All of lore.kernel.org
 help / color / mirror / Atom feed
* sparse problem with duplicate __iomem?
@ 2020-08-18 18:09 Randy Dunlap
  2020-08-18 19:23 ` Luc Van Oostenryck
  0 siblings, 1 reply; 3+ messages in thread
From: Randy Dunlap @ 2020-08-18 18:09 UTC (permalink / raw)
  To: Linux-Sparse, Luc Van Oostenryck

Hi,

On kernel 5.9-rc1, either i386 or x86_64 builds, I am seeing these
sparse warnings:

../drivers/gpu/drm/ast/ast_cursor.c:256:26: CK: warning: duplicate [noderef]
../drivers/gpu/drm/ast/ast_cursor.c:256:26: CK: error: multiple address space given: __iomem & __iomem

for this source line:

	u8 __iomem *dst, __iomem *sig;


Should one of those __iomem-s be removed?
I.e., does "__iomem" apply to everything after it, up to the ending ';',
or just up to the next comma ','? 


thanks.
-- 
~Randy


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

* Re: sparse problem with duplicate __iomem?
  2020-08-18 18:09 sparse problem with duplicate __iomem? Randy Dunlap
@ 2020-08-18 19:23 ` Luc Van Oostenryck
  2020-08-18 20:11   ` Randy Dunlap
  0 siblings, 1 reply; 3+ messages in thread
From: Luc Van Oostenryck @ 2020-08-18 19:23 UTC (permalink / raw)
  To: Randy Dunlap; +Cc: Linux-Sparse

On Tue, Aug 18, 2020 at 11:09:52AM -0700, Randy Dunlap wrote:
> Hi,
> 
> On kernel 5.9-rc1, either i386 or x86_64 builds, I am seeing these
> sparse warnings:
> 
> ../drivers/gpu/drm/ast/ast_cursor.c:256:26: CK: warning: duplicate [noderef]
> ../drivers/gpu/drm/ast/ast_cursor.c:256:26: CK: error: multiple address space given: __iomem & __iomem
> 
> for this source line:
> 
> 	u8 __iomem *dst, __iomem *sig;
> 
> 
> Should one of those __iomem-s be removed?

I think so. It's a bit like writing
	int const *a, const *b;
or
	int unsigned *a, unsigned *b;

> I.e., does "__iomem" apply to everything after it, up to the ending ';',
> or just up to the next comma ','? 

The (simplified) syntax for declarations is:
	declaration:
		declaration-specifiers [init-declarator-list] ;
	init-declarator-list:
		init-declarator
		init-declarator-list , init-declarator
	init-declarator
		declarator
		declarator = initializer
	declarator:
		[pointer] direct-declarator
	pointer:
		* [type-qualifier-list]
		* [type-qualifier-list] pointer
	direct-declarator:
		identifier
		...

Essentially, attributes are type modifiers, some acting like
qualifiers and others are more like specifiers. But qualifiers
and specifiers are never allowed directly after the comma because
they appertain to the declaration-specifier part of the declaration.
So, yes, the first __iomem applies to the whole declaration and
the second one should be removed.

But maybe it's not 100% clear and the best should be to use a
separate declaration for each variable?

Best regards,
-- Luc

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

* Re: sparse problem with duplicate __iomem?
  2020-08-18 19:23 ` Luc Van Oostenryck
@ 2020-08-18 20:11   ` Randy Dunlap
  0 siblings, 0 replies; 3+ messages in thread
From: Randy Dunlap @ 2020-08-18 20:11 UTC (permalink / raw)
  To: Luc Van Oostenryck; +Cc: Linux-Sparse

On 8/18/20 12:23 PM, Luc Van Oostenryck wrote:
> On Tue, Aug 18, 2020 at 11:09:52AM -0700, Randy Dunlap wrote:
>> Hi,
>>
>> On kernel 5.9-rc1, either i386 or x86_64 builds, I am seeing these
>> sparse warnings:
>>
>> ../drivers/gpu/drm/ast/ast_cursor.c:256:26: CK: warning: duplicate [noderef]
>> ../drivers/gpu/drm/ast/ast_cursor.c:256:26: CK: error: multiple address space given: __iomem & __iomem
>>
>> for this source line:
>>
>> 	u8 __iomem *dst, __iomem *sig;
>>
>>
>> Should one of those __iomem-s be removed?
> 
> I think so. It's a bit like writing
> 	int const *a, const *b;
> or
> 	int unsigned *a, unsigned *b;
> 
>> I.e., does "__iomem" apply to everything after it, up to the ending ';',
>> or just up to the next comma ','? 
> 
> The (simplified) syntax for declarations is:
> 	declaration:
> 		declaration-specifiers [init-declarator-list] ;
> 	init-declarator-list:
> 		init-declarator
> 		init-declarator-list , init-declarator
> 	init-declarator
> 		declarator
> 		declarator = initializer
> 	declarator:
> 		[pointer] direct-declarator
> 	pointer:
> 		* [type-qualifier-list]
> 		* [type-qualifier-list] pointer
> 	direct-declarator:
> 		identifier
> 		...
> 
> Essentially, attributes are type modifiers, some acting like
> qualifiers and others are more like specifiers. But qualifiers
> and specifiers are never allowed directly after the comma because
> they appertain to the declaration-specifier part of the declaration.
> So, yes, the first __iomem applies to the whole declaration and
> the second one should be removed.
> 
> But maybe it's not 100% clear and the best should be to use a
> separate declaration for each variable?

Yes, that was my patch plan. :)

Thanks for the explanation.

-- 
~Randy


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

end of thread, other threads:[~2020-08-18 20:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-18 18:09 sparse problem with duplicate __iomem? Randy Dunlap
2020-08-18 19:23 ` Luc Van Oostenryck
2020-08-18 20:11   ` Randy Dunlap

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.