fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / drivers / ide / legacy / hd.c
index c409055..45ed035 100644 (file)
@@ -156,11 +156,13 @@ else \
 
 
 #if (HD_DELAY > 0)
+
+#include <asm/i8253.h>
+
 unsigned long last_req;
 
 unsigned long read_timer(void)
 {
-        extern spinlock_t i8253_lock;
        unsigned long t, flags;
        int i;
 
@@ -457,7 +459,7 @@ ok_to_read:
 #ifdef DEBUG
        printk("%s: read: sector %ld, remaining = %ld, buffer=%p\n",
                req->rq_disk->disk_name, req->sector, req->nr_sectors,
-               req->buffer+512));
+               req->buffer+512);
 #endif
        if (req->current_nr_sectors <= 0)
                end_request(req, 1);
@@ -624,7 +626,7 @@ repeat:
                req->rq_disk->disk_name, (req->cmd == READ)?"read":"writ",
                cyl, head, sec, nsect, req->buffer);
 #endif
-       if (req->flags & REQ_CMD) {
+       if (blk_fs_request(req)) {
                switch (rq_data_dir(req)) {
                case READ:
                        hd_out(disk,nsect,sec,head,cyl,WIN_READ,&read_intr);
@@ -656,22 +658,14 @@ static void do_hd_request (request_queue_t * q)
        enable_irq(HD_IRQ);
 }
 
-static int hd_ioctl(struct inode * inode, struct file * file,
-       unsigned int cmd, unsigned long arg)
+static int hd_getgeo(struct block_device *bdev, struct hd_geometry *geo)
 {
-       struct hd_i_struct *disk = inode->i_bdev->bd_disk->private_data;
-       struct hd_geometry __user *loc = (struct hd_geometry __user *) arg;
-       struct hd_geometry g; 
-
-       if (cmd != HDIO_GETGEO)
-               return -EINVAL;
-       if (!loc)
-               return -EINVAL;
-       g.heads = disk->head;
-       g.sectors = disk->sect;
-       g.cylinders = disk->cyl;
-       g.start = get_start_sect(inode->i_bdev);
-       return copy_to_user(loc, &g, sizeof g) ? -EFAULT : 0; 
+       struct hd_i_struct *disk = bdev->bd_disk->private_data;
+
+       geo->heads = disk->head;
+       geo->sectors = disk->sect;
+       geo->cylinders = disk->cyl;
+       return 0;
 }
 
 /*
@@ -679,7 +673,7 @@ static int hd_ioctl(struct inode * inode, struct file * file,
  * be forgotten about...
  */
 
-static irqreturn_t hd_interrupt(int irq, void *dev_id, struct pt_regs *regs)
+static irqreturn_t hd_interrupt(int irq, void *dev_id)
 {
        void (*handler)(void) = do_hd;
 
@@ -693,11 +687,11 @@ static irqreturn_t hd_interrupt(int irq, void *dev_id, struct pt_regs *regs)
 }
 
 static struct block_device_operations hd_fops = {
-       .ioctl =        hd_ioctl,
+       .getgeo =       hd_getgeo,
 };
 
 /*
- * This is the hard disk IRQ description. The SA_INTERRUPT in sa_flags
+ * This is the hard disk IRQ description. The IRQF_DISABLED in sa_flags
  * means we run the IRQ-handler with interrupts disabled:  this is bad for
  * interrupt latency, but anything else has led to problems on some
  * machines.
@@ -812,7 +806,7 @@ static int __init hd_init(void)
                        p->cyl, p->head, p->sect);
        }
 
-       if (request_irq(HD_IRQ, hd_interrupt, SA_INTERRUPT, "hd", NULL)) {
+       if (request_irq(HD_IRQ, hd_interrupt, IRQF_DISABLED, "hd", NULL)) {
                printk("hd: unable to get IRQ%d for the hard disk driver\n",
                        HD_IRQ);
                goto out1;
@@ -851,7 +845,7 @@ Enomem:
        goto out;
 }
 
-static int parse_hd_setup (char *line) {
+static int __init parse_hd_setup (char *line) {
        int ints[6];
 
        (void) get_options(line, ARRAY_SIZE(ints), ints);