* [PATCH] drm/exynos: constify exynos_drm_crtc_ops structures
@ 2017-01-09 17:54 Bhumika Goyal
2017-01-10 10:18 ` Daniel Vetter
0 siblings, 1 reply; 2+ messages in thread
From: Bhumika Goyal @ 2017-01-09 17:54 UTC (permalink / raw)
To: julia.lawall, inki.dae, jy0922.shim, sw0312.kim, kyungmin.park,
airlied, kgene, krzk, javier, dri-devel, linux-arm-kernel,
linux-samsung-soc, linux-kernel
Cc: Bhumika Goyal
Declare exynos_drm_crtc_ops structures as const as they are only passed
as an argument to the function exynos_drm_crtc_create. This argument is
of type const struct exynos_drm_crtc_ops *, so exynos_drm_crtc_ops
structures having this property can be declared const.
Done using Coccinelle:
@r disable optional_qualifier@
identifier i;
position p;
@@
static struct exynos_drm_crtc_ops i@p={...};
@ok@
position p;
identifier r.i;
@@
exynos_drm_crtc_create(...,&i@p,...)
@bad@
position p!={r.p,ok.p};
identifier r.i;
@@
i@p
@depends on !bad disable optional_qualifier@
identifier r.i;
@@
+const
struct exynos_drm_crtc_ops i;
File size before:
text data bss dec hex filename
5008 280 0 5288 14a8 exynos/exynos5433_drm_decon.o
File size after:
text data bss dec hex filename
5120 176 0 5296 14b0 exynos/exynos5433_drm_decon.o
Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
---
drivers/gpu/drm/exynos/exynos5433_drm_decon.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
index 6ca1f31..12b9bf0 100644
--- a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
+++ b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
@@ -470,7 +470,7 @@ static void decon_clear_channels(struct exynos_drm_crtc *crtc)
clk_disable_unprepare(ctx->clks[i]);
}
-static struct exynos_drm_crtc_ops decon_crtc_ops = {
+static const struct exynos_drm_crtc_ops decon_crtc_ops = {
.enable = decon_enable,
.disable = decon_disable,
.enable_vblank = decon_enable_vblank,
--
1.9.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] drm/exynos: constify exynos_drm_crtc_ops structures
2017-01-09 17:54 [PATCH] drm/exynos: constify exynos_drm_crtc_ops structures Bhumika Goyal
@ 2017-01-10 10:18 ` Daniel Vetter
0 siblings, 0 replies; 2+ messages in thread
From: Daniel Vetter @ 2017-01-10 10:18 UTC (permalink / raw)
To: Bhumika Goyal
Cc: julia.lawall, inki.dae, jy0922.shim, sw0312.kim, kyungmin.park,
airlied, kgene, krzk, javier, dri-devel, linux-arm-kernel,
linux-samsung-soc, linux-kernel
On Mon, Jan 09, 2017 at 11:24:53PM +0530, Bhumika Goyal wrote:
> Declare exynos_drm_crtc_ops structures as const as they are only passed
> as an argument to the function exynos_drm_crtc_create. This argument is
> of type const struct exynos_drm_crtc_ops *, so exynos_drm_crtc_ops
> structures having this property can be declared const.
> Done using Coccinelle:
>
> @r disable optional_qualifier@
> identifier i;
> position p;
> @@
> static struct exynos_drm_crtc_ops i@p={...};
>
> @ok@
> position p;
> identifier r.i;
> @@
> exynos_drm_crtc_create(...,&i@p,...)
>
> @bad@
> position p!={r.p,ok.p};
> identifier r.i;
> @@
> i@p
>
> @depends on !bad disable optional_qualifier@
> identifier r.i;
> @@
> +const
> struct exynos_drm_crtc_ops i;
>
> File size before:
> text data bss dec hex filename
> 5008 280 0 5288 14a8 exynos/exynos5433_drm_decon.o
>
> File size after:
> text data bss dec hex filename
> 5120 176 0 5296 14b0 exynos/exynos5433_drm_decon.o
>
> Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Applied to drm-misc, thanks.
-Daniel
> ---
> drivers/gpu/drm/exynos/exynos5433_drm_decon.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
> index 6ca1f31..12b9bf0 100644
> --- a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
> +++ b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
> @@ -470,7 +470,7 @@ static void decon_clear_channels(struct exynos_drm_crtc *crtc)
> clk_disable_unprepare(ctx->clks[i]);
> }
>
> -static struct exynos_drm_crtc_ops decon_crtc_ops = {
> +static const struct exynos_drm_crtc_ops decon_crtc_ops = {
> .enable = decon_enable,
> .disable = decon_disable,
> .enable_vblank = decon_enable_vblank,
> --
> 1.9.1
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-01-10 10:18 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-09 17:54 [PATCH] drm/exynos: constify exynos_drm_crtc_ops structures Bhumika Goyal
2017-01-10 10:18 ` Daniel Vetter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).