int initialized;
 };
 
-#define vdev_to_amradio(r) container_of(r, struct amradio_device, videodev)
+static inline struct amradio_device *to_amradio_dev(struct v4l2_device *v4l2_dev)
+{
+       return container_of(v4l2_dev, struct amradio_device, v4l2_dev);
+}
 
 /* USB Device ID List */
 static struct usb_device_id usb_amradio_device_table[] = {
  */
 static void usb_amradio_disconnect(struct usb_interface *intf)
 {
-       struct amradio_device *radio = usb_get_intfdata(intf);
+       struct amradio_device *radio = to_amradio_dev(usb_get_intfdata(intf));
 
        mutex_lock(&radio->lock);
        radio->usbdev = NULL;
        mutex_unlock(&radio->lock);
 
-       usb_set_intfdata(intf, NULL);
        v4l2_device_disconnect(&radio->v4l2_dev);
        video_unregister_device(&radio->videodev);
 }
 /* open device - amradio_start() and amradio_setfreq() */
 static int usb_amradio_open(struct file *file)
 {
-       struct amradio_device *radio = vdev_to_amradio(video_devdata(file));
+       struct amradio_device *radio = video_drvdata(file);
        int retval = 0;
 
        mutex_lock(&radio->lock);
 /* Suspend device - stop device. Need to be checked and fixed */
 static int usb_amradio_suspend(struct usb_interface *intf, pm_message_t message)
 {
-       struct amradio_device *radio = usb_get_intfdata(intf);
+       struct amradio_device *radio = to_amradio_dev(usb_get_intfdata(intf));
 
        mutex_lock(&radio->lock);
 
 /* Resume device - start device. Need to be checked and fixed */
 static int usb_amradio_resume(struct usb_interface *intf)
 {
-       struct amradio_device *radio = usb_get_intfdata(intf);
+       struct amradio_device *radio = to_amradio_dev(usb_get_intfdata(intf));
 
        mutex_lock(&radio->lock);
 
 
 static void usb_amradio_video_device_release(struct video_device *videodev)
 {
-       struct amradio_device *radio = vdev_to_amradio(videodev);
-
-       v4l2_device_unregister(&radio->v4l2_dev);
+       struct amradio_device *radio = video_get_drvdata(videodev);
 
        /* free rest memory */
        kfree(radio->buffer);
                goto err_vdev;
        }
 
-       usb_set_intfdata(intf, radio);
        return 0;
 
 err_vdev: