[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200427054826.GA4159@infradead.org>
Date: Sun, 26 Apr 2020 22:48:26 -0700
From: Christoph Hellwig <hch@...radead.org>
To: Denis Efremov <efremov@...ux.com>
Cc: linux-block@...r.kernel.org, Willy Tarreau <w@....eu>,
Christoph Hellwig <hch@...radead.org>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 1/3] floppy: add FD_AUTODETECT_SIZE define for struct
floppy_drive_params
On Sun, Apr 26, 2020 at 04:07:26PM +0300, Denis Efremov wrote:
> Use FD_AUTODETECT_SIZE for autodetect buffer size in struct
> floppy_drive_params instead of a magic number.
>
> Signed-off-by: Denis Efremov <efremov@...ux.com>
> ---
> drivers/block/floppy.c | 9 +++++----
> include/uapi/linux/fd.h | 5 ++++-
> 2 files changed, 9 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c
> index 2817170dd403..ac2023c757e3 100644
> --- a/drivers/block/floppy.c
> +++ b/drivers/block/floppy.c
> @@ -2076,7 +2076,8 @@ static int next_valid_format(int drive)
>
> probed_format = drive_state[drive].probed_format;
> while (1) {
> - if (probed_format >= 8 || !drive_params[drive].autodetect[probed_format]) {
> + if (probed_format >= FD_AUTODETECT_SIZE ||
> + !drive_params[drive].autodetect[probed_format]) {
> drive_state[drive].probed_format = 0;
> return 1;
> }
> @@ -3445,13 +3446,13 @@ static int fd_getgeo(struct block_device *bdev, struct hd_geometry *geo)
> return 0;
> }
>
> -static bool valid_floppy_drive_params(const short autodetect[8],
> +static bool valid_floppy_drive_params(const short autodetect[FD_AUTODETECT_SIZE],
This adds an > 80 char line. But then again passing array sizes to
functions is a bit pointless ayway.
Otherwise this looks fine to me.
Powered by blists - more mailing lists