lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4e3f3cbd-b5a9-fb58-e245-f374709e38d7@tronnes.org>
Date:   Sun, 21 Jan 2018 19:39:07 +0100
From:   Noralf Trønnes <noralf@...nnes.org>
To:     Meghana Madhyastha <meghana.madhyastha@...il.com>,
        Lee Jones <lee.jones@...aro.org>,
        Daniel Thompson <daniel.thompson@...aro.org>,
        Jingoo Han <jingoohan1@...il.com>,
        Thierry Reding <thierry.reding@...il.com>,
        Tomi Valkeinen <tomi.valkeinen@...com>,
        Daniel Vetter <daniel.vetter@...el.com>,
        Sean Paul <seanpaul@...omium.org>,
        dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v17 09/10] drm/panel: Use of_find_backlight helper


Den 19.01.2018 11.47, skrev Meghana Madhyastha:
> Replace of_find_backlight_by_node and of the code around it
> with of_find_backlight helper to avoid repetition of code.
>
> Signed-off-by: Meghana Madhyastha <meghana.madhyastha@...il.com>
> ---
> changes in v17:
> -remove put_device() to avoid double put
>   as we are using the devm version
>
>   drivers/gpu/drm/panel/panel-innolux-p079zca.c   | 23 ++++-------------------
>   drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c | 25 ++++---------------------
>   drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c | 25 ++++---------------------
>   3 files changed, 12 insertions(+), 61 deletions(-)
>
> diff --git a/drivers/gpu/drm/panel/panel-innolux-p079zca.c b/drivers/gpu/drm/panel/panel-innolux-p079zca.c
> index 4c1b29eec..059f4af1a 100644
> --- a/drivers/gpu/drm/panel/panel-innolux-p079zca.c
> +++ b/drivers/gpu/drm/panel/panel-innolux-p079zca.c
> @@ -230,37 +230,22 @@ static int innolux_panel_add(struct innolux_panel *innolux)
>   		innolux->enable_gpio = NULL;
>   	}
>   
> -	np = of_parse_phandle(dev->of_node, "backlight", 0);
> -	if (np) {
> -		innolux->backlight = of_find_backlight_by_node(np);
> -		of_node_put(np);
> +	innolux->backlight = devm_of_find_backlight(np);

There are several errors in these two last patches, like this one:

/home/pi/dim-build/workdirs/drm-misc/linux-linus/drivers/gpu/drm/panel/panel-innolux-p079zca.c: 
In function 'innolux_panel_add':
/home/pi/dim-build/workdirs/drm-misc/linux-linus/drivers/gpu/drm/panel/panel-innolux-p079zca.c:233:46: 
warning: passing argument 1 of 'devm_of_find_backlight' from 
incompatible pointer type
   innolux->backlight = devm_of_find_backlight(np);

Instead of tracking down the build dependencies to get this driver built,
you can instead use these defconfigs and all DRM drivers should be built:
https://cgit.freedesktop.org/drm/drm-tip/tree/?h=rerere-cache

But not all drivers are built on every architecture.

Noralf.

>   
> -		if (!innolux->backlight)
> -			return -EPROBE_DEFER;
> -	}
> +	if (IS_ERR(innolux->backlight))
> +		return PTR_ERR(innolux->backlight);
>   
>   	drm_panel_init(&innolux->base);
>   	innolux->base.funcs = &innolux_panel_funcs;
>   	innolux->base.dev = &innolux->link->dev;
>   
> -	err = drm_panel_add(&innolux->base);
> -	if (err < 0)
> -		goto put_backlight;
> -
> -	return 0;
> -
> -put_backlight:
> -	put_device(&innolux->backlight->dev);
> -
> -	return err;
> +	return drm_panel_add(&innolux->base);
>   }
>   
>   static void innolux_panel_del(struct innolux_panel *innolux)
>   {
>   	if (innolux->base.dev)
>   		drm_panel_remove(&innolux->base);
> -
> -	put_device(&innolux->backlight->dev);
>   }
>   
>   static int innolux_panel_probe(struct mipi_dsi_device *dsi)
> diff --git a/drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c b/drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c
> index 072c0fc79..85279d224 100644
> --- a/drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c
> +++ b/drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c
> @@ -327,30 +327,16 @@ static int sharp_panel_add(struct sharp_panel *sharp)
>   	if (IS_ERR(sharp->supply))
>   		return PTR_ERR(sharp->supply);
>   
> -	np = of_parse_phandle(sharp->link1->dev.of_node, "backlight", 0);
> -	if (np) {
> -		sharp->backlight = of_find_backlight_by_node(np);
> -		of_node_put(np);
> +	sharp->backlight = devm_of_find_backlight(np);
>   
> -		if (!sharp->backlight)
> -			return -EPROBE_DEFER;
> -	}
> +	if (IS_ERR(sharp->backlight))
> +		return PTR_ERR(sharp->backlight);
>   
>   	drm_panel_init(&sharp->base);
>   	sharp->base.funcs = &sharp_panel_funcs;
>   	sharp->base.dev = &sharp->link1->dev;
>   
> -	err = drm_panel_add(&sharp->base);
> -	if (err < 0)
> -		goto put_backlight;
> -
> -	return 0;
> -
> -put_backlight:
> -	if (sharp->backlight)
> -		put_device(&sharp->backlight->dev);
> -
> -	return err;
> +	return drm_panel_add(&sharp->base);
>   }
>   
>   static void sharp_panel_del(struct sharp_panel *sharp)
> @@ -358,9 +344,6 @@ static void sharp_panel_del(struct sharp_panel *sharp)
>   	if (sharp->base.dev)
>   		drm_panel_remove(&sharp->base);
>   
> -	if (sharp->backlight)
> -		put_device(&sharp->backlight->dev);
> -
>   	if (sharp->link2)
>   		put_device(&sharp->link2->dev);
>   }
> diff --git a/drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c b/drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c
> index 8a5137963..b634ec887 100644
> --- a/drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c
> +++ b/drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c
> @@ -271,39 +271,22 @@ static int sharp_nt_panel_add(struct sharp_nt_panel *sharp_nt)
>   		gpiod_set_value(sharp_nt->reset_gpio, 0);
>   	}
>   
> -	np = of_parse_phandle(dev->of_node, "backlight", 0);
> -	if (np) {
> -		sharp_nt->backlight = of_find_backlight_by_node(np);
> -		of_node_put(np);
> +	sharp_nt->backlight = devm_of_find_backlight(np);
>   
> -		if (!sharp_nt->backlight)
> -			return -EPROBE_DEFER;
> -	}
> +	if (IS_ERR(sharp_nt->backlight))
> +		return PTR_ERR(sharp_nt->backlight);
>   
>   	drm_panel_init(&sharp_nt->base);
>   	sharp_nt->base.funcs = &sharp_nt_panel_funcs;
>   	sharp_nt->base.dev = &sharp_nt->dsi->dev;
>   
> -	ret = drm_panel_add(&sharp_nt->base);
> -	if (ret < 0)
> -		goto put_backlight;
> -
> -	return 0;
> -
> -put_backlight:
> -	if (sharp_nt->backlight)
> -		put_device(&sharp_nt->backlight->dev);
> -
> -	return ret;
> +	return drm_panel_add(&sharp_nt->base);
>   }
>   
>   static void sharp_nt_panel_del(struct sharp_nt_panel *sharp_nt)
>   {
>   	if (sharp_nt->base.dev)
>   		drm_panel_remove(&sharp_nt->base);
> -
> -	if (sharp_nt->backlight)
> -		put_device(&sharp_nt->backlight->dev);
>   }
>   
>   static int sharp_nt_panel_probe(struct mipi_dsi_device *dsi)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