Re: [PATCH] drm: armada: mark symbols static where possible

From: Russell King - ARM Linux
Date: Mon Sep 26 2016 - 11:17:42 EST


On Sun, Sep 25, 2016 at 03:22:25PM +0800, Baoyou Xie wrote:
> We get 2 warnings when building kernel with W=1:
> drivers/gpu/drm/armada/armada_gem.c:215:27: warning: no previous prototype for 'armada_gem_alloc_object' [-Wmissing-prototypes]
> drivers/gpu/drm/armada/armada_gem.c:423:1: warning: no previous prototype for 'armada_gem_prime_map_dma_buf' [-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@xxxxxxxxxx>

Thanks. You can have an:

Acked-by: Russell King <rmk+kernel@xxxxxxxxxxxxxxx>

with one change to this patch:

> ---
> drivers/gpu/drm/armada/armada_gem.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/armada/armada_gem.c b/drivers/gpu/drm/armada/armada_gem.c
> index cb8f034..1beef28 100644
> --- a/drivers/gpu/drm/armada/armada_gem.c
> +++ b/drivers/gpu/drm/armada/armada_gem.c
> @@ -212,7 +212,8 @@ armada_gem_alloc_private_object(struct drm_device *dev, size_t size)
> return obj;
> }
>
> -struct armada_gem_object *armada_gem_alloc_object(struct drm_device *dev,
> +static struct
> +armada_gem_object *armada_gem_alloc_object(struct drm_device *dev,
> size_t size)

Please make this:

static struct armada_gem_object *
armada_gem_alloc_object(struct drm_device *dev, size_t size)

instead - if we're going to break it across lines, there's no need to
break it across three, and always keep the return type on one line,
like the other instance you've modified below.

Thanks.

> {
> struct armada_gem_object *obj;
> @@ -419,7 +420,7 @@ int armada_gem_pwrite_ioctl(struct drm_device *dev, void *data,
> }
>
> /* Prime support */
> -struct sg_table *
> +static struct sg_table *
> armada_gem_prime_map_dma_buf(struct dma_buf_attachment *attach,
> enum dma_data_direction dir)
> {
> --
> 2.7.4
>

--
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.