Skip to content

Commit 19d2e0c

Browse files
LeSpockypavelmachek
authored andcommitted
leds: pwm: Remove platform_data support
Since commit 141f15c ("leds: pwm: remove header") that platform interface is not usable from outside and there seems to be no in tree user anymore. All in-tree users of the leds-pwm driver seem to use DT currently. Getting rid of the old platform interface allows the leds-pwm driver to switch over from 'devm_led_classdev_register()' to 'devm_led_classdev_register_ext()'. Signed-off-by: Alexander Dahl <[email protected]> Cc: Denis Osterland-Heim <[email protected]> Reviewed-by: Marek Behún <[email protected]> Signed-off-by: Pavel Machek <[email protected]>
1 parent 98d278c commit 19d2e0c

File tree

1 file changed

+5
-25
lines changed

1 file changed

+5
-25
lines changed

drivers/leds/leds-pwm.c

Lines changed: 5 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,6 @@ struct led_pwm {
2424
unsigned int max_brightness;
2525
};
2626

27-
struct led_pwm_platform_data {
28-
int num_leds;
29-
struct led_pwm *leds;
30-
};
31-
3227
struct led_pwm_data {
3328
struct led_classdev cdev;
3429
struct pwm_device *pwm;
@@ -60,6 +55,7 @@ static int led_pwm_set(struct led_classdev *led_cdev,
6055
return pwm_apply_state(led_dat->pwm, &led_dat->pwmstate);
6156
}
6257

58+
__attribute__((nonnull))
6359
static int led_pwm_add(struct device *dev, struct led_pwm_priv *priv,
6460
struct led_pwm *led, struct fwnode_handle *fwnode)
6561
{
@@ -73,10 +69,7 @@ static int led_pwm_add(struct device *dev, struct led_pwm_priv *priv,
7369
led_data->cdev.max_brightness = led->max_brightness;
7470
led_data->cdev.flags = LED_CORE_SUSPENDRESUME;
7571

76-
if (fwnode)
77-
led_data->pwm = devm_fwnode_pwm_get(dev, fwnode, NULL);
78-
else
79-
led_data->pwm = devm_pwm_get(dev, led->name);
72+
led_data->pwm = devm_fwnode_pwm_get(dev, fwnode, NULL);
8073
if (IS_ERR(led_data->pwm))
8174
return dev_err_probe(dev, PTR_ERR(led_data->pwm),
8275
"unable to request PWM for %s\n",
@@ -139,15 +132,11 @@ static int led_pwm_create_fwnode(struct device *dev, struct led_pwm_priv *priv)
139132

140133
static int led_pwm_probe(struct platform_device *pdev)
141134
{
142-
struct led_pwm_platform_data *pdata = dev_get_platdata(&pdev->dev);
143135
struct led_pwm_priv *priv;
144-
int count, i;
145136
int ret = 0;
137+
int count;
146138

147-
if (pdata)
148-
count = pdata->num_leds;
149-
else
150-
count = device_get_child_node_count(&pdev->dev);
139+
count = device_get_child_node_count(&pdev->dev);
151140

152141
if (!count)
153142
return -EINVAL;
@@ -157,16 +146,7 @@ static int led_pwm_probe(struct platform_device *pdev)
157146
if (!priv)
158147
return -ENOMEM;
159148

160-
if (pdata) {
161-
for (i = 0; i < count; i++) {
162-
ret = led_pwm_add(&pdev->dev, priv, &pdata->leds[i],
163-
NULL);
164-
if (ret)
165-
break;
166-
}
167-
} else {
168-
ret = led_pwm_create_fwnode(&pdev->dev, priv);
169-
}
149+
ret = led_pwm_create_fwnode(&pdev->dev, priv);
170150

171151
if (ret)
172152
return ret;

0 commit comments

Comments
 (0)