2017-04-29 00:17:19

by Shiva Kerdel

[permalink] [raw]
Subject: [PATCH] staging: fbtft: fbtft-core.c: EXPORT_SYMBOL should immediately follow its function

This patch fixes the following checkpatch.pl warning
- EXPORT_SYMBOL(foo); should immediately follow its function/variable

Signed-off-by: Shiva Kerdel <[email protected]>
---
drivers/staging/fbtft/fbtft-core.c | 25 +++++++++++++++----------
1 file changed, 15 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/fbtft/fbtft-core.c b/drivers/staging/fbtft/fbtft-core.c
index b742ee7..b004a4d 100644
--- a/drivers/staging/fbtft/fbtft-core.c
+++ b/drivers/staging/fbtft/fbtft-core.c
@@ -275,23 +275,31 @@ static int fbtft_backlight_get_brightness(struct backlight_device *bd)
return bd->props.brightness;
}

+static const struct backlight_ops fbtft_bl_ops = {
+ .get_brightness = fbtft_backlight_get_brightness,
+ .update_status = fbtft_backlight_update_status,
+};
+#endif
+
void fbtft_unregister_backlight(struct fbtft_par *par)
{
+ #ifdef CONFIG_FB_BACKLIGHT
+
if (par->info->bl_dev) {
par->info->bl_dev->props.power = FB_BLANK_POWERDOWN;
backlight_update_status(par->info->bl_dev);
backlight_device_unregister(par->info->bl_dev);
par->info->bl_dev = NULL;
}
-}

-static const struct backlight_ops fbtft_bl_ops = {
- .get_brightness = fbtft_backlight_get_brightness,
- .update_status = fbtft_backlight_update_status,
-};
+ #endif
+}
+EXPORT_SYMBOL(fbtft_unregister_backlight);

void fbtft_register_backlight(struct fbtft_par *par)
{
+ #ifdef CONFIG_FB_BACKLIGHT
+
struct backlight_device *bd;
struct backlight_properties bl_props = { 0, };

@@ -320,13 +328,10 @@ void fbtft_register_backlight(struct fbtft_par *par)

if (!par->fbtftops.unregister_backlight)
par->fbtftops.unregister_backlight = fbtft_unregister_backlight;
+
+ #endif
}
-#else
-void fbtft_register_backlight(struct fbtft_par *par) { };
-void fbtft_unregister_backlight(struct fbtft_par *par) { };
-#endif
EXPORT_SYMBOL(fbtft_register_backlight);
-EXPORT_SYMBOL(fbtft_unregister_backlight);

static void fbtft_set_addr_win(struct fbtft_par *par, int xs, int ys, int xe,
int ye)
--
2.10.2


2017-04-29 05:26:50

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH] staging: fbtft: fbtft-core.c: EXPORT_SYMBOL should immediately follow its function

On Sat, Apr 29, 2017 at 01:07:34AM +0200, Shiva Kerdel wrote:
> This patch fixes the following checkpatch.pl warning
> - EXPORT_SYMBOL(foo); should immediately follow its function/variable
>
> Signed-off-by: Shiva Kerdel <[email protected]>
> ---
> drivers/staging/fbtft/fbtft-core.c | 25 +++++++++++++++----------
> 1 file changed, 15 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/staging/fbtft/fbtft-core.c b/drivers/staging/fbtft/fbtft-core.c
> index b742ee7..b004a4d 100644
> --- a/drivers/staging/fbtft/fbtft-core.c
> +++ b/drivers/staging/fbtft/fbtft-core.c
> @@ -275,23 +275,31 @@ static int fbtft_backlight_get_brightness(struct backlight_device *bd)
> return bd->props.brightness;
> }
>
> +static const struct backlight_ops fbtft_bl_ops = {
> + .get_brightness = fbtft_backlight_get_brightness,
> + .update_status = fbtft_backlight_update_status,
> +};
> +#endif
> +
> void fbtft_unregister_backlight(struct fbtft_par *par)
> {
> + #ifdef CONFIG_FB_BACKLIGHT

Ick, no, does this really look like good style?

> +
> if (par->info->bl_dev) {
> par->info->bl_dev->props.power = FB_BLANK_POWERDOWN;
> backlight_update_status(par->info->bl_dev);
> backlight_device_unregister(par->info->bl_dev);
> par->info->bl_dev = NULL;
> }
> -}
>
> -static const struct backlight_ops fbtft_bl_ops = {
> - .get_brightness = fbtft_backlight_get_brightness,
> - .update_status = fbtft_backlight_update_status,
> -};
> + #endif
> +}
> +EXPORT_SYMBOL(fbtft_unregister_backlight);
>
> void fbtft_register_backlight(struct fbtft_par *par)
> {
> + #ifdef CONFIG_FB_BACKLIGHT
> +
> struct backlight_device *bd;
> struct backlight_properties bl_props = { 0, };
>
> @@ -320,13 +328,10 @@ void fbtft_register_backlight(struct fbtft_par *par)
>
> if (!par->fbtftops.unregister_backlight)
> par->fbtftops.unregister_backlight = fbtft_unregister_backlight;
> +
> + #endif
> }
> -#else
> -void fbtft_register_backlight(struct fbtft_par *par) { };
> -void fbtft_unregister_backlight(struct fbtft_par *par) { };
> -#endif
> EXPORT_SYMBOL(fbtft_register_backlight);
> -EXPORT_SYMBOL(fbtft_unregister_backlight);

The original code here is fine, please leave it as-is.

thanks,

greg k-h