From ff086575b7fbfcf48c1e2bc6f8914cbfc2c4ea37 Mon Sep 17 00:00:00 2001 From: Andy Walls Date: Sat, 18 Oct 2008 08:51:28 -0300 Subject: V4L/DVB (9297): cx18: Fix memory leak on card initialization failure On error exit, the cx18_probe() function did not use the proper entry in cx18_cards[] with kfree() when card init failed; leaking memory. Signed-off-by: Andy Walls Signed-off-by: Mauro Carvalho Chehab diff --git a/drivers/media/video/cx18/cx18-driver.c b/drivers/media/video/cx18/cx18-driver.c index 085121c..ef60f56 100644 --- a/drivers/media/video/cx18/cx18-driver.c +++ b/drivers/media/video/cx18/cx18-driver.c @@ -613,6 +613,7 @@ static int __devinit cx18_probe(struct pci_dev *dev, const struct pci_device_id *pci_id) { int retval = 0; + int i; int vbi_buf_size; u32 devtype; struct cx18 *cx; @@ -836,8 +837,11 @@ err: CX18_ERR("Error %d on initialization\n", retval); cx18_log_statistics(cx); - kfree(cx18_cards[cx18_cards_active]); - cx18_cards[cx18_cards_active] = NULL; + i = cx->num; + spin_lock(&cx18_cards_lock); + kfree(cx18_cards[i]); + cx18_cards[i] = NULL; + spin_unlock(&cx18_cards_lock); return retval; } -- cgit v0.10.2 From 06869713de3e6380b2f24d9eac30426b4e471375 Mon Sep 17 00:00:00 2001 From: Andy Walls Date: Sat, 18 Oct 2008 09:00:26 -0300 Subject: V4L/DVB (9298): cx18: Add __iomem address space qualifier to cx18_log_*_retries() argument cx18: Add __iomem address space qualifier to cx18_log_*_retries() addr argument to clean up sparse build warnings. Signed-off-by: Andy Walls Signed-off-by: Mauro Carvalho Chehab diff --git a/drivers/media/video/cx18/cx18-io.h b/drivers/media/video/cx18/cx18-io.h index 197d4fb..287a5e8 100644 --- a/drivers/media/video/cx18/cx18-io.h +++ b/drivers/media/video/cx18/cx18-io.h @@ -39,7 +39,7 @@ static inline void cx18_io_delay(struct cx18 *cx) /* Statistics gathering */ static inline -void cx18_log_write_retries(struct cx18 *cx, int i, const void *addr) +void cx18_log_write_retries(struct cx18 *cx, int i, const void __iomem *addr) { if (i > CX18_MAX_MMIO_RETRIES) i = CX18_MAX_MMIO_RETRIES; @@ -48,7 +48,7 @@ void cx18_log_write_retries(struct cx18 *cx, int i, const void *addr) } static inline -void cx18_log_read_retries(struct cx18 *cx, int i, const void *addr) +void cx18_log_read_retries(struct cx18 *cx, int i, const void __iomem *addr) { if (i > CX18_MAX_MMIO_RETRIES) i = CX18_MAX_MMIO_RETRIES; -- cgit v0.10.2 From 9b4a7c8a83899ef7742f63c0e9a8a28cbff2c29a Mon Sep 17 00:00:00 2001 From: Andy Walls Date: Sat, 18 Oct 2008 10:20:25 -0300 Subject: V4L/DVB (9299): cx18: Don't mask many real init error codes by mapping them to ENOMEM Changes to let error return codes bubble up to the user visible error message on card initialization. A number of them were being remapped to ENOMEM when no memory or array resource shortage existed. That hampered diagnosis of user trouble reports. Signed-off-by: Andy Walls Signed-off-by: Mauro Carvalho Chehab diff --git a/drivers/media/video/cx18/cx18-driver.c b/drivers/media/video/cx18/cx18-driver.c index ef60f56..7a1a783 100644 --- a/drivers/media/video/cx18/cx18-driver.c +++ b/drivers/media/video/cx18/cx18-driver.c @@ -699,7 +699,8 @@ static int __devinit cx18_probe(struct pci_dev *dev, /* active i2c */ CX18_DEBUG_INFO("activating i2c...\n"); - if (init_cx18_i2c(cx)) { + retval = init_cx18_i2c(cx); + if (retval) { CX18_ERR("Could not initialize i2c\n"); goto free_map; } diff --git a/drivers/media/video/cx18/cx18-streams.c b/drivers/media/video/cx18/cx18-streams.c index 0c8e754..e5ff770 100644 --- a/drivers/media/video/cx18/cx18-streams.c +++ b/drivers/media/video/cx18/cx18-streams.c @@ -200,16 +200,18 @@ static int cx18_prep_dev(struct cx18 *cx, int type) /* Initialize v4l2 variables and register v4l2 devices */ int cx18_streams_setup(struct cx18 *cx) { - int type; + int type, ret; /* Setup V4L2 Devices */ for (type = 0; type < CX18_MAX_STREAMS; type++) { /* Prepare device */ - if (cx18_prep_dev(cx, type)) + ret = cx18_prep_dev(cx, type); + if (ret < 0) break; /* Allocate Stream */ - if (cx18_stream_alloc(&cx->streams[type])) + ret = cx18_stream_alloc(&cx->streams[type]); + if (ret < 0) break; } if (type == CX18_MAX_STREAMS) @@ -217,14 +219,14 @@ int cx18_streams_setup(struct cx18 *cx) /* One or more streams could not be initialized. Clean 'em all up. */ cx18_streams_cleanup(cx, 0); - return -ENOMEM; + return ret; } static int cx18_reg_dev(struct cx18 *cx, int type) { struct cx18_stream *s = &cx->streams[type]; int vfl_type = cx18_stream_info[type].vfl_type; - int num; + int num, ret; /* TODO: Shouldn't this be a VFL_TYPE_TRANSPORT or something? * We need a VFL_TYPE_TS defined. @@ -233,9 +235,10 @@ static int cx18_reg_dev(struct cx18 *cx, int type) /* just return if no DVB is supported */ if ((cx->card->hw_all & CX18_HW_DVB) == 0) return 0; - if (cx18_dvb_register(s) < 0) { + ret = cx18_dvb_register(s); + if (ret < 0) { CX18_ERR("DVB failed to register\n"); - return -EINVAL; + return ret; } } @@ -252,12 +255,13 @@ static int cx18_reg_dev(struct cx18 *cx, int type) } /* Register device. First try the desired minor, then any free one. */ - if (video_register_device(s->v4l2dev, vfl_type, num)) { + ret = video_register_device(s->v4l2dev, vfl_type, num); + if (ret < 0) { CX18_ERR("Couldn't register v4l2 device for %s kernel number %d\n", s->name, num); video_device_release(s->v4l2dev); s->v4l2dev = NULL; - return -ENOMEM; + return ret; } num = s->v4l2dev->num; @@ -290,18 +294,22 @@ static int cx18_reg_dev(struct cx18 *cx, int type) int cx18_streams_register(struct cx18 *cx) { int type; - int err = 0; + int err; + int ret = 0; /* Register V4L2 devices */ - for (type = 0; type < CX18_MAX_STREAMS; type++) - err |= cx18_reg_dev(cx, type); + for (type = 0; type < CX18_MAX_STREAMS; type++) { + err = cx18_reg_dev(cx, type); + if (err && ret == 0) + ret = err; + } - if (err == 0) + if (ret == 0) return 0; /* One or more streams could not be initialized. Clean 'em all up. */ cx18_streams_cleanup(cx, 1); - return -ENOMEM; + return ret; } /* Unregister v4l2 devices */ -- cgit v0.10.2 From c82732a42896364296599b0f73f01c5e3fd781ae Mon Sep 17 00:00:00 2001 From: Mike Isely Date: Sun, 19 Oct 2008 16:26:05 -0300 Subject: V4L/DVB (9300): pvrusb2: Fix deadlock problem Fix deadlock problem in 2.6.27 caused by new USB core behavior in response to a USB device reset request. With older kernels, the USB device reset was "in line"; the reset simply took place and the driver retained its association with the hardware. However now this reset triggers a disconnect, and worse still the disconnect callback happens in the context of the caller who asked for the device reset. This results in an attempt by the pvrusb2 driver to recursively take a mutex it already has, which deadlocks the driver's worker thread. (Even if the disconnect callback were to happen on a different thread we'd still have problems however - because while the driver should survive and correctly disconnect / reconnect, it will then trigger another device reset during the repeated initialization, which will then cause another disconect, etc, forever.) The fix here is simply to not attempt the device reset (it was of marginal value anyway). Signed-off-by: Mike Isely Signed-off-by: Mauro Carvalho Chehab diff --git a/drivers/media/video/pvrusb2/pvrusb2-hdw.c b/drivers/media/video/pvrusb2/pvrusb2-hdw.c index 94265bd..5b81ba4 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-hdw.c +++ b/drivers/media/video/pvrusb2/pvrusb2-hdw.c @@ -60,7 +60,6 @@ static struct pvr2_hdw *unit_pointers[PVR_NUM] = {[ 0 ... PVR_NUM-1 ] = NULL}; static DEFINE_MUTEX(pvr2_unit_mtx); static int ctlchg; -static int initusbreset = 1; static int procreload; static int tuner[PVR_NUM] = { [0 ... PVR_NUM-1] = -1 }; static int tolerance[PVR_NUM] = { [0 ... PVR_NUM-1] = 0 }; @@ -71,8 +70,6 @@ module_param(ctlchg, int, S_IRUGO|S_IWUSR); MODULE_PARM_DESC(ctlchg, "0=optimize ctl change 1=always accept new ctl value"); module_param(init_pause_msec, int, S_IRUGO|S_IWUSR); MODULE_PARM_DESC(init_pause_msec, "hardware initialization settling delay"); -module_param(initusbreset, int, S_IRUGO|S_IWUSR); -MODULE_PARM_DESC(initusbreset, "Do USB reset device on probe"); module_param(procreload, int, S_IRUGO|S_IWUSR); MODULE_PARM_DESC(procreload, "Attempt init failure recovery with firmware reload"); @@ -1967,9 +1964,6 @@ static void pvr2_hdw_setup_low(struct pvr2_hdw *hdw) } hdw->fw1_state = FW1_STATE_OK; - if (initusbreset) { - pvr2_hdw_device_reset(hdw); - } if (!pvr2_hdw_dev_ok(hdw)) return; for (idx = 0; idx < hdw->hdw_desc->client_modules.cnt; idx++) { -- cgit v0.10.2 From 3f93d1adca658201c64251c43a147cc79d468c3f Mon Sep 17 00:00:00 2001 From: Boris Dores Date: Sun, 19 Oct 2008 17:00:30 -0300 Subject: V4L/DVB (9301): pvrusb2: Keep MPEG PTSs from drifting away (Mike Isely) This change was empirically figured out by Boris Dores after empirically comparing against behavior in the Windows driver. Signed-off-by: Mike Isely Signed-off-by: Mauro Carvalho Chehab diff --git a/drivers/media/video/pvrusb2/pvrusb2-encoder.c b/drivers/media/video/pvrusb2/pvrusb2-encoder.c index a1252d6..273d2a1 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-encoder.c +++ b/drivers/media/video/pvrusb2/pvrusb2-encoder.c @@ -402,6 +402,10 @@ static int pvr2_encoder_prep_config(struct pvr2_hdw *hdw) ret |= pvr2_encoder_vcmd(hdw, CX2341X_ENC_MISC,4, 0,3,0,0); ret |= pvr2_encoder_vcmd(hdw, CX2341X_ENC_MISC,4,15,0,0,0); + /* prevent the PTSs from slowly drifting away in the generated + MPEG stream */ + ret |= pvr2_encoder_vcmd(hdw, CX2341X_ENC_MISC, 2, 4, 1); + return ret; } -- cgit v0.10.2 From 448441cf2f97da478c51852fac153ae6bb3430d8 Mon Sep 17 00:00:00 2001 From: Alexey Klimov Date: Sun, 19 Oct 2008 23:20:47 -0300 Subject: V4L/DVB (9303): dsbr100: Correct bus_info string Replaced bus_info string from ISA to USB Signed-off-by: Alexey Klimov Signed-off-by: Douglas Schilling Landgraf Signed-off-by: Mauro Carvalho Chehab diff --git a/drivers/media/radio/dsbr100.c b/drivers/media/radio/dsbr100.c index 78f5694..8ddc8bfc 100644 --- a/drivers/media/radio/dsbr100.c +++ b/drivers/media/radio/dsbr100.c @@ -265,7 +265,7 @@ static int vidioc_querycap(struct file *file, void *priv, { strlcpy(v->driver, "dsbr100", sizeof(v->driver)); strlcpy(v->card, "D-Link R-100 USB FM Radio", sizeof(v->card)); - sprintf(v->bus_info, "ISA"); + sprintf(v->bus_info, "USB"); v->version = RADIO_VERSION; v->capabilities = V4L2_CAP_TUNER; return 0; -- cgit v0.10.2 From 223377e76d68c8015f1c809d3c831423de7b1fb6 Mon Sep 17 00:00:00 2001 From: Alexey Klimov Date: Sun, 19 Oct 2008 23:50:27 -0300 Subject: V4L/DVB (9304): dsbr100: CodingStyle issue Fixed few coding style issues in dsbr100 Signed-off-by: Alexey Klimov Signed-off-by: Douglas Schilling Landgraf Signed-off-by: Mauro Carvalho Chehab diff --git a/drivers/media/radio/dsbr100.c b/drivers/media/radio/dsbr100.c index 8ddc8bfc..e88c58e 100644 --- a/drivers/media/radio/dsbr100.c +++ b/drivers/media/radio/dsbr100.c @@ -171,11 +171,11 @@ static int dsbr100_start(struct dsbr100_device *radio) if (usb_control_msg(radio->usbdev, usb_rcvctrlpipe(radio->usbdev, 0), USB_REQ_GET_STATUS, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, - 0x00, 0xC7, radio->transfer_buffer, 8, 300)<0 || + 0x00, 0xC7, radio->transfer_buffer, 8, 300) < 0 || usb_control_msg(radio->usbdev, usb_rcvctrlpipe(radio->usbdev, 0), DSB100_ONOFF, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, - 0x01, 0x00, radio->transfer_buffer, 8, 300)<0) + 0x01, 0x00, radio->transfer_buffer, 8, 300) < 0) return -1; radio->muted=0; return (radio->transfer_buffer)[0]; @@ -188,11 +188,11 @@ static int dsbr100_stop(struct dsbr100_device *radio) if (usb_control_msg(radio->usbdev, usb_rcvctrlpipe(radio->usbdev, 0), USB_REQ_GET_STATUS, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, - 0x16, 0x1C, radio->transfer_buffer, 8, 300)<0 || + 0x16, 0x1C, radio->transfer_buffer, 8, 300) < 0 || usb_control_msg(radio->usbdev, usb_rcvctrlpipe(radio->usbdev, 0), DSB100_ONOFF, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, - 0x00, 0x00, radio->transfer_buffer, 8, 300)<0) + 0x00, 0x00, radio->transfer_buffer, 8, 300) < 0) return -1; radio->muted=1; return (radio->transfer_buffer)[0]; @@ -201,24 +201,24 @@ static int dsbr100_stop(struct dsbr100_device *radio) /* set a frequency, freq is defined by v4l's TUNER_LOW, i.e. 1/16th kHz */ static int dsbr100_setfreq(struct dsbr100_device *radio, int freq) { - freq = (freq/16*80)/1000+856; + freq = (freq / 16 * 80) / 1000 + 856; if (usb_control_msg(radio->usbdev, usb_rcvctrlpipe(radio->usbdev, 0), DSB100_TUNE, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, - (freq>>8)&0x00ff, freq&0xff, - radio->transfer_buffer, 8, 300)<0 || + (freq >> 8) & 0x00ff, freq & 0xff, + radio->transfer_buffer, 8, 300) < 0 || usb_control_msg(radio->usbdev, usb_rcvctrlpipe(radio->usbdev, 0), USB_REQ_GET_STATUS, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, - 0x96, 0xB7, radio->transfer_buffer, 8, 300)<0 || + 0x96, 0xB7, radio->transfer_buffer, 8, 300) < 0 || usb_control_msg(radio->usbdev, usb_rcvctrlpipe(radio->usbdev, 0), USB_REQ_GET_STATUS, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, - 0x00, 0x24, radio->transfer_buffer, 8, 300)<0) { + 0x00, 0x24, radio->transfer_buffer, 8, 300) < 0) { radio->stereo = -1; return -1; } - radio->stereo = ! ((radio->transfer_buffer)[0]&0x01); + radio->stereo = !((radio->transfer_buffer)[0] & 0x01); return (radio->transfer_buffer)[0]; } @@ -229,10 +229,10 @@ static void dsbr100_getstat(struct dsbr100_device *radio) if (usb_control_msg(radio->usbdev, usb_rcvctrlpipe(radio->usbdev, 0), USB_REQ_GET_STATUS, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, - 0x00 , 0x24, radio->transfer_buffer, 8, 300)<0) + 0x00 , 0x24, radio->transfer_buffer, 8, 300) < 0) radio->stereo = -1; else - radio->stereo = ! (radio->transfer_buffer[0]&0x01); + radio->stereo = !(radio->transfer_buffer[0] & 0x01); } @@ -282,9 +282,9 @@ static int vidioc_g_tuner(struct file *file, void *priv, dsbr100_getstat(radio); strcpy(v->name, "FM"); v->type = V4L2_TUNER_RADIO; - v->rangelow = FREQ_MIN*FREQ_MUL; - v->rangehigh = FREQ_MAX*FREQ_MUL; - v->rxsubchans = V4L2_TUNER_SUB_MONO|V4L2_TUNER_SUB_STEREO; + v->rangelow = FREQ_MIN * FREQ_MUL; + v->rangehigh = FREQ_MAX * FREQ_MUL; + v->rxsubchans = V4L2_TUNER_SUB_MONO | V4L2_TUNER_SUB_STEREO; v->capability = V4L2_TUNER_CAP_LOW; if(radio->stereo) v->audmode = V4L2_TUNER_MODE_STEREO; @@ -309,7 +309,7 @@ static int vidioc_s_frequency(struct file *file, void *priv, struct dsbr100_device *radio = video_drvdata(file); radio->curfreq = f->frequency; - if (dsbr100_setfreq(radio, radio->curfreq)==-1) + if (dsbr100_setfreq(radio, radio->curfreq) == -1) dev_warn(&radio->usbdev->dev, "Set frequency failed\n"); return 0; } @@ -331,8 +331,7 @@ static int vidioc_queryctrl(struct file *file, void *priv, for (i = 0; i < ARRAY_SIZE(radio_qctrl); i++) { if (qc->id && qc->id == radio_qctrl[i].id) { - memcpy(qc, &(radio_qctrl[i]), - sizeof(*qc)); + memcpy(qc, &(radio_qctrl[i]), sizeof(*qc)); return 0; } } @@ -417,7 +416,7 @@ static int usb_dsbr100_open(struct inode *inode, struct file *file) radio->users = 1; radio->muted = 1; - if (dsbr100_start(radio)<0) { + if (dsbr100_start(radio) < 0) { dev_warn(&radio->usbdev->dev, "Radio did not start up properly\n"); radio->users = 0; @@ -485,13 +484,20 @@ static int usb_dsbr100_probe(struct usb_interface *intf, { struct dsbr100_device *radio; - if (!(radio = kmalloc(sizeof(struct dsbr100_device), GFP_KERNEL))) + radio = kmalloc(sizeof(struct dsbr100_device), GFP_KERNEL); + + if (!radio) return -ENOMEM; - if (!(radio->transfer_buffer = kmalloc(TB_LEN, GFP_KERNEL))) { + + radio->transfer_buffer = kmalloc(TB_LEN, GFP_KERNEL); + + if (!(radio->transfer_buffer)) { kfree(radio); return -ENOMEM; } - if (!(radio->videodev = video_device_alloc())) { + radio->videodev = video_device_alloc(); + + if (!(radio->videodev)) { kfree(radio->transfer_buffer); kfree(radio); return -ENOMEM; @@ -501,7 +507,7 @@ static int usb_dsbr100_probe(struct usb_interface *intf, radio->removed = 0; radio->users = 0; radio->usbdev = interface_to_usbdev(intf); - radio->curfreq = FREQ_MIN*FREQ_MUL; + radio->curfreq = FREQ_MIN * FREQ_MUL; video_set_drvdata(radio->videodev, radio); if (video_register_device(radio->videodev, VFL_TYPE_RADIO, radio_nr) < 0) { dev_warn(&intf->dev, "Could not register video device\n"); -- cgit v0.10.2 From 0fabb78332aee7d5dd4a0a31228b9266de71182f Mon Sep 17 00:00:00 2001 From: Alexey Klimov Date: Sun, 19 Oct 2008 23:56:23 -0300 Subject: V4L/DVB (9305): radio-mr800: Add BKL for usb_amradio_open() Added BKL for usb_amradio_open() Signed-off-by: Alexey Klimov Signed-off-by: Douglas Schilling Landgraf Signed-off-by: Mauro Carvalho Chehab diff --git a/drivers/media/radio/radio-mr800.c b/drivers/media/radio/radio-mr800.c index a33717c..256cbef 100644 --- a/drivers/media/radio/radio-mr800.c +++ b/drivers/media/radio/radio-mr800.c @@ -469,16 +469,21 @@ static int usb_amradio_open(struct inode *inode, struct file *file) { struct amradio_device *radio = video_get_drvdata(video_devdata(file)); + lock_kernel(); + radio->users = 1; radio->muted = 1; if (amradio_start(radio) < 0) { warn("Radio did not start up properly"); radio->users = 0; + unlock_kernel(); return -EIO; } if (amradio_setfreq(radio, radio->curfreq) < 0) warn("Set frequency failed"); + + unlock_kernel(); return 0; } -- cgit v0.10.2 From b9f3573731e63116712eb5ea28bd6ded09232afa Mon Sep 17 00:00:00 2001 From: Alexey Klimov Date: Mon, 20 Oct 2008 00:00:03 -0300 Subject: V4L/DVB (9306): dsbr100: Add frequency check Add checking for frequency and printk if -1 returned. Signed-off-by: Alexey Klimov Signed-off-by: Douglas Schilling Landgraf Signed-off-by: Mauro Carvalho Chehab diff --git a/drivers/media/radio/dsbr100.c b/drivers/media/radio/dsbr100.c index e88c58e..a5ca176 100644 --- a/drivers/media/radio/dsbr100.c +++ b/drivers/media/radio/dsbr100.c @@ -411,6 +411,7 @@ static int vidioc_s_audio(struct file *file, void *priv, static int usb_dsbr100_open(struct inode *inode, struct file *file) { struct dsbr100_device *radio = video_drvdata(file); + int retval; lock_kernel(); radio->users = 1; @@ -423,7 +424,12 @@ static int usb_dsbr100_open(struct inode *inode, struct file *file) unlock_kernel(); return -EIO; } - dsbr100_setfreq(radio, radio->curfreq); + + retval = dsbr100_setfreq(radio, radio->curfreq); + + if (retval == -1) + printk(KERN_WARNING KBUILD_MODNAME ": Set frequency failed\n"); + unlock_kernel(); return 0; } -- cgit v0.10.2 From f4ef033ee03b36ba1b1d39007d740f2786a93f2b Mon Sep 17 00:00:00 2001 From: Steven Toth Date: Thu, 16 Oct 2008 23:15:10 -0300 Subject: V4L/DVB (9308): s5h1411: Improvements to the default registers s5h1411: Improvements to the default registers Signed-off-by: Steven Toth Signed-off-by: Mauro Carvalho Chehab diff --git a/drivers/media/dvb/frontends/s5h1411.c b/drivers/media/dvb/frontends/s5h1411.c index 2febfb5..a642cae 100644 --- a/drivers/media/dvb/frontends/s5h1411.c +++ b/drivers/media/dvb/frontends/s5h1411.c @@ -62,7 +62,7 @@ static struct init_tab { { S5H1411_I2C_TOP_ADDR, 0x08, 0x0047, }, { S5H1411_I2C_TOP_ADDR, 0x1c, 0x0400, }, { S5H1411_I2C_TOP_ADDR, 0x1e, 0x0370, }, - { S5H1411_I2C_TOP_ADDR, 0x1f, 0x342a, }, + { S5H1411_I2C_TOP_ADDR, 0x1f, 0x342c, }, { S5H1411_I2C_TOP_ADDR, 0x24, 0x0231, }, { S5H1411_I2C_TOP_ADDR, 0x25, 0x1011, }, { S5H1411_I2C_TOP_ADDR, 0x26, 0x0f07, }, @@ -100,7 +100,6 @@ static struct init_tab { { S5H1411_I2C_TOP_ADDR, 0x78, 0x3141, }, { S5H1411_I2C_TOP_ADDR, 0x7a, 0x3141, }, { S5H1411_I2C_TOP_ADDR, 0xb3, 0x8003, }, - { S5H1411_I2C_TOP_ADDR, 0xb5, 0xafbb, }, { S5H1411_I2C_TOP_ADDR, 0xb5, 0xa6bb, }, { S5H1411_I2C_TOP_ADDR, 0xb6, 0x0609, }, { S5H1411_I2C_TOP_ADDR, 0xb7, 0x2f06, }, -- cgit v0.10.2 From c96de5197d038cd1c5538085109c7329434ee94b Mon Sep 17 00:00:00 2001 From: Steven Toth Date: Thu, 16 Oct 2008 23:16:50 -0300 Subject: V4L/DVB (9309): s5h1411: I/F related bugfix for 3.25 and remove spurious define This should improve performance. Signed-off-by: Steven Toth Signed-off-by: Mauro Carvalho Chehab diff --git a/drivers/media/dvb/frontends/s5h1411.c b/drivers/media/dvb/frontends/s5h1411.c index a642cae..25a3fb3 100644 --- a/drivers/media/dvb/frontends/s5h1411.c +++ b/drivers/media/dvb/frontends/s5h1411.c @@ -392,7 +392,7 @@ static int s5h1411_set_if_freq(struct dvb_frontend *fe, int KHz) switch (KHz) { case 3250: - s5h1411_writereg(state, S5H1411_I2C_TOP_ADDR, 0x38, 0x10d9); + s5h1411_writereg(state, S5H1411_I2C_TOP_ADDR, 0x38, 0x10d5); s5h1411_writereg(state, S5H1411_I2C_TOP_ADDR, 0x39, 0x5342); s5h1411_writereg(state, S5H1411_I2C_QAM_ADDR, 0x2c, 0x10d9); break; diff --git a/drivers/media/dvb/frontends/s5h1411.h b/drivers/media/dvb/frontends/s5h1411.h index 7d542bc..2370a06 100644 --- a/drivers/media/dvb/frontends/s5h1411.h +++ b/drivers/media/dvb/frontends/s5h1411.h @@ -47,7 +47,6 @@ struct s5h1411_config { u16 mpeg_timing; /* IF Freq for QAM and VSB in KHz */ -#define S5H1411_IF_2500 2500 #define S5H1411_IF_3500 3500 #define S5H1411_IF_4000 4000 #define S5H1411_IF_5380 5380 -- cgit v0.10.2 From e16c63de928f00075f0ea466581e04b44bb33f75 Mon Sep 17 00:00:00 2001 From: Steven Toth Date: Thu, 16 Oct 2008 23:17:42 -0300 Subject: V4L/DVB (9310): s5h1411: read_status() locking detection fixes. This includes new bit definitions for previously unknown bits. Signed-off-by: Steven Toth Signed-off-by: Mauro Carvalho Chehab diff --git a/drivers/media/dvb/frontends/s5h1411.c b/drivers/media/dvb/frontends/s5h1411.c index 25a3fb3..c79e23d 100644 --- a/drivers/media/dvb/frontends/s5h1411.c +++ b/drivers/media/dvb/frontends/s5h1411.c @@ -636,28 +636,29 @@ static int s5h1411_read_status(struct dvb_frontend *fe, fe_status_t *status) *status = 0; - /* Get the demodulator status */ - reg = (s5h1411_readreg(state, S5H1411_I2C_TOP_ADDR, 0xf2) >> 15) - & 0x0001; - if (reg) - *status |= FE_HAS_LOCK | FE_HAS_CARRIER | FE_HAS_SIGNAL; + /* Register F2 bit 15 = Master Lock, removed */ switch (state->current_modulation) { case QAM_64: case QAM_256: reg = s5h1411_readreg(state, S5H1411_I2C_TOP_ADDR, 0xf0); - if (reg & 0x100) - *status |= FE_HAS_VITERBI; - if (reg & 0x10) - *status |= FE_HAS_SYNC; + if (reg & 0x10) /* QAM FEC Lock */ + *status |= FE_HAS_SYNC | FE_HAS_LOCK; + if (reg & 0x100) /* QAM EQ Lock */ + *status |= FE_HAS_VITERBI | FE_HAS_CARRIER | FE_HAS_SIGNAL; + break; case VSB_8: - reg = s5h1411_readreg(state, S5H1411_I2C_TOP_ADDR, 0x5e); - if (reg & 0x0001) - *status |= FE_HAS_SYNC; reg = s5h1411_readreg(state, S5H1411_I2C_TOP_ADDR, 0xf2); - if (reg & 0x1000) - *status |= FE_HAS_VITERBI; + if (reg & 0x1000) /* FEC Lock */ + *status |= FE_HAS_SYNC | FE_HAS_LOCK; + if (reg & 0x2000) /* EQ Lock */ + *status |= FE_HAS_VITERBI | FE_HAS_CARRIER | FE_HAS_SIGNAL; + + reg = s5h1411_readreg(state, S5H1411_I2C_TOP_ADDR, 0x53); + if (reg & 0x1) /* AFC Lock */ + *status |= FE_HAS_SIGNAL; + break; default: return -EINVAL; -- cgit v0.10.2 From 1af46b450fa49c57d73764d66f267335ccd807e2 Mon Sep 17 00:00:00 2001 From: Steven Toth Date: Thu, 16 Oct 2008 23:18:49 -0300 Subject: V4L/DVB (9311): s5h1411: bugfix: Setting serial or parallel mode could destroy bits Adding a serialmode function to read/and/or/write the register for safety. Signed-off-by: Steven Toth Signed-off-by: Mauro Carvalho Chehab diff --git a/drivers/media/dvb/frontends/s5h1411.c b/drivers/media/dvb/frontends/s5h1411.c index c79e23d..4cb0561 100644 --- a/drivers/media/dvb/frontends/s5h1411.c +++ b/drivers/media/dvb/frontends/s5h1411.c @@ -470,6 +470,20 @@ static int s5h1411_set_spectralinversion(struct dvb_frontend *fe, int inversion) return s5h1411_writereg(state, S5H1411_I2C_TOP_ADDR, 0x24, val); } +static int s5h1411_set_serialmode(struct dvb_frontend *fe, int serial) +{ + struct s5h1411_state *state = fe->demodulator_priv; + u16 val; + + dprintk("%s(%d)\n", __func__, serial); + val = s5h1411_readreg(state, S5H1411_I2C_TOP_ADDR, 0xbd) & ~0x100; + + if (serial == 1) + val |= 0x100; + + return s5h1411_writereg(state, S5H1411_I2C_TOP_ADDR, 0xbd, val); +} + static int s5h1411_enable_modulation(struct dvb_frontend *fe, fe_modulation_t m) { @@ -611,10 +625,10 @@ static int s5h1411_init(struct dvb_frontend *fe) if (state->config->output_mode == S5H1411_SERIAL_OUTPUT) /* Serial */ - s5h1411_writereg(state, S5H1411_I2C_TOP_ADDR, 0xbd, 0x1101); + s5h1411_set_serialmode(fe, 1); else /* Parallel */ - s5h1411_writereg(state, S5H1411_I2C_TOP_ADDR, 0xbd, 0x1001); + s5h1411_set_serialmode(fe, 0); s5h1411_set_spectralinversion(fe, state->config->inversion); s5h1411_set_if_freq(fe, state->config->vsb_if); -- cgit v0.10.2 From 5bd47311fe8965980469b45904fefd9afe6ca5b3 Mon Sep 17 00:00:00 2001 From: Steven Toth Date: Thu, 16 Oct 2008 23:26:05 -0300 Subject: V4L/DVB (9312): s5h1411: Remove meaningless code s5h1411: Remove meaningless code Signed-off-by: Steven Toth Signed-off-by: Mauro Carvalho Chehab diff --git a/drivers/media/dvb/frontends/s5h1411.c b/drivers/media/dvb/frontends/s5h1411.c index 4cb0561..e328d88 100644 --- a/drivers/media/dvb/frontends/s5h1411.c +++ b/drivers/media/dvb/frontends/s5h1411.c @@ -463,8 +463,6 @@ static int s5h1411_set_spectralinversion(struct dvb_frontend *fe, int inversion) if (inversion == 1) val |= 0x1000; /* Inverted */ - else - val |= 0x0000; state->inversion = inversion; return s5h1411_writereg(state, S5H1411_I2C_TOP_ADDR, 0x24, val); -- cgit v0.10.2 From 1874c443280d61bef1466a30c1e2819656d54eea Mon Sep 17 00:00:00 2001 From: Steven Toth Date: Sat, 18 Oct 2008 11:19:31 -0300 Subject: V4L/DVB (9313): s5h1411: Add the #define for an existing supporting I/F s5h1411: Add the #define for an existing supporting I/F Signed-off-by: Steven Toth Signed-off-by: Mauro Carvalho Chehab diff --git a/drivers/media/dvb/frontends/s5h1411.h b/drivers/media/dvb/frontends/s5h1411.h index 2370a06..45ec0f8 100644 --- a/drivers/media/dvb/frontends/s5h1411.h +++ b/drivers/media/dvb/frontends/s5h1411.h @@ -47,6 +47,7 @@ struct s5h1411_config { u16 mpeg_timing; /* IF Freq for QAM and VSB in KHz */ +#define S5H1411_IF_3250 3250 #define S5H1411_IF_3500 3500 #define S5H1411_IF_4000 4000 #define S5H1411_IF_5380 5380 -- cgit v0.10.2 From f0d041e50bc6c8a677922d72b010f80af9b23b18 Mon Sep 17 00:00:00 2001 From: Devin Heitmueller Date: Mon, 20 Oct 2008 10:17:08 -0300 Subject: V4L/DVB (9314): s5h1411: Perform s5h1411 soft reset after tuning If you instruct the tuner to change frequencies, it can take up to 2500ms to get a demod lock. By performing a soft reset after the tuning call (which is consistent with how the Pinnacle 801e Windows driver behaves), you get a demod lock inside of 300ms Signed-off-by: Devin Heitmueller Reviewed-by: Michael Krufky Acked-by: Steven Toth Signed-off-by: Mauro Carvalho Chehab diff --git a/drivers/media/dvb/frontends/s5h1411.c b/drivers/media/dvb/frontends/s5h1411.c index e328d88..40e0fed 100644 --- a/drivers/media/dvb/frontends/s5h1411.c +++ b/drivers/media/dvb/frontends/s5h1411.c @@ -585,9 +585,6 @@ static int s5h1411_set_frontend(struct dvb_frontend *fe, s5h1411_enable_modulation(fe, p->u.vsb.modulation); - /* Allow the demod to settle */ - msleep(100); - if (fe->ops.tuner_ops.set_params) { if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 1); @@ -598,6 +595,10 @@ static int s5h1411_set_frontend(struct dvb_frontend *fe, fe->ops.i2c_gate_ctrl(fe, 0); } + /* Issue a reset to the demod so it knows to resync against the + newly tuned frequency */ + s5h1411_softreset(fe); + return 0; } -- cgit v0.10.2 From 50eac6bc466f69e1ecb3a1b64346ed7b979547ac Mon Sep 17 00:00:00 2001 From: Devin Heitmueller Date: Mon, 20 Oct 2008 10:19:07 -0300 Subject: V4L/DVB (9315): s5h1411: Skip reconfiguring demod modulation if already at the desired modulation If we are already at the desired modulation, there is no need to reconfigure the demod (at a tuning time cost) Note that this change revealed that although the datasheet says the demod starts out in VSB-8 mode, the first tuning was failing consistently unless we went through the work of setting the registers. So add a field to denote this case so we always do the enable_frontend call, even if the first tuning request is for VSB-8. Signed-off-by: Devin Heitmueller Reviewed-by: Michael Krufky Acked-by: Steven Toth Signed-off-by: Mauro Carvalho Chehab diff --git a/drivers/media/dvb/frontends/s5h1411.c b/drivers/media/dvb/frontends/s5h1411.c index 40e0fed..b9ac6d3 100644 --- a/drivers/media/dvb/frontends/s5h1411.c +++ b/drivers/media/dvb/frontends/s5h1411.c @@ -38,6 +38,7 @@ struct s5h1411_state { struct dvb_frontend frontend; fe_modulation_t current_modulation; + unsigned int first_tune:1; u32 current_frequency; int if_freq; @@ -489,6 +490,12 @@ static int s5h1411_enable_modulation(struct dvb_frontend *fe, dprintk("%s(0x%08x)\n", __func__, m); + if ((state->first_tune == 0) && (m == state->current_modulation)) { + dprintk("%s() Already at desired modulation. Skipping...\n", + __func__); + return 0; + } + switch (m) { case VSB_8: dprintk("%s() VSB_8\n", __func__); @@ -513,6 +520,7 @@ static int s5h1411_enable_modulation(struct dvb_frontend *fe, } state->current_modulation = m; + state->first_tune = 0; s5h1411_softreset(fe); return 0; @@ -622,6 +630,11 @@ static int s5h1411_init(struct dvb_frontend *fe) /* The datasheet says that after initialisation, VSB is default */ state->current_modulation = VSB_8; + /* Although the datasheet says it's in VSB, empirical evidence + shows problems getting lock on the first tuning request. Make + sure we call enable_modulation the first time around */ + state->first_tune = 1; + if (state->config->output_mode == S5H1411_SERIAL_OUTPUT) /* Serial */ s5h1411_set_serialmode(fe, 1); -- cgit v0.10.2 From 11fc9a4a440112b5afc1a99d86ba92d70205a688 Mon Sep 17 00:00:00 2001 From: Devin Heitmueller Date: Mon, 20 Oct 2008 10:33:22 -0300 Subject: V4L/DVB (9316): s5h1411: Power down s5h1411 when not in use Power down the s5h1411 demodulator when not in use (on the Pinnacle 801e, this brings idle power from 123ma down to 84ma). Signed-off-by: Devin Heitmueller Acked-by: Steven Toth Signed-off-by: Mauro Carvalho Chehab diff --git a/drivers/media/dvb/frontends/s5h1411.c b/drivers/media/dvb/frontends/s5h1411.c index b9ac6d3..40644aa 100644 --- a/drivers/media/dvb/frontends/s5h1411.c +++ b/drivers/media/dvb/frontends/s5h1411.c @@ -554,7 +554,7 @@ static int s5h1411_set_gpio(struct dvb_frontend *fe, int enable) return s5h1411_writereg(state, S5H1411_I2C_TOP_ADDR, 0xe0, val); } -static int s5h1411_sleep(struct dvb_frontend *fe, int enable) +static int s5h1411_set_powerstate(struct dvb_frontend *fe, int enable) { struct s5h1411_state *state = fe->demodulator_priv; @@ -570,6 +570,11 @@ static int s5h1411_sleep(struct dvb_frontend *fe, int enable) return 0; } +static int s5h1411_sleep(struct dvb_frontend *fe) +{ + return s5h1411_set_powerstate(fe, 1); +} + static int s5h1411_register_reset(struct dvb_frontend *fe) { struct s5h1411_state *state = fe->demodulator_priv; @@ -619,7 +624,7 @@ static int s5h1411_init(struct dvb_frontend *fe) dprintk("%s()\n", __func__); - s5h1411_sleep(fe, 0); + s5h1411_set_powerstate(fe, 0); s5h1411_register_reset(fe); for (i = 0; i < ARRAY_SIZE(init_tab); i++) @@ -889,6 +894,7 @@ static struct dvb_frontend_ops s5h1411_ops = { }, .init = s5h1411_init, + .sleep = s5h1411_sleep, .i2c_gate_ctrl = s5h1411_i2c_gate_ctrl, .set_frontend = s5h1411_set_frontend, .get_frontend = s5h1411_get_frontend, -- cgit v0.10.2 From 96014a957c7a39392315ce117466549d69eb63b2 Mon Sep 17 00:00:00 2001 From: Sakari Ailus Date: Sat, 18 Oct 2008 12:23:45 -0300 Subject: V4L/DVB (9318): v4l2-int-if: Add command to get slave private data. vidioc_int_g_priv is used to get master's slave-related private data structure. The structure can contain for example master's configuration specific to slave. Signed-off-by: Sakari Ailus Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab diff --git a/include/media/v4l2-int-device.h b/include/media/v4l2-int-device.h index c8b80e0..d9a0053 100644 --- a/include/media/v4l2-int-device.h +++ b/include/media/v4l2-int-device.h @@ -184,6 +184,11 @@ enum v4l2_int_ioctl_num { vidioc_int_dev_exit_num, /* Set device power state: 0 is off, non-zero is on. */ vidioc_int_s_power_num, + /* + * Get slave private data, e.g. platform-specific slave + * configuration used by the master. + */ + vidioc_int_g_priv_num, /* Get slave interface parameters. */ vidioc_int_g_ifparm_num, /* Does the slave need to be reset after VIDIOC_DQBUF? */ @@ -267,6 +272,7 @@ V4L2_INT_WRAPPER_1(s_parm, struct v4l2_streamparm, *); V4L2_INT_WRAPPER_0(dev_init); V4L2_INT_WRAPPER_0(dev_exit); V4L2_INT_WRAPPER_1(s_power, int, ); +V4L2_INT_WRAPPER_1(g_priv, void, *); V4L2_INT_WRAPPER_1(g_ifparm, struct v4l2_ifparm, *); V4L2_INT_WRAPPER_1(g_needs_reset, void, *); -- cgit v0.10.2 From 621a3739f3b8c7427a789d3b2fe86a80ff234225 Mon Sep 17 00:00:00 2001 From: Sameer Venkatraman Date: Sat, 18 Oct 2008 12:25:28 -0300 Subject: V4L/DVB (9319): v4l2-int-if: Add cropcap, g_crop and s_crop commands. Signed-off-by: Sameer Venkatraman Signed-off-by: Mohit Jalori Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab diff --git a/include/media/v4l2-int-device.h b/include/media/v4l2-int-device.h index d9a0053..cee941c 100644 --- a/include/media/v4l2-int-device.h +++ b/include/media/v4l2-int-device.h @@ -170,6 +170,9 @@ enum v4l2_int_ioctl_num { vidioc_int_queryctrl_num, vidioc_int_g_ctrl_num, vidioc_int_s_ctrl_num, + vidioc_int_cropcap_num, + vidioc_int_g_crop_num, + vidioc_int_s_crop_num, vidioc_int_g_parm_num, vidioc_int_s_parm_num, @@ -266,6 +269,9 @@ V4L2_INT_WRAPPER_1(try_fmt_cap, struct v4l2_format, *); V4L2_INT_WRAPPER_1(queryctrl, struct v4l2_queryctrl, *); V4L2_INT_WRAPPER_1(g_ctrl, struct v4l2_control, *); V4L2_INT_WRAPPER_1(s_ctrl, struct v4l2_control, *); +V4L2_INT_WRAPPER_1(cropcap, struct v4l2_cropcap, *); +V4L2_INT_WRAPPER_1(g_crop, struct v4l2_crop, *); +V4L2_INT_WRAPPER_1(s_crop, struct v4l2_crop, *); V4L2_INT_WRAPPER_1(g_parm, struct v4l2_streamparm, *); V4L2_INT_WRAPPER_1(s_parm, struct v4l2_streamparm, *); -- cgit v0.10.2 From 733d710b09748a79f70cbb58547d036d28ec566e Mon Sep 17 00:00:00 2001 From: Sergio Aguirre Date: Sat, 18 Oct 2008 12:26:47 -0300 Subject: V4L/DVB (9320): v4l2: Add 10-bit RAW Bayer formats Add 10-bit raw bayer format expanded to 16 bits. Adds also definition for 10-bit raw bayer format dpcm-compressed to 8 bits. Signed-off-by: Sergio Aguirre Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h index d4b0303..4669d7e 100644 --- a/include/linux/videodev2.h +++ b/include/linux/videodev2.h @@ -315,6 +315,13 @@ struct v4l2_pix_format { /* see http://www.siliconimaging.com/RGB%20Bayer.htm */ #define V4L2_PIX_FMT_SBGGR8 v4l2_fourcc('B', 'A', '8', '1') /* 8 BGBG.. GRGR.. */ #define V4L2_PIX_FMT_SGBRG8 v4l2_fourcc('G', 'B', 'R', 'G') /* 8 GBGB.. RGRG.. */ +/* + * 10bit raw bayer, expanded to 16 bits + * xxxxrrrrrrrrrrxxxxgggggggggg xxxxggggggggggxxxxbbbbbbbbbb... + */ +#define V4L2_PIX_FMT_SGRBG10 v4l2_fourcc('B', 'A', '1', '0') +/* 10bit raw bayer DPCM compressed to 8 bits */ +#define V4L2_PIX_FMT_SGRBG10DPCM8 v4l2_fourcc('B', 'D', '1', '0') #define V4L2_PIX_FMT_SBGGR16 v4l2_fourcc('B', 'Y', 'R', '2') /* 16 BGBG.. GRGR.. */ /* compressed formats */ -- cgit v0.10.2 From 84389910d0f760cea22a5e58ee16b3b9713d456d Mon Sep 17 00:00:00 2001 From: Sakari Ailus Date: Sat, 18 Oct 2008 12:27:50 -0300 Subject: V4L/DVB (9321): v4l2-int-if: Define new power state changes Use enum v4l2_power instead of int as second argument to vidioc_int_s_power. The new functionality is that standby state is also recognised. Signed-off-by: Sakari Ailus Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab diff --git a/include/media/v4l2-int-device.h b/include/media/v4l2-int-device.h index cee941c..3351dcf 100644 --- a/include/media/v4l2-int-device.h +++ b/include/media/v4l2-int-device.h @@ -96,6 +96,12 @@ int v4l2_int_ioctl_1(struct v4l2_int_device *d, int cmd, void *arg); * */ +enum v4l2_power { + V4L2_POWER_OFF = 0, + V4L2_POWER_ON, + V4L2_POWER_STANDBY, +}; + /* Slave interface type. */ enum v4l2_if_type { /* @@ -185,7 +191,7 @@ enum v4l2_int_ioctl_num { vidioc_int_dev_init_num = 1000, /* Delinitialise the device at slave detach. */ vidioc_int_dev_exit_num, - /* Set device power state: 0 is off, non-zero is on. */ + /* Set device power state. */ vidioc_int_s_power_num, /* * Get slave private data, e.g. platform-specific slave @@ -277,7 +283,7 @@ V4L2_INT_WRAPPER_1(s_parm, struct v4l2_streamparm, *); V4L2_INT_WRAPPER_0(dev_init); V4L2_INT_WRAPPER_0(dev_exit); -V4L2_INT_WRAPPER_1(s_power, int, ); +V4L2_INT_WRAPPER_1(s_power, enum v4l2_power, ); V4L2_INT_WRAPPER_1(g_priv, void, *); V4L2_INT_WRAPPER_1(g_ifparm, struct v4l2_ifparm, *); V4L2_INT_WRAPPER_1(g_needs_reset, void, *); -- cgit v0.10.2 From 36499e525f6d2c0aba7c7f619d7a6081c56707ca Mon Sep 17 00:00:00 2001 From: Sakari Ailus Date: Sat, 18 Oct 2008 12:28:36 -0300 Subject: V4L/DVB (9322): v4l2-int-if: Export more interfaces to modules Export v4l2_int_device_try_attach_all. This allows initiating the initialisation of int if device after the drivers have been registered. Also allow drivers to call ioctls if v4l2-int-if was compiled as module. Signed-off-by: Sakari Ailus Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab diff --git a/drivers/media/video/v4l2-int-device.c b/drivers/media/video/v4l2-int-device.c index 0e45499..a935bae 100644 --- a/drivers/media/video/v4l2-int-device.c +++ b/drivers/media/video/v4l2-int-device.c @@ -32,7 +32,7 @@ static DEFINE_MUTEX(mutex); static LIST_HEAD(int_list); -static void v4l2_int_device_try_attach_all(void) +void v4l2_int_device_try_attach_all(void) { struct v4l2_int_device *m, *s; @@ -66,6 +66,7 @@ static void v4l2_int_device_try_attach_all(void) } } } +EXPORT_SYMBOL_GPL(v4l2_int_device_try_attach_all); static int ioctl_sort_cmp(const void *a, const void *b) { @@ -144,6 +145,7 @@ int v4l2_int_ioctl_0(struct v4l2_int_device *d, int cmd) find_ioctl(d->u.slave, cmd, (v4l2_int_ioctl_func *)no_such_ioctl_0))(d); } +EXPORT_SYMBOL_GPL(v4l2_int_ioctl_0); static int no_such_ioctl_1(struct v4l2_int_device *d, void *arg) { @@ -156,5 +158,6 @@ int v4l2_int_ioctl_1(struct v4l2_int_device *d, int cmd, void *arg) find_ioctl(d->u.slave, cmd, (v4l2_int_ioctl_func *)no_such_ioctl_1))(d, arg); } +EXPORT_SYMBOL_GPL(v4l2_int_ioctl_1); MODULE_LICENSE("GPL"); diff --git a/include/media/v4l2-int-device.h b/include/media/v4l2-int-device.h index 3351dcf..b5cee89 100644 --- a/include/media/v4l2-int-device.h +++ b/include/media/v4l2-int-device.h @@ -84,6 +84,8 @@ struct v4l2_int_device { void *priv; }; +void v4l2_int_device_try_attach_all(void); + int v4l2_int_device_register(struct v4l2_int_device *d); void v4l2_int_device_unregister(struct v4l2_int_device *d); -- cgit v0.10.2 From f496bc716613378f2a3f9097a8e3ea4e4e30e79d Mon Sep 17 00:00:00 2001 From: Sakari Ailus Date: Sat, 18 Oct 2008 12:29:15 -0300 Subject: V4L/DVB (9323): v4l2-int-if: Add enum_framesizes and enum_frameintervals ioctls. Signed-off-by: Sakari Ailus Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab diff --git a/include/media/v4l2-int-device.h b/include/media/v4l2-int-device.h index b5cee89..9c2df41 100644 --- a/include/media/v4l2-int-device.h +++ b/include/media/v4l2-int-device.h @@ -204,6 +204,8 @@ enum v4l2_int_ioctl_num { vidioc_int_g_ifparm_num, /* Does the slave need to be reset after VIDIOC_DQBUF? */ vidioc_int_g_needs_reset_num, + vidioc_int_enum_framesizes_num, + vidioc_int_enum_frameintervals_num, /* * @@ -289,6 +291,8 @@ V4L2_INT_WRAPPER_1(s_power, enum v4l2_power, ); V4L2_INT_WRAPPER_1(g_priv, void, *); V4L2_INT_WRAPPER_1(g_ifparm, struct v4l2_ifparm, *); V4L2_INT_WRAPPER_1(g_needs_reset, void, *); +V4L2_INT_WRAPPER_1(enum_framesizes, struct v4l2_frmsizeenum, *); +V4L2_INT_WRAPPER_1(enum_frameintervals, struct v4l2_frmivalenum, *); V4L2_INT_WRAPPER_0(reset); V4L2_INT_WRAPPER_0(init); -- cgit v0.10.2 From d5fbf32f381ad841d9d9537aa1b6f74796703361 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Sat, 18 Oct 2008 13:39:53 -0300 Subject: V4L/DVB (9324): v4l2: add video_ioctl2_unlocked for unlocked_ioctl support. Based on an older patch from Sakari Ailus. Cc: Sakari Ailus Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab diff --git a/drivers/media/video/v4l2-ioctl.c b/drivers/media/video/v4l2-ioctl.c index 155c9d7..0417844 100644 --- a/drivers/media/video/v4l2-ioctl.c +++ b/drivers/media/video/v4l2-ioctl.c @@ -630,8 +630,8 @@ static int __video_do_ioctl(struct inode *inode, struct file *file, { struct video_device *vfd = video_devdata(file); const struct v4l2_ioctl_ops *ops = vfd->ioctl_ops; - void *fh = file->private_data; - int ret = -EINVAL; + void *fh = file->private_data; + int ret = -EINVAL; if ((vfd->debug & V4L2_DEBUG_IOCTL) && !(vfd->debug & V4L2_DEBUG_IOCTL_ARG)) { @@ -1861,3 +1861,10 @@ out: return err; } EXPORT_SYMBOL(video_ioctl2); + +long video_ioctl2_unlocked(struct file *file, + unsigned int cmd, unsigned long arg) +{ + return video_ioctl2(file->f_path.dentry->d_inode, file, cmd, arg); +} +EXPORT_SYMBOL(video_ioctl2_unlocked); diff --git a/include/media/v4l2-ioctl.h b/include/media/v4l2-ioctl.h index 0bef03a..3e11dfe 100644 --- a/include/media/v4l2-ioctl.h +++ b/include/media/v4l2-ioctl.h @@ -285,7 +285,9 @@ extern long v4l_compat_ioctl32(struct file *file, unsigned int cmd, unsigned long arg); extern int video_ioctl2(struct inode *inode, struct file *file, - unsigned int cmd, unsigned long arg); + unsigned int cmd, unsigned long arg); +extern long video_ioctl2_unlocked(struct file *file, + unsigned int cmd, unsigned long arg); /* Include support for obsoleted stuff */ extern int video_usercopy(struct inode *inode, struct file *file, -- cgit v0.10.2 From 09882f0044b7cf6e506c82a5182ad768ebb660f2 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Sat, 18 Oct 2008 13:42:24 -0300 Subject: V4L/DVB (9325): ivtv: switch to unlocked_ioctl. Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab diff --git a/drivers/media/video/ivtv/ivtv-ioctl.c b/drivers/media/video/ivtv/ivtv-ioctl.c index 208fb54..09a75ab 100644 --- a/drivers/media/video/ivtv/ivtv-ioctl.c +++ b/drivers/media/video/ivtv/ivtv-ioctl.c @@ -1756,12 +1756,12 @@ static int ivtv_default(struct file *file, void *fh, int cmd, void *arg) return 0; } -static int ivtv_serialized_ioctl(struct ivtv *itv, struct inode *inode, struct file *filp, +static long ivtv_serialized_ioctl(struct ivtv *itv, struct file *filp, unsigned int cmd, unsigned long arg) { struct video_device *vfd = video_devdata(filp); struct ivtv_open_id *id = (struct ivtv_open_id *)filp->private_data; - int ret; + long ret; /* Filter dvb ioctls that cannot be handled by the v4l ioctl framework */ switch (cmd) { @@ -1830,20 +1830,19 @@ static int ivtv_serialized_ioctl(struct ivtv *itv, struct inode *inode, struct f if (ivtv_debug & IVTV_DBGFLG_IOCTL) vfd->debug = V4L2_DEBUG_IOCTL | V4L2_DEBUG_IOCTL_ARG; - ret = video_ioctl2(inode, filp, cmd, arg); + ret = video_ioctl2_unlocked(filp, cmd, arg); vfd->debug = 0; return ret; } -int ivtv_v4l2_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) +long ivtv_v4l2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) { struct ivtv_open_id *id = (struct ivtv_open_id *)filp->private_data; struct ivtv *itv = id->itv; - int res; + long res; mutex_lock(&itv->serialize_lock); - res = ivtv_serialized_ioctl(itv, inode, filp, cmd, arg); + res = ivtv_serialized_ioctl(itv, filp, cmd, arg); mutex_unlock(&itv->serialize_lock); return res; } diff --git a/drivers/media/video/ivtv/ivtv-ioctl.h b/drivers/media/video/ivtv/ivtv-ioctl.h index 7018858..58f0034 100644 --- a/drivers/media/video/ivtv/ivtv-ioctl.h +++ b/drivers/media/video/ivtv/ivtv-ioctl.h @@ -30,7 +30,6 @@ void ivtv_set_funcs(struct video_device *vdev); int ivtv_s_std(struct file *file, void *fh, v4l2_std_id *std); int ivtv_s_frequency(struct file *file, void *fh, struct v4l2_frequency *vf); int ivtv_s_input(struct file *file, void *fh, unsigned int inp); -int ivtv_v4l2_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg); +long ivtv_v4l2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg); #endif diff --git a/drivers/media/video/ivtv/ivtv-streams.c b/drivers/media/video/ivtv/ivtv-streams.c index 5bbf31e..9b7aa79 100644 --- a/drivers/media/video/ivtv/ivtv-streams.c +++ b/drivers/media/video/ivtv/ivtv-streams.c @@ -48,7 +48,7 @@ static const struct file_operations ivtv_v4l2_enc_fops = { .read = ivtv_v4l2_read, .write = ivtv_v4l2_write, .open = ivtv_v4l2_open, - .ioctl = ivtv_v4l2_ioctl, + .unlocked_ioctl = ivtv_v4l2_ioctl, .compat_ioctl = v4l_compat_ioctl32, .release = ivtv_v4l2_close, .poll = ivtv_v4l2_enc_poll, @@ -59,7 +59,7 @@ static const struct file_operations ivtv_v4l2_dec_fops = { .read = ivtv_v4l2_read, .write = ivtv_v4l2_write, .open = ivtv_v4l2_open, - .ioctl = ivtv_v4l2_ioctl, + .unlocked_ioctl = ivtv_v4l2_ioctl, .compat_ioctl = v4l_compat_ioctl32, .release = ivtv_v4l2_close, .poll = ivtv_v4l2_dec_poll, -- cgit v0.10.2 From 323a491a29d0bb1e91263ca347cb42c4de28adfc Mon Sep 17 00:00:00 2001 From: Martin Dauskardt Date: Sat, 18 Oct 2008 14:59:09 -0300 Subject: V4L/DVB (9326): ivtv: avoid green flashing when loading ivtv When loading ivtv the TV-out of the PVR-350 will flash green since the saa712x is activated before the MPEG decoder has been initialized. Deactivate the saa712x until the MPEG decoder has been initialized. Signed-off-by: Martin Dauskardt Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab diff --git a/drivers/media/video/ivtv/ivtv-driver.c b/drivers/media/video/ivtv/ivtv-driver.c index aeaa13f..d364850 100644 --- a/drivers/media/video/ivtv/ivtv-driver.c +++ b/drivers/media/video/ivtv/ivtv-driver.c @@ -1211,6 +1211,10 @@ static int __devinit ivtv_probe(struct pci_dev *dev, if (itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT) { ivtv_call_i2c_clients(itv, VIDIOC_INT_S_STD_OUTPUT, &itv->std); + /* Turn off the output signal. The mpeg decoder is not yet + active so without this you would get a green image until the + mpeg decoder becomes active. */ + ivtv_saa7127(itv, VIDIOC_STREAMOFF, NULL); } /* clear interrupt mask, effectively disabling interrupts */ @@ -1330,6 +1334,10 @@ int ivtv_init_on_first_open(struct ivtv *itv) ivtv_s_frequency(NULL, &fh, &vf); if (itv->card->v4l2_capabilities & V4L2_CAP_VIDEO_OUTPUT) { + /* Turn on the TV-out: ivtv_init_mpeg_decoder() initializes + the mpeg decoder so now the saa7127 receives a proper + signal. */ + ivtv_saa7127(itv, VIDIOC_STREAMON, NULL); ivtv_init_mpeg_decoder(itv); } ivtv_s_std(NULL, &fh, &itv->tuner_std); @@ -1366,6 +1374,10 @@ static void ivtv_remove(struct pci_dev *pci_dev) /* Stop all decoding */ IVTV_DEBUG_INFO("Stopping decoding\n"); + + /* Turn off the TV-out */ + if (itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT) + ivtv_saa7127(itv, VIDIOC_STREAMOFF, NULL); if (atomic_read(&itv->decoding) > 0) { int type; -- cgit v0.10.2 From c6330fb86fd0fed98b7e0d5792881a77b778fefc Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Sun, 19 Oct 2008 18:54:26 -0300 Subject: V4L/DVB (9327): v4l: use video_device.num instead of minor in video%d The kernel number of a v4l2 node (e.g. videoX, radioX or vbiX) is now independent of the minor number. So instead of using the minor field of the video_device struct one has to use the num field: this always contains the kernel number of the device node. I forgot about this when I did the v4l2 core change, so this patch converts all drivers that use it in one go. Luckily the change is trivial. Cc: michael@mihu.de Cc: mchehab@infradead.org Cc: corbet@lwn.net Cc: luca.risolia@studio.unibo.it Cc: isely@pobox.com Cc: pe1rxq@amsat.org Cc: royale@zerezo.com Cc: mkrufky@linuxtv.org Cc: stoth@linuxtv.org Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab diff --git a/drivers/media/common/saa7146_fops.c b/drivers/media/common/saa7146_fops.c index 5b34c13..127b052 100644 --- a/drivers/media/common/saa7146_fops.c +++ b/drivers/media/common/saa7146_fops.c @@ -545,11 +545,11 @@ int saa7146_register_device(struct video_device **vid, struct saa7146_dev* dev, if( VFL_TYPE_GRABBER == type ) { vv->video_minor = vfd->minor; INFO(("%s: registered device video%d [v4l2]\n", - dev->name, vfd->minor & 0x1f)); + dev->name, vfd->num)); } else { vv->vbi_minor = vfd->minor; INFO(("%s: registered device vbi%d [v4l2]\n", - dev->name, vfd->minor & 0x1f)); + dev->name, vfd->num)); } *vid = vfd; diff --git a/drivers/media/video/arv.c b/drivers/media/video/arv.c index 218754b..e09b006 100644 --- a/drivers/media/video/arv.c +++ b/drivers/media/video/arv.c @@ -866,7 +866,7 @@ static int __init ar_init(void) } printk("video%d: Found M64278 VGA (IRQ %d, Freq %dMHz).\n", - ar->vdev->minor, M32R_IRQ_INT3, freq); + ar->vdev->num, M32R_IRQ_INT3, freq); return 0; diff --git a/drivers/media/video/bt8xx/bttv-driver.c b/drivers/media/video/bt8xx/bttv-driver.c index 5858bf5..9ec4cec 100644 --- a/drivers/media/video/bt8xx/bttv-driver.c +++ b/drivers/media/video/bt8xx/bttv-driver.c @@ -4246,7 +4246,7 @@ static int __devinit bttv_register_video(struct bttv *btv) video_nr[btv->c.nr]) < 0) goto err; printk(KERN_INFO "bttv%d: registered device video%d\n", - btv->c.nr,btv->video_dev->minor & 0x1f); + btv->c.nr, btv->video_dev->num); if (device_create_file(&btv->video_dev->dev, &dev_attr_card)<0) { printk(KERN_ERR "bttv%d: device_create_file 'card' " @@ -4263,7 +4263,7 @@ static int __devinit bttv_register_video(struct bttv *btv) vbi_nr[btv->c.nr]) < 0) goto err; printk(KERN_INFO "bttv%d: registered device vbi%d\n", - btv->c.nr,btv->vbi_dev->minor & 0x1f); + btv->c.nr, btv->vbi_dev->num); if (!btv->has_radio) return 0; @@ -4275,7 +4275,7 @@ static int __devinit bttv_register_video(struct bttv *btv) radio_nr[btv->c.nr]) < 0) goto err; printk(KERN_INFO "bttv%d: registered device radio%d\n", - btv->c.nr,btv->radio_dev->minor & 0x1f); + btv->c.nr, btv->radio_dev->num); /* all done */ return 0; diff --git a/drivers/media/video/c-qcam.c b/drivers/media/video/c-qcam.c index 17aa0ad..0f930d3 100644 --- a/drivers/media/video/c-qcam.c +++ b/drivers/media/video/c-qcam.c @@ -815,7 +815,7 @@ static int init_cqcam(struct parport *port) } printk(KERN_INFO "video%d: Colour QuickCam found on %s\n", - qcam->vdev.minor, qcam->pport->name); + qcam->vdev.num, qcam->pport->name); qcams[num_cams++] = qcam; diff --git a/drivers/media/video/cafe_ccic.c b/drivers/media/video/cafe_ccic.c index fc9497b..a8c068e 100644 --- a/drivers/media/video/cafe_ccic.c +++ b/drivers/media/video/cafe_ccic.c @@ -2059,10 +2059,10 @@ static void cafe_dfs_cam_setup(struct cafe_camera *cam) if (!cafe_dfs_root) return; - sprintf(fname, "regs-%d", cam->v4ldev.minor); + sprintf(fname, "regs-%d", cam->v4ldev.num); cam->dfs_regs = debugfs_create_file(fname, 0444, cafe_dfs_root, cam, &cafe_dfs_reg_ops); - sprintf(fname, "cam-%d", cam->v4ldev.minor); + sprintf(fname, "cam-%d", cam->v4ldev.num); cam->dfs_cam_regs = debugfs_create_file(fname, 0444, cafe_dfs_root, cam, &cafe_dfs_cam_ops); } diff --git a/drivers/media/video/cpia.c b/drivers/media/video/cpia.c index 1798b77..16c094f 100644 --- a/drivers/media/video/cpia.c +++ b/drivers/media/video/cpia.c @@ -1347,7 +1347,7 @@ static void create_proc_cpia_cam(struct cam_data *cam) if (!cpia_proc_root || !cam) return; - snprintf(name, sizeof(name), "video%d", cam->vdev.minor); + snprintf(name, sizeof(name), "video%d", cam->vdev.num); ent = create_proc_entry(name, S_IFREG|S_IRUGO|S_IWUSR, cpia_proc_root); if (!ent) @@ -1372,7 +1372,7 @@ static void destroy_proc_cpia_cam(struct cam_data *cam) if (!cam || !cam->proc_entry) return; - snprintf(name, sizeof(name), "video%d", cam->vdev.minor); + snprintf(name, sizeof(name), "video%d", cam->vdev.num); remove_proc_entry(name, cpia_proc_root); cam->proc_entry = NULL; } @@ -4005,7 +4005,7 @@ void cpia_unregister_camera(struct cam_data *cam) } #ifdef CONFIG_PROC_FS - DBG("destroying /proc/cpia/video%d\n", cam->vdev.minor); + DBG("destroying /proc/cpia/video%d\n", cam->vdev.num); destroy_proc_cpia_cam(cam); #endif if (!cam->open_count) { diff --git a/drivers/media/video/cpia2/cpia2_v4l.c b/drivers/media/video/cpia2/cpia2_v4l.c index 897e8d1..1c6bd63 100644 --- a/drivers/media/video/cpia2/cpia2_v4l.c +++ b/drivers/media/video/cpia2/cpia2_v4l.c @@ -1973,7 +1973,7 @@ void cpia2_unregister_camera(struct camera_data *cam) } else { LOG("/dev/video%d removed while open, " "deferring video_unregister_device\n", - cam->vdev->minor); + cam->vdev->num); } } diff --git a/drivers/media/video/cx23885/cx23885-417.c b/drivers/media/video/cx23885/cx23885-417.c index 395c11f..00831f3 100644 --- a/drivers/media/video/cx23885/cx23885-417.c +++ b/drivers/media/video/cx23885/cx23885-417.c @@ -1815,7 +1815,7 @@ int cx23885_417_register(struct cx23885_dev *dev) cx23885_mc417_init(dev); printk(KERN_INFO "%s: registered device video%d [mpeg]\n", - dev->name, dev->v4l_device->minor & 0x1f); + dev->name, dev->v4l_device->num); return 0; } diff --git a/drivers/media/video/cx23885/cx23885-video.c b/drivers/media/video/cx23885/cx23885-video.c index ab3110d..c742a10 100644 --- a/drivers/media/video/cx23885/cx23885-video.c +++ b/drivers/media/video/cx23885/cx23885-video.c @@ -1543,7 +1543,7 @@ int cx23885_video_register(struct cx23885_dev *dev) goto fail_unreg; } printk(KERN_INFO "%s/0: registered device video%d [v4l2]\n", - dev->name, dev->video_dev->minor & 0x1f); + dev->name, dev->video_dev->num); /* initial device configuration */ mutex_lock(&dev->lock); cx23885_set_tvnorm(dev, dev->tvnorm); diff --git a/drivers/media/video/cx88/cx88-blackbird.c b/drivers/media/video/cx88/cx88-blackbird.c index e713697..078be63 100644 --- a/drivers/media/video/cx88/cx88-blackbird.c +++ b/drivers/media/video/cx88/cx88-blackbird.c @@ -1285,7 +1285,7 @@ static int blackbird_register_video(struct cx8802_dev *dev) return err; } printk(KERN_INFO "%s/2: registered device video%d [mpeg]\n", - dev->core->name,dev->mpeg_dev->minor & 0x1f); + dev->core->name, dev->mpeg_dev->num); return 0; } diff --git a/drivers/media/video/cx88/cx88-video.c b/drivers/media/video/cx88/cx88-video.c index 3904b73..61265fd 100644 --- a/drivers/media/video/cx88/cx88-video.c +++ b/drivers/media/video/cx88/cx88-video.c @@ -1911,7 +1911,7 @@ static int __devinit cx8800_initdev(struct pci_dev *pci_dev, goto fail_unreg; } printk(KERN_INFO "%s/0: registered device video%d [v4l2]\n", - core->name,dev->video_dev->minor & 0x1f); + core->name, dev->video_dev->num); dev->vbi_dev = cx88_vdev_init(core,dev->pci,&cx8800_vbi_template,"vbi"); err = video_register_device(dev->vbi_dev,VFL_TYPE_VBI, @@ -1922,7 +1922,7 @@ static int __devinit cx8800_initdev(struct pci_dev *pci_dev, goto fail_unreg; } printk(KERN_INFO "%s/0: registered device vbi%d\n", - core->name,dev->vbi_dev->minor & 0x1f); + core->name, dev->vbi_dev->num); if (core->board.radio.type == CX88_RADIO) { dev->radio_dev = cx88_vdev_init(core,dev->pci, @@ -1935,7 +1935,7 @@ static int __devinit cx8800_initdev(struct pci_dev *pci_dev, goto fail_unreg; } printk(KERN_INFO "%s/0: registered device radio%d\n", - core->name,dev->radio_dev->minor & 0x1f); + core->name, dev->radio_dev->num); } /* everything worked */ diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c index c53649e..a1ab2ef 100644 --- a/drivers/media/video/em28xx/em28xx-video.c +++ b/drivers/media/video/em28xx/em28xx-video.c @@ -2042,7 +2042,7 @@ static int em28xx_init_dev(struct em28xx **devhandle, struct usb_device *udev, goto fail_unreg; } em28xx_info("Registered radio device as /dev/radio%d\n", - dev->radio_dev->minor & 0x1f); + dev->radio_dev->num); } /* init video dma queues */ diff --git a/drivers/media/video/et61x251/et61x251_core.c b/drivers/media/video/et61x251/et61x251_core.c index 7a85c41..9d0ef96 100644 --- a/drivers/media/video/et61x251/et61x251_core.c +++ b/drivers/media/video/et61x251/et61x251_core.c @@ -588,7 +588,7 @@ static int et61x251_stream_interrupt(struct et61x251_device* cam) cam->state |= DEV_MISCONFIGURED; DBG(1, "URB timeout reached. The camera is misconfigured. To " "use it, close and open /dev/video%d again.", - cam->v4ldev->minor); + cam->v4ldev->num); return -EIO; } @@ -1195,7 +1195,7 @@ static void et61x251_release_resources(struct kref *kref) cam = container_of(kref, struct et61x251_device, kref); - DBG(2, "V4L2 device /dev/video%d deregistered", cam->v4ldev->minor); + DBG(2, "V4L2 device /dev/video%d deregistered", cam->v4ldev->num); video_set_drvdata(cam->v4ldev, NULL); video_unregister_device(cam->v4ldev); usb_put_dev(cam->usbdev); @@ -1237,7 +1237,7 @@ static int et61x251_open(struct inode* inode, struct file* filp) if (cam->users) { DBG(2, "Device /dev/video%d is already in use", - cam->v4ldev->minor); + cam->v4ldev->num); DBG(3, "Simultaneous opens are not supported"); if ((filp->f_flags & O_NONBLOCK) || (filp->f_flags & O_NDELAY)) { @@ -1280,7 +1280,7 @@ static int et61x251_open(struct inode* inode, struct file* filp) cam->frame_count = 0; et61x251_empty_framequeues(cam); - DBG(3, "Video device /dev/video%d is open", cam->v4ldev->minor); + DBG(3, "Video device /dev/video%d is open", cam->v4ldev->num); out: mutex_unlock(&cam->open_mutex); @@ -1304,7 +1304,7 @@ static int et61x251_release(struct inode* inode, struct file* filp) cam->users--; wake_up_interruptible_nr(&cam->wait_open, 1); - DBG(3, "Video device /dev/video%d closed", cam->v4ldev->minor); + DBG(3, "Video device /dev/video%d closed", cam->v4ldev->num); kref_put(&cam->kref, et61x251_release_resources); @@ -1845,7 +1845,7 @@ et61x251_vidioc_s_crop(struct et61x251_device* cam, void __user * arg) cam->state |= DEV_MISCONFIGURED; DBG(1, "VIDIOC_S_CROP failed because of hardware problems. To " "use the camera, close and open /dev/video%d again.", - cam->v4ldev->minor); + cam->v4ldev->num); return -EIO; } @@ -1858,7 +1858,7 @@ et61x251_vidioc_s_crop(struct et61x251_device* cam, void __user * arg) cam->state |= DEV_MISCONFIGURED; DBG(1, "VIDIOC_S_CROP failed because of not enough memory. To " "use the camera, close and open /dev/video%d again.", - cam->v4ldev->minor); + cam->v4ldev->num); return -ENOMEM; } @@ -2068,7 +2068,7 @@ et61x251_vidioc_try_s_fmt(struct et61x251_device* cam, unsigned int cmd, cam->state |= DEV_MISCONFIGURED; DBG(1, "VIDIOC_S_FMT failed because of hardware problems. To " "use the camera, close and open /dev/video%d again.", - cam->v4ldev->minor); + cam->v4ldev->num); return -EIO; } @@ -2080,7 +2080,7 @@ et61x251_vidioc_try_s_fmt(struct et61x251_device* cam, unsigned int cmd, cam->state |= DEV_MISCONFIGURED; DBG(1, "VIDIOC_S_FMT failed because of not enough memory. To " "use the camera, close and open /dev/video%d again.", - cam->v4ldev->minor); + cam->v4ldev->num); return -ENOMEM; } @@ -2128,7 +2128,7 @@ et61x251_vidioc_s_jpegcomp(struct et61x251_device* cam, void __user * arg) cam->state |= DEV_MISCONFIGURED; DBG(1, "VIDIOC_S_JPEGCOMP failed because of hardware " "problems. To use the camera, close and open " - "/dev/video%d again.", cam->v4ldev->minor); + "/dev/video%d again.", cam->v4ldev->num); return -EIO; } @@ -2605,7 +2605,7 @@ et61x251_usb_probe(struct usb_interface* intf, const struct usb_device_id* id) goto fail; } - DBG(2, "V4L2 device registered as /dev/video%d", cam->v4ldev->minor); + DBG(2, "V4L2 device registered as /dev/video%d", cam->v4ldev->num); cam->module_param.force_munmap = force_munmap[dev_nr]; cam->module_param.frame_timeout = frame_timeout[dev_nr]; @@ -2658,7 +2658,7 @@ static void et61x251_usb_disconnect(struct usb_interface* intf) if (cam->users) { DBG(2, "Device /dev/video%d is open! Deregistration and " "memory deallocation are deferred.", - cam->v4ldev->minor); + cam->v4ldev->num); cam->state |= DEV_MISCONFIGURED; et61x251_stop_transfer(cam); cam->state |= DEV_DISCONNECTED; diff --git a/drivers/media/video/pvrusb2/pvrusb2-v4l2.c b/drivers/media/video/pvrusb2/pvrusb2-v4l2.c index f048d80..43ef7ba 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-v4l2.c +++ b/drivers/media/video/pvrusb2/pvrusb2-v4l2.c @@ -893,7 +893,7 @@ static int pvr2_v4l2_do_ioctl(struct inode *inode, struct file *file, static void pvr2_v4l2_dev_destroy(struct pvr2_v4l2_dev *dip) { - int minor_id = dip->devbase.minor; + int num = dip->devbase.num; struct pvr2_hdw *hdw = dip->v4lp->channel.mc_head->hdw; enum pvr2_config cfg = dip->config; int v4l_type = dip->v4l_type; @@ -909,7 +909,7 @@ static void pvr2_v4l2_dev_destroy(struct pvr2_v4l2_dev *dip) video_unregister_device(&dip->devbase); printk(KERN_INFO "pvrusb2: unregistered device %s%u [%s]\n", - get_v4l_name(v4l_type),minor_id & 0x1f, + get_v4l_name(v4l_type), num, pvr2_config_get_name(cfg)); } @@ -1310,7 +1310,7 @@ static void pvr2_v4l2_dev_init(struct pvr2_v4l2_dev *dip, } printk(KERN_INFO "pvrusb2: registered device %s%u [%s]\n", - get_v4l_name(dip->v4l_type),dip->devbase.minor & 0x1f, + get_v4l_name(dip->v4l_type), dip->devbase.num, pvr2_config_get_name(dip->config)); pvr2_hdw_v4l_store_minor_number(vp->channel.mc_head->hdw, diff --git a/drivers/media/video/pwc/pwc-if.c b/drivers/media/video/pwc/pwc-if.c index ab28389..f3897a3 100644 --- a/drivers/media/video/pwc/pwc-if.c +++ b/drivers/media/video/pwc/pwc-if.c @@ -1795,7 +1795,7 @@ static int usb_pwc_probe(struct usb_interface *intf, const struct usb_device_id goto err; } else { - PWC_INFO("Registered as /dev/video%d.\n", pdev->vdev->minor & 0x3F); + PWC_INFO("Registered as /dev/video%d.\n", pdev->vdev->num); } /* occupy slot */ diff --git a/drivers/media/video/saa7134/saa7134-core.c b/drivers/media/video/saa7134/saa7134-core.c index b686bfa..2491844 100644 --- a/drivers/media/video/saa7134/saa7134-core.c +++ b/drivers/media/video/saa7134/saa7134-core.c @@ -996,7 +996,7 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev, goto fail4; } printk(KERN_INFO "%s: registered device video%d [v4l2]\n", - dev->name,dev->video_dev->minor & 0x1f); + dev->name, dev->video_dev->num); dev->vbi_dev = vdev_init(dev, &saa7134_video_template, "vbi"); @@ -1005,7 +1005,7 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev, if (err < 0) goto fail4; printk(KERN_INFO "%s: registered device vbi%d\n", - dev->name,dev->vbi_dev->minor & 0x1f); + dev->name, dev->vbi_dev->num); if (card_has_radio(dev)) { dev->radio_dev = vdev_init(dev,&saa7134_radio_template,"radio"); @@ -1014,7 +1014,7 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev, if (err < 0) goto fail4; printk(KERN_INFO "%s: registered device radio%d\n", - dev->name,dev->radio_dev->minor & 0x1f); + dev->name, dev->radio_dev->num); } /* everything worked */ diff --git a/drivers/media/video/saa7134/saa7134-empress.c b/drivers/media/video/saa7134/saa7134-empress.c index 9a8766a..7f40511 100644 --- a/drivers/media/video/saa7134/saa7134-empress.c +++ b/drivers/media/video/saa7134/saa7134-empress.c @@ -534,7 +534,7 @@ static int empress_init(struct saa7134_dev *dev) return err; } printk(KERN_INFO "%s: registered device video%d [mpeg]\n", - dev->name,dev->empress_dev->minor & 0x1f); + dev->name, dev->empress_dev->num); videobuf_queue_sg_init(&dev->empress_tsq, &saa7134_ts_qops, &dev->pci->dev, &dev->slock, diff --git a/drivers/media/video/se401.c b/drivers/media/video/se401.c index ae39491..044a2e9 100644 --- a/drivers/media/video/se401.c +++ b/drivers/media/video/se401.c @@ -1412,7 +1412,7 @@ static int se401_probe(struct usb_interface *intf, return -EIO; } dev_info(&intf->dev, "registered new video device: video%d\n", - se401->vdev.minor); + se401->vdev.num); usb_set_intfdata (intf, se401); return 0; diff --git a/drivers/media/video/sn9c102/sn9c102_core.c b/drivers/media/video/sn9c102/sn9c102_core.c index 20e30bd..fcd2b62 100644 --- a/drivers/media/video/sn9c102/sn9c102_core.c +++ b/drivers/media/video/sn9c102/sn9c102_core.c @@ -1008,7 +1008,7 @@ static int sn9c102_stream_interrupt(struct sn9c102_device* cam) cam->state |= DEV_MISCONFIGURED; DBG(1, "URB timeout reached. The camera is misconfigured. " "To use it, close and open /dev/video%d again.", - cam->v4ldev->minor); + cam->v4ldev->num); return -EIO; } @@ -1734,7 +1734,7 @@ static void sn9c102_release_resources(struct kref *kref) cam = container_of(kref, struct sn9c102_device, kref); - DBG(2, "V4L2 device /dev/video%d deregistered", cam->v4ldev->minor); + DBG(2, "V4L2 device /dev/video%d deregistered", cam->v4ldev->num); video_set_drvdata(cam->v4ldev, NULL); video_unregister_device(cam->v4ldev); usb_put_dev(cam->usbdev); @@ -1792,7 +1792,7 @@ static int sn9c102_open(struct inode* inode, struct file* filp) if (cam->users) { DBG(2, "Device /dev/video%d is already in use", - cam->v4ldev->minor); + cam->v4ldev->num); DBG(3, "Simultaneous opens are not supported"); /* open() must follow the open flags and should block @@ -1845,7 +1845,7 @@ static int sn9c102_open(struct inode* inode, struct file* filp) cam->frame_count = 0; sn9c102_empty_framequeues(cam); - DBG(3, "Video device /dev/video%d is open", cam->v4ldev->minor); + DBG(3, "Video device /dev/video%d is open", cam->v4ldev->num); out: mutex_unlock(&cam->open_mutex); @@ -1870,7 +1870,7 @@ static int sn9c102_release(struct inode* inode, struct file* filp) cam->users--; wake_up_interruptible_nr(&cam->wait_open, 1); - DBG(3, "Video device /dev/video%d closed", cam->v4ldev->minor); + DBG(3, "Video device /dev/video%d closed", cam->v4ldev->num); kref_put(&cam->kref, sn9c102_release_resources); @@ -2432,7 +2432,7 @@ sn9c102_vidioc_s_crop(struct sn9c102_device* cam, void __user * arg) cam->state |= DEV_MISCONFIGURED; DBG(1, "VIDIOC_S_CROP failed because of hardware problems. To " "use the camera, close and open /dev/video%d again.", - cam->v4ldev->minor); + cam->v4ldev->num); return -EIO; } @@ -2445,7 +2445,7 @@ sn9c102_vidioc_s_crop(struct sn9c102_device* cam, void __user * arg) cam->state |= DEV_MISCONFIGURED; DBG(1, "VIDIOC_S_CROP failed because of not enough memory. To " "use the camera, close and open /dev/video%d again.", - cam->v4ldev->minor); + cam->v4ldev->num); return -ENOMEM; } @@ -2689,7 +2689,7 @@ sn9c102_vidioc_try_s_fmt(struct sn9c102_device* cam, unsigned int cmd, cam->state |= DEV_MISCONFIGURED; DBG(1, "VIDIOC_S_FMT failed because of hardware problems. To " "use the camera, close and open /dev/video%d again.", - cam->v4ldev->minor); + cam->v4ldev->num); return -EIO; } @@ -2701,7 +2701,7 @@ sn9c102_vidioc_try_s_fmt(struct sn9c102_device* cam, unsigned int cmd, cam->state |= DEV_MISCONFIGURED; DBG(1, "VIDIOC_S_FMT failed because of not enough memory. To " "use the camera, close and open /dev/video%d again.", - cam->v4ldev->minor); + cam->v4ldev->num); return -ENOMEM; } @@ -2748,7 +2748,7 @@ sn9c102_vidioc_s_jpegcomp(struct sn9c102_device* cam, void __user * arg) cam->state |= DEV_MISCONFIGURED; DBG(1, "VIDIOC_S_JPEGCOMP failed because of hardware " "problems. To use the camera, close and open " - "/dev/video%d again.", cam->v4ldev->minor); + "/dev/video%d again.", cam->v4ldev->num); return -EIO; } @@ -3348,7 +3348,7 @@ sn9c102_usb_probe(struct usb_interface* intf, const struct usb_device_id* id) goto fail; } - DBG(2, "V4L2 device registered as /dev/video%d", cam->v4ldev->minor); + DBG(2, "V4L2 device registered as /dev/video%d", cam->v4ldev->num); video_set_drvdata(cam->v4ldev, cam); cam->module_param.force_munmap = force_munmap[dev_nr]; @@ -3402,7 +3402,7 @@ static void sn9c102_usb_disconnect(struct usb_interface* intf) if (cam->users) { DBG(2, "Device /dev/video%d is open! Deregistration and " "memory deallocation are deferred.", - cam->v4ldev->minor); + cam->v4ldev->num); cam->state |= DEV_MISCONFIGURED; sn9c102_stop_transfer(cam); cam->state |= DEV_DISCONNECTED; diff --git a/drivers/media/video/stk-webcam.c b/drivers/media/video/stk-webcam.c index edaea49..e9eb6d7 100644 --- a/drivers/media/video/stk-webcam.c +++ b/drivers/media/video/stk-webcam.c @@ -1331,7 +1331,7 @@ static int stk_register_video_device(struct stk_camera *dev) STK_ERROR("v4l registration failed\n"); else STK_INFO("Syntek USB2.0 Camera is now controlling video device" - " /dev/video%d\n", dev->vdev.minor); + " /dev/video%d\n", dev->vdev.num); return err; } @@ -1426,7 +1426,7 @@ static void stk_camera_disconnect(struct usb_interface *interface) stk_remove_sysfs_files(&dev->vdev); STK_INFO("Syntek USB2.0 Camera release resources " - "video device /dev/video%d\n", dev->vdev.minor); + "video device /dev/video%d\n", dev->vdev.num); video_unregister_device(&dev->vdev); } diff --git a/drivers/media/video/stv680.c b/drivers/media/video/stv680.c index 9c549d9..328c41b 100644 --- a/drivers/media/video/stv680.c +++ b/drivers/media/video/stv680.c @@ -1470,7 +1470,8 @@ static int stv680_probe (struct usb_interface *intf, const struct usb_device_id retval = -EIO; goto error_vdev; } - PDEBUG (0, "STV(i): registered new video device: video%d", stv680->vdev->minor); + PDEBUG(0, "STV(i): registered new video device: video%d", + stv680->vdev->num); usb_set_intfdata (intf, stv680); retval = stv680_create_sysfs_files(stv680->vdev); diff --git a/drivers/media/video/usbvideo/usbvideo.c b/drivers/media/video/usbvideo/usbvideo.c index 07cd87d..7c575bb 100644 --- a/drivers/media/video/usbvideo/usbvideo.c +++ b/drivers/media/video/usbvideo/usbvideo.c @@ -1059,7 +1059,7 @@ int usbvideo_RegisterVideoDevice(struct uvd *uvd) dev_info(&uvd->dev->dev, "%s on /dev/video%d: canvas=%s videosize=%s\n", (uvd->handle != NULL) ? uvd->handle->drvName : "???", - uvd->vdev.minor, tmp2, tmp1); + uvd->vdev.num, tmp2, tmp1); usb_get_dev(uvd->dev); return 0; diff --git a/drivers/media/video/usbvideo/vicam.c b/drivers/media/video/usbvideo/vicam.c index 7a127d6..8e2d58b 100644 --- a/drivers/media/video/usbvideo/vicam.c +++ b/drivers/media/video/usbvideo/vicam.c @@ -877,7 +877,8 @@ vicam_probe( struct usb_interface *intf, const struct usb_device_id *id) return -EIO; } - printk(KERN_INFO "ViCam webcam driver now controlling video device %d\n",cam->vdev.minor); + printk(KERN_INFO "ViCam webcam driver now controlling video device %d\n", + cam->vdev.num); usb_set_intfdata (intf, cam); diff --git a/drivers/media/video/usbvision/usbvision-i2c.c b/drivers/media/video/usbvision/usbvision-i2c.c index 92427fd..9907b9a 100644 --- a/drivers/media/video/usbvision/usbvision-i2c.c +++ b/drivers/media/video/usbvision/usbvision-i2c.c @@ -236,7 +236,7 @@ int usbvision_i2c_register(struct usb_usbvision *usbvision) sizeof(struct i2c_client)); sprintf(usbvision->i2c_adap.name + strlen(usbvision->i2c_adap.name), - " #%d", usbvision->vdev->minor & 0x1f); + " #%d", usbvision->vdev->num); PDEBUG(DBG_I2C,"Adaptername: %s", usbvision->i2c_adap.name); usbvision->i2c_adap.dev.parent = &usbvision->dev->dev; diff --git a/drivers/media/video/usbvision/usbvision-video.c b/drivers/media/video/usbvision/usbvision-video.c index 77aeb39..d185b57 100644 --- a/drivers/media/video/usbvision/usbvision-video.c +++ b/drivers/media/video/usbvision/usbvision-video.c @@ -1440,7 +1440,7 @@ static void usbvision_unregister_video(struct usb_usbvision *usbvision) // vbi Device: if (usbvision->vbi) { PDEBUG(DBG_PROBE, "unregister /dev/vbi%d [v4l2]", - usbvision->vbi->minor & 0x1f); + usbvision->vbi->num); if (usbvision->vbi->minor != -1) { video_unregister_device(usbvision->vbi); } else { @@ -1452,7 +1452,7 @@ static void usbvision_unregister_video(struct usb_usbvision *usbvision) // Radio Device: if (usbvision->rdev) { PDEBUG(DBG_PROBE, "unregister /dev/radio%d [v4l2]", - usbvision->rdev->minor & 0x1f); + usbvision->rdev->num); if (usbvision->rdev->minor != -1) { video_unregister_device(usbvision->rdev); } else { @@ -1464,7 +1464,7 @@ static void usbvision_unregister_video(struct usb_usbvision *usbvision) // Video Device: if (usbvision->vdev) { PDEBUG(DBG_PROBE, "unregister /dev/video%d [v4l2]", - usbvision->vdev->minor & 0x1f); + usbvision->vdev->num); if (usbvision->vdev->minor != -1) { video_unregister_device(usbvision->vdev); } else { @@ -1490,7 +1490,7 @@ static int __devinit usbvision_register_video(struct usb_usbvision *usbvision) goto err_exit; } printk(KERN_INFO "USBVision[%d]: registered USBVision Video device /dev/video%d [v4l2]\n", - usbvision->nr,usbvision->vdev->minor & 0x1f); + usbvision->nr, usbvision->vdev->num); // Radio Device: if (usbvision_device_data[usbvision->DevModel].Radio) { @@ -1507,7 +1507,7 @@ static int __devinit usbvision_register_video(struct usb_usbvision *usbvision) goto err_exit; } printk(KERN_INFO "USBVision[%d]: registered USBVision Radio device /dev/radio%d [v4l2]\n", - usbvision->nr, usbvision->rdev->minor & 0x1f); + usbvision->nr, usbvision->rdev->num); } // vbi Device: if (usbvision_device_data[usbvision->DevModel].vbi) { @@ -1523,7 +1523,7 @@ static int __devinit usbvision_register_video(struct usb_usbvision *usbvision) goto err_exit; } printk(KERN_INFO "USBVision[%d]: registered USBVision VBI device /dev/vbi%d [v4l2] (Not Working Yet!)\n", - usbvision->nr,usbvision->vbi->minor & 0x1f); + usbvision->nr, usbvision->vbi->num); } // all done return 0; diff --git a/drivers/media/video/vivi.c b/drivers/media/video/vivi.c index 7d7e51d..e15e48f 100644 --- a/drivers/media/video/vivi.c +++ b/drivers/media/video/vivi.c @@ -1163,11 +1163,11 @@ static int vivi_release(void) if (-1 != dev->vfd->minor) { printk(KERN_INFO "%s: unregistering /dev/video%d\n", - VIVI_MODULE_NAME, dev->vfd->minor); + VIVI_MODULE_NAME, dev->vfd->num); video_unregister_device(dev->vfd); } else { printk(KERN_INFO "%s: releasing /dev/video%d\n", - VIVI_MODULE_NAME, dev->vfd->minor); + VIVI_MODULE_NAME, dev->vfd->num); video_device_release(dev->vfd); } @@ -1307,7 +1307,7 @@ static int __init vivi_init(void) dev->vfd = vfd; printk(KERN_INFO "%s: V4L2 device registered as /dev/video%d\n", - VIVI_MODULE_NAME, vfd->minor); + VIVI_MODULE_NAME, vfd->num); } if (ret < 0) { diff --git a/drivers/media/video/w9968cf.c b/drivers/media/video/w9968cf.c index dcd45db..4dfb43b 100644 --- a/drivers/media/video/w9968cf.c +++ b/drivers/media/video/w9968cf.c @@ -2398,7 +2398,7 @@ error: cam->sensor = CC_UNKNOWN; DBG(1, "Image sensor initialization failed for %s (/dev/video%d). " "Try to detach and attach this device again", - symbolic(camlist, cam->id), cam->v4ldev->minor) + symbolic(camlist, cam->id), cam->v4ldev->num) return err; } @@ -2644,7 +2644,7 @@ static void w9968cf_release_resources(struct w9968cf_device* cam) { mutex_lock(&w9968cf_devlist_mutex); - DBG(2, "V4L device deregistered: /dev/video%d", cam->v4ldev->minor) + DBG(2, "V4L device deregistered: /dev/video%d", cam->v4ldev->num) video_unregister_device(cam->v4ldev); list_del(&cam->v4llist); @@ -2679,7 +2679,7 @@ static int w9968cf_open(struct inode* inode, struct file* filp) DBG(2, "No supported image sensor has been detected by the " "'ovcamchip' module for the %s (/dev/video%d). Make " "sure it is loaded *before* (re)connecting the camera.", - symbolic(camlist, cam->id), cam->v4ldev->minor) + symbolic(camlist, cam->id), cam->v4ldev->num) mutex_unlock(&cam->dev_mutex); up_read(&w9968cf_disconnect); return -ENODEV; @@ -2687,7 +2687,7 @@ static int w9968cf_open(struct inode* inode, struct file* filp) if (cam->users) { DBG(2, "%s (/dev/video%d) has been already occupied by '%s'", - symbolic(camlist, cam->id),cam->v4ldev->minor,cam->command) + symbolic(camlist, cam->id), cam->v4ldev->num, cam->command) if ((filp->f_flags & O_NONBLOCK)||(filp->f_flags & O_NDELAY)) { mutex_unlock(&cam->dev_mutex); up_read(&w9968cf_disconnect); @@ -2709,7 +2709,7 @@ static int w9968cf_open(struct inode* inode, struct file* filp) } DBG(5, "Opening '%s', /dev/video%d ...", - symbolic(camlist, cam->id), cam->v4ldev->minor) + symbolic(camlist, cam->id), cam->v4ldev->num) cam->streaming = 0; cam->misconfigured = 0; @@ -2947,7 +2947,7 @@ static int w9968cf_v4l_ioctl(struct inode* inode, struct file* filp, .minheight = cam->minheight, }; sprintf(cap.name, "W996[87]CF USB Camera #%d", - cam->v4ldev->minor); + cam->v4ldev->num); cap.maxwidth = (cam->upscaling && w9968cf_vpp) ? max((u16)W9968CF_MAX_WIDTH, cam->maxwidth) : cam->maxwidth; @@ -3567,7 +3567,7 @@ w9968cf_usb_probe(struct usb_interface* intf, const struct usb_device_id* id) goto fail; } - DBG(2, "V4L device registered as /dev/video%d", cam->v4ldev->minor) + DBG(2, "V4L device registered as /dev/video%d", cam->v4ldev->num) /* Set some basic constants */ w9968cf_configure_camera(cam, udev, mod_id, dev_nr); @@ -3618,7 +3618,7 @@ static void w9968cf_usb_disconnect(struct usb_interface* intf) DBG(2, "The device is open (/dev/video%d)! " "Process name: %s. Deregistration and memory " "deallocation are deferred on close.", - cam->v4ldev->minor, cam->command) + cam->v4ldev->num, cam->command) cam->misconfigured = 1; w9968cf_stop_transfer(cam); wake_up_interruptible(&cam->wait_queue); diff --git a/drivers/media/video/zc0301/zc0301_core.c b/drivers/media/video/zc0301/zc0301_core.c index 6a0902b..9fc5817 100644 --- a/drivers/media/video/zc0301/zc0301_core.c +++ b/drivers/media/video/zc0301/zc0301_core.c @@ -539,7 +539,7 @@ static int zc0301_stream_interrupt(struct zc0301_device* cam) cam->state |= DEV_MISCONFIGURED; DBG(1, "URB timeout reached. The camera is misconfigured. To " "use it, close and open /dev/video%d again.", - cam->v4ldev->minor); + cam->v4ldev->num); return -EIO; } @@ -640,7 +640,7 @@ static void zc0301_release_resources(struct kref *kref) { struct zc0301_device *cam = container_of(kref, struct zc0301_device, kref); - DBG(2, "V4L2 device /dev/video%d deregistered", cam->v4ldev->minor); + DBG(2, "V4L2 device /dev/video%d deregistered", cam->v4ldev->num); video_set_drvdata(cam->v4ldev, NULL); video_unregister_device(cam->v4ldev); usb_put_dev(cam->usbdev); @@ -679,7 +679,7 @@ static int zc0301_open(struct inode* inode, struct file* filp) } if (cam->users) { - DBG(2, "Device /dev/video%d is busy...", cam->v4ldev->minor); + DBG(2, "Device /dev/video%d is busy...", cam->v4ldev->num); DBG(3, "Simultaneous opens are not supported"); if ((filp->f_flags & O_NONBLOCK) || (filp->f_flags & O_NDELAY)) { @@ -722,7 +722,7 @@ static int zc0301_open(struct inode* inode, struct file* filp) cam->frame_count = 0; zc0301_empty_framequeues(cam); - DBG(3, "Video device /dev/video%d is open", cam->v4ldev->minor); + DBG(3, "Video device /dev/video%d is open", cam->v4ldev->num); out: mutex_unlock(&cam->open_mutex); @@ -746,7 +746,7 @@ static int zc0301_release(struct inode* inode, struct file* filp) cam->users--; wake_up_interruptible_nr(&cam->wait_open, 1); - DBG(3, "Video device /dev/video%d closed", cam->v4ldev->minor); + DBG(3, "Video device /dev/video%d closed", cam->v4ldev->num); kref_put(&cam->kref, zc0301_release_resources); @@ -1275,7 +1275,7 @@ zc0301_vidioc_s_crop(struct zc0301_device* cam, void __user * arg) cam->state |= DEV_MISCONFIGURED; DBG(1, "VIDIOC_S_CROP failed because of hardware problems. To " "use the camera, close and open /dev/video%d again.", - cam->v4ldev->minor); + cam->v4ldev->num); return -EIO; } @@ -1288,7 +1288,7 @@ zc0301_vidioc_s_crop(struct zc0301_device* cam, void __user * arg) cam->state |= DEV_MISCONFIGURED; DBG(1, "VIDIOC_S_CROP failed because of not enough memory. To " "use the camera, close and open /dev/video%d again.", - cam->v4ldev->minor); + cam->v4ldev->num); return -ENOMEM; } @@ -1470,7 +1470,7 @@ zc0301_vidioc_try_s_fmt(struct zc0301_device* cam, unsigned int cmd, cam->state |= DEV_MISCONFIGURED; DBG(1, "VIDIOC_S_FMT failed because of hardware problems. To " "use the camera, close and open /dev/video%d again.", - cam->v4ldev->minor); + cam->v4ldev->num); return -EIO; } @@ -1482,7 +1482,7 @@ zc0301_vidioc_try_s_fmt(struct zc0301_device* cam, unsigned int cmd, cam->state |= DEV_MISCONFIGURED; DBG(1, "VIDIOC_S_FMT failed because of not enough memory. To " "use the camera, close and open /dev/video%d again.", - cam->v4ldev->minor); + cam->v4ldev->num); return -ENOMEM; } @@ -1529,7 +1529,7 @@ zc0301_vidioc_s_jpegcomp(struct zc0301_device* cam, void __user * arg) cam->state |= DEV_MISCONFIGURED; DBG(1, "VIDIOC_S_JPEGCOMP failed because of hardware " "problems. To use the camera, close and open " - "/dev/video%d again.", cam->v4ldev->minor); + "/dev/video%d again.", cam->v4ldev->num); return -EIO; } @@ -2005,7 +2005,7 @@ zc0301_usb_probe(struct usb_interface* intf, const struct usb_device_id* id) goto fail; } - DBG(2, "V4L2 device registered as /dev/video%d", cam->v4ldev->minor); + DBG(2, "V4L2 device registered as /dev/video%d", cam->v4ldev->num); cam->module_param.force_munmap = force_munmap[dev_nr]; cam->module_param.frame_timeout = frame_timeout[dev_nr]; @@ -2044,7 +2044,7 @@ static void zc0301_usb_disconnect(struct usb_interface* intf) if (cam->users) { DBG(2, "Device /dev/video%d is open! Deregistration and " "memory deallocation are deferred.", - cam->v4ldev->minor); + cam->v4ldev->num); cam->state |= DEV_MISCONFIGURED; zc0301_stop_transfer(cam); cam->state |= DEV_DISCONNECTED; diff --git a/drivers/media/video/zr364xx.c b/drivers/media/video/zr364xx.c index 7cdac99..a1d81ed 100644 --- a/drivers/media/video/zr364xx.c +++ b/drivers/media/video/zr364xx.c @@ -885,7 +885,7 @@ static int zr364xx_probe(struct usb_interface *intf, usb_set_intfdata(intf, cam); dev_info(&udev->dev, DRIVER_DESC " controlling video device %d\n", - cam->vdev->minor); + cam->vdev->num); return 0; } -- cgit v0.10.2 From 4e7ca40dbff522691b13dd9b5ed41891e6c68e1a Mon Sep 17 00:00:00 2001 From: Ian Armstrong Date: Sun, 19 Oct 2008 18:58:26 -0300 Subject: V4L/DVB (9328): ivtvfb: FB_BLANK_POWERDOWN turns off video output When using FBIOBLANK, FB_BLANK_POWERDOWN will now switch off the video output. Since some televisions turn themselves off after a while with no signal, this is the closest we can get to power-saving. Signed-off-by: Ian Armstrong Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab diff --git a/drivers/media/video/ivtv/ivtv-i2c.c b/drivers/media/video/ivtv/ivtv-i2c.c index 24700c2..41dbbe9 100644 --- a/drivers/media/video/ivtv/ivtv-i2c.c +++ b/drivers/media/video/ivtv/ivtv-i2c.c @@ -726,6 +726,7 @@ int ivtv_saa7127(struct ivtv *itv, unsigned int cmd, void *arg) { return ivtv_call_i2c_client(itv, IVTV_SAA7127_I2C_ADDR, cmd, arg); } +EXPORT_SYMBOL(ivtv_saa7127); int ivtv_saa717x(struct ivtv *itv, unsigned int cmd, void *arg) { diff --git a/drivers/media/video/ivtv/ivtvfb.c b/drivers/media/video/ivtv/ivtvfb.c index 8a4a150..921e281 100644 --- a/drivers/media/video/ivtv/ivtvfb.c +++ b/drivers/media/video/ivtv/ivtvfb.c @@ -48,6 +48,7 @@ #endif #include "ivtv-driver.h" +#include "ivtv-i2c.h" #include "ivtv-udma.h" #include "ivtv-mailbox.h" @@ -894,11 +895,16 @@ static int ivtvfb_blank(int blank_mode, struct fb_info *info) switch (blank_mode) { case FB_BLANK_UNBLANK: ivtv_vapi(itv, CX2341X_OSD_SET_STATE, 1, 1); + ivtv_saa7127(itv, VIDIOC_STREAMON, NULL); break; case FB_BLANK_NORMAL: case FB_BLANK_HSYNC_SUSPEND: case FB_BLANK_VSYNC_SUSPEND: + ivtv_vapi(itv, CX2341X_OSD_SET_STATE, 1, 0); + ivtv_saa7127(itv, VIDIOC_STREAMON, NULL); + break; case FB_BLANK_POWERDOWN: + ivtv_saa7127(itv, VIDIOC_STREAMOFF, NULL); ivtv_vapi(itv, CX2341X_OSD_SET_STATE, 1, 0); break; } -- cgit v0.10.2 From b1f88407f3767f924cae1d521e815e568996a4ef Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 21 Oct 2008 11:27:20 -0300 Subject: V4L/DVB (9330): Get rid of inode parameter at v4l_compat_translate_ioctl() The inode parameter at v4l_compat_translate_ioctl() were just passed over several places just to keep compatible with fops.ioctl. However, it weren't used anywere. This patch gets hid of this unused parameter. Cc: Laurent Pinchart Cc: Mike Isely Signed-off-by: Mauro Carvalho Chehab diff --git a/drivers/media/common/saa7146_video.c b/drivers/media/common/saa7146_video.c index 99be9e5..fe0bd55 100644 --- a/drivers/media/common/saa7146_video.c +++ b/drivers/media/common/saa7146_video.c @@ -834,7 +834,7 @@ static int video_end(struct saa7146_fh *fh, struct file *file) * copying is done already, arg is a kernel pointer. */ -int saa7146_video_do_ioctl(struct inode *inode, struct file *file, unsigned int cmd, void *arg) +static int __saa7146_video_do_ioctl(struct file *file, unsigned int cmd, void *arg) { struct saa7146_fh *fh = file->private_data; struct saa7146_dev *dev = fh->dev; @@ -1215,12 +1215,18 @@ int saa7146_video_do_ioctl(struct inode *inode, struct file *file, unsigned int } #endif default: - return v4l_compat_translate_ioctl(inode,file,cmd,arg, - saa7146_video_do_ioctl); + return v4l_compat_translate_ioctl(file, cmd, arg, + __saa7146_video_do_ioctl); } return 0; } +int saa7146_video_do_ioctl(struct inode *inode, struct file *file, + unsigned int cmd, void *arg) +{ + return __saa7146_video_do_ioctl(file, cmd, arg); +} + /*********************************************************************************/ /* buffer handling functions */ diff --git a/drivers/media/video/pvrusb2/pvrusb2-v4l2.c b/drivers/media/video/pvrusb2/pvrusb2-v4l2.c index 43ef7ba..97ed959 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-v4l2.c +++ b/drivers/media/video/pvrusb2/pvrusb2-v4l2.c @@ -168,7 +168,7 @@ static const char *get_v4l_name(int v4l_type) * This is part of Video 4 Linux API. The procedure handles ioctl() calls. * */ -static int pvr2_v4l2_do_ioctl(struct inode *inode, struct file *file, +static int __pvr2_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg) { struct pvr2_v4l2_fh *fh = file->private_data; @@ -863,8 +863,8 @@ static int pvr2_v4l2_do_ioctl(struct inode *inode, struct file *file, #endif default : - ret = v4l_compat_translate_ioctl(inode,file,cmd, - arg,pvr2_v4l2_do_ioctl); + ret = v4l_compat_translate_ioctl(file, cmd, + arg, __pvr2_v4l2_do_ioctl); } pvr2_hdw_commit_ctl(hdw); @@ -890,6 +890,11 @@ static int pvr2_v4l2_do_ioctl(struct inode *inode, struct file *file, return ret; } +static int pvr2_v4l2_do_ioctl(struct inode *inode, struct file *file, + unsigned int cmd, void *arg) +{ + return __pvr2_v4l2_do_ioctl(file, cmd, arg); +} static void pvr2_v4l2_dev_destroy(struct pvr2_v4l2_dev *dip) { diff --git a/drivers/media/video/uvc/uvc_v4l2.c b/drivers/media/video/uvc/uvc_v4l2.c index 78e4c4e..758dfef 100644 --- a/drivers/media/video/uvc/uvc_v4l2.c +++ b/drivers/media/video/uvc/uvc_v4l2.c @@ -464,7 +464,7 @@ static int uvc_v4l2_release(struct inode *inode, struct file *file) return 0; } -static int uvc_v4l2_do_ioctl(struct inode *inode, struct file *file, +static int __uvc_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg) { struct video_device *vdev = video_devdata(file); @@ -978,8 +978,8 @@ static int uvc_v4l2_do_ioctl(struct inode *inode, struct file *file, return uvc_xu_ctrl_query(video, arg, 1); default: - if ((ret = v4l_compat_translate_ioctl(inode, file, cmd, arg, - uvc_v4l2_do_ioctl)) == -ENOIOCTLCMD) + if ((ret = v4l_compat_translate_ioctl(file, cmd, arg, + __uvc_v4l2_do_ioctl)) == -ENOIOCTLCMD) uvc_trace(UVC_TRACE_IOCTL, "Unknown ioctl 0x%08x\n", cmd); return ret; @@ -988,6 +988,12 @@ static int uvc_v4l2_do_ioctl(struct inode *inode, struct file *file, return ret; } +static int uvc_v4l2_do_ioctl(struct inode *inode, struct file *file, + unsigned int cmd, void *arg) +{ + return __uvc_v4l2_do_ioctl(file, cmd, arg); +} + static int uvc_v4l2_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) { diff --git a/drivers/media/video/v4l1-compat.c b/drivers/media/video/v4l1-compat.c index 928cb40..f13c0a9 100644 --- a/drivers/media/video/v4l1-compat.c +++ b/drivers/media/video/v4l1-compat.c @@ -57,8 +57,7 @@ MODULE_LICENSE("GPL"); */ static int -get_v4l_control(struct inode *inode, - struct file *file, +get_v4l_control(struct file *file, int cid, v4l2_kioctl drv) { @@ -67,12 +66,12 @@ get_v4l_control(struct inode *inode, int err; qctrl2.id = cid; - err = drv(inode, file, VIDIOC_QUERYCTRL, &qctrl2); + err = drv(file, VIDIOC_QUERYCTRL, &qctrl2); if (err < 0) dprintk("VIDIOC_QUERYCTRL: %d\n", err); if (err == 0 && !(qctrl2.flags & V4L2_CTRL_FLAG_DISABLED)) { ctrl2.id = qctrl2.id; - err = drv(inode, file, VIDIOC_G_CTRL, &ctrl2); + err = drv(file, VIDIOC_G_CTRL, &ctrl2); if (err < 0) { dprintk("VIDIOC_G_CTRL: %d\n", err); return 0; @@ -85,8 +84,7 @@ get_v4l_control(struct inode *inode, } static int -set_v4l_control(struct inode *inode, - struct file *file, +set_v4l_control(struct file *file, int cid, int value, v4l2_kioctl drv) @@ -96,7 +94,7 @@ set_v4l_control(struct inode *inode, int err; qctrl2.id = cid; - err = drv(inode, file, VIDIOC_QUERYCTRL, &qctrl2); + err = drv(file, VIDIOC_QUERYCTRL, &qctrl2); if (err < 0) dprintk("VIDIOC_QUERYCTRL: %d\n", err); if (err == 0 && @@ -114,7 +112,7 @@ set_v4l_control(struct inode *inode, + 32767) / 65535; ctrl2.value += qctrl2.minimum; - err = drv(inode, file, VIDIOC_S_CTRL, &ctrl2); + err = drv(file, VIDIOC_S_CTRL, &ctrl2); if (err < 0) dprintk("VIDIOC_S_CTRL: %d\n", err); } @@ -222,7 +220,6 @@ static int poll_one(struct file *file, struct poll_wqueues *pwq) } static int count_inputs( - struct inode *inode, struct file *file, v4l2_kioctl drv) { @@ -232,14 +229,13 @@ static int count_inputs( for (i = 0;; i++) { memset(&input2, 0, sizeof(input2)); input2.index = i; - if (0 != drv(inode, file, VIDIOC_ENUMINPUT, &input2)) + if (0 != drv(file, VIDIOC_ENUMINPUT, &input2)) break; } return i; } static int check_size( - struct inode *inode, struct file *file, v4l2_kioctl drv, int *maxw, @@ -252,14 +248,14 @@ static int check_size( memset(&fmt2, 0, sizeof(fmt2)); desc2.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - if (0 != drv(inode, file, VIDIOC_ENUM_FMT, &desc2)) + if (0 != drv(file, VIDIOC_ENUM_FMT, &desc2)) goto done; fmt2.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; fmt2.fmt.pix.width = 10000; fmt2.fmt.pix.height = 10000; fmt2.fmt.pix.pixelformat = desc2.pixelformat; - if (0 != drv(inode, file, VIDIOC_TRY_FMT, &fmt2)) + if (0 != drv(file, VIDIOC_TRY_FMT, &fmt2)) goto done; *maxw = fmt2.fmt.pix.width; @@ -273,7 +269,6 @@ done: static noinline int v4l1_compat_get_capabilities( struct video_capability *cap, - struct inode *inode, struct file *file, v4l2_kioctl drv) { @@ -289,13 +284,13 @@ static noinline int v4l1_compat_get_capabilities( memset(cap, 0, sizeof(*cap)); memset(&fbuf, 0, sizeof(fbuf)); - err = drv(inode, file, VIDIOC_QUERYCAP, cap2); + err = drv(file, VIDIOC_QUERYCAP, cap2); if (err < 0) { dprintk("VIDIOCGCAP / VIDIOC_QUERYCAP: %d\n", err); goto done; } if (cap2->capabilities & V4L2_CAP_VIDEO_OVERLAY) { - err = drv(inode, file, VIDIOC_G_FBUF, &fbuf); + err = drv(file, VIDIOC_G_FBUF, &fbuf); if (err < 0) { dprintk("VIDIOCGCAP / VIDIOC_G_FBUF: %d\n", err); memset(&fbuf, 0, sizeof(fbuf)); @@ -317,8 +312,8 @@ static noinline int v4l1_compat_get_capabilities( if (fbuf.capability & V4L2_FBUF_CAP_LIST_CLIPPING) cap->type |= VID_TYPE_CLIPPING; - cap->channels = count_inputs(inode, file, drv); - check_size(inode, file, drv, + cap->channels = count_inputs(file, drv); + check_size(file, drv, &cap->maxwidth, &cap->maxheight); cap->audios = 0; /* FIXME */ cap->minwidth = 48; /* FIXME */ @@ -331,7 +326,6 @@ done: static noinline int v4l1_compat_get_frame_buffer( struct video_buffer *buffer, - struct inode *inode, struct file *file, v4l2_kioctl drv) { @@ -341,7 +335,7 @@ static noinline int v4l1_compat_get_frame_buffer( memset(buffer, 0, sizeof(*buffer)); memset(&fbuf, 0, sizeof(fbuf)); - err = drv(inode, file, VIDIOC_G_FBUF, &fbuf); + err = drv(file, VIDIOC_G_FBUF, &fbuf); if (err < 0) { dprintk("VIDIOCGFBUF / VIDIOC_G_FBUF: %d\n", err); goto done; @@ -386,7 +380,6 @@ done: static noinline int v4l1_compat_set_frame_buffer( struct video_buffer *buffer, - struct inode *inode, struct file *file, v4l2_kioctl drv) { @@ -415,7 +408,7 @@ static noinline int v4l1_compat_set_frame_buffer( break; } fbuf.fmt.bytesperline = buffer->bytesperline; - err = drv(inode, file, VIDIOC_S_FBUF, &fbuf); + err = drv(file, VIDIOC_S_FBUF, &fbuf); if (err < 0) dprintk("VIDIOCSFBUF / VIDIOC_S_FBUF: %d\n", err); return err; @@ -423,7 +416,6 @@ static noinline int v4l1_compat_set_frame_buffer( static noinline int v4l1_compat_get_win_cap_dimensions( struct video_window *win, - struct inode *inode, struct file *file, v4l2_kioctl drv) { @@ -438,7 +430,7 @@ static noinline int v4l1_compat_get_win_cap_dimensions( memset(win, 0, sizeof(*win)); fmt->type = V4L2_BUF_TYPE_VIDEO_OVERLAY; - err = drv(inode, file, VIDIOC_G_FMT, fmt); + err = drv(file, VIDIOC_G_FMT, fmt); if (err < 0) dprintk("VIDIOCGWIN / VIDIOC_G_WIN: %d\n", err); if (err == 0) { @@ -453,7 +445,7 @@ static noinline int v4l1_compat_get_win_cap_dimensions( } fmt->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - err = drv(inode, file, VIDIOC_G_FMT, fmt); + err = drv(file, VIDIOC_G_FMT, fmt); if (err < 0) { dprintk("VIDIOCGWIN / VIDIOC_G_FMT: %d\n", err); goto done; @@ -472,7 +464,6 @@ done: static noinline int v4l1_compat_set_win_cap_dimensions( struct video_window *win, - struct inode *inode, struct file *file, v4l2_kioctl drv) { @@ -485,8 +476,8 @@ static noinline int v4l1_compat_set_win_cap_dimensions( return err; } fmt->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - drv(inode, file, VIDIOC_STREAMOFF, &fmt->type); - err1 = drv(inode, file, VIDIOC_G_FMT, fmt); + drv(file, VIDIOC_STREAMOFF, &fmt->type); + err1 = drv(file, VIDIOC_G_FMT, fmt); if (err1 < 0) dprintk("VIDIOCSWIN / VIDIOC_G_FMT: %d\n", err1); if (err1 == 0) { @@ -494,7 +485,7 @@ static noinline int v4l1_compat_set_win_cap_dimensions( fmt->fmt.pix.height = win->height; fmt->fmt.pix.field = V4L2_FIELD_ANY; fmt->fmt.pix.bytesperline = 0; - err = drv(inode, file, VIDIOC_S_FMT, fmt); + err = drv(file, VIDIOC_S_FMT, fmt); if (err < 0) dprintk("VIDIOCSWIN / VIDIOC_S_FMT #1: %d\n", err); @@ -511,7 +502,7 @@ static noinline int v4l1_compat_set_win_cap_dimensions( fmt->fmt.win.chromakey = win->chromakey; fmt->fmt.win.clips = (void __user *)win->clips; fmt->fmt.win.clipcount = win->clipcount; - err2 = drv(inode, file, VIDIOC_S_FMT, fmt); + err2 = drv(file, VIDIOC_S_FMT, fmt); if (err2 < 0) dprintk("VIDIOCSWIN / VIDIOC_S_FMT #2: %d\n", err2); @@ -525,7 +516,6 @@ static noinline int v4l1_compat_set_win_cap_dimensions( static noinline int v4l1_compat_turn_preview_on_off( int *on, - struct inode *inode, struct file *file, v4l2_kioctl drv) { @@ -536,9 +526,9 @@ static noinline int v4l1_compat_turn_preview_on_off( /* dirty hack time. But v4l1 has no STREAMOFF * equivalent in the API, and this one at * least comes close ... */ - drv(inode, file, VIDIOC_STREAMOFF, &captype); + drv(file, VIDIOC_STREAMOFF, &captype); } - err = drv(inode, file, VIDIOC_OVERLAY, on); + err = drv(file, VIDIOC_OVERLAY, on); if (err < 0) dprintk("VIDIOCCAPTURE / VIDIOC_PREVIEW: %d\n", err); return err; @@ -546,7 +536,6 @@ static noinline int v4l1_compat_turn_preview_on_off( static noinline int v4l1_compat_get_input_info( struct video_channel *chan, - struct inode *inode, struct file *file, v4l2_kioctl drv) { @@ -556,7 +545,7 @@ static noinline int v4l1_compat_get_input_info( memset(&input2, 0, sizeof(input2)); input2.index = chan->channel; - err = drv(inode, file, VIDIOC_ENUMINPUT, &input2); + err = drv(file, VIDIOC_ENUMINPUT, &input2); if (err < 0) { dprintk("VIDIOCGCHAN / VIDIOC_ENUMINPUT: " "channel=%d err=%d\n", chan->channel, err); @@ -578,7 +567,7 @@ static noinline int v4l1_compat_get_input_info( break; } chan->norm = 0; - err = drv(inode, file, VIDIOC_G_STD, &sid); + err = drv(file, VIDIOC_G_STD, &sid); if (err < 0) dprintk("VIDIOCGCHAN / VIDIOC_G_STD: %d\n", err); if (err == 0) { @@ -595,14 +584,13 @@ done: static noinline int v4l1_compat_set_input( struct video_channel *chan, - struct inode *inode, struct file *file, v4l2_kioctl drv) { int err; v4l2_std_id sid = 0; - err = drv(inode, file, VIDIOC_S_INPUT, &chan->channel); + err = drv(file, VIDIOC_S_INPUT, &chan->channel); if (err < 0) dprintk("VIDIOCSCHAN / VIDIOC_S_INPUT: %d\n", err); switch (chan->norm) { @@ -617,7 +605,7 @@ static noinline int v4l1_compat_set_input( break; } if (0 != sid) { - err = drv(inode, file, VIDIOC_S_STD, &sid); + err = drv(file, VIDIOC_S_STD, &sid); if (err < 0) dprintk("VIDIOCSCHAN / VIDIOC_S_STD: %d\n", err); } @@ -626,7 +614,6 @@ static noinline int v4l1_compat_set_input( static noinline int v4l1_compat_get_picture( struct video_picture *pict, - struct inode *inode, struct file *file, v4l2_kioctl drv) { @@ -639,19 +626,19 @@ static noinline int v4l1_compat_get_picture( return err; } - pict->brightness = get_v4l_control(inode, file, + pict->brightness = get_v4l_control(file, V4L2_CID_BRIGHTNESS, drv); - pict->hue = get_v4l_control(inode, file, + pict->hue = get_v4l_control(file, V4L2_CID_HUE, drv); - pict->contrast = get_v4l_control(inode, file, + pict->contrast = get_v4l_control(file, V4L2_CID_CONTRAST, drv); - pict->colour = get_v4l_control(inode, file, + pict->colour = get_v4l_control(file, V4L2_CID_SATURATION, drv); - pict->whiteness = get_v4l_control(inode, file, + pict->whiteness = get_v4l_control(file, V4L2_CID_WHITENESS, drv); fmt->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - err = drv(inode, file, VIDIOC_G_FMT, fmt); + err = drv(file, VIDIOC_G_FMT, fmt); if (err < 0) { dprintk("VIDIOCGPICT / VIDIOC_G_FMT: %d\n", err); goto done; @@ -669,7 +656,6 @@ done: static noinline int v4l1_compat_set_picture( struct video_picture *pict, - struct inode *inode, struct file *file, v4l2_kioctl drv) { @@ -685,15 +671,15 @@ static noinline int v4l1_compat_set_picture( } memset(&fbuf, 0, sizeof(fbuf)); - set_v4l_control(inode, file, + set_v4l_control(file, V4L2_CID_BRIGHTNESS, pict->brightness, drv); - set_v4l_control(inode, file, + set_v4l_control(file, V4L2_CID_HUE, pict->hue, drv); - set_v4l_control(inode, file, + set_v4l_control(file, V4L2_CID_CONTRAST, pict->contrast, drv); - set_v4l_control(inode, file, + set_v4l_control(file, V4L2_CID_SATURATION, pict->colour, drv); - set_v4l_control(inode, file, + set_v4l_control(file, V4L2_CID_WHITENESS, pict->whiteness, drv); /* * V4L1 uses this ioctl to set both memory capture and overlay @@ -703,7 +689,7 @@ static noinline int v4l1_compat_set_picture( */ fmt->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - err = drv(inode, file, VIDIOC_G_FMT, fmt); + err = drv(file, VIDIOC_G_FMT, fmt); /* If VIDIOC_G_FMT failed, then the driver likely doesn't support memory capture. Trying to set the memory capture parameters would be pointless. */ @@ -714,13 +700,13 @@ static noinline int v4l1_compat_set_picture( palette_to_pixelformat(pict->palette)) { fmt->fmt.pix.pixelformat = palette_to_pixelformat( pict->palette); - mem_err = drv(inode, file, VIDIOC_S_FMT, fmt); + mem_err = drv(file, VIDIOC_S_FMT, fmt); if (mem_err < 0) dprintk("VIDIOCSPICT / VIDIOC_S_FMT: %d\n", mem_err); } - err = drv(inode, file, VIDIOC_G_FBUF, &fbuf); + err = drv(file, VIDIOC_G_FBUF, &fbuf); /* If VIDIOC_G_FBUF failed, then the driver likely doesn't support overlay. Trying to set the overlay parameters would be quite pointless. */ @@ -731,7 +717,7 @@ static noinline int v4l1_compat_set_picture( palette_to_pixelformat(pict->palette)) { fbuf.fmt.pixelformat = palette_to_pixelformat( pict->palette); - ovl_err = drv(inode, file, VIDIOC_S_FBUF, &fbuf); + ovl_err = drv(file, VIDIOC_S_FBUF, &fbuf); if (ovl_err < 0) dprintk("VIDIOCSPICT / VIDIOC_S_FBUF: %d\n", ovl_err); @@ -752,7 +738,6 @@ static noinline int v4l1_compat_set_picture( static noinline int v4l1_compat_get_tuner( struct video_tuner *tun, - struct inode *inode, struct file *file, v4l2_kioctl drv) { @@ -762,7 +747,7 @@ static noinline int v4l1_compat_get_tuner( v4l2_std_id sid; memset(&tun2, 0, sizeof(tun2)); - err = drv(inode, file, VIDIOC_G_TUNER, &tun2); + err = drv(file, VIDIOC_G_TUNER, &tun2); if (err < 0) { dprintk("VIDIOCGTUNER / VIDIOC_G_TUNER: %d\n", err); goto done; @@ -778,7 +763,7 @@ static noinline int v4l1_compat_get_tuner( for (i = 0; i < 64; i++) { memset(&std2, 0, sizeof(std2)); std2.index = i; - if (0 != drv(inode, file, VIDIOC_ENUMSTD, &std2)) + if (0 != drv(file, VIDIOC_ENUMSTD, &std2)) break; if (std2.id & V4L2_STD_PAL) tun->flags |= VIDEO_TUNER_PAL; @@ -788,7 +773,7 @@ static noinline int v4l1_compat_get_tuner( tun->flags |= VIDEO_TUNER_SECAM; } - err = drv(inode, file, VIDIOC_G_STD, &sid); + err = drv(file, VIDIOC_G_STD, &sid); if (err < 0) dprintk("VIDIOCGTUNER / VIDIOC_G_STD: %d\n", err); if (err == 0) { @@ -811,7 +796,6 @@ done: static noinline int v4l1_compat_select_tuner( struct video_tuner *tun, - struct inode *inode, struct file *file, v4l2_kioctl drv) { @@ -821,7 +805,7 @@ static noinline int v4l1_compat_select_tuner( t.index = tun->tuner; - err = drv(inode, file, VIDIOC_S_INPUT, &t); + err = drv(file, VIDIOC_S_INPUT, &t); if (err < 0) dprintk("VIDIOCSTUNER / VIDIOC_S_INPUT: %d\n", err); return err; @@ -829,7 +813,6 @@ static noinline int v4l1_compat_select_tuner( static noinline int v4l1_compat_get_frequency( unsigned long *freq, - struct inode *inode, struct file *file, v4l2_kioctl drv) { @@ -838,7 +821,7 @@ static noinline int v4l1_compat_get_frequency( memset(&freq2, 0, sizeof(freq2)); freq2.tuner = 0; - err = drv(inode, file, VIDIOC_G_FREQUENCY, &freq2); + err = drv(file, VIDIOC_G_FREQUENCY, &freq2); if (err < 0) dprintk("VIDIOCGFREQ / VIDIOC_G_FREQUENCY: %d\n", err); if (0 == err) @@ -848,7 +831,6 @@ static noinline int v4l1_compat_get_frequency( static noinline int v4l1_compat_set_frequency( unsigned long *freq, - struct inode *inode, struct file *file, v4l2_kioctl drv) { @@ -856,9 +838,9 @@ static noinline int v4l1_compat_set_frequency( struct v4l2_frequency freq2; memset(&freq2, 0, sizeof(freq2)); - drv(inode, file, VIDIOC_G_FREQUENCY, &freq2); + drv(file, VIDIOC_G_FREQUENCY, &freq2); freq2.frequency = *freq; - err = drv(inode, file, VIDIOC_S_FREQUENCY, &freq2); + err = drv(file, VIDIOC_S_FREQUENCY, &freq2); if (err < 0) dprintk("VIDIOCSFREQ / VIDIOC_S_FREQUENCY: %d\n", err); return err; @@ -866,7 +848,6 @@ static noinline int v4l1_compat_set_frequency( static noinline int v4l1_compat_get_audio( struct video_audio *aud, - struct inode *inode, struct file *file, v4l2_kioctl drv) { @@ -876,7 +857,7 @@ static noinline int v4l1_compat_get_audio( struct v4l2_tuner tun2; memset(&aud2, 0, sizeof(aud2)); - err = drv(inode, file, VIDIOC_G_AUDIO, &aud2); + err = drv(file, VIDIOC_G_AUDIO, &aud2); if (err < 0) { dprintk("VIDIOCGAUDIO / VIDIOC_G_AUDIO: %d\n", err); goto done; @@ -886,27 +867,27 @@ static noinline int v4l1_compat_get_audio( aud->name[sizeof(aud->name) - 1] = 0; aud->audio = aud2.index; aud->flags = 0; - i = get_v4l_control(inode, file, V4L2_CID_AUDIO_VOLUME, drv); + i = get_v4l_control(file, V4L2_CID_AUDIO_VOLUME, drv); if (i >= 0) { aud->volume = i; aud->flags |= VIDEO_AUDIO_VOLUME; } - i = get_v4l_control(inode, file, V4L2_CID_AUDIO_BASS, drv); + i = get_v4l_control(file, V4L2_CID_AUDIO_BASS, drv); if (i >= 0) { aud->bass = i; aud->flags |= VIDEO_AUDIO_BASS; } - i = get_v4l_control(inode, file, V4L2_CID_AUDIO_TREBLE, drv); + i = get_v4l_control(file, V4L2_CID_AUDIO_TREBLE, drv); if (i >= 0) { aud->treble = i; aud->flags |= VIDEO_AUDIO_TREBLE; } - i = get_v4l_control(inode, file, V4L2_CID_AUDIO_BALANCE, drv); + i = get_v4l_control(file, V4L2_CID_AUDIO_BALANCE, drv); if (i >= 0) { aud->balance = i; aud->flags |= VIDEO_AUDIO_BALANCE; } - i = get_v4l_control(inode, file, V4L2_CID_AUDIO_MUTE, drv); + i = get_v4l_control(file, V4L2_CID_AUDIO_MUTE, drv); if (i >= 0) { if (i) aud->flags |= VIDEO_AUDIO_MUTE; @@ -914,13 +895,13 @@ static noinline int v4l1_compat_get_audio( } aud->step = 1; qctrl2.id = V4L2_CID_AUDIO_VOLUME; - if (drv(inode, file, VIDIOC_QUERYCTRL, &qctrl2) == 0 && + if (drv(file, VIDIOC_QUERYCTRL, &qctrl2) == 0 && !(qctrl2.flags & V4L2_CTRL_FLAG_DISABLED)) aud->step = qctrl2.step; aud->mode = 0; memset(&tun2, 0, sizeof(tun2)); - err = drv(inode, file, VIDIOC_G_TUNER, &tun2); + err = drv(file, VIDIOC_G_TUNER, &tun2); if (err < 0) { dprintk("VIDIOCGAUDIO / VIDIOC_G_TUNER: %d\n", err); err = 0; @@ -939,7 +920,6 @@ done: static noinline int v4l1_compat_set_audio( struct video_audio *aud, - struct inode *inode, struct file *file, v4l2_kioctl drv) { @@ -951,24 +931,24 @@ static noinline int v4l1_compat_set_audio( memset(&tun2, 0, sizeof(tun2)); aud2.index = aud->audio; - err = drv(inode, file, VIDIOC_S_AUDIO, &aud2); + err = drv(file, VIDIOC_S_AUDIO, &aud2); if (err < 0) { dprintk("VIDIOCSAUDIO / VIDIOC_S_AUDIO: %d\n", err); goto done; } - set_v4l_control(inode, file, V4L2_CID_AUDIO_VOLUME, + set_v4l_control(file, V4L2_CID_AUDIO_VOLUME, aud->volume, drv); - set_v4l_control(inode, file, V4L2_CID_AUDIO_BASS, + set_v4l_control(file, V4L2_CID_AUDIO_BASS, aud->bass, drv); - set_v4l_control(inode, file, V4L2_CID_AUDIO_TREBLE, + set_v4l_control(file, V4L2_CID_AUDIO_TREBLE, aud->treble, drv); - set_v4l_control(inode, file, V4L2_CID_AUDIO_BALANCE, + set_v4l_control(file, V4L2_CID_AUDIO_BALANCE, aud->balance, drv); - set_v4l_control(inode, file, V4L2_CID_AUDIO_MUTE, + set_v4l_control(file, V4L2_CID_AUDIO_MUTE, !!(aud->flags & VIDEO_AUDIO_MUTE), drv); - err = drv(inode, file, VIDIOC_G_TUNER, &tun2); + err = drv(file, VIDIOC_G_TUNER, &tun2); if (err < 0) dprintk("VIDIOCSAUDIO / VIDIOC_G_TUNER: %d\n", err); if (err == 0) { @@ -985,7 +965,7 @@ static noinline int v4l1_compat_set_audio( tun2.audmode = V4L2_TUNER_MODE_LANG2; break; } - err = drv(inode, file, VIDIOC_S_TUNER, &tun2); + err = drv(file, VIDIOC_S_TUNER, &tun2); if (err < 0) dprintk("VIDIOCSAUDIO / VIDIOC_S_TUNER: %d\n", err); } @@ -996,7 +976,6 @@ done: static noinline int v4l1_compat_capture_frame( struct video_mmap *mm, - struct inode *inode, struct file *file, v4l2_kioctl drv) { @@ -1013,7 +992,7 @@ static noinline int v4l1_compat_capture_frame( memset(&buf, 0, sizeof(buf)); fmt->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - err = drv(inode, file, VIDIOC_G_FMT, fmt); + err = drv(file, VIDIOC_G_FMT, fmt); if (err < 0) { dprintk("VIDIOCMCAPTURE / VIDIOC_G_FMT: %d\n", err); goto done; @@ -1029,7 +1008,7 @@ static noinline int v4l1_compat_capture_frame( palette_to_pixelformat(mm->format); fmt->fmt.pix.field = V4L2_FIELD_ANY; fmt->fmt.pix.bytesperline = 0; - err = drv(inode, file, VIDIOC_S_FMT, fmt); + err = drv(file, VIDIOC_S_FMT, fmt); if (err < 0) { dprintk("VIDIOCMCAPTURE / VIDIOC_S_FMT: %d\n", err); goto done; @@ -1037,17 +1016,17 @@ static noinline int v4l1_compat_capture_frame( } buf.index = mm->frame; buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - err = drv(inode, file, VIDIOC_QUERYBUF, &buf); + err = drv(file, VIDIOC_QUERYBUF, &buf); if (err < 0) { dprintk("VIDIOCMCAPTURE / VIDIOC_QUERYBUF: %d\n", err); goto done; } - err = drv(inode, file, VIDIOC_QBUF, &buf); + err = drv(file, VIDIOC_QBUF, &buf); if (err < 0) { dprintk("VIDIOCMCAPTURE / VIDIOC_QBUF: %d\n", err); goto done; } - err = drv(inode, file, VIDIOC_STREAMON, &captype); + err = drv(file, VIDIOC_STREAMON, &captype); if (err < 0) dprintk("VIDIOCMCAPTURE / VIDIOC_STREAMON: %d\n", err); done: @@ -1057,7 +1036,6 @@ done: static noinline int v4l1_compat_sync( int *i, - struct inode *inode, struct file *file, v4l2_kioctl drv) { @@ -1069,7 +1047,7 @@ static noinline int v4l1_compat_sync( memset(&buf, 0, sizeof(buf)); buf.index = *i; buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - err = drv(inode, file, VIDIOC_QUERYBUF, &buf); + err = drv(file, VIDIOC_QUERYBUF, &buf); if (err < 0) { /* No such buffer */ dprintk("VIDIOCSYNC / VIDIOC_QUERYBUF: %d\n", err); @@ -1082,7 +1060,7 @@ static noinline int v4l1_compat_sync( } /* make sure capture actually runs so we don't block forever */ - err = drv(inode, file, VIDIOC_STREAMON, &captype); + err = drv(file, VIDIOC_STREAMON, &captype); if (err < 0) { dprintk("VIDIOCSYNC / VIDIOC_STREAMON: %d\n", err); goto done; @@ -1096,7 +1074,7 @@ static noinline int v4l1_compat_sync( if (err < 0 || /* error or sleep was interrupted */ err == 0) /* timeout? Shouldn't occur. */ break; - err = drv(inode, file, VIDIOC_QUERYBUF, &buf); + err = drv(file, VIDIOC_QUERYBUF, &buf); if (err < 0) dprintk("VIDIOCSYNC / VIDIOC_QUERYBUF: %d\n", err); } @@ -1104,7 +1082,7 @@ static noinline int v4l1_compat_sync( if (!(buf.flags & V4L2_BUF_FLAG_DONE)) /* not done */ goto done; do { - err = drv(inode, file, VIDIOC_DQBUF, &buf); + err = drv(file, VIDIOC_DQBUF, &buf); if (err < 0) dprintk("VIDIOCSYNC / VIDIOC_DQBUF: %d\n", err); } while (err == 0 && buf.index != *i); @@ -1114,7 +1092,6 @@ done: static noinline int v4l1_compat_get_vbi_format( struct vbi_format *fmt, - struct inode *inode, struct file *file, v4l2_kioctl drv) { @@ -1128,7 +1105,7 @@ static noinline int v4l1_compat_get_vbi_format( } fmt2->type = V4L2_BUF_TYPE_VBI_CAPTURE; - err = drv(inode, file, VIDIOC_G_FMT, fmt2); + err = drv(file, VIDIOC_G_FMT, fmt2); if (err < 0) { dprintk("VIDIOCGVBIFMT / VIDIOC_G_FMT: %d\n", err); goto done; @@ -1153,7 +1130,6 @@ done: static noinline int v4l1_compat_set_vbi_format( struct vbi_format *fmt, - struct inode *inode, struct file *file, v4l2_kioctl drv) { @@ -1179,7 +1155,7 @@ static noinline int v4l1_compat_set_vbi_format( fmt2->fmt.vbi.start[1] = fmt->start[1]; fmt2->fmt.vbi.count[1] = fmt->count[1]; fmt2->fmt.vbi.flags = fmt->flags; - err = drv(inode, file, VIDIOC_TRY_FMT, fmt2); + err = drv(file, VIDIOC_TRY_FMT, fmt2); if (err < 0) { dprintk("VIDIOCSVBIFMT / VIDIOC_TRY_FMT: %d\n", err); goto done; @@ -1196,7 +1172,7 @@ static noinline int v4l1_compat_set_vbi_format( err = -EINVAL; goto done; } - err = drv(inode, file, VIDIOC_S_FMT, fmt2); + err = drv(file, VIDIOC_S_FMT, fmt2); if (err < 0) dprintk("VIDIOCSVBIFMT / VIDIOC_S_FMT: %d\n", err); done: @@ -1208,8 +1184,7 @@ done: * This function is exported. */ int -v4l_compat_translate_ioctl(struct inode *inode, - struct file *file, +v4l_compat_translate_ioctl(struct file *file, int cmd, void *arg, v4l2_kioctl drv) @@ -1218,64 +1193,64 @@ v4l_compat_translate_ioctl(struct inode *inode, switch (cmd) { case VIDIOCGCAP: /* capability */ - err = v4l1_compat_get_capabilities(arg, inode, file, drv); + err = v4l1_compat_get_capabilities(arg, file, drv); break; case VIDIOCGFBUF: /* get frame buffer */ - err = v4l1_compat_get_frame_buffer(arg, inode, file, drv); + err = v4l1_compat_get_frame_buffer(arg, file, drv); break; case VIDIOCSFBUF: /* set frame buffer */ - err = v4l1_compat_set_frame_buffer(arg, inode, file, drv); + err = v4l1_compat_set_frame_buffer(arg, file, drv); break; case VIDIOCGWIN: /* get window or capture dimensions */ - err = v4l1_compat_get_win_cap_dimensions(arg, inode, file, drv); + err = v4l1_compat_get_win_cap_dimensions(arg, file, drv); break; case VIDIOCSWIN: /* set window and/or capture dimensions */ - err = v4l1_compat_set_win_cap_dimensions(arg, inode, file, drv); + err = v4l1_compat_set_win_cap_dimensions(arg, file, drv); break; case VIDIOCCAPTURE: /* turn on/off preview */ - err = v4l1_compat_turn_preview_on_off(arg, inode, file, drv); + err = v4l1_compat_turn_preview_on_off(arg, file, drv); break; case VIDIOCGCHAN: /* get input information */ - err = v4l1_compat_get_input_info(arg, inode, file, drv); + err = v4l1_compat_get_input_info(arg, file, drv); break; case VIDIOCSCHAN: /* set input */ - err = v4l1_compat_set_input(arg, inode, file, drv); + err = v4l1_compat_set_input(arg, file, drv); break; case VIDIOCGPICT: /* get tone controls & partial capture format */ - err = v4l1_compat_get_picture(arg, inode, file, drv); + err = v4l1_compat_get_picture(arg, file, drv); break; case VIDIOCSPICT: /* set tone controls & partial capture format */ - err = v4l1_compat_set_picture(arg, inode, file, drv); + err = v4l1_compat_set_picture(arg, file, drv); break; case VIDIOCGTUNER: /* get tuner information */ - err = v4l1_compat_get_tuner(arg, inode, file, drv); + err = v4l1_compat_get_tuner(arg, file, drv); break; case VIDIOCSTUNER: /* select a tuner input */ - err = v4l1_compat_select_tuner(arg, inode, file, drv); + err = v4l1_compat_select_tuner(arg, file, drv); break; case VIDIOCGFREQ: /* get frequency */ - err = v4l1_compat_get_frequency(arg, inode, file, drv); + err = v4l1_compat_get_frequency(arg, file, drv); break; case VIDIOCSFREQ: /* set frequency */ - err = v4l1_compat_set_frequency(arg, inode, file, drv); + err = v4l1_compat_set_frequency(arg, file, drv); break; case VIDIOCGAUDIO: /* get audio properties/controls */ - err = v4l1_compat_get_audio(arg, inode, file, drv); + err = v4l1_compat_get_audio(arg, file, drv); break; case VIDIOCSAUDIO: /* set audio controls */ - err = v4l1_compat_set_audio(arg, inode, file, drv); + err = v4l1_compat_set_audio(arg, file, drv); break; case VIDIOCMCAPTURE: /* capture a frame */ - err = v4l1_compat_capture_frame(arg, inode, file, drv); + err = v4l1_compat_capture_frame(arg, file, drv); break; case VIDIOCSYNC: /* wait for a frame */ - err = v4l1_compat_sync(arg, inode, file, drv); + err = v4l1_compat_sync(arg, file, drv); break; case VIDIOCGVBIFMT: /* query VBI data capture format */ - err = v4l1_compat_get_vbi_format(arg, inode, file, drv); + err = v4l1_compat_get_vbi_format(arg, file, drv); break; case VIDIOCSVBIFMT: - err = v4l1_compat_set_vbi_format(arg, inode, file, drv); + err = v4l1_compat_set_vbi_format(arg, file, drv); break; default: err = -ENOIOCTLCMD; diff --git a/drivers/media/video/v4l2-ioctl.c b/drivers/media/video/v4l2-ioctl.c index 0417844..5b3e251 100644 --- a/drivers/media/video/v4l2-ioctl.c +++ b/drivers/media/video/v4l2-ioctl.c @@ -625,7 +625,7 @@ static int check_fmt(const struct v4l2_ioctl_ops *ops, enum v4l2_buf_type type) return -EINVAL; } -static int __video_do_ioctl(struct inode *inode, struct file *file, +static int __video_do_ioctl(struct file *file, unsigned int cmd, void *arg) { struct video_device *vfd = video_devdata(file); @@ -675,7 +675,7 @@ static int __video_do_ioctl(struct inode *inode, struct file *file, V4L2 ioctls. ********************************************************/ if (_IOC_TYPE(cmd) == 'v' && _IOC_NR(cmd) < BASE_VIDIOCPRIVATE) - return v4l_compat_translate_ioctl(inode, file, cmd, arg, + return v4l_compat_translate_ioctl(file, cmd, arg, __video_do_ioctl); #endif @@ -1832,7 +1832,7 @@ int video_ioctl2(struct inode *inode, struct file *file, } /* Handles IOCTL */ - err = __video_do_ioctl(inode, file, cmd, parg); + err = __video_do_ioctl(file, cmd, parg); if (err == -ENOIOCTLCMD) err = -EINVAL; if (is_ext_ctrl) { diff --git a/include/media/v4l2-ioctl.h b/include/media/v4l2-ioctl.h index 3e11dfe..7a91943 100644 --- a/include/media/v4l2-ioctl.h +++ b/include/media/v4l2-ioctl.h @@ -271,13 +271,13 @@ extern const char *v4l2_field_names[]; extern const char *v4l2_type_names[]; /* Compatibility layer interface -- v4l1-compat module */ -typedef int (*v4l2_kioctl)(struct inode *inode, struct file *file, +typedef int (*v4l2_kioctl)(struct file *file, unsigned int cmd, void *arg); #ifdef CONFIG_VIDEO_V4L1_COMPAT -int v4l_compat_translate_ioctl(struct inode *inode, struct file *file, +int v4l_compat_translate_ioctl(struct file *file, int cmd, void *arg, v4l2_kioctl driver_ioctl); #else -#define v4l_compat_translate_ioctl(inode, file, cmd, arg, ioctl) (-EINVAL) +#define v4l_compat_translate_ioctl(file, cmd, arg, ioctl) (-EINVAL) #endif /* 32 Bits compatibility layer for 64 bits processors */ -- cgit v0.10.2 From 8a522c916d3c3b29a38bd3c8fc3df826d22a9444 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 21 Oct 2008 11:58:39 -0300 Subject: V4L/DVB (9331): Remove unused inode parameter from video_ioctl2 inode is never used on video_ioctl2. Remove it and rename the function to __video_ioctl2. This allows its usage directly as a callback at fops.unlocked_ioctl. Since we still need a callback with inode to be used with fops.ioctl, this patch adds video_ioctl2() that is just a call to __video_ioctl2(). Also, this patch adds some comments about video_ioctl2 and __video_ioctl2 usage at v4l2-ioctl.h. Signed-off-by: Mauro Carvalho Chehab diff --git a/drivers/media/video/ivtv/ivtv-ioctl.c b/drivers/media/video/ivtv/ivtv-ioctl.c index 09a75ab..4bae38d 100644 --- a/drivers/media/video/ivtv/ivtv-ioctl.c +++ b/drivers/media/video/ivtv/ivtv-ioctl.c @@ -1830,7 +1830,7 @@ static long ivtv_serialized_ioctl(struct ivtv *itv, struct file *filp, if (ivtv_debug & IVTV_DBGFLG_IOCTL) vfd->debug = V4L2_DEBUG_IOCTL | V4L2_DEBUG_IOCTL_ARG; - ret = video_ioctl2_unlocked(filp, cmd, arg); + ret = __video_ioctl2(filp, cmd, arg); vfd->debug = 0; return ret; } diff --git a/drivers/media/video/v4l2-ioctl.c b/drivers/media/video/v4l2-ioctl.c index 5b3e251..710e1a4 100644 --- a/drivers/media/video/v4l2-ioctl.c +++ b/drivers/media/video/v4l2-ioctl.c @@ -1768,7 +1768,7 @@ static int __video_do_ioctl(struct file *file, return ret; } -int video_ioctl2(struct inode *inode, struct file *file, +int __video_ioctl2(struct file *file, unsigned int cmd, unsigned long arg) { char sbuf[128]; @@ -1860,11 +1860,11 @@ out: kfree(mbuf); return err; } -EXPORT_SYMBOL(video_ioctl2); +EXPORT_SYMBOL(__video_ioctl2); -long video_ioctl2_unlocked(struct file *file, - unsigned int cmd, unsigned long arg) +int video_ioctl2(struct inode *inode, struct file *file, + unsigned int cmd, unsigned long arg) { - return video_ioctl2(file->f_path.dentry->d_inode, file, cmd, arg); + return __video_ioctl2(file, cmd, arg); } -EXPORT_SYMBOL(video_ioctl2_unlocked); +EXPORT_SYMBOL(video_ioctl2); diff --git a/include/media/v4l2-ioctl.h b/include/media/v4l2-ioctl.h index 7a91943..e6ba25b 100644 --- a/include/media/v4l2-ioctl.h +++ b/include/media/v4l2-ioctl.h @@ -284,15 +284,25 @@ int v4l_compat_translate_ioctl(struct file *file, extern long v4l_compat_ioctl32(struct file *file, unsigned int cmd, unsigned long arg); -extern int video_ioctl2(struct inode *inode, struct file *file, - unsigned int cmd, unsigned long arg); -extern long video_ioctl2_unlocked(struct file *file, - unsigned int cmd, unsigned long arg); - /* Include support for obsoleted stuff */ extern int video_usercopy(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg, int (*func)(struct inode *inode, struct file *file, unsigned int cmd, void *arg)); +/* Standard handlers for V4L ioctl's */ + +/* This prototype is used on fops.unlocked_ioctl */ +extern int __video_ioctl2(struct file *file, + unsigned int cmd, unsigned long arg); + +/* This prototype is used on fops.ioctl + * Since fops.ioctl enables Kernel Big Lock, it is preferred + * to use __video_ioctl2 instead. + * It should be noticed that there's no lock code inside + * video_ioctl2(). + */ +extern int video_ioctl2(struct inode *inode, struct file *file, + unsigned int cmd, unsigned long arg); + #endif /* _V4L2_IOCTL_H */ -- cgit v0.10.2 From 9212a572dd5ecc69f9b9985ba3e92c6f2504f0fc Mon Sep 17 00:00:00 2001 From: Darron Broad Date: Tue, 21 Oct 2008 10:42:00 -0300 Subject: V4L/DVB (9332): cx88: initial fix for analogue only compilation Initial fix for when analogue only is selected for compilation (ie, !CX88_DVB) Signed-off-by: Darron Broad Signed-off-by: Mauro Carvalho Chehab diff --git a/drivers/media/video/cx88/cx88-i2c.c b/drivers/media/video/cx88/cx88-i2c.c index 01de230..1ab691d 100644 --- a/drivers/media/video/cx88/cx88-i2c.c +++ b/drivers/media/video/cx88/cx88-i2c.c @@ -116,8 +116,10 @@ static int detach_inform(struct i2c_client *client) void cx88_call_i2c_clients(struct cx88_core *core, unsigned int cmd, void *arg) { +#if defined(CONFIG_VIDEO_CX88_DVB) || defined(CONFIG_VIDEO_CX88_DVB_MODULE) struct videobuf_dvb_frontends *f = &core->dvbdev->frontends; struct videobuf_dvb_frontend *fe = NULL; +#endif if (0 != core->i2c_rc) return; diff --git a/drivers/media/video/cx88/cx88-mpeg.c b/drivers/media/video/cx88/cx88-mpeg.c index 6df5cf3..b21fd93 100644 --- a/drivers/media/video/cx88/cx88-mpeg.c +++ b/drivers/media/video/cx88/cx88-mpeg.c @@ -768,8 +768,11 @@ static int __devinit cx8802_probe(struct pci_dev *pci_dev, { struct cx8802_dev *dev; struct cx88_core *core; + int err; +#if defined(CONFIG_VIDEO_CX88_DVB) || defined(CONFIG_VIDEO_CX88_DVB_MODULE) struct videobuf_dvb_frontend *demod; - int err,i; + int i; +#endif /* general setup */ core = cx88_core_get(pci_dev); @@ -801,6 +804,7 @@ static int __devinit cx8802_probe(struct pci_dev *pci_dev, INIT_LIST_HEAD(&dev->drvlist); list_add_tail(&dev->devlist,&cx8802_devlist); +#if defined(CONFIG_VIDEO_CX88_DVB) || defined(CONFIG_VIDEO_CX88_DVB_MODULE) mutex_init(&dev->frontends.lock); INIT_LIST_HEAD(&dev->frontends.felist); @@ -814,6 +818,7 @@ static int __devinit cx8802_probe(struct pci_dev *pci_dev, goto fail_free; } } +#endif /* Maintain a reference so cx88-video can query the 8802 device. */ core->dvbdev = dev; -- cgit v0.10.2 From 3007703db804b7e6e9f5e3cca9e3a661e0ff3eb2 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 21 Oct 2008 10:43:10 -0300 Subject: V4L/DVB (9333): cx88: Not all boards that requires cx88-mpeg has frontends The multifrontend changes on cx88 assumed that all boards that use cx88-mpeg supports DVB. This is not true. There also a few analog-only boards based on Blackboard design that also uses cx88-mpeg. For those boards, there's no need to allocate dvb frontends. This patch fixes videobuf allocation for those devices. Signed-off-by: Mauro Carvalho Chehab diff --git a/drivers/media/video/cx88/cx88-cards.c b/drivers/media/video/cx88/cx88-cards.c index fbc224f..5bcbb4c 100644 --- a/drivers/media/video/cx88/cx88-cards.c +++ b/drivers/media/video/cx88/cx88-cards.c @@ -3044,8 +3044,8 @@ struct cx88_core *cx88_core_create(struct pci_dev *pci, int nr) memcpy(&core->board, &cx88_boards[core->boardnr], sizeof(core->board)); - if (!core->board.num_frontends) - core->board.num_frontends=1; + if (!core->board.num_frontends && (core->board.mpeg & CX88_MPEG_DVB)) + core->board.num_frontends = 1; info_printk(core, "subsystem: %04x:%04x, board: %s [card=%d,%s], frontend(s): %d\n", pci->subsystem_vendor, pci->subsystem_device, core->board.name, diff --git a/drivers/media/video/cx88/cx88-mpeg.c b/drivers/media/video/cx88/cx88-mpeg.c index b21fd93..a1c435b 100644 --- a/drivers/media/video/cx88/cx88-mpeg.c +++ b/drivers/media/video/cx88/cx88-mpeg.c @@ -785,11 +785,6 @@ static int __devinit cx8802_probe(struct pci_dev *pci_dev, if (!core->board.mpeg) goto fail_core; - if (!core->board.num_frontends) { - printk(KERN_ERR "%s() .num_frontends should be non-zero, err = %d\n", __func__, err); - goto fail_core; - } - err = -ENOMEM; dev = kzalloc(sizeof(*dev),GFP_KERNEL); if (NULL == dev) @@ -808,7 +803,8 @@ static int __devinit cx8802_probe(struct pci_dev *pci_dev, mutex_init(&dev->frontends.lock); INIT_LIST_HEAD(&dev->frontends.felist); - printk(KERN_INFO "%s() allocating %d frontend(s)\n", __func__, core->board.num_frontends); + if (core->board.num_frontends) + printk(KERN_INFO "%s() allocating %d frontend(s)\n", __func__, core->board.num_frontends); for (i = 1; i <= core->board.num_frontends; i++) { demod = videobuf_dvb_alloc_frontend(&dev->frontends, i); -- cgit v0.10.2 From 0fcd488d8d90d2332f9ff463929ec4b7676102b6 Mon Sep 17 00:00:00 2001 From: Darron Broad Date: Tue, 21 Oct 2008 11:18:47 -0300 Subject: V4L/DVB (9334): cx88: dvb_remove debug output Add debug output for dvb_remove enter. Signed-off-by: Darron Broad Signed-off-by: Mauro Carvalho Chehab diff --git a/drivers/media/video/cx88/cx88-dvb.c b/drivers/media/video/cx88/cx88-dvb.c index 6968ab0..6170d27 100644 --- a/drivers/media/video/cx88/cx88-dvb.c +++ b/drivers/media/video/cx88/cx88-dvb.c @@ -1246,8 +1246,11 @@ fail_core: static int cx8802_dvb_remove(struct cx8802_driver *drv) { + struct cx88_core *core = drv->core; struct cx8802_dev *dev = drv->core->dvbdev; + dprintk( 1, "%s\n", __func__); + videobuf_dvb_unregister_bus(&dev->frontends); vp3054_i2c_remove(dev); -- cgit v0.10.2 From 878595f6e7225c996523965b61ce3fe29addca9d Mon Sep 17 00:00:00 2001 From: Darron Broad Date: Tue, 21 Oct 2008 11:28:46 -0300 Subject: V4L/DVB (9335): videobuf: split unregister bus creating self-contained frontend de-allocator This creates a self contained frontend de-allocator for the instances where an adapter has not been registered yet frontend de-allocation may be required. Signed-off-by: Darron Broad Signed-off-by: Mauro Carvalho Chehab diff --git a/drivers/media/video/videobuf-dvb.c b/drivers/media/video/videobuf-dvb.c index 917277d..0e7dcba 100644 --- a/drivers/media/video/videobuf-dvb.c +++ b/drivers/media/video/videobuf-dvb.c @@ -296,29 +296,7 @@ EXPORT_SYMBOL(videobuf_dvb_register_bus); void videobuf_dvb_unregister_bus(struct videobuf_dvb_frontends *f) { - struct list_head *list, *q; - struct videobuf_dvb_frontend *fe; - - mutex_lock(&f->lock); - list_for_each_safe(list, q, &f->felist) { - fe = list_entry(list, struct videobuf_dvb_frontend, felist); - if (fe->dvb.net.dvbdev) { - dvb_net_release(&fe->dvb.net); - fe->dvb.demux.dmx.remove_frontend(&fe->dvb.demux.dmx, - &fe->dvb.fe_mem); - fe->dvb.demux.dmx.remove_frontend(&fe->dvb.demux.dmx, - &fe->dvb.fe_hw); - dvb_dmxdev_release(&fe->dvb.dmxdev); - dvb_dmx_release(&fe->dvb.demux); - dvb_unregister_frontend(fe->dvb.frontend); - } - if (fe->dvb.frontend) - /* always allocated, may have been reset */ - dvb_frontend_detach(fe->dvb.frontend); - list_del(list); - kfree(fe); - } - mutex_unlock(&f->lock); + videobuf_dvb_dealloc_frontends(f); dvb_unregister_adapter(&f->adapter); } @@ -389,3 +367,31 @@ fail_alloc: return fe; } EXPORT_SYMBOL(videobuf_dvb_alloc_frontend); + +void videobuf_dvb_dealloc_frontends(struct videobuf_dvb_frontends *f) +{ + struct list_head *list, *q; + struct videobuf_dvb_frontend *fe; + + mutex_lock(&f->lock); + list_for_each_safe(list, q, &f->felist) { + fe = list_entry(list, struct videobuf_dvb_frontend, felist); + if (fe->dvb.net.dvbdev) { + dvb_net_release(&fe->dvb.net); + fe->dvb.demux.dmx.remove_frontend(&fe->dvb.demux.dmx, + &fe->dvb.fe_mem); + fe->dvb.demux.dmx.remove_frontend(&fe->dvb.demux.dmx, + &fe->dvb.fe_hw); + dvb_dmxdev_release(&fe->dvb.dmxdev); + dvb_dmx_release(&fe->dvb.demux); + dvb_unregister_frontend(fe->dvb.frontend); + } + if (fe->dvb.frontend) + /* always allocated, may have been reset */ + dvb_frontend_detach(fe->dvb.frontend); + list_del(list); /* remove list entry */ + kfree(fe); /* free frontend allocation */ + } + mutex_unlock(&f->lock); +} +EXPORT_SYMBOL(videobuf_dvb_dealloc_frontends); diff --git a/include/media/videobuf-dvb.h b/include/media/videobuf-dvb.h index 80471c2..6ba4f12 100644 --- a/include/media/videobuf-dvb.h +++ b/include/media/videobuf-dvb.h @@ -47,6 +47,7 @@ int videobuf_dvb_register_bus(struct videobuf_dvb_frontends *f, void videobuf_dvb_unregister_bus(struct videobuf_dvb_frontends *f); struct videobuf_dvb_frontend * videobuf_dvb_alloc_frontend(struct videobuf_dvb_frontends *f, int id); +void videobuf_dvb_dealloc_frontends(struct videobuf_dvb_frontends *f); struct videobuf_dvb_frontend * videobuf_dvb_get_frontend(struct videobuf_dvb_frontends *f, int id); int videobuf_dvb_find_frontend(struct videobuf_dvb_frontends *f, struct dvb_frontend *p); -- cgit v0.10.2 From becd43056c8f65e3b8510b1a8a0940683ee185a2 Mon Sep 17 00:00:00 2001 From: Darron Broad Date: Tue, 21 Oct 2008 11:47:50 -0300 Subject: V4L/DVB (9336): cx88: always de-alloc frontends on fault condition De-alloc frontends on fault condition. Signed-off-by: Darron Broad Signed-off-by: Mauro Carvalho Chehab diff --git a/drivers/media/video/cx88/cx88-dvb.c b/drivers/media/video/cx88/cx88-dvb.c index 6170d27..cf6c30d 100644 --- a/drivers/media/video/cx88/cx88-dvb.c +++ b/drivers/media/video/cx88/cx88-dvb.c @@ -789,7 +789,7 @@ static int dvb_register(struct cx8802_dev *dev) if (fe0->dvb.frontend) fe0->dvb.frontend->ops.i2c_gate_ctrl = NULL; if (attach_xc3028(0x61, dev) < 0) - return -EINVAL; + goto frontend_detach; break; case CX88_BOARD_PCHDTV_HD3000: fe0->dvb.frontend = dvb_attach(or51132_attach, &pchdtv_hd3000, @@ -1058,7 +1058,6 @@ static int dvb_register(struct cx8802_dev *dev) goto frontend_detach; core->prev_set_voltage = fe0->dvb.frontend->ops.set_voltage; fe0->dvb.frontend->ops.set_voltage = tevii_dvbs_set_voltage; - } } break; @@ -1110,10 +1109,7 @@ static int dvb_register(struct cx8802_dev *dev) &dev->pci->dev, adapter_nr, mfe_shared); frontend_detach: - if (fe0->dvb.frontend) { - dvb_frontend_detach(fe0->dvb.frontend); - fe0->dvb.frontend = NULL; - } + videobuf_dvb_dealloc_frontends(&dev->frontends); return -EINVAL; } -- cgit v0.10.2