All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 1/2] gpio: adnp: use simple i2c probe function
@ 2022-06-28 19:59 Andy Shevchenko
  2022-06-28 19:59 ` [PATCH v1 2/2] gpio: adnp: Make use of device properties Andy Shevchenko
  2022-07-01  9:36 ` [PATCH v1 1/2] gpio: adnp: use simple i2c probe function Bartosz Golaszewski
  0 siblings, 2 replies; 5+ messages in thread
From: Andy Shevchenko @ 2022-06-28 19:59 UTC (permalink / raw)
  To: Andy Shevchenko, linux-gpio, linux-kernel
  Cc: Linus Walleij, Bartosz Golaszewski

The i2c probe functions here don't use the id information provided in
their second argument, so the single-parameter i2c probe function
("probe_new") can be used instead.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/gpio/gpio-adnp.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/gpio/gpio-adnp.c b/drivers/gpio/gpio-adnp.c
index cc349d4e4973..075782831044 100644
--- a/drivers/gpio/gpio-adnp.c
+++ b/drivers/gpio/gpio-adnp.c
@@ -485,8 +485,7 @@ static int adnp_gpio_setup(struct adnp *adnp, unsigned int num_gpios,
 	return 0;
 }
 
-static int adnp_i2c_probe(struct i2c_client *client,
-				    const struct i2c_device_id *id)
+static int adnp_i2c_probe(struct i2c_client *client)
 {
 	struct device_node *np = client->dev.of_node;
 	struct adnp *adnp;
@@ -535,7 +534,7 @@ static struct i2c_driver adnp_i2c_driver = {
 		.name = "gpio-adnp",
 		.of_match_table = adnp_of_match,
 	},
-	.probe = adnp_i2c_probe,
+	.probe_new = adnp_i2c_probe,
 	.id_table = adnp_i2c_id,
 };
 module_i2c_driver(adnp_i2c_driver);
-- 
2.35.1


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

* [PATCH v1 2/2] gpio: adnp: Make use of device properties
  2022-06-28 19:59 [PATCH v1 1/2] gpio: adnp: use simple i2c probe function Andy Shevchenko
@ 2022-06-28 19:59 ` Andy Shevchenko
  2022-06-28 20:29   ` Linus Walleij
  2022-07-01  9:37   ` Bartosz Golaszewski
  2022-07-01  9:36 ` [PATCH v1 1/2] gpio: adnp: use simple i2c probe function Bartosz Golaszewski
  1 sibling, 2 replies; 5+ messages in thread
From: Andy Shevchenko @ 2022-06-28 19:59 UTC (permalink / raw)
  To: Andy Shevchenko, linux-gpio, linux-kernel
  Cc: Linus Walleij, Bartosz Golaszewski

Convert the module to be property provider agnostic and allow
it to be used on non-OF platforms.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/gpio/gpio-adnp.c | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/drivers/gpio/gpio-adnp.c b/drivers/gpio/gpio-adnp.c
index 075782831044..a6439e3daff0 100644
--- a/drivers/gpio/gpio-adnp.c
+++ b/drivers/gpio/gpio-adnp.c
@@ -6,8 +6,9 @@
 #include <linux/gpio/driver.h>
 #include <linux/i2c.h>
 #include <linux/interrupt.h>
+#include <linux/mod_devicetable.h>
 #include <linux/module.h>
-#include <linux/of_irq.h>
+#include <linux/property.h>
 #include <linux/seq_file.h>
 #include <linux/slab.h>
 
