On Mon, Oct 16, 2023 at 09:26:02AM +0200, Milan Broz wrote: > This patch optimizes the previous one for 64-bit platforms, where > unsigned long is 64-bit, so we do not need to convert quirk flags > to 32-bit index. > > Signed-off-by: Milan Broz <gmazyland@xxxxxxxxx> > --- > drivers/usb/storage/Makefile | 3 +++ > drivers/usb/storage/mkflags.c | 9 +++++++++ > drivers/usb/storage/usb-ids.h | 4 ++++ > 3 files changed, 16 insertions(+) > > diff --git a/drivers/usb/storage/Makefile b/drivers/usb/storage/Makefile > index 612678f108d0..62ebaa76ef95 100644 > --- a/drivers/usb/storage/Makefile > +++ b/drivers/usb/storage/Makefile > @@ -57,6 +57,9 @@ $(obj)/usual-tables.o: $(obj)/usb-ids.c > $(obj)/uas.o: $(obj)/usb-ids-uas.c > clean-files := usb-ids.c usb-ids-uas.c > HOSTCFLAGS_mkflags.o := -I $(srctree)/include/ > +ifdef CONFIG_64BIT > +HOSTCFLAGS_mkflags.o += -D CONFIG_64BIT > +endif > hostprogs += mkflags > > quiet_cmd_mkflag_storage = FLAGS $@ > diff --git a/drivers/usb/storage/mkflags.c b/drivers/usb/storage/mkflags.c > index 2514ffef0154..08c37d2e52d6 100644 > --- a/drivers/usb/storage/mkflags.c > +++ b/drivers/usb/storage/mkflags.c > @@ -89,11 +89,15 @@ static struct svals vals[] = { > > static unsigned long get_device_info(uint64_t flags, unsigned int idx) > { > +#ifndef CONFIG_64BIT > if (flags < HI32) > return (unsigned long)flags; > > /* Use index that will be processed in usb_stor_di2flags */ > return HI32 + idx; > +#else > + return flags; > +#endif Please try to keep #ifdef out of .c files, it makes maintenance a real pain and is not the kernel coding style at all. thanks, greg k-h