diff options
author | Kay Sievers <kay.sievers@vrfy.org> | 2007-10-08 15:26:13 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2007-10-09 23:03:14 -0400 |
commit | 54bd5b66c87d14e250f108aad1228b905d6882f6 (patch) | |
tree | 2ecb78046819e2c9da176a74e4e9fbc8097031be /drivers | |
parent | d4cae5a50021271b9ef4e5e39e71e177d12fa8cb (diff) |
V4L/DVB (6293): V4L: convert struct class_device to struct device
The currently used "struct class_device" will be removed from the
kernel. Here is a patch that converts all users in drivers/media/video/
to struct device.
Reviewed-by: Thierry Merle <thierry.merle@free.fr>
Reviewed-by: Mike Isely <isely@pobox.com>
Reviewed-by: Luca Risolia <luca.risolia@studio.unibo.it>
Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/media/video/bt8xx/bttv-driver.c | 11 | ||||
-rw-r--r-- | drivers/media/video/et61x251/et61x251_core.c | 58 | ||||
-rw-r--r-- | drivers/media/video/ov511.c | 81 | ||||
-rw-r--r-- | drivers/media/video/pvrusb2/pvrusb2-sysfs.c | 210 | ||||
-rw-r--r-- | drivers/media/video/pwc/pwc-if.c | 31 | ||||
-rw-r--r-- | drivers/media/video/sn9c102/sn9c102_core.c | 112 | ||||
-rw-r--r-- | drivers/media/video/stv680.c | 51 | ||||
-rw-r--r-- | drivers/media/video/usbvision/usbvision-video.c | 119 | ||||
-rw-r--r-- | drivers/media/video/videodev.c | 40 |
9 files changed, 379 insertions, 334 deletions
diff --git a/drivers/media/video/bt8xx/bttv-driver.c b/drivers/media/video/bt8xx/bttv-driver.c index 4ab4e14b5c64..49278537eec4 100644 --- a/drivers/media/video/bt8xx/bttv-driver.c +++ b/drivers/media/video/bt8xx/bttv-driver.c | |||
@@ -154,13 +154,14 @@ MODULE_LICENSE("GPL"); | |||
154 | /* ----------------------------------------------------------------------- */ | 154 | /* ----------------------------------------------------------------------- */ |
155 | /* sysfs */ | 155 | /* sysfs */ |
156 | 156 | ||
157 | static ssize_t show_card(struct class_device *cd, char *buf) | 157 | static ssize_t show_card(struct device *cd, |
158 | struct device_attribute *attr, char *buf) | ||
158 | { | 159 | { |
159 | struct video_device *vfd = to_video_device(cd); | 160 | struct video_device *vfd = to_video_device(cd); |
160 | struct bttv *btv = dev_get_drvdata(vfd->dev); | 161 | struct bttv *btv = dev_get_drvdata(vfd->dev); |
161 | return sprintf(buf, "%d\n", btv ? btv->c.type : UNSET); | 162 | return sprintf(buf, "%d\n", btv ? btv->c.type : UNSET); |
162 | } | 163 | } |
163 | static CLASS_DEVICE_ATTR(card, S_IRUGO, show_card, NULL); | 164 | static DEVICE_ATTR(card, S_IRUGO, show_card, NULL); |
164 | 165 | ||
165 | /* ----------------------------------------------------------------------- */ | 166 | /* ----------------------------------------------------------------------- */ |
166 | /* dvb auto-load setup */ | 167 | /* dvb auto-load setup */ |
@@ -4615,9 +4616,9 @@ static int __devinit bttv_register_video(struct bttv *btv) | |||
4615 | goto err; | 4616 | goto err; |
4616 | printk(KERN_INFO "bttv%d: registered device video%d\n", | 4617 | printk(KERN_INFO "bttv%d: registered device video%d\n", |
4617 | btv->c.nr,btv->video_dev->minor & 0x1f); | 4618 | btv->c.nr,btv->video_dev->minor & 0x1f); |
4618 | if (class_device_create_file(&btv->video_dev->class_dev, | 4619 | if (device_create_file(&btv->video_dev->class_dev, |
4619 | &class_device_attr_card)<0) { | 4620 | &dev_attr_card)<0) { |
4620 | printk(KERN_ERR "bttv%d: class_device_create_file 'card' " | 4621 | printk(KERN_ERR "bttv%d: device_create_file 'card' " |
4621 | "failed\n", btv->c.nr); | 4622 | "failed\n", btv->c.nr); |
4622 | goto err; | 4623 | goto err; |
4623 | } | 4624 | } |
diff --git a/drivers/media/video/et61x251/et61x251_core.c b/drivers/media/video/et61x251/et61x251_core.c index 31062a981e36..d5fef4c01c87 100644 --- a/drivers/media/video/et61x251/et61x251_core.c +++ b/drivers/media/video/et61x251/et61x251_core.c | |||
@@ -706,7 +706,8 @@ static u8 et61x251_strtou8(const char* buff, size_t len, ssize_t* count) | |||
706 | NOTE 2: buffers are PAGE_SIZE long | 706 | NOTE 2: buffers are PAGE_SIZE long |
707 | */ | 707 | */ |
708 | 708 | ||
709 | static ssize_t et61x251_show_reg(struct class_device* cd, char* buf) | 709 | static ssize_t et61x251_show_reg(struct device* cd, |
710 | struct device_attribute *attr, char* buf) | ||
710 | { | 711 | { |
711 | struct et61x251_device* cam; | 712 | struct et61x251_device* cam; |
712 | ssize_t count; | 713 | ssize_t count; |
@@ -729,7 +730,8 @@ static ssize_t et61x251_show_reg(struct class_device* cd, char* buf) | |||
729 | 730 | ||
730 | 731 | ||
731 | static ssize_t | 732 | static ssize_t |
732 | et61x251_store_reg(struct class_device* cd, const char* buf, size_t len) | 733 | et61x251_store_reg(struct device* cd, |
734 | struct device_attribute *attr, const char* buf, size_t len) | ||
733 | { | 735 | { |
734 | struct et61x251_device* cam; | 736 | struct et61x251_device* cam; |
735 | u8 index; | 737 | u8 index; |
@@ -761,7 +763,8 @@ et61x251_store_reg(struct class_device* cd, const char* buf, size_t len) | |||
761 | } | 763 | } |
762 | 764 | ||
763 | 765 | ||
764 | static ssize_t et61x251_show_val(struct class_device* cd, char* buf) | 766 | static ssize_t et61x251_show_val(struct device* cd, |
767 | struct device_attribute *attr, char* buf) | ||
765 | { | 768 | { |
766 | struct et61x251_device* cam; | 769 | struct et61x251_device* cam; |
767 | ssize_t count; | 770 | ssize_t count; |
@@ -792,7 +795,8 @@ static ssize_t et61x251_show_val(struct class_device* cd, char* buf) | |||
792 | 795 | ||
793 | 796 | ||
794 | static ssize_t | 797 | static ssize_t |
795 | et61x251_store_val(struct class_device* cd, const char* buf, size_t len) | 798 | et61x251_store_val(struct device* cd, struct device_attribute *attr, |
799 | const char* buf, size_t len) | ||
796 | { | 800 | { |
797 | struct et61x251_device* cam; | 801 | struct et61x251_device* cam; |
798 | u8 value; | 802 | u8 value; |
@@ -830,7 +834,8 @@ et61x251_store_val(struct class_device* cd, const char* buf, size_t len) | |||
830 | } | 834 | } |
831 | 835 | ||
832 | 836 | ||
833 | static ssize_t et61x251_show_i2c_reg(struct class_device* cd, char* buf) | 837 | static ssize_t et61x251_show_i2c_reg(struct device* cd, |
838 | struct device_attribute *attr, char* buf) | ||
834 | { | 839 | { |
835 | struct et61x251_device* cam; | 840 | struct et61x251_device* cam; |
836 | ssize_t count; | 841 | ssize_t count; |
@@ -855,7 +860,8 @@ static ssize_t et61x251_show_i2c_reg(struct class_device* cd, char* buf) | |||
855 | 860 | ||
856 | 861 | ||
857 | static ssize_t | 862 | static ssize_t |
858 | et61x251_store_i2c_reg(struct class_device* cd, const char* buf, size_t len) | 863 | et61x251_store_i2c_reg(struct device* cd, struct device_attribute *attr, |
864 | const char* buf, size_t len) | ||
859 | { | 865 | { |
860 | struct et61x251_device* cam; | 866 | struct et61x251_device* cam; |
861 | u8 index; | 867 | u8 index; |
@@ -887,7 +893,8 @@ et61x251_store_i2c_reg(struct class_device* cd, const char* buf, size_t len) | |||
887 | } | 893 | } |
888 | 894 | ||
889 | 895 | ||
890 | static ssize_t et61x251_show_i2c_val(struct class_device* cd, char* buf) | 896 | static ssize_t et61x251_show_i2c_val(struct device* cd, |
897 | struct device_attribute *attr, char* buf) | ||
891 | { | 898 | { |
892 | struct et61x251_device* cam; | 899 | struct et61x251_device* cam; |
893 | ssize_t count; | 900 | ssize_t count; |
@@ -923,7 +930,8 @@ static ssize_t et61x251_show_i2c_val(struct class_device* cd, char* buf) | |||
923 | 930 | ||
924 | 931 | ||
925 | static ssize_t | 932 | static ssize_t |
926 | et61x251_store_i2c_val(struct class_device* cd, const char* buf, size_t len) | 933 | et61x251_store_i2c_val(struct device* cd, struct device_attribute *attr, |
934 | const char* buf, size_t len) | ||
927 | { | 935 | { |
928 | struct et61x251_device* cam; | 936 | struct et61x251_device* cam; |
929 | u8 value; | 937 | u8 value; |
@@ -966,42 +974,40 @@ et61x251_store_i2c_val(struct class_device* cd, const char* buf, size_t len) | |||
966 | } | 974 | } |
967 | 975 | ||
968 | 976 | ||
969 | static CLASS_DEVICE_ATTR(reg, S_IRUGO | S_IWUSR, | 977 | static DEVICE_ATTR(reg, S_IRUGO | S_IWUSR, |
970 | et61x251_show_reg, et61x251_store_reg); | 978 | et61x251_show_reg, et61x251_store_reg); |
971 | static CLASS_DEVICE_ATTR(val, S_IRUGO | S_IWUSR, | 979 | static DEVICE_ATTR(val, S_IRUGO | S_IWUSR, |
972 | et61x251_show_val, et61x251_store_val); | 980 | et61x251_show_val, et61x251_store_val); |
973 | static CLASS_DEVICE_ATTR(i2c_reg, S_IRUGO | S_IWUSR, | 981 | static DEVICE_ATTR(i2c_reg, S_IRUGO | S_IWUSR, |
974 | et61x251_show_i2c_reg, et61x251_store_i2c_reg); | 982 | et61x251_show_i2c_reg, et61x251_store_i2c_reg); |
975 | static CLASS_DEVICE_ATTR(i2c_val, S_IRUGO | S_IWUSR, | 983 | static DEVICE_ATTR(i2c_val, S_IRUGO | S_IWUSR, |
976 | et61x251_show_i2c_val, et61x251_store_i2c_val); | 984 | et61x251_show_i2c_val, et61x251_store_i2c_val); |
977 | 985 | ||
978 | 986 | ||
979 | static int et61x251_create_sysfs(struct et61x251_device* cam) | 987 | static int et61x251_create_sysfs(struct et61x251_device* cam) |
980 | { | 988 | { |
981 | struct class_device *classdev = &(cam->v4ldev->class_dev); | 989 | struct device *classdev = &(cam->v4ldev->class_dev); |
982 | int err = 0; | 990 | int err = 0; |
983 | 991 | ||
984 | if ((err = class_device_create_file(classdev, &class_device_attr_reg))) | 992 | if ((err = device_create_file(classdev, &dev_attr_reg))) |
985 | goto err_out; | 993 | goto err_out; |
986 | if ((err = class_device_create_file(classdev, &class_device_attr_val))) | 994 | if ((err = device_create_file(classdev, &dev_attr_val))) |
987 | goto err_reg; | 995 | goto err_reg; |
988 | 996 | ||
989 | if (cam->sensor.sysfs_ops) { | 997 | if (cam->sensor.sysfs_ops) { |
990 | if ((err = class_device_create_file(classdev, | 998 | if ((err = device_create_file(classdev, &dev_attr_i2c_reg))) |
991 | &class_device_attr_i2c_reg))) | ||
992 | goto err_val; | 999 | goto err_val; |
993 | if ((err = class_device_create_file(classdev, | 1000 | if ((err = device_create_file(classdev, &dev_attr_i2c_val))) |
994 | &class_device_attr_i2c_val))) | ||
995 | goto err_i2c_reg; | 1001 | goto err_i2c_reg; |
996 | } | 1002 | } |
997 | 1003 | ||
998 | err_i2c_reg: | 1004 | err_i2c_reg: |
999 | if (cam->sensor.sysfs_ops) | 1005 | if (cam->sensor.sysfs_ops) |
1000 | class_device_remove_file(classdev, &class_device_attr_i2c_reg); | 1006 | device_remove_file(classdev, &dev_attr_i2c_reg); |
1001 | err_val: | 1007 | err_val: |
1002 | class_device_remove_file(classdev, &class_device_attr_val); | 1008 | device_remove_file(classdev, &dev_attr_val); |
1003 | err_reg: | 1009 | err_reg: |
1004 | class_device_remove_file(classdev, &class_device_attr_reg); | 1010 | device_remove_file(classdev, &dev_attr_reg); |
1005 | err_out: | 1011 | err_out: |
1006 | return err; | 1012 | return err; |
1007 | } | 1013 | } |
diff --git a/drivers/media/video/ov511.c b/drivers/media/video/ov511.c index e5edff1059a2..9eb2562347a8 100644 --- a/drivers/media/video/ov511.c +++ b/drivers/media/video/ov511.c | |||
@@ -5554,41 +5554,46 @@ error: | |||
5554 | * sysfs | 5554 | * sysfs |
5555 | ***************************************************************************/ | 5555 | ***************************************************************************/ |
5556 | 5556 | ||
5557 | static inline struct usb_ov511 *cd_to_ov(struct class_device *cd) | 5557 | static inline struct usb_ov511 *cd_to_ov(struct device *cd) |
5558 | { | 5558 | { |
5559 | struct video_device *vdev = to_video_device(cd); | 5559 | struct video_device *vdev = to_video_device(cd); |
5560 | return video_get_drvdata(vdev); | 5560 | return video_get_drvdata(vdev); |
5561 | } | 5561 | } |
5562 | 5562 | ||
5563 | static ssize_t show_custom_id(struct class_device *cd, char *buf) | 5563 | static ssize_t show_custom_id(struct device *cd, |
5564 | struct device_attribute *attr, char *buf) | ||
5564 | { | 5565 | { |
5565 | struct usb_ov511 *ov = cd_to_ov(cd); | 5566 | struct usb_ov511 *ov = cd_to_ov(cd); |
5566 | return sprintf(buf, "%d\n", ov->customid); | 5567 | return sprintf(buf, "%d\n", ov->customid); |
5567 | } | 5568 | } |
5568 | static CLASS_DEVICE_ATTR(custom_id, S_IRUGO, show_custom_id, NULL); | 5569 | static DEVICE_ATTR(custom_id, S_IRUGO, show_custom_id, NULL); |
5569 | 5570 | ||
5570 | static ssize_t show_model(struct class_device *cd, char *buf) | 5571 | static ssize_t show_model(struct device *cd, |
5572 | struct device_attribute *attr, char *buf) | ||
5571 | { | 5573 | { |
5572 | struct usb_ov511 *ov = cd_to_ov(cd); | 5574 | struct usb_ov511 *ov = cd_to_ov(cd); |
5573 | return sprintf(buf, "%s\n", ov->desc); | 5575 | return sprintf(buf, "%s\n", ov->desc); |
5574 | } | 5576 | } |
5575 | static CLASS_DEVICE_ATTR(model, S_IRUGO, show_model, NULL); | 5577 | static DEVICE_ATTR(model, S_IRUGO, show_model, NULL); |
5576 | 5578 | ||
5577 | static ssize_t show_bridge(struct class_device *cd, char *buf) | 5579 | static ssize_t show_bridge(struct device *cd, |
5580 | struct device_attribute *attr, char *buf) | ||
5578 | { | 5581 | { |
5579 | struct usb_ov511 *ov = cd_to_ov(cd); | 5582 | struct usb_ov511 *ov = cd_to_ov(cd); |
5580 | return sprintf(buf, "%s\n", symbolic(brglist, ov->bridge)); | 5583 | return sprintf(buf, "%s\n", symbolic(brglist, ov->bridge)); |
5581 | } | 5584 | } |
5582 | static CLASS_DEVICE_ATTR(bridge, S_IRUGO, show_bridge, NULL); | 5585 | static DEVICE_ATTR(bridge, S_IRUGO, show_bridge, NULL); |
5583 | 5586 | ||
5584 | static ssize_t show_sensor(struct class_device *cd, char *buf) | 5587 | static ssize_t show_sensor(struct device *cd, |
5588 | struct device_attribute *attr, char *buf) | ||
5585 | { | 5589 | { |
5586 | struct usb_ov511 *ov = cd_to_ov(cd); | 5590 | struct usb_ov511 *ov = cd_to_ov(cd); |
5587 | return sprintf(buf, "%s\n", symbolic(senlist, ov->sensor)); | 5591 | return sprintf(buf, "%s\n", symbolic(senlist, ov->sensor)); |
5588 | } | 5592 | } |
5589 | static CLASS_DEVICE_ATTR(sensor, S_IRUGO, show_sensor, NULL); | 5593 | static DEVICE_ATTR(sensor, S_IRUGO, show_sensor, NULL); |
5590 | 5594 | ||
5591 | static ssize_t show_brightness(struct class_device *cd, char *buf) | 5595 | static ssize_t show_brightness(struct device *cd, |
5596 | struct device_attribute *attr, char *buf) | ||
5592 | { | 5597 | { |
5593 | struct usb_ov511 *ov = cd_to_ov(cd); | 5598 | struct usb_ov511 *ov = cd_to_ov(cd); |
5594 | unsigned short x; | 5599 | unsigned short x; |
@@ -5598,9 +5603,10 @@ static ssize_t show_brightness(struct class_device *cd, char *buf) | |||
5598 | sensor_get_brightness(ov, &x); | 5603 | sensor_get_brightness(ov, &x); |
5599 | return sprintf(buf, "%d\n", x >> 8); | 5604 | return sprintf(buf, "%d\n", x >> 8); |
5600 | } | 5605 | } |
5601 | static CLASS_DEVICE_ATTR(brightness, S_IRUGO, show_brightness, NULL); | 5606 | static DEVICE_ATTR(brightness, S_IRUGO, show_brightness, NULL); |
5602 | 5607 | ||
5603 | static ssize_t show_saturation(struct class_device *cd, char *buf) | 5608 | static ssize_t show_saturation(struct device *cd, |
5609 | struct device_attribute *attr, char *buf) | ||
5604 | { | 5610 | { |
5605 | struct usb_ov511 *ov = cd_to_ov(cd); | 5611 | struct usb_ov511 *ov = cd_to_ov(cd); |
5606 | unsigned short x; | 5612 | unsigned short x; |
@@ -5610,9 +5616,10 @@ static ssize_t show_saturation(struct class_device *cd, char *buf) | |||
5610 | sensor_get_saturation(ov, &x); | 5616 | sensor_get_saturation(ov, &x); |
5611 | return sprintf(buf, "%d\n", x >> 8); | 5617 | return sprintf(buf, "%d\n", x >> 8); |
5612 | } | 5618 | } |
5613 | static CLASS_DEVICE_ATTR(saturation, S_IRUGO, show_saturation, NULL); | 5619 | static DEVICE_ATTR(saturation, S_IRUGO, show_saturation, NULL); |
5614 | 5620 | ||
5615 | static ssize_t show_contrast(struct class_device *cd, char *buf) | 5621 | static ssize_t show_contrast(struct device *cd, |
5622 | struct device_attribute *attr, char *buf) | ||
5616 | { | 5623 | { |
5617 | struct usb_ov511 *ov = cd_to_ov(cd); | 5624 | struct usb_ov511 *ov = cd_to_ov(cd); |
5618 | unsigned short x; | 5625 | unsigned short x; |
@@ -5622,9 +5629,10 @@ static ssize_t show_contrast(struct class_device *cd, char *buf) | |||
5622 | sensor_get_contrast(ov, &x); | 5629 | sensor_get_contrast(ov, &x); |
5623 | return sprintf(buf, "%d\n", x >> 8); | 5630 | return sprintf(buf, "%d\n", x >> 8); |
5624 | } | 5631 | } |
5625 | static CLASS_DEVICE_ATTR(contrast, S_IRUGO, show_contrast, NULL); | 5632 | static DEVICE_ATTR(contrast, S_IRUGO, show_contrast, NULL); |
5626 | 5633 | ||
5627 | static ssize_t show_hue(struct class_device *cd, char *buf) | 5634 | static ssize_t show_hue(struct device *cd, |
5635 | struct device_attribute *attr, char *buf) | ||
5628 | { | 5636 | { |
5629 | struct usb_ov511 *ov = cd_to_ov(cd); | 5637 | struct usb_ov511 *ov = cd_to_ov(cd); |
5630 | unsigned short x; | 5638 | unsigned short x; |
@@ -5634,9 +5642,10 @@ static ssize_t show_hue(struct class_device *cd, char *buf) | |||
5634 | sensor_get_hue(ov, &x); | 5642 | sensor_get_hue(ov, &x); |
5635 | return sprintf(buf, "%d\n", x >> 8); | 5643 | return sprintf(buf, "%d\n", x >> 8); |
5636 | } | 5644 | } |
5637 | static CLASS_DEVICE_ATTR(hue, S_IRUGO, show_hue, NULL); | 5645 | static DEVICE_ATTR(hue, S_IRUGO, show_hue, NULL); |
5638 | 5646 | ||
5639 | static ssize_t show_exposure(struct class_device *cd, char *buf) | 5647 | static ssize_t show_exposure(struct device *cd, |
5648 | struct device_attribute *attr, char *buf) | ||
5640 | { | 5649 | { |
5641 | struct usb_ov511 *ov = cd_to_ov(cd); | 5650 | struct usb_ov511 *ov = cd_to_ov(cd); |
5642 | unsigned char exp = 0; | 5651 | unsigned char exp = 0; |
@@ -5646,49 +5655,49 @@ static ssize_t show_exposure(struct class_device *cd, char *buf) | |||
5646 | sensor_get_exposure(ov, &exp); | 5655 | sensor_get_exposure(ov, &exp); |
5647 | return sprintf(buf, "%d\n", exp >> 8); | 5656 | return sprintf(buf, "%d\n", exp >> 8); |
5648 | } | 5657 | } |
5649 | static CLASS_DEVICE_ATTR(exposure, S_IRUGO, show_exposure, NULL); | 5658 | static DEVICE_ATTR(exposure, S_IRUGO, show_exposure, NULL); |
5650 | 5659 | ||
5651 | static int ov_create_sysfs(struct video_device *vdev) | 5660 | static int ov_create_sysfs(struct video_device *vdev) |
5652 | { | 5661 | { |
5653 | int rc; | 5662 | int rc; |
5654 | 5663 | ||
5655 | rc = video_device_create_file(vdev, &class_device_attr_custom_id); | 5664 | rc = video_device_create_file(vdev, &dev_attr_custom_id); |
5656 | if (rc) goto err; | 5665 | if (rc) goto err; |
5657 | rc = video_device_create_file(vdev, &class_device_attr_model); | 5666 | rc = video_device_create_file(vdev, &dev_attr_model); |
5658 | if (rc) goto err_id; | 5667 | if (rc) goto err_id; |
5659 | rc = video_device_create_file(vdev, &class_device_attr_bridge); | 5668 | rc = video_device_create_file(vdev, &dev_attr_bridge); |
5660 | if (rc) goto err_model; | 5669 | if (rc) goto err_model; |
5661 | rc = video_device_create_file(vdev, &class_device_attr_sensor); | 5670 | rc = video_device_create_file(vdev, &dev_attr_sensor); |
5662 | if (rc) goto err_bridge; | 5671 | if (rc) goto err_bridge; |
5663 | rc = video_device_create_file(vdev, &class_device_attr_brightness); | 5672 | rc = video_device_create_file(vdev, &dev_attr_brightness); |
5664 | if (rc) goto err_sensor; | 5673 | if (rc) goto err_sensor; |
5665 | rc = video_device_create_file(vdev, &class_device_attr_saturation); | 5674 | rc = video_device_create_file(vdev, &dev_attr_saturation); |
5666 | if (rc) goto err_bright; | 5675 | if (rc) goto err_bright; |
5667 | rc = video_device_create_file(vdev, &class_device_attr_contrast); | 5676 | rc = video_device_create_file(vdev, &dev_attr_contrast); |
5668 | if (rc) goto err_sat; | 5677 | if (rc) goto err_sat; |
5669 | rc = video_device_create_file(vdev, &class_device_attr_hue); | 5678 | rc = video_device_create_file(vdev, &dev_attr_hue); |
5670 | if (rc) goto err_contrast; | 5679 | if (rc) goto err_contrast; |
5671 | rc = video_device_create_file(vdev, &class_device_attr_exposure); | 5680 | rc = video_device_create_file(vdev, &dev_attr_exposure); |
5672 | if (rc) goto err_hue; | 5681 | if (rc) goto err_hue; |
5673 | 5682 | ||
5674 | return 0; | 5683 | return 0; |
5675 | 5684 | ||
5676 | err_hue: | 5685 | err_hue: |
5677 | video_device_remove_file(vdev, &class_device_attr_hue); | 5686 | video_device_remove_file(vdev, &dev_attr_hue); |
5678 | err_contrast: | 5687 | err_contrast: |
5679 | video_device_remove_file(vdev, &class_device_attr_contrast); | 5688 | video_device_remove_file(vdev, &dev_attr_contrast); |
5680 | err_sat: | 5689 | err_sat: |
5681 | video_device_remove_file(vdev, &class_device_attr_saturation); | 5690 | video_device_remove_file(vdev, &dev_attr_saturation); |
5682 | err_bright: | 5691 | err_bright: |
5683 | video_device_remove_file(vdev, &class_device_attr_brightness); | 5692 | video_device_remove_file(vdev, &dev_attr_brightness); |
5684 | err_sensor: | 5693 | err_sensor: |
5685 | video_device_remove_file(vdev, &class_device_attr_sensor); | 5694 | video_device_remove_file(vdev, &dev_attr_sensor); |
5686 | err_bridge: | 5695 | err_bridge: |
5687 | video_device_remove_file(vdev, &class_device_attr_bridge); | 5696 | video_device_remove_file(vdev, &dev_attr_bridge); |
5688 | err_model: | 5697 | err_model: |
5689 | video_device_remove_file(vdev, &class_device_attr_model); | 5698 | video_device_remove_file(vdev, &dev_attr_model); |
5690 | err_id: | 5699 | err_id: |
5691 | video_device_remove_file(vdev, &class_device_attr_custom_id); | 5700 | video_device_remove_file(vdev, &dev_attr_custom_id); |
5692 | err: | 5701 | err: |
5693 | return rc; | 5702 | return rc; |
5694 | } | 5703 | } |
diff --git a/drivers/media/video/pvrusb2/pvrusb2-sysfs.c b/drivers/media/video/pvrusb2/pvrusb2-sysfs.c index 7ab79baa1c8c..b20dc4421d59 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-sysfs.c +++ b/drivers/media/video/pvrusb2/pvrusb2-sysfs.c | |||
@@ -33,16 +33,16 @@ | |||
33 | 33 | ||
34 | struct pvr2_sysfs { | 34 | struct pvr2_sysfs { |
35 | struct pvr2_channel channel; | 35 | struct pvr2_channel channel; |
36 | struct class_device *class_dev; | 36 | struct device *class_dev; |
37 | #ifdef CONFIG_VIDEO_PVRUSB2_DEBUGIFC | 37 | #ifdef CONFIG_VIDEO_PVRUSB2_DEBUGIFC |
38 | struct pvr2_sysfs_debugifc *debugifc; | 38 | struct pvr2_sysfs_debugifc *debugifc; |
39 | #endif /* CONFIG_VIDEO_PVRUSB2_DEBUGIFC */ | 39 | #endif /* CONFIG_VIDEO_PVRUSB2_DEBUGIFC */ |
40 | struct pvr2_sysfs_ctl_item *item_first; | 40 | struct pvr2_sysfs_ctl_item *item_first; |
41 | struct pvr2_sysfs_ctl_item *item_last; | 41 | struct pvr2_sysfs_ctl_item *item_last; |
42 | struct class_device_attribute attr_v4l_minor_number; | 42 | struct device_attribute attr_v4l_minor_number; |
43 | struct class_device_attribute attr_v4l_radio_minor_number; | 43 | struct device_attribute attr_v4l_radio_minor_number; |
44 | struct class_device_attribute attr_unit_number; | 44 | struct device_attribute attr_unit_number; |
45 | struct class_device_attribute attr_bus_info; | 45 | struct device_attribute attr_bus_info; |
46 | int v4l_minor_number_created_ok; | 46 | int v4l_minor_number_created_ok; |
47 | int v4l_radio_minor_number_created_ok; | 47 | int v4l_radio_minor_number_created_ok; |
48 | int unit_number_created_ok; | 48 | int unit_number_created_ok; |
@@ -51,22 +51,22 @@ struct pvr2_sysfs { | |||
51 | 51 | ||
52 | #ifdef CONFIG_VIDEO_PVRUSB2_DEBUGIFC | 52 | #ifdef CONFIG_VIDEO_PVRUSB2_DEBUGIFC |
53 | struct pvr2_sysfs_debugifc { | 53 | struct pvr2_sysfs_debugifc { |
54 | struct class_device_attribute attr_debugcmd; | 54 | struct device_attribute attr_debugcmd; |
55 | struct class_device_attribute attr_debuginfo; | 55 | struct device_attribute attr_debuginfo; |
56 | int debugcmd_created_ok; | 56 | int debugcmd_created_ok; |
57 | int debuginfo_created_ok; | 57 | int debuginfo_created_ok; |
58 | }; | 58 | }; |
59 | #endif /* CONFIG_VIDEO_PVRUSB2_DEBUGIFC */ | 59 | #endif /* CONFIG_VIDEO_PVRUSB2_DEBUGIFC */ |
60 | 60 | ||
61 | struct pvr2_sysfs_ctl_item { | 61 | struct pvr2_sysfs_ctl_item { |
62 | struct class_device_attribute attr_name; | 62 | struct device_attribute attr_name; |
63 | struct class_device_attribute attr_type; | 63 | struct device_attribute attr_type; |
64 | struct class_device_attribute attr_min; | 64 | struct device_attribute attr_min; |
65 | struct class_device_attribute attr_max; | 65 | struct device_attribute attr_max; |
66 | struct class_device_attribute attr_enum; | 66 | struct device_attribute attr_enum; |
67 | struct class_device_attribute attr_bits; | 67 | struct device_attribute attr_bits; |
68 | struct class_device_attribute attr_val; | 68 | struct device_attribute attr_val; |
69 | struct class_device_attribute attr_custom; | 69 | struct device_attribute attr_custom; |
70 | struct pvr2_ctrl *cptr; | 70 | struct pvr2_ctrl *cptr; |
71 | struct pvr2_sysfs *chptr; | 71 | struct pvr2_sysfs *chptr; |
72 | struct pvr2_sysfs_ctl_item *item_next; | 72 | struct pvr2_sysfs_ctl_item *item_next; |
@@ -80,13 +80,13 @@ struct pvr2_sysfs_class { | |||
80 | struct class class; | 80 | struct class class; |
81 | }; | 81 | }; |
82 | 82 | ||
83 | static ssize_t show_name(int id,struct class_device *class_dev,char *buf) | 83 | static ssize_t show_name(int id,struct device *class_dev,char *buf) |
84 | { | 84 | { |
85 | struct pvr2_ctrl *cptr; | 85 | struct pvr2_ctrl *cptr; |
86 | struct pvr2_sysfs *sfp; | 86 | struct pvr2_sysfs *sfp; |
87 | const char *name; | 87 | const char *name; |
88 | 88 | ||
89 | sfp = (struct pvr2_sysfs *)class_dev->class_data; | 89 | sfp = (struct pvr2_sysfs *)class_dev->driver_data; |
90 | if (!sfp) return -EINVAL; | 90 | if (!sfp) return -EINVAL; |
91 | cptr = pvr2_hdw_get_ctrl_by_index(sfp->channel.hdw,id); | 91 | cptr = pvr2_hdw_get_ctrl_by_index(sfp->channel.hdw,id); |
92 | if (!cptr) return -EINVAL; | 92 | if (!cptr) return -EINVAL; |
@@ -99,14 +99,14 @@ static ssize_t show_name(int id,struct class_device *class_dev,char *buf) | |||
99 | return scnprintf(buf,PAGE_SIZE,"%s\n",name); | 99 | return scnprintf(buf,PAGE_SIZE,"%s\n",name); |
100 | } | 100 | } |
101 | 101 | ||
102 | static ssize_t show_type(int id,struct class_device *class_dev,char *buf) | 102 | static ssize_t show_type(int id,struct device *class_dev,char *buf) |
103 | { | 103 | { |
104 | struct pvr2_ctrl *cptr; | 104 | struct pvr2_ctrl *cptr; |
105 | struct pvr2_sysfs *sfp; | 105 | struct pvr2_sysfs *sfp; |
106 | const char *name; | 106 | const char *name; |
107 | enum pvr2_ctl_type tp; | 107 | enum pvr2_ctl_type tp; |
108 | 108 | ||
109 | sfp = (struct pvr2_sysfs *)class_dev->class_data; | 109 | sfp = (struct pvr2_sysfs *)class_dev->driver_data; |
110 | if (!sfp) return -EINVAL; | 110 | if (!sfp) return -EINVAL; |
111 | cptr = pvr2_hdw_get_ctrl_by_index(sfp->channel.hdw,id); | 111 | cptr = pvr2_hdw_get_ctrl_by_index(sfp->channel.hdw,id); |
112 | if (!cptr) return -EINVAL; | 112 | if (!cptr) return -EINVAL; |
@@ -126,13 +126,13 @@ static ssize_t show_type(int id,struct class_device *class_dev,char *buf) | |||
126 | return scnprintf(buf,PAGE_SIZE,"%s\n",name); | 126 | return scnprintf(buf,PAGE_SIZE,"%s\n",name); |
127 | } | 127 | } |
128 | 128 | ||
129 | static ssize_t show_min(int id,struct class_device *class_dev,char *buf) | 129 | static ssize_t show_min(int id,struct device *class_dev,char *buf) |
130 | { | 130 | { |
131 | struct pvr2_ctrl *cptr; | 131 | struct pvr2_ctrl *cptr; |
132 | struct pvr2_sysfs *sfp; | 132 | struct pvr2_sysfs *sfp; |
133 | long val; | 133 | long val; |
134 | 134 | ||
135 | sfp = (struct pvr2_sysfs *)class_dev->class_data; | 135 | sfp = (struct pvr2_sysfs *)class_dev->driver_data; |
136 | if (!sfp) return -EINVAL; | 136 | if (!sfp) return -EINVAL; |
137 | cptr = pvr2_hdw_get_ctrl_by_index(sfp->channel.hdw,id); | 137 | cptr = pvr2_hdw_get_ctrl_by_index(sfp->channel.hdw,id); |
138 | if (!cptr) return -EINVAL; | 138 | if (!cptr) return -EINVAL; |
@@ -143,13 +143,13 @@ static ssize_t show_min(int id,struct class_device *class_dev,char *buf) | |||
143 | return scnprintf(buf,PAGE_SIZE,"%ld\n",val); | 143 | return scnprintf(buf,PAGE_SIZE,"%ld\n",val); |
144 | } | 144 | } |
145 | 145 | ||
146 | static ssize_t show_max(int id,struct class_device *class_dev,char *buf) | 146 | static ssize_t show_max(int id,struct device *class_dev,char *buf) |
147 | { | 147 | { |
148 | struct pvr2_ctrl *cptr; | 148 | struct pvr2_ctrl *cptr; |
149 | struct pvr2_sysfs *sfp; | 149 | struct pvr2_sysfs *sfp; |
150 | long val; | 150 | long val; |
151 | 151 | ||
152 | sfp = (struct pvr2_sysfs *)class_dev->class_data; | 152 | sfp = (struct pvr2_sysfs *)class_dev->driver_data; |
153 | if (!sfp) return -EINVAL; | 153 | if (!sfp) return -EINVAL; |
154 | cptr = pvr2_hdw_get_ctrl_by_index(sfp->channel.hdw,id); | 154 | cptr = pvr2_hdw_get_ctrl_by_index(sfp->channel.hdw,id); |
155 | if (!cptr) return -EINVAL; | 155 | if (!cptr) return -EINVAL; |
@@ -160,14 +160,14 @@ static ssize_t show_max(int id,struct class_device *class_dev,char *buf) | |||
160 | return scnprintf(buf,PAGE_SIZE,"%ld\n",val); | 160 | return scnprintf(buf,PAGE_SIZE,"%ld\n",val); |
161 | } | 161 | } |
162 | 162 | ||
163 | static ssize_t show_val_norm(int id,struct class_device *class_dev,char *buf) | 163 | static ssize_t show_val_norm(int id,struct device *class_dev,char *buf) |
164 | { | 164 | { |
165 | struct pvr2_ctrl *cptr; | 165 | struct pvr2_ctrl *cptr; |
166 | struct pvr2_sysfs *sfp; | 166 | struct pvr2_sysfs *sfp; |
167 | int val,ret; | 167 | int val,ret; |
168 | unsigned int cnt = 0; | 168 | unsigned int cnt = 0; |
169 | 169 | ||
170 | sfp = (struct pvr2_sysfs *)class_dev->class_data; | 170 | sfp = (struct pvr2_sysfs *)class_dev->driver_data; |
171 | if (!sfp) return -EINVAL; | 171 | if (!sfp) return -EINVAL; |
172 | cptr = pvr2_hdw_get_ctrl_by_index(sfp->channel.hdw,id); | 172 | cptr = pvr2_hdw_get_ctrl_by_index(sfp->channel.hdw,id); |
173 | if (!cptr) return -EINVAL; | 173 | if (!cptr) return -EINVAL; |
@@ -184,14 +184,14 @@ static ssize_t show_val_norm(int id,struct class_device *class_dev,char *buf) | |||
184 | return cnt+1; | 184 | return cnt+1; |
185 | } | 185 | } |
186 | 186 | ||
187 | static ssize_t show_val_custom(int id,struct class_device *class_dev,char *buf) | 187 | static ssize_t show_val_custom(int id,struct device *class_dev,char *buf) |
188 | { | 188 | { |
189 | struct pvr2_ctrl *cptr; | 189 | struct pvr2_ctrl *cptr; |
190 | struct pvr2_sysfs *sfp; | 190 | struct pvr2_sysfs *sfp; |
191 | int val,ret; | 191 | int val,ret; |
192 | unsigned int cnt = 0; | 192 | unsigned int cnt = 0; |
193 | 193 | ||
194 | sfp = (struct pvr2_sysfs *)class_dev->class_data; | 194 | sfp = (struct pvr2_sysfs *)class_dev->driver_data; |
195 | if (!sfp) return -EINVAL; | 195 | if (!sfp) return -EINVAL; |
196 | cptr = pvr2_hdw_get_ctrl_by_index(sfp->channel.hdw,id); | 196 | cptr = pvr2_hdw_get_ctrl_by_index(sfp->channel.hdw,id); |
197 | if (!cptr) return -EINVAL; | 197 | if (!cptr) return -EINVAL; |
@@ -208,14 +208,14 @@ static ssize_t show_val_custom(int id,struct class_device *class_dev,char *buf) | |||
208 | return cnt+1; | 208 | return cnt+1; |
209 | } | 209 | } |
210 | 210 | ||
211 | static ssize_t show_enum(int id,struct class_device *class_dev,char *buf) | 211 | static ssize_t show_enum(int id,struct device *class_dev,char *buf) |
212 | { | 212 | { |
213 | struct pvr2_ctrl *cptr; | 213 | struct pvr2_ctrl *cptr; |
214 | struct pvr2_sysfs *sfp; | 214 | struct pvr2_sysfs *sfp; |
215 | long val; | 215 | long val; |
216 | unsigned int bcnt,ccnt,ecnt; | 216 | unsigned int bcnt,ccnt,ecnt; |
217 | 217 | ||
218 | sfp = (struct pvr2_sysfs *)class_dev->class_data; | 218 | sfp = (struct pvr2_sysfs *)class_dev->driver_data; |
219 | if (!sfp) return -EINVAL; | 219 | if (!sfp) return -EINVAL; |
220 | cptr = pvr2_hdw_get_ctrl_by_index(sfp->channel.hdw,id); | 220 | cptr = pvr2_hdw_get_ctrl_by_index(sfp->channel.hdw,id); |
221 | if (!cptr) return -EINVAL; | 221 | if (!cptr) return -EINVAL; |
@@ -233,14 +233,14 @@ static ssize_t show_enum(int id,struct class_device *class_dev,char *buf) | |||
233 | return bcnt; | 233 | return bcnt; |
234 | } | 234 | } |
235 | 235 | ||
236 | static ssize_t show_bits(int id,struct class_device *class_dev,char *buf) | 236 | static ssize_t show_bits(int id,struct device *class_dev,char *buf) |
237 | { | 237 | { |
238 | struct pvr2_ctrl *cptr; | 238 | struct pvr2_ctrl *cptr; |
239 | struct pvr2_sysfs *sfp; | 239 | struct pvr2_sysfs *sfp; |
240 | int valid_bits,msk; | 240 | int valid_bits,msk; |
241 | unsigned int bcnt,ccnt; | 241 | unsigned int bcnt,ccnt; |
242 | 242 | ||
243 | sfp = (struct pvr2_sysfs *)class_dev->class_data; | 243 | sfp = (struct pvr2_sysfs *)class_dev->driver_data; |
244 | if (!sfp) return -EINVAL; | 244 | if (!sfp) return -EINVAL; |
245 | cptr = pvr2_hdw_get_ctrl_by_index(sfp->channel.hdw,id); | 245 | cptr = pvr2_hdw_get_ctrl_by_index(sfp->channel.hdw,id); |
246 | if (!cptr) return -EINVAL; | 246 | if (!cptr) return -EINVAL; |
@@ -278,23 +278,23 @@ static int store_val_any(int id,int customfl,struct pvr2_sysfs *sfp, | |||
278 | return ret; | 278 | return ret; |
279 | } | 279 | } |
280 | 280 | ||
281 | static ssize_t store_val_norm(int id,struct class_device *class_dev, | 281 | static ssize_t store_val_norm(int id,struct device *class_dev, |
282 | const char *buf,size_t count) | 282 | const char *buf,size_t count) |
283 | { | 283 | { |
284 | struct pvr2_sysfs *sfp; | 284 | struct pvr2_sysfs *sfp; |
285 | int ret; | 285 | int ret; |
286 | sfp = (struct pvr2_sysfs *)class_dev->class_data; | 286 | sfp = (struct pvr2_sysfs *)class_dev->driver_data; |
287 | ret = store_val_any(id,0,sfp,buf,count); | 287 | ret = store_val_any(id,0,sfp,buf,count); |
288 | if (!ret) ret = count; | 288 | if (!ret) ret = count; |
289 | return ret; | 289 | return ret; |
290 | } | 290 | } |
291 | 291 | ||
292 | static ssize_t store_val_custom(int id,struct class_device *class_dev, | 292 | static ssize_t store_val_custom(int id,struct device *class_dev, |
293 | const char *buf,size_t count) | 293 | const char *buf,size_t count) |
294 | { | 294 | { |
295 | struct pvr2_sysfs *sfp; | 295 | struct pvr2_sysfs *sfp; |
296 | int ret; | 296 | int ret; |
297 | sfp = (struct pvr2_sysfs *)class_dev->class_data; | 297 | sfp = (struct pvr2_sysfs *)class_dev->driver_data; |
298 | ret = store_val_any(id,1,sfp,buf,count); | 298 | ret = store_val_any(id,1,sfp,buf,count); |
299 | if (!ret) ret = count; | 299 | if (!ret) ret = count; |
300 | return ret; | 300 | return ret; |
@@ -304,7 +304,7 @@ static ssize_t store_val_custom(int id,struct class_device *class_dev, | |||
304 | Mike Isely <isely@pobox.com> 30-April-2005 | 304 | Mike Isely <isely@pobox.com> 30-April-2005 |
305 | 305 | ||
306 | This next batch of horrible preprocessor hackery is needed because the | 306 | This next batch of horrible preprocessor hackery is needed because the |
307 | kernel's class_device_attribute mechanism fails to pass the actual | 307 | kernel's device_attribute mechanism fails to pass the actual |
308 | attribute through to the show / store functions, which means we have no | 308 | attribute through to the show / store functions, which means we have no |
309 | way to package up any attribute-specific parameters, like for example the | 309 | way to package up any attribute-specific parameters, like for example the |
310 | control id. So we work around this brain-damage by encoding the control | 310 | control id. So we work around this brain-damage by encoding the control |
@@ -314,11 +314,13 @@ static ssize_t store_val_custom(int id,struct class_device *class_dev, | |||
314 | */ | 314 | */ |
315 | 315 | ||
316 | #define CREATE_SHOW_INSTANCE(sf_name,ctl_id) \ | 316 | #define CREATE_SHOW_INSTANCE(sf_name,ctl_id) \ |
317 | static ssize_t sf_name##_##ctl_id(struct class_device *class_dev,char *buf) \ | 317 | static ssize_t sf_name##_##ctl_id(struct device *class_dev, \ |
318 | struct device_attribute *attr, char *buf) \ | ||
318 | { return sf_name(ctl_id,class_dev,buf); } | 319 | { return sf_name(ctl_id,class_dev,buf); } |
319 | 320 | ||
320 | #define CREATE_STORE_INSTANCE(sf_name,ctl_id) \ | 321 | #define CREATE_STORE_INSTANCE(sf_name,ctl_id) \ |
321 | static ssize_t sf_name##_##ctl_id(struct class_device *class_dev,const char *buf,size_t count) \ | 322 | static ssize_t sf_name##_##ctl_id(struct device *class_dev, \ |
323 | struct device_attribute *attr, const char *buf, size_t count) \ | ||
322 | { return sf_name(ctl_id,class_dev,buf,count); } | 324 | { return sf_name(ctl_id,class_dev,buf,count); } |
323 | 325 | ||
324 | #define CREATE_BATCH(ctl_id) \ | 326 | #define CREATE_BATCH(ctl_id) \ |
@@ -395,17 +397,27 @@ CREATE_BATCH(58) | |||
395 | CREATE_BATCH(59) | 397 | CREATE_BATCH(59) |
396 | 398 | ||
397 | struct pvr2_sysfs_func_set { | 399 | struct pvr2_sysfs_func_set { |
398 | ssize_t (*show_name)(struct class_device *,char *); | 400 | ssize_t (*show_name)(struct device *, |
399 | ssize_t (*show_type)(struct class_device *,char *); | 401 | struct device_attribute *attr, char *); |
400 | ssize_t (*show_min)(struct class_device *,char *); | 402 | ssize_t (*show_type)(struct device *, |
401 | ssize_t (*show_max)(struct class_device *,char *); | 403 | struct device_attribute *attr, char *); |
402 | ssize_t (*show_enum)(struct class_device *,char *); | 404 | ssize_t (*show_min)(struct device *, |
403 | ssize_t (*show_bits)(struct class_device *,char *); | 405 | struct device_attribute *attr, char *); |
404 | ssize_t (*show_val_norm)(struct class_device *,char *); | 406 | ssize_t (*show_max)(struct device *, |
405 | ssize_t (*store_val_norm)(struct class_device *, | 407 | struct device_attribute *attr, char *); |
408 | ssize_t (*show_enum)(struct device *, | ||
409 | struct device_attribute *attr, char *); | ||
410 | ssize_t (*show_bits)(struct device *, | ||
411 | struct device_attribute *attr, char *); | ||
412 | ssize_t (*show_val_norm)(struct device *, | ||
413 | struct device_attribute *attr, char *); | ||
414 | ssize_t (*store_val_norm)(struct device *, | ||
415 | struct device_attribute *attr, | ||
406 | const char *,size_t); | 416 | const char *,size_t); |
407 | ssize_t (*show_val_custom)(struct class_device *,char *); | 417 | ssize_t (*show_val_custom)(struct device *, |
408 | ssize_t (*store_val_custom)(struct class_device *, | 418 | struct device_attribute *attr, char *); |
419 | ssize_t (*store_val_custom)(struct device *, | ||
420 | struct device_attribute *attr, | ||
409 | const char *,size_t); | 421 | const char *,size_t); |
410 | }; | 422 | }; |
411 | 423 | ||
@@ -597,9 +609,9 @@ static void pvr2_sysfs_add_control(struct pvr2_sysfs *sfp,int ctl_id) | |||
597 | } | 609 | } |
598 | 610 | ||
599 | #ifdef CONFIG_VIDEO_PVRUSB2_DEBUGIFC | 611 | #ifdef CONFIG_VIDEO_PVRUSB2_DEBUGIFC |
600 | static ssize_t debuginfo_show(struct class_device *,char *); | 612 | static ssize_t debuginfo_show(struct device *,char *); |
601 | static ssize_t debugcmd_show(struct class_device *,char *); | 613 | static ssize_t debugcmd_show(struct device *,char *); |
602 | static ssize_t debugcmd_store(struct class_device *,const char *,size_t count); | 614 | static ssize_t debugcmd_store(struct device *,const char *,size_t count); |
603 | 615 | ||
604 | static void pvr2_sysfs_add_debugifc(struct pvr2_sysfs *sfp) | 616 | static void pvr2_sysfs_add_debugifc(struct pvr2_sysfs *sfp) |
605 | { | 617 | { |
@@ -616,16 +628,16 @@ static void pvr2_sysfs_add_debugifc(struct pvr2_sysfs *sfp) | |||
616 | dip->attr_debuginfo.attr.mode = S_IRUGO; | 628 | dip->attr_debuginfo.attr.mode = S_IRUGO; |
617 | dip->attr_debuginfo.show = debuginfo_show; | 629 | dip->attr_debuginfo.show = debuginfo_show; |
618 | sfp->debugifc = dip; | 630 | sfp->debugifc = dip; |
619 | ret = class_device_create_file(sfp->class_dev,&dip->attr_debugcmd); | 631 | ret = device_create_file(sfp->class_dev,&dip->attr_debugcmd); |
620 | if (ret < 0) { | 632 | if (ret < 0) { |
621 | printk(KERN_WARNING "%s: class_device_create_file error: %d\n", | 633 | printk(KERN_WARNING "%s: device_create_file error: %d\n", |
622 | __FUNCTION__, ret); | 634 | __FUNCTION__, ret); |
623 | } else { | 635 | } else { |
624 | dip->debugcmd_created_ok = !0; | 636 | dip->debugcmd_created_ok = !0; |
625 | } | 637 | } |
626 | ret = class_device_create_file(sfp->class_dev,&dip->attr_debuginfo); | 638 | ret = device_create_file(sfp->class_dev,&dip->attr_debuginfo); |
627 | if (ret < 0) { | 639 | if (ret < 0) { |
628 | printk(KERN_WARNING "%s: class_device_create_file error: %d\n", | 640 | printk(KERN_WARNING "%s: device_create_file error: %d\n", |
629 | __FUNCTION__, ret); | 641 | __FUNCTION__, ret); |
630 | } else { | 642 | } else { |
631 | dip->debuginfo_created_ok = !0; | 643 | dip->debuginfo_created_ok = !0; |
@@ -637,11 +649,11 @@ static void pvr2_sysfs_tear_down_debugifc(struct pvr2_sysfs *sfp) | |||
637 | { | 649 | { |
638 | if (!sfp->debugifc) return; | 650 | if (!sfp->debugifc) return; |
639 | if (sfp->debugifc->debuginfo_created_ok) { | 651 | if (sfp->debugifc->debuginfo_created_ok) { |
640 | class_device_remove_file(sfp->class_dev, | 652 | device_remove_file(sfp->class_dev, |
641 | &sfp->debugifc->attr_debuginfo); | 653 | &sfp->debugifc->attr_debuginfo); |
642 | } | 654 | } |
643 | if (sfp->debugifc->debugcmd_created_ok) { | 655 | if (sfp->debugifc->debugcmd_created_ok) { |
644 | class_device_remove_file(sfp->class_dev, | 656 | device_remove_file(sfp->class_dev, |
645 | &sfp->debugifc->attr_debugcmd); | 657 | &sfp->debugifc->attr_debugcmd); |
646 | } | 658 | } |
647 | kfree(sfp->debugifc); | 659 | kfree(sfp->debugifc); |
@@ -683,7 +695,7 @@ static void pvr2_sysfs_class_release(struct class *class) | |||
683 | } | 695 | } |
684 | 696 | ||
685 | 697 | ||
686 | static void pvr2_sysfs_release(struct class_device *class_dev) | 698 | static void pvr2_sysfs_release(struct device *class_dev) |
687 | { | 699 | { |
688 | pvr2_sysfs_trace("Releasing class_dev id=%p",class_dev); | 700 | pvr2_sysfs_trace("Releasing class_dev id=%p",class_dev); |
689 | kfree(class_dev); | 701 | kfree(class_dev); |
@@ -698,32 +710,33 @@ static void class_dev_destroy(struct pvr2_sysfs *sfp) | |||
698 | #endif /* CONFIG_VIDEO_PVRUSB2_DEBUGIFC */ | 710 | #endif /* CONFIG_VIDEO_PVRUSB2_DEBUGIFC */ |
699 | pvr2_sysfs_tear_down_controls(sfp); | 711 | pvr2_sysfs_tear_down_controls(sfp); |
700 | if (sfp->bus_info_created_ok) { | 712 | if (sfp->bus_info_created_ok) { |
701 | class_device_remove_file(sfp->class_dev, | 713 | device_remove_file(sfp->class_dev, |
702 | &sfp->attr_bus_info); | 714 | &sfp->attr_bus_info); |
703 | } | 715 | } |
704 | if (sfp->v4l_minor_number_created_ok) { | 716 | if (sfp->v4l_minor_number_created_ok) { |
705 | class_device_remove_file(sfp->class_dev, | 717 | device_remove_file(sfp->class_dev, |
706 | &sfp->attr_v4l_minor_number); | 718 | &sfp->attr_v4l_minor_number); |
707 | } | 719 | } |
708 | if (sfp->v4l_radio_minor_number_created_ok) { | 720 | if (sfp->v4l_radio_minor_number_created_ok) { |
709 | class_device_remove_file(sfp->class_dev, | 721 | device_remove_file(sfp->class_dev, |
710 | &sfp->attr_v4l_radio_minor_number); | 722 | &sfp->attr_v4l_radio_minor_number); |
711 | } | 723 | } |
712 | if (sfp->unit_number_created_ok) { | 724 | if (sfp->unit_number_created_ok) { |
713 | class_device_remove_file(sfp->class_dev, | 725 | device_remove_file(sfp->class_dev, |
714 | &sfp->attr_unit_number); | 726 | &sfp->attr_unit_number); |
715 | } | 727 | } |
716 | pvr2_sysfs_trace("Destroying class_dev id=%p",sfp->class_dev); | 728 | pvr2_sysfs_trace("Destroying class_dev id=%p",sfp->class_dev); |
717 | sfp->class_dev->class_data = NULL; | 729 | sfp->class_dev->driver_data = NULL; |
718 | class_device_unregister(sfp->class_dev); | 730 | device_unregister(sfp->class_dev); |
719 | sfp->class_dev = NULL; | 731 | sfp->class_dev = NULL; |
720 | } | 732 | } |
721 | 733 | ||
722 | 734 | ||
723 | static ssize_t v4l_minor_number_show(struct class_device *class_dev,char *buf) | 735 | static ssize_t v4l_minor_number_show(struct device *class_dev, |
736 | struct device_attribute *attr, char *buf) | ||
724 | { | 737 | { |
725 | struct pvr2_sysfs *sfp; | 738 | struct pvr2_sysfs *sfp; |
726 | sfp = (struct pvr2_sysfs *)class_dev->class_data; | 739 | sfp = (struct pvr2_sysfs *)class_dev->driver_data; |
727 | if (!sfp) return -EINVAL; | 740 | if (!sfp) return -EINVAL; |
728 | return scnprintf(buf,PAGE_SIZE,"%d\n", | 741 | return scnprintf(buf,PAGE_SIZE,"%d\n", |
729 | pvr2_hdw_v4l_get_minor_number(sfp->channel.hdw, | 742 | pvr2_hdw_v4l_get_minor_number(sfp->channel.hdw, |
@@ -731,21 +744,23 @@ static ssize_t v4l_minor_number_show(struct class_device *class_dev,char *buf) | |||
731 | } | 744 | } |
732 | 745 | ||
733 | 746 | ||
734 | static ssize_t bus_info_show(struct class_device *class_dev,char *buf) | 747 | static ssize_t bus_info_show(struct device *class_dev, |
748 | struct device_attribute *attr, char *buf) | ||
735 | { | 749 | { |
736 | struct pvr2_sysfs *sfp; | 750 | struct pvr2_sysfs *sfp; |
737 | sfp = (struct pvr2_sysfs *)class_dev->class_data; | 751 | sfp = (struct pvr2_sysfs *)class_dev->driver_data; |
738 | if (!sfp) return -EINVAL; | 752 | if (!sfp) return -EINVAL; |
739 | return scnprintf(buf,PAGE_SIZE,"%s\n", | 753 | return scnprintf(buf,PAGE_SIZE,"%s\n", |
740 | pvr2_hdw_get_bus_info(sfp->channel.hdw)); | 754 | pvr2_hdw_get_bus_info(sfp->channel.hdw)); |
741 | } | 755 | } |
742 | 756 | ||
743 | 757 | ||
744 | static ssize_t v4l_radio_minor_number_show(struct class_device *class_dev, | 758 | static ssize_t v4l_radio_minor_number_show(struct device *class_dev, |
759 | struct device_attribute *attr, | ||
745 | char *buf) | 760 | char *buf) |
746 | { | 761 | { |
747 | struct pvr2_sysfs *sfp; | 762 | struct pvr2_sysfs *sfp; |
748 | sfp = (struct pvr2_sysfs *)class_dev->class_data; | 763 | sfp = (struct pvr2_sysfs *)class_dev->driver_data; |
749 | if (!sfp) return -EINVAL; | 764 | if (!sfp) return -EINVAL; |
750 | return scnprintf(buf,PAGE_SIZE,"%d\n", | 765 | return scnprintf(buf,PAGE_SIZE,"%d\n", |
751 | pvr2_hdw_v4l_get_minor_number(sfp->channel.hdw, | 766 | pvr2_hdw_v4l_get_minor_number(sfp->channel.hdw, |
@@ -753,10 +768,11 @@ static ssize_t v4l_radio_minor_number_show(struct class_device *class_dev, | |||
753 | } | 768 | } |
754 | 769 | ||
755 | 770 | ||
756 | static ssize_t unit_number_show(struct class_device *class_dev,char *buf) | 771 | static ssize_t unit_number_show(struct device *class_dev, |
772 | struct device_attribute *attr, char *buf) | ||
757 | { | 773 | { |
758 | struct pvr2_sysfs *sfp; | 774 | struct pvr2_sysfs *sfp; |
759 | sfp = (struct pvr2_sysfs *)class_dev->class_data; | 775 | sfp = (struct pvr2_sysfs *)class_dev->driver_data; |
760 | if (!sfp) return -EINVAL; | 776 | if (!sfp) return -EINVAL; |
761 | return scnprintf(buf,PAGE_SIZE,"%d\n", | 777 | return scnprintf(buf,PAGE_SIZE,"%d\n", |
762 | pvr2_hdw_get_unit_number(sfp->channel.hdw)); | 778 | pvr2_hdw_get_unit_number(sfp->channel.hdw)); |
@@ -767,7 +783,7 @@ static void class_dev_create(struct pvr2_sysfs *sfp, | |||
767 | struct pvr2_sysfs_class *class_ptr) | 783 | struct pvr2_sysfs_class *class_ptr) |
768 | { | 784 | { |
769 | struct usb_device *usb_dev; | 785 | struct usb_device *usb_dev; |
770 | struct class_device *class_dev; | 786 | struct device *class_dev; |
771 | int ret; | 787 | int ret; |
772 | 788 | ||
773 | usb_dev = pvr2_hdw_get_dev(sfp->channel.hdw); | 789 | usb_dev = pvr2_hdw_get_dev(sfp->channel.hdw); |
@@ -779,23 +795,23 @@ static void class_dev_create(struct pvr2_sysfs *sfp, | |||
779 | 795 | ||
780 | class_dev->class = &class_ptr->class; | 796 | class_dev->class = &class_ptr->class; |
781 | if (pvr2_hdw_get_sn(sfp->channel.hdw)) { | 797 | if (pvr2_hdw_get_sn(sfp->channel.hdw)) { |
782 | snprintf(class_dev->class_id,BUS_ID_SIZE,"sn-%lu", | 798 | snprintf(class_dev->bus_id, BUS_ID_SIZE, "sn-%lu", |
783 | pvr2_hdw_get_sn(sfp->channel.hdw)); | 799 | pvr2_hdw_get_sn(sfp->channel.hdw)); |
784 | } else if (pvr2_hdw_get_unit_number(sfp->channel.hdw) >= 0) { | 800 | } else if (pvr2_hdw_get_unit_number(sfp->channel.hdw) >= 0) { |
785 | snprintf(class_dev->class_id,BUS_ID_SIZE,"unit-%c", | 801 | snprintf(class_dev->bus_id, BUS_ID_SIZE, "unit-%c", |
786 | pvr2_hdw_get_unit_number(sfp->channel.hdw) + 'a'); | 802 | pvr2_hdw_get_unit_number(sfp->channel.hdw) + 'a'); |
787 | } else { | 803 | } else { |
788 | kfree(class_dev); | 804 | kfree(class_dev); |
789 | return; | 805 | return; |
790 | } | 806 | } |
791 | 807 | ||
792 | class_dev->dev = &usb_dev->dev; | 808 | class_dev->parent = &usb_dev->dev; |
793 | 809 | ||
794 | sfp->class_dev = class_dev; | 810 | sfp->class_dev = class_dev; |
795 | class_dev->class_data = sfp; | 811 | class_dev->driver_data = sfp; |
796 | ret = class_device_register(class_dev); | 812 | ret = device_register(class_dev); |
797 | if (ret) { | 813 | if (ret) { |
798 | printk(KERN_ERR "%s: class_device_register failed\n", | 814 | printk(KERN_ERR "%s: device_register failed\n", |
799 | __FUNCTION__); | 815 | __FUNCTION__); |
800 | kfree(class_dev); | 816 | kfree(class_dev); |
801 | return; | 817 | return; |
@@ -805,10 +821,10 @@ static void class_dev_create(struct pvr2_sysfs *sfp, | |||
805 | sfp->attr_v4l_minor_number.attr.mode = S_IRUGO; | 821 | sfp->attr_v4l_minor_number.attr.mode = S_IRUGO; |
806 | sfp->attr_v4l_minor_number.show = v4l_minor_number_show; | 822 | sfp->attr_v4l_minor_number.show = v4l_minor_number_show; |
807 | sfp->attr_v4l_minor_number.store = NULL; | 823 | sfp->attr_v4l_minor_number.store = NULL; |
808 | ret = class_device_create_file(sfp->class_dev, | 824 | ret = device_create_file(sfp->class_dev, |
809 | &sfp->attr_v4l_minor_number); | 825 | &sfp->attr_v4l_minor_number); |
810 | if (ret < 0) { | 826 | if (ret < 0) { |
811 | printk(KERN_WARNING "%s: class_device_create_file error: %d\n", | 827 | printk(KERN_WARNING "%s: device_create_file error: %d\n", |
812 | __FUNCTION__, ret); | 828 | __FUNCTION__, ret); |
813 | } else { | 829 | } else { |
814 | sfp->v4l_minor_number_created_ok = !0; | 830 | sfp->v4l_minor_number_created_ok = !0; |
@@ -818,10 +834,10 @@ static void class_dev_create(struct pvr2_sysfs *sfp, | |||
818 | sfp->attr_v4l_radio_minor_number.attr.mode = S_IRUGO; | 834 | sfp->attr_v4l_radio_minor_number.attr.mode = S_IRUGO; |
819 | sfp->attr_v4l_radio_minor_number.show = v4l_radio_minor_number_show; | 835 | sfp->attr_v4l_radio_minor_number.show = v4l_radio_minor_number_show; |
820 | sfp->attr_v4l_radio_minor_number.store = NULL; | 836 | sfp->attr_v4l_radio_minor_number.store = NULL; |
821 | ret = class_device_create_file(sfp->class_dev, | 837 | ret = device_create_file(sfp->class_dev, |
822 | &sfp->attr_v4l_radio_minor_number); | 838 | &sfp->attr_v4l_radio_minor_number); |
823 | if (ret < 0) { | 839 | if (ret < 0) { |
824 | printk(KERN_WARNING "%s: class_device_create_file error: %d\n", | 840 | printk(KERN_WARNING "%s: device_create_file error: %d\n", |
825 | __FUNCTION__, ret); | 841 | __FUNCTION__, ret); |
826 | } else { | 842 | } else { |
827 | sfp->v4l_radio_minor_number_created_ok = !0; | 843 | sfp->v4l_radio_minor_number_created_ok = !0; |
@@ -831,9 +847,9 @@ static void class_dev_create(struct pvr2_sysfs *sfp, | |||
831 | sfp->attr_unit_number.attr.mode = S_IRUGO; | 847 | sfp->attr_unit_number.attr.mode = S_IRUGO; |
832 | sfp->attr_unit_number.show = unit_number_show; | 848 | sfp->attr_unit_number.show = unit_number_show; |
833 | sfp->attr_unit_number.store = NULL; | 849 | sfp->attr_unit_number.store = NULL; |
834 | ret = class_device_create_file(sfp->class_dev,&sfp->attr_unit_number); | 850 | ret = device_create_file(sfp->class_dev,&sfp->attr_unit_number); |
835 | if (ret < 0) { | 851 | if (ret < 0) { |
836 | printk(KERN_WARNING "%s: class_device_create_file error: %d\n", | 852 | printk(KERN_WARNING "%s: device_create_file error: %d\n", |
837 | __FUNCTION__, ret); | 853 | __FUNCTION__, ret); |
838 | } else { | 854 | } else { |
839 | sfp->unit_number_created_ok = !0; | 855 | sfp->unit_number_created_ok = !0; |
@@ -843,10 +859,10 @@ static void class_dev_create(struct pvr2_sysfs *sfp, | |||
843 | sfp->attr_bus_info.attr.mode = S_IRUGO; | 859 | sfp->attr_bus_info.attr.mode = S_IRUGO; |
844 | sfp->attr_bus_info.show = bus_info_show; | 860 | sfp->attr_bus_info.show = bus_info_show; |
845 | sfp->attr_bus_info.store = NULL; | 861 | sfp->attr_bus_info.store = NULL; |
846 | ret = class_device_create_file(sfp->class_dev, | 862 | ret = device_create_file(sfp->class_dev, |
847 | &sfp->attr_bus_info); | 863 | &sfp->attr_bus_info); |
848 | if (ret < 0) { | 864 | if (ret < 0) { |
849 | printk(KERN_WARNING "%s: class_device_create_file error: %d\n", | 865 | printk(KERN_WARNING "%s: device_create_file error: %d\n", |
850 | __FUNCTION__, ret); | 866 | __FUNCTION__, ret); |
851 | } else { | 867 | } else { |
852 | sfp->bus_info_created_ok = !0; | 868 | sfp->bus_info_created_ok = !0; |
@@ -886,7 +902,7 @@ struct pvr2_sysfs *pvr2_sysfs_create(struct pvr2_context *mp, | |||
886 | } | 902 | } |
887 | 903 | ||
888 | 904 | ||
889 | static int pvr2_sysfs_hotplug(struct class_device *cd,char **envp, | 905 | static int pvr2_sysfs_hotplug(struct device *cd,char **envp, |
890 | int numenvp,char *buf,int size) | 906 | int numenvp,char *buf,int size) |
891 | { | 907 | { |
892 | /* Even though we don't do anything here, we still need this function | 908 | /* Even though we don't do anything here, we still need this function |
@@ -902,8 +918,8 @@ struct pvr2_sysfs_class *pvr2_sysfs_class_create(void) | |||
902 | pvr2_sysfs_trace("Creating pvr2_sysfs_class id=%p",clp); | 918 | pvr2_sysfs_trace("Creating pvr2_sysfs_class id=%p",clp); |
903 | clp->class.name = "pvrusb2"; | 919 | clp->class.name = "pvrusb2"; |
904 | clp->class.class_release = pvr2_sysfs_class_release; | 920 | clp->class.class_release = pvr2_sysfs_class_release; |
905 | clp->class.release = pvr2_sysfs_release; | 921 | clp->class.dev_release = pvr2_sysfs_release; |
906 | clp->class.uevent = pvr2_sysfs_hotplug; | 922 | clp->class.dev_uevent = pvr2_sysfs_hotplug; |
907 | if (class_register(&clp->class)) { | 923 | if (class_register(&clp->class)) { |
908 | pvr2_sysfs_trace( | 924 | pvr2_sysfs_trace( |
909 | "Registration failed for pvr2_sysfs_class id=%p",clp); | 925 | "Registration failed for pvr2_sysfs_class id=%p",clp); |
@@ -921,32 +937,32 @@ void pvr2_sysfs_class_destroy(struct pvr2_sysfs_class *clp) | |||
921 | 937 | ||
922 | 938 | ||
923 | #ifdef CONFIG_VIDEO_PVRUSB2_DEBUGIFC | 939 | #ifdef CONFIG_VIDEO_PVRUSB2_DEBUGIFC |
924 | static ssize_t debuginfo_show(struct class_device *class_dev,char *buf) | 940 | static ssize_t debuginfo_show(struct device *class_dev,char *buf) |
925 | { | 941 | { |
926 | struct pvr2_sysfs *sfp; | 942 | struct pvr2_sysfs *sfp; |
927 | sfp = (struct pvr2_sysfs *)class_dev->class_data; | 943 | sfp = (struct pvr2_sysfs *)class_dev->driver_data; |
928 | if (!sfp) return -EINVAL; | 944 | if (!sfp) return -EINVAL; |
929 | pvr2_hdw_trigger_module_log(sfp->channel.hdw); | 945 | pvr2_hdw_trigger_module_log(sfp->channel.hdw); |
930 | return pvr2_debugifc_print_info(sfp->channel.hdw,buf,PAGE_SIZE); | 946 | return pvr2_debugifc_print_info(sfp->channel.hdw,buf,PAGE_SIZE); |
931 | } | 947 | } |
932 | 948 | ||
933 | 949 | ||
934 | static ssize_t debugcmd_show(struct class_device *class_dev,char *buf) | 950 | static ssize_t debugcmd_show(struct device *class_dev,char *buf) |
935 | { | 951 | { |
936 | struct pvr2_sysfs *sfp; | 952 | struct pvr2_sysfs *sfp; |
937 | sfp = (struct pvr2_sysfs *)class_dev->class_data; | 953 | sfp = (struct pvr2_sysfs *)class_dev->driver_data; |
938 | if (!sfp) return -EINVAL; | 954 | if (!sfp) return -EINVAL; |
939 | return pvr2_debugifc_print_status(sfp->channel.hdw,buf,PAGE_SIZE); | 955 | return pvr2_debugifc_print_status(sfp->channel.hdw,buf,PAGE_SIZE); |
940 | } | 956 | } |
941 | 957 | ||
942 | 958 | ||
943 | static ssize_t debugcmd_store(struct class_device *class_dev, | 959 | static ssize_t debugcmd_store(struct device *class_dev, |
944 | const char *buf,size_t count) | 960 | const char *buf, size_t count) |
945 | { | 961 | { |
946 | struct pvr2_sysfs *sfp; | 962 | struct pvr2_sysfs *sfp; |
947 | int ret; | 963 | int ret; |
948 | 964 | ||
949 | sfp = (struct pvr2_sysfs *)class_dev->class_data; | 965 | sfp = (struct pvr2_sysfs *)class_dev->driver_data; |
950 | if (!sfp) return -EINVAL; | 966 | if (!sfp) return -EINVAL; |
951 | 967 | ||
952 | ret = pvr2_debugifc_docmd(sfp->channel.hdw,buf,count); | 968 | ret = pvr2_debugifc_docmd(sfp->channel.hdw,buf,count); |
diff --git a/drivers/media/video/pwc/pwc-if.c b/drivers/media/video/pwc/pwc-if.c index 0ff5718bf9b9..0b67d4ec0318 100644 --- a/drivers/media/video/pwc/pwc-if.c +++ b/drivers/media/video/pwc/pwc-if.c | |||
@@ -996,20 +996,22 @@ int pwc_try_video_mode(struct pwc_device *pdev, int width, int height, int new_f | |||
996 | /********* | 996 | /********* |
997 | * sysfs | 997 | * sysfs |
998 | *********/ | 998 | *********/ |
999 | static struct pwc_device *cd_to_pwc(struct class_device *cd) | 999 | static struct pwc_device *cd_to_pwc(struct device *cd) |
1000 | { | 1000 | { |
1001 | struct video_device *vdev = to_video_device(cd); | 1001 | struct video_device *vdev = to_video_device(cd); |
1002 | return video_get_drvdata(vdev); | 1002 | return video_get_drvdata(vdev); |
1003 | } | 1003 | } |
1004 | 1004 | ||
1005 | static ssize_t show_pan_tilt(struct class_device *class_dev, char *buf) | 1005 | static ssize_t show_pan_tilt(struct device *class_dev, |
1006 | struct device_attribute *attr, char *buf) | ||
1006 | { | 1007 | { |
1007 | struct pwc_device *pdev = cd_to_pwc(class_dev); | 1008 | struct pwc_device *pdev = cd_to_pwc(class_dev); |
1008 | return sprintf(buf, "%d %d\n", pdev->pan_angle, pdev->tilt_angle); | 1009 | return sprintf(buf, "%d %d\n", pdev->pan_angle, pdev->tilt_angle); |
1009 | } | 1010 | } |
1010 | 1011 | ||
1011 | static ssize_t store_pan_tilt(struct class_device *class_dev, const char *buf, | 1012 | static ssize_t store_pan_tilt(struct device *class_dev, |
1012 | size_t count) | 1013 | struct device_attribute *attr, |
1014 | const char *buf, size_t count) | ||
1013 | { | 1015 | { |
1014 | struct pwc_device *pdev = cd_to_pwc(class_dev); | 1016 | struct pwc_device *pdev = cd_to_pwc(class_dev); |
1015 | int pan, tilt; | 1017 | int pan, tilt; |
@@ -1025,10 +1027,11 @@ static ssize_t store_pan_tilt(struct class_device *class_dev, const char *buf, | |||
1025 | return ret; | 1027 | return ret; |
1026 | return strlen(buf); | 1028 | return strlen(buf); |
1027 | } | 1029 | } |
1028 | static CLASS_DEVICE_ATTR(pan_tilt, S_IRUGO | S_IWUSR, show_pan_tilt, | 1030 | static DEVICE_ATTR(pan_tilt, S_IRUGO | S_IWUSR, show_pan_tilt, |
1029 | store_pan_tilt); | 1031 | store_pan_tilt); |
1030 | 1032 | ||
1031 | static ssize_t show_snapshot_button_status(struct class_device *class_dev, char *buf) | 1033 | static ssize_t show_snapshot_button_status(struct device *class_dev, |
1034 | struct device_attribute *attr, char *buf) | ||
1032 | { | 1035 | { |
1033 | struct pwc_device *pdev = cd_to_pwc(class_dev); | 1036 | struct pwc_device *pdev = cd_to_pwc(class_dev); |
1034 | int status = pdev->snapshot_button_status; | 1037 | int status = pdev->snapshot_button_status; |
@@ -1036,26 +1039,26 @@ static ssize_t show_snapshot_button_status(struct class_device *class_dev, char | |||
1036 | return sprintf(buf, "%d\n", status); | 1039 | return sprintf(buf, "%d\n", status); |
1037 | } | 1040 | } |
1038 | 1041 | ||
1039 | static CLASS_DEVICE_ATTR(button, S_IRUGO | S_IWUSR, show_snapshot_button_status, | 1042 | static DEVICE_ATTR(button, S_IRUGO | S_IWUSR, show_snapshot_button_status, |
1040 | NULL); | 1043 | NULL); |
1041 | 1044 | ||
1042 | static int pwc_create_sysfs_files(struct video_device *vdev) | 1045 | static int pwc_create_sysfs_files(struct video_device *vdev) |
1043 | { | 1046 | { |
1044 | struct pwc_device *pdev = video_get_drvdata(vdev); | 1047 | struct pwc_device *pdev = video_get_drvdata(vdev); |
1045 | int rc; | 1048 | int rc; |
1046 | 1049 | ||
1047 | rc = video_device_create_file(vdev, &class_device_attr_button); | 1050 | rc = video_device_create_file(vdev, &dev_attr_button); |
1048 | if (rc) | 1051 | if (rc) |
1049 | goto err; | 1052 | goto err; |
1050 | if (pdev->features & FEATURE_MOTOR_PANTILT) { | 1053 | if (pdev->features & FEATURE_MOTOR_PANTILT) { |
1051 | rc = video_device_create_file(vdev,&class_device_attr_pan_tilt); | 1054 | rc = video_device_create_file(vdev, &dev_attr_pan_tilt); |
1052 | if (rc) goto err_button; | 1055 | if (rc) goto err_button; |
1053 | } | 1056 | } |
1054 | 1057 | ||
1055 | return 0; | 1058 | return 0; |
1056 | 1059 | ||
1057 | err_button: | 1060 | err_button: |
1058 | video_device_remove_file(vdev, &class_device_attr_button); | 1061 | video_device_remove_file(vdev, &dev_attr_button); |
1059 | err: | 1062 | err: |
1060 | return rc; | 1063 | return rc; |
1061 | } | 1064 | } |
@@ -1064,8 +1067,8 @@ static void pwc_remove_sysfs_files(struct video_device *vdev) | |||
1064 | { | 1067 | { |
1065 | struct pwc_device *pdev = video_get_drvdata(vdev); | 1068 | struct pwc_device *pdev = video_get_drvdata(vdev); |
1066 | if (pdev->features & FEATURE_MOTOR_PANTILT) | 1069 | if (pdev->features & FEATURE_MOTOR_PANTILT) |
1067 | video_device_remove_file(vdev, &class_device_attr_pan_tilt); | 1070 | video_device_remove_file(vdev, &dev_attr_pan_tilt); |
1068 | video_device_remove_file(vdev, &class_device_attr_button); | 1071 | video_device_remove_file(vdev, &dev_attr_button); |
1069 | } | 1072 | } |
1070 | 1073 | ||
1071 | #ifdef CONFIG_USB_PWC_DEBUG | 1074 | #ifdef CONFIG_USB_PWC_DEBUG |
diff --git a/drivers/media/video/sn9c102/sn9c102_core.c b/drivers/media/video/sn9c102/sn9c102_core.c index e0accf1b8713..6991e06f7651 100644 --- a/drivers/media/video/sn9c102/sn9c102_core.c +++ b/drivers/media/video/sn9c102/sn9c102_core.c | |||
@@ -1029,7 +1029,8 @@ static u16 sn9c102_strtou16(const char* buff, size_t len, ssize_t* count) | |||
1029 | NOTE 2: buffers are PAGE_SIZE long | 1029 | NOTE 2: buffers are PAGE_SIZE long |
1030 | */ | 1030 | */ |
1031 | 1031 | ||
1032 | static ssize_t sn9c102_show_reg(struct class_device* cd, char* buf) | 1032 | static ssize_t sn9c102_show_reg(struct device* cd, |
1033 | struct device_attribute *attr, char* buf) | ||
1033 | { | 1034 | { |
1034 | struct sn9c102_device* cam; | 1035 | struct sn9c102_device* cam; |
1035 | ssize_t count; | 1036 | ssize_t count; |
@@ -1053,7 +1054,8 @@ static ssize_t sn9c102_show_reg(struct class_device* cd, char* buf) | |||
1053 | 1054 | ||
1054 | 1055 | ||
1055 | static ssize_t | 1056 | static ssize_t |
1056 | sn9c102_store_reg(struct class_device* cd, const char* buf, size_t len) | 1057 | sn9c102_store_reg(struct device* cd, struct device_attribute *attr, |
1058 | const char* buf, size_t len) | ||
1057 | { | 1059 | { |
1058 | struct sn9c102_device* cam; | 1060 | struct sn9c102_device* cam; |
1059 | u16 index; | 1061 | u16 index; |
@@ -1086,7 +1088,8 @@ sn9c102_store_reg(struct class_device* cd, const char* buf, size_t len) | |||
1086 | } | 1088 | } |
1087 | 1089 | ||
1088 | 1090 | ||
1089 | static ssize_t sn9c102_show_val(struct class_device* cd, char* buf) | 1091 | static ssize_t sn9c102_show_val(struct device* cd, |
1092 | struct device_attribute *attr, char* buf) | ||
1090 | { | 1093 | { |
1091 | struct sn9c102_device* cam; | 1094 | struct sn9c102_device* cam; |
1092 | ssize_t count; | 1095 | ssize_t count; |
@@ -1118,7 +1121,8 @@ static ssize_t sn9c102_show_val(struct class_device* cd, char* buf) | |||
1118 | 1121 | ||
1119 | 1122 | ||
1120 | static ssize_t | 1123 | static ssize_t |
1121 | sn9c102_store_val(struct class_device* cd, const char* buf, size_t len) | 1124 | sn9c102_store_val(struct device* cd, struct device_attribute *attr, |
1125 | const char* buf, size_t len) | ||
1122 | { | 1126 | { |
1123 | struct sn9c102_device* cam; | 1127 | struct sn9c102_device* cam; |
1124 | u16 value; | 1128 | u16 value; |
@@ -1157,7 +1161,8 @@ sn9c102_store_val(struct class_device* cd, const char* buf, size_t len) | |||
1157 | } | 1161 | } |
1158 | 1162 | ||
1159 | 1163 | ||
1160 | static ssize_t sn9c102_show_i2c_reg(struct class_device* cd, char* buf) | 1164 | static ssize_t sn9c102_show_i2c_reg(struct device* cd, |
1165 | struct device_attribute *attr, char* buf) | ||
1161 | { | 1166 | { |
1162 | struct sn9c102_device* cam; | 1167 | struct sn9c102_device* cam; |
1163 | ssize_t count; | 1168 | ssize_t count; |
@@ -1183,7 +1188,8 @@ static ssize_t sn9c102_show_i2c_reg(struct class_device* cd, char* buf) | |||
1183 | 1188 | ||
1184 | 1189 | ||
1185 | static ssize_t | 1190 | static ssize_t |
1186 | sn9c102_store_i2c_reg(struct class_device* cd, const char* buf, size_t len) | 1191 | sn9c102_store_i2c_reg(struct device* cd, struct device_attribute *attr, |
1192 | const char* buf, size_t len) | ||
1187 | { | 1193 | { |
1188 | struct sn9c102_device* cam; | 1194 | struct sn9c102_device* cam; |
1189 | u16 index; | 1195 | u16 index; |
@@ -1216,7 +1222,8 @@ sn9c102_store_i2c_reg(struct class_device* cd, const char* buf, size_t len) | |||
1216 | } | 1222 | } |
1217 | 1223 | ||
1218 | 1224 | ||
1219 | static ssize_t sn9c102_show_i2c_val(struct class_device* cd, char* buf) | 1225 | static ssize_t sn9c102_show_i2c_val(struct device* cd, |
1226 | struct device_attribute *attr, char* buf) | ||
1220 | { | 1227 | { |
1221 | struct sn9c102_device* cam; | 1228 | struct sn9c102_device* cam; |
1222 | ssize_t count; | 1229 | ssize_t count; |
@@ -1253,7 +1260,8 @@ static ssize_t sn9c102_show_i2c_val(struct class_device* cd, char* buf) | |||
1253 | 1260 | ||
1254 | 1261 | ||
1255 | static ssize_t | 1262 | static ssize_t |
1256 | sn9c102_store_i2c_val(struct class_device* cd, const char* buf, size_t len) | 1263 | sn9c102_store_i2c_val(struct device* cd, struct device_attribute *attr, |
1264 | const char* buf, size_t len) | ||
1257 | { | 1265 | { |
1258 | struct sn9c102_device* cam; | 1266 | struct sn9c102_device* cam; |
1259 | u16 value; | 1267 | u16 value; |
@@ -1298,7 +1306,8 @@ sn9c102_store_i2c_val(struct class_device* cd, const char* buf, size_t len) | |||
1298 | 1306 | ||
1299 | 1307 | ||
1300 | static ssize_t | 1308 | static ssize_t |
1301 | sn9c102_store_green(struct class_device* cd, const char* buf, size_t len) | 1309 | sn9c102_store_green(struct device* cd, struct device_attribute *attr, |
1310 | const char* buf, size_t len) | ||
1302 | { | 1311 | { |
1303 | struct sn9c102_device* cam; | 1312 | struct sn9c102_device* cam; |
1304 | enum sn9c102_bridge bridge; | 1313 | enum sn9c102_bridge bridge; |
@@ -1329,16 +1338,16 @@ sn9c102_store_green(struct class_device* cd, const char* buf, size_t len) | |||
1329 | case BRIDGE_SN9C102: | 1338 | case BRIDGE_SN9C102: |
1330 | if (value > 0x0f) | 1339 | if (value > 0x0f) |
1331 | return -EINVAL; | 1340 | return -EINVAL; |
1332 | if ((res = sn9c102_store_reg(cd, "0x11", 4)) >= 0) | 1341 | if ((res = sn9c102_store_reg(cd, attr, "0x11", 4)) >= 0) |
1333 | res = sn9c102_store_val(cd, buf, len); | 1342 | res = sn9c102_store_val(cd, attr, buf, len); |
1334 | break; | 1343 | break; |
1335 | case BRIDGE_SN9C103: | 1344 | case BRIDGE_SN9C103: |
1336 | case BRIDGE_SN9C105: | 1345 | case BRIDGE_SN9C105: |
1337 | case BRIDGE_SN9C120: | 1346 | case BRIDGE_SN9C120: |
1338 | if (value > 0x7f) | 1347 | if (value > 0x7f) |
1339 | return -EINVAL; | 1348 | return -EINVAL; |
1340 | if ((res = sn9c102_store_reg(cd, "0x07", 4)) >= 0) | 1349 | if ((res = sn9c102_store_reg(cd, attr, "0x07", 4)) >= 0) |
1341 | res = sn9c102_store_val(cd, buf, len); | 1350 | res = sn9c102_store_val(cd, attr, buf, len); |
1342 | break; | 1351 | break; |
1343 | } | 1352 | } |
1344 | 1353 | ||
@@ -1347,7 +1356,8 @@ sn9c102_store_green(struct class_device* cd, const char* buf, size_t len) | |||
1347 | 1356 | ||
1348 | 1357 | ||
1349 | static ssize_t | 1358 | static ssize_t |
1350 | sn9c102_store_blue(struct class_device* cd, const char* buf, size_t len) | 1359 | sn9c102_store_blue(struct device* cd, struct device_attribute *attr, |
1360 | const char* buf, size_t len) | ||
1351 | { | 1361 | { |
1352 | ssize_t res = 0; | 1362 | ssize_t res = 0; |
1353 | u16 value; | 1363 | u16 value; |
@@ -1357,15 +1367,16 @@ sn9c102_store_blue(struct class_device* cd, const char* buf, size_t len) | |||
1357 | if (!count || value > 0x7f) | 1367 | if (!count || value > 0x7f) |
1358 | return -EINVAL; | 1368 | return -EINVAL; |
1359 | 1369 | ||
1360 | if ((res = sn9c102_store_reg(cd, "0x06", 4)) >= 0) | 1370 | if ((res = sn9c102_store_reg(cd, attr, "0x06", 4)) >= 0) |
1361 | res = sn9c102_store_val(cd, buf, len); | 1371 | res = sn9c102_store_val(cd, attr, buf, len); |
1362 | 1372 | ||
1363 | return res; | 1373 | return res; |
1364 | } | 1374 | } |
1365 | 1375 | ||
1366 | 1376 | ||
1367 | static ssize_t | 1377 | static ssize_t |
1368 | sn9c102_store_red(struct class_device* cd, const char* buf, size_t len) | 1378 | sn9c102_store_red(struct device* cd, struct device_attribute *attr, |
1379 | const char* buf, size_t len) | ||
1369 | { | 1380 | { |
1370 | ssize_t res = 0; | 1381 | ssize_t res = 0; |
1371 | u16 value; | 1382 | u16 value; |
@@ -1375,14 +1386,16 @@ sn9c102_store_red(struct class_device* cd, const char* buf, size_t len) | |||
1375 | if (!count || value > 0x7f) | 1386 | if (!count || value > 0x7f) |
1376 | return -EINVAL; | 1387 | return -EINVAL; |
1377 | 1388 | ||
1378 | if ((res = sn9c102_store_reg(cd, "0x05", 4)) >= 0) | 1389 | if ((res = sn9c102_store_reg(cd, attr, "0x05", 4)) >= 0) |
1379 | res = sn9c102_store_val(cd, buf, len); | 1390 | res = sn9c102_store_val(cd, attr, buf, len); |
1380 | 1391 | ||
1381 | return res; | 1392 | return res; |
1382 | } | 1393 | } |
1383 | 1394 | ||
1384 | 1395 | ||
1385 | static ssize_t sn9c102_show_frame_header(struct class_device* cd, char* buf) | 1396 | static ssize_t sn9c102_show_frame_header(struct device* cd, |
1397 | struct device_attribute *attr, | ||
1398 | char* buf) | ||
1386 | { | 1399 | { |
1387 | struct sn9c102_device* cam; | 1400 | struct sn9c102_device* cam; |
1388 | ssize_t count; | 1401 | ssize_t count; |
@@ -1401,72 +1414,63 @@ static ssize_t sn9c102_show_frame_header(struct class_device* cd, char* buf) | |||
1401 | } | 1414 | } |
1402 | 1415 | ||
1403 | 1416 | ||
1404 | static CLASS_DEVICE_ATTR(reg, S_IRUGO | S_IWUSR, | 1417 | static DEVICE_ATTR(reg, S_IRUGO | S_IWUSR, sn9c102_show_reg, sn9c102_store_reg); |
1405 | sn9c102_show_reg, sn9c102_store_reg); | 1418 | static DEVICE_ATTR(val, S_IRUGO | S_IWUSR, sn9c102_show_val, sn9c102_store_val); |
1406 | static CLASS_DEVICE_ATTR(val, S_IRUGO | S_IWUSR, | 1419 | static DEVICE_ATTR(i2c_reg, S_IRUGO | S_IWUSR, |
1407 | sn9c102_show_val, sn9c102_store_val); | 1420 | sn9c102_show_i2c_reg, sn9c102_store_i2c_reg); |
1408 | static CLASS_DEVICE_ATTR(i2c_reg, S_IRUGO | S_IWUSR, | 1421 | static DEVICE_ATTR(i2c_val, S_IRUGO | S_IWUSR, |
1409 | sn9c102_show_i2c_reg, sn9c102_store_i2c_reg); | 1422 | sn9c102_show_i2c_val, sn9c102_store_i2c_val); |
1410 | static CLASS_DEVICE_ATTR(i2c_val, S_IRUGO | S_IWUSR, | 1423 | static DEVICE_ATTR(green, S_IWUGO, NULL, sn9c102_store_green); |
1411 | sn9c102_show_i2c_val, sn9c102_store_i2c_val); | 1424 | static DEVICE_ATTR(blue, S_IWUGO, NULL, sn9c102_store_blue); |
1412 | static CLASS_DEVICE_ATTR(green, S_IWUGO, NULL, sn9c102_store_green); | 1425 | static DEVICE_ATTR(red, S_IWUGO, NULL, sn9c102_store_red); |
1413 | static CLASS_DEVICE_ATTR(blue, S_IWUGO, NULL, sn9c102_store_blue); | 1426 | static DEVICE_ATTR(frame_header, S_IRUGO, sn9c102_show_frame_header, NULL); |
1414 | static CLASS_DEVICE_ATTR(red, S_IWUGO, NULL, sn9c102_store_red); | ||
1415 | static CLASS_DEVICE_ATTR(frame_header, S_IRUGO, | ||
1416 | sn9c102_show_frame_header, NULL); | ||
1417 | 1427 | ||
1418 | 1428 | ||
1419 | static int sn9c102_create_sysfs(struct sn9c102_device* cam) | 1429 | static int sn9c102_create_sysfs(struct sn9c102_device* cam) |
1420 | { | 1430 | { |
1421 | struct class_device *classdev = &(cam->v4ldev->class_dev); | 1431 | struct device *classdev = &(cam->v4ldev->class_dev); |
1422 | int err = 0; | 1432 | int err = 0; |
1423 | 1433 | ||
1424 | if ((err = class_device_create_file(classdev, &class_device_attr_reg))) | 1434 | if ((err = device_create_file(classdev, &dev_attr_reg))) |
1425 | goto err_out; | 1435 | goto err_out; |
1426 | if ((err = class_device_create_file(classdev, &class_device_attr_val))) | 1436 | if ((err = device_create_file(classdev, &dev_attr_val))) |
1427 | goto err_reg; | 1437 | goto err_reg; |
1428 | if ((err = class_device_create_file(classdev, | 1438 | if ((err = device_create_file(classdev, &dev_attr_frame_header))) |
1429 | &class_device_attr_frame_header))) | ||
1430 | goto err_val; | 1439 | goto err_val; |
1431 | 1440 | ||
1432 | if (cam->sensor.sysfs_ops) { | 1441 | if (cam->sensor.sysfs_ops) { |
1433 | if ((err = class_device_create_file(classdev, | 1442 | if ((err = device_create_file(classdev, &dev_attr_i2c_reg))) |
1434 | &class_device_attr_i2c_reg))) | ||
1435 | goto err_frame_header; | 1443 | goto err_frame_header; |
1436 | if ((err = class_device_create_file(classdev, | 1444 | if ((err = device_create_file(classdev, &dev_attr_i2c_val))) |
1437 | &class_device_attr_i2c_val))) | ||
1438 | goto err_i2c_reg; | 1445 | goto err_i2c_reg; |
1439 | } | 1446 | } |
1440 | 1447 | ||
1441 | if (cam->bridge == BRIDGE_SN9C101 || cam->bridge == BRIDGE_SN9C102) { | 1448 | if (cam->bridge == BRIDGE_SN9C101 || cam->bridge == BRIDGE_SN9C102) { |
1442 | if ((err = class_device_create_file(classdev, | 1449 | if ((err = device_create_file(classdev, &dev_attr_green))) |
1443 | &class_device_attr_green))) | ||
1444 | goto err_i2c_val; | 1450 | goto err_i2c_val; |
1445 | } else { | 1451 | } else { |
1446 | if ((err = class_device_create_file(classdev, | 1452 | if ((err = device_create_file(classdev, &dev_attr_blue))) |
1447 | &class_device_attr_blue))) | ||
1448 | goto err_i2c_val; | 1453 | goto err_i2c_val; |
1449 | if ((err = class_device_create_file(classdev, | 1454 | if ((err = device_create_file(classdev, &dev_attr_red))) |
1450 | &class_device_attr_red))) | ||
1451 | goto err_blue; | 1455 | goto err_blue; |
1452 | } | 1456 | } |
1453 | 1457 | ||
1454 | return 0; | 1458 | return 0; |
1455 | 1459 | ||
1456 | err_blue: | 1460 | err_blue: |
1457 | class_device_remove_file(classdev, &class_device_attr_blue); | 1461 | device_remove_file(classdev, &dev_attr_blue); |
1458 | err_i2c_val: | 1462 | err_i2c_val: |
1459 | if (cam->sensor.sysfs_ops) | 1463 | if (cam->sensor.sysfs_ops) |
1460 | class_device_remove_file(classdev, &class_device_attr_i2c_val); | 1464 | device_remove_file(classdev, &dev_attr_i2c_val); |
1461 | err_i2c_reg: | 1465 | err_i2c_reg: |
1462 | if (cam->sensor.sysfs_ops) | 1466 | if (cam->sensor.sysfs_ops) |
1463 | class_device_remove_file(classdev, &class_device_attr_i2c_reg); | 1467 | device_remove_file(classdev, &dev_attr_i2c_reg); |
1464 | err_frame_header: | 1468 | err_frame_header: |
1465 | class_device_remove_file(classdev, &class_device_attr_frame_header); | 1469 | device_remove_file(classdev, &dev_attr_frame_header); |
1466 | err_val: | 1470 | err_val: |
1467 | class_device_remove_file(classdev, &class_device_attr_val); | 1471 | device_remove_file(classdev, &dev_attr_val); |
1468 | err_reg: | 1472 | err_reg: |
1469 | class_device_remove_file(classdev, &class_device_attr_reg); | 1473 | device_remove_file(classdev, &dev_attr_reg); |
1470 | err_out: | 1474 | err_out: |
1471 | return err; | 1475 | return err; |
1472 | } | 1476 | } |
diff --git a/drivers/media/video/stv680.c b/drivers/media/video/stv680.c index 4dc5bc714b95..9e009a7ab863 100644 --- a/drivers/media/video/stv680.c +++ b/drivers/media/video/stv680.c | |||
@@ -499,13 +499,14 @@ exit: | |||
499 | * sysfs | 499 | * sysfs |
500 | ***************************************************************************/ | 500 | ***************************************************************************/ |
501 | #define stv680_file(name, variable, field) \ | 501 | #define stv680_file(name, variable, field) \ |
502 | static ssize_t show_##name(struct class_device *class_dev, char *buf) \ | 502 | static ssize_t show_##name(struct device *class_dev, \ |
503 | struct device_attribute *attr, char *buf) \ | ||
503 | { \ | 504 | { \ |
504 | struct video_device *vdev = to_video_device(class_dev); \ | 505 | struct video_device *vdev = to_video_device(class_dev); \ |
505 | struct usb_stv *stv = video_get_drvdata(vdev); \ | 506 | struct usb_stv *stv = video_get_drvdata(vdev); \ |
506 | return sprintf(buf, field, stv->variable); \ | 507 | return sprintf(buf, field, stv->variable); \ |
507 | } \ | 508 | } \ |
508 | static CLASS_DEVICE_ATTR(name, S_IRUGO, show_##name, NULL); | 509 | static DEVICE_ATTR(name, S_IRUGO, show_##name, NULL); |
509 | 510 | ||
510 | stv680_file(model, camera_name, "%s\n"); | 511 | stv680_file(model, camera_name, "%s\n"); |
511 | stv680_file(in_use, user, "%d\n"); | 512 | stv680_file(in_use, user, "%d\n"); |
@@ -520,53 +521,53 @@ static int stv680_create_sysfs_files(struct video_device *vdev) | |||
520 | { | 521 | { |
521 | int rc; | 522 | int rc; |
522 | 523 | ||
523 | rc = video_device_create_file(vdev, &class_device_attr_model); | 524 | rc = video_device_create_file(vdev, &dev_attr_model); |
524 | if (rc) goto err; | 525 | if (rc) goto err; |
525 | rc = video_device_create_file(vdev, &class_device_attr_in_use); | 526 | rc = video_device_create_file(vdev, &dev_attr_in_use); |
526 | if (rc) goto err_model; | 527 | if (rc) goto err_model; |
527 | rc = video_device_create_file(vdev, &class_device_attr_streaming); | 528 | rc = video_device_create_file(vdev, &dev_attr_streaming); |
528 | if (rc) goto err_inuse; | 529 | if (rc) goto err_inuse; |
529 | rc = video_device_create_file(vdev, &class_device_attr_palette); | 530 | rc = video_device_create_file(vdev, &dev_attr_palette); |
530 | if (rc) goto err_stream; | 531 | if (rc) goto err_stream; |
531 | rc = video_device_create_file(vdev, &class_device_attr_frames_total); | 532 | rc = video_device_create_file(vdev, &dev_attr_frames_total); |
532 | if (rc) goto err_pal; | 533 | if (rc) goto err_pal; |
533 | rc = video_device_create_file(vdev, &class_device_attr_frames_read); | 534 | rc = video_device_create_file(vdev, &dev_attr_frames_read); |
534 | if (rc) goto err_framtot; | 535 | if (rc) goto err_framtot; |
535 | rc = video_device_create_file(vdev, &class_device_attr_packets_dropped); | 536 | rc = video_device_create_file(vdev, &dev_attr_packets_dropped); |
536 | if (rc) goto err_framread; | 537 | if (rc) goto err_framread; |
537 | rc = video_device_create_file(vdev, &class_device_attr_decoding_errors); | 538 | rc = video_device_create_file(vdev, &dev_attr_decoding_errors); |
538 | if (rc) goto err_dropped; | 539 | if (rc) goto err_dropped; |
539 | 540 | ||
540 | return 0; | 541 | return 0; |
541 | 542 | ||
542 | err_dropped: | 543 | err_dropped: |
543 | video_device_remove_file(vdev, &class_device_attr_packets_dropped); | 544 | video_device_remove_file(vdev, &dev_attr_packets_dropped); |
544 | err_framread: | 545 | err_framread: |
545 | video_device_remove_file(vdev, &class_device_attr_frames_read); | 546 | video_device_remove_file(vdev, &dev_attr_frames_read); |
546 | err_framtot: | 547 | err_framtot: |
547 | video_device_remove_file(vdev, &class_device_attr_frames_total); | 548 | video_device_remove_file(vdev, &dev_attr_frames_total); |
548 | err_pal: | 549 | err_pal: |
549 | video_device_remove_file(vdev, &class_device_attr_palette); | 550 | video_device_remove_file(vdev, &dev_attr_palette); |
550 | err_stream: | 551 | err_stream: |
551 | video_device_remove_file(vdev, &class_device_attr_streaming); | 552 | video_device_remove_file(vdev, &dev_attr_streaming); |
552 | err_inuse: | 553 | err_inuse: |
553 | video_device_remove_file(vdev, &class_device_attr_in_use); | 554 | video_device_remove_file(vdev, &dev_attr_in_use); |
554 | err_model: | 555 | err_model: |
555 | video_device_remove_file(vdev, &class_device_attr_model); | 556 | video_device_remove_file(vdev, &dev_attr_model); |
556 | err: | 557 | err: |
557 | return rc; | 558 | return rc; |
558 | } | 559 | } |
559 | 560 | ||
560 | static void stv680_remove_sysfs_files(struct video_device *vdev) | 561 | static void stv680_remove_sysfs_files(struct video_device *vdev) |
561 | { | 562 | { |
562 | video_device_remove_file(vdev, &class_device_attr_model); | 563 | video_device_remove_file(vdev, &dev_attr_model); |
563 | video_device_remove_file(vdev, &class_device_attr_in_use); | 564 | video_device_remove_file(vdev, &dev_attr_in_use); |
564 | video_device_remove_file(vdev, &class_device_attr_streaming); | 565 | video_device_remove_file(vdev, &dev_attr_streaming); |
565 | video_device_remove_file(vdev, &class_device_attr_palette); | 566 | video_device_remove_file(vdev, &dev_attr_palette); |
566 | video_device_remove_file(vdev, &class_device_attr_frames_total); | 567 | video_device_remove_file(vdev, &dev_attr_frames_total); |
567 | video_device_remove_file(vdev, &class_device_attr_frames_read); | 568 | video_device_remove_file(vdev, &dev_attr_frames_read); |
568 | video_device_remove_file(vdev, &class_device_attr_packets_dropped); | 569 | video_device_remove_file(vdev, &dev_attr_packets_dropped); |
569 | video_device_remove_file(vdev, &class_device_attr_decoding_errors); | 570 | video_device_remove_file(vdev, &dev_attr_decoding_errors); |
570 | } | 571 | } |
571 | 572 | ||
572 | /******************************************************************** | 573 | /******************************************************************** |
diff --git a/drivers/media/video/usbvision/usbvision-video.c b/drivers/media/video/usbvision/usbvision-video.c index 2f9b2b9e3b09..e2f3c01cfa13 100644 --- a/drivers/media/video/usbvision/usbvision-video.c +++ b/drivers/media/video/usbvision/usbvision-video.c | |||
@@ -182,20 +182,22 @@ MODULE_ALIAS(DRIVER_ALIAS); | |||
182 | 182 | ||
183 | #define YES_NO(x) ((x) ? "Yes" : "No") | 183 | #define YES_NO(x) ((x) ? "Yes" : "No") |
184 | 184 | ||
185 | static inline struct usb_usbvision *cd_to_usbvision(struct class_device *cd) | 185 | static inline struct usb_usbvision *cd_to_usbvision(struct device *cd) |
186 | { | 186 | { |
187 | struct video_device *vdev = | 187 | struct video_device *vdev = |
188 | container_of(cd, struct video_device, class_dev); | 188 | container_of(cd, struct video_device, class_dev); |
189 | return video_get_drvdata(vdev); | 189 | return video_get_drvdata(vdev); |
190 | } | 190 | } |
191 | 191 | ||
192 | static ssize_t show_version(struct class_device *cd, char *buf) | 192 | static ssize_t show_version(struct device *cd, |
193 | struct device_attribute *attr, char *buf) | ||
193 | { | 194 | { |
194 | return sprintf(buf, "%s\n", USBVISION_VERSION_STRING); | 195 | return sprintf(buf, "%s\n", USBVISION_VERSION_STRING); |
195 | } | 196 | } |
196 | static CLASS_DEVICE_ATTR(version, S_IRUGO, show_version, NULL); | 197 | static DEVICE_ATTR(version, S_IRUGO, show_version, NULL); |
197 | 198 | ||
198 | static ssize_t show_model(struct class_device *cd, char *buf) | 199 | static ssize_t show_model(struct device *cd, |
200 | struct device_attribute *attr, char *buf) | ||
199 | { | 201 | { |
200 | struct video_device *vdev = | 202 | struct video_device *vdev = |
201 | container_of(cd, struct video_device, class_dev); | 203 | container_of(cd, struct video_device, class_dev); |
@@ -203,9 +205,10 @@ static ssize_t show_model(struct class_device *cd, char *buf) | |||
203 | return sprintf(buf, "%s\n", | 205 | return sprintf(buf, "%s\n", |
204 | usbvision_device_data[usbvision->DevModel].ModelString); | 206 | usbvision_device_data[usbvision->DevModel].ModelString); |
205 | } | 207 | } |
206 | static CLASS_DEVICE_ATTR(model, S_IRUGO, show_model, NULL); | 208 | static DEVICE_ATTR(model, S_IRUGO, show_model, NULL); |
207 | 209 | ||
208 | static ssize_t show_hue(struct class_device *cd, char *buf) | 210 | static ssize_t show_hue(struct device *cd, |
211 | struct device_attribute *attr, char *buf) | ||
209 | { | 212 | { |
210 | struct video_device *vdev = | 213 | struct video_device *vdev = |
211 | container_of(cd, struct video_device, class_dev); | 214 | container_of(cd, struct video_device, class_dev); |
@@ -217,9 +220,10 @@ static ssize_t show_hue(struct class_device *cd, char *buf) | |||
217 | call_i2c_clients(usbvision, VIDIOC_G_CTRL, &ctrl); | 220 | call_i2c_clients(usbvision, VIDIOC_G_CTRL, &ctrl); |
218 | return sprintf(buf, "%d\n", ctrl.value); | 221 | return sprintf(buf, "%d\n", ctrl.value); |
219 | } | 222 | } |
220 | static CLASS_DEVICE_ATTR(hue, S_IRUGO, show_hue, NULL); | 223 | static DEVICE_ATTR(hue, S_IRUGO, show_hue, NULL); |
221 | 224 | ||
222 | static ssize_t show_contrast(struct class_device *cd, char *buf) | 225 | static ssize_t show_contrast(struct device *cd, |
226 | struct device_attribute *attr, char *buf) | ||
223 | { | 227 | { |
224 | struct video_device *vdev = | 228 | struct video_device *vdev = |
225 | container_of(cd, struct video_device, class_dev); | 229 | container_of(cd, struct video_device, class_dev); |
@@ -231,9 +235,10 @@ static ssize_t show_contrast(struct class_device *cd, char *buf) | |||
231 | call_i2c_clients(usbvision, VIDIOC_G_CTRL, &ctrl); | 235 | call_i2c_clients(usbvision, VIDIOC_G_CTRL, &ctrl); |
232 | return sprintf(buf, "%d\n", ctrl.value); | 236 | return sprintf(buf, "%d\n", ctrl.value); |
233 | } | 237 | } |
234 | static CLASS_DEVICE_ATTR(contrast, S_IRUGO, show_contrast, NULL); | 238 | static DEVICE_ATTR(contrast, S_IRUGO, show_contrast, NULL); |
235 | 239 | ||
236 | static ssize_t show_brightness(struct class_device *cd, char *buf) | 240 | static ssize_t show_brightness(struct device *cd, |
241 | struct device_attribute *attr, char *buf) | ||
237 | { | 242 | { |
238 | struct video_device *vdev = | 243 | struct video_device *vdev = |
239 | container_of(cd, struct video_device, class_dev); | 244 | container_of(cd, struct video_device, class_dev); |
@@ -245,9 +250,10 @@ static ssize_t show_brightness(struct class_device *cd, char *buf) | |||
245 | call_i2c_clients(usbvision, VIDIOC_G_CTRL, &ctrl); | 250 | call_i2c_clients(usbvision, VIDIOC_G_CTRL, &ctrl); |
246 | return sprintf(buf, "%d\n", ctrl.value); | 251 | return sprintf(buf, "%d\n", ctrl.value); |
247 | } | 252 | } |
248 | static CLASS_DEVICE_ATTR(brightness, S_IRUGO, show_brightness, NULL); | 253 | static DEVICE_ATTR(brightness, S_IRUGO, show_brightness, NULL); |
249 | 254 | ||
250 | static ssize_t show_saturation(struct class_device *cd, char *buf) | 255 | static ssize_t show_saturation(struct device *cd, |
256 | struct device_attribute *attr, char *buf) | ||
251 | { | 257 | { |
252 | struct video_device *vdev = | 258 | struct video_device *vdev = |
253 | container_of(cd, struct video_device, class_dev); | 259 | container_of(cd, struct video_device, class_dev); |
@@ -259,9 +265,10 @@ static ssize_t show_saturation(struct class_device *cd, char *buf) | |||
259 | call_i2c_clients(usbvision, VIDIOC_G_CTRL, &ctrl); | 265 | call_i2c_clients(usbvision, VIDIOC_G_CTRL, &ctrl); |
260 | return sprintf(buf, "%d\n", ctrl.value); | 266 | return sprintf(buf, "%d\n", ctrl.value); |
261 | } | 267 | } |
262 | static CLASS_DEVICE_ATTR(saturation, S_IRUGO, show_saturation, NULL); | 268 | static DEVICE_ATTR(saturation, S_IRUGO, show_saturation, NULL); |
263 | 269 | ||
264 | static ssize_t show_streaming(struct class_device *cd, char *buf) | 270 | static ssize_t show_streaming(struct device *cd, |
271 | struct device_attribute *attr, char *buf) | ||
265 | { | 272 | { |
266 | struct video_device *vdev = | 273 | struct video_device *vdev = |
267 | container_of(cd, struct video_device, class_dev); | 274 | container_of(cd, struct video_device, class_dev); |
@@ -269,9 +276,10 @@ static ssize_t show_streaming(struct class_device *cd, char *buf) | |||
269 | return sprintf(buf, "%s\n", | 276 | return sprintf(buf, "%s\n", |
270 | YES_NO(usbvision->streaming==Stream_On?1:0)); | 277 | YES_NO(usbvision->streaming==Stream_On?1:0)); |
271 | } | 278 | } |
272 | static CLASS_DEVICE_ATTR(streaming, S_IRUGO, show_streaming, NULL); | 279 | static DEVICE_ATTR(streaming, S_IRUGO, show_streaming, NULL); |
273 | 280 | ||
274 | static ssize_t show_compression(struct class_device *cd, char *buf) | 281 | static ssize_t show_compression(struct device *cd, |
282 | struct device_attribute *attr, char *buf) | ||
275 | { | 283 | { |
276 | struct video_device *vdev = | 284 | struct video_device *vdev = |
277 | container_of(cd, struct video_device, class_dev); | 285 | container_of(cd, struct video_device, class_dev); |
@@ -279,16 +287,17 @@ static ssize_t show_compression(struct class_device *cd, char *buf) | |||
279 | return sprintf(buf, "%s\n", | 287 | return sprintf(buf, "%s\n", |
280 | YES_NO(usbvision->isocMode==ISOC_MODE_COMPRESS)); | 288 | YES_NO(usbvision->isocMode==ISOC_MODE_COMPRESS)); |
281 | } | 289 | } |
282 | static CLASS_DEVICE_ATTR(compression, S_IRUGO, show_compression, NULL); | 290 | static DEVICE_ATTR(compression, S_IRUGO, show_compression, NULL); |
283 | 291 | ||
284 | static ssize_t show_device_bridge(struct class_device *cd, char *buf) | 292 | static ssize_t show_device_bridge(struct device *cd, |
293 | struct device_attribute *attr, char *buf) | ||
285 | { | 294 | { |
286 | struct video_device *vdev = | 295 | struct video_device *vdev = |
287 | container_of(cd, struct video_device, class_dev); | 296 | container_of(cd, struct video_device, class_dev); |
288 | struct usb_usbvision *usbvision = video_get_drvdata(vdev); | 297 | struct usb_usbvision *usbvision = video_get_drvdata(vdev); |
289 | return sprintf(buf, "%d\n", usbvision->bridgeType); | 298 | return sprintf(buf, "%d\n", usbvision->bridgeType); |
290 | } | 299 | } |
291 | static CLASS_DEVICE_ATTR(bridge, S_IRUGO, show_device_bridge, NULL); | 300 | static DEVICE_ATTR(bridge, S_IRUGO, show_device_bridge, NULL); |
292 | 301 | ||
293 | static void usbvision_create_sysfs(struct video_device *vdev) | 302 | static void usbvision_create_sysfs(struct video_device *vdev) |
294 | { | 303 | { |
@@ -296,40 +305,40 @@ static void usbvision_create_sysfs(struct video_device *vdev) | |||
296 | if (!vdev) | 305 | if (!vdev) |
297 | return; | 306 | return; |
298 | do { | 307 | do { |
299 | res=class_device_create_file(&vdev->class_dev, | 308 | res = device_create_file(&vdev->class_dev, |
300 | &class_device_attr_version); | 309 | &dev_attr_version); |
301 | if (res<0) | 310 | if (res<0) |
302 | break; | 311 | break; |
303 | res=class_device_create_file(&vdev->class_dev, | 312 | res = device_create_file(&vdev->class_dev, |
304 | &class_device_attr_model); | 313 | &dev_attr_model); |
305 | if (res<0) | 314 | if (res<0) |
306 | break; | 315 | break; |
307 | res=class_device_create_file(&vdev->class_dev, | 316 | res = device_create_file(&vdev->class_dev, |
308 | &class_device_attr_hue); | 317 | &dev_attr_hue); |
309 | if (res<0) | 318 | if (res<0) |
310 | break; | 319 | break; |
311 | res=class_device_create_file(&vdev->class_dev, | 320 | res = device_create_file(&vdev->class_dev, |
312 | &class_device_attr_contrast); | 321 | &dev_attr_contrast); |
313 | if (res<0) | 322 | if (res<0) |
314 | break; | 323 | break; |
315 | res=class_device_create_file(&vdev->class_dev, | 324 | res = device_create_file(&vdev->class_dev, |
316 | &class_device_attr_brightness); | 325 | &dev_attr_brightness); |
317 | if (res<0) | 326 | if (res<0) |
318 | break; | 327 | break; |
319 | res=class_device_create_file(&vdev->class_dev, | 328 | res = device_create_file(&vdev->class_dev, |
320 | &class_device_attr_saturation); | 329 | &dev_attr_saturation); |
321 | if (res<0) | 330 | if (res<0) |
322 | break; | 331 | break; |
323 | res=class_device_create_file(&vdev->class_dev, | 332 | res = device_create_file(&vdev->class_dev, |
324 | &class_device_attr_streaming); | 333 | &dev_attr_streaming); |
325 | if (res<0) | 334 | if (res<0) |
326 | break; | 335 | break; |
327 | res=class_device_create_file(&vdev->class_dev, | 336 | res = device_create_file(&vdev->class_dev, |
328 | &class_device_attr_compression); | 337 | &dev_attr_compression); |
329 | if (res<0) | 338 | if (res<0) |
330 | break; | 339 | break; |
331 | res=class_device_create_file(&vdev->class_dev, | 340 | res = device_create_file(&vdev->class_dev, |
332 | &class_device_attr_bridge); | 341 | &dev_attr_bridge); |
333 | if (res>=0) | 342 | if (res>=0) |
334 | return; | 343 | return; |
335 | } while (0); | 344 | } while (0); |
@@ -340,24 +349,24 @@ static void usbvision_create_sysfs(struct video_device *vdev) | |||
340 | static void usbvision_remove_sysfs(struct video_device *vdev) | 349 | static void usbvision_remove_sysfs(struct video_device *vdev) |
341 | { | 350 | { |
342 | if (vdev) { | 351 | if (vdev) { |
343 | class_device_remove_file(&vdev->class_dev, | 352 | device_remove_file(&vdev->class_dev, |
344 | &class_device_attr_version); | 353 | &dev_attr_version); |
345 | class_device_remove_file(&vdev->class_dev, | 354 | device_remove_file(&vdev->class_dev, |
346 | &class_device_attr_model); | 355 | &dev_attr_model); |
347 | class_device_remove_file(&vdev->class_dev, | 356 | device_remove_file(&vdev->class_dev, |
348 | &class_device_attr_hue); | 357 | &dev_attr_hue); |
349 | class_device_remove_file(&vdev->class_dev, | 358 | device_remove_file(&vdev->class_dev, |
350 | &class_device_attr_contrast); | 359 | &dev_attr_contrast); |
351 | class_device_remove_file(&vdev->class_dev, | 360 | device_remove_file(&vdev->class_dev, |
352 | &class_device_attr_brightness); | 361 | &dev_attr_brightness); |
353 | class_device_remove_file(&vdev->class_dev, | 362 | device_remove_file(&vdev->class_dev, |
354 | &class_device_attr_saturation); | 363 | &dev_attr_saturation); |
355 | class_device_remove_file(&vdev->class_dev, | 364 | device_remove_file(&vdev->class_dev, |
356 | &class_device_attr_streaming); | 365 | &dev_attr_streaming); |
357 | class_device_remove_file(&vdev->class_dev, | 366 | device_remove_file(&vdev->class_dev, |
358 | &class_device_attr_compression); | 367 | &dev_attr_compression); |
359 | class_device_remove_file(&vdev->class_dev, | 368 | device_remove_file(&vdev->class_dev, |
360 | &class_device_attr_bridge); | 369 | &dev_attr_bridge); |
361 | } | 370 | } |
362 | } | 371 | } |
363 | 372 | ||
diff --git a/drivers/media/video/videodev.c b/drivers/media/video/videodev.c index 0334b9aaf12a..0fbe8a1a91b3 100644 --- a/drivers/media/video/videodev.c +++ b/drivers/media/video/videodev.c | |||
@@ -54,15 +54,14 @@ | |||
54 | * sysfs stuff | 54 | * sysfs stuff |
55 | */ | 55 | */ |
56 | 56 | ||
57 | static ssize_t show_name(struct class_device *cd, char *buf) | 57 | static ssize_t show_name(struct device *cd, |
58 | struct device_attribute *attr, char *buf) | ||
58 | { | 59 | { |
59 | struct video_device *vfd = container_of(cd, struct video_device, | 60 | struct video_device *vfd = container_of(cd, struct video_device, |
60 | class_dev); | 61 | class_dev); |
61 | return sprintf(buf,"%.*s\n",(int)sizeof(vfd->name),vfd->name); | 62 | return sprintf(buf, "%.*s\n", (int)sizeof(vfd->name), vfd->name); |
62 | } | 63 | } |
63 | 64 | ||
64 | static CLASS_DEVICE_ATTR(name, S_IRUGO, show_name, NULL); | ||
65 | |||
66 | struct video_device *video_device_alloc(void) | 65 | struct video_device *video_device_alloc(void) |
67 | { | 66 | { |
68 | struct video_device *vfd; | 67 | struct video_device *vfd; |
@@ -76,10 +75,9 @@ void video_device_release(struct video_device *vfd) | |||
76 | kfree(vfd); | 75 | kfree(vfd); |
77 | } | 76 | } |
78 | 77 | ||
79 | static void video_release(struct class_device *cd) | 78 | static void video_release(struct device *cd) |
80 | { | 79 | { |
81 | struct video_device *vfd = container_of(cd, struct video_device, | 80 | struct video_device *vfd = container_of(cd, struct video_device, class_dev); |
82 | class_dev); | ||
83 | 81 | ||
84 | #if 1 | 82 | #if 1 |
85 | /* needed until all drivers are fixed */ | 83 | /* needed until all drivers are fixed */ |
@@ -89,9 +87,15 @@ static void video_release(struct class_device *cd) | |||
89 | vfd->release(vfd); | 87 | vfd->release(vfd); |
90 | } | 88 | } |
91 | 89 | ||
90 | static struct device_attribute video_device_attrs[] = { | ||
91 | __ATTR(name, S_IRUGO, show_name, NULL), | ||
92 | __ATTR_NULL | ||
93 | }; | ||
94 | |||
92 | static struct class video_class = { | 95 | static struct class video_class = { |
93 | .name = VIDEO_NAME, | 96 | .name = VIDEO_NAME, |
94 | .release = video_release, | 97 | .dev_attrs = video_device_attrs, |
98 | .dev_release = video_release, | ||
95 | }; | 99 | }; |
96 | 100 | ||
97 | /* | 101 | /* |
@@ -1753,22 +1757,16 @@ int video_register_device(struct video_device *vfd, int type, int nr) | |||
1753 | /* sysfs class */ | 1757 | /* sysfs class */ |
1754 | memset(&vfd->class_dev, 0x00, sizeof(vfd->class_dev)); | 1758 | memset(&vfd->class_dev, 0x00, sizeof(vfd->class_dev)); |
1755 | if (vfd->dev) | 1759 | if (vfd->dev) |
1756 | vfd->class_dev.dev = vfd->dev; | 1760 | vfd->class_dev.parent = vfd->dev; |
1757 | vfd->class_dev.class = &video_class; | 1761 | vfd->class_dev.class = &video_class; |
1758 | vfd->class_dev.devt = MKDEV(VIDEO_MAJOR, vfd->minor); | 1762 | vfd->class_dev.devt = MKDEV(VIDEO_MAJOR, vfd->minor); |
1759 | sprintf(vfd->class_dev.class_id, "%s%d", name_base, i - base); | 1763 | sprintf(vfd->class_dev.bus_id, "%s%d", name_base, i - base); |
1760 | ret = class_device_register(&vfd->class_dev); | 1764 | ret = device_register(&vfd->class_dev); |
1761 | if (ret < 0) { | 1765 | if (ret < 0) { |
1762 | printk(KERN_ERR "%s: class_device_register failed\n", | 1766 | printk(KERN_ERR "%s: device_register failed\n", |
1763 | __FUNCTION__); | 1767 | __FUNCTION__); |
1764 | goto fail_minor; | 1768 | goto fail_minor; |
1765 | } | 1769 | } |
1766 | ret = class_device_create_file(&vfd->class_dev, &class_device_attr_name); | ||
1767 | if (ret < 0) { | ||
1768 | printk(KERN_ERR "%s: class_device_create_file 'name' failed\n", | ||
1769 | __FUNCTION__); | ||
1770 | goto fail_classdev; | ||
1771 | } | ||
1772 | 1770 | ||
1773 | #if 1 | 1771 | #if 1 |
1774 | /* needed until all drivers are fixed */ | 1772 | /* needed until all drivers are fixed */ |
@@ -1779,8 +1777,6 @@ int video_register_device(struct video_device *vfd, int type, int nr) | |||
1779 | #endif | 1777 | #endif |
1780 | return 0; | 1778 | return 0; |
1781 | 1779 | ||
1782 | fail_classdev: | ||
1783 | class_device_unregister(&vfd->class_dev); | ||
1784 | fail_minor: | 1780 | fail_minor: |
1785 | mutex_lock(&videodev_lock); | 1781 | mutex_lock(&videodev_lock); |
1786 | video_device[vfd->minor] = NULL; | 1782 | video_device[vfd->minor] = NULL; |
@@ -1804,7 +1800,7 @@ void video_unregister_device(struct video_device *vfd) | |||
1804 | panic("videodev: bad unregister"); | 1800 | panic("videodev: bad unregister"); |
1805 | 1801 | ||
1806 | video_device[vfd->minor]=NULL; | 1802 | video_device[vfd->minor]=NULL; |
1807 | class_device_unregister(&vfd->class_dev); | 1803 | device_unregister(&vfd->class_dev); |
1808 | mutex_unlock(&videodev_lock); | 1804 | mutex_unlock(&videodev_lock); |
1809 | } | 1805 | } |
1810 | 1806 | ||