Skip to content

Commit

Permalink
Merge branch 'bkl_removal' of git://git.kernel.org/pub/scm/linux/kern…
Browse files Browse the repository at this point in the history
…el/git/mchehab/linux-2.6

* 'bkl_removal' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6:
  [media] uvcvideo: Convert to unlocked_ioctl
  [media] uvcvideo: Lock stream mutex when accessing format-related information
  [media] uvcvideo: Move mmap() handler to uvc_queue.c
  [media] uvcvideo: Move mutex lock/unlock inside uvc_free_buffers
  [media] uvcvideo: Lock controls mutex when querying menus
  [media] v4l2-dev: fix race condition
  [media] V4L: improve the BKL replacement heuristic
  [media] v4l2-dev: use mutex_lock_interruptible instead of plain mutex_lock
  [media] cx18: convert to unlocked_ioctl
  [media] radio-timb: convert to unlocked_ioctl
  [media] sh_vou: convert to unlocked_ioctl
  [media] cafe_ccic: replace ioctl by unlocked_ioctl
  [media] et61x251_core: trivial conversion to unlocked_ioctl
  [media] sn9c102: convert to unlocked_ioctl
  [media] BKL: trivial ioctl -> unlocked_ioctl video driver conversions
  [media] typhoon: convert to unlocked_ioctl
  [media] si4713: convert to unlocked_ioctl
  [media] tea5764: convert to unlocked_ioctl
  [media] cadet: use unlocked_ioctl
  [media] BKL: trivial BKL removal from V4L2 radio drivers
  • Loading branch information
