Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1478189 > unrolled thread

[PATCH] drm/sti: mark symbols static where possible

Started byBaoyou Xie <baoyou.xie@linaro.org>
First post2016-09-07 13:10 +0200
Last post2016-09-08 12:10 +0200
Articles 5 — 4 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] drm/sti: mark symbols static where possible Baoyou Xie <baoyou.xie@linaro.org> - 2016-09-07 13:10 +0200
    Re: [PATCH] drm/sti: mark symbols static where possible Emil Velikov <emil.l.velikov@gmail.com> - 2016-09-08 11:40 +0200
      Re: [PATCH] drm/sti: mark symbols static where possible Arnd Bergmann <arnd@arndb.de> - 2016-09-08 12:10 +0200
        Re: [PATCH] drm/sti: mark symbols static where possible Emil Velikov <emil.l.velikov@gmail.com> - 2016-09-09 14:50 +0200
    Re: [PATCH] drm/sti: mark symbols static where possible Benjamin Gaignard <benjamin.gaignard@linaro.org> - 2016-09-08 12:10 +0200

#1478189 — [PATCH] drm/sti: mark symbols static where possible

FromBaoyou Xie <baoyou.xie@linaro.org>
Date2016-09-07 13:10 +0200
Subject[PATCH] drm/sti: mark symbols static where possible
Message-ID<seITU-7oj-7@gated-at.bofh.it>
We get 2 warnings when building kernel with W=1:
drivers/gpu/drm/sti/sti_mixer.c:361:6: warning: no previous prototype for 'sti_mixer_set_matrix' [-Wmissing-prototypes]
drivers/gpu/drm/sti/sti_dvo.c:109:5: warning: no previous prototype for 'dvo_awg_generate_code' [-Wmissing-prototypes]

In fact, these functions are only used in the file in which they are
declared and don't need a declaration, but can be made static.
So this patch marks these functions with 'static'.

Signed-off-by: Baoyou Xie <baoyou.xie@linaro.org>
---
 drivers/gpu/drm/sti/sti_dvo.c   | 3 ++-
 drivers/gpu/drm/sti/sti_mixer.c | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/sti/sti_dvo.c b/drivers/gpu/drm/sti/sti_dvo.c
