linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/7] backlight: gpio: simplify the driver
@ 2019-07-24  8:25 Bartosz Golaszewski
  2019-07-24  8:25 ` [PATCH v3 1/7] sh: ecovec24: add additional properties to the backlight device Bartosz Golaszewski
                   ` (10 more replies)
  0 siblings, 11 replies; 25+ messages in thread
From: Bartosz Golaszewski @ 2019-07-24  8:25 UTC (permalink / raw)
  To: Yoshinori Sato, Rich Felker, Lee Jones, Daniel Thompson,
	Jingoo Han, Bartlomiej Zolnierkiewicz, Linus Walleij,
	Andy Shevchenko
  Cc: linux-sh, linux-kernel, dri-devel, linux-fbdev, Bartosz Golaszewski

From: Bartosz Golaszewski <bgolaszewski@baylibre.com>

While working on my other series related to gpio-backlight[1] I noticed
that we could simplify the driver if we made the only user of platform
data use GPIO lookups and device properties. This series tries to do
that.

The first patch adds all necessary data structures to ecovec24. Patch
2/7 unifies much of the code for both pdata and non-pdata cases. Patches
3-4/7 remove unused platform data fields. Last three patches contain
additional improvements for the GPIO backlight driver while we're already
modifying it.

I don't have access to this HW but hopefully this works. Only compile
tested.

[1] https://lkml.org/lkml/2019/6/25/900

v1 -> v2:
- rebased on top of v5.3-rc1 and adjusted to the recent changes from Andy
- added additional two patches with minor improvements

v2 -> v3:
- in patch 7/7: used initializers to set values for pdata and dev local vars

Bartosz Golaszewski (7):
  sh: ecovec24: add additional properties to the backlight device
  backlight: gpio: simplify the platform data handling
  sh: ecovec24: don't set unused fields in platform data
  backlight: gpio: remove unused fields from platform data
  backlight: gpio: remove dev from struct gpio_backlight
  backlight: gpio: remove def_value from struct gpio_backlight
  backlight: gpio: use a helper variable for &pdev->dev

 arch/sh/boards/mach-ecovec24/setup.c         | 33 ++++++--
 drivers/video/backlight/gpio_backlight.c     | 82 +++++---------------
 include/linux/platform_data/gpio_backlight.h |  3 -
 3 files changed, 44 insertions(+), 74 deletions(-)

-- 
2.21.0


^ permalink raw reply	[flat|nested] 25+ messages in thread

* [PATCH v3 1/7] sh: ecovec24: add additional properties to the backlight device
  2019-07-24  8:25 [PATCH v3 0/7] backlight: gpio: simplify the driver Bartosz Golaszewski
@ 2019-07-24  8:25 ` Bartosz Golaszewski
  2019-07-24  8:25 ` [PATCH v3 2/7] backlight: gpio: simplify the platform data handling Bartosz Golaszewski
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 25+ messages in thread
From: Bartosz Golaszewski @ 2019-07-24  8:25 UTC (permalink / raw)
  To: Yoshinori Sato, Rich Felker, Lee Jones, Daniel Thompson,
	Jingoo Han, Bartlomiej Zolnierkiewicz, Linus Walleij,
	Andy Shevchenko
  Cc: linux-sh, linux-kernel, dri-devel, linux-fbdev, Bartosz Golaszewski

From: Bartosz Golaszewski <bgolaszewski@baylibre.com>

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 <bgolaszewski@baylibre.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 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 f402aa741bf3..6926bb3865b9 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)
@@ -1464,6 +1478,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));
 }
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH v3 2/7] backlight: gpio: simplify the platform data handling
  2019-07-24  8:25 [PATCH v3 0/7] backlight: gpio: simplify the driver Bartosz Golaszewski
  2019-07-24  8:25 ` [PATCH v3 1/7] sh: ecovec24: add additional properties to the backlight device Bartosz Golaszewski
@ 2019-07-24  8:25 ` Bartosz Golaszewski
  2019-07-24 11:12   ` Daniel Thompson
  2019-07-24 11:44   ` Andy Shevchenko
  2019-07-24  8:25 ` [PATCH v3 3/7] sh: ecovec24: don't set unused fields in platform data Bartosz Golaszewski
                   ` (8 subsequent siblings)
  10 siblings, 2 replies; 25+ messages in thread
From: Bartosz Golaszewski @ 2019-07-24  8:25 UTC (permalink / raw)
  To: Yoshinori Sato, Rich Felker, Lee Jones, Daniel Thompson,
	Jingoo Han, Bartlomiej Zolnierkiewicz, Linus Walleij,
	Andy Shevchenko
  Cc: linux-sh, linux-kernel, dri-devel, linux-fbdev, Bartosz Golaszewski

From: Bartosz Golaszewski <bgolaszewski@baylibre.com>

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 <bgolaszewski@baylibre.com>
---
 drivers/video/backlight/gpio_backlight.c | 64 +++++-------------------
 1 file changed, 13 insertions(+), 51 deletions(-)

diff --git a/drivers/video/backlight/gpio_backlight.c b/drivers/video/backlight/gpio_backlight.c
index e84f3087e29f..01262186fa1e 100644
--- a/drivers/video/backlight/gpio_backlight.c
+++ b/drivers/video/backlight/gpio_backlight.c
@@ -55,30 +55,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;
-	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 backlight_properties props;
 	struct backlight_device *bl;
 	struct gpio_backlight *gbl;
+	enum gpiod_flags flags;
 	int ret;
 
 	gbl = devm_kzalloc(&pdev->dev, sizeof(*gbl), GFP_KERNEL);
@@ -94,35 +71,20 @@ 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->def_value = device_property_read_bool(&pdev->dev, "default-on");
+	flags = gbl->def_value ? GPIOD_OUT_HIGH : GPIOD_OUT_LOW;
+
+	gbl->gpiod = devm_gpiod_get(&pdev->dev, NULL, flags);
+	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");
 		}
-		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;
+		return ret;
 	}
 
 	memset(&props, 0, sizeof(props));
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH v3 3/7] sh: ecovec24: don't set unused fields in platform data
  2019-07-24  8:25 [PATCH v3 0/7] backlight: gpio: simplify the driver Bartosz Golaszewski
  2019-07-24  8:25 ` [PATCH v3 1/7] sh: ecovec24: add additional properties to the backlight device Bartosz Golaszewski
  2019-07-24  8:25 ` [PATCH v3 2/7] backlight: gpio: simplify the platform data handling Bartosz Golaszewski
@ 2019-07-24  8:25 ` Bartosz Golaszewski
  2019-07-24  8:25 ` [PATCH v3 4/7] backlight: gpio: remove unused fields from " Bartosz Golaszewski
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 25+ messages in thread
From: Bartosz Golaszewski @ 2019-07-24  8:25 UTC (permalink / raw)
  To: Yoshinori Sato, Rich Felker, Lee Jones, Daniel Thompson,
	Jingoo Han, Bartlomiej Zolnierkiewicz, Linus Walleij,
	Andy Shevchenko
  Cc: linux-sh, linux-kernel, dri-devel, linux-fbdev, Bartosz Golaszewski

From: Bartosz Golaszewski <bgolaszewski@baylibre.com>

Platform data fields other than fbdev are no longer used by the
backlight driver. Remove them.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 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 6926bb3865b9..64a5a1662b6d 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 = {
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH v3 4/7] backlight: gpio: remove unused fields from platform data
  2019-07-24  8:25 [PATCH v3 0/7] backlight: gpio: simplify the driver Bartosz Golaszewski
                   ` (2 preceding siblings ...)
  2019-07-24  8:25 ` [PATCH v3 3/7] sh: ecovec24: don't set unused fields in platform data Bartosz Golaszewski
