Commit 03c6bdfc authored by Geliang Tang's avatar Geliang Tang Committed by Mauro Carvalho Chehab

[media] bttv-driver, usbvision-video: use to_video_device()

Use to_video_device() instead of open-coding it.
Signed-off-by: default avatarGeliang Tang <geliangtang@163.com>
Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
parent 80fa4f07
...@@ -186,7 +186,7 @@ MODULE_VERSION(BTTV_VERSION); ...@@ -186,7 +186,7 @@ MODULE_VERSION(BTTV_VERSION);
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, dev); struct video_device *vfd = to_video_device(cd);
struct bttv *btv = video_get_drvdata(vfd); struct bttv *btv = video_get_drvdata(vfd);
return sprintf(buf, "%d\n", btv ? btv->c.type : UNSET); return sprintf(buf, "%d\n", btv ? btv->c.type : UNSET);
} }
......
...@@ -162,8 +162,7 @@ MODULE_ALIAS(DRIVER_ALIAS); ...@@ -162,8 +162,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 = to_video_device(cd);
container_of(cd, struct video_device, dev);
return video_get_drvdata(vdev); return video_get_drvdata(vdev);
} }
...@@ -177,8 +176,7 @@ static DEVICE_ATTR(version, S_IRUGO, show_version, NULL); ...@@ -177,8 +176,7 @@ static DEVICE_ATTR(version, S_IRUGO, show_version, NULL);
static ssize_t show_model(struct device *cd, 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 = to_video_device(cd);
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->dev_model].model_string); usbvision_device_data[usbvision->dev_model].model_string);
...@@ -188,8 +186,7 @@ static DEVICE_ATTR(model, S_IRUGO, show_model, NULL); ...@@ -188,8 +186,7 @@ static DEVICE_ATTR(model, S_IRUGO, show_model, NULL);
static ssize_t show_hue(struct device *cd, 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 = to_video_device(cd);
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;
...@@ -203,8 +200,7 @@ static DEVICE_ATTR(hue, S_IRUGO, show_hue, NULL); ...@@ -203,8 +200,7 @@ static DEVICE_ATTR(hue, S_IRUGO, show_hue, NULL);
static ssize_t show_contrast(struct device *cd, 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 = to_video_device(cd);
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;
...@@ -218,8 +214,7 @@ static DEVICE_ATTR(contrast, S_IRUGO, show_contrast, NULL); ...@@ -218,8 +214,7 @@ static DEVICE_ATTR(contrast, S_IRUGO, show_contrast, NULL);
static ssize_t show_brightness(struct device *cd, 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 = to_video_device(cd);
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;
...@@ -233,8 +228,7 @@ static DEVICE_ATTR(brightness, S_IRUGO, show_brightness, NULL); ...@@ -233,8 +228,7 @@ static DEVICE_ATTR(brightness, S_IRUGO, show_brightness, NULL);
static ssize_t show_saturation(struct device *cd, 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 = to_video_device(cd);
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;
...@@ -248,8 +242,7 @@ static DEVICE_ATTR(saturation, S_IRUGO, show_saturation, NULL); ...@@ -248,8 +242,7 @@ static DEVICE_ATTR(saturation, S_IRUGO, show_saturation, NULL);
static ssize_t show_streaming(struct device *cd, 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 = to_video_device(cd);
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));
...@@ -259,8 +252,7 @@ static DEVICE_ATTR(streaming, S_IRUGO, show_streaming, NULL); ...@@ -259,8 +252,7 @@ static DEVICE_ATTR(streaming, S_IRUGO, show_streaming, NULL);
static ssize_t show_compression(struct device *cd, 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 = to_video_device(cd);
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->isoc_mode == ISOC_MODE_COMPRESS)); YES_NO(usbvision->isoc_mode == ISOC_MODE_COMPRESS));
...@@ -270,8 +262,7 @@ static DEVICE_ATTR(compression, S_IRUGO, show_compression, NULL); ...@@ -270,8 +262,7 @@ static DEVICE_ATTR(compression, S_IRUGO, show_compression, NULL);
static ssize_t show_device_bridge(struct device *cd, 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 = to_video_device(cd);
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->bridge_type); return sprintf(buf, "%d\n", usbvision->bridge_type);
} }
......
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