Received: by 10.223.148.5 with SMTP id 5csp7355246wrq; Thu, 18 Jan 2018 04:34:52 -0800 (PST) X-Google-Smtp-Source: ACJfBovK3y8EJS4Gf4JW1oEVx1FW9VEmOCu2U422LYHjfqamh2rylzXMc9dZ34Dhhu6PvOMMObJC X-Received: by 10.99.155.2 with SMTP id r2mr2283733pgd.422.1516278892852; Thu, 18 Jan 2018 04:34:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516278892; cv=none; d=google.com; s=arc-20160816; b=HYrLLpEdxQeLhJCk0vs2FSszEYdAnJJr1lt6QJwKI/dobqqDgw3a57pBqiz0qzSx03 IoV7RwV3MFk90DbTHqTUg9z5GVCF6+lkr7bl/IYylBxO3fj+yrHMp4d9WKS3VpMbIxCJ yCxTxVPYQCUDABHUWxrdQ4x4tA4Msyp7ycdbD/eM3VelU3Wvoghr8YJ6gmlyf8tP4pde ypw5ZQgF7QQA+LmpPECZkPtO3cp6MXF1D+RNQnqcmON0ne7BObIFCW24kwAMHeE/S1RA ZSz+opf4bAJHOc5TqRyrsuaFJlJE120ZbQcHlhu/amsEBQ9pzssQ9Em+2FJ62eA9izLo LFAg== 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-transfer-encoding:content-disposition:mime-version :references:message-id:subject:to:from:date:dkim-signature :arc-authentication-results; bh=m6sSf4j1VNzIvNnoeAmnlRkJuPK4GuoQ76bWVgncqjI=; b=xIn02ayts4kt42zrcqZBHMnadVoSRLzBky/vWxYa0/5il7/k+50CconI3Et/vzhO/w w7/N1ITvgTkIHfEmVKIz7MuumFOciZE9PeHPam7R/7CybmiS5Yia4xNcJIwbXVC/eUps aAYa9W55jPiqFdNmo9QMk/+ByJhOB179GrbdcfdzJBDdKrNLBtLPbJ1O7YmM2pf+oOkb NTOOKqlKJc5wWCifU67NGuRiam94i3b5Iz9A3Kk/lFJrtMjFIVQyk3XB37rKKQ6a3hib yx157rRytmVhXI0LqlCu9rj3e3WsMHJLz0a6Eva2ujwpvNh5sew0+7WczU133yVKHSPP QYvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=DUVqO9D7; 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=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q12si5987638pgf.431.2018.01.18.04.34.38; Thu, 18 Jan 2018 04:34:52 -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=@gmail.com header.s=20161025 header.b=DUVqO9D7; 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=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755255AbeARMHn (ORCPT + 99 others); Thu, 18 Jan 2018 07:07:43 -0500 Received: from mail-pg0-f65.google.com ([74.125.83.65]:43668 "EHLO mail-pg0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752184AbeARMHm (ORCPT ); Thu, 18 Jan 2018 07:07:42 -0500 Received: by mail-pg0-f65.google.com with SMTP id n17so6403310pgf.10 for ; Thu, 18 Jan 2018 04:07:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=m6sSf4j1VNzIvNnoeAmnlRkJuPK4GuoQ76bWVgncqjI=; b=DUVqO9D7qhOQoEU0vbn7pCyGenUNKWPT1kD0Lwwz95rcB34TUvDATTZnzJalf5IlSy WphkZJD9iXBGhxg3rfDyPXbpXPWTp7I9dppDPSWo3b3esGLmU6ySTcu5ZYnmbTyJoYM6 xwwG+Lkn5s3VaWEg3mJSCU+E9WPiIHtgvAJFSr26M9KireOe4Gbj2EDtexDBqmlljGKZ Qh5JyJdinKOLvZM9jK7UhC0ulEGOZiHkxNSOYost79g9VrycliW7+jHUpExruCuR9ZDv jG37OqS9ECOCjUxfhffg2ht7FUAZpA43NZWeDqk4Q/wZ1i+dYMtlm5L7ZbM2G9IuQsAo l7vQ== 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:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=m6sSf4j1VNzIvNnoeAmnlRkJuPK4GuoQ76bWVgncqjI=; b=sXW4DzPqTIKHGZiFCbmNdxZ5N9z63VhqYxRKSWWzMOtjuuo4qsd6IZpa5aWC3f7Z4v mCtuEa7ySJ4r+1HnlGdWunM3/2WJm1ZB8O56E/y9PRXdQVc7HhMums5eFgxKUrfnAOF0 t7440ZLjg4/xndlqUN0CQbp+vCvfRTOnt3RNVTssgkJJC6a31loTEHg+S8EfsE9qfhbX CLkDMvahxnOCzdFefaTsu4uMEZJaQWo+UVIjPqy5gU8TBkeu/VwetcfIU0Vp4JUXVKSU Wm+9pukYWnI1LYT426O4Fa40osMD/op9AuZxQksUtZzQAsFYkUSkx/Bnply1I9/sd7US fxCg== X-Gm-Message-State: AKGB3mKHh1QDMgPgfkNs+kftasqXLJdJU17ZQjCjIZMmJe34i0usurCG EPB7YjFB0dQxE6/1CoLTfHgUxtz5 X-Received: by 10.99.148.26 with SMTP id m26mr35867778pge.157.1516277260320; Thu, 18 Jan 2018 04:07:40 -0800 (PST) Received: from meghana-HP-Pavilion-Notebook ([122.171.87.79]) by smtp.gmail.com with ESMTPSA id i9sm11858129pfi.154.2018.01.18.04.07.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 18 Jan 2018 04:07:39 -0800 (PST) Date: Thu, 18 Jan 2018 17:37:32 +0530 From: Meghana Madhyastha To: Noralf =?iso-8859-1?Q?Tr=F8nnes?= , Lee Jones , Daniel Thompson , Jingoo Han , Thierry Reding , Tomi Valkeinen , Daniel Vetter , Sean Paul , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v16 09/10] drm/panel: Use of_find_backlight helper Message-ID: <20180118120732.GC4864@meghana-HP-Pavilion-Notebook> References: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jan 16, 2018 at 06:08:53PM +0100, Noralf Tr?nnes wrote: > > Den 16.01.2018 11.36, 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 > >--- > > drivers/gpu/drm/panel/panel-innolux-p079zca.c | 10 +++------- > > drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c | 10 +++------- > > drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c | 10 +++------- > > 3 files changed, 9 insertions(+), 21 deletions(-) > > > >diff --git a/drivers/gpu/drm/panel/panel-innolux-p079zca.c b/drivers/gpu/drm/panel/panel-innolux-p079zca.c > >index 4c1b29eec..a69b0530f 100644 > >--- a/drivers/gpu/drm/panel/panel-innolux-p079zca.c > >+++ b/drivers/gpu/drm/panel/panel-innolux-p079zca.c > >@@ -230,14 +230,10 @@ 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); > > This driver isn't broken like tinydrm was, so it does put the backlight > device on cleanup like it should. So when you're using the devm_ version, > the result is a double put. Just remove the put_device() in > innolux_panel_add/del() and you're good. I have a quick question here. So devm_of_find_backlight automatically does a put_device on detachment of the driver. However in this case, put_device is called when panel_add is not successful (i.e when it returns a negative value here). So is devm's release mechanism still invoked here ? err = drm_panel_add(&innolux->base); if (err < 0) goto put_backlight; return 0; put_backlight: put_device(&innolux->backlight->dev); return err; If so then I should change this to err = drm_panel_add(&innolux->base) return err; Thanks and regards, Meghana > I haven't checked the other drivers. > > Noralf. > > PS: > Give people a few days (one week?) to respond before respinning a new > version, so we avoid a fragmented discussion. > > >- 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; > >diff --git a/drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c b/drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c > >index 1512ec4f3..d5450c9d9 100644 > >--- a/drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c > >+++ b/drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c > >@@ -329,14 +329,10 @@ 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; > >diff --git a/drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c b/drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c > >index a6af3257f..db31d8268 100644 > >--- a/drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c > >+++ b/drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c > >@@ -273,14 +273,10 @@ 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; >