fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / drivers / block / cpqarray.c
index f484d87..b857c61 100644 (file)
@@ -19,7 +19,6 @@
  *    Questions/Comments/Bugfixes to iss_storagedev@hp.com
  *
  */
-#include <linux/config.h>      /* CONFIG_PROC_FS */
 #include <linux/module.h>
 #include <linux/types.h>
 #include <linux/pci.h>
@@ -33,7 +32,6 @@
 #include <linux/blkpg.h>
 #include <linux/timer.h>
 #include <linux/proc_fs.h>
-#include <linux/devfs_fs_kernel.h>
 #include <linux/init.h>
 #include <linux/hdreg.h>
 #include <linux/spinlock.h>
@@ -52,6 +50,7 @@
 /* Original author Chris Frantz - Compaq Computer Corporation */
 MODULE_AUTHOR("Compaq Computer Corporation");
 MODULE_DESCRIPTION("Driver for Compaq Smart2 Array Controllers version 2.6.0");
+MODULE_VERSION("2.6.0");
 MODULE_LICENSE("GPL");
 
 #include "cpqarray.h"
@@ -171,7 +170,7 @@ static inline cmdlist_t *removeQ(cmdlist_t **Qptr, cmdlist_t *c);
 static inline void complete_buffers(struct bio *bio, int ok);
 static inline void complete_command(cmdlist_t *cmd, int timeout);
 
-static irqreturn_t do_ida_intr(int irq, void *dev_id, struct pt_regs * regs);
+static irqreturn_t do_ida_intr(int irq, void *dev_id);
 static void ida_timer(unsigned long tdata);
 static int ida_revalidate(struct gendisk *disk);
 static int revalidate_allvol(ctlr_info_t *host);
@@ -348,7 +347,6 @@ static void __devexit cpqarray_remove_one(int i)
        for(j = 0; j < NWD; j++) {
                if (ida_gendisk[i][j]->flags & GENHD_FL_UP)
                        del_gendisk(ida_gendisk[i][j]);
-               devfs_remove("ida/c%dd%d",i,j);
                put_disk(ida_gendisk[i][j]);
        }
        blk_cleanup_queue(hba[i]->queue);
@@ -392,7 +390,7 @@ static void __devexit cpqarray_remove_one_eisa (int i)
 }
 
 /* pdev is NULL for eisa */
