Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

gpio: imx-scu: Use ARRAY_SIZE for array length

Use of macro ARRAY_SIZE to calculate array size minimizes
the redundant code and improves code reusability.
This fixes warnings reported by Coccinelle:
drivers/gpio/gpio-imx-scu.c:106:32-33: WARNING: Use ARRAY_SIZE

Signed-off-by: Rajeshwar R Shinde <coolrrsh@gmail.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>

authored by

Rajeshwar R Shinde and committed by
Bartosz Golaszewski
a0e3b8e2 0988ffa0

+2 -1
+2 -1
drivers/gpio/gpio-imx-scu.c
··· 6 6 * to control the PIN resources on SCU domain. 7 7 */ 8 8 9 + #include <linux/kernel.h> 9 10 #include <linux/module.h> 10 11 #include <linux/gpio/driver.h> 11 12 #include <linux/platform_device.h> ··· 104 103 gc = &priv->chip; 105 104 gc->base = -1; 106 105 gc->parent = dev; 107 - gc->ngpio = sizeof(scu_rsrc_arr)/sizeof(unsigned int); 106 + gc->ngpio = ARRAY_SIZE(scu_rsrc_arr); 108 107 gc->label = dev_name(dev); 109 108 gc->get = imx_scu_gpio_get; 110 109 gc->set = imx_scu_gpio_set;