X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=drivers%2Fide%2Flegacy%2Fhd.c;h=6439dec66881619fc26d678a5bab544e18e06182;hb=9464c7cf61b9433057924c36e6e02f303a00e768;hp=05ea9a7057ebe7ef87daef653d3ca2a52feaf23d;hpb=daddc0d38b3571bed170afa273a49a0eba090c1e;p=linux-2.6.git diff --git a/drivers/ide/legacy/hd.c b/drivers/ide/legacy/hd.c index 05ea9a705..6439dec66 100644 --- a/drivers/ide/legacy/hd.c +++ b/drivers/ide/legacy/hd.c @@ -94,7 +94,7 @@ #define BBD_ERR 0x80 /* pre-EIDE meaning: block marked bad */ #define ICRC_ERR 0x80 /* new meaning: CRC error during transfer */ -static spinlock_t hd_lock = SPIN_LOCK_UNLOCKED; +static DEFINE_SPINLOCK(hd_lock); static struct request_queue *hd_queue; #define MAJOR_NR HD_MAJOR @@ -156,11 +156,13 @@ else \ #if (HD_DELAY > 0) + +#include + unsigned long last_req; unsigned long read_timer(void) { - extern spinlock_t i8253_lock; unsigned long t, flags; int i; @@ -174,7 +176,7 @@ unsigned long read_timer(void) } #endif -void __init hd_setup(char *str, int *ints) +static void __init hd_setup(char *str, int *ints) { int hdind = 0; @@ -239,7 +241,7 @@ static void dump_status (const char *msg, unsigned int stat) #endif } -void check_status(void) +static void check_status(void) { int i = inb_p(HD_STATUS); @@ -386,7 +388,7 @@ repeat: * drive enters "idle", "standby", or "sleep" mode, so if the status looks * "good", we just ignore the interrupt completely. */ -void unexpected_hd_interrupt(void) +static void unexpected_hd_interrupt(void) { unsigned int stat = inb_p(HD_STATUS); @@ -551,7 +553,7 @@ static void hd_times_out(unsigned long dummy) enable_irq(HD_IRQ); } -int do_special_op(struct hd_i_struct *disk, struct request *req) +static int do_special_op(struct hd_i_struct *disk, struct request *req) { if (disk->recalibrate) { disk->recalibrate = 0; @@ -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 *loc = (struct hd_geometry *) 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; } /* @@ -693,7 +687,7 @@ 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, }; /* @@ -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);