mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Bhumika Goyal <bhumirks@gmail.com>
To: julia.lawall@lip6.fr, eric.y.miao@gmail.com,
	haojian.zhuang@gmail.com, linux@armlinux.org.uk,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Cc: Bhumika Goyal <bhumirks@gmail.com>
Subject: [PATCH] ARM: mmp: make matrix_keymap_data const
Date: Mon, 21 Aug 2017 19:29:30 +0530	[thread overview]
Message-ID: <1503323970-31939-1-git-send-email-bhumirks@gmail.com> (raw)

Make these const as they are only stored in the matrix_keymap_data field
of a pxa27x_keypad_platform_data structure, which is const.
Done using Coccinelle:

@match disable optional_qualifier@
identifier s;
@@
static struct matrix_keymap_data s = {...};

@ref@
position p;
identifier match.s;
@@
s@p

@good1@
identifier y;
position ref.p;
identifier match.s;
@@
struct matrix_keypad_platform_data y = {...,.keymap_data=&s@p,...};

@good2@
struct matrix_keypad_platform_data y;
identifier match.s;
position ref.p;
@@
y.keymap_data = &s@p

@good3@
identifier y;
position ref.p;
identifier match.s;
@@
struct pxa27x_keypad_platform_data y =
{...,.matrix_keymap_data=&s@p,...};

@good4@
struct pxa27x_keypad_platform_data y;
identifier match.s;
position ref.p;
@@
y.matrix_keymap_data = &s@p

@bad depends on  !good1 && !good2 && !good3 && !good4@
position ref.p;
identifier match.s;
@@
s@p

@depends on forall !bad disable optional_qualifier@
identifier match.s;
@@
static
+ const
struct matrix_keymap_data s;

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
---
 arch/arm/mach-mmp/aspenite.c  | 2 +-
 arch/arm/mach-mmp/teton_bga.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-mmp/aspenite.c b/arch/arm/mach-mmp/aspenite.c
index 5db0edf..a285951 100644
--- a/arch/arm/mach-mmp/aspenite.c
+++ b/arch/arm/mach-mmp/aspenite.c
@@ -219,7 +219,7 @@ struct pxa168fb_mach_info aspenite_lcd_info = {
 	KEY(4, 7, KEY_ESC),	/* SW 9 */
 };
 
-static struct matrix_keymap_data aspenite_matrix_keymap_data = {
+static const struct matrix_keymap_data aspenite_matrix_keymap_data = {
 	.keymap			= aspenite_matrix_key_map,
 	.keymap_size		= ARRAY_SIZE(aspenite_matrix_key_map),
 };
diff --git a/arch/arm/mach-mmp/teton_bga.c b/arch/arm/mach-mmp/teton_bga.c
index cf038eb..d16010d 100644
--- a/arch/arm/mach-mmp/teton_bga.c
+++ b/arch/arm/mach-mmp/teton_bga.c
@@ -61,7 +61,7 @@
 	KEY(1, 7, KEY_RIGHT),
 };
 
-static struct matrix_keymap_data teton_bga_matrix_keymap_data = {
+static const struct matrix_keymap_data teton_bga_matrix_keymap_data = {
 	.keymap			= teton_bga_matrix_key_map,
 	.keymap_size		= ARRAY_SIZE(teton_bga_matrix_key_map),
 };
-- 
1.9.1

                 reply	other threads:[~2017-08-21 13:59 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1503323970-31939-1-git-send-email-bhumirks@gmail.com \
    --to=bhumirks@gmail.com \
    --cc=eric.y.miao@gmail.com \
    --cc=haojian.zhuang@gmail.com \
    --cc=julia.lawall@lip6.fr \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®