Commit 3d05913d authored by Andy Walls's avatar Andy Walls Committed by Mauro Carvalho Chehab

V4L/DVB (10280): cx18: Rename structure members: dev to pci_dev and v4l2dev to video_dev

Renamed structure member name to be more specific to type in anticipation
of updating to the v4l2_device/v4l2_subdev framework.  Too many objects named
"dev" and /v4l2_\{0,1\}dev/ would be to confusing.
Signed-off-by: default avatarAndy Walls <awalls@radix.net>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent e0f28b6a
...@@ -36,7 +36,7 @@ int cx18_av_loadfw(struct cx18 *cx) ...@@ -36,7 +36,7 @@ int cx18_av_loadfw(struct cx18 *cx)
int i; int i;
int retries1 = 0; int retries1 = 0;
if (request_firmware(&fw, FWFILE, &cx->dev->dev) != 0) { if (request_firmware(&fw, FWFILE, &cx->pci_dev->dev) != 0) {
CX18_ERR("unable to open firmware %s\n", FWFILE); CX18_ERR("unable to open firmware %s\n", FWFILE);
return -EINVAL; return -EINVAL;
} }
......
...@@ -502,7 +502,7 @@ static void cx18_process_options(struct cx18 *cx) ...@@ -502,7 +502,7 @@ static void cx18_process_options(struct cx18 *cx)
else if (cx->options.cardtype != 0) else if (cx->options.cardtype != 0)
CX18_ERR("Unknown user specified type, trying to autodetect card\n"); CX18_ERR("Unknown user specified type, trying to autodetect card\n");
if (cx->card == NULL) { if (cx->card == NULL) {
if (cx->dev->subsystem_vendor == CX18_PCI_ID_HAUPPAUGE) { if (cx->pci_dev->subsystem_vendor == CX18_PCI_ID_HAUPPAUGE) {
cx->card = cx18_get_card(CX18_CARD_HVR_1600_ESMT); cx->card = cx18_get_card(CX18_CARD_HVR_1600_ESMT);
CX18_INFO("Autodetected Hauppauge card\n"); CX18_INFO("Autodetected Hauppauge card\n");
} }
...@@ -512,13 +512,13 @@ static void cx18_process_options(struct cx18 *cx) ...@@ -512,13 +512,13 @@ static void cx18_process_options(struct cx18 *cx)
if (cx->card->pci_list == NULL) if (cx->card->pci_list == NULL)
continue; continue;
for (j = 0; cx->card->pci_list[j].device; j++) { for (j = 0; cx->card->pci_list[j].device; j++) {
if (cx->dev->device != if (cx->pci_dev->device !=
cx->card->pci_list[j].device) cx->card->pci_list[j].device)
continue; continue;
if (cx->dev->subsystem_vendor != if (cx->pci_dev->subsystem_vendor !=
cx->card->pci_list[j].subsystem_vendor) cx->card->pci_list[j].subsystem_vendor)
continue; continue;
if (cx->dev->subsystem_device != if (cx->pci_dev->subsystem_device !=
cx->card->pci_list[j].subsystem_device) cx->card->pci_list[j].subsystem_device)
continue; continue;
CX18_INFO("Autodetected %s card\n", cx->card->name); CX18_INFO("Autodetected %s card\n", cx->card->name);
...@@ -531,9 +531,10 @@ static void cx18_process_options(struct cx18 *cx) ...@@ -531,9 +531,10 @@ static void cx18_process_options(struct cx18 *cx)
if (cx->card == NULL) { if (cx->card == NULL) {
cx->card = cx18_get_card(CX18_CARD_HVR_1600_ESMT); cx->card = cx18_get_card(CX18_CARD_HVR_1600_ESMT);
CX18_ERR("Unknown card: vendor/device: [%04x:%04x]\n", CX18_ERR("Unknown card: vendor/device: [%04x:%04x]\n",
cx->dev->vendor, cx->dev->device); cx->pci_dev->vendor, cx->pci_dev->device);
CX18_ERR(" subsystem vendor/device: [%04x:%04x]\n", CX18_ERR(" subsystem vendor/device: [%04x:%04x]\n",
cx->dev->subsystem_vendor, cx->dev->subsystem_device); cx->pci_dev->subsystem_vendor,
cx->pci_dev->subsystem_device);
CX18_ERR("Defaulting to %s card\n", cx->card->name); CX18_ERR("Defaulting to %s card\n", cx->card->name);
CX18_ERR("Please mail the vendor/device and subsystem vendor/device IDs and what kind of\n"); CX18_ERR("Please mail the vendor/device and subsystem vendor/device IDs and what kind of\n");
CX18_ERR("card you have to the ivtv-devel mailinglist (www.ivtvdriver.org)\n"); CX18_ERR("card you have to the ivtv-devel mailinglist (www.ivtvdriver.org)\n");
...@@ -553,7 +554,7 @@ static int __devinit cx18_init_struct1(struct cx18 *cx) ...@@ -553,7 +554,7 @@ static int __devinit cx18_init_struct1(struct cx18 *cx)
{ {
int i; int i;
cx->base_addr = pci_resource_start(cx->dev, 0); cx->base_addr = pci_resource_start(cx->pci_dev, 0);
mutex_init(&cx->serialize_lock); mutex_init(&cx->serialize_lock);
mutex_init(&cx->i2c_bus_lock[0]); mutex_init(&cx->i2c_bus_lock[0]);
...@@ -676,7 +677,7 @@ static void __devinit cx18_init_struct2(struct cx18 *cx) ...@@ -676,7 +677,7 @@ static void __devinit cx18_init_struct2(struct cx18 *cx)
cx->av_state.vbi_line_offset = 8; cx->av_state.vbi_line_offset = 8;
} }
static int cx18_setup_pci(struct cx18 *cx, struct pci_dev *dev, static int cx18_setup_pci(struct cx18 *cx, struct pci_dev *pci_dev,
const struct pci_device_id *pci_id) const struct pci_device_id *pci_id)
{ {
u16 cmd; u16 cmd;
...@@ -684,11 +685,11 @@ static int cx18_setup_pci(struct cx18 *cx, struct pci_dev *dev, ...@@ -684,11 +685,11 @@ static int cx18_setup_pci(struct cx18 *cx, struct pci_dev *dev,
CX18_DEBUG_INFO("Enabling pci device\n"); CX18_DEBUG_INFO("Enabling pci device\n");
if (pci_enable_device(dev)) { if (pci_enable_device(pci_dev)) {
CX18_ERR("Can't enable device %d!\n", cx->num); CX18_ERR("Can't enable device %d!\n", cx->num);
return -EIO; return -EIO;
} }
if (pci_set_dma_mask(dev, 0xffffffff)) { if (pci_set_dma_mask(pci_dev, 0xffffffff)) {
CX18_ERR("No suitable DMA available on card %d.\n", cx->num); CX18_ERR("No suitable DMA available on card %d.\n", cx->num);
return -EIO; return -EIO;
} }
...@@ -698,25 +699,25 @@ static int cx18_setup_pci(struct cx18 *cx, struct pci_dev *dev, ...@@ -698,25 +699,25 @@ static int cx18_setup_pci(struct cx18 *cx, struct pci_dev *dev,
} }
/* Enable bus mastering and memory mapped IO for the CX23418 */ /* Enable bus mastering and memory mapped IO for the CX23418 */
pci_read_config_word(dev, PCI_COMMAND, &cmd); pci_read_config_word(pci_dev, PCI_COMMAND, &cmd);
cmd |= PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER; cmd |= PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER;
pci_write_config_word(dev, PCI_COMMAND, cmd); pci_write_config_word(pci_dev, PCI_COMMAND, cmd);
pci_read_config_byte(dev, PCI_CLASS_REVISION, &cx->card_rev); pci_read_config_byte(pci_dev, PCI_CLASS_REVISION, &cx->card_rev);
pci_read_config_byte(dev, PCI_LATENCY_TIMER, &pci_latency); pci_read_config_byte(pci_dev, PCI_LATENCY_TIMER, &pci_latency);
if (pci_latency < 64 && cx18_pci_latency) { if (pci_latency < 64 && cx18_pci_latency) {
CX18_INFO("Unreasonably low latency timer, " CX18_INFO("Unreasonably low latency timer, "
"setting to 64 (was %d)\n", pci_latency); "setting to 64 (was %d)\n", pci_latency);
pci_write_config_byte(dev, PCI_LATENCY_TIMER, 64); pci_write_config_byte(pci_dev, PCI_LATENCY_TIMER, 64);
pci_read_config_byte(dev, PCI_LATENCY_TIMER, &pci_latency); pci_read_config_byte(pci_dev, PCI_LATENCY_TIMER, &pci_latency);
} }
CX18_DEBUG_INFO("cx%d (rev %d) at %02x:%02x.%x, " CX18_DEBUG_INFO("cx%d (rev %d) at %02x:%02x.%x, "
"irq: %d, latency: %d, memory: 0x%lx\n", "irq: %d, latency: %d, memory: 0x%lx\n",
cx->dev->device, cx->card_rev, dev->bus->number, cx->pci_dev->device, cx->card_rev, pci_dev->bus->number,
PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn), PCI_SLOT(pci_dev->devfn), PCI_FUNC(pci_dev->devfn),
cx->dev->irq, pci_latency, (unsigned long)cx->base_addr); cx->pci_dev->irq, pci_latency, (unsigned long)cx->base_addr);
return 0; return 0;
} }
...@@ -771,7 +772,7 @@ static void cx18_load_and_init_modules(struct cx18 *cx) ...@@ -771,7 +772,7 @@ static void cx18_load_and_init_modules(struct cx18 *cx)
hw = cx->hw_flags; hw = cx->hw_flags;
} }
static int __devinit cx18_probe(struct pci_dev *dev, static int __devinit cx18_probe(struct pci_dev *pci_dev,
const struct pci_device_id *pci_id) const struct pci_device_id *pci_id)
{ {
int retval = 0; int retval = 0;
...@@ -796,7 +797,7 @@ static int __devinit cx18_probe(struct pci_dev *dev, ...@@ -796,7 +797,7 @@ static int __devinit cx18_probe(struct pci_dev *dev,
return -ENOMEM; return -ENOMEM;
} }
cx18_cards[cx18_cards_active] = cx; cx18_cards[cx18_cards_active] = cx;
cx->dev = dev; cx->pci_dev = pci_dev;
cx->num = cx18_cards_active++; cx->num = cx18_cards_active++;
snprintf(cx->name, sizeof(cx->name), "cx18-%d", cx->num); snprintf(cx->name, sizeof(cx->name), "cx18-%d", cx->num);
CX18_INFO("Initializing card #%d\n", cx->num); CX18_INFO("Initializing card #%d\n", cx->num);
...@@ -816,12 +817,12 @@ static int __devinit cx18_probe(struct pci_dev *dev, ...@@ -816,12 +817,12 @@ static int __devinit cx18_probe(struct pci_dev *dev,
CX18_DEBUG_INFO("base addr: 0x%08x\n", cx->base_addr); CX18_DEBUG_INFO("base addr: 0x%08x\n", cx->base_addr);
/* PCI Device Setup */ /* PCI Device Setup */
retval = cx18_setup_pci(cx, dev, pci_id); retval = cx18_setup_pci(cx, pci_dev, pci_id);
if (retval != 0) if (retval != 0)
goto free_workqueue; goto free_workqueue;
/* save cx in the pci struct for later use */ /* save cx in the pci struct for later use */
pci_set_drvdata(dev, cx); pci_set_drvdata(pci_dev, cx);
/* map io memory */ /* map io memory */
CX18_DEBUG_INFO("attempting ioremap at 0x%08x len 0x%08x\n", CX18_DEBUG_INFO("attempting ioremap at 0x%08x len 0x%08x\n",
...@@ -881,7 +882,7 @@ static int __devinit cx18_probe(struct pci_dev *dev, ...@@ -881,7 +882,7 @@ static int __devinit cx18_probe(struct pci_dev *dev,
cx18_init_scb(cx); cx18_init_scb(cx);
/* Register IRQ */ /* Register IRQ */
retval = request_irq(cx->dev->irq, cx18_irq_handler, retval = request_irq(cx->pci_dev->irq, cx18_irq_handler,
IRQF_SHARED | IRQF_DISABLED, cx->name, (void *)cx); IRQF_SHARED | IRQF_DISABLED, cx->name, (void *)cx);
if (retval) { if (retval) {
CX18_ERR("Failed to register irq %d\n", retval); CX18_ERR("Failed to register irq %d\n", retval);
...@@ -992,7 +993,7 @@ static int __devinit cx18_probe(struct pci_dev *dev, ...@@ -992,7 +993,7 @@ static int __devinit cx18_probe(struct pci_dev *dev,
free_streams: free_streams:
cx18_streams_cleanup(cx, 1); cx18_streams_cleanup(cx, 1);
free_irq: free_irq:
free_irq(cx->dev->irq, (void *)cx); free_irq(cx->pci_dev->irq, (void *)cx);
free_i2c: free_i2c:
exit_cx18_i2c(cx); exit_cx18_i2c(cx);
free_map: free_map:
...@@ -1128,13 +1129,13 @@ static void cx18_remove(struct pci_dev *pci_dev) ...@@ -1128,13 +1129,13 @@ static void cx18_remove(struct pci_dev *pci_dev)
exit_cx18_i2c(cx); exit_cx18_i2c(cx);
free_irq(cx->dev->irq, (void *)cx); free_irq(cx->pci_dev->irq, (void *)cx);
cx18_iounmap(cx); cx18_iounmap(cx);
release_mem_region(cx->base_addr, CX18_MEM_SIZE); release_mem_region(cx->base_addr, CX18_MEM_SIZE);
pci_disable_device(cx->dev); pci_disable_device(cx->pci_dev);
CX18_INFO("Removed %s, card #%d\n", cx->card_name, cx->num); CX18_INFO("Removed %s, card #%d\n", cx->card_name, cx->num);
} }
......
...@@ -279,7 +279,7 @@ struct cx18_epu_work_order { ...@@ -279,7 +279,7 @@ struct cx18_epu_work_order {
struct cx18_stream { struct cx18_stream {
/* These first four fields are always set, even if the stream /* These first four fields are always set, even if the stream
is not actually created. */ is not actually created. */
struct video_device *v4l2dev; /* NULL when stream not created */ struct video_device *video_dev; /* NULL when stream not created */
struct cx18 *cx; /* for ease of use */ struct cx18 *cx; /* for ease of use */
const char *name; /* name of the stream */ const char *name; /* name of the stream */
int type; /* stream type */ int type; /* stream type */
...@@ -385,7 +385,7 @@ struct cx18_i2c_algo_callback_data { ...@@ -385,7 +385,7 @@ struct cx18_i2c_algo_callback_data {
struct cx18 { struct cx18 {
int num; /* board number, -1 during init! */ int num; /* board number, -1 during init! */
char name[8]; /* board name for printk and interrupts (e.g. 'cx180') */ char name[8]; /* board name for printk and interrupts (e.g. 'cx180') */
struct pci_dev *dev; /* PCI device */ struct pci_dev *pci_dev;
const struct cx18_card *card; /* card information */ const struct cx18_card *card; /* card information */
const char *card_name; /* full name of the card */ const char *card_name; /* full name of the card */
const struct cx18_card_tuner_i2c *card_i2c; /* i2c addresses to probe for tuner */ const struct cx18_card_tuner_i2c *card_i2c; /* i2c addresses to probe for tuner */
......
...@@ -167,7 +167,7 @@ int cx18_dvb_register(struct cx18_stream *stream) ...@@ -167,7 +167,7 @@ int cx18_dvb_register(struct cx18_stream *stream)
ret = dvb_register_adapter(&dvb->dvb_adapter, ret = dvb_register_adapter(&dvb->dvb_adapter,
CX18_DRIVER_NAME, CX18_DRIVER_NAME,
THIS_MODULE, &cx->dev->dev, adapter_nr); THIS_MODULE, &cx->pci_dev->dev, adapter_nr);
if (ret < 0) if (ret < 0)
goto err_out; goto err_out;
......
...@@ -665,7 +665,7 @@ int cx18_v4l2_open(struct file *filp) ...@@ -665,7 +665,7 @@ int cx18_v4l2_open(struct file *filp)
if (cx18_cards[x] == NULL) if (cx18_cards[x] == NULL)
continue; continue;
s = &cx18_cards[x]->streams[y]; s = &cx18_cards[x]->streams[y];
if (s->v4l2dev && s->v4l2dev->minor == minor) { if (s->video_dev && s->video_dev->minor == minor) {
cx = cx18_cards[x]; cx = cx18_cards[x];
break; break;
} }
......
...@@ -107,7 +107,7 @@ static int load_cpu_fw_direct(const char *fn, u8 __iomem *mem, struct cx18 *cx) ...@@ -107,7 +107,7 @@ static int load_cpu_fw_direct(const char *fn, u8 __iomem *mem, struct cx18 *cx)
u32 __iomem *dst = (u32 __iomem *)mem; u32 __iomem *dst = (u32 __iomem *)mem;
const u32 *src; const u32 *src;
if (request_firmware(&fw, fn, &cx->dev->dev)) { if (request_firmware(&fw, fn, &cx->pci_dev->dev)) {
CX18_ERR("Unable to open firmware %s\n", fn); CX18_ERR("Unable to open firmware %s\n", fn);
CX18_ERR("Did you put the firmware in the hotplug firmware directory?\n"); CX18_ERR("Did you put the firmware in the hotplug firmware directory?\n");
return -ENOMEM; return -ENOMEM;
...@@ -151,7 +151,7 @@ static int load_apu_fw_direct(const char *fn, u8 __iomem *dst, struct cx18 *cx, ...@@ -151,7 +151,7 @@ static int load_apu_fw_direct(const char *fn, u8 __iomem *dst, struct cx18 *cx,
u32 apu_version = 0; u32 apu_version = 0;
int sz; int sz;
if (request_firmware(&fw, fn, &cx->dev->dev)) { if (request_firmware(&fw, fn, &cx->pci_dev->dev)) {
CX18_ERR("unable to open firmware %s\n", fn); CX18_ERR("unable to open firmware %s\n", fn);
CX18_ERR("did you put the firmware in the hotplug firmware directory?\n"); CX18_ERR("did you put the firmware in the hotplug firmware directory?\n");
cx18_setup_page(cx, 0); cx18_setup_page(cx, 0);
......
...@@ -366,7 +366,7 @@ int init_cx18_i2c(struct cx18 *cx) ...@@ -366,7 +366,7 @@ int init_cx18_i2c(struct cx18 *cx)
sprintf(cx->i2c_client[i].name + sprintf(cx->i2c_client[i].name +
strlen(cx->i2c_client[i].name), "%d", i); strlen(cx->i2c_client[i].name), "%d", i);
cx->i2c_client[i].adapter = &cx->i2c_adap[i]; cx->i2c_client[i].adapter = &cx->i2c_adap[i];
cx->i2c_adap[i].dev.parent = &cx->dev->dev; cx->i2c_adap[i].dev.parent = &cx->pci_dev->dev;
} }
if (cx18_read_reg(cx, CX18_REG_I2C_2_WR) != 0x0003c02f) { if (cx18_read_reg(cx, CX18_REG_I2C_2_WR) != 0x0003c02f) {
......
...@@ -335,7 +335,8 @@ static int cx18_querycap(struct file *file, void *fh, ...@@ -335,7 +335,8 @@ static int cx18_querycap(struct file *file, void *fh,
strlcpy(vcap->driver, CX18_DRIVER_NAME, sizeof(vcap->driver)); strlcpy(vcap->driver, CX18_DRIVER_NAME, sizeof(vcap->driver));
strlcpy(vcap->card, cx->card_name, sizeof(vcap->card)); strlcpy(vcap->card, cx->card_name, sizeof(vcap->card));
snprintf(vcap->bus_info, sizeof(vcap->bus_info), "PCI:%s", pci_name(cx->dev)); snprintf(vcap->bus_info, sizeof(vcap->bus_info),
"PCI:%s", pci_name(cx->pci_dev));
vcap->version = CX18_DRIVER_VERSION; /* version */ vcap->version = CX18_DRIVER_VERSION; /* version */
vcap->capabilities = cx->v4l2_cap; /* capabilities */ vcap->capabilities = cx->v4l2_cap; /* capabilities */
return 0; return 0;
...@@ -732,7 +733,7 @@ static int cx18_log_status(struct file *file, void *fh) ...@@ -732,7 +733,7 @@ static int cx18_log_status(struct file *file, void *fh)
for (i = 0; i < CX18_MAX_STREAMS; i++) { for (i = 0; i < CX18_MAX_STREAMS; i++) {
struct cx18_stream *s = &cx->streams[i]; struct cx18_stream *s = &cx->streams[i];
if (s->v4l2dev == NULL || s->buffers == 0) if (s->video_dev == NULL || s->buffers == 0)
continue; continue;
CX18_INFO("Stream %s: status 0x%04lx, %d%% of %d KiB (%d buffers) in use\n", CX18_INFO("Stream %s: status 0x%04lx, %d%% of %d KiB (%d buffers) in use\n",
s->name, s->s_flags, s->name, s->s_flags,
......
...@@ -204,7 +204,7 @@ int cx18_stream_alloc(struct cx18_stream *s) ...@@ -204,7 +204,7 @@ int cx18_stream_alloc(struct cx18_stream *s)
} }
buf->id = cx->buffer_id++; buf->id = cx->buffer_id++;
INIT_LIST_HEAD(&buf->list); INIT_LIST_HEAD(&buf->list);
buf->dma_handle = pci_map_single(s->cx->dev, buf->dma_handle = pci_map_single(s->cx->pci_dev,
buf->buf, s->buf_size, s->dma); buf->buf, s->buf_size, s->dma);
cx18_buf_sync_for_cpu(s, buf); cx18_buf_sync_for_cpu(s, buf);
cx18_enqueue(s, buf, &s->q_free); cx18_enqueue(s, buf, &s->q_free);
...@@ -227,7 +227,7 @@ void cx18_stream_free(struct cx18_stream *s) ...@@ -227,7 +227,7 @@ void cx18_stream_free(struct cx18_stream *s)
/* empty q_free */ /* empty q_free */
while ((buf = cx18_dequeue(s, &s->q_free))) { while ((buf = cx18_dequeue(s, &s->q_free))) {
pci_unmap_single(s->cx->dev, buf->dma_handle, pci_unmap_single(s->cx->pci_dev, buf->dma_handle,
s->buf_size, s->dma); s->buf_size, s->dma);
kfree(buf->buf); kfree(buf->buf);
kfree(buf); kfree(buf);
......
...@@ -29,14 +29,14 @@ ...@@ -29,14 +29,14 @@
static inline void cx18_buf_sync_for_cpu(struct cx18_stream *s, static inline void cx18_buf_sync_for_cpu(struct cx18_stream *s,
struct cx18_buffer *buf) struct cx18_buffer *buf)
{ {
pci_dma_sync_single_for_cpu(s->cx->dev, buf->dma_handle, pci_dma_sync_single_for_cpu(s->cx->pci_dev, buf->dma_handle,
s->buf_size, s->dma); s->buf_size, s->dma);
} }
static inline void cx18_buf_sync_for_device(struct cx18_stream *s, static inline void cx18_buf_sync_for_device(struct cx18_stream *s,
struct cx18_buffer *buf) struct cx18_buffer *buf)
{ {
pci_dma_sync_single_for_device(s->cx->dev, buf->dma_handle, pci_dma_sync_single_for_device(s->cx->pci_dev, buf->dma_handle,
s->buf_size, s->dma); s->buf_size, s->dma);
} }
......
...@@ -101,11 +101,11 @@ static struct { ...@@ -101,11 +101,11 @@ static struct {
static void cx18_stream_init(struct cx18 *cx, int type) static void cx18_stream_init(struct cx18 *cx, int type)
{ {
struct cx18_stream *s = &cx->streams[type]; struct cx18_stream *s = &cx->streams[type];
struct video_device *dev = s->v4l2dev; struct video_device *video_dev = s->video_dev;
/* we need to keep v4l2dev, so restore it afterwards */ /* we need to keep video_dev, so restore it afterwards */
memset(s, 0, sizeof(*s)); memset(s, 0, sizeof(*s));
s->v4l2dev = dev; s->video_dev = video_dev;
/* initialize cx18_stream fields */ /* initialize cx18_stream fields */
s->cx = cx; s->cx = cx;
...@@ -132,10 +132,10 @@ static int cx18_prep_dev(struct cx18 *cx, int type) ...@@ -132,10 +132,10 @@ static int cx18_prep_dev(struct cx18 *cx, int type)
int num_offset = cx18_stream_info[type].num_offset; int num_offset = cx18_stream_info[type].num_offset;
int num = cx->num + cx18_first_minor + num_offset; int num = cx->num + cx18_first_minor + num_offset;
/* These four fields are always initialized. If v4l2dev == NULL, then /* These four fields are always initialized. If video_dev == NULL, then
this stream is not in use. In that case no other fields but these this stream is not in use. In that case no other fields but these
four can be used. */ four can be used. */
s->v4l2dev = NULL; s->video_dev = NULL;
s->cx = cx; s->cx = cx;
s->type = type; s->type = type;
s->name = cx18_stream_info[type].name; s->name = cx18_stream_info[type].name;
...@@ -163,22 +163,22 @@ static int cx18_prep_dev(struct cx18 *cx, int type) ...@@ -163,22 +163,22 @@ static int cx18_prep_dev(struct cx18 *cx, int type)
return 0; return 0;
/* allocate and initialize the v4l2 video device structure */ /* allocate and initialize the v4l2 video device structure */
s->v4l2dev = video_device_alloc(); s->video_dev = video_device_alloc();
if (s->v4l2dev == NULL) { if (s->video_dev == NULL) {
CX18_ERR("Couldn't allocate v4l2 video_device for %s\n", CX18_ERR("Couldn't allocate v4l2 video_device for %s\n",
s->name); s->name);
return -ENOMEM; return -ENOMEM;
} }
snprintf(s->v4l2dev->name, sizeof(s->v4l2dev->name), "cx18-%d", snprintf(s->video_dev->name, sizeof(s->video_dev->name), "cx18-%d",
cx->num); cx->num);
s->v4l2dev->num = num; s->video_dev->num = num;
s->v4l2dev->parent = &cx->dev->dev; s->video_dev->parent = &cx->pci_dev->dev;
s->v4l2dev->fops = &cx18_v4l2_enc_fops; s->video_dev->fops = &cx18_v4l2_enc_fops;
s->v4l2dev->release = video_device_release; s->video_dev->release = video_device_release;
s->v4l2dev->tvnorms = V4L2_STD_ALL; s->video_dev->tvnorms = V4L2_STD_ALL;
cx18_set_funcs(s->v4l2dev); cx18_set_funcs(s->video_dev);
return 0; return 0;
} }
...@@ -227,28 +227,29 @@ static int cx18_reg_dev(struct cx18 *cx, int type) ...@@ -227,28 +227,29 @@ static int cx18_reg_dev(struct cx18 *cx, int type)
} }
} }
if (s->v4l2dev == NULL) if (s->video_dev == NULL)
return 0; return 0;
num = s->v4l2dev->num; num = s->video_dev->num;
/* card number + user defined offset + device offset */ /* card number + user defined offset + device offset */
if (type != CX18_ENC_STREAM_TYPE_MPG) { if (type != CX18_ENC_STREAM_TYPE_MPG) {
struct cx18_stream *s_mpg = &cx->streams[CX18_ENC_STREAM_TYPE_MPG]; struct cx18_stream *s_mpg = &cx->streams[CX18_ENC_STREAM_TYPE_MPG];
if (s_mpg->v4l2dev) if (s_mpg->video_dev)
num = s_mpg->v4l2dev->num + cx18_stream_info[type].num_offset; num = s_mpg->video_dev->num
+ cx18_stream_info[type].num_offset;
} }
/* Register device. First try the desired minor, then any free one. */ /* Register device. First try the desired minor, then any free one. */
ret = video_register_device(s->v4l2dev, vfl_type, num); ret = video_register_device(s->video_dev, vfl_type, num);
if (ret < 0) { if (ret < 0) {
CX18_ERR("Couldn't register v4l2 device for %s kernel number %d\n", CX18_ERR("Couldn't register v4l2 device for %s kernel number %d\n",
s->name, num); s->name, num);
video_device_release(s->v4l2dev); video_device_release(s->video_dev);
s->v4l2dev = NULL; s->video_dev = NULL;
return ret; return ret;
} }
num = s->v4l2dev->num; num = s->video_dev->num;
switch (vfl_type) { switch (vfl_type) {
case VFL_TYPE_GRABBER: case VFL_TYPE_GRABBER:
...@@ -312,9 +313,9 @@ void cx18_streams_cleanup(struct cx18 *cx, int unregister) ...@@ -312,9 +313,9 @@ void cx18_streams_cleanup(struct cx18 *cx, int unregister)
cx->streams[type].dvb.enabled = false; cx->streams[type].dvb.enabled = false;
} }
vdev = cx->streams[type].v4l2dev; vdev = cx->streams[type].video_dev;
cx->streams[type].v4l2dev = NULL; cx->streams[type].video_dev = NULL;
if (vdev == NULL) if (vdev == NULL)
continue; continue;
...@@ -437,7 +438,7 @@ int cx18_start_v4l2_encode_stream(struct cx18_stream *s) ...@@ -437,7 +438,7 @@ int cx18_start_v4l2_encode_stream(struct cx18_stream *s)
int ts = 0; int ts = 0;
int captype = 0; int captype = 0;
if (s->v4l2dev == NULL && s->dvb.enabled == 0) if (s->video_dev == NULL && s->dvb.enabled == 0)
return -EINVAL; return -EINVAL;
CX18_DEBUG_INFO("Start encoder stream %s\n", s->name); CX18_DEBUG_INFO("Start encoder stream %s\n", s->name);
...@@ -565,7 +566,7 @@ void cx18_stop_all_captures(struct cx18 *cx) ...@@ -565,7 +566,7 @@ void cx18_stop_all_captures(struct cx18 *cx)
for (i = CX18_MAX_STREAMS - 1; i >= 0; i--) { for (i = CX18_MAX_STREAMS - 1; i >= 0; i--) {
struct cx18_stream *s = &cx->streams[i]; struct cx18_stream *s = &cx->streams[i];
if (s->v4l2dev == NULL && s->dvb.enabled == 0) if (s->video_dev == NULL && s->dvb.enabled == 0)
continue; continue;
if (test_bit(CX18_F_S_STREAMING, &s->s_flags)) if (test_bit(CX18_F_S_STREAMING, &s->s_flags))
cx18_stop_v4l2_encode_stream(s, 0); cx18_stop_v4l2_encode_stream(s, 0);
...@@ -577,7 +578,7 @@ int cx18_stop_v4l2_encode_stream(struct cx18_stream *s, int gop_end) ...@@ -577,7 +578,7 @@ int cx18_stop_v4l2_encode_stream(struct cx18_stream *s, int gop_end)
struct cx18 *cx = s->cx; struct cx18 *cx = s->cx;
unsigned long then; unsigned long then;
if (s->v4l2dev == NULL && s->dvb.enabled == 0) if (s->video_dev == NULL && s->dvb.enabled == 0)
return -EINVAL; return -EINVAL;
/* This function assumes that you are allowed to stop the capture /* This function assumes that you are allowed to stop the capture
...@@ -629,7 +630,7 @@ u32 cx18_find_handle(struct cx18 *cx) ...@@ -629,7 +630,7 @@ u32 cx18_find_handle(struct cx18 *cx)
for (i = 0; i < CX18_MAX_STREAMS; i++) { for (i = 0; i < CX18_MAX_STREAMS; i++) {
struct cx18_stream *s = &cx->streams[i]; struct cx18_stream *s = &cx->streams[i];
if (s->v4l2dev && (s->handle != CX18_INVALID_TASK_HANDLE)) if (s->video_dev && (s->handle != CX18_INVALID_TASK_HANDLE))
return s->handle; return s->handle;
} }
return CX18_INVALID_TASK_HANDLE; return CX18_INVALID_TASK_HANDLE;
...@@ -647,7 +648,7 @@ struct cx18_stream *cx18_handle_to_stream(struct cx18 *cx, u32 handle) ...@@ -647,7 +648,7 @@ struct cx18_stream *cx18_handle_to_stream(struct cx18 *cx, u32 handle)
s = &cx->streams[i]; s = &cx->streams[i];
if (s->handle != handle) if (s->handle != handle)
continue; continue;
if (s->v4l2dev || s->dvb.enabled) if (s->video_dev || s->dvb.enabled)
return s; return s;
} }
return NULL; return NULL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment