|
@@ -83,7 +83,8 @@ static void yurex_control_callback(struct urb *urb)
|
|
|
int status = urb->status;
|
|
|
|
|
|
if (status) {
|
|
|
- err("%s - control failed: %d\n", __func__, status);
|
|
|
+ dev_err(&urb->dev->dev, "%s - control failed: %d\n",
|
|
|
+ __func__, status);
|
|
|
wake_up_interruptible(&dev->waitq);
|
|
|
return;
|
|
|
}
|
|
@@ -139,8 +140,9 @@ static void yurex_interrupt(struct urb *urb)
|
|
|
case 0: /*success*/
|
|
|
break;
|
|
|
case -EOVERFLOW:
|
|
|
- err("%s - overflow with length %d, actual length is %d",
|
|
|
- __func__, YUREX_BUF_SIZE, dev->urb->actual_length);
|
|
|
+ dev_err(&dev->interface->dev,
|
|
|
+ "%s - overflow with length %d, actual length is %d\n",
|
|
|
+ __func__, YUREX_BUF_SIZE, dev->urb->actual_length);
|
|
|
case -ECONNRESET:
|
|
|
case -ENOENT:
|
|
|
case -ESHUTDOWN:
|
|
@@ -148,7 +150,8 @@ static void yurex_interrupt(struct urb *urb)
|
|
|
/* The device is terminated, clean up */
|
|
|
return;
|
|
|
default:
|
|
|
- err("%s - unknown status received: %d", __func__, status);
|
|
|
+ dev_err(&dev->interface->dev,
|
|
|
+ "%s - unknown status received: %d\n", __func__, status);
|
|
|
goto exit;
|
|
|
}
|
|
|
|
|
@@ -181,7 +184,7 @@ static void yurex_interrupt(struct urb *urb)
|
|
|
exit:
|
|
|
retval = usb_submit_urb(dev->urb, GFP_ATOMIC);
|
|
|
if (retval) {
|
|
|
- err("%s - usb_submit_urb failed: %d",
|
|
|
+ dev_err(&dev->interface->dev, "%s - usb_submit_urb failed: %d\n",
|
|
|
__func__, retval);
|
|
|
}
|
|
|
}
|
|
@@ -198,7 +201,7 @@ static int yurex_probe(struct usb_interface *interface, const struct usb_device_
|
|
|
/* allocate memory for our device state and initialize it */
|
|
|
dev = kzalloc(sizeof(*dev), GFP_KERNEL);
|
|
|
if (!dev) {
|
|
|
- err("Out of memory");
|
|
|
+ dev_err(&interface->dev, "Out of memory\n");
|
|
|
goto error;
|
|
|
}
|
|
|
kref_init(&dev->kref);
|
|
@@ -221,7 +224,7 @@ static int yurex_probe(struct usb_interface *interface, const struct usb_device_
|
|
|
}
|
|
|
if (!dev->int_in_endpointAddr) {
|
|
|
retval = -ENODEV;
|
|
|
- err("Could not find endpoints");
|
|
|
+ dev_err(&interface->dev, "Could not find endpoints\n");
|
|
|
goto error;
|
|
|
}
|
|
|
|
|
@@ -229,7 +232,7 @@ static int yurex_probe(struct usb_interface *interface, const struct usb_device_
|
|
|
/* allocate control URB */
|
|
|
dev->cntl_urb = usb_alloc_urb(0, GFP_KERNEL);
|
|
|
if (!dev->cntl_urb) {
|
|
|
- err("Could not allocate control URB");
|
|
|
+ dev_err(&interface->dev, "Could not allocate control URB\n");
|
|
|
goto error;
|
|
|
}
|
|
|
|
|
@@ -238,7 +241,7 @@ static int yurex_probe(struct usb_interface *interface, const struct usb_device_
|
|
|
GFP_KERNEL,
|
|
|
&dev->cntl_urb->setup_dma);
|
|
|
if (!dev->cntl_req) {
|
|
|
- err("Could not allocate cntl_req");
|
|
|
+ dev_err(&interface->dev, "Could not allocate cntl_req\n");
|
|
|
goto error;
|
|
|
}
|
|
|
|
|
@@ -247,7 +250,7 @@ static int yurex_probe(struct usb_interface *interface, const struct usb_device_
|
|
|
GFP_KERNEL,
|
|
|
&dev->cntl_urb->transfer_dma);
|
|
|
if (!dev->cntl_buffer) {
|
|
|
- err("Could not allocate cntl_buffer");
|
|
|
+ dev_err(&interface->dev, "Could not allocate cntl_buffer\n");
|
|
|
goto error;
|
|
|
}
|
|
|
|
|
@@ -269,7 +272,7 @@ static int yurex_probe(struct usb_interface *interface, const struct usb_device_
|
|
|
/* allocate interrupt URB */
|
|
|
dev->urb = usb_alloc_urb(0, GFP_KERNEL);
|
|
|
if (!dev->urb) {
|
|
|
- err("Could not allocate URB");
|
|
|
+ dev_err(&interface->dev, "Could not allocate URB\n");
|
|
|
goto error;
|
|
|
}
|
|
|
|
|
@@ -277,7 +280,7 @@ static int yurex_probe(struct usb_interface *interface, const struct usb_device_
|
|
|
dev->int_buffer = usb_alloc_coherent(dev->udev, YUREX_BUF_SIZE,
|
|
|
GFP_KERNEL, &dev->urb->transfer_dma);
|
|
|
if (!dev->int_buffer) {
|
|
|
- err("Could not allocate int_buffer");
|
|
|
+ dev_err(&interface->dev, "Could not allocate int_buffer\n");
|
|
|
goto error;
|
|
|
}
|
|
|
|
|
@@ -289,7 +292,7 @@ static int yurex_probe(struct usb_interface *interface, const struct usb_device_
|
|
|
dev->cntl_urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
|
|
|
if (usb_submit_urb(dev->urb, GFP_KERNEL)) {
|
|
|
retval = -EIO;
|
|
|
- err("Could not submitting URB");
|
|
|
+ dev_err(&interface->dev, "Could not submitting URB\n");
|
|
|
goto error;
|
|
|
}
|
|
|
|
|
@@ -299,7 +302,8 @@ static int yurex_probe(struct usb_interface *interface, const struct usb_device_
|
|
|
/* we can register the device now, as it is ready */
|
|
|
retval = usb_register_dev(interface, &yurex_class);
|
|
|
if (retval) {
|
|
|
- err("Not able to get a minor for this device.");
|
|
|
+ dev_err(&interface->dev,
|
|
|
+ "Not able to get a minor for this device.\n");
|
|
|
usb_set_intfdata(interface, NULL);
|
|
|
goto error;
|
|
|
}
|
|
@@ -372,8 +376,8 @@ static int yurex_open(struct inode *inode, struct file *file)
|
|
|
|
|
|
interface = usb_find_interface(&yurex_driver, subminor);
|
|
|
if (!interface) {
|
|
|
- err("%s - error, can't find device for minor %d",
|
|
|
- __func__, subminor);
|
|
|
+ printk(KERN_ERR "%s - error, can't find device for minor %d",
|
|
|
+ __func__, subminor);
|
|
|
retval = -ENODEV;
|
|
|
goto exit;
|
|
|
}
|
|
@@ -518,7 +522,9 @@ static ssize_t yurex_write(struct file *file, const char *user_buffer, size_t co
|
|
|
mutex_unlock(&dev->io_mutex);
|
|
|
|
|
|
if (retval < 0) {
|
|
|
- err("%s - failed to send bulk msg, error %d", __func__, retval);
|
|
|
+ dev_err(&dev->interface->dev,
|
|
|
+ "%s - failed to send bulk msg, error %d\n",
|
|
|
+ __func__, retval);
|
|
|
goto error;
|
|
|
}
|
|
|
if (set && timeout)
|