[patch] staging: comedi: dt9812: Resolves sparse endian warnings.

Shaun Laing Shaun at XResource.ca
Mon Jul 29 15:21:07 UTC 2013


Ok,

I'll send in this additional patch.

On Mon, Jul 29, 2013 at 9:03 AM, Ian Abbott <abbotti at mev.co.uk> wrote:
> On 2013-07-26 19:19, H Hartley Sweeten wrote:
>>
>> On Friday, July 26, 2013 10:59 AM, Shaun Laing wrote:
>>
>> Please make sure to copy the mailing list... ;-)
>>
>>> I'm sorry Hartley,
>>>
>>> I'm really new at this so there's probably something I'm doing wrong.
>>> Do you have time to help me figure this out?  Here's how I'm building
>>> this module:
>>>
>>> shaun at rivendell:~/src/linux/staging$ make O=../staging-build C=1
>>> CF=-D__CHECK_ENDIAN__ drivers/staging/comedi/drivers/dt9812.o
>>
>>
>> Ah.. That's the difference.
>>
>> I usually don't pass the CF=-D__CHECK_ENDIAN__ option.
>>
>> With that option it appears there are a number of comedi drivers that
>> have some endian issues.
>>
>> Your patch does fix these four in the dt9812 driver:
>>
>> drivers/staging/comedi/drivers/dt9812.c:739:18: warning: cast to
>> restricted __le16
>> drivers/staging/comedi/drivers/dt9812.c:746:19: warning: cast to
>> restricted __le16
>> drivers/staging/comedi/drivers/dt9812.c:753:27: warning: cast to
>> restricted __le16
>> drivers/staging/comedi/drivers/dt9812.c:760:18: warning: cast to
>> restricted __le32
>>
>> So, FWIW:
>>
>> Reviewed-by: H Hartley Sweeten <hsweeten at visionengravers.com>
>>
>>
>> These endian warnings still exist in the driver:
>>
>> drivers/staging/comedi/drivers/dt9812.c:260:17: warning: incorrect type in
>> assignment (different base types)
>> drivers/staging/comedi/drivers/dt9812.c:260:17:    expected unsigned int
>> [unsigned] [usertype] cmd
>> drivers/staging/comedi/drivers/dt9812.c:260:17:    got restricted __le32
>> [usertype] <noident>
>> drivers/staging/comedi/drivers/dt9812.c:261:39: warning: incorrect type in
>> assignment (different base types)
>> drivers/staging/comedi/drivers/dt9812.c:261:39:    expected unsigned short
>> [unsigned] [usertype] address
>> drivers/staging/comedi/drivers/dt9812.c:261:39:    got restricted __le16
>> [usertype] <noident>
>> drivers/staging/comedi/drivers/dt9812.c:263:40: warning: incorrect type in
>> assignment (different base types)
>> drivers/staging/comedi/drivers/dt9812.c:263:40:    expected unsigned short
>> [unsigned] [usertype] numbytes
>> drivers/staging/comedi/drivers/dt9812.c:263:40:    got restricted __le16
>> [usertype] <noident>
>> drivers/staging/comedi/drivers/dt9812.c:284:17: warning: incorrect type in
>> assignment (different base types)
>> drivers/staging/comedi/drivers/dt9812.c:284:17:    expected unsigned int
>> [unsigned] [usertype] cmd
>> drivers/staging/comedi/drivers/dt9812.c:284:17:    got restricted __le32
>> [usertype] <noident>
>> drivers/staging/comedi/drivers/dt9812.c:308:17: warning: incorrect type in
>> assignment (different base types)
>> drivers/staging/comedi/drivers/dt9812.c:308:17:    expected unsigned int
>> [unsigned] [usertype] cmd
>> drivers/staging/comedi/drivers/dt9812.c:308:17:    got restricted __le32
>> [usertype] <noident>
>> drivers/staging/comedi/drivers/dt9812.c:329:17: warning: incorrect type in
>> assignment (different base types)
>> drivers/staging/comedi/drivers/dt9812.c:329:17:    expected unsigned int
>> [unsigned] [usertype] cmd
>> drivers/staging/comedi/drivers/dt9812.c:329:17:    got restricted __le32
>> [usertype] <noident>
>>
>> It appears they can be "fixed" by changing the types in the struct
>> dt9812_flash_data
>> and struct dt9812_usb_cmd. But I'm not positive if this is the "correct"
>> fix. Hopefully
>> someone with a bit more endian knowledge will comment. If they do, and
>> this is the
>> right fix, feel free to add this chunk to your patch.
>>
>> Regards,
>> Hartley
>>
>>
>>
>> @@ -188,8 +188,8 @@ enum {
>>   };
>>
>>   struct dt9812_flash_data {
>> -       u16 numbytes;
>> -       u16 address;
>> +       __le16 numbytes;
>> +       __le16 address;
>>   };
>>
>>   #define DT9812_MAX_NUM_MULTI_BYTE_RDS  \
>> @@ -230,7 +230,7 @@ struct dt9812_rmw_multi {
>>   };
>>
>>   struct dt9812_usb_cmd {
>> -       u32 cmd;
>> +       __le32 cmd;
>>          union {
>>                  struct dt9812_flash_data flash_data_info;
>>                  struct dt9812_read_multi read_multi_info;
>>
>>
>>
>
> Yes, your additions look correct, Hartley.
>
> --
> -=( Ian Abbott @ MEV Ltd.    E-mail: <abbotti at mev.co.uk>        )=-
> -=( Tel: +44 (0)161 477 1898   FAX: +44 (0)161 718 3587         )=-


More information about the devel mailing list