Received: by 10.213.65.68 with SMTP id h4csp33952imn; Thu, 15 Mar 2018 15:44:35 -0700 (PDT) X-Google-Smtp-Source: AG47ELs6nzcbhcjOt0/t5hkNt3tVqijMQaBvWgbkJw8AsBMhSZv4nXBZVp53w1KwjsQmKlKWUnRt X-Received: by 10.99.64.3 with SMTP id n3mr8158460pga.316.1521153875138; Thu, 15 Mar 2018 15:44:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521153875; cv=none; d=google.com; s=arc-20160816; b=f88U2O0u5v90FcE968Z3m4MpwubcbHJrlpp9LUy1zePXYCxFrpZOfftsqYbQzF6Ss7 JwvF1BhXbHBm3cPv//xomkkYg2BTLkMJVnoVLRtlBCGCehSnrd+jkVe8ypYcpZyWz0Y4 4CqTtq5SHL/E4lNxgkF9laM5+UZ8jLWlUZm0uNP+YsO2L33GY4ETP1Hm4Qi38ZV6mOcM C/tvYfmEPGrUHa3Y+JIaxMl11p95Z3UqM+w/xcJbQbp6jabH6LxRz8PLsAD/K6o8pXB8 cQ7uztq9b+PhYGvzvb8dCpo3QDpr2q4uiPiodM6eLxRZnun+pHa3dPi1j/ngWwXpN2+x 257Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=9BYbo+5ni0t3EJLLc4X8iQVDzMMSzzxyjCIO0uy5tKI=; b=rsDYJkZpCzPRq+Wekq3tYPpJKKYVee+MIAJSEN1ddrpsRiE6IwjTF/BfK+mnMhGUgy it7dqBWT+K3KygeDJBQd+WL/O2wjf3fQ/P64qsZYGGKtrM2Ss96cgrilaMXh351xPItR gBFEM6PZ2veep3E19hDvwNRxwTRi3UG1cls4RzKsjgkpbUbwuOCwQD5CeOM8VNal1lw0 QuUB5GPbGHdDz0fmFbKLt+QhofjUaRguf9WiJVc4O65/g4PD3TBPj4vX6eEopA0vzaxo Jv/4ooksp+RHRX+uZpxiluMc/a1L/+waQbynDGqAVkK3Iu85Ufk2wlHBRC9JImIvWtkJ Qugg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ew7iy445; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p15si2360539pgn.17.2018.03.15.15.44.10; Thu, 15 Mar 2018 15:44:35 -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=@gmail.com header.s=20161025 header.b=ew7iy445; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932856AbeCOWmd (ORCPT + 99 others); Thu, 15 Mar 2018 18:42:33 -0400 Received: from mail-pl0-f67.google.com ([209.85.160.67]:39873 "EHLO mail-pl0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932729AbeCOWmM (ORCPT ); Thu, 15 Mar 2018 18:42:12 -0400 Received: by mail-pl0-f67.google.com with SMTP id k22-v6so3860143pls.6; Thu, 15 Mar 2018 15:42:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=9BYbo+5ni0t3EJLLc4X8iQVDzMMSzzxyjCIO0uy5tKI=; b=ew7iy445BxdrwAavSdsDWj7bVlC2s96MrCgJ0sNWssgFzojkBnx8TJnAbgpkrDkZ74 5J/CVOz8Bqt/kInCA9cluSz2TEgz5eiu1sKcL8FgTwDx7BEIALPU1mnmBRJkuM45iOG5 HMax9UjPjogVN0jv49SqfMb6miy9gzHWBa3R4w7EICxUR7/XBl3tiOL1DVpp6fIPy+qs a+k0eL/8eq7zTOrY3oSCvrPzh/8jBnCe4fB7OI2KpbXV2dxWkBRaXBmGZyhvm9Yh80WR 7CEsE/vhrlCGV8Swrt6n1a+RrFFt7sIdpnZdmm+LMV373CiKFVAcdqIaPJ6OAGBx/kgk 22wg== 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; bh=9BYbo+5ni0t3EJLLc4X8iQVDzMMSzzxyjCIO0uy5tKI=; b=A2Nlq/mZ7os6tESYHZ7Agqny9QuKeYkZzaKPZS+pvKHJeGk8NdMX5FfmhURVE3ecec GZXHXVXDeDs6FncPsSSk6Xrl/LfE9O3WM3em2TR5oyU1F6pU3LdrWHuEDNLGJLeQE+nt spy5ghfSJT49NQCq6IRMwh9T4pc0JDi2ZFl/U21dfc+k0qv8hrhMLa/mGv81PwSB+Erg pKGFqtgy1fF7+WedWZulm2Feoe9PoNMHFuktDYSgu/vbx7MDgbZeo6sX7Gd4a0ULCz87 e90NTysbRFXusythNcd2o/d5BAva1Vn69F1C/a/hAJGOFVf8EseEbDAlV1Kk2qC/z+Ba HSBA== X-Gm-Message-State: AElRT7Ezhu+anHE37OlQU9P4ke7ujjgZWcGfH8Hj2tso+Cq6J5lOX3bY 6AmblePQ5fG5svk2l1hXDg8= X-Received: by 2002:a17:902:8b85:: with SMTP id ay5-v6mr9711526plb.329.1521153731611; Thu, 15 Mar 2018 15:42:11 -0700 (PDT) Received: from dtor-ws.mtv.corp.google.com ([2620:0:1000:1511:8de6:27a8:ed13:2ef5]) by smtp.gmail.com with ESMTPSA id c62sm4607888pfk.179.2018.03.15.15.42.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 15 Mar 2018 15:42:11 -0700 (PDT) From: Dmitry Torokhov To: Laurent Pinchart , Lee Jones Cc: Daniel Thompson , Jingoo Han , linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-sh@vger.kernel.org, Yoshinori Sato , Rich Felker , Linus Walleij Subject: [RFC 4/4] backlight: gpio_backlight: remove platform data support Date: Thu, 15 Mar 2018 15:42:02 -0700 Message-Id: <20180315224202.96668-5-dmitry.torokhov@gmail.com> X-Mailer: git-send-email 2.16.2.804.g6dcf76e118-goog In-Reply-To: <20180315224202.96668-1-dmitry.torokhov@gmail.com> References: <20180315224202.96668-1-dmitry.torokhov@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Legacy boards can use static property sets/GPIO lookup tables to describe backlight connections, there is no need to maintain legacy platform data. Signed-off-by: Dmitry Torokhov --- drivers/video/backlight/gpio_backlight.c | 85 ++++---------------- include/linux/platform_data/gpio_backlight.h | 20 ----- 2 files changed, 14 insertions(+), 91 deletions(-) delete mode 100644 include/linux/platform_data/gpio_backlight.h diff --git a/drivers/video/backlight/gpio_backlight.c b/drivers/video/backlight/gpio_backlight.c index 173fc4aafb89b..795359deeb700 100644 --- a/drivers/video/backlight/gpio_backlight.c +++ b/drivers/video/backlight/gpio_backlight.c @@ -15,17 +15,12 @@ #include #include #include -#include -#include #include +#include #include struct gpio_backlight { - struct device *dev; - struct device *fbdev; - struct gpio_desc *gpiod; - int def_value; }; static int gpio_backlight_update_status(struct backlight_device *bl) @@ -43,84 +38,32 @@ static int gpio_backlight_update_status(struct backlight_device *bl) return 0; } -static int gpio_backlight_check_fb(struct backlight_device *bl, - struct fb_info *info) -{ - struct gpio_backlight *gbl = bl_get_data(bl); - - return gbl->fbdev == NULL || gbl->fbdev == info->dev; -} - static const struct backlight_ops gpio_backlight_ops = { .options = BL_CORE_SUSPENDRESUME, .update_status = gpio_backlight_update_status, - .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; - 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 = - dev_get_platdata(&pdev->dev); + struct device *dev = &pdev->dev; struct backlight_properties props; struct backlight_device *bl; struct gpio_backlight *gbl; + int def_value; int ret; - gbl = devm_kzalloc(&pdev->dev, sizeof(*gbl), GFP_KERNEL); - if (gbl == NULL) + gbl = devm_kzalloc(dev, sizeof(*gbl), GFP_KERNEL); + if (!gbl) return -ENOMEM; - gbl->dev = &pdev->dev; - - if (!pdata) { - ret = gpio_backlight_probe_dt(pdev, gbl); - if (ret) - return ret; - } else { - /* - * 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; - - 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; + def_value = device_property_read_bool(dev, "default-on"); + gbl->gpiod = devm_gpiod_get(dev, NULL, + def_value ? GPIOD_OUT_HIGH : GPIOD_OUT_LOW); + if (IS_ERR(gbl->gpiod)) { + ret = PTR_ERR(gbl->gpiod); + if (ret != -EPROBE_DEFER) + dev_err(dev, "unable to request GPIO: %d\n", ret); + return ret; } memset(&props, 0, sizeof(props)); @@ -134,7 +77,7 @@ static int gpio_backlight_probe(struct platform_device *pdev) return PTR_ERR(bl); } - bl->props.brightness = gbl->def_value; + bl->props.brightness = def_value; backlight_update_status(bl); platform_set_drvdata(pdev, bl); diff --git a/include/linux/platform_data/gpio_backlight.h b/include/linux/platform_data/gpio_backlight.h deleted file mode 100644 index 683d90453c419..0000000000000 --- a/include/linux/platform_data/gpio_backlight.h +++ /dev/null @@ -1,20 +0,0 @@ -/* - * gpio_backlight.h - Simple GPIO-controlled backlight - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ -#ifndef __GPIO_BACKLIGHT_H__ -#define __GPIO_BACKLIGHT_H__ - -struct device; - -struct gpio_backlight_platform_data { - struct device *fbdev; - int gpio; - int def_value; - const char *name; -}; - -#endif -- 2.16.2.804.g6dcf76e118-goog