linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] gpio: xilinx: drop dependency on GPIO_OF
@ 2024-09-30 14:48 Bartosz Golaszewski
  2024-09-30 14:48 ` [PATCH 2/3] gpio: xilinx: use helper variable to store the address of pdev->dev Bartosz Golaszewski
                   ` (3 more replies)
  0 siblings, 4 replies; 13+ messages in thread
From: Bartosz Golaszewski @ 2024-09-30 14:48 UTC (permalink / raw)
  To: Linus Walleij, Shubhrajyoti Datta, Srinivas Neeli, Michal Simek
  Cc: linux-gpio, linux-kernel, linux-arm-kernel, Bartosz Golaszewski

From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>

This driver doesn't really depend on gpiolib-of being built and can be
compiled without it.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
 drivers/gpio/Kconfig | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
index d93cd4f722b4..0d676c96b72d 100644
--- a/drivers/gpio/Kconfig
+++ b/drivers/gpio/Kconfig
@@ -796,7 +796,6 @@ config GPIO_XGENE_SB
 config GPIO_XILINX
 	tristate "Xilinx GPIO support"
 	select GPIOLIB_IRQCHIP
-	depends on OF_GPIO
 	help
 	  Say yes here to support the Xilinx FPGA GPIO device.
 
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 2/3] gpio: xilinx: use helper variable to store the address of pdev->dev
  2024-09-30 14:48 [PATCH 1/3] gpio: xilinx: drop dependency on GPIO_OF Bartosz Golaszewski
@ 2024-09-30 14:48 ` Bartosz Golaszewski
  2024-10-01 10:28   ` Michal Simek
  2024-10-02 13:19   ` Linus Walleij
  2024-09-30 14:48 ` [PATCH 3/3] gpio: xilinx: use generic device properties Bartosz Golaszewski
                   ` (2 subsequent siblings)
  3 siblings, 2 replies; 13+ messages in thread
From: Bartosz Golaszewski @ 2024-09-30 14:48 UTC (permalink / raw)
  To: Linus Walleij, Shubhrajyoti Datta, Srinivas Neeli, Michal Simek
  Cc: linux-gpio, linux-kernel, linux-arm-kernel, Bartosz Golaszewski

From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>

For better readability don't repeatedly dereference pdev->dev but
instead store the address of the embedded struct device in a local
variable in probe().

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
 drivers/gpio/gpio-xilinx.c | 34 +++++++++++++++++-----------------
 1 file changed, 17 insertions(+), 17 deletions(-)

diff --git a/drivers/gpio/gpio-xilinx.c b/drivers/gpio/gpio-xilinx.c
index afcf432a1573..d99824d42c77 100644
--- a/drivers/gpio/gpio-xilinx.c
+++ b/drivers/gpio/gpio-xilinx.c
@@ -561,9 +561,10 @@ static const struct irq_chip xgpio_irq_chip = {
  */
 static int xgpio_probe(struct platform_device *pdev)
 {
+	struct device *dev = &pdev->dev;
 	struct xgpio_instance *chip;
 	int status = 0;
-	struct device_node *np = pdev->dev.of_node;
+	struct device_node *np = dev->of_node;
 	u32 is_dual = 0;
 	u32 width[2];
 	u32 state[2];
@@ -571,7 +572,7 @@ static int xgpio_probe(struct platform_device *pdev)
 	struct gpio_irq_chip *girq;
 	u32 temp;
 
-	chip = devm_kzalloc(&pdev->dev, sizeof(*chip), GFP_KERNEL);
+	chip = devm_kzalloc(dev, sizeof(*chip), GFP_KERNEL);
 	if (!chip)
 		return -ENOMEM;
 
@@ -624,7 +625,7 @@ static int xgpio_probe(struct platform_device *pdev)
 
 	chip->gc.base = -1;
 	chip->gc.ngpio = bitmap_weight(chip->hw_map, 64);
-	chip->gc.parent = &pdev->dev;
+	chip->gc.parent = dev;
 	chip->gc.direction_input = xgpio_dir_in;
 	chip->gc.direction_output = xgpio_dir_out;
 	chip->gc.get = xgpio_get;
@@ -633,21 +634,21 @@ static int xgpio_probe(struct platform_device *pdev)
 	chip->gc.free = xgpio_free;
 	chip->gc.set_multiple = xgpio_set_multiple;
 
-	chip->gc.label = dev_name(&pdev->dev);
+	chip->gc.label = dev_name(dev);
 
 	chip->regs = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(chip->regs)) {
-		dev_err(&pdev->dev, "failed to ioremap memory resource\n");
+		dev_err(dev, "failed to ioremap memory resource\n");
 		return PTR_ERR(chip->regs);
 	}
 
-	chip->clk = devm_clk_get_optional_enabled(&pdev->dev, NULL);
+	chip->clk = devm_clk_get_optional_enabled(dev, NULL);
 	if (IS_ERR(chip->clk))
-		return dev_err_probe(&pdev->dev, PTR_ERR(chip->clk), "input clock not found.\n");
+		return dev_err_probe(dev, PTR_ERR(chip->clk), "input clock not found.\n");
 
-	pm_runtime_get_noresume(&pdev->dev);
-	pm_runtime_set_active(&pdev->dev);
-	pm_runtime_enable(&pdev->dev);
+	pm_runtime_get_noresume(dev);
+	pm_runtime_set_active(dev);
+	pm_runtime_enable(dev);
 
 	xgpio_save_regs(chip);
 
@@ -667,8 +668,7 @@ static int xgpio_probe(struct platform_device *pdev)
 	gpio_irq_chip_set_chip(girq, &xgpio_irq_chip);
 	girq->parent_handler = xgpio_irqhandler;
 	girq->num_parents = 1;
-	girq->parents = devm_kcalloc(&pdev->dev, 1,
-				     sizeof(*girq->parents),
+	girq->parents = devm_kcalloc(dev, 1, sizeof(*girq->parents),
 				     GFP_KERNEL);
 	if (!girq->parents) {
 		status = -ENOMEM;
@@ -679,18 +679,18 @@ static int xgpio_probe(struct platform_device *pdev)
 	girq->handler = handle_bad_irq;
 
 skip_irq:
-	status = devm_gpiochip_add_data(&pdev->dev, &chip->gc, chip);
+	status = devm_gpiochip_add_data(dev, &chip->gc, chip);
 	if (status) {
-		dev_err(&pdev->dev, "failed to add GPIO chip\n");
+		dev_err(dev, "failed to add GPIO chip\n");
 		goto err_pm_put;
 	}
 
-	pm_runtime_put(&pdev->dev);
+	pm_runtime_put(dev);
 	return 0;
 
 err_pm_put:
-	pm_runtime_disable(&pdev->dev);
-	pm_runtime_put_noidle(&pdev->dev);
+	pm_runtime_disable(dev);
+	pm_runtime_put_noidle(dev);
 	return status;
 }
 
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 3/3] gpio: xilinx: use generic device properties
  2024-09-30 14:48 [PATCH 1/3] gpio: xilinx: drop dependency on GPIO_OF Bartosz Golaszewski
  2024-09-30 14:48 ` [PATCH 2/3] gpio: xilinx: use helper variable to store the address of pdev->dev Bartosz Golaszewski
