Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp4016534ybd; Tue, 25 Jun 2019 12:30:16 -0700 (PDT) X-Google-Smtp-Source: APXvYqxNekRDuGnRnJsPC18UdF3zhLlPN4STNPyzAyPtXy3KRi2vEbfxuX8yRyiu/BEiKUI/yh1P X-Received: by 2002:a17:902:c83:: with SMTP id 3mr373046plt.326.1561491016421; Tue, 25 Jun 2019 12:30:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561491016; cv=none; d=google.com; s=arc-20160816; b=mlsGhw/Sl0isIhQOD9AfP8Z07EIZBnpVS/RzCrgiMV7H+iLy2pCMVUi7Bn/ACb8HgM KCkUVBvLVsCK7VH4EwJ+8ypu+3gWaF727WannilmnhMjtUun8TaY8rAJ+xdtUT+mVvb9 OQqmCenZRb83NuzOwGQR+j2hWMmT1qrUw8qmWfWucuitbUV0xg0LozO3lYyusKsFuz/4 l8nBJV1Ryv+HAHVoRu14XI8lqRuPyEZ6CDyGQB2OECJJlNXMeE+/aLYSHXOX/7diibeH GMyPoD4Dm/8UCsAInSLUIFyBEtes1/pFFh135NP9ULq8pRdhhgcYCboUMaW2y3nS4fxv M13g== 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:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=9jHnEFpHn7uzznoO3/dgHPquJFVDhGL7Sa3AB/IK/o8=; b=fVcIRDbjZS5+7HiMADZR+yGCIkVl2QiWOnHPPnr/+0WCw3+cQQpT8CU1y3WtnECXUL /xloyEg93oBVkmP21nZrKfp3XQ7WENo7osTApJHrLEkhUmhKbGF8I1vKJptemltVm5SV 98BecgCHe5UPTcFNjJoE5D326Nm/qaWpzYrOFK+Px6QaWOP0M2C026z8O1lSU2xNmp52 WimWuHaGWukdvz2pch+0L/1er5K5fba6j3CIYTLMX1eTC9eYKPwBe3pHRHMEt2H+5/XZ lu6RIUMDRtfvjVsrr6uyXT2GXKnKfxjORudzZgB3YNNzI1OXwOFExPTkx2zGQ5E1aACM u/Cw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b=hn0sJGMr; 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 o3si1075006pld.102.2019.06.25.12.30.00; Tue, 25 Jun 2019 12:30:16 -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=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b=hn0sJGMr; 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 S1732079AbfFYQfj (ORCPT + 99 others); Tue, 25 Jun 2019 12:35:39 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:42652 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729448AbfFYQe6 (ORCPT ); Tue, 25 Jun 2019 12:34:58 -0400 Received: by mail-wr1-f65.google.com with SMTP id x17so18601161wrl.9 for ; Tue, 25 Jun 2019 09:34:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=9jHnEFpHn7uzznoO3/dgHPquJFVDhGL7Sa3AB/IK/o8=; b=hn0sJGMrU38ycKfPEcke4oemjMf5nF19She6rrogMdb5v0F2pBQBNKFb+k/+2MJbvv x0AL7iJN38li9VNodfle2pG9gu9d2FJ3tvO7WCdfFllzJdndvifHLTLjRDM4aDml+Kuj ARXR5bllOgDLUQO3pl4c5PKCRuEuqrBRd/sgqgOD1M5Honf1Q9rxMnOT9Gtrbba1Pc6q WCixZR6JX0xgDU+5eMlm3aDNlNwAqfajTgyiKEnyZ2eYijvvzNfmrix4ZFYvnBzoboQW vWSvbCOsW9ZdQYXrDXj4UOEBCHTBJKcTLpDkXcvPZbiDAcrZsqeJshpkE3iV/v/oMDyN QHOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=9jHnEFpHn7uzznoO3/dgHPquJFVDhGL7Sa3AB/IK/o8=; b=fxu56WlzoCH+1h//ncqQRt2rO4W34iRRyn34xIKdhRN2pK8JiQA4WT5pHoL6HJarQW POS/r183LGb/KBit45ojd42fN5gSOthmMlm5sJctxoxK59VDwuywCy0oD5TkNDQ9ygsZ nrYCljuJsC/zYdOlP6jNeFZNd4RdRXBrGDbGVyELsukeKMoCDF22Y/t/aVGJwUPfIs3J orlgrduG25cCJjdPzRirnBGgcQ5RQHhOGCQOcpjGkA4HXoTGpxI+LDkhX66+JQaEY1cl awilOQnp5RwFUdf4x9LiEUJHMYtjO/P6J0dUh4BOVBeDqvnDwNMyIXh4d2GIN/ZQYJN0 TWiA== X-Gm-Message-State: APjAAAU9s7x5M3ioXY2Bh786bMr8q/4aI8CJtSjZEzd98mi5Co56/CNa hpuQyiczq6lDNDXgp/n4h9A9yw== X-Received: by 2002:a5d:4fc8:: with SMTP id h8mr26465755wrw.124.1561480495518; Tue, 25 Jun 2019 09:34:55 -0700 (PDT) Received: from debian-brgl.home ([2a01:cb1d:af:5b00:6d6c:8493:1ab5:dad7]) by smtp.gmail.com with ESMTPSA id g8sm2683795wme.20.2019.06.25.09.34.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 25 Jun 2019 09:34:54 -0700 (PDT) From: Bartosz Golaszewski To: Sekhar Nori , Kevin Hilman , Lee Jones , Daniel Thompson , 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 Subject: [PATCH 03/12] backlight: gpio: pull the non-pdata device probing code into probe() Date: Tue, 25 Jun 2019 18:34:25 +0200 Message-Id: <20190625163434.13620-4-brgl@bgdev.pl> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190625163434.13620-1-brgl@bgdev.pl> References: <20190625163434.13620-1-brgl@bgdev.pl> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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)); -- 2.21.0