From patchwork Mon Oct 7 03:31:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 11176859 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 36AD8112B for ; Mon, 7 Oct 2019 07:02:26 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1F1BD20867 for ; Mon, 7 Oct 2019 07:02:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1F1BD20867 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C5D906E455; Mon, 7 Oct 2019 07:01:52 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pf1-x443.google.com (mail-pf1-x443.google.com [IPv6:2607:f8b0:4864:20::443]) by gabe.freedesktop.org (Postfix) with ESMTPS id E235C6E44D for ; Mon, 7 Oct 2019 03:32:04 +0000 (UTC) Received: by mail-pf1-x443.google.com with SMTP id v4so7729615pff.6 for ; Sun, 06 Oct 2019 20:32:04 -0700 (PDT) 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=XXUGs3TD/mQ9EDaZ43OuKw31dOCYSa+NG57KsS4H5LI=; b=P694T/V/HuUQa9jsZVu80Va4iQ9wtecy4da5VAGcgoBCAt4HzLKBeknNUVEhKAoQCj Vnu6klBIxwiQ3trtI9vFRqvmjIcXPcqHB9fSNEROQ8BXLuQYWn4pI1hG2C+UnKgwgm6o bjnNkoX1Jx2BpxcIJG/ws72QkPLORzb3uvSv/V3hSFBf0LO4pnrB8I0OKFtpRHjV3ORL WVncOpAA72iEL91vlbH8+hMdB7VfXBKSOta50WEF5ZlooM+1YgN8K2q36Ztz5LqQPmXK weCiJImi5BGZEGOi/KLp7A4u2SoWl9jCSIVijpIgIQDox5tHOwFqs5VnZ1/h9hzMVybH BiCw== X-Gm-Message-State: APjAAAULZFX7N1AM96V9MYrnY9jib+iiALpo5NiL+7LrhFI8EEnVruGv d2Nbcbk5HvOfa3qR9H4LnlCALg== X-Google-Smtp-Source: APXvYqwD1Ahm73jrBPcdOwtpwjSteXXDBGfgtBkjwZk7/DaYkZiI+mMtwaDZj10mJprtCxD4b2Gkfw== X-Received: by 2002:a63:1915:: with SMTP id z21mr5731158pgl.343.1570419124423; Sun, 06 Oct 2019 20:32:04 -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.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 06 Oct 2019 20:32:04 -0700 (PDT) From: Bartosz Golaszewski To: Yoshinori Sato , Rich Felker , Lee Jones , Daniel Thompson , Jingoo Han , Bartlomiej Zolnierkiewicz , Linus Walleij , Andy Shevchenko , Jacopo Mondi Subject: [PATCH v5 1/7] backlight: gpio: remove unneeded include Date: Mon, 7 Oct 2019 05:31:54 +0200 Message-Id: <20191007033200.13443-2-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 X-Mailman-Approved-At: Mon, 07 Oct 2019 07:01:51 +0000 X-Mailman-Original-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=XXUGs3TD/mQ9EDaZ43OuKw31dOCYSa+NG57KsS4H5LI=; b=edi7NYtYkiqE1uOWeL+U87Ck5mZpITswFODSgMcBAtpM60H+NcmQ1P13TeUemB2tXb nYWc7NXa2Rygyfr0y+T+T6F/VX/YcYhwJX+hIjXFAxA8pv3CNNRtzGAYoje6QugPsHgW 7f8J7IIc8ejfyyLdcO4inN5wtPcu/z7VdbEHq9yvGW3on1vSaNYWpqxFWSVJhJUpvlVu jNDWGewuuI45w5ms+ZPxtc5MHS2i/2ehOYqGySiFBXVOb3KMy9aSruKofSgiOehdlH1F PR3LajUBOwTC7I5nYpXz+9X6zPjE5V7Qrh6z9DBAFH+HjVolLxiJbfAn1FVYsHHgLIz/ 9JOg== X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Bartosz Golaszewski , linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-sh@vger.kernel.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Bartosz Golaszewski We no longer use any symbols from of_gpio.h. Remove this include. Signed-off-by: Bartosz Golaszewski Reviewed-by: Linus Walleij Reviewed-by: Daniel Thompson Reviewed-by: Andy Shevchenko --- drivers/video/backlight/gpio_backlight.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/video/backlight/gpio_backlight.c b/drivers/video/backlight/gpio_backlight.c index 18e053e4716c..7e1990199fae 100644 --- a/drivers/video/backlight/gpio_backlight.c +++ b/drivers/video/backlight/gpio_backlight.c @@ -12,7 +12,6 @@ #include #include #include -#include #include #include #include From patchwork Mon Oct 7 03:31:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 11176867 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 50EE714DB for ; Mon, 7 Oct 2019 07:02:35 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 393192196F for ; Mon, 7 Oct 2019 07:02:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 393192196F Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C5B436E478; Mon, 7 Oct 2019 07:01:54 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pf1-x443.google.com (mail-pf1-x443.google.com [IPv6:2607:f8b0:4864:20::443]) by gabe.freedesktop.org (Postfix) with ESMTPS id 518D96E44F for ; Mon, 7 Oct 2019 03:32:06 +0000 (UTC) Received: by mail-pf1-x443.google.com with SMTP id y22so7752447pfr.3 for ; Sun, 06 Oct 2019 20:32:06 -0700 (PDT) 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=l2IW6NowdeBUIPfd3VNaI3dgAIYTgpRJtcprF0UeLqs=; b=EKR7q6cTkPgyTO9vzVqWJ0SwNnr220Dr2FApc+pdmT2XXfpZUP4BQncqaUYLSQBOD/ z3xy/HBA1oeiFLjT6kVBkZHCS7fl3w3xlb4qocT/hJvUJtG/uYwrLMZCI1XkJHCxFLLF 7d4zroOyZn2Jnfl1Jp+YQ4VSxhbG/hnD6b33keQ06waqZu3H3OTmVE20ODcDQ+ld0WMz ltnfsdbpMHGmN2tQo5pysNVSqv0LY+B/Gt0Lt9V9hVfZofhceLNAhm7oh9+myOgEEyRa N09/cIuL2uj80saUEv76SKUz+48h+FlAP0JcQSnMCBM5jXICEU4J1JxPujPcF6kYi19x KGSA== X-Gm-Message-State: APjAAAW26IiYR3WOTIsS/WMc6Qr/XhGgXyQ7fnXbgnzC++Edbzo3iNn2 zbbuV1xDYPa+J4WZ4Zoxv4RoKw== X-Google-Smtp-Source: APXvYqz7s9JwaUSBo6GqoNnv0tsqJVGVlvVsWe22/BTdaniihiz1pfKEjqrkRml5q/ctrY69oeOThQ== X-Received: by 2002:aa7:8585:: with SMTP id w5mr30810659pfn.82.1570419125926; Sun, 06 Oct 2019 20:32:05 -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.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 06 Oct 2019 20:32:05 -0700 (PDT) From: Bartosz Golaszewski To: Yoshinori Sato , Rich Felker , Lee Jones , Daniel Thompson , Jingoo Han , Bartlomiej Zolnierkiewicz , Linus Walleij , Andy Shevchenko , Jacopo Mondi Subject: [PATCH v5 2/7] sh: ecovec24: add additional properties to the backlight device Date: Mon, 7 Oct 2019 05:31:55 +0200 Message-Id: <20191007033200.13443-3-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 X-Mailman-Approved-At: Mon, 07 Oct 2019 07:01:51 +0000 X-Mailman-Original-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=l2IW6NowdeBUIPfd3VNaI3dgAIYTgpRJtcprF0UeLqs=; b=AukjubrN4PDGMujmBkvHkgJfZ+2GlL0+Em3we5DHYt1NKwR5PJeW21D490d/mSjHb/ WlavS8gY35Bu5tottt++wT/UVqxZQHKZ88I/ijmFGikylQxJznYzS/4/cnHa2yWjxH4S r85pSvF9OuxrZu/koI8IPS3ydYYxYFxoDDN+jD8Sl5vdFB6Nkj37zoHjwOd/HLsCucJO XuWDYoOx69SijkEI1t4XJNUF5xo9kNXa7/7z2U+qkTiKueqpcOYocwP5edhzj95An56K hteswR2v8OjuGxYiyRu/wtgLcILNVCsjJeun6mrx5hFvSrKDb0MLgl+om7f+IQRNTzyj CjuQ== X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Bartosz Golaszewski , linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-sh@vger.kernel.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Bartosz Golaszewski Add a GPIO lookup entry and a device property for GPIO backlight to the board file. Tie them to the platform device which is now registered using platform_device_register_full() because of the properties. These changes are inactive now but will be used once the gpio backlight driver is modified. Signed-off-by: Bartosz Golaszewski Reviewed-by: Andy Shevchenko Reviewed-by: Linus Walleij --- arch/sh/boards/mach-ecovec24/setup.c | 30 +++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/arch/sh/boards/mach-ecovec24/setup.c b/arch/sh/boards/mach-ecovec24/setup.c index acaa97459531..aaa8ea62636f 100644 --- a/arch/sh/boards/mach-ecovec24/setup.c +++ b/arch/sh/boards/mach-ecovec24/setup.c @@ -371,6 +371,19 @@ static struct platform_device lcdc_device = { }, }; +static struct gpiod_lookup_table gpio_backlight_lookup = { + .dev_id = "gpio-backlight.0", + .table = { + GPIO_LOOKUP("sh7724_pfc", GPIO_PTR1, NULL, GPIO_ACTIVE_HIGH), + { } + }, +}; + +static struct property_entry gpio_backlight_props[] = { + PROPERTY_ENTRY_BOOL("default-on"), + { } +}; + static struct gpio_backlight_platform_data gpio_backlight_data = { .fbdev = &lcdc_device.dev, .gpio = GPIO_PTR1, @@ -378,13 +391,15 @@ static struct gpio_backlight_platform_data gpio_backlight_data = { .name = "backlight", }; -static struct platform_device gpio_backlight_device = { +static const struct platform_device_info gpio_backlight_device_info = { .name = "gpio-backlight", - .dev = { - .platform_data = &gpio_backlight_data, - }, + .data = &gpio_backlight_data, + .size_data = sizeof(gpio_backlight_data), + .properties = gpio_backlight_props, }; +static struct platform_device *gpio_backlight_device; + /* CEU0 */ static struct ceu_platform_data ceu0_pdata = { .num_subdevs = 2, @@ -1006,7 +1021,6 @@ static struct platform_device *ecovec_devices[] __initdata = { &usb1_common_device, &usbhs_device, &lcdc_device, - &gpio_backlight_device, &keysc_device, &cn12_power, #if defined(CONFIG_MMC_SDHI) || defined(CONFIG_MMC_SDHI_MODULE) @@ -1462,6 +1476,12 @@ static int __init arch_setup(void) #endif #endif + gpiod_add_lookup_table(&gpio_backlight_lookup); + gpio_backlight_device = platform_device_register_full( + &gpio_backlight_device_info); + if (IS_ERR(gpio_backlight_device)) + return PTR_ERR(gpio_backlight_device); + return platform_add_devices(ecovec_devices, ARRAY_SIZE(ecovec_devices)); } From patchwork Mon Oct 7 03:31:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 11176875 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 597A314DB for ; Mon, 7 Oct 2019 07:02:48 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3F1B022459 for ; Mon, 7 Oct 2019 07:02:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3F1B022459 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 69A6B6E4A1; Mon, 7 Oct 2019 07:01:57 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pf1-x442.google.com (mail-pf1-x442.google.com [IPv6:2607:f8b0:4864:20::442]) by gabe.freedesktop.org (Postfix) with ESMTPS id B2A586E450 for ; Mon, 7 Oct 2019 03:32:07 +0000 (UTC) Received: by mail-pf1-x442.google.com with SMTP id 205so7749570pfw.2 for ; Sun, 06 Oct 2019 20:32:07 -0700 (PDT) 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=tQYhiVWfzKfIp/LLolz4tTXV9GgxH2GTyHl8Hp5hHs4LKqL5k4QSF7C0chmoUtjf6K Dh9YTK/PacQmYk7BGkp4iK3GZVrz8lwvAXHb6FNRX8BXjqS9b9Y6/c7FADyY/knyJCQ5 ZyYxsKWDM3eRUhbbW056njuw7XN5pz72jRKjDxaHp/Lx5UvPxKNOderK/gZVKjdAj1l7 mgREJVQb9e+g5CnsuOJxsmNS5LzZpgQWiFI2RNGYJZKIjo5ZZvajwyZerCFQN0ezwO0J yK74i2k0y1Ze3E4yB2/cWb1fIYRVV2RJdXiLE8QFv74WObvkIrhRknzLvODGZgnM4V7m UDrA== X-Gm-Message-State: APjAAAW1QbQlSmIaels4zlEu9OYYBSK1xfPuhCmptlT2YPvk0TOnP0MW tDimhg4ylY/QVvIcm7wPgRZxuQ== X-Google-Smtp-Source: APXvYqx76nXvhspQY2IMt3FPcRnICCEPJ2Mzepztm3g6/xdrNMu+Cnj8pAQbJAyORrvFBRAd3/uLNw== 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 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 X-Mailman-Approved-At: Mon, 07 Oct 2019 07:01:51 +0000 X-Mailman-Original-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-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Bartosz Golaszewski , linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-sh@vger.kernel.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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)); From patchwork Mon Oct 7 03:31:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 11176877 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D318114DB for ; Mon, 7 Oct 2019 07:02:49 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BBA1C22459 for ; Mon, 7 Oct 2019 07:02:49 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BBA1C22459 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id EAD5B6E488; Mon, 7 Oct 2019 07:01:55 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pf1-x441.google.com (mail-pf1-x441.google.com [IPv6:2607:f8b0:4864:20::441]) by gabe.freedesktop.org (Postfix) with ESMTPS id 187DA6E450 for ; Mon, 7 Oct 2019 03:32:09 +0000 (UTC) Received: by mail-pf1-x441.google.com with SMTP id y5so7736754pfo.4 for ; Sun, 06 Oct 2019 20:32:09 -0700 (PDT) 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=YdPiqrMx4DGxjMQly7Bs8yH/i3WsBA2bl/JSPtLQAlU=; b=FxamlCN5HfBgSa04iw474a6kmQSeS7TA5/1UTG5JGqew3g0SxPOsh+NzaS45hw24X5 soGLX17brHpv4nbKKaGsK+c8Bg/LjQsk3bcjTiZm1epVFXKT0EttFObj6OaOMwL50/f7 NInKgssyh4o8UCmEYzmVqELZKSEQnrnE0k5R1aLDhA383/N87TPkpyJfLMtD3hzkGyoT E1xa8714lebrbARR3HMWGUhubPBhrGaN7jaC1vaWiH8y1TwIQ6GYlW4yhTAQU7HTEt98 YHoxrohmePjLETqCBP1tlYpx+0atrBUhubENwO717jSf9ons61jyueM1bYybTytfs/EU 8JhQ== X-Gm-Message-State: APjAAAVO+WQkBZeZ6HCxN7Mft6xX2YWD1oHVogh0RcnkDrQrjG69C+G0 UEzxFM97yjujt9rI+r4V7WgMKA== X-Google-Smtp-Source: APXvYqzdOWFcsQosjrpnIGRE710tR911OOtW+TNB7GzyjXHdPq3QJaRmZyw9bD+GubnD2IvAJNhmSw== X-Received: by 2002:a62:7d54:: with SMTP id y81mr30577794pfc.86.1570419128451; Sun, 06 Oct 2019 20:32:08 -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.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 06 Oct 2019 20:32:08 -0700 (PDT) From: Bartosz Golaszewski To: Yoshinori Sato , Rich Felker , Lee Jones , Daniel Thompson , Jingoo Han , Bartlomiej Zolnierkiewicz , Linus Walleij , Andy Shevchenko , Jacopo Mondi Subject: [PATCH v5 4/7] sh: ecovec24: don't set unused fields in platform data Date: Mon, 7 Oct 2019 05:31:57 +0200 Message-Id: <20191007033200.13443-5-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 X-Mailman-Approved-At: Mon, 07 Oct 2019 07:01:51 +0000 X-Mailman-Original-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=YdPiqrMx4DGxjMQly7Bs8yH/i3WsBA2bl/JSPtLQAlU=; b=CdUzkW995hDj+4VhwVg9oMZHUzQGlHk72ob3OVsXRVWZgf7+4PHcvudHA/4wmxF+Nx q+SIn6grfSFoMvOijlJ9pQ33jnn2HTj+q/fNdBXa9XiocAuw6VtpXZ6uq4TlDqtHtpoW uzBnJM5AkvSTCU9MtnTncl8QA8kaeg1O2tXI77iJpYeu/i7WyUxJzuzz7F21puHWx2Vv n3dkHdeaikrmzXLbNk9GudGvyDoVdGfiVsmDaMrvK8ByUz5nRuPw0Z4rzejlbciaT0p9 oCxo5hLvx+sIIVu0Vn9kz6xNFGZ12WuMxEDcZWxk1OPqX2NpNxdx+GQmU1E8FXVLopYl n06Q== X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Bartosz Golaszewski , linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-sh@vger.kernel.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Bartosz Golaszewski Platform data fields other than fbdev are no longer used by the backlight driver. Remove them. Signed-off-by: Bartosz Golaszewski Reviewed-by: Andy Shevchenko Reviewed-by: Linus Walleij --- arch/sh/boards/mach-ecovec24/setup.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/arch/sh/boards/mach-ecovec24/setup.c b/arch/sh/boards/mach-ecovec24/setup.c index aaa8ea62636f..dd427bac5cde 100644 --- a/arch/sh/boards/mach-ecovec24/setup.c +++ b/arch/sh/boards/mach-ecovec24/setup.c @@ -386,9 +386,6 @@ static struct property_entry gpio_backlight_props[] = { static struct gpio_backlight_platform_data gpio_backlight_data = { .fbdev = &lcdc_device.dev, - .gpio = GPIO_PTR1, - .def_value = 1, - .name = "backlight", }; static const struct platform_device_info gpio_backlight_device_info = { From patchwork Mon Oct 7 03:31:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 11176869 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CA10F112B for ; Mon, 7 Oct 2019 07:02:36 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B28A321871 for ; Mon, 7 Oct 2019 07:02:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B28A321871 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 241B76E47A; Mon, 7 Oct 2019 07:01:55 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pl1-x641.google.com (mail-pl1-x641.google.com [IPv6:2607:f8b0:4864:20::641]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3A46A6E451 for ; Mon, 7 Oct 2019 03:32:10 +0000 (UTC) Received: by mail-pl1-x641.google.com with SMTP id t10so6189144plr.8 for ; Sun, 06 Oct 2019 20:32:10 -0700 (PDT) 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=fJb9zTJUFk5gt04WV606l1pH2Oso/m6U1KjJZ/jsQAQ=; b=M0VHCpKbArVks+wesBDmPbvoVmo5GGHdA7iYWYsQtDzq60vAn0egvakTui1EXsg8+o C6pe0wYsspoAwskvF+4wl1BTliKJRAch5QqF545nCEjozKCK3DG9adaOEjAyFIy3LmJE Q7tSWPj7RzDF3JKHWAQ4j1YDFSZGhPk9DPxGHyh1XH80hVATAAZRSJuRb17oPXO99Jsx KZ2l6NFYke/dG/R7LTkmnn6ShdpmWnBzZxu+nPQbt/Es031m298jrf3iauyzadSzAEiF /DuV7TcGjb+71XfZCCav4CquJAbKchcZi1qm9FAYP0Vh8+o1gqbDvtmSdlm7xiUGSYHj KcLA== X-Gm-Message-State: APjAAAVzsu32CqoQfHi6aAwN7kkG+Iy4bVEVQjfSjJRb5FEWlF3qa8k9 CGRtcdbkn2gw+zRb9jBZvIZ1GQ== X-Google-Smtp-Source: APXvYqyMJpRgbsk8LYwFFeym3A3ODf7oVSr8gKY6I9NTk6wL5VBDQB09tM4CGa5DcdvslC6UztiJAA== X-Received: by 2002:a17:902:36a:: with SMTP id 97mr27459476pld.61.1570419129714; Sun, 06 Oct 2019 20:32:09 -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.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 06 Oct 2019 20:32:09 -0700 (PDT) From: Bartosz Golaszewski To: Yoshinori Sato , Rich Felker , Lee Jones , Daniel Thompson , Jingoo Han , Bartlomiej Zolnierkiewicz , Linus Walleij , Andy Shevchenko , Jacopo Mondi Subject: [PATCH v5 5/7] backlight: gpio: remove unused fields from platform data Date: Mon, 7 Oct 2019 05:31:58 +0200 Message-Id: <20191007033200.13443-6-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 X-Mailman-Approved-At: Mon, 07 Oct 2019 07:01:51 +0000 X-Mailman-Original-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=fJb9zTJUFk5gt04WV606l1pH2Oso/m6U1KjJZ/jsQAQ=; b=bZlGFSZZDV/Cfp22DU/NgsaVo8wYUYI8yHknx+coDeipjtN9VtPDfxSY8zd2elzjXa Y/QzPRSOScAuDQp/IMJFwpSwC40pb1zcW8kXEe7fYxJCWYGS9yKxYaGuj93pRoiquK5Q aADQ/bgClY7XcmZdf5e8az+S9cDB4r8TO0kDoB5x1T5HoLfh2+Sp9sMZ6rZiMBMBvqf9 +nQxtRD6ehrn7bTu8VeoWMlJApH8e/ve5A7RBTl78Qz/InuJYkrl5xvMoQmYAZK+CskA 64Ogkzl4ist0WFjZ+VGhAYTYFLqSOTkH0t/NncBzxiZu/4gNEZkC7jbsaBgdp7uNk0PA 0VSw== X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Bartosz Golaszewski , linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-sh@vger.kernel.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Bartosz Golaszewski Remove the platform data fields that nobody uses. Signed-off-by: Bartosz Golaszewski Reviewed-by: Andy Shevchenko Reviewed-by: Linus Walleij Reviewed-by: Daniel Thompson --- include/linux/platform_data/gpio_backlight.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/include/linux/platform_data/gpio_backlight.h b/include/linux/platform_data/gpio_backlight.h index 34179d600360..1a8b5b1946fe 100644 --- a/include/linux/platform_data/gpio_backlight.h +++ b/include/linux/platform_data/gpio_backlight.h @@ -9,9 +9,6 @@ struct device; struct gpio_backlight_platform_data { struct device *fbdev; - int gpio; - int def_value; - const char *name; }; #endif From patchwork Mon Oct 7 03:31:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 11176871 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CF57B14DB for ; Mon, 7 Oct 2019 07:02:43 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B79A8222D2 for ; Mon, 7 Oct 2019 07:02:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B79A8222D2 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id AB9226E480; Mon, 7 Oct 2019 07:01:55 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pl1-x641.google.com (mail-pl1-x641.google.com [IPv6:2607:f8b0:4864:20::641]) by gabe.freedesktop.org (Postfix) with ESMTPS id 77FC96E452 for ; Mon, 7 Oct 2019 03:32:11 +0000 (UTC) Received: by mail-pl1-x641.google.com with SMTP id j11so6204553plk.3 for ; Sun, 06 Oct 2019 20:32:11 -0700 (PDT) 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=3BPysl6DVnolWKLxLF4VbdfeZy6f97Qv6aum3TgQhxM=; b=ooisJetSuNXBDQV9EGiYC/FhHxqBp+Lm5F27y2C+11buA/TLXjaxm1Ek90YSyefAQL 3BeOb8/dYKNXRVQPojiFEsvmSydNOryel57ZLhI4AzNv/so8Zk/nhEvkR38GyfKxu2Eo kkk4U8+o27GHfu2lZXsRyWABWoBIWhZJwNOTFPDmJW1ZKy08DvA/9bfMC2Lcz8oETTKW Xs0Bp5Pd/cHIF9pIAY/3tFG7Wn5K9l7Dn1ZYcg0DexhhrCHrZbh/34aEUPooZk3O6ONQ k4bFFPy0hhSgzbNHmK/kgx3eIP8+CyLPEI2zC/D17k/Y4oXtazWx58KkbdWYwCJuQnDH /VhQ== X-Gm-Message-State: APjAAAVr00g+TP4VMLMHF7l6v8mBq/tGGpO5cQMpoJxW40AW0jbOTqX7 BHjR53me2oUgj1OVpv7ZGAAs/g== X-Google-Smtp-Source: APXvYqwui+TZsj1hrpt1A6WhBT4dxRajPwgWEBSZbF3dNiwstGf7Bc3pdFBi1PqMbkPT7HLUpEqGQA== X-Received: by 2002:a17:902:d887:: with SMTP id b7mr26427545plz.297.1570419130968; Sun, 06 Oct 2019 20:32:10 -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.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 06 Oct 2019 20:32:10 -0700 (PDT) From: Bartosz Golaszewski To: Yoshinori Sato , Rich Felker , Lee Jones , Daniel Thompson , Jingoo Han , Bartlomiej Zolnierkiewicz , Linus Walleij , Andy Shevchenko , Jacopo Mondi Subject: [PATCH v5 6/7] backlight: gpio: use a helper variable for &pdev->dev Date: Mon, 7 Oct 2019 05:31:59 +0200 Message-Id: <20191007033200.13443-7-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 X-Mailman-Approved-At: Mon, 07 Oct 2019 07:01:51 +0000 X-Mailman-Original-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=3BPysl6DVnolWKLxLF4VbdfeZy6f97Qv6aum3TgQhxM=; b=y+TYcOkuUhELANoszr4a3gmhyWWSDY+vzJu611GB87ScAdJ/pXChF4r0b/+6blLSGl BUcsrkNzV5otX3RewLR8/ISN1NQj6hvS2qEGuRtZukxoSVQY5mMHJBf9orIetMkyogEe mziAl7VWTOgcKRKmfHh+xtHXVdOiyEJkpYvwM31fawB2JvgQdoelG3fpb4T18TIuWxo8 e0cvbKmSdZUhbAv2AbFvrMM++vdtHF9jEsAcLrXuH1hNQiYLN26eOfdAlJjlvvu/PJzc spy3UaKYw41JS/hoOWHPUFQWEeR50Y+YGG6IYla/Scg+AlsPJGD/7g5fXT5QMOwBE7tC P6iA== X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Bartosz Golaszewski , linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-sh@vger.kernel.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Bartosz Golaszewski Instead of dereferencing pdev each time, use a helper variable for the associated device pointer. Signed-off-by: Bartosz Golaszewski Reviewed-by: Linus Walleij Reviewed-by: Daniel Thompson Reviewed-by: Andy Shevchenko --- drivers/video/backlight/gpio_backlight.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/video/backlight/gpio_backlight.c b/drivers/video/backlight/gpio_backlight.c index 20c5311c7ed2..6247687b6330 100644 --- a/drivers/video/backlight/gpio_backlight.c +++ b/drivers/video/backlight/gpio_backlight.c @@ -71,25 +71,25 @@ static int gpio_backlight_initial_power_state(struct gpio_backlight *gbl) 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 gpio_backlight_platform_data *pdata = dev_get_platdata(dev); struct backlight_properties props; struct backlight_device *bl; struct gpio_backlight *gbl; int ret; - gbl = devm_kzalloc(&pdev->dev, sizeof(*gbl), GFP_KERNEL); + gbl = devm_kzalloc(dev, sizeof(*gbl), GFP_KERNEL); if (gbl == NULL) return -ENOMEM; - gbl->dev = &pdev->dev; + gbl->dev = dev; if (pdata) gbl->fbdev = pdata->fbdev; - gbl->def_value = device_property_read_bool(&pdev->dev, "default-on"); + gbl->def_value = device_property_read_bool(dev, "default-on"); - gbl->gpiod = devm_gpiod_get(&pdev->dev, NULL, GPIOD_ASIS); + gbl->gpiod = devm_gpiod_get(dev, NULL, GPIOD_ASIS); if (IS_ERR(gbl->gpiod)) { ret = PTR_ERR(gbl->gpiod); if (ret != -EPROBE_DEFER) @@ -101,11 +101,11 @@ static int gpio_backlight_probe(struct platform_device *pdev) memset(&props, 0, sizeof(props)); props.type = BACKLIGHT_RAW; props.max_brightness = 1; - bl = devm_backlight_device_register(&pdev->dev, dev_name(&pdev->dev), - &pdev->dev, gbl, &gpio_backlight_ops, + bl = devm_backlight_device_register(dev, dev_name(dev), + dev, gbl, &gpio_backlight_ops, &props); if (IS_ERR(bl)) { - dev_err(&pdev->dev, "failed to register backlight\n"); + dev_err(dev, "failed to register backlight\n"); return PTR_ERR(bl); } From patchwork Mon Oct 7 03:32:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 11176887 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id F11291862 for ; Mon, 7 Oct 2019 07:02:59 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D98292246F for ; Mon, 7 Oct 2019 07:02:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D98292246F Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 112316E4B5; Mon, 7 Oct 2019 07:01:59 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pg1-x541.google.com (mail-pg1-x541.google.com [IPv6:2607:f8b0:4864:20::541]) by gabe.freedesktop.org (Postfix) with ESMTPS id 014346E452 for ; Mon, 7 Oct 2019 03:32:12 +0000 (UTC) Received: by mail-pg1-x541.google.com with SMTP id i14so7299152pgt.11 for ; Sun, 06 Oct 2019 20:32:12 -0700 (PDT) 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=v4a+pKVTYSrGaRJIHf88S7PAjoi+WG4Wfk9hIUcxXSg=; b=ibRMAO4hB2t+R4XYFkZ1LqR7afk5pVbV+nr/g204VVpEgoUAFVeBK8S/02Djjopqe0 5t64FiOMipZDp4/GuAVEZbbmERX3rSTP6yM4F+nyakHuaeElXxGoqJHaYrBZswtUW0NM 9gxGAcQitpknhAznW3oOBX4wpwej8CjK/0UDkTLarw+Qnlnj2TbzQoTYpU5nbthALse3 f6IzFGPtZvh6qIrHt12PyIPGo6szn6MIx+hA0rcW/HLoP/cifISUYSUJMZF6++iKVpE3 ueRIaEorubaeFgWBDvLtt1EXvdBNwHD4dFmf4TvA6DukW5yx/hZC9AwD07CAZ8qMocxQ easg== X-Gm-Message-State: APjAAAVGoBmz3okPe+DqrF8uGtz9xVsH9aOWQBARmCdeE+F9UT4r/riU 7LaVrf17o4jHFHv/i42mfZiMEQ== X-Google-Smtp-Source: APXvYqxJi6Cn38KU2ldDEqD3uN4eN8sBJwkVwzMxJCScyN7v5yPIeq7dl+xAxIUxlchljuW1E7ZgqA== X-Received: by 2002:a63:705b:: with SMTP id a27mr27756444pgn.136.1570419132502; Sun, 06 Oct 2019 20:32:12 -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.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 06 Oct 2019 20:32:12 -0700 (PDT) From: Bartosz Golaszewski To: Yoshinori Sato , Rich Felker , Lee Jones , Daniel Thompson , Jingoo Han , Bartlomiej Zolnierkiewicz , Linus Walleij , Andy Shevchenko , Jacopo Mondi Subject: [PATCH v5 7/7] backlight: gpio: pull gpio_backlight_initial_power_state() into probe Date: Mon, 7 Oct 2019 05:32:00 +0200 Message-Id: <20191007033200.13443-8-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 X-Mailman-Approved-At: Mon, 07 Oct 2019 07:01:51 +0000 X-Mailman-Original-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=v4a+pKVTYSrGaRJIHf88S7PAjoi+WG4Wfk9hIUcxXSg=; b=VEhWSNZoLO5WHHbpp9caxeGXuImosevibbsBdB/CmdKiB1x1QaJiw3PM+vtD47onTj YnRJWOaxfiYOZMGKnNbIAnpk+Lkq3FitSuXfKNWTeVjsYnLhroWVQs+X9ZiUO38IcwTd rYYrkk7IaNSq5w6fCEOUfRmZ9UZ8BXM1z/VvKLUdDa5+ITtgJ6i795wC/Ax32hcUvskA 5XpcsN84YILPA2nLpfRifCQHKvAQu0rAFy8Ro1p1OrvG8Ax57GMGJEO+PYc96po6eCAp 6cQLwl1Rsh7FmaNNg7cNvfCg8BiyO0ggdLaZlKDi4Ouwzk9EVF/CUd28ES5S5X3zjTX3 ccJw== X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Bartosz Golaszewski , linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-sh@vger.kernel.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Bartosz Golaszewski The probe function in the gpio-backlight driver is quite short. If we pull gpio_backlight_initial_power_state() into probe we can drop two more fields from struct gpio_backlight and shrink the driver code. Signed-off-by: Bartosz Golaszewski Acked-by: Daniel Thompson --- drivers/video/backlight/gpio_backlight.c | 37 +++++++++--------------- 1 file changed, 13 insertions(+), 24 deletions(-) diff --git a/drivers/video/backlight/gpio_backlight.c b/drivers/video/backlight/gpio_backlight.c index 6247687b6330..407d4eaafc5c 100644 --- a/drivers/video/backlight/gpio_backlight.c +++ b/drivers/video/backlight/gpio_backlight.c @@ -17,11 +17,8 @@ #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) @@ -53,41 +50,24 @@ static const struct backlight_ops gpio_backlight_ops = { .check_fb = gpio_backlight_check_fb, }; -static int gpio_backlight_initial_power_state(struct gpio_backlight *gbl) -{ - struct device_node *node = gbl->dev->of_node; - - /* Not booted with device tree or no phandle link to the node */ - if (!node || !node->phandle) - return gbl->def_value ? FB_BLANK_UNBLANK : FB_BLANK_POWERDOWN; - - /* if the enable GPIO is disabled, do not enable the backlight */ - if (gpiod_get_value_cansleep(gbl->gpiod) == 0) - return FB_BLANK_POWERDOWN; - - return FB_BLANK_UNBLANK; -} - - static int gpio_backlight_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct gpio_backlight_platform_data *pdata = dev_get_platdata(dev); + struct device_node *of_node = dev->of_node; struct backlight_properties props; struct backlight_device *bl; struct gpio_backlight *gbl; - int ret; + int ret, def_value; gbl = devm_kzalloc(dev, sizeof(*gbl), GFP_KERNEL); if (gbl == NULL) return -ENOMEM; - gbl->dev = dev; - if (pdata) gbl->fbdev = pdata->fbdev; - gbl->def_value = device_property_read_bool(dev, "default-on"); + def_value = device_property_read_bool(dev, "default-on"); gbl->gpiod = devm_gpiod_get(dev, NULL, GPIOD_ASIS); if (IS_ERR(gbl->gpiod)) { @@ -109,7 +89,16 @@ static int gpio_backlight_probe(struct platform_device *pdev) return PTR_ERR(bl); } - bl->props.power = gpio_backlight_initial_power_state(gbl); + /* Set the initial power state */ + if (!of_node || !of_node->phandle) + /* Not booted with device tree or no phandle link to the node */ + bl->props.power = def_value ? FB_BLANK_UNBLANK + : FB_BLANK_POWERDOWN; + else if (gpiod_get_value_cansleep(gbl->gpiod) == 0) + bl->props.power = FB_BLANK_POWERDOWN; + else + bl->props.power = FB_BLANK_UNBLANK; + bl->props.brightness = 1; backlight_update_status(bl);