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

leds: various: use dev_of_node(dev) instead of dev->of_node

The dev_of_node function should be preferred.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Cc: Orson Zhai <orsonzhai@gmail.com>
Cc: Baolin Wang <baolin.wang7@gmail.com>
Cc: Chunyan Zhang <zhang.lyra@gmail.com>
Cc: Sean Wang <sean.wang@mediatek.com>
Cc: Matthias Brugger <matthias.bgg@gmail.com>
Cc: Riku Voipio <riku.voipio@iki.fi>
Signed-off-by: Pavel Machek <pavel@ucw.cz>

authored by

Marek Behún and committed by
Pavel Machek
8853c95e 2779f472

+35 -35
+2 -2
drivers/leds/leds-88pm860x.c
··· 118 118 struct device_node *nproot, *np; 119 119 int iset = 0; 120 120 121 - if (!pdev->dev.parent->of_node) 121 + if (!dev_of_node(pdev->dev.parent)) 122 122 return -ENODEV; 123 - nproot = of_get_child_by_name(pdev->dev.parent->of_node, "leds"); 123 + nproot = of_get_child_by_name(dev_of_node(pdev->dev.parent), "leds"); 124 124 if (!nproot) { 125 125 dev_err(&pdev->dev, "failed to find leds node\n"); 126 126 return -ENODEV;
+1 -1
drivers/leds/leds-aat1290.c
··· 248 248 } 249 249 #endif 250 250 251 - child_node = of_get_next_available_child(dev->of_node, NULL); 251 + child_node = of_get_next_available_child(dev_of_node(dev), NULL); 252 252 if (!child_node) { 253 253 dev_err(dev, "No DT child node found for connected LED.\n"); 254 254 return -EINVAL;
+1 -1
drivers/leds/leds-an30259a.c
··· 202 202 static int an30259a_dt_init(struct i2c_client *client, 203 203 struct an30259a *chip) 204 204 { 205 - struct device_node *np = client->dev.of_node, *child; 205 + struct device_node *np = dev_of_node(&client->dev), *child; 206 206 int count, ret; 207 207 int i = 0; 208 208 const char *str;
+1 -1
drivers/leds/leds-aw2013.c
··· 261 261 262 262 static int aw2013_probe_dt(struct aw2013 *chip) 263 263 { 264 - struct device_node *np = chip->client->dev.of_node, *child; 264 + struct device_node *np = dev_of_node(&chip->client->dev), *child; 265 265 int count, ret = 0, i = 0; 266 266 struct aw2013_led *led; 267 267
+1 -1
drivers/leds/leds-bcm6328.c
··· 395 395 static int bcm6328_leds_probe(struct platform_device *pdev) 396 396 { 397 397 struct device *dev = &pdev->dev; 398 - struct device_node *np = pdev->dev.of_node; 398 + struct device_node *np = dev_of_node(&pdev->dev); 399 399 struct device_node *child; 400 400 void __iomem *mem; 401 401 spinlock_t *lock; /* memory lock */
+1 -1
drivers/leds/leds-bcm6358.c
··· 149 149 static int bcm6358_leds_probe(struct platform_device *pdev) 150 150 { 151 151 struct device *dev = &pdev->dev; 152 - struct device_node *np = pdev->dev.of_node; 152 + struct device_node *np = dev_of_node(&pdev->dev); 153 153 struct device_node *child; 154 154 void __iomem *mem; 155 155 spinlock_t *lock; /* memory lock */
+1 -1
drivers/leds/leds-is31fl319x.c
··· 202 202 static int is31fl319x_parse_dt(struct device *dev, 203 203 struct is31fl319x_chip *is31) 204 204 { 205 - struct device_node *np = dev->of_node, *child; 205 + struct device_node *np = dev_of_node(dev), *child; 206 206 int count; 207 207 int ret; 208 208
+2 -2
drivers/leds/leds-is31fl32xx.c
··· 372 372 struct device_node *child; 373 373 int ret = 0; 374 374 375 - for_each_child_of_node(dev->of_node, child) { 375 + for_each_child_of_node(dev_of_node(dev), child) { 376 376 struct is31fl32xx_led_data *led_data = 377 377 &priv->leds[priv->num_leds]; 378 378 const struct is31fl32xx_led_data *other_led_data; ··· 435 435 436 436 cdef = device_get_match_data(dev); 437 437 438 - count = of_get_child_count(dev->of_node); 438 + count = of_get_child_count(dev_of_node(dev)); 439 439 if (!count) 440 440 return -EINVAL; 441 441
+2 -2
drivers/leds/leds-ktd2692.c
··· 259 259 static int ktd2692_parse_dt(struct ktd2692_context *led, struct device *dev, 260 260 struct ktd2692_led_config_data *cfg) 261 261 { 262 - struct device_node *np = dev->of_node; 262 + struct device_node *np = dev_of_node(dev); 263 263 struct device_node *child_node; 264 264 int ret; 265 265 266 - if (!dev->of_node) 266 + if (!dev_of_node(dev)) 267 267 return -ENXIO; 268 268 269 269 led->ctrl_gpio = devm_gpiod_get(dev, "ctrl", GPIOD_ASIS);
+1 -1
drivers/leds/leds-lp5521.c
··· 523 523 struct lp55xx_chip *chip; 524 524 struct lp55xx_led *led; 525 525 struct lp55xx_platform_data *pdata = dev_get_platdata(&client->dev); 526 - struct device_node *np = client->dev.of_node; 526 + struct device_node *np = dev_of_node(&client->dev); 527 527 528 528 chip = devm_kzalloc(&client->dev, sizeof(*chip), GFP_KERNEL); 529 529 if (!chip)
+1 -1
drivers/leds/leds-lp5523.c
··· 891 891 struct lp55xx_chip *chip; 892 892 struct lp55xx_led *led; 893 893 struct lp55xx_platform_data *pdata = dev_get_platdata(&client->dev); 894 - struct device_node *np = client->dev.of_node; 894 + struct device_node *np = dev_of_node(&client->dev); 895 895 896 896 chip = devm_kzalloc(&client->dev, sizeof(*chip), GFP_KERNEL); 897 897 if (!chip)
+1 -1
drivers/leds/leds-lp5562.c
··· 518 518 struct lp55xx_chip *chip; 519 519 struct lp55xx_led *led; 520 520 struct lp55xx_platform_data *pdata = dev_get_platdata(&client->dev); 521 - struct device_node *np = client->dev.of_node; 521 + struct device_node *np = dev_of_node(&client->dev); 522 522 523 523 chip = devm_kzalloc(&client->dev, sizeof(*chip), GFP_KERNEL); 524 524 if (!chip)
+1 -1
drivers/leds/leds-lp8501.c
··· 306 306 struct lp55xx_chip *chip; 307 307 struct lp55xx_led *led; 308 308 struct lp55xx_platform_data *pdata = dev_get_platdata(&client->dev); 309 - struct device_node *np = client->dev.of_node; 309 + struct device_node *np = dev_of_node(&client->dev); 310 310 311 311 chip = devm_kzalloc(&client->dev, sizeof(*chip), GFP_KERNEL); 312 312 if (!chip)
+1 -1
drivers/leds/leds-lp8860.c
··· 380 380 { 381 381 int ret; 382 382 struct lp8860_led *led; 383 - struct device_node *np = client->dev.of_node; 383 + struct device_node *np = dev_of_node(&client->dev); 384 384 struct device_node *child_node; 385 385 struct led_init_data init_data = {}; 386 386
+1 -1
drivers/leds/leds-lt3593.c
··· 68 68 struct led_init_data init_data = {}; 69 69 const char *tmp; 70 70 71 - if (!dev->of_node) 71 + if (!dev_of_node(dev)) 72 72 return -ENODEV; 73 73 74 74 led_data = devm_kzalloc(dev, sizeof(*led_data), GFP_KERNEL);
+1 -1
drivers/leds/leds-max77693.c
··· 599 599 { 600 600 struct device *dev = &led->pdev->dev; 601 601 struct max77693_sub_led *sub_leds = led->sub_leds; 602 - struct device_node *node = dev->of_node, *child_node; 602 + struct device_node *node = dev_of_node(dev), *child_node; 603 603 struct property *prop; 604 604 u32 led_sources[2]; 605 605 int i, ret, fled_id;
+2 -2
drivers/leds/leds-mc13783.c
··· 121 121 if (!pdata) 122 122 return ERR_PTR(-ENOMEM); 123 123 124 - parent = of_get_child_by_name(dev->parent->of_node, "leds"); 124 + parent = of_get_child_by_name(dev_of_node(dev->parent), "leds"); 125 125 if (!parent) 126 126 goto out_node_put; 127 127 ··· 192 192 leds->master = mcdev; 193 193 platform_set_drvdata(pdev, leds); 194 194 195 - if (dev->parent->of_node) { 195 + if (dev_of_node(dev->parent)) { 196 196 pdata = mc13xxx_led_probe_dt(pdev); 197 197 if (IS_ERR(pdata)) 198 198 return PTR_ERR(pdata);
+1 -1
drivers/leds/leds-mt6323.c
··· 369 369 static int mt6323_led_probe(struct platform_device *pdev) 370 370 { 371 371 struct device *dev = &pdev->dev; 372 - struct device_node *np = pdev->dev.of_node; 372 + struct device_node *np = dev_of_node(&pdev->dev); 373 373 struct device_node *child; 374 374 struct mt6397_chip *hw = dev_get_drvdata(pdev->dev.parent); 375 375 struct mt6323_leds *leds;
+1 -1
drivers/leds/leds-netxbig.c
··· 419 419 static int netxbig_leds_get_of_pdata(struct device *dev, 420 420 struct netxbig_led_platform_data *pdata) 421 421 { 422 - struct device_node *np = dev->of_node; 422 + struct device_node *np = dev_of_node(dev); 423 423 struct device_node *gpio_ext_np; 424 424 struct platform_device *gpio_ext_pdev; 425 425 struct device *gpio_ext_dev;
+1 -1
drivers/leds/leds-ns2.c
··· 246 246 static int 247 247 ns2_leds_get_of_pdata(struct device *dev, struct ns2_led_platform_data *pdata) 248 248 { 249 - struct device_node *np = dev->of_node; 249 + struct device_node *np = dev_of_node(dev); 250 250 struct device_node *child; 251 251 struct ns2_led *led, *leds; 252 252 int ret, num_leds = 0;
+1 -1
drivers/leds/leds-pca9532.c
··· 507 507 struct pca9532_data *data = i2c_get_clientdata(client); 508 508 struct pca9532_platform_data *pca9532_pdata = 509 509 dev_get_platdata(&client->dev); 510 - struct device_node *np = client->dev.of_node; 510 + struct device_node *np = dev_of_node(&client->dev); 511 511 512 512 if (!pca9532_pdata) { 513 513 if (np) {
+1 -1
drivers/leds/leds-pm8058.c
··· 88 88 static int pm8058_led_probe(struct platform_device *pdev) 89 89 { 90 90 struct pm8058_led *led; 91 - struct device_node *np = pdev->dev.of_node; 91 + struct device_node *np = dev_of_node(&pdev->dev); 92 92 int ret; 93 93 struct regmap *map; 94 94 const char *state;
+1 -1
drivers/leds/leds-sc27xx-bltc.c
··· 276 276 static int sc27xx_led_probe(struct platform_device *pdev) 277 277 { 278 278 struct device *dev = &pdev->dev; 279 - struct device_node *np = dev->of_node, *child; 279 + struct device_node *np = dev_of_node(dev), *child; 280 280 struct sc27xx_led_priv *priv; 281 281 u32 base, count, reg; 282 282 int err;
+2 -2
drivers/leds/leds-spi-byte.c
··· 87 87 const char *state; 88 88 int ret; 89 89 90 - if (of_get_child_count(dev->of_node) != 1) { 90 + if (of_get_child_count(dev_of_node(dev)) != 1) { 91 91 dev_err(dev, "Device must have exactly one LED sub-node."); 92 92 return -EINVAL; 93 93 } 94 - child = of_get_next_child(dev->of_node, NULL); 94 + child = of_get_next_child(dev_of_node(dev), NULL); 95 95 96 96 led = devm_kzalloc(dev, sizeof(*led), GFP_KERNEL); 97 97 if (!led)
+2 -2
drivers/leds/leds-syscon.c
··· 56 56 static int syscon_led_probe(struct platform_device *pdev) 57 57 { 58 58 struct device *dev = &pdev->dev; 59 - struct device_node *np = dev->of_node; 59 + struct device_node *np = dev_of_node(dev); 60 60 struct device *parent; 61 61 struct regmap *map; 62 62 struct syscon_led *sled; ··· 68 68 dev_err(dev, "no parent for syscon LED\n"); 69 69 return -ENODEV; 70 70 } 71 - map = syscon_node_to_regmap(parent->of_node); 71 + map = syscon_node_to_regmap(dev_of_node(parent)); 72 72 if (IS_ERR(map)) { 73 73 dev_err(dev, "no regmap for syscon LED parent\n"); 74 74 return PTR_ERR(map);
+2 -2
drivers/leds/leds-tca6507.c
··· 656 656 tca->gpio.set = tca6507_gpio_set_value; 657 657 tca->gpio.parent = &client->dev; 658 658 #ifdef CONFIG_OF_GPIO 659 - tca->gpio.of_node = of_node_get(client->dev.of_node); 659 + tca->gpio.of_node = of_node_get(dev_of_node(&client->dev)); 660 660 #endif 661 661 err = gpiochip_add_data(&tca->gpio, tca); 662 662 if (err) { ··· 689 689 static struct tca6507_platform_data * 690 690 tca6507_led_dt_init(struct i2c_client *client) 691 691 { 692 - struct device_node *np = client->dev.of_node, *child; 692 + struct device_node *np = dev_of_node(&client->dev), *child; 693 693 struct tca6507_platform_data *pdata; 694 694 struct led_info *tca_leds; 695 695 int count;
+1 -1
drivers/leds/leds-tlc591xx.c
··· 148 148 tlc591xx_probe(struct i2c_client *client, 149 149 const struct i2c_device_id *id) 150 150 { 151 - struct device_node *np = client->dev.of_node, *child; 151 + struct device_node *np = dev_of_node(&client->dev), *child; 152 152 struct device *dev = &client->dev; 153 153 const struct tlc591xx *tlc591xx; 154 154 struct tlc591xx_priv *priv;
+1 -1
drivers/leds/leds-turris-omnia.c
··· 210 210 const struct i2c_device_id *id) 211 211 { 212 212 struct device *dev = &client->dev; 213 - struct device_node *np = dev->of_node, *child; 213 + struct device_node *np = dev_of_node(dev), *child; 214 214 struct omnia_leds *leds; 215 215 struct omnia_led *led; 216 216 int ret, count;