Skip to contentSkip to conversation

iio: mxs-lradc: Fix 'duplicate const' warning

PATCH Applied Fabio Estevam 3 participants 4 messages Feb 6, 2013 – Feb 9, 2013

Subsystems (4)
lore
Share & tools
lore

Fabio Estevam

author reviewer
#0 lore raw

PATCH 1/1 iio: mxs-lradc: Fix 'duplicate const' warning

From: Fabio Estevam <[email protected]>

The following warning is generated by sparse:

drivers/staging/iio/adc/mxs-lradc.c:118:47: warning: duplicate const

Remove the duplicate const.

---
 drivers/staging/iio/adc/mxs-lradc.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/iio/adc/mxs-lradc.c +1 -1
index 33a2747..55a459b 100644
@@ -115,7 +115,7 @@ struct mxs_lradc_of_config {
 	const char * const	*irq_name;
 };
 
-static const struct mxs_lradc_of_config const mxs_lradc_of_config[] = {
+static const struct mxs_lradc_of_config mxs_lradc_of_config[] = {
 	[IMX23_LRADC] = {
 		.irq_count	= ARRAY_SIZE(mx23_lradc_irq_names),
 		.irq_name	= mx23_lradc_irq_names,
Signature · 1 line
1.7.9.5
#1 lore raw

Dear Fabio Estevam,

Quoted 18 lines

From: Fabio Estevam <[email protected]>

The following warning is generated by sparse:

drivers/staging/iio/adc/mxs-lradc.c:118:47: warning: duplicate const

Remove the duplicate const.

---
 drivers/staging/iio/adc/mxs-lradc.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
(quoted diff) +0 -0

b/drivers/staging/iio/adc/mxs-lradc.c index 33a2747..55a459b 100644

drivers/staging/iio/adc/mxs-lradc.c struct mxs_lradc_of_config { · line 121

Quoted 8 lines
drivers/staging/iio/adc/mxs-lradc.c +1 -1
@@ -115,7 +115,7 @@ struct mxs_lradc_of_config {
 	const char * const	*irq_name;
 };
 
-static const struct mxs_lradc_of_config const mxs_lradc_of_config[] = {
+static const struct mxs_lradc_of_config mxs_lradc_of_config[] = {
 	[IMX23_LRADC] = {
 		.irq_count	= ARRAY_SIZE(mx23_lradc_irq_names),
 		.irq_name	= mx23_lradc_irq_names,

Isn't it const variable/array const array elements ... thus correct with the two consts ?

Best regards,
Marek Vasut

maintainer
#2 lore raw
Quoted 23 lines · Marek Vasut

Dear Fabio Estevam,

Quoted 21 lines

From: Fabio Estevam <[email protected]>

The following warning is generated by sparse:

drivers/staging/iio/adc/mxs-lradc.c:118:47: warning: duplicate const

Remove the duplicate const.

---
 drivers/staging/iio/adc/mxs-lradc.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
(quoted diff) +0 -0

b/drivers/staging/iio/adc/mxs-lradc.c index 33a2747..55a459b 100644

drivers/staging/iio/adc/mxs-lradc.c +0 -0
@@ -115,7 +115,7 @@ struct mxs_lradc_of_config {
 	const char * const	*irq_name;
 };
 
Quoted 8 lines

drivers/staging/iio/adc/mxs-lradc.c struct mxs_lradc_of_config { · line 121

Quoted 5 lines
drivers/staging/iio/adc/mxs-lradc.c +1 -1
-static const struct mxs_lradc_of_config const mxs_lradc_of_config[] = {
+static const struct mxs_lradc_of_config mxs_lradc_of_config[] = {
 	[IMX23_LRADC] = {
 		.irq_count	= ARRAY_SIZE(mx23_lradc_irq_names),
 		.irq_name	= mx23_lradc_irq_names,

Isn't it const variable/array const array elements ... thus correct with the two consts ?

Sadly not. c99 c.7.3.8 (first sentence)
or c11 c.7.3.9

If the specification of an array type includes any type qualifiers, the element type is so- qualified, not the array type.

I think that covers it though I'll admit I'm never that good at following these specs and got the reference from googling.

Jonathan

maintainer Applied
#3 lore raw
Quoted 5 lines · Jonathan Cameron
Quoted 4 lines · Marek Vasut

Dear Fabio Estevam,

Quoted 2 lines

From: Fabio Estevam <[email protected]>

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

The following warning is generated by sparse:

drivers/staging/iio/adc/mxs-lradc.c:118:47: warning: duplicate const

Remove the duplicate const.

applied to togreg branch of iio.git. Thanks,

Jonathan

Quoted 37 lines
Quoted 12 lines
Quoted 12 lines
---
 drivers/staging/iio/adc/mxs-lradc.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
(quoted diff) +0 -0

b/drivers/staging/iio/adc/mxs-lradc.c index 33a2747..55a459b 100644

drivers/staging/iio/adc/mxs-lradc.c +0 -0
@@ -115,7 +115,7 @@ struct mxs_lradc_of_config {
 	const char * const	*irq_name;
 };
 
Quoted 8 lines

drivers/staging/iio/adc/mxs-lradc.c struct mxs_lradc_of_config { · line 121

Quoted 5 lines
drivers/staging/iio/adc/mxs-lradc.c +1 -1
-static const struct mxs_lradc_of_config const mxs_lradc_of_config[] = {
+static const struct mxs_lradc_of_config mxs_lradc_of_config[] = {
 	[IMX23_LRADC] = {
 		.irq_count	= ARRAY_SIZE(mx23_lradc_irq_names),
 		.irq_name	= mx23_lradc_irq_names,

Isn't it const variable/array const array elements ... thus correct with the two consts ?

Sadly not. c99 c.7.3.8 (first sentence)
or c11 c.7.3.9

If the specification of an array type includes any type qualifiers, the element type is so- qualified, not the array type.

I think that covers it though I'll admit I'm never that good at following these specs and got the reference from googling.

Jonathan
--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html