Skip to content

Commit

Permalink
[media] em28xx: rename struct em28xx_usb_isoc_ctl to em28xx_usb_ctl
Browse files Browse the repository at this point in the history
Also rename the corresponding field isoc_ctl in struct em28xx
to usb_ctl.
We will use this struct for USB bulk transfers, too.

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
  • Loading branch information
Frank Schaefer authored and Mauro Carvalho Chehab committed Dec 22, 2012
1 parent f0fa993 commit 74209dc
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 32 deletions.
24 changes: 12 additions & 12 deletions drivers/media/usb/em28xx/em28xx-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -941,7 +941,7 @@ static void em28xx_irq_callback(struct urb *urb)

/* Copy data from URB */
spin_lock(&dev->slock);
dev->isoc_ctl.isoc_copy(dev, urb);
dev->usb_ctl.urb_data_copy(dev, urb);
spin_unlock(&dev->slock);

/* Reset urb buffers */
Expand Down Expand Up @@ -970,9 +970,9 @@ void em28xx_uninit_isoc(struct em28xx *dev, enum em28xx_mode mode)
em28xx_isocdbg("em28xx: called em28xx_uninit_isoc in mode %d\n", mode);

if (mode == EM28XX_DIGITAL_MODE)
isoc_bufs = &dev->isoc_ctl.digital_bufs;
isoc_bufs = &dev->usb_ctl.digital_bufs;
else
isoc_bufs = &dev->isoc_ctl.analog_bufs;
isoc_bufs = &dev->usb_ctl.analog_bufs;