@ 2024-09-30 14:48 ` Bartosz Golaszewski
  2024-10-01 10:29   ` Michal Simek
  2024-10-02 13:20   ` Linus Walleij
  2024-10-01 10:30 ` [PATCH 1/3] gpio: xilinx: drop dependency on GPIO_OF Michal Simek
  2024-10-08  8:18 ` Bartosz Golaszewski
  3 siblings, 2 replies; 13+ messages in thread
From: Bartosz Golaszewski @ 2024-09-30 14:48 UTC (permalink / raw)
  To: Linus Walleij, Shubhrajyoti Datta, Srinivas Neeli, Michal Simek
  Cc: linux-gpio, linux-kernel, linux-arm-kernel, Bartosz Golaszewski

From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>

OF-specific routines should not be used unless necessary. Generic device
properties are preferred so switch to using them in the driver code.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
 drivers/gpio/gpio-xilinx.c | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/drivers/gpio/gpio-xilinx.c b/drivers/gpio/gpio-xilinx.c
index d99824d42c77..41c552a58059 100644
--- a/drivers/gpio/gpio-xilinx.c
+++ b/drivers/gpio/gpio-xilinx.c
@@ -15,7 +15,6 @@
 #include <linux/io.h>
 #include <linux/irq.h>
 #include <linux/module.h>
-#include <linux/of.h>
 #include <linux/platform_device.h>
 #include <linux/pm_runtime.h>
 #include <linux/slab.h>
@@ -564,7 +563,6 @@ static int xgpio_probe(struct platform_device *pdev)
 	struct device *dev = &pdev->dev;
 	struct xgpio_instance *chip;
 	int status = 0;
-	struct device_node *np = dev->of_node;
 	u32 is_dual = 0;
 	u32 width[2];
 	u32 state[2];
@@ -579,7 +577,7 @@ static int xgpio_probe(struct platform_device *pdev)
 	platform_set_drvdata(pdev, chip);
 
 	/* First, check if the device is dual-channel */
-	of_property_read_u32(np, "xlnx,is-dual", &is_dual);
+	device_property_read_u32(dev, "xlnx,is-dual", &is_dual);
 
 	/* Setup defaults */
 	memset32(width, 0, ARRAY_SIZE(width));
@@ -587,14 +585,14 @@ static int xgpio_probe(struct platform_device *pdev)
 	memset32(dir, 0xFFFFFFFF, ARRAY_SIZE(dir));
 
 	/* Update GPIO state shadow register with default value */
-	of_property_read_u32(np, "xlnx,dout-default", &state[0]);
-	of_property_read_u32(np, "xlnx,dout-default-2", &state[1]);
+	device_property_read_u32(dev, "xlnx,dout-default", &state[0]);
+	device_property_read_u32(dev, "xlnx,dout-default-2", &state[1]);
 
 	bitmap_from_arr32(chip->state, state, 64);
 
 	/* Update GPIO direction shadow register with default value */
-	of_property_read_u32(np, "xlnx,tri-default", &dir[0]);
-	of_property_read_u32(np, "xlnx,tri-default-2", &dir[1]);
+	device_property_read_u32(dev, "xlnx,tri-default", &dir[0]);
+	device_property_read_u32(dev, "xlnx,tri-default-2", &dir[1]);
 
 	bitmap_from_arr32(chip->dir, dir, 64);
 
@@ -602,13 +600,13 @@ static int xgpio_probe(struct platform_device *pdev)
 	 * Check device node and parent device node for device width
 	 * and assume default width of 32
 	 */
-	if (of_property_read_u32(np, "xlnx,gpio-width", &width[0]))
+	if (device_property_read_u32(dev, "xlnx,gpio-width", &width[0]))
 		width[0] = 32;
 
 	if (width[0] > 32)
 		return -EINVAL;
 
-	if (is_dual && of_property_read_u32(np, "xlnx,gpio2-width", &width[1]))
+	if (is_dual && device_property_read_u32(dev, "xlnx,gpio2-width", &width[1]))
 		width[1] = 32;
 
 	if (width[1] > 32)
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH 2/3] gpio: xilinx: use helper variable to store the address of pdev->dev
  2024-09-30 14:48 ` [PATCH 2/3] gpio: xilinx: use helper variable to store the address of pdev->dev Bartosz Golaszewski
