Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 321980
b: refs/heads/master
c: aefe5c0
h: refs/heads/master
v: v3
  • Loading branch information
Bjørn Mork authored and David S. Miller committed Aug 14, 2012
1 parent ba3477c commit 502fde5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 41 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: 5ea429638fbd9f18e6837e3e83a1f517741ec43b
refs/heads/master: aefe5c0060639914cce7ed4947f2c030f615bebf
52 changes: 12 additions & 40 deletions trunk/drivers/net/usb/sierra_net.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,8 @@ static atomic_t iface_counter = ATOMIC_INIT(0);
*/
#define SIERRA_NET_USBCTL_BUF_LEN 1024

/* list of interface numbers - used for constructing interface lists */
struct sierra_net_iface_info {
const u32 infolen; /* number of interface numbers on list */
const u8 *ifaceinfo; /* pointer to the array holding the numbers */
};

struct sierra_net_info_data {
u16 rx_urb_size;
struct sierra_net_iface_info whitelist;
};

/* Private data structure */
Expand Down Expand Up @@ -637,21 +630,6 @@ static int sierra_net_change_mtu(struct net_device *net, int new_mtu)
return usbnet_change_mtu(net, new_mtu);
}

static int is_whitelisted(const u8 ifnum,
const struct sierra_net_iface_info *whitelist)
{
if (whitelist) {
const u8 *list = whitelist->ifaceinfo;
int i;

for (i = 0; i < whitelist->infolen; i++) {
if (list[i] == ifnum)
return 1;
}
}
return 0;
}

static int sierra_net_get_fw_attr(struct usbnet *dev, u16 *datap)
{
int result = 0;
Expand Down Expand Up @@ -706,11 +684,6 @@ static int sierra_net_bind(struct usbnet *dev, struct usb_interface *intf)
dev_dbg(&dev->udev->dev, "%s", __func__);

ifacenum = intf->cur_altsetting->desc.bInterfaceNumber;
/* We only accept certain interfaces */
if (!is_whitelisted(ifacenum, &data->whitelist)) {
dev_dbg(&dev->udev->dev, "Ignoring interface: %d", ifacenum);
return -ENODEV;
}
numendpoints = intf->cur_altsetting->desc.bNumEndpoints;
/* We have three endpoints, bulk in and out, and a status */
if (numendpoints != 3) {
Expand Down Expand Up @@ -945,13 +918,8 @@ struct sk_buff *sierra_net_tx_fixup(struct usbnet *dev, struct sk_buff *skb,
return NULL;
}

static const u8 sierra_net_ifnum_list[] = { 7, 10, 11 };
static const struct sierra_net_info_data sierra_net_info_data_direct_ip = {
.rx_urb_size = 8 * 1024,
.whitelist = {
.infolen = ARRAY_SIZE(sierra_net_ifnum_list),
.ifaceinfo = sierra_net_ifnum_list
}
};

static const struct driver_info sierra_net_info_direct_ip = {
Expand All @@ -965,15 +933,19 @@ static const struct driver_info sierra_net_info_direct_ip = {
.data = (unsigned long)&sierra_net_info_data_direct_ip,
};

#define DIRECT_IP_DEVICE(vend, prod) \
{USB_DEVICE_INTERFACE_NUMBER(vend, prod, 7), \
.driver_info = (unsigned long)&sierra_net_info_direct_ip}, \
{USB_DEVICE_INTERFACE_NUMBER(vend, prod, 10), \
.driver_info = (unsigned long)&sierra_net_info_direct_ip}, \
{USB_DEVICE_INTERFACE_NUMBER(vend, prod, 11), \
.driver_info = (unsigned long)&sierra_net_info_direct_ip}

static const struct usb_device_id products[] = {
{USB_DEVICE(0x1199, 0x68A3), /* Sierra Wireless USB-to-WWAN modem */
.driver_info = (unsigned long) &sierra_net_info_direct_ip},
{USB_DEVICE(0x0F3D, 0x68A3), /* AT&T Direct IP modem */
.driver_info = (unsigned long) &sierra_net_info_direct_ip},
{USB_DEVICE(0x1199, 0x68AA), /* Sierra Wireless Direct IP LTE modem */
.driver_info = (unsigned long) &sierra_net_info_direct_ip},
{USB_DEVICE(0x0F3D, 0x68AA), /* AT&T Direct IP LTE modem */
.driver_info = (unsigned long) &sierra_net_info_direct_ip},
DIRECT_IP_DEVICE(0x1199, 0x68A3), /* Sierra Wireless USB-to-WWAN modem */
DIRECT_IP_DEVICE(0x0F3D, 0x68A3), /* AT&T Direct IP modem */
DIRECT_IP_DEVICE(0x1199, 0x68AA), /* Sierra Wireless Direct IP LTE modem */
DIRECT_IP_DEVICE(0x0F3D, 0x68AA), /* AT&T Direct IP LTE modem */

{}, /* last item */
};
Expand Down

0 comments on commit 502fde5

Please sign in to comment.