@@ -487,19 +488,15 @@ static int adnp_gpio_setup(struct adnp *adnp, unsigned int num_gpios,
 
 static int adnp_i2c_probe(struct i2c_client *client)
 {
-	struct device_node *np = client->dev.of_node;
+	struct device *dev = &client->dev;
 	struct adnp *adnp;
 	u32 num_gpios;
 	int err;
 
-	err = of_property_read_u32(np, "nr-gpios", &num_gpios);
+	err = device_property_read_u32(dev, "nr-gpios", &num_gpios);
 	if (err < 0)
 		return err;
 
-	client->irq = irq_of_parse_and_map(np, 0);
-	if (!client->irq)
-		return -EPROBE_DEFER;
-
 	adnp = devm_kzalloc(&client->dev, sizeof(*adnp), GFP_KERNEL);
 	if (!adnp)
 		return -ENOMEM;
@@ -507,8 +504,7 @@ static int adnp_i2c_probe(struct i2c_client *client)
 	mutex_init(&adnp->i2c_lock);
 	adnp->client = client;
 
-	err = adnp_gpio_setup(adnp, num_gpios,
-			of_property_read_bool(np, "interrupt-controller"));
+	err = adnp_gpio_setup(adnp, num_gpios, device_property_read_bool(dev, "interrupt-controller"));
 	if (err)
 		return err;
 
-- 
2.35.1


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

* Re: [PATCH v1 2/2] gpio: adnp: Make use of device properties
  2022-06-28 19:59 ` [PATCH v1 2/2] gpio: adnp: Make use of device properties Andy Shevchenko
@ 2022-06-28 20:29   ` Linus Walleij
  2022-07-01  9:37   ` Bartosz Golaszewski
  1 sibling, 0 replies; 5+ messages in thread
From: Linus Walleij @ 2022-06-28 20:29 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: linux-gpio, linux-kernel, Bartosz Golaszewski

On Tue, Jun 28, 2022 at 9:59 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:

> Convert the module to be property provider agnostic and allow
> it to be used on non-OF platforms.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

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

Yours,
Linus Walleij

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

* Re: [PATCH v1 1/2] gpio: adnp: use simple i2c probe function
  2022-06-28 19:59 [PATCH v1 1/2] gpio: adnp: use simple i2c probe function Andy Shevchenko
  2022-06-28 19:59 ` [PATCH v1 2/2] gpio: adnp: Make use of device properties Andy Shevchenko
@ 2022-07-01  9:36 ` Bartosz Golaszewski
  1 sibling, 0 replies; 5+ messages in thread
From: Bartosz Golaszewski @ 2022-07-01  9:36 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: linux-gpio, linux-kernel, Linus Walleij

On Tue, Jun 28, 2022 at 9:59 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> The i2c probe functions here don't use the id information provided in
> their second argument, so the single-parameter i2c probe function
> ("probe_new") can be used instead.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  drivers/gpio/gpio-adnp.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpio/gpio-adnp.c b/drivers/gpio/gpio-adnp.c
> index cc349d4e4973..075782831044 100644
> --- a/drivers/gpio/gpio-adnp.c
> +++ b/drivers/gpio/gpio-adnp.c
> @@ -485,8 +485,7 @@ static int adnp_gpio_setup(struct adnp *adnp, unsigned int num_gpios,
>         return 0;
>  }
>
> -static int adnp_i2c_probe(struct i2c_client *client,
> -                                   const struct i2c_device_id *id)
> +static int adnp_i2c_probe(struct i2c_client *client)
>  {
>         struct device_node *np = client->dev.of_node;
>         struct adnp *adnp;
> @@ -535,7 +534,7 @@ static struct i2c_driver adnp_i2c_driver = {
>                 .name = "gpio-adnp",
>                 .of_match_table = adnp_of_match,
>         },
> -       .probe = adnp_i2c_probe,
> +       .probe_new = adnp_i2c_probe,
>         .id_table = adnp_i2c_id,
>  };
>  module_i2c_driver(adnp_i2c_driver);
> --
> 2.35.1
>

Applied, thanks!

Bart

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

* Re: [PATCH v1 2/2] gpio: adnp: Make use of device properties
  2022-06-28 19:59 ` [PATCH v1 2/2] gpio: adnp: Make use of device properties Andy Shevchenko
  2022-06-28 20:29   ` Linus Walleij
@ 2022-07-01  9:37   ` Bartosz Golaszewski
  1 sibling, 0 replies; 5+ messages in thread
From: Bartosz Golaszewski @ 2022-07-01  9:37 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: linux-gpio, linux-kernel, Linus Walleij

On Tue, Jun 28, 2022 at 9:59 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> Convert the module to be property provider agnostic and allow
> it to be used on non-OF platforms.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  drivers/gpio/gpio-adnp.c | 14 +++++---------
>  1 file changed, 5 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/gpio/gpio-adnp.c b/drivers/gpio/gpio-adnp.c
> index 075782831044..a6439e3daff0 100644
> --- a/drivers/gpio/gpio-adnp.c
> +++ b/drivers/gpio/gpio-adnp.c
> @@ -6,8 +6,9 @@
>  #include <linux/gpio/driver.h>
>  #include <linux/i2c.h>
>  #include <linux/interrupt.h>
> +#include <linux/mod_devicetable.h>
>  #include <linux/module.h>
> -#include <linux/of_irq.h>
> +#include <linux/property.h>
>  #include <linux/seq_file.h>
>  #include <linux/slab.h>
>
> @@ -487,19 +488,15 @@ static int adnp_gpio_setup(struct adnp *adnp, unsigned int num_gpios,
>
>  static int adnp_i2c_probe(struct i2c_client *client)
>  {
> -       struct device_node *np = client->dev.of_node;
> +       struct device *dev = &client->dev;
>         struct adnp *adnp;
>         u32 num_gpios;
>         int err;
>
> -       err = of_property_read_u32(np, "nr-gpios", &num_gpios);
> +       err = device_property_read_u32(dev, "nr-gpios", &num_gpios);
>         if (err < 0)
>                 return err;
>
> -       client->irq = irq_of_parse_and_map(np, 0);
> -       if (!client->irq)
> -               return -EPROBE_DEFER;
> -
>         adnp = devm_kzalloc(&client->dev, sizeof(*adnp), GFP_KERNEL);
>         if (!adnp)
>                 return -ENOMEM;
> @@ -507,8 +504,7 @@ static int adnp_i2c_probe(struct i2c_client *client)
>         mutex_init(&adnp->i2c_lock);
>         adnp->client = client;
>
> -       err = adnp_gpio_setup(adnp, num_gpios,
> -                       of_property_read_bool(np, "interrupt-controller"));
> +       err = adnp_gpio_setup(adnp, num_gpios, device_property_read_bool(dev, "interrupt-controller"));
>         if (err)
>                 return err;
>
> --
> 2.35.1
>

Applied, thanks!

Bart

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

end of thread, other threads:[~2022-07-01  9:37 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-28 19:59 [PATCH v1 1/2] gpio: adnp: use simple i2c probe function Andy Shevchenko
2022-06-28 19:59 ` [PATCH v1 2/2] gpio: adnp: Make use of device properties Andy Shevchenko
2022-06-28 20:29   ` Linus Walleij
2022-07-01  9:37   ` Bartosz Golaszewski
2022-07-01  9:36 ` [PATCH v1 1/2] gpio: adnp: use simple i2c probe function 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.