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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Aug 23, 2020 at 12:45:14PM +0200, Sam Ravnborg wrote:
> Introduce use of DECLARE_BACKLIGHT_INIT_RAW when registering the
> backlight.
> 
> Signed-off-by: Sam Ravnborg <sam@xxxxxxxxxxxx>
> Cc: Lee Jones <lee.jones@xxxxxxxxxx>
> Cc: Daniel Thompson <daniel.thompson@xxxxxxxxxx>
> Cc: Jingoo Han <jingoohan1@xxxxxxxxx>
> ---
>  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);

Other than the existing comment about wanting a scale this looks fine.

Curiously I think no value of scale would be wrong for this driver...
but I'd be tempted to mark it as logarithmic (e.g. hint that userspace
should expose it directly on a slider without any remapping).

However since no value is wrong then whatever you choose is OK and this
will be:
Reviewed-by: Daniel Thompson <daniel.thompson@xxxxxxxxxx>


Daniel.


>  	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
> 
_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel



[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux