Hi, I am trying to get rid of sparse's bitwise warnings in my isp116x-hcd driver. Regardless of studying the explanations about __bitwise, as for example in http://kerneltrap.org/node/3848 I was still not able to get rid of all the warnings. Could anybody please explain, how to correctly resolve the ones below.
An example piece of problematic code, compiled on little-endian ARM platform, is the following. struct isp116x { void __iomem *addr_reg; .... }; static inline void isp116x_write_addr(struct isp116x *isp116x, unsigned reg) { writew(cpu_to_le16((__u16) (reg & 0xff)), isp116x->addr_reg); isp116x_delay(isp116x, 300); } The sparse bitwise warnings about the writew(...) line (#377) are the following. drivers/usb/host/isp116x.h:377:6: warning: cast from restricted type drivers/usb/host/isp116x.h:377:6: warning: incorrect type in assignment (different base types) drivers/usb/host/isp116x.h:377:6: expected unsigned short volatile [unsigned] [short] [force] <noident> drivers/usb/host/isp116x.h:377:6: got restricted unsigned short [usertype] [force] <noident> Here is the same function after preprocessing. static inline __attribute__((always_inline)) void isp116x_write_addr(struct isp116x *isp116x, unsigned reg) { ((void)0, *(volatile unsigned short *)((isp116x->addr_reg)) = ((( __le16)(__u16) ((( __le16)(__u16)((__u16) (reg & 0xff))))))); (isp116x)->board->delay(isp116x_to_hcd(isp116x)->self.controller,300); } Thanks in advance, Olav ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click _______________________________________________ linux-usb-devel@lists.sourceforge.net To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel