public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/5] staging: fbtft: some checpatch.pl cleanups
@ 2015-08-16 20:36 Mike Rapoport
  2015-08-16 20:36 ` [PATCH 1/5] staging: fbtft: remove unused bl_ops from fbtft_unregister_backlight Mike Rapoport
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Mike Rapoport @ 2015-08-16 20:36 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Mike Rapoport, Thomas Petazzoni, Noralf Trønnes, LKML

Hi,

These patches slightly refactor the code to reduce amount of checkpath.pl warnings

Mike Rapoport (5):
  staging: fbtft: remove unused bl_ops from fbtft_unregister_backlight
  staging: fbtft: fbtft-core: define backlight_ops statically
  staging: fbtft: fbtft_request_gpios: reduce nesting
  staging: fbtft: fb_ssd1351: define backlight_ops statically
  staging: fbtft: fb_watterott: define backlight_ops statically

 drivers/staging/fbtft/fb_ssd1351.c   | 13 +++----
 drivers/staging/fbtft/fb_watterott.c | 17 +++------
 drivers/staging/fbtft/fbtft-core.c   | 69 +++++++++++++++++-------------------
 3 files changed, 42 insertions(+), 57 deletions(-)

-- 
1.8.3.1


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

* [PATCH 1/5] staging: fbtft: remove unused bl_ops from fbtft_unregister_backlight
  2015-08-16 20:36 [PATCH 0/5] staging: fbtft: some checpatch.pl cleanups Mike Rapoport
@ 2015-08-16 20:36 ` Mike Rapoport
  2015-09-03  1:08   ` Greg Kroah-Hartman
  2015-08-16 20:36 ` [PATCH 2/5] staging: fbtft: fbtft-core: define backlight_ops statically Mike Rapoport
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 7+ messages in thread
From: Mike Rapoport @ 2015-08-16 20:36 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Mike Rapoport, Thomas Petazzoni, Noralf Trønnes, LKML

Signed-off-by: Mike Rapoport <mike.rapoport@gmail.com>
---
 drivers/staging/fbtft/fbtft-core.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/staging/fbtft/fbtft-core.c b/drivers/staging/fbtft/fbtft-core.c
