diff options
Diffstat (limited to 'drivers/media/video/pvrusb2/pvrusb2-sysfs.c')
-rw-r--r-- | drivers/media/video/pvrusb2/pvrusb2-sysfs.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/drivers/media/video/pvrusb2/pvrusb2-sysfs.c b/drivers/media/video/pvrusb2/pvrusb2-sysfs.c index 71f50565f637..3d7e5aab547f 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-sysfs.c +++ b/drivers/media/video/pvrusb2/pvrusb2-sysfs.c | |||
@@ -74,7 +74,7 @@ struct pvr2_sysfs_ctl_item { | |||
74 | int ctl_id; | 74 | int ctl_id; |
75 | struct pvr2_sysfs *chptr; | 75 | struct pvr2_sysfs *chptr; |
76 | struct pvr2_sysfs_ctl_item *item_next; | 76 | struct pvr2_sysfs_ctl_item *item_next; |
77 | struct attribute *attr_gen[7]; | 77 | struct attribute *attr_gen[8]; |
78 | struct attribute_group grp; | 78 | struct attribute_group grp; |
79 | int created_ok; | 79 | int created_ok; |
80 | char name[80]; | 80 | char name[80]; |
@@ -511,6 +511,7 @@ static void pvr2_sysfs_release(struct device *class_dev) | |||
511 | 511 | ||
512 | static void class_dev_destroy(struct pvr2_sysfs *sfp) | 512 | static void class_dev_destroy(struct pvr2_sysfs *sfp) |
513 | { | 513 | { |
514 | struct device *dev; | ||
514 | if (!sfp->class_dev) return; | 515 | if (!sfp->class_dev) return; |
515 | #ifdef CONFIG_VIDEO_PVRUSB2_DEBUGIFC | 516 | #ifdef CONFIG_VIDEO_PVRUSB2_DEBUGIFC |
516 | pvr2_sysfs_tear_down_debugifc(sfp); | 517 | pvr2_sysfs_tear_down_debugifc(sfp); |
@@ -542,6 +543,9 @@ static void class_dev_destroy(struct pvr2_sysfs *sfp) | |||
542 | } | 543 | } |
543 | pvr2_sysfs_trace("Destroying class_dev id=%p",sfp->class_dev); | 544 | pvr2_sysfs_trace("Destroying class_dev id=%p",sfp->class_dev); |
544 | dev_set_drvdata(sfp->class_dev, NULL); | 545 | dev_set_drvdata(sfp->class_dev, NULL); |
546 | dev = sfp->class_dev->parent; | ||
547 | sfp->class_dev->parent = NULL; | ||
548 | put_device(dev); | ||
545 | device_unregister(sfp->class_dev); | 549 | device_unregister(sfp->class_dev); |
546 | sfp->class_dev = NULL; | 550 | sfp->class_dev = NULL; |
547 | } | 551 | } |
@@ -631,10 +635,11 @@ static void class_dev_create(struct pvr2_sysfs *sfp, | |||
631 | pvr2_sysfs_trace("Creating class_dev id=%p",class_dev); | 635 | pvr2_sysfs_trace("Creating class_dev id=%p",class_dev); |
632 | 636 | ||
633 | class_dev->class = &class_ptr->class; | 637 | class_dev->class = &class_ptr->class; |
638 | |||
634 | dev_set_name(class_dev, "%s", | 639 | dev_set_name(class_dev, "%s", |
635 | pvr2_hdw_get_device_identifier(sfp->channel.hdw)); | 640 | pvr2_hdw_get_device_identifier(sfp->channel.hdw)); |
636 | 641 | ||
637 | class_dev->parent = &usb_dev->dev; | 642 | class_dev->parent = get_device(&usb_dev->dev); |
638 | 643 | ||
639 | sfp->class_dev = class_dev; | 644 | sfp->class_dev = class_dev; |
640 | dev_set_drvdata(class_dev, sfp); | 645 | dev_set_drvdata(class_dev, sfp); |
@@ -775,7 +780,8 @@ struct pvr2_sysfs_class *pvr2_sysfs_class_create(void) | |||
775 | struct pvr2_sysfs_class *clp; | 780 | struct pvr2_sysfs_class *clp; |
776 | clp = kzalloc(sizeof(*clp),GFP_KERNEL); | 781 | clp = kzalloc(sizeof(*clp),GFP_KERNEL); |
777 | if (!clp) return clp; | 782 | if (!clp) return clp; |
778 | pvr2_sysfs_trace("Creating pvr2_sysfs_class id=%p",clp); | 783 | pvr2_sysfs_trace("Creating and registering pvr2_sysfs_class id=%p", |
784 | clp); | ||
779 | clp->class.name = "pvrusb2"; | 785 | clp->class.name = "pvrusb2"; |
780 | clp->class.class_release = pvr2_sysfs_class_release; | 786 | clp->class.class_release = pvr2_sysfs_class_release; |
781 | clp->class.dev_release = pvr2_sysfs_release; | 787 | clp->class.dev_release = pvr2_sysfs_release; |
@@ -791,6 +797,7 @@ struct pvr2_sysfs_class *pvr2_sysfs_class_create(void) | |||
791 | 797 | ||
792 | void pvr2_sysfs_class_destroy(struct pvr2_sysfs_class *clp) | 798 | void pvr2_sysfs_class_destroy(struct pvr2_sysfs_class *clp) |
793 | { | 799 | { |
800 | pvr2_sysfs_trace("Unregistering pvr2_sysfs_class id=%p", clp); | ||
794 | class_unregister(&clp->class); | 801 | class_unregister(&clp->class); |
795 | } | 802 | } |
796 | 803 | ||