index 00881eb..4545ad0 100644
--- a/drivers/gpu/drm/sti/sti_dvo.c
+++ b/drivers/gpu/drm/sti/sti_dvo.c
@@ -106,7 +106,8 @@ struct sti_dvo_connector {
 	container_of(x, struct sti_dvo_connector, drm_connector)
 
 #define BLANKING_LEVEL 16
-int dvo_awg_generate_code(struct sti_dvo *dvo, u8 *ram_size, u32 *ram_code)
+static int
+dvo_awg_generate_code(struct sti_dvo *dvo, u8 *ram_size, u32 *ram_code)
 {
 	struct drm_display_mode *mode = &dvo->mode;
 	struct dvo_config *config = dvo->config;
diff --git a/drivers/gpu/drm/sti/sti_mixer.c b/drivers/gpu/drm/sti/sti_mixer.c
index 7d9aea8..b78cec5 100644
--- a/drivers/gpu/drm/sti/sti_mixer.c
+++ b/drivers/gpu/drm/sti/sti_mixer.c
@@ -358,7 +358,7 @@ int sti_mixer_set_plane_status(struct sti_mixer *mixer,
 	return 0;
 }
 
-void sti_mixer_set_matrix(struct sti_mixer *mixer)
+static void sti_mixer_set_matrix(struct sti_mixer *mixer)
 {
 	unsigned int i;
 
-- 
2.7.4

[toc] | [next] | [standalone]


#1478976

FromEmil Velikov <emil.l.velikov@gmail.com>
Date2016-09-08 11:40 +0200
Message-ID<sf3Yl-417-15@gated-at.bofh.it>
In reply to#1478189
[Trimming down the CC list]

Hi Baoyou,

On 7 September 2016 at 12:05, Baoyou Xie <baoyou.xie@linaro.org> wrote:
> We get 2 warnings when building kernel with W=1:
As you're going through DRM I was wondering if you have a rough number
of warnings we get at the various W levels 1,2,...

Hope you'll have the time/interest to sort some of the W>1 ones as well :-)
Thanks
Emil

[toc] | [prev] | [next] | [standalone]


#1479023

FromArnd Bergmann <arnd@arndb.de>
Date2016-09-08 12:10 +0200
Message-ID<sf4rn-4qN-9@gated-at.bofh.it>
In reply to#1478976
On Thursday, September 8, 2016 10:35:17 AM CEST Emil Velikov wrote:
> On 7 September 2016 at 12:05, Baoyou Xie <baoyou.xie@linaro.org> wrote:
> > We get 2 warnings when building kernel with W=1:
> As you're going through DRM I was wondering if you have a rough number
> of warnings we get at the various W levels 1,2,...

I've looked at the W=1 warnings overall, and the count I got a
month ago was 648 warnings for drivers/gpu/::

    471 -Werror=missing-prototypes
     12 -Werror=type-limits
    124 -Werror=unused-but-set-variable
     41 -Werror=unused-const-variable=

vs for the whole kernel

   2033 -Werror=missing-prototypes
     58 -Werror=suggest-attribute=format
    167 -Werror=type-limits
   1398 -Werror=unused-but-set-variable
   1526 -Werror=unused-const-variable=

but that was after I had already fixed some of the other warnings
locally. It shouldn't be hard to fix all of them for any given
subsystem, often a single line change gets rid of a number
of individual warnings.

My basic idea however is not to do it by subsystem but instead
do it one warning at a time for the entire kernel and then enable
that warning by default without W=1.

> Hope you'll have the time/interest to sort some of the W>1 ones as well 

I suggested to Baoyou that he starts looking at missing-prototype
warnings across the kernel, as these are likely to find the most
actual bugs out of the W=1 warnings we get.

	Arnd

[toc] | [prev] | [next] | [standalone]


#1479950

FromEmil Velikov <emil.l.velikov@gmail.com>
Date2016-09-09 14:50 +0200
Message-ID<sftpM-2S8-1@gated-at.bofh.it>
In reply to#1479023
On 8 September 2016 at 10:56, Arnd Bergmann <arnd@arndb.de> wrote:
> On Thursday, September 8, 2016 10:35:17 AM CEST Emil Velikov wrote:
>> On 7 September 2016 at 12:05, Baoyou Xie <baoyou.xie@linaro.org> wrote:
>> > We get 2 warnings when building kernel with W=1:
>> As you're going through DRM I was wondering if you have a rough number
>> of warnings we get at the various W levels 1,2,...
>
> I've looked at the W=1 warnings overall, and the count I got a
> month ago was 648 warnings for drivers/gpu/::
>
>     471 -Werror=missing-prototypes
>      12 -Werror=type-limits
>     124 -Werror=unused-but-set-variable
>      41 -Werror=unused-const-variable=
>
> vs for the whole kernel
>
>    2033 -Werror=missing-prototypes
>      58 -Werror=suggest-attribute=format
>     167 -Werror=type-limits
>    1398 -Werror=unused-but-set-variable
>    1526 -Werror=unused-const-variable=
>
> but that was after I had already fixed some of the other warnings
> locally. It shouldn't be hard to fix all of them for any given
> subsystem, often a single line change gets rid of a number
> of individual warnings.
>
Considering the LOC in the kernel, the number are quite small. Still a
fair bit to go.

> My basic idea however is not to do it by subsystem but instead
> do it one warning at a time for the entire kernel and then enable
> that warning by default without W=1.
>
Makes perfect sense. Thanks Arnd !

Keep up the good work gents.

Regards,
Emil

[toc] | [prev] | [next] | [standalone]


#1479024

FromBenjamin Gaignard <benjamin.gaignard@linaro.org>
Date2016-09-08 12:10 +0200
Message-ID<sf4ro-4qN-13@gated-at.bofh.it>
In reply to#1478189
Acked-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>

2016-09-07 13:05 GMT+02:00 Baoyou Xie <baoyou.xie@linaro.org>:
> We get 2 warnings when building kernel with W=1:
> drivers/gpu/drm/sti/sti_mixer.c:361:6: warning: no previous prototype for 'sti_mixer_set_matrix' [-Wmissing-prototypes]
> drivers/gpu/drm/sti/sti_dvo.c:109:5: warning: no previous prototype for 'dvo_awg_generate_code' [-Wmissing-prototypes]
>
> In fact, these functions are only used in the file in which they are
> declared and don't need a declaration, but can be made static.
> So this patch marks these functions with 'static'.
>
> Signed-off-by: Baoyou Xie <baoyou.xie@linaro.org>
> ---
>  drivers/gpu/drm/sti/sti_dvo.c   | 3 ++-
>  drivers/gpu/drm/sti/sti_mixer.c | 2 +-
>  2 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/sti/sti_dvo.c b/drivers/gpu/drm/sti/sti_dvo.c
> index 00881eb..4545ad0 100644
> --- a/drivers/gpu/drm/sti/sti_dvo.c
> +++ b/drivers/gpu/drm/sti/sti_dvo.c
> @@ -106,7 +106,8 @@ struct sti_dvo_connector {
>         container_of(x, struct sti_dvo_connector, drm_connector)
>
>  #define BLANKING_LEVEL 16
> -int dvo_awg_generate_code(struct sti_dvo *dvo, u8 *ram_size, u32 *ram_code)
> +static int
> +dvo_awg_generate_code(struct sti_dvo *dvo, u8 *ram_size, u32 *ram_code)
>  {
>         struct drm_display_mode *mode = &dvo->mode;
>         struct dvo_config *config = dvo->config;
> diff --git a/drivers/gpu/drm/sti/sti_mixer.c b/drivers/gpu/drm/sti/sti_mixer.c
> index 7d9aea8..b78cec5 100644
> --- a/drivers/gpu/drm/sti/sti_mixer.c
> +++ b/drivers/gpu/drm/sti/sti_mixer.c
> @@ -358,7 +358,7 @@ int sti_mixer_set_plane_status(struct sti_mixer *mixer,
>         return 0;
>  }
>
> -void sti_mixer_set_matrix(struct sti_mixer *mixer)
> +static void sti_mixer_set_matrix(struct sti_mixer *mixer)
>  {
>         unsigned int i;
>
> --
> 2.7.4
>



-- 
Benjamin Gaignard

Graphic Study Group

Linaro.org │ Open source software for ARM SoCs

Follow Linaro: Facebook | Twitter | Blog

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web