2017-06-16 09:35:53

by Arvind Yadav

[permalink] [raw]
Subject: [PATCH] mtd: spi-nor: cqspi: make of_device_ids const

of_device_ids are not supposed to change at runtime. All functions
working with of_device_ids provided by <linux/of.h> work with const
of_device_ids. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <[email protected]>
---
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 9f8102d..1a25637 100644
--- a/drivers/mtd/spi-nor/cadence-quadspi.c
+++ b/drivers/mtd/spi-nor/cadence-quadspi.c
@@ -1277,7 +1277,7 @@ static int cqspi_resume(struct device *dev)
#define CQSPI_DEV_PM_OPS NULL
#endif

-static struct of_device_id const cqspi_dt_ids[] = {
+static const struct of_device_id const cqspi_dt_ids[] = {
{.compatible = "cdns,qspi-nor",},
{ /* end of table */ }
};
--
1.9.1


2017-06-16 10:28:49

by Marek Vasut

[permalink] [raw]
Subject: Re: [PATCH] mtd: spi-nor: cqspi: make of_device_ids const

On 06/16/2017 11:35 AM, Arvind Yadav wrote:
> of_device_ids are not supposed to change at runtime. All functions
> working with of_device_ids provided by <linux/of.h> work with const
> of_device_ids. So mark the non-const structs as const.
>
> Signed-off-by: Arvind Yadav <[email protected]>

Works for me
Reviewed-by: Marek Vasut <[email protected]>

> ---
> 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 9f8102d..1a25637 100644
> --- a/drivers/mtd/spi-nor/cadence-quadspi.c
> +++ b/drivers/mtd/spi-nor/cadence-quadspi.c
> @@ -1277,7 +1277,7 @@ static int cqspi_resume(struct device *dev)
> #define CQSPI_DEV_PM_OPS NULL
> #endif
>
> -static struct of_device_id const cqspi_dt_ids[] = {
> +static const struct of_device_id const cqspi_dt_ids[] = {
> {.compatible = "cdns,qspi-nor",},
> { /* end of table */ }
> };
>


--
Best regards,
Marek Vasut

2017-06-21 03:51:19

by Cyrille Pitchen

[permalink] [raw]
Subject: Re: [PATCH] mtd: spi-nor: cqspi: make of_device_ids const

Le 16/06/2017 à 12:27, Marek Vasut a écrit :
> On 06/16/2017 11:35 AM, Arvind Yadav wrote:
>> of_device_ids are not supposed to change at runtime. All functions
>> working with of_device_ids provided by <linux/of.h> work with const
>> of_device_ids. So mark the non-const structs as const.
>>
>> Signed-off-by: Arvind Yadav <[email protected]>
>
> Works for me
> Reviewed-by: Marek Vasut <[email protected]>
>

Applied to the spi-nor/next branch of l2-mtd

Thanks!

>> ---
>> 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 9f8102d..1a25637 100644
>> --- a/drivers/mtd/spi-nor/cadence-quadspi.c
>> +++ b/drivers/mtd/spi-nor/cadence-quadspi.c
>> @@ -1277,7 +1277,7 @@ static int cqspi_resume(struct device *dev)
>> #define CQSPI_DEV_PM_OPS NULL
>> #endif
>>
>> -static struct of_device_id const cqspi_dt_ids[] = {
>> +static const struct of_device_id const cqspi_dt_ids[] = {
>> {.compatible = "cdns,qspi-nor",},
>> { /* end of table */ }
>> };
>>
>
>