-static int cpqarray_register_ctlr( int i, struct pci_dev *pdev)
+static int __init cpqarray_register_ctlr( int i, struct pci_dev *pdev)
 {
        request_queue_t *q;
        int j;
@@ -410,8 +408,7 @@ static int cpqarray_register_ctlr( int i, struct pci_dev *pdev)
        }
        hba[i]->access.set_intr_mask(hba[i], 0);
        if (request_irq(hba[i]->intr, do_ida_intr,
-               SA_INTERRUPT|SA_SHIRQ|SA_SAMPLE_RANDOM,
-               hba[i]->devname, hba[i]))
+               IRQF_DISABLED|IRQF_SHARED, hba[i]->devname, hba[i]))
        {
                printk(KERN_ERR "cpqarray: Unable to get irq %d for %s\n",
                                hba[i]->intr, hba[i]->devname);
@@ -617,6 +614,7 @@ static int cpqarray_pci_init(ctlr_info_t *c, struct pci_dev *pdev)
        int i;
 
        c->pci_dev = pdev;
+       pci_set_master(pdev);
        if (pci_enable_device(pdev)) {
                printk(KERN_ERR "cpqarray: Unable to Enable PCI device\n");
                return -1;
@@ -745,7 +743,7 @@ __setup("smart2=", cpqarray_setup);
 /*
  * Find an EISA controller's signature.  Set up an hba if we find it.
  */
-static int cpqarray_eisa_detect(void)
+static int __init cpqarray_eisa_detect(void)
 {
        int i=0, j;
        __u32 board_id;
@@ -906,8 +904,7 @@ queue_next:
        if (!creq)
                goto startio;
 
-       if (creq->nr_phys_segments > SG_MAX)
-               BUG();
+       BUG_ON(creq->nr_phys_segments > SG_MAX);
 
        if ((c = cmd_alloc(h,1)) == NULL)
                goto startio;
@@ -993,7 +990,6 @@ static inline void complete_buffers(struct bio *bio, int ok)
                xbh = bio->bi_next;
                bio->bi_next = NULL;
                
-               blk_finished_io(nr_sectors);
                bio_endio(bio, nr_sectors << 9, ok ? 0 : -EIO);
 
                bio = xbh;
@@ -1040,10 +1036,12 @@ static inline void complete_command(cmdlist_t *cmd, int timeout)
 
        if (blk_fs_request(rq)) {
                const int rw = rq_data_dir(rq);
+
                disk_stat_add(rq->rq_disk, sectors[rw], rq->nr_sectors);
        }
 
+       add_disk_randomness(rq->rq_disk);
+
        DBGPX(printk("Done with %p\n", rq););
        end_that_request_last(rq, ok ? 1 : -EIO);
 }
@@ -1053,7 +1051,7 @@ static inline void complete_command(cmdlist_t *cmd, int timeout)
  *  Find the command on the completion queue, remove it, tell the OS and
  *  try to queue up more IO
  */
-static irqreturn_t do_ida_intr(int irq, void *dev_id, struct pt_regs *regs)
+static irqreturn_t do_ida_intr(int irq, void *dev_id)
 {
        ctlr_info_t *h = dev_id;
        cmdlist_t *c;
@@ -1629,7 +1627,7 @@ static void start_fwbk(int ctlr)
                " processing\n");
        /* Command does not return anything, but idasend command needs a 
                buffer */
-       id_ctlr_buf = (id_ctlr_t *)kmalloc(sizeof(id_ctlr_t), GFP_KERNEL);
+       id_ctlr_buf = kmalloc(sizeof(id_ctlr_t), GFP_KERNEL);
        if(id_ctlr_buf==NULL)
        {
                printk(KERN_WARNING "cpqarray: Out of memory. "
@@ -1664,14 +1662,14 @@ static void getgeometry(int ctlr)
 
        info_p->log_drv_map = 0;        
        
-       id_ldrive = (id_log_drv_t *)kmalloc(sizeof(id_log_drv_t), GFP_KERNEL);
+       id_ldrive = kmalloc(sizeof(id_log_drv_t), GFP_KERNEL);
        if(id_ldrive == NULL)
        {
                printk( KERN_ERR "cpqarray:  out of memory.\n");
                return;
        }
 
-       id_ctlr_buf = (id_ctlr_t *)kmalloc(sizeof(id_ctlr_t), GFP_KERNEL);
+       id_ctlr_buf = kmalloc(sizeof(id_ctlr_t), GFP_KERNEL);
        if(id_ctlr_buf == NULL)
        {
                kfree(id_ldrive);
@@ -1679,7 +1677,7 @@ static void getgeometry(int ctlr)
                return;
        }
 
-       id_lstatus_buf = (sense_log_drv_stat_t *)kmalloc(sizeof(sense_log_drv_stat_t), GFP_KERNEL);
+       id_lstatus_buf = kmalloc(sizeof(sense_log_drv_stat_t), GFP_KERNEL);
        if(id_lstatus_buf == NULL)
        {
                kfree(id_ctlr_buf);
@@ -1688,7 +1686,7 @@ static void getgeometry(int ctlr)
                return;
        }
 
-       sense_config_buf = (config_t *)kmalloc(sizeof(config_t), GFP_KERNEL);
+       sense_config_buf = kmalloc(sizeof(config_t), GFP_KERNEL);
        if(sense_config_buf == NULL)
        {
                kfree(id_lstatus_buf);
@@ -1748,8 +1746,6 @@ static void getgeometry(int ctlr)
             (log_index < id_ctlr_buf->nr_drvs)
             && (log_unit < NWD);
             log_unit++) {
-               struct gendisk *disk = ida_gendisk[ctlr][log_unit];
-
                size = sizeof(sense_log_drv_stat_t);
 
                /*
@@ -1814,8 +1810,6 @@ static void getgeometry(int ctlr)
 
                                }
 
-                               sprintf(disk->devfs_name, "ida/c%dd%d", ctlr, log_unit);
-
                                info_p->phys_drives =
                                    sense_config_buf->ctlr_phys_drv;
                                info_p->drv_assign_map
@@ -1851,7 +1845,6 @@ static void __exit cpqarray_exit(void)
                }
        }
 
-       devfs_remove("ida");
        remove_proc_entry("cpqarray", proc_root_driver);
 }