@ 2019-07-24  8:25 ` Bartosz Golaszewski
  2019-07-24 11:13   ` Daniel Thompson
  2019-07-24  8:25 ` [PATCH v3 5/7] backlight: gpio: remove dev from struct gpio_backlight Bartosz Golaszewski
                   ` (6 subsequent siblings)
  10 siblings, 1 reply; 25+ messages in thread
From: Bartosz Golaszewski @ 2019-07-24  8:25 UTC (permalink / raw)
  To: Yoshinori Sato, Rich Felker, Lee Jones, Daniel Thompson,
	Jingoo Han, Bartlomiej Zolnierkiewicz, Linus Walleij,
	Andy Shevchenko
  Cc: linux-sh, linux-kernel, dri-devel, linux-fbdev, Bartosz Golaszewski

From: Bartosz Golaszewski <bgolaszewski@baylibre.com>

Remove the platform data fields that nobody uses.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 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
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH v3 5/7] backlight: gpio: remove dev from struct gpio_backlight
  2019-07-24  8:25 [PATCH v3 0/7] backlight: gpio: simplify the driver Bartosz Golaszewski
                   ` (3 preceding siblings ...)
  2019-07-24  8:25 ` [PATCH v3 4/7] backlight: gpio: remove unused fields from " Bartosz Golaszewski
@ 2019-07-24  8:25 ` Bartosz Golaszewski
  2019-07-24 11:13   ` Daniel Thompson
  2019-07-24  8:25 ` [PATCH v3 6/7] backlight: gpio: remove def_value " Bartosz Golaszewski
                   ` (5 subsequent siblings)
  10 siblings, 1 reply; 25+ messages in thread
From: Bartosz Golaszewski @ 2019-07-24  8:25 UTC (permalink / raw)
  To: Yoshinori Sato, Rich Felker, Lee Jones, Daniel Thompson,
	Jingoo Han, Bartlomiej Zolnierkiewicz, Linus Walleij,
	Andy Shevchenko
  Cc: linux-sh, linux-kernel, dri-devel, linux-fbdev, Bartosz Golaszewski

From: Bartosz Golaszewski <bgolaszewski@baylibre.com>

This field is unused. Remove it.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/video/backlight/gpio_backlight.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/drivers/video/backlight/gpio_backlight.c b/drivers/video/backlight/gpio_backlight.c
index 01262186fa1e..70882556f047 100644
--- a/drivers/video/backlight/gpio_backlight.c
+++ b/drivers/video/backlight/gpio_backlight.c
@@ -19,9 +19,7 @@
 #include <linux/slab.h>
 
 struct gpio_backlight {
-	struct device *dev;
 	struct device *fbdev;
-
 	struct gpio_desc *gpiod;
 	int def_value;
 };
@@ -69,8 +67,6 @@ static int gpio_backlight_probe(struct platform_device *pdev)
 	if (gbl == NULL)
 		return -ENOMEM;
 
-	gbl->dev = &pdev->dev;
-
 	if (pdata)
 		gbl->fbdev = pdata->fbdev;
 
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH v3 6/7] backlight: gpio: remove def_value from struct gpio_backlight
  2019-07-24  8:25 [PATCH v3 0/7] backlight: gpio: simplify the driver Bartosz Golaszewski
                   ` (4 preceding siblings ...)
  2019-07-24  8:25 ` [PATCH v3 5/7] backlight: gpio: remove dev from struct gpio_backlight Bartosz Golaszewski
@ 2019-07-24  8:25 ` Bartosz Golaszewski
  2019-07-24 11:13   ` Daniel Thompson
  2019-07-24  8:25 ` [PATCH v3 7/7] backlight: gpio: use a helper variable for &pdev->dev Bartosz Golaszewski
                   ` (4 subsequent siblings)
  10 siblings, 1 reply; 25+ messages in thread
From: Bartosz Golaszewski @ 2019-07-24  8:25 UTC (permalink / raw)
  To: Yoshinori Sato, Rich Felker, Lee Jones, Daniel Thompson,
	Jingoo Han, Bartlomiej Zolnierkiewicz, Linus Walleij,
	Andy Shevchenko
  Cc: linux-sh, linux-kernel, dri-devel, linux-fbdev, Bartosz Golaszewski

From: Bartosz Golaszewski <bgolaszewski@baylibre.com>

This field is unused outside of probe(). There's no need to store it.
We can make it into a local variable.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/video/backlight/gpio_backlight.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/video/backlight/gpio_backlight.c b/drivers/video/backlight/gpio_backlight.c
index 70882556f047..cd6a75bca9cc 100644
--- a/drivers/video/backlight/gpio_backlight.c
+++ b/drivers/video/backlight/gpio_backlight.c
@@ -21,7 +21,6 @@
 struct gpio_backlight {
 	struct device *fbdev;
 	struct gpio_desc *gpiod;
-	int def_value;
 };
 
 static int gpio_backlight_update_status(struct backlight_device *bl)
@@ -61,7 +60,7 @@ static int gpio_backlight_probe(struct platform_device *pdev)
 	struct backlight_device *bl;
 	struct gpio_backlight *gbl;
 	enum gpiod_flags flags;
-	int ret;
+	int ret, def_value;
 
 	gbl = devm_kzalloc(&pdev->dev, sizeof(*gbl), GFP_KERNEL);
 	if (gbl == NULL)
@@ -70,8 +69,8 @@ static int gpio_backlight_probe(struct platform_device *pdev)
 	if (pdata)
 		gbl->fbdev = pdata->fbdev;
 
-	gbl->def_value = device_property_read_bool(&pdev->dev, "default-on");
-	flags = gbl->def_value ? GPIOD_OUT_HIGH : GPIOD_OUT_LOW;
+	def_value = device_property_read_bool(&pdev->dev, "default-on");
+	flags = def_value ? GPIOD_OUT_HIGH : GPIOD_OUT_LOW;
 
 	gbl->gpiod = devm_gpiod_get(&pdev->dev, NULL, flags);
 	if (IS_ERR(gbl->gpiod)) {
@@ -94,7 +93,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);
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH v3 7/7] backlight: gpio: use a helper variable for &pdev->dev
  2019-07-24  8:25 [PATCH v3 0/7] backlight: gpio: simplify the driver Bartosz Golaszewski
                   ` (5 preceding siblings ...)
  2019-07-24  8:25 ` [PATCH v3 6/7] backlight: gpio: remove def_value " Bartosz Golaszewski
