aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/floppy.c
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2010-03-10 18:20:58 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2010-03-12 18:52:30 -0500
commit74f63f469ed1cee8305840b7bbcee2f99797cd12 (patch)
tree080f826e32bdf5d1aede69990f261de6ba416721 /drivers/block/floppy.c
parent55eee80c6233c67217a6238dd94f1fc765c723d1 (diff)
drivers/block/floppy.c: convert int 1/0 to bool true/false
Various functions use int where bool is appropriate lock_fdc, wait_til_done, poll_drive, user_reset_fdc Convert to bool. 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/floppy.c')
-rw-r--r--drivers/block/floppy.c60
1 files changed, 30 insertions, 30 deletions
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c
index 4d0ac121b56f..028d7e4749d0 100644
--- a/drivers/block/floppy.c
+++ b/drivers/block/floppy.c
@@ -862,7 +862,7 @@ static void set_fdc(int drive)
862} 862}
863 863
864/* locks the driver */ 864/* locks the driver */
865static int _lock_fdc(int drive, int interruptible, int line) 865static int _lock_fdc(int drive, bool interruptible, int line)
866{ 866{
867 if (!usage_count) { 867 if (!usage_count) {
868 pr_err("Trying to lock fdc while usage count=0 at line %d\n", 868 pr_err("Trying to lock fdc while usage count=0 at line %d\n",
@@ -2021,7 +2021,7 @@ static struct cont_t intr_cont = {
2021 .done = (done_f)empty 2021 .done = (done_f)empty
2022}; 2022};
2023 2023
2024static int wait_til_done(void (*handler)(void), int interruptible) 2024static int wait_til_done(void (*handler)(void), bool interruptible)
2025{ 2025{
2026 int ret; 2026 int ret;
2027 2027
@@ -2247,7 +2247,7 @@ static int do_format(int drive, struct format_descr *tmp_format_req)
2247{ 2247{
2248 int ret; 2248 int ret;
2249 2249
2250 if (lock_fdc(drive, 1)) 2250 if (lock_fdc(drive, true))
2251 return -EINTR; 2251 return -EINTR;
2252 2252
2253 set_floppy(drive); 2253 set_floppy(drive);
@@ -2264,7 +2264,7 @@ static int do_format(int drive, struct format_descr *tmp_format_req)
2264 format_errors = 0; 2264 format_errors = 0;
2265 cont = &format_cont; 2265 cont = &format_cont;
2266 errors = &format_errors; 2266 errors = &format_errors;
2267 ret = wait_til_done(redo_format, 1); 2267 ret = wait_til_done(redo_format, true);
2268 if (ret == -EINTR) 2268 if (ret == -EINTR)
2269 return -EINTR; 2269 return -EINTR;
2270 process_fd_request(); 2270 process_fd_request();
@@ -2980,7 +2980,7 @@ static void do_fd_request(struct request_queue *q)
2980 is_alive("do fd request, old request running"); 2980 is_alive("do fd request, old request running");
2981 return; 2981 return;
2982 } 2982 }
2983 lock_fdc(MAXTIMEOUT, 0); 2983 lock_fdc(MAXTIMEOUT, false);
2984 process_fd_request(); 2984 process_fd_request();
2985 is_alive("do fd request"); 2985 is_alive("do fd request");
2986} 2986}
@@ -2992,7 +2992,7 @@ static struct cont_t poll_cont = {
2992 .done = generic_done 2992 .done = generic_done
2993}; 2993};
2994 2994
2995static int poll_drive(int interruptible, int flag) 2995static int poll_drive(bool interruptible, int flag)
2996{ 2996{
2997 /* no auto-sense, just clear dcl */ 2997 /* no auto-sense, just clear dcl */
2998 raw_cmd = &default_raw_cmd; 2998 raw_cmd = &default_raw_cmd;
@@ -3023,7 +3023,7 @@ static struct cont_t reset_cont = {
3023 .done = generic_done 3023 .done = generic_done
3024}; 3024};
3025 3025
3026static int user_reset_fdc(int drive, int arg, int interruptible) 3026static int user_reset_fdc(int drive, int arg, bool interruptible)
3027{ 3027{
3028 int ret; 3028 int ret;
3029 3029
@@ -3265,7 +3265,7 @@ static int raw_cmd_ioctl(int cmd, void __user *param)
3265 3265
3266 raw_cmd = my_raw_cmd; 3266 raw_cmd = my_raw_cmd;
3267 cont = &raw_cmd_cont; 3267 cont = &raw_cmd_cont;
3268 ret = wait_til_done(floppy_start, 1); 3268 ret = wait_til_done(floppy_start, true);
3269 debug_dcl(DP->flags, "calling disk change from raw_cmd ioctl\n"); 3269 debug_dcl(DP->flags, "calling disk change from raw_cmd ioctl\n");
3270 3270
3271 if (ret != -EINTR && FDCS->reset) 3271 if (ret != -EINTR && FDCS->reset)
@@ -3305,7 +3305,7 @@ static inline int set_geometry(unsigned int cmd, struct floppy_struct *g,
3305 if (!capable(CAP_SYS_ADMIN)) 3305 if (!capable(CAP_SYS_ADMIN))
3306 return -EPERM; 3306 return -EPERM;
3307 mutex_lock(&open_lock); 3307 mutex_lock(&open_lock);
3308 if (lock_fdc(drive, 1)) { 3308 if (lock_fdc(drive, true)) {
3309 mutex_unlock(&open_lock); 3309 mutex_unlock(&open_lock);
3310 return -EINTR; 3310 return -EINTR;
3311 } 3311 }
@@ -3325,12 +3325,12 @@ static inline int set_geometry(unsigned int cmd, struct floppy_struct *g,
3325 } else { 3325 } else {
3326 int oldStretch; 3326 int oldStretch;
3327 3327
3328 if (lock_fdc(drive, 1)) 3328 if (lock_fdc(drive, true))
3329 return -EINTR; 3329 return -EINTR;
3330 if (cmd != FDDEFPRM) { 3330 if (cmd != FDDEFPRM) {
3331 /* notice a disk change immediately, else 3331 /* notice a disk change immediately, else
3332 * we lose our settings immediately*/ 3332 * we lose our settings immediately*/
3333 if (poll_drive(1, FD_RAW_NEED_DISK) == -EINTR) 3333 if (poll_drive(true, FD_RAW_NEED_DISK) == -EINTR)
3334 return -EINTR; 3334 return -EINTR;
3335 } 3335 }
3336 oldStretch = g->stretch; 3336 oldStretch = g->stretch;
@@ -3411,9 +3411,9 @@ static int get_floppy_geometry(int drive, int type, struct floppy_struct **g)
3411 if (type) 3411 if (type)
3412 *g = &floppy_type[type]; 3412 *g = &floppy_type[type];
3413 else { 3413 else {
3414 if (lock_fdc(drive, 0)) 3414 if (lock_fdc(drive, false))
3415 return -EINTR; 3415 return -EINTR;
3416 if (poll_drive(0, 0) == -EINTR) 3416 if (poll_drive(false, 0) == -EINTR)
3417 return -EINTR; 3417 return -EINTR;
3418 process_fd_request(); 3418 process_fd_request();
3419 *g = current_type[drive]; 3419 *g = current_type[drive];
@@ -3497,7 +3497,7 @@ static int fd_ioctl(struct block_device *bdev, fmode_t mode, unsigned int cmd,
3497 if (UDRS->fd_ref != 1) 3497 if (UDRS->fd_ref != 1)
3498 /* somebody else has this drive open */ 3498 /* somebody else has this drive open */
3499 return -EBUSY; 3499 return -EBUSY;
3500 if (lock_fdc(drive, 1)) 3500 if (lock_fdc(drive, true))
3501 return -EINTR; 3501 return -EINTR;
3502 3502
3503 /* do the actual eject. Fails on 3503 /* do the actual eject. Fails on
@@ -3509,7 +3509,7 @@ static int fd_ioctl(struct block_device *bdev, fmode_t mode, unsigned int cmd,
3509 process_fd_request(); 3509 process_fd_request();
3510 return ret; 3510 return ret;
3511 case FDCLRPRM: 3511 case FDCLRPRM:
3512 if (lock_fdc(drive, 1)) 3512 if (lock_fdc(drive, true))
3513 return -EINTR; 3513 return -EINTR;
3514 current_type[drive] = NULL; 3514 current_type[drive] = NULL;
3515 floppy_sizes[drive] = MAX_DISK_SIZE << 1; 3515 floppy_sizes[drive] = MAX_DISK_SIZE << 1;
@@ -3532,9 +3532,9 @@ static int fd_ioctl(struct block_device *bdev, fmode_t mode, unsigned int cmd,
3532 UDP->flags &= ~FTD_MSG; 3532 UDP->flags &= ~FTD_MSG;
3533 return 0; 3533 return 0;
3534 case FDFMTBEG: 3534 case FDFMTBEG:
3535 if (lock_fdc(drive, 1)) 3535 if (lock_fdc(drive, true))
3536 return -EINTR; 3536 return -EINTR;
3537 if (poll_drive(1, FD_RAW_NEED_DISK) == -EINTR) 3537 if (poll_drive(true, FD_RAW_NEED_DISK) == -EINTR)
3538 return -EINTR; 3538 return -EINTR;
3539 ret = UDRS->flags; 3539 ret = UDRS->flags;
3540 process_fd_request(); 3540 process_fd_request();
@@ -3549,7 +3549,7 @@ static int fd_ioctl(struct block_device *bdev, fmode_t mode, unsigned int cmd,
3549 return do_format(drive, &inparam.f); 3549 return do_format(drive, &inparam.f);
3550 case FDFMTEND: 3550 case FDFMTEND:
3551 case FDFLUSH: 3551 case FDFLUSH:
3552 if (lock_fdc(drive, 1)) 3552 if (lock_fdc(drive, true))
3553 return -EINTR; 3553 return -EINTR;
3554 return invalidate_drive(bdev); 3554 return invalidate_drive(bdev);
3555 case FDSETEMSGTRESH: 3555 case FDSETEMSGTRESH:
@@ -3572,9 +3572,9 @@ static int fd_ioctl(struct block_device *bdev, fmode_t mode, unsigned int cmd,
3572 outparam = (const char *)UDP; 3572 outparam = (const char *)UDP;
3573 break; 3573 break;
3574 case FDPOLLDRVSTAT: 3574 case FDPOLLDRVSTAT:
3575 if (lock_fdc(drive, 1)) 3575 if (lock_fdc(drive, true))
3576 return -EINTR; 3576 return -EINTR;
3577 if (poll_drive(1, FD_RAW_NEED_DISK) == -EINTR) 3577 if (poll_drive(true, FD_RAW_NEED_DISK) == -EINTR)
3578 return -EINTR; 3578 return -EINTR;
3579 process_fd_request(); 3579 process_fd_request();
3580 /* fall through */ 3580 /* fall through */
@@ -3582,7 +3582,7 @@ static int fd_ioctl(struct block_device *bdev, fmode_t mode, unsigned int cmd,
3582 outparam = (const char *)UDRS; 3582 outparam = (const char *)UDRS;
3583 break; 3583 break;
3584 case FDRESET: 3584 case FDRESET:
3585 return user_reset_fdc(drive, (int)param, 1); 3585 return user_reset_fdc(drive, (int)param, true);
3586 case FDGETFDCSTAT: 3586 case FDGETFDCSTAT:
3587 outparam = (const char *)UFDCS; 3587 outparam = (const char *)UFDCS;
3588 break; 3588 break;
@@ -3595,7 +3595,7 @@ static int fd_ioctl(struct block_device *bdev, fmode_t mode, unsigned int cmd,
3595 case FDRAWCMD: 3595 case FDRAWCMD:
3596 if (type) 3596 if (type)
3597 return -EINVAL; 3597 return -EINVAL;
3598 if (lock_fdc(drive, 1)) 3598 if (lock_fdc(drive, true))
3599 return -EINTR; 3599 return -EINTR;
3600 set_floppy(drive); 3600 set_floppy(drive);
3601 i = raw_cmd_ioctl(cmd, (void __user *)param); 3601 i = raw_cmd_ioctl(cmd, (void __user *)param);
@@ -3604,7 +3604,7 @@ static int fd_ioctl(struct block_device *bdev, fmode_t mode, unsigned int cmd,
3604 process_fd_request(); 3604 process_fd_request();
3605 return i; 3605 return i;
3606 case FDTWADDLE: 3606 case FDTWADDLE:
3607 if (lock_fdc(drive, 1)) 3607 if (lock_fdc(drive, true))
3608 return -EINTR; 3608 return -EINTR;
3609 twaddle(); 3609 twaddle();
3610 process_fd_request(); 3610 process_fd_request();
@@ -3803,8 +3803,8 @@ static int check_floppy_change(struct gendisk *disk)
3803 return 1; 3803 return 1;
3804 3804
3805 if (time_after(jiffies, UDRS->last_checked + UDP->checkfreq)) { 3805 if (time_after(jiffies, UDRS->last_checked + UDP->checkfreq)) {
3806 lock_fdc(drive, 0); 3806 lock_fdc(drive, false);
3807 poll_drive(0, 0); 3807 poll_drive(false, 0);
3808 process_fd_request(); 3808 process_fd_request();
3809 } 3809 }
3810 3810
@@ -3887,7 +3887,7 @@ static int floppy_revalidate(struct gendisk *disk)
3887 pr_info("VFS: revalidate called on non-open device.\n"); 3887 pr_info("VFS: revalidate called on non-open device.\n");
3888 return -EFAULT; 3888 return -EFAULT;
3889 } 3889 }
3890 lock_fdc(drive, 0); 3890 lock_fdc(drive, false);
3891 cf = (test_bit(FD_DISK_CHANGED_BIT, &UDRS->flags) || 3891 cf = (test_bit(FD_DISK_CHANGED_BIT, &UDRS->flags) ||
3892 test_bit(FD_VERIFY_BIT, &UDRS->flags)); 3892 test_bit(FD_VERIFY_BIT, &UDRS->flags));
3893 if (!(cf || test_bit(drive, &fake_change) || NO_GEOM)) { 3893 if (!(cf || test_bit(drive, &fake_change) || NO_GEOM)) {
@@ -3907,7 +3907,7 @@ static int floppy_revalidate(struct gendisk *disk)
3907 res = __floppy_read_block_0(opened_bdev[drive]); 3907 res = __floppy_read_block_0(opened_bdev[drive]);
3908 } else { 3908 } else {
3909 if (cf) 3909 if (cf)
3910 poll_drive(0, FD_RAW_NEED_DISK); 3910 poll_drive(false, FD_RAW_NEED_DISK);
3911 process_fd_request(); 3911 process_fd_request();
3912 } 3912 }
3913 } 3913 }
@@ -4164,7 +4164,7 @@ static int floppy_resume(struct device *dev)
4164 4164
4165 for (fdc = 0; fdc < N_FDC; fdc++) 4165 for (fdc = 0; fdc < N_FDC; fdc++)
4166 if (FDCS->address != -1) 4166 if (FDCS->address != -1)
4167 user_reset_fdc(-1, FD_RESET_ALWAYS, 0); 4167 user_reset_fdc(-1, FD_RESET_ALWAYS, false);
4168 4168
4169 return 0; 4169 return 0;
4170} 4170}
@@ -4311,7 +4311,7 @@ static int __init floppy_init(void)
4311 if (FDCS->address == -1) 4311 if (FDCS->address == -1)
4312 continue; 4312 continue;
4313 FDCS->rawcmd = 2; 4313 FDCS->rawcmd = 2;
4314 if (user_reset_fdc(-1, FD_RESET_ALWAYS, 0)) { 4314 if (user_reset_fdc(-1, FD_RESET_ALWAYS, false)) {
4315 /* free ioports reserved by floppy_grab_irq_and_dma() */ 4315 /* free ioports reserved by floppy_grab_irq_and_dma() */
4316 floppy_release_regions(fdc); 4316 floppy_release_regions(fdc);
4317 FDCS->address = -1; 4317 FDCS->address = -1;
@@ -4334,7 +4334,7 @@ static int __init floppy_init(void)
4334 * properly, so force a reset for the standard FDC clones, 4334 * properly, so force a reset for the standard FDC clones,
4335 * to avoid interrupt garbage. 4335 * to avoid interrupt garbage.
4336 */ 4336 */
4337 user_reset_fdc(-1, FD_RESET_ALWAYS, 0); 4337 user_reset_fdc(-1, FD_RESET_ALWAYS, false);
4338 } 4338 }
4339 fdc = 0; 4339 fdc = 0;
4340 del_timer(&fd_timeout); 4340 del_timer(&fd_timeout);