aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTejun Heo <htejun@gmail.com>2007-09-20 03:05:10 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2007-10-12 17:51:09 -0400
commit5a7ad7f044941316dc98eda2a087a12a7a50649d (patch)
tree03b61af0e90dc158df43f24f8a38792d8c6ae651
parent59f69015684b3de7b9472be9a81b1a978f93a496 (diff)
sysfs: kill sysfs_update_file()
sysfs_update_file() depends on inode->i_mtime but sysfs iondes are now reclaimable making the reported modification time unreliable. There's only one user (pci hotplug) of this notification mechanism and it reportedly isn't utilized from userland. Kill sysfs_update_file(). Signed-off-by: Tejun Heo <htejun@gmail.com> Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--drivers/pci/hotplug/pci_hotplug_core.c60
-rw-r--r--fs/sysfs/file.c40
-rw-r--r--include/linux/sysfs.h7
3 files changed, 0 insertions, 107 deletions
diff --git a/drivers/pci/hotplug/pci_hotplug_core.c b/drivers/pci/hotplug/pci_hotplug_core.c
index bd433ef6bfc6..f0eba534f805 100644
--- a/drivers/pci/hotplug/pci_hotplug_core.c
+++ b/drivers/pci/hotplug/pci_hotplug_core.c
@@ -694,66 +694,6 @@ int __must_check pci_hp_change_slot_info(struct hotplug_slot *slot,
694 if ((slot == NULL) || (info == NULL)) 694 if ((slot == NULL) || (info == NULL))
695 return -ENODEV; 695 return -ENODEV;
696 696
697 /*
698 * check all fields in the info structure, and update timestamps
699 * for the files referring to the fields that have now changed.
700 */
701 if ((has_power_file(slot) == 0) &&
702 (slot->info->power_status != info->power_status)) {
703 retval = sysfs_update_file(&slot->kobj,
704 &hotplug_slot_attr_power.attr);
705 if (retval)
706 return retval;
707 }
708
709 if ((has_attention_file(slot) == 0) &&
710 (slot->info->attention_status != info->attention_status)) {
711 retval = sysfs_update_file(&slot->kobj,
712 &hotplug_slot_attr_attention.attr);
713 if (retval)
714 return retval;
715 }
716
717 if ((has_latch_file(slot) == 0) &&
718 (slot->info->latch_status != info->latch_status)) {
719 retval = sysfs_update_file(&slot->kobj,
720 &hotplug_slot_attr_latch.attr);
721 if (retval)
722 return retval;
723 }
724
725 if ((has_adapter_file(slot) == 0) &&
726 (slot->info->adapter_status != info->adapter_status)) {
727 retval = sysfs_update_file(&slot->kobj,
728 &hotplug_slot_attr_presence.attr);
729 if (retval)
730 return retval;
731 }
732
733 if ((has_address_file(slot) == 0) &&
734 (slot->info->address != info->address)) {
735 retval = sysfs_update_file(&slot->kobj,
736 &hotplug_slot_attr_address.attr);
737 if (retval)
738 return retval;
739 }
740
741 if ((has_max_bus_speed_file(slot) == 0) &&
742 (slot->info->max_bus_speed != info->max_bus_speed)) {
743 retval = sysfs_update_file(&slot->kobj,
744 &hotplug_slot_attr_max_bus_speed.attr);
745 if (retval)
746 return retval;
747 }
748
749 if ((has_cur_bus_speed_file(slot) == 0) &&
750 (slot->info->cur_bus_speed != info->cur_bus_speed)) {
751 retval = sysfs_update_file(&slot->kobj,
752 &hotplug_slot_attr_cur_bus_speed.attr);
753 if (retval)
754 return retval;
755 }
756
757 memcpy (slot->info, info, sizeof (struct hotplug_slot_info)); 697 memcpy (slot->info, info, sizeof (struct hotplug_slot_info));
758 698
759 return 0; 699 return 0;
diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c
index 9fdf8dae0dcd..61a8c19df7c3 100644
--- a/fs/sysfs/file.c
+++ b/fs/sysfs/file.c
@@ -3,7 +3,6 @@
3 */ 3 */
4 4
5#include <linux/module.h> 5#include <linux/module.h>
6#include <linux/fsnotify.h>
7#include <linux/kobject.h> 6#include <linux/kobject.h>
8#include <linux/namei.h> 7#include <linux/namei.h>
9#include <linux/poll.h> 8#include <linux/poll.h>
@@ -453,44 +452,6 @@ int sysfs_add_file_to_group(struct kobject *kobj,
453} 452}
454EXPORT_SYMBOL_GPL(sysfs_add_file_to_group); 453EXPORT_SYMBOL_GPL(sysfs_add_file_to_group);
455 454
456
457/**
458 * sysfs_update_file - update the modified timestamp on an object attribute.
459 * @kobj: object we're acting for.
460 * @attr: attribute descriptor.
461 */
462int sysfs_update_file(struct kobject * kobj, const struct attribute * attr)
463{
464 struct sysfs_dirent *victim_sd = NULL;
465 struct dentry *victim = NULL;
466 int rc;
467
468 rc = -ENOENT;
469 victim_sd = sysfs_get_dirent(kobj->sd, attr->name);
470 if (!victim_sd)
471 goto out;
472
473 mutex_lock(&sysfs_rename_mutex);
474 victim = sysfs_get_dentry(victim_sd);
475 mutex_unlock(&sysfs_rename_mutex);
476 if (IS_ERR(victim)) {
477 rc = PTR_ERR(victim);
478 victim = NULL;
479 goto out;
480 }
481
482 mutex_lock(&victim->d_inode->i_mutex);
483 victim->d_inode->i_mtime = CURRENT_TIME;
484 fsnotify_modify(victim);
485 mutex_unlock(&victim->d_inode->i_mutex);
486 rc = 0;
487 out:
488 dput(victim);
489 sysfs_put(victim_sd);
490 return rc;
491}
492
493
494/** 455/**
495 * sysfs_chmod_file - update the modified mode value on an object attribute. 456 * sysfs_chmod_file - update the modified mode value on an object attribute.
496 * @kobj: object we're acting for. 457 * @kobj: object we're acting for.
@@ -641,4 +602,3 @@ EXPORT_SYMBOL_GPL(sysfs_schedule_callback);
641 602
642EXPORT_SYMBOL_GPL(sysfs_create_file); 603EXPORT_SYMBOL_GPL(sysfs_create_file);
643EXPORT_SYMBOL_GPL(sysfs_remove_file); 604EXPORT_SYMBOL_GPL(sysfs_remove_file);
644EXPORT_SYMBOL_GPL(sysfs_update_file);
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h
index b393bb449624..db5dd2403d08 100644
--- a/include/linux/sysfs.h
+++ b/include/linux/sysfs.h
@@ -87,8 +87,6 @@ int __must_check sysfs_move_dir(struct kobject *kobj,
87 87
88int __must_check sysfs_create_file(struct kobject *kobj, 88int __must_check sysfs_create_file(struct kobject *kobj,
89 const struct attribute *attr); 89 const struct attribute *attr);
90int __must_check sysfs_update_file(struct kobject *kobj,
91 const struct attribute *attr);
92int __must_check sysfs_chmod_file(struct kobject *kobj, struct attribute *attr, 90int __must_check sysfs_chmod_file(struct kobject *kobj, struct attribute *attr,
93 mode_t mode); 91 mode_t mode);
94void sysfs_remove_file(struct kobject *kobj, const struct attribute *attr); 92void sysfs_remove_file(struct kobject *kobj, const struct attribute *attr);
@@ -149,11 +147,6 @@ static inline int sysfs_create_file(struct kobject *kobj,
149 return 0; 147 return 0;
150} 148}
151 149
152static inline int sysfs_update_file(struct kobject *kobj,
153 const struct attribute *attr)
154{
155 return 0;
156}
157static inline int sysfs_chmod_file(struct kobject *kobj, 150static inline int sysfs_chmod_file(struct kobject *kobj,
158 struct attribute *attr, mode_t mode) 151 struct attribute *attr, mode_t mode)
159{ 152{