On Fri, Nov 03, 2023 at 09:17:09PM +0100, Milan Broz wrote: > The USB mass storage quirks flags can be stored in driver_info in > a 32-bit integer (unsigned long on 32-bit platforms). > As this attribute cannot be enlarged, we need to use some form > of translation of 64-bit quirk bits. > > This problem was discussed on the USB list > https://lore.kernel.org/linux-usb/f9e8acb5-32d5-4a30-859f-d4336a86b31a@xxxxxxxxx/ > > The initial solution to use a static array extensively increased the size > of the kernel module, so I decided to try the second suggested solution: > generate a table by host-compiled program and use bit 31 to indicate > that the value is an index, not the actual value. > > This patch adds a host-compiled program that processes unusual_devs.h > (and unusual_uas.h) and generates files usb-ids.c and usb-ids-uas.c > (for pre-processed USB device table with 32-bit device info). > These files also contain a generated translation table for driver_info > to 64-bit values. > > The translation function is used only in usb-storage and uas modules; all > other USB storage modules store flags directly, using only 32-bit flags. > > For 64-bit platforms, where unsigned long is 64-bit, we do not need to > convert quirk flags to 32-bit index; the translation function there uses > flags directly. > > Signed-off-by: Milan Broz <gmazyland@xxxxxxxxx> > --- Reviewed-by: Alan Stern <stern@xxxxxxxxxxxxxxxxxxx>