--- zzzz-none-000/linux-3.10.107/drivers/video/backlight/88pm860x_bl.c 2017-06-27 09:49:32.000000000 +0000 +++ scorpion-7490-727/linux-3.10.107/drivers/video/backlight/88pm860x_bl.c 2021-02-04 17:41:59.000000000 +0000 @@ -168,10 +168,7 @@ struct device_node *nproot, *np; int iset = 0; - nproot = of_node_get(pdev->dev.parent->of_node); - if (!nproot) - return -ENODEV; - nproot = of_find_node_by_name(nproot, "backlights"); + nproot = of_get_child_by_name(pdev->dev.parent->of_node, "backlights"); if (!nproot) { dev_err(&pdev->dev, "failed to find backlights node\n"); return -ENODEV; @@ -183,6 +180,7 @@ data->iset = PM8606_WLED_CURRENT(iset); of_property_read_u32(np, "marvell,88pm860x-pwm", &data->pwm); + of_node_put(np); break; } } @@ -196,7 +194,7 @@ static int pm860x_backlight_probe(struct platform_device *pdev) { struct pm860x_chip *chip = dev_get_drvdata(pdev->dev.parent); - struct pm860x_backlight_pdata *pdata = pdev->dev.platform_data; + struct pm860x_backlight_pdata *pdata = dev_get_platdata(&pdev->dev); struct pm860x_backlight_data *data; struct backlight_device *bl; struct resource *res; @@ -216,7 +214,7 @@ data->reg_duty_cycle = res->start; res = platform_get_resource_byname(pdev, IORESOURCE_REG, "always on"); if (!res) { - dev_err(&pdev->dev, "No REG resorce for always on\n"); + dev_err(&pdev->dev, "No REG resource for always on\n"); return -ENXIO; } data->reg_always_on = res->start; @@ -243,7 +241,7 @@ memset(&props, 0, sizeof(struct backlight_properties)); props.type = BACKLIGHT_RAW; props.max_brightness = MAX_BRIGHTNESS; - bl = backlight_device_register(name, &pdev->dev, data, + bl = devm_backlight_device_register(&pdev->dev, name, &pdev->dev, data, &pm860x_backlight_ops, &props); if (IS_ERR(bl)) { dev_err(&pdev->dev, "failed to register backlight\n"); @@ -256,30 +254,17 @@ /* read current backlight */ ret = pm860x_backlight_get_brightness(bl); if (ret < 0) - goto out_brt; + return ret; backlight_update_status(bl); return 0; -out_brt: - backlight_device_unregister(bl); - return ret; -} - -static int pm860x_backlight_remove(struct platform_device *pdev) -{ - struct backlight_device *bl = platform_get_drvdata(pdev); - - backlight_device_unregister(bl); - return 0; } static struct platform_driver pm860x_backlight_driver = { .driver = { .name = "88pm860x-backlight", - .owner = THIS_MODULE, }, .probe = pm860x_backlight_probe, - .remove = pm860x_backlight_remove, }; module_platform_driver(pm860x_backlight_driver);