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 3c679d30b698..b6e290956214 100644 --- a/drivers/block/amiflop.c +++ b/drivers/block/amiflop.c | |||
@@ -194,6 +194,8 @@ static DECLARE_WAIT_QUEUE_HEAD(ms_wait); | |||
194 | */ | 194 | */ |
195 | #define MAX_ERRORS 12 | 195 | #define MAX_ERRORS 12 |
196 | 196 | ||
197 | #define custom amiga_custom | ||
198 | |||
197 | /* Prevent "aliased" accesses. */ | 199 | /* Prevent "aliased" accesses. */ |
198 | static int fd_ref[4] = { 0,0,0,0 }; | 200 | static int fd_ref[4] = { 0,0,0,0 }; |
199 | static int fd_device[4] = { 0, 0, 0, 0 }; | 201 | static int fd_device[4] = { 0, 0, 0, 0 }; |
@@ -1439,6 +1441,7 @@ static int fd_ioctl(struct inode *inode, struct file *filp, | |||
1439 | { | 1441 | { |
1440 | int drive = iminor(inode) & 3; | 1442 | int drive = iminor(inode) & 3; |
1441 | static struct floppy_struct getprm; | 1443 | static struct floppy_struct getprm; |
1444 | void __user *argp = (void __user *)param; | ||
1442 | 1445 | ||
1443 | switch(cmd){ | 1446 | switch(cmd){ |
1444 | case FDFMTBEG: | 1447 | case FDFMTBEG: |
@@ -1484,9 +1487,7 @@ static int fd_ioctl(struct inode *inode, struct file *filp, | |||
1484 | getprm.head=unit[drive].type->heads; | 1487 | getprm.head=unit[drive].type->heads; |
1485 | getprm.sect=unit[drive].dtype->sects * unit[drive].type->sect_mult; | 1488 | getprm.sect=unit[drive].dtype->sects * unit[drive].type->sect_mult; |
1486 | getprm.size=unit[drive].blocks; | 1489 | getprm.size=unit[drive].blocks; |
1487 | if (copy_to_user((void *)param, | 1490 | if (copy_to_user(argp, &getprm, sizeof(struct floppy_struct))) |
1488 | (void *)&getprm, | ||
1489 | sizeof(struct floppy_struct))) | ||
1490 | return -EFAULT; | 1491 | return -EFAULT; |
1491 | break; | 1492 | break; |
1492 | case FDSETPRM: | 1493 | case FDSETPRM: |
@@ -1498,8 +1499,7 @@ static int fd_ioctl(struct inode *inode, struct file *filp, | |||
1498 | break; | 1499 | break; |
1499 | #ifdef RAW_IOCTL | 1500 | #ifdef RAW_IOCTL |
1500 | case IOCTL_RAW_TRACK: | 1501 | case IOCTL_RAW_TRACK: |
1501 | if (copy_to_user((void *)param, raw_buf, | 1502 | if (copy_to_user(argp, raw_buf, unit[drive].type->read_size)) |
1502 | unit[drive].type->read_size)) | ||
1503 | return -EFAULT; | 1503 | return -EFAULT; |
1504 | else | 1504 | else |
1505 | return unit[drive].type->read_size; | 1505 | return unit[drive].type->read_size; |
@@ -1654,12 +1654,6 @@ static struct block_device_operations floppy_fops = { | |||
1654 | .media_changed = amiga_floppy_change, | 1654 | .media_changed = amiga_floppy_change, |
1655 | }; | 1655 | }; |
1656 | 1656 | ||
1657 | void __init amiga_floppy_setup (char *str, int *ints) | ||
1658 | { | ||
1659 | printk (KERN_INFO "amiflop: Setting default df0 to %x\n", ints[1]); | ||
1660 | fd_def_df0 = ints[1]; | ||
1661 | } | ||
1662 | |||
1663 | static int __init fd_probe_drives(void) | 1657 | static int __init fd_probe_drives(void) |
1664 | { | 1658 | { |
1665 | int drive,drives,nomem; | 1659 | int drive,drives,nomem; |
@@ -1845,4 +1839,18 @@ void cleanup_module(void) | |||
1845 | unregister_blkdev(FLOPPY_MAJOR, "fd"); | 1839 | unregister_blkdev(FLOPPY_MAJOR, "fd"); |
1846 | } | 1840 | } |
1847 | #endif | 1841 | #endif |
1842 | |||
1843 | #else | ||
1844 | static int __init amiga_floppy_setup (char *str) | ||
1845 | { | ||
1846 | int n; | ||
1847 | if (!MACH_IS_AMIGA) | ||
1848 | return 0; | ||
1849 | if (!get_option(&str, &n)) | ||
1850 | return 0; | ||
1851 | printk (KERN_INFO "amiflop: Setting default df0 to %x\n", n); | ||
1852 | fd_def_df0 = n; | ||
1853 | } | ||
1854 | |||
1855 | __setup("floppy=", amiga_floppy_setup); | ||
1848 | #endif | 1856 | #endif |
diff --git a/drivers/block/ataflop.c b/drivers/block/ataflop.c index 3aa68a5447d6..f8ce235ccfc3 100644 --- a/drivers/block/ataflop.c +++ b/drivers/block/ataflop.c | |||
@@ -1361,7 +1361,7 @@ static int floppy_revalidate(struct gendisk *disk) | |||
1361 | formats, for 'permanent user-defined' parameter: | 1361 | formats, for 'permanent user-defined' parameter: |
1362 | restore default_params[] here if flagged valid! */ | 1362 | restore default_params[] here if flagged valid! */ |
1363 | if (default_params[drive].blocks == 0) | 1363 | if (default_params[drive].blocks == 0) |
1364 | UDT = 0; | 1364 | UDT = NULL; |
1365 | else | 1365 | else |
1366 | UDT = &default_params[drive]; | 1366 | UDT = &default_params[drive]; |
1367 | } | 1367 | } |
@@ -1495,6 +1495,7 @@ static int fd_ioctl(struct inode *inode, struct file *filp, | |||
1495 | struct floppy_struct getprm; | 1495 | struct floppy_struct getprm; |
1496 | int settype; | 1496 | int settype; |
1497 | struct floppy_struct setprm; | 1497 | struct floppy_struct setprm; |
1498 | void __user *argp = (void __user *)param; | ||
1498 | 1499 | ||
1499 | switch (cmd) { | 1500 | switch (cmd) { |
1500 | case FDGETPRM: | 1501 | case FDGETPRM: |
@@ -1521,7 +1522,7 @@ static int fd_ioctl(struct inode *inode, struct file *filp, | |||
1521 | getprm.head = 2; | 1522 | getprm.head = 2; |
1522 | getprm.track = dtp->blocks/dtp->spt/2; | 1523 | getprm.track = dtp->blocks/dtp->spt/2; |
1523 | getprm.stretch = dtp->stretch; | 1524 | getprm.stretch = dtp->stretch; |
1524 | if (copy_to_user((void *)param, &getprm, sizeof(getprm))) | 1525 | if (copy_to_user(argp, &getprm, sizeof(getprm))) |
1525 | return -EFAULT; | 1526 | return -EFAULT; |
1526 | return 0; | 1527 | return 0; |
1527 | } | 1528 | } |
@@ -1540,7 +1541,7 @@ static int fd_ioctl(struct inode *inode, struct file *filp, | |||
1540 | /* get the parameters from user space */ | 1541 | /* get the parameters from user space */ |
1541 | if (floppy->ref != 1 && floppy->ref != -1) | 1542 | if (floppy->ref != 1 && floppy->ref != -1) |
1542 | return -EBUSY; | 1543 | return -EBUSY; |
1543 | if (copy_from_user(&setprm, (void *) param, sizeof(setprm))) | 1544 | if (copy_from_user(&setprm, argp, sizeof(setprm))) |
1544 | return -EFAULT; | 1545 | return -EFAULT; |
1545 | /* | 1546 | /* |
1546 | * first of all: check for floppy change and revalidate, | 1547 | * first of all: check for floppy change and revalidate, |
@@ -1647,7 +1648,7 @@ static int fd_ioctl(struct inode *inode, struct file *filp, | |||
1647 | case FDFMTTRK: | 1648 | case FDFMTTRK: |
1648 | if (floppy->ref != 1 && floppy->ref != -1) | 1649 | if (floppy->ref != 1 && floppy->ref != -1) |
1649 | return -EBUSY; | 1650 | return -EBUSY; |
1650 | if (copy_from_user(&fmt_desc, (void *) param, sizeof(fmt_desc))) | 1651 | if (copy_from_user(&fmt_desc, argp, sizeof(fmt_desc))) |
1651 | return -EFAULT; | 1652 | return -EFAULT; |
1652 | return do_format(drive, type, &fmt_desc); | 1653 | return do_format(drive, type, &fmt_desc); |
1653 | case FDCLRPRM: | 1654 | case FDCLRPRM: |
@@ -1950,14 +1951,20 @@ Enomem: | |||
1950 | return -ENOMEM; | 1951 | return -ENOMEM; |
1951 | } | 1952 | } |
1952 | 1953 | ||
1953 | 1954 | #ifndef MODULE | |
1954 | void __init atari_floppy_setup( char *str, int *ints ) | 1955 | static int __init atari_floppy_setup(char *str) |
1955 | { | 1956 | { |
1957 | int ints[3 + FD_MAX_UNITS]; | ||
1956 | int i; | 1958 | int i; |
1959 | |||
1960 | if (!MACH_IS_ATARI) | ||
1961 | return 0; | ||
1962 | |||
1963 | str = get_options(str, 3 + FD_MAX_UNITS, ints); | ||
1957 | 1964 | ||
1958 | if (ints[0] < 1) { | 1965 | if (ints[0] < 1) { |
1959 | printk(KERN_ERR "ataflop_setup: no arguments!\n" ); | 1966 | printk(KERN_ERR "ataflop_setup: no arguments!\n" ); |
1960 | return; | 1967 | return 0; |
1961 | } | 1968 | } |
1962 | else if (ints[0] > 2+FD_MAX_UNITS) { | 1969 | else if (ints[0] > 2+FD_MAX_UNITS) { |
1963 | printk(KERN_ERR "ataflop_setup: too many arguments\n" ); | 1970 | printk(KERN_ERR "ataflop_setup: too many arguments\n" ); |
@@ -1977,9 +1984,13 @@ void __init atari_floppy_setup( char *str, int *ints ) | |||
1977 | else | 1984 | else |
1978 | UserSteprate[i-3] = ints[i]; | 1985 | UserSteprate[i-3] = ints[i]; |
1979 | } | 1986 | } |
1987 | return 1; | ||
1980 | } | 1988 | } |
1981 | 1989 | ||
1982 | static void atari_floppy_exit(void) | 1990 | __setup("floppy=", atari_floppy_setup); |
1991 | #endif | ||
1992 | |||
1993 | static void __exit atari_floppy_exit(void) | ||
1983 | { | 1994 | { |
1984 | int i; | 1995 | int i; |
1985 | blk_unregister_region(MKDEV(FLOPPY_MAJOR, 0), 256); | 1996 | blk_unregister_region(MKDEV(FLOPPY_MAJOR, 0), 256); |