@ 2019-07-24  8:25 ` Bartosz Golaszewski
  2019-07-24 11:13   ` Daniel Thompson
  2019-07-24 11:41   ` Andy Shevchenko
  2019-07-24  8:27 ` [PATCH v3 0/7] backlight: gpio: simplify the driver Bartosz Golaszewski
                   ` (3 subsequent siblings)
  10 siblings, 2 replies; 25+ messages in thread
From: Bartosz Golaszewski @ 2019-07-24  8:25 UTC (permalink / raw)
  To: Yoshinori Sato, Rich Felker, Lee Jones, Daniel Thompson,
	Jingoo Han, Bartlomiej Zolnierkiewicz, Linus Walleij,
	Andy Shevchenko
  Cc: linux-sh, linux-kernel, dri-devel, linux-fbdev, Bartosz Golaszewski

From: Bartosz Golaszewski <bgolaszewski@baylibre.com>

Instead of dereferencing pdev each time, use a helper variable for
the associated device pointer.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
---
 drivers/video/backlight/gpio_backlight.c | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/drivers/video/backlight/gpio_backlight.c b/drivers/video/backlight/gpio_backlight.c
index cd6a75bca9cc..7dc4f90d926b 100644
--- a/drivers/video/backlight/gpio_backlight.c
+++ b/drivers/video/backlight/gpio_backlight.c
@@ -54,29 +54,29 @@ static const struct backlight_ops gpio_backlight_ops = {
 
 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;
 	enum gpiod_flags flags;
 	int ret, def_value;
 
-	gbl = devm_kzalloc(&pdev->dev, sizeof(*gbl), GFP_KERNEL);
+	gbl = devm_kzalloc(dev, sizeof(*gbl), GFP_KERNEL);
 	if (gbl == NULL)
 		return -ENOMEM;
 
 	if (pdata)
 		gbl->fbdev = pdata->fbdev;
 
-	def_value = device_property_read_bool(&pdev->dev, "default-on");
+	def_value = device_property_read_bool(dev, "default-on");
 	flags = def_value ? GPIOD_OUT_HIGH : GPIOD_OUT_LOW;
 
-	gbl->gpiod = devm_gpiod_get(&pdev->dev, NULL, flags);
+	gbl->gpiod = devm_gpiod_get(dev, NULL, flags);
 	if (IS_ERR(gbl->gpiod)) {
 		ret = PTR_ERR(gbl->gpiod);
 		if (ret != -EPROBE_DEFER) {
-			dev_err(&pdev->dev,
+			dev_err(dev,
 				"Error: The gpios parameter is missing or invalid.\n");
 		}
 		return ret;
@@ -85,11 +85,10 @@ 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,
-					&props);
+	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);
 	}
 
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* Re: [PATCH v3 0/7] backlight: gpio: simplify the driver
  2019-07-24  8:25 [PATCH v3 0/7] backlight: gpio: simplify the driver Bartosz Golaszewski
                   ` (6 preceding siblings ...)
  2019-07-24  8:25 ` [PATCH v3 7/7] backlight: gpio: use a helper variable for &pdev->dev Bartosz Golaszewski
@ 2019-07-24  8:27 ` Bartosz Golaszewski
  2019-08-05 21:12 ` Linus Walleij
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 25+ messages in thread
From: Bartosz Golaszewski @ 2019-07-24  8:27 UTC (permalink / raw)
  To: Daniel Thompson
  Cc: linux-sh, Rich Felker, Linus Walleij, Bartlomiej Zolnierkiewicz,
	Andy Shevchenko, Yoshinori Sato, Lee Jones,
	Linux Kernel Mailing List, dri-devel, linux-fbdev,
	Bartosz Golaszewski, Jingoo Han

śr., 24 lip 2019 o 10:25 Bartosz Golaszewski <brgl@bgdev.pl> napisał(a):
>
> From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
>
> While working on my other series related to gpio-backlight[1] I noticed
> that we could simplify the driver if we made the only user of platform
> data use GPIO lookups and device properties. This series tries to do
> that.
>
> The first patch adds all necessary data structures to ecovec24. Patch
> 2/7 unifies much of the code for both pdata and non-pdata cases. Patches
> 3-4/7 remove unused platform data fields. Last three patches contain
> additional improvements for the GPIO backlight driver while we're already
> modifying it.
>
> I don't have access to this HW but hopefully this works. Only compile
> tested.
>
> [1] https://lkml.org/lkml/2019/6/25/900
>
> v1 -> v2:
> - rebased on top of v5.3-rc1 and adjusted to the recent changes from Andy
> - added additional two patches with minor improvements
>
> v2 -> v3:
> - in patch 7/7: used initializers to set values for pdata and dev local vars
>
> Bartosz Golaszewski (7):
>   sh: ecovec24: add additional properties to the backlight device
>   backlight: gpio: simplify the platform data handling
>   sh: ecovec24: don't set unused fields in platform data
>   backlight: gpio: remove unused fields from platform data
>   backlight: gpio: remove dev from struct gpio_backlight
>   backlight: gpio: remove def_value from struct gpio_backlight
>   backlight: gpio: use a helper variable for &pdev->dev
>
>  arch/sh/boards/mach-ecovec24/setup.c         | 33 ++++++--
>  drivers/video/backlight/gpio_backlight.c     | 82 +++++---------------
>  include/linux/platform_data/gpio_backlight.h |  3 -
>  3 files changed, 44 insertions(+), 74 deletions(-)
>
> --
> 2.21.0
>

Daniel,

I missed your review tags - could you add them again?

Thanks,
Bart

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH v3 2/7] backlight: gpio: simplify the platform data handling
  2019-07-24  8:25 ` [PATCH v3 2/7] backlight: gpio: simplify the platform data handling Bartosz Golaszewski
@ 2019-07-24 11:12   ` Daniel Thompson
  2019-07-24 11:44   ` Andy Shevchenko
  1 sibling, 0 replies; 25+ messages in thread
From: Daniel Thompson @ 2019-07-24 11:12 UTC (permalink / raw)
  To: Bartosz Golaszewski
  Cc: Yoshinori Sato, Rich Felker, Lee Jones, Jingoo Han,
	Bartlomiej Zolnierkiewicz, Linus Walleij, Andy Shevchenko,
	linux-sh, linux-kernel, dri-devel, linux-fbdev,
	Bartosz Golaszewski

On Wed, Jul 24, 2019 at 10:25:03AM +0200, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> 
> 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 <bgolaszewski@baylibre.com>

Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org>

> ---
>  drivers/video/backlight/gpio_backlight.c | 64 +++++-------------------
>  1 file changed, 13 insertions(+), 51 deletions(-)
> 
> diff --git a/drivers/video/backlight/gpio_backlight.c b/drivers/video/backlight/gpio_backlight.c
> index e84f3087e29f..01262186fa1e 100644
> --- a/drivers/video/backlight/gpio_backlight.c
> +++ b/drivers/video/backlight/gpio_backlight.c
> @@ -55,30 +55,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;
> -	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 backlight_properties props;
>  	struct backlight_device *bl;
>  	struct gpio_backlight *gbl;
> +	enum gpiod_flags flags;
>  	int ret;
>  
>  	gbl = devm_kzalloc(&pdev->dev, sizeof(*gbl), GFP_KERNEL);
> @@ -94,35 +71,20 @@ 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->def_value = device_property_read_bool(&pdev->dev, "default-on");
> +	flags = gbl->def_value ? GPIOD_OUT_HIGH : GPIOD_OUT_LOW;
> +
> +	gbl->gpiod = devm_gpiod_get(&pdev->dev, NULL, flags);
> +	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");
>  		}
> -		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;
> +		return ret;
>  	}
>  
>  	memset(&props, 0, sizeof(props));
> -- 
> 2.21.0
> 

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH v3 4/7] backlight: gpio: remove unused fields from platform data
  2019-07-24  8:25 ` [PATCH v3 4/7] backlight: gpio: remove unused fields from " Bartosz Golaszewski
@ 2019-07-24 11:13   ` Daniel Thompson
  0 siblings, 0 replies; 25+ messages in thread
From: Daniel Thompson @ 2019-07-24 11:13 UTC (permalink / raw)
  To: Bartosz Golaszewski
  Cc: Yoshinori Sato, Rich Felker, Lee Jones, Jingoo Han,
	Bartlomiej Zolnierkiewicz, Linus Walleij, Andy Shevchenko,
	linux-sh, linux-kernel, dri-devel, linux-fbdev,
	Bartosz Golaszewski

