diff options
Diffstat (limited to 'drivers/block/ataflop.c')
-rw-r--r-- | drivers/block/ataflop.c | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/drivers/block/ataflop.c b/drivers/block/ataflop.c index 22bda05fc69..f8ce235ccfc 100644 --- a/drivers/block/ataflop.c +++ b/drivers/block/ataflop.c @@ -181,7 +181,7 @@ static struct { { 6, TYPE_HD }, /* 31: H1640 <- was H1600 == h1600 for PC */ }; -#define NUM_DISK_MINORS (sizeof(minor2disktype)/sizeof(*minor2disktype)) +#define NUM_DISK_MINORS ARRAY_SIZE(minor2disktype) /* * Maximum disk size (in kilobytes). This default is used whenever the @@ -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); |