@ 2024-10-01 10:28   ` Michal Simek
  2024-10-02 13:19   ` Linus Walleij
  1 sibling, 0 replies; 13+ messages in thread
From: Michal Simek @ 2024-10-01 10:28 UTC (permalink / raw)
  To: Bartosz Golaszewski, Linus Walleij, Shubhrajyoti Datta,
	Srinivas Neeli
  Cc: linux-gpio, linux-kernel, linux-arm-kernel, Bartosz Golaszewski



On 9/30/24 16:48, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> 
> For better readability don't repeatedly dereference pdev->dev but
> instead store the address of the embedded struct device in a local
> variable in probe().
> 
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> ---
>   drivers/gpio/gpio-xilinx.c | 34 +++++++++++++++++-----------------
>   1 file changed, 17 insertions(+), 17 deletions(-)
> 
> diff --git a/drivers/gpio/gpio-xilinx.c b/drivers/gpio/gpio-xilinx.c
> index afcf432a1573..d99824d42c77 100644
> --- a/drivers/gpio/gpio-xilinx.c
> +++ b/drivers/gpio/gpio-xilinx.c
> @@ -561,9 +561,10 @@ static const struct irq_chip xgpio_irq_chip = {
>    */
>   static int xgpio_probe(struct platform_device *pdev)
>   {
> +	struct device *dev = &pdev->dev;
>   	struct xgpio_instance *chip;
>   	int status = 0;
> -	struct device_node *np = pdev->dev.of_node;
> +	struct device_node *np = dev->of_node;
>   	u32 is_dual = 0;
>   	u32 width[2];
>   	u32 state[2];
> @@ -571,7 +572,7 @@ static int xgpio_probe(struct platform_device *pdev)
>   	struct gpio_irq_chip *girq;
>   	u32 temp;
>   
> -	chip = devm_kzalloc(&pdev->dev, sizeof(*chip), GFP_KERNEL);
> +	chip = devm_kzalloc(dev, sizeof(*chip), GFP_KERNEL);
>   	if (!chip)
>   		return -ENOMEM;
>   
> @@ -624,7 +625,7 @@ static int xgpio_probe(struct platform_device *pdev)
>   
>   	chip->gc.base = -1;
>   	chip->gc.ngpio = bitmap_weight(chip->hw_map, 64);
> -	chip->gc.parent = &pdev->dev;
> +	chip->gc.parent = dev;
>   	chip->gc.direction_input = xgpio_dir_in;
>   	chip->gc.direction_output = xgpio_dir_out;
>   	chip->gc.get = xgpio_get;
> @@ -633,21 +634,21 @@ static int xgpio_probe(struct platform_device *pdev)
>   	chip->gc.free = xgpio_free;
>   	chip->gc.set_multiple = xgpio_set_multiple;
>   
> -	chip->gc.label = dev_name(&pdev->dev);
> +	chip->gc.label = dev_name(dev);
>   
>   	chip->regs = devm_platform_ioremap_resource(pdev, 0);
>   	if (IS_ERR(chip->regs)) {
> -		dev_err(&pdev->dev, "failed to ioremap memory resource\n");
> +		dev_err(dev, "failed to ioremap memory resource\n");
>   		return PTR_ERR(chip->regs);
>   	}
>   
> -	chip->clk = devm_clk_get_optional_enabled(&pdev->dev, NULL);
> +	chip->clk = devm_clk_get_optional_enabled(dev, NULL);
>   	if (IS_ERR(chip->clk))
> -		return dev_err_probe(&pdev->dev, PTR_ERR(chip->clk), "input clock not found.\n");
> +		return dev_err_probe(dev, PTR_ERR(chip->clk), "input clock not found.\n");
>   
> -	pm_runtime_get_noresume(&pdev->dev);
> -	pm_runtime_set_active(&pdev->dev);
> -	pm_runtime_enable(&pdev->dev);
> +	pm_runtime_get_noresume(dev);
> +	pm_runtime_set_active(dev);
> +	pm_runtime_enable(dev);
>   
>   	xgpio_save_regs(chip);
>   
> @@ -667,8 +668,7 @@ static int xgpio_probe(struct platform_device *pdev)
>   	gpio_irq_chip_set_chip(girq, &xgpio_irq_chip);
>   	girq->parent_handler = xgpio_irqhandler;
>   	girq->num_parents = 1;
> -	girq->parents = devm_kcalloc(&pdev->dev, 1,
> -				     sizeof(*girq->parents),
> +	girq->parents = devm_kcalloc(dev, 1, sizeof(*girq->parents),
>   				     GFP_KERNEL);
>   	if (!girq->parents) {
>   		status = -ENOMEM;
> @@ -679,18 +679,18 @@ static int xgpio_probe(struct platform_device *pdev)
>   	girq->handler = handle_bad_irq;
>   
>   skip_irq:
> -	status = devm_gpiochip_add_data(&pdev->dev, &chip->gc, chip);
> +	status = devm_gpiochip_add_data(dev, &chip->gc, chip);
>   	if (status) {
> -		dev_err(&pdev->dev, "failed to add GPIO chip\n");
> +		dev_err(dev, "failed to add GPIO chip\n");
>   		goto err_pm_put;
>   	}
>   
> -	pm_runtime_put(&pdev->dev);
> +	pm_runtime_put(dev);
>   	return 0;
>   
>   err_pm_put:
> -	pm_runtime_disable(&pdev->dev);
> -	pm_runtime_put_noidle(&pdev->dev);
> +	pm_runtime_disable(dev);
> +	pm_runtime_put_noidle(dev);
>   	return status;
>   }
>   

make sense.

Acked-by: Michal Simek <michal.simek@amd.com>

Thanks,
Michal

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 3/3] gpio: xilinx: use generic device properties
  2024-09-30 14:48 ` [PATCH 3/3] gpio: xilinx: use generic device properties Bartosz Golaszewski
@ 2024-10-01 10:29   ` Michal Simek
  2024-10-02 13:20   ` Linus Walleij
  1 sibling, 0 replies; 13+ messages in thread
From: Michal Simek @ 2024-10-01 10:29 UTC (permalink / raw)
  To: Bartosz Golaszewski, Linus Walleij, Shubhrajyoti Datta,
	Srinivas Neeli
  Cc: linux-gpio, linux-kernel, linux-arm-kernel, Bartosz Golaszewski



On 9/30/24 16:48, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> 
> OF-specific routines should not be used unless necessary. Generic device
> properties are preferred so switch to using them in the driver code.
> 
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> ---
>   drivers/gpio/gpio-xilinx.c | 16 +++++++---------
>   1 file changed, 7 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/gpio/gpio-xilinx.c b/drivers/gpio/gpio-xilinx.c
> index d99824d42c77..41c552a58059 100644
> --- a/drivers/gpio/gpio-xilinx.c
> +++ b/drivers/gpio/gpio-xilinx.c
> @@ -15,7 +15,6 @@
>   #include <linux/io.h>
>   #include <linux/irq.h>
>   #include <linux/module.h>
> -#include <linux/of.h>
>   #include <linux/platform_device.h>
>   #include <linux/pm_runtime.h>
>   #include <linux/slab.h>
> @@ -564,7 +563,6 @@ static int xgpio_probe(struct platform_device *pdev)
>   	struct device *dev = &pdev->dev;
>   	struct xgpio_instance *chip;
>   	int status = 0;
> -	struct device_node *np = dev->of_node;
>   	u32 is_dual = 0;
>   	u32 width[2];
>   	u32 state[2];
> @@ -579,7 +577,7 @@ static int xgpio_probe(struct platform_device *pdev)
>   	platform_set_drvdata(pdev, chip);
>   
>   	/* First, check if the device is dual-channel */
> -	of_property_read_u32(np, "xlnx,is-dual", &is_dual);
> +	device_property_read_u32(dev, "xlnx,is-dual", &is_dual);
>   
>   	/* Setup defaults */
>   	memset32(width, 0, ARRAY_SIZE(width));
> @@ -587,14 +585,14 @@ static int xgpio_probe(struct platform_device *pdev)
>   	memset32(dir, 0xFFFFFFFF, ARRAY_SIZE(dir));
>   
>   	/* Update GPIO state shadow register with default value */
> -	of_property_read_u32(np, "xlnx,dout-default", &state[0]);
> -	of_property_read_u32(np, "xlnx,dout-default-2", &state[1]);
> +	device_property_read_u32(dev, "xlnx,dout-default", &state[0]);
> +	device_property_read_u32(dev, "xlnx,dout-default-2", &state[1]);
>   
>   	bitmap_from_arr32(chip->state, state, 64);
>   
>   	/* Update GPIO direction shadow register with default value */
> -	of_property_read_u32(np, "xlnx,tri-default", &dir[0]);
> -	of_property_read_u32(np, "xlnx,tri-default-2", &dir[1]);
> +	device_property_read_u32(dev, "xlnx,tri-default", &dir[0]);
> +	device_property_read_u32(dev, "xlnx,tri-default-2", &dir[1]);
>   
>   	bitmap_from_arr32(chip->dir, dir, 64);
>   
> @@ -602,13 +600,13 @@ static int xgpio_probe(struct platform_device *pdev)
>   	 * Check device node and parent device node for device width
>   	 * and assume default width of 32
>   	 */
> -	if (of_property_read_u32(np, "xlnx,gpio-width", &width[0]))
> +	if (device_property_read_u32(dev, "xlnx,gpio-width", &width[0]))
>   		width[0] = 32;
>   
>   	if (width[0] > 32)
>   		return -EINVAL;
>   
> -	if (is_dual && of_property_read_u32(np, "xlnx,gpio2-width", &width[1]))
> +	if (is_dual && device_property_read_u32(dev, "xlnx,gpio2-width", &width[1]))
>   		width[1] = 32;
>   
>   	if (width[1] > 32)

This is also fine.

Acked-by: Michal Simek <michal.simek@amd.com>

Thanks,
Michal


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/3] gpio: xilinx: drop dependency on GPIO_OF
  2024-09-30 14:48 [PATCH 1/3] gpio: xilinx: drop dependency on GPIO_OF Bartosz Golaszewski
  2024-09-30 14:48 ` [PATCH 2/3] gpio: xilinx: use helper variable to store the address of pdev->dev Bartosz Golaszewski
  2024-09-30 14:48 ` [PATCH 3/3] gpio: xilinx: use generic device properties Bartosz Golaszewski
@ 2024-10-01 10:30 ` Michal Simek
  2024-10-01 10:44   ` Bartosz Golaszewski
  2024-10-08  8:18 ` Bartosz Golaszewski
  3 siblings, 1 reply; 13+ messages in thread
From: Michal Simek @ 2024-10-01 10:30 UTC (permalink / raw)
  To: Bartosz Golaszewski, Linus Walleij, Shubhrajyoti Datta,
	Srinivas Neeli
  Cc: linux-gpio, linux-kernel, linux-arm-kernel, Bartosz Golaszewski



On 9/30/24 16:48, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> 
> This driver doesn't really depend on gpiolib-of being built and can be
> compiled without it.
> 
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> ---
>   drivers/gpio/Kconfig | 1 -
>   1 file changed, 1 deletion(-)
> 
> diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
> index d93cd4f722b4..0d676c96b72d 100644
> --- a/drivers/gpio/Kconfig
> +++ b/drivers/gpio/Kconfig
> @@ -796,7 +796,6 @@ config GPIO_XGENE_SB
>   config GPIO_XILINX
>   	tristate "Xilinx GPIO support"
>   	select GPIOLIB_IRQCHIP
> -	depends on OF_GPIO
>   	help
>   	  Say yes here to support the Xilinx FPGA GPIO device.
>   

The patch itself is fine but it should be likely applied as last one not the 
first one.
If this is applied like that feel free to add

Acked-by: Michal Simek <michal.simek@amd.com>

Thanks,
Michal

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/3] gpio: xilinx: drop dependency on GPIO_OF
  2024-10-01 10:30 ` [PATCH 1/3] gpio: xilinx: drop dependency on GPIO_OF Michal Simek
@ 2024-10-01 10:44   ` Bartosz Golaszewski
  2024-10-01 11:13     ` Michal Simek
  0 siblings, 1 reply; 13+ messages in thread
From: Bartosz Golaszewski @ 2024-10-01 10:44 UTC (permalink / raw)
  To: Michal Simek
  Cc: Linus Walleij, Shubhrajyoti Datta, Srinivas Neeli, linux-gpio,
	linux-kernel, linux-arm-kernel, Bartosz Golaszewski

On Tue, Oct 1, 2024 at 12:30 PM Michal Simek <michal.simek@amd.com> wrote:
>
> On 9/30/24 16:48, Bartosz Golaszewski wrote:
> > From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> >
> > This driver doesn't really depend on gpiolib-of being built and can be
> > compiled without it.
> >
> > Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> > ---
> >   drivers/gpio/Kconfig | 1 -
> >   1 file changed, 1 deletion(-)
> >
> > diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
> > index d93cd4f722b4..0d676c96b72d 100644
> > --- a/drivers/gpio/Kconfig
> > +++ b/drivers/gpio/Kconfig
> > @@ -796,7 +796,6 @@ config GPIO_XGENE_SB
> >   config GPIO_XILINX
> >       tristate "Xilinx GPIO support"
> >       select GPIOLIB_IRQCHIP
> > -     depends on OF_GPIO
> >       help
> >         Say yes here to support the Xilinx FPGA GPIO device.
> >
>
> The patch itself is fine but it should be likely applied as last one not the
> first one.
> If this is applied like that feel free to add
>
> Acked-by: Michal Simek <michal.simek@amd.com>
>

I think you may be confusing CONFIG_OF with CONFIG_OF_GPIO. This
driver doesn't depend at build-time on the latter and this patch can
be applied right away.

Bart

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/3] gpio: xilinx: drop dependency on GPIO_OF
  2024-10-01 10:44   ` Bartosz Golaszewski
@ 2024-10-01 11:13     ` Michal Simek
  2024-10-01 12:31       ` Bartosz Golaszewski
  0 siblings, 1 reply; 13+ messages in thread
From: Michal Simek @ 2024-10-01 11:13 UTC (permalink / raw)
  To: Bartosz Golaszewski
  Cc: Linus Walleij, Shubhrajyoti Datta, Srinivas Neeli, linux-gpio,
	linux-kernel, linux-arm-kernel, Bartosz Golaszewski



On 10/1/24 12:44, Bartosz Golaszewski wrote:
> On Tue, Oct 1, 2024 at 12:30 PM Michal Simek <michal.simek@amd.com> wrote:
>>
>> On 9/30/24 16:48, Bartosz Golaszewski wrote:
>>> From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
>>>
>>> This driver doesn't really depend on gpiolib-of being built and can be
>>> compiled without it.
>>>
>>> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
>>> ---
>>>    drivers/gpio/Kconfig | 1 -
>>>    1 file changed, 1 deletion(-)
>>>
>>> diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
>>> index d93cd4f722b4..0d676c96b72d 100644
>>> --- a/drivers/gpio/Kconfig
>>> +++ b/drivers/gpio/Kconfig
>>> @@ -796,7 +796,6 @@ config GPIO_XGENE_SB
>>>    config GPIO_XILINX
>>>        tristate "Xilinx GPIO support"
>>>        select GPIOLIB_IRQCHIP
>>> -     depends on OF_GPIO
>>>        help
>>>          Say yes here to support the Xilinx FPGA GPIO device.
>>>
>>
>> The patch itself is fine but it should be likely applied as last one not the
>> first one.
>> If this is applied like that feel free to add
>>
>> Acked-by: Michal Simek <michal.simek@amd.com>
>>
> 
> I think you may be confusing CONFIG_OF with CONFIG_OF_GPIO. This
> driver doesn't depend at build-time on the latter and this patch can
> be applied right away.

ok then.

Thanks,
Michal


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/3] gpio: xilinx: drop dependency on GPIO_OF
  2024-10-01 11:13     ` Michal Simek
@ 2024-10-01 12:31       ` Bartosz Golaszewski
  2024-10-02 14:34         ` Bartosz Golaszewski
  0 siblings, 1 reply; 13+ messages in thread
From: Bartosz Golaszewski @ 2024-10-01 12:31 UTC (permalink / raw)
  To: Michal Simek
  Cc: Linus Walleij, Shubhrajyoti Datta, Srinivas Neeli, linux-gpio,
	linux-kernel, linux-arm-kernel, Bartosz Golaszewski

On Tue, Oct 1, 2024 at 1:13 PM Michal Simek <michal.simek@amd.com> wrote:
>
>
>
> On 10/1/24 12:44, Bartosz Golaszewski wrote:
> > On Tue, Oct 1, 2024 at 12:30 PM Michal Simek <michal.simek@amd.com> wrote:
> >>
> >> On 9/30/24 16:48, Bartosz Golaszewski wrote:
> >>> From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> >>>
> >>> This driver doesn't really depend on gpiolib-of being built and can be
> >>> compiled without it.
> >>>
> >>> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> >>> ---
> >>>    drivers/gpio/Kconfig | 1 -
> >>>    1 file changed, 1 deletion(-)
> >>>
> >>> diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
> >>> index d93cd4f722b4..0d676c96b72d 100644
> >>> --- a/drivers/gpio/Kconfig
> >>> +++ b/drivers/gpio/Kconfig
> >>> @@ -796,7 +796,6 @@ config GPIO_XGENE_SB
> >>>    config GPIO_XILINX
> >>>        tristate "Xilinx GPIO support"
> >>>        select GPIOLIB_IRQCHIP
> >>> -     depends on OF_GPIO
> >>>        help
> >>>          Say yes here to support the Xilinx FPGA GPIO device.
> >>>
> >>
> >> The patch itself is fine but it should be likely applied as last one not the
> >> first one.
> >> If this is applied like that feel free to add
> >>
> >> Acked-by: Michal Simek <michal.simek@amd.com>
> >>
> >
> > I think you may be confusing CONFIG_OF with CONFIG_OF_GPIO. This
> > driver doesn't depend at build-time on the latter and this patch can
> > be applied right away.
>
> ok then.
>
> Thanks,
> Michal
>

Now that I think about it - we should probably use of_match_ptr() once
we drop this dependency though.

Bart

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 2/3] gpio: xilinx: use helper variable to store the address of pdev->dev
  2024-09-30 14:48 ` [PATCH 2/3] gpio: xilinx: use helper variable to store the address of pdev->dev Bartosz Golaszewski
  2024-10-01 10:28   ` Michal Simek
@ 2024-10-02 13:19   ` Linus Walleij
  1 sibling, 0 replies; 13+ messages in thread
