* [PATCH v1 0/6] gpio: ge: fixes and cleanups
@ 2023-07-24 16:13 Andy Shevchenko
2023-07-24 16:13 ` [PATCH v1 1/6] gpio: ge: Add missing header Andy Shevchenko
` (7 more replies)
0 siblings, 8 replies; 10+ messages in thread
From: Andy Shevchenko @ 2023-07-24 16:13 UTC (permalink / raw)
To: Bartosz Golaszewski, Andy Shevchenko, linux-gpio, linux-kernel
Cc: Linus Walleij, Bartosz Golaszewski, Andy Shevchenko
Randy reported a couple of problems, the first two patches
fix that. On top are a few cleanups.
Andy Shevchenko (6):
gpio: ge: Add missing header
gpio: ge: Fix English spelling and grammar
gpio: ge: Make driver OF-independent
gpio: ge: Utilise temporary variable for struct device
gpio: ge: Replace GPLv2 boilerplate with SPDX
gpio: ge: Enable COMPILE_TEST for the driver
drivers/gpio/Kconfig | 2 +-
drivers/gpio/gpio-ge.c | 66 +++++++++++++++++++-----------------------
2 files changed, 30 insertions(+), 38 deletions(-)
--
2.40.0.1.gaa8946217a0b
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v1 1/6] gpio: ge: Add missing header
2023-07-24 16:13 [PATCH v1 0/6] gpio: ge: fixes and cleanups Andy Shevchenko
@ 2023-07-24 16:13 ` Andy Shevchenko
2023-07-26 18:05 ` Rob Herring
2023-07-24 16:13 ` [PATCH v1 2/6] gpio: ge: Fix English spelling and grammar Andy Shevchenko
` (6 subsequent siblings)
7 siblings, 1 reply; 10+ messages in thread
From: Andy Shevchenko @ 2023-07-24 16:13 UTC (permalink / raw)
To: Bartosz Golaszewski, Andy Shevchenko, linux-gpio, linux-kernel
Cc: Linus Walleij, Bartosz Golaszewski, Andy Shevchenko, Randy Dunlap
Add missing platform_device.h that used to be implied by of_device.h.
While at it, sort headers alphabetically for better maintenance.
Reported-by: Randy Dunlap <rdunlap@infradead.org>
Fixes: e91d0f05e66a ("gpio: Explicitly include correct DT includes")
Closes: https://lore.kernel.org/r/65b4ac1a-1128-6e2a-92c0-9bbcca4b760a@infradead.org
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/gpio/gpio-ge.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/drivers/gpio/gpio-ge.c b/drivers/gpio/gpio-ge.c
index 4eecbc862abc..ecadb81ce7f8 100644
--- a/drivers/gpio/gpio-ge.c
+++ b/drivers/gpio/gpio-ge.c
@@ -17,13 +17,14 @@
* the I/O interrupt controllers mask to stop them propergating
*/
-#include <linux/kernel.h>
+#include <linux/gpio/driver.h>
#include <linux/io.h>
-#include <linux/slab.h>
-#include <linux/of.h>
-#include <linux/of_address.h>
+#include <linux/kernel.h>
#include <linux/module.h>
-#include <linux/gpio/driver.h>
+#include <linux/of_address.h>
+#include <linux/of.h>
+#include <linux/platform_device.h>
+#include <linux/slab.h>
#define GEF_GPIO_DIRECT 0x00
#define GEF_GPIO_IN 0x04
--
2.40.0.1.gaa8946217a0b
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v1 2/6] gpio: ge: Fix English spelling and grammar
2023-07-24 16:13 [PATCH v1 0/6] gpio: ge: fixes and cleanups Andy Shevchenko
2023-07-24 16:13 ` [PATCH v1 1/6] gpio: ge: Add missing header Andy Shevchenko
@ 2023-07-24 16:13 ` Andy Shevchenko
2023-07-24 16:13 ` [PATCH v1 3/6] gpio: ge: Make driver OF-independent Andy Shevchenko
` (5 subsequent siblings)
7 siblings, 0 replies; 10+ messages in thread
From: Andy Shevchenko @ 2023-07-24 16:13 UTC (permalink / raw)
To: Bartosz Golaszewski, Andy Shevchenko, linux-gpio, linux-kernel
Cc: Linus Walleij, Bartosz Golaszewski, Andy Shevchenko, Randy Dunlap
Fix English spelling and grammar in the comments.
While at it, fix the MODULE_AUTHOR() email address format.
Reported-by: Randy Dunlap <rdunlap@infradead.org>
Closes: https://lore.kernel.org/r/65b4ac1a-1128-6e2a-92c0-9bbcca4b760a@infradead.org
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/gpio/gpio-ge.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/drivers/gpio/gpio-ge.c b/drivers/gpio/gpio-ge.c
index ecadb81ce7f8..f92b3c8a3a8a 100644
--- a/drivers/gpio/gpio-ge.c
+++ b/drivers/gpio/gpio-ge.c
@@ -10,11 +10,12 @@
* kind, whether express or implied.
*/
-/* TODO
+/*
+ * TODO:
*
- * Configuration of output modes (totem-pole/open-drain)
- * Interrupt configuration - interrupts are always generated the FPGA relies on
- * the I/O interrupt controllers mask to stop them propergating
+ * Configuration of output modes (totem-pole/open-drain).
+ * Interrupt configuration - interrupts are always generated, the FPGA relies
+ * on the I/O interrupt controllers mask to stop them from being propagated.
*/
#include <linux/gpio/driver.h>
@@ -104,5 +105,5 @@ static struct platform_driver gef_gpio_driver = {
module_platform_driver_probe(gef_gpio_driver, gef_gpio_probe);
MODULE_DESCRIPTION("GE I/O FPGA GPIO driver");
-MODULE_AUTHOR("Martyn Welch <martyn.welch@ge.com");
+MODULE_AUTHOR("Martyn Welch <martyn.welch@ge.com>");
MODULE_LICENSE("GPL");
--
2.40.0.1.gaa8946217a0b
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v1 3/6] gpio: ge: Make driver OF-independent
2023-07-24 16:13 [PATCH v1 0/6] gpio: ge: fixes and cleanups Andy Shevchenko
2023-07-24 16:13 ` [PATCH v1 1/6] gpio: ge: Add missing header Andy Shevchenko
2023-07-24 16:13 ` [PATCH v1 2/6] gpio: ge: Fix English spelling and grammar Andy Shevchenko
@ 2023-07-24 16:13 ` Andy Shevchenko
2023-07-24 16:13 ` [PATCH v1 4/6] gpio: ge: Utilise temporary variable for struct device Andy Shevchenko
` (4 subsequent siblings)
7 siblings, 0 replies; 10+ messages in thread
From: Andy Shevchenko @ 2023-07-24 16:13 UTC (permalink / raw)
To: Bartosz Golaszewski, Andy Shevchenko, linux-gpio, linux-kernel
Cc: Linus Walleij, Bartosz Golaszewski, Andy Shevchenko
There is nothing in the driver that requires OF APIs,
make the driver OF independent.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/gpio/gpio-ge.c | 33 +++++++++++++--------------------
1 file changed, 13 insertions(+), 20 deletions(-)
diff --git a/drivers/gpio/gpio-ge.c b/drivers/gpio/gpio-ge.c
index f92b3c8a3a8a..d019669048e6 100644
--- a/drivers/gpio/gpio-ge.c
+++ b/drivers/gpio/gpio-ge.c
@@ -21,10 +21,10 @@
#include <linux/gpio/driver.h>
#include <linux/io.h>
#include <linux/kernel.h>
+#include <linux/mod_devicetable.h>
#include <linux/module.h>
-#include <linux/of_address.h>
-#include <linux/of.h>
#include <linux/platform_device.h>
+#include <linux/property.h>
#include <linux/slab.h>
#define GEF_GPIO_DIRECT 0x00
@@ -54,6 +54,7 @@ MODULE_DEVICE_TABLE(of, gef_gpio_ids);
static int __init gef_gpio_probe(struct platform_device *pdev)
{
+ struct device *dev = &pdev->dev;
struct gpio_chip *gc;
void __iomem *regs;
int ret;
@@ -62,38 +63,30 @@ static int __init gef_gpio_probe(struct platform_device *pdev)
if (!gc)
return -ENOMEM;
- regs = of_iomap(pdev->dev.of_node, 0);
- if (!regs)
- return -ENOMEM;
+ regs = devm_platform_ioremap_resource(pdev, 0);
+ if (IS_ERR(regs))
+ return PTR_ERR(regs);
ret = bgpio_init(gc, &pdev->dev, 4, regs + GEF_GPIO_IN,
regs + GEF_GPIO_OUT, NULL, NULL,
regs + GEF_GPIO_DIRECT, BGPIOF_BIG_ENDIAN_BYTE_ORDER);
- if (ret) {
- dev_err(&pdev->dev, "bgpio_init failed\n");
- goto err0;
- }
+ if (ret)
+ return dev_err_probe(dev, ret, "bgpio_init failed\n");
/* Setup pointers to chip functions */
- gc->label = devm_kasprintf(&pdev->dev, GFP_KERNEL, "%pOF", pdev->dev.of_node);
- if (!gc->label) {
- ret = -ENOMEM;
- goto err0;
- }
+ gc->label = devm_kasprintf(dev, GFP_KERNEL, "%pfw", dev_fwnode(dev));
+ if (!gc->label)
+ return -ENOMEM;
gc->base = -1;
- gc->ngpio = (u16)(uintptr_t)of_device_get_match_data(&pdev->dev);
+ gc->ngpio = (uintptr_t)device_get_match_data(dev);
/* This function adds a memory mapped GPIO chip */
ret = devm_gpiochip_add_data(&pdev->dev, gc, NULL);
if (ret)
- goto err0;
+ return dev_err_probe(dev, ret, "GPIO chip registration failed\n");
return 0;
-err0:
- iounmap(regs);
- pr_err("%pOF: GPIO chip registration failed\n", pdev->dev.of_node);
- return ret;
};
static struct platform_driver gef_gpio_driver = {
--
2.40.0.1.gaa8946217a0b
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v1 4/6] gpio: ge: Utilise temporary variable for struct device
2023-07-24 16:13 [PATCH v1 0/6] gpio: ge: fixes and cleanups Andy Shevchenko
` (2 preceding siblings ...)
2023-07-24 16:13 ` [PATCH v1 3/6] gpio: ge: Make driver OF-independent Andy Shevchenko
@ 2023-07-24 16:13 ` Andy Shevchenko
2023-07-24 16:13 ` [PATCH v1 5/6] gpio: ge: Replace GPLv2 boilerplate with SPDX Andy Shevchenko
` (3 subsequent siblings)
7 siblings, 0 replies; 10+ messages in thread
From: Andy Shevchenko @ 2023-07-24 16:13 UTC (permalink / raw)
To: Bartosz Golaszewski, Andy Shevchenko, linux-gpio, linux-kernel
Cc: Linus Walleij, Bartosz Golaszewski, Andy Shevchenko
We have a temporary variable to keep pointer to struct device.
Utilise it inside the ->probe() implementation.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/gpio/gpio-ge.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/gpio/gpio-ge.c b/drivers/gpio/gpio-ge.c
index d019669048e6..268de5496fcb 100644
--- a/drivers/gpio/gpio-ge.c
+++ b/drivers/gpio/gpio-ge.c
@@ -59,7 +59,7 @@ static int __init gef_gpio_probe(struct platform_device *pdev)
void __iomem *regs;
int ret;
- gc = devm_kzalloc(&pdev->dev, sizeof(*gc), GFP_KERNEL);
+ gc = devm_kzalloc(dev, sizeof(*gc), GFP_KERNEL);
if (!gc)
return -ENOMEM;
@@ -67,9 +67,9 @@ static int __init gef_gpio_probe(struct platform_device *pdev)
if (IS_ERR(regs))
return PTR_ERR(regs);
- ret = bgpio_init(gc, &pdev->dev, 4, regs + GEF_GPIO_IN,
- regs + GEF_GPIO_OUT, NULL, NULL,
- regs + GEF_GPIO_DIRECT, BGPIOF_BIG_ENDIAN_BYTE_ORDER);
+ ret = bgpio_init(gc, dev, 4, regs + GEF_GPIO_IN, regs + GEF_GPIO_OUT,
+ NULL, NULL, regs + GEF_GPIO_DIRECT,
+ BGPIOF_BIG_ENDIAN_BYTE_ORDER);
if (ret)
return dev_err_probe(dev, ret, "bgpio_init failed\n");
@@ -82,7 +82,7 @@ static int __init gef_gpio_probe(struct platform_device *pdev)
gc->ngpio = (uintptr_t)device_get_match_data(dev);
/* This function adds a memory mapped GPIO chip */
- ret = devm_gpiochip_add_data(&pdev->dev, gc, NULL);
+ ret = devm_gpiochip_add_data(dev, gc, NULL);
if (ret)
return dev_err_probe(dev, ret, "GPIO chip registration failed\n");
--
2.40.0.1.gaa8946217a0b
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v1 5/6] gpio: ge: Replace GPLv2 boilerplate with SPDX
2023-07-24 16:13 [PATCH v1 0/6] gpio: ge: fixes and cleanups Andy Shevchenko
` (3 preceding siblings ...)
2023-07-24 16:13 ` [PATCH v1 4/6] gpio: ge: Utilise temporary variable for struct device Andy Shevchenko
@ 2023-07-24 16:13 ` Andy Shevchenko
2023-07-24 16:13 ` [PATCH v1 6/6] gpio: ge: Enable COMPILE_TEST for the driver Andy Shevchenko
` (2 subsequent siblings)
7 siblings, 0 replies; 10+ messages in thread
From: Andy Shevchenko @ 2023-07-24 16:13 UTC (permalink / raw)
To: Bartosz Golaszewski, Andy Shevchenko, linux-gpio, linux-kernel
Cc: Linus Walleij, Bartosz Golaszewski, Andy Shevchenko
Replace the GPLv2 boilerplate text with a nice and short
SPDX header.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/gpio/gpio-ge.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/gpio/gpio-ge.c b/drivers/gpio/gpio-ge.c
index 268de5496fcb..5dc49648d8e3 100644
--- a/drivers/gpio/gpio-ge.c
+++ b/drivers/gpio/gpio-ge.c
@@ -1,13 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0-only
/*
* Driver for GE FPGA based GPIO
*
* Author: Martyn Welch <martyn.welch@ge.com>
*
* 2008 (c) GE Intelligent Platforms Embedded Systems, Inc.
- *
- * This file is licensed under the terms of the GNU General Public License
- * version 2. This program is licensed "as is" without any warranty of any
- * kind, whether express or implied.
*/
/*
--
2.40.0.1.gaa8946217a0b
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v1 6/6] gpio: ge: Enable COMPILE_TEST for the driver
2023-07-24 16:13 [PATCH v1 0/6] gpio: ge: fixes and cleanups Andy Shevchenko
` (4 preceding siblings ...)
2023-07-24 16:13 ` [PATCH v1 5/6] gpio: ge: Replace GPLv2 boilerplate with SPDX Andy Shevchenko
@ 2023-07-24 16:13 ` Andy Shevchenko
2023-07-24 22:55 ` [PATCH v1 0/6] gpio: ge: fixes and cleanups Randy Dunlap
2023-07-27 7:33 ` Bartosz Golaszewski
7 siblings, 0 replies; 10+ messages in thread
From: Andy Shevchenko @ 2023-07-24 16:13 UTC (permalink / raw)
To: Bartosz Golaszewski, Andy Shevchenko, linux-gpio, linux-kernel
Cc: Linus Walleij, Bartosz Golaszewski, Andy Shevchenko
Driver is so simple, yet there was a room for mistakes.
Reduce their appearance in the future by enabling COMPILE_TEST
option.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/gpio/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
index 7d41f59d21d8..5981ad290c6e 100644
--- a/drivers/gpio/Kconfig
+++ b/drivers/gpio/Kconfig
@@ -282,7 +282,7 @@ config GPIO_EXAR
config GPIO_GE_FPGA
bool "GE FPGA based GPIO"
- depends on GE_FPGA
+ depends on GE_FPGA || COMPILE_TEST
select GPIO_GENERIC
help
Support for common GPIO functionality provided on some GE Single Board
--
2.40.0.1.gaa8946217a0b
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH v1 0/6] gpio: ge: fixes and cleanups
2023-07-24 16:13 [PATCH v1 0/6] gpio: ge: fixes and cleanups Andy Shevchenko
` (5 preceding siblings ...)
2023-07-24 16:13 ` [PATCH v1 6/6] gpio: ge: Enable COMPILE_TEST for the driver Andy Shevchenko
@ 2023-07-24 22:55 ` Randy Dunlap
2023-07-27 7:33 ` Bartosz Golaszewski
7 siblings, 0 replies; 10+ messages in thread
From: Randy Dunlap @ 2023-07-24 22:55 UTC (permalink / raw)
To: Andy Shevchenko, Bartosz Golaszewski, linux-gpio, linux-kernel
Cc: Linus Walleij, Bartosz Golaszewski, Andy Shevchenko
On 7/24/23 09:13, Andy Shevchenko wrote:
> Randy reported a couple of problems, the first two patches
> fix that. On top are a few cleanups.
>
For the series:
Acked-by: Randy Dunlap <rdunlap@infradead.org>
Tested-by: Randy Dunlap <rdunlap@infradead.org> # build-tested
Thanks.
> Andy Shevchenko (6):
> gpio: ge: Add missing header
> gpio: ge: Fix English spelling and grammar
> gpio: ge: Make driver OF-independent
> gpio: ge: Utilise temporary variable for struct device
> gpio: ge: Replace GPLv2 boilerplate with SPDX
> gpio: ge: Enable COMPILE_TEST for the driver
>
> drivers/gpio/Kconfig | 2 +-
> drivers/gpio/gpio-ge.c | 66 +++++++++++++++++++-----------------------
> 2 files changed, 30 insertions(+), 38 deletions(-)
>
--
~Randy
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v1 1/6] gpio: ge: Add missing header
2023-07-24 16:13 ` [PATCH v1 1/6] gpio: ge: Add missing header Andy Shevchenko
@ 2023-07-26 18:05 ` Rob Herring
0 siblings, 0 replies; 10+ messages in thread
From: Rob Herring @ 2023-07-26 18:05 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Bartosz Golaszewski, linux-gpio, linux-kernel, Linus Walleij,
Bartosz Golaszewski, Andy Shevchenko, Randy Dunlap
On Mon, Jul 24, 2023 at 07:13:15PM +0300, Andy Shevchenko wrote:
> Add missing platform_device.h that used to be implied by of_device.h.
>
> While at it, sort headers alphabetically for better maintenance.
>
> Reported-by: Randy Dunlap <rdunlap@infradead.org>
> Fixes: e91d0f05e66a ("gpio: Explicitly include correct DT includes")
> Closes: https://lore.kernel.org/r/65b4ac1a-1128-6e2a-92c0-9bbcca4b760a@infradead.org
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
> drivers/gpio/gpio-ge.c | 11 ++++++-----
> 1 file changed, 6 insertions(+), 5 deletions(-)
Thanks for fixing.
Reviewed-by: Rob Herring <robh@kernel.org>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v1 0/6] gpio: ge: fixes and cleanups
2023-07-24 16:13 [PATCH v1 0/6] gpio: ge: fixes and cleanups Andy Shevchenko
` (6 preceding siblings ...)
2023-07-24 22:55 ` [PATCH v1 0/6] gpio: ge: fixes and cleanups Randy Dunlap
@ 2023-07-27 7:33 ` Bartosz Golaszewski
7 siblings, 0 replies; 10+ messages in thread
From: Bartosz Golaszewski @ 2023-07-27 7:33 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Bartosz Golaszewski, linux-gpio, linux-kernel, Linus Walleij,
Andy Shevchenko
On Mon, Jul 24, 2023 at 6:13 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> Randy reported a couple of problems, the first two patches
> fix that. On top are a few cleanups.
>
> Andy Shevchenko (6):
> gpio: ge: Add missing header
> gpio: ge: Fix English spelling and grammar
> gpio: ge: Make driver OF-independent
> gpio: ge: Utilise temporary variable for struct device
> gpio: ge: Replace GPLv2 boilerplate with SPDX
> gpio: ge: Enable COMPILE_TEST for the driver
>
> drivers/gpio/Kconfig | 2 +-
> drivers/gpio/gpio-ge.c | 66 +++++++++++++++++++-----------------------
> 2 files changed, 30 insertions(+), 38 deletions(-)
>
> --
> 2.40.0.1.gaa8946217a0b
>
Sweet! Applied the entire thing.
Bart
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2023-07-27 7:40 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-24 16:13 [PATCH v1 0/6] gpio: ge: fixes and cleanups Andy Shevchenko
2023-07-24 16:13 ` [PATCH v1 1/6] gpio: ge: Add missing header Andy Shevchenko
2023-07-26 18:05 ` Rob Herring
2023-07-24 16:13 ` [PATCH v1 2/6] gpio: ge: Fix English spelling and grammar Andy Shevchenko
2023-07-24 16:13 ` [PATCH v1 3/6] gpio: ge: Make driver OF-independent Andy Shevchenko
2023-07-24 16:13 ` [PATCH v1 4/6] gpio: ge: Utilise temporary variable for struct device Andy Shevchenko
2023-07-24 16:13 ` [PATCH v1 5/6] gpio: ge: Replace GPLv2 boilerplate with SPDX Andy Shevchenko
2023-07-24 16:13 ` [PATCH v1 6/6] gpio: ge: Enable COMPILE_TEST for the driver Andy Shevchenko
2023-07-24 22:55 ` [PATCH v1 0/6] gpio: ge: fixes and cleanups Randy Dunlap
2023-07-27 7:33 ` Bartosz Golaszewski
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.