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/media/video/pwc | |
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/media/video/pwc')
-rw-r--r-- | drivers/media/video/pwc/pwc-if.c | 31 |
1 files changed, 17 insertions, 14 deletions
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 |