[PATCH v2 06/24] backlight: gpio: Use DECLARE_BACKLIGHT_INIT_RAW

Sam Ravnborg sam at ravnborg.org
Sun Aug 23 10:45:14 UTC 2020


Introduce use of DECLARE_BACKLIGHT_INIT_RAW when registering the
backlight.

Signed-off-by: Sam Ravnborg <sam at ravnborg.org>
Cc: Lee Jones <lee.jones at linaro.org>
Cc: Daniel Thompson <daniel.thompson at linaro.org>
Cc: Jingoo Han <jingoohan1 at gmail.com>
---
 drivers/video/backlight/gpio_backlight.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/video/backlight/gpio_backlight.c b/drivers/video/backlight/gpio_backlight.c
index 1d509b626b12..13d44417446a 100644
--- a/drivers/video/backlight/gpio_backlight.c
+++ b/drivers/video/backlight/gpio_backlight.c
@@ -49,7 +49,7 @@ static int gpio_backlight_probe(struct platform_device *pdev)
 	struct device *dev = &pdev->dev;
 	struct gpio_backlight_platform_data *pdata = dev_get_platdata(dev);
 	struct device_node *of_node = dev->of_node;
-	struct backlight_properties props;
+	DECLARE_BACKLIGHT_INIT_RAW(props, 1, 1);
 	struct backlight_device *bl;
 	struct gpio_backlight *gbl;
 	int ret, init_brightness, def_value;
@@ -69,9 +69,6 @@ static int gpio_backlight_probe(struct platform_device *pdev)
 		return dev_err_probe(dev, PTR_ERR(gbl->gpiod),
 				     "The gpios parameter is missing or invalid.\n");
 
-	memset(&props, 0, sizeof(props));
-	props.type = BACKLIGHT_RAW;
-	props.max_brightness = 1;
 	bl = devm_backlight_device_register(dev, dev_name(dev), dev, gbl,
 					    &gpio_backlight_ops, &props);
 	if (IS_ERR(bl)) {
@@ -96,8 +93,6 @@ static int gpio_backlight_probe(struct platform_device *pdev)
 	else
 		backlight_disable(bl);
 
-	bl->props.brightness = 1;
-
 	init_brightness = backlight_get_brightness(bl);
 	ret = gpiod_direction_output(gbl->gpiod, init_brightness);
 	if (ret) {
-- 
2.25.1



More information about the dri-devel mailing list