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

powerpc/52xx: Get rid of of_node assignment

Let GPIO library assign of_node from the parent device.
This allows to move GPIO library and drivers to use fwnode
APIs instead of being stuck with OF-only interfaces.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20220507100147.5802-3-andriy.shevchenko@linux.intel.com

authored by

Andy Shevchenko and committed by
Michael Ellerman
00bcb550 de06fba6

+8 -10
+8 -10
arch/powerpc/platforms/52xx/mpc52xx_gpt.c
··· 60 60 #include <linux/of_platform.h> 61 61 #include <linux/of_gpio.h> 62 62 #include <linux/kernel.h> 63 + #include <linux/property.h> 63 64 #include <linux/slab.h> 64 65 #include <linux/fs.h> 65 66 #include <linux/watchdog.h> ··· 317 316 return 0; 318 317 } 319 318 320 - static void 321 - mpc52xx_gpt_gpio_setup(struct mpc52xx_gpt_priv *gpt, struct device_node *node) 319 + static void mpc52xx_gpt_gpio_setup(struct mpc52xx_gpt_priv *gpt) 322 320 { 323 321 int rc; 324 322 325 - /* Only setup GPIO if the device tree claims the GPT is 326 - * a GPIO controller */ 327 - if (!of_find_property(node, "gpio-controller", NULL)) 323 + /* Only setup GPIO if the device claims the GPT is a GPIO controller */ 324 + if (!device_property_present(gpt->dev, "gpio-controller")) 328 325 return; 329 326 330 - gpt->gc.label = kasprintf(GFP_KERNEL, "%pOF", node); 327 + gpt->gc.label = kasprintf(GFP_KERNEL, "%pfw", dev_fwnode(gpt->dev)); 331 328 if (!gpt->gc.label) { 332 329 dev_err(gpt->dev, "out of memory\n"); 333 330 return; ··· 337 338 gpt->gc.get = mpc52xx_gpt_gpio_get; 338 339 gpt->gc.set = mpc52xx_gpt_gpio_set; 339 340 gpt->gc.base = -1; 340 - gpt->gc.of_node = node; 341 + gpt->gc.parent = gpt->dev; 341 342 342 343 /* Setup external pin in GPIO mode */ 343 344 clrsetbits_be32(&gpt->regs->mode, MPC52xx_GPT_MODE_MS_MASK, ··· 350 351 dev_dbg(gpt->dev, "%s() complete.\n", __func__); 351 352 } 352 353 #else /* defined(CONFIG_GPIOLIB) */ 353 - static void 354 - mpc52xx_gpt_gpio_setup(struct mpc52xx_gpt_priv *p, struct device_node *np) { } 354 + static void mpc52xx_gpt_gpio_setup(struct mpc52xx_gpt_priv *gpt) { } 355 355 #endif /* defined(CONFIG_GPIOLIB) */ 356 356 357 357 /*********************************************************************** ··· 727 729 728 730 dev_set_drvdata(&ofdev->dev, gpt); 729 731 730 - mpc52xx_gpt_gpio_setup(gpt, ofdev->dev.of_node); 732 + mpc52xx_gpt_gpio_setup(gpt); 731 733 mpc52xx_gpt_irq_setup(gpt, ofdev->dev.of_node); 732 734 733 735 mutex_lock(&mpc52xx_gpt_list_mutex);