diff options
Diffstat (limited to 'drivers/block')
-rw-r--r-- | drivers/block/amiflop.c | 30 | ||||
-rw-r--r-- | drivers/block/ataflop.c | 27 |
2 files changed, 38 insertions, 19 deletions
diff --git a/drivers/block/amiflop.c b/drivers/block/amiflop.c index 3c679d3..b6e2909 100644 --- a/drivers/block/amiflop.c +++ b/drivers/block/amiflop.c @@ -194,6 +194,8 @@ static DECLARE_WAIT_QUEUE_HEAD(ms_wait); */ #define MAX_ERRORS 12 +#define custom amiga_custom + /* Prevent "aliased" accesses. */ static int fd_ref[4] = { 0,0,0,0 }; static int fd_device[4] = { 0, 0, 0, 0 }; @@ -1439,6 +1441,7 @@ static int fd_ioctl(struct inode *inode, struct file *filp, { int drive = iminor(inode) & 3; static struct floppy_struct getprm; + void __user *argp = (void __user *)param; switch(cmd){ case FDFMTBEG: @@ -1484,9 +1487,7 @@ static int fd_ioctl(struct inode *inode, struct file *filp, getprm.head=unit[drive].type->heads; getprm.sect=unit[drive].dtype->sects * unit[drive].type->sect_mult; getprm.size=unit[drive].blocks; - if (copy_to_user((void *)param, - (void *)&getprm, - sizeof(struct floppy_struct))) + if (copy_to_user(argp, &getprm, sizeof(struct floppy_struct))) return -EFAULT; break; case FDSETPRM: @@ -1498,8 +1499,7 @@ static int fd_ioctl(struct inode *inode, struct file *filp, break; #ifdef RAW_IOCTL case IOCTL_RAW_TRACK: - if (copy_to_user((void *)param, raw_buf, - unit[drive].type->read_size)) + if (copy_to_user(argp, raw_buf, unit[drive].type->read_size)) return -EFAULT; else return unit[drive].type->read_size; @@ -1654,12 +1654,6 @@ static struct block_device_operations floppy_fops = { .media_changed = amiga_floppy_change, }; -void __init amiga_floppy_setup (char *str, int *ints) -{ - printk (KERN_INFO "amiflop: Setting default df0 to %x\n", ints[1]); - fd_def_df0 = ints[1]; -} - static int __init fd_probe_drives(void) { int drive,drives,nomem; @@ -1845,4 +1839,18 @@ void cleanup_module(void) unregister_blkdev(FLOPPY_MAJOR, "fd"); } #endif + +#else +static int __init amiga_floppy_setup (char *str) +{ + int n; + if (!MACH_IS_AMIGA) + return 0; + if (!get_option(&str, &n)) + return 0; + printk (KERN_INFO "amiflop: Setting default df0 to %x\n", n); + fd_def_df0 = n; +} + +__setup("floppy=", amiga_floppy_setup); #endif diff --git a/drivers/block/ataflop.c b/drivers/block/ataflop.c index 3aa68a5..f8ce235 100644 --- a/drivers/block/ataflop.c +++ b/drivers/block/ataflop.c @@ -1361,7 +1361,7 @@ static int floppy_revalidate(struct gendisk *disk) formats, for 'permanent user-defined' parameter: restore default_params[] here if flagged valid! */ if (default_params[drive].blocks == 0) - UDT = 0; + UDT = NULL; else UDT = &default_params[drive]; } @@ -1495,6 +1495,7 @@ static int fd_ioctl(struct inode *inode, struct file *filp, struct floppy_struct getprm; int settype; struct floppy_struct setprm; + void __user *argp = (void __user *)param; switch (cmd) { case FDGETPRM: @@ -1521,7 +1522,7 @@ static int fd_ioctl(struct inode *inode, struct file *filp, getprm.head = 2; getprm.track = dtp->blocks/dtp->spt/2; getprm.stretch = dtp->stretch; - if (copy_to_user((void *)param, &getprm, sizeof(getprm))) + if (copy_to_user(argp, &getprm, sizeof(getprm))) return -EFAULT; return 0; } @@ -1540,7 +1541,7 @@ static int fd_ioctl(struct inode *inode, struct file *filp, /* get the parameters from user space */ if (floppy->ref != 1 && floppy->ref != -1) return -EBUSY; - if (copy_from_user(&setprm, (void *) param, sizeof(setprm))) + if (copy_from_user(&setprm, argp, sizeof(setprm))) return -EFAULT; /* * first of all: check for floppy change and revalidate, @@ -1647,7 +1648,7 @@ static int fd_ioctl(struct inode *inode, struct file *filp, case FDFMTTRK: if (floppy->ref != 1 && floppy->ref != -1) return -EBUSY; - if (copy_from_user(&fmt_desc, (void *) param, sizeof(fmt_desc))) + if (copy_from_user(&fmt_desc, argp, sizeof(fmt_desc))) return -EFAULT; return do_format(drive, type, &fmt_desc); case FDCLRPRM: @@ -1950,14 +1951,20 @@ Enomem: return -ENOMEM; } - -void __init atari_floppy_setup( char *str, int *ints ) +#ifndef MODULE +static int __init atari_floppy_setup(char *str) { + int ints[3 + FD_MAX_UNITS]; int i; + + if (!MACH_IS_ATARI) + return 0; + + str = get_options(str, 3 + FD_MAX_UNITS, ints); if (ints[0] < 1) { printk(KERN_ERR "ataflop_setup: no arguments!\n" ); - return; + return 0; } else if (ints[0] > 2+FD_MAX_UNITS) { printk(KERN_ERR "ataflop_setup: too many arguments\n" ); @@ -1977,9 +1984,13 @@ void __init atari_floppy_setup( char *str, int *ints ) else UserSteprate[i-3] = ints[i]; } + return 1; } -static void atari_floppy_exit(void) +__setup("floppy=", atari_floppy_setup); +#endif + +static void __exit atari_floppy_exit(void) { int i; blk_unregister_region(MKDEV(FLOPPY_MAJOR, 0), 256); |