All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mtd: spi-nor: cqspi: remove duplicate const
@ 2017-06-27 15:34 Arnd Bergmann
  2017-06-27 16:11 ` Marek Vasut
  0 siblings, 1 reply; 7+ messages in thread
From: Arnd Bergmann @ 2017-06-27 15:34 UTC (permalink / raw)
  To: Cyrille Pitchen, Marek Vasut, David Woodhouse, Brian Norris,
	Boris Brezillon, Richard Weinberger
  Cc: Arnd Bergmann, linux-mtd, linux-kernel

The variable was already marked 'const' before the previous
patch, but the qualifier was in an unusual place, and now the
extra 'const' causes a harmless warning:

drivers/mtd/spi-nor/cadence-quadspi.c:1286:34: error: duplicate 'const' declaration specifier [-Werror=duplicate-decl-specifier]

This removes the other 'const' instead.

Fixes: f993c123b461 ("mtd: spi-nor: cqspi: make of_device_ids const")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/mtd/spi-nor/cadence-quadspi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mtd/spi-nor/cadence-quadspi.c b/drivers/mtd/spi-nor/cadence-quadspi.c
index d315c326e72f..53c7d8e0327a 100644
--- a/drivers/mtd/spi-nor/cadence-quadspi.c
+++ b/drivers/mtd/spi-nor/cadence-quadspi.c
@@ -1283,7 +1283,7 @@ static const struct dev_pm_ops cqspi__dev_pm_ops = {
 #define CQSPI_DEV_PM_OPS	NULL
 #endif
 
-static const struct of_device_id const cqspi_dt_ids[] = {
+static const struct of_device_id cqspi_dt_ids[] = {
 	{.compatible = "cdns,qspi-nor",},
 	{ /* end of table */ }
 };
-- 
2.9.0

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] mtd: spi-nor: cqspi: remove duplicate const
  2017-06-27 15:34 [PATCH] mtd: spi-nor: cqspi: remove duplicate const Arnd Bergmann
@ 2017-06-27 16:11 ` Marek Vasut
  2017-06-27 19:48   ` Cyrille Pitchen
  0 siblings, 1 reply; 7+ messages in thread
From: Marek Vasut @ 2017-06-27 16:11 UTC (permalink / raw)
  To: Arnd Bergmann, Cyrille Pitchen, David Woodhouse, Brian Norris,
	Boris Brezillon, Richard Weinberger
  Cc: linux-mtd, linux-kernel

On 06/27/2017 05:34 PM, Arnd Bergmann wrote:
> The variable was already marked 'const' before the previous
> patch, but the qualifier was in an unusual place, and now the
> extra 'const' causes a harmless warning:
> 
> drivers/mtd/spi-nor/cadence-quadspi.c:1286:34: error: duplicate 'const' declaration specifier [-Werror=duplicate-decl-specifier]
> 
> This removes the other 'const' instead.

Isn't that const array const elements , thus two consts ?
IMO the original code is correct.

> Fixes: f993c123b461 ("mtd: spi-nor: cqspi: make of_device_ids const")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  drivers/mtd/spi-nor/cadence-quadspi.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/mtd/spi-nor/cadence-quadspi.c b/drivers/mtd/spi-nor/cadence-quadspi.c
> index d315c326e72f..53c7d8e0327a 100644
> --- a/drivers/mtd/spi-nor/cadence-quadspi.c
> +++ b/drivers/mtd/spi-nor/cadence-quadspi.c
> @@ -1283,7 +1283,7 @@ static const struct dev_pm_ops cqspi__dev_pm_ops = {
>  #define CQSPI_DEV_PM_OPS	NULL
>  #endif
>  
> -static const struct of_device_id const cqspi_dt_ids[] = {
> +static const struct of_device_id cqspi_dt_ids[] = {
>  	{.compatible = "cdns,qspi-nor",},
>  	{ /* end of table */ }
>  };
> 


-- 
Best regards,
Marek Vasut

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] mtd: spi-nor: cqspi: remove duplicate const
  2017-06-27 16:11 ` Marek Vasut
@ 2017-06-27 19:48   ` Cyrille Pitchen
  2017-06-27 19:51     ` Marek Vasut
  0 siblings, 1 reply; 7+ messages in thread
