aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/media/video/bt8xx/bttv-driver.c4
-rw-r--r--drivers/media/video/et61x251/et61x251_core.c2
-rw-r--r--drivers/media/video/sn9c102/sn9c102_core.c60
-rw-r--r--drivers/media/video/usbvision/usbvision-video.c72
-rw-r--r--drivers/media/video/v4l2-dev.c23
-rw-r--r--include/media/v4l2-dev.h14
6 files changed, 72 insertions, 103 deletions
diff --git a/drivers/media/video/bt8xx/bttv-driver.c b/drivers/media/video/bt8xx/bttv-driver.c
index 3dda84d115d1..fff2fffcad63 100644
--- a/drivers/media/video/bt8xx/bttv-driver.c
+++ b/drivers/media/video/bt8xx/bttv-driver.c
@@ -163,7 +163,7 @@ MODULE_LICENSE("GPL");
163static ssize_t show_card(struct device *cd, 163static ssize_t show_card(struct device *cd,
164 struct device_attribute *attr, char *buf) 164 struct device_attribute *attr, char *buf)
165{ 165{
166 struct video_device *vfd = container_of(cd, struct video_device, class_dev); 166 struct video_device *vfd = container_of(cd, struct video_device, dev);
167 struct bttv *btv = dev_get_drvdata(vfd->parent); 167 struct bttv *btv = dev_get_drvdata(vfd->parent);
168 return sprintf(buf, "%d\n", btv ? btv->c.type : UNSET); 168 return sprintf(buf, "%d\n", btv ? btv->c.type : UNSET);
169} 169}
@@ -4244,7 +4244,7 @@ static int __devinit bttv_register_video(struct bttv *btv)
4244 goto err; 4244 goto err;
4245 printk(KERN_INFO "bttv%d: registered device video%d\n", 4245 printk(KERN_INFO "bttv%d: registered device video%d\n",
4246 btv->c.nr,btv->video_dev->minor & 0x1f); 4246 btv->c.nr,btv->video_dev->minor & 0x1f);
4247 if (device_create_file(&btv->video_dev->class_dev, 4247 if (device_create_file(&btv->video_dev->dev,
4248 &dev_attr_card)<0) { 4248 &dev_attr_card)<0) {
4249 printk(KERN_ERR "bttv%d: device_create_file 'card' " 4249 printk(KERN_ERR "bttv%d: device_create_file 'card' "
4250 "failed\n", btv->c.nr); 4250 "failed\n", btv->c.nr);
diff --git a/drivers/media/video/et61x251/et61x251_core.c b/drivers/media/video/et61x251/et61x251_core.c
index 15d037ae25c5..3eea1333a52f 100644
--- a/drivers/media/video/et61x251/et61x251_core.c
+++ b/drivers/media/video/et61x251/et61x251_core.c
@@ -985,7 +985,7 @@ static DEVICE_ATTR(i2c_val, S_IRUGO | S_IWUSR,
985 985
986static int et61x251_create_sysfs(struct et61x251_device* cam) 986static int et61x251_create_sysfs(struct et61x251_device* cam)
987{ 987{
988 struct device *classdev = &(cam->v4ldev->class_dev); 988 struct device *classdev = &(cam->v4ldev->dev);
989 int err = 0; 989 int err = 0;
990 990
991 if ((err = device_create_file(classdev, &dev_attr_reg))) 991 if ((err = device_create_file(classdev, &dev_attr_reg)))
diff --git a/drivers/media/video/sn9c102/sn9c102_core.c b/drivers/media/video/sn9c102/sn9c102_core.c
index 7f9c7bcf3c85..475b78191151 100644
--- a/drivers/media/video/sn9c102/sn9c102_core.c
+++ b/drivers/media/video/sn9c102/sn9c102_core.c
@@ -1038,8 +1038,7 @@ static ssize_t sn9c102_show_reg(struct device* cd,
1038 if (mutex_lock_interruptible(&sn9c102_sysfs_lock)) 1038 if (mutex_lock_interruptible(&sn9c102_sysfs_lock))
1039 return -ERESTARTSYS; 1039 return -ERESTARTSYS;
1040 1040
1041 cam = video_get_drvdata(container_of(cd, struct video_device, 1041 cam = video_get_drvdata(container_of(cd, struct video_device, dev));
1042 class_dev));
1043 if (!cam) { 1042 if (!cam) {
1044 mutex_unlock(&sn9c102_sysfs_lock); 1043 mutex_unlock(&sn9c102_sysfs_lock);
1045 return -ENODEV; 1044 return -ENODEV;
@@ -1064,8 +1063,7 @@ sn9c102_store_reg(struct device* cd, struct device_attribute *attr,
1064 if (mutex_lock_interruptible(&sn9c102_sysfs_lock)) 1063 if (mutex_lock_interruptible(&sn9c102_sysfs_lock))
1065 return -ERESTARTSYS; 1064 return -ERESTARTSYS;
1066 1065
1067 cam = video_get_drvdata(container_of(cd, struct video_device, 1066 cam = video_get_drvdata(container_of(cd, struct video_device, dev));
1068 class_dev));
1069 if (!cam) { 1067 if (!cam) {
1070 mutex_unlock(&sn9c102_sysfs_lock); 1068 mutex_unlock(&sn9c102_sysfs_lock);
1071 return -ENODEV; 1069 return -ENODEV;
@@ -1098,8 +1096,7 @@ static ssize_t sn9c102_show_val(struct device* cd,
1098 if (mutex_lock_interruptible(&sn9c102_sysfs_lock)) 1096 if (mutex_lock_interruptible(&sn9c102_sysfs_lock))
1099 return -ERESTARTSYS; 1097 return -ERESTARTSYS;
1100 1098
1101 cam = video_get_drvdata(container_of(cd, struct video_device, 1099 cam = video_get_drvdata(container_of(cd, struct video_device, dev));
1102 class_dev));
1103 if (!cam) { 1100 if (!cam) {
1104 mutex_unlock(&sn9c102_sysfs_lock); 1101 mutex_unlock(&sn9c102_sysfs_lock);
1105 return -ENODEV; 1102 return -ENODEV;
@@ -1132,8 +1129,7 @@ sn9c102_store_val(struct device* cd, struct device_attribute *attr,
1132 if (mutex_lock_interruptible(&sn9c102_sysfs_lock)) 1129 if (mutex_lock_interruptible(&sn9c102_sysfs_lock))
1133 return -ERESTARTSYS; 1130 return -ERESTARTSYS;
1134 1131
1135 cam = video_get_drvdata(container_of(cd, struct video_device, 1132 cam = video_get_drvdata(container_of(cd, struct video_device, dev));
1136 class_dev));
1137 if (!cam) { 1133 if (!cam) {
1138 mutex_unlock(&sn9c102_sysfs_lock); 1134 mutex_unlock(&sn9c102_sysfs_lock);
1139 return -ENODEV; 1135 return -ENODEV;
@@ -1170,8 +1166,7 @@ static ssize_t sn9c102_show_i2c_reg(struct device* cd,
1170 if (mutex_lock_interruptible(&sn9c102_sysfs_lock)) 1166 if (mutex_lock_interruptible(&sn9c102_sysfs_lock))
1171 return -ERESTARTSYS; 1167 return -ERESTARTSYS;
1172 1168
1173 cam = video_get_drvdata(container_of(cd, struct video_device, 1169 cam = video_get_drvdata(container_of(cd, struct video_device, dev));
1174 class_dev));
1175 if (!cam) { 1170 if (!cam) {
1176 mutex_unlock(&sn9c102_sysfs_lock); 1171 mutex_unlock(&sn9c102_sysfs_lock);
1177 return -ENODEV; 1172 return -ENODEV;
@@ -1198,8 +1193,7 @@ sn9c102_store_i2c_reg(struct device* cd, struct device_attribute *attr,
1198 if (mutex_lock_interruptible(&sn9c102_sysfs_lock)) 1193 if (mutex_lock_interruptible(&sn9c102_sysfs_lock))
1199 return -ERESTARTSYS; 1194 return -ERESTARTSYS;
1200 1195
1201 cam = video_get_drvdata(container_of(cd, struct video_device, 1196 cam = video_get_drvdata(container_of(cd, struct video_device, dev));
1202 class_dev));
1203 if (!cam) { 1197 if (!cam) {
1204 mutex_unlock(&sn9c102_sysfs_lock); 1198 mutex_unlock(&sn9c102_sysfs_lock);
1205 return -ENODEV; 1199 return -ENODEV;
@@ -1232,8 +1226,7 @@ static ssize_t sn9c102_show_i2c_val(struct device* cd,
1232 if (mutex_lock_interruptible(&sn9c102_sysfs_lock)) 1226 if (mutex_lock_interruptible(&sn9c102_sysfs_lock))
1233 return -ERESTARTSYS; 1227 return -ERESTARTSYS;
1234 1228
1235 cam = video_get_drvdata(container_of(cd, struct video_device, 1229 cam = video_get_drvdata(container_of(cd, struct video_device, dev));
1236 class_dev));
1237 if (!cam) { 1230 if (!cam) {
1238 mutex_unlock(&sn9c102_sysfs_lock); 1231 mutex_unlock(&sn9c102_sysfs_lock);
1239 return -ENODEV; 1232 return -ENODEV;
@@ -1271,8 +1264,7 @@ sn9c102_store_i2c_val(struct device* cd, struct device_attribute *attr,
1271 if (mutex_lock_interruptible(&sn9c102_sysfs_lock)) 1264 if (mutex_lock_interruptible(&sn9c102_sysfs_lock))
1272 return -ERESTARTSYS; 1265 return -ERESTARTSYS;
1273 1266
1274 cam = video_get_drvdata(container_of(cd, struct video_device, 1267 cam = video_get_drvdata(container_of(cd, struct video_device, dev));
1275 class_dev));
1276 if (!cam) { 1268 if (!cam) {
1277 mutex_unlock(&sn9c102_sysfs_lock); 1269 mutex_unlock(&sn9c102_sysfs_lock);
1278 return -ENODEV; 1270 return -ENODEV;
@@ -1318,8 +1310,7 @@ sn9c102_store_green(struct device* cd, struct device_attribute *attr,
1318 if (mutex_lock_interruptible(&sn9c102_sysfs_lock)) 1310 if (mutex_lock_interruptible(&sn9c102_sysfs_lock))
1319 return -ERESTARTSYS; 1311 return -ERESTARTSYS;
1320 1312
1321 cam = video_get_drvdata(container_of(cd, struct video_device, 1313 cam = video_get_drvdata(container_of(cd, struct video_device, dev));
1322 class_dev));
1323 if (!cam) { 1314 if (!cam) {
1324 mutex_unlock(&sn9c102_sysfs_lock); 1315 mutex_unlock(&sn9c102_sysfs_lock);
1325 return -ENODEV; 1316 return -ENODEV;
@@ -1400,8 +1391,7 @@ static ssize_t sn9c102_show_frame_header(struct device* cd,
1400 struct sn9c102_device* cam; 1391 struct sn9c102_device* cam;
1401 ssize_t count; 1392 ssize_t count;
1402 1393
1403 cam = video_get_drvdata(container_of(cd, struct video_device, 1394 cam = video_get_drvdata(container_of(cd, struct video_device, dev));
1404 class_dev));
1405 if (!cam) 1395 if (!cam)
1406 return -ENODEV; 1396 return -ENODEV;
1407 1397
@@ -1428,49 +1418,49 @@ static DEVICE_ATTR(frame_header, S_IRUGO, sn9c102_show_frame_header, NULL);
1428 1418
1429static int sn9c102_create_sysfs(struct sn9c102_device* cam) 1419static int sn9c102_create_sysfs(struct sn9c102_device* cam)
1430{ 1420{
1431 struct device *classdev = &(cam->v4ldev->class_dev); 1421 struct device *dev = &(cam->v4ldev->dev);
1432 int err = 0; 1422 int err = 0;
1433 1423
1434 if ((err = device_create_file(classdev, &dev_attr_reg))) 1424 if ((err = device_create_file(dev, &dev_attr_reg)))
1435 goto err_out; 1425 goto err_out;
1436 if ((err = device_create_file(classdev, &dev_attr_val))) 1426 if ((err = device_create_file(dev, &dev_attr_val)))
1437 goto err_reg; 1427 goto err_reg;
1438 if ((err = device_create_file(classdev, &dev_attr_frame_header))) 1428 if ((err = device_create_file(dev, &dev_attr_frame_header)))
1439 goto err_val; 1429 goto err_val;
1440 1430
1441 if (cam->sensor.sysfs_ops) { 1431 if (cam->sensor.sysfs_ops) {
1442 if ((err = device_create_file(classdev, &dev_attr_i2c_reg))) 1432 if ((err = device_create_file(dev, &dev_attr_i2c_reg)))
1443 goto err_frame_header; 1433 goto err_frame_header;
1444 if ((err = device_create_file(classdev, &dev_attr_i2c_val))) 1434 if ((err = device_create_file(dev, &dev_attr_i2c_val)))
1445 goto err_i2c_reg; 1435 goto err_i2c_reg;
1446 } 1436 }
1447 1437
1448 if (cam->bridge == BRIDGE_SN9C101 || cam->bridge == BRIDGE_SN9C102) { 1438 if (cam->bridge == BRIDGE_SN9C101 || cam->bridge == BRIDGE_SN9C102) {
1449 if ((err = device_create_file(classdev, &dev_attr_green))) 1439 if ((err = device_create_file(dev, &dev_attr_green)))
1450 goto err_i2c_val; 1440 goto err_i2c_val;
1451 } else { 1441 } else {
1452 if ((err = device_create_file(classdev, &dev_attr_blue))) 1442 if ((err = device_create_file(dev, &dev_attr_blue)))
1453 goto err_i2c_val; 1443 goto err_i2c_val;
1454 if ((err = device_create_file(classdev, &dev_attr_red))) 1444 if ((err = device_create_file(dev, &dev_attr_red)))
1455 goto err_blue; 1445 goto err_blue;
1456 } 1446 }
1457 1447
1458 return 0; 1448 return 0;
1459 1449
1460err_blue: 1450err_blue:
1461 device_remove_file(classdev, &dev_attr_blue); 1451 device_remove_file(dev, &dev_attr_blue);
1462err_i2c_val: 1452err_i2c_val:
1463 if (cam->sensor.sysfs_ops) 1453 if (cam->sensor.sysfs_ops)
1464 device_remove_file(classdev, &dev_attr_i2c_val); 1454 device_remove_file(dev, &dev_attr_i2c_val);
1465err_i2c_reg: 1455err_i2c_reg:
1466 if (cam->sensor.sysfs_ops) 1456 if (cam->sensor.sysfs_ops)
1467 device_remove_file(classdev, &dev_attr_i2c_reg); 1457 device_remove_file(dev, &dev_attr_i2c_reg);
1468err_frame_header: 1458err_frame_header:
1469 device_remove_file(classdev, &dev_attr_frame_header); 1459 device_remove_file(dev, &dev_attr_frame_header);
1470err_val: 1460err_val:
1471 device_remove_file(classdev, &dev_attr_val); 1461 device_remove_file(dev, &dev_attr_val);
1472err_reg: 1462err_reg:
1473 device_remove_file(classdev, &dev_attr_reg); 1463 device_remove_file(dev, &dev_attr_reg);
1474err_out: 1464err_out:
1475 return err; 1465 return err;
1476} 1466}
diff --git a/drivers/media/video/usbvision/usbvision-video.c b/drivers/media/video/usbvision/usbvision-video.c
index 899906d954aa..2ddfaa34e6b0 100644
--- a/drivers/media/video/usbvision/usbvision-video.c
+++ b/drivers/media/video/usbvision/usbvision-video.c
@@ -184,7 +184,7 @@ MODULE_ALIAS(DRIVER_ALIAS);
184static inline struct usb_usbvision *cd_to_usbvision(struct device *cd) 184static inline struct usb_usbvision *cd_to_usbvision(struct device *cd)
185{ 185{
186 struct video_device *vdev = 186 struct video_device *vdev =
187 container_of(cd, struct video_device, class_dev); 187 container_of(cd, struct video_device, dev);
188 return video_get_drvdata(vdev); 188 return video_get_drvdata(vdev);
189} 189}
190 190
@@ -199,7 +199,7 @@ static ssize_t show_model(struct device *cd,
199 struct device_attribute *attr, char *buf) 199 struct device_attribute *attr, char *buf)
200{ 200{
201 struct video_device *vdev = 201 struct video_device *vdev =
202 container_of(cd, struct video_device, class_dev); 202 container_of(cd, struct video_device, dev);
203 struct usb_usbvision *usbvision = video_get_drvdata(vdev); 203 struct usb_usbvision *usbvision = video_get_drvdata(vdev);
204 return sprintf(buf, "%s\n", 204 return sprintf(buf, "%s\n",
205 usbvision_device_data[usbvision->DevModel].ModelString); 205 usbvision_device_data[usbvision->DevModel].ModelString);
@@ -210,7 +210,7 @@ static ssize_t show_hue(struct device *cd,
210 struct device_attribute *attr, char *buf) 210 struct device_attribute *attr, char *buf)
211{ 211{
212 struct video_device *vdev = 212 struct video_device *vdev =
213 container_of(cd, struct video_device, class_dev); 213 container_of(cd, struct video_device, dev);
214 struct usb_usbvision *usbvision = video_get_drvdata(vdev); 214 struct usb_usbvision *usbvision = video_get_drvdata(vdev);
215 struct v4l2_control ctrl; 215 struct v4l2_control ctrl;
216 ctrl.id = V4L2_CID_HUE; 216 ctrl.id = V4L2_CID_HUE;
@@ -225,7 +225,7 @@ static ssize_t show_contrast(struct device *cd,
225 struct device_attribute *attr, char *buf) 225 struct device_attribute *attr, char *buf)
226{ 226{
227 struct video_device *vdev = 227 struct video_device *vdev =
228 container_of(cd, struct video_device, class_dev); 228 container_of(cd, struct video_device, dev);
229 struct usb_usbvision *usbvision = video_get_drvdata(vdev); 229 struct usb_usbvision *usbvision = video_get_drvdata(vdev);
230 struct v4l2_control ctrl; 230 struct v4l2_control ctrl;
231 ctrl.id = V4L2_CID_CONTRAST; 231 ctrl.id = V4L2_CID_CONTRAST;
@@ -240,7 +240,7 @@ static ssize_t show_brightness(struct device *cd,
240 struct device_attribute *attr, char *buf) 240 struct device_attribute *attr, char *buf)
241{ 241{
242 struct video_device *vdev = 242 struct video_device *vdev =
243 container_of(cd, struct video_device, class_dev); 243 container_of(cd, struct video_device, dev);
244 struct usb_usbvision *usbvision = video_get_drvdata(vdev); 244 struct usb_usbvision *usbvision = video_get_drvdata(vdev);
245 struct v4l2_control ctrl; 245 struct v4l2_control ctrl;
246 ctrl.id = V4L2_CID_BRIGHTNESS; 246 ctrl.id = V4L2_CID_BRIGHTNESS;
@@ -255,7 +255,7 @@ static ssize_t show_saturation(struct device *cd,
255 struct device_attribute *attr, char *buf) 255 struct device_attribute *attr, char *buf)
256{ 256{
257 struct video_device *vdev = 257 struct video_device *vdev =
258 container_of(cd, struct video_device, class_dev); 258 container_of(cd, struct video_device, dev);
259 struct usb_usbvision *usbvision = video_get_drvdata(vdev); 259 struct usb_usbvision *usbvision = video_get_drvdata(vdev);
260 struct v4l2_control ctrl; 260 struct v4l2_control ctrl;
261 ctrl.id = V4L2_CID_SATURATION; 261 ctrl.id = V4L2_CID_SATURATION;
@@ -270,7 +270,7 @@ static ssize_t show_streaming(struct device *cd,
270 struct device_attribute *attr, char *buf) 270 struct device_attribute *attr, char *buf)
271{ 271{
272 struct video_device *vdev = 272 struct video_device *vdev =
273 container_of(cd, struct video_device, class_dev); 273 container_of(cd, struct video_device, dev);
274 struct usb_usbvision *usbvision = video_get_drvdata(vdev); 274 struct usb_usbvision *usbvision = video_get_drvdata(vdev);
275 return sprintf(buf, "%s\n", 275 return sprintf(buf, "%s\n",
276 YES_NO(usbvision->streaming==Stream_On?1:0)); 276 YES_NO(usbvision->streaming==Stream_On?1:0));
@@ -281,7 +281,7 @@ static ssize_t show_compression(struct device *cd,
281 struct device_attribute *attr, char *buf) 281 struct device_attribute *attr, char *buf)
282{ 282{
283 struct video_device *vdev = 283 struct video_device *vdev =
284 container_of(cd, struct video_device, class_dev); 284 container_of(cd, struct video_device, dev);
285 struct usb_usbvision *usbvision = video_get_drvdata(vdev); 285 struct usb_usbvision *usbvision = video_get_drvdata(vdev);
286 return sprintf(buf, "%s\n", 286 return sprintf(buf, "%s\n",
287 YES_NO(usbvision->isocMode==ISOC_MODE_COMPRESS)); 287 YES_NO(usbvision->isocMode==ISOC_MODE_COMPRESS));
@@ -292,7 +292,7 @@ static ssize_t show_device_bridge(struct device *cd,
292 struct device_attribute *attr, char *buf) 292 struct device_attribute *attr, char *buf)
293{ 293{
294 struct video_device *vdev = 294 struct video_device *vdev =
295 container_of(cd, struct video_device, class_dev); 295 container_of(cd, struct video_device, dev);
296 struct usb_usbvision *usbvision = video_get_drvdata(vdev); 296 struct usb_usbvision *usbvision = video_get_drvdata(vdev);
297 return sprintf(buf, "%d\n", usbvision->bridgeType); 297 return sprintf(buf, "%d\n", usbvision->bridgeType);
298} 298}
@@ -304,40 +304,31 @@ static void usbvision_create_sysfs(struct video_device *vdev)
304 if (!vdev) 304 if (!vdev)
305 return; 305 return;
306 do { 306 do {
307 res = device_create_file(&vdev->class_dev, 307 res = device_create_file(&vdev->dev, &dev_attr_version);
308 &dev_attr_version);
309 if (res<0) 308 if (res<0)
310 break; 309 break;
311 res = device_create_file(&vdev->class_dev, 310 res = device_create_file(&vdev->dev, &dev_attr_model);
312 &dev_attr_model);
313 if (res<0) 311 if (res<0)
314 break; 312 break;
315 res = device_create_file(&vdev->class_dev, 313 res = device_create_file(&vdev->dev, &dev_attr_hue);
316 &dev_attr_hue);
317 if (res<0) 314 if (res<0)
318 break; 315 break;
319 res = device_create_file(&vdev->class_dev, 316 res = device_create_file(&vdev->dev, &dev_attr_contrast);
320 &dev_attr_contrast);
321 if (res<0) 317 if (res<0)
322 break; 318 break;
323 res = device_create_file(&vdev->class_dev, 319 res = device_create_file(&vdev->dev, &dev_attr_brightness);
324 &dev_attr_brightness);
325 if (res<0) 320 if (res<0)
326 break; 321 break;
327 res = device_create_file(&vdev->class_dev, 322 res = device_create_file(&vdev->dev, &dev_attr_saturation);
328 &dev_attr_saturation);
329 if (res<0) 323 if (res<0)
330 break; 324 break;
331 res = device_create_file(&vdev->class_dev, 325 res = device_create_file(&vdev->dev, &dev_attr_streaming);
332 &dev_attr_streaming);
333 if (res<0) 326 if (res<0)
334 break; 327 break;
335 res = device_create_file(&vdev->class_dev, 328 res = device_create_file(&vdev->dev, &dev_attr_compression);
336 &dev_attr_compression);
337 if (res<0) 329 if (res<0)
338 break; 330 break;
339 res = device_create_file(&vdev->class_dev, 331 res = device_create_file(&vdev->dev, &dev_attr_bridge);
340 &dev_attr_bridge);
341 if (res>=0) 332 if (res>=0)
342 return; 333 return;
343 } while (0); 334 } while (0);
@@ -348,24 +339,15 @@ static void usbvision_create_sysfs(struct video_device *vdev)
348static void usbvision_remove_sysfs(struct video_device *vdev) 339static void usbvision_remove_sysfs(struct video_device *vdev)
349{ 340{
350 if (vdev) { 341 if (vdev) {
351 device_remove_file(&vdev->class_dev, 342 device_remove_file(&vdev->dev, &dev_attr_version);
352 &dev_attr_version); 343 device_remove_file(&vdev->dev, &dev_attr_model);
353 device_remove_file(&vdev->class_dev, 344 device_remove_file(&vdev->dev, &dev_attr_hue);
354 &dev_attr_model); 345 device_remove_file(&vdev->dev, &dev_attr_contrast);
355 device_remove_file(&vdev->class_dev, 346 device_remove_file(&vdev->dev, &dev_attr_brightness);
356 &dev_attr_hue); 347 device_remove_file(&vdev->dev, &dev_attr_saturation);
357 device_remove_file(&vdev->class_dev, 348 device_remove_file(&vdev->dev, &dev_attr_streaming);
358 &dev_attr_contrast); 349 device_remove_file(&vdev->dev, &dev_attr_compression);
359 device_remove_file(&vdev->class_dev, 350 device_remove_file(&vdev->dev, &dev_attr_bridge);
360 &dev_attr_brightness);
361 device_remove_file(&vdev->class_dev,
362 &dev_attr_saturation);
363 device_remove_file(&vdev->class_dev,
364 &dev_attr_streaming);
365 device_remove_file(&vdev->class_dev,
366 &dev_attr_compression);
367 device_remove_file(&vdev->class_dev,
368 &dev_attr_bridge);
369 } 351 }
370} 352}
371 353
diff --git a/drivers/media/video/v4l2-dev.c b/drivers/media/video/v4l2-dev.c
index 9cc2cf1a1c93..88eeee1d8baf 100644
--- a/drivers/media/video/v4l2-dev.c
+++ b/drivers/media/video/v4l2-dev.c
@@ -41,16 +41,14 @@
41static ssize_t show_index(struct device *cd, 41static ssize_t show_index(struct device *cd,
42 struct device_attribute *attr, char *buf) 42 struct device_attribute *attr, char *buf)
43{ 43{
44 struct video_device *vfd = container_of(cd, struct video_device, 44 struct video_device *vfd = container_of(cd, struct video_device, dev);
45 class_dev);
46 return sprintf(buf, "%i\n", vfd->index); 45 return sprintf(buf, "%i\n", vfd->index);
47} 46}
48 47
49static ssize_t show_name(struct device *cd, 48static ssize_t show_name(struct device *cd,
50 struct device_attribute *attr, char *buf) 49 struct device_attribute *attr, char *buf)
51{ 50{
52 struct video_device *vfd = container_of(cd, struct video_device, 51 struct video_device *vfd = container_of(cd, struct video_device, dev);
53 class_dev);
54 return sprintf(buf, "%.*s\n", (int)sizeof(vfd->name), vfd->name); 52 return sprintf(buf, "%.*s\n", (int)sizeof(vfd->name), vfd->name);
55} 53}
56 54
@@ -77,8 +75,7 @@ EXPORT_SYMBOL(video_device_release);
77 75
78static void video_release(struct device *cd) 76static void video_release(struct device *cd)
79{ 77{
80 struct video_device *vfd = container_of(cd, struct video_device, 78 struct video_device *vfd = container_of(cd, struct video_device, dev);
81 class_dev);
82 79
83#if 1 80#if 1
84 /* needed until all drivers are fixed */ 81 /* needed until all drivers are fixed */
@@ -320,13 +317,13 @@ int video_register_device_index(struct video_device *vfd, int type, int nr,
320 mutex_init(&vfd->lock); 317 mutex_init(&vfd->lock);
321 318
322 /* sysfs class */ 319 /* sysfs class */
323 memset(&vfd->class_dev, 0x00, sizeof(vfd->class_dev)); 320 memset(&vfd->dev, 0x00, sizeof(vfd->dev));
324 vfd->class_dev.class = &video_class; 321 vfd->dev.class = &video_class;
325 vfd->class_dev.devt = MKDEV(VIDEO_MAJOR, vfd->minor); 322 vfd->dev.devt = MKDEV(VIDEO_MAJOR, vfd->minor);
326 if (vfd->parent) 323 if (vfd->parent)
327 vfd->class_dev.parent = vfd->parent; 324 vfd->dev.parent = vfd->parent;
328 sprintf(vfd->class_dev.bus_id, "%s%d", name_base, i - base); 325 sprintf(vfd->dev.bus_id, "%s%d", name_base, i - base);
329 ret = device_register(&vfd->class_dev); 326 ret = device_register(&vfd->dev);
330 if (ret < 0) { 327 if (ret < 0) {
331 printk(KERN_ERR "%s: device_register failed\n", __func__); 328 printk(KERN_ERR "%s: device_register failed\n", __func__);
332 goto fail_minor; 329 goto fail_minor;
@@ -365,7 +362,7 @@ void video_unregister_device(struct video_device *vfd)
365 panic("videodev: bad unregister"); 362 panic("videodev: bad unregister");
366 363
367 video_device[vfd->minor] = NULL; 364 video_device[vfd->minor] = NULL;
368 device_unregister(&vfd->class_dev); 365 device_unregister(&vfd->dev);
369 mutex_unlock(&videodev_lock); 366 mutex_unlock(&videodev_lock);
370} 367}
371EXPORT_SYMBOL(video_unregister_device); 368EXPORT_SYMBOL(video_unregister_device);
diff --git a/include/media/v4l2-dev.h b/include/media/v4l2-dev.h
index 5ae261fbcb7e..185372ffa270 100644
--- a/include/media/v4l2-dev.h
+++ b/include/media/v4l2-dev.h
@@ -88,18 +88,18 @@ struct video_device
88 const struct file_operations *fops; 88 const struct file_operations *fops;
89 89
90 /* sysfs */ 90 /* sysfs */
91 struct device class_dev; /* v4l device */ 91 struct device dev; /* v4l device */
92 struct device *parent; /* device parent */ 92 struct device *parent; /* device parent */
93 93
94 /* device info */ 94 /* device info */
95 char name[32]; 95 char name[32];
96 int type; /* v4l1 */ 96 int type; /* v4l1 */
97 int type2; /* v4l2 */ 97 int type2; /* v4l2 */
98 int minor; 98 int minor;
99 /* attribute to diferentiate multiple indexs on one physical device */ 99 /* attribute to diferentiate multiple indexs on one physical device */
100 int index; 100 int index;
101 101
102 int debug; /* Activates debug level*/ 102 int debug; /* Activates debug level*/
103 103
104 /* Video standard vars */ 104 /* Video standard vars */
105 v4l2_std_id tvnorms; /* Supported tv norms */ 105 v4l2_std_id tvnorms; /* Supported tv norms */
@@ -345,7 +345,7 @@ void *priv;
345}; 345};
346 346
347/* Class-dev to video-device */ 347/* Class-dev to video-device */
348#define to_video_device(cd) container_of(cd, struct video_device, class_dev) 348#define to_video_device(cd) container_of(cd, struct video_device, dev)
349 349
350/* Version 2 functions */ 350/* Version 2 functions */
351extern int video_register_device(struct video_device *vfd, int type, int nr); 351extern int video_register_device(struct video_device *vfd, int type, int nr);
@@ -373,7 +373,7 @@ static inline int __must_check
373video_device_create_file(struct video_device *vfd, 373video_device_create_file(struct video_device *vfd,
374 struct device_attribute *attr) 374 struct device_attribute *attr)
375{ 375{
376 int ret = device_create_file(&vfd->class_dev, attr); 376 int ret = device_create_file(&vfd->dev, attr);
377 if (ret < 0) 377 if (ret < 0)
378 printk(KERN_WARNING "%s error: %d\n", __func__, ret); 378 printk(KERN_WARNING "%s error: %d\n", __func__, ret);
379 return ret; 379 return ret;
@@ -382,7 +382,7 @@ static inline void
382video_device_remove_file(struct video_device *vfd, 382video_device_remove_file(struct video_device *vfd,
383 struct device_attribute *attr) 383 struct device_attribute *attr)
384{ 384{
385 device_remove_file(&vfd->class_dev, attr); 385 device_remove_file(&vfd->dev, attr);
386} 386}
387 387
388#endif /* CONFIG_VIDEO_V4L1_COMPAT */ 388#endif /* CONFIG_VIDEO_V4L1_COMPAT */