Commit 05bccceb authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

Merge tag 'fixes-for-v4.15-rc2' of...

Merge tag 'fixes-for-v4.15-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-linus

Felipe writes:

usb: fixes for v4.15-rc2

After a long time, we finally have a good solution for how to handle
OS descriptor on FFS. From now on we will force the Reserved field to
be 1 as mandated by the specification.

Apart from that, we have a couple other smaller fixes:

- FFS learned to not sleep in atomic context.
- UDC-core has a fix for the way we set a UDC's operating speed.
- Renesas USB3 has a fix for the maximum number of pipes supported
- Allow legacy drivers to be compiled without USB_ETH
- Fix some coccinelle warnings
parents 7a38b2d1 a3acc696
...@@ -508,8 +508,8 @@ choice ...@@ -508,8 +508,8 @@ choice
controller, and the relevant drivers for each function declared controller, and the relevant drivers for each function declared
by the device. by the device.
source "drivers/usb/gadget/legacy/Kconfig"
endchoice endchoice
source "drivers/usb/gadget/legacy/Kconfig"
endif # USB_GADGET endif # USB_GADGET
...@@ -146,7 +146,6 @@ int config_ep_by_speed(struct usb_gadget *g, ...@@ -146,7 +146,6 @@ int config_ep_by_speed(struct usb_gadget *g,
struct usb_function *f, struct usb_function *f,
struct usb_ep *_ep) struct usb_ep *_ep)
{ {
struct usb_composite_dev *cdev = get_gadget_data(g);
struct usb_endpoint_descriptor *chosen_desc = NULL; struct usb_endpoint_descriptor *chosen_desc = NULL;
struct usb_descriptor_header **speed_desc = NULL; struct usb_descriptor_header **speed_desc = NULL;
...@@ -226,8 +225,12 @@ int config_ep_by_speed(struct usb_gadget *g, ...@@ -226,8 +225,12 @@ int config_ep_by_speed(struct usb_gadget *g,
_ep->maxburst = comp_desc->bMaxBurst + 1; _ep->maxburst = comp_desc->bMaxBurst + 1;
break; break;
default: default:
if (comp_desc->bMaxBurst != 0) if (comp_desc->bMaxBurst != 0) {
struct usb_composite_dev *cdev;
cdev = get_gadget_data(g);
ERROR(cdev, "ep0 bMaxBurst must be 0\n"); ERROR(cdev, "ep0 bMaxBurst must be 0\n");
}
_ep->maxburst = 1; _ep->maxburst = 1;
break; break;
} }
......
...@@ -1012,7 +1012,7 @@ static ssize_t ffs_epfile_io(struct file *file, struct ffs_io_data *io_data) ...@@ -1012,7 +1012,7 @@ static ssize_t ffs_epfile_io(struct file *file, struct ffs_io_data *io_data)
else else
ret = ep->status; ret = ep->status;
goto error_mutex; goto error_mutex;
} else if (!(req = usb_ep_alloc_request(ep->ep, GFP_KERNEL))) { } else if (!(req = usb_ep_alloc_request(ep->ep, GFP_ATOMIC))) {
ret = -ENOMEM; ret = -ENOMEM;
} else { } else {
req->buf = data; req->buf = data;
...@@ -2282,9 +2282,18 @@ static int __ffs_data_do_os_desc(enum ffs_os_desc_type type, ...@@ -2282,9 +2282,18 @@ static int __ffs_data_do_os_desc(enum ffs_os_desc_type type,
int i; int i;
if (len < sizeof(*d) || if (len < sizeof(*d) ||
d->bFirstInterfaceNumber >= ffs->interfaces_count || d->bFirstInterfaceNumber >= ffs->interfaces_count)
!d->Reserved1)
return -EINVAL; return -EINVAL;
if (d->Reserved1 != 1) {
/*
* According to the spec, Reserved1 must be set to 1
* but older kernels incorrectly rejected non-zero
* values. We fix it here to avoid returning EINVAL
* in response to values we used to accept.
*/
pr_debug("usb_ext_compat_desc::Reserved1 forced to 1\n");
d->Reserved1 = 1;
}
for (i = 0; i < ARRAY_SIZE(d->Reserved2); ++i) for (i = 0; i < ARRAY_SIZE(d->Reserved2); ++i)
if (d->Reserved2[i]) if (d->Reserved2[i])
return -EINVAL; return -EINVAL;
......
...@@ -13,6 +13,14 @@ ...@@ -13,6 +13,14 @@
# both kinds of controller can also support "USB On-the-Go" (CONFIG_USB_OTG). # both kinds of controller can also support "USB On-the-Go" (CONFIG_USB_OTG).
# #
menuconfig USB_GADGET_LEGACY
bool "Legacy USB Gadget Support"
help
Legacy USB gadgets are USB gadgets that do not use the USB gadget
configfs interface.
if USB_GADGET_LEGACY
config USB_ZERO config USB_ZERO
tristate "Gadget Zero (DEVELOPMENT)" tristate "Gadget Zero (DEVELOPMENT)"
select USB_LIBCOMPOSITE select USB_LIBCOMPOSITE
...@@ -490,3 +498,5 @@ config USB_G_WEBCAM ...@@ -490,3 +498,5 @@ config USB_G_WEBCAM
Say "y" to link the driver statically, or "m" to build a Say "y" to link the driver statically, or "m" to build a
dynamically linked module called "g_webcam". dynamically linked module called "g_webcam".
endif
...@@ -642,7 +642,6 @@ static const struct of_device_id bdc_of_match[] = { ...@@ -642,7 +642,6 @@ static const struct of_device_id bdc_of_match[] = {
static struct platform_driver bdc_driver = { static struct platform_driver bdc_driver = {
.driver = { .driver = {
.name = BRCM_BDC_NAME, .name = BRCM_BDC_NAME,
.owner = THIS_MODULE,
.pm = &bdc_pm_ops, .pm = &bdc_pm_ops,
.of_match_table = bdc_of_match, .of_match_table = bdc_of_match,
}, },
......
...@@ -1069,8 +1069,12 @@ static inline void usb_gadget_udc_stop(struct usb_udc *udc) ...@@ -1069,8 +1069,12 @@ static inline void usb_gadget_udc_stop(struct usb_udc *udc)
static inline void usb_gadget_udc_set_speed(struct usb_udc *udc, static inline void usb_gadget_udc_set_speed(struct usb_udc *udc,
enum usb_device_speed speed) enum usb_device_speed speed)
{ {
if (udc->gadget->ops->udc_set_speed) if (udc->gadget->ops->udc_set_speed) {
udc->gadget->ops->udc_set_speed(udc->gadget, speed); enum usb_device_speed s;
s = min(speed, udc->gadget->max_speed);
udc->gadget->ops->udc_set_speed(udc->gadget, s);
}
} }
/** /**
......
...@@ -252,7 +252,7 @@ ...@@ -252,7 +252,7 @@
#define USB3_EP0_SS_MAX_PACKET_SIZE 512 #define USB3_EP0_SS_MAX_PACKET_SIZE 512
#define USB3_EP0_HSFS_MAX_PACKET_SIZE 64 #define USB3_EP0_HSFS_MAX_PACKET_SIZE 64
#define USB3_EP0_BUF_SIZE 8 #define USB3_EP0_BUF_SIZE 8
#define USB3_MAX_NUM_PIPES 30 #define USB3_MAX_NUM_PIPES 6 /* This includes PIPE 0 */
#define USB3_WAIT_US 3 #define USB3_WAIT_US 3
#define USB3_DMA_NUM_SETTING_AREA 4 #define USB3_DMA_NUM_SETTING_AREA 4
/* /*
......
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