diff options
author | Mauro Carvalho Chehab <mchehab@infradead.org> | 2007-06-07 07:26:37 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2007-07-18 13:23:59 -0400 |
commit | 018ec5440b4994f560cdde78be6fb10d7ab370d7 (patch) | |
tree | 8ec606fdbe6ffc92375e890a6bb70a16f0fc4e80 /drivers/media/video/usbvideo | |
parent | 890be2bb55774290479672b98fcb0486b57e758e (diff) |
V4L/DVB (5750): Remove obsoleted support for PROC_FS on vicam.c
Procfs support on V4L were converted to sysfs support by a pre-2.6 patch:
http://www.ussg.iu.edu/hypermail/linux/kernel/0307.1/2356.html
There's no sense on keeping the dead code inside vicam.c. Also,it won't
work anyway, as part of proc_fs support were previously inside
videodev.c.
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/usbvideo')
-rw-r--r-- | drivers/media/video/usbvideo/vicam.c | 181 |
1 files changed, 0 insertions, 181 deletions
diff --git a/drivers/media/video/usbvideo/vicam.c b/drivers/media/video/usbvideo/vicam.c index 982b115193f8..2d9c0dd3b733 100644 --- a/drivers/media/video/usbvideo/vicam.c +++ b/drivers/media/video/usbvideo/vicam.c | |||
@@ -42,7 +42,6 @@ | |||
42 | #include <linux/usb.h> | 42 | #include <linux/usb.h> |
43 | #include <linux/vmalloc.h> | 43 | #include <linux/vmalloc.h> |
44 | #include <linux/slab.h> | 44 | #include <linux/slab.h> |
45 | #include <linux/proc_fs.h> | ||
46 | #include <linux/mutex.h> | 45 | #include <linux/mutex.h> |
47 | #include "usbvideo.h" | 46 | #include "usbvideo.h" |
48 | 47 | ||
@@ -417,11 +416,6 @@ struct vicam_camera { | |||
417 | u8 open_count; | 416 | u8 open_count; |
418 | u8 bulkEndpoint; | 417 | u8 bulkEndpoint; |
419 | int needsDummyRead; | 418 | int needsDummyRead; |
420 | |||
421 | #if defined(CONFIG_VIDEO_PROC_FS) | ||
422 | struct proc_dir_entry *proc_dir; | ||
423 | #endif | ||
424 | |||
425 | }; | 419 | }; |
426 | 420 | ||
427 | static int vicam_probe( struct usb_interface *intf, const struct usb_device_id *id); | 421 | static int vicam_probe( struct usb_interface *intf, const struct usb_device_id *id); |
@@ -1065,175 +1059,6 @@ vicam_mmap(struct file *file, struct vm_area_struct *vma) | |||
1065 | return 0; | 1059 | return 0; |
1066 | } | 1060 | } |
1067 | 1061 | ||
1068 | #if defined(CONFIG_VIDEO_PROC_FS) | ||
1069 | |||
1070 | static struct proc_dir_entry *vicam_proc_root = NULL; | ||
1071 | |||
1072 | static int vicam_read_helper(char *page, char **start, off_t off, | ||
1073 | int count, int *eof, int value) | ||
1074 | { | ||
1075 | char *out = page; | ||
1076 | int len; | ||
1077 | |||
1078 | out += sprintf(out, "%d",value); | ||
1079 | |||
1080 | len = out - page; | ||
1081 | len -= off; | ||
1082 | if (len < count) { | ||
1083 | *eof = 1; | ||
1084 | if (len <= 0) | ||
1085 | return 0; | ||
1086 | } else | ||
1087 | len = count; | ||
1088 | |||
1089 | *start = page + off; | ||
1090 | return len; | ||
1091 | } | ||
1092 | |||
1093 | static int vicam_read_proc_shutter(char *page, char **start, off_t off, | ||
1094 | int count, int *eof, void *data) | ||
1095 | { | ||
1096 | return vicam_read_helper(page,start,off,count,eof, | ||
1097 | ((struct vicam_camera *)data)->shutter_speed); | ||
1098 | } | ||
1099 | |||
1100 | static int vicam_read_proc_gain(char *page, char **start, off_t off, | ||
1101 | int count, int *eof, void *data) | ||
1102 | { | ||
1103 | return vicam_read_helper(page,start,off,count,eof, | ||
1104 | ((struct vicam_camera *)data)->gain); | ||
1105 | } | ||
1106 | |||
1107 | static int | ||
1108 | vicam_write_proc_shutter(struct file *file, const char *buffer, | ||
1109 | unsigned long count, void *data) | ||
1110 | { | ||
1111 | u16 stmp; | ||
1112 | char kbuf[8]; | ||
1113 | struct vicam_camera *cam = (struct vicam_camera *) data; | ||
1114 | |||
1115 | if (count > 6) | ||
1116 | return -EINVAL; | ||
1117 | |||
1118 | if (copy_from_user(kbuf, buffer, count)) | ||
1119 | return -EFAULT; | ||
1120 | |||
1121 | stmp = (u16) simple_strtoul(kbuf, NULL, 10); | ||
1122 | if (stmp < 4 || stmp > 32000) | ||
1123 | return -EINVAL; | ||
1124 | |||
1125 | cam->shutter_speed = stmp; | ||
1126 | |||
1127 | return count; | ||
1128 | } | ||
1129 | |||
1130 | static int | ||
1131 | vicam_write_proc_gain(struct file *file, const char *buffer, | ||
1132 | unsigned long count, void *data) | ||
1133 | { | ||
1134 | u16 gtmp; | ||
1135 | char kbuf[8]; | ||
1136 | |||
1137 | struct vicam_camera *cam = (struct vicam_camera *) data; | ||
1138 | |||
1139 | if (count > 4) | ||
1140 | return -EINVAL; | ||
1141 | |||
1142 | if (copy_from_user(kbuf, buffer, count)) | ||
1143 | return -EFAULT; | ||
1144 | |||
1145 | gtmp = (u16) simple_strtoul(kbuf, NULL, 10); | ||
1146 | if (gtmp > 255) | ||
1147 | return -EINVAL; | ||
1148 | cam->gain = gtmp; | ||
1149 | |||
1150 | return count; | ||
1151 | } | ||
1152 | |||
1153 | static void | ||
1154 | vicam_create_proc_root(void) | ||
1155 | { | ||
1156 | vicam_proc_root = proc_mkdir("video/vicam", NULL); | ||
1157 | |||
1158 | if (vicam_proc_root) | ||
1159 | vicam_proc_root->owner = THIS_MODULE; | ||
1160 | else | ||
1161 | printk(KERN_ERR | ||
1162 | "could not create /proc entry for vicam!"); | ||
1163 | } | ||
1164 | |||
1165 | static void | ||
1166 | vicam_destroy_proc_root(void) | ||
1167 | { | ||
1168 | if (vicam_proc_root) | ||
1169 | remove_proc_entry("video/vicam", 0); | ||
1170 | } | ||
1171 | |||
1172 | static void | ||
1173 | vicam_create_proc_entry(struct vicam_camera *cam) | ||
1174 | { | ||
1175 | char name[64]; | ||
1176 | struct proc_dir_entry *ent; | ||
1177 | |||
1178 | DBG(KERN_INFO "vicam: creating proc entry\n"); | ||
1179 | |||
1180 | if (!vicam_proc_root || !cam) { | ||
1181 | printk(KERN_INFO | ||
1182 | "vicam: could not create proc entry, %s pointer is null.\n", | ||
1183 | (!cam ? "camera" : "root")); | ||
1184 | return; | ||
1185 | } | ||
1186 | |||
1187 | sprintf(name, "video%d", cam->vdev.minor); | ||
1188 | |||
1189 | cam->proc_dir = proc_mkdir(name, vicam_proc_root); | ||
1190 | |||
1191 | if ( !cam->proc_dir ) | ||
1192 | return; // FIXME: We should probably return an error here | ||
1193 | |||
1194 | ent = create_proc_entry("shutter", S_IFREG | S_IRUGO | S_IWUSR, | ||
1195 | cam->proc_dir); | ||
1196 | if (ent) { | ||
1197 | ent->data = cam; | ||
1198 | ent->read_proc = vicam_read_proc_shutter; | ||
1199 | ent->write_proc = vicam_write_proc_shutter; | ||
1200 | ent->size = 64; | ||
1201 | } | ||
1202 | |||
1203 | ent = create_proc_entry("gain", S_IFREG | S_IRUGO | S_IWUSR, | ||
1204 | cam->proc_dir); | ||
1205 | if (ent) { | ||
1206 | ent->data = cam; | ||
1207 | ent->read_proc = vicam_read_proc_gain; | ||
1208 | ent->write_proc = vicam_write_proc_gain; | ||
1209 | ent->size = 64; | ||
1210 | } | ||
1211 | } | ||
1212 | |||
1213 | static void | ||
1214 | vicam_destroy_proc_entry(void *ptr) | ||
1215 | { | ||
1216 | struct vicam_camera *cam = (struct vicam_camera *) ptr; | ||
1217 | char name[16]; | ||
1218 | |||
1219 | if ( !cam->proc_dir ) | ||
1220 | return; | ||
1221 | |||
1222 | sprintf(name, "video%d", cam->vdev.minor); | ||
1223 | remove_proc_entry("shutter", cam->proc_dir); | ||
1224 | remove_proc_entry("gain", cam->proc_dir); | ||
1225 | remove_proc_entry(name,vicam_proc_root); | ||
1226 | cam->proc_dir = NULL; | ||
1227 | |||
1228 | } | ||
1229 | |||
1230 | #else | ||
1231 | static inline void vicam_create_proc_root(void) { } | ||
1232 | static inline void vicam_destroy_proc_root(void) { } | ||
1233 | static inline void vicam_create_proc_entry(struct vicam_camera *cam) { } | ||
1234 | static inline void vicam_destroy_proc_entry(void *ptr) { } | ||
1235 | #endif | ||
1236 | |||
1237 | static const struct file_operations vicam_fops = { | 1062 | static const struct file_operations vicam_fops = { |
1238 | .owner = THIS_MODULE, | 1063 | .owner = THIS_MODULE, |
1239 | .open = vicam_open, | 1064 | .open = vicam_open, |
@@ -1330,8 +1155,6 @@ vicam_probe( struct usb_interface *intf, const struct usb_device_id *id) | |||
1330 | return -EIO; | 1155 | return -EIO; |
1331 | } | 1156 | } |
1332 | 1157 | ||
1333 | vicam_create_proc_entry(cam); | ||
1334 | |||
1335 | printk(KERN_INFO "ViCam webcam driver now controlling video device %d\n",cam->vdev.minor); | 1158 | printk(KERN_INFO "ViCam webcam driver now controlling video device %d\n",cam->vdev.minor); |
1336 | 1159 | ||
1337 | usb_set_intfdata (intf, cam); | 1160 | usb_set_intfdata (intf, cam); |
@@ -1363,8 +1186,6 @@ vicam_disconnect(struct usb_interface *intf) | |||
1363 | 1186 | ||
1364 | cam->udev = NULL; | 1187 | cam->udev = NULL; |
1365 | 1188 | ||
1366 | vicam_destroy_proc_entry(cam); | ||
1367 | |||
1368 | /* the only thing left to do is synchronize with | 1189 | /* the only thing left to do is synchronize with |
1369 | * our close/release function on who should release | 1190 | * our close/release function on who should release |
1370 | * the camera memory. if there are any users using the | 1191 | * the camera memory. if there are any users using the |
@@ -1390,7 +1211,6 @@ usb_vicam_init(void) | |||
1390 | { | 1211 | { |
1391 | int retval; | 1212 | int retval; |
1392 | DBG(KERN_INFO "ViCam-based WebCam driver startup\n"); | 1213 | DBG(KERN_INFO "ViCam-based WebCam driver startup\n"); |
1393 | vicam_create_proc_root(); | ||
1394 | retval = usb_register(&vicam_driver); | 1214 | retval = usb_register(&vicam_driver); |
1395 | if (retval) | 1215 | if (retval) |
1396 | printk(KERN_WARNING "usb_register failed!\n"); | 1216 | printk(KERN_WARNING "usb_register failed!\n"); |
@@ -1404,7 +1224,6 @@ usb_vicam_exit(void) | |||
1404 | "ViCam-based WebCam driver shutdown\n"); | 1224 | "ViCam-based WebCam driver shutdown\n"); |
1405 | 1225 | ||
1406 | usb_deregister(&vicam_driver); | 1226 | usb_deregister(&vicam_driver); |
1407 | vicam_destroy_proc_root(); | ||
1408 | } | 1227 | } |
1409 | 1228 | ||
1410 | module_init(usb_vicam_init); | 1229 | module_init(usb_vicam_init); |