From: Bryan O'Donoghue Date: Mon, 30 Apr 2018 14:56:09 +0000 (+0100) Subject: usb: f_mass_storage: Fix set_bit and clear_bit usage X-Git-Url: http://git.dujemihanovic.xyz/?a=commitdiff_plain;h=5ac73f6879327beef45bc58484f1f09c2f0cb37c;p=u-boot.git usb: f_mass_storage: Fix set_bit and clear_bit usage Compiling the f_mass_storage driver for an x86 target results in a compilation error as set_bit and clear_bit are provided by bitops.h Looking at the provenance of the current u-boot code and the git change history in the kernel, it looks like we have a local copy of set_bit and clear_bit as a hold-over from porting the Linux driver into u-boot. These days __set_bit and __clear_bit are optionally provided by an arch and can be used as inputs to generic_bit_set and generic_bit_clear. This patch switches over to generic_set_bit and generic_clear_bit to accommodate. Tested on i.MX WaRP7 and Intel Edison Signed-off-by: Bryan O'Donoghue Cc: Lukasz Majewski Cc: Marek Vasut --- diff --git a/drivers/usb/gadget/f_mass_storage.c b/drivers/usb/gadget/f_mass_storage.c index 90c9561563..c7348fcf4b 100644 --- a/drivers/usb/gadget/f_mass_storage.c +++ b/drivers/usb/gadget/f_mass_storage.c @@ -251,6 +251,7 @@ #include #include +#include #include #include #include @@ -282,26 +283,6 @@ static const char fsg_string_interface[] = "Mass Storage"; struct kref {int x; }; struct completion {int x; }; -inline void set_bit(int nr, volatile void *addr) -{ - int mask; - unsigned int *a = (unsigned int *) addr; - - a += nr >> 5; - mask = 1 << (nr & 0x1f); - *a |= mask; -} - -inline void clear_bit(int nr, volatile void *addr) -{ - int mask; - unsigned int *a = (unsigned int *) addr; - - a += nr >> 5; - mask = 1 << (nr & 0x1f); - *a &= ~mask; -} - struct fsg_dev; struct fsg_common; @@ -2085,7 +2066,7 @@ static int received_cbw(struct fsg_dev *fsg, struct fsg_buffhd *bh) * we can simply accept and discard any data received * until the next reset. */ wedge_bulk_in_endpoint(fsg); - set_bit(IGNORE_BULK_OUT, &fsg->atomic_bitflags); + generic_set_bit(IGNORE_BULK_OUT, &fsg->atomic_bitflags); return -EINVAL; } @@ -2249,7 +2230,7 @@ reset: fsg->bulk_out_enabled = 1; common->bulk_out_maxpacket = le16_to_cpu(get_unaligned(&d->wMaxPacketSize)); - clear_bit(IGNORE_BULK_OUT, &fsg->atomic_bitflags); + generic_clear_bit(IGNORE_BULK_OUT, &fsg->atomic_bitflags); /* Allocate the requests */ for (i = 0; i < FSG_NUM_BUFFERS; ++i) {