On Wed, Jul 24, 2019 at 10:25:05AM +0200, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> 
> Remove the platform data fields that nobody uses.
> 
> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org>


> ---
>  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
> -- 
> 2.21.0
> 

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH v3 5/7] backlight: gpio: remove dev from struct gpio_backlight
  2019-07-24  8:25 ` [PATCH v3 5/7] backlight: gpio: remove dev from struct gpio_backlight Bartosz Golaszewski
@ 2019-07-24 11:13   ` Daniel Thompson
  0 siblings, 0 replies; 25+ messages in thread
From: Daniel Thompson @ 2019-07-24 11:13 UTC (permalink / raw)
  To: Bartosz Golaszewski
  Cc: Yoshinori Sato, Rich Felker, Lee Jones, Jingoo Han,
	Bartlomiej Zolnierkiewicz, Linus Walleij, Andy Shevchenko,
	linux-sh, linux-kernel, dri-devel, linux-fbdev,
	Bartosz Golaszewski

On Wed, Jul 24, 2019 at 10:25:06AM +0200, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> 
> This field is unused. Remove it.
> 
> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org>

> ---
>  drivers/video/backlight/gpio_backlight.c | 4 ----
>  1 file changed, 4 deletions(-)
> 
> diff --git a/drivers/video/backlight/gpio_backlight.c b/drivers/video/backlight/gpio_backlight.c
> index 01262186fa1e..70882556f047 100644
> --- a/drivers/video/backlight/gpio_backlight.c
> +++ b/drivers/video/backlight/gpio_backlight.c
> @@ -19,9 +19,7 @@
>  #include <linux/slab.h>
>  
>  struct gpio_backlight {
> -	struct device *dev;
>  	struct device *fbdev;
> -
>  	struct gpio_desc *gpiod;
>  	int def_value;
>  };
> @@ -69,8 +67,6 @@ static int gpio_backlight_probe(struct platform_device *pdev)
>  	if (gbl == NULL)
>  		return -ENOMEM;
>  
> -	gbl->dev = &pdev->dev;
> -
>  	if (pdata)
>  		gbl->fbdev = pdata->fbdev;
>  
> -- 
> 2.21.0
> 

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH v3 6/7] backlight: gpio: remove def_value from struct gpio_backlight
  2019-07-24  8:25 ` [PATCH v3 6/7] backlight: gpio: remove def_value " Bartosz Golaszewski
@ 2019-07-24 11:13   ` Daniel Thompson
  0 siblings, 0 replies; 25+ messages in thread
From: Daniel Thompson @ 2019-07-24 11:13 UTC (permalink / raw)
  To: Bartosz Golaszewski
  Cc: Yoshinori Sato, Rich Felker, Lee Jones, Jingoo Han,
	Bartlomiej Zolnierkiewicz, Linus Walleij, Andy Shevchenko,
	linux-sh, linux-kernel, dri-devel, linux-fbdev,
	Bartosz Golaszewski

On Wed, Jul 24, 2019 at 10:25:07AM +0200, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> 
> This field is unused outside of probe(). There's no need to store it.
> We can make it into a local variable.
> 
> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org>
> ---
>  drivers/video/backlight/gpio_backlight.c | 9 ++++-----
>  1 file changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/video/backlight/gpio_backlight.c b/drivers/video/backlight/gpio_backlight.c
> index 70882556f047..cd6a75bca9cc 100644
> --- a/drivers/video/backlight/gpio_backlight.c
> +++ b/drivers/video/backlight/gpio_backlight.c
> @@ -21,7 +21,6 @@
>  struct gpio_backlight {
>  	struct device *fbdev;
>  	struct gpio_desc *gpiod;
> -	int def_value;
>  };
>  
>  static int gpio_backlight_update_status(struct backlight_device *bl)
> @@ -61,7 +60,7 @@ static int gpio_backlight_probe(struct platform_device *pdev)
>  	struct backlight_device *bl;
>  	struct gpio_backlight *gbl;
>  	enum gpiod_flags flags;
> -	int ret;
> +	int ret, def_value;
>  
>  	gbl = devm_kzalloc(&pdev->dev, sizeof(*gbl), GFP_KERNEL);
>  	if (gbl == NULL)
> @@ -70,8 +69,8 @@ static int gpio_backlight_probe(struct platform_device *pdev)
>  	if (pdata)
>  		gbl->fbdev = pdata->fbdev;
>  
> -	gbl->def_value = device_property_read_bool(&pdev->dev, "default-on");
> -	flags = gbl->def_value ? GPIOD_OUT_HIGH : GPIOD_OUT_LOW;
> +	def_value = device_property_read_bool(&pdev->dev, "default-on");
> +	flags = def_value ? GPIOD_OUT_HIGH : GPIOD_OUT_LOW;
>  
>  	gbl->gpiod = devm_gpiod_get(&pdev->dev, NULL, flags);
>  	if (IS_ERR(gbl->gpiod)) {
> @@ -94,7 +93,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);
> -- 
> 2.21.0
> 

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH v3 7/7] backlight: gpio: use a helper variable for &pdev->dev
  2019-07-24  8:25 ` [PATCH v3 7/7] backlight: gpio: use a helper variable for &pdev->dev Bartosz Golaszewski
@ 2019-07-24 11:13   ` Daniel Thompson
  2019-07-24 11:41   ` Andy Shevchenko
  1 sibling, 0 replies; 25+ messages in thread
From: Daniel Thompson @ 2019-07-24 11:13 UTC (permalink / raw)
  To: Bartosz Golaszewski
  Cc: Yoshinori Sato, Rich Felker, Lee Jones, Jingoo Han,
	Bartlomiej Zolnierkiewicz, Linus Walleij, Andy Shevchenko,
	linux-sh, linux-kernel, dri-devel, linux-fbdev,
	Bartosz Golaszewski

On Wed, Jul 24, 2019 at 10:25:08AM +0200, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> 
> Instead of dereferencing pdev each time, use a helper variable for
> the associated device pointer.
> 
> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>

Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org>

> ---
>  drivers/video/backlight/gpio_backlight.c | 19 +++++++++----------
>  1 file changed, 9 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/video/backlight/gpio_backlight.c b/drivers/video/backlight/gpio_backlight.c
> index cd6a75bca9cc..7dc4f90d926b 100644
> --- a/drivers/video/backlight/gpio_backlight.c
> +++ b/drivers/video/backlight/gpio_backlight.c
> @@ -54,29 +54,29 @@ static const struct backlight_ops gpio_backlight_ops = {
>  
>  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;
>  	enum gpiod_flags flags;
>  	int ret, def_value;
>  
> -	gbl = devm_kzalloc(&pdev->dev, sizeof(*gbl), GFP_KERNEL);
> +	gbl = devm_kzalloc(dev, sizeof(*gbl), GFP_KERNEL);
>  	if (gbl == NULL)
>  		return -ENOMEM;
>  
>  	if (pdata)
>  		gbl->fbdev = pdata->fbdev;
>  
> -	def_value = device_property_read_bool(&pdev->dev, "default-on");
> +	def_value = device_property_read_bool(dev, "default-on");
>  	flags = def_value ? GPIOD_OUT_HIGH : GPIOD_OUT_LOW;
>  
> -	gbl->gpiod = devm_gpiod_get(&pdev->dev, NULL, flags);
> +	gbl->gpiod = devm_gpiod_get(dev, NULL, flags);
>  	if (IS_ERR(gbl->gpiod)) {
>  		ret = PTR_ERR(gbl->gpiod);
>  		if (ret != -EPROBE_DEFER) {
> -			dev_err(&pdev->dev,
> +			dev_err(dev,
>  				"Error: The gpios parameter is missing or invalid.\n");
>  		}
>  		return ret;
> @@ -85,11 +85,10 @@ 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,
> -					&props);
> +	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);
>  	}
>  
> -- 
> 2.21.0
> 

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH v3 7/7] backlight: gpio: use a helper variable for &pdev->dev
  2019-07-24  8:25 ` [PATCH v3 7/7] backlight: gpio: use a helper variable for &pdev->dev Bartosz Golaszewski
  2019-07-24 11:13   ` Daniel Thompson
@ 2019-07-24 11:41   ` Andy Shevchenko
  1 sibling, 0 replies; 25+ messages in thread
