Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp3791519ybp; Sun, 6 Oct 2019 20:32:48 -0700 (PDT) X-Google-Smtp-Source: APXvYqw+EEWL+jPFSq1ggj/1t6yzpQoNROtL1bVP/YwqlD/VkRgZGErmnjdkTc5zOA3zMwrPoGJ8 X-Received: by 2002:a17:906:b84c:: with SMTP id ga12mr22397059ejb.0.1570419168323; Sun, 06 Oct 2019 20:32:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570419168; cv=none; d=google.com; s=arc-20160816; b=tRrDSOxVyVD1dNKD4ALce2H801sZaxDQYDTSfpLS+NDNeelGcmwjEZgm9lsSQEraaW NvGHnepVDSKmN6FS5jbDXrFoEN6I+x5CWBaNdFwwMm+sVAJnWfUZR5svq9bhuDjHgUwP KqLKMCpdIHVhANS+8pCnO2y1MjRL9m7DGgPwuwkU6DCHxGkF0W7RcWUFzAjamEh5uV3+ Lr2UvV+dt7ON/Zsd2JGf1C5ZoNTQKYVpLTrTO8zOH2VohtA0Mxy4XUDmd/7PECigeLaP Bpkp6th1KFrfR9f03W6GLtgTxb7o4gYYPlIe0r3zft1xsR7bl7iqNoliRV+vmxJED4He /PlQ== 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=nGttCXCUTufQ00gCZ8QmnQ1I5lZpZkhALPcK59Skk0o=; b=IEkD2fUyV+14A7y2S9N/nbv5CdHoyT4DH2TelB82VyBq3m7NMKGTCNLJvLim/wfGUu XTNlpmtPuQlvSalcDm1avduzvRXyv7hTNTjKN4dgB05DiZf2FDipA6v8Oj3OVcZjBp79 6+ho5hZqFGlGi+PBeAh09/7MzunGWZv1pPqjML3eeIM80evvpYeqhx46NUfnyLIEpoWy mMvgV1ke27fab05ndqFfiim6Cpd6ny1SZOE1bDS57DQl74nfPJz+T75oJ7t+vSMJVp2E PieKvf8T7F23p00Bh/WFuJYiKmn3DKXtEGhFyQ9JSCNc//VJdKOBfBdDNULhgW+rMtYd J2Dw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b=QaDNsl3l; 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 h19si7332364edv.393.2019.10.06.20.32.24; Sun, 06 Oct 2019 20:32:48 -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=QaDNsl3l; 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 S1727209AbfJGDcL (ORCPT + 99 others); Sun, 6 Oct 2019 23:32:11 -0400 Received: from mail-pg1-f195.google.com ([209.85.215.195]:38307 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727175AbfJGDcI (ORCPT ); Sun, 6 Oct 2019 23:32:08 -0400 Received: by mail-pg1-f195.google.com with SMTP id x10so7336051pgi.5 for ; Sun, 06 Oct 2019 20:32:07 -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=nGttCXCUTufQ00gCZ8QmnQ1I5lZpZkhALPcK59Skk0o=; b=QaDNsl3lPwrys6+c19cQUZfN0xEVA2hqhmRXa+jPGCf/gwFHbGVgNlFNFZLRqm4hnC oqAvQl6hnUUr6+BTy5Q7rxw5MxVik5BNrTgF/4EFIOC+3QpNGOgammIc3qALq9oXw1Vc P0vcG8uL3K5yRSciO/VHo0q/sa4MJIvXWsyYNAMV+kfB4aoB9T6LGYYA5I/mPkAQ/+h3 TdglHQdO7nLnEwp6nVMd0wbNwb0vmW7KlgL7gzsugljN1hSSqvG4kw3cJEzS/4GqRnG9 4YatOb+M1flLT7qU31ciQFAinvCoH5QW6JLWmcZnjf8Ou78XdpP0AsUWmmkbD13Iv5Tk g8BA== 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=nGttCXCUTufQ00gCZ8QmnQ1I5lZpZkhALPcK59Skk0o=; b=hBI5Y/ZAc9fzoKEukZJYyuMEtyLlC0G6bp6/akEt6QmsF1nZqob3Cv+Yh4XM585jx+ nraAqvdk1U6//4Rfe4ED5ZUm7zmSrf6L0R7CNhwiaGk394EOzZPFECEXkie/mc0ZcY5v v6i8DAgpts0BWRpUwiyiK0ZejuA5cjKXLFc3ykPE55mXHTk1IDeuzc+cJsLQdfWNNsVn VCNHPYNAbQXiMOjIsvMQuT88DYklRpsGd96FoPDResTMreRY4AeCZKE9c+B/363ifvPA TPHxvWIii1Rig02idpwy6CTvfcmIUjKs0wcP6wjL46YWf59ZAUx7sj1gJoCRI+w33RUw XEeg== X-Gm-Message-State: APjAAAU4AgixAUdZeU6jw/ezOnz4vYUUzIn5YsRQ22lERionQsK4ns+O mJRZ/cLi7vfUhrZnwhb22f6tKQ== X-Received: by 2002:a17:90a:8001:: with SMTP id b1mr32016772pjn.56.1570419127187; Sun, 06 Oct 2019 20:32:07 -0700 (PDT) Received: from debian-brgl.local (96-95-220-76-static.hfc.comcastbusiness.net. [96.95.220.76]) by smtp.gmail.com with ESMTPSA id x10sm16377720pfr.44.2019.10.06.20.32.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 06 Oct 2019 20:32:06 -0700 (PDT) From: Bartosz Golaszewski To: Yoshinori Sato , Rich Felker , Lee Jones , Daniel Thompson , Jingoo Han , Bartlomiej Zolnierkiewicz , Linus Walleij , Andy Shevchenko , Jacopo Mondi Cc: linux-sh@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH v5 3/7] backlight: gpio: simplify the platform data handling Date: Mon, 7 Oct 2019 05:31:56 +0200 Message-Id: <20191007033200.13443-4-brgl@bgdev.pl> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191007033200.13443-1-brgl@bgdev.pl> References: <20191007033200.13443-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 Now that the last user of platform data (sh ecovec24) defines a proper GPIO lookup and sets the 'default-on' device property, we can drop the platform_data-specific GPIO handling and unify a big chunk of code. The only field used from the platform data is now the fbdev pointer. Signed-off-by: Bartosz Golaszewski Reviewed-by: Linus Walleij Reviewed-by: Daniel Thompson Reviewed-by: Andy Shevchenko --- drivers/video/backlight/gpio_backlight.c | 62 +++++------------------- 1 file changed, 11 insertions(+), 51 deletions(-) diff --git a/drivers/video/backlight/gpio_backlight.c b/drivers/video/backlight/gpio_backlight.c index 7e1990199fae..20c5311c7ed2 100644 --- a/drivers/video/backlight/gpio_backlight.c +++ b/drivers/video/backlight/gpio_backlight.c @@ -6,7 +6,6 @@ #include #include #include -#include /* Only for legacy support */ #include #include #include @@ -54,28 +53,6 @@ static const struct backlight_ops gpio_backlight_ops = { .check_fb = gpio_backlight_check_fb, }; -static int gpio_backlight_probe_dt(struct platform_device *pdev, - struct gpio_backlight *gbl) -{ - struct device *dev = &pdev->dev; - int ret; - - gbl->def_value = device_property_read_bool(dev, "default-on"); - - gbl->gpiod = devm_gpiod_get(dev, NULL, GPIOD_ASIS); - 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_initial_power_state(struct gpio_backlight *gbl) { struct device_node *node = gbl->dev->of_node; @@ -107,35 +84,18 @@ static int gpio_backlight_probe(struct platform_device *pdev) gbl->dev = &pdev->dev; - if (pdev->dev.fwnode) { - ret = gpio_backlight_probe_dt(pdev, gbl); - if (ret) - return ret; - } else if (pdata) { - /* - * Legacy platform data GPIO retrieveal. Do not expand - * the use of this code path, currently only used by one - * SH board. - */ - unsigned long flags = GPIOF_DIR_OUT; - + if (pdata) gbl->fbdev = pdata->fbdev; - gbl->def_value = pdata->def_value; - flags |= gbl->def_value ? GPIOF_INIT_HIGH : GPIOF_INIT_LOW; - - ret = devm_gpio_request_one(gbl->dev, pdata->gpio, flags, - pdata ? pdata->name : "backlight"); - if (ret < 0) { - dev_err(&pdev->dev, "unable to request GPIO\n"); - return ret; - } - gbl->gpiod = gpio_to_desc(pdata->gpio); - if (!gbl->gpiod) - return -EINVAL; - } else { - dev_err(&pdev->dev, - "failed to find platform data or device tree node.\n"); - return -ENODEV; + + gbl->def_value = device_property_read_bool(&pdev->dev, "default-on"); + + gbl->gpiod = devm_gpiod_get(&pdev->dev, NULL, GPIOD_ASIS); + if (IS_ERR(gbl->gpiod)) { + ret = PTR_ERR(gbl->gpiod); + if (ret != -EPROBE_DEFER) + dev_err(&pdev->dev, + "Error: The gpios parameter is missing or invalid.\n"); + return ret; } memset(&props, 0, sizeof(props)); -- 2.23.0