Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3104413ybi; Tue, 2 Jul 2019 02:13:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqzDUNXNARKSWewudR8MTLWZZX9Mt0ZP5S+x31nXO1Ip1z/WQizL3xPaFEsMUZCixsr1Qh7X X-Received: by 2002:a17:902:a612:: with SMTP id u18mr33052944plq.181.1562058800004; Tue, 02 Jul 2019 02:13:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562058799; cv=none; d=google.com; s=arc-20160816; b=w3bIZ2csA2TyvHJqt4K5H0N4G+vVvKctmaJw69AHTdwh9Q4+uXty6NdZOUB3C7re2m oZcnBZuziQs5Ru23MxXq9sW4psLZffyPBlZl0B4coxyL3IDGenAjCKwGiBmeN4TkvN8u 3f/srpz61eeL+2ssilBT9aLRE0yXKvg6oL8rdmmtrvIWBGvr5oyfMNJe3G6tUdqgYyeQ gdFEsWuSg6XXQVch1+vb0D1t0wt7ImRFb9ojmxG0a1VQm4vS93N02mKEJxe74qS6nNSZ DZwtfakeHW3svvbi/epTCdQ/Tmgib9CpaTxRkP61nG9bJpyAN5CY3797YwZhllJ0skn/ UjHQ== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=YL/v7kwpoAOgfrWESvYJW+oEOt7FvpXlkjkTWAE20U0=; b=sNdVP6ku9/xvhSSWZRyBOU7hbRbzXg6AfsNeXvNbxAE9kVc+Ph8fDKELQD27ZUkaGj f69n4XSLn9mh5zXAZrnvmbhLNL57UhdZ8NUiXPQs3jKcZUsRAV/shpPkzjXKcWuhozrY MPPBU1cvJypqSUhBrUX5+r0UFdpqxVyH3jcdUUbeFnowpnHpyRUqHykORyrAd+28PP5y VcheU0WGHbI4TRK/xOUnniRwtz+eMQlcnJLYLR7vDQaHTBTc6cdf2FMcG96csrGjNi+s tEvrk3jvlVbdgyFrCvKZytvi50sdnUmcSq54ukQ0802YLLrtwf5On48nu3zzL9obBl32 Xmvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=g8XO7Gia; 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=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n18si12162217plp.215.2019.07.02.02.13.04; Tue, 02 Jul 2019 02:13:19 -0700 (PDT) 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=@linaro.org header.s=google header.b=g8XO7Gia; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727109AbfGBJLU (ORCPT + 99 others); Tue, 2 Jul 2019 05:11:20 -0400 Received: from mail-wm1-f65.google.com ([209.85.128.65]:53283 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725851AbfGBJLT (ORCPT ); Tue, 2 Jul 2019 05:11:19 -0400 Received: by mail-wm1-f65.google.com with SMTP id x15so85448wmj.3 for ; Tue, 02 Jul 2019 02:11:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=YL/v7kwpoAOgfrWESvYJW+oEOt7FvpXlkjkTWAE20U0=; b=g8XO7GiaR9I/8MSq8vNOC8n9Zjdf9iwOmT25kQ4xcSoHEFAaUVXiioDJpXSFEGM/FX QiRHrnXy4C3eZbMS/HKHHHjfTNbwQKYvjDzOAeoK37i9GxcyCUnr7oP3jMf/093uPLP2 gIexxaR99d8BsZFHxFMms0ILgNIgHYtwtUJD9vCPbgRPpY1aIQTsTiokf3xlDM3IT+Hf hr0Bq9xF4PbuQR81x6ZodSzm+rS6cI/6wQH1K7/J9qs9v06RUDnqh0t/3VINH2ZWbg50 DVfRErAm0zplGE9wp8ZiAFxl11rqLvItVbBQWxNu3NOE0Qfq4H/BPMrUo0RpkwlRjL45 XhqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=YL/v7kwpoAOgfrWESvYJW+oEOt7FvpXlkjkTWAE20U0=; b=Wf49mLSF2E93GecJ7u7RjQVPKSWkLE+exsQj7BxJlXO2UMZu2StthH7EDwAwImMudQ FJEBukY2AenuSjcirqSzaw9MvV8Pgr7HAFTj4UbTtn3tRTRA3rkS97BSq8R/fDuLAS9d nOZx0xuPR7hWgo7F+FVkEW462+UmOLHMBKmi5tygKA8F7b8iWST3sbgQwG9etr+Oh6S7 K88xxExmVyRFHVaYJE4EVfbjNq5avW3E31f2S0THrnEOl8k7EvMlCI32m+1UjdAv7r9v 2iPh4OvBP4c+ykrz0Z1X9DP/6Fuskw7YQ9F2tUHt81rHinGkwxFkniRQqqIs+IAHFLDx XYvg== X-Gm-Message-State: APjAAAWhOkDdmpO6z3pqOYpB0k9luRvOu+Goa9h6N9XGojLchHkFiT+F b3l6PwFa/5/INjxKvsl4WZvthQ== X-Received: by 2002:a7b:cd84:: with SMTP id y4mr779871wmj.79.1562058677297; Tue, 02 Jul 2019 02:11:17 -0700 (PDT) Received: from holly.lan (cpc141214-aztw34-2-0-cust773.18-1.cable.virginm.net. [86.9.19.6]) by smtp.googlemail.com with ESMTPSA id t15sm12269862wrx.84.2019.07.02.02.11.16 (version=TLS1_3 cipher=AEAD-AES128-GCM-SHA256 bits=128/128); Tue, 02 Jul 2019 02:11:16 -0700 (PDT) Subject: Re: [PATCH 03/12] backlight: gpio: pull the non-pdata device probing code into probe() To: Bartosz Golaszewski , Sekhar Nori , Kevin Hilman , Lee Jones , Jingoo Han , Bartlomiej Zolnierkiewicz , David Lechner , Linus Walleij Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, Bartosz Golaszewski References: <20190625163434.13620-1-brgl@bgdev.pl> <20190625163434.13620-4-brgl@bgdev.pl> From: Daniel Thompson Message-ID: <920a5359-d662-5111-8b3d-4f5c63b2afb6@linaro.org> Date: Tue, 2 Jul 2019 10:11:16 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 In-Reply-To: <20190625163434.13620-4-brgl@bgdev.pl> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 25/06/2019 17:34, Bartosz Golaszewski wrote: > From: Bartosz Golaszewski > > There's no good reason to have the generic probing code in a separate > routine. This function is short and is inlined by the compiler anyway. > Move it into probe under the pdata-specific part. > > Signed-off-by: Bartosz Golaszewski Like the others, this will need to be respun to match latest code but when it comes round again: Acked-by: Daniel Thompson Daniel. > --- > drivers/video/backlight/gpio_backlight.c | 39 ++++++++---------------- > 1 file changed, 13 insertions(+), 26 deletions(-) > > diff --git a/drivers/video/backlight/gpio_backlight.c b/drivers/video/backlight/gpio_backlight.c > index 8adbc8d75097..89e10bccfd3c 100644 > --- a/drivers/video/backlight/gpio_backlight.c > +++ b/drivers/video/backlight/gpio_backlight.c > @@ -54,30 +54,6 @@ static const struct backlight_ops gpio_backlight_ops = { > .check_fb = gpio_backlight_check_fb, > }; > > -static int gpio_backlight_probe_prop(struct platform_device *pdev, > - struct gpio_backlight *gbl) > -{ > - struct device *dev = &pdev->dev; > - enum gpiod_flags flags; > - int ret; > - > - gbl->def_value = device_property_read_bool(dev, "default-on"); > - flags = gbl->def_value ? GPIOD_OUT_HIGH : GPIOD_OUT_LOW; > - > - gbl->gpiod = devm_gpiod_get(dev, NULL, flags); > - if (IS_ERR(gbl->gpiod)) { > - ret = PTR_ERR(gbl->gpiod); > - > - if (ret != -EPROBE_DEFER) { > - dev_err(dev, > - "Error: The gpios parameter is missing or invalid.\n"); > - } > - return ret; > - } > - > - return 0; > -} > - > static int gpio_backlight_probe(struct platform_device *pdev) > { > struct gpio_backlight_platform_data *pdata = > @@ -86,6 +62,7 @@ static int gpio_backlight_probe(struct platform_device *pdev) > struct device *dev = &pdev->dev; > struct backlight_device *bl; > struct gpio_backlight *gbl; > + enum gpiod_flags flags; > int ret; > > gbl = devm_kzalloc(dev, sizeof(*gbl), GFP_KERNEL); > @@ -116,9 +93,19 @@ static int gpio_backlight_probe(struct platform_device *pdev) > if (!gbl->gpiod) > return -EINVAL; > } else { > - ret = gpio_backlight_probe_prop(pdev, gbl); > - if (ret) > + gbl->def_value = device_property_read_bool(dev, "default-on"); > + flags = gbl->def_value ? GPIOD_OUT_HIGH : GPIOD_OUT_LOW; > + > + gbl->gpiod = devm_gpiod_get(dev, NULL, flags); > + if (IS_ERR(gbl->gpiod)) { > + ret = PTR_ERR(gbl->gpiod); > + > + if (ret != -EPROBE_DEFER) { > + dev_err(dev, > + "Error: The gpios parameter is missing or invalid.\n"); > + } > return ret; > + } > } > > memset(&props, 0, sizeof(props)); >