summaryrefslogtreecommitdiffstats
path: root/drivers/media/usb/em28xx/em28xx-audio.c
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@s-opensource.com>2016-10-20 08:42:03 -0200
committerMauro Carvalho Chehab <mchehab@s-opensource.com>2016-11-18 10:08:15 -0200
commitce8591ff023ef8e04750c2cc2882523619a80b58 (patch)
treea513137f48890cd4ef0e51966666b4398d2bb747 /drivers/media/usb/em28xx/em28xx-audio.c
parent39ad799a85e2afb2eeb0295cabe81e183b011b95 (diff)
downloadop-kernel-dev-ce8591ff023ef8e04750c2cc2882523619a80b58.zip
op-kernel-dev-ce8591ff023ef8e04750c2cc2882523619a80b58.tar.gz
[media] em28xx: convert it from pr_foo() to dev_foo()
Instead of using pr_foo(), use dev_foo(), with provides a better output. As this device is a multi-interface one, we'll set the device name to show the chipset and the driver used. While here, get rid of printk continuation messages. Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Diffstat (limited to 'drivers/media/usb/em28xx/em28xx-audio.c')
-rw-r--r--drivers/media/usb/em28xx/em28xx-audio.c64
1 files changed, 37 insertions, 27 deletions
diff --git a/drivers/media/usb/em28xx/em28xx-audio.c b/drivers/media/usb/em28xx/em28xx-audio.c
index 06e4956..cd2545c 100644
--- a/drivers/media/usb/em28xx/em28xx-audio.c
+++ b/drivers/media/usb/em28xx/em28xx-audio.c
@@ -55,9 +55,10 @@ MODULE_PARM_DESC(debug, "activates debug info");
#define EM28XX_MIN_AUDIO_PACKETS 64
#define dprintk(fmt, arg...) do { \
- if (debug) \
- printk(KERN_DEBUG pr_fmt("audio: %s: " fmt), \
- __func__, ##arg); } while (0)
+ if (debug) \
+ dev_printk(KERN_DEBUG, &dev->udev->dev, \
+ "video: %s: " fmt, __func__, ## arg); \
+} while (0)
static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;
@@ -91,7 +92,8 @@ static void em28xx_audio_isocirq(struct urb *urb)
struct snd_pcm_runtime *runtime;
if (dev->disconnected) {
- dprintk("device disconnected while streaming. URB status=%d.\n", urb->status);
+ dprintk("device disconnected while streaming. URB status=%d.\n",
+ urb->status);
atomic_set(&dev->adev.stream_started, 0);
return;
}
@@ -164,8 +166,9 @@ static void em28xx_audio_isocirq(struct urb *urb)
status = usb_submit_urb(urb, GFP_ATOMIC);
if (status < 0)
- pr_err("resubmit of audio urb failed (error=%i)\n",
- status);
+ dev_err(&dev->udev->dev,
+ "resubmit of audio urb failed (error=%i)\n",
+ status);
return;
}
@@ -182,8 +185,9 @@ static int em28xx_init_audio_isoc(struct em28xx *dev)
errCode = usb_submit_urb(dev->adev.urb[i], GFP_ATOMIC);
if (errCode) {
- pr_err("submit of audio urb failed (error=%i)\n",
- errCode);
+ dev_err(&dev->udev->dev,
+ "submit of audio urb failed (error=%i)\n",
+ errCode);
em28xx_deinit_isoc_audio(dev);
atomic_set(&dev->adev.stream_started, 0);
return errCode;
@@ -197,6 +201,7 @@ static int em28xx_init_audio_isoc(struct em28xx *dev)
static int snd_pcm_alloc_vmalloc_buffer(struct snd_pcm_substream *subs,
size_t size)
{
+ struct em28xx *dev = snd_pcm_substream_chip(subs);
struct snd_pcm_runtime *runtime = subs->runtime;
dprintk("Allocating vbuffer\n");
@@ -254,7 +259,8 @@ static int snd_em28xx_capture_open(struct snd_pcm_substream *substream)
int nonblock, ret = 0;
if (!dev) {
- pr_err("BUG: em28xx can't find device struct. Can't proceed with open\n");
+ dev_err(&dev->udev->dev,
+ "BUG: em28xx can't find device struct. Can't proceed with open\n");
return -ENODEV;
}
@@ -317,7 +323,8 @@ static int snd_em28xx_capture_open(struct snd_pcm_substream *substream)
err:
mutex_unlock(&dev->lock);
- pr_err("Error while configuring em28xx mixer\n");
+ dev_err(&dev->udev->dev,
+ "Error while configuring em28xx mixer\n");
return ret;
}
@@ -755,7 +762,7 @@ static int em28xx_audio_urb_init(struct em28xx *dev)
intf = usb_ifnum_to_if(dev->udev, dev->ifnum);
if (intf->num_altsetting <= alt) {
- pr_err("alt %d doesn't exist on interface %d\n",
+ dev_err(&dev->udev->dev, "alt %d doesn't exist on interface %d\n",
dev->ifnum, alt);
return -ENODEV;
}
@@ -771,18 +778,17 @@ static int em28xx_audio_urb_init(struct em28xx *dev)
}
if (!ep) {
- pr_err("Couldn't find an audio endpoint");
+ dev_err(&dev->udev->dev, "Couldn't find an audio endpoint");
return -ENODEV;
}
ep_size = em28xx_audio_ep_packet_size(dev->udev, ep);
interval = 1 << (ep->bInterval - 1);
- pr_info("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);
+ dev_info(&dev->udev->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);
/* Calculate the number and size of URBs to better fit the audio samples */
@@ -819,8 +825,9 @@ static int em28xx_audio_urb_init(struct em28xx *dev)
if (urb_size > ep_size * npackets)
npackets = DIV_ROUND_UP(urb_size, ep_size);
- pr_info("Number of URBs: %d, with %d packets and %d size\n",
- num_urb, npackets, urb_size);
+ dev_info(&dev->udev->dev,
+ "Number of URBs: %d, with %d packets and %d size\n",
+ num_urb, npackets, urb_size);
/* Estimate the bytes per period */
dev->adev.period = urb_size * npackets;
@@ -857,7 +864,8 @@ 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) {
- pr_err("usb_alloc_coherent failed!\n");
+ dev_err(&dev->udev->dev,
+ "usb_alloc_coherent failed!\n");
em28xx_audio_free_urb(dev);
return -ENOMEM;
}
@@ -897,12 +905,14 @@ static int em28xx_audio_init(struct em28xx *dev)
return 0;
}
- pr_info("Binding audio extension\n");
+ dev_info(&dev->udev->dev, "Binding audio extension\n");
kref_get(&dev->ref);
- pr_info("em28xx-audio.c: Copyright (C) 2006 Markus Rechberger\n");
- pr_info("em28xx-audio.c: Copyright (C) 2007-2016 Mauro Carvalho Chehab\n");
+ dev_info(&dev->udev->dev,
+ "em28xx-audio.c: Copyright (C) 2006 Markus Rechberger\n");
+ dev_info(&dev->udev->dev,
+ "em28xx-audio.c: Copyright (C) 2007-2016 Mauro Carvalho Chehab\n");
err = snd_card_new(&dev->udev->dev, index[devnr], "Em28xx Audio",
THIS_MODULE, 0, &card);
@@ -952,7 +962,7 @@ static int em28xx_audio_init(struct em28xx *dev)
if (err < 0)
goto urb_free;
- pr_info("Audio extension successfully initialized\n");
+ dev_info(&dev->udev->dev, "Audio extension successfully initialized\n");
return 0;
urb_free:
@@ -977,7 +987,7 @@ static int em28xx_audio_fini(struct em28xx *dev)
return 0;
}
- pr_info("Closing audio extension\n");
+ dev_info(&dev->udev->dev, "Closing audio extension\n");
if (dev->adev.sndcard) {
snd_card_disconnect(dev->adev.sndcard);
@@ -1001,7 +1011,7 @@ static int em28xx_audio_suspend(struct em28xx *dev)
if (dev->usb_audio_type != EM28XX_USB_AUDIO_VENDOR)
return 0;
- pr_info("Suspending audio extension\n");
+ dev_info(&dev->udev->dev, "Suspending audio extension\n");
em28xx_deinit_isoc_audio(dev);
atomic_set(&dev->adev.stream_started, 0);
return 0;
@@ -1015,7 +1025,7 @@ static int em28xx_audio_resume(struct em28xx *dev)
if (dev->usb_audio_type != EM28XX_USB_AUDIO_VENDOR)
return 0;
- pr_info("Resuming audio extension\n");
+ dev_info(&dev->udev->dev, "Resuming audio extension\n");
/* Nothing to do other than schedule_work() ?? */
schedule_work(&dev->adev.wq_trigger);
return 0;
OpenPOWER on IntegriCloud