Commit be9ed511 authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab Committed by Mauro Carvalho Chehab

V4L/DVB (10298): remove err macro from few usb devices

Patch removes err() macros from few usb devices.
It places pr_err in pvrusb2-v4l2.c, dev_err in dabusb and in usbvision
drivers. Beside placing dev_err, patch defines new s2255_dev_err macro
with S2255_DRIVER_NAME in s2255 module.
Signed-off-by: default avatarAlexey Klimov <klimov.linux@gmail.com>
Acked-by: default avatarThierry Merle <thierry.merle@free.fr>
Acked-by: default avatarMike Isely <isely@pobox.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent f1801523
...@@ -189,17 +189,20 @@ static void dabusb_iso_complete (struct urb *purb) ...@@ -189,17 +189,20 @@ static void dabusb_iso_complete (struct urb *purb)
dst += len; dst += len;
} }
else else
err("dabusb_iso_complete: invalid len %d", len); dev_err(&purb->dev->dev,
"dabusb_iso_complete: invalid len %d\n", len);
} }
else else
dev_warn(&purb->dev->dev, "dabusb_iso_complete: corrupted packet status: %d\n", purb->iso_frame_desc[i].status); dev_warn(&purb->dev->dev, "dabusb_iso_complete: corrupted packet status: %d\n", purb->iso_frame_desc[i].status);
if (dst != purb->actual_length) if (dst != purb->actual_length)
err("dst!=purb->actual_length:%d!=%d", dst, purb->actual_length); dev_err(&purb->dev->dev,
"dst!=purb->actual_length:%d!=%d\n",
dst, purb->actual_length);
} }
if (atomic_dec_and_test (&s->pending_io) && !s->remove_pending && s->state != _stopped) { if (atomic_dec_and_test (&s->pending_io) && !s->remove_pending && s->state != _stopped) {
s->overruns++; s->overruns++;
err("overrun (%d)", s->overruns); dev_err(&purb->dev->dev, "overrun (%d)\n", s->overruns);
} }
wake_up (&s->wait); wake_up (&s->wait);
} }
...@@ -220,13 +223,14 @@ static int dabusb_alloc_buffers (pdabusb_t s) ...@@ -220,13 +223,14 @@ static int dabusb_alloc_buffers (pdabusb_t s)
while (transfer_len < (s->total_buffer_size << 10)) { while (transfer_len < (s->total_buffer_size << 10)) {
b = kzalloc(sizeof (buff_t), GFP_KERNEL); b = kzalloc(sizeof (buff_t), GFP_KERNEL);
if (!b) { if (!b) {
err("kzalloc(sizeof(buff_t))==NULL"); dev_err(&s->usbdev->dev,
"kzalloc(sizeof(buff_t))==NULL\n");
goto err; goto err;
} }
b->s = s; b->s = s;
b->purb = usb_alloc_urb(packets, GFP_KERNEL); b->purb = usb_alloc_urb(packets, GFP_KERNEL);
if (!b->purb) { if (!b->purb) {
err("usb_alloc_urb == NULL"); dev_err(&s->usbdev->dev, "usb_alloc_urb == NULL\n");
kfree (b); kfree (b);
goto err; goto err;
} }
...@@ -235,7 +239,8 @@ static int dabusb_alloc_buffers (pdabusb_t s) ...@@ -235,7 +239,8 @@ static int dabusb_alloc_buffers (pdabusb_t s)
if (!b->purb->transfer_buffer) { if (!b->purb->transfer_buffer) {
kfree (b->purb); kfree (b->purb);
kfree (b); kfree (b);
err("kmalloc(%d)==NULL", transfer_buffer_length); dev_err(&s->usbdev->dev,
"kmalloc(%d)==NULL\n", transfer_buffer_length);
goto err; goto err;
} }
...@@ -279,10 +284,11 @@ static int dabusb_bulk (pdabusb_t s, pbulk_transfer_t pb) ...@@ -279,10 +284,11 @@ static int dabusb_bulk (pdabusb_t s, pbulk_transfer_t pb)
ret=usb_bulk_msg(s->usbdev, pipe, pb->data, pb->size, &actual_length, 100); ret=usb_bulk_msg(s->usbdev, pipe, pb->data, pb->size, &actual_length, 100);
if(ret<0) { if(ret<0) {
err("dabusb: usb_bulk_msg failed(%d)",ret); dev_err(&s->usbdev->dev,
"usb_bulk_msg failed(%d)\n", ret);
if (usb_set_interface (s->usbdev, _DABUSB_IF, 1) < 0) { if (usb_set_interface (s->usbdev, _DABUSB_IF, 1) < 0) {
err("set_interface failed"); dev_err(&s->usbdev->dev, "set_interface failed\n");
return -EINVAL; return -EINVAL;
} }
...@@ -291,7 +297,7 @@ static int dabusb_bulk (pdabusb_t s, pbulk_transfer_t pb) ...@@ -291,7 +297,7 @@ static int dabusb_bulk (pdabusb_t s, pbulk_transfer_t pb)
if( ret == -EPIPE ) { if( ret == -EPIPE ) {
dev_warn(&s->usbdev->dev, "CLEAR_FEATURE request to remove STALL condition.\n"); dev_warn(&s->usbdev->dev, "CLEAR_FEATURE request to remove STALL condition.\n");
if(usb_clear_halt(s->usbdev, usb_pipeendpoint(pipe))) if(usb_clear_halt(s->usbdev, usb_pipeendpoint(pipe)))
err("request failed"); dev_err(&s->usbdev->dev, "request failed\n");
} }
pb->size = actual_length; pb->size = actual_length;
...@@ -305,7 +311,8 @@ static int dabusb_writemem (pdabusb_t s, int pos, const unsigned char *data, ...@@ -305,7 +311,8 @@ static int dabusb_writemem (pdabusb_t s, int pos, const unsigned char *data,
unsigned char *transfer_buffer = kmalloc (len, GFP_KERNEL); unsigned char *transfer_buffer = kmalloc (len, GFP_KERNEL);
if (!transfer_buffer) { if (!transfer_buffer) {
err("dabusb_writemem: kmalloc(%d) failed.", len); dev_err(&s->usbdev->dev,
"dabusb_writemem: kmalloc(%d) failed.\n", len);
return -ENOMEM; return -ENOMEM;
} }
...@@ -333,7 +340,8 @@ static int dabusb_loadmem (pdabusb_t s, const char *fname) ...@@ -333,7 +340,8 @@ static int dabusb_loadmem (pdabusb_t s, const char *fname)
ret = request_ihex_firmware(&fw, "dabusb/firmware.fw", &s->usbdev->dev); ret = request_ihex_firmware(&fw, "dabusb/firmware.fw", &s->usbdev->dev);
if (ret) { if (ret) {
err("Failed to load \"dabusb/firmware.fw\": %d\n", ret); dev_err(&s->usbdev->dev,
"Failed to load \"dabusb/firmware.fw\": %d\n", ret);
goto out; goto out;
} }
ret = dabusb_8051_reset (s, 1); ret = dabusb_8051_reset (s, 1);
...@@ -346,9 +354,10 @@ static int dabusb_loadmem (pdabusb_t s, const char *fname) ...@@ -346,9 +354,10 @@ static int dabusb_loadmem (pdabusb_t s, const char *fname)
ret = dabusb_writemem(s, be32_to_cpu(rec->addr), rec->data, ret = dabusb_writemem(s, be32_to_cpu(rec->addr), rec->data,
be16_to_cpu(rec->len)); be16_to_cpu(rec->len));
if (ret < 0) { if (ret < 0) {
err("dabusb_writemem failed (%d %04X %p %d)", ret, dev_err(&s->usbdev->dev,
be32_to_cpu(rec->addr), rec->data, "dabusb_writemem failed (%d %04X %p %d)\n",
be16_to_cpu(rec->len)); ret, be32_to_cpu(rec->addr),
rec->data, be16_to_cpu(rec->len));
break; break;
} }
} }
...@@ -396,13 +405,15 @@ static int dabusb_fpga_download (pdabusb_t s, const char *fname) ...@@ -396,13 +405,15 @@ static int dabusb_fpga_download (pdabusb_t s, const char *fname)
dbg("Enter dabusb_fpga_download (internal)"); dbg("Enter dabusb_fpga_download (internal)");
if (!b) { if (!b) {
err("kmalloc(sizeof(bulk_transfer_t))==NULL"); dev_err(&s->usbdev->dev,
"kmalloc(sizeof(bulk_transfer_t))==NULL\n");
return -ENOMEM; return -ENOMEM;
} }
ret = request_firmware(&fw, "dabusb/bitstream.bin", &s->usbdev->dev); ret = request_firmware(&fw, "dabusb/bitstream.bin", &s->usbdev->dev);
if (ret) { if (ret) {
err("Failed to load \"dabusb/bitstream.bin\": %d\n", ret); dev_err(&s->usbdev->dev,
"Failed to load \"dabusb/bitstream.bin\": %d\n", ret);
kfree(b); kfree(b);
return ret; return ret;
} }
...@@ -425,7 +436,7 @@ static int dabusb_fpga_download (pdabusb_t s, const char *fname) ...@@ -425,7 +436,7 @@ static int dabusb_fpga_download (pdabusb_t s, const char *fname)
memcpy (b->data + 4, fw->data + 74 + n, 60); memcpy (b->data + 4, fw->data + 74 + n, 60);
ret = dabusb_bulk (s, b); ret = dabusb_bulk (s, b);
if (ret < 0) { if (ret < 0) {
err("dabusb_bulk failed."); dev_err(&s->usbdev->dev, "dabusb_bulk failed.\n");
break; break;
} }
mdelay (1); mdelay (1);
...@@ -478,9 +489,11 @@ static int dabusb_startrek (pdabusb_t s) ...@@ -478,9 +489,11 @@ static int dabusb_startrek (pdabusb_t s)
ret = usb_submit_urb (end->purb, GFP_KERNEL); ret = usb_submit_urb (end->purb, GFP_KERNEL);
if (ret) { if (ret) {
err("usb_submit_urb returned:%d", ret); dev_err(&s->usbdev->dev,
"usb_submit_urb returned:%d\n", ret);
if (dabusb_add_buf_tail (s, &s->free_buff_list, &s->rec_buff_list)) if (dabusb_add_buf_tail (s, &s->free_buff_list, &s->rec_buff_list))
err("startrek: dabusb_add_buf_tail failed"); dev_err(&s->usbdev->dev,
"startrek: dabusb_add_buf_tail failed\n");
break; break;
} }
else else
...@@ -523,7 +536,8 @@ static ssize_t dabusb_read (struct file *file, char __user *buf, size_t count, l ...@@ -523,7 +536,8 @@ static ssize_t dabusb_read (struct file *file, char __user *buf, size_t count, l
spin_unlock_irqrestore(&s->lock, flags); spin_unlock_irqrestore(&s->lock, flags);
err("error: rec_buf_list is empty"); dev_err(&s->usbdev->dev,
"error: rec_buf_list is empty\n");
goto err; goto err;
} }
...@@ -552,7 +566,8 @@ static ssize_t dabusb_read (struct file *file, char __user *buf, size_t count, l ...@@ -552,7 +566,8 @@ static ssize_t dabusb_read (struct file *file, char __user *buf, size_t count, l
if (list_empty (&s->rec_buff_list)) { if (list_empty (&s->rec_buff_list)) {
spin_unlock_irqrestore(&s->lock, flags); spin_unlock_irqrestore(&s->lock, flags);
err("error: still no buffer available."); dev_err(&s->usbdev->dev,
"error: still no buffer available.\n");
goto err; goto err;
} }
spin_unlock_irqrestore(&s->lock, flags); spin_unlock_irqrestore(&s->lock, flags);
...@@ -573,7 +588,7 @@ static ssize_t dabusb_read (struct file *file, char __user *buf, size_t count, l ...@@ -573,7 +588,7 @@ static ssize_t dabusb_read (struct file *file, char __user *buf, size_t count, l
dbg("copy_to_user:%p %p %d",buf, purb->transfer_buffer + s->readptr, cnt); dbg("copy_to_user:%p %p %d",buf, purb->transfer_buffer + s->readptr, cnt);
if (copy_to_user (buf, purb->transfer_buffer + s->readptr, cnt)) { if (copy_to_user (buf, purb->transfer_buffer + s->readptr, cnt)) {
err("read: copy_to_user failed"); dev_err(&s->usbdev->dev, "read: copy_to_user failed\n");
if (!ret) if (!ret)
ret = -EFAULT; ret = -EFAULT;
goto err; goto err;
...@@ -587,7 +602,8 @@ static ssize_t dabusb_read (struct file *file, char __user *buf, size_t count, l ...@@ -587,7 +602,8 @@ static ssize_t dabusb_read (struct file *file, char __user *buf, size_t count, l
if (s->readptr == purb->actual_length) { if (s->readptr == purb->actual_length) {
// finished, take next buffer // finished, take next buffer
if (dabusb_add_buf_tail (s, &s->free_buff_list, &s->rec_buff_list)) if (dabusb_add_buf_tail (s, &s->free_buff_list, &s->rec_buff_list))
err("read: dabusb_add_buf_tail failed"); dev_err(&s->usbdev->dev,
"read: dabusb_add_buf_tail failed\n");
s->readptr = 0; s->readptr = 0;
} }
} }
...@@ -623,7 +639,7 @@ static int dabusb_open (struct inode *inode, struct file *file) ...@@ -623,7 +639,7 @@ static int dabusb_open (struct inode *inode, struct file *file)
} }
if (usb_set_interface (s->usbdev, _DABUSB_IF, 1) < 0) { if (usb_set_interface (s->usbdev, _DABUSB_IF, 1) < 0) {
mutex_unlock(&s->mutex); mutex_unlock(&s->mutex);
err("set_interface failed"); dev_err(&s->usbdev->dev, "set_interface failed\n");
return -EINVAL; return -EINVAL;
} }
s->opened = 1; s->opened = 1;
...@@ -648,7 +664,7 @@ static int dabusb_release (struct inode *inode, struct file *file) ...@@ -648,7 +664,7 @@ static int dabusb_release (struct inode *inode, struct file *file)
if (!s->remove_pending) { if (!s->remove_pending) {
if (usb_set_interface (s->usbdev, _DABUSB_IF, 0) < 0) if (usb_set_interface (s->usbdev, _DABUSB_IF, 0) < 0)
err("set_interface failed"); dev_err(&s->usbdev->dev, "set_interface failed\n");
} }
else else
wake_up (&s->remove_ok); wake_up (&s->remove_ok);
...@@ -764,7 +780,7 @@ static int dabusb_probe (struct usb_interface *intf, ...@@ -764,7 +780,7 @@ static int dabusb_probe (struct usb_interface *intf,
s->devnum = intf->minor; s->devnum = intf->minor;
if (usb_reset_configuration (usbdev) < 0) { if (usb_reset_configuration (usbdev) < 0) {
err("reset_configuration failed"); dev_err(&intf->dev, "reset_configuration failed\n");
goto reject; goto reject;
} }
if (le16_to_cpu(usbdev->descriptor.idProduct) == 0x2131) { if (le16_to_cpu(usbdev->descriptor.idProduct) == 0x2131) {
...@@ -775,7 +791,7 @@ static int dabusb_probe (struct usb_interface *intf, ...@@ -775,7 +791,7 @@ static int dabusb_probe (struct usb_interface *intf,
dabusb_fpga_download (s, NULL); dabusb_fpga_download (s, NULL);
if (usb_set_interface (s->usbdev, _DABUSB_IF, 0) < 0) { if (usb_set_interface (s->usbdev, _DABUSB_IF, 0) < 0) {
err("set_interface failed"); dev_err(&intf->dev, "set_interface failed\n");
goto reject; goto reject;
} }
} }
......
...@@ -1268,8 +1268,9 @@ static void pvr2_v4l2_dev_init(struct pvr2_v4l2_dev *dip, ...@@ -1268,8 +1268,9 @@ static void pvr2_v4l2_dev_init(struct pvr2_v4l2_dev *dip,
dip->minor_type = pvr2_v4l_type_video; dip->minor_type = pvr2_v4l_type_video;
nr_ptr = video_nr; nr_ptr = video_nr;
if (!dip->stream) { if (!dip->stream) {
err("Failed to set up pvrusb2 v4l video dev" pr_err(KBUILD_MODNAME
" due to missing stream instance"); ": Failed to set up pvrusb2 v4l video dev"
" due to missing stream instance\n");
return; return;
} }
break; break;
...@@ -1286,8 +1287,8 @@ static void pvr2_v4l2_dev_init(struct pvr2_v4l2_dev *dip, ...@@ -1286,8 +1287,8 @@ static void pvr2_v4l2_dev_init(struct pvr2_v4l2_dev *dip,
break; break;
default: default:
/* Bail out (this should be impossible) */ /* Bail out (this should be impossible) */
err("Failed to set up pvrusb2 v4l dev" pr_err(KBUILD_MODNAME ": Failed to set up pvrusb2 v4l dev"
" due to unrecognized config"); " due to unrecognized config\n");
return; return;
} }
...@@ -1303,7 +1304,8 @@ static void pvr2_v4l2_dev_init(struct pvr2_v4l2_dev *dip, ...@@ -1303,7 +1304,8 @@ static void pvr2_v4l2_dev_init(struct pvr2_v4l2_dev *dip,
dip->v4l_type, mindevnum) < 0) && dip->v4l_type, mindevnum) < 0) &&
(video_register_device(&dip->devbase, (video_register_device(&dip->devbase,
dip->v4l_type, -1) < 0)) { dip->v4l_type, -1) < 0)) {
err("Failed to register pvrusb2 v4l device"); pr_err(KBUILD_MODNAME
": Failed to register pvrusb2 v4l device\n");
} }
printk(KERN_INFO "pvrusb2: registered device %s%u [%s]\n", printk(KERN_INFO "pvrusb2: registered device %s%u [%s]\n",
......
...@@ -336,14 +336,19 @@ static long s2255_vendor_req(struct s2255_dev *dev, unsigned char req, ...@@ -336,14 +336,19 @@ static long s2255_vendor_req(struct s2255_dev *dev, unsigned char req,
u16 index, u16 value, void *buf, u16 index, u16 value, void *buf,
s32 buf_len, int bOut); s32 buf_len, int bOut);
/* dev_err macro with driver name */
#define S2255_DRIVER_NAME "s2255"
#define s2255_dev_err(dev, fmt, arg...) \
dev_err(dev, S2255_DRIVER_NAME " - " fmt, ##arg)
#define dprintk(level, fmt, arg...) \ #define dprintk(level, fmt, arg...) \
do { \ do { \
if (*s2255_debug >= (level)) { \ if (*s2255_debug >= (level)) { \
printk(KERN_DEBUG "s2255: " fmt, ##arg); \ printk(KERN_DEBUG S2255_DRIVER_NAME \
": " fmt, ##arg); \
} \ } \
} while (0) } while (0)
static struct usb_driver s2255_driver; static struct usb_driver s2255_driver;
...@@ -528,14 +533,14 @@ static void s2255_fwchunk_complete(struct urb *urb) ...@@ -528,14 +533,14 @@ static void s2255_fwchunk_complete(struct urb *urb)
int len; int len;
dprintk(100, "udev %p urb %p", udev, urb); dprintk(100, "udev %p urb %p", udev, urb);
if (urb->status) { if (urb->status) {
dev_err(&udev->dev, "URB failed with status %d", urb->status); dev_err(&udev->dev, "URB failed with status %d\n", urb->status);
atomic_set(&data->fw_state, S2255_FW_FAILED); atomic_set(&data->fw_state, S2255_FW_FAILED);
/* wake up anything waiting for the firmware */ /* wake up anything waiting for the firmware */
wake_up(&data->wait_fw); wake_up(&data->wait_fw);
return; return;
} }
if (data->fw_urb == NULL) { if (data->fw_urb == NULL) {
dev_err(&udev->dev, "s2255 disconnected\n"); s2255_dev_err(&udev->dev, "disconnected\n");
atomic_set(&data->fw_state, S2255_FW_FAILED); atomic_set(&data->fw_state, S2255_FW_FAILED);
/* wake up anything waiting for the firmware */ /* wake up anything waiting for the firmware */
wake_up(&data->wait_fw); wake_up(&data->wait_fw);
...@@ -1278,7 +1283,7 @@ static int vidioc_streamon(struct file *file, void *priv, enum v4l2_buf_type i) ...@@ -1278,7 +1283,7 @@ static int vidioc_streamon(struct file *file, void *priv, enum v4l2_buf_type i)
} }
if (!res_get(dev, fh)) { if (!res_get(dev, fh)) {
dev_err(&dev->udev->dev, "s2255: stream busy\n"); s2255_dev_err(&dev->udev->dev, "stream busy\n");
return -EBUSY; return -EBUSY;
} }
...@@ -1545,7 +1550,8 @@ static int s2255_open(struct file *file) ...@@ -1545,7 +1550,8 @@ static int s2255_open(struct file *file)
switch (atomic_read(&dev->fw_data->fw_state)) { switch (atomic_read(&dev->fw_data->fw_state)) {
case S2255_FW_FAILED: case S2255_FW_FAILED:
err("2255 firmware load failed. retrying.\n"); s2255_dev_err(&dev->udev->dev,
"firmware load failed. retrying.\n");
s2255_fwload_start(dev, 1); s2255_fwload_start(dev, 1);
wait_event_timeout(dev->fw_data->wait_fw, wait_event_timeout(dev->fw_data->wait_fw,
((atomic_read(&dev->fw_data->fw_state) ((atomic_read(&dev->fw_data->fw_state)
...@@ -2173,7 +2179,8 @@ static int s2255_board_init(struct s2255_dev *dev) ...@@ -2173,7 +2179,8 @@ static int s2255_board_init(struct s2255_dev *dev)
printk(KERN_INFO "2255 usb firmware version %d \n", fw_ver); printk(KERN_INFO "2255 usb firmware version %d \n", fw_ver);
if (fw_ver < CUR_USB_FWVER) if (fw_ver < CUR_USB_FWVER)
err("usb firmware not up to date %d\n", fw_ver); dev_err(&dev->udev->dev,
"usb firmware not up to date %d\n", fw_ver);
for (j = 0; j < MAX_CHANNELS; j++) { for (j = 0; j < MAX_CHANNELS; j++) {
dev->b_acquire[j] = 0; dev->b_acquire[j] = 0;
...@@ -2228,13 +2235,13 @@ static void read_pipe_completion(struct urb *purb) ...@@ -2228,13 +2235,13 @@ static void read_pipe_completion(struct urb *purb)
dprintk(100, "read pipe completion %p, status %d\n", purb, dprintk(100, "read pipe completion %p, status %d\n", purb,
purb->status); purb->status);
if (pipe_info == NULL) { if (pipe_info == NULL) {
err("no context !"); dev_err(&purb->dev->dev, "no context!\n");
return; return;
} }
dev = pipe_info->dev; dev = pipe_info->dev;
if (dev == NULL) { if (dev == NULL) {
err("no context !"); dev_err(&purb->dev->dev, "no context!\n");
return; return;
} }
status = purb->status; status = purb->status;
...@@ -2286,7 +2293,7 @@ static int s2255_start_readpipe(struct s2255_dev *dev) ...@@ -2286,7 +2293,7 @@ static int s2255_start_readpipe(struct s2255_dev *dev)
pipe_info->stream_urb = usb_alloc_urb(0, GFP_KERNEL); pipe_info->stream_urb = usb_alloc_urb(0, GFP_KERNEL);
if (!pipe_info->stream_urb) { if (!pipe_info->stream_urb) {
dev_err(&dev->udev->dev, dev_err(&dev->udev->dev,
"ReadStream: Unable to alloc URB"); "ReadStream: Unable to alloc URB\n");
return -ENOMEM; return -ENOMEM;
} }
/* transfer buffer allocated in board_init */ /* transfer buffer allocated in board_init */
...@@ -2391,7 +2398,7 @@ static void s2255_stop_readpipe(struct s2255_dev *dev) ...@@ -2391,7 +2398,7 @@ static void s2255_stop_readpipe(struct s2255_dev *dev)
int j; int j;
if (dev == NULL) { if (dev == NULL) {
err("s2255: invalid device"); s2255_dev_err(&dev->udev->dev, "invalid device\n");
return; return;
} }
dprintk(4, "stop read pipe\n"); dprintk(4, "stop read pipe\n");
...@@ -2453,7 +2460,7 @@ static int s2255_probe(struct usb_interface *interface, ...@@ -2453,7 +2460,7 @@ static int s2255_probe(struct usb_interface *interface,
/* allocate memory for our device state and initialize it to zero */ /* allocate memory for our device state and initialize it to zero */
dev = kzalloc(sizeof(struct s2255_dev), GFP_KERNEL); dev = kzalloc(sizeof(struct s2255_dev), GFP_KERNEL);
if (dev == NULL) { if (dev == NULL) {
err("s2255: out of memory"); s2255_dev_err(&interface->dev, "out of memory\n");
goto error; goto error;
} }
...@@ -2487,7 +2494,7 @@ static int s2255_probe(struct usb_interface *interface, ...@@ -2487,7 +2494,7 @@ static int s2255_probe(struct usb_interface *interface,
} }
if (!dev->read_endpoint) { if (!dev->read_endpoint) {
dev_err(&interface->dev, "Could not find bulk-in endpoint"); dev_err(&interface->dev, "Could not find bulk-in endpoint\n");
goto error; goto error;
} }
...@@ -2583,7 +2590,7 @@ static void s2255_disconnect(struct usb_interface *interface) ...@@ -2583,7 +2590,7 @@ static void s2255_disconnect(struct usb_interface *interface)
} }
static struct usb_driver s2255_driver = { static struct usb_driver s2255_driver = {
.name = "s2255", .name = S2255_DRIVER_NAME,
.probe = s2255_probe, .probe = s2255_probe,
.disconnect = s2255_disconnect, .disconnect = s2255_disconnect,
.id_table = s2255_table, .id_table = s2255_table,
...@@ -2597,7 +2604,8 @@ static int __init usb_s2255_init(void) ...@@ -2597,7 +2604,8 @@ static int __init usb_s2255_init(void)
result = usb_register(&s2255_driver); result = usb_register(&s2255_driver);
if (result) if (result)
err("usb_register failed. Error number %d", result); pr_err(KBUILD_MODNAME
": usb_register failed. Error number %d\n", result);
dprintk(2, "s2255_init: done\n"); dprintk(2, "s2255_init: done\n");
return result; return result;
......
...@@ -381,8 +381,9 @@ int usbvision_scratch_alloc(struct usb_usbvision *usbvision) ...@@ -381,8 +381,9 @@ int usbvision_scratch_alloc(struct usb_usbvision *usbvision)
usbvision->scratch = vmalloc_32(scratch_buf_size); usbvision->scratch = vmalloc_32(scratch_buf_size);
scratch_reset(usbvision); scratch_reset(usbvision);
if(usbvision->scratch == NULL) { if(usbvision->scratch == NULL) {
err("%s: unable to allocate %d bytes for scratch", dev_err(&usbvision->dev->dev,
__func__, scratch_buf_size); "%s: unable to allocate %d bytes for scratch\n",
__func__, scratch_buf_size);
return -ENOMEM; return -ENOMEM;
} }
return 0; return 0;
...@@ -491,8 +492,9 @@ int usbvision_decompress_alloc(struct usb_usbvision *usbvision) ...@@ -491,8 +492,9 @@ int usbvision_decompress_alloc(struct usb_usbvision *usbvision)
int IFB_size = MAX_FRAME_WIDTH * MAX_FRAME_HEIGHT * 3 / 2; int IFB_size = MAX_FRAME_WIDTH * MAX_FRAME_HEIGHT * 3 / 2;
usbvision->IntraFrameBuffer = vmalloc_32(IFB_size); usbvision->IntraFrameBuffer = vmalloc_32(IFB_size);
if (usbvision->IntraFrameBuffer == NULL) { if (usbvision->IntraFrameBuffer == NULL) {
err("%s: unable to allocate %d for compr. frame buffer", dev_err(&usbvision->dev->dev,
__func__, IFB_size); "%s: unable to allocate %d for compr. frame buffer\n",
__func__, IFB_size);
return -ENOMEM; return -ENOMEM;
} }
return 0; return 0;
...@@ -1514,8 +1516,9 @@ static void usbvision_isocIrq(struct urb *urb) ...@@ -1514,8 +1516,9 @@ static void usbvision_isocIrq(struct urb *urb)
errCode = usb_submit_urb (urb, GFP_ATOMIC); errCode = usb_submit_urb (urb, GFP_ATOMIC);
if(errCode) { if(errCode) {
err("%s: usb_submit_urb failed: error %d", dev_err(&usbvision->dev->dev,
__func__, errCode); "%s: usb_submit_urb failed: error %d\n",
__func__, errCode);
} }
return; return;
...@@ -1546,7 +1549,8 @@ int usbvision_read_reg(struct usb_usbvision *usbvision, unsigned char reg) ...@@ -1546,7 +1549,8 @@ int usbvision_read_reg(struct usb_usbvision *usbvision, unsigned char reg)
0, (__u16) reg, buffer, 1, HZ); 0, (__u16) reg, buffer, 1, HZ);
if (errCode < 0) { if (errCode < 0) {
err("%s: failed: error %d", __func__, errCode); dev_err(&usbvision->dev->dev,
"%s: failed: error %d\n", __func__, errCode);
return errCode; return errCode;
} }
return buffer[0]; return buffer[0];
...@@ -1574,7 +1578,8 @@ int usbvision_write_reg(struct usb_usbvision *usbvision, unsigned char reg, ...@@ -1574,7 +1578,8 @@ int usbvision_write_reg(struct usb_usbvision *usbvision, unsigned char reg,
USB_RECIP_ENDPOINT, 0, (__u16) reg, &value, 1, HZ); USB_RECIP_ENDPOINT, 0, (__u16) reg, &value, 1, HZ);
if (errCode < 0) { if (errCode < 0) {
err("%s: failed: error %d", __func__, errCode); dev_err(&usbvision->dev->dev,
"%s: failed: error %d\n", __func__, errCode);
} }
return errCode; return errCode;
} }
...@@ -1850,7 +1855,8 @@ int usbvision_set_output(struct usb_usbvision *usbvision, int width, ...@@ -1850,7 +1855,8 @@ int usbvision_set_output(struct usb_usbvision *usbvision, int width,
0, (__u16) USBVISION_LXSIZE_O, value, 4, HZ); 0, (__u16) USBVISION_LXSIZE_O, value, 4, HZ);
if (errCode < 0) { if (errCode < 0) {
err("%s failed: error %d", __func__, errCode); dev_err(&usbvision->dev->dev,
"%s failed: error %d\n", __func__, errCode);
return errCode; return errCode;
} }
usbvision->curwidth = usbvision->stretch_width * UsbWidth; usbvision->curwidth = usbvision->stretch_width * UsbWidth;
...@@ -2236,7 +2242,7 @@ static int usbvision_set_dram_settings(struct usb_usbvision *usbvision) ...@@ -2236,7 +2242,7 @@ static int usbvision_set_dram_settings(struct usb_usbvision *usbvision)
(__u16) USBVISION_DRM_PRM1, value, 8, HZ); (__u16) USBVISION_DRM_PRM1, value, 8, HZ);
if (rc < 0) { if (rc < 0) {
err("%sERROR=%d", __func__, rc); dev_err(&usbvision->dev->dev, "%sERROR=%d\n", __func__, rc);
return rc; return rc;
} }
...@@ -2432,8 +2438,9 @@ int usbvision_set_alternate(struct usb_usbvision *dev) ...@@ -2432,8 +2438,9 @@ int usbvision_set_alternate(struct usb_usbvision *dev)
PDEBUG(DBG_FUNC,"setting alternate %d with wMaxPacketSize=%u", dev->ifaceAlt,dev->isocPacketSize); PDEBUG(DBG_FUNC,"setting alternate %d with wMaxPacketSize=%u", dev->ifaceAlt,dev->isocPacketSize);
errCode = usb_set_interface(dev->dev, dev->iface, dev->ifaceAlt); errCode = usb_set_interface(dev->dev, dev->iface, dev->ifaceAlt);
if (errCode < 0) { if (errCode < 0) {
err ("cannot change alternate number to %d (error=%i)", dev_err(&dev->dev->dev,
dev->ifaceAlt, errCode); "cannot change alternate number to %d (error=%i)\n",
dev->ifaceAlt, errCode);
return errCode; return errCode;
} }
} }
...@@ -2484,7 +2491,8 @@ int usbvision_init_isoc(struct usb_usbvision *usbvision) ...@@ -2484,7 +2491,8 @@ int usbvision_init_isoc(struct usb_usbvision *usbvision)
urb = usb_alloc_urb(USBVISION_URB_FRAMES, GFP_KERNEL); urb = usb_alloc_urb(USBVISION_URB_FRAMES, GFP_KERNEL);
if (urb == NULL) { if (urb == NULL) {
err("%s: usb_alloc_urb() failed", __func__); dev_err(&usbvision->dev->dev,
"%s: usb_alloc_urb() failed\n", __func__);
return -ENOMEM; return -ENOMEM;
} }
usbvision->sbuf[bufIdx].urb = urb; usbvision->sbuf[bufIdx].urb = urb;
...@@ -2516,8 +2524,9 @@ int usbvision_init_isoc(struct usb_usbvision *usbvision) ...@@ -2516,8 +2524,9 @@ int usbvision_init_isoc(struct usb_usbvision *usbvision)
errCode = usb_submit_urb(usbvision->sbuf[bufIdx].urb, errCode = usb_submit_urb(usbvision->sbuf[bufIdx].urb,
GFP_KERNEL); GFP_KERNEL);
if (errCode) { if (errCode) {
err("%s: usb_submit_urb(%d) failed: error %d", dev_err(&usbvision->dev->dev,
__func__, bufIdx, errCode); "%s: usb_submit_urb(%d) failed: error %d\n",
__func__, bufIdx, errCode);
} }
} }
...@@ -2566,8 +2575,9 @@ void usbvision_stop_isoc(struct usb_usbvision *usbvision) ...@@ -2566,8 +2575,9 @@ void usbvision_stop_isoc(struct usb_usbvision *usbvision)
errCode = usb_set_interface(usbvision->dev, usbvision->iface, errCode = usb_set_interface(usbvision->dev, usbvision->iface,
usbvision->ifaceAlt); usbvision->ifaceAlt);
if (errCode < 0) { if (errCode < 0) {
err("%s: usb_set_interface() failed: error %d", dev_err(&usbvision->dev->dev,
__func__, errCode); "%s: usb_set_interface() failed: error %d\n",
__func__, errCode);
usbvision->last_error = errCode; usbvision->last_error = errCode;
} }
regValue = (16-usbvision_read_reg(usbvision, USBVISION_ALTER_REG)) & 0x0F; regValue = (16-usbvision_read_reg(usbvision, USBVISION_ALTER_REG)) & 0x0F;
......
...@@ -119,7 +119,8 @@ static inline int usb_find_address(struct i2c_adapter *i2c_adap, ...@@ -119,7 +119,8 @@ static inline int usb_find_address(struct i2c_adapter *i2c_adap,
/* try extended address code... */ /* try extended address code... */
ret = try_write_address(i2c_adap, addr, retries); ret = try_write_address(i2c_adap, addr, retries);
if (ret != 1) { if (ret != 1) {
err("died at extended address code, while writing"); dev_err(&i2c_adap->dev,
"died at extended address code, while writing\n");
return -EREMOTEIO; return -EREMOTEIO;
} }
add[0] = addr; add[0] = addr;
...@@ -128,7 +129,8 @@ static inline int usb_find_address(struct i2c_adapter *i2c_adap, ...@@ -128,7 +129,8 @@ static inline int usb_find_address(struct i2c_adapter *i2c_adap,
addr |= 0x01; addr |= 0x01;
ret = try_read_address(i2c_adap, addr, retries); ret = try_read_address(i2c_adap, addr, retries);
if (ret != 1) { if (ret != 1) {
err("died at extended address code, while reading"); dev_err(&i2c_adap->dev,
"died at extended address code, while reading\n");
return -EREMOTEIO; return -EREMOTEIO;
} }
} }
......
...@@ -329,7 +329,7 @@ static void usbvision_create_sysfs(struct video_device *vdev) ...@@ -329,7 +329,7 @@ static void usbvision_create_sysfs(struct video_device *vdev)
return; return;
} while (0); } while (0);
err("%s error: %d\n", __func__, res); dev_err(&vdev->dev, "%s error: %d\n", __func__, res);
} }
static void usbvision_remove_sysfs(struct video_device *vdev) static void usbvision_remove_sysfs(struct video_device *vdev)
...@@ -487,8 +487,9 @@ static int vidioc_g_register (struct file *file, void *priv, ...@@ -487,8 +487,9 @@ static int vidioc_g_register (struct file *file, void *priv,
/* NT100x has a 8-bit register space */ /* NT100x has a 8-bit register space */
errCode = usbvision_read_reg(usbvision, reg->reg&0xff); errCode = usbvision_read_reg(usbvision, reg->reg&0xff);
if (errCode < 0) { if (errCode < 0) {
err("%s: VIDIOC_DBG_G_REGISTER failed: error %d", dev_err(&usbvision->vdev->dev,
__func__, errCode); "%s: VIDIOC_DBG_G_REGISTER failed: error %d\n",
__func__, errCode);
return errCode; return errCode;
} }
reg->val = errCode; reg->val = errCode;
...@@ -507,8 +508,9 @@ static int vidioc_s_register (struct file *file, void *priv, ...@@ -507,8 +508,9 @@ static int vidioc_s_register (struct file *file, void *priv,
/* NT100x has a 8-bit register space */ /* NT100x has a 8-bit register space */
errCode = usbvision_write_reg(usbvision, reg->reg&0xff, reg->val); errCode = usbvision_write_reg(usbvision, reg->reg&0xff, reg->val);
if (errCode < 0) { if (errCode < 0) {
err("%s: VIDIOC_DBG_S_REGISTER failed: error %d", dev_err(&usbvision->vdev->dev,
__func__, errCode); "%s: VIDIOC_DBG_S_REGISTER failed: error %d\n",
__func__, errCode);
return errCode; return errCode;
} }
return 0; return 0;
...@@ -1189,7 +1191,9 @@ static int usbvision_radio_open(struct file *file) ...@@ -1189,7 +1191,9 @@ static int usbvision_radio_open(struct file *file)
mutex_lock(&usbvision->lock); mutex_lock(&usbvision->lock);
if (usbvision->user) { if (usbvision->user) {
err("%s: Someone tried to open an already opened USBVision Radio!", __func__); dev_err(&usbvision->rdev->dev,
"%s: Someone tried to open an already opened USBVision Radio!\n",
__func__);
errCode = -EBUSY; errCode = -EBUSY;
} }
else { else {
...@@ -1413,7 +1417,8 @@ static struct video_device *usbvision_vdev_init(struct usb_usbvision *usbvision, ...@@ -1413,7 +1417,8 @@ static struct video_device *usbvision_vdev_init(struct usb_usbvision *usbvision,
struct video_device *vdev; struct video_device *vdev;
if (usb_dev == NULL) { if (usb_dev == NULL) {
err("%s: usbvision->dev is not set", __func__); dev_err(&usbvision->dev->dev,
"%s: usbvision->dev is not set\n", __func__);
return NULL; return NULL;
} }
...@@ -1524,7 +1529,9 @@ static int __devinit usbvision_register_video(struct usb_usbvision *usbvision) ...@@ -1524,7 +1529,9 @@ static int __devinit usbvision_register_video(struct usb_usbvision *usbvision)
return 0; return 0;
err_exit: err_exit:
err("USBVision[%d]: video_register_device() failed", usbvision->nr); dev_err(&usbvision->dev->dev,
"USBVision[%d]: video_register_device() failed\n",
usbvision->nr);
usbvision_unregister_video(usbvision); usbvision_unregister_video(usbvision);
return -1; return -1;
} }
...@@ -1675,20 +1682,20 @@ static int __devinit usbvision_probe(struct usb_interface *intf, ...@@ -1675,20 +1682,20 @@ static int __devinit usbvision_probe(struct usb_interface *intf,
} }
endpoint = &interface->endpoint[1].desc; endpoint = &interface->endpoint[1].desc;
if (!usb_endpoint_xfer_isoc(endpoint)) { if (!usb_endpoint_xfer_isoc(endpoint)) {
err("%s: interface %d. has non-ISO endpoint!", dev_err(&intf->dev, "%s: interface %d. has non-ISO endpoint!\n",
__func__, ifnum); __func__, ifnum);
err("%s: Endpoint attributes %d", dev_err(&intf->dev, "%s: Endpoint attributes %d",
__func__, endpoint->bmAttributes); __func__, endpoint->bmAttributes);
return -ENODEV; return -ENODEV;
} }
if (usb_endpoint_dir_out(endpoint)) { if (usb_endpoint_dir_out(endpoint)) {
err("%s: interface %d. has ISO OUT endpoint!", dev_err(&intf->dev, "%s: interface %d. has ISO OUT endpoint!\n",
__func__, ifnum); __func__, ifnum);
return -ENODEV; return -ENODEV;
} }
if ((usbvision = usbvision_alloc(dev)) == NULL) { if ((usbvision = usbvision_alloc(dev)) == NULL) {
err("%s: couldn't allocate USBVision struct", __func__); dev_err(&intf->dev, "%s: couldn't allocate USBVision struct\n", __func__);
return -ENOMEM; return -ENOMEM;
} }
...@@ -1711,7 +1718,7 @@ static int __devinit usbvision_probe(struct usb_interface *intf, ...@@ -1711,7 +1718,7 @@ static int __devinit usbvision_probe(struct usb_interface *intf,
usbvision->alt_max_pkt_size = kmalloc(32* usbvision->alt_max_pkt_size = kmalloc(32*
usbvision->num_alt,GFP_KERNEL); usbvision->num_alt,GFP_KERNEL);
if (usbvision->alt_max_pkt_size == NULL) { if (usbvision->alt_max_pkt_size == NULL) {
err("usbvision: out of memory!\n"); dev_err(&intf->dev, "usbvision: out of memory!\n");
mutex_unlock(&usbvision->lock); mutex_unlock(&usbvision->lock);
return -ENOMEM; return -ENOMEM;
} }
...@@ -1772,7 +1779,8 @@ static void __devexit usbvision_disconnect(struct usb_interface *intf) ...@@ -1772,7 +1779,8 @@ static void __devexit usbvision_disconnect(struct usb_interface *intf)
PDEBUG(DBG_PROBE, ""); PDEBUG(DBG_PROBE, "");
if (usbvision == NULL) { if (usbvision == NULL) {
err("%s: usb_get_intfdata() failed", __func__); dev_err(&usbvision->dev->dev,
"%s: usb_get_intfdata() failed\n", __func__);
return; return;
} }
usb_set_intfdata (intf, NULL); usb_set_intfdata (intf, NULL);
......
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