summaryrefslogtreecommitdiff
path: root/drivers/usb/serial/whiteheat.c
diff options
context:
space:
mode:
authorJohan Hovold <johan@kernel.org>2017-03-02 14:51:34 +0300
committerJohan Hovold <johan@kernel.org>2017-03-16 12:33:47 +0300
commit2ac8fc51ddf152fdd2344c6d286976803183d59c (patch)
treead6d266ca0bb11d55ba13d6f8f639ffb25169f41 /drivers/usb/serial/whiteheat.c
parente2cd017f1b7c2e79b3a89d3c8e31c88ad365243a (diff)
downloadlinux-2ac8fc51ddf152fdd2344c6d286976803183d59c.tar.xz
USB: serial: whiteheat: simplify endpoint check
Simplify the endpoint sanity check by letting core verify that the required endpoints are present. Note that the driver registers four ports but uses five bulk-endpoint pairs. Signed-off-by: Johan Hovold <johan@kernel.org>
Diffstat (limited to 'drivers/usb/serial/whiteheat.c')
-rw-r--r--drivers/usb/serial/whiteheat.c32
1 files changed, 2 insertions, 30 deletions
diff --git a/drivers/usb/serial/whiteheat.c b/drivers/usb/serial/whiteheat.c
index 5ab65eb1dacc..55cebc1e6fec 100644
--- a/drivers/usb/serial/whiteheat.c
+++ b/drivers/usb/serial/whiteheat.c
@@ -80,8 +80,6 @@ static int whiteheat_firmware_download(struct usb_serial *serial,
static int whiteheat_firmware_attach(struct usb_serial *serial);
/* function prototypes for the Connect Tech WhiteHEAT serial converter */
-static int whiteheat_probe(struct usb_serial *serial,
- const struct usb_device_id *id);
static int whiteheat_attach(struct usb_serial *serial);
static void whiteheat_release(struct usb_serial *serial);
static int whiteheat_port_probe(struct usb_serial_port *port);
@@ -118,7 +116,8 @@ static struct usb_serial_driver whiteheat_device = {
.description = "Connect Tech - WhiteHEAT",
.id_table = id_table_std,
.num_ports = 4,
- .probe = whiteheat_probe,
+ .num_bulk_in = 5,
+ .num_bulk_out = 5,
.attach = whiteheat_attach,
.release = whiteheat_release,
.port_probe = whiteheat_port_probe,
@@ -221,33 +220,6 @@ static int whiteheat_firmware_attach(struct usb_serial *serial)
* Connect Tech's White Heat serial driver functions
*****************************************************************************/
-static int whiteheat_probe(struct usb_serial *serial,
- const struct usb_device_id *id)
-{
- struct usb_host_interface *iface_desc;
- struct usb_endpoint_descriptor *endpoint;
- size_t num_bulk_in = 0;
- size_t num_bulk_out = 0;
- size_t min_num_bulk;
- unsigned int i;
-
- iface_desc = serial->interface->cur_altsetting;
-
- for (i = 0; i < iface_desc->desc.bNumEndpoints; i++) {
- endpoint = &iface_desc->endpoint[i].desc;
- if (usb_endpoint_is_bulk_in(endpoint))
- ++num_bulk_in;
- if (usb_endpoint_is_bulk_out(endpoint))
- ++num_bulk_out;
- }
-
- min_num_bulk = COMMAND_PORT + 1;
- if (num_bulk_in < min_num_bulk || num_bulk_out < min_num_bulk)
- return -ENODEV;
-
- return 0;
-}
-
static int whiteheat_attach(struct usb_serial *serial)
{
struct usb_serial_port *command_port;