Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1350735 > unrolled thread

Re: [PATCH v5 09/26] mtd: nand: omap: Clean up device tree support

Started byBrian Norris <computersforpeace@gmail.com>
First post2016-03-05 03:20 +0100
Last post2016-03-07 10:10 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH v5 09/26] mtd: nand: omap: Clean up device tree support Brian Norris <computersforpeace@gmail.com> - 2016-03-05 03:20 +0100
    Re: [PATCH v5 09/26] mtd: nand: omap: Clean up device tree support Roger Quadros <rogerq@ti.com> - 2016-03-07 10:10 +0100

#1350735 — Re: [PATCH v5 09/26] mtd: nand: omap: Clean up device tree support

FromBrian Norris <computersforpeace@gmail.com>
Date2016-03-05 03:20 +0100
SubjectRe: [PATCH v5 09/26] mtd: nand: omap: Clean up device tree support
Message-ID<r99YZ-7Kj-7@gated-at.bofh.it>
A couple of sparse warnings.

On Fri, Feb 19, 2016 at 11:15:31PM +0200, Roger Quadros wrote:
> Move NAND specific device tree parsing to NAND driver.
> 
> The NAND controller node must have a compatible id, register space
> resource and interrupt resource.
> 
> Signed-off-by: Roger Quadros <rogerq@ti.com>
> ---
>  arch/arm/mach-omap2/gpmc-nand.c              |   5 +-
>  drivers/memory/omap-gpmc.c                   | 143 +++++++--------------------
>  drivers/mtd/nand/omap2.c                     | 133 +++++++++++++++++++++----
>  include/linux/platform_data/mtd-nand-omap2.h |   3 +-
>  4 files changed, 152 insertions(+), 132 deletions(-)
> 
> diff --git a/arch/arm/mach-omap2/gpmc-nand.c b/arch/arm/mach-omap2/gpmc-nand.c
> index 04e6998..f6ac027 100644
> --- a/arch/arm/mach-omap2/gpmc-nand.c
> +++ b/arch/arm/mach-omap2/gpmc-nand.c

[...]

