Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 151370
b: refs/heads/master
c: 9636b68
h: refs/heads/master
v: v3
  • Loading branch information
Elina Pasheva authored and Greg Kroah-Hartman committed Jun 16, 2009
1 parent 3d5d649 commit ecb0a93
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 36 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c76a23da8e9a39222c4a7c29b0c5348cd8902a2b
refs/heads/master: 9636b683769a6c3acfe121314ee9d7e19157f109
49 changes: 14 additions & 35 deletions trunk/drivers/usb/serial/sierra.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,18 +83,22 @@ static int sierra_vsc_set_nmea(struct usb_device *udev, __u16 enable)

static int sierra_calc_num_ports(struct usb_serial *serial)
{
int result;
int *num_ports = usb_get_serial_data(serial);
dev_dbg(&serial->dev->dev, "%s\n", __func__);
int num_ports = 0;
u8 ifnum, numendpoints;

result = *num_ports;
dev_dbg(&serial->dev->dev, "%s\n", __func__);

if (result) {
kfree(num_ports);
usb_set_serial_data(serial, NULL);
}
ifnum = serial->interface->cur_altsetting->desc.bInterfaceNumber;
numendpoints = serial->interface->cur_altsetting->desc.bNumEndpoints;

return result;
/* Dummy interface present on some SKUs should be ignored */
if (ifnum == 0x99)
num_ports = 0;
else if (numendpoints <= 3)
num_ports = 1;
else
num_ports = (numendpoints-1)/2;
return num_ports;
}

static int is_blacklisted(const u8 ifnum,
Expand Down Expand Up @@ -140,23 +144,12 @@ static int sierra_probe(struct usb_serial *serial,
{
int result = 0;
struct usb_device *udev;
int *num_ports;
u8 ifnum;
u8 numendpoints;

dev_dbg(&serial->dev->dev, "%s\n", __func__);

num_ports = kmalloc(sizeof(*num_ports), GFP_KERNEL);
if (!num_ports)
return -ENOMEM;

ifnum = serial->interface->cur_altsetting->desc.bInterfaceNumber;
numendpoints = serial->interface->cur_altsetting->desc.bNumEndpoints;
udev = serial->dev;
dev_dbg(&udev->dev, "%s\n", __func__);

/* Figure out the interface number from the serial structure */
ifnum = sierra_calc_interface(serial);

/*
* If this interface supports more than 1 alternate
* select the 2nd one
Expand All @@ -168,20 +161,6 @@ static int sierra_probe(struct usb_serial *serial,
usb_set_interface(udev, ifnum, 1);
}

/* Dummy interface present on some SKUs should be ignored */
if (ifnum == 0x99)
*num_ports = 0;
else if (numendpoints <= 3)
*num_ports = 1;
else
*num_ports = (numendpoints-1)/2;

/*
* save off our num_ports info so that we can use it in the
* calc_num_ports callback
*/
usb_set_serial_data(serial, (void *)num_ports);

/* ifnum could have changed - by calling usb_set_interface */
ifnum = sierra_calc_interface(serial);

Expand Down

0 comments on commit ecb0a93

Please sign in to comment.