Commit 74f63f46 authored by Joe Perches's avatar Joe Perches Committed by Linus Torvalds

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: 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 55eee80c
...@@ -862,7 +862,7 @@ static void set_fdc(int drive) ...@@ -862,7 +862,7 @@ static void set_fdc(int drive)
} }
/* locks the driver */ /* locks the driver */
static int _lock_fdc(int drive, int interruptible, int line) static int _lock_fdc(int drive, bool interruptible, int line)
{ {
if (!usage_count) { if (!usage_count) {
pr_err("Trying to lock fdc while usage count=0 at line %d\n", 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,7 +2021,7 @@ static struct cont_t intr_cont = {
.done = (done_f)empty .done = (done_f)empty
}; };
static int wait_til_done(void (*handler)(void), int interruptible) static int wait_til_done(void (*handler)(void), bool interruptible)
{ {
int ret; int ret;
...@@ -2247,7 +2247,7 @@ static int do_format(int drive, struct format_descr *tmp_format_req) ...@@ -2247,7 +2247,7 @@ static int do_format(int drive, struct format_descr *tmp_format_req)
{ {
int ret; int ret;
if (lock_fdc(drive, 1)) if (lock_fdc(drive, true))
return -EINTR; return -EINTR;
set_floppy(drive); set_floppy(drive);
...@@ -2264,7 +2264,7 @@ static int do_format(int drive, struct format_descr *tmp_format_req) ...@@ -2264,7 +2264,7 @@ static int do_format(int drive, struct format_descr *tmp_format_req)
format_errors = 0; format_errors = 0;
cont = &format_cont; cont = &format_cont;
errors = &format_errors; errors = &format_errors;
ret = wait_til_done(redo_format, 1); ret = wait_til_done(redo_format, true);
if (ret == -EINTR) if (ret == -EINTR)
return -EINTR; return -EINTR;
process_fd_request(); process_fd_request();
...@@ -2980,7 +2980,7 @@ static void do_fd_request(struct request_queue *q) ...@@ -2980,7 +2980,7 @@ static void do_fd_request(struct request_queue *q)
is_alive("do fd request, old request running"); is_alive("do fd request, old request running");
return; return;
} }
lock_fdc(MAXTIMEOUT, 0); lock_fdc(MAXTIMEOUT, false);
process_fd_request(); process_fd_request();
is_alive("do fd request"); is_alive("do fd request");
} }
...@@ -2992,7 +2992,7 @@ static struct cont_t poll_cont = { ...@@ -2992,7 +2992,7 @@ static struct cont_t poll_cont = {
.done = generic_done .done = generic_done
}; };
static int poll_drive(int interruptible, int flag) static int poll_drive(bool interruptible, int flag)
{ {
/* no auto-sense, just clear dcl */ /* no auto-sense, just clear dcl */
raw_cmd = &default_raw_cmd; raw_cmd = &default_raw_cmd;
...@@ -3023,7 +3023,7 @@ static struct cont_t reset_cont = { ...@@ -3023,7 +3023,7 @@ static struct cont_t reset_cont = {
.done = generic_done .done = generic_done
}; };
static int user_reset_fdc(int drive, int arg, int interruptible) static int user_reset_fdc(int drive, int arg, bool interruptible)
{ {
int ret; int ret;
...@@ -3265,7 +3265,7 @@ static int raw_cmd_ioctl(int cmd, void __user *param) ...@@ -3265,7 +3265,7 @@ static int raw_cmd_ioctl(int cmd, void __user *param)
raw_cmd = my_raw_cmd; raw_cmd = my_raw_cmd;
cont = &raw_cmd_cont; cont = &raw_cmd_cont;
ret = wait_til_done(floppy_start, 1); ret = wait_til_done(floppy_start, true);
debug_dcl(DP->flags, "calling disk change from raw_cmd ioctl\n"); debug_dcl(DP->flags, "calling disk change from raw_cmd ioctl\n");
if (ret != -EINTR && FDCS->reset) if (ret != -EINTR && FDCS->reset)
...@@ -3305,7 +3305,7 @@ static inline int set_geometry(unsigned int cmd, struct floppy_struct *g, ...@@ -3305,7 +3305,7 @@ static inline int set_geometry(unsigned int cmd, struct floppy_struct *g,
if (!capable(CAP_SYS_ADMIN)) if (!capable(CAP_SYS_ADMIN))
return -EPERM; return -EPERM;
mutex_lock(&open_lock); mutex_lock(&open_lock);
if (lock_fdc(drive, 1)) { if (lock_fdc(drive, true)) {
mutex_unlock(&open_lock); mutex_unlock(&open_lock);
return -EINTR; return -EINTR;
} }
...@@ -3325,12 +3325,12 @@ static inline int set_geometry(unsigned int cmd, struct floppy_struct *g, ...@@ -3325,12 +3325,12 @@ static inline int set_geometry(unsigned int cmd, struct floppy_struct *g,
} else { } else {
int oldStretch; int oldStretch;
if (lock_fdc(drive, 1)) if (lock_fdc(drive, true))
return -EINTR; return -EINTR;
if (cmd != FDDEFPRM) { if (cmd != FDDEFPRM) {
/* notice a disk change immediately, else /* notice a disk change immediately, else
* we lose our settings immediately*/ * we lose our settings immediately*/
if (poll_drive(1, FD_RAW_NEED_DISK) == -EINTR) if (poll_drive(true, FD_RAW_NEED_DISK) == -EINTR)
return -EINTR; return -EINTR;
} }
oldStretch = g->stretch; oldStretch = g->stretch;
...@@ -3411,9 +3411,9 @@ static int get_floppy_geometry(int drive, int type, struct floppy_struct **g) ...@@ -3411,9 +3411,9 @@ static int get_floppy_geometry(int drive, int type, struct floppy_struct **g)
if (type) if (type)
*g = &floppy_type[type]; *g = &floppy_type[type];
else { else {
if (lock_fdc(drive, 0)) if (lock_fdc(drive, false))
return -EINTR; return -EINTR;
if (poll_drive(0, 0) == -EINTR) if (poll_drive(false, 0) == -EINTR)
return -EINTR; return -EINTR;
process_fd_request(); process_fd_request();
*g = current_type[drive]; *g = current_type[drive];
...@@ -3497,7 +3497,7 @@ static int fd_ioctl(struct block_device *bdev, fmode_t mode, unsigned int cmd, ...@@ -3497,7 +3497,7 @@ static int fd_ioctl(struct block_device *bdev, fmode_t mode, unsigned int cmd,
if (UDRS->fd_ref != 1) if (UDRS->fd_ref != 1)
/* somebody else has this drive open */ /* somebody else has this drive open */
return -EBUSY; return -EBUSY;
if (lock_fdc(drive, 1)) if (lock_fdc(drive, true))
return -EINTR; return -EINTR;
/* do the actual eject. Fails on /* 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,7 +3509,7 @@ static int fd_ioctl(struct block_device *bdev, fmode_t mode, unsigned int cmd,
process_fd_request(); process_fd_request();
return ret; return ret;
case FDCLRPRM: case FDCLRPRM:
if (lock_fdc(drive, 1)) if (lock_fdc(drive, true))
return -EINTR; return -EINTR;
current_type[drive] = NULL; current_type[drive] = NULL;
floppy_sizes[drive] = MAX_DISK_SIZE << 1; 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,9 +3532,9 @@ static int fd_ioctl(struct block_device *bdev, fmode_t mode, unsigned int cmd,
UDP->flags &= ~FTD_MSG; UDP->flags &= ~FTD_MSG;
return 0; return 0;
case FDFMTBEG: case FDFMTBEG:
if (lock_fdc(drive, 1)) if (lock_fdc(drive, true))
return -EINTR; return -EINTR;
if (poll_drive(1, FD_RAW_NEED_DISK) == -EINTR) if (poll_drive(true, FD_RAW_NEED_DISK) == -EINTR)
return -EINTR; return -EINTR;
ret = UDRS->flags; ret = UDRS->flags;
process_fd_request(); process_fd_request();
...@@ -3549,7 +3549,7 @@ static int fd_ioctl(struct block_device *bdev, fmode_t mode, unsigned int cmd, ...@@ -3549,7 +3549,7 @@ static int fd_ioctl(struct block_device *bdev, fmode_t mode, unsigned int cmd,
return do_format(drive, &inparam.f); return do_format(drive, &inparam.f);
case FDFMTEND: case FDFMTEND:
case FDFLUSH: case FDFLUSH:
if (lock_fdc(drive, 1)) if (lock_fdc(drive, true))
return -EINTR; return -EINTR;
return invalidate_drive(bdev); return invalidate_drive(bdev);
case FDSETEMSGTRESH: case FDSETEMSGTRESH:
...@@ -3572,9 +3572,9 @@ static int fd_ioctl(struct block_device *bdev, fmode_t mode, unsigned int cmd, ...@@ -3572,9 +3572,9 @@ static int fd_ioctl(struct block_device *bdev, fmode_t mode, unsigned int cmd,
outparam = (const char *)UDP; outparam = (const char *)UDP;
break; break;
case FDPOLLDRVSTAT: case FDPOLLDRVSTAT:
if (lock_fdc(drive, 1)) if (lock_fdc(drive, true))
return -EINTR; return -EINTR;
if (poll_drive(1, FD_RAW_NEED_DISK) == -EINTR) if (poll_drive(true, FD_RAW_NEED_DISK) == -EINTR)
return -EINTR; return -EINTR;
process_fd_request(); process_fd_request();
/* fall through */ /* fall through */
...@@ -3582,7 +3582,7 @@ static int fd_ioctl(struct block_device *bdev, fmode_t mode, unsigned int cmd, ...@@ -3582,7 +3582,7 @@ static int fd_ioctl(struct block_device *bdev, fmode_t mode, unsigned int cmd,
outparam = (const char *)UDRS; outparam = (const char *)UDRS;
break; break;
case FDRESET: case FDRESET:
return user_reset_fdc(drive, (int)param, 1); return user_reset_fdc(drive, (int)param, true);
case FDGETFDCSTAT: case FDGETFDCSTAT:
outparam = (const char *)UFDCS; outparam = (const char *)UFDCS;
break; break;
...@@ -3595,7 +3595,7 @@ static int fd_ioctl(struct block_device *bdev, fmode_t mode, unsigned int cmd, ...@@ -3595,7 +3595,7 @@ static int fd_ioctl(struct block_device *bdev, fmode_t mode, unsigned int cmd,
case FDRAWCMD: case FDRAWCMD:
if (type) if (type)
return -EINVAL; return -EINVAL;
if (lock_fdc(drive, 1)) if (lock_fdc(drive, true))
return -EINTR; return -EINTR;
set_floppy(drive); set_floppy(drive);
i = raw_cmd_ioctl(cmd, (void __user *)param); 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,7 +3604,7 @@ static int fd_ioctl(struct block_device *bdev, fmode_t mode, unsigned int cmd,
process_fd_request(); process_fd_request();
return i; return i;
case FDTWADDLE: case FDTWADDLE:
if (lock_fdc(drive, 1)) if (lock_fdc(drive, true))
return -EINTR; return -EINTR;
twaddle(); twaddle();
process_fd_request(); process_fd_request();
...@@ -3803,8 +3803,8 @@ static int check_floppy_change(struct gendisk *disk) ...@@ -3803,8 +3803,8 @@ static int check_floppy_change(struct gendisk *disk)
return 1; return 1;
if (time_after(jiffies, UDRS->last_checked + UDP->checkfreq)) { if (time_after(jiffies, UDRS->last_checked + UDP->checkfreq)) {
lock_fdc(drive, 0); lock_fdc(drive, false);
poll_drive(0, 0); poll_drive(false, 0);
process_fd_request(); process_fd_request();
} }
...@@ -3887,7 +3887,7 @@ static int floppy_revalidate(struct gendisk *disk) ...@@ -3887,7 +3887,7 @@ static int floppy_revalidate(struct gendisk *disk)
pr_info("VFS: revalidate called on non-open device.\n"); pr_info("VFS: revalidate called on non-open device.\n");
return -EFAULT; return -EFAULT;
} }
lock_fdc(drive, 0); lock_fdc(drive, false);
cf = (test_bit(FD_DISK_CHANGED_BIT, &UDRS->flags) || cf = (test_bit(FD_DISK_CHANGED_BIT, &UDRS->flags) ||
test_bit(FD_VERIFY_BIT, &UDRS->flags)); test_bit(FD_VERIFY_BIT, &UDRS->flags));
if (!(cf || test_bit(drive, &fake_change) || NO_GEOM)) { if (!(cf || test_bit(drive, &fake_change) || NO_GEOM)) {
...@@ -3907,7 +3907,7 @@ static int floppy_revalidate(struct gendisk *disk) ...@@ -3907,7 +3907,7 @@ static int floppy_revalidate(struct gendisk *disk)
res = __floppy_read_block_0(opened_bdev[drive]); res = __floppy_read_block_0(opened_bdev[drive]);
} else { } else {
if (cf) if (cf)
poll_drive(0, FD_RAW_NEED_DISK); poll_drive(false, FD_RAW_NEED_DISK);
process_fd_request(); process_fd_request();
} }
} }
...@@ -4164,7 +4164,7 @@ static int floppy_resume(struct device *dev) ...@@ -4164,7 +4164,7 @@ static int floppy_resume(struct device *dev)
for (fdc = 0; fdc < N_FDC; fdc++) for (fdc = 0; fdc < N_FDC; fdc++)
if (FDCS->address != -1) if (FDCS->address != -1)
user_reset_fdc(-1, FD_RESET_ALWAYS, 0); user_reset_fdc(-1, FD_RESET_ALWAYS, false);
return 0; return 0;
} }
...@@ -4311,7 +4311,7 @@ static int __init floppy_init(void) ...@@ -4311,7 +4311,7 @@ static int __init floppy_init(void)
if (FDCS->address == -1) if (FDCS->address == -1)
continue; continue;
FDCS->rawcmd = 2; FDCS->rawcmd = 2;
if (user_reset_fdc(-1, FD_RESET_ALWAYS, 0)) { if (user_reset_fdc(-1, FD_RESET_ALWAYS, false)) {
/* free ioports reserved by floppy_grab_irq_and_dma() */ /* free ioports reserved by floppy_grab_irq_and_dma() */
floppy_release_regions(fdc); floppy_release_regions(fdc);
FDCS->address = -1; FDCS->address = -1;
...@@ -4334,7 +4334,7 @@ static int __init floppy_init(void) ...@@ -4334,7 +4334,7 @@ static int __init floppy_init(void)
* properly, so force a reset for the standard FDC clones, * properly, so force a reset for the standard FDC clones,
* to avoid interrupt garbage. * to avoid interrupt garbage.
*/ */
user_reset_fdc(-1, FD_RESET_ALWAYS, 0); user_reset_fdc(-1, FD_RESET_ALWAYS, false);
} }
fdc = 0; fdc = 0;
del_timer(&fd_timeout); del_timer(&fd_timeout);
......
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