[PATCH] staging: mt7621-pinctrl: stop using the deprecated 'pinctrl_add_gpio_range'

2020-12-06 Thread Sergio Paracuellos
If the gpio DT node has the 'gpio-ranges' property, the range will be
added by the gpio core and doesn't need to be added by the pinctrl
driver.

By having the gpio-ranges property, we can map every pin between
gpio node and pinctrl node and we can stop using the deprecated
pinctrl_add_gpio_range() function.

Signed-off-by: Sergio Paracuellos 
---
 drivers/staging/mt7621-dts/mt7621.dtsi|  1 +
 .../staging/mt7621-pinctrl/pinctrl-rt2880.c   | 29 ---
 2 files changed, 1 insertion(+), 29 deletions(-)

diff --git a/drivers/staging/mt7621-dts/mt7621.dtsi 
b/drivers/staging/mt7621-dts/mt7621.dtsi
index 82aa93634eda..5b9d3bf82cb1 100644
--- a/drivers/staging/mt7621-dts/mt7621.dtsi
+++ b/drivers/staging/mt7621-dts/mt7621.dtsi
@@ -90,6 +90,7 @@ gpio: gpio@600 {
#interrupt-cells = <2>;
compatible = "mediatek,mt7621-gpio";
gpio-controller;
+   gpio-ranges = <&pinctrl 0 0 95>;
interrupt-controller;
reg = <0x600 0x100>;
interrupt-parent = <&gic>;
diff --git a/drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c 
b/drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c
index caaf9e34f1ee..e61dbe186bc9 100644
--- a/drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c
+++ b/drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c
@@ -318,7 +318,6 @@ static int rt2880_pinmux_probe(struct platform_device *pdev)
 {
struct rt2880_priv *p;
struct pinctrl_dev *dev;
-   struct device_node *np;
 
if (!rt2880_pinmux_data)
return -ENOTSUPP;
@@ -346,34 +345,6 @@ static int rt2880_pinmux_probe(struct platform_device 
*pdev)
if (IS_ERR(dev))
return PTR_ERR(dev);
 
-   /* finalize by adding gpio ranges for enables gpio controllers */
-   for_each_compatible_node(np, NULL, "ralink,rt2880-gpio") {
-   const __be32 *ngpio, *gpiobase;
-   struct pinctrl_gpio_range *range;
-
-   if (!of_device_is_available(np))
-   continue;
-
-   ngpio = of_get_property(np, "ralink,num-gpios", NULL);
-   gpiobase = of_get_property(np, "ralink,gpio-base", NULL);
-   if (!ngpio || !gpiobase) {
-   dev_err(&pdev->dev, "failed to load chip info\n");
-   of_node_put(np);
-   return -EINVAL;
-   }
-
-   range = devm_kzalloc(p->dev, sizeof(*range), GFP_KERNEL);
-   if (!range) {
-   of_node_put(np);
-   return -ENOMEM;
-   }
-   range->name = "pio";
-   range->npins = __be32_to_cpu(*ngpio);
-   range->base = __be32_to_cpu(*gpiobase);
-   range->pin_base = range->base;
-   pinctrl_add_gpio_range(dev, range);
-   }
-
return 0;
 }
 
-- 
2.25.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: rtl8712: check register_netdev() return value

2020-12-06 Thread Greg KH
On Sun, Dec 06, 2020 at 11:59:07PM +0800, shaojie.d...@isrc.iscas.ac.cn wrote:
> From: "shaojie.dong" 
> 
> Function register_netdev() can fail, so we should check it's return value

You just check it, you are not doing anything with it, which is just the
same as not checking this.

Please fix this properly.

thanks,

greg k-h
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: rtl8712: check register_netdev() return value

2020-12-06 Thread shaojie . dong
From: "shaojie.dong" 

Function register_netdev() can fail, so we should check it's return value

Signed-off-by: shaojie.dong 
---
 drivers/staging/rtl8712/hal_init.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8712/hal_init.c 
b/drivers/staging/rtl8712/hal_init.c
index 715f1fe8b..fbcc6de1b 100644
--- a/drivers/staging/rtl8712/hal_init.c
+++ b/drivers/staging/rtl8712/hal_init.c
@@ -45,7 +45,8 @@ static void rtl871x_load_fw_cb(const struct firmware 
*firmware, void *context)
}
adapter->fw = firmware;
/* firmware available - start netdev */
-   register_netdev(adapter->pnetdev);
+   if (register_netdev(adapter->pnetdev) != 0)
+   dev_err(&udev->dev, "r8712u: register_netdev() failed\n");
complete(&adapter->rtl8712_fw_ready);
 }
 
