leds: pm8058: cosmetic change: use helper variable
Use helper variable dev instead of always writing &pdev->dev. Signed-off-by: Marek Behún <marek.behun@nic.cz> Cc: Linus Walleij <linus.walleij@linaro.org> Cc: Bjorn Andersson <bjorn.andersson@linaro.org> Signed-off-by: Pavel Machek <pavel@ucw.cz>
This commit is contained in:
parent
eed951bbf7
commit
fb270ba0d9
|
@ -88,29 +88,32 @@ static enum led_brightness pm8058_led_get(struct led_classdev *cled)
|
||||||
static int pm8058_led_probe(struct platform_device *pdev)
|
static int pm8058_led_probe(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
struct led_init_data init_data = {};
|
struct led_init_data init_data = {};
|
||||||
|
struct device *dev = &pdev->dev;
|
||||||
struct pm8058_led *led;
|
struct pm8058_led *led;
|
||||||
struct device_node *np = dev_of_node(&pdev->dev);
|
struct device_node *np;
|
||||||
int ret;
|
int ret;
|
||||||
struct regmap *map;
|
struct regmap *map;
|
||||||
const char *state;
|
const char *state;
|
||||||
enum led_brightness maxbright;
|
enum led_brightness maxbright;
|
||||||
|
|
||||||
led = devm_kzalloc(&pdev->dev, sizeof(*led), GFP_KERNEL);
|
led = devm_kzalloc(dev, sizeof(*led), GFP_KERNEL);
|
||||||
if (!led)
|
if (!led)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
led->ledtype = (u32)(unsigned long)of_device_get_match_data(&pdev->dev);
|
led->ledtype = (u32)(unsigned long)of_device_get_match_data(dev);
|
||||||
|
|
||||||
map = dev_get_regmap(pdev->dev.parent, NULL);
|
map = dev_get_regmap(dev->parent, NULL);
|
||||||
if (!map) {
|
if (!map) {
|
||||||
dev_err(&pdev->dev, "Parent regmap unavailable.\n");
|
dev_err(dev, "Parent regmap unavailable.\n");
|
||||||
return -ENXIO;
|
return -ENXIO;
|
||||||
}
|
}
|
||||||
led->map = map;
|
led->map = map;
|
||||||
|
|
||||||
|
np = dev_of_node(dev);
|
||||||
|
|
||||||
ret = of_property_read_u32(np, "reg", &led->reg);
|
ret = of_property_read_u32(np, "reg", &led->reg);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
dev_err(&pdev->dev, "no register offset specified\n");
|
dev_err(dev, "no register offset specified\n");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -143,10 +146,9 @@ static int pm8058_led_probe(struct platform_device *pdev)
|
||||||
|
|
||||||
init_data.fwnode = of_fwnode_handle(np);
|
init_data.fwnode = of_fwnode_handle(np);
|
||||||
|
|
||||||
ret = devm_led_classdev_register_ext(&pdev->dev, &led->cdev,
|
ret = devm_led_classdev_register_ext(dev, &led->cdev, &init_data);
|
||||||
&init_data);
|
|
||||||
if (ret) {
|
if (ret) {
|
||||||
dev_err(&pdev->dev, "Failed to register LED for %pOF\n", np);
|
dev_err(dev, "Failed to register LED for %pOF\n", np);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue