diff options
author | Greg Kroah-Hartman <gregkh@suse.de> | 2009-04-30 17:43:31 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-06-16 00:30:27 -0400 |
commit | 79510cdbc76265426c6d75326436624393694ea7 (patch) | |
tree | a36e5adf746e0c8fb967ac21e7c33b77a178919e /drivers/media/video/pvrusb2/pvrusb2-sysfs.c | |
parent | 017596b61f324946299fa94d9ef6f08b7478a3d8 (diff) |
media: remove driver_data direct access of struct device
In the near future, the driver core is going to not allow direct access
to the driver_data pointer in struct device. Instead, the functions
dev_get_drvdata() and dev_set_drvdata() should be used. These functions
have been around since the beginning, so are backwards compatible with
all older kernel versions.
Cc: Mauro Carvalho Chehab <mchehab@infradead.org>
Acked-by: Mike Isely <isely@pobox.com>
Cc: linux-media@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/media/video/pvrusb2/pvrusb2-sysfs.c')
-rw-r--r-- | drivers/media/video/pvrusb2/pvrusb2-sysfs.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/drivers/media/video/pvrusb2/pvrusb2-sysfs.c b/drivers/media/video/pvrusb2/pvrusb2-sysfs.c index 299c1cbc3832..6c23456e0bda 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-sysfs.c +++ b/drivers/media/video/pvrusb2/pvrusb2-sysfs.c | |||
@@ -539,7 +539,7 @@ static void class_dev_destroy(struct pvr2_sysfs *sfp) | |||
539 | &sfp->attr_unit_number); | 539 | &sfp->attr_unit_number); |
540 | } | 540 | } |
541 | pvr2_sysfs_trace("Destroying class_dev id=%p",sfp->class_dev); | 541 | pvr2_sysfs_trace("Destroying class_dev id=%p",sfp->class_dev); |
542 | sfp->class_dev->driver_data = NULL; | 542 | dev_set_drvdata(sfp->class_dev, NULL); |
543 | device_unregister(sfp->class_dev); | 543 | device_unregister(sfp->class_dev); |
544 | sfp->class_dev = NULL; | 544 | sfp->class_dev = NULL; |
545 | } | 545 | } |
@@ -549,7 +549,7 @@ static ssize_t v4l_minor_number_show(struct device *class_dev, | |||
549 | struct device_attribute *attr, char *buf) | 549 | struct device_attribute *attr, char *buf) |
550 | { | 550 | { |
551 | struct pvr2_sysfs *sfp; | 551 | struct pvr2_sysfs *sfp; |
552 | sfp = (struct pvr2_sysfs *)class_dev->driver_data; | 552 | sfp = dev_get_drvdata(class_dev); |
553 | if (!sfp) return -EINVAL; | 553 | if (!sfp) return -EINVAL; |
554 | return scnprintf(buf,PAGE_SIZE,"%d\n", | 554 | return scnprintf(buf,PAGE_SIZE,"%d\n", |
555 | pvr2_hdw_v4l_get_minor_number(sfp->channel.hdw, | 555 | pvr2_hdw_v4l_get_minor_number(sfp->channel.hdw, |
@@ -561,7 +561,7 @@ static ssize_t bus_info_show(struct device *class_dev, | |||
561 | struct device_attribute *attr, char *buf) | 561 | struct device_attribute *attr, char *buf) |
562 | { | 562 | { |
563 | struct pvr2_sysfs *sfp; | 563 | struct pvr2_sysfs *sfp; |
564 | sfp = (struct pvr2_sysfs *)class_dev->driver_data; | 564 | sfp = dev_get_drvdata(class_dev); |
565 | if (!sfp) return -EINVAL; | 565 | if (!sfp) return -EINVAL; |
566 | return scnprintf(buf,PAGE_SIZE,"%s\n", | 566 | return scnprintf(buf,PAGE_SIZE,"%s\n", |
567 | pvr2_hdw_get_bus_info(sfp->channel.hdw)); | 567 | pvr2_hdw_get_bus_info(sfp->channel.hdw)); |
@@ -572,7 +572,7 @@ static ssize_t hdw_name_show(struct device *class_dev, | |||
572 | struct device_attribute *attr, char *buf) | 572 | struct device_attribute *attr, char *buf) |
573 | { | 573 | { |
574 | struct pvr2_sysfs *sfp; | 574 | struct pvr2_sysfs *sfp; |
575 | sfp = (struct pvr2_sysfs *)class_dev->driver_data; | 575 | sfp = dev_get_drvdata(class_dev); |
576 | if (!sfp) return -EINVAL; | 576 | if (!sfp) return -EINVAL; |
577 | return scnprintf(buf,PAGE_SIZE,"%s\n", | 577 | return scnprintf(buf,PAGE_SIZE,"%s\n", |
578 | pvr2_hdw_get_type(sfp->channel.hdw)); | 578 | pvr2_hdw_get_type(sfp->channel.hdw)); |
@@ -583,7 +583,7 @@ static ssize_t hdw_desc_show(struct device *class_dev, | |||
583 | struct device_attribute *attr, char *buf) | 583 | struct device_attribute *attr, char *buf) |
584 | { | 584 | { |
585 | struct pvr2_sysfs *sfp; | 585 | struct pvr2_sysfs *sfp; |
586 | sfp = (struct pvr2_sysfs *)class_dev->driver_data; | 586 | sfp = dev_get_drvdata(class_dev); |
587 | if (!sfp) return -EINVAL; | 587 | if (!sfp) return -EINVAL; |
588 | return scnprintf(buf,PAGE_SIZE,"%s\n", | 588 | return scnprintf(buf,PAGE_SIZE,"%s\n", |
589 | pvr2_hdw_get_desc(sfp->channel.hdw)); | 589 | pvr2_hdw_get_desc(sfp->channel.hdw)); |
@@ -595,7 +595,7 @@ static ssize_t v4l_radio_minor_number_show(struct device *class_dev, | |||
595 | char *buf) | 595 | char *buf) |
596 | { | 596 | { |
597 | struct pvr2_sysfs *sfp; | 597 | struct pvr2_sysfs *sfp; |
598 | sfp = (struct pvr2_sysfs *)class_dev->driver_data; | 598 | sfp = dev_get_drvdata(class_dev); |
599 | if (!sfp) return -EINVAL; | 599 | if (!sfp) return -EINVAL; |
600 | return scnprintf(buf,PAGE_SIZE,"%d\n", | 600 | return scnprintf(buf,PAGE_SIZE,"%d\n", |
601 | pvr2_hdw_v4l_get_minor_number(sfp->channel.hdw, | 601 | pvr2_hdw_v4l_get_minor_number(sfp->channel.hdw, |
@@ -607,7 +607,7 @@ static ssize_t unit_number_show(struct device *class_dev, | |||
607 | struct device_attribute *attr, char *buf) | 607 | struct device_attribute *attr, char *buf) |
608 | { | 608 | { |
609 | struct pvr2_sysfs *sfp; | 609 | struct pvr2_sysfs *sfp; |
610 | sfp = (struct pvr2_sysfs *)class_dev->driver_data; | 610 | sfp = dev_get_drvdata(class_dev); |
611 | if (!sfp) return -EINVAL; | 611 | if (!sfp) return -EINVAL; |
612 | return scnprintf(buf,PAGE_SIZE,"%d\n", | 612 | return scnprintf(buf,PAGE_SIZE,"%d\n", |
613 | pvr2_hdw_get_unit_number(sfp->channel.hdw)); | 613 | pvr2_hdw_get_unit_number(sfp->channel.hdw)); |
@@ -635,7 +635,7 @@ static void class_dev_create(struct pvr2_sysfs *sfp, | |||
635 | class_dev->parent = &usb_dev->dev; | 635 | class_dev->parent = &usb_dev->dev; |
636 | 636 | ||
637 | sfp->class_dev = class_dev; | 637 | sfp->class_dev = class_dev; |
638 | class_dev->driver_data = sfp; | 638 | dev_set_drvdata(class_dev, sfp); |
639 | ret = device_register(class_dev); | 639 | ret = device_register(class_dev); |
640 | if (ret) { | 640 | if (ret) { |
641 | pvr2_trace(PVR2_TRACE_ERROR_LEGS, | 641 | pvr2_trace(PVR2_TRACE_ERROR_LEGS, |
@@ -792,7 +792,7 @@ static ssize_t debuginfo_show(struct device *class_dev, | |||
792 | struct device_attribute *attr, char *buf) | 792 | struct device_attribute *attr, char *buf) |
793 | { | 793 | { |
794 | struct pvr2_sysfs *sfp; | 794 | struct pvr2_sysfs *sfp; |
795 | sfp = (struct pvr2_sysfs *)class_dev->driver_data; | 795 | sfp = dev_get_drvdata(class_dev); |
796 | if (!sfp) return -EINVAL; | 796 | if (!sfp) return -EINVAL; |
797 | pvr2_hdw_trigger_module_log(sfp->channel.hdw); | 797 | pvr2_hdw_trigger_module_log(sfp->channel.hdw); |
798 | return pvr2_debugifc_print_info(sfp->channel.hdw,buf,PAGE_SIZE); | 798 | return pvr2_debugifc_print_info(sfp->channel.hdw,buf,PAGE_SIZE); |
@@ -803,7 +803,7 @@ static ssize_t debugcmd_show(struct device *class_dev, | |||
803 | struct device_attribute *attr, char *buf) | 803 | struct device_attribute *attr, char *buf) |
804 | { | 804 | { |
805 | struct pvr2_sysfs *sfp; | 805 | struct pvr2_sysfs *sfp; |
806 | sfp = (struct pvr2_sysfs *)class_dev->driver_data; | 806 | sfp = dev_get_drvdata(class_dev); |
807 | if (!sfp) return -EINVAL; | 807 | if (!sfp) return -EINVAL; |
808 | return pvr2_debugifc_print_status(sfp->channel.hdw,buf,PAGE_SIZE); | 808 | return pvr2_debugifc_print_status(sfp->channel.hdw,buf,PAGE_SIZE); |
809 | } | 809 | } |
@@ -816,7 +816,7 @@ static ssize_t debugcmd_store(struct device *class_dev, | |||
816 | struct pvr2_sysfs *sfp; | 816 | struct pvr2_sysfs *sfp; |
817 | int ret; | 817 | int ret; |
818 | 818 | ||
819 | sfp = (struct pvr2_sysfs *)class_dev->driver_data; | 819 | sfp = dev_get_drvdata(class_dev); |
820 | if (!sfp) return -EINVAL; | 820 | if (!sfp) return -EINVAL; |
821 | 821 | ||
822 | ret = pvr2_debugifc_docmd(sfp->channel.hdw,buf,count); | 822 | ret = pvr2_debugifc_docmd(sfp->channel.hdw,buf,count); |