Skip to content

Commit

Permalink
V4L/DVB (10280): cx18: Rename structure members: dev to pci_dev and v…
Browse files Browse the repository at this point in the history
…4l2dev 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: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
  • Loading branch information
Andy Walls authored and Mauro Carvalho Chehab committed Mar 30, 2009
1 parent e0f28b6 commit 3d05913
Show file tree
Hide file tree
Showing 11 changed files with 73 additions and 70 deletions.
2 changes: 1 addition & 1 deletion drivers/media/video/cx18/cx18-av-firmware.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ int cx18_av_loadfw(struct cx18 *cx)
int i;
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);
return -EINVAL;
}
Expand Down
55 changes: 28 additions & 27 deletions drivers/media/video/cx18/cx18-driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ static void cx18_process_options(struct cx18 *cx)
else if (cx->options.cardtype != 0)
CX18_ERR("Unknown user specified type, trying to autodetect card\n");
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);
CX18_INFO("Autodetected Hauppauge card\n");
}
Expand All @@ -512,13 +512,13 @@ static void cx18_process_options(struct cx18 *cx)
if (cx->card->pci_list == NULL)
continue;
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)
continue;
if (cx->dev->subsystem_vendor !=
if (cx->pci_dev->subsystem_vendor !=
cx->card->pci_list[j].subsystem_vendor)
continue;
if (cx->dev->subsystem_device !=
if (cx->pci_dev->subsystem_device !=
cx->card->pci_list[j].subsystem_device)
continue;
CX18_INFO("Autodetected %s card\n", cx->card->name);
Expand All @@ -531,9 +531,10 @@ static void cx18_process_options(struct cx18 *cx)
if (cx->card == NULL) {
cx->card = cx18_get_card(CX18_CARD_HVR_1600_ESMT);
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",
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("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");
Expand All @@ -553,7 +554,7 @@ static int __devinit cx18_init_struct1(struct cx18 *cx)
{
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->i2c_bus_lock[0]);
Expand Down Expand Up @@ -676,19 +677,19 @@ static void __devinit cx18_init_struct2(struct cx18 *cx)
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)
{
u16 cmd;
unsigned char pci_latency;

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);
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);
return -EIO;
}
Expand All @@ -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 */
pci_read_config_word(dev, PCI_COMMAND, &cmd);
pci_read_config_word(pci_dev, PCI_COMMAND, &cmd);
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(dev, PCI_LATENCY_TIMER, &pci_latency);
pci_read_config_byte(pci_dev, PCI_CLASS_REVISION, &cx->card_rev);
pci_read_config_byte(pci_dev, PCI_LATENCY_TIMER, &pci_latency);

if (pci_latency < 64 && cx18_pci_latency) {
CX18_INFO("Unreasonably low latency timer, "
"setting to 64 (was %d)\n", pci_latency);
pci_write_config_byte(dev, PCI_LATENCY_TIMER, 64);
pci_read_config_byte(dev, PCI_LATENCY_TIMER, &pci_latency);
pci_write_config_byte(pci_dev, PCI_LATENCY_TIMER, 64);
pci_read_config_byte(pci_dev, PCI_LATENCY_TIMER, &pci_latency);
}

CX18_DEBUG_INFO("cx%d (rev %d) at %02x:%02x.%x, "
"irq: %d, latency: %d, memory: 0x%lx\n",
cx->dev->device, cx->card_rev, dev->bus->number,
PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn),
cx->dev->irq, pci_latency, (unsigned long)cx->base_addr);
cx->pci_dev->device, cx->card_rev, pci_dev->bus->number,
PCI_SLOT(pci_dev->devfn), PCI_FUNC(pci_dev->devfn),
cx->pci_dev->irq, pci_latency, (unsigned long)cx->base_addr);

