From patchwork Fri Apr 16 08:34:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Denis Efremov (Oracle)" X-Patchwork-Id: 12206985 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1A82CC433ED for ; Fri, 16 Apr 2021 08:35:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EA54C611AB for ; Fri, 16 Apr 2021 08:35:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234996AbhDPIf6 (ORCPT ); Fri, 16 Apr 2021 04:35:58 -0400 Received: from mail-qv1-f41.google.com ([209.85.219.41]:35354 "EHLO mail-qv1-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239471AbhDPIf6 (ORCPT ); Fri, 16 Apr 2021 04:35:58 -0400 Received: by mail-qv1-f41.google.com with SMTP id x27so13077345qvd.2; Fri, 16 Apr 2021 01:35:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=remU4wRFvBJsWsuq7KZfs4sBz1FR2GIMrE8lrIkidqs=; b=E/H+GfncvwYFFZCbjteo+fpkN54UMXcuYt9VIL4sxP6NgGTgKlJZN/VhPhW9zZpWiR k5SPmWlB0SlBtUeKvfmlSiIO+EPRDxsNqWmYfXngSk8rxBfV0ujKRzpYLGfO6XxjGLR4 JTvYcmGinzPrYBbdrFCUy5Z762b1vlGus1uMQjYNJvN4zxZnJDVFnel8mjPVj9+rXPb1 PvP4vSdCDDkvdwjXVUY9hJY/PrOdHn8SjqL4iN7q8SC7b6eowL+Y5FYRj11NGnEi5wkX s4LLINB3KIfP7G5NrJpvih7JMEifvOqkmvTv1lKRPUV7uwWuG2ls+96I+53LETgORfeU /mmA== X-Gm-Message-State: AOAM533H1943FMQbo2eao7z9q+MHO0nHekNVhRuZarUv5R4CHNizKJPU YrDApAV4LeEZKhFzChygkyAv+KtDcCeYpg== X-Google-Smtp-Source: ABdhPJxApfwUbxH5p8Jfz6ceyi9z6xn1U5csu89vGB2EVKYsSe/j2ReIwdkV85/tC04boxzwZgdlvw== X-Received: by 2002:a0c:e842:: with SMTP id l2mr7188459qvo.21.1618562133541; Fri, 16 Apr 2021 01:35:33 -0700 (PDT) Received: from black.ru.oracle.com (broadband-188-32-236-56.ip.moscow.rt.ru. [188.32.236.56]) by smtp.googlemail.com with ESMTPSA id k17sm3363778qtp.26.2021.04.16.01.35.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Apr 2021 01:35:33 -0700 (PDT) From: Denis Efremov To: linux-block@vger.kernel.org Cc: Denis Efremov , linux-kernel@vger.kernel.org Subject: [PATCH 1/5] floppy: cleanups: remove trailing whitespaces Date: Fri, 16 Apr 2021 11:34:45 +0300 Message-Id: <20210416083449.72700-2-efremov@linux.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210416083449.72700-1-efremov@linux.com> References: <20210416083449.72700-1-efremov@linux.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Cleanup trailing whitespaces as checkpatch.pl suggests. Signed-off-by: Denis Efremov --- include/uapi/linux/fd.h | 46 ++++++++++++++++++++--------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/include/uapi/linux/fd.h b/include/uapi/linux/fd.h index 8b80c63b971c..7022e3413dbc 100644 --- a/include/uapi/linux/fd.h +++ b/include/uapi/linux/fd.h @@ -49,11 +49,11 @@ struct floppy_struct { #define FDCLRPRM _IO(2, 0x41) /* clear user-defined parameters */ -#define FDSETPRM _IOW(2, 0x42, struct floppy_struct) +#define FDSETPRM _IOW(2, 0x42, struct floppy_struct) #define FDSETMEDIAPRM FDSETPRM /* set user-defined parameters for current media */ -#define FDDEFPRM _IOW(2, 0x43, struct floppy_struct) +#define FDDEFPRM _IOW(2, 0x43, struct floppy_struct) #define FDGETPRM _IOR(2, 0x04, struct floppy_struct) #define FDDEFMEDIAPRM FDDEFPRM #define FDGETMEDIAPRM FDGETPRM @@ -65,7 +65,7 @@ struct floppy_struct { /* issue/don't issue kernel messages on media type change */ -/* +/* * Formatting (obsolete) */ #define FD_FILL_BYTE 0xF6 /* format fill byte. */ @@ -126,13 +126,13 @@ typedef char floppy_drive_name[16]; */ struct floppy_drive_params { signed char cmos; /* CMOS type */ - - /* Spec2 is (HLD<<1 | ND), where HLD is head load time (1=2ms, 2=4 ms + + /* Spec2 is (HLD<<1 | ND), where HLD is head load time (1=2ms, 2=4 ms * etc) and ND is set means no DMA. Hardcoded to 6 (HLD=6ms, use DMA). */ unsigned long max_dtr; /* Step rate, usec */ unsigned long hlt; /* Head load/settle time, msec */ - unsigned long hut; /* Head unload time (remnant of + unsigned long hut; /* Head unload time (remnant of * 8" drives) */ unsigned long srt; /* Step rate, usec */ @@ -145,12 +145,12 @@ struct floppy_drive_params { unsigned char rps; /* rotations per second */ unsigned char tracks; /* maximum number of tracks */ unsigned long timeout; /* timeout for interrupt requests */ - - unsigned char interleave_sect; /* if there are more sectors, use + + unsigned char interleave_sect; /* if there are more sectors, use * interleave */ - + struct floppy_max_errors max_errors; - + char flags; /* various flags, including ftd_msg */ /* * Announce successful media type detection and media information loss after @@ -162,7 +162,7 @@ struct floppy_drive_params { #define FD_BROKEN_DCL 0x20 #define FD_DEBUG 0x02 #define FD_SILENT_DCL_CLEAR 0x4 -#define FD_INVERTED_DCL 0x80 /* must be 0x80, because of hardware +#define FD_INVERTED_DCL 0x80 /* must be 0x80, because of hardware considerations */ char read_track; /* use readtrack during probing? */ @@ -176,8 +176,8 @@ struct floppy_drive_params { #define FD_AUTODETECT_SIZE 8 short autodetect[FD_AUTODETECT_SIZE]; /* autodetected formats */ - - int checkfreq; /* how often should the drive be checked for disk + + int checkfreq; /* how often should the drive be checked for disk * changes */ int native_format; /* native format of this drive */ }; @@ -225,13 +225,13 @@ struct floppy_drive_struct { * decremented after each probe. */ int keep_data; - + /* Prevent "aliased" accesses. */ int fd_ref; int fd_device; - unsigned long last_checked; /* when was the drive last checked for a disk + unsigned long last_checked; /* when was the drive last checked for a disk * change? */ - + char *dmabuf; int bufblocks; }; @@ -255,7 +255,7 @@ enum reset_mode { /* * FDC state */ -struct floppy_fdc_state { +struct floppy_fdc_state { int spec1; /* spec1 value last used */ int spec2; /* spec2 value last used */ int dtr; @@ -302,16 +302,16 @@ struct floppy_write_errors { * to the user process are not counted. */ - unsigned int write_errors; /* number of physical write errors + unsigned int write_errors; /* number of physical write errors * encountered */ - + /* position of first and last write errors */ unsigned long first_error_sector; int first_error_generation; unsigned long last_error_sector; int last_error_generation; - - unsigned int badness; /* highest retry count for a read or write + + unsigned int badness; /* highest retry count for a read or write * operation */ }; @@ -335,7 +335,7 @@ struct floppy_raw_cmd { #define FD_RAW_DISK_CHANGE 4 /* out: disk change flag was set */ #define FD_RAW_INTR 8 /* wait for an interrupt */ #define FD_RAW_SPIN 0x10 /* spin up the disk for this command */ -#define FD_RAW_NO_MOTOR_AFTER 0x20 /* switch the motor off after command +#define FD_RAW_NO_MOTOR_AFTER 0x20 /* switch the motor off after command * completion */ #define FD_RAW_NEED_DISK 0x40 /* this command needs a disk to be present */ #define FD_RAW_NEED_SEEK 0x80 /* this command uses an implied seek (soft) */ @@ -353,7 +353,7 @@ struct floppy_raw_cmd { void __user *data; char *kernel_data; /* location of data buffer in the kernel */ - struct floppy_raw_cmd *next; /* used for chaining of raw cmd's + struct floppy_raw_cmd *next; /* used for chaining of raw cmd's * within the kernel */ long length; /* in: length of dma transfer. out: remaining bytes */ long phys_length; /* physical length, if different from dma length */ From patchwork Fri Apr 16 08:34:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Denis Efremov (Oracle)" X-Patchwork-Id: 12206987 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0F5D7C433ED for ; Fri, 16 Apr 2021 08:35:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D99A86117A for ; Fri, 16 Apr 2021 08:35:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238766AbhDPIgC (ORCPT ); Fri, 16 Apr 2021 04:36:02 -0400 Received: from mail-qv1-f42.google.com ([209.85.219.42]:45686 "EHLO mail-qv1-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240059AbhDPIgB (ORCPT ); Fri, 16 Apr 2021 04:36:01 -0400 Received: by mail-qv1-f42.google.com with SMTP id bs7so12553769qvb.12; Fri, 16 Apr 2021 01:35:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Hw31C33PILT3DamWMHDgiiU6OjaR9sNFohiSgOeE+jE=; b=ozEtyBG3Phl6/wQE87UCOyHyzQHL9VRexGmg6ly4iNAUWgCJUmF2XOSJhJI98gSGGG 5MRGy7N+pLvj4uf1gYWjDYP6fZjnlxxohnIpyUyHcBNi2wOHFw5iCXc7Ha+lOunJoqxI 7erPW6KtNusZN3qKybhi4E03C+l1iaarlsjICLVIECGmbon6K/993joniEhlZcfOAkgA a0YYOo7cLfpg8pWSobq2ic+WxTVEAAwdihsH5GdRrqNUJFz4gepsPDhUYjivEJupM26Q Do/LhshPjeio4SfJR/TDiTQkBidn1W4txs0smrI6XnyaGMo9NyVbXW9BUdICUHL2WgHC 7A8w== X-Gm-Message-State: AOAM530BpNtNsRAHrWBJnOIQu6MFX7WXNtATo0Dlr6iXqclSsGaSZ/5I FhexyBi2oEbG5SthebaWQu6qrQoDsLea+g== X-Google-Smtp-Source: ABdhPJxRjSNka1nHBJAG5Ilk39BekLvA8FURwLp7GDLBxBmAS6hbvbK9p7BYEXeabZ+VHaR0jEi/KQ== X-Received: by 2002:a0c:a045:: with SMTP id b63mr1251841qva.19.1618562136393; Fri, 16 Apr 2021 01:35:36 -0700 (PDT) Received: from black.ru.oracle.com (broadband-188-32-236-56.ip.moscow.rt.ru. [188.32.236.56]) by smtp.googlemail.com with ESMTPSA id k17sm3363778qtp.26.2021.04.16.01.35.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Apr 2021 01:35:36 -0700 (PDT) From: Denis Efremov To: linux-block@vger.kernel.org Cc: Denis Efremov , linux-kernel@vger.kernel.org Subject: [PATCH 2/5] floppy: cleanups: use ST0 as reply_buffer index 0 Date: Fri, 16 Apr 2021 11:34:46 +0300 Message-Id: <20210416083449.72700-3-efremov@linux.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210416083449.72700-1-efremov@linux.com> References: <20210416083449.72700-1-efremov@linux.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Use ST0 as 0 index for reply_buffer array. get_fdc_version() is the only function that uses index 0 directly instead of the ST0 define. Signed-off-by: Denis Efremov --- drivers/block/floppy.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c index 960e5791d6f5..df5c32900539 100644 --- a/drivers/block/floppy.c +++ b/drivers/block/floppy.c @@ -4232,7 +4232,7 @@ static char __init get_fdc_version(int fdc) r = result(fdc); if (r <= 0x00) return FDC_NONE; /* No FDC present ??? */ - if ((r == 1) && (reply_buffer[0] == 0x80)) { + if ((r == 1) && (reply_buffer[ST0] == 0x80)) { pr_info("FDC %d is an 8272A\n", fdc); return FDC_8272A; /* 8272a/765 don't know DUMPREGS */ } @@ -4257,12 +4257,12 @@ static char __init get_fdc_version(int fdc) output_byte(fdc, FD_UNLOCK); r = result(fdc); - if ((r == 1) && (reply_buffer[0] == 0x80)) { + if ((r == 1) && (reply_buffer[ST0] == 0x80)) { pr_info("FDC %d is a pre-1991 82077\n", fdc); return FDC_82077_ORIG; /* Pre-1991 82077, doesn't know * LOCK/UNLOCK */ } - if ((r != 1) || (reply_buffer[0] != 0x00)) { + if ((r != 1) || (reply_buffer[ST0] != 0x00)) { pr_info("FDC %d init: UNLOCK: unexpected return of %d bytes.\n", fdc, r); return FDC_UNKNOWN; @@ -4274,11 +4274,11 @@ static char __init get_fdc_version(int fdc) fdc, r); return FDC_UNKNOWN; } - if (reply_buffer[0] == 0x80) { + if (reply_buffer[ST0] == 0x80) { pr_info("FDC %d is a post-1991 82077\n", fdc); return FDC_82077; /* Revised 82077AA passes all the tests */ } - switch (reply_buffer[0] >> 5) { + switch (reply_buffer[ST0] >> 5) { case 0x0: /* Either a 82078-1 or a 82078SL running at 5Volt */ pr_info("FDC %d is an 82078.\n", fdc); @@ -4294,7 +4294,7 @@ static char __init get_fdc_version(int fdc) return FDC_87306; default: pr_info("FDC %d init: 82078 variant with unknown PARTID=%d.\n", - fdc, reply_buffer[0] >> 5); + fdc, reply_buffer[ST0] >> 5); return FDC_82078_UNKN; } } /* get_fdc_version */ From patchwork Fri Apr 16 08:34:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Denis Efremov (Oracle)" X-Patchwork-Id: 12206989 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C7837C43460 for ; Fri, 16 Apr 2021 08:35:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8FD3661184 for ; Fri, 16 Apr 2021 08:35:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240059AbhDPIgE (ORCPT ); Fri, 16 Apr 2021 04:36:04 -0400 Received: from mail-qk1-f180.google.com ([209.85.222.180]:41828 "EHLO mail-qk1-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240464AbhDPIgE (ORCPT ); Fri, 16 Apr 2021 04:36:04 -0400 Received: by mail-qk1-f180.google.com with SMTP id f19so10362059qka.8; Fri, 16 Apr 2021 01:35:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=iaWCqAz1Lh0K+YMS2Sm/+2KskMbWPrmtR34tefX2FCk=; b=iyVx6eVu2hf25UrvagyrvhCGGIwedPrpvdGcALNQumi2a5lYx18aAvRxraDTIz5SyC RE4AXtr1Lomo8kfpiVCwGlHn7/ujJeRypo8i7II0AjkW/+c7+Kw+8XaM29EFKK5L15ti ZTlURXeJiaIpF4r6IOhFiOElQrFCEsLJZNACJn6rfCgH9Aq5DgFAMCPnWDFt20wGovgI XY3CLXoSJEsrcDkCEKawvIjsknFYueZ8w2+Wjt6pslChbvEBG1ppKHVWrIZB1538Ta2Q XaiN0BywTNY2OYgaBQJEdAXaYcAyjRlf1eNLzGkWMHVTw0S8lqgo1WexmV/mthhFGSh+ UZJQ== X-Gm-Message-State: AOAM533DfO5VCg6w4FD4mFIz5TJR1mNdWlcKhcRjZmRYy7Ibh1JVCCRf cxD7dYuWOnve+TJFMO32EJA5hWPs6wFGQg== X-Google-Smtp-Source: ABdhPJwUeNyXNj6qXFhTLMemljhm2jc4jmR8wxvXhsR6AeYO1w7BNv9NKzzyqEJRet2A85qmSizz6A== X-Received: by 2002:a37:695:: with SMTP id 143mr8039369qkg.217.1618562138773; Fri, 16 Apr 2021 01:35:38 -0700 (PDT) Received: from black.ru.oracle.com (broadband-188-32-236-56.ip.moscow.rt.ru. [188.32.236.56]) by smtp.googlemail.com with ESMTPSA id k17sm3363778qtp.26.2021.04.16.01.35.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Apr 2021 01:35:38 -0700 (PDT) From: Denis Efremov To: linux-block@vger.kernel.org Cc: Denis Efremov , linux-kernel@vger.kernel.org Subject: [PATCH 3/5] floppy: cleanups: use memset() to zero reply_buffer Date: Fri, 16 Apr 2021 11:34:47 +0300 Message-Id: <20210416083449.72700-4-efremov@linux.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210416083449.72700-1-efremov@linux.com> References: <20210416083449.72700-1-efremov@linux.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Use memset() to zero reply buffer in raw_cmd_copyin() instead of a for loop. Signed-off-by: Denis Efremov --- drivers/block/floppy.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c index df5c32900539..c58b0b079afc 100644 --- a/drivers/block/floppy.c +++ b/drivers/block/floppy.c @@ -3090,7 +3090,6 @@ static int raw_cmd_copyin(int cmd, void __user *param, { struct floppy_raw_cmd *ptr; int ret; - int i; *rcmd = NULL; @@ -3109,8 +3108,7 @@ static int raw_cmd_copyin(int cmd, void __user *param, if (ptr->cmd_count > FD_RAW_CMD_FULLSIZE) return -EINVAL; - for (i = 0; i < FD_RAW_REPLY_SIZE; i++) - ptr->reply[i] = 0; + memset(ptr->reply, 0, FD_RAW_REPLY_SIZE); ptr->resultcode = 0; if (ptr->flags & (FD_RAW_READ | FD_RAW_WRITE)) { From patchwork Fri Apr 16 08:34:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Denis Efremov (Oracle)" X-Patchwork-Id: 12206991 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D704FC433ED for ; Fri, 16 Apr 2021 08:35:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B68F761166 for ; Fri, 16 Apr 2021 08:35:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240086AbhDPIgJ (ORCPT ); Fri, 16 Apr 2021 04:36:09 -0400 Received: from mail-qt1-f172.google.com ([209.85.160.172]:43602 "EHLO mail-qt1-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240464AbhDPIgG (ORCPT ); Fri, 16 Apr 2021 04:36:06 -0400 Received: by mail-qt1-f172.google.com with SMTP id i6so10642946qti.10; Fri, 16 Apr 2021 01:35:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=w+SWBg6vyMpiCnh+pmxIKMewgtfrKgyoDu1G+uKhgXY=; b=Gvd5U83C5yAmbzFGgWs3hrDnIXYi4wszHRWe15B1/4Saig01uy+40zvG2c+htkZgsA NeksPHgm4s7xOXGhkmX2IKW3h6QFiqQPgYTn18Aaj+PhBpGQzDbgIPSfm+3d74AfZSPQ 7k1l+ltc3rnR7ozh4C3w1RMSClRfYTOgjG8Zuyo/Mh7c6K7/vmhUg7aVkiawsMPsldYj 8IVDetaMYM40i3QkBo4Dk9dFZ3wsohpVvg2A9GKkscSlndrIbaOSry5hZQ4UFf3GaHXs HmQ1qIb7h1Ws7J0XJQM+V34FNabld5krLsN8gedTMmsi5ax6Lf8lkdg+sBR6qwiT9XIq 0h+g== X-Gm-Message-State: AOAM533S8v8RDoo4zgZ32yZEo14050rBB07/rjKvvLoVIsi9/YDGhkDM LIaM4wON67NNV8IGM50oBedQv9qG1BI3jg== X-Google-Smtp-Source: ABdhPJzjExvhu/I5GIUQUhSCBRi2Pixy4GZxIyjyqNjqh5gIXeoJtku2qLNwqK2NG6sZkq485CcydQ== X-Received: by 2002:ac8:5cc5:: with SMTP id s5mr6854950qta.15.1618562141372; Fri, 16 Apr 2021 01:35:41 -0700 (PDT) Received: from black.ru.oracle.com (broadband-188-32-236-56.ip.moscow.rt.ru. [188.32.236.56]) by smtp.googlemail.com with ESMTPSA id k17sm3363778qtp.26.2021.04.16.01.35.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Apr 2021 01:35:41 -0700 (PDT) From: Denis Efremov To: linux-block@vger.kernel.org Cc: Denis Efremov , linux-kernel@vger.kernel.org Subject: [PATCH 4/5] floppy: cleanups: use memcpy() to copy reply_buffer Date: Fri, 16 Apr 2021 11:34:48 +0300 Message-Id: <20210416083449.72700-5-efremov@linux.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210416083449.72700-1-efremov@linux.com> References: <20210416083449.72700-1-efremov@linux.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Use memcpy() in raw_cmd_done() to copy reply_buffer instead of a for loop. Signed-off-by: Denis Efremov --- drivers/block/floppy.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c index c58b0b079afc..c584657bacab 100644 --- a/drivers/block/floppy.c +++ b/drivers/block/floppy.c @@ -2988,8 +2988,6 @@ static const char *drive_name(int type, int drive) /* raw commands */ static void raw_cmd_done(int flag) { - int i; - if (!flag) { raw_cmd->flags |= FD_RAW_FAILURE; raw_cmd->flags |= FD_RAW_HARDFAILURE; @@ -2997,8 +2995,7 @@ static void raw_cmd_done(int flag) raw_cmd->reply_count = inr; if (raw_cmd->reply_count > FD_RAW_REPLY_SIZE) raw_cmd->reply_count = 0; - for (i = 0; i < raw_cmd->reply_count; i++) - raw_cmd->reply[i] = reply_buffer[i]; + memcpy(raw_cmd->reply, reply_buffer, raw_cmd->reply_count); if (raw_cmd->flags & (FD_RAW_READ | FD_RAW_WRITE)) { unsigned long flags; From patchwork Fri Apr 16 08:34:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Denis Efremov (Oracle)" X-Patchwork-Id: 12206993 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5DACFC433B4 for ; Fri, 16 Apr 2021 08:35:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4547C61166 for ; Fri, 16 Apr 2021 08:35:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240513AbhDPIgM (ORCPT ); Fri, 16 Apr 2021 04:36:12 -0400 Received: from mail-qt1-f180.google.com ([209.85.160.180]:46725 "EHLO mail-qt1-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240500AbhDPIgL (ORCPT ); Fri, 16 Apr 2021 04:36:11 -0400 Received: by mail-qt1-f180.google.com with SMTP id d6so1973078qtx.13; Fri, 16 Apr 2021 01:35:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=DXu78L1cWa3O40BlxHBypy2EDCIHUvn4ujVswlz20VI=; b=EjJFyQJ9oxWiw+2qNf7HZfImIc4SLSDSlyG4j528th4CdufdvCT9Bi/wAzXklmr7lY 84mjfMM0AYk/IMat0Qv/UwFY30rOLihYEzT34fA5LwFX5oF+gEewK5SbhYfiZxn4QM2B HN29gyfYHHhybxVdHQrXJiPREUvEWxEb+rnE0L1yn5Blc/sJwS4TfoeT4IpDDSN1qXmG wKZAYFt7jMmNq4fsfpCL8jXRfT+qSQuIOYtEIY+WSZknCc/FvqAIij0j6Z01AQ3a56eC cIwRD2qTnkUdwIYV0Rr+rHncwwhJm6JXJ6Dx0Pd/OR8f0840Z6qAkIEautl/kt+sswQI pvHQ== X-Gm-Message-State: AOAM533H1oYilk7dRZhaJMRNcWXSzvWOyE574pvJLHJLUea3vlcrsauk ttOo7QNdV/oewuPfSWbEOngIn2NCXiW4bQ== X-Google-Smtp-Source: ABdhPJzqIpQ2leik764+IfGqMOAd+ma6XX7Ib4BJS+Ow4/ke/cXs5QjDWaLsxMOVD+F1T6msW49eZQ== X-Received: by 2002:ac8:594d:: with SMTP id 13mr6940953qtz.151.1618562145427; Fri, 16 Apr 2021 01:35:45 -0700 (PDT) Received: from black.ru.oracle.com (broadband-188-32-236-56.ip.moscow.rt.ru. [188.32.236.56]) by smtp.googlemail.com with ESMTPSA id k17sm3363778qtp.26.2021.04.16.01.35.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Apr 2021 01:35:45 -0700 (PDT) From: Denis Efremov To: linux-block@vger.kernel.org Cc: Denis Efremov , linux-kernel@vger.kernel.org Subject: [PATCH 5/5] floppy: cleanups: remove FLOPPY_SILENT_DCL_CLEAR undef Date: Fri, 16 Apr 2021 11:34:49 +0300 Message-Id: <20210416083449.72700-6-efremov@linux.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210416083449.72700-1-efremov@linux.com> References: <20210416083449.72700-1-efremov@linux.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org FLOPPY_SILENT_DCL_CLEAR is not defined anywhere and comes from pre-git era. Just drop this undef. There is FD_SILENT_DCL_CLEAR which is really used. Signed-off-by: Denis Efremov --- drivers/block/floppy.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c index c584657bacab..678ea45f2388 100644 --- a/drivers/block/floppy.c +++ b/drivers/block/floppy.c @@ -145,8 +145,6 @@ * Better audit of register_blkdev. */ -#undef FLOPPY_SILENT_DCL_CLEAR - #define REALLY_SLOW_IO #define DEBUGT 2