aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2010-03-10 18:20:53 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2010-03-12 18:52:29 -0500
commit52a0d61f64123ab758d8b8cc8f8ca521733d2f32 (patch)
tree8dd686fbafaf96cc34c6407f523da965c990eb73 /drivers/block
parenta0a52d67de6da21db0e549e38749b7a00029fea3 (diff)
drivers/block/floppy.c: remove macro LOCK_FDC
Macros with hidden returns aren't nice. Signed-off-by: Joe 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: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/block')
-rw-r--r--drivers/block/floppy.c43
1 files changed, 26 insertions, 17 deletions
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c
index 491f21ae83b6..50bd9e9370dd 100644
--- a/drivers/block/floppy.c
+++ b/drivers/block/floppy.c
@@ -908,10 +908,6 @@ static int _lock_fdc(int drive, int interruptible, int line)
908#define lock_fdc(drive, interruptible) \ 908#define lock_fdc(drive, interruptible) \
909 _lock_fdc(drive, interruptible, __LINE__) 909 _lock_fdc(drive, interruptible, __LINE__)
910 910
911#define LOCK_FDC(drive, interruptible) \
912 if (lock_fdc(drive, interruptible)) \
913 return -EINTR;
914
915/* unlocks the driver */ 911/* unlocks the driver */
916static inline void unlock_fdc(void) 912static inline void unlock_fdc(void)
917{ 913{
@@ -2276,7 +2272,9 @@ static int do_format(int drive, struct format_descr *tmp_format_req)
2276{ 2272{
2277 int ret; 2273 int ret;
2278 2274
2279 LOCK_FDC(drive, 1); 2275 if (lock_fdc(drive, 1))
2276 return -EINTR;
2277
2280 set_floppy(drive); 2278 set_floppy(drive);
2281 if (!_floppy || 2279 if (!_floppy ||
2282 _floppy->track > DP->tracks || 2280 _floppy->track > DP->tracks ||
@@ -3056,8 +3054,9 @@ static int user_reset_fdc(int drive, int arg, int interruptible)
3056{ 3054{
3057 int ret; 3055 int ret;
3058 3056
3059 ret = 0; 3057 if (lock_fdc(drive, interruptible))
3060 LOCK_FDC(drive, interruptible); 3058 return -EINTR;
3059
3061 if (arg == FD_RESET_ALWAYS) 3060 if (arg == FD_RESET_ALWAYS)
3062 FDCS->reset = 1; 3061 FDCS->reset = 1;
3063 if (FDCS->reset) { 3062 if (FDCS->reset) {
@@ -3065,7 +3064,7 @@ static int user_reset_fdc(int drive, int arg, int interruptible)
3065 WAIT(reset_fdc); 3064 WAIT(reset_fdc);
3066 } 3065 }
3067 process_fd_request(); 3066 process_fd_request();
3068 return ret; 3067 return 0;
3069} 3068}
3070 3069
3071/* 3070/*
@@ -3352,7 +3351,9 @@ static inline int set_geometry(unsigned int cmd, struct floppy_struct *g,
3352 mutex_unlock(&open_lock); 3351 mutex_unlock(&open_lock);
3353 } else { 3352 } else {
3354 int oldStretch; 3353 int oldStretch;
3355 LOCK_FDC(drive, 1); 3354
3355 if (lock_fdc(drive, 1))
3356 return -EINTR;
3356 if (cmd != FDDEFPRM) 3357 if (cmd != FDDEFPRM)
3357 /* notice a disk change immediately, else 3358 /* notice a disk change immediately, else
3358 * we lose our settings immediately*/ 3359 * we lose our settings immediately*/
@@ -3435,7 +3436,8 @@ static int get_floppy_geometry(int drive, int type, struct floppy_struct **g)
3435 if (type) 3436 if (type)
3436 *g = &floppy_type[type]; 3437 *g = &floppy_type[type];
3437 else { 3438 else {
3438 LOCK_FDC(drive, 0); 3439 if (lock_fdc(drive, 0))
3440 return -EINTR;
3439 CALL(poll_drive(0, 0)); 3441 CALL(poll_drive(0, 0));
3440 process_fd_request(); 3442 process_fd_request();
3441 *g = current_type[drive]; 3443 *g = current_type[drive];
@@ -3514,7 +3516,8 @@ static int fd_ioctl(struct block_device *bdev, fmode_t mode, unsigned int cmd,
3514 if (UDRS->fd_ref != 1) 3516 if (UDRS->fd_ref != 1)
3515 /* somebody else has this drive open */ 3517 /* somebody else has this drive open */
3516 return -EBUSY; 3518 return -EBUSY;
3517 LOCK_FDC(drive, 1); 3519 if (lock_fdc(drive, 1))
3520 return -EINTR;
3518 3521
3519 /* do the actual eject. Fails on 3522 /* do the actual eject. Fails on
3520 * non-Sparc architectures */ 3523 * non-Sparc architectures */
@@ -3525,7 +3528,8 @@ static int fd_ioctl(struct block_device *bdev, fmode_t mode, unsigned int cmd,
3525 process_fd_request(); 3528 process_fd_request();
3526 return ret; 3529 return ret;
3527 case FDCLRPRM: 3530 case FDCLRPRM:
3528 LOCK_FDC(drive, 1); 3531 if (lock_fdc(drive, 1))
3532 return -EINTR;
3529 current_type[drive] = NULL; 3533 current_type[drive] = NULL;
3530 floppy_sizes[drive] = MAX_DISK_SIZE << 1; 3534 floppy_sizes[drive] = MAX_DISK_SIZE << 1;
3531 UDRS->keep_data = 0; 3535 UDRS->keep_data = 0;
@@ -3545,7 +3549,8 @@ static int fd_ioctl(struct block_device *bdev, fmode_t mode, unsigned int cmd,
3545 UDP->flags &= ~FTD_MSG; 3549 UDP->flags &= ~FTD_MSG;
3546 return 0; 3550 return 0;
3547 case FDFMTBEG: 3551 case FDFMTBEG:
3548 LOCK_FDC(drive, 1); 3552 if (lock_fdc(drive, 1))
3553 return -EINTR;
3549 CALL(poll_drive(1, FD_RAW_NEED_DISK)); 3554 CALL(poll_drive(1, FD_RAW_NEED_DISK));
3550 ret = UDRS->flags; 3555 ret = UDRS->flags;
3551 process_fd_request(); 3556 process_fd_request();
@@ -3560,7 +3565,8 @@ static int fd_ioctl(struct block_device *bdev, fmode_t mode, unsigned int cmd,
3560 return do_format(drive, &inparam.f); 3565 return do_format(drive, &inparam.f);
3561 case FDFMTEND: 3566 case FDFMTEND:
3562 case FDFLUSH: 3567 case FDFLUSH:
3563 LOCK_FDC(drive, 1); 3568 if (lock_fdc(drive, 1))
3569 return -EINTR;
3564 return invalidate_drive(bdev); 3570 return invalidate_drive(bdev);
3565 case FDSETEMSGTRESH: 3571 case FDSETEMSGTRESH:
3566 UDP->max_errors.reporting = (unsigned short)(param & 0x0f); 3572 UDP->max_errors.reporting = (unsigned short)(param & 0x0f);
@@ -3582,7 +3588,8 @@ static int fd_ioctl(struct block_device *bdev, fmode_t mode, unsigned int cmd,
3582 outparam = (const char *)UDP; 3588 outparam = (const char *)UDP;
3583 break; 3589 break;
3584 case FDPOLLDRVSTAT: 3590 case FDPOLLDRVSTAT:
3585 LOCK_FDC(drive, 1); 3591 if (lock_fdc(drive, 1))
3592 return -EINTR;
3586 CALL(poll_drive(1, FD_RAW_NEED_DISK)); 3593 CALL(poll_drive(1, FD_RAW_NEED_DISK));
3587 process_fd_request(); 3594 process_fd_request();
3588 /* fall through */ 3595 /* fall through */
@@ -3603,13 +3610,15 @@ static int fd_ioctl(struct block_device *bdev, fmode_t mode, unsigned int cmd,
3603 case FDRAWCMD: 3610 case FDRAWCMD:
3604 if (type) 3611 if (type)
3605 return -EINVAL; 3612 return -EINVAL;
3606 LOCK_FDC(drive, 1); 3613 if (lock_fdc(drive, 1))
3614 return -EINTR;
3607 set_floppy(drive); 3615 set_floppy(drive);
3608 CALL(i = raw_cmd_ioctl(cmd, (void __user *)param)); 3616 CALL(i = raw_cmd_ioctl(cmd, (void __user *)param));
3609 process_fd_request(); 3617 process_fd_request();
3610 return i; 3618 return i;
3611 case FDTWADDLE: 3619 case FDTWADDLE:
3612 LOCK_FDC(drive, 1); 3620 if (lock_fdc(drive, 1))
3621 return -EINTR;
3613 twaddle(); 3622 twaddle();
3614 process_fd_request(); 3623 process_fd_request();
3615 return 0; 3624 return 0;