Commit 5b307d3b authored by Rolf Eike Beer's avatar Rolf Eike Beer Committed by Deepak Saxena

[PATCH] PCI Hotplug skeleton: fix codingstyle

Coding style fixes for pcihp_skeleton.c: remove spaces before opening braces
and change a comment in function hardware_test to make clearer that the
functions purpose is not to tell the user there are no tests.
parent 2f167387
...@@ -95,12 +95,12 @@ static struct hotplug_slot_ops skel_hotplug_slot_ops = { ...@@ -95,12 +95,12 @@ static struct hotplug_slot_ops skel_hotplug_slot_ops = {
.get_adapter_status = get_adapter_status, .get_adapter_status = get_adapter_status,
}; };
static int enable_slot (struct hotplug_slot *hotplug_slot) static int enable_slot(struct hotplug_slot *hotplug_slot)
{ {
struct slot *slot = hotplug_slot->private; struct slot *slot = hotplug_slot->private;
int retval = 0; int retval = 0;
dbg ("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name); dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name);
/* /*
* Fill in code here to enable the specified slot * Fill in code here to enable the specified slot
...@@ -110,12 +110,12 @@ static int enable_slot (struct hotplug_slot *hotplug_slot) ...@@ -110,12 +110,12 @@ static int enable_slot (struct hotplug_slot *hotplug_slot)
} }
static int disable_slot (struct hotplug_slot *hotplug_slot) static int disable_slot(struct hotplug_slot *hotplug_slot)
{ {
struct slot *slot = hotplug_slot->private; struct slot *slot = hotplug_slot->private;
int retval = 0; int retval = 0;
dbg ("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name); dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name);
/* /*
* Fill in code here to disable the specified slot * Fill in code here to disable the specified slot
...@@ -124,12 +124,12 @@ static int disable_slot (struct hotplug_slot *hotplug_slot) ...@@ -124,12 +124,12 @@ static int disable_slot (struct hotplug_slot *hotplug_slot)
return retval; return retval;
} }
static int set_attention_status (struct hotplug_slot *hotplug_slot, u8 status) static int set_attention_status(struct hotplug_slot *hotplug_slot, u8 status)
{ {
struct slot *slot = hotplug_slot->private; struct slot *slot = hotplug_slot->private;
int retval = 0; int retval = 0;
dbg ("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name); dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name);
switch (status) { switch (status) {
case 0: case 0:
...@@ -149,22 +149,21 @@ static int set_attention_status (struct hotplug_slot *hotplug_slot, u8 status) ...@@ -149,22 +149,21 @@ static int set_attention_status (struct hotplug_slot *hotplug_slot, u8 status)
return retval; return retval;
} }
static int hardware_test (struct hotplug_slot *hotplug_slot, u32 value) static int hardware_test(struct hotplug_slot *hotplug_slot, u32 value)
{ {
struct slot *slot = hotplug_slot->private; struct slot *slot = hotplug_slot->private;
int retval = 0; int retval = 0;
dbg ("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name); dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name);
err ("No hardware tests are defined for this driver");
retval = -ENODEV; retval = -ENODEV;
/* Or you can specify a test if you want to */ /* Or specify a test if you have one */
return retval; return retval;
} }
static int get_power_status (struct hotplug_slot *hotplug_slot, u8 *value) static int get_power_status(struct hotplug_slot *hotplug_slot, u8 *value)
{ {
struct slot *slot = hotplug_slot->private; struct slot *slot = hotplug_slot->private;
int retval = 0; int retval = 0;
...@@ -179,7 +178,7 @@ static int get_power_status (struct hotplug_slot *hotplug_slot, u8 *value) ...@@ -179,7 +178,7 @@ static int get_power_status (struct hotplug_slot *hotplug_slot, u8 *value)
return retval; return retval;
} }
static int get_attention_status (struct hotplug_slot *hotplug_slot, u8 *value) static int get_attention_status(struct hotplug_slot *hotplug_slot, u8 *value)
{ {
struct slot *slot = hotplug_slot->private; struct slot *slot = hotplug_slot->private;
int retval = 0; int retval = 0;
...@@ -194,7 +193,7 @@ static int get_attention_status (struct hotplug_slot *hotplug_slot, u8 *value) ...@@ -194,7 +193,7 @@ static int get_attention_status (struct hotplug_slot *hotplug_slot, u8 *value)
return retval; return retval;
} }
static int get_latch_status (struct hotplug_slot *hotplug_slot, u8 *value) static int get_latch_status(struct hotplug_slot *hotplug_slot, u8 *value)
{ {
struct slot *slot = hotplug_slot->private; struct slot *slot = hotplug_slot->private;
int retval = 0; int retval = 0;
...@@ -209,7 +208,7 @@ static int get_latch_status (struct hotplug_slot *hotplug_slot, u8 *value) ...@@ -209,7 +208,7 @@ static int get_latch_status (struct hotplug_slot *hotplug_slot, u8 *value)
return retval; return retval;
} }
static int get_adapter_status (struct hotplug_slot *hotplug_slot, u8 *value) static int get_adapter_status(struct hotplug_slot *hotplug_slot, u8 *value)
{ {
struct slot *slot = hotplug_slot->private; struct slot *slot = hotplug_slot->private;
int retval = 0; int retval = 0;
...@@ -237,7 +236,7 @@ static void release_slots(struct hotplug_slot *hotplug_slot) ...@@ -237,7 +236,7 @@ static void release_slots(struct hotplug_slot *hotplug_slot)
} }
#define SLOT_NAME_SIZE 10 #define SLOT_NAME_SIZE 10
static void make_slot_name (struct slot *slot) static void make_slot_name(struct slot *slot)
{ {
/* /*
* Stupid way to make a filename out of the slot name. * Stupid way to make a filename out of the slot name.
...@@ -246,7 +245,7 @@ static void make_slot_name (struct slot *slot) ...@@ -246,7 +245,7 @@ static void make_slot_name (struct slot *slot)
snprintf (slot->hotplug_slot->name, SLOT_NAME_SIZE, "%d", slot->number); snprintf (slot->hotplug_slot->name, SLOT_NAME_SIZE, "%d", slot->number);
} }
static int init_slots (void) static int init_slots(void)
{ {
struct slot *slot; struct slot *slot;
struct hotplug_slot *hotplug_slot; struct hotplug_slot *hotplug_slot;
...@@ -260,12 +259,12 @@ static int init_slots (void) ...@@ -260,12 +259,12 @@ static int init_slots (void)
* with the pci_hotplug subsystem. * with the pci_hotplug subsystem.
*/ */
for (i = 0; i < num_slots; ++i) { for (i = 0; i < num_slots; ++i) {
slot = kmalloc (sizeof (struct slot), GFP_KERNEL); slot = kmalloc(sizeof (struct slot), GFP_KERNEL);
if (!slot) if (!slot)
return -ENOMEM; return -ENOMEM;
memset(slot, 0, sizeof(struct slot)); memset(slot, 0, sizeof(struct slot));
hotplug_slot = kmalloc (sizeof (struct hotplug_slot), GFP_KERNEL); hotplug_slot = kmalloc(sizeof (struct hotplug_slot), GFP_KERNEL);
if (!hotplug_slot) { if (!hotplug_slot) {
kfree (slot); kfree (slot);
return -ENOMEM; return -ENOMEM;
...@@ -273,7 +272,7 @@ static int init_slots (void) ...@@ -273,7 +272,7 @@ static int init_slots (void)
memset(hotplug_slot, 0, sizeof (struct hotplug_slot)); memset(hotplug_slot, 0, sizeof (struct hotplug_slot));
slot->hotplug_slot = hotplug_slot; slot->hotplug_slot = hotplug_slot;
info = kmalloc (sizeof (struct hotplug_slot_info), GFP_KERNEL); info = kmalloc(sizeof (struct hotplug_slot_info), GFP_KERNEL);
if (!info) { if (!info) {
kfree (hotplug_slot); kfree (hotplug_slot);
kfree (slot); kfree (slot);
...@@ -282,7 +281,7 @@ static int init_slots (void) ...@@ -282,7 +281,7 @@ static int init_slots (void)
memset(info, 0, sizeof (struct hotplug_slot_info)); memset(info, 0, sizeof (struct hotplug_slot_info));
hotplug_slot->info = info; hotplug_slot->info = info;
name = kmalloc (SLOT_NAME_SIZE, GFP_KERNEL); name = kmalloc(SLOT_NAME_SIZE, GFP_KERNEL);
if (!name) { if (!name) {
kfree (info); kfree (info);
kfree (hotplug_slot); kfree (hotplug_slot);
...@@ -295,7 +294,7 @@ static int init_slots (void) ...@@ -295,7 +294,7 @@ static int init_slots (void)
hotplug_slot->private = slot; hotplug_slot->private = slot;
hotplug_slot->release = &release_slot; hotplug_slot->release = &release_slot;
make_slot_name (slot); make_slot_name(slot);
hotplug_slot->ops = &skel_hotplug_slot_ops; hotplug_slot->ops = &skel_hotplug_slot_ops;
/* /*
...@@ -307,10 +306,10 @@ static int init_slots (void) ...@@ -307,10 +306,10 @@ static int init_slots (void)
info->latch_status = get_latch_status(slot); info->latch_status = get_latch_status(slot);
info->adapter_status = get_adapter_status(slot); info->adapter_status = get_adapter_status(slot);
dbg ("registering slot %d\n", i); dbg("registering slot %d\n", i);
retval = pci_hp_register (slot->hotplug_slot); retval = pci_hp_register(slot->hotplug_slot);
if (retval) { if (retval) {
err ("pci_hp_register failed with error %d\n", retval); err("pci_hp_register failed with error %d\n", retval);
kfree (info); kfree (info);
kfree (name); kfree (name);
kfree (hotplug_slot); kfree (hotplug_slot);
...@@ -337,9 +336,9 @@ static void cleanup_slots(void) ...@@ -337,9 +336,9 @@ static void cleanup_slots(void)
* lifespan is finished. * lifespan is finished.
*/ */
list_for_each_safe (tmp, next, &slot_list) { list_for_each_safe (tmp, next, &slot_list) {
slot = list_entry (tmp, struct slot, slot_list); slot = list_entry(tmp, struct slot, slot_list);
list_del (&slot->slot_list); list_del (&slot->slot_list);
pci_hp_deregister (slot->hotplug_slot); pci_hp_deregister(slot->hotplug_slot);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment