Commit 87aae1ea82f93f0f00cb955044ea1db3501cf233
Committed by
Bryan Wu
1 parent
8465b01827
Exists in
smarc-imx_3.14.28_1.0.0_ga
and in
1 other branch
leds: use dev_get_platdata()
Use the wrapper function for retrieving the platform data instead of accessing dev->platform_data directly. Signed-off-by: Jingoo Han <jg1.han@samsung.com> Signed-off-by: Bryan Wu <cooloney@gmail.com>
Showing 30 changed files with 52 additions and 49 deletions Side-by-side Diff
- drivers/leds/leds-88pm860x.c
- drivers/leds/leds-adp5520.c
- drivers/leds/leds-asic3.c
- drivers/leds/leds-atmel-pwm.c
- drivers/leds/leds-bd2802.c
- drivers/leds/leds-da903x.c
- drivers/leds/leds-da9052.c
- drivers/leds/leds-gpio.c
- drivers/leds/leds-lm3530.c
- drivers/leds/leds-lm3533.c
- drivers/leds/leds-lm355x.c
- drivers/leds/leds-lm3642.c
- drivers/leds/leds-lp3944.c
- drivers/leds/leds-lp5521.c
- drivers/leds/leds-lp5523.c
- drivers/leds/leds-lp5562.c
- drivers/leds/leds-lp8501.c
- drivers/leds/leds-lt3593.c
- drivers/leds/leds-netxbig.c
- drivers/leds/leds-ns2.c
- drivers/leds/leds-pca9532.c
- drivers/leds/leds-pca955x.c
- drivers/leds/leds-pca9633.c
- drivers/leds/leds-pwm.c
- drivers/leds/leds-regulator.c
- drivers/leds/leds-renesas-tpu.c
- drivers/leds/leds-s3c24xx.c
- drivers/leds/leds-tca6507.c
- drivers/leds/leds-wm831x-status.c
- drivers/leds/leds-wm8350.c
drivers/leds/leds-88pm860x.c
... | ... | @@ -157,7 +157,7 @@ |
157 | 157 | static int pm860x_led_probe(struct platform_device *pdev) |
158 | 158 | { |
159 | 159 | struct pm860x_chip *chip = dev_get_drvdata(pdev->dev.parent); |
160 | - struct pm860x_led_pdata *pdata = pdev->dev.platform_data; | |
160 | + struct pm860x_led_pdata *pdata = dev_get_platdata(&pdev->dev); | |
161 | 161 | struct pm860x_led *data; |
162 | 162 | struct resource *res; |
163 | 163 | int ret = 0; |
drivers/leds/leds-adp5520.c
... | ... | @@ -87,7 +87,7 @@ |
87 | 87 | |
88 | 88 | static int adp5520_led_prepare(struct platform_device *pdev) |
89 | 89 | { |
90 | - struct adp5520_leds_platform_data *pdata = pdev->dev.platform_data; | |
90 | + struct adp5520_leds_platform_data *pdata = dev_get_platdata(&pdev->dev); | |
91 | 91 | struct device *dev = pdev->dev.parent; |
92 | 92 | int ret = 0; |
93 | 93 | |
... | ... | @@ -103,7 +103,7 @@ |
103 | 103 | |
104 | 104 | static int adp5520_led_probe(struct platform_device *pdev) |
105 | 105 | { |
106 | - struct adp5520_leds_platform_data *pdata = pdev->dev.platform_data; | |
106 | + struct adp5520_leds_platform_data *pdata = dev_get_platdata(&pdev->dev); | |
107 | 107 | struct adp5520_led *led, *led_dat; |
108 | 108 | struct led_info *cur_led; |
109 | 109 | int ret, i; |
... | ... | @@ -185,7 +185,7 @@ |
185 | 185 | |
186 | 186 | static int adp5520_led_remove(struct platform_device *pdev) |
187 | 187 | { |
188 | - struct adp5520_leds_platform_data *pdata = pdev->dev.platform_data; | |
188 | + struct adp5520_leds_platform_data *pdata = dev_get_platdata(&pdev->dev); | |
189 | 189 | struct adp5520_led *led; |
190 | 190 | int i; |
191 | 191 |
drivers/leds/leds-asic3.c
... | ... | @@ -94,7 +94,7 @@ |
94 | 94 | |
95 | 95 | static int asic3_led_probe(struct platform_device *pdev) |
96 | 96 | { |
97 | - struct asic3_led *led = pdev->dev.platform_data; | |
97 | + struct asic3_led *led = dev_get_platdata(&pdev->dev); | |
98 | 98 | int ret; |
99 | 99 | |
100 | 100 | ret = mfd_cell_enable(pdev); |
... | ... | @@ -127,7 +127,7 @@ |
127 | 127 | |
128 | 128 | static int asic3_led_remove(struct platform_device *pdev) |
129 | 129 | { |
130 | - struct asic3_led *led = pdev->dev.platform_data; | |
130 | + struct asic3_led *led = dev_get_platdata(&pdev->dev); | |
131 | 131 | |
132 | 132 | led_classdev_unregister(led->cdev); |
133 | 133 |
drivers/leds/leds-atmel-pwm.c
... | ... | @@ -42,7 +42,7 @@ |
42 | 42 | int i; |
43 | 43 | int status; |
44 | 44 | |
45 | - pdata = pdev->dev.platform_data; | |
45 | + pdata = dev_get_platdata(&pdev->dev); | |
46 | 46 | if (!pdata || pdata->num_leds < 1) |
47 | 47 | return -ENODEV; |
48 | 48 | |
... | ... | @@ -119,7 +119,7 @@ |
119 | 119 | struct pwmled *leds; |
120 | 120 | unsigned i; |
121 | 121 | |
122 | - pdata = pdev->dev.platform_data; | |
122 | + pdata = dev_get_platdata(&pdev->dev); | |
123 | 123 | leds = platform_get_drvdata(pdev); |
124 | 124 | |
125 | 125 | for (i = 0; i < pdata->num_leds; i++) { |
drivers/leds/leds-bd2802.c
... | ... | @@ -684,7 +684,7 @@ |
684 | 684 | } |
685 | 685 | |
686 | 686 | led->client = client; |
687 | - pdata = led->pdata = client->dev.platform_data; | |
687 | + pdata = led->pdata = dev_get_platdata(&client->dev); | |
688 | 688 | i2c_set_clientdata(client, led); |
689 | 689 | |
690 | 690 | /* Configure RESET GPIO (L: RESET, H: RESET cancel) */ |
drivers/leds/leds-da903x.c
drivers/leds/leds-da9052.c
... | ... | @@ -112,7 +112,7 @@ |
112 | 112 | int i; |
113 | 113 | |
114 | 114 | da9052 = dev_get_drvdata(pdev->dev.parent); |
115 | - pdata = da9052->dev->platform_data; | |
115 | + pdata = dev_get_platdata(da9052->dev); | |
116 | 116 | if (pdata == NULL) { |
117 | 117 | dev_err(&pdev->dev, "No platform data\n"); |
118 | 118 | goto err; |
... | ... | @@ -185,7 +185,7 @@ |
185 | 185 | int i; |
186 | 186 | |
187 | 187 | da9052 = dev_get_drvdata(pdev->dev.parent); |
188 | - pdata = da9052->dev->platform_data; | |
188 | + pdata = dev_get_platdata(da9052->dev); | |
189 | 189 | pled = pdata->pled; |
190 | 190 | |
191 | 191 | for (i = 0; i < pled->num_leds; i++) { |
drivers/leds/leds-gpio.c
... | ... | @@ -233,7 +233,7 @@ |
233 | 233 | |
234 | 234 | static int gpio_led_probe(struct platform_device *pdev) |
235 | 235 | { |
236 | - struct gpio_led_platform_data *pdata = pdev->dev.platform_data; | |
236 | + struct gpio_led_platform_data *pdata = dev_get_platdata(&pdev->dev); | |
237 | 237 | struct gpio_leds_priv *priv; |
238 | 238 | int i, ret = 0; |
239 | 239 |
drivers/leds/leds-lm3530.c
... | ... | @@ -403,7 +403,7 @@ |
403 | 403 | static int lm3530_probe(struct i2c_client *client, |
404 | 404 | const struct i2c_device_id *id) |
405 | 405 | { |
406 | - struct lm3530_platform_data *pdata = client->dev.platform_data; | |
406 | + struct lm3530_platform_data *pdata = dev_get_platdata(&client->dev); | |
407 | 407 | struct lm3530_data *drvdata; |
408 | 408 | int err = 0; |
409 | 409 |
drivers/leds/leds-lm3533.c
drivers/leds/leds-lm355x.c
... | ... | @@ -423,7 +423,7 @@ |
423 | 423 | static int lm355x_probe(struct i2c_client *client, |
424 | 424 | const struct i2c_device_id *id) |
425 | 425 | { |
426 | - struct lm355x_platform_data *pdata = client->dev.platform_data; | |
426 | + struct lm355x_platform_data *pdata = dev_get_platdata(&client->dev); | |
427 | 427 | struct lm355x_chip_data *chip; |
428 | 428 | |
429 | 429 | int err; |
drivers/leds/leds-lm3642.c
... | ... | @@ -316,7 +316,7 @@ |
316 | 316 | static int lm3642_probe(struct i2c_client *client, |
317 | 317 | const struct i2c_device_id *id) |
318 | 318 | { |
319 | - struct lm3642_platform_data *pdata = client->dev.platform_data; | |
319 | + struct lm3642_platform_data *pdata = dev_get_platdata(&client->dev); | |
320 | 320 | struct lm3642_chip_data *chip; |
321 | 321 | |
322 | 322 | int err; |
drivers/leds/leds-lp3944.c
... | ... | @@ -377,7 +377,8 @@ |
377 | 377 | static int lp3944_probe(struct i2c_client *client, |
378 | 378 | const struct i2c_device_id *id) |
379 | 379 | { |
380 | - struct lp3944_platform_data *lp3944_pdata = client->dev.platform_data; | |
380 | + struct lp3944_platform_data *lp3944_pdata = | |
381 | + dev_get_platdata(&client->dev); | |
381 | 382 | struct lp3944_data *data; |
382 | 383 | int err; |
383 | 384 | |
... | ... | @@ -413,7 +414,7 @@ |
413 | 414 | |
414 | 415 | static int lp3944_remove(struct i2c_client *client) |
415 | 416 | { |
416 | - struct lp3944_platform_data *pdata = client->dev.platform_data; | |
417 | + struct lp3944_platform_data *pdata = dev_get_platdata(&client->dev); | |
417 | 418 | struct lp3944_data *data = i2c_get_clientdata(client); |
418 | 419 | int i; |
419 | 420 |
drivers/leds/leds-lp5521.c
... | ... | @@ -420,7 +420,7 @@ |
420 | 420 | struct lp55xx_platform_data *pdata; |
421 | 421 | struct device_node *np = client->dev.of_node; |
422 | 422 | |
423 | - if (!client->dev.platform_data) { | |
423 | + if (!dev_get_platdata(&client->dev)) { | |
424 | 424 | if (np) { |
425 | 425 | ret = lp55xx_of_populate_pdata(&client->dev, np); |
426 | 426 | if (ret < 0) |
... | ... | @@ -430,7 +430,7 @@ |
430 | 430 | return -EINVAL; |
431 | 431 | } |
432 | 432 | } |
433 | - pdata = client->dev.platform_data; | |
433 | + pdata = dev_get_platdata(&client->dev); | |
434 | 434 | |
435 | 435 | chip = devm_kzalloc(&client->dev, sizeof(*chip), GFP_KERNEL); |
436 | 436 | if (!chip) |
drivers/leds/leds-lp5523.c
... | ... | @@ -432,7 +432,7 @@ |
432 | 432 | struct lp55xx_platform_data *pdata; |
433 | 433 | struct device_node *np = client->dev.of_node; |
434 | 434 | |
435 | - if (!client->dev.platform_data) { | |
435 | + if (!dev_get_platdata(&client->dev)) { | |
436 | 436 | if (np) { |
437 | 437 | ret = lp55xx_of_populate_pdata(&client->dev, np); |
438 | 438 | if (ret < 0) |
... | ... | @@ -442,7 +442,7 @@ |
442 | 442 | return -EINVAL; |
443 | 443 | } |
444 | 444 | } |
445 | - pdata = client->dev.platform_data; | |
445 | + pdata = dev_get_platdata(&client->dev); | |
446 | 446 | |
447 | 447 | chip = devm_kzalloc(&client->dev, sizeof(*chip), GFP_KERNEL); |
448 | 448 | if (!chip) |
drivers/leds/leds-lp5562.c
... | ... | @@ -518,7 +518,7 @@ |
518 | 518 | struct lp55xx_platform_data *pdata; |
519 | 519 | struct device_node *np = client->dev.of_node; |
520 | 520 | |
521 | - if (!client->dev.platform_data) { | |
521 | + if (!dev_get_platdata(&client->dev)) { | |
522 | 522 | if (np) { |
523 | 523 | ret = lp55xx_of_populate_pdata(&client->dev, np); |
524 | 524 | if (ret < 0) |
... | ... | @@ -528,7 +528,7 @@ |
528 | 528 | return -EINVAL; |
529 | 529 | } |
530 | 530 | } |
531 | - pdata = client->dev.platform_data; | |
531 | + pdata = dev_get_platdata(&client->dev); | |
532 | 532 | |
533 | 533 | chip = devm_kzalloc(&client->dev, sizeof(*chip), GFP_KERNEL); |
534 | 534 | if (!chip) |
drivers/leds/leds-lp8501.c
... | ... | @@ -310,7 +310,7 @@ |
310 | 310 | struct lp55xx_platform_data *pdata; |
311 | 311 | struct device_node *np = client->dev.of_node; |
312 | 312 | |
313 | - if (!client->dev.platform_data) { | |
313 | + if (!dev_get_platdata(&client->dev)) { | |
314 | 314 | if (np) { |
315 | 315 | ret = lp55xx_of_populate_pdata(&client->dev, np); |
316 | 316 | if (ret < 0) |
... | ... | @@ -320,7 +320,7 @@ |
320 | 320 | return -EINVAL; |
321 | 321 | } |
322 | 322 | } |
323 | - pdata = client->dev.platform_data; | |
323 | + pdata = dev_get_platdata(&client->dev); | |
324 | 324 | |
325 | 325 | chip = devm_kzalloc(&client->dev, sizeof(*chip), GFP_KERNEL); |
326 | 326 | if (!chip) |
drivers/leds/leds-lt3593.c
... | ... | @@ -135,7 +135,7 @@ |
135 | 135 | |
136 | 136 | static int lt3593_led_probe(struct platform_device *pdev) |
137 | 137 | { |
138 | - struct gpio_led_platform_data *pdata = pdev->dev.platform_data; | |
138 | + struct gpio_led_platform_data *pdata = dev_get_platdata(&pdev->dev); | |
139 | 139 | struct lt3593_led_data *leds_data; |
140 | 140 | int i, ret = 0; |
141 | 141 | |
... | ... | @@ -169,7 +169,7 @@ |
169 | 169 | static int lt3593_led_remove(struct platform_device *pdev) |
170 | 170 | { |
171 | 171 | int i; |
172 | - struct gpio_led_platform_data *pdata = pdev->dev.platform_data; | |
172 | + struct gpio_led_platform_data *pdata = dev_get_platdata(&pdev->dev); | |
173 | 173 | struct lt3593_led_data *leds_data; |
174 | 174 | |
175 | 175 | leds_data = platform_get_drvdata(pdev); |
drivers/leds/leds-netxbig.c
... | ... | @@ -306,7 +306,7 @@ |
306 | 306 | struct netxbig_led_data *led_dat, |
307 | 307 | const struct netxbig_led *template) |
308 | 308 | { |
309 | - struct netxbig_led_platform_data *pdata = pdev->dev.platform_data; | |
309 | + struct netxbig_led_platform_data *pdata = dev_get_platdata(&pdev->dev); | |
310 | 310 | int ret; |
311 | 311 | |
312 | 312 | spin_lock_init(&led_dat->lock); |
... | ... | @@ -354,7 +354,7 @@ |
354 | 354 | |
355 | 355 | static int netxbig_led_probe(struct platform_device *pdev) |
356 | 356 | { |
357 | - struct netxbig_led_platform_data *pdata = pdev->dev.platform_data; | |
357 | + struct netxbig_led_platform_data *pdata = dev_get_platdata(&pdev->dev); | |
358 | 358 | struct netxbig_led_data *leds_data; |
359 | 359 | int i; |
360 | 360 | int ret; |
... | ... | @@ -391,7 +391,7 @@ |
391 | 391 | |
392 | 392 | static int netxbig_led_remove(struct platform_device *pdev) |
393 | 393 | { |
394 | - struct netxbig_led_platform_data *pdata = pdev->dev.platform_data; | |
394 | + struct netxbig_led_platform_data *pdata = dev_get_platdata(&pdev->dev); | |
395 | 395 | struct netxbig_led_data *leds_data; |
396 | 396 | int i; |
397 | 397 |
drivers/leds/leds-ns2.c
... | ... | @@ -321,7 +321,7 @@ |
321 | 321 | |
322 | 322 | static int ns2_led_probe(struct platform_device *pdev) |
323 | 323 | { |
324 | - struct ns2_led_platform_data *pdata = pdev->dev.platform_data; | |
324 | + struct ns2_led_platform_data *pdata = dev_get_platdata(&pdev->dev); | |
325 | 325 | struct ns2_led_priv *priv; |
326 | 326 | int i; |
327 | 327 | int ret; |
drivers/leds/leds-pca9532.c
... | ... | @@ -446,7 +446,8 @@ |
446 | 446 | const struct i2c_device_id *id) |
447 | 447 | { |
448 | 448 | struct pca9532_data *data = i2c_get_clientdata(client); |
449 | - struct pca9532_platform_data *pca9532_pdata = client->dev.platform_data; | |
449 | + struct pca9532_platform_data *pca9532_pdata = | |
450 | + dev_get_platdata(&client->dev); | |
450 | 451 | |
451 | 452 | if (!pca9532_pdata) |
452 | 453 | return -EIO; |
drivers/leds/leds-pca955x.c
... | ... | @@ -267,7 +267,7 @@ |
267 | 267 | |
268 | 268 | chip = &pca955x_chipdefs[id->driver_data]; |
269 | 269 | adapter = to_i2c_adapter(client->dev.parent); |
270 | - pdata = client->dev.platform_data; | |
270 | + pdata = dev_get_platdata(&client->dev); | |
271 | 271 | |
272 | 272 | /* Make sure the slave address / chip type combo given is possible */ |
273 | 273 | if ((client->addr & ~((1 << chip->slv_addr_shift) - 1)) != |
drivers/leds/leds-pca9633.c
drivers/leds/leds-pwm.c
... | ... | @@ -147,7 +147,7 @@ |
147 | 147 | |
148 | 148 | static int led_pwm_probe(struct platform_device *pdev) |
149 | 149 | { |
150 | - struct led_pwm_platform_data *pdata = pdev->dev.platform_data; | |
150 | + struct led_pwm_platform_data *pdata = dev_get_platdata(&pdev->dev); | |
151 | 151 | struct led_pwm_priv *priv; |
152 | 152 | int i, ret = 0; |
153 | 153 |
drivers/leds/leds-regulator.c
... | ... | @@ -142,7 +142,8 @@ |
142 | 142 | |
143 | 143 | static int regulator_led_probe(struct platform_device *pdev) |
144 | 144 | { |
145 | - struct led_regulator_platform_data *pdata = pdev->dev.platform_data; | |
145 | + struct led_regulator_platform_data *pdata = | |
146 | + dev_get_platdata(&pdev->dev); | |
146 | 147 | struct regulator_led *led; |
147 | 148 | struct regulator *vcc; |
148 | 149 | int ret = 0; |
drivers/leds/leds-renesas-tpu.c
... | ... | @@ -65,7 +65,7 @@ |
65 | 65 | |
66 | 66 | static inline u16 r_tpu_read(struct r_tpu_priv *p, int reg_nr) |
67 | 67 | { |
68 | - struct led_renesas_tpu_config *cfg = p->pdev->dev.platform_data; | |
68 | + struct led_renesas_tpu_config *cfg = dev_get_platdata(&p->pdev->dev); | |
69 | 69 | void __iomem *base = p->mapbase; |
70 | 70 | unsigned long offs = reg_nr << 2; |
71 | 71 | |
... | ... | @@ -77,7 +77,7 @@ |
77 | 77 | |
78 | 78 | static inline void r_tpu_write(struct r_tpu_priv *p, int reg_nr, u16 value) |
79 | 79 | { |
80 | - struct led_renesas_tpu_config *cfg = p->pdev->dev.platform_data; | |
80 | + struct led_renesas_tpu_config *cfg = dev_get_platdata(&p->pdev->dev); | |
81 | 81 | void __iomem *base = p->mapbase; |
82 | 82 | unsigned long offs = reg_nr << 2; |
83 | 83 | |
... | ... | @@ -91,7 +91,7 @@ |
91 | 91 | |
92 | 92 | static void r_tpu_start_stop_ch(struct r_tpu_priv *p, int start) |
93 | 93 | { |
94 | - struct led_renesas_tpu_config *cfg = p->pdev->dev.platform_data; | |
94 | + struct led_renesas_tpu_config *cfg = dev_get_platdata(&p->pdev->dev); | |
95 | 95 | unsigned long flags; |
96 | 96 | u16 value; |
97 | 97 | |
... | ... | @@ -110,7 +110,7 @@ |
110 | 110 | |
111 | 111 | static int r_tpu_enable(struct r_tpu_priv *p, enum led_brightness brightness) |
112 | 112 | { |
113 | - struct led_renesas_tpu_config *cfg = p->pdev->dev.platform_data; | |
113 | + struct led_renesas_tpu_config *cfg = dev_get_platdata(&p->pdev->dev); | |
114 | 114 | int prescaler[] = { 1, 4, 16, 64 }; |
115 | 115 | int k, ret; |
116 | 116 | unsigned long rate, tmp; |
... | ... | @@ -190,7 +190,7 @@ |
190 | 190 | static void r_tpu_set_pin(struct r_tpu_priv *p, enum r_tpu_pin new_state, |
191 | 191 | enum led_brightness brightness) |
192 | 192 | { |
193 | - struct led_renesas_tpu_config *cfg = p->pdev->dev.platform_data; | |
193 | + struct led_renesas_tpu_config *cfg = dev_get_platdata(&p->pdev->dev); | |
194 | 194 | |
195 | 195 | if (p->pin_state == new_state) { |
196 | 196 | if (p->pin_state == R_TPU_PIN_GPIO) |
... | ... | @@ -241,7 +241,7 @@ |
241 | 241 | |
242 | 242 | static int r_tpu_probe(struct platform_device *pdev) |
243 | 243 | { |
244 | - struct led_renesas_tpu_config *cfg = pdev->dev.platform_data; | |
244 | + struct led_renesas_tpu_config *cfg = dev_get_platdata(&pdev->dev); | |
245 | 245 | struct r_tpu_priv *p; |
246 | 246 | struct resource *res; |
247 | 247 | int ret; |
drivers/leds/leds-s3c24xx.c
drivers/leds/leds-tca6507.c
drivers/leds/leds-wm831x-status.c
... | ... | @@ -246,8 +246,8 @@ |
246 | 246 | drvdata->wm831x = wm831x; |
247 | 247 | drvdata->reg = res->start; |
248 | 248 | |
249 | - if (wm831x->dev->platform_data) | |
250 | - chip_pdata = wm831x->dev->platform_data; | |
249 | + if (dev_get_platdata(wm831x->dev)) | |
250 | + chip_pdata = dev_get_platdata(wm831x->dev); | |
251 | 251 | else |
252 | 252 | chip_pdata = NULL; |
253 | 253 |
drivers/leds/leds-wm8350.c
... | ... | @@ -203,7 +203,7 @@ |
203 | 203 | { |
204 | 204 | struct regulator *isink, *dcdc; |
205 | 205 | struct wm8350_led *led; |
206 | - struct wm8350_led_platform_data *pdata = pdev->dev.platform_data; | |
206 | + struct wm8350_led_platform_data *pdata = dev_get_platdata(&pdev->dev); | |
207 | 207 | int i; |
208 | 208 | |
209 | 209 | if (pdata == NULL) { |