From: Linus Walleij @ 2024-10-02 13:19 UTC (permalink / raw)
  To: Bartosz Golaszewski
  Cc: Shubhrajyoti Datta, Srinivas Neeli, Michal Simek, linux-gpio,
	linux-kernel, linux-arm-kernel, Bartosz Golaszewski

On Mon, Sep 30, 2024 at 4:48 PM Bartosz Golaszewski <brgl@bgdev.pl> wrote:

> From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
>
> For better readability don't repeatedly dereference pdev->dev but
> instead store the address of the embedded struct device in a local
> variable in probe().
>
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 3/3] gpio: xilinx: use generic device properties
  2024-09-30 14:48 ` [PATCH 3/3] gpio: xilinx: use generic device properties Bartosz Golaszewski
  2024-10-01 10:29   ` Michal Simek
@ 2024-10-02 13:20   ` Linus Walleij
  1 sibling, 0 replies; 13+ messages in thread
From: Linus Walleij @ 2024-10-02 13:20 UTC (permalink / raw)
  To: Bartosz Golaszewski
  Cc: Shubhrajyoti Datta, Srinivas Neeli, Michal Simek, linux-gpio,
	linux-kernel, linux-arm-kernel, Bartosz Golaszewski

On Mon, Sep 30, 2024 at 4:48 PM Bartosz Golaszewski <brgl@bgdev.pl> wrote:

> From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
>
> OF-specific routines should not be used unless necessary. Generic device
> properties are preferred so switch to using them in the driver code.
>
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/3] gpio: xilinx: drop dependency on GPIO_OF
  2024-10-01 12:31       ` Bartosz Golaszewski
