Received: by 10.223.176.46 with SMTP id f43csp4464442wra; Tue, 23 Jan 2018 09:45:06 -0800 (PST) X-Google-Smtp-Source: AH8x224p8IeXknQ8/mFHtg4XMfNF6huzKegBO99CSuNkloVj3GbNSiFzpCaMtukIgWD9D5mLh/+Z X-Received: by 10.36.208.72 with SMTP id m69mr4604153itg.73.1516729506229; Tue, 23 Jan 2018 09:45:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516729506; cv=none; d=google.com; s=arc-20160816; b=YQZu3ivn/AMmNh/IMEEDd/Z63A3KnbxpqboWu2uEWvXYmteu6uqtHqG6BsHKayyxTH 7uWmRdhpuVDqBF3K9db1fMga1FU5lVDmVFSTUQF0GB0lGo4JBu/mXbmOW01xH8qmG/NH USN1Ns/4TSVZXxw6/A0LVB0vsT36N2Toa3RVjur8KWnuLshCacrWxHryXa+79IEG/FZu S/JNLQE6tPRxTNxNljn+JxPMOmCc9nhwuZJ2xRT5tJ0fq3A7qsqe5SseWyWRlvh/71DQ Q34q+dJ8PQ8V8VADqujjmLeXInf8u2lMtWjOCiSwWPimSA1gOoO1X1BOBqYTIt9rH9wY sZjA== 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:references:to:from:subject :arc-authentication-results; bh=kbQBjFcBBD03u7k7MjnrdurIoNHiUfk4JcFnc4NsqSQ=; b=SyCNX77ONTzqe0GOXFinbhVLlYgoNxOS5eKGGx2Ujby+jcCppxQYucu6cxb/PqLcrs wOlTfduIIqlCJZyASHzLw1ejuoWkJobCnbSRKiFMOMMwLEE+2tK58CCQkF9dShJ92N/K ejI5UI191eTXPw+oif/8jdbqYf5ODSdvA7yLfqO9yh/MfWsN6n4U2e+t+dBd5wk0DZ8h bVqZAImYq7Z0XY7fHNT3ptSqG4a+DCjPb9HX+BLoDdXI1MGjzJIckk/FACZX5S9CNh1W QtyOhmjvzuVOUusa7AGKTz1n/Cq2/1OAyHDgVHIhL6H4TyugQUcI5O+wqBziaVj300Xl GxoA== 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 d142si8685422itd.51.2018.01.23.09.44.53; Tue, 23 Jan 2018 09:45:06 -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 S1751996AbeAWRoA (ORCPT + 99 others); Tue, 23 Jan 2018 12:44:00 -0500 Received: from smtp.domeneshop.no ([194.63.252.55]:58962 "EHLO smtp.domeneshop.no" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751633AbeAWRn7 (ORCPT ); Tue, 23 Jan 2018 12:43:59 -0500 Received: from 211.81-166-168.customer.lyse.net ([81.166.168.211]:63699 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 1ee2c1-0001tj-FT; Tue, 23 Jan 2018 18:43:57 +0100 Subject: Re: [PATCH v18 10/10] drm/omapdrm: Use of_find_backlight helper From: =?UTF-8?Q?Noralf_Tr=c3=b8nnes?= 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: <69379bffdebdddf49952eabeaaee7f1dd7cff99c.1516632388.git.meghana.madhyastha@gmail.com> <394a73f6-3459-449f-6d9f-4cb52a1d3328@tronnes.org> <20180123165501.GA5908@meghana-HP-Pavilion-Notebook> <853882e3-5f96-56c9-4fe5-a55fe6fbb030@tronnes.org> Message-ID: Date: Tue, 23 Jan 2018 18:43:55 +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: <853882e3-5f96-56c9-4fe5-a55fe6fbb030@tronnes.org> 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 23.01.2018 18.41, skrev Noralf Trønnes: > > Den 23.01.2018 17.55, skrev Meghana Madhyastha: >> On Tue, Jan 23, 2018 at 03:37:38PM +0100, Noralf Trønnes wrote: >>> Den 22.01.2018 15.56, 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 >>>> --- >>>> 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/omapdrm/displays/panel-dpi.c | 33 >>>> ++++++++++------------------ >>>>   1 file changed, 11 insertions(+), 22 deletions(-) >>>> >>>> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dpi.c >>>> b/drivers/gpu/drm/omapdrm/displays/panel-dpi.c >>>> index ac9596251..93b7a176d 100644 >>>> --- a/drivers/gpu/drm/omapdrm/displays/panel-dpi.c >>>> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dpi.c >>>> @@ -156,14 +156,14 @@ static struct omap_dss_driver panel_dpi_ops = { >>>>   static int panel_dpi_probe_of(struct platform_device *pdev) >>>>   { >>>>       struct panel_drv_data *ddata = platform_get_drvdata(pdev); >>>> +    struct device *dev = &pdev->dev; >>>>       struct device_node *node = pdev->dev.of_node; >>>> -    struct device_node *bl_node; >>>>       struct omap_dss_device *in; >>>>       int r; >>>>       struct display_timing timing; >>>>       struct gpio_desc *gpio; >>>> -    gpio = devm_gpiod_get_optional(&pdev->dev, "enable", >>>> GPIOD_OUT_LOW); >>>> +    gpio = devm_gpiod_get_optional(dev, "enable", GPIOD_OUT_LOW); >>> Please don't make unrelated changes like this. It clutters the patch. >>> You can just as well use &pdev->dev when getting the backlight also. >> I had made the change in order to be more consistent with how the other >> drivers were doing this. Most of them had a variable struct device *dev. >> However, I can undo this if necessary. > > It's best to be consistent with the coding style in the driver you're > changing. If you make an extra dev variable or not isn't that important, > unless the driver maintainer have a strict coding style for their driver. > > I try to stay on the safe side, change as little as possible and do thing > the way it's done in the driver to increase the change of getting the > patch accepted as-is the first time around. > > The important feedback from me is to remove the unrelated changes. > and the use of the devm_ version ofc. > Noralf. > >> >>>>       if (IS_ERR(gpio)) >>>>           return PTR_ERR(gpio); >>>> @@ -175,47 +175,36 @@ static int panel_dpi_probe_of(struct >>>> platform_device *pdev) >>>>        * timing and order relative to the enable gpio. So for now >>>> it's just >>>>        * ensured that the reset line isn't active. >>>>        */ >>>> -    gpio = devm_gpiod_get_optional(&pdev->dev, "reset", >>>> GPIOD_OUT_LOW); >>>> +    gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW); >>>>       if (IS_ERR(gpio)) >>>>           return PTR_ERR(gpio); >>>> -    ddata->vcc_supply = devm_regulator_get(&pdev->dev, "vcc"); >>>> +    ddata->vcc_supply = devm_regulator_get(dev, "vcc"); >>>>       if (IS_ERR(ddata->vcc_supply)) >>>>           return PTR_ERR(ddata->vcc_supply); >>>> -    bl_node = of_parse_phandle(node, "backlight", 0); >>>> -    if (bl_node) { >>>> -        ddata->backlight = of_find_backlight_by_node(bl_node); >>>> -        of_node_put(bl_node); >>>> +    ddata->backlight = of_find_backlight(dev); >>> Any reason you don't use the devm_ version here? >>> You do remove error_free_backlight... >>> >>> With the devm_ version remember to drop the put_device in >>> panel_dpi_remove(). >>> >>> Noralf. >>> >>>> -        if (!ddata->backlight) >>>> -            return -EPROBE_DEFER; >>>> -    } >>>> +    if (IS_ERR(ddata->backlight)) >>>> +        return PTR_ERR(ddata->backlight); >>>>       r = of_get_display_timing(node, "panel-timing", &timing); >>>>       if (r) { >>>> -        dev_err(&pdev->dev, "failed to get video timing\n"); >>>> -        goto error_free_backlight; >>>> +        dev_err(dev, "failed to get video timing\n"); >>>> +        return r; >>>>       } >>>>       videomode_from_timing(&timing, &ddata->vm); >>>>       in = omapdss_of_find_source_for_first_ep(node); >>>>       if (IS_ERR(in)) { >>>> -        dev_err(&pdev->dev, "failed to find video source\n"); >>>> -        r = PTR_ERR(in); >>>> -        goto error_free_backlight; >>>> +        dev_err(dev, "failed to find video source\n"); >>>> +        return PTR_ERR(in); >>>>       } >>>>       ddata->in = in; >>>>       return 0; >>>> - >>>> -error_free_backlight: >>>> -    if (ddata->backlight) >>>> -        put_device(&ddata->backlight->dev); >>>> - >>>> -    return r; >>>>   } >>>>   static int panel_dpi_probe(struct platform_device *pdev) > > _______________________________________________ > dri-devel mailing list > dri-devel@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/dri-devel >