aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorWolfram Sang <w.sang@pengutronix.de>2010-04-06 17:34:52 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-04-07 11:38:03 -0400
commit12765517d9dbb477a2432375938f1eb5bdbcb532 (patch)
tree5c0e4002378fe3b65e20ea4959276d22b0a22911 /drivers/media
parent975f8c5653acba461229e671202113da69b87be1 (diff)
device_attributes: add sysfs_attr_init() for dynamic attributes
Made necessary by 6992f5334995af474c2b58d010d08bc597f0f2fe ("sysfs: Use one lockdep class per sysfs attribute"). Prevents further "key xxx not in .data" bug-reports. Although some attributes could probably be converted to static ones, this is left for people having hardware to test. Found by this semantic patch: @ init @ type T; identifier A; @@ T { ... struct device_attribute A; ... }; @ main extends init @ expression E; statement S; identifier err; T *name; @@ ... when != sysfs_attr_init(&name->A.attr); ( + sysfs_attr_init(&name->A.attr); if (device_create_file(E, &name->A)) S | + sysfs_attr_init(&name->A.attr); err = device_create_file(E, &name->A); ) While reviewing, I put the initialization to apropriate places. Signed-off-by: Wolfram Sang <w.sang@pengutronix.de> Cc: Eric W. Biederman <ebiederm@xmission.com> Cc: Greg KH <gregkh@suse.de> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Grant Likely <grant.likely@secretlab.ca> Cc: Mike Isely <isely@pobox.com> Cc: Mauro Carvalho Chehab <mchehab@infradead.org> Cc: Sujith Thomas <sujith.thomas@intel.com> Cc: Matthew Garrett <mjg@redhat.com> Cc: Len Brown <len.brown@intel.com> Cc: Krzysztof Helt <krzysztof.h1@wp.pl> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-sysfs.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/media/video/pvrusb2/pvrusb2-sysfs.c b/drivers/media/video/pvrusb2/pvrusb2-sysfs.c
index 6c23456e0bda..71f50565f637 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-sysfs.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-sysfs.c
@@ -423,10 +423,12 @@ static void pvr2_sysfs_add_debugifc(struct pvr2_sysfs *sfp)
423 423
424 dip = kzalloc(sizeof(*dip),GFP_KERNEL); 424 dip = kzalloc(sizeof(*dip),GFP_KERNEL);
425 if (!dip) return; 425 if (!dip) return;
426 sysfs_attr_init(&dip->attr_debugcmd.attr);
426 dip->attr_debugcmd.attr.name = "debugcmd"; 427 dip->attr_debugcmd.attr.name = "debugcmd";
427 dip->attr_debugcmd.attr.mode = S_IRUGO|S_IWUSR|S_IWGRP; 428 dip->attr_debugcmd.attr.mode = S_IRUGO|S_IWUSR|S_IWGRP;
428 dip->attr_debugcmd.show = debugcmd_show; 429 dip->attr_debugcmd.show = debugcmd_show;
429 dip->attr_debugcmd.store = debugcmd_store; 430 dip->attr_debugcmd.store = debugcmd_store;
431 sysfs_attr_init(&dip->attr_debuginfo.attr);
430 dip->attr_debuginfo.attr.name = "debuginfo"; 432 dip->attr_debuginfo.attr.name = "debuginfo";
431 dip->attr_debuginfo.attr.mode = S_IRUGO; 433 dip->attr_debuginfo.attr.mode = S_IRUGO;
432 dip->attr_debuginfo.show = debuginfo_show; 434 dip->attr_debuginfo.show = debuginfo_show;
@@ -644,6 +646,7 @@ static void class_dev_create(struct pvr2_sysfs *sfp,
644 return; 646 return;
645 } 647 }
646 648
649 sysfs_attr_init(&sfp->attr_v4l_minor_number.attr);
647 sfp->attr_v4l_minor_number.attr.name = "v4l_minor_number"; 650 sfp->attr_v4l_minor_number.attr.name = "v4l_minor_number";
648 sfp->attr_v4l_minor_number.attr.mode = S_IRUGO; 651 sfp->attr_v4l_minor_number.attr.mode = S_IRUGO;
649 sfp->attr_v4l_minor_number.show = v4l_minor_number_show; 652 sfp->attr_v4l_minor_number.show = v4l_minor_number_show;
@@ -658,6 +661,7 @@ static void class_dev_create(struct pvr2_sysfs *sfp,
658 sfp->v4l_minor_number_created_ok = !0; 661 sfp->v4l_minor_number_created_ok = !0;
659 } 662 }
660 663
664 sysfs_attr_init(&sfp->attr_v4l_radio_minor_number.attr);
661 sfp->attr_v4l_radio_minor_number.attr.name = "v4l_radio_minor_number"; 665 sfp->attr_v4l_radio_minor_number.attr.name = "v4l_radio_minor_number";
662 sfp->attr_v4l_radio_minor_number.attr.mode = S_IRUGO; 666 sfp->attr_v4l_radio_minor_number.attr.mode = S_IRUGO;
663 sfp->attr_v4l_radio_minor_number.show = v4l_radio_minor_number_show; 667 sfp->attr_v4l_radio_minor_number.show = v4l_radio_minor_number_show;
@@ -672,6 +676,7 @@ static void class_dev_create(struct pvr2_sysfs *sfp,
672 sfp->v4l_radio_minor_number_created_ok = !0; 676 sfp->v4l_radio_minor_number_created_ok = !0;
673 } 677 }
674 678
679 sysfs_attr_init(&sfp->attr_unit_number.attr);
675 sfp->attr_unit_number.attr.name = "unit_number"; 680 sfp->attr_unit_number.attr.name = "unit_number";
676 sfp->attr_unit_number.attr.mode = S_IRUGO; 681 sfp->attr_unit_number.attr.mode = S_IRUGO;
677 sfp->attr_unit_number.show = unit_number_show; 682 sfp->attr_unit_number.show = unit_number_show;
@@ -685,6 +690,7 @@ static void class_dev_create(struct pvr2_sysfs *sfp,
685 sfp->unit_number_created_ok = !0; 690 sfp->unit_number_created_ok = !0;
686 } 691 }
687 692
693 sysfs_attr_init(&sfp->attr_bus_info.attr);
688 sfp->attr_bus_info.attr.name = "bus_info_str"; 694 sfp->attr_bus_info.attr.name = "bus_info_str";
689 sfp->attr_bus_info.attr.mode = S_IRUGO; 695 sfp->attr_bus_info.attr.mode = S_IRUGO;
690 sfp->attr_bus_info.show = bus_info_show; 696 sfp->attr_bus_info.show = bus_info_show;
@@ -699,6 +705,7 @@ static void class_dev_create(struct pvr2_sysfs *sfp,
699 sfp->bus_info_created_ok = !0; 705 sfp->bus_info_created_ok = !0;
700 } 706 }
701 707
708 sysfs_attr_init(&sfp->attr_hdw_name.attr);
702 sfp->attr_hdw_name.attr.name = "device_hardware_type"; 709 sfp->attr_hdw_name.attr.name = "device_hardware_type";
703 sfp->attr_hdw_name.attr.mode = S_IRUGO; 710 sfp->attr_hdw_name.attr.mode = S_IRUGO;
704 sfp->attr_hdw_name.show = hdw_name_show; 711 sfp->attr_hdw_name.show = hdw_name_show;
@@ -713,6 +720,7 @@ static void class_dev_create(struct pvr2_sysfs *sfp,
713 sfp->hdw_name_created_ok = !0; 720 sfp->hdw_name_created_ok = !0;
714 } 721 }
715 722
723 sysfs_attr_init(&sfp->attr_hdw_desc.attr);
716 sfp->attr_hdw_desc.attr.name = "device_hardware_description"; 724 sfp->attr_hdw_desc.attr.name = "device_hardware_description";
717 sfp->attr_hdw_desc.attr.mode = S_IRUGO; 725 sfp->attr_hdw_desc.attr.mode = S_IRUGO;
718 sfp->attr_hdw_desc.show = hdw_desc_show; 726 sfp->attr_hdw_desc.show = hdw_desc_show;