]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
drm/sun4i: constify component_ops structures
authorJulia Lawall <Julia.Lawall@lip6.fr>
Sat, 12 Nov 2016 17:19:58 +0000 (18:19 +0100)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Sun, 13 Nov 2016 10:42:48 +0000 (11:42 +0100)
These component_ops structures are only used as the second argument to
component_add and component_del, which are declared as const, so the
structures can be declared as const as well.

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@r disable optional_qualifier@
identifier i;
position p;
@@

static struct component_ops i@p = { ... };

@ok1@
identifier r.i;
expression e1;
position p;
@@

component_add(e1,&i@p)

@ok2@
identifier r.i;
expression e1;
position p;
@@

component_del(e1, &i@p)

@bad@
position p != {r.p,ok1.p,ok2.p};
identifier r.i;
struct component_ops e;
@@

e@i@p

@depends on !bad disable optional_qualifier@
identifier r.i;
@@

static
+const
 struct component_ops i = { ... };
// </smpl>

The result of the size command before the change is (arm):

   text       data         bss     dec      hex filename
   5266        236           8    5510     1586 sun4i_backend.o
   6393        236           8    6637     19ed sun4i_tcon.o
   3700        368           8    4076      fec sun4i_tv.o
   1668        108           0    1776      6f0 sun6i_drc.o

and after the change:

   text       data         bss     dec     hex filename
   5274        228           8    5510    1586 sun4i_backend.o
   6401        228           8    6637    19ed sun4i_tcon.o
   3708        360           8    4076     fec sun4i_tv.o
   1676        100           0    1776     6f0 sun6i_drc.o

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1478971198-3659-1-git-send-email-Julia.Lawall@lip6.fr
drivers/gpu/drm/sun4i/sun4i_backend.c
drivers/gpu/drm/sun4i/sun4i_tcon.c
drivers/gpu/drm/sun4i/sun4i_tv.c
drivers/gpu/drm/sun4i/sun6i_drc.c

index 32c0584e3c3565bc31a77d8912d1c476dc905113..701fff8705f15698cdddf9a6c87f7304192d414c 100644 (file)
@@ -389,7 +389,7 @@ static void sun4i_backend_unbind(struct device *dev, struct device *master,
        reset_control_assert(backend->reset);
 }
 
-static struct component_ops sun4i_backend_ops = {
+static const struct component_ops sun4i_backend_ops = {
        .bind   = sun4i_backend_bind,
        .unbind = sun4i_backend_unbind,
 };
index cadacb517f958f3f910a0a594e1da1a89f4a9b5c..25674bcd6dd0a1c7c780ce2e35193d6502b1007f 100644 (file)
@@ -551,7 +551,7 @@ static void sun4i_tcon_unbind(struct device *dev, struct device *master,
        sun4i_tcon_free_clocks(tcon);
 }
 
-static struct component_ops sun4i_tcon_ops = {
+static const struct component_ops sun4i_tcon_ops = {
        .bind   = sun4i_tcon_bind,
        .unbind = sun4i_tcon_unbind,
 };
index 1dd3d9eabf2e5098c617d72001bdcc3a82737629..d430b331fed5c24395b8670070738160e3c76306 100644 (file)
@@ -667,7 +667,7 @@ static void sun4i_tv_unbind(struct device *dev, struct device *master,
        clk_disable_unprepare(tv->clk);
 }
 
-static struct component_ops sun4i_tv_ops = {
+static const struct component_ops sun4i_tv_ops = {
        .bind   = sun4i_tv_bind,
        .unbind = sun4i_tv_unbind,
 };
index bf6d846d81322e04cdb8755502b8eaac3b5f02f9..873b47967060929638a3b2ebafa7ee259db53e27 100644 (file)
@@ -80,7 +80,7 @@ static void sun6i_drc_unbind(struct device *dev, struct device *master,
        reset_control_assert(drc->reset);
 }
 
-static struct component_ops sun6i_drc_ops = {
+static const struct component_ops sun6i_drc_ops = {
        .bind   = sun6i_drc_bind,
        .unbind = sun6i_drc_unbind,
 };