diff options
Diffstat (limited to 'drivers/media/video/pvrusb2/pvrusb2-sysfs.c')
-rw-r--r-- | drivers/media/video/pvrusb2/pvrusb2-sysfs.c | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/drivers/media/video/pvrusb2/pvrusb2-sysfs.c b/drivers/media/video/pvrusb2/pvrusb2-sysfs.c index 3c57a7d8200b..7a1cd878e31a 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-sysfs.c +++ b/drivers/media/video/pvrusb2/pvrusb2-sysfs.c | |||
@@ -43,10 +43,14 @@ struct pvr2_sysfs { | |||
43 | struct device_attribute attr_v4l_radio_minor_number; | 43 | struct device_attribute attr_v4l_radio_minor_number; |
44 | struct device_attribute attr_unit_number; | 44 | struct device_attribute attr_unit_number; |
45 | struct device_attribute attr_bus_info; | 45 | struct device_attribute attr_bus_info; |
46 | struct device_attribute attr_hdw_name; | ||
47 | struct device_attribute attr_hdw_desc; | ||
46 | int v4l_minor_number_created_ok; | 48 | int v4l_minor_number_created_ok; |
47 | int v4l_radio_minor_number_created_ok; | 49 | int v4l_radio_minor_number_created_ok; |
48 | int unit_number_created_ok; | 50 | int unit_number_created_ok; |
49 | int bus_info_created_ok; | 51 | int bus_info_created_ok; |
52 | int hdw_name_created_ok; | ||
53 | int hdw_desc_created_ok; | ||
50 | }; | 54 | }; |
51 | 55 | ||
52 | #ifdef CONFIG_VIDEO_PVRUSB2_DEBUGIFC | 56 | #ifdef CONFIG_VIDEO_PVRUSB2_DEBUGIFC |
@@ -712,6 +716,14 @@ static void class_dev_destroy(struct pvr2_sysfs *sfp) | |||
712 | pvr2_sysfs_tear_down_debugifc(sfp); | 716 | pvr2_sysfs_tear_down_debugifc(sfp); |
713 | #endif /* CONFIG_VIDEO_PVRUSB2_DEBUGIFC */ | 717 | #endif /* CONFIG_VIDEO_PVRUSB2_DEBUGIFC */ |
714 | pvr2_sysfs_tear_down_controls(sfp); | 718 | pvr2_sysfs_tear_down_controls(sfp); |
719 | if (sfp->hdw_desc_created_ok) { | ||
720 | device_remove_file(sfp->class_dev, | ||
721 | &sfp->attr_hdw_desc); | ||
722 | } | ||
723 | if (sfp->hdw_name_created_ok) { | ||
724 | device_remove_file(sfp->class_dev, | ||
725 | &sfp->attr_hdw_name); | ||
726 | } | ||
715 | if (sfp->bus_info_created_ok) { | 727 | if (sfp->bus_info_created_ok) { |
716 | device_remove_file(sfp->class_dev, | 728 | device_remove_file(sfp->class_dev, |
717 | &sfp->attr_bus_info); | 729 | &sfp->attr_bus_info); |
@@ -758,6 +770,28 @@ static ssize_t bus_info_show(struct device *class_dev, | |||
758 | } | 770 | } |
759 | 771 | ||
760 | 772 | ||
773 | static ssize_t hdw_name_show(struct device *class_dev, | ||
774 | struct device_attribute *attr, char *buf) | ||
775 | { | ||
776 | struct pvr2_sysfs *sfp; | ||
777 | sfp = (struct pvr2_sysfs *)class_dev->driver_data; | ||
778 | if (!sfp) return -EINVAL; | ||
779 | return scnprintf(buf,PAGE_SIZE,"%s\n", | ||
780 | pvr2_hdw_get_type(sfp->channel.hdw)); | ||
781 | } | ||
782 | |||
783 | |||
784 | static ssize_t hdw_desc_show(struct device *class_dev, | ||
785 | struct device_attribute *attr, char *buf) | ||
786 | { | ||
787 | struct pvr2_sysfs *sfp; | ||
788 | sfp = (struct pvr2_sysfs *)class_dev->driver_data; | ||
789 | if (!sfp) return -EINVAL; | ||
790 | return scnprintf(buf,PAGE_SIZE,"%s\n", | ||
791 | pvr2_hdw_get_desc(sfp->channel.hdw)); | ||
792 | } | ||
793 | |||
794 | |||
761 | static ssize_t v4l_radio_minor_number_show(struct device *class_dev, | 795 | static ssize_t v4l_radio_minor_number_show(struct device *class_dev, |
762 | struct device_attribute *attr, | 796 | struct device_attribute *attr, |
763 | char *buf) | 797 | char *buf) |
@@ -871,6 +905,32 @@ static void class_dev_create(struct pvr2_sysfs *sfp, | |||
871 | sfp->bus_info_created_ok = !0; | 905 | sfp->bus_info_created_ok = !0; |
872 | } | 906 | } |
873 | 907 | ||
908 | sfp->attr_hdw_name.attr.name = "device_hardware_type"; | ||
909 | sfp->attr_hdw_name.attr.mode = S_IRUGO; | ||
910 | sfp->attr_hdw_name.show = hdw_name_show; | ||
911 | sfp->attr_hdw_name.store = NULL; | ||
912 | ret = device_create_file(sfp->class_dev, | ||
913 | &sfp->attr_hdw_name); | ||
914 | if (ret < 0) { | ||
915 | printk(KERN_WARNING "%s: device_create_file error: %d\n", | ||
916 | __FUNCTION__, ret); | ||
917 | } else { | ||
918 | sfp->hdw_name_created_ok = !0; | ||
919 | } | ||
920 | |||
921 | sfp->attr_hdw_desc.attr.name = "device_hardware_description"; | ||
922 | sfp->attr_hdw_desc.attr.mode = S_IRUGO; | ||
923 | sfp->attr_hdw_desc.show = hdw_desc_show; | ||
924 | sfp->attr_hdw_desc.store = NULL; | ||
925 | ret = device_create_file(sfp->class_dev, | ||
926 | &sfp->attr_hdw_desc); | ||
927 | if (ret < 0) { | ||
928 | printk(KERN_WARNING "%s: device_create_file error: %d\n", | ||
929 | __FUNCTION__, ret); | ||
930 | } else { | ||
931 | sfp->hdw_desc_created_ok = !0; | ||
932 | } | ||
933 | |||
874 | pvr2_sysfs_add_controls(sfp); | 934 | pvr2_sysfs_add_controls(sfp); |
875 | #ifdef CONFIG_VIDEO_PVRUSB2_DEBUGIFC | 935 | #ifdef CONFIG_VIDEO_PVRUSB2_DEBUGIFC |
876 | pvr2_sysfs_add_debugifc(sfp); | 936 | pvr2_sysfs_add_debugifc(sfp); |