Skip to content

Commit

Permalink
USB: replace uses of __constant_{endian}
Browse files Browse the repository at this point in the history
The base versions handle constant folding now.

Signed-off-by: Harvey Harrison <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
hharrison authored and gregkh committed Mar 24, 2009
1 parent a78b428 commit 551509d
Show file tree
Hide file tree
Showing 35 changed files with 152 additions and 152 deletions.
2 changes: 1 addition & 1 deletion drivers/usb/core/hcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -901,7 +901,7 @@ static int register_root_hub(struct usb_hcd *hcd)

mutex_lock(&usb_bus_list_lock);

usb_dev->ep0.desc.wMaxPacketSize = __constant_cpu_to_le16(64);
usb_dev->ep0.desc.wMaxPacketSize = cpu_to_le16(64);
retval = usb_get_device_descriptor(usb_dev, USB_DT_DEVICE_SIZE);
if (retval != sizeof usb_dev->descriptor) {
mutex_unlock(&usb_bus_list_lock);
Expand Down
8 changes: 4 additions & 4 deletions drivers/usb/core/hub.c
Original file line number Diff line number Diff line change
Expand Up @@ -2471,20 +2471,20 @@ hub_port_init (struct usb_hub *hub, struct usb_device *udev, int port1,
*/
switch (udev->speed) {
case USB_SPEED_VARIABLE: /* fixed at 512 */
udev->ep0.desc.wMaxPacketSize = __constant_cpu_to_le16(512);
udev->ep0.desc.wMaxPacketSize = cpu_to_le16(512);
break;
case USB_SPEED_HIGH: /* fixed at 64 */
udev->ep0.desc.wMaxPacketSize = __constant_cpu_to_le16(64);
udev->ep0.desc.wMaxPacketSize = cpu_to_le16(64);
break;
case USB_SPEED_FULL: /* 8, 16, 32, or 64 */
/* to determine the ep0 maxpacket size, try to read
* the device descriptor to get bMaxPacketSize0 and
* then correct our initial guess.
*/
udev->ep0.desc.wMaxPacketSize = __constant_cpu_to_le16(64);
udev->ep0.desc.wMaxPacketSize = cpu_to_le16(64);
break;
case USB_SPEED_LOW: /* fixed at 8 */
udev->ep0.desc.wMaxPacketSize = __constant_cpu_to_le16(8);
udev->ep0.desc.wMaxPacketSize = cpu_to_le16(8);
break;
default:
goto fail;
Expand Down
2 changes: 1 addition & 1 deletion drivers/usb/gadget/amd5536udc.c
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ udc_alloc_request(struct usb_ep *usbep, gfp_t gfp)
dma_desc->status = AMD_ADDBITS(dma_desc->status,
UDC_DMA_STP_STS_BS_HOST_BUSY,
UDC_DMA_STP_STS_BS);
dma_desc->bufptr = __constant_cpu_to_le32(DMA_DONT_USE);
dma_desc->bufptr = cpu_to_le32(DMA_DONT_USE);
req->td_data = dma_desc;
req->td_data_last = NULL;
req->chain_len = 1;
Expand Down
20 changes: 10 additions & 10 deletions drivers/usb/gadget/atmel_usba_udc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1017,7 +1017,7 @@ static struct usb_endpoint_descriptor usba_ep0_desc = {
.bDescriptorType = USB_DT_ENDPOINT,
.bEndpointAddress = 0,
.bmAttributes = USB_ENDPOINT_XFER_CONTROL,
.wMaxPacketSize = __constant_cpu_to_le16(64),
.wMaxPacketSize = cpu_to_le16(64),
/* FIXME: I have no idea what to put here */
.bInterval = 1,
};
Expand Down Expand Up @@ -1207,21 +1207,21 @@ static int do_test_mode(struct usba_udc *udc)
/* Avoid overly long expressions */
static inline bool feature_is_dev_remote_wakeup(struct usb_ctrlrequest *crq)
{
if (crq->wValue == __constant_cpu_to_le16(USB_DEVICE_REMOTE_WAKEUP))
if (crq->wValue == cpu_to_le16(USB_DEVICE_REMOTE_WAKEUP))
return true;
return false;
}

static inline bool feature_is_dev_test_mode(struct usb_ctrlrequest *crq)
{
if (crq->wValue == __constant_cpu_to_le16(USB_DEVICE_TEST_MODE))
if (crq->wValue == cpu_to_le16(USB_DEVICE_TEST_MODE))
return true;
return false;
}

static inline bool feature_is_ep_halt(struct usb_ctrlrequest *crq)
{
if (crq->wValue == __constant_cpu_to_le16(USB_ENDPOINT_HALT))
if (crq->wValue == cpu_to_le16(USB_ENDPOINT_HALT))
return true;
return false;
}
Expand All @@ -1239,7 +1239,7 @@ static int handle_ep0_setup(struct usba_udc *udc, struct usba_ep *ep,
status = cpu_to_le16(udc->devstatus);
} else if (crq->bRequestType
== (USB_DIR_IN | USB_RECIP_INTERFACE)) {
status = __constant_cpu_to_le16(0);
status = cpu_to_le16(0);
} else if (crq->bRequestType
== (USB_DIR_IN | USB_RECIP_ENDPOINT)) {
struct usba_ep *target;
Expand All @@ -1250,12 +1250,12 @@ static int handle_ep0_setup(struct usba_udc *udc, struct usba_ep *ep,

status = 0;
if (is_stalled(udc, target))
status |= __constant_cpu_to_le16(1);
status |= cpu_to_le16(1);
} else
goto delegate;

/* Write directly to the FIFO. No queueing is done. */
if (crq->wLength != __constant_cpu_to_le16(sizeof(status)))
if (crq->wLength != cpu_to_le16(sizeof(status)))
goto stall;
ep->state = DATA_STAGE_IN;
__raw_writew(status, ep->fifo);
Expand All @@ -1274,7 +1274,7 @@ static int handle_ep0_setup(struct usba_udc *udc, struct usba_ep *ep,
} else if (crq->bRequestType == USB_RECIP_ENDPOINT) {
struct usba_ep *target;

if (crq->wLength != __constant_cpu_to_le16(0)
if (crq->wLength != cpu_to_le16(0)
|| !feature_is_ep_halt(crq))
goto stall;
target = get_ep_by_addr(udc, le16_to_cpu(crq->wIndex));
Expand Down Expand Up @@ -1308,7 +1308,7 @@ static int handle_ep0_setup(struct usba_udc *udc, struct usba_ep *ep,
} else if (crq->bRequestType == USB_RECIP_ENDPOINT) {
struct usba_ep *target;

if (crq->wLength != __constant_cpu_to_le16(0)
if (crq->wLength != cpu_to_le16(0)
|| !feature_is_ep_halt(crq))
goto stall;

Expand Down Expand Up @@ -1514,7 +1514,7 @@ static void usba_control_irq(struct usba_udc *udc, struct usba_ep *ep)
*/
ep->state = DATA_STAGE_IN;
} else {
if (crq.crq.wLength != __constant_cpu_to_le16(0))
if (crq.crq.wLength != cpu_to_le16(0))
ep->state = DATA_STAGE_OUT;
else
ep->state = STATUS_STAGE_IN;
Expand Down
8 changes: 4 additions & 4 deletions drivers/usb/gadget/cdc2.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,16 +66,16 @@ static struct usb_device_descriptor device_desc = {
.bLength = sizeof device_desc,
.bDescriptorType = USB_DT_DEVICE,

.bcdUSB = __constant_cpu_to_le16(0x0200),
.bcdUSB = cpu_to_le16(0x0200),

.bDeviceClass = USB_CLASS_COMM,
.bDeviceSubClass = 0,
.bDeviceProtocol = 0,
/* .bMaxPacketSize0 = f(hardware) */

/* Vendor and product id can be overridden by module parameters. */
.idVendor = __constant_cpu_to_le16(CDC_VENDOR_NUM),
.idProduct = __constant_cpu_to_le16(CDC_PRODUCT_NUM),
.idVendor = cpu_to_le16(CDC_VENDOR_NUM),
.idProduct = cpu_to_le16(CDC_PRODUCT_NUM),
/* .bcdDevice = f(hardware) */
/* .iManufacturer = DYNAMIC */
/* .iProduct = DYNAMIC */
Expand Down Expand Up @@ -193,7 +193,7 @@ static int __init cdc_bind(struct usb_composite_dev *cdev)
gadget->name,
cdc_config_driver.label);
device_desc.bcdDevice =
__constant_cpu_to_le16(0x0300 | 0x0099);
cpu_to_le16(0x0300 | 0x0099);
}


Expand Down
2 changes: 1 addition & 1 deletion drivers/usb/gadget/dummy_hcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1626,7 +1626,7 @@ static int dummy_hub_control (
hub_descriptor ((struct usb_hub_descriptor *) buf);
break;
case GetHubStatus:
*(__le32 *) buf = __constant_cpu_to_le32 (0);
*(__le32 *) buf = cpu_to_le32 (0);
break;
case GetPortStatus:
if (wIndex != 1)
Expand Down
2 changes: 1 addition & 1 deletion drivers/usb/gadget/epautoconf.c
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ ep_matches (
return 0;

/* BOTH: "high bandwidth" works only at high speed */
if ((desc->wMaxPacketSize & __constant_cpu_to_le16(3<<11))) {
if ((desc->wMaxPacketSize & cpu_to_le16(3<<11))) {
if (!gadget->is_dualspeed)
return 0;
/* configure your hardware with enough buffering!! */
Expand Down
8 changes: 4 additions & 4 deletions drivers/usb/gadget/ether.c
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ static struct usb_device_descriptor device_desc = {
.bLength = sizeof device_desc,
.bDescriptorType = USB_DT_DEVICE,

.bcdUSB = __constant_cpu_to_le16 (0x0200),
.bcdUSB = cpu_to_le16 (0x0200),

.bDeviceClass = USB_CLASS_COMM,
.bDeviceSubClass = 0,
Expand All @@ -167,8 +167,8 @@ static struct usb_device_descriptor device_desc = {
* we support. (As does bNumConfigurations.) These values can
* also be overridden by module parameters.
*/
.idVendor = __constant_cpu_to_le16 (CDC_VENDOR_NUM),
.idProduct = __constant_cpu_to_le16 (CDC_PRODUCT_NUM),
.idVendor = cpu_to_le16 (CDC_VENDOR_NUM),
.idProduct = cpu_to_le16 (CDC_PRODUCT_NUM),
/* .bcdDevice = f(hardware) */
/* .iManufacturer = DYNAMIC */
/* .iProduct = DYNAMIC */
Expand Down Expand Up @@ -318,7 +318,7 @@ static int __init eth_bind(struct usb_composite_dev *cdev)
gadget->name,
eth_config_driver.label);
device_desc.bcdDevice =
__constant_cpu_to_le16(0x0300 | 0x0099);
cpu_to_le16(0x0300 | 0x0099);
}


Expand Down
10 changes: 5 additions & 5 deletions drivers/usb/gadget/f_acm.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ static struct usb_cdc_header_desc acm_header_desc __initdata = {
.bLength = sizeof(acm_header_desc),
.bDescriptorType = USB_DT_CS_INTERFACE,
.bDescriptorSubType = USB_CDC_HEADER_TYPE,
.bcdCDC = __constant_cpu_to_le16(0x0110),
.bcdCDC = cpu_to_le16(0x0110),
};

static struct usb_cdc_call_mgmt_descriptor
Expand Down Expand Up @@ -159,7 +159,7 @@ static struct usb_endpoint_descriptor acm_fs_notify_desc __initdata = {
.bDescriptorType = USB_DT_ENDPOINT,
.bEndpointAddress = USB_DIR_IN,
.bmAttributes = USB_ENDPOINT_XFER_INT,
.wMaxPacketSize = __constant_cpu_to_le16(GS_NOTIFY_MAXPACKET),
.wMaxPacketSize = cpu_to_le16(GS_NOTIFY_MAXPACKET),
.bInterval = 1 << GS_LOG2_NOTIFY_INTERVAL,
};

Expand Down Expand Up @@ -197,22 +197,22 @@ static struct usb_endpoint_descriptor acm_hs_notify_desc __initdata = {
.bDescriptorType = USB_DT_ENDPOINT,
.bEndpointAddress = USB_DIR_IN,
.bmAttributes = USB_ENDPOINT_XFER_INT,
.wMaxPacketSize = __constant_cpu_to_le16(GS_NOTIFY_MAXPACKET),
.wMaxPacketSize = cpu_to_le16(GS_NOTIFY_MAXPACKET),
.bInterval = GS_LOG2_NOTIFY_INTERVAL+4,
};

static struct usb_endpoint_descriptor acm_hs_in_desc __initdata = {
.bLength = USB_DT_ENDPOINT_SIZE,
.bDescriptorType = USB_DT_ENDPOINT,
.bmAttributes = USB_ENDPOINT_XFER_BULK,
.wMaxPacketSize = __constant_cpu_to_le16(512),
.wMaxPacketSize = cpu_to_le16(512),
};

static struct usb_endpoint_descriptor acm_hs_out_desc __initdata = {
.bLength = USB_DT_ENDPOINT_SIZE,
.bDescriptorType = USB_DT_ENDPOINT,
.bmAttributes = USB_ENDPOINT_XFER_BULK,
.wMaxPacketSize = __constant_cpu_to_le16(512),
.wMaxPacketSize = cpu_to_le16(512),
};

static struct usb_descriptor_header *acm_hs_function[] __initdata = {
Expand Down
16 changes: 8 additions & 8 deletions drivers/usb/gadget/f_ecm.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ static struct usb_cdc_header_desc ecm_header_desc __initdata = {
.bDescriptorType = USB_DT_CS_INTERFACE,
.bDescriptorSubType = USB_CDC_HEADER_TYPE,

.bcdCDC = __constant_cpu_to_le16(0x0110),
.bcdCDC = cpu_to_le16(0x0110),
};

static struct usb_cdc_union_desc ecm_union_desc __initdata = {
Expand All @@ -148,9 +148,9 @@ static struct usb_cdc_ether_desc ecm_desc __initdata = {

/* this descriptor actually adds value, surprise! */
/* .iMACAddress = DYNAMIC */
.bmEthernetStatistics = __constant_cpu_to_le32(0), /* no statistics */
.wMaxSegmentSize = __constant_cpu_to_le16(ETH_FRAME_LEN),
.wNumberMCFilters = __constant_cpu_to_le16(0),
.bmEthernetStatistics = cpu_to_le32(0), /* no statistics */
.wMaxSegmentSize = cpu_to_le16(ETH_FRAME_LEN),
.wNumberMCFilters = cpu_to_le16(0),
.bNumberPowerFilters = 0,
};

Expand Down Expand Up @@ -192,7 +192,7 @@ static struct usb_endpoint_descriptor fs_ecm_notify_desc __initdata = {

.bEndpointAddress = USB_DIR_IN,
.bmAttributes = USB_ENDPOINT_XFER_INT,
.wMaxPacketSize = __constant_cpu_to_le16(ECM_STATUS_BYTECOUNT),
.wMaxPacketSize = cpu_to_le16(ECM_STATUS_BYTECOUNT),
.bInterval = 1 << LOG2_STATUS_INTERVAL_MSEC,
};

Expand Down Expand Up @@ -236,7 +236,7 @@ static struct usb_endpoint_descriptor hs_ecm_notify_desc __initdata = {

.bEndpointAddress = USB_DIR_IN,
.bmAttributes = USB_ENDPOINT_XFER_INT,
.wMaxPacketSize = __constant_cpu_to_le16(ECM_STATUS_BYTECOUNT),
.wMaxPacketSize = cpu_to_le16(ECM_STATUS_BYTECOUNT),
.bInterval = LOG2_STATUS_INTERVAL_MSEC + 4,
};
static struct usb_endpoint_descriptor hs_ecm_in_desc __initdata = {
Expand All @@ -245,7 +245,7 @@ static struct usb_endpoint_descriptor hs_ecm_in_desc __initdata = {

.bEndpointAddress = USB_DIR_IN,
.bmAttributes = USB_ENDPOINT_XFER_BULK,
.wMaxPacketSize = __constant_cpu_to_le16(512),
.wMaxPacketSize = cpu_to_le16(512),
};

static struct usb_endpoint_descriptor hs_ecm_out_desc __initdata = {
Expand All @@ -254,7 +254,7 @@ static struct usb_endpoint_descriptor hs_ecm_out_desc __initdata = {

.bEndpointAddress = USB_DIR_OUT,
.bmAttributes = USB_ENDPOINT_XFER_BULK,
.wMaxPacketSize = __constant_cpu_to_le16(512),
.wMaxPacketSize = cpu_to_le16(512),
};

static struct usb_descriptor_header *ecm_hs_function[] __initdata = {
Expand Down
4 changes: 2 additions & 2 deletions drivers/usb/gadget/f_loopback.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,15 +100,15 @@ static struct usb_endpoint_descriptor hs_loop_source_desc = {
.bDescriptorType = USB_DT_ENDPOINT,

.bmAttributes = USB_ENDPOINT_XFER_BULK,
.wMaxPacketSize = __constant_cpu_to_le16(512),
.wMaxPacketSize = cpu_to_le16(512),
};

static struct usb_endpoint_descriptor hs_loop_sink_desc = {
.bLength = USB_DT_ENDPOINT_SIZE,
.bDescriptorType = USB_DT_ENDPOINT,

.bmAttributes = USB_ENDPOINT_XFER_BULK,
.wMaxPacketSize = __constant_cpu_to_le16(512),
.wMaxPacketSize = cpu_to_le16(512),
};

static struct usb_descriptor_header *hs_loopback_descs[] = {
Expand Down
8 changes: 4 additions & 4 deletions drivers/usb/gadget/f_obex.c
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ static struct usb_cdc_header_desc obex_cdc_header_desc __initdata = {
.bLength = sizeof(obex_cdc_header_desc),
.bDescriptorType = USB_DT_CS_INTERFACE,
.bDescriptorSubType = USB_CDC_HEADER_TYPE,
.bcdCDC = __constant_cpu_to_le16(0x0120),
.bcdCDC = cpu_to_le16(0x0120),
};

static struct usb_cdc_union_desc obex_cdc_union_desc __initdata = {
Expand All @@ -138,7 +138,7 @@ static struct usb_cdc_obex_desc obex_desc __initdata = {
.bLength = sizeof(obex_desc),
.bDescriptorType = USB_DT_CS_INTERFACE,
.bDescriptorSubType = USB_CDC_OBEX_TYPE,
.bcdVersion = __constant_cpu_to_le16(0x0100),
.bcdVersion = cpu_to_le16(0x0100),
};

/* High-Speed Support */
Expand All @@ -149,7 +149,7 @@ static struct usb_endpoint_descriptor obex_hs_ep_out_desc __initdata = {

.bEndpointAddress = USB_DIR_OUT,
.bmAttributes = USB_ENDPOINT_XFER_BULK,
.wMaxPacketSize = __constant_cpu_to_le16(512),
.wMaxPacketSize = cpu_to_le16(512),
};

static struct usb_endpoint_descriptor obex_hs_ep_in_desc __initdata = {
Expand All @@ -158,7 +158,7 @@ static struct usb_endpoint_descriptor obex_hs_ep_in_desc __initdata = {

.bEndpointAddress = USB_DIR_IN,
.bmAttributes = USB_ENDPOINT_XFER_BULK,
.wMaxPacketSize = __constant_cpu_to_le16(512),
.wMaxPacketSize = cpu_to_le16(512),
};

static struct usb_descriptor_header *hs_function[] __initdata = {
Expand Down
8 changes: 4 additions & 4 deletions drivers/usb/gadget/f_phonet.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,15 @@ pn_header_desc = {
.bLength = sizeof pn_header_desc,
.bDescriptorType = USB_DT_CS_INTERFACE,
.bDescriptorSubType = USB_CDC_HEADER_TYPE,
.bcdCDC = __constant_cpu_to_le16(0x0110),
.bcdCDC = cpu_to_le16(0x0110),
};

static const struct usb_cdc_header_desc
pn_phonet_desc = {
.bLength = sizeof pn_phonet_desc,
.bDescriptorType = USB_DT_CS_INTERFACE,
.bDescriptorSubType = USB_CDC_PHONET_TYPE,
.bcdCDC = __constant_cpu_to_le16(0x1505), /* ??? */
.bcdCDC = cpu_to_le16(0x1505), /* ??? */
};

static struct usb_cdc_union_desc
Expand Down Expand Up @@ -138,7 +138,7 @@ pn_hs_sink_desc = {

.bEndpointAddress = USB_DIR_OUT,
.bmAttributes = USB_ENDPOINT_XFER_BULK,
.wMaxPacketSize = __constant_cpu_to_le16(512),
.wMaxPacketSize = cpu_to_le16(512),
};

static struct usb_endpoint_descriptor
Expand All @@ -157,7 +157,7 @@ pn_hs_source_desc = {

.bEndpointAddress = USB_DIR_IN,
.bmAttributes = USB_ENDPOINT_XFER_BULK,
.wMaxPacketSize = __constant_cpu_to_le16(512),
.wMaxPacketSize = cpu_to_le16(512),
};

static struct usb_descriptor_header *fs_pn_function[] = {
Expand Down
Loading

0 comments on commit 551509d

Please sign in to comment.