Skip to content

Commit

Permalink
[media] em28xx: use usb_interface for dev_foo() calls
Browse files Browse the repository at this point in the history
The usb_device->dev is not the right device for dev_foo() calls.
Instead, it should use usb_interface->dev.

Tested-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
  • Loading branch information
Mauro Carvalho Chehab authored and Mauro Carvalho Chehab committed Dec 12, 2016
1 parent ea48c36 commit 29b05e2
Show file tree
Hide file tree
Showing 10 changed files with 216 additions and 213 deletions.
34 changes: 17 additions & 17 deletions drivers/media/usb/em28xx/em28xx-audio.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ MODULE_PARM_DESC(debug, "activates debug info");

#define dprintk(fmt, arg...) do { \
if (debug) \
dev_printk(KERN_DEBUG, &dev->udev->dev, \
dev_printk(KERN_DEBUG, &dev->intf->dev, \
"video: %s: " fmt, __func__, ## arg); \
} while (0)

Expand Down Expand Up @@ -166,7 +166,7 @@ static void em28xx_audio_isocirq(struct urb *urb)

status = usb_submit_urb(urb, GFP_ATOMIC);
if (status < 0)
dev_err(&dev->udev->dev,
dev_err(&dev->intf->dev,
"resubmit of audio urb failed (error=%i)\n",
status);
return;
Expand All @@ -185,7 +185,7 @@ static int em28xx_init_audio_isoc(struct em28xx *dev)

errCode = usb_submit_urb(dev->adev.urb[i], GFP_ATOMIC);
if (errCode) {
dev_err(&dev->udev->dev,
dev_err(&dev->intf->dev,
"submit of audio urb failed (error=%i)\n",
errCode);
em28xx_deinit_isoc_audio(dev);
Expand Down Expand Up @@ -322,7 +322,7 @@ static int snd_em28xx_capture_open(struct snd_pcm_substream *substream)
err:
mutex_unlock(&dev->lock);

dev_err(&dev->udev->dev,
dev_err(&dev->intf->dev,
"Error while configuring em28xx mixer\n");
return ret;
}
Expand Down Expand Up @@ -761,7 +761,7 @@ static int em28xx_audio_urb_init(struct em28xx *dev)
intf = usb_ifnum_to_if(dev->udev, dev->ifnum);

if (intf->num_altsetting <= alt) {
dev_err(&dev->udev->dev, "alt %d doesn't exist on interface %d\n",
dev_err(&dev->intf->dev, "alt %d doesn't exist on interface %d\n",
dev->ifnum, alt);
return -ENODEV;
}
Expand All @@ -777,14 +777,14 @@ static int em28xx_audio_urb_init(struct em28xx *dev)
}

if (!ep) {
dev_err(&dev->udev->dev, "Couldn't find an audio endpoint");
dev_err(&dev->intf->dev, "Couldn't find an audio endpoint");
return -ENODEV;
}

ep_size = em28xx_audio_ep_packet_size(dev->udev, ep);
interval = 1 << (ep->bInterval - 1);

dev_info(&dev->udev->dev,
dev_info(&dev->intf->dev,
"Endpoint 0x%02x %s on intf %d alt %d interval = %d, size %d\n",
EM28XX_EP_AUDIO, usb_speed_string(dev->udev->speed),
dev->ifnum, alt, interval, ep_size);
Expand Down Expand Up @@ -824,7 +824,7 @@ static int em28xx_audio_urb_init(struct em28xx *dev)
if (urb_size > ep_size * npackets)
npackets = DIV_ROUND_UP(urb_size, ep_size);

dev_info(&dev->udev->dev,
dev_info(&dev->intf->dev,
"Number of URBs: %d, with %d packets and %d size\n",
num_urb, npackets, urb_size);

Expand Down Expand Up @@ -863,7 +863,7 @@ static int em28xx_audio_urb_init(struct em28xx *dev)
buf = usb_alloc_coherent(dev->udev, npackets * ep_size, GFP_ATOMIC,
&urb->transfer_dma);
if (!buf) {
dev_err(&dev->udev->dev,
dev_err(&dev->intf->dev,
"usb_alloc_coherent failed!\n");
em28xx_audio_free_urb(dev);
return -ENOMEM;
Expand Down Expand Up @@ -904,16 +904,16 @@ static int em28xx_audio_init(struct em28xx *dev)
return 0;
}

dev_info(&dev->udev->dev, "Binding audio extension\n");
dev_info(&dev->intf->dev, "Binding audio extension\n");

kref_get(&dev->ref);

dev_info(&dev->udev->dev,
dev_info(&dev->intf->dev,
"em28xx-audio.c: Copyright (C) 2006 Markus Rechberger\n");
dev_info(&dev->udev->dev,
dev_info(&dev->intf->dev,
"em28xx-audio.c: Copyright (C) 2007-2016 Mauro Carvalho Chehab\n");

err = snd_card_new(&dev->udev->dev, index[devnr], "Em28xx Audio",
err = snd_card_new(&dev->intf->dev, index[devnr], "Em28xx Audio",
THIS_MODULE, 0, &card);
if (err < 0)
return err;
Expand Down Expand Up @@ -961,7 +961,7 @@ static int em28xx_audio_init(struct em28xx *dev)
if (err < 0)
goto urb_free;

dev_info(&dev->udev->dev, "Audio extension successfully initialized\n");
dev_info(&dev->intf->dev, "Audio extension successfully initialized\n");
return 0;

urb_free:
Expand All @@ -986,7 +986,7 @@ static int em28xx_audio_fini(struct em28xx *dev)
return 0;
}

dev_info(&dev->udev->dev, "Closing audio extension\n");
dev_info(&dev->intf->dev, "Closing audio extension\n");

if (dev->adev.sndcard) {
snd_card_disconnect(dev->adev.sndcard);
Expand All @@ -1010,7 +1010,7 @@ static int em28xx_audio_suspend(struct em28xx *dev)
if (dev->usb_audio_type != EM28XX_USB_AUDIO_VENDOR)
return 0;

dev_info(&dev->udev->dev, "Suspending audio extension\n");
dev_info(&dev->intf->dev, "Suspending audio extension\n");
em28xx_deinit_isoc_audio(dev);
atomic_set(&dev->adev.stream_started, 0);
return 0;
Expand All @@ -1024,7 +1024,7 @@ static int em28xx_audio_resume(struct em28xx *dev)
if (dev->usb_audio_type != EM28XX_USB_AUDIO_VENDOR)
return 0;

dev_info(&dev->udev->dev, "Resuming audio extension\n");
dev_info(&dev->intf->dev, "Resuming audio extension\n");
/* Nothing to do other than schedule_work() ?? */
schedule_work(&dev->adev.wq_trigger);
return 0;
Expand Down
30 changes: 15 additions & 15 deletions drivers/media/usb/em28xx/em28xx-camera.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,14 +121,14 @@ static int em28xx_probe_sensor_micron(struct em28xx *dev)
ret = i2c_master_send(&client, &reg, 1);
if (ret < 0) {
if (ret != -ENXIO)
dev_err(&dev->udev->dev,
dev_err(&dev->intf->dev,
"couldn't read from i2c device 0x%02x: error %i\n",
client.addr << 1, ret);
continue;
}
ret = i2c_master_recv(&client, (u8 *)&id_be, 2);
if (ret < 0) {
dev_err(&dev->udev->dev,
dev_err(&dev->intf->dev,
"couldn't read from i2c device 0x%02x: error %i\n",
client.addr << 1, ret);
continue;
Expand All @@ -138,14 +138,14 @@ static int em28xx_probe_sensor_micron(struct em28xx *dev)
reg = 0xff;
ret = i2c_master_send(&client, &reg, 1);
if (ret < 0) {
dev_err(&dev->udev->dev,
dev_err(&dev->intf->dev,
"couldn't read from i2c device 0x%02x: error %i\n",
client.addr << 1, ret);
continue;
}
ret = i2c_master_recv(&client, (u8 *)&id_be, 2);
if (ret < 0) {
dev_err(&dev->udev->dev,
dev_err(&dev->intf->dev,
"couldn't read from i2c device 0x%02x: error %i\n",
client.addr << 1, ret);
continue;
Expand Down Expand Up @@ -185,16 +185,16 @@ static int em28xx_probe_sensor_micron(struct em28xx *dev)
dev->em28xx_sensor = EM28XX_MT9M001;
break;
default:
dev_info(&dev->udev->dev,
dev_info(&dev->intf->dev,
"unknown Micron sensor detected: 0x%04x\n", id);
return 0;
}

if (dev->em28xx_sensor == EM28XX_NOSENSOR)
dev_info(&dev->udev->dev,
dev_info(&dev->intf->dev,
"unsupported sensor detected: %s\n", name);
else
dev_info(&dev->udev->dev,
dev_info(&dev->intf->dev,
"sensor %s detected\n", name);

dev->i2c_client[dev->def_i2c_bus].addr = client.addr;
Expand Down Expand Up @@ -225,7 +225,7 @@ static int em28xx_probe_sensor_omnivision(struct em28xx *dev)
ret = i2c_smbus_read_byte_data(&client, reg);
if (ret < 0) {
if (ret != -ENXIO)
dev_err(&dev->udev->dev,
dev_err(&dev->intf->dev,
"couldn't read from i2c device 0x%02x: error %i\n",
client.addr << 1, ret);
continue;
Expand All @@ -234,7 +234,7 @@ static int em28xx_probe_sensor_omnivision(struct em28xx *dev)
reg = 0x1d;
ret = i2c_smbus_read_byte_data(&client, reg);
if (ret < 0) {
dev_err(&dev->udev->dev,
dev_err(&dev->intf->dev,
"couldn't read from i2c device 0x%02x: error %i\n",
client.addr << 1, ret);
continue;
Expand All @@ -247,7 +247,7 @@ static int em28xx_probe_sensor_omnivision(struct em28xx *dev)
reg = 0x0a;
ret = i2c_smbus_read_byte_data(&client, reg);
if (ret < 0) {
dev_err(&dev->udev->dev,
dev_err(&dev->intf->dev,
"couldn't read from i2c device 0x%02x: error %i\n",
client.addr << 1, ret);
continue;
Expand All @@ -256,7 +256,7 @@ static int em28xx_probe_sensor_omnivision(struct em28xx *dev)
reg = 0x0b;
ret = i2c_smbus_read_byte_data(&client, reg);
if (ret < 0) {
dev_err(&dev->udev->dev,
dev_err(&dev->intf->dev,
"couldn't read from i2c device 0x%02x: error %i\n",
client.addr << 1, ret);
continue;
Expand Down Expand Up @@ -296,17 +296,17 @@ static int em28xx_probe_sensor_omnivision(struct em28xx *dev)
name = "OV9655";
break;
default:
dev_info(&dev->udev->dev,
dev_info(&dev->intf->dev,
"unknown OmniVision sensor detected: 0x%04x\n",
id);
return 0;
}

if (dev->em28xx_sensor == EM28XX_NOSENSOR)
dev_info(&dev->udev->dev,
dev_info(&dev->intf->dev,
"unsupported sensor detected: %s\n", name);
else
dev_info(&dev->udev->dev,
dev_info(&dev->intf->dev,
"sensor %s detected\n", name);

dev->i2c_client[dev->def_i2c_bus].addr = client.addr;
Expand All @@ -331,7 +331,7 @@ int em28xx_detect_sensor(struct em28xx *dev)
*/

if (dev->em28xx_sensor == EM28XX_NOSENSOR && ret < 0) {
dev_info(&dev->udev->dev,
dev_info(&dev->intf->dev,
"No sensor detected\n");
return -ENODEV;
}
Expand Down
Loading

0 comments on commit 29b05e2

Please sign in to comment.