@ 2024-10-02 14:34         ` Bartosz Golaszewski
  0 siblings, 0 replies; 13+ messages in thread
From: Bartosz Golaszewski @ 2024-10-02 14:34 UTC (permalink / raw)
  To: Michal Simek
  Cc: Linus Walleij, Shubhrajyoti Datta, Srinivas Neeli, linux-gpio,
	linux-kernel, linux-arm-kernel, Bartosz Golaszewski

On Tue, Oct 1, 2024 at 2:31 PM Bartosz Golaszewski <brgl@bgdev.pl> wrote:
>
> On Tue, Oct 1, 2024 at 1:13 PM Michal Simek <michal.simek@amd.com> wrote:
> >
> >
> >
> > On 10/1/24 12:44, Bartosz Golaszewski wrote:
> > > On Tue, Oct 1, 2024 at 12:30 PM Michal Simek <michal.simek@amd.com> wrote:
> > >>
> > >> On 9/30/24 16:48, Bartosz Golaszewski wrote:
> > >>> From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> > >>>
> > >>> This driver doesn't really depend on gpiolib-of being built and can be
> > >>> compiled without it.
> > >>>
> > >>> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> > >>> ---
> > >>>    drivers/gpio/Kconfig | 1 -
> > >>>    1 file changed, 1 deletion(-)
> > >>>
> > >>> diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
> > >>> index d93cd4f722b4..0d676c96b72d 100644
> > >>> --- a/drivers/gpio/Kconfig
> > >>> +++ b/drivers/gpio/Kconfig
> > >>> @@ -796,7 +796,6 @@ config GPIO_XGENE_SB
> > >>>    config GPIO_XILINX
> > >>>        tristate "Xilinx GPIO support"
> > >>>        select GPIOLIB_IRQCHIP
> > >>> -     depends on OF_GPIO
> > >>>        help
> > >>>          Say yes here to support the Xilinx FPGA GPIO device.
> > >>>
> > >>
> > >> The patch itself is fine but it should be likely applied as last one not the
> > >> first one.
> > >> If this is applied like that feel free to add
> > >>
> > >> Acked-by: Michal Simek <michal.simek@amd.com>
> > >>
> > >
> > > I think you may be confusing CONFIG_OF with CONFIG_OF_GPIO. This
> > > driver doesn't depend at build-time on the latter and this patch can
> > > be applied right away.
> >
> > ok then.
> >
> > Thanks,
> > Michal
> >
>
> Now that I think about it - we should probably use of_match_ptr() once
> we drop this dependency though.
>
> Bart

Scratch that - that would actually require us to conditionally define
the ids struct.

Bart

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/3] gpio: xilinx: drop dependency on GPIO_OF
  2024-09-30 14:48 [PATCH 1/3] gpio: xilinx: drop dependency on GPIO_OF Bartosz Golaszewski
                   ` (2 preceding siblings ...)
  2024-10-01 10:30 ` [PATCH 1/3] gpio: xilinx: drop dependency on GPIO_OF Michal Simek
@ 2024-10-08  8:18 ` Bartosz Golaszewski
  3 siblings, 0 replies; 13+ messages in thread
