Commit e5f78c74 authored by David Brownell's avatar David Brownell Committed by Linus Torvalds

[PATCH] Fix big-endian USB gadget build

Initializers must be constant expressions, and thus we can't use the
complex expression "cpu_to_le*()" - the end result of which may have a
constant _value_ but the expression itself isn't a constant expression.

So use the explicitly constant "__constant_cpu_to_*()" expression
instead.
parent 4b598ef6
......@@ -168,7 +168,7 @@ module_param (qmult, uint, S_IRUGO|S_IWUSR);
*/
#ifdef CONFIG_USB_ETH_NET2280
#define CHIP "net2280"
#define DRIVER_VERSION_NUM cpu_to_le16(0x0101)
#define DRIVER_VERSION_NUM 0x0101
#define EP0_MAXPACKET 64
static const char EP_OUT_NAME [] = "ep-a";
#define EP_OUT_NUM 2
......@@ -201,7 +201,7 @@ static inline void hw_optimize (struct usb_gadget *gadget)
*/
#ifdef CONFIG_USB_ETH_PXA250
#define CHIP "pxa250"
#define DRIVER_VERSION_NUM cpu_to_le16(0x0103)
#define DRIVER_VERSION_NUM 0x0103
#define EP0_MAXPACKET 16
static const char EP_OUT_NAME [] = "ep12out-bulk";
#define EP_OUT_NUM 12
......@@ -225,7 +225,7 @@ static const char EP_STATUS_NAME [] = "ep6in-bulk";
*/
#ifdef CONFIG_USB_ETH_SA1100
#define CHIP "sa1100"
#define DRIVER_VERSION_NUM cpu_to_le16(0x0105)
#define DRIVER_VERSION_NUM 0x0105
#define EP0_MAXPACKET 8
static const char EP_OUT_NAME [] = "ep1out-bulk";
#define EP_OUT_NUM 1
......@@ -329,15 +329,15 @@ device_desc = {
.bLength = sizeof device_desc,
.bDescriptorType = USB_DT_DEVICE,
.bcdUSB = cpu_to_le16 (0x0200),
.bcdUSB = __constant_cpu_to_le16 (0x0200),
.bDeviceClass = USB_CLASS_COMM,
.bDeviceSubClass = 0,
.bDeviceProtocol = 0,
.bMaxPacketSize0 = EP0_MAXPACKET,
.idVendor = cpu_to_le16 (DRIVER_VENDOR_NUM),
.idProduct = cpu_to_le16 (DRIVER_PRODUCT_NUM),
.bcdDevice = cpu_to_le16 (DRIVER_VERSION_NUM),
.idVendor = __constant_cpu_to_le16 (DRIVER_VENDOR_NUM),
.idProduct = __constant_cpu_to_le16 (DRIVER_PRODUCT_NUM),
.bcdDevice = __constant_cpu_to_le16 (DRIVER_VERSION_NUM),
.iManufacturer = STRING_MANUFACTURER,
.iProduct = STRING_PRODUCT,
.bNumConfigurations = 1,
......@@ -389,7 +389,7 @@ static const struct header_desc header_desc = {
.bDescriptorType = 0x24,
.bDescriptorSubType = 0,
.bcdCDC = cpu_to_le16 (0x0110),
.bcdCDC = __constant_cpu_to_le16 (0x0110),
};
/* "Union Functional Descriptor" from CDC spec 5.2.3.X */
......@@ -432,9 +432,9 @@ static const struct ether_desc ether_desc = {
/* this descriptor actually adds value, surprise! */
.iMACAddress = STRING_ETHADDR,
.bmEthernetStatistics = cpu_to_le32 (0), /* no statistics */
.wMaxSegmentSize = cpu_to_le16 (MAX_PACKET + ETH_HLEN),
.wNumberMCFilters = cpu_to_le16 (0),
.bmEthernetStatistics = __constant_cpu_to_le32 (0), /* no statistics */
.wMaxSegmentSize = __constant_cpu_to_le16 (MAX_PACKET + ETH_HLEN),
.wNumberMCFilters = __constant_cpu_to_le16 (0),
.bNumberPowerFilters = 0,
};
......@@ -457,7 +457,7 @@ fs_status_desc = {
.bEndpointAddress = EP_STATUS_NUM | USB_DIR_IN,
.bmAttributes = USB_ENDPOINT_XFER_INT,
.wMaxPacketSize = cpu_to_le16 (STATUS_BYTECOUNT),
.wMaxPacketSize = __constant_cpu_to_le16 (STATUS_BYTECOUNT),
.bInterval = 1 << LOG2_STATUS_INTERVAL_MSEC,
};
#endif
......@@ -501,7 +501,7 @@ fs_source_desc = {
.bEndpointAddress = EP_IN_NUM | USB_DIR_IN,
.bmAttributes = USB_ENDPOINT_XFER_BULK,
.wMaxPacketSize = cpu_to_le16 (64),
.wMaxPacketSize = __constant_cpu_to_le16 (64),
};
static const struct usb_endpoint_descriptor
......@@ -511,7 +511,7 @@ fs_sink_desc = {
.bEndpointAddress = EP_OUT_NUM,
.bmAttributes = USB_ENDPOINT_XFER_BULK,
.wMaxPacketSize = cpu_to_le16 (64),
.wMaxPacketSize = __constant_cpu_to_le16 (64),
};
#ifdef HIGHSPEED
......@@ -529,7 +529,7 @@ hs_status_desc = {
.bEndpointAddress = EP_STATUS_NUM | USB_DIR_IN,
.bmAttributes = USB_ENDPOINT_XFER_INT,
.wMaxPacketSize = cpu_to_le16 (STATUS_BYTECOUNT),
.wMaxPacketSize = __constant_cpu_to_le16 (STATUS_BYTECOUNT),
.bInterval = LOG2_STATUS_INTERVAL_MSEC + 3,
};
#endif
......@@ -541,7 +541,7 @@ hs_source_desc = {
.bEndpointAddress = EP_IN_NUM | USB_DIR_IN,
.bmAttributes = USB_ENDPOINT_XFER_BULK,
.wMaxPacketSize = cpu_to_le16 (512),
.wMaxPacketSize = __constant_cpu_to_le16 (512),
.bInterval = 1,
};
......@@ -552,7 +552,7 @@ hs_sink_desc = {
.bEndpointAddress = EP_OUT_NUM,
.bmAttributes = USB_ENDPOINT_XFER_BULK,
.wMaxPacketSize = cpu_to_le16 (512),
.wMaxPacketSize = __constant_cpu_to_le16 (512),
.bInterval = 1,
};
......@@ -561,7 +561,7 @@ dev_qualifier = {
.bLength = sizeof dev_qualifier,
.bDescriptorType = USB_DT_DEVICE_QUALIFIER,
.bcdUSB = cpu_to_le16 (0x0200),
.bcdUSB = __constant_cpu_to_le16 (0x0200),
.bDeviceClass = USB_CLASS_VENDOR_SPEC,
/* assumes ep0 uses the same value for both speeds ... */
......@@ -627,7 +627,7 @@ config_buf (enum usb_device_speed speed, u8 *buf, u8 type, unsigned index)
memcpy (buf, &eth_config, USB_DT_CONFIG_SIZE);
buf [1] = type;
((struct usb_config_descriptor *) buf)->wTotalLength
= cpu_to_le16 (config_len);
= __constant_cpu_to_le16 (config_len);
buf += USB_DT_CONFIG_SIZE;
#ifdef HIGHSPEED
hs = (speed == USB_SPEED_HIGH);
......@@ -858,9 +858,9 @@ static void eth_status_complete (struct usb_ep *ep, struct usb_request *req)
&& value == 0) {
event->bmRequestType = 0xA1;
event->bNotificationType = CDC_NOTIFY_SPEED_CHANGE;
event->wValue = cpu_to_le16 (0);
event->wIndex = cpu_to_le16 (1);
event->wLength = cpu_to_le16 (8);
event->wValue = __constant_cpu_to_le16 (0);
event->wIndex = __constant_cpu_to_le16 (1);
event->wLength = __constant_cpu_to_le16 (8);
/* SPEED_CHANGE data is up/down speeds in bits/sec */
event->data [0] = event->data [1] =
......@@ -920,8 +920,8 @@ static void issue_start_status (struct eth_dev *dev)
event = req->buf;
event->bmRequestType = 0xA1;
event->bNotificationType = CDC_NOTIFY_NETWORK_CONNECTION;
event->wValue = cpu_to_le16 (1); /* connected */
event->wIndex = cpu_to_le16 (1);
event->wValue = __constant_cpu_to_le16 (1); /* connected */
event->wIndex = __constant_cpu_to_le16 (1);
event->wLength = 0;
req->length = 8;
......
......@@ -114,8 +114,8 @@ static char *type_string (u8 bmAttributes)
#include "net2280.h"
#define valid_bit cpu_to_le32 (1 << VALID_BIT)
#define dma_done_ie cpu_to_le32 (1 << DMA_DONE_INTERRUPT_ENABLE)
#define valid_bit __constant_cpu_to_le32 (1 << VALID_BIT)
#define dma_done_ie __constant_cpu_to_le32 (1 << DMA_DONE_INTERRUPT_ENABLE)
/*-------------------------------------------------------------------------*/
......@@ -371,7 +371,7 @@ net2280_alloc_request (struct usb_ep *_ep, int gfp_flags)
return 0;
}
td->dmacount = 0; /* not VALID */
td->dmaaddr = cpu_to_le32 (DMA_ADDR_INVALID);
td->dmaaddr = __constant_cpu_to_le32 (DMA_ADDR_INVALID);
req->td = td;
}
return &req->req;
......@@ -756,7 +756,7 @@ static void start_dma (struct net2280_ep *ep, struct net2280_request *req)
| (ep->is_in << DMA_DIRECTION)
| 0, &dma->dmacount);
#else
req->td->dmacount |= cpu_to_le32 (1 << END_OF_CHAIN);
req->td->dmacount |= __constant_cpu_to_le32 (1 << END_OF_CHAIN);
#endif
writel (req->td_dma, &dma->dmadesc);
......@@ -2157,9 +2157,9 @@ static void handle_stat0_irqs (struct net2280 *dev, u32 stat)
if (readl (&e->regs->ep_rsp)
& (1 << SET_ENDPOINT_HALT))
status = cpu_to_le16 (1);
status = __constant_cpu_to_le16 (1);
else
status = cpu_to_le16 (0);
status = __constant_cpu_to_le16 (0);
/* don't bother with a request object! */
writel (0, &dev->epregs [0].ep_irqenb);
......@@ -2574,7 +2574,7 @@ static int net2280_probe (struct pci_dev *pdev, const struct pci_device_id *id)
goto done;
}
td->dmacount = 0; /* not VALID */
td->dmaaddr = cpu_to_le32 (DMA_ADDR_INVALID);
td->dmaaddr = __constant_cpu_to_le32 (DMA_ADDR_INVALID);
dev->ep [i].dummy = td;
}
......
......@@ -137,7 +137,7 @@ static const char loopback [] = "loop input to output";
*/
#ifdef CONFIG_USB_ZERO_NET2280
#define CHIP "net2280"
#define DRIVER_VERSION_NUM cpu_to_le16(0x0101)
#define DRIVER_VERSION_NUM 0x0101
#define EP0_MAXPACKET 64
static const char EP_OUT_NAME [] = "ep-a";
#define EP_OUT_NUM 2
......@@ -172,7 +172,7 @@ static inline void hw_optimize (struct usb_gadget *gadget)
*/
#ifdef CONFIG_USB_ZERO_PXA250
#define CHIP "pxa250"
#define DRIVER_VERSION_NUM cpu_to_le16(0x0103)
#define DRIVER_VERSION_NUM 0x0103
#define EP0_MAXPACKET 16
static const char EP_OUT_NAME [] = "ep12out-bulk";
#define EP_OUT_NUM 12
......@@ -199,7 +199,7 @@ static const char EP_IN_NAME [] = "ep11in-bulk";
*/
#ifdef CONFIG_USB_ZERO_SA1100
#define CHIP "sa1100"
#define DRIVER_VERSION_NUM cpu_to_le16(0x0105)
#define DRIVER_VERSION_NUM 0x0105
#define EP0_MAXPACKET 8
static const char EP_OUT_NAME [] = "ep1out-bulk";
#define EP_OUT_NUM 1
......@@ -340,13 +340,13 @@ device_desc = {
.bLength = sizeof device_desc,
.bDescriptorType = USB_DT_DEVICE,
.bcdUSB = cpu_to_le16 (0x0200),
.bcdUSB = __constant_cpu_to_le16 (0x0200),
.bDeviceClass = USB_CLASS_VENDOR_SPEC,
.bMaxPacketSize0 = EP0_MAXPACKET,
.idVendor = cpu_to_le16 (DRIVER_VENDOR_NUM),
.idProduct = cpu_to_le16 (DRIVER_PRODUCT_NUM),
.bcdDevice = cpu_to_le16 (DRIVER_VERSION_NUM),
.idVendor = __constant_cpu_to_le16 (DRIVER_VENDOR_NUM),
.idProduct = __constant_cpu_to_le16 (DRIVER_PRODUCT_NUM),
.bcdDevice = __constant_cpu_to_le16 (DRIVER_VERSION_NUM),
.iManufacturer = STRING_MANUFACTURER,
.iProduct = STRING_PRODUCT,
.iSerialNumber = STRING_SERIAL,
......@@ -410,7 +410,7 @@ fs_source_desc = {
.bEndpointAddress = EP_IN_NUM | USB_DIR_IN,
.bmAttributes = USB_ENDPOINT_XFER_BULK,
.wMaxPacketSize = cpu_to_le16 (64),
.wMaxPacketSize = __constant_cpu_to_le16 (64),
};
static const struct usb_endpoint_descriptor
......@@ -420,7 +420,7 @@ fs_sink_desc = {
.bEndpointAddress = EP_OUT_NUM,
.bmAttributes = USB_ENDPOINT_XFER_BULK,
.wMaxPacketSize = cpu_to_le16 (64),
.wMaxPacketSize = __constant_cpu_to_le16 (64),
};
#ifdef HIGHSPEED
......@@ -441,7 +441,7 @@ hs_source_desc = {
.bEndpointAddress = EP_IN_NUM | USB_DIR_IN,
.bmAttributes = USB_ENDPOINT_XFER_BULK,
.wMaxPacketSize = cpu_to_le16 (512),
.wMaxPacketSize = __constant_cpu_to_le16 (512),
};
static const struct usb_endpoint_descriptor
......@@ -451,7 +451,7 @@ hs_sink_desc = {
.bEndpointAddress = EP_OUT_NUM,
.bmAttributes = USB_ENDPOINT_XFER_BULK,
.wMaxPacketSize = cpu_to_le16 (512),
.wMaxPacketSize = __constant_cpu_to_le16 (512),
};
static const struct usb_qualifier_descriptor
......@@ -459,7 +459,7 @@ dev_qualifier = {
.bLength = sizeof dev_qualifier,
.bDescriptorType = USB_DT_DEVICE_QUALIFIER,
.bcdUSB = cpu_to_le16 (0x0200),
.bcdUSB = __constant_cpu_to_le16 (0x0200),
.bDeviceClass = USB_CLASS_VENDOR_SPEC,
/* assumes ep0 uses the same value for both speeds ... */
......@@ -538,7 +538,7 @@ config_buf (enum usb_device_speed speed,
memcpy (buf, &loopback_config, USB_DT_CONFIG_SIZE);
buf [1] = type;
((struct usb_config_descriptor *) buf)->wTotalLength
= cpu_to_le16 (config_len);
= __constant_cpu_to_le16 (config_len);
buf += USB_DT_CONFIG_SIZE;
/* one interface */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment