Re: [PATCH] Input: spaceball - fix parsing of movement data packets

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

 



On Mon, Dec 20, 2021 at 12:59:21AM -0800, Dmitry Torokhov wrote:
> Could we write
> 
> 			for (i == 0; i < ARRAY_SIZE(spaceball_axes); i++)
> 				input_report_abs(dev, spaceball_axes[i],
> 					(__s16)(get_unaligned_be16(&data[i * 2]);
> 
> instead?
>
	It's not as readable, but sure, I could do that.

> 			for (i == 0; i < ARRAY_SIZE(spaceball_axes); i++)
  			       ^^
	Pretty sure you didn't mean that :-).

> 				input_report_abs(dev, spaceball_axes[i],
> 					(__s16)(get_unaligned_be16(&data[i * 2]);
  					                                ^^^^^^^
	I'm new here, but it seems odd that an array index (shift plus add
to the base pointer) is preferred over a direct pointer reference.

> 					(__s16)(get_unaligned_be16(&data[i * 2]);
  					        ^^^^^^^^^^^^^^^^^^
	Ooo!  Didn't know about this; thank you!

					Schwab



[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