From: Andy Shevchenko @ 2019-07-24 11:41 UTC (permalink / raw)
  To: Bartosz Golaszewski
  Cc: Yoshinori Sato, Rich Felker, Lee Jones, Daniel Thompson,
	Jingoo Han, Bartlomiej Zolnierkiewicz, Linus Walleij, linux-sh,
	linux-kernel, dri-devel, linux-fbdev, Bartosz Golaszewski

On Wed, Jul 24, 2019 at 10:25:08AM +0200, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> 
> Instead of dereferencing pdev each time, use a helper variable for
> the associated device pointer.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

> 
> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> ---
>  drivers/video/backlight/gpio_backlight.c | 19 +++++++++----------
>  1 file changed, 9 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/video/backlight/gpio_backlight.c b/drivers/video/backlight/gpio_backlight.c
> index cd6a75bca9cc..7dc4f90d926b 100644
> --- a/drivers/video/backlight/gpio_backlight.c
> +++ b/drivers/video/backlight/gpio_backlight.c
> @@ -54,29 +54,29 @@ static const struct backlight_ops gpio_backlight_ops = {
>  
>  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;
>  	enum gpiod_flags flags;
>  	int ret, def_value;
>  
> -	gbl = devm_kzalloc(&pdev->dev, sizeof(*gbl), GFP_KERNEL);
> +	gbl = devm_kzalloc(dev, sizeof(*gbl), GFP_KERNEL);
>  	if (gbl == NULL)
>  		return -ENOMEM;
>  
>  	if (pdata)
>  		gbl->fbdev = pdata->fbdev;
>  
> -	def_value = device_property_read_bool(&pdev->dev, "default-on");
> +	def_value = device_property_read_bool(dev, "default-on");
>  	flags = def_value ? GPIOD_OUT_HIGH : GPIOD_OUT_LOW;
>  
> -	gbl->gpiod = devm_gpiod_get(&pdev->dev, NULL, flags);
> +	gbl->gpiod = devm_gpiod_get(dev, NULL, flags);
>  	if (IS_ERR(gbl->gpiod)) {
>  		ret = PTR_ERR(gbl->gpiod);
>  		if (ret != -EPROBE_DEFER) {
> -			dev_err(&pdev->dev,
> +			dev_err(dev,
>  				"Error: The gpios parameter is missing or invalid.\n");
>  		}
>  		return ret;
> @@ -85,11 +85,10 @@ 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,
> -					&props);
> +	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);
>  	}
>  
> -- 
> 2.21.0
> 

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH v3 2/7] backlight: gpio: simplify the platform data handling
  2019-07-24  8:25 ` [PATCH v3 2/7] backlight: gpio: simplify the platform data handling Bartosz Golaszewski
  2019-07-24 11:12   ` Daniel Thompson
@ 2019-07-24 11:44   ` Andy Shevchenko
  1 sibling, 0 replies; 25+ messages in thread
From: Andy Shevchenko @ 2019-07-24 11:44 UTC (permalink / raw)
  To: Bartosz Golaszewski
  Cc: Yoshinori Sato, Rich Felker, Lee Jones, Daniel Thompson,
	Jingoo Han, Bartlomiej Zolnierkiewicz, Linus Walleij, linux-sh,
	linux-kernel, dri-devel, linux-fbdev, Bartosz Golaszewski

On Wed, Jul 24, 2019 at 10:25:03AM +0200, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> 
> 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.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

> 
> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> ---
>  drivers/video/backlight/gpio_backlight.c | 64 +++++-------------------
>  1 file changed, 13 insertions(+), 51 deletions(-)
> 
> diff --git a/drivers/video/backlight/gpio_backlight.c b/drivers/video/backlight/gpio_backlight.c
> index e84f3087e29f..01262186fa1e 100644
> --- a/drivers/video/backlight/gpio_backlight.c
> +++ b/drivers/video/backlight/gpio_backlight.c
> @@ -55,30 +55,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;
> -	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 backlight_properties props;
>  	struct backlight_device *bl;
>  	struct gpio_backlight *gbl;
> +	enum gpiod_flags flags;
>  	int ret;
>  
>  	gbl = devm_kzalloc(&pdev->dev, sizeof(*gbl), GFP_KERNEL);
> @@ -94,35 +71,20 @@ 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->def_value = device_property_read_bool(&pdev->dev, "default-on");
> +	flags = gbl->def_value ? GPIOD_OUT_HIGH : GPIOD_OUT_LOW;
> +
> +	gbl->gpiod = devm_gpiod_get(&pdev->dev, NULL, flags);
> +	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");
>  		}
> -		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;
> +		return ret;
>  	}
>  
>  	memset(&props, 0, sizeof(props));
> -- 
> 2.21.0
> 

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH v3 0/7] backlight: gpio: simplify the driver
  2019-07-24  8:25 [PATCH v3 0/7] backlight: gpio: simplify the driver Bartosz Golaszewski
                   ` (7 preceding siblings ...)
  2019-07-24  8:27 ` [PATCH v3 0/7] backlight: gpio: simplify the driver Bartosz Golaszewski
@ 2019-08-05 21:12 ` Linus Walleij
  2019-08-08  8:17 ` Bartosz Golaszewski
  2019-09-02  9:31 ` Lee Jones
  10 siblings, 0 replies; 25+ messages in thread
From: Linus Walleij @ 2019-08-05 21:12 UTC (permalink / raw)
  To: Bartosz Golaszewski
  Cc: Yoshinori Sato, Rich Felker, Lee Jones, Daniel Thompson,
	Jingoo Han, Bartlomiej Zolnierkiewicz, Andy Shevchenko, linux-sh,
	linux-kernel, open list:DRM PANEL DRIVERS, linux-fbdev,
	Bartosz Golaszewski

On Wed, Jul 24, 2019 at 10:25 AM Bartosz Golaszewski <brgl@bgdev.pl> wrote:

> From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
>
> While working on my other series related to gpio-backlight[1] I noticed
> that we could simplify the driver if we made the only user of platform
> data use GPIO lookups and device properties. This series tries to do
> that.
>
> The first patch adds all necessary data structures to ecovec24. Patch
> 2/7 unifies much of the code for both pdata and non-pdata cases. Patches
> 3-4/7 remove unused platform data fields. Last three patches contain
> additional improvements for the GPIO backlight driver while we're already
> modifying it.
>
> I don't have access to this HW but hopefully this works. Only compile
> tested.
>
> [1] https://lkml.org/lkml/2019/6/25/900
>
> v1 -> v2:
> - rebased on top of v5.3-rc1 and adjusted to the recent changes from Andy
> - added additional two patches with minor improvements
>
> v2 -> v3:
> - in patch 7/7: used initializers to set values for pdata and dev local vars

