aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/usbvision
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/usbvision')
-rw-r--r--drivers/media/video/usbvision/usbvision-video.c119
1 files changed, 64 insertions, 55 deletions
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
185static inline struct usb_usbvision *cd_to_usbvision(struct class_device *cd) 185static 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
192static ssize_t show_version(struct class_device *cd, char *buf) 192static 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}
196static CLASS_DEVICE_ATTR(version, S_IRUGO, show_version, NULL); 197static DEVICE_ATTR(version, S_IRUGO, show_version, NULL);
197 198
198static ssize_t show_model(struct class_device *cd, char *buf) 199static 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}
206static CLASS_DEVICE_ATTR(model, S_IRUGO, show_model, NULL); 208static DEVICE_ATTR(model, S_IRUGO, show_model, NULL);
207 209
208static ssize_t show_hue(struct class_device *cd, char *buf) 210static 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}
220static CLASS_DEVICE_ATTR(hue, S_IRUGO, show_hue, NULL); 223static DEVICE_ATTR(hue, S_IRUGO, show_hue, NULL);
221 224
222static ssize_t show_contrast(struct class_device *cd, char *buf) 225static 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}
234static CLASS_DEVICE_ATTR(contrast, S_IRUGO, show_contrast, NULL); 238static DEVICE_ATTR(contrast, S_IRUGO, show_contrast, NULL);
235 239
236static ssize_t show_brightness(struct class_device *cd, char *buf) 240static 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}
248static CLASS_DEVICE_ATTR(brightness, S_IRUGO, show_brightness, NULL); 253static DEVICE_ATTR(brightness, S_IRUGO, show_brightness, NULL);
249 254
250static ssize_t show_saturation(struct class_device *cd, char *buf) 255static 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}
262static CLASS_DEVICE_ATTR(saturation, S_IRUGO, show_saturation, NULL); 268static DEVICE_ATTR(saturation, S_IRUGO, show_saturation, NULL);
263 269
264static ssize_t show_streaming(struct class_device *cd, char *buf) 270static 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}
272static CLASS_DEVICE_ATTR(streaming, S_IRUGO, show_streaming, NULL); 279static DEVICE_ATTR(streaming, S_IRUGO, show_streaming, NULL);
273 280
274static ssize_t show_compression(struct class_device *cd, char *buf) 281static 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}
282static CLASS_DEVICE_ATTR(compression, S_IRUGO, show_compression, NULL); 290static DEVICE_ATTR(compression, S_IRUGO, show_compression, NULL);
283 291
284static ssize_t show_device_bridge(struct class_device *cd, char *buf) 292static 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}
291static CLASS_DEVICE_ATTR(bridge, S_IRUGO, show_device_bridge, NULL); 300static DEVICE_ATTR(bridge, S_IRUGO, show_device_bridge, NULL);
292 301
293static void usbvision_create_sysfs(struct video_device *vdev) 302static 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)
340static void usbvision_remove_sysfs(struct video_device *vdev) 349static 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