Received: by 10.223.164.202 with SMTP id h10csp3800585wrb; Tue, 28 Nov 2017 17:53:14 -0800 (PST) X-Google-Smtp-Source: AGs4zMYM6i/NfSI14TgYPAekiWGNRyov+6N1UMVg/vLO7/CZ2Jt0ApiDRErk55caQfHrzDNPwqzs X-Received: by 10.84.177.129 with SMTP id x1mr1219060plb.217.1511920394150; Tue, 28 Nov 2017 17:53:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511920394; cv=none; d=google.com; s=arc-20160816; b=PqoZiQ1yqxuKHIumqlKp8ltK3yI1w4JZfkRl1kjJlt4wmGsd9Fr6gmvgwTzDYE44r2 6y22H8T5YaT7acnA279gPrsHjQmQoLNYDJoHI6/Tr4AJjf53R0YiYW02Q4357EqwVCG+ jH7zkMa35lI6GYszK8jo72mxH+zwuUxvs8XtKZIAEFabxDPBA1KO526x6jfLoNLqsqna U72CMplRcqhyERoFnnxaBTelIo/aQm5p+ASO6GjSERfw7IcvMjLeFsqPqp+8G/8fhwBL WNsT1VJG082OwT4/EyVbHHZdib1LvfbnCZOKuL602cgGXok0hrz7jrJLBv2HmdYJPhef hfNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=KR5bzLEojiCaVOqAqYvwJvcIi+2Be+MWdA/XVHci0is=; b=eVeqdr6WJgDie5q+oS95OHDmI9uQbh+vtVnDT+PC7PW3qwechJcvp2m31/fS85BGwB FHyvDqd5Efpsc4pF5SQe9UXQyUqBSbSEJGaTOFXpzCs32+swb50HDESsHqD8zKb4chAS X+L62pgfFIGWUtXsGsxMEpkurmJQgWsD0dxtcHFYsPt3pN0JAqRqCvC7f9CeXjuUb1kv YxDNhEp9N+u42IAVvagsuS7e3YHYtMzFLG9QJ05k46iuXMSTcv/YTGqrKrnihrVzLWWn w9UVAguE4onFcT6aOWXQ0OIzM58T9uhvYFWgCzzo4ejI5Jgibt1sCNg1adU5pEPl6XNz MIlg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=ggY4moAp; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e14si405017pga.447.2017.11.28.17.53.03; Tue, 28 Nov 2017 17:53:14 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=ggY4moAp; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752619AbdK2Bw0 (ORCPT + 70 others); Tue, 28 Nov 2017 20:52:26 -0500 Received: from mail-yb0-f196.google.com ([209.85.213.196]:43892 "EHLO mail-yb0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752134AbdK2BwY (ORCPT ); Tue, 28 Nov 2017 20:52:24 -0500 Received: by mail-yb0-f196.google.com with SMTP id i206so773573ybc.10 for ; Tue, 28 Nov 2017 17:52:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=KR5bzLEojiCaVOqAqYvwJvcIi+2Be+MWdA/XVHci0is=; b=ggY4moApCI0ndRu9nkeGGC8932QeNR2A60dBZ9byhzyrQV7KBmfZy3whqBuBdLkWGx hvtgISkTF3QltP2mWTxWSbiCagWfcxlDsxJ6M6+5RkKUUxr6P8bKGmZrzTRbKX/tXJSd eCpUK6Z1F4vyiwcLeTXNnBaiZnWsymSeBUPFU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=KR5bzLEojiCaVOqAqYvwJvcIi+2Be+MWdA/XVHci0is=; b=RpU9qFcWmOnxlSfbAYkmZUCDyrp54WKp0xKgJOsxABSkrTvcXrhxNTkQ9nS+WAy7Zp GIJ9e80Ho1Z357RHKBH6Ezc2T9F+o013tpSs7n1b3+6ekz+N8YJAi900xWhI0lzn+bDH B48M+xfalPIUzbBrmuSbVaCg9wvM4C8mPqumvNrZ/l7n+2rm5VSHYh8sZtjaR9XYKWmz vVFOhSsVfax3fK3A6pyBFYpvvPqhwJrslHZiO4i3yPBdXyawv2P+JyIu9CkrD3l9ypVY Cf1f4lWNVOiUN2yWflFiaudko13ONUyxIehloy4MPEcnGluZD4wCkLU+pvHsgXcBJXzl xgfw== X-Gm-Message-State: AJaThX4RCkqmGWPdiCw46x8d9a/vds4jTilorHuWX7yGZUt3zApknXA6 DCYn/vs2KsMUKGz6eB+ShoS7aw== X-Received: by 10.37.34.137 with SMTP id i131mr846794ybi.213.1511920343199; Tue, 28 Nov 2017 17:52:23 -0800 (PST) Received: from localhost ([2620:0:1013:11:d3af:69ac:1964:28e8]) by smtp.gmail.com with ESMTPSA id v4sm327792ywv.37.2017.11.28.17.52.22 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 28 Nov 2017 17:52:22 -0800 (PST) Date: Tue, 28 Nov 2017 20:52:22 -0500 From: Sean Paul To: Nickey Yang Cc: robh+dt@kernel.org, heiko@sntech.de, mark.rutland@arm.com, airlied@linux.ie, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-rockchip@lists.infradead.org, seanpaul@chromium.org, briannorris@chromium.org, mka@chromium.org, hoegsberg@gmail.com, architt@codeaurora.org, philippe.cornu@st.com, yannick.fertre@st.com, hl@rock-chips.com, zyw@rock-chips.com, xbl@rock-chips.com Subject: Re: [PATCH v3 1/5] drm/bridge/synopsys: stop clobbering drvdata Message-ID: <20171129015222.c4iohxyai5gw3idi@art_vandelay> References: <1511868006-27130-1-git-send-email-nickey.yang@rock-chips.com> <1511868006-27130-2-git-send-email-nickey.yang@rock-chips.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1511868006-27130-2-git-send-email-nickey.yang@rock-chips.com> User-Agent: NeoMutt/20170609 (1.8.3) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Nov 28, 2017 at 07:20:02PM +0800, Nickey Yang wrote: Looks like you paved the author. This should be From: Brian. Sean > Bridge drivers/helpers shouldn't be clobbering the drvdata, since a > parent driver might need to own this. Instead, let's return our > 'dw_mipi_dsi' object and have callers pass that back to us for removal. > > Signed-off-by: Brian Norris > Reviewed-by: Matthias Kaehlcke > Reviewed-by: Archit Taneja > Acked-by: Philippe Cornu > Link:https://patchwork.kernel.org/patch/10078493/ > --- > drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 36 ++++++++++----------------- > include/drm/bridge/dw_mipi_dsi.h | 17 ++++++++----- > 2 files changed, 24 insertions(+), 29 deletions(-) > > diff --git a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c > index d9cca4f..c39c7dc 100644 > --- a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c > +++ b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c > @@ -922,8 +922,6 @@ static int dw_mipi_dsi_bridge_attach(struct drm_bridge *bridge) > dsi->bridge.of_node = pdev->dev.of_node; > #endif > > - dev_set_drvdata(dev, dsi); > - > return dsi; > } > > @@ -935,23 +933,16 @@ static void __dw_mipi_dsi_remove(struct dw_mipi_dsi *dsi) > /* > * Probe/remove API, used from platforms based on the DRM bridge API. > */ > -int dw_mipi_dsi_probe(struct platform_device *pdev, > - const struct dw_mipi_dsi_plat_data *plat_data) > +struct dw_mipi_dsi * > +dw_mipi_dsi_probe(struct platform_device *pdev, > + const struct dw_mipi_dsi_plat_data *plat_data) > { > - struct dw_mipi_dsi *dsi; > - > - dsi = __dw_mipi_dsi_probe(pdev, plat_data); > - if (IS_ERR(dsi)) > - return PTR_ERR(dsi); > - > - return 0; > + return __dw_mipi_dsi_probe(pdev, plat_data); > } > EXPORT_SYMBOL_GPL(dw_mipi_dsi_probe); > > -void dw_mipi_dsi_remove(struct platform_device *pdev) > +void dw_mipi_dsi_remove(struct dw_mipi_dsi *dsi) > { > - struct dw_mipi_dsi *dsi = platform_get_drvdata(pdev); > - > mipi_dsi_host_unregister(&dsi->dsi_host); > > __dw_mipi_dsi_remove(dsi); > @@ -961,31 +952,30 @@ void dw_mipi_dsi_remove(struct platform_device *pdev) > /* > * Bind/unbind API, used from platforms based on the component framework. > */ > -int dw_mipi_dsi_bind(struct platform_device *pdev, struct drm_encoder *encoder, > - const struct dw_mipi_dsi_plat_data *plat_data) > +struct dw_mipi_dsi * > +dw_mipi_dsi_bind(struct platform_device *pdev, struct drm_encoder *encoder, > + const struct dw_mipi_dsi_plat_data *plat_data) > { > struct dw_mipi_dsi *dsi; > int ret; > > dsi = __dw_mipi_dsi_probe(pdev, plat_data); > if (IS_ERR(dsi)) > - return PTR_ERR(dsi); > + return dsi; > > ret = drm_bridge_attach(encoder, &dsi->bridge, NULL); > if (ret) { > - dw_mipi_dsi_remove(pdev); > + dw_mipi_dsi_remove(dsi); > DRM_ERROR("Failed to initialize bridge with drm\n"); > - return ret; > + return ERR_PTR(ret); > } > > - return 0; > + return dsi; > } > EXPORT_SYMBOL_GPL(dw_mipi_dsi_bind); > > -void dw_mipi_dsi_unbind(struct device *dev) > +void dw_mipi_dsi_unbind(struct dw_mipi_dsi *dsi) > { > - struct dw_mipi_dsi *dsi = dev_get_drvdata(dev); > - > __dw_mipi_dsi_remove(dsi); > } > EXPORT_SYMBOL_GPL(dw_mipi_dsi_unbind); > diff --git a/include/drm/bridge/dw_mipi_dsi.h b/include/drm/bridge/dw_mipi_dsi.h > index 9b30fec..d9c6d54 100644 > --- a/include/drm/bridge/dw_mipi_dsi.h > +++ b/include/drm/bridge/dw_mipi_dsi.h > @@ -10,6 +10,8 @@ > #ifndef __DW_MIPI_DSI__ > #define __DW_MIPI_DSI__ > > +struct dw_mipi_dsi; > + > struct dw_mipi_dsi_phy_ops { > int (*init)(void *priv_data); > int (*get_lane_mbps)(void *priv_data, struct drm_display_mode *mode, > @@ -29,11 +31,14 @@ struct dw_mipi_dsi_plat_data { > void *priv_data; > }; > > -int dw_mipi_dsi_probe(struct platform_device *pdev, > - const struct dw_mipi_dsi_plat_data *plat_data); > -void dw_mipi_dsi_remove(struct platform_device *pdev); > -int dw_mipi_dsi_bind(struct platform_device *pdev, struct drm_encoder *encoder, > - const struct dw_mipi_dsi_plat_data *plat_data); > -void dw_mipi_dsi_unbind(struct device *dev); > +struct dw_mipi_dsi *dw_mipi_dsi_probe(struct platform_device *pdev, > + const struct dw_mipi_dsi_plat_data > + *plat_data); > +void dw_mipi_dsi_remove(struct dw_mipi_dsi *dsi); > +struct dw_mipi_dsi *dw_mipi_dsi_bind(struct platform_device *pdev, > + struct drm_encoder *encoder, > + const struct dw_mipi_dsi_plat_data > + *plat_data); > +void dw_mipi_dsi_unbind(struct dw_mipi_dsi *dsi); > > #endif /* __DW_MIPI_DSI__ */ > -- > 1.9.1 > -- Sean Paul, Software Engineer, Google / Chromium OS From 1585308648827306699@xxx Tue Nov 28 11:22:21 +0000 2017 X-GM-THRID: 1585308648827306699 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread