public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging: fbtft: Fix checkpatch warning
@ 2016-09-28  9:43 Carlos Palminha
  0 siblings, 0 replies; 5+ messages in thread
From: Carlos Palminha @ 2016-09-28  9:43 UTC (permalink / raw)
  To: devel, linux-kernel; +Cc: thomas.petazzoni, noralf, gregkh, CARLOS.PALMINHA

---
 drivers/staging/fbtft/fbtft_device.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/fbtft/fbtft_device.c b/drivers/staging/fbtft/fbtft_device.c
index e9f25dd..0883715 100644
--- a/drivers/staging/fbtft/fbtft_device.c
+++ b/drivers/staging/fbtft/fbtft_device.c
@@ -841,7 +841,6 @@ static struct fbtft_device_display displays[] = {
 			}
 		}
 	}, {
-
 		.name = "piscreen",
 		.spi = &(struct spi_board_info) {
 			.modalias = "fb_ili9486",
@@ -1418,14 +1417,14 @@ static int __init fbtft_device_init(void)
 
 	/* parse module parameter: gpios */
 	while ((p_gpio = strsep(&gpios, ","))) {
-		if (strchr(p_gpio, ':') == NULL) {
+		if (!strchr(p_gpio, ':')) {
 			pr_err("error: missing ':' in gpios parameter: %s\n",
 			       p_gpio);
 			return -EINVAL;
 		}
 		p_num = p_gpio;
 		p_name = strsep(&p_num, ":");
-		if (p_name == NULL || p_num == NULL) {
+		if (!p_name || !p_num) {
 			pr_err("something bad happened parsing gpios parameter: %s\n",
 			       p_gpio);
 			return -EINVAL;
@@ -1586,7 +1585,6 @@ static void __exit fbtft_device_exit(void)
 
 	if (p_device)
 		platform_device_unregister(p_device);
-
 }
 
 arch_initcall(fbtft_device_init);
-- 
2.9.3

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

* [PATCH] staging: fbtft: Fix checkpatch warning
@ 2016-09-28  9:59 Carlos Palminha
  2016-09-28 10:05 ` Greg KH
  0 siblings, 1 reply; 5+ messages in thread
From: Carlos Palminha @ 2016-09-28  9:59 UTC (permalink / raw)
  To: devel, linux-kernel; +Cc: thomas.petazzoni, noralf, gregkh, CARLOS.PALMINHA

Improve code readability.

Signed-off-by: Carlos Palminha <palminha@synopsys.com>
---
Changes v1->v2:
- Added signed-off-by and comment.

 drivers/staging/fbtft/fbtft_device.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/fbtft/fbtft_device.c b/drivers/staging/fbtft/fbtft_device.c
index e9f25dd..0883715 100644
--- a/drivers/staging/fbtft/fbtft_device.c
+++ b/drivers/staging/fbtft/fbtft_device.c
@@ -841,7 +841,6 @@ static struct fbtft_device_display displays[] = {
 			}
 		}
 	}, {
-
 		.name = "piscreen",
 		.spi = &(struct spi_board_info) {
 			.modalias = "fb_ili9486",
@@ -1418,14 +1417,14 @@ static int __init fbtft_device_init(void)
 
 	/* parse module parameter: gpios */
 	while ((p_gpio = strsep(&gpios, ","))) {
-		if (strchr(p_gpio, ':') == NULL) {
+		if (!strchr(p_gpio, ':')) {
 			pr_err("error: missing ':' in gpios parameter: %s\n",
 			       p_gpio);
 			return -EINVAL;
 		}
 		p_num = p_gpio;
 		p_name = strsep(&p_num, ":");
-		if (p_name == NULL || p_num == NULL) {
+		if (!p_name || !p_num) {
 			pr_err("something bad happened parsing gpios parameter: %s\n",
 			       p_gpio);
 			return -EINVAL;
@@ -1586,7 +1585,6 @@ static void __exit fbtft_device_exit(void)
 
 	if (p_device)
 		platform_device_unregister(p_device);
-
 }
 
 arch_initcall(fbtft_device_init);
-- 
2.9.3

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

* Re: [PATCH] staging: fbtft: Fix checkpatch warning
  2016-09-28  9:59 [PATCH] staging: fbtft: Fix checkpatch warning Carlos Palminha
@ 2016-09-28 10:05 ` Greg KH
  0 siblings, 0 replies; 5+ messages in thread
From: Greg KH @ 2016-09-28 10:05 UTC (permalink / raw)
  To: Carlos Palminha; +Cc: devel, linux-kernel, noralf

On Wed, Sep 28, 2016 at 10:59:46AM +0100, Carlos Palminha wrote:
> Improve code readability.

You are doing multiple things in the same patch, and you don't really
tell us what you are doing, or why you are doing it...

Please take a step back, relax, and wait a day before resending a patch
series for these issues.

thanks,

greg k-h

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

* [PATCH] Staging: fbtft: Fix checkpatch warning
@ 2017-03-24  9:02 Anar Adilova
  2017-03-27 12:06 ` Greg KH
  0 siblings, 1 reply; 5+ messages in thread
From: Anar Adilova @ 2017-03-24  9:02 UTC (permalink / raw)
  To: thomas.petazzoni, gregkh; +Cc: outreachy-kernel, devel, linux-kernel

This patch fixes the checkpatch.pl warning:

EXPORT_SYMBOL(foo); should immediately follow its function/variable.

The EXPORT_SYMBOL statements are placed inside if blocks, after both function implementations.

Signed-off-by: Anar Adilova <anaradilovab@gmail.com>
---
 drivers/staging/fbtft/fbtft-core.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/fbtft/fbtft-core.c b/drivers/staging/fbtft/fbtft-core.c
index b742ee7..d2e3e8d 100644
--- a/drivers/staging/fbtft/fbtft-core.c
+++ b/drivers/staging/fbtft/fbtft-core.c
@@ -284,6 +284,7 @@ void fbtft_unregister_backlight(struct fbtft_par *par)
 		par->info->bl_dev = NULL;
 	}
 }
+EXPORT_SYMBOL(fbtft_unregister_backlight);
 
 static const struct backlight_ops fbtft_bl_ops = {
 	.get_brightness	= fbtft_backlight_get_brightness,
@@ -321,12 +322,13 @@ void fbtft_register_backlight(struct fbtft_par *par)
 	if (!par->fbtftops.unregister_backlight)
 		par->fbtftops.unregister_backlight = fbtft_unregister_backlight;
 }
+EXPORT_SYMBOL(fbtft_register_backlight);
 #else
 void fbtft_register_backlight(struct fbtft_par *par) { };
-void fbtft_unregister_backlight(struct fbtft_par *par) { };
-#endif
 EXPORT_SYMBOL(fbtft_register_backlight);
+void fbtft_unregister_backlight(struct fbtft_par *par) { };
 EXPORT_SYMBOL(fbtft_unregister_backlight);
+#endif
 
 static void fbtft_set_addr_win(struct fbtft_par *par, int xs, int ys, int xe,
 			       int ye)
-- 
2.9.3

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

* Re: [PATCH] Staging: fbtft: Fix checkpatch warning
  2017-03-24  9:02 [PATCH] Staging: " Anar Adilova
@ 2017-03-27 12:06 ` Greg KH
  0 siblings, 0 replies; 5+ messages in thread
From: Greg KH @ 2017-03-27 12:06 UTC (permalink / raw)
  To: Anar Adilova; +Cc: thomas.petazzoni, devel, outreachy-kernel, linux-kernel

On Fri, Mar 24, 2017 at 03:02:45PM +0600, Anar Adilova wrote:
> This patch fixes the checkpatch.pl warning:
> 
> EXPORT_SYMBOL(foo); should immediately follow its function/variable.
> 
> The EXPORT_SYMBOL statements are placed inside if blocks, after both function implementations.
>

Please always wrap your changelog text at 72 columns.

> Signed-off-by: Anar Adilova <anaradilovab@gmail.com>
> ---
>  drivers/staging/fbtft/fbtft-core.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/fbtft/fbtft-core.c b/drivers/staging/fbtft/fbtft-core.c
> index b742ee7..d2e3e8d 100644
> --- a/drivers/staging/fbtft/fbtft-core.c
> +++ b/drivers/staging/fbtft/fbtft-core.c
> @@ -284,6 +284,7 @@ void fbtft_unregister_backlight(struct fbtft_par *par)
>  		par->info->bl_dev = NULL;
>  	}
>  }
> +EXPORT_SYMBOL(fbtft_unregister_backlight);
>  
>  static const struct backlight_ops fbtft_bl_ops = {
>  	.get_brightness	= fbtft_backlight_get_brightness,
> @@ -321,12 +322,13 @@ void fbtft_register_backlight(struct fbtft_par *par)
>  	if (!par->fbtftops.unregister_backlight)
>  		par->fbtftops.unregister_backlight = fbtft_unregister_backlight;
>  }
> +EXPORT_SYMBOL(fbtft_register_backlight);
>  #else
>  void fbtft_register_backlight(struct fbtft_par *par) { };
> -void fbtft_unregister_backlight(struct fbtft_par *par) { };
> -#endif
>  EXPORT_SYMBOL(fbtft_register_backlight);
> +void fbtft_unregister_backlight(struct fbtft_par *par) { };
>  EXPORT_SYMBOL(fbtft_unregister_backlight);
> +#endif

No, the original code here is "nicer" in that you don't have duplicate
declarations like your change added.

You can ignore the checkpatch warning here.

thanks,

greg k-h

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

end of thread, other threads:[~2017-03-27 12:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-28  9:59 [PATCH] staging: fbtft: Fix checkpatch warning Carlos Palminha
2016-09-28 10:05 ` Greg KH
  -- strict thread matches above, loose matches on Subject: below --
2017-03-24  9:02 [PATCH] Staging: " Anar Adilova
2017-03-27 12:06 ` Greg KH
2016-09-28  9:43 [PATCH] staging: " Carlos Palminha

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