Linus Torvalds committed Dec 17, 2010
2 parents 7428081 + 673eb9f commit 8efc1a1
Show file tree
Hide file tree
Showing 38 changed files with 413 additions and 324 deletions.
16 changes: 8 additions & 8 deletions drivers/media/radio/radio-aimslab.c
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ static int vidioc_s_audio(struct file *file, void *priv,

static const struct v4l2_file_operations rtrack_fops = {
.owner = THIS_MODULE,
.ioctl = video_ioctl2,
.unlocked_ioctl = video_ioctl2,
};

static const struct v4l2_ioctl_ops rtrack_ioctl_ops = {
Expand Down Expand Up @@ -412,13 +412,6 @@ static int __init rtrack_init(void)
rt->vdev.release = video_device_release_empty;
video_set_drvdata(&rt->vdev, rt);

if (video_register_device(&rt->vdev, VFL_TYPE_RADIO, radio_nr) < 0) {
v4l2_device_unregister(&rt->v4l2_dev);
release_region(rt->io, 2);
return -EINVAL;
}
v4l2_info(v4l2_dev, "AIMSlab RadioTrack/RadioReveal card driver.\n");

/* Set up the I/O locking */

mutex_init(&rt->lock);
Expand All @@ -430,6 +423,13 @@ static int __init rtrack_init(void)
sleep_delay(2000000); /* make sure it's totally down */
outb(0xc0, rt->io); /* steady volume, mute card */

if (video_register_device(&rt->vdev, VFL_TYPE_RADIO, radio_nr) < 0) {
v4l2_device_unregister(&rt->v4l2_dev);
release_region(rt->io, 2);
return -EINVAL;
}
v4l2_info(v4l2_dev, "AIMSlab RadioTrack/RadioReveal card driver.\n");

return 0;
}

Expand Down
6 changes: 3 additions & 3 deletions drivers/media/radio/radio-aztech.c
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ static int vidioc_s_ctrl(struct file *file, void *priv,

static const struct v4l2_file_operations aztech_fops = {
.owner = THIS_MODULE,
.ioctl = video_ioctl2,
.unlocked_ioctl = video_ioctl2,
};

static const struct v4l2_ioctl_ops aztech_ioctl_ops = {
Expand Down Expand Up @@ -375,6 +375,8 @@ static int __init aztech_init(void)
az->vdev.ioctl_ops = &aztech_ioctl_ops;
az->vdev.release = video_device_release_empty;
video_set_drvdata(&az->vdev, az);
/* mute card - prevents noisy bootups */
outb(0, az->io);

if (video_register_device(&az->vdev, VFL_TYPE_RADIO, radio_nr) < 0) {
v4l2_device_unregister(v4l2_dev);
Expand All @@ -383,8 +385,6 @@ static int __init aztech_init(void)
}

v4l2_info(v4l2_dev, "Aztech radio card driver v1.00/19990224 rkroll@exploits.org\n");
/* mute card - prevents noisy bootups */
outb(0, az->io);
return 0;
}

Expand Down
12 changes: 9 additions & 3 deletions drivers/media/radio/radio-cadet.c
Original file line number Diff line number Diff line change
Expand Up @@ -328,24 +328,26 @@ static ssize_t cadet_read(struct file *file, char __user *data, size_t count, lo
unsigned char readbuf[RDS_BUFFER];
int i = 0;

mutex_lock(&dev->lock);
if (dev->rdsstat == 0) {
mutex_lock(&dev->lock);
dev->rdsstat = 1;
outb(0x80, dev->io); /* Select RDS fifo */
mutex_unlock(&dev->lock);
init_timer(&dev->readtimer);
dev->readtimer.function = cadet_handler;
dev->readtimer.data = (unsigned long)dev;
dev->readtimer.expires = jiffies + msecs_to_jiffies(50);
add_timer(&dev->readtimer);
}
if (dev->rdsin == dev->rdsout) {
mutex_unlock(&dev->lock);
if (file->f_flags & O_NONBLOCK)
return -EWOULDBLOCK;
interruptible_sleep_on(&dev->read_queue);
mutex_lock(&dev->lock);
}
while (i < count && dev->rdsin != dev->rdsout)
readbuf[i++] = dev->rdsbuf[dev->rdsout++];
mutex_unlock(&dev->lock);

if (copy_to_user(data, readbuf, i))
return -EFAULT;
Expand Down Expand Up @@ -525,21 +527,25 @@ static int cadet_open(struct file *file)
{
struct cadet *dev = video_drvdata(file);

mutex_lock(&dev->lock);
dev->users++;
if (1 == dev->users)
init_waitqueue_head(&dev->read_queue);
mutex_unlock(&dev->lock);
return 0;
}

static int cadet_release(struct file *file)
{
struct cadet *dev = video_drvdata(file);

mutex_lock(&dev->lock);
dev->users--;
if (0 == dev->users) {
del_timer_sync(&dev->readtimer);
dev->rdsstat = 0;
}
mutex_unlock(&dev->lock);
return 0;
}

Expand All @@ -559,7 +565,7 @@ static const struct v4l2_file_operations cadet_fops = {
.open = cadet_open,
.release = cadet_release,
.read = cadet_read,
.ioctl = video_ioctl2,
.unlocked_ioctl = video_ioctl2,
.poll = cadet_poll,
};

Expand Down
6 changes: 3 additions & 3 deletions drivers/media/radio/radio-gemtek-pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ MODULE_DEVICE_TABLE(pci, gemtek_pci_id);

static const struct v4l2_file_operations gemtek_pci_fops = {
.owner = THIS_MODULE,
.ioctl = video_ioctl2,
.unlocked_ioctl = video_ioctl2,
};

static const struct v4l2_ioctl_ops gemtek_pci_ioctl_ops = {
Expand Down Expand Up @@ -422,11 +422,11 @@ static int __devinit gemtek_pci_probe(struct pci_dev *pdev, const struct pci_dev
card->vdev.release = video_device_release_empty;
video_set_drvdata(&card->vdev, card);

gemtek_pci_mute(card);

if (video_register_device(&card->vdev, VFL_TYPE_RADIO, nr_radio) < 0)
goto err_video;

gemtek_pci_mute(card);

v4l2_info(v4l2_dev, "Gemtek PCI Radio (rev. %d) found at 0x%04x-0x%04x.\n",
pdev->revision, card->iobase, card->iobase + card->length - 1);

Expand Down
14 changes: 7 additions & 7 deletions drivers/media/radio/radio-gemtek.c
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ static int gemtek_probe(struct gemtek *gt)

static const struct v4l2_file_operations gemtek_fops = {
.owner = THIS_MODULE,
.ioctl = video_ioctl2,
.unlocked_ioctl = video_ioctl2,
};

static int vidioc_querycap(struct file *file, void *priv,
Expand Down Expand Up @@ -577,19 +577,19 @@ static int __init gemtek_init(void)
gt->vdev.release = video_device_release_empty;
video_set_drvdata(&gt->vdev, gt);

if (video_register_device(&gt->vdev, VFL_TYPE_RADIO, radio_nr) < 0) {
v4l2_device_unregister(v4l2_dev);
release_region(gt->io, 1);
return -EBUSY;
}

/* Set defaults */
gt->lastfreq = GEMTEK_LOWFREQ;
gt->bu2614data = 0;

if (initmute)
gemtek_mute(gt);

if (video_register_device(&gt->vdev, VFL_TYPE_RADIO, radio_nr) < 0) {
v4l2_device_unregister(v4l2_dev);
release_region(gt->io, 1);
return -EBUSY;
}

return 0;
}

Expand Down
14 changes: 6 additions & 8 deletions drivers/media/radio/radio-maestro.c
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ static int vidioc_s_audio(struct file *file, void *priv,

static const struct v4l2_file_operations maestro_fops = {
.owner = THIS_MODULE,
.ioctl = video_ioctl2,
.unlocked_ioctl = video_ioctl2,
};

static const struct v4l2_ioctl_ops maestro_ioctl_ops = {
Expand Down Expand Up @@ -383,22 +383,20 @@ static int __devinit maestro_probe(struct pci_dev *pdev,
dev->vdev.release = video_device_release_empty;
video_set_drvdata(&dev->vdev, dev);

if (!radio_power_on(dev)) {
retval = -EIO;
goto errfr1;
}

retval = video_register_device(&dev->vdev, VFL_TYPE_RADIO, radio_nr);
if (retval) {
v4l2_err(v4l2_dev, "can't register video device!\n");
goto errfr1;
}

if (!radio_power_on(dev)) {
retval = -EIO;
goto errunr;
}

v4l2_info(v4l2_dev, "version " DRIVER_VERSION "\n");

return 0;
errunr:
video_unregister_device(&dev->vdev);
errfr1:
v4l2_device_unregister(v4l2_dev);
errfr:
Expand Down
2 changes: 1 addition & 1 deletion drivers/media/radio/radio-maxiradio.c
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ static int vidioc_s_ctrl(struct file *file, void *priv,

static const struct v4l2_file_operations maxiradio_fops = {
.owner = THIS_MODULE,
.ioctl = video_ioctl2,
.unlocked_ioctl = video_ioctl2,
};

static const struct v4l2_ioctl_ops maxiradio_ioctl_ops = {
Expand Down
6 changes: 4 additions & 2 deletions drivers/media/radio/radio-miropcm20.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ struct pcm20 {
unsigned long freq;
int muted;
struct snd_miro_aci *aci;
struct mutex lock;
};

static struct pcm20 pcm20_card = {
Expand Down Expand Up @@ -72,7 +73,7 @@ static int pcm20_setfreq(struct pcm20 *dev, unsigned long freq)

static const struct v4l2_file_operations pcm20_fops = {
.owner = THIS_MODULE,
.ioctl = video_ioctl2,
.unlocked_ioctl = video_ioctl2,
};

static int vidioc_querycap(struct file *file, void *priv,
Expand Down Expand Up @@ -229,7 +230,7 @@ static int __init pcm20_init(void)
return -ENODEV;
}
strlcpy(v4l2_dev->name, "miropcm20", sizeof(v4l2_dev->name));

mutex_init(&dev->lock);

res = v4l2_device_register(NULL, v4l2_dev);
if (res < 0) {
Expand All @@ -242,6 +243,7 @@ static int __init pcm20_init(void)
dev->vdev.fops = &pcm20_fops;
dev->vdev.ioctl_ops = &pcm20_ioctl_ops;
dev->vdev.release = video_device_release_empty;
dev->vdev.lock = &dev->lock;
video_set_drvdata(&dev->vdev, dev);

if (video_register_device(&dev->vdev, VFL_TYPE_RADIO, radio_nr) < 0)
Expand Down
10 changes: 5 additions & 5 deletions drivers/media/radio/radio-rtrack2.c
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ static int vidioc_s_audio(struct file *file, void *priv,

static const struct v4l2_file_operations rtrack2_fops = {
.owner = THIS_MODULE,
.ioctl = video_ioctl2,
.unlocked_ioctl = video_ioctl2,
};

static const struct v4l2_ioctl_ops rtrack2_ioctl_ops = {
Expand Down Expand Up @@ -315,6 +315,10 @@ static int __init rtrack2_init(void)
dev->vdev.release = video_device_release_empty;
video_set_drvdata(&dev->vdev, dev);

/* mute card - prevents noisy bootups */
outb(1, dev->io);
dev->muted = 1;

mutex_init(&dev->lock);
if (video_register_device(&dev->vdev, VFL_TYPE_RADIO, radio_nr) < 0) {
v4l2_device_unregister(v4l2_dev);
Expand All @@ -324,10 +328,6 @@ static int __init rtrack2_init(void)

v4l2_info(v4l2_dev, "AIMSlab Radiotrack II card driver.\n");

/* mute card - prevents noisy bootups */
outb(1, dev->io);
dev->muted = 1;

return 0;
}

Expand Down
7 changes: 4 additions & 3 deletions drivers/media/radio/radio-sf16fmi.c
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ static int vidioc_s_audio(struct file *file, void *priv,

static const struct v4l2_file_operations fmi_fops = {
.owner = THIS_MODULE,
.ioctl = video_ioctl2,
.unlocked_ioctl = video_ioctl2,
};

static const struct v4l2_ioctl_ops fmi_ioctl_ops = {
Expand Down Expand Up @@ -382,6 +382,9 @@ static int __init fmi_init(void)

mutex_init(&fmi->lock);

/* mute card - prevents noisy bootups */
fmi_mute(fmi);

if (video_register_device(&fmi->vdev, VFL_TYPE_RADIO, radio_nr) < 0) {
v4l2_device_unregister(v4l2_dev);
release_region(fmi->io, 2);
Expand All @@ -391,8 +394,6 @@ static int __init fmi_init(void)
}

v4l2_info(v4l2_dev, "card driver at 0x%x\n", fmi->io);
/* mute card - prevents noisy bootups */
fmi_mute(fmi);
return 0;
}

Expand Down
11 changes: 5 additions & 6 deletions drivers/media/radio/radio-sf16fmr2.c
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ static int vidioc_s_audio(struct file *file, void *priv,

static const struct v4l2_file_operations fmr2_fops = {
.owner = THIS_MODULE,
.ioctl = video_ioctl2,
.unlocked_ioctl = video_ioctl2,
};

static const struct v4l2_ioctl_ops fmr2_ioctl_ops = {
Expand Down Expand Up @@ -424,18 +424,17 @@ static int __init fmr2_init(void)
fmr2->vdev.release = video_device_release_empty;
video_set_drvdata(&fmr2->vdev, fmr2);

/* mute card - prevents noisy bootups */
fmr2_mute(fmr2->io);
fmr2_product_info(fmr2);

if (video_register_device(&fmr2->vdev, VFL_TYPE_RADIO, radio_nr) < 0) {
v4l2_device_unregister(v4l2_dev);
release_region(fmr2->io, 2);
return -EINVAL;
}

v4l2_info(v4l2_dev, "SF16FMR2 radio card driver at 0x%x.\n", fmr2->io);
/* mute card - prevents noisy bootups */
mutex_lock(&fmr2->lock);
fmr2_mute(fmr2->io);
fmr2_product_info(fmr2);
mutex_unlock(&fmr2->lock);
debug_print((KERN_DEBUG "card_type %d\n", fmr2->card_type));
return 0;
}
Expand Down
3 changes: 2 additions & 1 deletion drivers/media/radio/radio-si4713.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ struct radio_si4713_device {
/* radio_si4713_fops - file operations interface */
static const struct v4l2_file_operations radio_si4713_fops = {
.owner = THIS_MODULE,
.ioctl = video_ioctl2,
/* Note: locking is done at the subdev level in the i2c driver. */
.unlocked_ioctl = video_ioctl2,
};

/* Video4Linux Interface */
Expand Down
Loading

0 comments on commit 8efc1a1

Please sign in to comment.