gpio: stmpe: A few cleanups
cover gpio: stmpe: A few cleanups
A few ad-hoc cleanups inducted by the recent patch that made an (insignificant) typo in one message.
Andy Shevchenko (5):
gpio: stmpe: Fix IRQ related error messages
gpio: stmpe: Remove unused 'dev' member of struct stmpe_gpio
gpio: stmpe: Utilise temporary variable for struct device
gpio: stmpe: Make use of device properties
gpio: stmpe: Sort headers
drivers/gpio/gpio-stmpe.c | 52 ++++++++++++++++----------------------- 1 file changed, 21 insertions(+), 31 deletions(-)
Signature · 1 line
2.43.0.rc1.1336.g36b5255a03ac
PATCH 1/5 gpio: stmpe: Fix IRQ related error messages
First of all, remove duplicate message that platform_get_irq() does already print. Second, correct the error message when unable to register a handler, which is broken in two ways:
1) the misleading 'get' vs. 'register';
2) missing '\n' at the end.
(Yes, for the curious ones, the dev_*() cases do not require '\n' and issue it automatically, but it's better to have them explicit)
Fix all this here.
--- drivers/gpio/gpio-stmpe.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)
drivers/gpio/gpio-stmpe.c +3 -8
@@ -464,6 +464,7 @@ static void stmpe_gpio_disable(void *stmpe)static int stmpe_gpio_probe (struct platform_device *pdev) { +struct device *dev = &pdev->dev;struct stmpe *stmpe =dev_get_drvdata (pdev->dev.parent);struct device_node *np = pdev->dev.of_node;struct stmpe_gpio *stmpe_gpio;
@@ -493,12 +494,6 @@ static int stmpe_gpio_probe(struct platform_device *pdev)of_property_read_u32 (np,"st,norequest-mask" , &stmpe_gpio->norequest_mask); - irq =platform_get_irq (pdev,0 ); -if (irq <0 ) -dev_info (&pdev->dev, -"device configured in no-irq mode: " -"irqs are not available\n" ); - ret =stmpe_enable (stmpe,STMPE_BLOCK_GPIO );if (ret)return ret;
@@ -507,6 +502,7 @@ static int stmpe_gpio_probe(struct platform_device *pdev)if (ret)return ret; + irq =platform_get_irq (pdev,0 );if (irq >0 ) {struct gpio_irq_chip *girq;
@@ -514,8 +510,7 @@ static int stmpe_gpio_probe(struct platform_device *pdev) stmpe_gpio_irq,IRQF_ONESHOT , "stmpe-gpio", stmpe_gpio);if (ret) -return dev_err_probe (&pdev->dev, ret, -"unable to get irq" ); +return dev_err_probe (dev, ret,"unable to register IRQ handler\n" ); girq = &stmpe_gpio->chip.irq;gpio_irq_chip_set_chip (girq, &stmpe_gpio_irq_chip);
Signature · 1 line
2.43.0.rc1.1336.g36b5255a03ac
Re: [PATCH v1 1/5] gpio: stmpe: Fix IRQ related error messages
Quoted 6 lines · Andy Shevchenko
First of all, remove duplicate message that
platform_get_irq()does already print. Second, correct the error message when unable to register a handler, which is broken in two ways:
1) the misleading 'get' vs. 'register';
2) missing '\n' at the end.
Quoted 7 lines
(Yes, for the curious ones, the dev_*() cases do not require '\n' and issue it automatically, but it's better to have them explicit)
Fix all this here.
Fixes 1882e769362b ("gpio: stmpe: Simplify with dev_err_probe()")Signed-off-by Andy Shevchenko <[email protected]>
Yours,
Linus Walleij
PATCH 2/5 gpio: stmpe: Remove unused 'dev' member of struct stmpe_gpio
In reply to Andy ShevchenkoThere is no evidence that the 'dev' member of struct stmpe_gpio is used, drop it.
--- drivers/gpio/gpio-stmpe.c | 2 -- 1 file changed, 2 deletions(-)
drivers/gpio/gpio-stmpe.c +0 -2
@@ -31,7 +31,6 @@ enum { LSB, CSB, MSB };struct stmpe_gpio {struct gpio_chip chip;struct stmpe *stmpe; -struct device *dev;struct mutex irq_lock;u32 norequest_mask;/* Caches of interrupt control registers for bus_lock */
@@ -481,7 +480,6 @@ static int stmpe_gpio_probe(struct platform_device *pdev)mutex_init (&stmpe_gpio->irq_lock); - stmpe_gpio->dev = &pdev->dev; stmpe_gpio->stmpe = stmpe; stmpe_gpio->chip = template_chip; stmpe_gpio->chip.ngpio = stmpe->num_gpios;
Signature · 1 line
2.43.0.rc1.1336.g36b5255a03ac
Re: [PATCH v1 2/5] gpio: stmpe: Remove unused 'dev' member of struct stmpe_gpio
Quoted 4 lines · Andy Shevchenko
There is no evidence that the 'dev' member of struct
stmpe_gpiois used, drop it.Signed-off-by Andy Shevchenko <[email protected]>
Yours,
Linus Walleij
PATCH 3/5 gpio: stmpe: Utilise temporary variable for struct device
In reply to Andy ShevchenkoWe have a temporary variable to keep a pointer to struct device. Utilise it where it makes sense.
--- drivers/gpio/gpio-stmpe.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-)
drivers/gpio/gpio-stmpe.c +9 -10
@@ -464,17 +464,17 @@ static void stmpe_gpio_disable(void *stmpe)static int stmpe_gpio_probe (struct platform_device *pdev) {struct device *dev = &pdev->dev; -struct stmpe *stmpe =dev_get_drvdata (pdev->dev.parent); -struct device_node *np = pdev->dev.of_node; +struct stmpe *stmpe =dev_get_drvdata (dev->parent); +struct device_node *np = dev->of_node;struct stmpe_gpio *stmpe_gpio;int ret, irq;if (stmpe->num_gpios >MAX_GPIOS ) { -dev_err (&pdev->dev,"Need to increase maximum GPIO number\n" ); +dev_err (dev,"Need to increase maximum GPIO number\n" );return -EINVAL ; } - stmpe_gpio =devm_kzalloc (&pdev->dev,sizeof (*stmpe_gpio),GFP_KERNEL ); + stmpe_gpio =devm_kzalloc (dev,sizeof (*stmpe_gpio),GFP_KERNEL );if (!stmpe_gpio)return -ENOMEM ;
@@ -483,7 +483,7 @@ static int stmpe_gpio_probe(struct platform_device *pdev) stmpe_gpio->stmpe = stmpe; stmpe_gpio->chip = template_chip; stmpe_gpio->chip.ngpio = stmpe->num_gpios; - stmpe_gpio->chip.parent = &pdev->dev; + stmpe_gpio->chip.parent = dev; stmpe_gpio->chip.base =-1 ;if (IS_ENABLED (CONFIG_DEBUG_FS ))
@@ -496,7 +496,7 @@ static int stmpe_gpio_probe(struct platform_device *pdev)if (ret)return ret; - ret =devm_add_action_or_reset (&pdev->dev, stmpe_gpio_disable, stmpe); + ret =devm_add_action_or_reset (dev, stmpe_gpio_disable, stmpe);if (ret)return ret;
@@ -504,9 +504,8 @@ static int stmpe_gpio_probe(struct platform_device *pdev)if (irq >0 ) {struct gpio_irq_chip *girq; - ret =devm_request_threaded_irq (&pdev->dev, irq,NULL , - stmpe_gpio_irq,IRQF_ONESHOT , -"stmpe-gpio" , stmpe_gpio); + ret =devm_request_threaded_irq (dev, irq,NULL , stmpe_gpio_irq, +IRQF_ONESHOT ,"stmpe-gpio" , stmpe_gpio);if (ret)return dev_err_probe (dev, ret,"unable to register IRQ handler\n" );
@@ -522,7 +521,7 @@ static int stmpe_gpio_probe(struct platform_device *pdev) girq->init_valid_mask = stmpe_init_irq_valid_mask; } -return devm_gpiochip_add_data (&pdev->dev, &stmpe_gpio->chip, stmpe_gpio); +return devm_gpiochip_add_data (dev, &stmpe_gpio->chip, stmpe_gpio); }static struct platform_driver stmpe_gpio_driver = {
Signature · 1 line
2.43.0.rc1.1336.g36b5255a03ac
Re: [PATCH v1 3/5] gpio: stmpe: Utilise temporary variable for struct device
Quoted 4 lines · Andy Shevchenko
We have a temporary variable to keep a pointer to struct device. Utilise it where it makes sense.
Signed-off-by Andy Shevchenko <[email protected]>
Yours,
Linus Walleij
PATCH 4/5 gpio: stmpe: Make use of device properties
In reply to Andy ShevchenkoConvert the module to be property provider agnostic and allow it to be used on non-OF platforms.
--- drivers/gpio/gpio-stmpe.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/gpio/gpio-stmpe.c +2 -4
@@ -11,8 +11,8 @@#include <linux/slab.h> #include <linux/gpio/driver.h> #include <linux/interrupt.h> -#include <linux/of.h> #include <linux/mfd/stmpe.h> +#include <linux/property.h> #include <linux/seq_file.h> #include <linux/bitops.h>
@@ -465,7 +465,6 @@ static int stmpe_gpio_probe(struct platform_device *pdev) {struct device *dev = &pdev->dev;struct stmpe *stmpe =dev_get_drvdata (dev->parent); -struct device_node *np = dev->of_node;struct stmpe_gpio *stmpe_gpio;int ret, irq;
@@ -489,8 +488,7 @@ static int stmpe_gpio_probe(struct platform_device *pdev)if (IS_ENABLED (CONFIG_DEBUG_FS )) stmpe_gpio->chip.dbg_show = stmpe_dbg_show; -of_property_read_u32 (np,"st,norequest-mask" , - &stmpe_gpio->norequest_mask); +device_property_read_u32 (dev,"st,norequest-mask" , &stmpe_gpio->norequest_mask); ret =stmpe_enable (stmpe,STMPE_BLOCK_GPIO );if (ret)
Signature · 1 line
2.43.0.rc1.1336.g36b5255a03ac
Re: [PATCH v1 4/5] gpio: stmpe: Make use of device properties
Quoted 4 lines · Andy Shevchenko
Convert the module to be property provider agnostic and allow it to be used on non-OF platforms.
Signed-off-by Andy Shevchenko <[email protected]>
Yours,
Linus Walleij
PATCH 5/5 gpio: stmpe: Sort headers
In reply to Andy ShevchenkoSort the headers in alphabetic order in order to ease the maintenance for this part.
--- drivers/gpio/gpio-stmpe.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpio/gpio-stmpe.c +4 -4
@@ -5,16 +5,16 @@* Author: Rabin Vincent <[email protected]> for ST-Ericsson */ +#include <linux/bitops.h> #include <linux/cleanup.h> -#include <linux/init.h> -#include <linux/platform_device.h> -#include <linux/slab.h> #include <linux/gpio/driver.h> +#include <linux/init.h> #include <linux/interrupt.h> #include <linux/mfd/stmpe.h> #include <linux/property.h> +#include <linux/platform_device.h> #include <linux/seq_file.h> -#include <linux/bitops.h> +#include <linux/slab.h> /* * These registers are modified under the irq bus lock and cached to avoid
Signature · 1 line
2.43.0.rc1.1336.g36b5255a03ac
Re: [PATCH v1 5/5] gpio: stmpe: Sort headers
Quoted 4 lines · Andy Shevchenko
Sort the headers in alphabetic order in order to ease the maintenance for this part.
Signed-off-by Andy Shevchenko <[email protected]>
Yours,
Linus Walleij
Bartosz Golaszewski
AppliedFrom: Bartosz Golaszewski <[email protected]>
Quoted 11 lines · Andy Shevchenko
A few ad-hoc cleanups inducted by the recent patch that made an (insignificant) typo in one message.
Andy Shevchenko (5):
gpio: stmpe: Fix IRQ related error messages
gpio: stmpe: Remove unused 'dev' member of structstmpe_gpio
gpio: stmpe: Utilise temporary variable for struct device
gpio: stmpe: Make use of device properties
gpio: stmpe: Sort headers[...]
Applied, thanks!
[1/5] gpio: stmpe: Fix IRQ related error messages
commit: a794331325f143bd010a91aa078547fee7fe907e
[2/5] gpio: stmpe: Remove unused 'dev' member of struct stmpe_gpio
commit: c028e1c5a414f03cd849912073db7c1927ec8d89
[3/5] gpio: stmpe: Utilise temporary variable for struct device
commit: 56f534dde6ff41eaf71f4e368953cb8da54cecc3
[4/5] gpio: stmpe: Make use of device properties
commit: e6815a05c0c909c8d6396bf41d0c06bc967f37bc
[5/5] gpio: stmpe: Sort headers
commit: 9f0127b9cea593a661004df948dc0b4479081c2eBest regards,
Signature · 1 line
Bartosz Golaszewski <[email protected]>