for (i = 0; i < isoc_bufs->num_bufs; i++) {
urb = isoc_bufs->urb[i];
Expand Down Expand Up @@ -1012,7 +1012,7 @@ void em28xx_stop_urbs(struct em28xx *dev)
{
int i;
struct urb *urb;
struct em28xx_usb_bufs *isoc_bufs = &dev->isoc_ctl.digital_bufs;
struct em28xx_usb_bufs *isoc_bufs = &dev->usb_ctl.digital_bufs;

em28xx_isocdbg("em28xx: called em28xx_stop_urbs\n");

Expand Down Expand Up @@ -1045,9 +1045,9 @@ int em28xx_alloc_isoc(struct em28xx *dev, enum em28xx_mode mode,
em28xx_isocdbg("em28xx: called em28xx_alloc_isoc in mode %d\n", mode);

if (mode == EM28XX_DIGITAL_MODE)
isoc_bufs = &dev->isoc_ctl.digital_bufs;
isoc_bufs = &dev->usb_ctl.digital_bufs;
else
isoc_bufs = &dev->isoc_ctl.analog_bufs;
isoc_bufs = &dev->usb_ctl.analog_bufs;

/* De-allocates all pending stuff */
em28xx_uninit_isoc(dev, mode);
Expand All @@ -1070,16 +1070,16 @@ int em28xx_alloc_isoc(struct em28xx *dev, enum em28xx_mode mode,

isoc_bufs->max_pkt_size = max_pkt_size;
isoc_bufs->num_packets = num_packets;
dev->isoc_ctl.vid_buf = NULL;
dev->isoc_ctl.vbi_buf = NULL;
dev->usb_ctl.vid_buf = NULL;
dev->usb_ctl.vbi_buf = NULL;

sb_size = isoc_bufs->num_packets * isoc_bufs->max_pkt_size;

/* allocate urbs and transfer buffers */
for (i = 0; i < isoc_bufs->num_bufs; i++) {
urb = usb_alloc_urb(isoc_bufs->num_packets, GFP_KERNEL);
if (!urb) {
em28xx_err("cannot alloc isoc_ctl.urb %i\n", i);
em28xx_err("cannot alloc usb_ctl.urb %i\n", i);
em28xx_uninit_isoc(dev, mode);
return -ENOMEM;
}
Expand Down Expand Up @@ -1141,14 +1141,14 @@ int em28xx_init_isoc(struct em28xx *dev, enum em28xx_mode mode,

em28xx_isocdbg("em28xx: called em28xx_init_isoc in mode %d\n", mode);

dev->isoc_ctl.isoc_copy = isoc_copy;
dev->usb_ctl.urb_data_copy = isoc_copy;

if (mode == EM28XX_DIGITAL_MODE) {
isoc_bufs = &dev->isoc_ctl.digital_bufs;
isoc_bufs = &dev->usb_ctl.digital_bufs;
/* no need to free/alloc isoc buffers in digital mode */
alloc = 0;
} else {
isoc_bufs = &dev->isoc_ctl.analog_bufs;
isoc_bufs = &dev->usb_ctl.analog_bufs;
alloc = 1;
}

Expand Down
4 changes: 2 additions & 2 deletions drivers/media/usb/em28xx/em28xx-vbi.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ free_buffer(struct videobuf_queue *vq, struct em28xx_buffer *buf)
VIDEOBUF_ACTIVE, it won't be, though.
*/
spin_lock_irqsave(&dev->slock, flags);
if (dev->isoc_ctl.vbi_buf == buf)
dev->isoc_ctl.vbi_buf = NULL;
if (dev->usb_ctl.vbi_buf == buf)
dev->usb_ctl.vbi_buf = NULL;
spin_unlock_irqrestore(&dev->slock, flags);

videobuf_vmalloc_free(&buf->vb);
Expand Down
24 changes: 12 additions & 12 deletions drivers/media/usb/em28xx/em28xx-video.c
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ static inline void buffer_filled(struct em28xx *dev,
buf->vb.field_count++;
v4l2_get_timestamp(&buf->vb.ts);

dev->isoc_ctl.vid_buf = NULL;
dev->usb_ctl.vid_buf = NULL;

list_del(&buf->vb.queue);
wake_up(&buf->vb.done);
Expand All @@ -182,7 +182,7 @@ static inline void vbi_buffer_filled(struct em28xx *dev,
buf->vb.field_count++;
v4l2_get_timestamp(&buf->vb.ts);

dev->isoc_ctl.vbi_buf = NULL;
dev->usb_ctl.vbi_buf = NULL;

list_del(&buf->vb.queue);
wake_up(&buf->vb.done);
Expand Down Expand Up @@ -368,7 +368,7 @@ static inline void get_next_buf(struct em28xx_dmaqueue *dma_q,

if (list_empty(&dma_q->active)) {
em28xx_isocdbg("No active queue to serve\n");
dev->isoc_ctl.vid_buf = NULL;
dev->usb_ctl.vid_buf = NULL;
*buf = NULL;
return;
}
Expand All @@ -380,7 +380,7 @@ static inline void get_next_buf(struct em28xx_dmaqueue *dma_q,
outp = videobuf_to_vmalloc(&(*buf)->vb);
memset(outp, 0, (*buf)->vb.size);

dev->isoc_ctl.vid_buf = *buf;
dev->usb_ctl.vid_buf = *buf;

return;
}
Expand All @@ -396,7 +396,7 @@ static inline void vbi_get_next_buf(struct em28xx_dmaqueue *dma_q,

if (list_empty(&dma_q->active)) {
em28xx_isocdbg("No active queue to serve\n");
dev->isoc_ctl.vbi_buf = NULL;
dev->usb_ctl.vbi_buf = NULL;
*buf = NULL;
return;
}
Expand All @@ -407,7 +407,7 @@ static inline void vbi_get_next_buf(struct em28xx_dmaqueue *dma_q,
outp = videobuf_to_vmalloc(&(*buf)->vb);
memset(outp, 0x00, (*buf)->vb.size);

dev->isoc_ctl.vbi_buf = *buf;
dev->usb_ctl.vbi_buf = *buf;

return;
}
Expand Down Expand Up @@ -435,7 +435,7 @@ static inline int em28xx_isoc_copy(struct em28xx *dev, struct urb *urb)
return 0;
}

buf = dev->isoc_ctl.vid_buf;
buf = dev->usb_ctl.vid_buf;
if (buf != NULL)
outp = videobuf_to_vmalloc(&buf->vb);

Expand Down Expand Up @@ -531,11 +531,11 @@ static inline int em28xx_isoc_copy_vbi(struct em28xx *dev, struct urb *urb)
return 0;
}

buf = dev->isoc_ctl.vid_buf;
buf = dev->usb_ctl.vid_buf;
if (buf != NULL)
outp = videobuf_to_vmalloc(&buf->vb);

vbi_buf = dev->isoc_ctl.vbi_buf;
vbi_buf = dev->usb_ctl.vbi_buf;
if (vbi_buf != NULL)
vbioutp = videobuf_to_vmalloc(&vbi_buf->vb);

Expand Down Expand Up @@ -725,8 +725,8 @@ static void free_buffer(struct videobuf_queue *vq, struct em28xx_buffer *buf)
VIDEOBUF_ACTIVE, it won't be, though.
*/
spin_lock_irqsave(&dev->slock, flags);
if (dev->isoc_ctl.vid_buf == buf)
dev->isoc_ctl.vid_buf = NULL;
if (dev->usb_ctl.vid_buf == buf)
dev->usb_ctl.vid_buf = NULL;
spin_unlock_irqrestore(&dev->slock, flags);

videobuf_vmalloc_free(&buf->vb);
Expand Down Expand Up @@ -758,7 +758,7 @@ buffer_prepare(struct videobuf_queue *vq, struct videobuf_buffer *vb,
goto fail;
}

if (!dev->isoc_ctl.analog_bufs.num_bufs)
if (!dev->usb_ctl.analog_bufs.num_bufs)
urb_init = 1;

if (urb_init) {
Expand Down
12 changes: 6 additions & 6 deletions drivers/media/usb/em28xx/em28xx.h
Original file line number Diff line number Diff line change
Expand Up @@ -220,19 +220,19 @@ struct em28xx_usb_bufs {
char **transfer_buffer;
};

struct em28xx_usb_isoc_ctl {
/* isoc transfer buffers for analog mode */
struct em28xx_usb_ctl {
/* isoc/bulk transfer buffers for analog mode */
struct em28xx_usb_bufs analog_bufs;

/* isoc transfer buffers for digital mode */
/* isoc/bulk transfer buffers for digital mode */
struct em28xx_usb_bufs digital_bufs;

/* Stores already requested buffers */
struct em28xx_buffer *vid_buf;
struct em28xx_buffer *vbi_buf;

/* isoc urb callback */
int (*isoc_copy) (struct em28xx *dev, struct urb *urb);
/* copy data from URB */
int (*urb_data_copy) (struct em28xx *dev, struct urb *urb);

};

Expand Down Expand Up @@ -582,7 +582,7 @@ struct em28xx {
/* Isoc control struct */
struct em28xx_dmaqueue vidq;
struct em28xx_dmaqueue vbiq;
struct em28xx_usb_isoc_ctl isoc_ctl;
struct em28xx_usb_ctl usb_ctl;
spinlock_t slock;

/* usb transfer */
Expand Down

0 comments on commit 74209dc

Please sign in to comment.