[PATCH v2] usb/gadget: remove DUALSPEED from printer

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

This patch demoves the DUALSPEED macro and makes the HS (and FS) case
the default. This is one little step before composite can be used for
descriptor management.

Signed-off-by: Sebastian Andrzej Siewior <sebastian@xxxxxxxxxxxxx>
- ---
v1..v2: redo patch description

 drivers/usb/gadget/printer.c |   25 +------------------------
 1 files changed, 1 insertions(+), 24 deletions(-)

diff --git a/drivers/usb/gadget/printer.c b/drivers/usb/gadget/printer.c
index d83134b..1db9377 100644
- --- a/drivers/usb/gadget/printer.c
+++ b/drivers/usb/gadget/printer.c
@@ -155,12 +155,6 @@ module_param(qlen, uint, S_IRUGO|S_IWUSR);
 
 #define QLEN	qlen
 
- -#ifdef CONFIG_USB_GADGET_DUALSPEED
- -#define DEVSPEED	USB_SPEED_HIGH
- -#else   /* full speed (low speed doesn't do bulk) */
- -#define DEVSPEED        USB_SPEED_FULL
- -#endif
- -
 /*-------------------------------------------------------------------------*/
 
 #define xprintk(d, level, fmt, args...) \
@@ -279,8 +273,6 @@ static const struct usb_descriptor_header *fs_printer_function [11] = {
 	NULL
 };
 
- -#ifdef	CONFIG_USB_GADGET_DUALSPEED
- -
 /*
  * usb 2.0 devices need to expose both high speed and full speed
  * descriptors, unless they only run at full speed.
@@ -319,13 +311,6 @@ static const struct usb_descriptor_header *hs_printer_function [11] = {
 /* maxpacket and other transfer characteristics vary by speed. */
 #define ep_desc(g, hs, fs) (((g)->speed == USB_SPEED_HIGH)?(hs):(fs))
 
- -#else
- -
- -/* if there's no high speed support, maxpacket doesn't change. */
- -#define ep_desc(g, hs, fs) (((void)(g)), (fs))
- -
- -#endif	/* !CONFIG_USB_GADGET_DUALSPEED */
- -
 /*-------------------------------------------------------------------------*/
 
 /* descriptors that are built on-demand */
@@ -981,7 +966,6 @@ config_buf(enum usb_device_speed speed, u8 *buf, u8 type, unsigned index,
 {
 	int					len;
 	const struct usb_descriptor_header	**function;
- -#ifdef CONFIG_USB_GADGET_DUALSPEED
 	int					hs = (speed == USB_SPEED_HIGH);
 
 	if (type == USB_DT_OTHER_SPEED_CONFIG)
@@ -992,9 +976,6 @@ config_buf(enum usb_device_speed speed, u8 *buf, u8 type, unsigned index,
 	} else {
 		function = fs_printer_function;
 	}
- -#else
- -	function = fs_printer_function;
- -#endif
 
 	if (index >= device_desc.bNumConfigurations)
 		return -EINVAL;
@@ -1139,7 +1120,6 @@ printer_setup(struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl)
 				value = min(wLength, (u16) sizeof device_desc);
 				memcpy(req->buf, &device_desc, value);
 				break;
- -#ifdef CONFIG_USB_GADGET_DUALSPEED
 			case USB_DT_DEVICE_QUALIFIER:
 				if (!gadget_is_dualspeed(gadget))
 					break;
@@ -1158,7 +1138,6 @@ printer_setup(struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl)
 				if (!gadget_is_dualspeed(gadget))
 					break;
 				/* FALLTHROUGH */
- -#endif /* CONFIG_USB_GADGET_DUALSPEED */
 			case USB_DT_CONFIG:
 				value = config_buf(gadget->speed, req->buf,
 						wValue >> 8,
@@ -1443,11 +1422,9 @@ autoconf_fail:
 		goto autoconf_fail;
 	out_ep->driver_data = out_ep;	/* claim */
 
- -#ifdef	CONFIG_USB_GADGET_DUALSPEED
 	/* assumes that all endpoints are dual-speed */
 	hs_ep_in_desc.bEndpointAddress = fs_ep_in_desc.bEndpointAddress;
 	hs_ep_out_desc.bEndpointAddress = fs_ep_out_desc.bEndpointAddress;
- -#endif	/* DUALSPEED */
 
 	usb_gadget_set_selfpowered(gadget);
 
@@ -1535,7 +1512,7 @@ fail:
 /*-------------------------------------------------------------------------*/
 
 static struct usb_gadget_driver printer_driver = {
- -	.max_speed	= DEVSPEED,
+	.max_speed	= USB_SPEED_HIGH,
 
 	.function	= (char *) driver_desc,
 	.unbind		= printer_unbind,
- -- 
1.7.8.3

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)

iQIcBAEBCAAGBQJPMYu3AAoJEHuW6BYqjPXRpq8P+wSrxeAqClYUR5mnX8CXGi4w
eFc1FrkECTta2YgIGVGuKE4+0jvSjisiumAQZSjOi2PLCbgOFRH1Sebe0wv3+LJ3
kV/NcyJXGg+8u+bCQMtA2T9yjWpB2ljKLkhUxkUeUKgM7w5r1U8mFB6fxDAshIOz
Xp5OoyLGf2PegxCYGnJCdsw1TMQ2zj9TKIVTnwg4Du4rmuSqDAbLgbXKFEGkfZyM
ubcHAmPiBkFT6wW5qWkc/runlz2+Bgo7T7jGuFHp83lJtx7JVS0nzZtRxzrsqT5P
rUPIL54ElzfCp8xDqvYAImQU2ue2MOIyaCKR57TWxqtPzvlmhNjcFi+3eQmCpWpT
td3KYIQT3sog7DdgrGoSpL+VRoUM31jAhI9NK89WhDn3fCeYmO+wMzx/Y48svQAu
njxLMND/ozo/tTC4CYHkwykK7nNwSccD6jGb+TVH+F99+QQUNdrfgbllLCn5lp+6
1ZcBNU95BPAUIG4ycQCTlEDBgKMK8W2O0UEEOsmXYW4Gi3Rbbv8gWAWK/jLDpoFA
MC4ItVIXKSVOMvF9OHVfh6znkpahceWTfHFXLq9cbezuCA8zq97h2qv+ahWzzb7R
szVHVwxAh0j+b5ZmI37whTqtpid2E5kFlX4Lp9+U0Acuz/Rn3br3+IJR73DUYjFd
CNcGQjTnnfyYnyFKhRV9
=pao0
-----END PGP SIGNATURE-----
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux