Commit da273653 authored by Joe Perches's avatar Joe Perches Committed by Linus Torvalds

drivers/block/floppy.c: remove IN/OUT macros, indent switch/case

Remove ugly IN/OUT macros, use direct case and code
Add missing semicolon after ECALL
Signed-off-by: default avatarJoe Perches <joe@perches.com>
Cc: Stephen Hemminger <shemminger@vyatta.com>
Cc: Jens Axboe <jens.axboe@oracle.com>
Cc: Marcin Slusarz <marcin.slusarz@gmail.com>
Cc: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 96534f1d
...@@ -3466,8 +3466,6 @@ static int fd_ioctl(struct block_device *bdev, fmode_t mode, unsigned int cmd, ...@@ -3466,8 +3466,6 @@ static int fd_ioctl(struct block_device *bdev, fmode_t mode, unsigned int cmd,
unsigned long param) unsigned long param)
{ {
#define FD_IOCTL_ALLOWED (mode & (FMODE_WRITE|FMODE_WRITE_IOCTL)) #define FD_IOCTL_ALLOWED (mode & (FMODE_WRITE|FMODE_WRITE_IOCTL))
#define OUT(c,x) case c: outparam = (const char *) (x); break
#define IN(c,x,tag) case c: *(x) = inparam. tag ; return 0
int drive = (long)bdev->bd_disk->private_data; int drive = (long)bdev->bd_disk->private_data;
int type = ITYPE(UDRS->fd_device); int type = ITYPE(UDRS->fd_device);
...@@ -3509,7 +3507,7 @@ static int fd_ioctl(struct block_device *bdev, fmode_t mode, unsigned int cmd, ...@@ -3509,7 +3507,7 @@ static int fd_ioctl(struct block_device *bdev, fmode_t mode, unsigned int cmd,
/* copyin */ /* copyin */
memset(&inparam, 0, sizeof(inparam)); memset(&inparam, 0, sizeof(inparam));
if (_IOC_DIR(cmd) & _IOC_WRITE) if (_IOC_DIR(cmd) & _IOC_WRITE)
ECALL(fd_copyin((void __user *)param, &inparam, size)) ECALL(fd_copyin((void __user *)param, &inparam, size));
switch (cmd) { switch (cmd) {
case FDEJECT: case FDEJECT:
...@@ -3534,21 +3532,18 @@ static int fd_ioctl(struct block_device *bdev, fmode_t mode, unsigned int cmd, ...@@ -3534,21 +3532,18 @@ static int fd_ioctl(struct block_device *bdev, fmode_t mode, unsigned int cmd,
return invalidate_drive(bdev); return invalidate_drive(bdev);
case FDSETPRM: case FDSETPRM:
case FDDEFPRM: case FDDEFPRM:
return set_geometry(cmd, &inparam.g, return set_geometry(cmd, &inparam.g, drive, type, bdev);
drive, type, bdev);
case FDGETPRM: case FDGETPRM:
ECALL(get_floppy_geometry(drive, type, ECALL(get_floppy_geometry(drive, type,
(struct floppy_struct **) (struct floppy_struct **)
&outparam)); &outparam));
break; break;
case FDMSGON: case FDMSGON:
UDP->flags |= FTD_MSG; UDP->flags |= FTD_MSG;
return 0; return 0;
case FDMSGOFF: case FDMSGOFF:
UDP->flags &= ~FTD_MSG; UDP->flags &= ~FTD_MSG;
return 0; return 0;
case FDFMTBEG: case FDFMTBEG:
LOCK_FDC(drive, 1); LOCK_FDC(drive, 1);
CALL(poll_drive(1, FD_RAW_NEED_DISK)); CALL(poll_drive(1, FD_RAW_NEED_DISK));
...@@ -3567,39 +3562,44 @@ static int fd_ioctl(struct block_device *bdev, fmode_t mode, unsigned int cmd, ...@@ -3567,39 +3562,44 @@ static int fd_ioctl(struct block_device *bdev, fmode_t mode, unsigned int cmd,
case FDFLUSH: case FDFLUSH:
LOCK_FDC(drive, 1); LOCK_FDC(drive, 1);
return invalidate_drive(bdev); return invalidate_drive(bdev);
case FDSETEMSGTRESH: case FDSETEMSGTRESH:
UDP->max_errors.reporting = UDP->max_errors.reporting = (unsigned short)(param & 0x0f);
(unsigned short)(param & 0x0f);
return 0; return 0;
OUT(FDGETMAXERRS, &UDP->max_errors); case FDGETMAXERRS:
IN(FDSETMAXERRS, &UDP->max_errors, max_errors); outparam = (const char *)&UDP->max_errors;
break;
case FDSETMAXERRS:
UDP->max_errors = inparam.max_errors;
break;
case FDGETDRVTYP: case FDGETDRVTYP:
outparam = drive_name(type, drive); outparam = drive_name(type, drive);
SUPBOUND(size, strlen(outparam) + 1); SUPBOUND(size, strlen(outparam) + 1);
break; break;
case FDSETDRVPRM:
IN(FDSETDRVPRM, UDP, dp); *UDP = inparam.dp;
OUT(FDGETDRVPRM, UDP); break;
case FDGETDRVPRM:
outparam = (const char *)UDP;
break;
case FDPOLLDRVSTAT: case FDPOLLDRVSTAT:
LOCK_FDC(drive, 1); LOCK_FDC(drive, 1);
CALL(poll_drive(1, FD_RAW_NEED_DISK)); CALL(poll_drive(1, FD_RAW_NEED_DISK));
process_fd_request(); process_fd_request();
/* fall through */ /* fall through */
OUT(FDGETDRVSTAT, UDRS); case FDGETDRVSTAT:
outparam = (const char *)UDRS;
break;
case FDRESET: case FDRESET:
return user_reset_fdc(drive, (int)param, 1); return user_reset_fdc(drive, (int)param, 1);
case FDGETFDCSTAT:
OUT(FDGETFDCSTAT, UFDCS); outparam = (const char *)UFDCS;
break;
case FDWERRORCLR: case FDWERRORCLR:
memset(UDRWE, 0, sizeof(*UDRWE)); memset(UDRWE, 0, sizeof(*UDRWE));
return 0; return 0;
OUT(FDWERRORGET, UDRWE); case FDWERRORGET:
outparam = (const char *)UDRWE;
break;
case FDRAWCMD: case FDRAWCMD:
if (type) if (type)
return -EINVAL; return -EINVAL;
...@@ -3608,23 +3608,19 @@ static int fd_ioctl(struct block_device *bdev, fmode_t mode, unsigned int cmd, ...@@ -3608,23 +3608,19 @@ static int fd_ioctl(struct block_device *bdev, fmode_t mode, unsigned int cmd,
CALL(i = raw_cmd_ioctl(cmd, (void __user *)param)); CALL(i = raw_cmd_ioctl(cmd, (void __user *)param));
process_fd_request(); process_fd_request();
return i; return i;
case FDTWADDLE: case FDTWADDLE:
LOCK_FDC(drive, 1); LOCK_FDC(drive, 1);
twaddle(); twaddle();
process_fd_request(); process_fd_request();
return 0; return 0;
default: default:
return -EINVAL; return -EINVAL;
} }
if (_IOC_DIR(cmd) & _IOC_READ) if (_IOC_DIR(cmd) & _IOC_READ)
return fd_copyout((void __user *)param, outparam, size); return fd_copyout((void __user *)param, outparam, size);
else
return 0; return 0;
#undef OUT
#undef IN
} }
static void __init config_types(void) static void __init config_types(void)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment