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

gpio: adnp: Make use of device properties

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>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>

authored by

Andy Shevchenko and committed by
Bartosz Golaszewski
8773bace a2a15e12

+5 -9
+5 -9
drivers/gpio/gpio-adnp.c
··· 6 6 #include <linux/gpio/driver.h> 7 7 #include <linux/i2c.h> 8 8 #include <linux/interrupt.h> 9 + #include <linux/mod_devicetable.h> 9 10 #include <linux/module.h> 10 - #include <linux/of_irq.h> 11 + #include <linux/property.h> 11 12 #include <linux/seq_file.h> 12 13 #include <linux/slab.h> 13 14 ··· 488 487 489 488 static int adnp_i2c_probe(struct i2c_client *client) 490 489 { 491 - struct device_node *np = client->dev.of_node; 490 + struct device *dev = &client->dev; 492 491 struct adnp *adnp; 493 492 u32 num_gpios; 494 493 int err; 495 494 496 - err = of_property_read_u32(np, "nr-gpios", &num_gpios); 495 + err = device_property_read_u32(dev, "nr-gpios", &num_gpios); 497 496 if (err < 0) 498 497 return err; 499 - 500 - client->irq = irq_of_parse_and_map(np, 0); 501 - if (!client->irq) 502 - return -EPROBE_DEFER; 503 498 504 499 adnp = devm_kzalloc(&client->dev, sizeof(*adnp), GFP_KERNEL); 505 500 if (!adnp) ··· 504 507 mutex_init(&adnp->i2c_lock); 505 508 adnp->client = client; 506 509 507 - err = adnp_gpio_setup(adnp, num_gpios, 508 - of_property_read_bool(np, "interrupt-controller")); 510 + err = adnp_gpio_setup(adnp, num_gpios, device_property_read_bool(dev, "interrupt-controller")); 509 511 if (err) 510 512 return err; 511 513