From: Cyrille Pitchen @ 2017-06-27 19:48 UTC (permalink / raw)
  To: Marek Vasut, Arnd Bergmann, David Woodhouse, Brian Norris,
	Boris Brezillon, Richard Weinberger
  Cc: linux-mtd, linux-kernel

Le 27/06/2017 à 18:11, Marek Vasut a écrit :
> On 06/27/2017 05:34 PM, Arnd Bergmann wrote:
>> The variable was already marked 'const' before the previous
>> patch, but the qualifier was in an unusual place, and now the
>> extra 'const' causes a harmless warning:
>>
>> drivers/mtd/spi-nor/cadence-quadspi.c:1286:34: error: duplicate 'const' declaration specifier [-Werror=duplicate-decl-specifier]
>>
>> This removes the other 'const' instead.
> 
> Isn't that const array const elements , thus two consts ?
> IMO the original code is correct.

Indeed the 2 'const' don't have the same meaning so the original code
may be correct but with an array like cqspi_dt_ids[] we can't write
"cqspi_dt_ids = (const struct of_device_id *)<right value>;" anyway.

So I think the 2nd 'const' is useless here then if this patch removes a
warning, let's apply it, right?

> 
>> Fixes: f993c123b461 ("mtd: spi-nor: cqspi: make of_device_ids const")
>> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>> ---
>>  drivers/mtd/spi-nor/cadence-quadspi.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/mtd/spi-nor/cadence-quadspi.c b/drivers/mtd/spi-nor/cadence-quadspi.c
>> index d315c326e72f..53c7d8e0327a 100644
>> --- a/drivers/mtd/spi-nor/cadence-quadspi.c
>> +++ b/drivers/mtd/spi-nor/cadence-quadspi.c
>> @@ -1283,7 +1283,7 @@ static const struct dev_pm_ops cqspi__dev_pm_ops = {
>>  #define CQSPI_DEV_PM_OPS	NULL
>>  #endif
>>  
>> -static const struct of_device_id const cqspi_dt_ids[] = {
>> +static const struct of_device_id cqspi_dt_ids[] = {
>>  	{.compatible = "cdns,qspi-nor",},
>>  	{ /* end of table */ }
>>  };
>>
> 
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] mtd: spi-nor: cqspi: remove duplicate const
  2017-06-27 19:48   ` Cyrille Pitchen
@ 2017-06-27 19:51     ` Marek Vasut
  2017-06-27 20:21       ` Cyrille Pitchen
  0 siblings, 1 reply; 7+ messages in thread
From: Marek Vasut @ 2017-06-27 19:51 UTC (permalink / raw)
  To: Cyrille Pitchen, Arnd Bergmann, David Woodhouse, Brian Norris,
	Boris Brezillon, Richard Weinberger
  Cc: linux-mtd, linux-kernel

On 06/27/2017 09:48 PM, Cyrille Pitchen wrote:
> Le 27/06/2017 à 18:11, Marek Vasut a écrit :
>> On 06/27/2017 05:34 PM, Arnd Bergmann wrote:
>>> The variable was already marked 'const' before the previous
>>> patch, but the qualifier was in an unusual place, and now the
>>> extra 'const' causes a harmless warning:
>>>
>>> drivers/mtd/spi-nor/cadence-quadspi.c:1286:34: error: duplicate 'const' declaration specifier [-Werror=duplicate-decl-specifier]
>>>
>>> This removes the other 'const' instead.
>>
>> Isn't that const array const elements , thus two consts ?
>> IMO the original code is correct.
> 
> Indeed the 2 'const' don't have the same meaning so the original code
> may be correct but with an array like cqspi_dt_ids[] we can't write
> "cqspi_dt_ids = (const struct of_device_id *)<right value>;" anyway.

Not sure I understand what you're trying to say here.

> So I think the 2nd 'const' is useless here then if this patch removes a
> warning, let's apply it, right?
> 
>>
>>> Fixes: f993c123b461 ("mtd: spi-nor: cqspi: make of_device_ids const")
>>> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>>> ---
>>>  drivers/mtd/spi-nor/cadence-quadspi.c | 2 +-
>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/mtd/spi-nor/cadence-quadspi.c b/drivers/mtd/spi-nor/cadence-quadspi.c
>>> index d315c326e72f..53c7d8e0327a 100644
>>> --- a/drivers/mtd/spi-nor/cadence-quadspi.c
>>> +++ b/drivers/mtd/spi-nor/cadence-quadspi.c
>>> @@ -1283,7 +1283,7 @@ static const struct dev_pm_ops cqspi__dev_pm_ops = {
>>>  #define CQSPI_DEV_PM_OPS	NULL
>>>  #endif
>>>  
>>> -static const struct of_device_id const cqspi_dt_ids[] = {
>>> +static const struct of_device_id cqspi_dt_ids[] = {
>>>  	{.compatible = "cdns,qspi-nor",},
>>>  	{ /* end of table */ }
>>>  };
>>>
>>
>>
> 


-- 
Best regards,
Marek Vasut

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] mtd: spi-nor: cqspi: remove duplicate const
  2017-06-27 19:51     ` Marek Vasut
@ 2017-06-27 20:21       ` Cyrille Pitchen
  2017-06-27 20:53         ` Marek Vasut
  0 siblings, 1 reply; 7+ messages in thread
From: Cyrille Pitchen @ 2017-06-27 20:21 UTC (permalink / raw)
  To: Marek Vasut, Arnd Bergmann, David Woodhouse, Brian Norris,
	Boris Brezillon, Richard Weinberger
  Cc: linux-mtd, linux-kernel

Le 27/06/2017 à 21:51, Marek Vasut a écrit :
> On 06/27/2017 09:48 PM, Cyrille Pitchen wrote:
>> Le 27/06/2017 à 18:11, Marek Vasut a écrit :
>>> On 06/27/2017 05:34 PM, Arnd Bergmann wrote:
>>>> The variable was already marked 'const' before the previous
>>>> patch, but the qualifier was in an unusual place, and now the
>>>> extra 'const' causes a harmless warning:
>>>>
>>>> drivers/mtd/spi-nor/cadence-quadspi.c:1286:34: error: duplicate 'const' declaration specifier [-Werror=duplicate-decl-specifier]
>>>>
>>>> This removes the other 'const' instead.
>>>
>>> Isn't that const array const elements , thus two consts ?
>>> IMO the original code is correct.
>>
>> Indeed the 2 'const' don't have the same meaning so the original code
>> may be correct but with an array like cqspi_dt_ids[] we can't write
>> "cqspi_dt_ids = (const struct of_device_id *)<right value>;" anyway.
> 
> Not sure I understand what you're trying to say here.
>

Just that once an array like cqspi_dt_ids[] has been defined, you can
never assign it a new value later:

cqspi_dt_ids = <new value>; /* that doesn't work */

For this specific point, an array behaves like a constant pointer (but
otherwise I agree that arrays and constant pointers are not the same
things). So I guess the 2nd 'const' could be considered as implicit :)



