Commit f7385ec9 authored by Ming Lei's avatar Ming Lei Committed by David S. Miller

usbnet: sierra_net: apply introduced usb command APIs

Acked-by: default avatarOliver Neukum <oneukum@suse.de>
Signed-off-by: default avatarMing Lei <ming.lei@canonical.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 7cdd2487
......@@ -311,10 +311,9 @@ static int sierra_net_send_cmd(struct usbnet *dev,
struct sierra_net_data *priv = sierra_net_get_private(dev);
int status;
status = usb_control_msg(dev->udev, usb_sndctrlpipe(dev->udev, 0),
USB_CDC_SEND_ENCAPSULATED_COMMAND,
USB_DIR_OUT|USB_TYPE_CLASS|USB_RECIP_INTERFACE, 0,
priv->ifnum, cmd, cmdlen, USB_CTRL_SET_TIMEOUT);
status = usbnet_write_cmd(dev, USB_CDC_SEND_ENCAPSULATED_COMMAND,
USB_DIR_OUT|USB_TYPE_CLASS|USB_RECIP_INTERFACE,
0, priv->ifnum, cmd, cmdlen);
if (status != cmdlen && status != -ENODEV)
netdev_err(dev->net, "Submit %s failed %d\n", cmd_name, status);
......@@ -632,32 +631,22 @@ static int sierra_net_change_mtu(struct net_device *net, int new_mtu)
static int sierra_net_get_fw_attr(struct usbnet *dev, u16 *datap)
{
int result = 0;
u16 *attrdata;
u16 attrdata;
attrdata = kmalloc(sizeof(*attrdata), GFP_KERNEL);
if (!attrdata)
return -ENOMEM;
result = usb_control_msg(
dev->udev,
usb_rcvctrlpipe(dev->udev, 0),
result = usbnet_read_cmd(dev,
/* _u8 vendor specific request */
SWI_USB_REQUEST_GET_FW_ATTR,
USB_DIR_IN | USB_TYPE_VENDOR, /* __u8 request type */
0x0000, /* __u16 value not used */
0x0000, /* __u16 index not used */
attrdata, /* char *data */
sizeof(*attrdata), /* __u16 size */
USB_CTRL_SET_TIMEOUT); /* int timeout */
&attrdata, /* char *data */
sizeof(attrdata) /* __u16 size */
);
if (result < 0) {
kfree(attrdata);
if (result < 0)
return -EIO;
}
*datap = le16_to_cpu(*attrdata);
kfree(attrdata);
*datap = le16_to_cpu(attrdata);
return result;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment