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. _______________________________________________ Virtualization mailing list Virtualization@xxxxxxxxxxxxxxxxxxxxxxxxxx https://lists.linuxfoundation.org/mailman/listinfo/virtualization