* [PATCH] pcmcia: make Open Firmware device id constant
@ 2010-01-12 7:56 Németh Márton
2010-01-12 9:07 ` Wolfram Sang
0 siblings, 1 reply; 2+ messages in thread
From: Németh Márton @ 2010-01-12 7:56 UTC (permalink / raw)
To: linux-pcmcia; +Cc: LKML, Julia Lawall, cocci
From: Márton Németh <nm127@freemail.hu>
The match_table field of the struct of_device_id is constant in <linux/of_platform.h>
so it is worth to make the initialization data also constant.
The semantic match that finds this kind of pattern is as follows:
(http://coccinelle.lip6.fr/)
// <smpl>
@r@
disable decl_init,const_decl_init;
identifier I1, I2, x;
@@
struct I1 {
...
const struct I2 *x;
...
};
@s@
identifier r.I1, y;
identifier r.x, E;
@@
struct I1 y = {
.x = E,
};
@c@
identifier r.I2;
identifier s.E;
@@
const struct I2 E[] = ... ;
@depends on !c@
identifier r.I2;
identifier s.E;
@@
+ const
struct I2 E[] = ...;
// </smpl>
Signed-off-by: Márton Németh <nm127@freemail.hu>
Cc: Julia Lawall <julia@diku.dk>
Cc: cocci@diku.dk
---
diff -u -p a/drivers/pcmcia/electra_cf.c b/drivers/pcmcia/electra_cf.c
--- a/drivers/pcmcia/electra_cf.c 2009-12-03 04:51:21.000000000 +0100
+++ b/drivers/pcmcia/electra_cf.c 2010-01-08 14:35:41.000000000 +0100
@@ -347,7 +347,7 @@ static int __devexit electra_cf_remove(s
return 0;
}
-static struct of_device_id electra_cf_match[] = {
+static const struct of_device_id electra_cf_match[] = {
{
.compatible = "electra-cf",
},
diff -u -p a/drivers/pcmcia/m8xx_pcmcia.c b/drivers/pcmcia/m8xx_pcmcia.c
--- a/drivers/pcmcia/m8xx_pcmcia.c 2010-01-07 19:08:44.000000000 +0100
+++ b/drivers/pcmcia/m8xx_pcmcia.c 2010-01-08 14:36:19.000000000 +0100
@@ -1303,7 +1303,7 @@ static int m8xx_resume(struct platform_d
#define m8xx_resume NULL
#endif
-static struct of_device_id m8xx_pcmcia_match[] = {
+static const struct of_device_id m8xx_pcmcia_match[] = {
{
.type = "pcmcia",
.compatible = "fsl,pq-pcmcia",
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] pcmcia: make Open Firmware device id constant
2010-01-12 7:56 [PATCH] pcmcia: make Open Firmware device id constant Németh Márton
@ 2010-01-12 9:07 ` Wolfram Sang
0 siblings, 0 replies; 2+ messages in thread
From: Wolfram Sang @ 2010-01-12 9:07 UTC (permalink / raw)
To: Németh Márton; +Cc: linux-pcmcia, Julia Lawall, LKML, cocci
[-- Attachment #1: Type: text/plain, Size: 590 bytes --]
On Tue, Jan 12, 2010 at 08:56:13AM +0100, Németh Márton wrote:
> From: Márton Németh <nm127@freemail.hu>
>
> The match_table field of the struct of_device_id is constant in <linux/of_platform.h>
> so it is worth to make the initialization data also constant.
[...]
> Signed-off-by: Márton Németh <nm127@freemail.hu>
> Cc: Julia Lawall <julia@diku.dk>
> Cc: cocci@diku.dk
Acked-by: Wolfram Sang <w.sang@pengutronix.de>
--
Pengutronix e.K. | Wolfram Sang |
Industrial Linux Solutions | http://www.pengutronix.de/ |
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-01-12 9:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-12 7:56 [PATCH] pcmcia: make Open Firmware device id constant Németh Márton
2010-01-12 9:07 ` Wolfram Sang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox