OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

virtio-dev message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: Re: [virtio-dev] Re: [PATCH 1/1] Add virtio-input driver.



On 23/03/2015 08:53, Gerd Hoffmann wrote:
>>>>> > > > > +		if (cfg & (1 << (bit % 8)))
>>>>> > > > > +			set_bit(bit, bits);
>>>> > > > 
>>>> > > > what if not set? does something clear the mask?
>>> > > 
>>> > > kzalloc?
>> > 
>> > So you are really just reading in array of bytes?
>> > All this set bit trickery is just to convert things from LE?
> Trickery?  Just checking each bit from virtio config space, then set it
> in the input layer bitmap.  It's a simple stupid loop.
> 
> Surely not the most efficient way, but hey, it's not in the hot path and
> I'm sure I'm setting the bits correctly because this uses the standard
> linux kernel bitops.

Use __set_bit though, because set_bit is an atomic operation.

Paolo

>> > At least, this needs a comment explaining what the function does,
>> > and maybe wrap it in a helper like virtio_input_bitmap_copy or
>> > virtio_bitmap_or.
> Can do that, sure.


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]