X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=drivers%2Fblock%2Fparide%2Fpd.c;h=62d2464c12f2001017077dadb883e0a18264be84;hb=987b0145d94eecf292d8b301228356f44611ab7c;hp=5f6534daa2c86dc0c767780a069e6416a367a70c;hpb=bc77d24c47b89f1e0efed0b8e4be5f8aad102883;p=linux-2.6.git diff --git a/drivers/block/paride/pd.c b/drivers/block/paride/pd.c index 5f6534daa..62d2464c1 100644 --- a/drivers/block/paride/pd.c +++ b/drivers/block/paride/pd.c @@ -155,38 +155,17 @@ enum {D_PRT, D_PRO, D_UNI, D_MOD, D_GEO, D_SBY, D_DLY, D_SLV}; #include #include -static spinlock_t pd_lock = SPIN_LOCK_UNLOCKED; - -#ifndef MODULE - -#include "setup.h" - -static STT pd_stt[7] = { - {"drive0", 8, drive0}, - {"drive1", 8, drive1}, - {"drive2", 8, drive2}, - {"drive3", 8, drive3}, - {"disable", 1, &disable}, - {"cluster", 1, &cluster}, - {"nice", 1, &nice} -}; - -void pd_setup(char *str, int *ints) -{ - generic_setup(pd_stt, 7, str); -} - -#endif - -MODULE_PARM(verbose, "i"); -MODULE_PARM(major, "i"); -MODULE_PARM(name, "s"); -MODULE_PARM(cluster, "i"); -MODULE_PARM(nice, "i"); -MODULE_PARM(drive0, "1-8i"); -MODULE_PARM(drive1, "1-8i"); -MODULE_PARM(drive2, "1-8i"); -MODULE_PARM(drive3, "1-8i"); +static DEFINE_SPINLOCK(pd_lock); + +module_param(verbose, bool, 0); +module_param(major, int, 0); +module_param(name, charp, 0); +module_param(cluster, int, 0); +module_param(nice, int, 0); +module_param_array(drive0, int, NULL, 0); +module_param_array(drive1, int, NULL, 0); +module_param_array(drive2, int, NULL, 0); +module_param_array(drive3, int, NULL, 0); #include "paride.h" @@ -255,7 +234,7 @@ struct pd_unit { struct gendisk *gd; }; -struct pd_unit pd[PD_UNITS]; +static struct pd_unit pd[PD_UNITS]; static char pd_scratch[512]; /* scratch block buffer */ @@ -743,7 +722,8 @@ static int pd_special_command(struct pd_unit *disk, rq.rq_disk = disk->gd; rq.ref_count = 1; rq.waiting = &wait; - blk_insert_request(disk->gd->queue, &rq, 0, func, 0); + rq.end_io = blk_end_sync_rq; + blk_insert_request(disk->gd->queue, &rq, 0, func); wait_for_completion(&wait); rq.waiting = NULL; if (rq.errors) @@ -767,32 +747,33 @@ static int pd_open(struct inode *inode, struct file *file) return 0; } +static int pd_getgeo(struct block_device *bdev, struct hd_geometry *geo) +{ + struct pd_unit *disk = bdev->bd_disk->private_data; + + if (disk->alt_geom) { + geo->heads = PD_LOG_HEADS; + geo->sectors = PD_LOG_SECTS; + geo->cylinders = disk->capacity / (geo->heads * geo->sectors); + } else { + geo->heads = disk->heads; + geo->sectors = disk->sectors; + geo->cylinders = disk->cylinders; + } + + return 0; +} + static int pd_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) { struct pd_unit *disk = inode->i_bdev->bd_disk->private_data; - struct hd_geometry __user *geo = (struct hd_geometry __user *) arg; - struct hd_geometry g; switch (cmd) { case CDROMEJECT: if (disk->access == 1) pd_special_command(disk, pd_eject); return 0; - case HDIO_GETGEO: - if (disk->alt_geom) { - g.heads = PD_LOG_HEADS; - g.sectors = PD_LOG_SECTS; - g.cylinders = disk->capacity / (g.heads * g.sectors); - } else { - g.heads = disk->heads; - g.sectors = disk->sectors; - g.cylinders = disk->cylinders; - } - g.start = get_start_sect(inode->i_bdev); - if (copy_to_user(geo, &g, sizeof(struct hd_geometry))) - return -EFAULT; - return 0; default: return -EINVAL; } @@ -835,6 +816,7 @@ static struct block_device_operations pd_fops = { .open = pd_open, .release = pd_release, .ioctl = pd_ioctl, + .getgeo = pd_getgeo, .media_changed = pd_check_media, .revalidate_disk= pd_revalidate };