On Tue, Feb 09, 2010 at 05:52:23PM +0100, Uwe Kleine-König wrote: > [Added linux-sparse@xxxxxxxxxxxxxxx to Cc:] > > On Tue, Feb 09, 2010 at 09:59:34AM +0000, Russell King - ARM Linux wrote: > > On Tue, Feb 09, 2010 at 10:31:29AM +0100, Uwe Kleine-König wrote: > > > > +#define io_p2v(x) ((void __iomem *) (unsigned long) IO_ADDRESS(x)) > > > Is this cast to unsigned long needed? AFAIK IO_ADDRESS(x) has > > > type unsigned for x in { 0x0 ... 0xffffffff } (provided that int uses a > > > 32 bit 2s-complement representation). If unsigned long is really > > > needed, maybe put it into the IO_ADDRESS macro? > > > > int -> void __iomem * = sparse warning > > unsigned long -> void __iomem * = no sparse warning > Ah, OK, I see. But IMHO it's a poor reason to add the cast. Either > the cast is necessary/recommended or sparse is wrong. In the first case > the reasoning shouldn't have to do with sparse, in the latter sparse > should be fixed. The point is that on 64-bit architectures, a pointer may be representable by an unsigned long, but not an int. > Is this intended? What is the preferred way to define iomem pointers? Define a numerical address with a UL suffix is the simplest way. -- To unsubscribe from this list: send the line "unsubscribe linux-sparse" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html