diff options
Diffstat (limited to 'drivers/media/radio/dsbr100.c')
-rw-r--r-- | drivers/media/radio/dsbr100.c | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/drivers/media/radio/dsbr100.c b/drivers/media/radio/dsbr100.c index 70c65a745923..66783fffe4c1 100644 --- a/drivers/media/radio/dsbr100.c +++ b/drivers/media/radio/dsbr100.c | |||
@@ -274,7 +274,7 @@ static int vidioc_querycap(struct file *file, void *priv, | |||
274 | static int vidioc_g_tuner(struct file *file, void *priv, | 274 | static int vidioc_g_tuner(struct file *file, void *priv, |
275 | struct v4l2_tuner *v) | 275 | struct v4l2_tuner *v) |
276 | { | 276 | { |
277 | struct dsbr100_device *radio = video_get_drvdata(video_devdata(file)); | 277 | struct dsbr100_device *radio = video_drvdata(file); |
278 | 278 | ||
279 | if (v->index > 0) | 279 | if (v->index > 0) |
280 | return -EINVAL; | 280 | return -EINVAL; |
@@ -306,7 +306,7 @@ static int vidioc_s_tuner(struct file *file, void *priv, | |||
306 | static int vidioc_s_frequency(struct file *file, void *priv, | 306 | static int vidioc_s_frequency(struct file *file, void *priv, |
307 | struct v4l2_frequency *f) | 307 | struct v4l2_frequency *f) |
308 | { | 308 | { |
309 | struct dsbr100_device *radio = video_get_drvdata(video_devdata(file)); | 309 | struct dsbr100_device *radio = video_drvdata(file); |
310 | 310 | ||
311 | radio->curfreq = f->frequency; | 311 | radio->curfreq = f->frequency; |
312 | if (dsbr100_setfreq(radio, radio->curfreq)==-1) | 312 | if (dsbr100_setfreq(radio, radio->curfreq)==-1) |
@@ -317,7 +317,7 @@ static int vidioc_s_frequency(struct file *file, void *priv, | |||
317 | static int vidioc_g_frequency(struct file *file, void *priv, | 317 | static int vidioc_g_frequency(struct file *file, void *priv, |
318 | struct v4l2_frequency *f) | 318 | struct v4l2_frequency *f) |
319 | { | 319 | { |
320 | struct dsbr100_device *radio = video_get_drvdata(video_devdata(file)); | 320 | struct dsbr100_device *radio = video_drvdata(file); |
321 | 321 | ||
322 | f->type = V4L2_TUNER_RADIO; | 322 | f->type = V4L2_TUNER_RADIO; |
323 | f->frequency = radio->curfreq; | 323 | f->frequency = radio->curfreq; |
@@ -342,7 +342,7 @@ static int vidioc_queryctrl(struct file *file, void *priv, | |||
342 | static int vidioc_g_ctrl(struct file *file, void *priv, | 342 | static int vidioc_g_ctrl(struct file *file, void *priv, |
343 | struct v4l2_control *ctrl) | 343 | struct v4l2_control *ctrl) |
344 | { | 344 | { |
345 | struct dsbr100_device *radio = video_get_drvdata(video_devdata(file)); | 345 | struct dsbr100_device *radio = video_drvdata(file); |
346 | 346 | ||
347 | switch (ctrl->id) { | 347 | switch (ctrl->id) { |
348 | case V4L2_CID_AUDIO_MUTE: | 348 | case V4L2_CID_AUDIO_MUTE: |
@@ -355,16 +355,20 @@ static int vidioc_g_ctrl(struct file *file, void *priv, | |||
355 | static int vidioc_s_ctrl(struct file *file, void *priv, | 355 | static int vidioc_s_ctrl(struct file *file, void *priv, |
356 | struct v4l2_control *ctrl) | 356 | struct v4l2_control *ctrl) |
357 | { | 357 | { |
358 | struct dsbr100_device *radio = video_get_drvdata(video_devdata(file)); | 358 | struct dsbr100_device *radio = video_drvdata(file); |
359 | 359 | ||
360 | switch (ctrl->id) { | 360 | switch (ctrl->id) { |
361 | case V4L2_CID_AUDIO_MUTE: | 361 | case V4L2_CID_AUDIO_MUTE: |
362 | if (ctrl->value) { | 362 | if (ctrl->value) { |
363 | if (dsbr100_stop(radio)==-1) | 363 | if (dsbr100_stop(radio) == -1) { |
364 | warn("Radio did not respond properly"); | 364 | warn("Radio did not respond properly"); |
365 | return -EBUSY; | ||
366 | } | ||
365 | } else { | 367 | } else { |
366 | if (dsbr100_start(radio)==-1) | 368 | if (dsbr100_start(radio) == -1) { |
367 | warn("Radio did not respond properly"); | 369 | warn("Radio did not respond properly"); |
370 | return -EBUSY; | ||
371 | } | ||
368 | } | 372 | } |
369 | return 0; | 373 | return 0; |
370 | } | 374 | } |
@@ -405,23 +409,26 @@ static int vidioc_s_audio(struct file *file, void *priv, | |||
405 | 409 | ||
406 | static int usb_dsbr100_open(struct inode *inode, struct file *file) | 410 | static int usb_dsbr100_open(struct inode *inode, struct file *file) |
407 | { | 411 | { |
408 | struct dsbr100_device *radio=video_get_drvdata(video_devdata(file)); | 412 | struct dsbr100_device *radio = video_drvdata(file); |
409 | 413 | ||
414 | lock_kernel(); | ||
410 | radio->users = 1; | 415 | radio->users = 1; |
411 | radio->muted = 1; | 416 | radio->muted = 1; |
412 | 417 | ||
413 | if (dsbr100_start(radio)<0) { | 418 | if (dsbr100_start(radio)<0) { |
414 | warn("Radio did not start up properly"); | 419 | warn("Radio did not start up properly"); |
415 | radio->users = 0; | 420 | radio->users = 0; |
421 | unlock_kernel(); | ||
416 | return -EIO; | 422 | return -EIO; |
417 | } | 423 | } |
418 | dsbr100_setfreq(radio, radio->curfreq); | 424 | dsbr100_setfreq(radio, radio->curfreq); |
425 | unlock_kernel(); | ||
419 | return 0; | 426 | return 0; |
420 | } | 427 | } |
421 | 428 | ||
422 | static int usb_dsbr100_close(struct inode *inode, struct file *file) | 429 | static int usb_dsbr100_close(struct inode *inode, struct file *file) |
423 | { | 430 | { |
424 | struct dsbr100_device *radio=video_get_drvdata(video_devdata(file)); | 431 | struct dsbr100_device *radio = video_drvdata(file); |
425 | 432 | ||
426 | if (!radio) | 433 | if (!radio) |
427 | return -ENODEV; | 434 | return -ENODEV; |
@@ -507,7 +514,8 @@ static int usb_dsbr100_probe(struct usb_interface *intf, | |||
507 | static int __init dsbr100_init(void) | 514 | static int __init dsbr100_init(void) |
508 | { | 515 | { |
509 | int retval = usb_register(&usb_dsbr100_driver); | 516 | int retval = usb_register(&usb_dsbr100_driver); |
510 | info(DRIVER_VERSION ":" DRIVER_DESC); | 517 | printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":" |
518 | DRIVER_DESC "\n"); | ||
511 | return retval; | 519 | return retval; |
512 | } | 520 | } |
513 | 521 | ||