Received: by 10.223.176.46 with SMTP id f43csp4232093wra; Tue, 23 Jan 2018 06:24:54 -0800 (PST) X-Google-Smtp-Source: AH8x227CHdxgKD3w+DEFT01p1eVlRc9foRt1bB+5tBOxjvVElewU7a4cFbunbTK1DHQ87Rvr8OOI X-Received: by 10.98.228.5 with SMTP id r5mr10899698pfh.193.1516717494888; Tue, 23 Jan 2018 06:24:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516717494; cv=none; d=google.com; s=arc-20160816; b=Nn7P6iHLYhSBhpQvoHNTqYcaMJiB8A/gLSFa+UY56V7lERp64w4KHkgRpd4Vxi7QXV NsNjp4z8GN7NYmkffCztQf9a5SvUICLZ+O4l3efjIQ1HYu1hkqC5hQP8+g9epk1/7t8+ Q665IzOQAEy1APJWj9o3ETsS2pHJVjexcY9hOfFIDaqcVKj+v400UKm8F8PB+LrV4HDQ t7qj6f0RKkVNjSi3DJo0vB5SXpTJ6e3/1upDwn0IaoJxiPfdPAotZhNMISPqcf8L2I1A cY3v6/ZD+i55PaveKMJCZduDlwmjBv7RJgadiu7ek3J29ISbU8tu7ddWHf3IK3a97YAM UPVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:references:to:subject :arc-authentication-results; bh=X1XE+E2+32EBYsUILJs5EzQz3cDLDYK20repBpb5QKU=; b=pdjFWk5HSAyqNbc3LVFWoVNHCxBcGF4h2SSu2xuWoXUOb9tCIRhfhz1DzF1RDH9tRR ThnqrWAB/WLMAAgT5NPBscev7bBxu9DtgLpzHSx+thrXlBrlwbLoVEj60ysUFBvmo0Kt JCsCa7FeWk5z8Cr9zPxfqB5RpjvvqR9bNev6dJnVlyEa2HZfp5XXizirIq2PdB7oK8r6 qmbgWMUSZiaR3q3Np8pAjcsldrDWy5eM319OkzsFYgUUiA+vTJS4AvAnlTaHhBslDtee g+PN+wSop5YKWaUgKkunYwpp4+voQgkdJASBroerrNNEyxGuHOm2/gpEKc1nMP9Eoqin m1vw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t20si1549980pfi.42.2018.01.23.06.24.39; Tue, 23 Jan 2018 06:24:54 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751885AbeAWOYO (ORCPT + 99 others); Tue, 23 Jan 2018 09:24:14 -0500 Received: from smtp.domeneshop.no ([194.63.252.55]:45045 "EHLO smtp.domeneshop.no" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751706AbeAWOYN (ORCPT ); Tue, 23 Jan 2018 09:24:13 -0500 Received: from 211.81-166-168.customer.lyse.net ([81.166.168.211]:62796 helo=[192.168.10.157]) by smtp.domeneshop.no with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1edzUh-0002RH-2k; Tue, 23 Jan 2018 15:24:11 +0100 Subject: Re: [PATCH v18 09/10] drm/panel: Use of_find_backlight helper To: Meghana Madhyastha , Lee Jones , Daniel Thompson , Jingoo Han , Thierry Reding , Tomi Valkeinen , Daniel Vetter , Sean Paul , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org References: <140d01afb138d687680b2d1776a4c101c9fa9a0a.1516632388.git.meghana.madhyastha@gmail.com> From: =?UTF-8?Q?Noralf_Tr=c3=b8nnes?= Message-ID: Date: Tue, 23 Jan 2018 15:24:08 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: <140d01afb138d687680b2d1776a4c101c9fa9a0a.1516632388.git.meghana.madhyastha@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Den 22.01.2018 15.55, 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 > --- Reviewed-by: Noralf Trønnes > Changes in v18: > -Fixed warnings resulting from passing device_node* to of_find_backlight. > Fixed it by passing struct device* to of_find_backlight > > drivers/gpu/drm/panel/panel-innolux-p079zca.c | 24 ++++----------------- > drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c | 28 +++++-------------------- > drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c | 27 ++++-------------------- > 3 files changed, 13 insertions(+), 66 deletions(-) > > diff --git a/drivers/gpu/drm/panel/panel-innolux-p079zca.c b/drivers/gpu/drm/panel/panel-innolux-p079zca.c > index 4c1b29eec..57df39b5c 100644 > --- a/drivers/gpu/drm/panel/panel-innolux-p079zca.c > +++ b/drivers/gpu/drm/panel/panel-innolux-p079zca.c > @@ -215,7 +215,6 @@ MODULE_DEVICE_TABLE(of, innolux_of_match); > static int innolux_panel_add(struct innolux_panel *innolux) > { > struct device *dev = &innolux->link->dev; > - struct device_node *np; > int err; > > innolux->supply = devm_regulator_get(dev, "power"); > @@ -230,37 +229,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(dev); > > - 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..6bf8730f1 100644 > --- a/drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c > +++ b/drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c > @@ -318,8 +318,7 @@ MODULE_DEVICE_TABLE(of, sharp_of_match); > > static int sharp_panel_add(struct sharp_panel *sharp) > { > - struct device_node *np; > - int err; > + struct device *dev = &sharp->link1->dev; > > sharp->mode = &default_mode; > > @@ -327,30 +326,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(dev); > > - 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 +343,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..494aa9b16 100644 > --- a/drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c > +++ b/drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c > @@ -253,8 +253,6 @@ static const struct drm_panel_funcs sharp_nt_panel_funcs = { > static int sharp_nt_panel_add(struct sharp_nt_panel *sharp_nt) > { > struct device *dev = &sharp_nt->dsi->dev; > - struct device_node *np; > - int ret; > > sharp_nt->mode = &default_mode; > > @@ -271,39 +269,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(dev); > > - 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)