The series:
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH v3 0/7] backlight: gpio: simplify the driver
  2019-07-24  8:25 [PATCH v3 0/7] backlight: gpio: simplify the driver Bartosz Golaszewski
                   ` (8 preceding siblings ...)
  2019-08-05 21:12 ` Linus Walleij
@ 2019-08-08  8:17 ` Bartosz Golaszewski
  2019-08-16 15:48   ` Bartosz Golaszewski
  2019-09-02  9:31 ` Lee Jones
  10 siblings, 1 reply; 25+ messages in thread
From: Bartosz Golaszewski @ 2019-08-08  8:17 UTC (permalink / raw)
  To: Yoshinori Sato, Rich Felker
  Cc: linux-sh, Linux Kernel Mailing List, dri-devel, linux-fbdev,
	Bartosz Golaszewski, Lee Jones, Bartlomiej Zolnierkiewicz,
	Jingoo Han, Andy Shevchenko, Daniel Thompson, Linus Walleij

śr., 24 lip 2019 o 10:25 Bartosz Golaszewski <brgl@bgdev.pl> napisał(a):
>
> From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
>
> While working on my other series related to gpio-backlight[1] I noticed
> that we could simplify the driver if we made the only user of platform
> data use GPIO lookups and device properties. This series tries to do
> that.
>
> The first patch adds all necessary data structures to ecovec24. Patch
> 2/7 unifies much of the code for both pdata and non-pdata cases. Patches
> 3-4/7 remove unused platform data fields. Last three patches contain
> additional improvements for the GPIO backlight driver while we're already
> modifying it.
>
> I don't have access to this HW but hopefully this works. Only compile
> tested.
>
> [1] https://lkml.org/lkml/2019/6/25/900
>
> v1 -> v2:
> - rebased on top of v5.3-rc1 and adjusted to the recent changes from Andy
> - added additional two patches with minor improvements
>
> v2 -> v3:
> - in patch 7/7: used initializers to set values for pdata and dev local vars
>
> Bartosz Golaszewski (7):
>   sh: ecovec24: add additional properties to the backlight device
>   backlight: gpio: simplify the platform data handling
>   sh: ecovec24: don't set unused fields in platform data
>   backlight: gpio: remove unused fields from platform data
>   backlight: gpio: remove dev from struct gpio_backlight
>   backlight: gpio: remove def_value from struct gpio_backlight
>   backlight: gpio: use a helper variable for &pdev->dev
>
>  arch/sh/boards/mach-ecovec24/setup.c         | 33 ++++++--
>  drivers/video/backlight/gpio_backlight.c     | 82 +++++---------------
>  include/linux/platform_data/gpio_backlight.h |  3 -
>  3 files changed, 44 insertions(+), 74 deletions(-)
>
> --
> 2.21.0
>

Hi Rich, Yoshinori,

can you ack the sh patches in this series?

Bart

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH v3 0/7] backlight: gpio: simplify the driver
  2019-08-08  8:17 ` Bartosz Golaszewski
@ 2019-08-16 15:48   ` Bartosz Golaszewski
  2019-08-28  7:32     ` Bartosz Golaszewski
  0 siblings, 1 reply; 25+ messages in thread
From: Bartosz Golaszewski @ 2019-08-16 15:48 UTC (permalink / raw)
  To: Yoshinori Sato, Rich Felker
  Cc: linux-sh, Linux Kernel Mailing List, dri-devel, linux-fbdev,
	Bartosz Golaszewski, Lee Jones, Bartlomiej Zolnierkiewicz,
	Jingoo Han, Andy Shevchenko, Daniel Thompson, Linus Walleij

czw., 8 sie 2019 o 10:17 Bartosz Golaszewski <brgl@bgdev.pl> napisał(a):
>
> śr., 24 lip 2019 o 10:25 Bartosz Golaszewski <brgl@bgdev.pl> napisał(a):
> >
> > From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> >
> > While working on my other series related to gpio-backlight[1] I noticed
> > that we could simplify the driver if we made the only user of platform
> > data use GPIO lookups and device properties. This series tries to do
> > that.
> >
> > The first patch adds all necessary data structures to ecovec24. Patch
> > 2/7 unifies much of the code for both pdata and non-pdata cases. Patches
> > 3-4/7 remove unused platform data fields. Last three patches contain
> > additional improvements for the GPIO backlight driver while we're already
> > modifying it.
> >
> > I don't have access to this HW but hopefully this works. Only compile
> > tested.
> >
> > [1] https://lkml.org/lkml/2019/6/25/900
> >
> > v1 -> v2:
> > - rebased on top of v5.3-rc1 and adjusted to the recent changes from Andy
> > - added additional two patches with minor improvements
> >
> > v2 -> v3:
> > - in patch 7/7: used initializers to set values for pdata and dev local vars
> >
> > Bartosz Golaszewski (7):
> >   sh: ecovec24: add additional properties to the backlight device
> >   backlight: gpio: simplify the platform data handling
> >   sh: ecovec24: don't set unused fields in platform data
> >   backlight: gpio: remove unused fields from platform data
> >   backlight: gpio: remove dev from struct gpio_backlight
> >   backlight: gpio: remove def_value from struct gpio_backlight
> >   backlight: gpio: use a helper variable for &pdev->dev
> >
> >  arch/sh/boards/mach-ecovec24/setup.c         | 33 ++++++--
> >  drivers/video/backlight/gpio_backlight.c     | 82 +++++---------------
> >  include/linux/platform_data/gpio_backlight.h |  3 -
> >  3 files changed, 44 insertions(+), 74 deletions(-)
> >
> > --
> > 2.21.0
> >
>
> Hi Rich, Yoshinori,
>
> can you ack the sh patches in this series?
>
> Bart

Ping.

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH v3 0/7] backlight: gpio: simplify the driver
  2019-08-16 15:48   ` Bartosz Golaszewski
@ 2019-08-28  7:32     ` Bartosz Golaszewski
  2019-08-28  8:36       ` Geert Uytterhoeven
  0 siblings, 1 reply; 25+ messages in thread
From: Bartosz Golaszewski @ 2019-08-28  7:32 UTC (permalink / raw)
  To: Yoshinori Sato, Rich Felker
  Cc: linux-sh, Linux Kernel Mailing List, dri-devel, linux-fbdev,
	Bartosz Golaszewski, Lee Jones, Bartlomiej Zolnierkiewicz,
	Jingoo Han, Andy Shevchenko, Daniel Thompson, Linus Walleij

pt., 16 sie 2019 o 17:48 Bartosz Golaszewski <brgl@bgdev.pl> napisał(a):
>
> czw., 8 sie 2019 o 10:17 Bartosz Golaszewski <brgl@bgdev.pl> napisał(a):
> >
> > śr., 24 lip 2019 o 10:25 Bartosz Golaszewski <brgl@bgdev.pl> napisał(a):
> > >
> > > From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> > >
> > > While working on my other series related to gpio-backlight[1] I noticed
> > > that we could simplify the driver if we made the only user of platform
> > > data use GPIO lookups and device properties. This series tries to do
> > > that.
> > >
> > > The first patch adds all necessary data structures to ecovec24. Patch
> > > 2/7 unifies much of the code for both pdata and non-pdata cases. Patches
> > > 3-4/7 remove unused platform data fields. Last three patches contain
> > > additional improvements for the GPIO backlight driver while we're already
> > > modifying it.
> > >
> > > I don't have access to this HW but hopefully this works. Only compile
> > > tested.
> > >
> > > [1] https://lkml.org/lkml/2019/6/25/900
> > >
> > > v1 -> v2:
> > > - rebased on top of v5.3-rc1 and adjusted to the recent changes from Andy
> > > - added additional two patches with minor improvements
> > >
> > > v2 -> v3:
> > > - in patch 7/7: used initializers to set values for pdata and dev local vars
> > >
> > > Bartosz Golaszewski (7):
> > >   sh: ecovec24: add additional properties to the backlight device
> > >   backlight: gpio: simplify the platform data handling
> > >   sh: ecovec24: don't set unused fields in platform data
> > >   backlight: gpio: remove unused fields from platform data
> > >   backlight: gpio: remove dev from struct gpio_backlight
> > >   backlight: gpio: remove def_value from struct gpio_backlight
> > >   backlight: gpio: use a helper variable for &pdev->dev
> > >
> > >  arch/sh/boards/mach-ecovec24/setup.c         | 33 ++++++--
> > >  drivers/video/backlight/gpio_backlight.c     | 82 +++++---------------
> > >  include/linux/platform_data/gpio_backlight.h |  3 -
> > >  3 files changed, 44 insertions(+), 74 deletions(-)
> > >
> > > --
> > > 2.21.0
> > >
> >
> > Hi Rich, Yoshinori,
> >
> > can you ack the sh patches in this series?
> >
> > Bart
>
> Ping.

Hi,

any chance of getting this reviewed for sh?

Bart

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH v3 0/7] backlight: gpio: simplify the driver
  2019-08-28  7:32     ` Bartosz Golaszewski