index 23392eb..bbc394a 100644
--- a/drivers/staging/fbtft/fbtft-core.c
+++ b/drivers/staging/fbtft/fbtft-core.c
@@ -270,14 +270,11 @@ static int fbtft_backlight_get_brightness(struct backlight_device *bd)
 
 void fbtft_unregister_backlight(struct fbtft_par *par)
 {
-	const struct backlight_ops *bl_ops;
-
 	fbtft_par_dbg(DEBUG_BACKLIGHT, par, "%s()\n", __func__);
 
 	if (par->info->bl_dev) {
 		par->info->bl_dev->props.power = FB_BLANK_POWERDOWN;
 		backlight_update_status(par->info->bl_dev);
-		bl_ops = par->info->bl_dev->ops;
 		backlight_device_unregister(par->info->bl_dev);
 		par->info->bl_dev = NULL;
 	}
-- 
1.8.3.1


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

* [PATCH 2/5] staging: fbtft: fbtft-core: define backlight_ops statically
  2015-08-16 20:36 [PATCH 0/5] staging: fbtft: some checpatch.pl cleanups Mike Rapoport
  2015-08-16 20:36 ` [PATCH 1/5] staging: fbtft: remove unused bl_ops from fbtft_unregister_backlight Mike Rapoport
@ 2015-08-16 20:36 ` Mike Rapoport
  2015-08-16 20:36 ` [PATCH 3/5] staging: fbtft: fbtft_request_gpios: reduce nesting Mike Rapoport
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Mike Rapoport @ 2015-08-16 20:36 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Mike Rapoport, Thomas Petazzoni, Noralf Trønnes, LKML

instead of devm_kzalloc'ing them

Signed-off-by: Mike Rapoport <mike.rapoport@gmail.com>
---
 drivers/staging/fbtft/fbtft-core.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/fbtft/fbtft-core.c b/drivers/staging/fbtft/fbtft-core.c
index bbc394a..81ba416 100644
--- a/drivers/staging/fbtft/fbtft-core.c
+++ b/drivers/staging/fbtft/fbtft-core.c
@@ -280,11 +280,15 @@ void fbtft_unregister_backlight(struct fbtft_par *par)
 	}
 }
 
+static const struct backlight_ops fbtft_bl_ops = {
+	.get_brightness	= fbtft_backlight_get_brightness,
+	.update_status	= fbtft_backlight_update_status,
+};
+
 void fbtft_register_backlight(struct fbtft_par *par)
 {
 	struct backlight_device *bd;
 	struct backlight_properties bl_props = { 0, };
-	struct backlight_ops *bl_ops;
 
 	fbtft_par_dbg(DEBUG_BACKLIGHT, par, "%s()\n", __func__);
 
@@ -294,13 +298,6 @@ void fbtft_register_backlight(struct fbtft_par *par)
 		return;
 	}
 
-	bl_ops = devm_kzalloc(par->info->device, sizeof(struct backlight_ops),
-				GFP_KERNEL);
-	if (!bl_ops)
-		return;
-
-	bl_ops->get_brightness = fbtft_backlight_get_brightness;
-	bl_ops->update_status = fbtft_backlight_update_status;
 	bl_props.type = BACKLIGHT_RAW;
 	/* Assume backlight is off, get polarity from current state of pin */
 	bl_props.power = FB_BLANK_POWERDOWN;
@@ -308,7 +305,7 @@ void fbtft_register_backlight(struct fbtft_par *par)
 		bl_props.state |= BL_CORE_DRIVER1;
 
 	bd = backlight_device_register(dev_driver_string(par->info->device),
-				par->info->device, par, bl_ops, &bl_props);
+				par->info->device, par, &fbtft_bl_ops, &bl_props);
 	if (IS_ERR(bd)) {
 		dev_err(par->info->device,
 			"cannot register backlight device (%ld)\n",
-- 
1.8.3.1


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

* [PATCH 3/5] staging: fbtft: fbtft_request_gpios: reduce nesting
  2015-08-16 20:36 [PATCH 0/5] staging: fbtft: some checpatch.pl cleanups Mike Rapoport
  2015-08-16 20:36 ` [PATCH 1/5] staging: fbtft: remove unused bl_ops from fbtft_unregister_backlight Mike Rapoport
  2015-08-16 20:36 ` [PATCH 2/5] staging: fbtft: fbtft-core: define backlight_ops statically Mike Rapoport
@ 2015-08-16 20:36 ` Mike Rapoport
  2015-08-16 20:36 ` [PATCH 4/5] staging: fbtft: fb_ssd1351: define backlight_ops statically Mike Rapoport
  2015-08-16 20:36 ` [PATCH 5/5] staging: fbtft: fb_watterott: " Mike Rapoport
  4 siblings, 0 replies; 7+ messages in thread
From: Mike Rapoport @ 2015-08-16 20:36 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Mike Rapoport, Thomas Petazzoni, Noralf Trønnes, LKML

Returning immediately if no platform_data or platform_data->gpios is
specified reduceis code nesting

Signed-off-by: Mike Rapoport <mike.rapoport@gmail.com>
---
 drivers/staging/fbtft/fbtft-core.c | 51 +++++++++++++++++++-------------------
 1 file changed, 26 insertions(+), 25 deletions(-)

diff --git a/drivers/staging/fbtft/fbtft-core.c b/drivers/staging/fbtft/fbtft-core.c
index 81ba416..f55936a 100644
--- a/drivers/staging/fbtft/fbtft-core.c
+++ b/drivers/staging/fbtft/fbtft-core.c
@@ -127,33 +127,34 @@ static int fbtft_request_gpios(struct fbtft_par *par)
 	unsigned long flags;
 	int ret;
 
-	if (pdata && pdata->gpios) {
-		gpio = pdata->gpios;
-		while (gpio->name[0]) {
-			flags = FBTFT_GPIO_NO_MATCH;
-			/* if driver provides match function, try it first,
-			   if no match use our own */
-			if (par->fbtftops.request_gpios_match)
-				flags = par->fbtftops.request_gpios_match(par, gpio);
-			if (flags == FBTFT_GPIO_NO_MATCH)
-				flags = fbtft_request_gpios_match(par, gpio);
-			if (flags != FBTFT_GPIO_NO_MATCH) {
-				ret = devm_gpio_request_one(par->info->device,
-						gpio->gpio, flags,
-						par->info->device->driver->name);
-				if (ret < 0) {
-					dev_err(par->info->device,
-						"%s: gpio_request_one('%s'=%d) failed with %d\n",
-						__func__, gpio->name,
-						gpio->gpio, ret);
-					return ret;
-				}
-				fbtft_par_dbg(DEBUG_REQUEST_GPIOS, par,
-					"%s: '%s' = GPIO%d\n",
-					__func__, gpio->name, gpio->gpio);
+	if (!(pdata && pdata->gpios))
+		return 0;
+
+	gpio = pdata->gpios;
+	while (gpio->name[0]) {
+		flags = FBTFT_GPIO_NO_MATCH;
+		/* if driver provides match function, try it first,
+		   if no match use our own */
+		if (par->fbtftops.request_gpios_match)
+			flags = par->fbtftops.request_gpios_match(par, gpio);
+		if (flags == FBTFT_GPIO_NO_MATCH)
+			flags = fbtft_request_gpios_match(par, gpio);
+		if (flags != FBTFT_GPIO_NO_MATCH) {
+			ret = devm_gpio_request_one(par->info->device,
+					gpio->gpio, flags,
+					par->info->device->driver->name);
+			if (ret < 0) {
+				dev_err(par->info->device,
+					"%s: gpio_request_one('%s'=%d) failed with %d\n",
+					__func__, gpio->name,
+					gpio->gpio, ret);
+				return ret;
 			}
-			gpio++;
+			fbtft_par_dbg(DEBUG_REQUEST_GPIOS, par,
+				"%s: '%s' = GPIO%d\n",
+				__func__, gpio->name, gpio->gpio);
 		}
+		gpio++;
 	}
 
 	return 0;
-- 
1.8.3.1


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

* [PATCH 4/5] staging: fbtft: fb_ssd1351: define backlight_ops statically
  2015-08-16 20:36 [PATCH 0/5] staging: fbtft: some checpatch.pl cleanups Mike Rapoport
                   ` (2 preceding siblings ...)
  2015-08-16 20:36 ` [PATCH 3/5] staging: fbtft: fbtft_request_gpios: reduce nesting Mike Rapoport
@ 2015-08-16 20:36 ` Mike Rapoport
  2015-08-16 20:36 ` [PATCH 5/5] staging: fbtft: fb_watterott: " Mike Rapoport
  4 siblings, 0 replies; 7+ messages in thread
From: Mike Rapoport @ 2015-08-16 20:36 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Mike Rapoport, Thomas Petazzoni, Noralf Trønnes, LKML

instead of devm_kzalloc'ing them

Signed-off-by: Mike Rapoport <mike.rapoport@gmail.com>
---
 drivers/staging/fbtft/fb_ssd1351.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/fbtft/fb_ssd1351.c b/drivers/staging/fbtft/fb_ssd1351.c
index 9bcd7a0..dff5809 100644
--- a/drivers/staging/fbtft/fb_ssd1351.c
+++ b/drivers/staging/fbtft/fb_ssd1351.c
@@ -208,25 +208,22 @@ static int update_onboard_backlight(struct backlight_device *bd)
 	return 0;
 }
 
+static const struct backlight_ops bl_ops = {
+	.update_status = update_onboard_backlight,
+};
+
 static void register_onboard_backlight(struct fbtft_par *par)
 {
 	struct backlight_device *bd;
 	struct backlight_properties bl_props = { 0, };
-	struct backlight_ops *bl_ops;
 
 	fbtft_par_dbg(DEBUG_BACKLIGHT, par, "%s()\n", __func__);
 
-	bl_ops = devm_kzalloc(par->info->device, sizeof(struct backlight_ops),
-				GFP_KERNEL);
-	if (!bl_ops)
-		return;
-
-	bl_ops->update_status = update_onboard_backlight;
 	bl_props.type = BACKLIGHT_RAW;
 	bl_props.power = FB_BLANK_POWERDOWN;
 
 	bd = backlight_device_register(dev_driver_string(par->info->device),
-				par->info->device, par, bl_ops, &bl_props);
+				par->info->device, par, &bl_ops, &bl_props);
 	if (IS_ERR(bd)) {
 		dev_err(par->info->device,
 			"cannot register backlight device (%ld)\n",
-- 
1.8.3.1


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

* [PATCH 5/5] staging: fbtft: fb_watterott: define backlight_ops statically
  2015-08-16 20:36 [PATCH 0/5] staging: fbtft: some checpatch.pl cleanups Mike Rapoport
                   ` (3 preceding siblings ...)
  2015-08-16 20:36 ` [PATCH 4/5] staging: fbtft: fb_ssd1351: define backlight_ops statically Mike Rapoport
@ 2015-08-16 20:36 ` Mike Rapoport
  4 siblings, 0 replies; 7+ messages in thread
From: Mike Rapoport @ 2015-08-16 20:36 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Mike Rapoport, Thomas Petazzoni, Noralf Trønnes, LKML

instead of devm_kzalloc'ing them

Signed-off-by: Mike Rapoport <mike.rapoport@gmail.com>
---
 drivers/staging/fbtft/fb_watterott.c | 17 +++++------------
 1 file changed, 5 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/fbtft/fb_watterott.c b/drivers/staging/fbtft/fb_watterott.c
index 88fb2c0..e8ebe2e 100644
--- a/drivers/staging/fbtft/fb_watterott.c
+++ b/drivers/staging/fbtft/fb_watterott.c
@@ -257,31 +257,24 @@ static int backlight_chip_update_status(struct backlight_device *bd)
 	return 0;
 }
 
+static const struct backlight_ops bl_ops = {
+	.update_status = backlight_chip_update_status,
+};
+
 static void register_chip_backlight(struct fbtft_par *par)
 {
 	struct backlight_device *bd;
 	struct backlight_properties bl_props = { 0, };
-	struct backlight_ops *bl_ops;
 
 	fbtft_par_dbg(DEBUG_BACKLIGHT, par, "%s()\n", __func__);
 
-	bl_ops = devm_kzalloc(par->info->device, sizeof(struct backlight_ops),
-				GFP_KERNEL);
-	if (!bl_ops) {
-		dev_err(par->info->device,
-			"%s: could not allocate memory for backlight operations.\n",
-			__func__);
-		return;
-	}
-
-	bl_ops->update_status = backlight_chip_update_status;
 	bl_props.type = BACKLIGHT_RAW;
 	bl_props.power = FB_BLANK_POWERDOWN;
 	bl_props.max_brightness = 100;
 	bl_props.brightness = DEFAULT_BRIGHTNESS;
 
 	bd = backlight_device_register(dev_driver_string(par->info->device),
-				par->info->device, par, bl_ops, &bl_props);
+				par->info->device, par, &bl_ops, &bl_props);
 	if (IS_ERR(bd)) {
 		dev_err(par->info->device,
 			"cannot register backlight device (%ld)\n",
-- 
1.8.3.1


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

* Re: [PATCH 1/5] staging: fbtft: remove unused bl_ops from fbtft_unregister_backlight
  2015-08-16 20:36 ` [PATCH 1/5] staging: fbtft: remove unused bl_ops from fbtft_unregister_backlight Mike Rapoport
@ 2015-09-03  1:08   ` Greg Kroah-Hartman
  0 siblings, 0 replies; 7+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-03  1:08 UTC (permalink / raw)
  To: Mike Rapoport; +Cc: Thomas Petazzoni, Noralf Trønnes, LKML

On Sun, Aug 16, 2015 at 11:36:33PM +0300, Mike Rapoport wrote:
> Signed-off-by: Mike Rapoport <mike.rapoport@gmail.com>

I can't take a patch without some kind of changelog text, sorry.

Please fix up and resend this series.

thanks,

greg k-h

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

end of thread, other threads:[~2015-09-03  1:08 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-16 20:36 [PATCH 0/5] staging: fbtft: some checpatch.pl cleanups Mike Rapoport
2015-08-16 20:36 ` [PATCH 1/5] staging: fbtft: remove unused bl_ops from fbtft_unregister_backlight Mike Rapoport
2015-09-03  1:08   ` Greg Kroah-Hartman
2015-08-16 20:36 ` [PATCH 2/5] staging: fbtft: fbtft-core: define backlight_ops statically Mike Rapoport
2015-08-16 20:36 ` [PATCH 3/5] staging: fbtft: fbtft_request_gpios: reduce nesting Mike Rapoport
2015-08-16 20:36 ` [PATCH 4/5] staging: fbtft: fb_ssd1351: define backlight_ops statically Mike Rapoport
2015-08-16 20:36 ` [PATCH 5/5] staging: fbtft: fb_watterott: " Mike Rapoport

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox