Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

usb/gadget: use common defines within the storage gadget

This replaces the remaining defines which are available in "public"
include/ directory and are re-defined by the storage gadget.
This is patch is basicaly search & replace followed by the removal of
the defines.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Sebastian Andrzej Siewior and committed by
Greg Kroah-Hartman
775dafdc b8db6d64

+24 -45
+12 -12
drivers/usb/gadget/f_mass_storage.c
··· 620 620 621 621 switch (ctrl->bRequest) { 622 622 623 - case USB_BULK_RESET_REQUEST: 623 + case US_BULK_RESET_REQUEST: 624 624 if (ctrl->bRequestType != 625 625 (USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE)) 626 626 break; ··· 636 636 raise_exception(fsg->common, FSG_STATE_RESET); 637 637 return DELAYED_STATUS; 638 638 639 - case USB_BULK_GET_MAX_LUN_REQUEST: 639 + case US_BULK_GET_MAX_LUN: 640 640 if (ctrl->bRequestType != 641 641 (USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_INTERFACE)) 642 642 break; ··· 1742 1742 struct fsg_buffhd *bh; 1743 1743 struct bulk_cs_wrap *csw; 1744 1744 int rc; 1745 - u8 status = USB_STATUS_PASS; 1745 + u8 status = US_BULK_STAT_OK; 1746 1746 u32 sd, sdinfo = 0; 1747 1747 1748 1748 /* Wait for the next buffer to become available */ ··· 1763 1763 1764 1764 if (common->phase_error) { 1765 1765 DBG(common, "sending phase-error status\n"); 1766 - status = USB_STATUS_PHASE_ERROR; 1766 + status = US_BULK_STAT_PHASE; 1767 1767 sd = SS_INVALID_COMMAND; 1768 1768 } else if (sd != SS_NO_SENSE) { 1769 1769 DBG(common, "sending command-failure status\n"); 1770 - status = USB_STATUS_FAIL; 1770 + status = US_BULK_STAT_FAIL; 1771 1771 VDBG(common, " sense data: SK x%02x, ASC x%02x, ASCQ x%02x;" 1772 1772 " info x%x\n", 1773 1773 SK(sd), ASC(sd), ASCQ(sd), sdinfo); ··· 1776 1776 /* Store and send the Bulk-only CSW */ 1777 1777 csw = (void *)bh->buf; 1778 1778 1779 - csw->Signature = cpu_to_le32(USB_BULK_CS_SIG); 1779 + csw->Signature = cpu_to_le32(US_BULK_CS_SIGN); 1780 1780 csw->Tag = common->tag; 1781 1781 csw->Residue = cpu_to_le32(common->residue); 1782 1782 csw->Status = status; 1783 1783 1784 - bh->inreq->length = USB_BULK_CS_WRAP_LEN; 1784 + bh->inreq->length = US_BULK_CS_WRAP_LEN; 1785 1785 bh->inreq->zero = 0; 1786 1786 if (!start_in_transfer(common, bh)) 1787 1787 /* Don't know what to do if common->fsg is NULL */ ··· 2229 2229 return -EINVAL; 2230 2230 2231 2231 /* Is the CBW valid? */ 2232 - if (req->actual != USB_BULK_CB_WRAP_LEN || 2232 + if (req->actual != US_BULK_CB_WRAP_LEN || 2233 2233 cbw->Signature != cpu_to_le32( 2234 - USB_BULK_CB_SIG)) { 2234 + US_BULK_CB_SIGN)) { 2235 2235 DBG(fsg, "invalid CBW: len %u sig 0x%x\n", 2236 2236 req->actual, 2237 2237 le32_to_cpu(cbw->Signature)); ··· 2253 2253 } 2254 2254 2255 2255 /* Is the CBW meaningful? */ 2256 - if (cbw->Lun >= FSG_MAX_LUNS || cbw->Flags & ~USB_BULK_IN_FLAG || 2256 + if (cbw->Lun >= FSG_MAX_LUNS || cbw->Flags & ~US_BULK_FLAG_IN || 2257 2257 cbw->Length <= 0 || cbw->Length > MAX_COMMAND_SIZE) { 2258 2258 DBG(fsg, "non-meaningful CBW: lun = %u, flags = 0x%x, " 2259 2259 "cmdlen %u\n", ··· 2273 2273 /* Save the command for later */ 2274 2274 common->cmnd_size = cbw->Length; 2275 2275 memcpy(common->cmnd, cbw->CDB, common->cmnd_size); 2276 - if (cbw->Flags & USB_BULK_IN_FLAG) 2276 + if (cbw->Flags & US_BULK_FLAG_IN) 2277 2277 common->data_dir = DATA_DIR_TO_HOST; 2278 2278 else 2279 2279 common->data_dir = DATA_DIR_FROM_HOST; ··· 2303 2303 } 2304 2304 2305 2305 /* Queue a request to read a Bulk-only CBW */ 2306 - set_bulk_out_req_length(common, bh, USB_BULK_CB_WRAP_LEN); 2306 + set_bulk_out_req_length(common, bh, US_BULK_CB_WRAP_LEN); 2307 2307 if (!start_out_transfer(common, bh)) 2308 2308 /* Don't know what to do if common->fsg is NULL */ 2309 2309 return -EIO;
+12 -12
drivers/usb/gadget/file_storage.c
··· 855 855 if (transport_is_bbb()) { 856 856 switch (ctrl->bRequest) { 857 857 858 - case USB_BULK_RESET_REQUEST: 858 + case US_BULK_RESET_REQUEST: 859 859 if (ctrl->bRequestType != (USB_DIR_OUT | 860 860 USB_TYPE_CLASS | USB_RECIP_INTERFACE)) 861 861 break; ··· 871 871 value = DELAYED_STATUS; 872 872 break; 873 873 874 - case USB_BULK_GET_MAX_LUN_REQUEST: 874 + case US_BULK_GET_MAX_LUN: 875 875 if (ctrl->bRequestType != (USB_DIR_IN | 876 876 USB_TYPE_CLASS | USB_RECIP_INTERFACE)) 877 877 break; ··· 2125 2125 struct fsg_lun *curlun = fsg->curlun; 2126 2126 struct fsg_buffhd *bh; 2127 2127 int rc; 2128 - u8 status = USB_STATUS_PASS; 2128 + u8 status = US_BULK_STAT_OK; 2129 2129 u32 sd, sdinfo = 0; 2130 2130 2131 2131 /* Wait for the next buffer to become available */ ··· 2146 2146 2147 2147 if (fsg->phase_error) { 2148 2148 DBG(fsg, "sending phase-error status\n"); 2149 - status = USB_STATUS_PHASE_ERROR; 2149 + status = US_BULK_STAT_PHASE; 2150 2150 sd = SS_INVALID_COMMAND; 2151 2151 } else if (sd != SS_NO_SENSE) { 2152 2152 DBG(fsg, "sending command-failure status\n"); 2153 - status = USB_STATUS_FAIL; 2153 + status = US_BULK_STAT_FAIL; 2154 2154 VDBG(fsg, " sense data: SK x%02x, ASC x%02x, ASCQ x%02x;" 2155 2155 " info x%x\n", 2156 2156 SK(sd), ASC(sd), ASCQ(sd), sdinfo); ··· 2160 2160 struct bulk_cs_wrap *csw = bh->buf; 2161 2161 2162 2162 /* Store and send the Bulk-only CSW */ 2163 - csw->Signature = cpu_to_le32(USB_BULK_CS_SIG); 2163 + csw->Signature = cpu_to_le32(US_BULK_CS_SIGN); 2164 2164 csw->Tag = fsg->tag; 2165 2165 csw->Residue = cpu_to_le32(fsg->residue); 2166 2166 csw->Status = status; 2167 2167 2168 - bh->inreq->length = USB_BULK_CS_WRAP_LEN; 2168 + bh->inreq->length = US_BULK_CS_WRAP_LEN; 2169 2169 bh->inreq->zero = 0; 2170 2170 start_transfer(fsg, fsg->bulk_in, bh->inreq, 2171 2171 &bh->inreq_busy, &bh->state); ··· 2616 2616 return -EINVAL; 2617 2617 2618 2618 /* Is the CBW valid? */ 2619 - if (req->actual != USB_BULK_CB_WRAP_LEN || 2619 + if (req->actual != US_BULK_CB_WRAP_LEN || 2620 2620 cbw->Signature != cpu_to_le32( 2621 - USB_BULK_CB_SIG)) { 2621 + US_BULK_CB_SIGN)) { 2622 2622 DBG(fsg, "invalid CBW: len %u sig 0x%x\n", 2623 2623 req->actual, 2624 2624 le32_to_cpu(cbw->Signature)); ··· 2638 2638 } 2639 2639 2640 2640 /* Is the CBW meaningful? */ 2641 - if (cbw->Lun >= FSG_MAX_LUNS || cbw->Flags & ~USB_BULK_IN_FLAG || 2641 + if (cbw->Lun >= FSG_MAX_LUNS || cbw->Flags & ~US_BULK_FLAG_IN || 2642 2642 cbw->Length <= 0 || cbw->Length > MAX_COMMAND_SIZE) { 2643 2643 DBG(fsg, "non-meaningful CBW: lun = %u, flags = 0x%x, " 2644 2644 "cmdlen %u\n", ··· 2656 2656 /* Save the command for later */ 2657 2657 fsg->cmnd_size = cbw->Length; 2658 2658 memcpy(fsg->cmnd, cbw->CDB, fsg->cmnd_size); 2659 - if (cbw->Flags & USB_BULK_IN_FLAG) 2659 + if (cbw->Flags & US_BULK_FLAG_IN) 2660 2660 fsg->data_dir = DATA_DIR_TO_HOST; 2661 2661 else 2662 2662 fsg->data_dir = DATA_DIR_FROM_HOST; ··· 2685 2685 } 2686 2686 2687 2687 /* Queue a request to read a Bulk-only CBW */ 2688 - set_bulk_out_req_length(fsg, bh, USB_BULK_CB_WRAP_LEN); 2688 + set_bulk_out_req_length(fsg, bh, US_BULK_CB_WRAP_LEN); 2689 2689 start_transfer(fsg, fsg->bulk_out, bh->outreq, 2690 2690 &bh->outreq_busy, &bh->state); 2691 2691
-21
drivers/usb/gadget/storage_common.c
··· 145 145 146 146 #endif /* DUMP_MSGS */ 147 147 148 - 149 - 150 - 151 - 152 148 /*-------------------------------------------------------------------------*/ 153 - 154 - /* Bulk-only data structures */ 155 - 156 - #define USB_BULK_CB_WRAP_LEN 31 157 - #define USB_BULK_CB_SIG 0x43425355 /* Spells out USBC */ 158 - #define USB_BULK_IN_FLAG 0x80 159 - 160 - #define USB_BULK_CS_WRAP_LEN 13 161 - #define USB_BULK_CS_SIG 0x53425355 /* Spells out 'USBS' */ 162 - #define USB_STATUS_PASS 0 163 - #define USB_STATUS_FAIL 1 164 - #define USB_STATUS_PHASE_ERROR 2 165 - 166 - /* Bulk-only class specific requests */ 167 - #define USB_BULK_RESET_REQUEST 0xff 168 - #define USB_BULK_GET_MAX_LUN_REQUEST 0xfe 169 - 170 149 171 150 /* CBI Interrupt data structure */ 172 151 struct interrupt_data {