diff options
Diffstat (limited to 'drivers/media/video/ov511.c')
-rw-r--r-- | drivers/media/video/ov511.c | 81 |
1 files changed, 45 insertions, 36 deletions
diff --git a/drivers/media/video/ov511.c b/drivers/media/video/ov511.c index e5edff1059a2..9eb2562347a8 100644 --- a/drivers/media/video/ov511.c +++ b/drivers/media/video/ov511.c | |||
@@ -5554,41 +5554,46 @@ error: | |||
5554 | * sysfs | 5554 | * sysfs |
5555 | ***************************************************************************/ | 5555 | ***************************************************************************/ |
5556 | 5556 | ||
5557 | static inline struct usb_ov511 *cd_to_ov(struct class_device *cd) | 5557 | static inline struct usb_ov511 *cd_to_ov(struct device *cd) |
5558 | { | 5558 | { |
5559 | struct video_device *vdev = to_video_device(cd); | 5559 | struct video_device *vdev = to_video_device(cd); |
5560 | return video_get_drvdata(vdev); | 5560 | return video_get_drvdata(vdev); |
5561 | } | 5561 | } |
5562 | 5562 | ||
5563 | static ssize_t show_custom_id(struct class_device *cd, char *buf) | 5563 | static ssize_t show_custom_id(struct device *cd, |
5564 | struct device_attribute *attr, char *buf) | ||
5564 | { | 5565 | { |
5565 | struct usb_ov511 *ov = cd_to_ov(cd); | 5566 | struct usb_ov511 *ov = cd_to_ov(cd); |
5566 | return sprintf(buf, "%d\n", ov->customid); | 5567 | return sprintf(buf, "%d\n", ov->customid); |
5567 | } | 5568 | } |
5568 | static CLASS_DEVICE_ATTR(custom_id, S_IRUGO, show_custom_id, NULL); | 5569 | static DEVICE_ATTR(custom_id, S_IRUGO, show_custom_id, NULL); |
5569 | 5570 | ||
5570 | static ssize_t show_model(struct class_device *cd, char *buf) | 5571 | static ssize_t show_model(struct device *cd, |
5572 | struct device_attribute *attr, char *buf) | ||
5571 | { | 5573 | { |
5572 | struct usb_ov511 *ov = cd_to_ov(cd); | 5574 | struct usb_ov511 *ov = cd_to_ov(cd); |
5573 | return sprintf(buf, "%s\n", ov->desc); | 5575 | return sprintf(buf, "%s\n", ov->desc); |
5574 | } | 5576 | } |
5575 | static CLASS_DEVICE_ATTR(model, S_IRUGO, show_model, NULL); | 5577 | static DEVICE_ATTR(model, S_IRUGO, show_model, NULL); |
5576 | 5578 | ||
5577 | static ssize_t show_bridge(struct class_device *cd, char *buf) | 5579 | static ssize_t show_bridge(struct device *cd, |
5580 | struct device_attribute *attr, char *buf) | ||
5578 | { | 5581 | { |
5579 | struct usb_ov511 *ov = cd_to_ov(cd); | 5582 | struct usb_ov511 *ov = cd_to_ov(cd); |
5580 | return sprintf(buf, "%s\n", symbolic(brglist, ov->bridge)); | 5583 | return sprintf(buf, "%s\n", symbolic(brglist, ov->bridge)); |
5581 | } | 5584 | } |
5582 | static CLASS_DEVICE_ATTR(bridge, S_IRUGO, show_bridge, NULL); | 5585 | static DEVICE_ATTR(bridge, S_IRUGO, show_bridge, NULL); |
5583 | 5586 | ||
5584 | static ssize_t show_sensor(struct class_device *cd, char *buf) | 5587 | static ssize_t show_sensor(struct device *cd, |
5588 | struct device_attribute *attr, char *buf) | ||
5585 | { | 5589 | { |
5586 | struct usb_ov511 *ov = cd_to_ov(cd); | 5590 | struct usb_ov511 *ov = cd_to_ov(cd); |
5587 | return sprintf(buf, "%s\n", symbolic(senlist, ov->sensor)); | 5591 | return sprintf(buf, "%s\n", symbolic(senlist, ov->sensor)); |
5588 | } | 5592 | } |
5589 | static CLASS_DEVICE_ATTR(sensor, S_IRUGO, show_sensor, NULL); | 5593 | static DEVICE_ATTR(sensor, S_IRUGO, show_sensor, NULL); |
5590 | 5594 | ||
5591 | static ssize_t show_brightness(struct class_device *cd, char *buf) | 5595 | static ssize_t show_brightness(struct device *cd, |
5596 | struct device_attribute *attr, char *buf) | ||
5592 | { | 5597 | { |
5593 | struct usb_ov511 *ov = cd_to_ov(cd); | 5598 | struct usb_ov511 *ov = cd_to_ov(cd); |
5594 | unsigned short x; | 5599 | unsigned short x; |
@@ -5598,9 +5603,10 @@ static ssize_t show_brightness(struct class_device *cd, char *buf) | |||
5598 | sensor_get_brightness(ov, &x); | 5603 | sensor_get_brightness(ov, &x); |
5599 | return sprintf(buf, "%d\n", x >> 8); | 5604 | return sprintf(buf, "%d\n", x >> 8); |
5600 | } | 5605 | } |
5601 | static CLASS_DEVICE_ATTR(brightness, S_IRUGO, show_brightness, NULL); | 5606 | static DEVICE_ATTR(brightness, S_IRUGO, show_brightness, NULL); |
5602 | 5607 | ||
5603 | static ssize_t show_saturation(struct class_device *cd, char *buf) | 5608 | static ssize_t show_saturation(struct device *cd, |
5609 | struct device_attribute *attr, char *buf) | ||
5604 | { | 5610 | { |
5605 | struct usb_ov511 *ov = cd_to_ov(cd); | 5611 | struct usb_ov511 *ov = cd_to_ov(cd); |
5606 | unsigned short x; | 5612 | unsigned short x; |
@@ -5610,9 +5616,10 @@ static ssize_t show_saturation(struct class_device *cd, char *buf) | |||
5610 | sensor_get_saturation(ov, &x); | 5616 | sensor_get_saturation(ov, &x); |
5611 | return sprintf(buf, "%d\n", x >> 8); | 5617 | return sprintf(buf, "%d\n", x >> 8); |
5612 | } | 5618 | } |
5613 | static CLASS_DEVICE_ATTR(saturation, S_IRUGO, show_saturation, NULL); | 5619 | static DEVICE_ATTR(saturation, S_IRUGO, show_saturation, NULL); |
5614 | 5620 | ||
5615 | static ssize_t show_contrast(struct class_device *cd, char *buf) | 5621 | static ssize_t show_contrast(struct device *cd, |
5622 | struct device_attribute *attr, char *buf) | ||
5616 | { | 5623 | { |
5617 | struct usb_ov511 *ov = cd_to_ov(cd); | 5624 | struct usb_ov511 *ov = cd_to_ov(cd); |
5618 | unsigned short x; | 5625 | unsigned short x; |
@@ -5622,9 +5629,10 @@ static ssize_t show_contrast(struct class_device *cd, char *buf) | |||
5622 | sensor_get_contrast(ov, &x); | 5629 | sensor_get_contrast(ov, &x); |
5623 | return sprintf(buf, "%d\n", x >> 8); | 5630 | return sprintf(buf, "%d\n", x >> 8); |
5624 | } | 5631 | } |
5625 | static CLASS_DEVICE_ATTR(contrast, S_IRUGO, show_contrast, NULL); | 5632 | static DEVICE_ATTR(contrast, S_IRUGO, show_contrast, NULL); |
5626 | 5633 | ||
5627 | static ssize_t show_hue(struct class_device *cd, char *buf) | 5634 | static ssize_t show_hue(struct device *cd, |
5635 | struct device_attribute *attr, char *buf) | ||
5628 | { | 5636 | { |
5629 | struct usb_ov511 *ov = cd_to_ov(cd); | 5637 | struct usb_ov511 *ov = cd_to_ov(cd); |
5630 | unsigned short x; | 5638 | unsigned short x; |
@@ -5634,9 +5642,10 @@ static ssize_t show_hue(struct class_device *cd, char *buf) | |||
5634 | sensor_get_hue(ov, &x); | 5642 | sensor_get_hue(ov, &x); |
5635 | return sprintf(buf, "%d\n", x >> 8); | 5643 | return sprintf(buf, "%d\n", x >> 8); |
5636 | } | 5644 | } |
5637 | static CLASS_DEVICE_ATTR(hue, S_IRUGO, show_hue, NULL); | 5645 | static DEVICE_ATTR(hue, S_IRUGO, show_hue, NULL); |
5638 | 5646 | ||
5639 | static ssize_t show_exposure(struct class_device *cd, char *buf) | 5647 | static ssize_t show_exposure(struct device *cd, |
5648 | struct device_attribute *attr, char *buf) | ||
5640 | { | 5649 | { |
5641 | struct usb_ov511 *ov = cd_to_ov(cd); | 5650 | struct usb_ov511 *ov = cd_to_ov(cd); |
5642 | unsigned char exp = 0; | 5651 | unsigned char exp = 0; |
@@ -5646,49 +5655,49 @@ static ssize_t show_exposure(struct class_device *cd, char *buf) | |||
5646 | sensor_get_exposure(ov, &exp); | 5655 | sensor_get_exposure(ov, &exp); |
5647 | return sprintf(buf, "%d\n", exp >> 8); | 5656 | return sprintf(buf, "%d\n", exp >> 8); |
5648 | } | 5657 | } |
5649 | static CLASS_DEVICE_ATTR(exposure, S_IRUGO, show_exposure, NULL); | 5658 | static DEVICE_ATTR(exposure, S_IRUGO, show_exposure, NULL); |
5650 | 5659 | ||
5651 | static int ov_create_sysfs(struct video_device *vdev) | 5660 | static int ov_create_sysfs(struct video_device *vdev) |
5652 | { | 5661 | { |
5653 | int rc; | 5662 | int rc; |
5654 | 5663 | ||
5655 | rc = video_device_create_file(vdev, &class_device_attr_custom_id); | 5664 | rc = video_device_create_file(vdev, &dev_attr_custom_id); |
5656 | if (rc) goto err; | 5665 | if (rc) goto err; |
5657 | rc = video_device_create_file(vdev, &class_device_attr_model); | 5666 | rc = video_device_create_file(vdev, &dev_attr_model); |
5658 | if (rc) goto err_id; | 5667 | if (rc) goto err_id; |
5659 | rc = video_device_create_file(vdev, &class_device_attr_bridge); | 5668 | rc = video_device_create_file(vdev, &dev_attr_bridge); |
5660 | if (rc) goto err_model; | 5669 | if (rc) goto err_model; |
5661 | rc = video_device_create_file(vdev, &class_device_attr_sensor); | 5670 | rc = video_device_create_file(vdev, &dev_attr_sensor); |
5662 | if (rc) goto err_bridge; | 5671 | if (rc) goto err_bridge; |
5663 | rc = video_device_create_file(vdev, &class_device_attr_brightness); | 5672 | rc = video_device_create_file(vdev, &dev_attr_brightness); |
5664 | if (rc) goto err_sensor; | 5673 | if (rc) goto err_sensor; |
5665 | rc = video_device_create_file(vdev, &class_device_attr_saturation); | 5674 | rc = video_device_create_file(vdev, &dev_attr_saturation); |
5666 | if (rc) goto err_bright; | 5675 | if (rc) goto err_bright; |
5667 | rc = video_device_create_file(vdev, &class_device_attr_contrast); | 5676 | rc = video_device_create_file(vdev, &dev_attr_contrast); |
5668 | if (rc) goto err_sat; | 5677 | if (rc) goto err_sat; |
5669 | rc = video_device_create_file(vdev, &class_device_attr_hue); | 5678 | rc = video_device_create_file(vdev, &dev_attr_hue); |
5670 | if (rc) goto err_contrast; | 5679 | if (rc) goto err_contrast; |
5671 | rc = video_device_create_file(vdev, &class_device_attr_exposure); | 5680 | rc = video_device_create_file(vdev, &dev_attr_exposure); |
5672 | if (rc) goto err_hue; | 5681 | if (rc) goto err_hue; |
5673 | 5682 | ||
5674 | return 0; | 5683 | return 0; |
5675 | 5684 | ||
5676 | err_hue: | 5685 | err_hue: |
5677 | video_device_remove_file(vdev, &class_device_attr_hue); | 5686 | video_device_remove_file(vdev, &dev_attr_hue); |
5678 | err_contrast: | 5687 | err_contrast: |
5679 | video_device_remove_file(vdev, &class_device_attr_contrast); | 5688 | video_device_remove_file(vdev, &dev_attr_contrast); |
5680 | err_sat: | 5689 | err_sat: |
5681 | video_device_remove_file(vdev, &class_device_attr_saturation); | 5690 | video_device_remove_file(vdev, &dev_attr_saturation); |
5682 | err_bright: | 5691 | err_bright: |
5683 | video_device_remove_file(vdev, &class_device_attr_brightness); | 5692 | video_device_remove_file(vdev, &dev_attr_brightness); |
5684 | err_sensor: | 5693 | err_sensor: |
5685 | video_device_remove_file(vdev, &class_device_attr_sensor); | 5694 | video_device_remove_file(vdev, &dev_attr_sensor); |
5686 | err_bridge: | 5695 | err_bridge: |
5687 | video_device_remove_file(vdev, &class_device_attr_bridge); | 5696 | video_device_remove_file(vdev, &dev_attr_bridge); |
5688 | err_model: | 5697 | err_model: |
5689 | video_device_remove_file(vdev, &class_device_attr_model); | 5698 | video_device_remove_file(vdev, &dev_attr_model); |
5690 | err_id: | 5699 | err_id: |
5691 | video_device_remove_file(vdev, &class_device_attr_custom_id); | 5700 | video_device_remove_file(vdev, &dev_attr_custom_id); |
5692 | err: | 5701 | err: |
5693 | return rc; | 5702 | return rc; |
5694 | } | 5703 | } |