RE: [PATCH] Add a driver to support InvenSense mpu3050 gyroscope chip.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Alan Cox wrote on 2011-04-13:
>> Could just fix the length in this. You only ever use it with the value
>> 6. Hardly seems worth it's own function.  I guess this may be because
>> it gets used for other things in the full version?  If so it doesn't do
>> any harm here so might as well leave it alone.
>
> In its current form, but there may well be future reasons for people
> to update that depending upon their application of the device.
>
>>> +   u8 buffer[6];
>>> +   buffer[0] = MPU3050_XOUT_H;
>>> +   mpu3050_xyz_read_reg(client, buffer, 6);
>>> +   coords->x = buffer[0];
>>> +   coords->x = coords->x << 8 | buffer[1];
>>
>> Better to use le16_tocpu or similar rather than hand rolling these.
>
> le16_to_cpu takes an u16 or similar input which means buffer then has
> to be a u16[] array for alignment which means you need a separate
> input and output buffer or to do uglies setting XOUT_H

How about get_unaligned_be16(&buffer[0]) ?

> (Normally I'd agree with you but in this case I'm unconvinced)
>
> Alan

Greetings,
Michael

--
Analog Devices GmbH      Wilhelm-Wagenfeld-Str. 6      80807 Muenchen
Sitz der Gesellschaft: Muenchen; Registergericht: Muenchen HRB 40368; Geschaeftsfuehrer:Dr.Carsten Suckrow, Thomas Wessel, William A. Martin, Margaret Seif

--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux