From: Andrew Morton - Fix debug printks - uninline function with multiple callsites - coding style fixups - remove unneeded casts of void* - Note that atomic_xchg isn't _really- available on all architectures. But afaict only UML is missing it now. Cc: HighPoint Linux Team Signed-off-by: Andrew Morton --- drivers/scsi/hptiop.c | 133 ++++++++++++++++++++-------------------- 1 files changed, 67 insertions(+), 66 deletions(-) diff -puN drivers/scsi/hptiop.c~hptiop-highpoint-rocketraid-3xxx-controller-driver-list-locking-updates drivers/scsi/hptiop.c --- 25/drivers/scsi/hptiop.c~hptiop-highpoint-rocketraid-3xxx-controller-driver-list-locking-updates Fri May 12 09:59:39 2006 +++ 25-akpm/drivers/scsi/hptiop.c Fri May 12 09:59:39 2006 @@ -49,11 +49,11 @@ static DEFINE_SPINLOCK(hptiop_hba_list_l static LIST_HEAD(hptiop_hba_list); static int hptiop_cdev_major = -1; -static void hptiop_host_request_callback(struct hptiop_hba * hba, u32 tag); -static void hptiop_iop_request_callback(struct hptiop_hba * hba, u32 tag); -static void hptiop_message_callback(struct hptiop_hba * hba, u32 msg); +static void hptiop_host_request_callback(struct hptiop_hba *hba, u32 tag); +static void hptiop_iop_request_callback(struct hptiop_hba *hba, u32 tag); +static void hptiop_message_callback(struct hptiop_hba *hba, u32 msg); -static int iop_wait_ready(struct hpt_iopmu __iomem * iop, u32 millisec) +static int iop_wait_ready(struct hpt_iopmu __iomem *iop, u32 millisec) { u32 req = 0; int i; @@ -73,7 +73,7 @@ static int iop_wait_ready(struct hpt_iop return -1; } -static void inline hptiop_request_callback(struct hptiop_hba * hba, u32 tag) +static void hptiop_request_callback(struct hptiop_hba *hba, u32 tag) { if ((tag & IOPMU_QUEUE_MASK_HOST_BITS) == IOPMU_QUEUE_ADDR_HOST_BIT) return hptiop_host_request_callback(hba, @@ -82,7 +82,7 @@ static void inline hptiop_request_callba return hptiop_iop_request_callback(hba, tag); } -static inline void hptiop_drain_outbound_queue(struct hptiop_hba * hba) +static inline void hptiop_drain_outbound_queue(struct hptiop_hba *hba) { u32 req; @@ -108,9 +108,9 @@ static inline void hptiop_drain_outbound } } -static int __iop_intr(struct hptiop_hba * hba) +static int __iop_intr(struct hptiop_hba *hba) { - struct hpt_iopmu __iomem * iop = hba->iop; + struct hpt_iopmu __iomem *iop = hba->iop; u32 status; int ret = 0; @@ -132,10 +132,10 @@ static int __iop_intr(struct hptiop_hba return ret; } -static int iop_send_sync_request(struct hptiop_hba * hba, - void __iomem * _req, u32 millisec) +static int iop_send_sync_request(struct hptiop_hba *hba, + void __iomem *_req, u32 millisec) { - struct hpt_iop_request_header __iomem * req = _req; + struct hpt_iop_request_header __iomem *req = _req; u32 i; writel(readl(&req->flags) | IOP_REQUEST_FLAG_SYNC_REQUEST, @@ -156,7 +156,7 @@ static int iop_send_sync_request(struct return -1; } -static int iop_send_sync_msg(struct hptiop_hba * hba, u32 msg, u32 millisec) +static int iop_send_sync_msg(struct hptiop_hba *hba, u32 msg, u32 millisec) { u32 i; @@ -174,11 +174,11 @@ static int iop_send_sync_msg(struct hpti return hba->msg_done? 0 : -1; } -static int iop_get_config(struct hptiop_hba * hba, - struct hpt_iop_request_get_config * config) +static int iop_get_config(struct hptiop_hba *hba, + struct hpt_iop_request_get_config *config) { u32 req32; - struct hpt_iop_request_get_config __iomem * req; + struct hpt_iop_request_get_config __iomem *req; req32 = readl(&hba->iop->inbound_queue); if (req32 == IOPMU_QUEUE_EMPTY) @@ -202,11 +202,11 @@ static int iop_get_config(struct hptiop_ return 0; } -static int iop_set_config(struct hptiop_hba * hba, - struct hpt_iop_request_set_config * config) +static int iop_set_config(struct hptiop_hba *hba, + struct hpt_iop_request_set_config *config) { u32 req32; - struct hpt_iop_request_set_config __iomem * req; + struct hpt_iop_request_set_config __iomem *req; req32 = readl(&hba->iop->inbound_queue); if (req32 == IOPMU_QUEUE_EMPTY) @@ -234,9 +234,9 @@ static int iop_set_config(struct hptiop_ return 0; } -static int hptiop_initialize_iop(struct hptiop_hba * hba) +static int hptiop_initialize_iop(struct hptiop_hba *hba) { - struct hpt_iopmu __iomem * iop = hba->iop; + struct hpt_iopmu __iomem *iop = hba->iop; /* enable interrupts */ writel(~(IOPMU_OUTBOUND_INT_POSTQUEUE|IOPMU_OUTBOUND_INT_MSG0), @@ -254,11 +254,11 @@ static int hptiop_initialize_iop(struct return 0; } -static int hptiop_map_pci_bar(struct hptiop_hba * hba) +static int hptiop_map_pci_bar(struct hptiop_hba *hba) { u8 cmd; u32 mem_base_phy, length; - void __iomem * mem_base_virt; + void __iomem *mem_base_virt; struct pci_dev *pcidev = hba->pcidev; pci_read_config_byte(pcidev, PCI_COMMAND, &cmd); @@ -287,7 +287,7 @@ static int hptiop_map_pci_bar(struct hpt return 0; } -static void hptiop_message_callback(struct hptiop_hba * hba, u32 msg) +static void hptiop_message_callback(struct hptiop_hba *hba, u32 msg) { dprintk("iop message 0x%x\n", msg); @@ -302,9 +302,9 @@ static void hptiop_message_callback(stru hba->msg_done = 1; } -static inline struct hptiop_request * get_req(struct hptiop_hba * hba) +static inline struct hptiop_request *get_req(struct hptiop_hba *hba) { - struct hptiop_request * ret; + struct hptiop_request *ret; dprintk("get_req : req=%p\n", hba->req_list); @@ -322,13 +322,13 @@ static inline void free_req(struct hptio hba->req_list = req; } -static void hptiop_host_request_callback(struct hptiop_hba * hba, u32 tag) +static void hptiop_host_request_callback(struct hptiop_hba *hba, u32 tag) { - struct hpt_iop_request_scsi_command * req; + struct hpt_iop_request_scsi_command *req; struct scsi_cmnd *scp; req = (struct hpt_iop_request_scsi_command *)hba->reqs[tag].req_virt; - dprintk("hptiop_request_callback: req=%p, type=%d, " + dprintk("hptiop_host_request_callback: req=%p, type=%d, " "result=%d, context=0x%x tag=%d\n", req, req->header.type, req->header.result, req->header.context, tag); @@ -392,15 +392,15 @@ static void hptiop_host_request_callback atomic_dec(&hba->outstandingcommands); } -void hptiop_iop_request_callback(struct hptiop_hba * hba, u32 tag) +void hptiop_iop_request_callback(struct hptiop_hba *hba, u32 tag) { - struct hpt_iop_request_header __iomem * req; - struct hpt_iop_request_ioctl_command __iomem * p; + struct hpt_iop_request_header __iomem *req; + struct hpt_iop_request_ioctl_command __iomem *p; struct hpt_ioctl_k *arg; req = (struct hpt_iop_request_header __iomem *) ((unsigned long)hba->iop + tag); - dprintk("hptiop_request_callback: req=%p, type=%d, " + dprintk("hptiop_iop_request_callback: req=%p, type=%d, " "result=%d, context=0x%x tag=%d\n", req, readl(&req->type), readl(&req->result), readl(&req->context), tag); @@ -433,7 +433,7 @@ void hptiop_iop_request_callback(struct static irqreturn_t hptiop_intr(int irq, void *dev_id, struct pt_regs *regs) { - struct hptiop_hba * hba = (struct hptiop_hba *)dev_id; + struct hptiop_hba *hba = dev_id; int handled = 0; unsigned long flags; @@ -501,14 +501,14 @@ static int hptiop_buildsgl(struct scsi_c return sg_count; } -static int hptiop_queuecommand(struct scsi_cmnd * scp, - void (*done) (struct scsi_cmnd *)) +static int hptiop_queuecommand(struct scsi_cmnd *scp, + void (*done)(struct scsi_cmnd *)) { struct Scsi_Host *host = scp->device->host; - struct hptiop_hba * hba = (struct hptiop_hba *)host->hostdata; - struct hpt_iop_request_scsi_command * req; + struct hptiop_hba *hba = (struct hptiop_hba *)host->hostdata; + struct hpt_iop_request_scsi_command *req; int sg_count = 0; - struct hptiop_request * _req; + struct hptiop_request *_req; BUG_ON(!done); scp->scsi_done = done; @@ -598,7 +598,7 @@ static int hptiop_abort(struct scsi_cmnd return FAILED; } -static int hptiop_reset_hba(struct hptiop_hba * hba) +static int hptiop_reset_hba(struct hptiop_hba *hba) { if (atomic_xchg(&hba->resetting, 1) == 0) { atomic_inc(&hba->reset_count); @@ -808,19 +808,21 @@ static inline int __hpt_do_ioctl(struct #define hpt_id_valid(id) ((id) && ((u32)(id) != 0xffffffff)) -static int hptiop_get_controller_info(struct hptiop_hba * hba, - struct hpt_controller_info * pinfo) +static int hptiop_get_controller_info(struct hptiop_hba *hba, + struct hpt_controller_info *pinfo) { int id = 0; + return __hpt_do_ioctl(hba, HPT_IOCTL_GET_CONTROLLER_INFO, &id, sizeof(int), pinfo, sizeof(*pinfo)); } -static int hptiop_get_channel_info(struct hptiop_hba * hba, int bus, - struct hpt_channel_info * pinfo) +static int hptiop_get_channel_info(struct hptiop_hba *hba, int bus, + struct hpt_channel_info *pinfo) { u32 ids[2]; + ids[0] = 0; ids[1] = bus; return __hpt_do_ioctl(hba, HPT_IOCTL_GET_CHANNEL_INFO, @@ -828,8 +830,8 @@ static int hptiop_get_channel_info(struc } -static int hptiop_get_logical_devices(struct hptiop_hba * hba, - hpt_id_t * pids, int maxcount) +static int hptiop_get_logical_devices(struct hptiop_hba *hba, + hpt_id_t *pids, int maxcount) { int i; u32 count = maxcount - 1; @@ -846,15 +848,15 @@ static int hptiop_get_logical_devices(st return maxcount; } -static int hptiop_get_device_info_v3(struct hptiop_hba * hba, - hpt_id_t id, struct hpt_logical_device_info_v3 * pinfo) +static int hptiop_get_device_info_v3(struct hptiop_hba *hba, hpt_id_t id, + struct hpt_logical_device_info_v3 *pinfo) { return __hpt_do_ioctl(hba, HPT_IOCTL_GET_DEVICE_INFO_V3, &id, sizeof(hpt_id_t), pinfo, sizeof(*pinfo)); } -static const char *get_array_status(struct hpt_logical_device_info_v3 * devinfo) +static const char *get_array_status(struct hpt_logical_device_info_v3 *devinfo) { static char s[64]; u32 flags = devinfo->u.array.flags; @@ -912,7 +914,7 @@ static const char *get_array_status(stru return s; } -static void hptiop_dump_devinfo(struct hptiop_hba * hba, +static void hptiop_dump_devinfo(struct hptiop_hba *hba, struct hptiop_getinfo *pinfo, hpt_id_t id, int indent) { struct hpt_logical_device_info_v3 devinfo; @@ -983,8 +985,7 @@ static void hptiop_dump_devinfo(struct h devinfo.u.array.array_type==AT_JBOD? "JBOD" : "unknown", capacity, - get_array_status(&devinfo) - ); + get_array_status(&devinfo)); for (i = 0; i < devinfo.u.array.ndisk; i++) { if (hpt_id_valid(devinfo.u.array.members[i])) { if ((1<private_data; + struct hptiop_hba *hba = filp->private_data; struct hptiop_getinfo info; int i, j, ndev; struct hpt_controller_info con_info; @@ -1172,8 +1173,8 @@ static struct file_operations hptiop_cde static ssize_t hptiop_show_fw_version(struct class_device *class_dev, char *buf) { - struct Scsi_Host * host = class_to_shost(class_dev); - struct hptiop_hba * hba = (struct hptiop_hba *)host->hostdata; + struct Scsi_Host *host = class_to_shost(class_dev); + struct hptiop_hba *hba = (struct hptiop_hba *)host->hostdata; return snprintf(buf, PAGE_SIZE, "%d.%d.%d.%d\n", hba->firmware_version >> 24, @@ -1224,12 +1225,12 @@ static struct scsi_host_template driver_ static int __devinit hptiop_probe(struct pci_dev *pcidev, const struct pci_device_id *id) { - struct Scsi_Host * host = NULL; - struct hptiop_hba * hba; - struct hpt_iop_request_get_config iop_config; - struct hpt_iop_request_set_config set_config; + struct Scsi_Host *host = NULL; + struct hptiop_hba *hba; + struct hpt_iop_request_get_config iop_config; + struct hpt_iop_request_set_config set_config; dma_addr_t start_phy; - void * start_virt; + void *start_virt; u32 offset, i, req_size; dprintk("hptiop_probe(%p)\n", pcidev); @@ -1418,9 +1419,9 @@ disable_pci_device: static void hptiop_shutdown(struct pci_dev *pcidev) { - struct Scsi_Host * host = pci_get_drvdata(pcidev); - struct hptiop_hba * hba = (struct hptiop_hba *)host->hostdata; - struct hpt_iopmu __iomem * iop = hba->iop; + struct Scsi_Host *host = pci_get_drvdata(pcidev); + struct hptiop_hba *hba = (struct hptiop_hba *)host->hostdata; + struct hpt_iopmu __iomem *iop = hba->iop; u32 int_mask; dprintk("hptiop_shutdown(%p)\n", hba); @@ -1443,8 +1444,8 @@ static void hptiop_shutdown(struct pci_d static void hptiop_remove(struct pci_dev *pcidev) { - struct Scsi_Host * host = pci_get_drvdata(pcidev); - struct hptiop_hba * hba = (struct hptiop_hba *)host->hostdata; + struct Scsi_Host *host = pci_get_drvdata(pcidev); + struct hptiop_hba *hba = (struct hptiop_hba *)host->hostdata; dprintk("scsi%d: hptiop_remove\n", hba->host->host_no); _