Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp2548093ybz; Sun, 26 Apr 2020 22:50:17 -0700 (PDT) X-Google-Smtp-Source: APiQypKHeZL1cB3KBd3lVhJ6xWj989Q8A2ePpKepjiB/XECxwhflDBdvS/fiMfeGR54dHIcZpyCq X-Received: by 2002:aa7:d718:: with SMTP id t24mr3646805edq.20.1587966617568; Sun, 26 Apr 2020 22:50:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587966617; cv=none; d=google.com; s=arc-20160816; b=PISGpmnIIoEHwz5KxE0fw3qgnF6Kcmv9AqjDMStnwt1dXJf5RsDLEGnyfJHk0z1t/+ /zioIvhNkdNXVMZPoTqJreeW0EzAzutui4nsML8Ca6ycqTncA8+Bc/bdCYUETZUCWvSN 3o++p6oxPlZ+TzHvdW6rCbxW7+VDN3sPtsenm3p9wDCUO9bhtANEopLo/DM3OK1hjRrS 6HkoFOWEfnqIKIiTOpAnkKKUU7Jr/SrA0TfEyY73CALArE0qL4ycf3/CqRnTSXDSmCFe ZwHBZWk7BJoJgCMNSLLKzH6tmrIennl3rK8DqqNMGyOOeBWhVWh9BVNoZpu2BHcb4LKn KVbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=/PSqghsfGGjRQjfpqyIZ2MD77LzLmwVJtfCaOeG3/FQ=; b=J/ixNLt8y7uc1pbqP2F5KeilBm8orNy/Hkd3hDwneDVSR4jlXFDcWyqRnl/jKK9Jxr YXepSe0FTpUKjfAbGg4xCGwcxFHzo7oZaFvWNfTQqoGxDVfSFbSJwuJtrz83JhPUdHMx lO9k2lnnngYbe4pCmszgxTDD6tSr+oQYHM5PwzuRyFc6ld9t9nLodNFpCHchxwgFAhJb nHbnI9dhX9wTxIBJsVDlfwul+bje0REt6MkaBV9k7dVD8iXePQPA2iylcS9nItEGRbKc lcuRcynUdIIMRb/DTM1/q3+VWWwVaXTmCOUDrIKu5fXZZoK9GKpKs7np10ZaiaXDghwR ZBlA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=jyIEPV2+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id os28si7654521ejb.98.2020.04.26.22.49.53; Sun, 26 Apr 2020 22:50:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=jyIEPV2+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726429AbgD0Fsa (ORCPT + 99 others); Mon, 27 Apr 2020 01:48:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37588 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726178AbgD0Fsa (ORCPT ); Mon, 27 Apr 2020 01:48:30 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB472C061A0F; Sun, 26 Apr 2020 22:48:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=/PSqghsfGGjRQjfpqyIZ2MD77LzLmwVJtfCaOeG3/FQ=; b=jyIEPV2+/wssi7ISWw/r0t0N1R sj5CyFlWIw3mNp6OT31624TkVGkCgv8Jult3rcuBVn4Uf4UPxoRB1Tkivu+kuz3r7oMs4u/tjffbR 9xPdlmUwxwI3Yi4QtAe5l5hpzGHZ/uYexepgnzfcuTy8W+y0MaE82hF2mWVpvcq1UrYxnfu7bYodD Yak8Jw2oOOXa4Y+eD0cZBoLJXV3wb/wGjJVGolkE3nxi+F1t6kPG1+8+Gjhee7Ozwbg8fKe0rTFdp YBZ787lQPdkYACsv7OinO5uc/HMjWxES8a3CPnSqaVxxJujTI1ErrZQhEst7LPV66iUZ45cWCIv+o UiXE+UIA==; Received: from hch by bombadil.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1jSwd0-0001Dj-Vx; Mon, 27 Apr 2020 05:48:26 +0000 Date: Sun, 26 Apr 2020 22:48:26 -0700 From: Christoph Hellwig To: Denis Efremov Cc: linux-block@vger.kernel.org, Willy Tarreau , Christoph Hellwig , linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 1/3] floppy: add FD_AUTODETECT_SIZE define for struct floppy_drive_params Message-ID: <20200427054826.GA4159@infradead.org> References: <20200426130728.63399-1-efremov@linux.com> <20200426130728.63399-2-efremov@linux.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200426130728.63399-2-efremov@linux.com> X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > --- > 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.