Skip to contentSkip to conversation

gspca: make sd_desc const

PATCH New Németh Márton 1 participant 1 message Dec 30, 2009 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gspca: make sd_desc const

From: Márton Németh <[email protected]>

The function callbacks in sd_desc are defined at compile time and they do not change at runtime. Make the sd_desc initializations const.

The semantic match that finds this kind of pattern is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@c@
identifier x;
@@

	static const struct sd_desc x = ...;

@depends on !c@
identifier x;
@@
static
+ const

	struct sd_desc x = ...;

// </smpl>

---

linux/drivers/media/video/gspca/conex.c +1 -1
diff -r 62ee2b0f6556 linux/drivers/media/video/gspca/conex.c
@@ -1032,7 +1032,7 @@
 }
 
 /* sub-driver description */
-static struct sd_desc sd_desc = {
+static const struct sd_desc sd_desc = {
 	.name = MODULE_NAME,
 	.ctrls = sd_ctrls,
 	.nctrls = ARRAY_SIZE(sd_ctrls),
linux/drivers/media/video/gspca/etoms.c +1 -1
diff -r 62ee2b0f6556 linux/drivers/media/video/gspca/etoms.c
@@ -857,7 +857,7 @@
 }
 
 /* sub-driver description */
-static struct sd_desc sd_desc = {
+static const struct sd_desc sd_desc = {
 	.name = MODULE_NAME,
 	.ctrls = sd_ctrls,
 	.nctrls = ARRAY_SIZE(sd_ctrls),
linux/drivers/media/video/gspca/gl860/gl860.c +5 -5
diff -r 62ee2b0f6556 linux/drivers/media/video/gspca/gl860/gl860.c
@@ -161,7 +161,7 @@
 
 /*==================== sud-driver structure initialisation =================*/
 
-static struct sd_desc sd_desc_mi1320 = {
+static const struct sd_desc sd_desc_mi1320 = {
 	.name        = MODULE_NAME,
 	.ctrls       = sd_ctrls_mi1320,
 	.nctrls      = GL860_NCTRLS,
@@ -174,7 +174,7 @@
 	.dq_callback = sd_callback,
 };
 
-static struct sd_desc sd_desc_mi2020 = {
+static const struct sd_desc sd_desc_mi2020 = {
 	.name        = MODULE_NAME,
 	.ctrls       = sd_ctrls_mi2020,
 	.nctrls      = GL860_NCTRLS,
@@ -187,7 +187,7 @@
 	.dq_callback = sd_callback,
 };
 
-static struct sd_desc sd_desc_mi2020b = {
+static const struct sd_desc sd_desc_mi2020b = {
 	.name        = MODULE_NAME,
 	.ctrls       = sd_ctrls_mi2020b,
 	.nctrls      = GL860_NCTRLS,
@@ -200,7 +200,7 @@
 	.dq_callback = sd_callback,
 };
 
-static struct sd_desc sd_desc_ov2640 = {
+static const struct sd_desc sd_desc_ov2640 = {
 	.name        = MODULE_NAME,
 	.ctrls       = sd_ctrls_ov2640,
 	.nctrls      = GL860_NCTRLS,
@@ -213,7 +213,7 @@
 	.dq_callback = sd_callback,
 };
 
-static struct sd_desc sd_desc_ov9655 = {
+static const struct sd_desc sd_desc_ov9655 = {
 	.name        = MODULE_NAME,
 	.ctrls       = sd_ctrls_ov9655,
 	.nctrls      = GL860_NCTRLS,
linux/drivers/media/video/gspca/pac7302.c +1 -1
diff -r 62ee2b0f6556 linux/drivers/media/video/gspca/pac7302.c
@@ -1232,7 +1232,7 @@
 #endif
 
 /* sub-driver description for pac7302 */
-static struct sd_desc sd_desc = {
+static const struct sd_desc sd_desc = {
 	.name = MODULE_NAME,
 	.ctrls = sd_ctrls,
 	.nctrls = ARRAY_SIZE(sd_ctrls),
linux/drivers/media/video/gspca/pac7311.c +1 -1
diff -r 62ee2b0f6556 linux/drivers/media/video/gspca/pac7311.c
@@ -870,7 +870,7 @@
 }
 
 /* sub-driver description for pac7311 */
-static struct sd_desc sd_desc = {
+static const struct sd_desc sd_desc = {
 	.name = MODULE_NAME,
 	.ctrls = sd_ctrls,
 	.nctrls = ARRAY_SIZE(sd_ctrls),
linux/drivers/media/video/gspca/spca500.c +1 -1
diff -r 62ee2b0f6556 linux/drivers/media/video/gspca/spca500.c
@@ -1064,7 +1064,7 @@
 }
 
 /* sub-driver description */
-static struct sd_desc sd_desc = {
+static const struct sd_desc sd_desc = {
 	.name = MODULE_NAME,
 	.ctrls = sd_ctrls,
 	.nctrls = ARRAY_SIZE(sd_ctrls),
linux/drivers/media/video/gspca/spca506.c +1 -1
diff -r 62ee2b0f6556 linux/drivers/media/video/gspca/spca506.c
@@ -673,7 +673,7 @@
 }
 
 /* sub-driver description */
-static struct sd_desc sd_desc = {
+static const struct sd_desc sd_desc = {
 	.name = MODULE_NAME,
 	.ctrls = sd_ctrls,
 	.nctrls = ARRAY_SIZE(sd_ctrls),