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] [day] [month] [year] [list]
Date:   Wed, 18 Oct 2017 18:03:03 +0200
From:   Neil Armstrong <narmstrong@...libre.com>
To:     Jeffy Chen <jeffy.chen@...k-chips.com>,
        linux-kernel@...r.kernel.org
Cc:     briannorris@...omium.org, seanpaul@...omium.org,
        dianders@...omium.org, heiko@...ech.de, tfiga@...omium.org,
        Andrzej Hajda <a.hajda@...sung.com>,
        Romain Perier <romain.perier@...labora.com>,
        Philipp Zabel <p.zabel@...gutronix.de>,
        Jonathan Corbet <corbet@....net>,
        dri-devel@...ts.freedesktop.org,
        Kevin Hilman <khilman@...libre.com>,
        Laurent Pinchart <Laurent.pinchart@...asonboard.com>,
        Russell King <rmk+kernel@...linux.org.uk>,
        linux-rockchip@...ts.infradead.org,
        Carlo Caione <carlo@...one.org>,
        linux-amlogic@...ts.infradead.org,
        Archit Taneja <architt@...eaurora.org>,
        linux-arm-kernel@...ts.infradead.org,
        Mark Yao <mark.yao@...k-chips.com>,
        linux-renesas-soc@...r.kernel.org,
        Kieran Bingham <kieran.bingham+renesas@...asonboard.com>,
        Jose Abreu <Jose.Abreu@...opsys.com>,
        David Airlie <airlied@...ux.ie>
Subject: Re: [PATCH v5 8/9] drm/bridge/synopsys: dw-hdmi: Do not use device's
 drvdata

On 18/10/2017 14:09, Jeffy Chen wrote:
> Let plat drivers own the drvdata, so that they could cleanup resources
> in their unbind().
> 
> Signed-off-by: Jeffy Chen <jeffy.chen@...k-chips.com>
> ---
> 
> Changes in v5: None
> 
>  drivers/gpu/drm/bridge/synopsys/dw-hdmi.c   | 43 ++++++++++-------------------
>  drivers/gpu/drm/imx/dw_hdmi-imx.c           | 22 +++++++++------
>  drivers/gpu/drm/meson/meson_dw_hdmi.c       | 20 ++++++++++----
>  drivers/gpu/drm/rcar-du/rcar_dw_hdmi.c      | 14 ++++++++--
>  drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 23 ++++++++-------
>  include/drm/bridge/dw_hdmi.h                | 17 ++++++------
>  6 files changed, 77 insertions(+), 62 deletions(-)
> 

[...]

> diff --git a/drivers/gpu/drm/meson/meson_dw_hdmi.c b/drivers/gpu/drm/meson/meson_dw_hdmi.c
> index cef414466f9f..fc29f69f7108 100644
> --- a/drivers/gpu/drm/meson/meson_dw_hdmi.c
> +++ b/drivers/gpu/drm/meson/meson_dw_hdmi.c
> @@ -138,6 +138,8 @@ struct meson_dw_hdmi {
>  	struct clk *hdmi_pclk;
>  	struct clk *venci_clk;
>  	u32 irq_stat;
> +
> +	struct dw_hdmi *hdmi;
>  };
>  #define encoder_to_meson_dw_hdmi(x) \
>  	container_of(x, struct meson_dw_hdmi, encoder)
> @@ -526,7 +528,7 @@ static irqreturn_t dw_hdmi_top_thread_irq(int irq, void *dev_id)
>  		if (stat & HDMITX_TOP_INTR_HPD_RISE)
>  			hpd_connected = true;
>  
> -		dw_hdmi_setup_rx_sense(dw_hdmi->dev, hpd_connected,
> +		dw_hdmi_setup_rx_sense(dw_hdmi->hdmi, hpd_connected,
>  				       hpd_connected);
>  
>  		drm_helper_hpd_irq_event(dw_hdmi->encoder.dev);
> @@ -865,9 +867,14 @@ static int meson_dw_hdmi_bind(struct device *dev, struct device *master,
>  	dw_plat_data->input_bus_format = MEDIA_BUS_FMT_YUV8_1X24;
>  	dw_plat_data->input_bus_encoding = V4L2_YCBCR_ENC_709;
>  
> -	ret = dw_hdmi_bind(pdev, encoder, &meson_dw_hdmi->dw_plat_data);
> -	if (ret)
> -		return ret;
> +	meson_dw_hdmi->hdmi = dw_hdmi_bind(pdev, encoder,
> +					   &meson_dw_hdmi->dw_plat_data);
> +	if (IS_ERR(meson_dw_hdmi->hdmi)) {
> +		encoder->funcs->destroy(encoder);
> +		return PTR_ERR(meson_dw_hdmi->hdmi);
> +	}
> +
> +	dev_set_drvdata(dev, meson_dw_hdmi);
>  
>  	DRM_DEBUG_DRIVER("HDMI controller initialized\n");
>  
> @@ -877,7 +884,10 @@ static int meson_dw_hdmi_bind(struct device *dev, struct device *master,
>  static void meson_dw_hdmi_unbind(struct device *dev, struct device *master,
>  				   void *data)
>  {
> -	dw_hdmi_unbind(dev);
> +	struct meson_dw_hdmi *meson_dw_hdmi = dev_get_drvdata(dev);
> +
> +	dw_hdmi_unbind(meson_dw_hdmi->hdmi);
> +	meson_dw_hdmi->encoder.funcs->destroy(&meson_dw_hdmi->encoder);
>  }
>  
>  static const struct component_ops meson_dw_hdmi_ops = {

[...]

For meson/meson_dw_hdmi.c :

Reviewed-by: Neil Armstrong <narmstrong@...libre.com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