Fedora kernel-2.6.17-1.2142_FC4 patched with stable patch-2.6.17.4-vs2.0.2-rc26.diff
[linux-2.6.git] / drivers / block / ps2esdi.c
index 2954878..bea75f2 100644 (file)
@@ -43,6 +43,7 @@
 #include <linux/init.h>
 #include <linux/ioport.h>
 #include <linux/module.h>
+#include <linux/hdreg.h>
 
 #include <asm/system.h>
 #include <asm/io.h>
@@ -81,8 +82,7 @@ static void (*current_int_handler) (u_int) = NULL;
 static void ps2esdi_normal_interrupt_handler(u_int);
 static void ps2esdi_initial_reset_int_handler(u_int);
 static void ps2esdi_geometry_int_handler(u_int);
-static int ps2esdi_ioctl(struct inode *inode, struct file *file,
-                        u_int cmd, u_long arg);
+static int ps2esdi_getgeo(struct block_device *bdev, struct hd_geometry *geo);
 
 static int ps2esdi_read_status_words(int num_words, int max_words, u_short * buffer);
 
@@ -99,8 +99,7 @@ static DECLARE_WAIT_QUEUE_HEAD(ps2esdi_int);
 static int no_int_yet;
 static int ps2esdi_drives;
 static u_short io_base;
-static struct timer_list esdi_timer =
-               TIMER_INITIALIZER(ps2esdi_reset_timer, 0, 0);
+static DEFINE_TIMER(esdi_timer, ps2esdi_reset_timer, 0, 0);
 static int reset_status;
 static int ps2esdi_slot = -1;
 static int tp720esdi = 0;      /* Is it Integrated ESDI of ThinkPad-720? */
@@ -133,7 +132,7 @@ static struct ps2esdi_i_struct ps2esdi_info[MAX_HD] =
 static struct block_device_operations ps2esdi_fops =
 {
        .owner          = THIS_MODULE,
-       .ioctl          = ps2esdi_ioctl,
+       .getgeo         = ps2esdi_getgeo,
 };
 
 static struct gendisk *ps2esdi_gendisk[2];
@@ -1059,21 +1058,13 @@ static void dump_cmd_complete_status(u_int int_ret_code)
 
 }
 
-static int ps2esdi_ioctl(struct inode *inode,
-                        struct file *file, u_int cmd, u_long arg)
+static int ps2esdi_getgeo(struct block_device *bdev, struct hd_geometry *geo)
 {
-       struct ps2esdi_i_struct *p = inode->i_bdev->bd_disk->private_data;
-       struct ps2esdi_geometry geom;
-
-       if (cmd != HDIO_GETGEO)
-               return -EINVAL;
-       memset(&geom, 0, sizeof(geom));
-       geom.heads = p->head;
-       geom.sectors = p->sect;
-       geom.cylinders = p->cyl;
-       geom.start = get_start_sect(inode->i_bdev);
-       if (copy_to_user((void __user *)arg, &geom, sizeof(geom)))
-               return -EFAULT;
+       struct ps2esdi_i_struct *p = bdev->bd_disk->private_data;
+
+       geo->heads = p->head;
+       geo->sectors = p->sect;
+       geo->cylinders = p->cyl;
        return 0;
 }