Path: csiph.com!news.redatomik.org!aioe.org!bofh.it!news.nic.it!robomod From: John Keeping Newsgroups: linux.kernel Subject: Re: [PATCH v3 21/24] drm/rockchip: dw-mipi-dsi: defer probe if panel is not loaded Date: Fri, 10 Feb 2017 19:30:02 +0100 Message-ID: References: X-Original-To: Sean Paul Dkim-Signature: v=1; a=rsa-sha256; q=dns/txt; c=simple/simple; d=metanate.com; s=stronger; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Subject:Cc:To:From:Date; bh=F+Uc9geVgnmGz6VA+ZjBPU67rctT10FKppu3M3sAZ6I=; b=a1QkhpdJWsRYM5Czd6DhIs9C0M9/1kZizc/FH5KUoFTuWdiUCK+HjR67owsfsPn2O1wjxtoY6LJyxJAG64TZjQH6cbRuss02Dq3oGmxCvToRuGvHq499oavj5I5ZOyODOFY9SVIE0Ti1Jq7AuyGPWvCbBkHG/FdUwPyvP9+OYO4qlGw05AMIJHR1bKRE7ceQMQ787AGyjQp8opDfCsPwSFeKruCPH8fVNYHnlFXE7cVGX/NWwv3zVf/HOEzVBaV+fYjXiyYOAcZYyCTh5n60W0jx6SZWoY9+ETiAT1dSEDHEGBovJIkSFIBbmRgR7Eu3Qw0LfByvDwfNrdvAteciPg==; Organization: Metanate Ltd X-Mailer: Claws Mail 3.14.1 (GTK+ 2.24.31; x86_64-unknown-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: robomod@news.nic.it List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Approved: robomod@news.nic.it Lines: 54 X-Original-Cc: Mark Yao , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-rockchip@lists.infradead.org, Chris Zhong , linux-arm-kernel@lists.infradead.org X-Original-Date: Fri, 10 Feb 2017 17:27:47 +0000 X-Original-Message-ID: <20170210172747.5f0afb0a.john@metanate.com> X-Original-References: <20170129132444.25251-1-john@metanate.com> <20170129132444.25251-22-john@metanate.com> <20170131192117.GE20076@art_vandelay> X-Original-Sender: linux-kernel-owner@vger.kernel.org Xref: csiph.com linux.kernel:1578689 On Tue, 31 Jan 2017 14:21:17 -0500, Sean Paul wrote: > On Sun, Jan 29, 2017 at 01:24:41PM +0000, John Keeping wrote: > > This ensures that the output resolution is known before fbcon loads. > > > > Signed-off-by: John Keeping > > --- > > Unchanged in v3 > > Unchanged in v2 > > > > drivers/gpu/drm/rockchip/dw-mipi-dsi.c | 11 +++++++++-- > > 1 file changed, 9 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c > > index f5b15377ef85..5bad92e2370e 100644 > > --- a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c > > +++ b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c > > @@ -1176,10 +1176,17 @@ static int dw_mipi_dsi_bind(struct device *dev, struct device *master, > > > > dsi->dsi_host.ops = &dw_mipi_dsi_host_ops; > > dsi->dsi_host.dev = dev; > > - return mipi_dsi_host_register(&dsi->dsi_host); > > + ret = mipi_dsi_host_register(&dsi->dsi_host); > > + if (!ret && !dsi->panel) { > > + mipi_dsi_host_unregister(&dsi->dsi_host); > > + drm_encoder_cleanup(&dsi->encoder); > > + drm_connector_cleanup(&dsi->connector); > > Move the host registration up before dw_mipi_dsi_register() to avoid > having to clean up the encoder and connector? No, mipi_dsi_host_register() has to be called after the connector is registered because it is likely to result in a call to dw_mipi_dsi_host_attach() which attaches a panel to the connector. > > + ret = -EPROBE_DEFER; > > + } > > > > err_pllref: > > - clk_disable_unprepare(dsi->pllref_clk); > > + if (ret) > > I personally think it's cleaner to explicitly goto in the error conditional (or > in this case, the defer conditional) and have a return 0; right before the err_* > labels. Then you don't need to worry about a) checking ret in all of your > cleanups and b) someone adding code above the labels that you don't intend to > run. Agreed. I'll change this to use a goto if we hit the EPROBE_DEFER case and keep all the cleanup together. > > + clk_disable_unprepare(dsi->pllref_clk); > > return ret; > > }