diff options
author | Ryan Desfosses <ryan@desfo.org> | 2014-04-19 04:13:49 +0400 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2014-06-11 06:20:19 +0400 |
commit | 3c78bc61f5ef3bc87e7f94f67ec737d2273f120b (patch) | |
tree | 490efb8676389718e78a4d6775ad668538ecaf4f /drivers/pci/hotplug/pci_hotplug_core.c | |
parent | b7fe943421396b61b9f7a97c2554ed999e0f3658 (diff) | |
download | linux-3c78bc61f5ef3bc87e7f94f67ec737d2273f120b.tar.xz |
PCI: Whitespace cleanup
Fix various whitespace errors.
No functional change.
[bhelgaas: fix other similar problems]
Signed-off-by: Ryan Desfosses <ryan@desfo.org>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Diffstat (limited to 'drivers/pci/hotplug/pci_hotplug_core.c')
-rw-r--r-- | drivers/pci/hotplug/pci_hotplug_core.c | 96 |
1 files changed, 45 insertions, 51 deletions
diff --git a/drivers/pci/hotplug/pci_hotplug_core.c b/drivers/pci/hotplug/pci_hotplug_core.c index ef496457f8d0..29caef96a21c 100644 --- a/drivers/pci/hotplug/pci_hotplug_core.c +++ b/drivers/pci/hotplug/pci_hotplug_core.c @@ -59,14 +59,12 @@ static bool debug; #define DRIVER_DESC "PCI Hot Plug PCI Core" -////////////////////////////////////////////////////////////////// - static LIST_HEAD(pci_hotplug_slot_list); static DEFINE_MUTEX(pci_hp_mutex); /* Weee, fun with macros... */ -#define GET_STATUS(name,type) \ -static int get_##name (struct hotplug_slot *slot, type *value) \ +#define GET_STATUS(name, type) \ +static int get_##name(struct hotplug_slot *slot, type *value) \ { \ struct hotplug_slot_ops *ops = slot->ops; \ int retval = 0; \ @@ -92,42 +90,41 @@ static ssize_t power_read_file(struct pci_slot *slot, char *buf) retval = get_power_status(slot->hotplug, &value); if (retval) - goto exit; - retval = sprintf (buf, "%d\n", value); -exit: - return retval; + return retval; + + return sprintf(buf, "%d\n", value); } static ssize_t power_write_file(struct pci_slot *pci_slot, const char *buf, - size_t count) + size_t count) { struct hotplug_slot *slot = pci_slot->hotplug; unsigned long lpower; u8 power; int retval = 0; - lpower = simple_strtoul (buf, NULL, 10); + lpower = simple_strtoul(buf, NULL, 10); power = (u8)(lpower & 0xff); - dbg ("power = %d\n", power); + dbg("power = %d\n", power); if (!try_module_get(slot->ops->owner)) { retval = -ENODEV; goto exit; } switch (power) { - case 0: - if (slot->ops->disable_slot) - retval = slot->ops->disable_slot(slot); - break; - - case 1: - if (slot->ops->enable_slot) - retval = slot->ops->enable_slot(slot); - break; - - default: - err ("Illegal value specified for power\n"); - retval = -EINVAL; + case 0: + if (slot->ops->disable_slot) + retval = slot->ops->disable_slot(slot); + break; + + case 1: + if (slot->ops->enable_slot) + retval = slot->ops->enable_slot(slot); + break; + + default: + err("Illegal value specified for power\n"); + retval = -EINVAL; } module_put(slot->ops->owner); @@ -150,24 +147,22 @@ static ssize_t attention_read_file(struct pci_slot *slot, char *buf) retval = get_attention_status(slot->hotplug, &value); if (retval) - goto exit; - retval = sprintf(buf, "%d\n", value); + return retval; -exit: - return retval; + return sprintf(buf, "%d\n", value); } static ssize_t attention_write_file(struct pci_slot *slot, const char *buf, - size_t count) + size_t count) { struct hotplug_slot_ops *ops = slot->hotplug->ops; unsigned long lattention; u8 attention; int retval = 0; - lattention = simple_strtoul (buf, NULL, 10); + lattention = simple_strtoul(buf, NULL, 10); attention = (u8)(lattention & 0xff); - dbg (" - attention = %d\n", attention); + dbg(" - attention = %d\n", attention); if (!try_module_get(ops->owner)) { retval = -ENODEV; @@ -196,11 +191,9 @@ static ssize_t latch_read_file(struct pci_slot *slot, char *buf) retval = get_latch_status(slot->hotplug, &value); if (retval) - goto exit; - retval = sprintf (buf, "%d\n", value); + return retval; -exit: - return retval; + return sprintf(buf, "%d\n", value); } static struct pci_slot_attribute hotplug_slot_attr_latch = { @@ -215,11 +208,9 @@ static ssize_t presence_read_file(struct pci_slot *slot, char *buf) retval = get_adapter_status(slot->hotplug, &value); if (retval) - goto exit; - retval = sprintf (buf, "%d\n", value); + return retval; -exit: - return retval; + return sprintf(buf, "%d\n", value); } static struct pci_slot_attribute hotplug_slot_attr_presence = { @@ -228,7 +219,7 @@ static struct pci_slot_attribute hotplug_slot_attr_presence = { }; static ssize_t test_write_file(struct pci_slot *pci_slot, const char *buf, - size_t count) + size_t count) { struct hotplug_slot *slot = pci_slot->hotplug; unsigned long ltest; @@ -237,7 +228,7 @@ static ssize_t test_write_file(struct pci_slot *pci_slot, const char *buf, ltest = simple_strtoul (buf, NULL, 10); test = (u32)(ltest & 0xffffffff); - dbg ("test = %d\n", test); + dbg("test = %d\n", test); if (!try_module_get(slot->ops->owner)) { retval = -ENODEV; @@ -261,6 +252,7 @@ static struct pci_slot_attribute hotplug_slot_attr_test = { static bool has_power_file(struct pci_slot *pci_slot) { struct hotplug_slot *slot = pci_slot->hotplug; + if ((!slot) || (!slot->ops)) return false; if ((slot->ops->enable_slot) || @@ -273,6 +265,7 @@ static bool has_power_file(struct pci_slot *pci_slot) static bool has_attention_file(struct pci_slot *pci_slot) { struct hotplug_slot *slot = pci_slot->hotplug; + if ((!slot) || (!slot->ops)) return false; if ((slot->ops->set_attention_status) || @@ -284,6 +277,7 @@ static bool has_attention_file(struct pci_slot *pci_slot) static bool has_latch_file(struct pci_slot *pci_slot) { struct hotplug_slot *slot = pci_slot->hotplug; + if ((!slot) || (!slot->ops)) return false; if (slot->ops->get_latch_status) @@ -294,6 +288,7 @@ static bool has_latch_file(struct pci_slot *pci_slot) static bool has_adapter_file(struct pci_slot *pci_slot) { struct hotplug_slot *slot = pci_slot->hotplug; + if ((!slot) || (!slot->ops)) return false; if (slot->ops->get_adapter_status) @@ -304,6 +299,7 @@ static bool has_adapter_file(struct pci_slot *pci_slot) static bool has_test_file(struct pci_slot *pci_slot) { struct hotplug_slot *slot = pci_slot->hotplug; + if ((!slot) || (!slot->ops)) return false; if (slot->ops->hardware_test) @@ -397,13 +393,13 @@ static void fs_remove_slot(struct pci_slot *slot) pci_hp_remove_module_link(slot); } -static struct hotplug_slot *get_slot_from_name (const char *name) +static struct hotplug_slot *get_slot_from_name(const char *name) { struct hotplug_slot *slot; struct list_head *tmp; - list_for_each (tmp, &pci_hotplug_slot_list) { - slot = list_entry (tmp, struct hotplug_slot, slot_list); + list_for_each(tmp, &pci_hotplug_slot_list) { + slot = list_entry(tmp, struct hotplug_slot, slot_list); if (strcmp(hotplug_slot_name(slot), name) == 0) return slot; } @@ -531,23 +527,21 @@ int pci_hp_change_slot_info(struct hotplug_slot *hotplug, } EXPORT_SYMBOL_GPL(pci_hp_change_slot_info); -static int __init pci_hotplug_init (void) +static int __init pci_hotplug_init(void) { int result; result = cpci_hotplug_init(debug); if (result) { - err ("cpci_hotplug_init with error %d\n", result); - goto err_cpci; + err("cpci_hotplug_init with error %d\n", result); + return result; } - info (DRIVER_DESC " version: " DRIVER_VERSION "\n"); - -err_cpci: + info(DRIVER_DESC " version: " DRIVER_VERSION "\n"); return result; } -static void __exit pci_hotplug_exit (void) +static void __exit pci_hotplug_exit(void) { cpci_hotplug_exit(); } |