Skip to content

Commit

Permalink
[PATCH] shpchp: miscellaneous cleanups
Browse files Browse the repository at this point in the history
Remove un-necessary header includes, remove dead code, remove
some type casts, receive function return in the correct data
type...

Signed-off-by: Rajesh Shah <rajesh.shah@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
rajesh.shah@intel.com authored and Greg Kroah-Hartman committed Oct 28, 2005
1 parent 2178bfa commit ee13833
Show file tree
Hide file tree
Showing 9 changed files with 46 additions and 157 deletions.
14 changes: 3 additions & 11 deletions drivers/pci/hotplug/shpchp.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@
#include <linux/types.h>
#include <linux/pci.h>
#include <linux/delay.h>
#include <asm/semaphore.h>
#include <asm/io.h>
#include "pci_hotplug.h"

#if !defined(MODULE)
Expand Down Expand Up @@ -80,7 +78,7 @@ struct event_info {
struct controller {
struct controller *next;
struct semaphore crit_sect; /* critical section semaphore */
void * hpc_ctlr_handle; /* HPC controller handle */
struct php_ctlr_state_s *hpc_ctlr_handle; /* HPC controller handle */
int num_slots; /* Number of slots on ctlr */
int slot_num_inc; /* 1 or -1 */
struct pci_dev *pci_dev;
Expand Down Expand Up @@ -234,7 +232,7 @@ enum ctrl_offsets {
SLOT11 = offsetof(struct ctrl_reg, slot11),
SLOT12 = offsetof(struct ctrl_reg, slot12),
};
typedef u8(*php_intr_callback_t) (unsigned int change_id, void *instance_id);
typedef u8(*php_intr_callback_t) (u8 hp_slot, void *instance_id);
struct php_ctlr_state_s {
struct php_ctlr_state_s *pnext;
struct pci_dev *pci_dev;
Expand Down Expand Up @@ -347,11 +345,7 @@ enum php_ctlr_type {
ACPI
};

int shpc_init( struct controller *ctrl, struct pci_dev *pdev,
php_intr_callback_t attention_button_callback,
php_intr_callback_t switch_change_callback,
php_intr_callback_t presence_change_callback,
php_intr_callback_t power_fault_callback);
int shpc_init( struct controller *ctrl, struct pci_dev *pdev);

int shpc_get_ctlr_slot_config( struct controller *ctrl,
int *num_ctlr_slots,
Expand All @@ -364,8 +358,6 @@ struct hpc_ops {
int (*power_on_slot ) (struct slot *slot);
int (*slot_enable ) (struct slot *slot);
int (*slot_disable ) (struct slot *slot);
int (*enable_all_slots) (struct slot *slot);
int (*pwr_on_all_slots) (struct slot *slot);
int (*set_bus_speed_mode) (struct slot *slot, enum pci_bus_speed speed);
int (*get_power_status) (struct slot *slot, u8 *status);
int (*get_attention_status) (struct slot *slot, u8 *status);
Expand Down
12 changes: 1 addition & 11 deletions drivers/pci/hotplug/shpchp_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,11 @@
*
*/

#include <linux/config.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/kernel.h>
#include <linux/types.h>
#include <linux/proc_fs.h>
#include <linux/slab.h>
#include <linux/workqueue.h>
#include <linux/pci.h>
#include <linux/init.h>
#include <asm/uaccess.h>
#include "shpchp.h"

/* Global variables */
Expand Down Expand Up @@ -381,11 +375,7 @@ static int shpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent)

dbg("DRV_thread pid = %d\n", current->pid);

rc = shpc_init(ctrl, pdev,
(php_intr_callback_t) shpchp_handle_attention_button,
(php_intr_callback_t) shpchp_handle_switch_change,
(php_intr_callback_t) shpchp_handle_presence_change,
(php_intr_callback_t) shpchp_handle_power_fault);
rc = shpc_init(ctrl, pdev);
if (rc) {
dbg("%s: controller initialization failed\n", SHPC_MODULE_NAME);
goto err_out_free_ctrl;
Expand Down
31 changes: 13 additions & 18 deletions drivers/pci/hotplug/shpchp_ctrl.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,9 @@
*
*/

#include <linux/config.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/types.h>
#include <linux/slab.h>
#include <linux/workqueue.h>
#include <linux/interrupt.h>
#include <linux/delay.h>
#include <linux/wait.h>
#include <linux/smp_lock.h>
#include <linux/pci.h>
#include "../pci.h"
Expand Down Expand Up @@ -242,9 +236,10 @@ u8 shpchp_handle_power_fault(u8 hp_slot, void *inst_id)
/* The following routines constitute the bulk of the
hotplug controller logic
*/
static u32 change_bus_speed(struct controller *ctrl, struct slot *p_slot, enum pci_bus_speed speed)
static int change_bus_speed(struct controller *ctrl, struct slot *p_slot,
enum pci_bus_speed speed)
{
u32 rc = 0;
int rc = 0;

dbg("%s: change to speed %d\n", __FUNCTION__, speed);
down(&ctrl->crit_sect);
Expand All @@ -266,10 +261,11 @@ static u32 change_bus_speed(struct controller *ctrl, struct slot *p_slot, enum p
return rc;
}

static u32 fix_bus_speed(struct controller *ctrl, struct slot *pslot, u8 flag,
enum pci_bus_speed asp, enum pci_bus_speed bsp, enum pci_bus_speed msp)
static int fix_bus_speed(struct controller *ctrl, struct slot *pslot,
u8 flag, enum pci_bus_speed asp, enum pci_bus_speed bsp,
enum pci_bus_speed msp)
{
u32 rc = 0;
int rc = 0;

if (flag != 0) { /* Other slots on the same bus are occupied */
if ( asp < bsp ) {
Expand Down Expand Up @@ -308,11 +304,11 @@ enum pci_bus_speed asp, enum pci_bus_speed bsp, enum pci_bus_speed msp)
* Configures board
*
*/
static u32 board_added(struct slot *p_slot)
static int board_added(struct slot *p_slot)
{
u8 hp_slot;
u8 slots_not_empty = 0;
u32 rc = 0;
int rc = 0;
enum pci_bus_speed adapter_speed, bus_speed, max_bus_speed;
u8 pi, mode;
struct controller *ctrl = p_slot->ctrl;
Expand Down Expand Up @@ -580,11 +576,11 @@ static u32 board_added(struct slot *p_slot)
* remove_board - Turns off slot and LED's
*
*/
static u32 remove_board(struct slot *p_slot)
static int remove_board(struct slot *p_slot)
{
struct controller *ctrl = p_slot->ctrl;
u8 hp_slot;
u32 rc;
int rc;

if (shpchp_unconfigure_device(p_slot))
return(1);
Expand Down Expand Up @@ -961,7 +957,6 @@ int shpchp_enable_slot (struct slot *p_slot)
int shpchp_disable_slot (struct slot *p_slot)
{
u8 getstatus = 0;
u32 rc = 0;
int ret = 0;

if (!p_slot->ctrl)
Expand Down Expand Up @@ -990,8 +985,8 @@ int shpchp_disable_slot (struct slot *p_slot)
}
up(&p_slot->ctrl->crit_sect);

rc = remove_board(p_slot);
ret = remove_board(p_slot);
update_slot_info(p_slot);
return rc;
return ret;
}

Loading

0 comments on commit ee13833

Please sign in to comment.