return 0;
}
Expand Down Expand Up @@ -771,7 +772,7 @@ static void cx18_load_and_init_modules(struct cx18 *cx)
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)
{
int retval = 0;
Expand All @@ -796,7 +797,7 @@ static int __devinit cx18_probe(struct pci_dev *dev,
return -ENOMEM;
}
cx18_cards[cx18_cards_active] = cx;
cx->dev = dev;
cx->pci_dev = pci_dev;
cx->num = cx18_cards_active++;
snprintf(cx->name, sizeof(cx->name), "cx18-%d", cx->num);
CX18_INFO("Initializing card #%d\n", cx->num);
Expand All @@ -816,12 +817,12 @@ static int __devinit cx18_probe(struct pci_dev *dev,
CX18_DEBUG_INFO("base addr: 0x%08x\n", cx->base_addr);

/* PCI Device Setup */
retval = cx18_setup_pci(cx, dev, pci_id);
retval = cx18_setup_pci(cx, pci_dev, pci_id);
if (retval != 0)
goto free_workqueue;

/* save cx in the pci struct for later use */
pci_set_drvdata(dev, cx);
pci_set_drvdata(pci_dev, cx);

/* map io memory */
CX18_DEBUG_INFO("attempting ioremap at 0x%08x len 0x%08x\n",
Expand Down Expand Up @@ -881,7 +882,7 @@ static int __devinit cx18_probe(struct pci_dev *dev,
cx18_init_scb(cx);

/* 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);
if (retval) {
CX18_ERR("Failed to register irq %d\n", retval);
Expand Down Expand Up @@ -992,7 +993,7 @@ static int __devinit cx18_probe(struct pci_dev *dev,
free_streams:
cx18_streams_cleanup(cx, 1);
free_irq:
free_irq(cx->dev->irq, (void *)cx);
free_irq(cx->pci_dev->irq, (void *)cx);
free_i2c:
exit_cx18_i2c(cx);
free_map:
Expand Down Expand Up @@ -1128,13 +1129,13 @@ static void cx18_remove(struct pci_dev *pci_dev)

exit_cx18_i2c(cx);

free_irq(cx->dev->irq, (void *)cx);
free_irq(cx->pci_dev->irq, (void *)cx);

cx18_iounmap(cx);

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);
}
Expand Down
4 changes: 2 additions & 2 deletions drivers/media/video/cx18/cx18-driver.h
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ struct cx18_epu_work_order {
struct cx18_stream {
/* These first four fields are always set, even if the stream
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 */
const char *name; /* name of the stream */
int type; /* stream type */
Expand Down Expand Up @@ -385,7 +385,7 @@ struct cx18_i2c_algo_callback_data {
struct cx18 {
int num; /* board number, -1 during init! */
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 char *card_name; /* full name of the card */
const struct cx18_card_tuner_i2c *card_i2c; /* i2c addresses to probe for tuner */
Expand Down
2 changes: 1 addition & 1 deletion drivers/media/video/cx18/cx18-dvb.c
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ int cx18_dvb_register(struct cx18_stream *stream)

ret = dvb_register_adapter(&dvb->dvb_adapter,
CX18_DRIVER_NAME,
THIS_MODULE, &cx->dev->dev, adapter_nr);
THIS_MODULE, &cx->pci_dev->dev, adapter_nr);
if (ret < 0)
goto err_out;

Expand Down
2 changes: 1 addition & 1 deletion drivers/media/video/cx18/cx18-fileops.c
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,7 @@ int cx18_v4l2_open(struct file *filp)
if (cx18_cards[x] == NULL)
continue;
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];
break;
}
Expand Down
4 changes: 2 additions & 2 deletions drivers/media/video/cx18/cx18-firmware.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
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("Did you put the firmware in the hotplug firmware directory?\n");
return -ENOMEM;
Expand Down Expand Up @@ -151,7 +151,7 @@ static int load_apu_fw_direct(const char *fn, u8 __iomem *dst, struct cx18 *cx,
u32 apu_version = 0;
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("did you put the firmware in the hotplug firmware directory?\n");
cx18_setup_page(cx, 0);
Expand Down
2 changes: 1 addition & 1 deletion drivers/media/video/cx18/cx18-i2c.c
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ int init_cx18_i2c(struct cx18 *cx)
sprintf(cx->i2c_client[i].name +
strlen(cx->i2c_client[i].name), "%d", 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) {
Expand Down
5 changes: 3 additions & 2 deletions drivers/media/video/cx18/cx18-ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,8 @@ static int cx18_querycap(struct file *file, void *fh,

strlcpy(vcap->driver, CX18_DRIVER_NAME, sizeof(vcap->driver));
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->capabilities = cx->v4l2_cap; /* capabilities */
return 0;
Expand Down Expand Up @@ -732,7 +733,7 @@ static int cx18_log_status(struct file *file, void *fh)
for (i = 0; i < CX18_MAX_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;
CX18_INFO("Stream %s: status 0x%04lx, %d%% of %d KiB (%d buffers) in use\n",
s->name, s->s_flags,
Expand Down
4 changes: 2 additions & 2 deletions drivers/media/video/cx18/cx18-queue.c
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ int cx18_stream_alloc(struct cx18_stream *s)
}
buf->id = cx->buffer_id++;
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);
cx18_buf_sync_for_cpu(s, buf);
cx18_enqueue(s, buf, &s->q_free);
Expand All @@ -227,7 +227,7 @@ void cx18_stream_free(struct cx18_stream *s)

/* empty 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);
kfree(buf->buf);
kfree(buf);
Expand Down
4 changes: 2 additions & 2 deletions drivers/media/video/cx18/cx18-queue.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@
static inline void cx18_buf_sync_for_cpu(struct cx18_stream *s,
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);
}

static inline void cx18_buf_sync_for_device(struct cx18_stream *s,
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);
}

Expand Down
Loading

0 comments on commit 3d05913

Please sign in to comment.