aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinas Vepstas <linas@austin.ibm.com>2006-12-01 19:31:27 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2006-12-20 13:54:42 -0500
commitf1e79092d9a59e2b1c8eae3b0f4ef3827dda08a0 (patch)
tree5cc1514f7d46583e9812aa2f0d7e8f5548fa5d53
parent0c875c28649eac0adb8d2e2efac2186c3089e100 (diff)
rpaphp: compiler warning cleanup
This janitorial patch removes the following annoying compile-time message: drivers/pci/hotplug/rpaphp_slot.c:57: warning: ignoring return value of sfs_create_file declared with attribute warn_unused_result It also fixes a typo, removes some misc crud. Signed-off-by: Linas Vepstas <linas@austin.ibm.com> Cc: John Rose <johnrose@us.ibm.com> Signed-off-by: Kristen Carlson Accardi <kristen.c.accardi@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--drivers/pci/hotplug/rpaphp_slot.c47
1 files changed, 23 insertions, 24 deletions
diff --git a/drivers/pci/hotplug/rpaphp_slot.c b/drivers/pci/hotplug/rpaphp_slot.c
index b771196a654..3009193f005 100644
--- a/drivers/pci/hotplug/rpaphp_slot.c
+++ b/drivers/pci/hotplug/rpaphp_slot.c
@@ -47,21 +47,11 @@ static ssize_t location_read_file (struct hotplug_slot *php_slot, char *buf)
47 return retval; 47 return retval;
48} 48}
49 49
50static struct hotplug_slot_attribute hotplug_slot_attr_location = { 50static struct hotplug_slot_attribute php_attr_location = {
51 .attr = {.name = "phy_location", .mode = S_IFREG | S_IRUGO}, 51 .attr = {.name = "phy_location", .mode = S_IFREG | S_IRUGO},
52 .show = location_read_file, 52 .show = location_read_file,
53}; 53};
54 54
55static void rpaphp_sysfs_add_attr_location (struct hotplug_slot *slot)
56{
57 sysfs_create_file(&slot->kobj, &hotplug_slot_attr_location.attr);
58}
59
60static void rpaphp_sysfs_remove_attr_location (struct hotplug_slot *slot)
61{
62 sysfs_remove_file(&slot->kobj, &hotplug_slot_attr_location.attr);
63}
64
65/* free up the memory used by a slot */ 55/* free up the memory used by a slot */
66static void rpaphp_release_slot(struct hotplug_slot *hotplug_slot) 56static void rpaphp_release_slot(struct hotplug_slot *hotplug_slot)
67{ 57{
@@ -145,7 +135,7 @@ int rpaphp_deregister_slot(struct slot *slot)
145 list_del(&slot->rpaphp_slot_list); 135 list_del(&slot->rpaphp_slot_list);
146 136
147 /* remove "phy_location" file */ 137 /* remove "phy_location" file */
148 rpaphp_sysfs_remove_attr_location(php_slot); 138 sysfs_remove_file(&php_slot->kobj, &php_attr_location.attr);
149 139
150 retval = pci_hp_deregister(php_slot); 140 retval = pci_hp_deregister(php_slot);
151 if (retval) 141 if (retval)
@@ -160,36 +150,45 @@ EXPORT_SYMBOL_GPL(rpaphp_deregister_slot);
160 150
161int rpaphp_register_slot(struct slot *slot) 151int rpaphp_register_slot(struct slot *slot)
162{ 152{
153 struct hotplug_slot *php_slot = slot->hotplug_slot;
163 int retval; 154 int retval;
164 155
165 dbg("%s registering slot:path[%s] index[%x], name[%s] pdomain[%x] type[%d]\n", 156 dbg("%s registering slot:path[%s] index[%x], name[%s] pdomain[%x] type[%d]\n",
166 __FUNCTION__, slot->dn->full_name, slot->index, slot->name, 157 __FUNCTION__, slot->dn->full_name, slot->index, slot->name,
167 slot->power_domain, slot->type); 158 slot->power_domain, slot->type);
159
168 /* should not try to register the same slot twice */ 160 /* should not try to register the same slot twice */
169 if (is_registered(slot)) { /* should't be here */ 161 if (is_registered(slot)) {
170 err("rpaphp_register_slot: slot[%s] is already registered\n", slot->name); 162 err("rpaphp_register_slot: slot[%s] is already registered\n", slot->name);
171 rpaphp_release_slot(slot->hotplug_slot); 163 retval = -EAGAIN;
172 return -EAGAIN; 164 goto register_fail;
173 } 165 }
174 retval = pci_hp_register(slot->hotplug_slot); 166
167 retval = pci_hp_register(php_slot);
175 if (retval) { 168 if (retval) {
176 err("pci_hp_register failed with error %d\n", retval); 169 err("pci_hp_register failed with error %d\n", retval);
177 rpaphp_release_slot(slot->hotplug_slot); 170 goto register_fail;
178 return retval;
179 } 171 }
180
181 /* create "phy_locatoin" file */
182 rpaphp_sysfs_add_attr_location(slot->hotplug_slot);
183 172
184 /* add slot to our internal list */ 173 /* create "phy_location" file */
185 dbg("%s adding slot[%s] to rpaphp_slot_list\n", 174 retval = sysfs_create_file(&php_slot->kobj, &php_attr_location.attr);
186 __FUNCTION__, slot->name); 175 if (retval) {
176 err("sysfs_create_file failed with error %d\n", retval);
177 goto sysfs_fail;
178 }
187 179
180 /* add slot to our internal list */
188 list_add(&slot->rpaphp_slot_list, &rpaphp_slot_head); 181 list_add(&slot->rpaphp_slot_list, &rpaphp_slot_head);
189 info("Slot [%s](PCI location=%s) registered\n", slot->name, 182 info("Slot [%s](PCI location=%s) registered\n", slot->name,
190 slot->location); 183 slot->location);
191 num_slots++; 184 num_slots++;
192 return 0; 185 return 0;
186
187sysfs_fail:
188 pci_hp_deregister(php_slot);
189register_fail:
190 rpaphp_release_slot(php_slot);
191 return retval;
193} 192}
194 193
195int rpaphp_get_power_status(struct slot *slot, u8 * value) 194int rpaphp_get_power_status(struct slot *slot, u8 * value)