From: Bartosz Golaszewski @ 2024-10-08  8:18 UTC (permalink / raw)
  To: Linus Walleij, Shubhrajyoti Datta, Srinivas Neeli, Michal Simek,
	Bartosz Golaszewski
  Cc: Bartosz Golaszewski, linux-gpio, linux-kernel, linux-arm-kernel

From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>


On Mon, 30 Sep 2024 16:48:02 +0200, Bartosz Golaszewski wrote:
> This driver doesn't really depend on gpiolib-of being built and can be
> compiled without it.
> 
> 

Applied, thanks!

[1/3] gpio: xilinx: drop dependency on GPIO_OF
      commit: e96c6de61233bfea7d0d0c32a7d539906ac23180
[2/3] gpio: xilinx: use helper variable to store the address of pdev->dev
      commit: 3cc3af160be758e95c9b4008b3bf06f4a81b653f
[3/3] gpio: xilinx: use generic device properties
      commit: 06c88b7ac9eed417f02cd748499b29318a9795be

Best regards,
-- 
Bartosz Golaszewski <bartosz.golaszewski@linaro.org>

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2024-10-08  8:18 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-30 14:48 [PATCH 1/3] gpio: xilinx: drop dependency on GPIO_OF Bartosz Golaszewski
2024-09-30 14:48 ` [PATCH 2/3] gpio: xilinx: use helper variable to store the address of pdev->dev Bartosz Golaszewski
2024-10-01 10:28   ` Michal Simek
2024-10-02 13:19   ` Linus Walleij
2024-09-30 14:48 ` [PATCH 3/3] gpio: xilinx: use generic device properties Bartosz Golaszewski
2024-10-01 10:29   ` Michal Simek
2024-10-02 13:20   ` Linus Walleij
2024-10-01 10:30 ` [PATCH 1/3] gpio: xilinx: drop dependency on GPIO_OF Michal Simek
2024-10-01 10:44   ` Bartosz Golaszewski
2024-10-01 11:13     ` Michal Simek
2024-10-01 12:31       ` Bartosz Golaszewski
2024-10-02 14:34         ` Bartosz Golaszewski
2024-10-08  8:18 ` Bartosz Golaszewski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).