--- zzzz-none-000/linux-3.10.107/drivers/video/backlight/tps65217_bl.c 2017-06-27 09:49:32.000000000 +0000 +++ scorpion-7490-727/linux-3.10.107/drivers/video/backlight/tps65217_bl.c 2021-02-04 17:41:59.000000000 +0000 @@ -109,15 +109,9 @@ return rc; } -static int tps65217_bl_get_brightness(struct backlight_device *bl) -{ - return bl->props.brightness; -} - static const struct backlight_ops tps65217_bl_ops = { .options = BL_CORE_SUSPENDRESUME, .update_status = tps65217_bl_update_status, - .get_brightness = tps65217_bl_get_brightness }; static int tps65217_bl_hw_init(struct tps65217_bl *tps65217_bl, @@ -200,7 +194,6 @@ pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); if (!pdata) { - dev_err(&pdev->dev, "failed to allocate platform data\n"); err = ERR_PTR(-ENOMEM); goto err; } @@ -287,20 +280,17 @@ if (IS_ERR(pdata)) return PTR_ERR(pdata); } else { - if (!pdev->dev.platform_data) { + pdata = dev_get_platdata(&pdev->dev); + if (!pdata) { dev_err(&pdev->dev, "no platform data provided\n"); return -EINVAL; } - - pdata = pdev->dev.platform_data; } tps65217_bl = devm_kzalloc(&pdev->dev, sizeof(*tps65217_bl), GFP_KERNEL); - if (tps65217_bl == NULL) { - dev_err(&pdev->dev, "allocation of struct tps65217_bl failed\n"); + if (tps65217_bl == NULL) return -ENOMEM; - } tps65217_bl->tps = tps; tps65217_bl->dev = &pdev->dev; @@ -314,7 +304,7 @@ bl_props.type = BACKLIGHT_RAW; bl_props.max_brightness = 100; - tps65217_bl->bl = backlight_device_register(pdev->name, + tps65217_bl->bl = devm_backlight_device_register(&pdev->dev, pdev->name, tps65217_bl->dev, tps65217_bl, &tps65217_bl_ops, &bl_props); if (IS_ERR(tps65217_bl->bl)) { @@ -330,20 +320,9 @@ return 0; } -static int tps65217_bl_remove(struct platform_device *pdev) -{ - struct tps65217_bl *tps65217_bl = platform_get_drvdata(pdev); - - backlight_device_unregister(tps65217_bl->bl); - - return 0; -} - static struct platform_driver tps65217_bl_driver = { .probe = tps65217_bl_probe, - .remove = tps65217_bl_remove, .driver = { - .owner = THIS_MODULE, .name = "tps65217-bl", }, };