Commit ce8591ff authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab

[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: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent 39ad799a
......@@ -56,8 +56,9 @@ MODULE_PARM_DESC(debug, "activates debug info");
#define dprintk(fmt, arg...) do { \
if (debug) \
printk(KERN_DEBUG pr_fmt("audio: %s: " fmt), \
__func__, ##arg); } while (0)
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,7 +166,8 @@ 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",
dev_err(&dev->udev->dev,
"resubmit of audio urb failed (error=%i)\n",
status);
return;
}
......@@ -182,7 +185,8 @@ 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",
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);
......@@ -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",
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);
dev->ifnum, alt, interval, ep_size);
/* Calculate the number and size of URBs to better fit the audio samples */
......@@ -819,7 +825,8 @@ 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",
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 */
......@@ -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;
......
......@@ -22,6 +22,7 @@
#include "em28xx.h"
#include <linux/i2c.h>
#include <linux/usb.h>
#include <media/soc_camera.h>
#include <media/i2c/mt9v011.h>
#include <media/v4l2-clk.h>
......@@ -120,13 +121,15 @@ static int em28xx_probe_sensor_micron(struct em28xx *dev)
ret = i2c_master_send(&client, &reg, 1);
if (ret < 0) {
if (ret != -ENXIO)
pr_err("couldn't read from i2c device 0x%02x: error %i\n",
dev_err(&dev->udev->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) {
pr_err("couldn't read from i2c device 0x%02x: error %i\n",
dev_err(&dev->udev->dev,
"couldn't read from i2c device 0x%02x: error %i\n",
client.addr << 1, ret);
continue;
}
......@@ -135,13 +138,15 @@ static int em28xx_probe_sensor_micron(struct em28xx *dev)
reg = 0xff;
ret = i2c_master_send(&client, &reg, 1);
if (ret < 0) {
pr_err("couldn't read from i2c device 0x%02x: error %i\n",
dev_err(&dev->udev->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) {
pr_err("couldn't read from i2c device 0x%02x: error %i\n",
dev_err(&dev->udev->dev,
"couldn't read from i2c device 0x%02x: error %i\n",
client.addr << 1, ret);
continue;
}
......@@ -180,14 +185,17 @@ static int em28xx_probe_sensor_micron(struct em28xx *dev)
dev->em28xx_sensor = EM28XX_MT9M001;
break;
default:
pr_info("unknown Micron sensor detected: 0x%04x\n", id);
dev_info(&dev->udev->dev,
"unknown Micron sensor detected: 0x%04x\n", id);
return 0;
}
if (dev->em28xx_sensor == EM28XX_NOSENSOR)
pr_info("unsupported sensor detected: %s\n", name);
dev_info(&dev->udev->dev,
"unsupported sensor detected: %s\n", name);
else
pr_info("sensor %s detected\n", name);
dev_info(&dev->udev->dev,
"sensor %s detected\n", name);
dev->i2c_client[dev->def_i2c_bus].addr = client.addr;
return 0;
......@@ -217,7 +225,8 @@ static int em28xx_probe_sensor_omnivision(struct em28xx *dev)
ret = i2c_smbus_read_byte_data(&client, reg);
if (ret < 0) {
if (ret != -ENXIO)
pr_err("couldn't read from i2c device 0x%02x: error %i\n",
dev_err(&dev->udev->dev,
"couldn't read from i2c device 0x%02x: error %i\n",
client.addr << 1, ret);
continue;
}
......@@ -225,7 +234,8 @@ static int em28xx_probe_sensor_omnivision(struct em28xx *dev)
reg = 0x1d;
ret = i2c_smbus_read_byte_data(&client, reg);
if (ret < 0) {
pr_err("couldn't read from i2c device 0x%02x: error %i\n",
dev_err(&dev->udev->dev,
"couldn't read from i2c device 0x%02x: error %i\n",
client.addr << 1, ret);
continue;
}
......@@ -237,7 +247,8 @@ static int em28xx_probe_sensor_omnivision(struct em28xx *dev)
reg = 0x0a;
ret = i2c_smbus_read_byte_data(&client, reg);
if (ret < 0) {
pr_err("couldn't read from i2c device 0x%02x: error %i\n",
dev_err(&dev->udev->dev,
"couldn't read from i2c device 0x%02x: error %i\n",
client.addr << 1, ret);
continue;
}
......@@ -245,7 +256,8 @@ static int em28xx_probe_sensor_omnivision(struct em28xx *dev)
reg = 0x0b;
ret = i2c_smbus_read_byte_data(&client, reg);
if (ret < 0) {
pr_err("couldn't read from i2c device 0x%02x: error %i\n",
dev_err(&dev->udev->dev,
"couldn't read from i2c device 0x%02x: error %i\n",
client.addr << 1, ret);
continue;
}
......@@ -284,15 +296,18 @@ static int em28xx_probe_sensor_omnivision(struct em28xx *dev)
name = "OV9655";
break;
default:
pr_info("unknown OmniVision sensor detected: 0x%04x\n",
dev_info(&dev->udev->dev,
"unknown OmniVision sensor detected: 0x%04x\n",
id);
return 0;
}
if (dev->em28xx_sensor == EM28XX_NOSENSOR)
pr_info("unsupported sensor detected: %s\n", name);
dev_info(&dev->udev->dev,
"unsupported sensor detected: %s\n", name);
else
pr_info("sensor %s detected\n", name);
dev_info(&dev->udev->dev,
"sensor %s detected\n", name);
dev->i2c_client[dev->def_i2c_bus].addr = client.addr;
return 0;
......@@ -316,7 +331,8 @@ int em28xx_detect_sensor(struct em28xx *dev)
*/
if (dev->em28xx_sensor == EM28XX_NOSENSOR && ret < 0) {
pr_info("No sensor detected\n");
dev_info(&dev->udev->dev,
"No sensor detected\n");
return -ENODEV;
}
......
This diff is collapsed.
This diff is collapsed.
......@@ -74,8 +74,9 @@ MODULE_PARM_DESC(debug, "enable debug messages [dvb]");
DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
#define dprintk(level, fmt, arg...) do { \
if (debug >= level) \
printk(KERN_DEBUG "%s/2-dvb: " fmt, dev->name, ## arg); \
if (debug >= level) \
dev_printk(KERN_DEBUG, &dev->udev->dev, \
"dvb: " fmt, ## arg); \
} while (0)
struct em28xx_dvb {
......@@ -735,7 +736,7 @@ static int em28xx_pctv_290e_set_lna(struct dvb_frontend *fe)
ret = gpio_request_one(dvb->lna_gpio, flags, NULL);
if (ret)
pr_err("gpio request failed %d\n", ret);
dev_err(&dev->udev->dev, "gpio request failed %d\n", ret);
else
gpio_free(dvb->lna_gpio);
......@@ -935,19 +936,20 @@ static int em28xx_attach_xc3028(u8 addr, struct em28xx *dev)
cfg.ctrl = &ctl;
if (!dev->dvb->fe[0]) {
pr_err("dvb frontend not attached. Can't attach xc3028\n");
dev_err(&dev->udev->dev,
"dvb frontend not attached. Can't attach xc3028\n");
return -EINVAL;
}
fe = dvb_attach(xc2028_attach, dev->dvb->fe[0], &cfg);
if (!fe) {
pr_err("xc3028 attach failed\n");
dev_err(&dev->udev->dev, "xc3028 attach failed\n");
dvb_frontend_detach(dev->dvb->fe[0]);
dev->dvb->fe[0] = NULL;
return -EINVAL;
}
pr_info("xc3028 attached\n");
dev_info(&dev->udev->dev, "xc3028 attached\n");
return 0;
}
......@@ -963,10 +965,12 @@ static int em28xx_register_dvb(struct em28xx_dvb *dvb, struct module *module,
mutex_init(&dvb->lock);
/* register adapter */
result = dvb_register_adapter(&dvb->adapter, dev->name, module, device,
adapter_nr);
result = dvb_register_adapter(&dvb->adapter,
dev_name(&dev->udev->dev), module,
device, adapter_nr);
if (result < 0) {
pr_warn("dvb_register_adapter failed (errno = %d)\n",
dev_warn(&dev->udev->dev,
"dvb_register_adapter failed (errno = %d)\n",
result);
goto fail_adapter;
}
......@@ -984,7 +988,8 @@ static int em28xx_register_dvb(struct em28xx_dvb *dvb, struct module *module,
/* register frontend */
result = dvb_register_frontend(&dvb->adapter, dvb->fe[0]);
if (result < 0) {
pr_warn("dvb_register_frontend failed (errno = %d)\n",
dev_warn(&dev->udev->dev,
"dvb_register_frontend failed (errno = %d)\n",
result);
goto fail_frontend0;
}
......@@ -993,7 +998,8 @@ static int em28xx_register_dvb(struct em28xx_dvb *dvb, struct module *module,
if (dvb->fe[1]) {
result = dvb_register_frontend(&dvb->adapter, dvb->fe[1]);
if (result < 0) {
pr_warn("2nd dvb_register_frontend failed (errno = %d)\n",
dev_warn(&dev->udev->dev,
"2nd dvb_register_frontend failed (errno = %d)\n",
result);
goto fail_frontend1;
}
......@@ -1011,7 +1017,9 @@ static int em28xx_register_dvb(struct em28xx_dvb *dvb, struct module *module,
result = dvb_dmx_init(&dvb->demux);
if (result < 0) {
pr_warn("dvb_dmx_init failed (errno = %d)\n", result);
dev_warn(&dev->udev->dev,
"dvb_dmx_init failed (errno = %d)\n",
result);
goto fail_dmx;
}
......@@ -1020,14 +1028,17 @@ static int em28xx_register_dvb(struct em28xx_dvb *dvb, struct module *module,
dvb->dmxdev.capabilities = 0;
result = dvb_dmxdev_init(&dvb->dmxdev, &dvb->adapter);
if (result < 0) {
pr_warn("dvb_dmxdev_init failed (errno = %d)\n", result);
dev_warn(&dev->udev->dev,
"dvb_dmxdev_init failed (errno = %d)\n",
result);
goto fail_dmxdev;
}
dvb->fe_hw.source = DMX_FRONTEND_0;
result = dvb->demux.dmx.add_frontend(&dvb->demux.dmx, &dvb->fe_hw);
if (result < 0) {
pr_warn("add_frontend failed (DMX_FRONTEND_0, errno = %d)\n",
dev_warn(&dev->udev->dev,
"add_frontend failed (DMX_FRONTEND_0, errno = %d)\n",
result);
goto fail_fe_hw;
}
......@@ -1035,14 +1046,17 @@ static int em28xx_register_dvb(struct em28xx_dvb *dvb, struct module *module,
dvb->fe_mem.source = DMX_MEMORY_FE;
result = dvb->demux.dmx.add_frontend(&dvb->demux.dmx, &dvb->fe_mem);
if (result < 0) {
pr_warn("add_frontend failed (DMX_MEMORY_FE, errno = %d)\n",
dev_warn(&dev->udev->dev,
"add_frontend failed (DMX_MEMORY_FE, errno = %d)\n",
result);
goto fail_fe_mem;
}
result = dvb->demux.dmx.connect_frontend(&dvb->demux.dmx, &dvb->fe_hw);
if (result < 0) {
pr_warn("connect_frontend failed (errno = %d)\n", result);
dev_warn(&dev->udev->dev,
"connect_frontend failed (errno = %d)\n",
result);
goto fail_fe_conn;
}
......@@ -1114,7 +1128,7 @@ static int em28xx_dvb_init(struct em28xx *dev)
return 0;
}
pr_info("Binding DVB extension\n");
dev_info(&dev->udev->dev, "Binding DVB extension\n");
dvb = kzalloc(sizeof(struct em28xx_dvb), GFP_KERNEL);
if (!dvb)
......@@ -1138,7 +1152,8 @@ static int em28xx_dvb_init(struct em28xx *dev)
EM28XX_DVB_NUM_ISOC_PACKETS);
}
if (result) {
pr_err("em28xx_dvb: failed to pre-allocate USB transfer buffers for DVB.\n");
dev_err(&dev->udev->dev,
"failed to pre-allocate USB transfer buffers for DVB.\n");
kfree(dvb);
dev->dvb = NULL;
return result;
......@@ -1317,7 +1332,8 @@ static int em28xx_dvb_init(struct em28xx *dev)
result = gpio_request_one(dvb->lna_gpio,
GPIOF_OUT_INIT_LOW, NULL);
if (result)
pr_err("gpio request failed %d\n",
dev_err(&dev->udev->dev,
"gpio request failed %d\n",
result);
else
gpio_free(dvb->lna_gpio);
......@@ -1933,11 +1949,12 @@ static int em28xx_dvb_init(struct em28xx *dev)
}
break;
default:
pr_err("The frontend of your DVB/ATSC card isn't supported yet\n");
dev_err(&dev->udev->dev,
"The frontend of your DVB/ATSC card isn't supported yet\n");
break;
}
if (NULL == dvb->fe[0]) {
pr_err("frontend initialization failed\n");
dev_err(&dev->udev->dev, "frontend initialization failed\n");
result = -EINVAL;
goto out_free;
}
......@@ -1952,7 +1969,7 @@ static int em28xx_dvb_init(struct em28xx *dev)
if (result < 0)
goto out_free;
pr_info("DVB extension successfully initialized\n");
dev_info(&dev->udev->dev, "DVB extension successfully initialized\n");
kref_get(&dev->ref);
......@@ -1992,7 +2009,7 @@ static int em28xx_dvb_fini(struct em28xx *dev)
if (!dev->dvb)
return 0;
pr_info("Closing DVB extension\n");
dev_info(&dev->udev->dev, "Closing DVB extension\n");
dvb = dev->dvb;
......@@ -2050,17 +2067,17 @@ static int em28xx_dvb_suspend(struct em28xx *dev)
if (!dev->board.has_dvb)
return 0;
pr_info("Suspending DVB extension\n");
dev_info(&dev->udev->dev, "Suspending DVB extension\n");
if (dev->dvb) {
struct em28xx_dvb *dvb = dev->dvb;
if (dvb->fe[0]) {
ret = dvb_frontend_suspend(dvb->fe[0]);
pr_info("fe0 suspend %d\n", ret);
dev_info(&dev->udev->dev, "fe0 suspend %d\n", ret);
}
if (dvb->fe[1]) {
dvb_frontend_suspend(dvb->fe[1]);
pr_info("fe1 suspend %d\n", ret);
dev_info(&dev->udev->dev, "fe1 suspend %d\n", ret);
}
}
......@@ -2077,18 +2094,18 @@ static int em28xx_dvb_resume(struct em28xx *dev)
if (!dev->board.has_dvb)
return 0;
pr_info("Resuming DVB extension\n");
dev_info(&dev->udev->dev, "Resuming DVB extension\n");
if (dev->dvb) {
struct em28xx_dvb *dvb = dev->dvb;
if (dvb->fe[0]) {
ret = dvb_frontend_resume(dvb->fe[0]);
pr_info("fe0 resume %d\n", ret);
dev_info(&dev->udev->dev, "fe0 resume %d\n", ret);
}
if (dvb->fe[1]) {
ret = dvb_frontend_resume(dvb->fe[1]);
pr_info("fe1 resume %d\n", ret);
dev_info(&dev->udev->dev, "fe1 resume %d\n", ret);
}
}
......
This diff is collapsed.
......@@ -41,10 +41,11 @@ MODULE_PARM_DESC(ir_debug, "enable debug messages [IR]");
#define MODULE_NAME "em28xx"
#define dprintk(fmt, arg...) \
if (ir_debug) { \
printk(KERN_DEBUG "%s/ir: " fmt, ir->name , ## arg); \
}
#define dprintk( fmt, arg...) do { \
if (ir_debug) \
dev_printk(KERN_DEBUG, &ir->dev->udev->dev, \
"input: %s: " fmt, __func__, ## arg); \
} while (0)
/**********************************************************
Polling structure used by em28xx IR's
......@@ -458,7 +459,8 @@ static int em28xx_ir_change_protocol(struct rc_dev *rc_dev, u64 *rc_type)
case CHIP_ID_EM28178:
return em2874_ir_change_protocol(rc_dev, rc_type);
default:
pr_err("Unrecognized em28xx chip id 0x%02x: IR not supported\n",
dev_err(&ir->dev->udev->dev,
"Unrecognized em28xx chip id 0x%02x: IR not supported\n",
dev->chip_id);
return -EINVAL;
}
......@@ -567,7 +569,7 @@ static int em28xx_register_snapshot_button(struct em28xx *dev)
struct input_dev *input_dev;
int err;
pr_info("Registering snapshot button...\n");
dev_info(&dev->udev->dev, "Registering snapshot button...\n");
input_dev = input_allocate_device();
if (!input_dev)
return -ENOMEM;
......@@ -591,7 +593,7 @@ static int em28xx_register_snapshot_button(struct em28xx *dev)
err = input_register_device(input_dev);
if (err) {
pr_err("input_register_device failed\n");
dev_err(&dev->udev->dev, "input_register_device failed\n");
input_free_device(input_dev);
return err;
}
......@@ -631,7 +633,8 @@ static void em28xx_init_buttons(struct em28xx *dev)
} else if (button->role == EM28XX_BUTTON_ILLUMINATION) {
/* Check sanity */
if (!em28xx_find_led(dev, EM28XX_LED_ILLUMINATION)) {
pr_err("BUG: illumination button defined, but no illumination LED.\n");
dev_err(&dev->udev->dev,
"BUG: illumination button defined, but no illumination LED.\n");
goto next_button;
}
}
......@@ -667,7 +670,7 @@ static void em28xx_shutdown_buttons(struct em28xx *dev)
dev->num_button_polling_addresses = 0;
/* Deregister input devices */
if (dev->sbutton_input_dev != NULL) {
pr_info("Deregistering snapshot button\n");
dev_info(&dev->udev->dev, "Deregistering snapshot button\n");
input_unregister_device(dev->sbutton_input_dev);
dev->sbutton_input_dev = NULL;
}
......@@ -696,18 +699,20 @@ static int em28xx_ir_init(struct em28xx *dev)
i2c_rc_dev_addr = em28xx_probe_i2c_ir(dev);
if (!i2c_rc_dev_addr) {
dev->board.has_ir_i2c = 0;
pr_warn("No i2c IR remote control device found.\n");
dev_warn(&dev->udev->dev,
"No i2c IR remote control device found.\n");
return -ENODEV;
}
}
if (dev->board.ir_codes == NULL && !dev->board.has_ir_i2c) {
/* No remote control support */
pr_warn("Remote control support is not available for this card.\n");
dev_warn(&dev->udev->dev,
"Remote control support is not available for this card.\n");
return 0;
}
pr_info("Registering input extension\n");
dev_info(&dev->udev->dev, "Registering input extension\n");
ir = kzalloc(sizeof(*ir), GFP_KERNEL);
if (!ir)
......@@ -791,7 +796,8 @@ static int em28xx_ir_init(struct em28xx *dev)
ir->polling = 100; /* ms */
/* init input device */
snprintf(ir->name, sizeof(ir->name), "em28xx IR (%s)", dev->name);
snprintf(ir->name, sizeof(ir->name), "%s IR",
dev_name(&dev->udev->dev));
usb_make_path(dev->udev, ir->phys, sizeof(ir->phys));
strlcat(ir->phys, "/input0", sizeof(ir->phys));
......@@ -810,7 +816,7 @@ static int em28xx_ir_init(struct em28xx *dev)
if (err)
goto error;
pr_info("Input extension successfully initalized\n");
dev_info(&dev->udev->dev, "Input extension successfully initalized\n");
return 0;
......@@ -831,7 +837,7 @@ static int em28xx_ir_fini(struct em28xx *dev)
return 0;
}
pr_info("Closing input extension\n");
dev_info(&dev->udev->dev, "Closing input extension\n");
em28xx_shutdown_buttons(dev);
......@@ -860,7 +866,7 @@ static int em28xx_ir_suspend(struct em28xx *dev)
if (dev->is_audio_only)
return 0;
pr_info("Suspending input extension\n");
dev_info(&dev->udev->dev, "Suspending input extension\n");
if (ir)
cancel_delayed_work_sync(&ir->work);
cancel_delayed_work_sync(&dev->buttons_query_work);
......@@ -877,7 +883,7 @@ static int em28xx_ir_resume(struct em28xx *dev)
if (dev->is_audio_only)
return 0;
pr_info("Resuming input extension\n");
dev_info(&dev->udev->dev, "Resuming input extension\n");
/* if suspend calls ir_raw_event_unregister(), the should call
ir_raw_event_register() */
if (ir)
......
......@@ -27,6 +27,7 @@
#include <linux/module.h>
#include <linux/hardirq.h>
#include <linux/init.h>
#include <linux/usb.h>
#include "em28xx-v4l.h"
......@@ -64,7 +65,8 @@ static int vbi_buffer_prepare(struct vb2_buffer *vb)
size = v4l2->vbi_width * v4l2->vbi_height * 2;
if (vb2_plane_size(vb, 0) < size) {
pr_info("%s data will not fit into plane (%lu < %lu)\n",
dev_info(&dev->udev->dev,
"%s data will not fit into plane (%lu < %lu)\n",
__func__, vb2_plane_size(vb, 0), size);
return -EINVAL;
}
......
......@@ -64,15 +64,17 @@ static int alt;
module_param(alt, int, 0644);
MODULE_PARM_DESC(alt, "alternate setting to use for video endpoint");
#define em28xx_videodbg(fmt, arg...) do {\
#define em28xx_videodbg(fmt, arg...) do { \
if (video_debug) \
printk(KERN_DEBUG pr_fmt("video: %s: " fmt), \
__func__, ##arg); } while (0)
dev_printk(KERN_DEBUG, &dev->udev->dev, \
"video: %s: " fmt, __func__, ## arg); \
} while (0)
#define em28xx_isocdbg(fmt, arg...) do {\
if (isoc_debug) \
printk(KERN_DEBUG pr_fmt("isoc: %s: " fmt), \
__func__, ##arg); } while (0)
dev_printk(KERN_DEBUG, &dev->udev->dev, \
"isoc: %s: " fmt, __func__, ## arg); \
} while (0)
MODULE_AUTHOR(DRIVER_AUTHOR);
MODULE_DESCRIPTION(DRIVER_DESC " - v4l2 interface");
......@@ -411,7 +413,8 @@ static int em28xx_set_alternate(struct em28xx *dev)
dev->alt, dev->max_pkt_size);
errCode = usb_set_interface(dev->udev, dev->ifnum, dev->alt);
if (errCode < 0) {
pr_err("cannot change alternate number to %d (error=%i)\n",
dev_err(&dev->udev->dev,
"cannot change alternate number to %d (error=%i)\n",
dev->alt, errCode);
return errCode;
}
......@@ -923,7 +926,8 @@ static int em28xx_enable_analog_tuner(struct em28xx *dev)
ret = media_entity_setup_link(link, flags);
if (ret) {
pr_err("Couldn't change link %s->%s to %s. Error %d\n",
dev_err(&dev->udev->dev,
"Couldn't change link %s->%s to %s. Error %d\n",
source->name, sink->name,
flags ? "enabled" : "disabled",
ret);
......@@ -954,14 +958,16 @@ static void em28xx_v4l2_create_entities(struct em28xx *dev)
v4l2->video_pad.flags = MEDIA_PAD_FL_SINK;
ret = media_entity_pads_init(&v4l2->vdev.entity, 1, &v4l2->video_pad);
if (ret < 0)
pr_err("failed to initialize video media entity!\n");
dev_err(&dev->udev->dev,
"failed to initialize video media entity!\n");
if (em28xx_vbi_supported(dev)) {
v4l2->vbi_pad.flags = MEDIA_PAD_FL_SINK;
ret = media_entity_pads_init(&v4l2->vbi_dev.entity, 1,
&v4l2->vbi_pad);
if (ret < 0)
pr_err("failed to initialize vbi media entity!\n");
dev_err(&dev->udev->dev,
"failed to initialize vbi media entity!\n");
}
/* Webcams don't have input connectors */
......@@ -994,11 +1000,13 @@ static void em28xx_v4l2_create_entities(struct em28xx *dev)
ret = media_entity_pads_init(ent, 1, &dev->input_pad[i]);
if (ret < 0)
pr_err("failed to initialize input pad[%d]!\n", i);
dev_err(&dev->udev->dev,
"failed to initialize input pad[%d]!\n", i);
ret = media_device_register_entity(dev->media_dev, ent);
if (ret < 0)
pr_err("failed to register input entity %d!\n", i);
dev_err(&dev->udev->dev,
"failed to register input entity %d!\n", i);
}
#endif
}
......@@ -2045,7 +2053,8 @@ static int em28xx_v4l2_open(struct file *filp)
ret = v4l2_fh_open(filp);
if (ret) {
pr_err("%s: v4l2_fh_open() returned error %d\n",
dev_err(&dev->udev->dev,
"%s: v4l2_fh_open() returned error %d\n",
__func__, ret);
mutex_unlock(&dev->lock);
return ret;
......@@ -2100,7 +2109,7 @@ static int em28xx_v4l2_fini(struct em28xx *dev)
if (v4l2 == NULL)
return 0;
pr_info("Closing video extension\n");
dev_info(&dev->udev->dev, "Closing video extension\n");
mutex_lock(&dev->lock);
......@@ -2111,17 +2120,17 @@ static int em28xx_v4l2_fini(struct em28xx *dev)
em28xx_v4l2_media_release(dev);
if (video_is_registered(&v4l2->radio_dev)) {
pr_info("V4L2 device %s deregistered\n",
dev_info(&dev->udev->dev, "V4L2 device %s deregistered\n",
video_device_node_name(&v4l2->radio_dev));
video_unregister_device(&v4l2->radio_dev);
}
if (video_is_registered(&v4l2->vbi_dev)) {
pr_info("V4L2 device %s deregistered\n",
dev_info(&dev->udev->dev, "V4L2 device %s deregistered\n",
video_device_node_name(&v4l2->vbi_dev));
video_unregister_device(&v4l2->vbi_dev);
}
if (video_is_registered(&v4l2->vdev)) {
pr_info("V4L2 device %s deregistered\n",
dev_info(&dev->udev->dev, "V4L2 device %s deregistered\n",
video_device_node_name(&v4l2->vdev));
video_unregister_device(&v4l2->vdev);
}
......@@ -2151,7 +2160,7 @@ static int em28xx_v4l2_suspend(struct em28xx *dev)
if (!dev->has_video)
return 0;
pr_info("Suspending video extension\n");
dev_info(&dev->udev->dev, "Suspending video extension\n");
em28xx_stop_urbs(dev);
return 0;
}
......@@ -2164,7 +2173,7 @@ static int em28xx_v4l2_resume(struct em28xx *dev)
if (!dev->has_video)
return 0;
pr_info("Resuming video extension\n");
dev_info(&dev->udev->dev, "Resuming video extension\n");
/* what do we do here */
return 0;
}
......@@ -2201,7 +2210,8 @@ static int em28xx_v4l2_close(struct file *filp)
em28xx_videodbg("setting alternate 0\n");
errCode = usb_set_interface(dev->udev, 0, 0);
if (errCode < 0) {
pr_err("cannot change alternate number to 0 (error=%i)\n",
dev_err(&dev->udev->dev,
"cannot change alternate number to 0 (error=%i)\n",
errCode);
}
}
......@@ -2335,7 +2345,7 @@ static void em28xx_vdev_init(struct em28xx *dev,
vfd->tvnorms = 0;
snprintf(vfd->name, sizeof(vfd->name), "%s %s",
dev->name, type_name);
dev_name(&dev->udev->dev), type_name);
video_set_drvdata(vfd, dev);
}
......@@ -2419,7 +2429,7 @@ static int em28xx_v4l2_init(struct em28xx *dev)
return 0;
}
pr_info("Registering V4L2 extension\n");
dev_info(&dev->udev->dev, "Registering V4L2 extension\n");
mutex_lock(&dev->lock);
......@@ -2437,7 +2447,8 @@ static int em28xx_v4l2_init(struct em28xx *dev)
#endif
ret = v4l2_device_register(&dev->udev->dev, &v4l2->v4l2_dev);
if (ret < 0) {
pr_err("Call to v4l2_device_register() failed!\n");
dev_err(&dev->udev->dev,
"Call to v4l2_device_register() failed!\n");
goto err;
}
......@@ -2521,7 +2532,8 @@ static int em28xx_v4l2_init(struct em28xx *dev)
/* Configure audio */
ret = em28xx_audio_setup(dev);
if (ret < 0) {
pr_err("%s: Error while setting audio - error [%d]!\n",
dev_err(&dev->udev->dev,
"%s: Error while setting audio - error [%d]!\n",
__func__, ret);
goto unregister_dev;
}
......@@ -2549,7 +2561,8 @@ static int em28xx_v4l2_init(struct em28xx *dev)
/* Send a reset to other chips via gpio */
ret = em28xx_write_reg(dev, EM2820_R08_GPIO_CTRL, 0xf7);
if (ret < 0) {
pr_err("%s: em28xx_write_reg - msp34xx(1) failed! error [%d]\n",
dev_err(&dev->udev->dev,
"%s: em28xx_write_reg - msp34xx(1) failed! error [%d]\n",
__func__, ret);
goto unregister_dev;
}
......@@ -2557,7 +2570,8 @@ static int em28xx_v4l2_init(struct em28xx *dev)
ret = em28xx_write_reg(dev, EM2820_R08_GPIO_CTRL, 0xff);
if (ret < 0) {
pr_err("%s: em28xx_write_reg - msp34xx(2) failed! error [%d]\n",
dev_err(&dev->udev->dev,
"%s: em28xx_write_reg - msp34xx(2) failed! error [%d]\n",
__func__, ret);
goto unregister_dev;
}
......@@ -2659,7 +2673,8 @@ static int em28xx_v4l2_init(struct em28xx *dev)
ret = video_register_device(&v4l2->vdev, VFL_TYPE_GRABBER,
video_nr[dev->devno]);
if (ret) {
pr_err("unable to register video device (error=%i).\n", ret);
dev_err(&dev->udev->dev,
"unable to register video device (error=%i).\n", ret);
goto unregister_dev;
}
......@@ -2688,7 +2703,8 @@ static int em28xx_v4l2_init(struct em28xx *dev)
ret = video_register_device(&v4l2->vbi_dev, VFL_TYPE_VBI,
vbi_nr[dev->devno]);
if (ret < 0) {
pr_err("unable to register vbi device\n");
dev_err(&dev->udev->dev,
"unable to register vbi device\n");
goto unregister_dev;
}
}
......@@ -2699,10 +2715,12 @@ static int em28xx_v4l2_init(struct em28xx *dev)
ret = video_register_device(&v4l2->radio_dev, VFL_TYPE_RADIO,
radio_nr[dev->devno]);
if (ret < 0) {
pr_err("can't register radio device\n");
dev_err(&dev->udev->dev,
"can't register radio device\n");
goto unregister_dev;
}
pr_info("Registered radio device as %s\n",
dev_info(&dev->udev->dev,
"Registered radio device as %s\n",
video_device_node_name(&v4l2->radio_dev));
}
......@@ -2712,17 +2730,20 @@ static int em28xx_v4l2_init(struct em28xx *dev)
#ifdef CONFIG_MEDIA_CONTROLLER
ret = v4l2_mc_create_media_graph(dev->media_dev);
if (ret) {
pr_err("failed to create media graph\n");
dev_err(&dev->udev->dev,
"failed to create media graph\n");
em28xx_v4l2_media_release(dev);
goto unregister_dev;
}
#endif
pr_info("V4L2 video device registered as %s\n",
dev_info(&dev->udev->dev,
"V4L2 video device registered as %s\n",
video_device_node_name(&v4l2->vdev));
if (video_is_registered(&v4l2->vbi_dev))
pr_info("V4L2 VBI device registered as %s\n",
dev_info(&dev->udev->dev,
"V4L2 VBI device registered as %s\n",
video_device_node_name(&v4l2->vbi_dev));
/* Save some power by putting tuner to sleep */
......@@ -2731,7 +2752,8 @@ static int em28xx_v4l2_init(struct em28xx *dev)
/* initialize videobuf2 stuff */
em28xx_vb2_setup(dev);
pr_info("V4L2 extension successfully initialized\n");
dev_info(&dev->udev->dev,
"V4L2 extension successfully initialized\n");
kref_get(&dev->ref);
......@@ -2740,17 +2762,20 @@ static int em28xx_v4l2_init(struct em28xx *dev)
unregister_dev:
if (video_is_registered(&v4l2->radio_dev)) {
pr_info("V4L2 device %s deregistered\n",
dev_info(&dev->udev->dev,
"V4L2 device %s deregistered\n",
video_device_node_name(&v4l2->radio_dev));
video_unregister_device(&v4l2->radio_dev);
}
if (video_is_registered(&v4l2->vbi_dev)) {
pr_info("V4L2 device %s deregistered\n",
dev_info(&dev->udev->dev,
"V4L2 device %s deregistered\n",
video_device_node_name(&v4l2->vbi_dev));
video_unregister_device(&v4l2->vbi_dev);
}
if (video_is_registered(&v4l2->vdev)) {
pr_info("V4L2 device %s deregistered\n",
dev_info(&dev->udev->dev,
"V4L2 device %s deregistered\n",
video_device_node_name(&v4l2->vdev));
video_unregister_device(&v4l2->vdev);
}
......
......@@ -29,8 +29,6 @@
#define EM28XX_VERSION "0.2.2"
#define DRIVER_DESC "Empia em28xx device driver"
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/workqueue.h>
#include <linux/i2c.h>
#include <linux/mutex.h>
......@@ -612,7 +610,6 @@ struct em28xx {
struct em28xx_IR *ir;
/* generic device properties */
char name[30]; /* name (including minor) of the device */
int model; /* index in the device_data struct */
int devno; /* marks the number of this device */
enum em28xx_chip_id chip_id;
......
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