aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2010-05-02 04:36:32 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2010-05-19 11:58:56 -0400
commita2bdc5e6c4fefea6b0d576a4f610e47456647577 (patch)
tree95d012afdaecf271af65ed5ed8b47c36339ba23a /drivers/media
parentdd0daf2a6fb6bec436a3ef68bd585ea09a2a54b7 (diff)
V4L/DVB: radio-am800: let v4l2_device_(un)register handle usb_get/set_intfdata
v4l2_device_register already sets the usb intfdata to v4l2_dev. So use that instead. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/radio/radio-mr800.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/drivers/media/radio/radio-mr800.c b/drivers/media/radio/radio-mr800.c
index 02a9cefc9a00..353b82855949 100644
--- a/drivers/media/radio/radio-mr800.c
+++ b/drivers/media/radio/radio-mr800.c
@@ -144,7 +144,10 @@ struct amradio_device {
144 int initialized; 144 int initialized;
145}; 145};
146 146
147#define vdev_to_amradio(r) container_of(r, struct amradio_device, videodev) 147static inline struct amradio_device *to_amradio_dev(struct v4l2_device *v4l2_dev)
148{
149 return container_of(v4l2_dev, struct amradio_device, v4l2_dev);
150}
148 151
149/* USB Device ID List */ 152/* USB Device ID List */
150static struct usb_device_id usb_amradio_device_table[] = { 153static struct usb_device_id usb_amradio_device_table[] = {
@@ -284,13 +287,12 @@ static int amradio_set_stereo(struct amradio_device *radio, char argument)
284 */ 287 */
285static void usb_amradio_disconnect(struct usb_interface *intf) 288static void usb_amradio_disconnect(struct usb_interface *intf)
286{ 289{
287 struct amradio_device *radio = usb_get_intfdata(intf); 290 struct amradio_device *radio = to_amradio_dev(usb_get_intfdata(intf));
288 291
289 mutex_lock(&radio->lock); 292 mutex_lock(&radio->lock);
290 radio->usbdev = NULL; 293 radio->usbdev = NULL;
291 mutex_unlock(&radio->lock); 294 mutex_unlock(&radio->lock);
292 295
293 usb_set_intfdata(intf, NULL);
294 v4l2_device_disconnect(&radio->v4l2_dev); 296 v4l2_device_disconnect(&radio->v4l2_dev);
295 video_unregister_device(&radio->videodev); 297 video_unregister_device(&radio->videodev);
296} 298}
@@ -500,7 +502,7 @@ out:
500/* open device - amradio_start() and amradio_setfreq() */ 502/* open device - amradio_start() and amradio_setfreq() */
501static int usb_amradio_open(struct file *file) 503static int usb_amradio_open(struct file *file)
502{ 504{
503 struct amradio_device *radio = vdev_to_amradio(video_devdata(file)); 505 struct amradio_device *radio = video_drvdata(file);
504 int retval = 0; 506 int retval = 0;
505 507
506 mutex_lock(&radio->lock); 508 mutex_lock(&radio->lock);
@@ -566,7 +568,7 @@ unlock:
566/* Suspend device - stop device. Need to be checked and fixed */ 568/* Suspend device - stop device. Need to be checked and fixed */
567static int usb_amradio_suspend(struct usb_interface *intf, pm_message_t message) 569static int usb_amradio_suspend(struct usb_interface *intf, pm_message_t message)
568{ 570{
569 struct amradio_device *radio = usb_get_intfdata(intf); 571 struct amradio_device *radio = to_amradio_dev(usb_get_intfdata(intf));
570 572
571 mutex_lock(&radio->lock); 573 mutex_lock(&radio->lock);
572 574
@@ -584,7 +586,7 @@ static int usb_amradio_suspend(struct usb_interface *intf, pm_message_t message)
584/* Resume device - start device. Need to be checked and fixed */ 586/* Resume device - start device. Need to be checked and fixed */
585static int usb_amradio_resume(struct usb_interface *intf) 587static int usb_amradio_resume(struct usb_interface *intf)
586{ 588{
587 struct amradio_device *radio = usb_get_intfdata(intf); 589 struct amradio_device *radio = to_amradio_dev(usb_get_intfdata(intf));
588 590
589 mutex_lock(&radio->lock); 591 mutex_lock(&radio->lock);
590 592
@@ -633,9 +635,7 @@ static const struct v4l2_ioctl_ops usb_amradio_ioctl_ops = {
633 635
634static void usb_amradio_video_device_release(struct video_device *videodev) 636static void usb_amradio_video_device_release(struct video_device *videodev)
635{ 637{
636 struct amradio_device *radio = vdev_to_amradio(videodev); 638 struct amradio_device *radio = video_get_drvdata(videodev);
637
638 v4l2_device_unregister(&radio->v4l2_dev);
639 639
640 /* free rest memory */ 640 /* free rest memory */
641 kfree(radio->buffer); 641 kfree(radio->buffer);
@@ -693,7 +693,6 @@ static int usb_amradio_probe(struct usb_interface *intf,
693 goto err_vdev; 693 goto err_vdev;
694 } 694 }
695 695
696 usb_set_intfdata(intf, radio);
697 return 0; 696 return 0;
698 697
699err_vdev: 698err_vdev: