Commit 22a04f10 authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab

V4L/DVB (8429): videodev: renamed 'class_dev' to 'dev'

The class_dev field is a normal device, not a class device. This is very
confusing and now that the old 'dev' field has been renamed to 'parent'
we can rename 'class_dev' to just 'dev'.
Signed-off-by: default avatarHans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@infradead.org>
parent 5e85e732
...@@ -163,7 +163,7 @@ MODULE_LICENSE("GPL"); ...@@ -163,7 +163,7 @@ MODULE_LICENSE("GPL");
static ssize_t show_card(struct device *cd, static ssize_t show_card(struct device *cd,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
struct video_device *vfd = container_of(cd, struct video_device, class_dev); struct video_device *vfd = container_of(cd, struct video_device, dev);
struct bttv *btv = dev_get_drvdata(vfd->parent); struct bttv *btv = dev_get_drvdata(vfd->parent);
return sprintf(buf, "%d\n", btv ? btv->c.type : UNSET); return sprintf(buf, "%d\n", btv ? btv->c.type : UNSET);
} }
...@@ -4244,7 +4244,7 @@ static int __devinit bttv_register_video(struct bttv *btv) ...@@ -4244,7 +4244,7 @@ static int __devinit bttv_register_video(struct bttv *btv)
goto err; goto err;
printk(KERN_INFO "bttv%d: registered device video%d\n", printk(KERN_INFO "bttv%d: registered device video%d\n",
btv->c.nr,btv->video_dev->minor & 0x1f); btv->c.nr,btv->video_dev->minor & 0x1f);
if (device_create_file(&btv->video_dev->class_dev, if (device_create_file(&btv->video_dev->dev,
&dev_attr_card)<0) { &dev_attr_card)<0) {
printk(KERN_ERR "bttv%d: device_create_file 'card' " printk(KERN_ERR "bttv%d: device_create_file 'card' "
"failed\n", btv->c.nr); "failed\n", btv->c.nr);
......
...@@ -985,7 +985,7 @@ static DEVICE_ATTR(i2c_val, S_IRUGO | S_IWUSR, ...@@ -985,7 +985,7 @@ static DEVICE_ATTR(i2c_val, S_IRUGO | S_IWUSR,
static int et61x251_create_sysfs(struct et61x251_device* cam) static int et61x251_create_sysfs(struct et61x251_device* cam)
{ {
struct device *classdev = &(cam->v4ldev->class_dev); struct device *classdev = &(cam->v4ldev->dev);
int err = 0; int err = 0;
if ((err = device_create_file(classdev, &dev_attr_reg))) if ((err = device_create_file(classdev, &dev_attr_reg)))
......
...@@ -1038,8 +1038,7 @@ static ssize_t sn9c102_show_reg(struct device* cd, ...@@ -1038,8 +1038,7 @@ static ssize_t sn9c102_show_reg(struct device* cd,
if (mutex_lock_interruptible(&sn9c102_sysfs_lock)) if (mutex_lock_interruptible(&sn9c102_sysfs_lock))
return -ERESTARTSYS; return -ERESTARTSYS;
cam = video_get_drvdata(container_of(cd, struct video_device, cam = video_get_drvdata(container_of(cd, struct video_device, dev));
class_dev));
if (!cam) { if (!cam) {
mutex_unlock(&sn9c102_sysfs_lock); mutex_unlock(&sn9c102_sysfs_lock);
return -ENODEV; return -ENODEV;
...@@ -1064,8 +1063,7 @@ sn9c102_store_reg(struct device* cd, struct device_attribute *attr, ...@@ -1064,8 +1063,7 @@ sn9c102_store_reg(struct device* cd, struct device_attribute *attr,
if (mutex_lock_interruptible(&sn9c102_sysfs_lock)) if (mutex_lock_interruptible(&sn9c102_sysfs_lock))
return -ERESTARTSYS; return -ERESTARTSYS;
cam = video_get_drvdata(container_of(cd, struct video_device, cam = video_get_drvdata(container_of(cd, struct video_device, dev));
class_dev));
if (!cam) { if (!cam) {
mutex_unlock(&sn9c102_sysfs_lock); mutex_unlock(&sn9c102_sysfs_lock);
return -ENODEV; return -ENODEV;
...@@ -1098,8 +1096,7 @@ static ssize_t sn9c102_show_val(struct device* cd, ...@@ -1098,8 +1096,7 @@ static ssize_t sn9c102_show_val(struct device* cd,
if (mutex_lock_interruptible(&sn9c102_sysfs_lock)) if (mutex_lock_interruptible(&sn9c102_sysfs_lock))
return -ERESTARTSYS; return -ERESTARTSYS;
cam = video_get_drvdata(container_of(cd, struct video_device, cam = video_get_drvdata(container_of(cd, struct video_device, dev));
class_dev));
if (!cam) { if (!cam) {
mutex_unlock(&sn9c102_sysfs_lock); mutex_unlock(&sn9c102_sysfs_lock);
return -ENODEV; return -ENODEV;
...@@ -1132,8 +1129,7 @@ sn9c102_store_val(struct device* cd, struct device_attribute *attr, ...@@ -1132,8 +1129,7 @@ sn9c102_store_val(struct device* cd, struct device_attribute *attr,
if (mutex_lock_interruptible(&sn9c102_sysfs_lock)) if (mutex_lock_interruptible(&sn9c102_sysfs_lock))
return -ERESTARTSYS; return -ERESTARTSYS;
cam = video_get_drvdata(container_of(cd, struct video_device, cam = video_get_drvdata(container_of(cd, struct video_device, dev));
class_dev));
if (!cam) { if (!cam) {
mutex_unlock(&sn9c102_sysfs_lock); mutex_unlock(&sn9c102_sysfs_lock);
return -ENODEV; return -ENODEV;
...@@ -1170,8 +1166,7 @@ static ssize_t sn9c102_show_i2c_reg(struct device* cd, ...@@ -1170,8 +1166,7 @@ static ssize_t sn9c102_show_i2c_reg(struct device* cd,
if (mutex_lock_interruptible(&sn9c102_sysfs_lock)) if (mutex_lock_interruptible(&sn9c102_sysfs_lock))
return -ERESTARTSYS; return -ERESTARTSYS;
cam = video_get_drvdata(container_of(cd, struct video_device, cam = video_get_drvdata(container_of(cd, struct video_device, dev));
class_dev));
if (!cam) { if (!cam) {
mutex_unlock(&sn9c102_sysfs_lock); mutex_unlock(&sn9c102_sysfs_lock);
return -ENODEV; return -ENODEV;
...@@ -1198,8 +1193,7 @@ sn9c102_store_i2c_reg(struct device* cd, struct device_attribute *attr, ...@@ -1198,8 +1193,7 @@ sn9c102_store_i2c_reg(struct device* cd, struct device_attribute *attr,
if (mutex_lock_interruptible(&sn9c102_sysfs_lock)) if (mutex_lock_interruptible(&sn9c102_sysfs_lock))
return -ERESTARTSYS; return -ERESTARTSYS;
cam = video_get_drvdata(container_of(cd, struct video_device, cam = video_get_drvdata(container_of(cd, struct video_device, dev));
class_dev));
if (!cam) { if (!cam) {
mutex_unlock(&sn9c102_sysfs_lock); mutex_unlock(&sn9c102_sysfs_lock);
return -ENODEV; return -ENODEV;
...@@ -1232,8 +1226,7 @@ static ssize_t sn9c102_show_i2c_val(struct device* cd, ...@@ -1232,8 +1226,7 @@ static ssize_t sn9c102_show_i2c_val(struct device* cd,
if (mutex_lock_interruptible(&sn9c102_sysfs_lock)) if (mutex_lock_interruptible(&sn9c102_sysfs_lock))
return -ERESTARTSYS; return -ERESTARTSYS;
cam = video_get_drvdata(container_of(cd, struct video_device, cam = video_get_drvdata(container_of(cd, struct video_device, dev));
class_dev));
if (!cam) { if (!cam) {
mutex_unlock(&sn9c102_sysfs_lock); mutex_unlock(&sn9c102_sysfs_lock);
return -ENODEV; return -ENODEV;
...@@ -1271,8 +1264,7 @@ sn9c102_store_i2c_val(struct device* cd, struct device_attribute *attr, ...@@ -1271,8 +1264,7 @@ sn9c102_store_i2c_val(struct device* cd, struct device_attribute *attr,
if (mutex_lock_interruptible(&sn9c102_sysfs_lock)) if (mutex_lock_interruptible(&sn9c102_sysfs_lock))
return -ERESTARTSYS; return -ERESTARTSYS;
cam = video_get_drvdata(container_of(cd, struct video_device, cam = video_get_drvdata(container_of(cd, struct video_device, dev));
class_dev));
if (!cam) { if (!cam) {
mutex_unlock(&sn9c102_sysfs_lock); mutex_unlock(&sn9c102_sysfs_lock);
return -ENODEV; return -ENODEV;
...@@ -1318,8 +1310,7 @@ sn9c102_store_green(struct device* cd, struct device_attribute *attr, ...@@ -1318,8 +1310,7 @@ sn9c102_store_green(struct device* cd, struct device_attribute *attr,
if (mutex_lock_interruptible(&sn9c102_sysfs_lock)) if (mutex_lock_interruptible(&sn9c102_sysfs_lock))
return -ERESTARTSYS; return -ERESTARTSYS;
cam = video_get_drvdata(container_of(cd, struct video_device, cam = video_get_drvdata(container_of(cd, struct video_device, dev));
class_dev));
if (!cam) { if (!cam) {
mutex_unlock(&sn9c102_sysfs_lock); mutex_unlock(&sn9c102_sysfs_lock);
return -ENODEV; return -ENODEV;
...@@ -1400,8 +1391,7 @@ static ssize_t sn9c102_show_frame_header(struct device* cd, ...@@ -1400,8 +1391,7 @@ static ssize_t sn9c102_show_frame_header(struct device* cd,
struct sn9c102_device* cam; struct sn9c102_device* cam;
ssize_t count; ssize_t count;
cam = video_get_drvdata(container_of(cd, struct video_device, cam = video_get_drvdata(container_of(cd, struct video_device, dev));
class_dev));
if (!cam) if (!cam)
return -ENODEV; return -ENODEV;
...@@ -1428,49 +1418,49 @@ static DEVICE_ATTR(frame_header, S_IRUGO, sn9c102_show_frame_header, NULL); ...@@ -1428,49 +1418,49 @@ static DEVICE_ATTR(frame_header, S_IRUGO, sn9c102_show_frame_header, NULL);
static int sn9c102_create_sysfs(struct sn9c102_device* cam) static int sn9c102_create_sysfs(struct sn9c102_device* cam)
{ {
struct device *classdev = &(cam->v4ldev->class_dev); struct device *dev = &(cam->v4ldev->dev);
int err = 0; int err = 0;
if ((err = device_create_file(classdev, &dev_attr_reg))) if ((err = device_create_file(dev, &dev_attr_reg)))
goto err_out; goto err_out;
if ((err = device_create_file(classdev, &dev_attr_val))) if ((err = device_create_file(dev, &dev_attr_val)))
goto err_reg; goto err_reg;
if ((err = device_create_file(classdev, &dev_attr_frame_header))) if ((err = device_create_file(dev, &dev_attr_frame_header)))
goto err_val; goto err_val;
if (cam->sensor.sysfs_ops) { if (cam->sensor.sysfs_ops) {
if ((err = device_create_file(classdev, &dev_attr_i2c_reg))) if ((err = device_create_file(dev, &dev_attr_i2c_reg)))
goto err_frame_header; goto err_frame_header;
if ((err = device_create_file(classdev, &dev_attr_i2c_val))) if ((err = device_create_file(dev, &dev_attr_i2c_val)))
goto err_i2c_reg; goto err_i2c_reg;
} }
if (cam->bridge == BRIDGE_SN9C101 || cam->bridge == BRIDGE_SN9C102) { if (cam->bridge == BRIDGE_SN9C101 || cam->bridge == BRIDGE_SN9C102) {
if ((err = device_create_file(classdev, &dev_attr_green))) if ((err = device_create_file(dev, &dev_attr_green)))
goto err_i2c_val; goto err_i2c_val;
} else { } else {
if ((err = device_create_file(classdev, &dev_attr_blue))) if ((err = device_create_file(dev, &dev_attr_blue)))
goto err_i2c_val; goto err_i2c_val;
if ((err = device_create_file(classdev, &dev_attr_red))) if ((err = device_create_file(dev, &dev_attr_red)))
goto err_blue; goto err_blue;
} }
return 0; return 0;
err_blue: err_blue:
device_remove_file(classdev, &dev_attr_blue); device_remove_file(dev, &dev_attr_blue);
err_i2c_val: err_i2c_val:
if (cam->sensor.sysfs_ops) if (cam->sensor.sysfs_ops)
device_remove_file(classdev, &dev_attr_i2c_val); device_remove_file(dev, &dev_attr_i2c_val);
err_i2c_reg: err_i2c_reg:
if (cam->sensor.sysfs_ops) if (cam->sensor.sysfs_ops)
device_remove_file(classdev, &dev_attr_i2c_reg); device_remove_file(dev, &dev_attr_i2c_reg);
err_frame_header: err_frame_header:
device_remove_file(classdev, &dev_attr_frame_header); device_remove_file(dev, &dev_attr_frame_header);
err_val: err_val:
device_remove_file(classdev, &dev_attr_val); device_remove_file(dev, &dev_attr_val);
err_reg: err_reg:
device_remove_file(classdev, &dev_attr_reg); device_remove_file(dev, &dev_attr_reg);
err_out: err_out:
return err; return err;
} }
......
...@@ -184,7 +184,7 @@ MODULE_ALIAS(DRIVER_ALIAS); ...@@ -184,7 +184,7 @@ MODULE_ALIAS(DRIVER_ALIAS);
static inline struct usb_usbvision *cd_to_usbvision(struct device *cd) static inline struct usb_usbvision *cd_to_usbvision(struct device *cd)
{ {
struct video_device *vdev = struct video_device *vdev =
container_of(cd, struct video_device, class_dev); container_of(cd, struct video_device, dev);
return video_get_drvdata(vdev); return video_get_drvdata(vdev);
} }
...@@ -199,7 +199,7 @@ static ssize_t show_model(struct device *cd, ...@@ -199,7 +199,7 @@ static ssize_t show_model(struct device *cd,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
struct video_device *vdev = struct video_device *vdev =
container_of(cd, struct video_device, class_dev); container_of(cd, struct video_device, dev);
struct usb_usbvision *usbvision = video_get_drvdata(vdev); struct usb_usbvision *usbvision = video_get_drvdata(vdev);
return sprintf(buf, "%s\n", return sprintf(buf, "%s\n",
usbvision_device_data[usbvision->DevModel].ModelString); usbvision_device_data[usbvision->DevModel].ModelString);
...@@ -210,7 +210,7 @@ static ssize_t show_hue(struct device *cd, ...@@ -210,7 +210,7 @@ static ssize_t show_hue(struct device *cd,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
struct video_device *vdev = struct video_device *vdev =
container_of(cd, struct video_device, class_dev); container_of(cd, struct video_device, dev);
struct usb_usbvision *usbvision = video_get_drvdata(vdev); struct usb_usbvision *usbvision = video_get_drvdata(vdev);
struct v4l2_control ctrl; struct v4l2_control ctrl;
ctrl.id = V4L2_CID_HUE; ctrl.id = V4L2_CID_HUE;
...@@ -225,7 +225,7 @@ static ssize_t show_contrast(struct device *cd, ...@@ -225,7 +225,7 @@ static ssize_t show_contrast(struct device *cd,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
struct video_device *vdev = struct video_device *vdev =
container_of(cd, struct video_device, class_dev); container_of(cd, struct video_device, dev);
struct usb_usbvision *usbvision = video_get_drvdata(vdev); struct usb_usbvision *usbvision = video_get_drvdata(vdev);
struct v4l2_control ctrl; struct v4l2_control ctrl;
ctrl.id = V4L2_CID_CONTRAST; ctrl.id = V4L2_CID_CONTRAST;
...@@ -240,7 +240,7 @@ static ssize_t show_brightness(struct device *cd, ...@@ -240,7 +240,7 @@ static ssize_t show_brightness(struct device *cd,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
struct video_device *vdev = struct video_device *vdev =
container_of(cd, struct video_device, class_dev); container_of(cd, struct video_device, dev);
struct usb_usbvision *usbvision = video_get_drvdata(vdev); struct usb_usbvision *usbvision = video_get_drvdata(vdev);
struct v4l2_control ctrl; struct v4l2_control ctrl;
ctrl.id = V4L2_CID_BRIGHTNESS; ctrl.id = V4L2_CID_BRIGHTNESS;
...@@ -255,7 +255,7 @@ static ssize_t show_saturation(struct device *cd, ...@@ -255,7 +255,7 @@ static ssize_t show_saturation(struct device *cd,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
struct video_device *vdev = struct video_device *vdev =
container_of(cd, struct video_device, class_dev); container_of(cd, struct video_device, dev);
struct usb_usbvision *usbvision = video_get_drvdata(vdev); struct usb_usbvision *usbvision = video_get_drvdata(vdev);
struct v4l2_control ctrl; struct v4l2_control ctrl;
ctrl.id = V4L2_CID_SATURATION; ctrl.id = V4L2_CID_SATURATION;
...@@ -270,7 +270,7 @@ static ssize_t show_streaming(struct device *cd, ...@@ -270,7 +270,7 @@ static ssize_t show_streaming(struct device *cd,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
struct video_device *vdev = struct video_device *vdev =
container_of(cd, struct video_device, class_dev); container_of(cd, struct video_device, dev);
struct usb_usbvision *usbvision = video_get_drvdata(vdev); struct usb_usbvision *usbvision = video_get_drvdata(vdev);
return sprintf(buf, "%s\n", return sprintf(buf, "%s\n",
YES_NO(usbvision->streaming==Stream_On?1:0)); YES_NO(usbvision->streaming==Stream_On?1:0));
...@@ -281,7 +281,7 @@ static ssize_t show_compression(struct device *cd, ...@@ -281,7 +281,7 @@ static ssize_t show_compression(struct device *cd,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
struct video_device *vdev = struct video_device *vdev =
container_of(cd, struct video_device, class_dev); container_of(cd, struct video_device, dev);
struct usb_usbvision *usbvision = video_get_drvdata(vdev); struct usb_usbvision *usbvision = video_get_drvdata(vdev);
return sprintf(buf, "%s\n", return sprintf(buf, "%s\n",
YES_NO(usbvision->isocMode==ISOC_MODE_COMPRESS)); YES_NO(usbvision->isocMode==ISOC_MODE_COMPRESS));
...@@ -292,7 +292,7 @@ static ssize_t show_device_bridge(struct device *cd, ...@@ -292,7 +292,7 @@ static ssize_t show_device_bridge(struct device *cd,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
struct video_device *vdev = struct video_device *vdev =
container_of(cd, struct video_device, class_dev); container_of(cd, struct video_device, dev);
struct usb_usbvision *usbvision = video_get_drvdata(vdev); struct usb_usbvision *usbvision = video_get_drvdata(vdev);
return sprintf(buf, "%d\n", usbvision->bridgeType); return sprintf(buf, "%d\n", usbvision->bridgeType);
} }
...@@ -304,40 +304,31 @@ static void usbvision_create_sysfs(struct video_device *vdev) ...@@ -304,40 +304,31 @@ static void usbvision_create_sysfs(struct video_device *vdev)
if (!vdev) if (!vdev)
return; return;
do { do {
res = device_create_file(&vdev->class_dev, res = device_create_file(&vdev->dev, &dev_attr_version);
&dev_attr_version);
if (res<0) if (res<0)
break; break;
res = device_create_file(&vdev->class_dev, res = device_create_file(&vdev->dev, &dev_attr_model);
&dev_attr_model);
if (res<0) if (res<0)
break; break;
res = device_create_file(&vdev->class_dev, res = device_create_file(&vdev->dev, &dev_attr_hue);
&dev_attr_hue);
if (res<0) if (res<0)
break; break;
res = device_create_file(&vdev->class_dev, res = device_create_file(&vdev->dev, &dev_attr_contrast);
&dev_attr_contrast);
if (res<0) if (res<0)
break; break;
res = device_create_file(&vdev->class_dev, res = device_create_file(&vdev->dev, &dev_attr_brightness);
&dev_attr_brightness);
if (res<0) if (res<0)
break; break;
res = device_create_file(&vdev->class_dev, res = device_create_file(&vdev->dev, &dev_attr_saturation);
&dev_attr_saturation);
if (res<0) if (res<0)
break; break;
res = device_create_file(&vdev->class_dev, res = device_create_file(&vdev->dev, &dev_attr_streaming);
&dev_attr_streaming);
if (res<0) if (res<0)
break; break;
res = device_create_file(&vdev->class_dev, res = device_create_file(&vdev->dev, &dev_attr_compression);
&dev_attr_compression);
if (res<0) if (res<0)
break; break;
res = device_create_file(&vdev->class_dev, res = device_create_file(&vdev->dev, &dev_attr_bridge);
&dev_attr_bridge);
if (res>=0) if (res>=0)
return; return;
} while (0); } while (0);
...@@ -348,24 +339,15 @@ static void usbvision_create_sysfs(struct video_device *vdev) ...@@ -348,24 +339,15 @@ static void usbvision_create_sysfs(struct video_device *vdev)
static void usbvision_remove_sysfs(struct video_device *vdev) static void usbvision_remove_sysfs(struct video_device *vdev)
{ {
if (vdev) { if (vdev) {
device_remove_file(&vdev->class_dev, device_remove_file(&vdev->dev, &dev_attr_version);
&dev_attr_version); device_remove_file(&vdev->dev, &dev_attr_model);
device_remove_file(&vdev->class_dev, device_remove_file(&vdev->dev, &dev_attr_hue);
&dev_attr_model); device_remove_file(&vdev->dev, &dev_attr_contrast);
device_remove_file(&vdev->class_dev, device_remove_file(&vdev->dev, &dev_attr_brightness);
&dev_attr_hue); device_remove_file(&vdev->dev, &dev_attr_saturation);
device_remove_file(&vdev->class_dev, device_remove_file(&vdev->dev, &dev_attr_streaming);
&dev_attr_contrast); device_remove_file(&vdev->dev, &dev_attr_compression);
device_remove_file(&vdev->class_dev, device_remove_file(&vdev->dev, &dev_attr_bridge);
&dev_attr_brightness);
device_remove_file(&vdev->class_dev,
&dev_attr_saturation);
device_remove_file(&vdev->class_dev,
&dev_attr_streaming);
device_remove_file(&vdev->class_dev,
&dev_attr_compression);
device_remove_file(&vdev->class_dev,
&dev_attr_bridge);
} }
} }
......
...@@ -41,16 +41,14 @@ ...@@ -41,16 +41,14 @@
static ssize_t show_index(struct device *cd, static ssize_t show_index(struct device *cd,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
struct video_device *vfd = container_of(cd, struct video_device, struct video_device *vfd = container_of(cd, struct video_device, dev);
class_dev);
return sprintf(buf, "%i\n", vfd->index); return sprintf(buf, "%i\n", vfd->index);
} }
static ssize_t show_name(struct device *cd, static ssize_t show_name(struct device *cd,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
struct video_device *vfd = container_of(cd, struct video_device, struct video_device *vfd = container_of(cd, struct video_device, dev);
class_dev);
return sprintf(buf, "%.*s\n", (int)sizeof(vfd->name), vfd->name); return sprintf(buf, "%.*s\n", (int)sizeof(vfd->name), vfd->name);
} }
...@@ -77,8 +75,7 @@ EXPORT_SYMBOL(video_device_release); ...@@ -77,8 +75,7 @@ EXPORT_SYMBOL(video_device_release);
static void video_release(struct device *cd) static void video_release(struct device *cd)
{ {
struct video_device *vfd = container_of(cd, struct video_device, struct video_device *vfd = container_of(cd, struct video_device, dev);
class_dev);
#if 1 #if 1
/* needed until all drivers are fixed */ /* needed until all drivers are fixed */
...@@ -320,13 +317,13 @@ int video_register_device_index(struct video_device *vfd, int type, int nr, ...@@ -320,13 +317,13 @@ int video_register_device_index(struct video_device *vfd, int type, int nr,
mutex_init(&vfd->lock); mutex_init(&vfd->lock);
/* sysfs class */ /* sysfs class */
memset(&vfd->class_dev, 0x00, sizeof(vfd->class_dev)); memset(&vfd->dev, 0x00, sizeof(vfd->dev));
vfd->class_dev.class = &video_class; vfd->dev.class = &video_class;
vfd->class_dev.devt = MKDEV(VIDEO_MAJOR, vfd->minor); vfd->dev.devt = MKDEV(VIDEO_MAJOR, vfd->minor);
if (vfd->parent) if (vfd->parent)
vfd->class_dev.parent = vfd->parent; vfd->dev.parent = vfd->parent;
sprintf(vfd->class_dev.bus_id, "%s%d", name_base, i - base); sprintf(vfd->dev.bus_id, "%s%d", name_base, i - base);
ret = device_register(&vfd->class_dev); ret = device_register(&vfd->dev);
if (ret < 0) { if (ret < 0) {
printk(KERN_ERR "%s: device_register failed\n", __func__); printk(KERN_ERR "%s: device_register failed\n", __func__);
goto fail_minor; goto fail_minor;
...@@ -365,7 +362,7 @@ void video_unregister_device(struct video_device *vfd) ...@@ -365,7 +362,7 @@ void video_unregister_device(struct video_device *vfd)
panic("videodev: bad unregister"); panic("videodev: bad unregister");
video_device[vfd->minor] = NULL; video_device[vfd->minor] = NULL;
device_unregister(&vfd->class_dev); device_unregister(&vfd->dev);
mutex_unlock(&videodev_lock); mutex_unlock(&videodev_lock);
} }
EXPORT_SYMBOL(video_unregister_device); EXPORT_SYMBOL(video_unregister_device);
......
...@@ -88,7 +88,7 @@ struct video_device ...@@ -88,7 +88,7 @@ struct video_device
const struct file_operations *fops; const struct file_operations *fops;
/* sysfs */ /* sysfs */
struct device class_dev; /* v4l device */ struct device dev; /* v4l device */
struct device *parent; /* device parent */ struct device *parent; /* device parent */
/* device info */ /* device info */
...@@ -345,7 +345,7 @@ void *priv; ...@@ -345,7 +345,7 @@ void *priv;
}; };
/* Class-dev to video-device */ /* Class-dev to video-device */
#define to_video_device(cd) container_of(cd, struct video_device, class_dev) #define to_video_device(cd) container_of(cd, struct video_device, dev)
/* Version 2 functions */ /* Version 2 functions */
extern int video_register_device(struct video_device *vfd, int type, int nr); extern int video_register_device(struct video_device *vfd, int type, int nr);
...@@ -373,7 +373,7 @@ static inline int __must_check ...@@ -373,7 +373,7 @@ static inline int __must_check
video_device_create_file(struct video_device *vfd, video_device_create_file(struct video_device *vfd,
struct device_attribute *attr) struct device_attribute *attr)
{ {
int ret = device_create_file(&vfd->class_dev, attr); int ret = device_create_file(&vfd->dev, attr);
if (ret < 0) if (ret < 0)
printk(KERN_WARNING "%s error: %d\n", __func__, ret); printk(KERN_WARNING "%s error: %d\n", __func__, ret);
return ret; return ret;
...@@ -382,7 +382,7 @@ static inline void ...@@ -382,7 +382,7 @@ static inline void
video_device_remove_file(struct video_device *vfd, video_device_remove_file(struct video_device *vfd,
struct device_attribute *attr) struct device_attribute *attr)
{ {
device_remove_file(&vfd->class_dev, attr); device_remove_file(&vfd->dev, attr);
} }
#endif /* CONFIG_VIDEO_V4L1_COMPAT */ #endif /* CONFIG_VIDEO_V4L1_COMPAT */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment