All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Denis Efremov <efremov@linux.com>
Cc: linux-block@vger.kernel.org, Willy Tarreau <w@1wt.eu>,
	Christoph Hellwig <hch@infradead.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 1/3] floppy: add FD_AUTODETECT_SIZE define for struct floppy_drive_params
Date: Sun, 26 Apr 2020 22:48:26 -0700	[thread overview]
Message-ID: <20200427054826.GA4159@infradead.org> (raw)
In-Reply-To: <20200426130728.63399-2-efremov@linux.com>

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@linux.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.

  parent reply	other threads:[~2020-04-27  5:48 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-26 13:07 [PATCH v2 0/3] floppy: suppress UBSAN warning in setup_rw_floppy() Denis Efremov
2020-04-26 13:07 ` [PATCH v2 1/3] floppy: add FD_AUTODETECT_SIZE define for struct floppy_drive_params Denis Efremov
2020-04-26 20:24   ` Joe Perches
2020-04-27  5:48   ` Christoph Hellwig [this message]
2020-04-26 13:07 ` [PATCH v2 2/3] floppy: add defines for sizes of cmd & reply buffers of floppy_raw_cmd Denis Efremov
2020-04-26 20:28   ` Joe Perches
2020-04-26 20:44     ` Denis Efremov
2020-04-27  5:50   ` Christoph Hellwig
2020-04-26 13:07 ` [PATCH v2 3/3] floppy: suppress UBSAN warning in setup_rw_floppy() Denis Efremov
2020-04-26 23:19   ` Joe Perches
2020-04-27  5:50   ` Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200427054826.GA4159@infradead.org \
    --to=hch@infradead.org \
    --cc=efremov@linux.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=w@1wt.eu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.