-- 
2.17.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: rtl8712: check register_netdev() return value

2020-12-06 Thread kernel test robot
Hi,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on staging/staging-testing]

url:
https://github.com/0day-ci/linux/commits/shaojie-dong-isrc-iscas-ac-cn/staging-rtl8712-check-register_netdev-return-value/20201207-000540
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git 
138f3e1265488a9163be7f379073297ba8545cca
config: arc-allmodconfig (attached as .config)
compiler: arceb-elf-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
# 
https://github.com/0day-ci/linux/commit/a5d44fc70b0f1b3d0a23e3c3bab16a04e4352ad2
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review 
shaojie-dong-isrc-iscas-ac-cn/staging-rtl8712-check-register_netdev-return-value/20201207-000540
git checkout a5d44fc70b0f1b3d0a23e3c3bab16a04e4352ad2
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=arc 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot 

All errors (new ones prefixed by >>):

   In file included from include/linux/device.h:15,
from include/linux/usb/ch9.h:36,
from include/linux/usb.h:6,
from drivers/staging/rtl8712/hal_init.c:19:
   drivers/staging/rtl8712/hal_init.c: In function 'rtl871x_load_fw_cb':
>> drivers/staging/rtl8712/hal_init.c:49:12: error: 'udev' undeclared (first 
>> use in this function); did you mean 'cdev'?
  49 |   dev_err(&udev->dev, "r8712u: register_netdev() failed\n");
 |^~~~
   include/linux/dev_printk.h:112:11: note: in definition of macro 'dev_err'
 112 |  _dev_err(dev, dev_fmt(fmt), ##__VA_ARGS__)
 |   ^~~
   drivers/staging/rtl8712/hal_init.c:49:12: note: each undeclared identifier 
is reported only once for each function it appears in
  49 |   dev_err(&udev->dev, "r8712u: register_netdev() failed\n");
 |^~~~
   include/linux/dev_printk.h:112:11: note: in definition of macro 'dev_err'
 112 |  _dev_err(dev, dev_fmt(fmt), ##__VA_ARGS__)
 |   ^~~

vim +49 drivers/staging/rtl8712/hal_init.c

31  
32  static void rtl871x_load_fw_cb(const struct firmware *firmware, void 
*context)
33  {
34  struct _adapter *adapter = context;
35  
36  if (!firmware) {
37  struct usb_device *udev = adapter->dvobjpriv.pusbdev;
38  struct usb_interface *usb_intf = adapter->pusb_intf;
39  
40  dev_err(&udev->dev, "r8712u: Firmware request 
failed\n");
41  usb_put_dev(udev);
42  usb_set_intfdata(usb_intf, NULL);
43  complete(&adapter->rtl8712_fw_ready);
44  return;
45  }
46  adapter->fw = firmware;
47  /* firmware available - start netdev */
48  if (register_netdev(adapter->pnetdev) != 0)
  > 49  dev_err(&udev->dev, "r8712u: register_netdev() 
failed\n");
50  complete(&adapter->rtl8712_fw_ready);
51  }
52  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-...@lists.01.org


.config.gz
Description: application/gzip
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging:hantro: Fixed "replace comma with semicolon" Warning:

2020-12-06 Thread Philipp Zabel
Hi Travis,

On Fri, 2020-12-04 at 17:51 -0600, Travis Carter wrote:
> Corrected the following Warning:
> drivers/staging/media/hantro/hantro_v4l2.c:319: WARNING: Possible comma where 
> semicolon could be used
> 
> Signed-off-by: Travis Carter 
> ---
>  drivers/staging/media/hantro/hantro_v4l2.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/media/hantro/hantro_v4l2.c 
> b/drivers/staging/media/hantro/hantro_v4l2.c
> index b668a82d40ad..e1081c16f56a 100644
> --- a/drivers/staging/media/hantro/hantro_v4l2.c
> +++ b/drivers/staging/media/hantro/hantro_v4l2.c
> @@ -316,7 +316,7 @@ hantro_reset_fmt(struct v4l2_pix_format_mplane *fmt,
>  
>   fmt->pixelformat = vpu_fmt->fourcc;
>   fmt->field = V4L2_FIELD_NONE;
> - fmt->colorspace = V4L2_COLORSPACE_JPEG,
> + fmt->colorspace = V4L2_COLORSPACE_JPEG;
>   fmt->ycbcr_enc = V4L2_YCBCR_ENC_DEFAULT;
>   fmt->quantization = V4L2_QUANTIZATION_DEFAULT;
>   fmt->xfer_func = V4L2_XFER_FUNC_DEFAULT;

Thank you,

Reviewed-by: Philipp Zabel 

regards
Philipp
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel