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

leds: pwm: Remove platform_data support

Since commit 141f15c66d94 ("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 <post@lespocky.de>
Cc: Denis Osterland-Heim <denis.osterland@diehl.com>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
Signed-off-by: Pavel Machek <pavel@ucw.cz>

authored by

Alexander Dahl and committed by
Pavel Machek
19d2e0ce 98d278ca

+5 -25
+5 -25
drivers/leds/leds-pwm.c
··· 24 24 unsigned int max_brightness; 25 25 }; 26 26 27 - struct led_pwm_platform_data { 28 - int num_leds; 29 - struct led_pwm *leds; 30 - }; 31 - 32 27 struct led_pwm_data { 33 28 struct led_classdev cdev; 34 29 struct pwm_device *pwm; ··· 55 60 return pwm_apply_state(led_dat->pwm, &led_dat->pwmstate); 56 61 } 57 62 63 + __attribute__((nonnull)) 58 64 static int led_pwm_add(struct device *dev, struct led_pwm_priv *priv, 59 65 struct led_pwm *led, struct fwnode_handle *fwnode) 60 66 { ··· 69 73 led_data->cdev.max_brightness = led->max_brightness; 70 74 led_data->cdev.flags = LED_CORE_SUSPENDRESUME; 71 75 72 - if (fwnode) 73 - led_data->pwm = devm_fwnode_pwm_get(dev, fwnode, NULL); 74 - else 75 - led_data->pwm = devm_pwm_get(dev, led->name); 76 + led_data->pwm = devm_fwnode_pwm_get(dev, fwnode, NULL); 76 77 if (IS_ERR(led_data->pwm)) 77 78 return dev_err_probe(dev, PTR_ERR(led_data->pwm), 78 79 "unable to request PWM for %s\n", ··· 132 139 133 140 static int led_pwm_probe(struct platform_device *pdev) 134 141 { 135 - struct led_pwm_platform_data *pdata = dev_get_platdata(&pdev->dev); 136 142 struct led_pwm_priv *priv; 137 - int count, i; 138 143 int ret = 0; 144 + int count; 139 145 140 - if (pdata) 141 - count = pdata->num_leds; 142 - else 143 - count = device_get_child_node_count(&pdev->dev); 146 + count = device_get_child_node_count(&pdev->dev); 144 147 145 148 if (!count) 146 149 return -EINVAL; ··· 146 157 if (!priv) 147 158 return -ENOMEM; 148 159 149 - if (pdata) { 150 - for (i = 0; i < count; i++) { 151 - ret = led_pwm_add(&pdev->dev, priv, &pdata->leds[i], 152 - NULL); 153 - if (ret) 154 - break; 155 - } 156 - } else { 157 - ret = led_pwm_create_fwnode(&pdev->dev, priv); 158 - } 160 + ret = led_pwm_create_fwnode(&pdev->dev, priv); 159 161 160 162 if (ret) 161 163 return ret;