diff options
Diffstat (limited to 'drivers/net/usb/sierra_net.c')
-rw-r--r-- | drivers/net/usb/sierra_net.c | 52 |
1 files changed, 12 insertions, 40 deletions
diff --git a/drivers/net/usb/sierra_net.c b/drivers/net/usb/sierra_net.c index d75d1f56becf..7be49ea60b6d 100644 --- a/drivers/net/usb/sierra_net.c +++ b/drivers/net/usb/sierra_net.c | |||
@@ -68,15 +68,8 @@ static atomic_t iface_counter = ATOMIC_INIT(0); | |||
68 | */ | 68 | */ |
69 | #define SIERRA_NET_USBCTL_BUF_LEN 1024 | 69 | #define SIERRA_NET_USBCTL_BUF_LEN 1024 |
70 | 70 | ||
71 | /* list of interface numbers - used for constructing interface lists */ | ||
72 | struct sierra_net_iface_info { | ||
73 | const u32 infolen; /* number of interface numbers on list */ | ||
74 | const u8 *ifaceinfo; /* pointer to the array holding the numbers */ | ||
75 | }; | ||
76 | |||
77 | struct sierra_net_info_data { | 71 | struct sierra_net_info_data { |
78 | u16 rx_urb_size; | 72 | u16 rx_urb_size; |
79 | struct sierra_net_iface_info whitelist; | ||
80 | }; | 73 | }; |
81 | 74 | ||
82 | /* Private data structure */ | 75 | /* Private data structure */ |
@@ -637,21 +630,6 @@ static int sierra_net_change_mtu(struct net_device *net, int new_mtu) | |||
637 | return usbnet_change_mtu(net, new_mtu); | 630 | return usbnet_change_mtu(net, new_mtu); |
638 | } | 631 | } |
639 | 632 | ||
640 | static int is_whitelisted(const u8 ifnum, | ||
641 | const struct sierra_net_iface_info *whitelist) | ||
642 | { | ||
643 | if (whitelist) { | ||
644 | const u8 *list = whitelist->ifaceinfo; | ||
645 | int i; | ||
646 | |||
647 | for (i = 0; i < whitelist->infolen; i++) { | ||
648 | if (list[i] == ifnum) | ||
649 | return 1; | ||
650 | } | ||
651 | } | ||
652 | return 0; | ||
653 | } | ||
654 | |||
655 | static int sierra_net_get_fw_attr(struct usbnet *dev, u16 *datap) | 633 | static int sierra_net_get_fw_attr(struct usbnet *dev, u16 *datap) |
656 | { | 634 | { |
657 | int result = 0; | 635 | int result = 0; |
@@ -706,11 +684,6 @@ static int sierra_net_bind(struct usbnet *dev, struct usb_interface *intf) | |||
706 | dev_dbg(&dev->udev->dev, "%s", __func__); | 684 | dev_dbg(&dev->udev->dev, "%s", __func__); |
707 | 685 | ||
708 | ifacenum = intf->cur_altsetting->desc.bInterfaceNumber; | 686 | ifacenum = intf->cur_altsetting->desc.bInterfaceNumber; |
709 | /* We only accept certain interfaces */ | ||
710 | if (!is_whitelisted(ifacenum, &data->whitelist)) { | ||
711 | dev_dbg(&dev->udev->dev, "Ignoring interface: %d", ifacenum); | ||
712 | return -ENODEV; | ||
713 | } | ||
714 | numendpoints = intf->cur_altsetting->desc.bNumEndpoints; | 687 | numendpoints = intf->cur_altsetting->desc.bNumEndpoints; |
715 | /* We have three endpoints, bulk in and out, and a status */ | 688 | /* We have three endpoints, bulk in and out, and a status */ |
716 | if (numendpoints != 3) { | 689 | if (numendpoints != 3) { |
@@ -945,13 +918,8 @@ struct sk_buff *sierra_net_tx_fixup(struct usbnet *dev, struct sk_buff *skb, | |||
945 | return NULL; | 918 | return NULL; |
946 | } | 919 | } |
947 | 920 | ||
948 | static const u8 sierra_net_ifnum_list[] = { 7, 10, 11 }; | ||
949 | static const struct sierra_net_info_data sierra_net_info_data_direct_ip = { | 921 | static const struct sierra_net_info_data sierra_net_info_data_direct_ip = { |
950 | .rx_urb_size = 8 * 1024, | 922 | .rx_urb_size = 8 * 1024, |
951 | .whitelist = { | ||
952 | .infolen = ARRAY_SIZE(sierra_net_ifnum_list), | ||
953 | .ifaceinfo = sierra_net_ifnum_list | ||
954 | } | ||
955 | }; | 923 | }; |
956 | 924 | ||
957 | static const struct driver_info sierra_net_info_direct_ip = { | 925 | static const struct driver_info sierra_net_info_direct_ip = { |
@@ -965,15 +933,19 @@ static const struct driver_info sierra_net_info_direct_ip = { | |||
965 | .data = (unsigned long)&sierra_net_info_data_direct_ip, | 933 | .data = (unsigned long)&sierra_net_info_data_direct_ip, |
966 | }; | 934 | }; |
967 | 935 | ||
936 | #define DIRECT_IP_DEVICE(vend, prod) \ | ||
937 | {USB_DEVICE_INTERFACE_NUMBER(vend, prod, 7), \ | ||
938 | .driver_info = (unsigned long)&sierra_net_info_direct_ip}, \ | ||
939 | {USB_DEVICE_INTERFACE_NUMBER(vend, prod, 10), \ | ||
940 | .driver_info = (unsigned long)&sierra_net_info_direct_ip}, \ | ||
941 | {USB_DEVICE_INTERFACE_NUMBER(vend, prod, 11), \ | ||
942 | .driver_info = (unsigned long)&sierra_net_info_direct_ip} | ||
943 | |||
968 | static const struct usb_device_id products[] = { | 944 | static const struct usb_device_id products[] = { |
969 | {USB_DEVICE(0x1199, 0x68A3), /* Sierra Wireless USB-to-WWAN modem */ | 945 | DIRECT_IP_DEVICE(0x1199, 0x68A3), /* Sierra Wireless USB-to-WWAN modem */ |
970 | .driver_info = (unsigned long) &sierra_net_info_direct_ip}, | 946 | DIRECT_IP_DEVICE(0x0F3D, 0x68A3), /* AT&T Direct IP modem */ |
971 | {USB_DEVICE(0x0F3D, 0x68A3), /* AT&T Direct IP modem */ | 947 | DIRECT_IP_DEVICE(0x1199, 0x68AA), /* Sierra Wireless Direct IP LTE modem */ |
972 | .driver_info = (unsigned long) &sierra_net_info_direct_ip}, | 948 | DIRECT_IP_DEVICE(0x0F3D, 0x68AA), /* AT&T Direct IP LTE modem */ |
973 | {USB_DEVICE(0x1199, 0x68AA), /* Sierra Wireless Direct IP LTE modem */ | ||
974 | .driver_info = (unsigned long) &sierra_net_info_direct_ip}, | ||
975 | {USB_DEVICE(0x0F3D, 0x68AA), /* AT&T Direct IP LTE modem */ | ||
976 | .driver_info = (unsigned long) &sierra_net_info_direct_ip}, | ||
977 | 949 | ||
978 | {}, /* last item */ | 950 | {}, /* last item */ |
979 | }; | 951 | }; |