@ 2019-08-28  8:36       ` Geert Uytterhoeven
  2019-08-28 16:31         ` Linus Walleij
  0 siblings, 1 reply; 25+ messages in thread
From: Geert Uytterhoeven @ 2019-08-28  8:36 UTC (permalink / raw)
  To: Bartosz Golaszewski
  Cc: Yoshinori Sato, Rich Felker, Linux-sh list,
	Linux Kernel Mailing List, DRI Development,
	Linux Fbdev development list, Bartosz Golaszewski, Lee Jones,
	Bartlomiej Zolnierkiewicz, Jingoo Han, Andy Shevchenko,
	Daniel Thompson, Linus Walleij, Jacopo Mondi

CC the pour soul with the ecovec board.

On Wed, Aug 28, 2019 at 9:33 AM Bartosz Golaszewski <brgl@bgdev.pl> wrote:
> pt., 16 sie 2019 o 17:48 Bartosz Golaszewski <brgl@bgdev.pl> napisał(a):
> > czw., 8 sie 2019 o 10:17 Bartosz Golaszewski <brgl@bgdev.pl> napisał(a):
> > > śr., 24 lip 2019 o 10:25 Bartosz Golaszewski <brgl@bgdev.pl> napisał(a):
> > > > From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> > > >
> > > > While working on my other series related to gpio-backlight[1] I noticed
> > > > that we could simplify the driver if we made the only user of platform
> > > > data use GPIO lookups and device properties. This series tries to do
> > > > that.
> > > >
> > > > The first patch adds all necessary data structures to ecovec24. Patch
> > > > 2/7 unifies much of the code for both pdata and non-pdata cases. Patches
> > > > 3-4/7 remove unused platform data fields. Last three patches contain
> > > > additional improvements for the GPIO backlight driver while we're already
> > > > modifying it.
> > > >
> > > > I don't have access to this HW but hopefully this works. Only compile
> > > > tested.
> > > >
> > > > [1] https://lkml.org/lkml/2019/6/25/900
> > > >
> > > > v1 -> v2:
> > > > - rebased on top of v5.3-rc1 and adjusted to the recent changes from Andy
> > > > - added additional two patches with minor improvements
> > > >
> > > > v2 -> v3:
> > > > - in patch 7/7: used initializers to set values for pdata and dev local vars
> > > >
> > > > Bartosz Golaszewski (7):
> > > >   sh: ecovec24: add additional properties to the backlight device
> > > >   backlight: gpio: simplify the platform data handling
> > > >   sh: ecovec24: don't set unused fields in platform data
> > > >   backlight: gpio: remove unused fields from platform data
> > > >   backlight: gpio: remove dev from struct gpio_backlight
> > > >   backlight: gpio: remove def_value from struct gpio_backlight
> > > >   backlight: gpio: use a helper variable for &pdev->dev
> > > >
> > > >  arch/sh/boards/mach-ecovec24/setup.c         | 33 ++++++--
> > > >  drivers/video/backlight/gpio_backlight.c     | 82 +++++---------------
> > > >  include/linux/platform_data/gpio_backlight.h |  3 -
> > > >  3 files changed, 44 insertions(+), 74 deletions(-)
> > > >
> > > > --
> > > > 2.21.0
> > > >
> > >
> > > Hi Rich, Yoshinori,
> > >
> > > can you ack the sh patches in this series?
> > >
> > > Bart
> >
> > Ping.
>
> Hi,
>
> any chance of getting this reviewed for sh?

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH v3 0/7] backlight: gpio: simplify the driver
  2019-08-28  8:36       ` Geert Uytterhoeven
@ 2019-08-28 16:31         ` Linus Walleij
  2019-08-28 16:40           ` Jacopo Mondi
  0 siblings, 1 reply; 25+ messages in thread
From: Linus Walleij @ 2019-08-28 16:31 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Bartosz Golaszewski, Yoshinori Sato, Rich Felker, Linux-sh list,
	Linux Kernel Mailing List, DRI Development,
	Linux Fbdev development list, Bartosz Golaszewski, Lee Jones,
	Bartlomiej Zolnierkiewicz, Jingoo Han, Andy Shevchenko,
	Daniel Thompson, Jacopo Mondi

On Wed, Aug 28, 2019 at 10:36 AM Geert Uytterhoeven
<geert@linux-m68k.org> wrote:

> CC the pour soul with the ecovec board.

With great power comes great responsibility ;)

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH v3 0/7] backlight: gpio: simplify the driver
  2019-08-28 16:31         ` Linus Walleij