> @@ -2039,9 +1939,42 @@ static int gpmc_probe_generic_child(struct platform_device *pdev,
>  		goto err;
>  	}
>  
> -	ret = of_property_read_u32(child, "bank-width", &gpmc_s.device_width);
> -	if (ret < 0)
> -		goto err;
> +	if (of_node_cmp(child->name, "nand") == 0) {
> +		/* NAND specific setup */
> +		u32 val;

drivers/memory/omap-gpmc.c:1952:13: originally declared here [sparse]
drivers/memory/omap-gpmc.c:2029:21: warning: symbol 'val' shadows an earlier one [sparse]

> +
> +		/* Warn about older DT blobs with no compatible property */
> +		if (!of_property_read_bool(child, "compatible")) {
> +			dev_warn(&pdev->dev,
> +				 "Incompatible NAND node: missing compatible");
> +			ret = -EINVAL;
> +			goto err;
> +		}
> +

[...]

> diff --git a/drivers/mtd/nand/omap2.c b/drivers/mtd/nand/omap2.c
> index 9e99199..0a637c4 100644
> --- a/drivers/mtd/nand/omap2.c
> +++ b/drivers/mtd/nand/omap2.c

[...]

> +static int omap_get_dt_info(struct device *dev, struct omap_nand_info *info)
> +{
> +	struct device_node *child = dev->of_node;
> +	int i;
> +	const char *s;
> +
> +	/* In old bindings, CS num is embedded in reg property */
> +	if (of_property_read_u32(child, "reg", &info->gpmc_cs) < 0) {

Sparse doesn't like this one:

drivers/mtd/nand/omap2.c:1660:49: warning: incorrect type in argument 3 (different signedness) [sparse]
drivers/mtd/nand/omap2.c:1660:49:    expected unsigned int [usertype] *out_value [sparse]
drivers/mtd/nand/omap2.c:1660:49:    got int *<noident> [sparse]

> +		dev_err(dev, "reg not found in DT\n");
> +		return -EINVAL;
> +	}
> +

[...]

Brian 

[toc] | [next] | [standalone]


#1351411

FromRoger Quadros <rogerq@ti.com>
Date2016-03-07 10:10 +0100
Message-ID<r9ZkS-QT-3@gated-at.bofh.it>
In reply to#1350735
On 05/03/16 04:10, Brian Norris wrote:
> A couple of sparse warnings.
> 
> On Fri, Feb 19, 2016 at 11:15:31PM +0200, Roger Quadros wrote:
>> Move NAND specific device tree parsing to NAND driver.
>>
>> The NAND controller node must have a compatible id, register space
>> resource and interrupt resource.
>>
>> Signed-off-by: Roger Quadros <rogerq@ti.com>
>> ---
>>  arch/arm/mach-omap2/gpmc-nand.c              |   5 +-
>>  drivers/memory/omap-gpmc.c                   | 143 +++++++--------------------
>>  drivers/mtd/nand/omap2.c                     | 133 +++++++++++++++++++++----
>>  include/linux/platform_data/mtd-nand-omap2.h |   3 +-
>>  4 files changed, 152 insertions(+), 132 deletions(-)
>>
>> diff --git a/arch/arm/mach-omap2/gpmc-nand.c b/arch/arm/mach-omap2/gpmc-nand.c
>> index 04e6998..f6ac027 100644
>> --- a/arch/arm/mach-omap2/gpmc-nand.c
>> +++ b/arch/arm/mach-omap2/gpmc-nand.c
> 
> [...]
> 
>> @@ -2039,9 +1939,42 @@ static int gpmc_probe_generic_child(struct platform_device *pdev,
>>  		goto err;
>>  	}
>>  
>> -	ret = of_property_read_u32(child, "bank-width", &gpmc_s.device_width);
>> -	if (ret < 0)
>> -		goto err;
>> +	if (of_node_cmp(child->name, "nand") == 0) {
>> +		/* NAND specific setup */
>> +		u32 val;
> 
> drivers/memory/omap-gpmc.c:1952:13: originally declared here [sparse]
> drivers/memory/omap-gpmc.c:2029:21: warning: symbol 'val' shadows an earlier one [sparse]

I'll get rid of this duplicate val.
> 
>> +
>> +		/* Warn about older DT blobs with no compatible property */
>> +		if (!of_property_read_bool(child, "compatible")) {
>> +			dev_warn(&pdev->dev,
>> +				 "Incompatible NAND node: missing compatible");
>> +			ret = -EINVAL;
>> +			goto err;
>> +		}
>> +
> 
> [...]
> 
>> diff --git a/drivers/mtd/nand/omap2.c b/drivers/mtd/nand/omap2.c
>> index 9e99199..0a637c4 100644
>> --- a/drivers/mtd/nand/omap2.c
>> +++ b/drivers/mtd/nand/omap2.c
> 
> [...]
> 
>> +static int omap_get_dt_info(struct device *dev, struct omap_nand_info *info)
>> +{
>> +	struct device_node *child = dev->of_node;
>> +	int i;
>> +	const char *s;
>> +
>> +	/* In old bindings, CS num is embedded in reg property */
>> +	if (of_property_read_u32(child, "reg", &info->gpmc_cs) < 0) {
> 
> Sparse doesn't like this one:
> 
> drivers/mtd/nand/omap2.c:1660:49: warning: incorrect type in argument 3 (different signedness) [sparse]
> drivers/mtd/nand/omap2.c:1660:49:    expected unsigned int [usertype] *out_value [sparse]
> drivers/mtd/nand/omap2.c:1660:49:    got int *<noident> [sparse]

I'll use a temporary unsigned int variable instead.

> 
>> +		dev_err(dev, "reg not found in DT\n");
>> +		return -EINVAL;
>> +	}
>> +
> 
> [...]
> 

cheers,
-roger

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web