]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/pci/hotplug/cpqphp_ctrl.c
Merge git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh-2.6
[linux-2.6-omap-h63xx.git] / drivers / pci / hotplug / cpqphp_ctrl.c
index 856d57b4d6044539c50b4f631107c03f1df5891d..a60a25290995e5f2c267f6a2f4da65e9122d858a 100644 (file)
@@ -123,7 +123,7 @@ static u8 handle_switch_change(u8 change, struct controller * ctrl)
 }
 
 /**
- * cpqhp_find_slot: find the struct slot of given device
+ * cpqhp_find_slot - find the struct slot of given device
  * @ctrl: scan lots of this controller
  * @device: the device id to find
  */
@@ -305,9 +305,8 @@ static u8 handle_power_fault(u8 change, struct controller * ctrl)
 
 
 /**
- * sort_by_size: sort nodes on the list by their length, smallest first.
+ * sort_by_size - sort nodes on the list by their length, smallest first.
  * @head: list to sort
- *
  */
 static int sort_by_size(struct pci_resource **head)
 {
@@ -354,9 +353,8 @@ static int sort_by_size(struct pci_resource **head)
 
 
 /**
- * sort_by_max_size: sort nodes on the list by their length, largest first.
+ * sort_by_max_size - sort nodes on the list by their length, largest first.
  * @head: list to sort
- *
  */
 static int sort_by_max_size(struct pci_resource **head)
 {
@@ -403,8 +401,10 @@ static int sort_by_max_size(struct pci_resource **head)
 
 
 /**
- * do_pre_bridge_resource_split: find node of resources that are unused
- *
+ * do_pre_bridge_resource_split - find node of resources that are unused
+ * @head: new list head
+ * @orig_head: original list head
+ * @alignment: max node size (?)
  */
 static struct pci_resource *do_pre_bridge_resource_split(struct pci_resource **head,
                                struct pci_resource **orig_head, u32 alignment)
@@ -477,8 +477,9 @@ static struct pci_resource *do_pre_bridge_resource_split(struct pci_resource **h
 
 
 /**
- * do_bridge_resource_split: find one node of resources that aren't in use
- *
+ * do_bridge_resource_split - find one node of resources that aren't in use
+ * @head: list head
+ * @alignment: max node size (?)
  */
 static struct pci_resource *do_bridge_resource_split(struct pci_resource **head, u32 alignment)
 {
@@ -525,14 +526,13 @@ error:
 
 
 /**
- * get_io_resource: find first node of given size not in ISA aliasing window.
+ * get_io_resource - find first node of given size not in ISA aliasing window.
  * @head: list to search
  * @size: size of node to find, must be a power of two.
  *
- * Description: this function sorts the resource list by size and then returns
+ * Description: This function sorts the resource list by size and then returns
  * returns the first node of "size" length that is not in the ISA aliasing
  * window.  If it finds a node larger than "size" it will split it up.
- *
  */
 static struct pci_resource *get_io_resource(struct pci_resource **head, u32 size)
 {
@@ -620,7 +620,7 @@ static struct pci_resource *get_io_resource(struct pci_resource **head, u32 size
 
 
 /**
- * get_max_resource: get largest node which has at least the given size.
+ * get_max_resource - get largest node which has at least the given size.
  * @head: the list to search the node in
  * @size: the minimum size of the node to find
  *
@@ -712,7 +712,7 @@ static struct pci_resource *get_max_resource(struct pci_resource **head, u32 siz
 
 
 /**
- * get_resource: find resource of given size and split up larger ones.
+ * get_resource - find resource of given size and split up larger ones.
  * @head: the list to search for resources
  * @size: the size limit to use
  *
@@ -737,12 +737,12 @@ static struct pci_resource *get_resource(struct pci_resource **head, u32 size)
 
        for (node = *head; node; node = node->next) {
                dbg("%s: req_size =%x node=%p, base=%x, length=%x\n",
-                   __FUNCTION__, size, node, node->base, node->length);
+                   __func__, size, node, node->base, node->length);
                if (node->length < size)
                        continue;
 
                if (node->base & (size - 1)) {
-                       dbg("%s: not aligned\n", __FUNCTION__);
+                       dbg("%s: not aligned\n", __func__);
                        /* this one isn't base aligned properly
                         * so we'll make a new entry and split it up */
                        temp_dword = (node->base | (size-1)) + 1;
@@ -767,7 +767,7 @@ static struct pci_resource *get_resource(struct pci_resource **head, u32 size)
 
                /* Don't need to check if too small since we already did */
                if (node->length > size) {
-                       dbg("%s: too big\n", __FUNCTION__);
+                       dbg("%s: too big\n", __func__);
                        /* this one is longer than we need
                         * so we'll make a new entry and split it up */
                        split_node = kmalloc(sizeof(*split_node), GFP_KERNEL);
@@ -784,7 +784,7 @@ static struct pci_resource *get_resource(struct pci_resource **head, u32 size)
                        node->next = split_node;
                }  /* End of too big on top end */
 
-               dbg("%s: got one!!!\n", __FUNCTION__);
+               dbg("%s: got one!!!\n", __func__);
                /* If we got here, then it is the right size
                 * Now take it out of the list */
                if (*head == node) {
@@ -804,14 +804,14 @@ static struct pci_resource *get_resource(struct pci_resource **head, u32 size)
 
 
 /**
- * cpqhp_resource_sort_and_combine: sort nodes by base addresses and clean up.
+ * cpqhp_resource_sort_and_combine - sort nodes by base addresses and clean up
  * @head: the list to sort and clean up
  *
  * Description: Sorts all of the nodes in the list in ascending order by
  * their base addresses.  Also does garbage collection by
  * combining adjacent nodes.
  *
- * returns 0 if success
+ * Returns %0 if success.
  */
 int cpqhp_resource_sort_and_combine(struct pci_resource **head)
 {
@@ -819,7 +819,7 @@ int cpqhp_resource_sort_and_combine(struct pci_resource **head)
        struct pci_resource *node2;
        int out_of_order = 1;
 
-       dbg("%s: head = %p, *head = %p\n", __FUNCTION__, head, *head);
+       dbg("%s: head = %p, *head = %p\n", __func__, head, *head);
 
        if (!(*head))
                return 1;
@@ -907,7 +907,7 @@ irqreturn_t cpqhp_ctrl_intr(int IRQ, void *data)
                /* Read to clear posted writes */
                misc = readw(ctrl->hpc_reg + MISC);
 
-               dbg ("%s - waking up\n", __FUNCTION__);
+               dbg ("%s - waking up\n", __func__);
                wake_up_interruptible(&ctrl->queue);
        }
 
@@ -951,9 +951,9 @@ irqreturn_t cpqhp_ctrl_intr(int IRQ, void *data)
 
 /**
  * cpqhp_slot_create - Creates a node and adds it to the proper bus.
- * @busnumber - bus where new node is to be located
+ * @busnumber: bus where new node is to be located
  *
- * Returns pointer to the new node or NULL if unsuccessful
+ * Returns pointer to the new node or %NULL if unsuccessful.
  */
 struct pci_func *cpqhp_slot_create(u8 busnumber)
 {
@@ -986,7 +986,7 @@ struct pci_func *cpqhp_slot_create(u8 busnumber)
  * slot_remove - Removes a node from the linked list of slots.
  * @old_slot: slot to remove
  *
- * Returns 0 if successful, !0 otherwise.
+ * Returns %0 if successful, !0 otherwise.
  */
 static int slot_remove(struct pci_func * old_slot)
 {
@@ -1026,7 +1026,7 @@ static int slot_remove(struct pci_func * old_slot)
  * bridge_slot_remove - Removes a node from the linked list of slots.
  * @bridge: bridge to remove
  *
- * Returns 0 if successful, !0 otherwise.
+ * Returns %0 if successful, !0 otherwise.
  */
 static int bridge_slot_remove(struct pci_func *bridge)
 {
@@ -1071,7 +1071,7 @@ out:
  * cpqhp_slot_find - Looks for a node by bus, and device, multiple functions accessed
  * @bus: bus to find
  * @device: device to find
- * @index: is 0 for first function found, 1 for the second...
+ * @index: is %0 for first function found, %1 for the second...
  *
  * Returns pointer to the node if successful, %NULL otherwise.
  */
@@ -1115,16 +1115,13 @@ static int is_bridge(struct pci_func * func)
 
 
 /**
- * set_controller_speed - set the frequency and/or mode of a specific
- * controller segment.
- *
+ * set_controller_speed - set the frequency and/or mode of a specific controller segment.
  * @ctrl: controller to change frequency/mode for.
  * @adapter_speed: the speed of the adapter we want to match.
  * @hp_slot: the slot number where the adapter is installed.
  *
- * Returns 0 if we successfully change frequency and/or mode to match the
+ * Returns %0 if we successfully change frequency and/or mode to match the
  * adapter speed.
- * 
  */
 static u8 set_controller_speed(struct controller *ctrl, u8 adapter_speed, u8 hp_slot)
 {
@@ -1142,7 +1139,7 @@ static u8 set_controller_speed(struct controller *ctrl, u8 adapter_speed, u8 hp_
        for(slot = ctrl->slot; slot; slot = slot->next) {
                if (slot->device == (hp_slot + ctrl->slot_device_offset)) 
                        continue;
-               if (!slot->hotplug_slot && !slot->hotplug_slot->info) 
+               if (!slot->hotplug_slot || !slot->hotplug_slot->info)
                        continue;
                if (slot->hotplug_slot->info->adapter_status == 0) 
                        continue;
@@ -1253,13 +1250,14 @@ static u8 set_controller_speed(struct controller *ctrl, u8 adapter_speed, u8 hp_
 
 /**
  * board_replaced - Called after a board has been replaced in the system.
+ * @func: PCI device/function information
+ * @ctrl: hotplug controller
  *
- * This is only used if we don't have resources for hot add
- * Turns power on for the board
- * Checks to see if board is the same
- * If board is same, reconfigures it
+ * This is only used if we don't have resources for hot add.
+ * Turns power on for the board.
+ * Checks to see if board is the same.
+ * If board is same, reconfigures it.
  * If board isn't same, turns it back off.
- *
  */
 static u32 board_replaced(struct pci_func *func, struct controller *ctrl)
 {
@@ -1403,10 +1401,11 @@ static u32 board_replaced(struct pci_func *func, struct controller *ctrl)
 
 /**
  * board_added - Called after a board has been added to the system.
+ * @func: PCI device/function info
+ * @ctrl: hotplug controller
  *
- * Turns power on for the board
- * Configures board
- *
+ * Turns power on for the board.
+ * Configures board.
  */
 static u32 board_added(struct pci_func *func, struct controller *ctrl)
 {
@@ -1422,7 +1421,7 @@ static u32 board_added(struct pci_func *func, struct controller *ctrl)
 
        hp_slot = func->device - ctrl->slot_device_offset;
        dbg("%s: func->device, slot_offset, hp_slot = %d, %d ,%d\n",
-           __FUNCTION__, func->device, ctrl->slot_device_offset, hp_slot);
+           __func__, func->device, ctrl->slot_device_offset, hp_slot);
 
        mutex_lock(&ctrl->crit_sect);
 
@@ -1467,55 +1466,55 @@ static u32 board_added(struct pci_func *func, struct controller *ctrl)
 
        /* turn on board and blink green LED */
 
-       dbg("%s: before down\n", __FUNCTION__);
+       dbg("%s: before down\n", __func__);
        mutex_lock(&ctrl->crit_sect);
-       dbg("%s: after down\n", __FUNCTION__);
+       dbg("%s: after down\n", __func__);
 
-       dbg("%s: before slot_enable\n", __FUNCTION__);
+       dbg("%s: before slot_enable\n", __func__);
        slot_enable (ctrl, hp_slot);
 
-       dbg("%s: before green_LED_blink\n", __FUNCTION__);
+       dbg("%s: before green_LED_blink\n", __func__);
        green_LED_blink (ctrl, hp_slot);
 
-       dbg("%s: before amber_LED_blink\n", __FUNCTION__);
+       dbg("%s: before amber_LED_blink\n", __func__);
        amber_LED_off (ctrl, hp_slot);
 
-       dbg("%s: before set_SOGO\n", __FUNCTION__);
+       dbg("%s: before set_SOGO\n", __func__);
        set_SOGO(ctrl);
 
        /* Wait for SOBS to be unset */
-       dbg("%s: before wait_for_ctrl_irq\n", __FUNCTION__);
+       dbg("%s: before wait_for_ctrl_irq\n", __func__);
        wait_for_ctrl_irq (ctrl);
-       dbg("%s: after wait_for_ctrl_irq\n", __FUNCTION__);
+       dbg("%s: after wait_for_ctrl_irq\n", __func__);
 
-       dbg("%s: before up\n", __FUNCTION__);
+       dbg("%s: before up\n", __func__);
        mutex_unlock(&ctrl->crit_sect);
-       dbg("%s: after up\n", __FUNCTION__);
+       dbg("%s: after up\n", __func__);
 
        /* Wait for ~1 second because of hot plug spec */
-       dbg("%s: before long_delay\n", __FUNCTION__);
+       dbg("%s: before long_delay\n", __func__);
        long_delay(1*HZ);
-       dbg("%s: after long_delay\n", __FUNCTION__);
+       dbg("%s: after long_delay\n", __func__);
 
-       dbg("%s: func status = %x\n", __FUNCTION__, func->status);
+       dbg("%s: func status = %x\n", __func__, func->status);
        /* Check for a power fault */
        if (func->status == 0xFF) {
                /* power fault occurred, but it was benign */
                temp_register = 0xFFFFFFFF;
-               dbg("%s: temp register set to %x by power fault\n", __FUNCTION__, temp_register);
+               dbg("%s: temp register set to %x by power fault\n", __func__, temp_register);
                rc = POWER_FAILURE;
                func->status = 0;
        } else {
                /* Get vendor/device ID u32 */
                ctrl->pci_bus->number = func->bus;
                rc = pci_bus_read_config_dword (ctrl->pci_bus, PCI_DEVFN(func->device, func->function), PCI_VENDOR_ID, &temp_register);
-               dbg("%s: pci_read_config_dword returns %d\n", __FUNCTION__, rc);
-               dbg("%s: temp_register is %x\n", __FUNCTION__, temp_register);
+               dbg("%s: pci_read_config_dword returns %d\n", __func__, rc);
+               dbg("%s: temp_register is %x\n", __func__, temp_register);
 
                if (rc != 0) {
                        /* Something's wrong here */
                        temp_register = 0xFFFFFFFF;
-                       dbg("%s: temp register set to %x by error\n", __FUNCTION__, temp_register);
+                       dbg("%s: temp register set to %x by error\n", __func__, temp_register);
                }
                /* Preset return code.  It will be changed later if things go okay. */
                rc = NO_ADAPTER_PRESENT;
@@ -1531,7 +1530,7 @@ static u32 board_added(struct pci_func *func, struct controller *ctrl)
 
                rc = configure_new_device(ctrl, func, 0, &res_lists);
 
-               dbg("%s: back from configure_new_device\n", __FUNCTION__);
+               dbg("%s: back from configure_new_device\n", __func__);
                ctrl->io_head = res_lists.io_head;
                ctrl->mem_head = res_lists.mem_head;
                ctrl->p_mem_head = res_lists.p_mem_head;
@@ -1567,7 +1566,7 @@ static u32 board_added(struct pci_func *func, struct controller *ctrl)
 
                /* next, we will instantiate the linux pci_dev structures (with
                 * appropriate driver notification, if already present) */
-               dbg("%s: configure linux pci_dev structure\n", __FUNCTION__);
+               dbg("%s: configure linux pci_dev structure\n", __func__);
                index = 0;
                do {
                        new_slot = cpqhp_slot_find(ctrl->bus, func->device, index++);
@@ -1607,8 +1606,10 @@ static u32 board_added(struct pci_func *func, struct controller *ctrl)
 
 
 /**
- * remove_board - Turns off slot and LED's
- *
+ * remove_board - Turns off slot and LEDs
+ * @func: PCI device/function info
+ * @replace_flag: whether replacing or adding a new device
+ * @ctrl: target controller
  */
 static u32 remove_board(struct pci_func * func, u32 replace_flag, struct controller * ctrl)
 {
@@ -1627,7 +1628,7 @@ static u32 remove_board(struct pci_func * func, u32 replace_flag, struct control
        device = func->device;
 
        hp_slot = func->device - ctrl->slot_device_offset;
-       dbg("In %s, hp_slot = %d\n", __FUNCTION__, hp_slot);
+       dbg("In %s, hp_slot = %d\n", __func__, hp_slot);
 
        /* When we get here, it is safe to change base address registers.
         * We will attempt to save the base address register lengths */
@@ -1902,11 +1903,11 @@ static void interrupt_event_handler(struct controller *ctrl)
 
 
 /**
- * cpqhp_pushbutton_thread
+ * cpqhp_pushbutton_thread - handle pushbutton events
+ * @slot: target slot (struct)
  *
- * Scheduled procedure to handle blocking stuff for the pushbuttons
+ * Scheduled procedure to handle blocking stuff for the pushbuttons.
  * Handles all pending events and exits.
- *
  */
 void cpqhp_pushbutton_thread(unsigned long slot)
 {
@@ -1927,7 +1928,7 @@ void cpqhp_pushbutton_thread(unsigned long slot)
                func = cpqhp_slot_find(p_slot->bus, p_slot->device, 0);
                dbg("In power_down_board, func = %p, ctrl = %p\n", func, ctrl);
                if (!func) {
-                       dbg("Error! func NULL in %s\n", __FUNCTION__);
+                       dbg("Error! func NULL in %s\n", __func__);
                        return ;
                }
 
@@ -1949,7 +1950,7 @@ void cpqhp_pushbutton_thread(unsigned long slot)
                func = cpqhp_slot_find(p_slot->bus, p_slot->device, 0);
                dbg("In add_board, func = %p, ctrl = %p\n", func, ctrl);
                if (!func) {
-                       dbg("Error! func NULL in %s\n", __FUNCTION__);
+                       dbg("Error! func NULL in %s\n", __func__);
                        return ;
                }
 
@@ -2057,7 +2058,7 @@ int cpqhp_process_SI(struct controller *ctrl, struct pci_func *func)
        }
 
        if (rc) {
-               dbg("%s: rc = %d\n", __FUNCTION__, rc);
+               dbg("%s: rc = %d\n", __func__, rc);
        }
 
        if (p_slot)
@@ -2137,9 +2138,10 @@ int cpqhp_process_SS(struct controller *ctrl, struct pci_func *func)
 }
 
 /**
- * switch_leds: switch the leds, go from one site to the other.
+ * switch_leds - switch the leds, go from one site to the other.
  * @ctrl: controller to use
  * @num_of_slots: number of slots to use
+ * @work_LED: LED control value
  * @direction: 1 to start from the left side, 0 to start right.
  */
 static void switch_leds(struct controller *ctrl, const int num_of_slots,
@@ -2165,11 +2167,11 @@ static void switch_leds(struct controller *ctrl, const int num_of_slots,
 }
 
 /**
- * hardware_test - runs hardware tests
+ * cpqhp_hardware_test - runs hardware tests
+ * @ctrl: target controller
+ * @test_num: the number written to the "test" file in sysfs.
  *
  * For hot plug ctrl folks to play with.
- * test_num is the number written to the "test" file in sysfs
- *
  */
 int cpqhp_hardware_test(struct controller *ctrl, int test_num)
 {
@@ -2249,14 +2251,12 @@ int cpqhp_hardware_test(struct controller *ctrl, int test_num)
 
 /**
  * configure_new_device - Configures the PCI header information of one board.
- *
  * @ctrl: pointer to controller structure
  * @func: pointer to function structure
  * @behind_bridge: 1 if this is a recursive call, 0 if not
  * @resources: pointer to set of resource lists
  *
- * Returns 0 if success
- *
+ * Returns 0 if success.
  */
 static u32 configure_new_device(struct controller * ctrl, struct pci_func * func,
                                 u8 behind_bridge, struct resource_lists * resources)
@@ -2269,12 +2269,12 @@ static u32 configure_new_device(struct controller * ctrl, struct pci_func * func
 
        new_slot = func;
 
-       dbg("%s\n", __FUNCTION__);
+       dbg("%s\n", __func__);
        /* Check for Multi-function device */
        ctrl->pci_bus->number = func->bus;
        rc = pci_bus_read_config_byte (ctrl->pci_bus, PCI_DEVFN(func->device, func->function), 0x0E, &temp_byte);
        if (rc) {
-               dbg("%s: rc = %d\n", __FUNCTION__, rc);
+               dbg("%s: rc = %d\n", __func__, rc);
                return rc;
        }
 
@@ -2346,15 +2346,13 @@ static u32 configure_new_device(struct controller * ctrl, struct pci_func * func
 
 /**
  * configure_new_function - Configures the PCI header information of one device
- *
  * @ctrl: pointer to controller structure
  * @func: pointer to function structure
  * @behind_bridge: 1 if this is a recursive call, 0 if not
  * @resources: pointer to set of resource lists
  *
  * Calls itself recursively for bridged devices.
- * Returns 0 if success
- *
+ * Returns 0 if success.
  */
 static int configure_new_function(struct controller *ctrl, struct pci_func *func,
                                   u8 behind_bridge,