@ 2019-08-28 16:40           ` Jacopo Mondi
  0 siblings, 0 replies; 25+ messages in thread
From: Jacopo Mondi @ 2019-08-28 16:40 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Geert Uytterhoeven, Bartosz Golaszewski, Yoshinori Sato,
	Rich Felker, Linux-sh list, Linux Kernel Mailing List,
	DRI Development, Linux Fbdev development list,
	Bartosz Golaszewski, Lee Jones, Bartlomiej Zolnierkiewicz,
	Jingoo Han, Andy Shevchenko, Daniel Thompson

[-- Attachment #1: Type: text/plain, Size: 639 bytes --]

Hi Geert,

On Wed, Aug 28, 2019 at 06:31:19PM +0200, Linus Walleij wrote:
> On Wed, Aug 28, 2019 at 10:36 AM Geert Uytterhoeven
> <geert@linux-m68k.org> wrote:
>
> > CC the pour soul with the ecovec board.
>
I'm sorry, Eco what ? :)

> With great power comes great responsibility ;)
>

Yeah, that's -exactly- a 'great powers' board :)

I'll try to resurect it from the deads again and get back eventually
with a tested-by.

I only briefly looked at the series and I don't have any LCD to test
the backlight with, I hope I can sample the backlight GPIO value from
some test point, if I ever find the schematics...

> Yours,
> Linus Walleij

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH v3 0/7] backlight: gpio: simplify the driver
  2019-07-24  8:25 [PATCH v3 0/7] backlight: gpio: simplify the driver Bartosz Golaszewski
                   ` (9 preceding siblings ...)
  2019-08-08  8:17 ` Bartosz Golaszewski
@ 2019-09-02  9:31 ` Lee Jones
  2019-09-02 12:35   ` Bartosz Golaszewski
  10 siblings, 1 reply; 25+ messages in thread
From: Lee Jones @ 2019-09-02  9:31 UTC (permalink / raw)
  To: Bartosz Golaszewski
  Cc: Yoshinori Sato, Rich Felker, Daniel Thompson, Jingoo Han,
	Bartlomiej Zolnierkiewicz, Linus Walleij, Andy Shevchenko,
	linux-sh, linux-kernel, dri-devel, linux-fbdev,
	Bartosz Golaszewski

On Wed, 24 Jul 2019, Bartosz Golaszewski wrote:

> From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> 
> While working on my other series related to gpio-backlight[1] I noticed
> that we could simplify the driver if we made the only user of platform
> data use GPIO lookups and device properties. This series tries to do
> that.
> 
> The first patch adds all necessary data structures to ecovec24. Patch
> 2/7 unifies much of the code for both pdata and non-pdata cases. Patches
> 3-4/7 remove unused platform data fields. Last three patches contain
> additional improvements for the GPIO backlight driver while we're already
> modifying it.
> 
> I don't have access to this HW but hopefully this works. Only compile
> tested.
> 
> [1] https://lkml.org/lkml/2019/6/25/900
> 
> v1 -> v2:
> - rebased on top of v5.3-rc1 and adjusted to the recent changes from Andy
> - added additional two patches with minor improvements
> 
> v2 -> v3:
> - in patch 7/7: used initializers to set values for pdata and dev local vars
> 
> Bartosz Golaszewski (7):
>   sh: ecovec24: add additional properties to the backlight device
>   backlight: gpio: simplify the platform data handling
>   sh: ecovec24: don't set unused fields in platform data
>   backlight: gpio: remove unused fields from platform data
>   backlight: gpio: remove dev from struct gpio_backlight
>   backlight: gpio: remove def_value from struct gpio_backlight
>   backlight: gpio: use a helper variable for &pdev->dev
> 
>  arch/sh/boards/mach-ecovec24/setup.c         | 33 ++++++--
>  drivers/video/backlight/gpio_backlight.c     | 82 +++++---------------
>  include/linux/platform_data/gpio_backlight.h |  3 -
>  3 files changed, 44 insertions(+), 74 deletions(-)

Can you collect all your Acks and re-submit please?

-- 
Lee Jones [李琼斯]
Linaro Services Technical Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH v3 0/7] backlight: gpio: simplify the driver
  2019-09-02  9:31 ` Lee Jones
@ 2019-09-02 12:35   ` Bartosz Golaszewski
  0 siblings, 0 replies; 25+ messages in thread
From: Bartosz Golaszewski @ 2019-09-02 12:35 UTC (permalink / raw)
  To: Lee Jones
  Cc: Yoshinori Sato, Rich Felker, Daniel Thompson, Jingoo Han,
	Bartlomiej Zolnierkiewicz, Linus Walleij, Andy Shevchenko,
	linux-sh, Linux Kernel Mailing List, dri-devel, linux-fbdev,
	Bartosz Golaszewski

pon., 2 wrz 2019 o 11:31 Lee Jones <lee.jones@linaro.org> napisał(a):
>
> On Wed, 24 Jul 2019, Bartosz Golaszewski wrote:
>
> > From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> >
> > While working on my other series related to gpio-backlight[1] I noticed
> > that we could simplify the driver if we made the only user of platform
> > data use GPIO lookups and device properties. This series tries to do
> > that.
> >
> > The first patch adds all necessary data structures to ecovec24. Patch
> > 2/7 unifies much of the code for both pdata and non-pdata cases. Patches
> > 3-4/7 remove unused platform data fields. Last three patches contain
> > additional improvements for the GPIO backlight driver while we're already
> > modifying it.
> >
> > I don't have access to this HW but hopefully this works. Only compile
> > tested.
> >
> > [1] https://lkml.org/lkml/2019/6/25/900
> >
> > v1 -> v2:
> > - rebased on top of v5.3-rc1 and adjusted to the recent changes from Andy
> > - added additional two patches with minor improvements
> >
> > v2 -> v3:
> > - in patch 7/7: used initializers to set values for pdata and dev local vars
> >
> > Bartosz Golaszewski (7):
> >   sh: ecovec24: add additional properties to the backlight device
> >   backlight: gpio: simplify the platform data handling
> >   sh: ecovec24: don't set unused fields in platform data
> >   backlight: gpio: remove unused fields from platform data
> >   backlight: gpio: remove dev from struct gpio_backlight
> >   backlight: gpio: remove def_value from struct gpio_backlight
> >   backlight: gpio: use a helper variable for &pdev->dev
> >
> >  arch/sh/boards/mach-ecovec24/setup.c         | 33 ++++++--
> >  drivers/video/backlight/gpio_backlight.c     | 82 +++++---------------
> >  include/linux/platform_data/gpio_backlight.h |  3 -
> >  3 files changed, 44 insertions(+), 74 deletions(-)
>
> Can you collect all your Acks and re-submit please?
>

Done.

Bart

> --
> Lee Jones [李琼斯]
> Linaro Services Technical Lead
> Linaro.org │ Open source software for ARM SoCs
> Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2019-09-02 12:35 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-24  8:25 [PATCH v3 0/7] backlight: gpio: simplify the driver Bartosz Golaszewski
2019-07-24  8:25 ` [PATCH v3 1/7] sh: ecovec24: add additional properties to the backlight device Bartosz Golaszewski
2019-07-24  8:25 ` [PATCH v3 2/7] backlight: gpio: simplify the platform data handling Bartosz Golaszewski
2019-07-24 11:12   ` Daniel Thompson
2019-07-24 11:44   ` Andy Shevchenko
2019-07-24  8:25 ` [PATCH v3 3/7] sh: ecovec24: don't set unused fields in platform data Bartosz Golaszewski
2019-07-24  8:25 ` [PATCH v3 4/7] backlight: gpio: remove unused fields from " Bartosz Golaszewski
2019-07-24 11:13   ` Daniel Thompson
2019-07-24  8:25 ` [PATCH v3 5/7] backlight: gpio: remove dev from struct gpio_backlight Bartosz Golaszewski
2019-07-24 11:13   ` Daniel Thompson
2019-07-24  8:25 ` [PATCH v3 6/7] backlight: gpio: remove def_value " Bartosz Golaszewski
2019-07-24 11:13   ` Daniel Thompson
2019-07-24  8:25 ` [PATCH v3 7/7] backlight: gpio: use a helper variable for &pdev->dev Bartosz Golaszewski
2019-07-24 11:13   ` Daniel Thompson
2019-07-24 11:41   ` Andy Shevchenko
2019-07-24  8:27 ` [PATCH v3 0/7] backlight: gpio: simplify the driver Bartosz Golaszewski
2019-08-05 21:12 ` Linus Walleij
2019-08-08  8:17 ` Bartosz Golaszewski
2019-08-16 15:48   ` Bartosz Golaszewski
2019-08-28  7:32     ` Bartosz Golaszewski
2019-08-28  8:36       ` Geert Uytterhoeven
2019-08-28 16:31         ` Linus Walleij
2019-08-28 16:40           ` Jacopo Mondi
2019-09-02  9:31 ` Lee Jones
2019-09-02 12:35   ` Bartosz Golaszewski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).