Re: [PATCH v2 10/23] HID: uclogic: Support v2 protocol

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

 



On Thu, Feb 21, 2019 at 11:54 AM Nikolai Kondrashov <spbnick@xxxxxxxxx> wrote:
>
> On 2/21/19 12:41 PM, Benjamin Tissoires wrote:
> > On Sun, Feb 10, 2019 at 11:15 AM Nikolai Kondrashov <spbnick@xxxxxxxxx> wrote:
> >> +/**
> >> + * uclogic_params_get_le24() - get a 24-bit little-endian number from a
> >> + * buffer.
> >> + *
> >> + * @p: The pointer to the number buffer.
> >> + *
> >> + * Returns:
> >> + *     The retrieved number
> >> + */
> >> +static s32 uclogic_params_get_le24(const void *p)
> >> +{
> >> +       const __u8 *b = p;
> >> +       return b[0] | (b[1] << 8UL) | (b[2] << 16UL);
> >
> > Nitpick, I am pretty sure we already have the bits in the kernel for that.
>
> I tried to find it and couldn't, do you have any hints where I can find it?

For non aligned bits in the middle of a report, we have
hid_field_extract()
(https://git.kernel.org/pub/scm/linux/kernel/git/hid/hid.git/tree/drivers/hid/hid-core.c?h=for-next#n1301)

For other regular operations, there are the get_unaligned_le*()
operations, but they are for 16, 32 or 64 bits.
include/target/target_core_backend.h has a get_unaligned_be24() but it
requires to read p - 1, and I am not sure you can in your case.


>
> > But OTOH, not sure I'll request a v3 just for that.
>
> Will be glad to fix this, if you'll need v3, or later.

Probably later :)

Cheers,
Benjamin

>
> Nick



[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