>> So I think the 2nd 'const' is useless here then if this patch removes a
>> warning, let's apply it, right?
>>
>>>
>>>> Fixes: f993c123b461 ("mtd: spi-nor: cqspi: make of_device_ids const")
>>>> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>>>> ---
>>>>  drivers/mtd/spi-nor/cadence-quadspi.c | 2 +-
>>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>>
>>>> diff --git a/drivers/mtd/spi-nor/cadence-quadspi.c b/drivers/mtd/spi-nor/cadence-quadspi.c
>>>> index d315c326e72f..53c7d8e0327a 100644
>>>> --- a/drivers/mtd/spi-nor/cadence-quadspi.c
>>>> +++ b/drivers/mtd/spi-nor/cadence-quadspi.c
>>>> @@ -1283,7 +1283,7 @@ static const struct dev_pm_ops cqspi__dev_pm_ops = {
>>>>  #define CQSPI_DEV_PM_OPS	NULL
>>>>  #endif
>>>>  
>>>> -static const struct of_device_id const cqspi_dt_ids[] = {
>>>> +static const struct of_device_id cqspi_dt_ids[] = {
>>>>  	{.compatible = "cdns,qspi-nor",},
>>>>  	{ /* end of table */ }
>>>>  };
>>>>
>>>
>>>
>>
> 
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] mtd: spi-nor: cqspi: remove duplicate const
  2017-06-27 20:21       ` Cyrille Pitchen
@ 2017-06-27 20:53         ` Marek Vasut
  2017-06-27 22:08           ` Cyrille Pitchen
  0 siblings, 1 reply; 7+ messages in thread
From: Marek Vasut @ 2017-06-27 20:53 UTC (permalink / raw)
  To: Cyrille Pitchen, Arnd Bergmann, David Woodhouse, Brian Norris,
	Boris Brezillon, Richard Weinberger
  Cc: linux-mtd, linux-kernel

On 06/27/2017 10:21 PM, Cyrille Pitchen wrote:
> Le 27/06/2017 à 21:51, Marek Vasut a écrit :
>> On 06/27/2017 09:48 PM, Cyrille Pitchen wrote:
>>> Le 27/06/2017 à 18:11, Marek Vasut a écrit :
>>>> On 06/27/2017 05:34 PM, Arnd Bergmann wrote:
>>>>> The variable was already marked 'const' before the previous
>>>>> patch, but the qualifier was in an unusual place, and now the
>>>>> extra 'const' causes a harmless warning:
>>>>>
>>>>> drivers/mtd/spi-nor/cadence-quadspi.c:1286:34: error: duplicate 'const' declaration specifier [-Werror=duplicate-decl-specifier]
>>>>>
>>>>> This removes the other 'const' instead.
>>>>
>>>> Isn't that const array const elements , thus two consts ?
>>>> IMO the original code is correct.
>>>
>>> Indeed the 2 'const' don't have the same meaning so the original code
>>> may be correct but with an array like cqspi_dt_ids[] we can't write
>>> "cqspi_dt_ids = (const struct of_device_id *)<right value>;" anyway.
>>
>> Not sure I understand what you're trying to say here.
>>
> 
> Just that once an array like cqspi_dt_ids[] has been defined, you can
> never assign it a new value later:
> 
> cqspi_dt_ids = <new value>; /* that doesn't work */
>
> For this specific point, an array behaves like a constant pointer (but
> otherwise I agree that arrays and constant pointers are not the same
> things). So I guess the 2nd 'const' could be considered as implicit :)

I had to think about this a little and I think what you're getting at is
something slightly different.

IIUC if this was array of pointers (which it is not), you'd need this
const Type *const name[] , but since this is array of Type , you can do
with const Type name[] and the whole thing is implicitly const.

But in that case:
Acked-by: Marek Vasut <marek.vasut@gmail.com>

>>> So I think the 2nd 'const' is useless here then if this patch removes a
>>> warning, let's apply it, right?
>>>
>>>>
>>>>> Fixes: f993c123b461 ("mtd: spi-nor: cqspi: make of_device_ids const")
>>>>> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>>>>> ---
>>>>>  drivers/mtd/spi-nor/cadence-quadspi.c | 2 +-
>>>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>>>
>>>>> diff --git a/drivers/mtd/spi-nor/cadence-quadspi.c b/drivers/mtd/spi-nor/cadence-quadspi.c
>>>>> index d315c326e72f..53c7d8e0327a 100644
>>>>> --- a/drivers/mtd/spi-nor/cadence-quadspi.c
>>>>> +++ b/drivers/mtd/spi-nor/cadence-quadspi.c
>>>>> @@ -1283,7 +1283,7 @@ static const struct dev_pm_ops cqspi__dev_pm_ops = {
>>>>>  #define CQSPI_DEV_PM_OPS	NULL
>>>>>  #endif
>>>>>  
>>>>> -static const struct of_device_id const cqspi_dt_ids[] = {
>>>>> +static const struct of_device_id cqspi_dt_ids[] = {
>>>>>  	{.compatible = "cdns,qspi-nor",},
>>>>>  	{ /* end of table */ }
>>>>>  };
>>>>>
>>>>
>>>>
>>>
>>
>>
> 


-- 
Best regards,
Marek Vasut

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] mtd: spi-nor: cqspi: remove duplicate const
  2017-06-27 20:53         ` Marek Vasut
@ 2017-06-27 22:08           ` Cyrille Pitchen
  0 siblings, 0 replies; 7+ messages in thread
From: Cyrille Pitchen @ 2017-06-27 22:08 UTC (permalink / raw)
  To: Marek Vasut, Arnd Bergmann, David Woodhouse, Brian Norris,
	Boris Brezillon, Richard Weinberger
  Cc: linux-mtd, linux-kernel

Le 27/06/2017 à 22:53, Marek Vasut a écrit :
> On 06/27/2017 10:21 PM, Cyrille Pitchen wrote:
>> Le 27/06/2017 à 21:51, Marek Vasut a écrit :
>>> On 06/27/2017 09:48 PM, Cyrille Pitchen wrote:
>>>> Le 27/06/2017 à 18:11, Marek Vasut a écrit :
>>>>> On 06/27/2017 05:34 PM, Arnd Bergmann wrote:
>>>>>> The variable was already marked 'const' before the previous
>>>>>> patch, but the qualifier was in an unusual place, and now the
>>>>>> extra 'const' causes a harmless warning:
>>>>>>
>>>>>> drivers/mtd/spi-nor/cadence-quadspi.c:1286:34: error: duplicate 'const' declaration specifier [-Werror=duplicate-decl-specifier]
>>>>>>
>>>>>> This removes the other 'const' instead.
>>>>>
>>>>> Isn't that const array const elements , thus two consts ?
>>>>> IMO the original code is correct.
>>>>
>>>> Indeed the 2 'const' don't have the same meaning so the original code
>>>> may be correct but with an array like cqspi_dt_ids[] we can't write
>>>> "cqspi_dt_ids = (const struct of_device_id *)<right value>;" anyway.
>>>
>>> Not sure I understand what you're trying to say here.
>>>
>>
>> Just that once an array like cqspi_dt_ids[] has been defined, you can
>> never assign it a new value later:
>>
>> cqspi_dt_ids = <new value>; /* that doesn't work */
>>
>> For this specific point, an array behaves like a constant pointer (but
>> otherwise I agree that arrays and constant pointers are not the same
>> things). So I guess the 2nd 'const' could be considered as implicit :)
> 
> I had to think about this a little and I think what you're getting at is
> something slightly different.

Indeed, you're right, I've misunderstood the 2nd 'const' ;)

So this time if I understand correctly, patch f993c123b461 was actually
useless since the elements of the array were already constant before
that patch, the syntax "Type const array[] = {...};" being equivalent to
"const Type array[] = {...};"

Anyway, the issue is fixed :)

> 
> IIUC if this was array of pointers (which it is not), you'd need this
> const Type *const name[] , but since this is array of Type , you can do
> with const Type name[] and the whole thing is implicitly const.
> 
> But in that case:
> Acked-by: Marek Vasut <marek.vasut@gmail.com>
> 
>>>> So I think the 2nd 'const' is useless here then if this patch removes a
>>>> warning, let's apply it, right?
>>>>
>>>>>
>>>>>> Fixes: f993c123b461 ("mtd: spi-nor: cqspi: make of_device_ids const")
>>>>>> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>>>>>> ---
>>>>>>  drivers/mtd/spi-nor/cadence-quadspi.c | 2 +-
>>>>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>>>>
>>>>>> diff --git a/drivers/mtd/spi-nor/cadence-quadspi.c b/drivers/mtd/spi-nor/cadence-quadspi.c
>>>>>> index d315c326e72f..53c7d8e0327a 100644
>>>>>> --- a/drivers/mtd/spi-nor/cadence-quadspi.c
>>>>>> +++ b/drivers/mtd/spi-nor/cadence-quadspi.c
>>>>>> @@ -1283,7 +1283,7 @@ static const struct dev_pm_ops cqspi__dev_pm_ops = {
>>>>>>  #define CQSPI_DEV_PM_OPS	NULL
>>>>>>  #endif
>>>>>>  
>>>>>> -static const struct of_device_id const cqspi_dt_ids[] = {
>>>>>> +static const struct of_device_id cqspi_dt_ids[] = {
>>>>>>  	{.compatible = "cdns,qspi-nor",},
>>>>>>  	{ /* end of table */ }
>>>>>>  };
>>>>>>
>>>>>
>>>>>
>>>>
>>>
>>>
>>
> 
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2017-06-27 22:15 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-27 15:34 [PATCH] mtd: spi-nor: cqspi: remove duplicate const Arnd Bergmann
2017-06-27 16:11 ` Marek Vasut
2017-06-27 19:48   ` Cyrille Pitchen
2017-06-27 19:51     ` Marek Vasut
2017-06-27 20:21       ` Cyrille Pitchen
2017-06-27 20:53         ` Marek Vasut
2017-06-27 22:08           ` Cyrille Pitchen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.