From patchwork Tue Mar 7 22:45:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ondrej Zary X-Patchwork-Id: 65931 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp7483wrd; Tue, 7 Mar 2023 14:57:57 -0800 (PST) X-Google-Smtp-Source: AK7set+ofgwUblhIdPCK/9CjxzLeIQgFZuhrsFS8gh6cH8Ge7vxtGoWKqKLz0r564TCNhv3Q4tKC X-Received: by 2002:a17:907:8b98:b0:8b1:76dd:f5f6 with SMTP id tb24-20020a1709078b9800b008b176ddf5f6mr21541120ejc.50.1678229877182; Tue, 07 Mar 2023 14:57:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678229877; cv=none; d=google.com; s=arc-20160816; b=ShiJChocbMuBRjiCu86707F2OtMxcI3YnLWaeH6g1IDvW82Y9jywR/ayIvbQXKfzZR ay+6NGM+nchkUiU0zRZVDaqY2Xe3JbJ0ws2wh+HU2zpRfAkHmEfJXqoJGCKDlb0u9euD c7WUEfLDhrhbqHVaJhkHlLSp2KKqPVT0JB2zcUQ684HOcMRoD7g+hXYZpjzStXFABM24 MgJMKZltEaGI45Bo1gHizdfX1IMkyed3lerABduHXv2l4kQdFhKvQo4EnSvTNdEJlI4u 7v/POsieAscBZPS296IPPJ1OPzOAskTkcRlmil3w9eeqmPAzN0EZbGfXWhZcvQzpUYz1 MopA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=FgQ5r9Zl3+qVxpo8SESUC4P3nUYq+D07VOLc4JPPDYQ=; b=NsLLkBhDtdzqx1iDIzj9tmW84rI98hg0NtIbHw73CVdLbNlCXlWIoGiu4YquXWZ+45 o04RGxhvRkujqwjEgIMAWTrs1qWoApMcx8eY/V/INbqniKdc7b+LqVpzv76dxS4IsD40 Am4T87AvEIE19107FE+JzuouAUpm5qT+unpmRogLV/CK8Lgvnl53ZK8l5k/3xWyRRyR9 rd4Xu4zRKpe3okiOan7QKDNnJ/C9xQVr/uRON489MyiVXNIrPPChc4vb7PExe/9RGg56 FF3E4BSmOojgaZuZrsMovbW3nW0xF05kCgdvnxTgPuRLkiblaGP8GvF92+GM4qIX7r/L 4ebg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gb7-20020a170907960700b008b1810ef12esi328117ejc.65.2023.03.07.14.57.33; Tue, 07 Mar 2023 14:57:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230361AbjCGWrI (ORCPT + 99 others); Tue, 7 Mar 2023 17:47:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33254 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229746AbjCGWrA (ORCPT ); Tue, 7 Mar 2023 17:47:00 -0500 Received: from hosting.gsystem.sk (hosting.gsystem.sk [212.5.213.30]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 3EB4993C8; Tue, 7 Mar 2023 14:46:49 -0800 (PST) Received: from gsql.ggedos.sk (off-20.infotel.telecom.sk [212.5.213.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by hosting.gsystem.sk (Postfix) with ESMTPSA id E06927A02E3; Tue, 7 Mar 2023 23:46:47 +0100 (CET) From: Ondrej Zary To: Damien Le Moal , Sudip Mukherjee Cc: Christoph Hellwig , Sergey Shtylyov , Jens Axboe , Tim Waugh , linux-block@vger.kernel.org, linux-parport@lists.infradead.org, linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 01/32] pata_parport-bpck6: remove useless defines Date: Tue, 7 Mar 2023 23:45:56 +0100 Message-Id: <20230307224627.28011-2-linux@zary.sk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20230307224627.28011-1-linux@zary.sk> References: <20230307224627.28011-1-linux@zary.sk> MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759751571435268197?= X-GMAIL-MSGID: =?utf-8?q?1759751571435268197?= Almost all the ATAPI_ defines are unused. Remove them and use ATA_REG_DATA instead of ATAPI_DATA. Signed-off-by: Ondrej Zary Reviewed-by: Sergey Shtylyov --- drivers/ata/pata_parport/bpck6.c | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/drivers/ata/pata_parport/bpck6.c b/drivers/ata/pata_parport/bpck6.c index 964bc688e280..842e8116b649 100644 --- a/drivers/ata/pata_parport/bpck6.c +++ b/drivers/ata/pata_parport/bpck6.c @@ -23,23 +23,6 @@ #define PPCSTRUCT(pi) ((Interface *)(pi->private)) -/****************************************************************/ -/* - ATAPI CDROM DRIVE REGISTERS -*/ -#define ATAPI_DATA 0 /* data port */ -#define ATAPI_ERROR 1 /* error register (read) */ -#define ATAPI_FEATURES 1 /* feature register (write) */ -#define ATAPI_INT_REASON 2 /* interrupt reason register */ -#define ATAPI_COUNT_LOW 4 /* byte count register (low) */ -#define ATAPI_COUNT_HIGH 5 /* byte count register (high) */ -#define ATAPI_DRIVE_SEL 6 /* drive select register */ -#define ATAPI_STATUS 7 /* status port (read) */ -#define ATAPI_COMMAND 7 /* command port (write) */ -#define ATAPI_ALT_STATUS 0x0e /* alternate status reg (read) */ -#define ATAPI_DEVICE_CONTROL 0x0e /* device control (write) */ -/****************************************************************/ - static int bpck6_read_regr(struct pi_adapter *pi, int cont, int reg) { unsigned int out; @@ -64,12 +47,12 @@ static void bpck6_write_regr(struct pi_adapter *pi, int cont, int reg, int val) static void bpck6_write_block(struct pi_adapter *pi, char *buf, int len) { - ppc6_wr_port16_blk(PPCSTRUCT(pi),ATAPI_DATA,buf,(u32)len>>1); + ppc6_wr_port16_blk(PPCSTRUCT(pi), ATA_REG_DATA, buf, (u32)len>>1); } static void bpck6_read_block(struct pi_adapter *pi, char *buf, int len) { - ppc6_rd_port16_blk(PPCSTRUCT(pi),ATAPI_DATA,buf,(u32)len>>1); + ppc6_rd_port16_blk(PPCSTRUCT(pi), ATA_REG_DATA, buf, (u32)len>>1); } static void bpck6_connect(struct pi_adapter *pi) From patchwork Tue Mar 7 22:45:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ondrej Zary X-Patchwork-Id: 65913 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp4328wrd; Tue, 7 Mar 2023 14:49:13 -0800 (PST) X-Google-Smtp-Source: AK7set+cNpweFjg83fEhTat0MHLHiMfqHtPITjjy9/sAvg0SLGqUFgadfLeazqbygSWnoX1Kv7PY X-Received: by 2002:a05:6a20:8f08:b0:c7:6a98:5bdc with SMTP id b8-20020a056a208f0800b000c76a985bdcmr22655128pzk.16.1678229353122; Tue, 07 Mar 2023 14:49:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678229353; cv=none; d=google.com; s=arc-20160816; b=xweGW7YSHdLpVWTFOjlS2ZfAQuc7z6oudECuNw50RfrEo3bMYt5l4NgxFtX+qOabDk fPtQTptbnXNnj6b4aAtP9UyQWklrtwSotnplwjg4kZxZKxAwP0INfY3Ujq3CvlZwylCt dk02uxkbW+J01W4xvRO+qxflZTcz/YKXJqU2+OWdaTq4aKtlX4RMTwmO12Z1ZxOZYUIq nJKFKsCmnoDTZnDVOlUS8skHEy23Ey9UZGLRwM8zVuZYXd/Z6FuIkAe89IBH4qNxZdh6 vWlfVYrQpYEOgSfJMMzOzV4rp6yNOBKNiaF4+NWBbBK9Jqsx8jrZgeBOxHH+EzofJK/F wnSA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=3ZYTcDywHAsg7C0/nIRKYixVJiJWcgs7VJahRV23Xfw=; b=opCAxOXkQwmPN1bKs9MXWV2do8opJl2mk+/oEwx9U3RioMqTXahx1wP/EtIC4tNm5k O5gPsS11sfzRSKKWJRBaOsoPY1x/sPAEPXBl4th1RwX5dZ30r38yuhGI73hmOrqOSdPU p6SwEd6hlJFtkegKGIFjFkqyStReR2hfCzYdlXghNWtWcEb4F511eE3JtJp7F63A2kCq NzsbjO1dh2OLrj1cCV2p8WN8ZjBZ3PTboQOc40AhWmb5S4SV+P4O4lEWjuYjoKzQFQXd DatXhnvyO3MW4kat6KUNZx8Ar/TEMTyr5LiLMlV0EoT8wg41SKwriv60k1pYskg6C6q2 F7gQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q32-20020a635c20000000b004e658a3b1b0si12415044pgb.183.2023.03.07.14.48.31; Tue, 07 Mar 2023 14:49:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229758AbjCGWrD (ORCPT + 99 others); Tue, 7 Mar 2023 17:47:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33250 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229691AbjCGWrA (ORCPT ); Tue, 7 Mar 2023 17:47:00 -0500 Received: from hosting.gsystem.sk (hosting.gsystem.sk [212.5.213.30]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 3E0E059D9; Tue, 7 Mar 2023 14:46:49 -0800 (PST) Received: from gsql.ggedos.sk (off-20.infotel.telecom.sk [212.5.213.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by hosting.gsystem.sk (Postfix) with ESMTPSA id 053947A0533; Tue, 7 Mar 2023 23:46:48 +0100 (CET) From: Ondrej Zary To: Damien Le Moal , Sudip Mukherjee Cc: Christoph Hellwig , Sergey Shtylyov , Jens Axboe , Tim Waugh , linux-block@vger.kernel.org, linux-parport@lists.infradead.org, linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 02/32] pata_parport-bpck6: remove useless range check from read/write_regr Date: Tue, 7 Mar 2023 23:45:57 +0100 Message-Id: <20230307224627.28011-3-linux@zary.sk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20230307224627.28011-1-linux@zary.sk> References: <20230307224627.28011-1-linux@zary.sk> MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759751022450608944?= X-GMAIL-MSGID: =?utf-8?q?1759751022450608944?= bpck6_read_regr() and bpck6_write_regr() check values of cont and reg but there's no point in doing that. They can only be called with a fixed set of values. Remove the checks. Signed-off-by: Ondrej Zary Reviewed-by: Sergey Shtylyov --- drivers/ata/pata_parport/bpck6.c | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/drivers/ata/pata_parport/bpck6.c b/drivers/ata/pata_parport/bpck6.c index 842e8116b649..4d6edb9c1245 100644 --- a/drivers/ata/pata_parport/bpck6.c +++ b/drivers/ata/pata_parport/bpck6.c @@ -25,24 +25,12 @@ static int bpck6_read_regr(struct pi_adapter *pi, int cont, int reg) { - unsigned int out; - - /* check for bad settings */ - if (reg<0 || reg>7 || cont<0 || cont>2) - { - return(-1); - } - out=ppc6_rd_port(PPCSTRUCT(pi),cont?reg|8:reg); - return(out); + return ppc6_rd_port(PPCSTRUCT(pi), cont?reg|8:reg); } static void bpck6_write_regr(struct pi_adapter *pi, int cont, int reg, int val) { - /* check for bad settings */ - if (reg>=0 && reg<=7 && cont>=0 && cont<=1) - { - ppc6_wr_port(PPCSTRUCT(pi),cont?reg|8:reg,(u8)val); - } + ppc6_wr_port(PPCSTRUCT(pi), cont?reg|8:reg, val); } static void bpck6_write_block(struct pi_adapter *pi, char *buf, int len) From patchwork Tue Mar 7 22:45:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ondrej Zary X-Patchwork-Id: 65949 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp10789wrd; Tue, 7 Mar 2023 15:04:18 -0800 (PST) X-Google-Smtp-Source: AK7set//wibp+jc0NeBFNe/4xMjE7b2QUtGDBSTVS22xDjTv/FPHSFW+xwNI+TFMECBanSLzZs+z X-Received: by 2002:aa7:c1c4:0:b0:4c5:bc48:d422 with SMTP id d4-20020aa7c1c4000000b004c5bc48d422mr13123524edp.7.1678230258685; Tue, 07 Mar 2023 15:04:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678230258; cv=none; d=google.com; s=arc-20160816; b=SL2tFqcibPbiI3lQNl4hPYcBjQ7f+9yU4iyI8t6JM37UPVyBpjnNzqsqmdrJ/71ErV 6VvcmarBvM6gZDVfvN4IRUzk16Ahm4SKkot1ygVnweJnRy8VIpoxtl/VbqDr1Vu0eWYw SMo9Lcc58tEyTBe1hIx+O4zBdbn0T4mynqVp46aSlU7AVDTSRYcYGADFnDwnwYjI9f3K feQhY4VCnT150coA2Gu6FEfbVf2B+g2hjWcMrh5fi0FxKifGWgxvVsRmRQi0ZU/jh7qi LIpkqmL/MRTu3min6EiswIDB81kr1G2Q4Oy5kQIpaaekyvftO9HOaqnQNppWvKHq3IRF vcSA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=i5s39yySUz+SHiMEbv7pflgYBsYdlWC40wAlOX/X4EI=; b=yqohPwR4w+DknPwH31Ie4B4hKFv6Sjcu6o39o3raIv5PFLe6S+fyRjs7yBAvwLpunc 0JOKAAMvxa1qaX8KNZz7V3QMJ2daEKEOcoqlljfBXyDLn5DAclFMxd1dn1QXTEySHZp9 brJ4meH9vcHTInXv0UJHhmY/Wi3yjDLErXXQ4ingDtTxE+eo0L1JCenEA4fcqZ0A2GPA gNmp1IqKOj3sXVzqSJQnyVxG8q71BFqRmLAhKbvM/no9jq6x4MvW5eoe3sait9zuyoDe Vw9zE140uc7bTrvgIWN5sxjhOysSj6FosO0QHwo4Fy7Y9KvLRpAasIzlvmcWuNs/tFCJ 9rKQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id di8-20020a170906730800b008b17569b4d9si5612980ejc.361.2023.03.07.15.03.54; Tue, 07 Mar 2023 15:04:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231135AbjCGWrM (ORCPT + 99 others); Tue, 7 Mar 2023 17:47:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33270 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229549AbjCGWrB (ORCPT ); Tue, 7 Mar 2023 17:47:01 -0500 Received: from hosting.gsystem.sk (hosting.gsystem.sk [212.5.213.30]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 3DFF240D2; Tue, 7 Mar 2023 14:46:49 -0800 (PST) Received: from gsql.ggedos.sk (off-20.infotel.telecom.sk [212.5.213.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by hosting.gsystem.sk (Postfix) with ESMTPSA id 2A4F67A0568; Tue, 7 Mar 2023 23:46:48 +0100 (CET) From: Ondrej Zary To: Damien Le Moal , Sudip Mukherjee Cc: Christoph Hellwig , Sergey Shtylyov , Jens Axboe , Tim Waugh , linux-block@vger.kernel.org, linux-parport@lists.infradead.org, linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 03/32] pata_parport-bpck6: don't cast pi->pardev to struct pardevice * Date: Tue, 7 Mar 2023 23:45:58 +0100 Message-Id: <20230307224627.28011-4-linux@zary.sk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20230307224627.28011-1-linux@zary.sk> References: <20230307224627.28011-1-linux@zary.sk> MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759751971481292345?= X-GMAIL-MSGID: =?utf-8?q?1759751971481292345?= pi->pardev is struct pardevice *, no need to cast it to the same type. Also clean up the return mess. Signed-off-by: Ondrej Zary Reviewed-by: Sergey Shtylyov --- drivers/ata/pata_parport/bpck6.c | 24 ++++++------------------ 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/drivers/ata/pata_parport/bpck6.c b/drivers/ata/pata_parport/bpck6.c index 4d6edb9c1245..fa1f7d4fe3cb 100644 --- a/drivers/ata/pata_parport/bpck6.c +++ b/drivers/ata/pata_parport/bpck6.c @@ -74,30 +74,18 @@ static void bpck6_disconnect(struct pi_adapter *pi) static int bpck6_test_port(struct pi_adapter *pi) /* check for 8-bit port */ { dev_dbg(&pi->dev, "PARPORT indicates modes=%x for lp=0x%lx\n", - ((struct pardevice *)(pi->pardev))->port->modes, - ((struct pardevice *)(pi->pardev))->port->base); + pi->pardev->port->modes, pi->pardev->port->base); /*copy over duplicate stuff.. initialize state info*/ PPCSTRUCT(pi)->ppc_id=pi->unit; PPCSTRUCT(pi)->lpt_addr=pi->port; - /* look at the parport device to see if what modes we can use */ - if(((struct pardevice *)(pi->pardev))->port->modes & - (PARPORT_MODE_EPP) - ) - { - return 5; /* Can do EPP*/ - } - else if(((struct pardevice *)(pi->pardev))->port->modes & - (PARPORT_MODE_TRISTATE) - ) - { + /* look at the parport device to see what modes we can use */ + if (pi->pardev->port->modes & PARPORT_MODE_EPP) + return 5; /* Can do EPP */ + if (pi->pardev->port->modes & PARPORT_MODE_TRISTATE) return 2; - } - else /*Just flat SPP*/ - { - return 1; - } + return 1; /* Just flat SPP */ } static int bpck6_probe_unit(struct pi_adapter *pi) From patchwork Tue Mar 7 22:45:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ondrej Zary X-Patchwork-Id: 65915 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp4345wrd; Tue, 7 Mar 2023 14:49:15 -0800 (PST) X-Google-Smtp-Source: AK7set9Y6iCWIaX52VeAfM/0XUDP36c/fQ7lGaRpssLgY9fU64A55GM6xJk0S6FrgJPj44KVwFei X-Received: by 2002:a17:902:c94c:b0:19b:33c0:4091 with SMTP id i12-20020a170902c94c00b0019b33c04091mr21305695pla.52.1678229355133; Tue, 07 Mar 2023 14:49:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678229355; cv=none; d=google.com; s=arc-20160816; b=EL1WBBF3KZ5cSW8+FAyrsz5iDGgFO9JTpFLETea2zD47UCqwjfBQjSwCEldnXUNvRa lC3JzaEnyZllt61YPUUt1Db3JRK1y5WWWxshgooCCl2AG0FgJzU3WwOqp6y30zpLYyPI Tb2/WZOoEJMRE1AGYggFijKeD6XQgS5zYysXkAFAIlG0ac4EzMOgEyC2fBZhHUKC/uO/ 2zxLk/sv7A6WW7cbEWyM0ke/JSKuyEJ3nJu6Q84m1ggMPUjnj60z2qh2a5i0NeUGHyWR HLIKktpUTR1EzVlBSw+2OTin59t/aZ4axI3XvSg9SHVVEbuW+n8RfsC8qdigVmQcw+t6 LoiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=BJaFizK7ymwNJHCqOVUsvQBF9BnMWHZEj4L9E1Liumc=; b=JNViNUJ/AdzATRHMR/wC1NpJcB10/4tr6kwFG8BbzJAA2B2EvqXkYXOJKO5alwobNv To5Cj4dXQibmGUF2MZZrI9pjLUw5x1rc8rHmSic7cnJy2YSsCqG6n/+rnjVp47ub3W0F pF8jWYRIDinEBymSMRr6Y2zRO5O/IzAILk0mjVD9Qj8ZWXRd3o/s/ruXJRT99XTXkfFr 9AUEK1lyJKnsQMtvnPf6y8Ewdj95x6HaBkYHVXZeUeg5a3rLhC72UUHCoPaZ2QOmTo5Y yX1Hz+l2OZTV1W6DIj7IiAmmQIpGS27Ll8R6fo14SfF8L2Mb+AJ+kBCVUKHo9ww9BQxW edLA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id jx8-20020a170903138800b0019cd71b56cbsi11888228plb.522.2023.03.07.14.49.01; Tue, 07 Mar 2023 14:49:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231618AbjCGWrV (ORCPT + 99 others); Tue, 7 Mar 2023 17:47:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33250 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229772AbjCGWrB (ORCPT ); Tue, 7 Mar 2023 17:47:01 -0500 Received: from hosting.gsystem.sk (hosting.gsystem.sk [212.5.213.30]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 3E2A57288; Tue, 7 Mar 2023 14:46:49 -0800 (PST) Received: from gsql.ggedos.sk (off-20.infotel.telecom.sk [212.5.213.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by hosting.gsystem.sk (Postfix) with ESMTPSA id 3CBE07A05AB; Tue, 7 Mar 2023 23:46:48 +0100 (CET) From: Ondrej Zary To: Damien Le Moal , Sudip Mukherjee Cc: Christoph Hellwig , Sergey Shtylyov , Jens Axboe , Tim Waugh , linux-block@vger.kernel.org, linux-parport@lists.infradead.org, linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 04/32] pata_parport-bpck6: pass around struct pi_adapter * Date: Tue, 7 Mar 2023 23:45:59 +0100 Message-Id: <20230307224627.28011-5-linux@zary.sk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20230307224627.28011-1-linux@zary.sk> References: <20230307224627.28011-1-linux@zary.sk> MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759751024178161504?= X-GMAIL-MSGID: =?utf-8?q?1759751024178161504?= Remove Interface typedef, pass around struct pi_adapter * down to all functions instead. Remove PPCSTRUCT define. Signed-off-by: Ondrej Zary Reviewed-by: Sergey Shtylyov Reviewed-by: Sergey Shtylyov --- drivers/ata/pata_parport/bpck6.c | 43 ++++----- drivers/ata/pata_parport/ppc6lnx.c | 139 +++++++++++++++-------------- 2 files changed, 96 insertions(+), 86 deletions(-) diff --git a/drivers/ata/pata_parport/bpck6.c b/drivers/ata/pata_parport/bpck6.c index fa1f7d4fe3cb..bc128a2c444e 100644 --- a/drivers/ata/pata_parport/bpck6.c +++ b/drivers/ata/pata_parport/bpck6.c @@ -18,67 +18,67 @@ #include #include #include -#include "ppc6lnx.c" #include "pata_parport.h" - -#define PPCSTRUCT(pi) ((Interface *)(pi->private)) +#include "ppc6lnx.c" static int bpck6_read_regr(struct pi_adapter *pi, int cont, int reg) { - return ppc6_rd_port(PPCSTRUCT(pi), cont?reg|8:reg); + return ppc6_rd_port(pi, cont?reg|8:reg); } static void bpck6_write_regr(struct pi_adapter *pi, int cont, int reg, int val) { - ppc6_wr_port(PPCSTRUCT(pi), cont?reg|8:reg, val); + ppc6_wr_port(pi, cont?reg|8:reg, val); } static void bpck6_write_block(struct pi_adapter *pi, char *buf, int len) { - ppc6_wr_port16_blk(PPCSTRUCT(pi), ATA_REG_DATA, buf, (u32)len>>1); + ppc6_wr_port16_blk(pi, ATA_REG_DATA, buf, (u32)len>>1); } static void bpck6_read_block(struct pi_adapter *pi, char *buf, int len) { - ppc6_rd_port16_blk(PPCSTRUCT(pi), ATA_REG_DATA, buf, (u32)len>>1); + ppc6_rd_port16_blk(pi, ATA_REG_DATA, buf, (u32)len>>1); } static void bpck6_connect(struct pi_adapter *pi) { + struct ppc_storage *ppc = (void *)(pi->private); dev_dbg(&pi->dev, "connect\n"); if(pi->mode >=2) { - PPCSTRUCT(pi)->mode=4+pi->mode-2; + ppc->mode = 4+pi->mode-2; } else if(pi->mode==1) { - PPCSTRUCT(pi)->mode=3; + ppc->mode = 3; } else { - PPCSTRUCT(pi)->mode=1; + ppc->mode = 1; } - ppc6_open(PPCSTRUCT(pi)); - ppc6_wr_extout(PPCSTRUCT(pi),0x3); + ppc6_open(pi); + ppc6_wr_extout(pi, 0x3); } static void bpck6_disconnect(struct pi_adapter *pi) { dev_dbg(&pi->dev, "disconnect\n"); - ppc6_wr_extout(PPCSTRUCT(pi),0x0); - ppc6_close(PPCSTRUCT(pi)); + ppc6_wr_extout(pi, 0x0); + ppc6_close(pi); } static int bpck6_test_port(struct pi_adapter *pi) /* check for 8-bit port */ { + struct ppc_storage *ppc = (void *)(pi->private); dev_dbg(&pi->dev, "PARPORT indicates modes=%x for lp=0x%lx\n", pi->pardev->port->modes, pi->pardev->port->base); /*copy over duplicate stuff.. initialize state info*/ - PPCSTRUCT(pi)->ppc_id=pi->unit; - PPCSTRUCT(pi)->lpt_addr=pi->port; + ppc->ppc_id = pi->unit; + ppc->lpt_addr = pi->port; /* look at the parport device to see what modes we can use */ if (pi->pardev->port->modes & PARPORT_MODE_EPP) @@ -90,23 +90,24 @@ static int bpck6_test_port(struct pi_adapter *pi) /* check for 8-bit port */ static int bpck6_probe_unit(struct pi_adapter *pi) { + struct ppc_storage *ppc = (void *)(pi->private); int out; dev_dbg(&pi->dev, "PROBE UNIT %x on port:%x\n", pi->unit, pi->port); /*SET PPC UNIT NUMBER*/ - PPCSTRUCT(pi)->ppc_id=pi->unit; + ppc->ppc_id = pi->unit; /*LOWER DOWN TO UNIDIRECTIONAL*/ - PPCSTRUCT(pi)->mode=1; + ppc->mode = 1; - out=ppc6_open(PPCSTRUCT(pi)); + out = ppc6_open(pi); dev_dbg(&pi->dev, "ppc_open returned %2x\n", out); if(out) { - ppc6_close(PPCSTRUCT(pi)); + ppc6_close(pi); dev_dbg(&pi->dev, "leaving probe\n"); return(1); } @@ -128,7 +129,7 @@ static void bpck6_log_adapter(struct pi_adapter *pi) static int bpck6_init_proto(struct pi_adapter *pi) { - Interface *p = kzalloc(sizeof(Interface), GFP_KERNEL); + struct ppc_storage *p = kzalloc(sizeof(struct ppc_storage), GFP_KERNEL); if (p) { pi->private = (unsigned long)p; diff --git a/drivers/ata/pata_parport/ppc6lnx.c b/drivers/ata/pata_parport/ppc6lnx.c index 5e5521d3b1dd..f12bb019fc61 100644 --- a/drivers/ata/pata_parport/ppc6lnx.c +++ b/drivers/ata/pata_parport/ppc6lnx.c @@ -64,7 +64,7 @@ //*************************************************************************** -typedef struct ppc_storage { +struct ppc_storage { u16 lpt_addr; // LPT base address u8 ppc_id; u8 mode; // operating mode @@ -79,7 +79,7 @@ typedef struct ppc_storage { u8 org_data; // original LPT data port contents u8 org_ctrl; // original LPT control port contents u8 cur_ctrl; // current control port contents -} Interface; +}; //*************************************************************************** @@ -101,26 +101,27 @@ typedef struct ppc_storage { //*************************************************************************** -static int ppc6_select(Interface *ppc); -static void ppc6_deselect(Interface *ppc); -static void ppc6_send_cmd(Interface *ppc, u8 cmd); -static void ppc6_wr_data_byte(Interface *ppc, u8 data); -static u8 ppc6_rd_data_byte(Interface *ppc); -static u8 ppc6_rd_port(Interface *ppc, u8 port); -static void ppc6_wr_port(Interface *ppc, u8 port, u8 data); -static void ppc6_rd_data_blk(Interface *ppc, u8 *data, long count); -static void ppc6_wait_for_fifo(Interface *ppc); -static void ppc6_wr_data_blk(Interface *ppc, u8 *data, long count); -static void ppc6_rd_port16_blk(Interface *ppc, u8 port, u8 *data, long length); -static void ppc6_wr_port16_blk(Interface *ppc, u8 port, u8 *data, long length); -static void ppc6_wr_extout(Interface *ppc, u8 regdata); -static int ppc6_open(Interface *ppc); -static void ppc6_close(Interface *ppc); +static int ppc6_select(struct pi_adapter *pi); +static void ppc6_deselect(struct pi_adapter *pi); +static void ppc6_send_cmd(struct pi_adapter *pi, u8 cmd); +static void ppc6_wr_data_byte(struct pi_adapter *pi, u8 data); +static u8 ppc6_rd_data_byte(struct pi_adapter *pi); +static u8 ppc6_rd_port(struct pi_adapter *pi, u8 port); +static void ppc6_wr_port(struct pi_adapter *pi, u8 port, u8 data); +static void ppc6_rd_data_blk(struct pi_adapter *pi, u8 *data, long count); +static void ppc6_wait_for_fifo(struct pi_adapter *pi); +static void ppc6_wr_data_blk(struct pi_adapter *pi, u8 *data, long count); +static void ppc6_rd_port16_blk(struct pi_adapter *pi, u8 port, u8 *data, long length); +static void ppc6_wr_port16_blk(struct pi_adapter *pi, u8 port, u8 *data, long length); +static void ppc6_wr_extout(struct pi_adapter *pi, u8 regdata); +static int ppc6_open(struct pi_adapter *pi); +static void ppc6_close(struct pi_adapter *pi); //*************************************************************************** -static int ppc6_select(Interface *ppc) +static int ppc6_select(struct pi_adapter *pi) { + struct ppc_storage *ppc = (void *)(pi->private); u8 i, j, k; i = inb(ppc->lpt_addr + 1); @@ -205,8 +206,9 @@ static int ppc6_select(Interface *ppc) //*************************************************************************** -static void ppc6_deselect(Interface *ppc) +static void ppc6_deselect(struct pi_adapter *pi) { + struct ppc_storage *ppc = (void *)(pi->private); if (ppc->mode & 4) // EPP ppc->cur_ctrl |= port_init; else // PPC/ECP @@ -223,8 +225,9 @@ static void ppc6_deselect(Interface *ppc) //*************************************************************************** -static void ppc6_send_cmd(Interface *ppc, u8 cmd) +static void ppc6_send_cmd(struct pi_adapter *pi, u8 cmd) { + struct ppc_storage *ppc = (void *)(pi->private); switch(ppc->mode) { case PPCMODE_UNI_SW : @@ -254,8 +257,9 @@ static void ppc6_send_cmd(Interface *ppc, u8 cmd) //*************************************************************************** -static void ppc6_wr_data_byte(Interface *ppc, u8 data) +static void ppc6_wr_data_byte(struct pi_adapter *pi, u8 data) { + struct ppc_storage *ppc = (void *)(pi->private); switch(ppc->mode) { case PPCMODE_UNI_SW : @@ -285,8 +289,9 @@ static void ppc6_wr_data_byte(Interface *ppc, u8 data) //*************************************************************************** -static u8 ppc6_rd_data_byte(Interface *ppc) +static u8 ppc6_rd_data_byte(struct pi_adapter *pi) { + struct ppc_storage *ppc = (void *)(pi->private); u8 data = 0; switch(ppc->mode) @@ -358,26 +363,27 @@ static u8 ppc6_rd_data_byte(Interface *ppc) //*************************************************************************** -static u8 ppc6_rd_port(Interface *ppc, u8 port) +static u8 ppc6_rd_port(struct pi_adapter *pi, u8 port) { - ppc6_send_cmd(ppc,(u8)(port | ACCESS_PORT | ACCESS_READ)); + ppc6_send_cmd(pi, port | ACCESS_PORT | ACCESS_READ); - return(ppc6_rd_data_byte(ppc)); + return ppc6_rd_data_byte(pi); } //*************************************************************************** -static void ppc6_wr_port(Interface *ppc, u8 port, u8 data) +static void ppc6_wr_port(struct pi_adapter *pi, u8 port, u8 data) { - ppc6_send_cmd(ppc,(u8)(port | ACCESS_PORT | ACCESS_WRITE)); + ppc6_send_cmd(pi, port | ACCESS_PORT | ACCESS_WRITE); - ppc6_wr_data_byte(ppc, data); + ppc6_wr_data_byte(pi, data); } //*************************************************************************** -static void ppc6_rd_data_blk(Interface *ppc, u8 *data, long count) +static void ppc6_rd_data_blk(struct pi_adapter *pi, u8 *data, long count) { + struct ppc_storage *ppc = (void *)(pi->private); switch(ppc->mode) { case PPCMODE_UNI_SW : @@ -512,8 +518,9 @@ static void ppc6_rd_data_blk(Interface *ppc, u8 *data, long count) //*************************************************************************** -static void ppc6_wait_for_fifo(Interface *ppc) +static void ppc6_wait_for_fifo(struct pi_adapter *pi) { + struct ppc_storage *ppc = (void *)(pi->private); int i; if (ppc->ppc_flags & fifo_wait) @@ -525,8 +532,9 @@ static void ppc6_wait_for_fifo(Interface *ppc) //*************************************************************************** -static void ppc6_wr_data_blk(Interface *ppc, u8 *data, long count) +static void ppc6_wr_data_blk(struct pi_adapter *pi, u8 *data, long count) { + struct ppc_storage *ppc = (void *)(pi->private); switch(ppc->mode) { case PPCMODE_UNI_SW : @@ -549,7 +557,7 @@ static void ppc6_wr_data_blk(Interface *ppc, u8 *data, long count) { u8 this, last; - ppc6_send_cmd(ppc,(CMD_PREFIX_SET | PREFIX_FASTWR)); + ppc6_send_cmd(pi, CMD_PREFIX_SET | PREFIX_FASTWR); ppc->cur_ctrl |= port_stb; @@ -582,7 +590,7 @@ static void ppc6_wr_data_blk(Interface *ppc, u8 *data, long count) outb(ppc->cur_ctrl, ppc->lpt_addr + 2); - ppc6_send_cmd(ppc,(CMD_PREFIX_RESET | PREFIX_FASTWR)); + ppc6_send_cmd(pi, CMD_PREFIX_RESET | PREFIX_FASTWR); break; } @@ -595,7 +603,7 @@ static void ppc6_wr_data_blk(Interface *ppc, u8 *data, long count) count--; } - ppc6_wait_for_fifo(ppc); + ppc6_wait_for_fifo(pi); break; } @@ -615,7 +623,7 @@ static void ppc6_wr_data_blk(Interface *ppc, u8 *data, long count) count--; } - ppc6_wait_for_fifo(ppc); + ppc6_wait_for_fifo(pi); break; } @@ -635,7 +643,7 @@ static void ppc6_wr_data_blk(Interface *ppc, u8 *data, long count) count--; } - ppc6_wait_for_fifo(ppc); + ppc6_wait_for_fifo(pi); break; } @@ -644,72 +652,73 @@ static void ppc6_wr_data_blk(Interface *ppc, u8 *data, long count) //*************************************************************************** -static void ppc6_rd_port16_blk(Interface *ppc, u8 port, u8 *data, long length) +static void ppc6_rd_port16_blk(struct pi_adapter *pi, u8 port, u8 *data, long length) { length = length << 1; - ppc6_send_cmd(ppc, (REG_BLKSIZE | ACCESS_REG | ACCESS_WRITE)); - ppc6_wr_data_byte(ppc,(u8)length); - ppc6_wr_data_byte(ppc,(u8)(length >> 8)); - ppc6_wr_data_byte(ppc,0); + ppc6_send_cmd(pi, REG_BLKSIZE | ACCESS_REG | ACCESS_WRITE); + ppc6_wr_data_byte(pi, (u8)length); + ppc6_wr_data_byte(pi, (u8)(length >> 8)); + ppc6_wr_data_byte(pi, 0); - ppc6_send_cmd(ppc, (CMD_PREFIX_SET | PREFIX_IO16 | PREFIX_BLK)); + ppc6_send_cmd(pi, CMD_PREFIX_SET | PREFIX_IO16 | PREFIX_BLK); - ppc6_send_cmd(ppc, (u8)(port | ACCESS_PORT | ACCESS_READ)); + ppc6_send_cmd(pi, port | ACCESS_PORT | ACCESS_READ); - ppc6_rd_data_blk(ppc, data, length); + ppc6_rd_data_blk(pi, data, length); - ppc6_send_cmd(ppc, (CMD_PREFIX_RESET | PREFIX_IO16 | PREFIX_BLK)); + ppc6_send_cmd(pi, CMD_PREFIX_RESET | PREFIX_IO16 | PREFIX_BLK); } //*************************************************************************** -static void ppc6_wr_port16_blk(Interface *ppc, u8 port, u8 *data, long length) +static void ppc6_wr_port16_blk(struct pi_adapter *pi, u8 port, u8 *data, long length) { length = length << 1; - ppc6_send_cmd(ppc, (REG_BLKSIZE | ACCESS_REG | ACCESS_WRITE)); - ppc6_wr_data_byte(ppc,(u8)length); - ppc6_wr_data_byte(ppc,(u8)(length >> 8)); - ppc6_wr_data_byte(ppc,0); + ppc6_send_cmd(pi, REG_BLKSIZE | ACCESS_REG | ACCESS_WRITE); + ppc6_wr_data_byte(pi, (u8)length); + ppc6_wr_data_byte(pi, (u8)(length >> 8)); + ppc6_wr_data_byte(pi, 0); - ppc6_send_cmd(ppc, (CMD_PREFIX_SET | PREFIX_IO16 | PREFIX_BLK)); + ppc6_send_cmd(pi, CMD_PREFIX_SET | PREFIX_IO16 | PREFIX_BLK); - ppc6_send_cmd(ppc, (u8)(port | ACCESS_PORT | ACCESS_WRITE)); + ppc6_send_cmd(pi, port | ACCESS_PORT | ACCESS_WRITE); - ppc6_wr_data_blk(ppc, data, length); + ppc6_wr_data_blk(pi, data, length); - ppc6_send_cmd(ppc, (CMD_PREFIX_RESET | PREFIX_IO16 | PREFIX_BLK)); + ppc6_send_cmd(pi, CMD_PREFIX_RESET | PREFIX_IO16 | PREFIX_BLK); } //*************************************************************************** -static void ppc6_wr_extout(Interface *ppc, u8 regdata) +static void ppc6_wr_extout(struct pi_adapter *pi, u8 regdata) { - ppc6_send_cmd(ppc,(REG_VERSION | ACCESS_REG | ACCESS_WRITE)); + ppc6_send_cmd(pi, REG_VERSION | ACCESS_REG | ACCESS_WRITE); - ppc6_wr_data_byte(ppc, (u8)((regdata & 0x03) << 6)); + ppc6_wr_data_byte(pi, (u8)((regdata & 0x03) << 6)); } //*************************************************************************** -static int ppc6_open(Interface *ppc) +static int ppc6_open(struct pi_adapter *pi) { + struct ppc_storage *ppc = (void *)(pi->private); int ret; - ret = ppc6_select(ppc); + ret = ppc6_select(pi); if (ret == 0) return(ret); ppc->ppc_flags &= ~fifo_wait; - ppc6_send_cmd(ppc, (ACCESS_REG | ACCESS_WRITE | REG_RAMSIZE)); - ppc6_wr_data_byte(ppc, RAMSIZE_128K); + ppc6_send_cmd(pi, ACCESS_REG | ACCESS_WRITE | REG_RAMSIZE); + ppc6_wr_data_byte(pi, RAMSIZE_128K); - ppc6_send_cmd(ppc, (ACCESS_REG | ACCESS_READ | REG_VERSION)); + ppc6_send_cmd(pi, ACCESS_REG | ACCESS_READ | REG_VERSION); - if ((ppc6_rd_data_byte(ppc) & 0x3F) == 0x0C) + if ((ppc6_rd_data_byte(pi) & 0x3F) == 0x0C) ppc->ppc_flags |= fifo_wait; return(ret); @@ -717,9 +726,9 @@ static int ppc6_open(Interface *ppc) //*************************************************************************** -static void ppc6_close(Interface *ppc) +static void ppc6_close(struct pi_adapter *pi) { - ppc6_deselect(ppc); + ppc6_deselect(pi); } //*************************************************************************** From patchwork Tue Mar 7 22:46:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ondrej Zary X-Patchwork-Id: 65944 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp10059wrd; Tue, 7 Mar 2023 15:03:04 -0800 (PST) X-Google-Smtp-Source: AK7set88jTLVpTIMYKbNSqcnRK2XOCWvCDlQwjeQPr9NALVYRYFdvo8o1LUNM/DNMMKvx/48Nq2+ X-Received: by 2002:aa7:d683:0:b0:4af:75fd:8214 with SMTP id d3-20020aa7d683000000b004af75fd8214mr12606545edr.38.1678230184499; Tue, 07 Mar 2023 15:03:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678230184; cv=none; d=google.com; s=arc-20160816; b=ah5n+obLzVlg2rA1U1MsI1cPDHOIUJfUTm4o0h4tHXgdz3gBnGlVlJ6h4zRuQvLG+A QDawC++/MU/tYjgBO6nVCjA6YGRKK36bxIKLCAex22iQAWqWV3t9s+NwnOwpJ8+79tmM JbWFi+rZKmcn6ifLFBO1d36s0F11QVakG3D60ngjsXGT7+SNEHRFAnaZacoUSYocy7WA z/bRnTbHUoDQDUWRpdCdnfVta3ykQ+rNEYraBWixNVtiOaw2rbXiw2HVH97DLGNPMFen e1jBLKyin63PViQ0fSuIrjfCebtOjLa31rU9QFsTn5BWe6ZY8uWQJhfwIRP+ZeGKVSYv Hw/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=LqD/j2TxIJQHb+0JuJCnwFMmHzxIUclLpn4lkbjUiu0=; b=piIVSFAVmS6s1ODaRyFQ5x+vfOLFV3x0f3wAP90evuN7MtR0JhXl8arD4SdPrK4h5s 8lY9NMYQ6CjSzoNsKMBp2sE3wK4ekmY4iOVP33bmAVTW8Hp9bWSuHjWswmS0s9V+N5cQ XC0svZD/iiCANAp5h+2IH4r15t6pimFSXWIFbQJBHRCYfkEQp3jNnFR+4TjpyW6thKmh D8lX/j7ftWOTOntADAelz/hs97/4MybjmeiwtwfIyasHJ0potQwltGqceG6zLaDOokQo vrKNaJdyyF48+cb3DEidhiuqur4UWzg5OLFt2mOVnw2WlEO0ODPInb1F07ymWNa8wsqv pkZQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b4-20020aa7d484000000b004acc575090fsi3925307edr.36.2023.03.07.15.02.40; Tue, 07 Mar 2023 15:03:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231303AbjCGWr5 (ORCPT + 99 others); Tue, 7 Mar 2023 17:47:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33464 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229923AbjCGWrH (ORCPT ); Tue, 7 Mar 2023 17:47:07 -0500 Received: from hosting.gsystem.sk (hosting.gsystem.sk [212.5.213.30]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 4D9E84EE4; Tue, 7 Mar 2023 14:47:00 -0800 (PST) Received: from gsql.ggedos.sk (off-20.infotel.telecom.sk [212.5.213.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by hosting.gsystem.sk (Postfix) with ESMTPSA id 5F2977A05BD; Tue, 7 Mar 2023 23:46:48 +0100 (CET) From: Ondrej Zary To: Damien Le Moal , Sudip Mukherjee Cc: Christoph Hellwig , Sergey Shtylyov , Jens Axboe , Tim Waugh , linux-block@vger.kernel.org, linux-parport@lists.infradead.org, linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 05/32] pata_parport-bpck6: remove lpt_addr from struct ppc_storage Date: Tue, 7 Mar 2023 23:46:00 +0100 Message-Id: <20230307224627.28011-6-linux@zary.sk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20230307224627.28011-1-linux@zary.sk> References: <20230307224627.28011-1-linux@zary.sk> MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759751894096354846?= X-GMAIL-MSGID: =?utf-8?q?1759751894096354846?= lpt_addr duplicates pi->port. Remove it. Signed-off-by: Ondrej Zary Reviewed-by: Sergey Shtylyov --- drivers/ata/pata_parport/bpck6.c | 1 - drivers/ata/pata_parport/ppc6lnx.c | 153 ++++++++++++++--------------- 2 files changed, 76 insertions(+), 78 deletions(-) diff --git a/drivers/ata/pata_parport/bpck6.c b/drivers/ata/pata_parport/bpck6.c index bc128a2c444e..50d313fc529e 100644 --- a/drivers/ata/pata_parport/bpck6.c +++ b/drivers/ata/pata_parport/bpck6.c @@ -78,7 +78,6 @@ static int bpck6_test_port(struct pi_adapter *pi) /* check for 8-bit port */ /*copy over duplicate stuff.. initialize state info*/ ppc->ppc_id = pi->unit; - ppc->lpt_addr = pi->port; /* look at the parport device to see what modes we can use */ if (pi->pardev->port->modes & PARPORT_MODE_EPP) diff --git a/drivers/ata/pata_parport/ppc6lnx.c b/drivers/ata/pata_parport/ppc6lnx.c index f12bb019fc61..c00e561cc833 100644 --- a/drivers/ata/pata_parport/ppc6lnx.c +++ b/drivers/ata/pata_parport/ppc6lnx.c @@ -65,7 +65,6 @@ //*************************************************************************** struct ppc_storage { - u16 lpt_addr; // LPT base address u8 ppc_id; u8 mode; // operating mode // 0 = PPC Uni SW @@ -124,65 +123,65 @@ static int ppc6_select(struct pi_adapter *pi) struct ppc_storage *ppc = (void *)(pi->private); u8 i, j, k; - i = inb(ppc->lpt_addr + 1); + i = inb(pi->port + 1); if (i & 1) - outb(i, ppc->lpt_addr + 1); + outb(i, pi->port + 1); - ppc->org_data = inb(ppc->lpt_addr); + ppc->org_data = inb(pi->port); - ppc->org_ctrl = inb(ppc->lpt_addr + 2) & 0x5F; // readback ctrl + ppc->org_ctrl = inb(pi->port + 2) & 0x5F; // readback ctrl ppc->cur_ctrl = ppc->org_ctrl; ppc->cur_ctrl |= port_sel; - outb(ppc->cur_ctrl, ppc->lpt_addr + 2); + outb(ppc->cur_ctrl, pi->port + 2); if (ppc->org_data == 'b') - outb('x', ppc->lpt_addr); + outb('x', pi->port); - outb('b', ppc->lpt_addr); - outb('p', ppc->lpt_addr); - outb(ppc->ppc_id, ppc->lpt_addr); - outb(~ppc->ppc_id,ppc->lpt_addr); + outb('b', pi->port); + outb('p', pi->port); + outb(ppc->ppc_id, pi->port); + outb(~ppc->ppc_id, pi->port); ppc->cur_ctrl &= ~port_sel; - outb(ppc->cur_ctrl, ppc->lpt_addr + 2); + outb(ppc->cur_ctrl, pi->port + 2); ppc->cur_ctrl = (ppc->cur_ctrl & port_int) | port_init; - outb(ppc->cur_ctrl, ppc->lpt_addr + 2); + outb(ppc->cur_ctrl, pi->port + 2); i = ppc->mode & 0x0C; if (i == 0) i = (ppc->mode & 2) | 1; - outb(i, ppc->lpt_addr); + outb(i, pi->port); ppc->cur_ctrl |= port_sel; - outb(ppc->cur_ctrl, ppc->lpt_addr + 2); + outb(ppc->cur_ctrl, pi->port + 2); // DELAY ppc->cur_ctrl |= port_afd; - outb(ppc->cur_ctrl, ppc->lpt_addr + 2); + outb(ppc->cur_ctrl, pi->port + 2); j = ((i & 0x08) << 4) | ((i & 0x07) << 3); - k = inb(ppc->lpt_addr + 1) & 0xB8; + k = inb(pi->port + 1) & 0xB8; if (j == k) { ppc->cur_ctrl &= ~port_afd; - outb(ppc->cur_ctrl, ppc->lpt_addr + 2); + outb(ppc->cur_ctrl, pi->port + 2); - k = (inb(ppc->lpt_addr + 1) & 0xB8) ^ 0xB8; + k = (inb(pi->port + 1) & 0xB8) ^ 0xB8; if (j == k) { @@ -191,15 +190,15 @@ static int ppc6_select(struct pi_adapter *pi) else // PPC/ECP ppc->cur_ctrl &= ~port_sel; - outb(ppc->cur_ctrl, ppc->lpt_addr + 2); + outb(ppc->cur_ctrl, pi->port + 2); return(1); } } - outb(ppc->org_ctrl, ppc->lpt_addr + 2); + outb(ppc->org_ctrl, pi->port + 2); - outb(ppc->org_data, ppc->lpt_addr); + outb(ppc->org_data, pi->port); return(0); // FAIL } @@ -214,13 +213,13 @@ static void ppc6_deselect(struct pi_adapter *pi) else // PPC/ECP ppc->cur_ctrl |= port_sel; - outb(ppc->cur_ctrl, ppc->lpt_addr + 2); + outb(ppc->cur_ctrl, pi->port + 2); - outb(ppc->org_data, ppc->lpt_addr); + outb(ppc->org_data, pi->port); - outb((ppc->org_ctrl | port_sel), ppc->lpt_addr + 2); + outb((ppc->org_ctrl | port_sel), pi->port + 2); - outb(ppc->org_ctrl, ppc->lpt_addr + 2); + outb(ppc->org_ctrl, pi->port + 2); } //*************************************************************************** @@ -235,11 +234,11 @@ static void ppc6_send_cmd(struct pi_adapter *pi, u8 cmd) case PPCMODE_BI_SW : case PPCMODE_BI_FW : { - outb(cmd, ppc->lpt_addr); + outb(cmd, pi->port); ppc->cur_ctrl ^= cmd_stb; - outb(ppc->cur_ctrl, ppc->lpt_addr + 2); + outb(ppc->cur_ctrl, pi->port + 2); break; } @@ -248,7 +247,7 @@ static void ppc6_send_cmd(struct pi_adapter *pi, u8 cmd) case PPCMODE_EPP_WORD : case PPCMODE_EPP_DWORD : { - outb(cmd, ppc->lpt_addr + 3); + outb(cmd, pi->port + 3); break; } @@ -267,11 +266,11 @@ static void ppc6_wr_data_byte(struct pi_adapter *pi, u8 data) case PPCMODE_BI_SW : case PPCMODE_BI_FW : { - outb(data, ppc->lpt_addr); + outb(data, pi->port); ppc->cur_ctrl ^= data_stb; - outb(ppc->cur_ctrl, ppc->lpt_addr + 2); + outb(ppc->cur_ctrl, pi->port + 2); break; } @@ -280,7 +279,7 @@ static void ppc6_wr_data_byte(struct pi_adapter *pi, u8 data) case PPCMODE_EPP_WORD : case PPCMODE_EPP_DWORD : { - outb(data, ppc->lpt_addr + 4); + outb(data, pi->port + 4); break; } @@ -301,21 +300,21 @@ static u8 ppc6_rd_data_byte(struct pi_adapter *pi) { ppc->cur_ctrl = (ppc->cur_ctrl & ~port_stb) ^ data_stb; - outb(ppc->cur_ctrl, ppc->lpt_addr + 2); + outb(ppc->cur_ctrl, pi->port + 2); // DELAY - data = inb(ppc->lpt_addr + 1); + data = inb(pi->port + 1); data = ((data & 0x80) >> 1) | ((data & 0x38) >> 3); ppc->cur_ctrl |= port_stb; - outb(ppc->cur_ctrl, ppc->lpt_addr + 2); + outb(ppc->cur_ctrl, pi->port + 2); // DELAY - data |= inb(ppc->lpt_addr + 1) & 0xB8; + data |= inb(pi->port + 1) & 0xB8; break; } @@ -325,21 +324,21 @@ static u8 ppc6_rd_data_byte(struct pi_adapter *pi) { ppc->cur_ctrl |= port_dir; - outb(ppc->cur_ctrl, ppc->lpt_addr + 2); + outb(ppc->cur_ctrl, pi->port + 2); ppc->cur_ctrl = (ppc->cur_ctrl | port_stb) ^ data_stb; - outb(ppc->cur_ctrl, ppc->lpt_addr + 2); + outb(ppc->cur_ctrl, pi->port + 2); - data = inb(ppc->lpt_addr); + data = inb(pi->port); ppc->cur_ctrl &= ~port_stb; - outb(ppc->cur_ctrl,ppc->lpt_addr + 2); + outb(ppc->cur_ctrl, pi->port + 2); ppc->cur_ctrl &= ~port_dir; - outb(ppc->cur_ctrl, ppc->lpt_addr + 2); + outb(ppc->cur_ctrl, pi->port + 2); break; } @@ -348,11 +347,11 @@ static u8 ppc6_rd_data_byte(struct pi_adapter *pi) case PPCMODE_EPP_WORD : case PPCMODE_EPP_DWORD : { - outb((ppc->cur_ctrl | port_dir),ppc->lpt_addr + 2); + outb((ppc->cur_ctrl | port_dir), pi->port + 2); - data = inb(ppc->lpt_addr + 4); + data = inb(pi->port + 4); - outb(ppc->cur_ctrl,ppc->lpt_addr + 2); + outb(ppc->cur_ctrl, pi->port + 2); break; } @@ -395,21 +394,21 @@ static void ppc6_rd_data_blk(struct pi_adapter *pi, u8 *data, long count) ppc->cur_ctrl = (ppc->cur_ctrl & ~port_stb) ^ data_stb; - outb(ppc->cur_ctrl, ppc->lpt_addr + 2); + outb(ppc->cur_ctrl, pi->port + 2); // DELAY - d = inb(ppc->lpt_addr + 1); + d = inb(pi->port + 1); d = ((d & 0x80) >> 1) | ((d & 0x38) >> 3); ppc->cur_ctrl |= port_stb; - outb(ppc->cur_ctrl, ppc->lpt_addr + 2); + outb(ppc->cur_ctrl, pi->port + 2); // DELAY - d |= inb(ppc->lpt_addr + 1) & 0xB8; + d |= inb(pi->port + 1) & 0xB8; *data++ = d; count--; @@ -423,7 +422,7 @@ static void ppc6_rd_data_blk(struct pi_adapter *pi, u8 *data, long count) { ppc->cur_ctrl |= port_dir; - outb(ppc->cur_ctrl, ppc->lpt_addr + 2); + outb(ppc->cur_ctrl, pi->port + 2); ppc->cur_ctrl |= port_stb; @@ -431,84 +430,84 @@ static void ppc6_rd_data_blk(struct pi_adapter *pi, u8 *data, long count) { ppc->cur_ctrl ^= data_stb; - outb(ppc->cur_ctrl, ppc->lpt_addr + 2); + outb(ppc->cur_ctrl, pi->port + 2); - *data++ = inb(ppc->lpt_addr); + *data++ = inb(pi->port); count--; } ppc->cur_ctrl &= ~port_stb; - outb(ppc->cur_ctrl, ppc->lpt_addr + 2); + outb(ppc->cur_ctrl, pi->port + 2); ppc->cur_ctrl &= ~port_dir; - outb(ppc->cur_ctrl, ppc->lpt_addr + 2); + outb(ppc->cur_ctrl, pi->port + 2); break; } case PPCMODE_EPP_BYTE : { - outb((ppc->cur_ctrl | port_dir), ppc->lpt_addr + 2); + outb((ppc->cur_ctrl | port_dir), pi->port + 2); // DELAY while(count) { - *data++ = inb(ppc->lpt_addr + 4); + *data++ = inb(pi->port + 4); count--; } - outb(ppc->cur_ctrl, ppc->lpt_addr + 2); + outb(ppc->cur_ctrl, pi->port + 2); break; } case PPCMODE_EPP_WORD : { - outb((ppc->cur_ctrl | port_dir), ppc->lpt_addr + 2); + outb((ppc->cur_ctrl | port_dir), pi->port + 2); // DELAY while(count > 1) { - *((u16 *)data) = inw(ppc->lpt_addr + 4); + *((u16 *)data) = inw(pi->port + 4); data += 2; count -= 2; } while(count) { - *data++ = inb(ppc->lpt_addr + 4); + *data++ = inb(pi->port + 4); count--; } - outb(ppc->cur_ctrl, ppc->lpt_addr + 2); + outb(ppc->cur_ctrl, pi->port + 2); break; } case PPCMODE_EPP_DWORD : { - outb((ppc->cur_ctrl | port_dir),ppc->lpt_addr + 2); + outb((ppc->cur_ctrl | port_dir), pi->port + 2); // DELAY while(count > 3) { - *((u32 *)data) = inl(ppc->lpt_addr + 4); + *((u32 *)data) = inl(pi->port + 4); data += 4; count -= 4; } while(count) { - *data++ = inb(ppc->lpt_addr + 4); + *data++ = inb(pi->port + 4); count--; } - outb(ppc->cur_ctrl, ppc->lpt_addr + 2); + outb(ppc->cur_ctrl, pi->port + 2); break; } @@ -526,7 +525,7 @@ static void ppc6_wait_for_fifo(struct pi_adapter *pi) if (ppc->ppc_flags & fifo_wait) { for(i=0; i<20; i++) - inb(ppc->lpt_addr + 1); + inb(pi->port + 1); } } @@ -542,11 +541,11 @@ static void ppc6_wr_data_blk(struct pi_adapter *pi, u8 *data, long count) { while(count--) { - outb(*data++, ppc->lpt_addr); + outb(*data++, pi->port); ppc->cur_ctrl ^= data_stb; - outb(ppc->cur_ctrl, ppc->lpt_addr + 2); + outb(ppc->cur_ctrl, pi->port + 2); } break; @@ -561,11 +560,11 @@ static void ppc6_wr_data_blk(struct pi_adapter *pi, u8 *data, long count) ppc->cur_ctrl |= port_stb; - outb(ppc->cur_ctrl, ppc->lpt_addr + 2); + outb(ppc->cur_ctrl, pi->port + 2); last = *data; - outb(last, ppc->lpt_addr); + outb(last, pi->port); while(count) { @@ -576,11 +575,11 @@ static void ppc6_wr_data_blk(struct pi_adapter *pi, u8 *data, long count) { ppc->cur_ctrl ^= data_stb; - outb(ppc->cur_ctrl, ppc->lpt_addr + 2); + outb(ppc->cur_ctrl, pi->port + 2); } else { - outb(this, ppc->lpt_addr); + outb(this, pi->port); last = this; } @@ -588,7 +587,7 @@ static void ppc6_wr_data_blk(struct pi_adapter *pi, u8 *data, long count) ppc->cur_ctrl &= ~port_stb; - outb(ppc->cur_ctrl, ppc->lpt_addr + 2); + outb(ppc->cur_ctrl, pi->port + 2); ppc6_send_cmd(pi, CMD_PREFIX_RESET | PREFIX_FASTWR); @@ -599,7 +598,7 @@ static void ppc6_wr_data_blk(struct pi_adapter *pi, u8 *data, long count) { while(count) { - outb(*data++,ppc->lpt_addr + 4); + outb(*data++, pi->port + 4); count--; } @@ -612,14 +611,14 @@ static void ppc6_wr_data_blk(struct pi_adapter *pi, u8 *data, long count) { while(count > 1) { - outw(*((u16 *)data),ppc->lpt_addr + 4); + outw(*((u16 *)data), pi->port + 4); data += 2; count -= 2; } while(count) { - outb(*data++,ppc->lpt_addr + 4); + outb(*data++, pi->port + 4); count--; } @@ -632,14 +631,14 @@ static void ppc6_wr_data_blk(struct pi_adapter *pi, u8 *data, long count) { while(count > 3) { - outl(*((u32 *)data),ppc->lpt_addr + 4); + outl(*((u32 *)data), pi->port + 4); data += 4; count -= 4; } while(count) { - outb(*data++,ppc->lpt_addr + 4); + outb(*data++, pi->port + 4); count--; } From patchwork Tue Mar 7 22:46:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ondrej Zary X-Patchwork-Id: 65938 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp8197wrd; Tue, 7 Mar 2023 15:00:04 -0800 (PST) X-Google-Smtp-Source: AK7set9anXI6pKIkqC7+cJhJ+bWfl87y+KmlkF63Zw89dGZ2T5xnBmQ8QRl0RA/Ie4a4ZdmTGwU4 X-Received: by 2002:a05:6402:337:b0:4be:b37d:6134 with SMTP id q23-20020a056402033700b004beb37d6134mr14750403edw.5.1678230003810; Tue, 07 Mar 2023 15:00:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678230003; cv=none; d=google.com; s=arc-20160816; b=d8HSJXsdTiv+NGmFt4UaODFjXSQGp6OAQyX6lTUVfosPm7h20OuZQgyX8R/7qhw80v QySyr4sKvP0RQxztlRosVj5LMh5hnuMJxM6x1ABB7ZYcpBUWycGrR6qDNqFGG9ZLMo2x y+2Zb/CDLqFrZU+thd9ZmFS8N0Cx/qLDW8zhqgNENzznQ0NgEcU3fkUB7209V7owvmLd hFcbfi0udAEk9Z+3EbNzikDtFOeN46tazroGfTwCuqEeRLPbgbALl8m3fKzMOYFtXHJv JA+Y7UsK3/BYVjMtbRfnB59keFX5cgivdo1GEgTmLsLUU6trx+DRKyTJUG7La/DVa/WB LJWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=7M1gl9xr2OE6iWPtpvXUIJY0M56c/H28ZJCSN106qLo=; b=NEgwcmLlXcw/owIepGc9Fi1nDOxHkYmzPKdE9PGUSxIWH3aeaYNipx+RvJ+WUycOcr +CpZu2h1OAZHHTvZy+5kZRjVOBmYw+mHwn+4FtpSCWdg3JX4OlnMNq//JLgHuL3kMkxs GOLQY+TB0FnE2dgX/iBVeaw85+JTJNJD1RN589ZUPHgWR77Y4Sv7mlfcDbQtQLZ2VLdH fsc9t35mF+KGlD+lVSeg/oT6/N00z5lK/uMsqkGKW7qU3ceFgMzk4n5MrtHmfNqh8gJq T93b/sAdRVc/8v/9d3l/9ZeVu76z/AG7JT6yA87HkCGkXCp/NlKd0z7YRLxUrxiMzmks pEkQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bf14-20020a0564021a4e00b004bc696040c8si14901157edb.508.2023.03.07.14.59.39; Tue, 07 Mar 2023 15:00:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230034AbjCGWr2 (ORCPT + 99 others); Tue, 7 Mar 2023 17:47:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33270 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230075AbjCGWrE (ORCPT ); Tue, 7 Mar 2023 17:47:04 -0500 Received: from hosting.gsystem.sk (hosting.gsystem.sk [212.5.213.30]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id CC646E067; Tue, 7 Mar 2023 14:47:00 -0800 (PST) Received: from gsql.ggedos.sk (off-20.infotel.telecom.sk [212.5.213.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by hosting.gsystem.sk (Postfix) with ESMTPSA id 7921D7A05D5; Tue, 7 Mar 2023 23:46:48 +0100 (CET) From: Ondrej Zary To: Damien Le Moal , Sudip Mukherjee Cc: Christoph Hellwig , Sergey Shtylyov , Jens Axboe , Tim Waugh , linux-block@vger.kernel.org, linux-parport@lists.infradead.org, linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 06/32] pata_parport-bpck6: remove ppc_id from struct ppc_storage Date: Tue, 7 Mar 2023 23:46:01 +0100 Message-Id: <20230307224627.28011-7-linux@zary.sk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20230307224627.28011-1-linux@zary.sk> References: <20230307224627.28011-1-linux@zary.sk> MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759751704676610603?= X-GMAIL-MSGID: =?utf-8?q?1759751704676610603?= ppc_id duplicates pi->unit. Remove it. Signed-off-by: Ondrej Zary Reviewed-by: Sergey Shtylyov --- drivers/ata/pata_parport/bpck6.c | 7 ------- drivers/ata/pata_parport/ppc6lnx.c | 5 ++--- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/drivers/ata/pata_parport/bpck6.c b/drivers/ata/pata_parport/bpck6.c index 50d313fc529e..176bf456c698 100644 --- a/drivers/ata/pata_parport/bpck6.c +++ b/drivers/ata/pata_parport/bpck6.c @@ -72,13 +72,9 @@ static void bpck6_disconnect(struct pi_adapter *pi) static int bpck6_test_port(struct pi_adapter *pi) /* check for 8-bit port */ { - struct ppc_storage *ppc = (void *)(pi->private); dev_dbg(&pi->dev, "PARPORT indicates modes=%x for lp=0x%lx\n", pi->pardev->port->modes, pi->pardev->port->base); - /*copy over duplicate stuff.. initialize state info*/ - ppc->ppc_id = pi->unit; - /* look at the parport device to see what modes we can use */ if (pi->pardev->port->modes & PARPORT_MODE_EPP) return 5; /* Can do EPP */ @@ -94,9 +90,6 @@ static int bpck6_probe_unit(struct pi_adapter *pi) dev_dbg(&pi->dev, "PROBE UNIT %x on port:%x\n", pi->unit, pi->port); - /*SET PPC UNIT NUMBER*/ - ppc->ppc_id = pi->unit; - /*LOWER DOWN TO UNIDIRECTIONAL*/ ppc->mode = 1; diff --git a/drivers/ata/pata_parport/ppc6lnx.c b/drivers/ata/pata_parport/ppc6lnx.c index c00e561cc833..dd9f3040f9a7 100644 --- a/drivers/ata/pata_parport/ppc6lnx.c +++ b/drivers/ata/pata_parport/ppc6lnx.c @@ -65,7 +65,6 @@ //*************************************************************************** struct ppc_storage { - u8 ppc_id; u8 mode; // operating mode // 0 = PPC Uni SW // 1 = PPC Uni FW @@ -143,8 +142,8 @@ static int ppc6_select(struct pi_adapter *pi) outb('b', pi->port); outb('p', pi->port); - outb(ppc->ppc_id, pi->port); - outb(~ppc->ppc_id, pi->port); + outb(pi->unit, pi->port); + outb(~pi->unit, pi->port); ppc->cur_ctrl &= ~port_sel; From patchwork Tue Mar 7 22:46:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ondrej Zary X-Patchwork-Id: 65933 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp7830wrd; Tue, 7 Mar 2023 14:58:53 -0800 (PST) X-Google-Smtp-Source: AK7set9emHTwB0oxcy2xTJgklvcWddblysQ+MmydyKiRFSdc87lBoULJ+xUGmxrHbIzxuuoIzV81 X-Received: by 2002:a05:6a20:3c9f:b0:cb:2c7e:b673 with SMTP id b31-20020a056a203c9f00b000cb2c7eb673mr16611026pzj.37.1678229933086; Tue, 07 Mar 2023 14:58:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678229933; cv=none; d=google.com; s=arc-20160816; b=VnDzUmq7mC7ZhmZBbaBvHH9DB5aXeuGY6N2BJNU95ISTINt4pouP6GgcwaltCLcUlk PuXmZ2mW5w92aMX5aicVrkQu6+uU/FMlx4helGobUbQV90MI2n85Kyqy9/3Vp/gcTNWN VoBlgmbMZGf7w7C4qt0mTWqdPGvshp68l4N0WP2SidIyFiS3zBXkfrrQVM+m/WgT5z8+ p0Iv0RNxC2JBgRjbU0HHqe+rzeFBt5ltD2A30wwPJubYfg0AwwYffmHVpIbPoM0bhA+2 Lm5Wr8oNOQW8Z+MOmpvt/x7AZgQHuRcOU9NZzxGgXgIWOGWLachgp3qz7MwOUnpGj0qm Svlw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=dl/KmoCnxC0z+DlXhmOQbOfBMifsnYkbl3EqmkyT4Pg=; b=cNokoiYjqbRKx5Y9gEWkG7ise5EG/O+yX4EUzuwgVIeJZOwNlzqw+giWQNTuCKjiXU dC4jvb29eSL+r2U9JpBEViJdNCCYwuIc/o1Lgt3koDMBD1N9YoGha16BtIzp/4dU9HHt Kmnw2JNedh9d043iQuPMjFun246E3hMTYWqc3bd375qvWQbcA5r/zbJ1V1uIMIaw4+Kk c4HmTJ5xdfqsMlBzKbQt8Yph9oEIW63djs44ajcUP2d6UZ+1nx8GfJ5WKvNN6cXVZ6gG Fp63TGBc1kJbLwdQPAGjzmDzIWk+HuKiOnyXbDVljdntqw4QYoL+QKX2wtpnMUm68+LV rZGw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p123-20020a622981000000b005939fff6d47si12183834pfp.326.2023.03.07.14.58.39; Tue, 07 Mar 2023 14:58:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231735AbjCGWrj (ORCPT + 99 others); Tue, 7 Mar 2023 17:47:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33250 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230333AbjCGWrH (ORCPT ); Tue, 7 Mar 2023 17:47:07 -0500 Received: from hosting.gsystem.sk (hosting.gsystem.sk [212.5.213.30]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 4DD5229E15; Tue, 7 Mar 2023 14:47:01 -0800 (PST) Received: from gsql.ggedos.sk (off-20.infotel.telecom.sk [212.5.213.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by hosting.gsystem.sk (Postfix) with ESMTPSA id 957DF7A05DC; Tue, 7 Mar 2023 23:46:48 +0100 (CET) From: Ondrej Zary To: Damien Le Moal , Sudip Mukherjee Cc: Christoph Hellwig , Sergey Shtylyov , Jens Axboe , Tim Waugh , linux-block@vger.kernel.org, linux-parport@lists.infradead.org, linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 07/32] pata_parport-bpck6: remove org_* from struct ppc_storage Date: Tue, 7 Mar 2023 23:46:02 +0100 Message-Id: <20230307224627.28011-8-linux@zary.sk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20230307224627.28011-1-linux@zary.sk> References: <20230307224627.28011-1-linux@zary.sk> MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759751630775228095?= X-GMAIL-MSGID: =?utf-8?q?1759751630775228095?= org_data duplicates saved_r0 and org_ctrl duplicates saved_r2 in pi->unit. Remove them. Signed-off-by: Ondrej Zary Reviewed-by: Sergey Shtylyov --- drivers/ata/pata_parport/ppc6lnx.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/drivers/ata/pata_parport/ppc6lnx.c b/drivers/ata/pata_parport/ppc6lnx.c index dd9f3040f9a7..7ea8e8a31aeb 100644 --- a/drivers/ata/pata_parport/ppc6lnx.c +++ b/drivers/ata/pata_parport/ppc6lnx.c @@ -74,8 +74,6 @@ struct ppc_storage { // 5 = EPP Word // 6 = EPP Dword u8 ppc_flags; - u8 org_data; // original LPT data port contents - u8 org_ctrl; // original LPT control port contents u8 cur_ctrl; // current control port contents }; @@ -127,17 +125,17 @@ static int ppc6_select(struct pi_adapter *pi) if (i & 1) outb(i, pi->port + 1); - ppc->org_data = inb(pi->port); + pi->saved_r0 = inb(pi->port); - ppc->org_ctrl = inb(pi->port + 2) & 0x5F; // readback ctrl + pi->saved_r2 = inb(pi->port + 2) & 0x5F; // readback ctrl - ppc->cur_ctrl = ppc->org_ctrl; + ppc->cur_ctrl = pi->saved_r2; ppc->cur_ctrl |= port_sel; outb(ppc->cur_ctrl, pi->port + 2); - if (ppc->org_data == 'b') + if (pi->saved_r0 == 'b') outb('x', pi->port); outb('b', pi->port); @@ -195,9 +193,9 @@ static int ppc6_select(struct pi_adapter *pi) } } - outb(ppc->org_ctrl, pi->port + 2); + outb(pi->saved_r2, pi->port + 2); - outb(ppc->org_data, pi->port); + outb(pi->saved_r0, pi->port); return(0); // FAIL } @@ -214,11 +212,11 @@ static void ppc6_deselect(struct pi_adapter *pi) outb(ppc->cur_ctrl, pi->port + 2); - outb(ppc->org_data, pi->port); + outb(pi->saved_r0, pi->port); - outb((ppc->org_ctrl | port_sel), pi->port + 2); + outb((pi->saved_r2 | port_sel), pi->port + 2); - outb(ppc->org_ctrl, pi->port + 2); + outb(pi->saved_r2, pi->port + 2); } //*************************************************************************** From patchwork Tue Mar 7 22:46:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ondrej Zary X-Patchwork-Id: 65943 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp9995wrd; Tue, 7 Mar 2023 15:02:56 -0800 (PST) X-Google-Smtp-Source: AK7set++Wadzjp7tgOjfvv+Opioc8RH+bb9s0JgeIU6NTz2tm5e6jZV4WJljT143w/aGSpTPffPo X-Received: by 2002:aa7:c242:0:b0:4ab:4c5e:b0ed with SMTP id y2-20020aa7c242000000b004ab4c5eb0edmr13405494edo.21.1678230175954; Tue, 07 Mar 2023 15:02:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678230175; cv=none; d=google.com; s=arc-20160816; b=POhyNSmd7rgUqDORr1Pz+rqNTkSsiqcOrLaZUxwZMAD/fcyj+9ttpoo2v8inzY2WP0 jwohx/vG5xQFE+gfTZJPn00y8ZmDaTFpHNYgjCVH9eLnUYp7uI/xSFdZEwjvhIR+432s ll6x9NYV5bWg8hrGm9BovRGZI45qUJ040hSUIHvXBl2utQasT9Zw8dEG44BfAAa6duoZ UEO1hzjL9KbgDiWlSQkW2kOv9lLM6kskfQO9NKi+Js0C2KAhxY+0SJugGShOFLVz4F2b dIa+nbaoW4VwMcesdE8X0rlISMkgfSVXds+iPW1Rs8RRbf4hL4v1BWfwSiKagmc27QOh X7ag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=QnMAL0mZLt1Ug+TVzDC7CHMVPSjIHLEIDgKl9uJKA10=; b=LUPh+7yg1hoxUbpqEtBCCJ68HjHzyNql616nWEUzY20H9ylwZB2fIVMklEsjQ4ZinT EVXohvQmC8l+Nhlo17zu/aGcchBtg+48JemdBmgoP9A240UIiAuk68kjD1VhFpQjrpOh Od8vphxuxbEej5NTfUW42Yzczy3QZYtDN0+DBEjiFtTAWKvX2uN26t3P4IY/1QiZggnJ uozdGS6Kjt9hI9ohxvP0OkRmklHZlvVXr3b16hl9JVp8oO2qr8KPA8BHAcM9xLbqlXsQ 1n4gMJqg13h/OUALI4OYL06SKUSe7Ne0TWw/KKHMAdzJwjQhA/ngH4qiuRl8TFdfn+kr oPJw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o3-20020a170906768300b008c673be343dsi13789594ejm.612.2023.03.07.15.02.29; Tue, 07 Mar 2023 15:02:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231154AbjCGWrc (ORCPT + 99 others); Tue, 7 Mar 2023 17:47:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33406 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229904AbjCGWrF (ORCPT ); Tue, 7 Mar 2023 17:47:05 -0500 Received: from hosting.gsystem.sk (hosting.gsystem.sk [212.5.213.30]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 4DB1459D9; Tue, 7 Mar 2023 14:47:01 -0800 (PST) Received: from gsql.ggedos.sk (off-20.infotel.telecom.sk [212.5.213.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by hosting.gsystem.sk (Postfix) with ESMTPSA id ADFE17A06EC; Tue, 7 Mar 2023 23:46:48 +0100 (CET) From: Ondrej Zary To: Damien Le Moal , Sudip Mukherjee Cc: Christoph Hellwig , Sergey Shtylyov , Jens Axboe , Tim Waugh , linux-block@vger.kernel.org, linux-parport@lists.infradead.org, linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 08/32] pata_parport-bpck6: remove mode from struct ppc_storage Date: Tue, 7 Mar 2023 23:46:03 +0100 Message-Id: <20230307224627.28011-9-linux@zary.sk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20230307224627.28011-1-linux@zary.sk> References: <20230307224627.28011-1-linux@zary.sk> MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759751884944606697?= X-GMAIL-MSGID: =?utf-8?q?1759751884944606697?= introduce mode_map[] that maps bpck6 modes to ppc6 modes and use it to replace mode in ppc_storage Signed-off-by: Ondrej Zary Reviewed-by: Sergey Shtylyov --- drivers/ata/pata_parport/bpck6.c | 22 +++++----------------- drivers/ata/pata_parport/ppc6lnx.c | 27 +++++++++++---------------- 2 files changed, 16 insertions(+), 33 deletions(-) diff --git a/drivers/ata/pata_parport/bpck6.c b/drivers/ata/pata_parport/bpck6.c index 176bf456c698..fe97d1dee51c 100644 --- a/drivers/ata/pata_parport/bpck6.c +++ b/drivers/ata/pata_parport/bpck6.c @@ -43,22 +43,8 @@ static void bpck6_read_block(struct pi_adapter *pi, char *buf, int len) static void bpck6_connect(struct pi_adapter *pi) { - struct ppc_storage *ppc = (void *)(pi->private); dev_dbg(&pi->dev, "connect\n"); - if(pi->mode >=2) - { - ppc->mode = 4+pi->mode-2; - } - else if(pi->mode==1) - { - ppc->mode = 3; - } - else - { - ppc->mode = 1; - } - ppc6_open(pi); ppc6_wr_extout(pi, 0x3); } @@ -85,13 +71,13 @@ static int bpck6_test_port(struct pi_adapter *pi) /* check for 8-bit port */ static int bpck6_probe_unit(struct pi_adapter *pi) { - struct ppc_storage *ppc = (void *)(pi->private); - int out; + int out, saved_mode; dev_dbg(&pi->dev, "PROBE UNIT %x on port:%x\n", pi->unit, pi->port); + saved_mode = pi->mode; /*LOWER DOWN TO UNIDIRECTIONAL*/ - ppc->mode = 1; + pi->mode = 0; out = ppc6_open(pi); @@ -101,11 +87,13 @@ static int bpck6_probe_unit(struct pi_adapter *pi) { ppc6_close(pi); dev_dbg(&pi->dev, "leaving probe\n"); + pi->mode = saved_mode; return(1); } else { dev_dbg(&pi->dev, "Failed open\n"); + pi->mode = saved_mode; return(0); } } diff --git a/drivers/ata/pata_parport/ppc6lnx.c b/drivers/ata/pata_parport/ppc6lnx.c index 7ea8e8a31aeb..75f9748d8de5 100644 --- a/drivers/ata/pata_parport/ppc6lnx.c +++ b/drivers/ata/pata_parport/ppc6lnx.c @@ -65,14 +65,6 @@ //*************************************************************************** struct ppc_storage { - u8 mode; // operating mode - // 0 = PPC Uni SW - // 1 = PPC Uni FW - // 2 = PPC Bi SW - // 3 = PPC Bi FW - // 4 = EPP Byte - // 5 = EPP Word - // 6 = EPP Dword u8 ppc_flags; u8 cur_ctrl; // current control port contents }; @@ -115,6 +107,9 @@ static void ppc6_close(struct pi_adapter *pi); //*************************************************************************** +int mode_map[] = { PPCMODE_UNI_FW, PPCMODE_BI_FW, PPCMODE_EPP_BYTE, + PPCMODE_EPP_WORD, PPCMODE_EPP_DWORD }; + static int ppc6_select(struct pi_adapter *pi) { struct ppc_storage *ppc = (void *)(pi->private); @@ -151,10 +146,10 @@ static int ppc6_select(struct pi_adapter *pi) outb(ppc->cur_ctrl, pi->port + 2); - i = ppc->mode & 0x0C; + i = mode_map[pi->mode] & 0x0C; if (i == 0) - i = (ppc->mode & 2) | 1; + i = (mode_map[pi->mode] & 2) | 1; outb(i, pi->port); @@ -205,7 +200,7 @@ static int ppc6_select(struct pi_adapter *pi) static void ppc6_deselect(struct pi_adapter *pi) { struct ppc_storage *ppc = (void *)(pi->private); - if (ppc->mode & 4) // EPP + if (mode_map[pi->mode] & 4) // EPP ppc->cur_ctrl |= port_init; else // PPC/ECP ppc->cur_ctrl |= port_sel; @@ -224,7 +219,7 @@ static void ppc6_deselect(struct pi_adapter *pi) static void ppc6_send_cmd(struct pi_adapter *pi, u8 cmd) { struct ppc_storage *ppc = (void *)(pi->private); - switch(ppc->mode) + switch (mode_map[pi->mode]) { case PPCMODE_UNI_SW : case PPCMODE_UNI_FW : @@ -256,7 +251,7 @@ static void ppc6_send_cmd(struct pi_adapter *pi, u8 cmd) static void ppc6_wr_data_byte(struct pi_adapter *pi, u8 data) { struct ppc_storage *ppc = (void *)(pi->private); - switch(ppc->mode) + switch (mode_map[pi->mode]) { case PPCMODE_UNI_SW : case PPCMODE_UNI_FW : @@ -290,7 +285,7 @@ static u8 ppc6_rd_data_byte(struct pi_adapter *pi) struct ppc_storage *ppc = (void *)(pi->private); u8 data = 0; - switch(ppc->mode) + switch (mode_map[pi->mode]) { case PPCMODE_UNI_SW : case PPCMODE_UNI_FW : @@ -380,7 +375,7 @@ static void ppc6_wr_port(struct pi_adapter *pi, u8 port, u8 data) static void ppc6_rd_data_blk(struct pi_adapter *pi, u8 *data, long count) { struct ppc_storage *ppc = (void *)(pi->private); - switch(ppc->mode) + switch (mode_map[pi->mode]) { case PPCMODE_UNI_SW : case PPCMODE_UNI_FW : @@ -531,7 +526,7 @@ static void ppc6_wait_for_fifo(struct pi_adapter *pi) static void ppc6_wr_data_blk(struct pi_adapter *pi, u8 *data, long count) { struct ppc_storage *ppc = (void *)(pi->private); - switch(ppc->mode) + switch (mode_map[pi->mode]) { case PPCMODE_UNI_SW : case PPCMODE_BI_SW : From patchwork Tue Mar 7 22:46:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ondrej Zary X-Patchwork-Id: 65918 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp4587wrd; Tue, 7 Mar 2023 14:49:48 -0800 (PST) X-Google-Smtp-Source: AK7set9ekdjIzeQeKuDHsYZFy1d7IWgxtEc+jQ0XCen6rKfohLJhJ1Ev6C2Jhlqb4mXocyFdriQA X-Received: by 2002:a62:19cf:0:b0:5a8:4b70:885f with SMTP id 198-20020a6219cf000000b005a84b70885fmr13627301pfz.18.1678229387900; Tue, 07 Mar 2023 14:49:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678229387; cv=none; d=google.com; s=arc-20160816; b=XM8EENbrpQl4mmPBMXbEW3SuIOS3ZufKRxlmxihGxg2stVw2RdBM1QLzo/sAKC7C95 fjPgcoL/+Xwos9IGbsJi3KiQjfPrpvlv4eWoTbZXgV8l3w9yXKPmdw5CiEuEtZX2HfVq UcmwpJJ4YZNty/XqPytXFhtamDhLFG+W8+ZtwQYW29bQK7bE9E5KhSbReEUMqF0JjU9t ByiVHNLPOcweVocM7KDyIaaBqevw4asFyQKnPYENTZVpossdbJUcC9bGESQXZt4bTyZS bjkW0zQC6ePpWBKmfeRnPXQ6h2Dl8bVcwDXEZwABdsPP41wN4gfDxQ1aXklVlhO6psai rVEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=jLP759Ox+QO6XkaC/g1k4ueIKwZ0XVzA+kJt4YwKfzM=; b=UZ7D8cNIbv+ZSGCxn0X9Sest/hfnyK1wd8bTvol4qq/g0yvcFn8Paoe3GXfHXfGD3o BalqNuSEDlIDU72DIHLb/U42x+tJJ1E1ajSaJk18lEmctNRtqyO1MRUzNNZVr3q06bGA I9oPEYMLxJE69t+7bdA603N6vhJwKPG08vmGAT5oOXtQSuCwEXufs/KplEEFKlG5rhCP QNY5cObNvXdqXH5rPysUnb+ZaQNGKUC6QgH6iUpikChs9v19uY80ig/JyM8vHjizNVTc n4j3LfKBwR86gB9XvlwQcYy9tLm9H4590Gf6To/rE93LG0KhnyXIv1rbFShUHzTeeiwU lu4g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u124-20020a627982000000b0061d8ab6228esi2823059pfc.87.2023.03.07.14.49.34; Tue, 07 Mar 2023 14:49:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231584AbjCGWsH (ORCPT + 99 others); Tue, 7 Mar 2023 17:48:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33422 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230430AbjCGWrL (ORCPT ); Tue, 7 Mar 2023 17:47:11 -0500 Received: from hosting.gsystem.sk (hosting.gsystem.sk [212.5.213.30]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id C3E47136DA; Tue, 7 Mar 2023 14:47:01 -0800 (PST) Received: from gsql.ggedos.sk (off-20.infotel.telecom.sk [212.5.213.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by hosting.gsystem.sk (Postfix) with ESMTPSA id CC22D7A06F6; Tue, 7 Mar 2023 23:46:48 +0100 (CET) From: Ondrej Zary To: Damien Le Moal , Sudip Mukherjee Cc: Christoph Hellwig , Sergey Shtylyov , Jens Axboe , Tim Waugh , linux-block@vger.kernel.org, linux-parport@lists.infradead.org, linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 09/32] pata_parport-bpck6: remove struct ppc_storage Date: Tue, 7 Mar 2023 23:46:04 +0100 Message-Id: <20230307224627.28011-10-linux@zary.sk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20230307224627.28011-1-linux@zary.sk> References: <20230307224627.28011-1-linux@zary.sk> MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759751059047366529?= X-GMAIL-MSGID: =?utf-8?q?1759751059047366529?= Store the remaining two variables (cur_ctrl and ppc_flags) in struct ppc_storage directly in pi->private and remove struct ppc_storage. Signed-off-by: Ondrej Zary Reviewed-by: Sergey Shtylyov --- drivers/ata/pata_parport/bpck6.c | 21 ---- drivers/ata/pata_parport/ppc6lnx.c | 149 +++++++++++++---------------- 2 files changed, 69 insertions(+), 101 deletions(-) diff --git a/drivers/ata/pata_parport/bpck6.c b/drivers/ata/pata_parport/bpck6.c index fe97d1dee51c..dc0f71cc305e 100644 --- a/drivers/ata/pata_parport/bpck6.c +++ b/drivers/ata/pata_parport/bpck6.c @@ -14,7 +14,6 @@ #include #include #include -#include #include #include #include @@ -107,24 +106,6 @@ static void bpck6_log_adapter(struct pi_adapter *pi) pi->unit, pi->port, pi->mode, mode_string[pi->mode], pi->delay); } -static int bpck6_init_proto(struct pi_adapter *pi) -{ - struct ppc_storage *p = kzalloc(sizeof(struct ppc_storage), GFP_KERNEL); - - if (p) { - pi->private = (unsigned long)p; - return 0; - } - - dev_err(&pi->dev, "ERROR COULDN'T ALLOCATE MEMORY\n"); - return -1; -} - -static void bpck6_release_proto(struct pi_adapter *pi) -{ - kfree((void *)(pi->private)); -} - static struct pi_protocol bpck6 = { .owner = THIS_MODULE, .name = "bpck6", @@ -140,8 +121,6 @@ static struct pi_protocol bpck6 = { .test_port = bpck6_test_port, .probe_unit = bpck6_probe_unit, .log_adapter = bpck6_log_adapter, - .init_proto = bpck6_init_proto, - .release_proto = bpck6_release_proto, }; MODULE_LICENSE("GPL"); diff --git a/drivers/ata/pata_parport/ppc6lnx.c b/drivers/ata/pata_parport/ppc6lnx.c index 75f9748d8de5..ee8cee6bae7c 100644 --- a/drivers/ata/pata_parport/ppc6lnx.c +++ b/drivers/ata/pata_parport/ppc6lnx.c @@ -64,10 +64,8 @@ //*************************************************************************** -struct ppc_storage { - u8 ppc_flags; - u8 cur_ctrl; // current control port contents -}; +#define CUR_CTRL (((u8 *)&pi->private)[0]) +#define PPC_FLAGS (((u8 *)&pi->private)[1]) //*************************************************************************** @@ -112,7 +110,6 @@ int mode_map[] = { PPCMODE_UNI_FW, PPCMODE_BI_FW, PPCMODE_EPP_BYTE, static int ppc6_select(struct pi_adapter *pi) { - struct ppc_storage *ppc = (void *)(pi->private); u8 i, j, k; i = inb(pi->port + 1); @@ -124,11 +121,11 @@ static int ppc6_select(struct pi_adapter *pi) pi->saved_r2 = inb(pi->port + 2) & 0x5F; // readback ctrl - ppc->cur_ctrl = pi->saved_r2; + CUR_CTRL = pi->saved_r2; - ppc->cur_ctrl |= port_sel; + CUR_CTRL |= port_sel; - outb(ppc->cur_ctrl, pi->port + 2); + outb(CUR_CTRL, pi->port + 2); if (pi->saved_r0 == 'b') outb('x', pi->port); @@ -138,13 +135,13 @@ static int ppc6_select(struct pi_adapter *pi) outb(pi->unit, pi->port); outb(~pi->unit, pi->port); - ppc->cur_ctrl &= ~port_sel; + CUR_CTRL &= ~port_sel; - outb(ppc->cur_ctrl, pi->port + 2); + outb(CUR_CTRL, pi->port + 2); - ppc->cur_ctrl = (ppc->cur_ctrl & port_int) | port_init; + CUR_CTRL = (CUR_CTRL & port_int) | port_init; - outb(ppc->cur_ctrl, pi->port + 2); + outb(CUR_CTRL, pi->port + 2); i = mode_map[pi->mode] & 0x0C; @@ -153,15 +150,15 @@ static int ppc6_select(struct pi_adapter *pi) outb(i, pi->port); - ppc->cur_ctrl |= port_sel; + CUR_CTRL |= port_sel; - outb(ppc->cur_ctrl, pi->port + 2); + outb(CUR_CTRL, pi->port + 2); // DELAY - ppc->cur_ctrl |= port_afd; + CUR_CTRL |= port_afd; - outb(ppc->cur_ctrl, pi->port + 2); + outb(CUR_CTRL, pi->port + 2); j = ((i & 0x08) << 4) | ((i & 0x07) << 3); @@ -169,20 +166,20 @@ static int ppc6_select(struct pi_adapter *pi) if (j == k) { - ppc->cur_ctrl &= ~port_afd; + CUR_CTRL &= ~port_afd; - outb(ppc->cur_ctrl, pi->port + 2); + outb(CUR_CTRL, pi->port + 2); k = (inb(pi->port + 1) & 0xB8) ^ 0xB8; if (j == k) { if (i & 4) // EPP - ppc->cur_ctrl &= ~(port_sel | port_init); + CUR_CTRL &= ~(port_sel | port_init); else // PPC/ECP - ppc->cur_ctrl &= ~port_sel; + CUR_CTRL &= ~port_sel; - outb(ppc->cur_ctrl, pi->port + 2); + outb(CUR_CTRL, pi->port + 2); return(1); } @@ -199,13 +196,12 @@ static int ppc6_select(struct pi_adapter *pi) static void ppc6_deselect(struct pi_adapter *pi) { - struct ppc_storage *ppc = (void *)(pi->private); if (mode_map[pi->mode] & 4) // EPP - ppc->cur_ctrl |= port_init; + CUR_CTRL |= port_init; else // PPC/ECP - ppc->cur_ctrl |= port_sel; + CUR_CTRL |= port_sel; - outb(ppc->cur_ctrl, pi->port + 2); + outb(CUR_CTRL, pi->port + 2); outb(pi->saved_r0, pi->port); @@ -218,7 +214,6 @@ static void ppc6_deselect(struct pi_adapter *pi) static void ppc6_send_cmd(struct pi_adapter *pi, u8 cmd) { - struct ppc_storage *ppc = (void *)(pi->private); switch (mode_map[pi->mode]) { case PPCMODE_UNI_SW : @@ -228,9 +223,9 @@ static void ppc6_send_cmd(struct pi_adapter *pi, u8 cmd) { outb(cmd, pi->port); - ppc->cur_ctrl ^= cmd_stb; + CUR_CTRL ^= cmd_stb; - outb(ppc->cur_ctrl, pi->port + 2); + outb(CUR_CTRL, pi->port + 2); break; } @@ -250,7 +245,6 @@ static void ppc6_send_cmd(struct pi_adapter *pi, u8 cmd) static void ppc6_wr_data_byte(struct pi_adapter *pi, u8 data) { - struct ppc_storage *ppc = (void *)(pi->private); switch (mode_map[pi->mode]) { case PPCMODE_UNI_SW : @@ -260,9 +254,9 @@ static void ppc6_wr_data_byte(struct pi_adapter *pi, u8 data) { outb(data, pi->port); - ppc->cur_ctrl ^= data_stb; + CUR_CTRL ^= data_stb; - outb(ppc->cur_ctrl, pi->port + 2); + outb(CUR_CTRL, pi->port + 2); break; } @@ -282,7 +276,6 @@ static void ppc6_wr_data_byte(struct pi_adapter *pi, u8 data) static u8 ppc6_rd_data_byte(struct pi_adapter *pi) { - struct ppc_storage *ppc = (void *)(pi->private); u8 data = 0; switch (mode_map[pi->mode]) @@ -290,9 +283,9 @@ static u8 ppc6_rd_data_byte(struct pi_adapter *pi) case PPCMODE_UNI_SW : case PPCMODE_UNI_FW : { - ppc->cur_ctrl = (ppc->cur_ctrl & ~port_stb) ^ data_stb; + CUR_CTRL = (CUR_CTRL & ~port_stb) ^ data_stb; - outb(ppc->cur_ctrl, pi->port + 2); + outb(CUR_CTRL, pi->port + 2); // DELAY @@ -300,9 +293,9 @@ static u8 ppc6_rd_data_byte(struct pi_adapter *pi) data = ((data & 0x80) >> 1) | ((data & 0x38) >> 3); - ppc->cur_ctrl |= port_stb; + CUR_CTRL |= port_stb; - outb(ppc->cur_ctrl, pi->port + 2); + outb(CUR_CTRL, pi->port + 2); // DELAY @@ -314,23 +307,23 @@ static u8 ppc6_rd_data_byte(struct pi_adapter *pi) case PPCMODE_BI_SW : case PPCMODE_BI_FW : { - ppc->cur_ctrl |= port_dir; + CUR_CTRL |= port_dir; - outb(ppc->cur_ctrl, pi->port + 2); + outb(CUR_CTRL, pi->port + 2); - ppc->cur_ctrl = (ppc->cur_ctrl | port_stb) ^ data_stb; + CUR_CTRL = (CUR_CTRL | port_stb) ^ data_stb; - outb(ppc->cur_ctrl, pi->port + 2); + outb(CUR_CTRL, pi->port + 2); data = inb(pi->port); - ppc->cur_ctrl &= ~port_stb; + CUR_CTRL &= ~port_stb; - outb(ppc->cur_ctrl, pi->port + 2); + outb(CUR_CTRL, pi->port + 2); - ppc->cur_ctrl &= ~port_dir; + CUR_CTRL &= ~port_dir; - outb(ppc->cur_ctrl, pi->port + 2); + outb(CUR_CTRL, pi->port + 2); break; } @@ -339,11 +332,11 @@ static u8 ppc6_rd_data_byte(struct pi_adapter *pi) case PPCMODE_EPP_WORD : case PPCMODE_EPP_DWORD : { - outb((ppc->cur_ctrl | port_dir), pi->port + 2); + outb((CUR_CTRL | port_dir), pi->port + 2); data = inb(pi->port + 4); - outb(ppc->cur_ctrl, pi->port + 2); + outb(CUR_CTRL, pi->port + 2); break; } @@ -374,7 +367,6 @@ static void ppc6_wr_port(struct pi_adapter *pi, u8 port, u8 data) static void ppc6_rd_data_blk(struct pi_adapter *pi, u8 *data, long count) { - struct ppc_storage *ppc = (void *)(pi->private); switch (mode_map[pi->mode]) { case PPCMODE_UNI_SW : @@ -384,9 +376,9 @@ static void ppc6_rd_data_blk(struct pi_adapter *pi, u8 *data, long count) { u8 d; - ppc->cur_ctrl = (ppc->cur_ctrl & ~port_stb) ^ data_stb; + CUR_CTRL = (CUR_CTRL & ~port_stb) ^ data_stb; - outb(ppc->cur_ctrl, pi->port + 2); + outb(CUR_CTRL, pi->port + 2); // DELAY @@ -394,9 +386,9 @@ static void ppc6_rd_data_blk(struct pi_adapter *pi, u8 *data, long count) d = ((d & 0x80) >> 1) | ((d & 0x38) >> 3); - ppc->cur_ctrl |= port_stb; + CUR_CTRL |= port_stb; - outb(ppc->cur_ctrl, pi->port + 2); + outb(CUR_CTRL, pi->port + 2); // DELAY @@ -412,36 +404,36 @@ static void ppc6_rd_data_blk(struct pi_adapter *pi, u8 *data, long count) case PPCMODE_BI_SW : case PPCMODE_BI_FW : { - ppc->cur_ctrl |= port_dir; + CUR_CTRL |= port_dir; - outb(ppc->cur_ctrl, pi->port + 2); + outb(CUR_CTRL, pi->port + 2); - ppc->cur_ctrl |= port_stb; + CUR_CTRL |= port_stb; while(count) { - ppc->cur_ctrl ^= data_stb; + CUR_CTRL ^= data_stb; - outb(ppc->cur_ctrl, pi->port + 2); + outb(CUR_CTRL, pi->port + 2); *data++ = inb(pi->port); count--; } - ppc->cur_ctrl &= ~port_stb; + CUR_CTRL &= ~port_stb; - outb(ppc->cur_ctrl, pi->port + 2); + outb(CUR_CTRL, pi->port + 2); - ppc->cur_ctrl &= ~port_dir; + CUR_CTRL &= ~port_dir; - outb(ppc->cur_ctrl, pi->port + 2); + outb(CUR_CTRL, pi->port + 2); break; } case PPCMODE_EPP_BYTE : { - outb((ppc->cur_ctrl | port_dir), pi->port + 2); + outb((CUR_CTRL | port_dir), pi->port + 2); // DELAY @@ -451,14 +443,14 @@ static void ppc6_rd_data_blk(struct pi_adapter *pi, u8 *data, long count) count--; } - outb(ppc->cur_ctrl, pi->port + 2); + outb(CUR_CTRL, pi->port + 2); break; } case PPCMODE_EPP_WORD : { - outb((ppc->cur_ctrl | port_dir), pi->port + 2); + outb((CUR_CTRL | port_dir), pi->port + 2); // DELAY @@ -475,14 +467,14 @@ static void ppc6_rd_data_blk(struct pi_adapter *pi, u8 *data, long count) count--; } - outb(ppc->cur_ctrl, pi->port + 2); + outb(CUR_CTRL, pi->port + 2); break; } case PPCMODE_EPP_DWORD : { - outb((ppc->cur_ctrl | port_dir), pi->port + 2); + outb((CUR_CTRL | port_dir), pi->port + 2); // DELAY @@ -499,7 +491,7 @@ static void ppc6_rd_data_blk(struct pi_adapter *pi, u8 *data, long count) count--; } - outb(ppc->cur_ctrl, pi->port + 2); + outb(CUR_CTRL, pi->port + 2); break; } @@ -511,10 +503,9 @@ static void ppc6_rd_data_blk(struct pi_adapter *pi, u8 *data, long count) static void ppc6_wait_for_fifo(struct pi_adapter *pi) { - struct ppc_storage *ppc = (void *)(pi->private); int i; - if (ppc->ppc_flags & fifo_wait) + if (PPC_FLAGS & fifo_wait) { for(i=0; i<20; i++) inb(pi->port + 1); @@ -525,7 +516,6 @@ static void ppc6_wait_for_fifo(struct pi_adapter *pi) static void ppc6_wr_data_blk(struct pi_adapter *pi, u8 *data, long count) { - struct ppc_storage *ppc = (void *)(pi->private); switch (mode_map[pi->mode]) { case PPCMODE_UNI_SW : @@ -535,9 +525,9 @@ static void ppc6_wr_data_blk(struct pi_adapter *pi, u8 *data, long count) { outb(*data++, pi->port); - ppc->cur_ctrl ^= data_stb; + CUR_CTRL ^= data_stb; - outb(ppc->cur_ctrl, pi->port + 2); + outb(CUR_CTRL, pi->port + 2); } break; @@ -550,9 +540,9 @@ static void ppc6_wr_data_blk(struct pi_adapter *pi, u8 *data, long count) ppc6_send_cmd(pi, CMD_PREFIX_SET | PREFIX_FASTWR); - ppc->cur_ctrl |= port_stb; + CUR_CTRL |= port_stb; - outb(ppc->cur_ctrl, pi->port + 2); + outb(CUR_CTRL, pi->port + 2); last = *data; @@ -565,9 +555,9 @@ static void ppc6_wr_data_blk(struct pi_adapter *pi, u8 *data, long count) if (this == last) { - ppc->cur_ctrl ^= data_stb; + CUR_CTRL ^= data_stb; - outb(ppc->cur_ctrl, pi->port + 2); + outb(CUR_CTRL, pi->port + 2); } else { @@ -577,9 +567,9 @@ static void ppc6_wr_data_blk(struct pi_adapter *pi, u8 *data, long count) } } - ppc->cur_ctrl &= ~port_stb; + CUR_CTRL &= ~port_stb; - outb(ppc->cur_ctrl, pi->port + 2); + outb(CUR_CTRL, pi->port + 2); ppc6_send_cmd(pi, CMD_PREFIX_RESET | PREFIX_FASTWR); @@ -694,7 +684,6 @@ static void ppc6_wr_extout(struct pi_adapter *pi, u8 regdata) static int ppc6_open(struct pi_adapter *pi) { - struct ppc_storage *ppc = (void *)(pi->private); int ret; ret = ppc6_select(pi); @@ -702,7 +691,7 @@ static int ppc6_open(struct pi_adapter *pi) if (ret == 0) return(ret); - ppc->ppc_flags &= ~fifo_wait; + PPC_FLAGS &= ~fifo_wait; ppc6_send_cmd(pi, ACCESS_REG | ACCESS_WRITE | REG_RAMSIZE); ppc6_wr_data_byte(pi, RAMSIZE_128K); @@ -710,7 +699,7 @@ static int ppc6_open(struct pi_adapter *pi) ppc6_send_cmd(pi, ACCESS_REG | ACCESS_READ | REG_VERSION); if ((ppc6_rd_data_byte(pi) & 0x3F) == 0x0C) - ppc->ppc_flags |= fifo_wait; + PPC_FLAGS |= fifo_wait; return(ret); } From patchwork Tue Mar 7 22:46:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ondrej Zary X-Patchwork-Id: 65932 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp7673wrd; Tue, 7 Mar 2023 14:58:26 -0800 (PST) X-Google-Smtp-Source: AK7set+hlfp3FNlm7eYEG5dbFzTD3rUwEYIyezhqWz6X/MM8CemcM5OOaWVQNVvsyu+QgNDdFdVK X-Received: by 2002:a17:906:a1cc:b0:878:7189:a457 with SMTP id bx12-20020a170906a1cc00b008787189a457mr16946144ejb.51.1678229905925; Tue, 07 Mar 2023 14:58:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678229905; cv=none; d=google.com; s=arc-20160816; b=GJUtfLPYHa5fCde8DjO9X3JNOJSImOei7g2w8KUrDQtFLwu0GKgOYazrDrETVR7Mh1 oDiZJF+jymzrKjeJ80EUUSf5eTg+kRdIZOieiun8ttNfUCpIwNdFIOqUK9w6ruN66DF6 jOie1WPAvVtFmBxsEYkZd7ze0nk+l/3q9lkrKfWjVoMfUuBDsl4Sr8l+EnI1BmIQxuYx mULSqqY1f9ajx0WiOd3hvu/pmJyAxpwGCnBoUpj6NihRTsVFYZE8h88Ml2HC1Sm64Xk0 GJqQWvMnC5aeHUKjuB6kTjAzx2AHqWNL968Us3t4Nm4r3M1rnWBOsNp23K3z1C77Qk7W 8HYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=gC7xjsd5fN0jiMdOh6X9kiQYEP5RlETMCXB/GHzOpjQ=; b=EFDJQ/OJ9yXayEYXX1XIuB8wQygYIy49o+g/oXRMiI1ZPHgrEM0AsuISEsp3XjeIrg OdMwNg2CqG/7S55bLHc6WuxsSh9pIBlmZm3eEB6W8od22CASWt7Qe0mbcxpHl56k0jes 5PuboKyiDZqwFa4rD1mZhAVkUnUlpL7xugIvJpgMwv44gR2KnEHdhewaRk7SwgJZQxph OprtrWAuiGJBSoqnnk6HumTz9B/r6c0ibl6GYqOW9PPaBaW4KNpwczv8U1AabEN3rD6a UqJGv8aEQKt409kL3erpOmvkR+CU5yfkFHMDSXphF6lfNCFoVGu7ibalIAF0eFxxGBt8 2DAQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a20-20020a170906275400b008e176a55b12si13316022ejd.983.2023.03.07.14.58.01; Tue, 07 Mar 2023 14:58:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231755AbjCGWrl (ORCPT + 99 others); Tue, 7 Mar 2023 17:47:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33256 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230323AbjCGWrH (ORCPT ); Tue, 7 Mar 2023 17:47:07 -0500 Received: from hosting.gsystem.sk (hosting.gsystem.sk [212.5.213.30]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 4BC0A40D2; Tue, 7 Mar 2023 14:47:01 -0800 (PST) Received: from gsql.ggedos.sk (off-20.infotel.telecom.sk [212.5.213.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by hosting.gsystem.sk (Postfix) with ESMTPSA id E14E37A06F8; Tue, 7 Mar 2023 23:46:48 +0100 (CET) From: Ondrej Zary To: Damien Le Moal , Sudip Mukherjee Cc: Christoph Hellwig , Sergey Shtylyov , Jens Axboe , Tim Waugh , linux-block@vger.kernel.org, linux-parport@lists.infradead.org, linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 10/32] pata_parport-bpck6: remove parallel port bit defines Date: Tue, 7 Mar 2023 23:46:05 +0100 Message-Id: <20230307224627.28011-11-linux@zary.sk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20230307224627.28011-1-linux@zary.sk> References: <20230307224627.28011-1-linux@zary.sk> MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759751601467481041?= X-GMAIL-MSGID: =?utf-8?q?1759751601467481041?= Remove port_stb, port_afd, cmd_stb, port_init, data_stb and port_sel defines and use standard PARPORT_CONTROL_* instead. Signed-off-by: Ondrej Zary --- drivers/ata/pata_parport/ppc6lnx.c | 59 ++++++++++++++---------------- 1 file changed, 27 insertions(+), 32 deletions(-) diff --git a/drivers/ata/pata_parport/ppc6lnx.c b/drivers/ata/pata_parport/ppc6lnx.c index ee8cee6bae7c..09480a7fcaee 100644 --- a/drivers/ata/pata_parport/ppc6lnx.c +++ b/drivers/ata/pata_parport/ppc6lnx.c @@ -16,12 +16,6 @@ //*************************************************************************** -#define port_stb 1 -#define port_afd 2 -#define cmd_stb port_afd -#define port_init 4 -#define data_stb port_init -#define port_sel 8 #define port_int 16 #define port_dir 0x20 @@ -123,7 +117,7 @@ static int ppc6_select(struct pi_adapter *pi) CUR_CTRL = pi->saved_r2; - CUR_CTRL |= port_sel; + CUR_CTRL |= PARPORT_CONTROL_SELECT; outb(CUR_CTRL, pi->port + 2); @@ -135,11 +129,11 @@ static int ppc6_select(struct pi_adapter *pi) outb(pi->unit, pi->port); outb(~pi->unit, pi->port); - CUR_CTRL &= ~port_sel; + CUR_CTRL &= ~PARPORT_CONTROL_SELECT; outb(CUR_CTRL, pi->port + 2); - CUR_CTRL = (CUR_CTRL & port_int) | port_init; + CUR_CTRL = (CUR_CTRL & port_int) | PARPORT_CONTROL_INIT; outb(CUR_CTRL, pi->port + 2); @@ -150,13 +144,13 @@ static int ppc6_select(struct pi_adapter *pi) outb(i, pi->port); - CUR_CTRL |= port_sel; + CUR_CTRL |= PARPORT_CONTROL_SELECT; outb(CUR_CTRL, pi->port + 2); // DELAY - CUR_CTRL |= port_afd; + CUR_CTRL |= PARPORT_CONTROL_AUTOFD; outb(CUR_CTRL, pi->port + 2); @@ -166,7 +160,7 @@ static int ppc6_select(struct pi_adapter *pi) if (j == k) { - CUR_CTRL &= ~port_afd; + CUR_CTRL &= ~PARPORT_CONTROL_AUTOFD; outb(CUR_CTRL, pi->port + 2); @@ -175,9 +169,9 @@ static int ppc6_select(struct pi_adapter *pi) if (j == k) { if (i & 4) // EPP - CUR_CTRL &= ~(port_sel | port_init); + CUR_CTRL &= ~(PARPORT_CONTROL_SELECT | PARPORT_CONTROL_INIT); else // PPC/ECP - CUR_CTRL &= ~port_sel; + CUR_CTRL &= ~PARPORT_CONTROL_SELECT; outb(CUR_CTRL, pi->port + 2); @@ -197,15 +191,15 @@ static int ppc6_select(struct pi_adapter *pi) static void ppc6_deselect(struct pi_adapter *pi) { if (mode_map[pi->mode] & 4) // EPP - CUR_CTRL |= port_init; + CUR_CTRL |= PARPORT_CONTROL_INIT; else // PPC/ECP - CUR_CTRL |= port_sel; + CUR_CTRL |= PARPORT_CONTROL_SELECT; outb(CUR_CTRL, pi->port + 2); outb(pi->saved_r0, pi->port); - outb((pi->saved_r2 | port_sel), pi->port + 2); + outb((pi->saved_r2 | PARPORT_CONTROL_SELECT), pi->port + 2); outb(pi->saved_r2, pi->port + 2); } @@ -223,7 +217,7 @@ static void ppc6_send_cmd(struct pi_adapter *pi, u8 cmd) { outb(cmd, pi->port); - CUR_CTRL ^= cmd_stb; + CUR_CTRL ^= PARPORT_CONTROL_AUTOFD; outb(CUR_CTRL, pi->port + 2); @@ -254,7 +248,7 @@ static void ppc6_wr_data_byte(struct pi_adapter *pi, u8 data) { outb(data, pi->port); - CUR_CTRL ^= data_stb; + CUR_CTRL ^= PARPORT_CONTROL_INIT; outb(CUR_CTRL, pi->port + 2); @@ -283,7 +277,7 @@ static u8 ppc6_rd_data_byte(struct pi_adapter *pi) case PPCMODE_UNI_SW : case PPCMODE_UNI_FW : { - CUR_CTRL = (CUR_CTRL & ~port_stb) ^ data_stb; + CUR_CTRL = (CUR_CTRL & ~PARPORT_CONTROL_STROBE) ^ PARPORT_CONTROL_INIT; outb(CUR_CTRL, pi->port + 2); @@ -293,7 +287,7 @@ static u8 ppc6_rd_data_byte(struct pi_adapter *pi) data = ((data & 0x80) >> 1) | ((data & 0x38) >> 3); - CUR_CTRL |= port_stb; + CUR_CTRL |= PARPORT_CONTROL_STROBE; outb(CUR_CTRL, pi->port + 2); @@ -311,13 +305,13 @@ static u8 ppc6_rd_data_byte(struct pi_adapter *pi) outb(CUR_CTRL, pi->port + 2); - CUR_CTRL = (CUR_CTRL | port_stb) ^ data_stb; + CUR_CTRL = (CUR_CTRL | PARPORT_CONTROL_STROBE) ^ PARPORT_CONTROL_INIT; outb(CUR_CTRL, pi->port + 2); data = inb(pi->port); - CUR_CTRL &= ~port_stb; + CUR_CTRL &= ~PARPORT_CONTROL_STROBE; outb(CUR_CTRL, pi->port + 2); @@ -376,7 +370,8 @@ static void ppc6_rd_data_blk(struct pi_adapter *pi, u8 *data, long count) { u8 d; - CUR_CTRL = (CUR_CTRL & ~port_stb) ^ data_stb; + CUR_CTRL = (CUR_CTRL & ~PARPORT_CONTROL_STROBE) + ^ PARPORT_CONTROL_INIT; outb(CUR_CTRL, pi->port + 2); @@ -386,7 +381,7 @@ static void ppc6_rd_data_blk(struct pi_adapter *pi, u8 *data, long count) d = ((d & 0x80) >> 1) | ((d & 0x38) >> 3); - CUR_CTRL |= port_stb; + CUR_CTRL |= PARPORT_CONTROL_STROBE; outb(CUR_CTRL, pi->port + 2); @@ -408,11 +403,11 @@ static void ppc6_rd_data_blk(struct pi_adapter *pi, u8 *data, long count) outb(CUR_CTRL, pi->port + 2); - CUR_CTRL |= port_stb; + CUR_CTRL |= PARPORT_CONTROL_STROBE; while(count) { - CUR_CTRL ^= data_stb; + CUR_CTRL ^= PARPORT_CONTROL_INIT; outb(CUR_CTRL, pi->port + 2); @@ -420,7 +415,7 @@ static void ppc6_rd_data_blk(struct pi_adapter *pi, u8 *data, long count) count--; } - CUR_CTRL &= ~port_stb; + CUR_CTRL &= ~PARPORT_CONTROL_STROBE; outb(CUR_CTRL, pi->port + 2); @@ -525,7 +520,7 @@ static void ppc6_wr_data_blk(struct pi_adapter *pi, u8 *data, long count) { outb(*data++, pi->port); - CUR_CTRL ^= data_stb; + CUR_CTRL ^= PARPORT_CONTROL_INIT; outb(CUR_CTRL, pi->port + 2); } @@ -540,7 +535,7 @@ static void ppc6_wr_data_blk(struct pi_adapter *pi, u8 *data, long count) ppc6_send_cmd(pi, CMD_PREFIX_SET | PREFIX_FASTWR); - CUR_CTRL |= port_stb; + CUR_CTRL |= PARPORT_CONTROL_STROBE; outb(CUR_CTRL, pi->port + 2); @@ -555,7 +550,7 @@ static void ppc6_wr_data_blk(struct pi_adapter *pi, u8 *data, long count) if (this == last) { - CUR_CTRL ^= data_stb; + CUR_CTRL ^= PARPORT_CONTROL_INIT; outb(CUR_CTRL, pi->port + 2); } @@ -567,7 +562,7 @@ static void ppc6_wr_data_blk(struct pi_adapter *pi, u8 *data, long count) } } - CUR_CTRL &= ~port_stb; + CUR_CTRL &= ~PARPORT_CONTROL_STROBE; outb(CUR_CTRL, pi->port + 2); From patchwork Tue Mar 7 22:46:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ondrej Zary X-Patchwork-Id: 65917 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp4430wrd; Tue, 7 Mar 2023 14:49:27 -0800 (PST) X-Google-Smtp-Source: AK7set8zVN3P9qo1AJKsmHDv2LUmPMsvvf9hA7vJp4dFR8Sqm6qqYN/B79fmCmRchx0FLuRWTXtb X-Received: by 2002:a05:6a20:3949:b0:cc:f9f2:3039 with SMTP id r9-20020a056a20394900b000ccf9f23039mr20458546pzg.60.1678229366873; Tue, 07 Mar 2023 14:49:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678229366; cv=none; d=google.com; s=arc-20160816; b=OvN795yVKAYNNJRd6UQsyWRSvQxEwVK2RtapY+jmwHKfqtDuiwgWobMihNeFUp61P6 8R4ube2e1cgdxZfbAoxXPWyKelqZLHCKlevp6S65tIv/RJFi3E00rOoXHNG79WlDQxQg 1UjTdVuJTW+lCZc7Gj4J2xBPU+Fdj7WgWib1mRRtwe3WX2IsGDUg+5SPq8qwAui/1o12 e8Tro+GZROI8l2sXTvbLcsaMasliKK9BHNvBfANsVs3EU/ky63DAi3RgYInrCTI3F2lc ZaH4v2C5li4aDJr4ukyyWYcFltgxewswlgFNlwJz3H7C1KLr4fD+eKXap81w4596VxXK c6PA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=T1clZPmNTcpqBL3bJrOvMLvhrBhvFNOEiqYzttXesnw=; b=qbwseXdieyvdBK1doq0Pqq23JooXhq5dQnd6o124t/znDlvjfKAQVGi+zD+/MLnexQ GK+uKSCQNBz8F1yBW1DnM6cyhzp5poorlCSCYlf3uSSOHAYQNbOzPJQ3/Bysi9UpM2UY nPgWPP4Qfv2fsaoUw7PooAGzutXKY+Kh+D8VAa4LbrKndjNcvJhED+o54OywTrpcKP77 Ehp4O6h6ZBjcypYLsudObijPOUQh5Z+HjpVvR/0TmvdN+d4iHF1iyv8nxctSZZI0b/Mw /hC0UTmTrag7exKgajyRVLXSeLBP6bmBwFAs65H6BR+Cf87OcrCk7NsmSYXUNuncXp6O fG+w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t185-20020a6381c2000000b004ccd057d472si12320140pgd.815.2023.03.07.14.49.13; Tue, 07 Mar 2023 14:49:26 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231676AbjCGWrg (ORCPT + 99 others); Tue, 7 Mar 2023 17:47:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33324 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230232AbjCGWrH (ORCPT ); Tue, 7 Mar 2023 17:47:07 -0500 Received: from hosting.gsystem.sk (hosting.gsystem.sk [212.5.213.30]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 6842A7288; Tue, 7 Mar 2023 14:47:01 -0800 (PST) Received: from gsql.ggedos.sk (off-20.infotel.telecom.sk [212.5.213.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by hosting.gsystem.sk (Postfix) with ESMTPSA id 09CF57A06FE; Tue, 7 Mar 2023 23:46:49 +0100 (CET) From: Ondrej Zary To: Damien Le Moal , Sudip Mukherjee Cc: Christoph Hellwig , Sergey Shtylyov , Jens Axboe , Tim Waugh , linux-block@vger.kernel.org, linux-parport@lists.infradead.org, linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 11/32] parport_pc: add 16-bit and 8-bit fast EPP transfer flags Date: Tue, 7 Mar 2023 23:46:06 +0100 Message-Id: <20230307224627.28011-12-linux@zary.sk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20230307224627.28011-1-linux@zary.sk> References: <20230307224627.28011-1-linux@zary.sk> MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759751036557948990?= X-GMAIL-MSGID: =?utf-8?q?1759751036557948990?= PARPORT_EPP_FAST flag currently uses 32-bit I/O port access for data read/write (insl/outsl). Add PARPORT_EPP_FAST_16 and PARPORT_EPP_FAST_8 that use insw/outsw and insb/outsb (and PARPORT_EPP_FAST_32 as alias for PARPORT_EPP_FAST). Signed-off-by: Ondrej Zary --- drivers/parport/parport_pc.c | 20 ++++++++++++++++---- include/uapi/linux/parport.h | 3 +++ 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/drivers/parport/parport_pc.c b/drivers/parport/parport_pc.c index 5784dc20fb38..eda4e4e6d4e8 100644 --- a/drivers/parport/parport_pc.c +++ b/drivers/parport/parport_pc.c @@ -298,9 +298,15 @@ static size_t parport_pc_epp_read_data(struct parport *port, void *buf, } return got; } - if ((flags & PARPORT_EPP_FAST) && (length > 1)) { - if (!(((long)buf | length) & 0x03)) + if ((length > 1) && ((flags & PARPORT_EPP_FAST_32) + || flags & PARPORT_EPP_FAST_16 + || flags & PARPORT_EPP_FAST_8)) { + if ((flags & PARPORT_EPP_FAST_32) + && !(((long)buf | length) & 0x03)) insl(EPPDATA(port), buf, (length >> 2)); + else if ((flags & PARPORT_EPP_FAST_16) + && !(((long)buf | length) & 0x01)) + insw(EPPDATA(port), buf, length >> 1); else insb(EPPDATA(port), buf, length); if (inb(STATUS(port)) & 0x01) { @@ -327,9 +333,15 @@ static size_t parport_pc_epp_write_data(struct parport *port, const void *buf, { size_t written = 0; - if ((flags & PARPORT_EPP_FAST) && (length > 1)) { - if (!(((long)buf | length) & 0x03)) + if ((length > 1) && ((flags & PARPORT_EPP_FAST_32) + || flags & PARPORT_EPP_FAST_16 + || flags & PARPORT_EPP_FAST_8)) { + if ((flags & PARPORT_EPP_FAST_32) + && !(((long)buf | length) & 0x03)) outsl(EPPDATA(port), buf, (length >> 2)); + else if ((flags & PARPORT_EPP_FAST_16) + && !(((long)buf | length) & 0x01)) + outsw(EPPDATA(port), buf, length >> 1); else outsb(EPPDATA(port), buf, length); if (inb(STATUS(port)) & 0x01) { diff --git a/include/uapi/linux/parport.h b/include/uapi/linux/parport.h index f41388f88dc3..fe93e41fc205 100644 --- a/include/uapi/linux/parport.h +++ b/include/uapi/linux/parport.h @@ -90,6 +90,9 @@ typedef enum { /* Flags for block transfer operations. */ #define PARPORT_EPP_FAST (1<<0) /* Unreliable counts. */ #define PARPORT_W91284PIC (1<<1) /* have a Warp9 w91284pic in the device */ +#define PARPORT_EPP_FAST_32 PARPORT_EPP_FAST /* 32-bit EPP transfers */ +#define PARPORT_EPP_FAST_16 (1<<2) /* 16-bit EPP transfers */ +#define PARPORT_EPP_FAST_8 (1<<3) /* 8-bit EPP transfers */ /* The rest is for the kernel only */ #endif /* _UAPI_PARPORT_H_ */ From patchwork Tue Mar 7 22:46:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ondrej Zary X-Patchwork-Id: 65937 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp8129wrd; Tue, 7 Mar 2023 14:59:53 -0800 (PST) X-Google-Smtp-Source: AK7set+L6hnISpNN8xa8yPB3LGRgzg7v3BcaxWD1+9i4Jpz5rew8rcB8G1pPMCRYILq6QeJQ7J8l X-Received: by 2002:a17:907:64c:b0:8ab:a378:5f96 with SMTP id wq12-20020a170907064c00b008aba3785f96mr19896924ejb.3.1678229993024; Tue, 07 Mar 2023 14:59:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678229993; cv=none; d=google.com; s=arc-20160816; b=BuDYJnWm7EyzxxJTPLtOuFaQovdwevK0m9Ae2PLTATOdG0BJ8X2eo5A2bAxsWFld/o YJgV3lrS0lFEtTg8n4d56QNnYlAyFhkFBGomTwX1+BLy3FobwJc8UVAbDonOFVlwyxnm bW+qfljru398GZK1LZH0LgOa7485CJCCFsAdidxYOkyePUDxjRNNV7NB1c1BmTgMqhOr oVNfZuNhv8Cjl54c+hdQ26O5mqSuT4CG0l62Kg/JnQ8Ny7/lsqQTJh0oqWiw4617tLv7 ehuRstjBWLRWf+al+kChxvk1hkQlIBxpzb9l7DiT9ZY/pZchRkn/E7ffTzyNwyYtmpim oGIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=SayNx3/nsgZFHGspnLny6R92wMJ1DN01COrXjujtJAk=; b=BlQM+lNwlV/D7UYKr5JmFx3ElL7GO2inRu2ae+cds4pdTmE1lQClJiVTDCk+Hd2qaZ HCamWngefZCAPxL+JkQtwghjy0rbXds2X1+qOxqiBCKybhQj+Y8dHRGiATjqSWcaz3Y3 sqrQcOzQ29EmSx+ISwnV1Gsax3jogPQMxh2gsJIbuOWG5R/MmDCxtvjxmI82qJPBQL0o 2s90H/kvl0oLYutxRIoWVRGAQMKewU177MWMR6ajWCqK7kcmkPE7GRJHUQ/q5Eq1f5Co fpj1b0bBrVFIJAoHpCyWEFUDzFYPqF8wKPsN6c2LLWC5gPtMeJE/KS8A3xplelOajG8G wf7Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id di8-20020a170906730800b008b17569b4d9si5612980ejc.361.2023.03.07.14.59.29; Tue, 07 Mar 2023 14:59:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231782AbjCGWrp (ORCPT + 99 others); Tue, 7 Mar 2023 17:47:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33500 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229953AbjCGWrI (ORCPT ); Tue, 7 Mar 2023 17:47:08 -0500 Received: from hosting.gsystem.sk (hosting.gsystem.sk [212.5.213.30]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 68CEF93C8; Tue, 7 Mar 2023 14:47:01 -0800 (PST) Received: from gsql.ggedos.sk (off-20.infotel.telecom.sk [212.5.213.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by hosting.gsystem.sk (Postfix) with ESMTPSA id 2240E7A0708; Tue, 7 Mar 2023 23:46:49 +0100 (CET) From: Ondrej Zary To: Damien Le Moal , Sudip Mukherjee Cc: Christoph Hellwig , Sergey Shtylyov , Jens Axboe , Tim Waugh , linux-block@vger.kernel.org, linux-parport@lists.infradead.org, linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 12/32] pata_parport-bpck6: use parport access functions instead of port I/O Date: Tue, 7 Mar 2023 23:46:07 +0100 Message-Id: <20230307224627.28011-13-linux@zary.sk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20230307224627.28011-1-linux@zary.sk> References: <20230307224627.28011-1-linux@zary.sk> MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759751693413277957?= X-GMAIL-MSGID: =?utf-8?q?1759751693413277957?= Use parport access functions instead of inb/outb/inw/outw/inl/outl. Signed-off-by: Ondrej Zary --- drivers/ata/pata_parport/bpck6.c | 1 - drivers/ata/pata_parport/ppc6lnx.c | 212 +++++++++-------------------- 2 files changed, 68 insertions(+), 145 deletions(-) diff --git a/drivers/ata/pata_parport/bpck6.c b/drivers/ata/pata_parport/bpck6.c index dc0f71cc305e..39ac6e1a0aee 100644 --- a/drivers/ata/pata_parport/bpck6.c +++ b/drivers/ata/pata_parport/bpck6.c @@ -15,7 +15,6 @@ #include #include #include -#include #include #include "pata_parport.h" #include "ppc6lnx.c" diff --git a/drivers/ata/pata_parport/ppc6lnx.c b/drivers/ata/pata_parport/ppc6lnx.c index 09480a7fcaee..89c40d6ab036 100644 --- a/drivers/ata/pata_parport/ppc6lnx.c +++ b/drivers/ata/pata_parport/ppc6lnx.c @@ -17,7 +17,6 @@ #define port_int 16 -#define port_dir 0x20 #define ECR_EPP 0x80 #define ECR_BI 0x20 @@ -106,65 +105,60 @@ static int ppc6_select(struct pi_adapter *pi) { u8 i, j, k; - i = inb(pi->port + 1); + pi->saved_r0 = parport_read_data(pi->pardev->port); - if (i & 1) - outb(i, pi->port + 1); - - pi->saved_r0 = inb(pi->port); - - pi->saved_r2 = inb(pi->port + 2) & 0x5F; // readback ctrl + pi->saved_r2 = parport_read_control(pi->pardev->port) & 0x5F; // readback ctrl CUR_CTRL = pi->saved_r2; CUR_CTRL |= PARPORT_CONTROL_SELECT; - outb(CUR_CTRL, pi->port + 2); + parport_write_control(pi->pardev->port, CUR_CTRL); if (pi->saved_r0 == 'b') - outb('x', pi->port); + parport_write_data(pi->pardev->port, 'x'); - outb('b', pi->port); - outb('p', pi->port); - outb(pi->unit, pi->port); - outb(~pi->unit, pi->port); + parport_write_data(pi->pardev->port, 'b'); + parport_write_data(pi->pardev->port, 'p'); + parport_write_data(pi->pardev->port, pi->unit); + parport_write_data(pi->pardev->port, ~pi->unit); CUR_CTRL &= ~PARPORT_CONTROL_SELECT; - outb(CUR_CTRL, pi->port + 2); + parport_write_control(pi->pardev->port, CUR_CTRL); CUR_CTRL = (CUR_CTRL & port_int) | PARPORT_CONTROL_INIT; - outb(CUR_CTRL, pi->port + 2); + parport_write_control(pi->pardev->port, CUR_CTRL); i = mode_map[pi->mode] & 0x0C; if (i == 0) i = (mode_map[pi->mode] & 2) | 1; - outb(i, pi->port); + parport_write_data(pi->pardev->port, i); CUR_CTRL |= PARPORT_CONTROL_SELECT; - outb(CUR_CTRL, pi->port + 2); + parport_write_control(pi->pardev->port, CUR_CTRL); // DELAY CUR_CTRL |= PARPORT_CONTROL_AUTOFD; - outb(CUR_CTRL, pi->port + 2); + parport_write_control(pi->pardev->port, CUR_CTRL); j = ((i & 0x08) << 4) | ((i & 0x07) << 3); - k = inb(pi->port + 1) & 0xB8; + k = parport_read_status(pi->pardev->port) & 0xB8; if (j == k) { CUR_CTRL &= ~PARPORT_CONTROL_AUTOFD; - outb(CUR_CTRL, pi->port + 2); + parport_write_control(pi->pardev->port, CUR_CTRL); - k = (inb(pi->port + 1) & 0xB8) ^ 0xB8; + k = (parport_read_status(pi->pardev->port) & 0xB8) ^ 0xB8; if (j == k) { @@ -173,15 +167,15 @@ static int ppc6_select(struct pi_adapter *pi) else // PPC/ECP CUR_CTRL &= ~PARPORT_CONTROL_SELECT; - outb(CUR_CTRL, pi->port + 2); + parport_write_control(pi->pardev->port, CUR_CTRL); return(1); } } - outb(pi->saved_r2, pi->port + 2); + parport_write_control(pi->pardev->port, pi->saved_r2); - outb(pi->saved_r0, pi->port); + parport_write_data(pi->pardev->port, pi->saved_r0); return(0); // FAIL } @@ -195,13 +189,13 @@ static void ppc6_deselect(struct pi_adapter *pi) else // PPC/ECP CUR_CTRL |= PARPORT_CONTROL_SELECT; - outb(CUR_CTRL, pi->port + 2); + parport_write_control(pi->pardev->port, CUR_CTRL); - outb(pi->saved_r0, pi->port); + parport_write_data(pi->pardev->port, pi->saved_r0); - outb((pi->saved_r2 | PARPORT_CONTROL_SELECT), pi->port + 2); + parport_write_control(pi->pardev->port, (pi->saved_r2 | PARPORT_CONTROL_SELECT)); - outb(pi->saved_r2, pi->port + 2); + parport_write_control(pi->pardev->port, pi->saved_r2); } //*************************************************************************** @@ -215,11 +209,11 @@ static void ppc6_send_cmd(struct pi_adapter *pi, u8 cmd) case PPCMODE_BI_SW : case PPCMODE_BI_FW : { - outb(cmd, pi->port); + parport_write_data(pi->pardev->port, cmd); CUR_CTRL ^= PARPORT_CONTROL_AUTOFD; - outb(CUR_CTRL, pi->port + 2); + parport_write_control(pi->pardev->port, CUR_CTRL); break; } @@ -228,7 +222,7 @@ static void ppc6_send_cmd(struct pi_adapter *pi, u8 cmd) case PPCMODE_EPP_WORD : case PPCMODE_EPP_DWORD : { - outb(cmd, pi->port + 3); + pi->pardev->port->ops->epp_write_addr(pi->pardev->port, &cmd, 1, 0); break; } @@ -246,11 +240,11 @@ static void ppc6_wr_data_byte(struct pi_adapter *pi, u8 data) case PPCMODE_BI_SW : case PPCMODE_BI_FW : { - outb(data, pi->port); + parport_write_data(pi->pardev->port, data); CUR_CTRL ^= PARPORT_CONTROL_INIT; - outb(CUR_CTRL, pi->port + 2); + parport_write_control(pi->pardev->port, CUR_CTRL); break; } @@ -259,7 +253,7 @@ static void ppc6_wr_data_byte(struct pi_adapter *pi, u8 data) case PPCMODE_EPP_WORD : case PPCMODE_EPP_DWORD : { - outb(data, pi->port + 4); + pi->pardev->port->ops->epp_write_data(pi->pardev->port, &data, 1, 0); break; } @@ -279,21 +273,21 @@ static u8 ppc6_rd_data_byte(struct pi_adapter *pi) { CUR_CTRL = (CUR_CTRL & ~PARPORT_CONTROL_STROBE) ^ PARPORT_CONTROL_INIT; - outb(CUR_CTRL, pi->port + 2); + parport_write_control(pi->pardev->port, CUR_CTRL); // DELAY - data = inb(pi->port + 1); + data = parport_read_status(pi->pardev->port); data = ((data & 0x80) >> 1) | ((data & 0x38) >> 3); CUR_CTRL |= PARPORT_CONTROL_STROBE; - outb(CUR_CTRL, pi->port + 2); + parport_write_control(pi->pardev->port, CUR_CTRL); // DELAY - data |= inb(pi->port + 1) & 0xB8; + data |= parport_read_status(pi->pardev->port) & 0xB8; break; } @@ -301,23 +295,19 @@ static u8 ppc6_rd_data_byte(struct pi_adapter *pi) case PPCMODE_BI_SW : case PPCMODE_BI_FW : { - CUR_CTRL |= port_dir; - - outb(CUR_CTRL, pi->port + 2); + parport_data_reverse(pi->pardev->port); CUR_CTRL = (CUR_CTRL | PARPORT_CONTROL_STROBE) ^ PARPORT_CONTROL_INIT; - outb(CUR_CTRL, pi->port + 2); + parport_write_control(pi->pardev->port, CUR_CTRL); - data = inb(pi->port); + data = parport_read_data(pi->pardev->port); CUR_CTRL &= ~PARPORT_CONTROL_STROBE; - outb(CUR_CTRL, pi->port + 2); - - CUR_CTRL &= ~port_dir; + parport_write_control(pi->pardev->port, CUR_CTRL); - outb(CUR_CTRL, pi->port + 2); + parport_data_forward(pi->pardev->port); break; } @@ -326,11 +316,7 @@ static u8 ppc6_rd_data_byte(struct pi_adapter *pi) case PPCMODE_EPP_WORD : case PPCMODE_EPP_DWORD : { - outb((CUR_CTRL | port_dir), pi->port + 2); - - data = inb(pi->port + 4); - - outb(CUR_CTRL, pi->port + 2); + pi->pardev->port->ops->epp_read_data(pi->pardev->port, &data, 1, 0); break; } @@ -373,21 +359,21 @@ static void ppc6_rd_data_blk(struct pi_adapter *pi, u8 *data, long count) CUR_CTRL = (CUR_CTRL & ~PARPORT_CONTROL_STROBE) ^ PARPORT_CONTROL_INIT; - outb(CUR_CTRL, pi->port + 2); + parport_write_control(pi->pardev->port, CUR_CTRL); // DELAY - d = inb(pi->port + 1); + d = parport_read_status(pi->pardev->port); d = ((d & 0x80) >> 1) | ((d & 0x38) >> 3); CUR_CTRL |= PARPORT_CONTROL_STROBE; - outb(CUR_CTRL, pi->port + 2); + parport_write_control(pi->pardev->port, CUR_CTRL); // DELAY - d |= inb(pi->port + 1) & 0xB8; + d |= parport_read_status(pi->pardev->port) & 0xB8; *data++ = d; count--; @@ -399,9 +385,7 @@ static void ppc6_rd_data_blk(struct pi_adapter *pi, u8 *data, long count) case PPCMODE_BI_SW : case PPCMODE_BI_FW : { - CUR_CTRL |= port_dir; - - outb(CUR_CTRL, pi->port + 2); + parport_data_reverse(pi->pardev->port); CUR_CTRL |= PARPORT_CONTROL_STROBE; @@ -409,84 +393,47 @@ static void ppc6_rd_data_blk(struct pi_adapter *pi, u8 *data, long count) { CUR_CTRL ^= PARPORT_CONTROL_INIT; - outb(CUR_CTRL, pi->port + 2); + parport_write_control(pi->pardev->port, CUR_CTRL); - *data++ = inb(pi->port); + *data++ = parport_read_data(pi->pardev->port); count--; } CUR_CTRL &= ~PARPORT_CONTROL_STROBE; - outb(CUR_CTRL, pi->port + 2); + parport_write_control(pi->pardev->port, CUR_CTRL); - CUR_CTRL &= ~port_dir; - - outb(CUR_CTRL, pi->port + 2); + parport_data_forward(pi->pardev->port); break; } case PPCMODE_EPP_BYTE : { - outb((CUR_CTRL | port_dir), pi->port + 2); - // DELAY - while(count) - { - *data++ = inb(pi->port + 4); - count--; - } - - outb(CUR_CTRL, pi->port + 2); + pi->pardev->port->ops->epp_read_data(pi->pardev->port, + data, count, PARPORT_EPP_FAST_8); break; } case PPCMODE_EPP_WORD : { - outb((CUR_CTRL | port_dir), pi->port + 2); - // DELAY - while(count > 1) - { - *((u16 *)data) = inw(pi->port + 4); - data += 2; - count -= 2; - } - - while(count) - { - *data++ = inb(pi->port + 4); - count--; - } - - outb(CUR_CTRL, pi->port + 2); + pi->pardev->port->ops->epp_read_data(pi->pardev->port, + data, count, PARPORT_EPP_FAST_16); break; } case PPCMODE_EPP_DWORD : { - outb((CUR_CTRL | port_dir), pi->port + 2); - // DELAY - while(count > 3) - { - *((u32 *)data) = inl(pi->port + 4); - data += 4; - count -= 4; - } - - while(count) - { - *data++ = inb(pi->port + 4); - count--; - } - - outb(CUR_CTRL, pi->port + 2); + pi->pardev->port->ops->epp_read_data(pi->pardev->port, + data, count, PARPORT_EPP_FAST_32); break; } @@ -503,7 +450,7 @@ static void ppc6_wait_for_fifo(struct pi_adapter *pi) if (PPC_FLAGS & fifo_wait) { for(i=0; i<20; i++) - inb(pi->port + 1); + parport_read_status(pi->pardev->port); } } @@ -518,11 +465,11 @@ static void ppc6_wr_data_blk(struct pi_adapter *pi, u8 *data, long count) { while(count--) { - outb(*data++, pi->port); + parport_write_data(pi->pardev->port, *data++); CUR_CTRL ^= PARPORT_CONTROL_INIT; - outb(CUR_CTRL, pi->port + 2); + parport_write_control(pi->pardev->port, CUR_CTRL); } break; @@ -537,11 +484,11 @@ static void ppc6_wr_data_blk(struct pi_adapter *pi, u8 *data, long count) CUR_CTRL |= PARPORT_CONTROL_STROBE; - outb(CUR_CTRL, pi->port + 2); + parport_write_control(pi->pardev->port, CUR_CTRL); last = *data; - outb(last, pi->port); + parport_write_data(pi->pardev->port, last); while(count) { @@ -552,11 +499,11 @@ static void ppc6_wr_data_blk(struct pi_adapter *pi, u8 *data, long count) { CUR_CTRL ^= PARPORT_CONTROL_INIT; - outb(CUR_CTRL, pi->port + 2); + parport_write_control(pi->pardev->port, CUR_CTRL); } else { - outb(this, pi->port); + parport_write_data(pi->pardev->port, this); last = this; } @@ -564,7 +511,7 @@ static void ppc6_wr_data_blk(struct pi_adapter *pi, u8 *data, long count) CUR_CTRL &= ~PARPORT_CONTROL_STROBE; - outb(CUR_CTRL, pi->port + 2); + parport_write_control(pi->pardev->port, CUR_CTRL); ppc6_send_cmd(pi, CMD_PREFIX_RESET | PREFIX_FASTWR); @@ -573,11 +520,8 @@ static void ppc6_wr_data_blk(struct pi_adapter *pi, u8 *data, long count) case PPCMODE_EPP_BYTE : { - while(count) - { - outb(*data++, pi->port + 4); - count--; - } + pi->pardev->port->ops->epp_write_data(pi->pardev->port, + data, count, PARPORT_EPP_FAST_8); ppc6_wait_for_fifo(pi); @@ -586,18 +530,8 @@ static void ppc6_wr_data_blk(struct pi_adapter *pi, u8 *data, long count) case PPCMODE_EPP_WORD : { - while(count > 1) - { - outw(*((u16 *)data), pi->port + 4); - data += 2; - count -= 2; - } - - while(count) - { - outb(*data++, pi->port + 4); - count--; - } + pi->pardev->port->ops->epp_write_data(pi->pardev->port, + data, count, PARPORT_EPP_FAST_16); ppc6_wait_for_fifo(pi); @@ -606,18 +540,8 @@ static void ppc6_wr_data_blk(struct pi_adapter *pi, u8 *data, long count) case PPCMODE_EPP_DWORD : { - while(count > 3) - { - outl(*((u32 *)data), pi->port + 4); - data += 4; - count -= 4; - } - - while(count) - { - outb(*data++, pi->port + 4); - count--; - } + pi->pardev->port->ops->epp_write_data(pi->pardev->port, + data, count, PARPORT_EPP_FAST_32); ppc6_wait_for_fifo(pi); From patchwork Tue Mar 7 22:46:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ondrej Zary X-Patchwork-Id: 65945 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp10085wrd; Tue, 7 Mar 2023 15:03:08 -0800 (PST) X-Google-Smtp-Source: AK7set8Miblp6i1KGtWC50J8Wjm4CSYkdjlaHm2muPCHZaFj0dY6iR876eeGgyT3vkRRjk8t7wtM X-Received: by 2002:a17:906:1846:b0:8b2:abcd:624 with SMTP id w6-20020a170906184600b008b2abcd0624mr16645166eje.0.1678230187927; Tue, 07 Mar 2023 15:03:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678230187; cv=none; d=google.com; s=arc-20160816; b=sKw5G9mtqammRKRGvbu/RZmOG1GxhF+tPsveWkPHusoKgsqrEtdbq+WbSvgtksNrJx xIu8j4v+0Jan3eEZF8NJlwXZTFJAmlcGNuWhw+UpkZy0bg8g7AJ2PVFLHe2d1fB34t0E ET/Vq0K4cdF3850hKWtf34Xx8rNZb7O6PME4nUfd43iEM5W/HFPIHTENLtN90sY2zCj4 15o22iRHmVuZ5TOlipsg811mfJud+B55KUpTp+iadsTBeuuBpiPC0Amdx6vSLLu1WTr+ qUBEUbZW/hRLmSyww9kA0cwLlKvcyOINIv9l9pd6PBdLybPMqwVecNDJtRCFJqucjJEf i9QQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=bmnmdtfVFepOxoEo5OHMVl/RXseDjw6Xwe0hy4SP0lA=; b=qaeOrhUtKAewWGUjM8ZV1uR/gf04k9f7VTIZEUIZvepcOroS5X7XYgCgvJA/GL278P 7+5NCM7dxvMfuROWkK0Dsctv9UfBxWyO9DWeAvVgCbkcAS+e4bhMB7xMI9hHjGictwfS i8u/7hYqWLrUSQNAn8NKTgVFO54qB268WZpRD+mRcS1Xq8Kd3DXejvIiVAOWjz3FnKhf Ttxy4FhJdNvHIPE5L2wB4nAqw6TvKprcNch6BFu0Zpbmf456GC838JTxNGCWk4MqGB9L qg0mo8ERlFD/zYXSuXWneJghpaAS2RzjcV8tW2omwQOqes9wSWJ+IvbppXMX7bbonlaL dzhg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f3-20020a05640214c300b004be3964ffdcsi13937689edx.517.2023.03.07.15.02.42; Tue, 07 Mar 2023 15:03:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230298AbjCGWrv (ORCPT + 99 others); Tue, 7 Mar 2023 17:47:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33468 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230355AbjCGWrH (ORCPT ); Tue, 7 Mar 2023 17:47:07 -0500 Received: from hosting.gsystem.sk (hosting.gsystem.sk [212.5.213.30]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id D0DA315C91; Tue, 7 Mar 2023 14:47:02 -0800 (PST) Received: from gsql.ggedos.sk (off-20.infotel.telecom.sk [212.5.213.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by hosting.gsystem.sk (Postfix) with ESMTPSA id 409EE7A0709; Tue, 7 Mar 2023 23:46:49 +0100 (CET) From: Ondrej Zary To: Damien Le Moal , Sudip Mukherjee Cc: Christoph Hellwig , Sergey Shtylyov , Jens Axboe , Tim Waugh , linux-block@vger.kernel.org, linux-parport@lists.infradead.org, linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 13/32] pata_parport-bpck6: use parport_frob_control and remove CUR_CTRL Date: Tue, 7 Mar 2023 23:46:08 +0100 Message-Id: <20230307224627.28011-14-linux@zary.sk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20230307224627.28011-1-linux@zary.sk> References: <20230307224627.28011-1-linux@zary.sk> MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759751897185747279?= X-GMAIL-MSGID: =?utf-8?q?1759751897185747279?= Use parport_frob_control instead of manually maintaining control register state. Signed-off-by: Ondrej Zary --- drivers/ata/pata_parport/ppc6lnx.c | 120 +++++++++-------------------- 1 file changed, 36 insertions(+), 84 deletions(-) diff --git a/drivers/ata/pata_parport/ppc6lnx.c b/drivers/ata/pata_parport/ppc6lnx.c index 89c40d6ab036..fdc11875bf1b 100644 --- a/drivers/ata/pata_parport/ppc6lnx.c +++ b/drivers/ata/pata_parport/ppc6lnx.c @@ -15,14 +15,6 @@ //*************************************************************************** - -#define port_int 16 - -#define ECR_EPP 0x80 -#define ECR_BI 0x20 - -//*************************************************************************** - // 60772 Commands #define ACCESS_REG 0x00 @@ -57,7 +49,6 @@ //*************************************************************************** -#define CUR_CTRL (((u8 *)&pi->private)[0]) #define PPC_FLAGS (((u8 *)&pi->private)[1]) //*************************************************************************** @@ -109,11 +100,7 @@ static int ppc6_select(struct pi_adapter *pi) pi->saved_r2 = parport_read_control(pi->pardev->port) & 0x5F; // readback ctrl - CUR_CTRL = pi->saved_r2; - - CUR_CTRL |= PARPORT_CONTROL_SELECT; - - parport_write_control(pi->pardev->port, CUR_CTRL); + parport_frob_control(pi->pardev->port, PARPORT_CONTROL_SELECT, PARPORT_CONTROL_SELECT); if (pi->saved_r0 == 'b') parport_write_data(pi->pardev->port, 'x'); @@ -123,13 +110,9 @@ static int ppc6_select(struct pi_adapter *pi) parport_write_data(pi->pardev->port, pi->unit); parport_write_data(pi->pardev->port, ~pi->unit); - CUR_CTRL &= ~PARPORT_CONTROL_SELECT; - - parport_write_control(pi->pardev->port, CUR_CTRL); + parport_frob_control(pi->pardev->port, PARPORT_CONTROL_SELECT, 0); - CUR_CTRL = (CUR_CTRL & port_int) | PARPORT_CONTROL_INIT; - - parport_write_control(pi->pardev->port, CUR_CTRL); + parport_write_control(pi->pardev->port, PARPORT_CONTROL_INIT); i = mode_map[pi->mode] & 0x0C; @@ -138,15 +121,11 @@ static int ppc6_select(struct pi_adapter *pi) parport_write_data(pi->pardev->port, i); - CUR_CTRL |= PARPORT_CONTROL_SELECT; - - parport_write_control(pi->pardev->port, CUR_CTRL); + parport_frob_control(pi->pardev->port, PARPORT_CONTROL_SELECT, PARPORT_CONTROL_SELECT); // DELAY - CUR_CTRL |= PARPORT_CONTROL_AUTOFD; - - parport_write_control(pi->pardev->port, CUR_CTRL); + parport_frob_control(pi->pardev->port, PARPORT_CONTROL_AUTOFD, PARPORT_CONTROL_AUTOFD); j = ((i & 0x08) << 4) | ((i & 0x07) << 3); @@ -154,20 +133,18 @@ static int ppc6_select(struct pi_adapter *pi) if (j == k) { - CUR_CTRL &= ~PARPORT_CONTROL_AUTOFD; - - parport_write_control(pi->pardev->port, CUR_CTRL); + parport_frob_control(pi->pardev->port, PARPORT_CONTROL_AUTOFD, 0); k = (parport_read_status(pi->pardev->port) & 0xB8) ^ 0xB8; if (j == k) { if (i & 4) // EPP - CUR_CTRL &= ~(PARPORT_CONTROL_SELECT | PARPORT_CONTROL_INIT); + parport_frob_control(pi->pardev->port, + PARPORT_CONTROL_SELECT | PARPORT_CONTROL_INIT, 0); else // PPC/ECP - CUR_CTRL &= ~PARPORT_CONTROL_SELECT; - - parport_write_control(pi->pardev->port, CUR_CTRL); + parport_frob_control(pi->pardev->port, + PARPORT_CONTROL_SELECT, 0); return(1); } @@ -185,11 +162,11 @@ static int ppc6_select(struct pi_adapter *pi) static void ppc6_deselect(struct pi_adapter *pi) { if (mode_map[pi->mode] & 4) // EPP - CUR_CTRL |= PARPORT_CONTROL_INIT; + parport_frob_control(pi->pardev->port, + PARPORT_CONTROL_INIT, PARPORT_CONTROL_INIT); else // PPC/ECP - CUR_CTRL |= PARPORT_CONTROL_SELECT; - - parport_write_control(pi->pardev->port, CUR_CTRL); + parport_frob_control(pi->pardev->port, + PARPORT_CONTROL_SELECT, PARPORT_CONTROL_SELECT); parport_write_data(pi->pardev->port, pi->saved_r0); @@ -210,10 +187,7 @@ static void ppc6_send_cmd(struct pi_adapter *pi, u8 cmd) case PPCMODE_BI_FW : { parport_write_data(pi->pardev->port, cmd); - - CUR_CTRL ^= PARPORT_CONTROL_AUTOFD; - - parport_write_control(pi->pardev->port, CUR_CTRL); + parport_frob_control(pi->pardev->port, 0, PARPORT_CONTROL_AUTOFD); break; } @@ -241,10 +215,7 @@ static void ppc6_wr_data_byte(struct pi_adapter *pi, u8 data) case PPCMODE_BI_FW : { parport_write_data(pi->pardev->port, data); - - CUR_CTRL ^= PARPORT_CONTROL_INIT; - - parport_write_control(pi->pardev->port, CUR_CTRL); + parport_frob_control(pi->pardev->port, 0, PARPORT_CONTROL_INIT); break; } @@ -271,9 +242,8 @@ static u8 ppc6_rd_data_byte(struct pi_adapter *pi) case PPCMODE_UNI_SW : case PPCMODE_UNI_FW : { - CUR_CTRL = (CUR_CTRL & ~PARPORT_CONTROL_STROBE) ^ PARPORT_CONTROL_INIT; - - parport_write_control(pi->pardev->port, CUR_CTRL); + parport_frob_control(pi->pardev->port, + PARPORT_CONTROL_STROBE, PARPORT_CONTROL_INIT); // DELAY @@ -281,9 +251,8 @@ static u8 ppc6_rd_data_byte(struct pi_adapter *pi) data = ((data & 0x80) >> 1) | ((data & 0x38) >> 3); - CUR_CTRL |= PARPORT_CONTROL_STROBE; - - parport_write_control(pi->pardev->port, CUR_CTRL); + parport_frob_control(pi->pardev->port, + PARPORT_CONTROL_STROBE, PARPORT_CONTROL_STROBE); // DELAY @@ -297,15 +266,12 @@ static u8 ppc6_rd_data_byte(struct pi_adapter *pi) { parport_data_reverse(pi->pardev->port); - CUR_CTRL = (CUR_CTRL | PARPORT_CONTROL_STROBE) ^ PARPORT_CONTROL_INIT; - - parport_write_control(pi->pardev->port, CUR_CTRL); + parport_frob_control(pi->pardev->port, PARPORT_CONTROL_STROBE, + PARPORT_CONTROL_STROBE | PARPORT_CONTROL_INIT); data = parport_read_data(pi->pardev->port); - CUR_CTRL &= ~PARPORT_CONTROL_STROBE; - - parport_write_control(pi->pardev->port, CUR_CTRL); + parport_frob_control(pi->pardev->port, PARPORT_CONTROL_STROBE, 0); parport_data_forward(pi->pardev->port); @@ -356,10 +322,8 @@ static void ppc6_rd_data_blk(struct pi_adapter *pi, u8 *data, long count) { u8 d; - CUR_CTRL = (CUR_CTRL & ~PARPORT_CONTROL_STROBE) - ^ PARPORT_CONTROL_INIT; - - parport_write_control(pi->pardev->port, CUR_CTRL); + parport_frob_control(pi->pardev->port, + PARPORT_CONTROL_STROBE, PARPORT_CONTROL_INIT); // DELAY @@ -367,9 +331,8 @@ static void ppc6_rd_data_blk(struct pi_adapter *pi, u8 *data, long count) d = ((d & 0x80) >> 1) | ((d & 0x38) >> 3); - CUR_CTRL |= PARPORT_CONTROL_STROBE; - - parport_write_control(pi->pardev->port, CUR_CTRL); + parport_frob_control(pi->pardev->port, + PARPORT_CONTROL_STROBE, PARPORT_CONTROL_STROBE); // DELAY @@ -387,21 +350,16 @@ static void ppc6_rd_data_blk(struct pi_adapter *pi, u8 *data, long count) { parport_data_reverse(pi->pardev->port); - CUR_CTRL |= PARPORT_CONTROL_STROBE; - while(count) { - CUR_CTRL ^= PARPORT_CONTROL_INIT; - - parport_write_control(pi->pardev->port, CUR_CTRL); + parport_frob_control(pi->pardev->port, PARPORT_CONTROL_STROBE, + PARPORT_CONTROL_STROBE | PARPORT_CONTROL_INIT); *data++ = parport_read_data(pi->pardev->port); count--; } - CUR_CTRL &= ~PARPORT_CONTROL_STROBE; - - parport_write_control(pi->pardev->port, CUR_CTRL); + parport_frob_control(pi->pardev->port, PARPORT_CONTROL_STROBE, 0); parport_data_forward(pi->pardev->port); @@ -467,9 +425,7 @@ static void ppc6_wr_data_blk(struct pi_adapter *pi, u8 *data, long count) { parport_write_data(pi->pardev->port, *data++); - CUR_CTRL ^= PARPORT_CONTROL_INIT; - - parport_write_control(pi->pardev->port, CUR_CTRL); + parport_frob_control(pi->pardev->port, 0, PARPORT_CONTROL_INIT); } break; @@ -482,9 +438,8 @@ static void ppc6_wr_data_blk(struct pi_adapter *pi, u8 *data, long count) ppc6_send_cmd(pi, CMD_PREFIX_SET | PREFIX_FASTWR); - CUR_CTRL |= PARPORT_CONTROL_STROBE; - - parport_write_control(pi->pardev->port, CUR_CTRL); + parport_frob_control(pi->pardev->port, + PARPORT_CONTROL_STROBE, PARPORT_CONTROL_STROBE); last = *data; @@ -497,9 +452,8 @@ static void ppc6_wr_data_blk(struct pi_adapter *pi, u8 *data, long count) if (this == last) { - CUR_CTRL ^= PARPORT_CONTROL_INIT; - - parport_write_control(pi->pardev->port, CUR_CTRL); + parport_frob_control(pi->pardev->port, + 0, PARPORT_CONTROL_INIT); } else { @@ -509,9 +463,7 @@ static void ppc6_wr_data_blk(struct pi_adapter *pi, u8 *data, long count) } } - CUR_CTRL &= ~PARPORT_CONTROL_STROBE; - - parport_write_control(pi->pardev->port, CUR_CTRL); + parport_frob_control(pi->pardev->port, PARPORT_CONTROL_STROBE, 0); ppc6_send_cmd(pi, CMD_PREFIX_RESET | PREFIX_FASTWR); From patchwork Tue Mar 7 22:46:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ondrej Zary X-Patchwork-Id: 65947 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp10611wrd; Tue, 7 Mar 2023 15:04:02 -0800 (PST) X-Google-Smtp-Source: AK7set93IxLOc9W6FzIGXA0zk06H+cQBCksiZ+xT1i2Kn/uSGxsdfuYa95SJn5mL2cHAbC0wkoEX X-Received: by 2002:aa7:c14e:0:b0:4ac:d2cd:81c7 with SMTP id r14-20020aa7c14e000000b004acd2cd81c7mr16361448edp.5.1678230242628; Tue, 07 Mar 2023 15:04:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678230242; cv=none; d=google.com; s=arc-20160816; b=BVI3ljtDB2/azaZUqpIzyirvBXAihQS3ttDnWil0nhEhnJ9PovrSqonwjZuPpCU1cI DHAh6/87XEB3rlpO2ihMayMQ3CEh77PikzAbgA7YQx6rCI3evlb+q+JvU8C6bt2LIrZy m69/icM+vD5B2URVHklX+2shP70jdJLdvSwVWYHgrJXoHpwm/S6fLn5mQMoJl9XsXQ8y iITNaCIoR32HIcYZB23DjFCalRpf9N0w21JsQ/7YdORsEakSGAhFx90RvPu7lnV2oITh Hl154i4U/UZaRLPXUeRHIRiCff82e5sdT67O866Gmgi/oNaMGNePneLgmpMMU/sdrBKI IThg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=f2C+e1PLVza+0oQah+SevyUi8FgCmveZqT7y7CXVSDc=; b=bFXQ3faeHixScyPHZJUT9XYIo/VIGsG7NepsSJnCYL5cXOXU4NxVfAg17tWAnLpi6i uuyzSKa/10mfOezPHHCuKBi5Q1XlPdQ+1iOI0l695mkpXPTGR833KF35Kr0PDcmrvCrT NdnNzRt0dE4hED83R2x04LGDvMBVjxntY4NggvuwDiOlwSujreRaZqmcogxW2a9q36OM dXhRrzVNcG8swaQw3j96oRIlnXRY94nzKWqD1TXjv3FhbKGYRJ7tBWRgA60ADdoE+xlE zf0N8uFq64KSbGbZEHcDuN4Qop1/kzZfud40DCenSM4c1mUZzY28DUOLfbL5zJPDYTFA LjCA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b4-20020aa7d484000000b004acc575090fsi3925307edr.36.2023.03.07.15.03.38; Tue, 07 Mar 2023 15:04:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231132AbjCGWry (ORCPT + 99 others); Tue, 7 Mar 2023 17:47:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33270 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229991AbjCGWrK (ORCPT ); Tue, 7 Mar 2023 17:47:10 -0500 Received: from hosting.gsystem.sk (hosting.gsystem.sk [212.5.213.30]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id EEEED43928; Tue, 7 Mar 2023 14:47:02 -0800 (PST) Received: from gsql.ggedos.sk (off-20.infotel.telecom.sk [212.5.213.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by hosting.gsystem.sk (Postfix) with ESMTPSA id 503E87A071B; Tue, 7 Mar 2023 23:46:49 +0100 (CET) From: Ondrej Zary To: Damien Le Moal , Sudip Mukherjee Cc: Christoph Hellwig , Sergey Shtylyov , Jens Axboe , Tim Waugh , linux-block@vger.kernel.org, linux-parport@lists.infradead.org, linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 14/32] pata_parport-bpck6: remove PPC_FLAGS Date: Tue, 7 Mar 2023 23:46:09 +0100 Message-Id: <20230307224627.28011-15-linux@zary.sk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20230307224627.28011-1-linux@zary.sk> References: <20230307224627.28011-1-linux@zary.sk> MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759751954934064449?= X-GMAIL-MSGID: =?utf-8?q?1759751954934064449?= pi->private is now not used for any other purpose, so store wait_fifo flag directly there and remove PPC_FLAGS define. Signed-off-by: Ondrej Zary Reviewed-by: Sergey Shtylyov --- drivers/ata/pata_parport/ppc6lnx.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/drivers/ata/pata_parport/ppc6lnx.c b/drivers/ata/pata_parport/ppc6lnx.c index fdc11875bf1b..9a166f396112 100644 --- a/drivers/ata/pata_parport/ppc6lnx.c +++ b/drivers/ata/pata_parport/ppc6lnx.c @@ -49,10 +49,6 @@ //*************************************************************************** -#define PPC_FLAGS (((u8 *)&pi->private)[1]) - -//*************************************************************************** - // ppc_flags #define fifo_wait 0x10 @@ -405,7 +401,7 @@ static void ppc6_wait_for_fifo(struct pi_adapter *pi) { int i; - if (PPC_FLAGS & fifo_wait) + if (pi->private & fifo_wait) { for(i=0; i<20; i++) parport_read_status(pi->pardev->port); @@ -562,7 +558,7 @@ static int ppc6_open(struct pi_adapter *pi) if (ret == 0) return(ret); - PPC_FLAGS &= ~fifo_wait; + pi->private = 0; ppc6_send_cmd(pi, ACCESS_REG | ACCESS_WRITE | REG_RAMSIZE); ppc6_wr_data_byte(pi, RAMSIZE_128K); @@ -570,7 +566,7 @@ static int ppc6_open(struct pi_adapter *pi) ppc6_send_cmd(pi, ACCESS_REG | ACCESS_READ | REG_VERSION); if ((ppc6_rd_data_byte(pi) & 0x3F) == 0x0C) - PPC_FLAGS |= fifo_wait; + pi->private |= fifo_wait; return(ret); } From patchwork Tue Mar 7 22:46:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ondrej Zary X-Patchwork-Id: 65939 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp8531wrd; Tue, 7 Mar 2023 15:00:44 -0800 (PST) X-Google-Smtp-Source: AK7set99+5pdvTK2mLCipxY9/f5YKelKoDzrzK0dNr3O8NJtBfPv3Yfwf24YV30zOL2fOf3cvjum X-Received: by 2002:a05:6402:1619:b0:4af:63a7:7485 with SMTP id f25-20020a056402161900b004af63a77485mr15846959edv.17.1678230044539; Tue, 07 Mar 2023 15:00:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678230044; cv=none; d=google.com; s=arc-20160816; b=wGKjiGYhoUDa/PqoPzy6SOV5SVlJRIK7b6IrVdCwNTeDyQL3Lx4g0cTTfXcxmLHDhy wHvROuZIQRhd78a+U+Yx0kXHjfPvxRxTLwtHmw+sQAV/HtKTdLDUXYuIIn/E1dX4vd50 QTaBD5bvMzAIPdJSM1LgWqhtWDSedSdgJxFle6LfoD/XzFtuLfxNIniMZVOVEzaSFz8y oHIXTGnD0kL6qYfD9pfdHoxBDB6KjmV2U+x2CYbLN88wxlFcwrbYlaRKuebxQNI6Cbt3 Hm9svooZeLtnF2Lu050nA7CupHK3MXP5M7DlWYvaSQ2TiUV0Kzc4IEmHTkdSAGq0BIBR 4+Rw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=xHZ0de99UUR/EOFio2CgoB/350A0KhwGE0euUa3sIdk=; b=XY2ASP5vR+cswve0KLd/xdq0SoGsAs1/XP3aqizpPXEotdtSwkLUYo5dnOMBFgc5z0 uoTwU9u0nIS9LCbb6T5/2OMA2zTI9s9fysHZ90lIq3TpQ4PW2A4B41Z8r7wYPw9KR5tt Me9zMSJNesayEUceXWZHRhn/NX3RYoDljTAhwyPf16nAA7m4Wedm0JyqA87Fkl+jmKJM rNIqtXvt9BC1Nbt3X+rRYx/Bdsn6qEfgaloz5tpQafY/6Wmm6419FWeLhTFzINg72tjs USYG5WZVeoRM/YOYVLJWX2xWJYO9eAAxmer1+HuP5FM5/t/dcGRhoYOJOSPGfj8YZEDX kc7w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t8-20020a17090616c800b008b71bc0308asi12986979ejd.139.2023.03.07.15.00.14; Tue, 07 Mar 2023 15:00:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231811AbjCGWsD (ORCPT + 99 others); Tue, 7 Mar 2023 17:48:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33574 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230247AbjCGWrK (ORCPT ); Tue, 7 Mar 2023 17:47:10 -0500 Received: from hosting.gsystem.sk (hosting.gsystem.sk [212.5.213.30]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E823A4FAA7; Tue, 7 Mar 2023 14:47:04 -0800 (PST) Received: from gsql.ggedos.sk (off-20.infotel.telecom.sk [212.5.213.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by hosting.gsystem.sk (Postfix) with ESMTPSA id 65F1C7A071E; Tue, 7 Mar 2023 23:46:49 +0100 (CET) From: Ondrej Zary To: Damien Le Moal , Sudip Mukherjee Cc: Christoph Hellwig , Sergey Shtylyov , Jens Axboe , Tim Waugh , linux-block@vger.kernel.org, linux-parport@lists.infradead.org, linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 15/32] pata_parport-bpck6: remove ppc6_close Date: Tue, 7 Mar 2023 23:46:10 +0100 Message-Id: <20230307224627.28011-16-linux@zary.sk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20230307224627.28011-1-linux@zary.sk> References: <20230307224627.28011-1-linux@zary.sk> MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759751747003486814?= X-GMAIL-MSGID: =?utf-8?q?1759751747003486814?= ppc6_close does not do anything except calling ppc6_deselect. Remove ppc6_close and call ppc6_deselect directly. Signed-off-by: Ondrej Zary --- drivers/ata/pata_parport/bpck6.c | 4 ++-- drivers/ata/pata_parport/ppc6lnx.c | 8 -------- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/drivers/ata/pata_parport/bpck6.c b/drivers/ata/pata_parport/bpck6.c index 39ac6e1a0aee..b8135a6eed16 100644 --- a/drivers/ata/pata_parport/bpck6.c +++ b/drivers/ata/pata_parport/bpck6.c @@ -51,7 +51,7 @@ static void bpck6_disconnect(struct pi_adapter *pi) { dev_dbg(&pi->dev, "disconnect\n"); ppc6_wr_extout(pi, 0x0); - ppc6_close(pi); + ppc6_deselect(pi); } static int bpck6_test_port(struct pi_adapter *pi) /* check for 8-bit port */ @@ -83,7 +83,7 @@ static int bpck6_probe_unit(struct pi_adapter *pi) if(out) { - ppc6_close(pi); + ppc6_deselect(pi); dev_dbg(&pi->dev, "leaving probe\n"); pi->mode = saved_mode; return(1); diff --git a/drivers/ata/pata_parport/ppc6lnx.c b/drivers/ata/pata_parport/ppc6lnx.c index 9a166f396112..5b7796083e7e 100644 --- a/drivers/ata/pata_parport/ppc6lnx.c +++ b/drivers/ata/pata_parport/ppc6lnx.c @@ -81,7 +81,6 @@ static void ppc6_rd_port16_blk(struct pi_adapter *pi, u8 port, u8 *data, long le static void ppc6_wr_port16_blk(struct pi_adapter *pi, u8 port, u8 *data, long length); static void ppc6_wr_extout(struct pi_adapter *pi, u8 regdata); static int ppc6_open(struct pi_adapter *pi); -static void ppc6_close(struct pi_adapter *pi); //*************************************************************************** @@ -573,10 +572,3 @@ static int ppc6_open(struct pi_adapter *pi) //*************************************************************************** -static void ppc6_close(struct pi_adapter *pi) -{ - ppc6_deselect(pi); -} - -//*************************************************************************** - From patchwork Tue Mar 7 22:46:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ondrej Zary X-Patchwork-Id: 65951 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp11316wrd; Tue, 7 Mar 2023 15:05:12 -0800 (PST) X-Google-Smtp-Source: AK7set/PGmaN4vtRjYUAzsLLiqegDNxURRF8NNwmDUtvVDTf2W70o/Lx8EbL54fgYmJO1iGgwopV X-Received: by 2002:a17:907:8a1e:b0:8b1:264d:6187 with SMTP id sc30-20020a1709078a1e00b008b1264d6187mr19748279ejc.46.1678230312784; Tue, 07 Mar 2023 15:05:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678230312; cv=none; d=google.com; s=arc-20160816; b=uiu3QenpVTvyQr5nl9EBHDNqR8rubePbuiQnUFnPv3FCKInNy1Xq91gB31KL664pYQ +anL3/1Fo1vt3jyCTcBWneLmAA+MJS90VYaAeYTtHxQ7VmXNbD5yspiy/b+N15y4zpWT gV966i15tRWCj2x6pwN4CFnPc/cd96oknpkHhYxEaAJ4h9DVBiG4T9n+SIt2VJYZ7Tx/ 1SplA8SiEAShGk3nn5crqhdZfklJsGcQwbL/fqzyxr7DCh2n38qj4+UBY4nvRysTO7qV I21Bc2KmtZ2FHgz0iMvBqIT+z0KE0GRN2xkdij0aVODDCw23y+iYBT20iy1v4v8dR9ay CGkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=Hk/XJ5YCxnGdNqL98MjGVtT5Qoc8QUcleC3NCZPNmkA=; b=NBUUqm5DEeNSLvSAYevM0HVBzhezzmEtGQDrCrzrJXKcsCPGnjCfpI6spMM7B5NzW3 t6Vgfn0htC0PmIZFwg07X/tBLs1fxYWxvlTxJ6TMlXY/3xr5kOd8kZ6mNlQVZ84HUGi7 cWQnBovFAdVPR6P/tuglA3LMiFVQkCFdNCjxRrBMdoqBydhYY//PX10jPZ9DUWFlgQ6p MEoMOIilwIhRxVYcJkl5MukFaUjrS8QQhyk9m8MPVkC81xMol9Tt6ifX35sq+nCmIm5r ZjC3dkAzhBO9lp76T3rQD9kni/QWaYuc5fIAnL7ii7yYmTaIiVNDlTEwKGC3sJiwoMAv eIAA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ci25-20020a170906c35900b008e1cbdcd3b3si2206271ejb.195.2023.03.07.15.04.48; Tue, 07 Mar 2023 15:05:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230043AbjCGWsB (ORCPT + 99 others); Tue, 7 Mar 2023 17:48:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33564 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230044AbjCGWrK (ORCPT ); Tue, 7 Mar 2023 17:47:10 -0500 Received: from hosting.gsystem.sk (hosting.gsystem.sk [212.5.213.30]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 8CA5A838AD; Tue, 7 Mar 2023 14:47:04 -0800 (PST) Received: from gsql.ggedos.sk (off-20.infotel.telecom.sk [212.5.213.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by hosting.gsystem.sk (Postfix) with ESMTPSA id 834BD7A0728; Tue, 7 Mar 2023 23:46:49 +0100 (CET) From: Ondrej Zary To: Damien Le Moal , Sudip Mukherjee Cc: Christoph Hellwig , Sergey Shtylyov , Jens Axboe , Tim Waugh , linux-block@vger.kernel.org, linux-parport@lists.infradead.org, linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 16/32] pata_parport-bpck6: merge ppc6_rd_port into bpck6_read_regr Date: Tue, 7 Mar 2023 23:46:11 +0100 Message-Id: <20230307224627.28011-17-linux@zary.sk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20230307224627.28011-1-linux@zary.sk> References: <20230307224627.28011-1-linux@zary.sk> MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759752028355699333?= X-GMAIL-MSGID: =?utf-8?q?1759752028355699333?= ppc6_rd_port is only called by bpck6_read_regr. Merge ppc6_rd_port into bpck6_read_regr. Signed-off-by: Ondrej Zary --- drivers/ata/pata_parport/bpck6.c | 5 ++++- drivers/ata/pata_parport/ppc6lnx.c | 10 ---------- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/drivers/ata/pata_parport/bpck6.c b/drivers/ata/pata_parport/bpck6.c index b8135a6eed16..2918fc9e9def 100644 --- a/drivers/ata/pata_parport/bpck6.c +++ b/drivers/ata/pata_parport/bpck6.c @@ -21,7 +21,10 @@ static int bpck6_read_regr(struct pi_adapter *pi, int cont, int reg) { - return ppc6_rd_port(pi, cont?reg|8:reg); + u8 port = cont ? reg | 8 : reg; + + ppc6_send_cmd(pi, port | ACCESS_PORT | ACCESS_READ); + return ppc6_rd_data_byte(pi); } static void bpck6_write_regr(struct pi_adapter *pi, int cont, int reg, int val) diff --git a/drivers/ata/pata_parport/ppc6lnx.c b/drivers/ata/pata_parport/ppc6lnx.c index 5b7796083e7e..23dce177b722 100644 --- a/drivers/ata/pata_parport/ppc6lnx.c +++ b/drivers/ata/pata_parport/ppc6lnx.c @@ -72,7 +72,6 @@ static void ppc6_deselect(struct pi_adapter *pi); static void ppc6_send_cmd(struct pi_adapter *pi, u8 cmd); static void ppc6_wr_data_byte(struct pi_adapter *pi, u8 data); static u8 ppc6_rd_data_byte(struct pi_adapter *pi); -static u8 ppc6_rd_port(struct pi_adapter *pi, u8 port); static void ppc6_wr_port(struct pi_adapter *pi, u8 port, u8 data); static void ppc6_rd_data_blk(struct pi_adapter *pi, u8 *data, long count); static void ppc6_wait_for_fifo(struct pi_adapter *pi); @@ -288,15 +287,6 @@ static u8 ppc6_rd_data_byte(struct pi_adapter *pi) //*************************************************************************** -static u8 ppc6_rd_port(struct pi_adapter *pi, u8 port) -{ - ppc6_send_cmd(pi, port | ACCESS_PORT | ACCESS_READ); - - return ppc6_rd_data_byte(pi); -} - -//*************************************************************************** - static void ppc6_wr_port(struct pi_adapter *pi, u8 port, u8 data) { ppc6_send_cmd(pi, port | ACCESS_PORT | ACCESS_WRITE); From patchwork Tue Mar 7 22:46:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ondrej Zary X-Patchwork-Id: 65919 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp4609wrd; Tue, 7 Mar 2023 14:49:51 -0800 (PST) X-Google-Smtp-Source: AK7set+CG5SFvDlpA5UTRmIv+JKvMwSylXJi+g6EsOwbY1Nn6Gh4r7KAH9YUZFkHCBU84MIOERH5 X-Received: by 2002:a05:6a21:99a5:b0:a5:df86:f0e1 with SMTP id ve37-20020a056a2199a500b000a5df86f0e1mr15782905pzb.16.1678229391643; Tue, 07 Mar 2023 14:49:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678229391; cv=none; d=google.com; s=arc-20160816; b=ae+htUmYiFD7ZNq/Ept8PmZPItHvIVtEIgwZAicnvpOS24OSGSOQwJUqyi83X0za+Q zxYyG6tiabuylZbb/aCUDlLkHc6GnOQOTElreQIR7n/e/bORCDKF+e93zcVFl9vaOYbt keKzmz0jj/NyU5ieYu37X4BJdPCFk3BKM9X6N7nlDzEKcd3rtwyGhgh9B+9UKNSCeM8J XYwy5Mh9FXUaJrHPw8I3ZZgn8pzjjSwqpidh/Bj79qmtp0vIktD7eJ5RH29XeOIEXHFO 8+SKjpUNIsgjCWoBL9QEQmKmzKH1NYxhczpXi6QDN4XdMbZgalckh10WSgV1nQD4CPC9 tY8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=ovGGXr0i5EJsFtnFnJoPYZR2KOLznYLsMeYVa5VB/Z8=; b=LxkJZWGF1dTMhIIzczqrXjrr6pL6nriFo/jtAwx/VwtDQL6kVL8YruUkcrbO3QV50P BxPTgB8iSVWy/96ca70BMQz78z/UCEZ5bIJ+HGzC9F1go30H5ZVTDzjVN0/+VxiNZ15k HGAF5a9JVv81nY9gVYaiDycJkf7FL6g3L+0rp006KIz1FSwa4esDmqxSRsPhzXObvVXW 8gXeCwsfVVkv9BeN0kXll6xfNi82l8ebIwDUu/9gEVO+Ep14OeK+olHKIZm/ArqSRUga qmASvMHV8/Gc/Bv4W7GQ5tEda0YMRU+c8ZmtsM/1QyN4C3nwjRxc3naSpT2Z6wp3lcDx NztA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y187-20020a6232c4000000b005a8ac97d6cdsi12467784pfy.344.2023.03.07.14.49.37; Tue, 07 Mar 2023 14:49:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231639AbjCGWsL (ORCPT + 99 others); Tue, 7 Mar 2023 17:48:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33598 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230177AbjCGWrM (ORCPT ); Tue, 7 Mar 2023 17:47:12 -0500 Received: from hosting.gsystem.sk (hosting.gsystem.sk [212.5.213.30]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 813FD166D6; Tue, 7 Mar 2023 14:47:05 -0800 (PST) Received: from gsql.ggedos.sk (off-20.infotel.telecom.sk [212.5.213.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by hosting.gsystem.sk (Postfix) with ESMTPSA id ABC9A7A0731; Tue, 7 Mar 2023 23:46:49 +0100 (CET) From: Ondrej Zary To: Damien Le Moal , Sudip Mukherjee Cc: Christoph Hellwig , Sergey Shtylyov , Jens Axboe , Tim Waugh , linux-block@vger.kernel.org, linux-parport@lists.infradead.org, linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 17/32] pata_parport-bpck6: merge ppc6_wr_port into bpck6_write_regr Date: Tue, 7 Mar 2023 23:46:12 +0100 Message-Id: <20230307224627.28011-18-linux@zary.sk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20230307224627.28011-1-linux@zary.sk> References: <20230307224627.28011-1-linux@zary.sk> MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759751062332625586?= X-GMAIL-MSGID: =?utf-8?q?1759751062332625586?= ppc6_wr_port is only called by bpck6_write_regr. Merge ppc6_wr_port into bpck6_write_regr. Signed-off-by: Ondrej Zary --- drivers/ata/pata_parport/bpck6.c | 5 ++++- drivers/ata/pata_parport/ppc6lnx.c | 10 ---------- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/drivers/ata/pata_parport/bpck6.c b/drivers/ata/pata_parport/bpck6.c index 2918fc9e9def..8e0094e3b02b 100644 --- a/drivers/ata/pata_parport/bpck6.c +++ b/drivers/ata/pata_parport/bpck6.c @@ -29,7 +29,10 @@ static int bpck6_read_regr(struct pi_adapter *pi, int cont, int reg) static void bpck6_write_regr(struct pi_adapter *pi, int cont, int reg, int val) { - ppc6_wr_port(pi, cont?reg|8:reg, val); + u8 port = cont ? reg | 8 : reg; + + ppc6_send_cmd(pi, port | ACCESS_PORT | ACCESS_WRITE); + ppc6_wr_data_byte(pi, val); } static void bpck6_write_block(struct pi_adapter *pi, char *buf, int len) diff --git a/drivers/ata/pata_parport/ppc6lnx.c b/drivers/ata/pata_parport/ppc6lnx.c index 23dce177b722..35427742e4d3 100644 --- a/drivers/ata/pata_parport/ppc6lnx.c +++ b/drivers/ata/pata_parport/ppc6lnx.c @@ -72,7 +72,6 @@ static void ppc6_deselect(struct pi_adapter *pi); static void ppc6_send_cmd(struct pi_adapter *pi, u8 cmd); static void ppc6_wr_data_byte(struct pi_adapter *pi, u8 data); static u8 ppc6_rd_data_byte(struct pi_adapter *pi); -static void ppc6_wr_port(struct pi_adapter *pi, u8 port, u8 data); static void ppc6_rd_data_blk(struct pi_adapter *pi, u8 *data, long count); static void ppc6_wait_for_fifo(struct pi_adapter *pi); static void ppc6_wr_data_blk(struct pi_adapter *pi, u8 *data, long count); @@ -287,15 +286,6 @@ static u8 ppc6_rd_data_byte(struct pi_adapter *pi) //*************************************************************************** -static void ppc6_wr_port(struct pi_adapter *pi, u8 port, u8 data) -{ - ppc6_send_cmd(pi, port | ACCESS_PORT | ACCESS_WRITE); - - ppc6_wr_data_byte(pi, data); -} - -//*************************************************************************** - static void ppc6_rd_data_blk(struct pi_adapter *pi, u8 *data, long count) { switch (mode_map[pi->mode]) From patchwork Tue Mar 7 22:46:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ondrej Zary X-Patchwork-Id: 65935 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp7979wrd; Tue, 7 Mar 2023 14:59:25 -0800 (PST) X-Google-Smtp-Source: AK7set8Jpq6cbZ2HWGcUOvz0Vm5KurIuBWx4XSyOa2r9ZeR0LgaxkRKUhEtgrPJk/tSgOiyLa0eN X-Received: by 2002:aa7:dccb:0:b0:4ae:eae1:946a with SMTP id w11-20020aa7dccb000000b004aeeae1946amr18892256edu.13.1678229965449; Tue, 07 Mar 2023 14:59:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678229965; cv=none; d=google.com; s=arc-20160816; b=eRnlwuVnFh8Sy/vZLav2dYUpHrII5iapwYmVBWan7JmUgd5deW7zVP/G0x9ugzq2oj b/BctBWvJh0clOXQ6Sl1F34VNhth1BIAlgD2PwaknF57DXSBr55eYnctamz73T8chiyU kCDabhDCY4ODYpsynSl1Uy6i7xlPJ62/22kp5LtMrKP+bsADBNZnm+Y3Xb2mHRSArRY/ ddYqkYZuRtZ3b6ruNVmoaOEnO7P9Hviq7Aq/USzIhtt9RK5GaiVg3edWn42Jyf+NgO6b P9kgZna+UjE9R+qOivALn3Be+zr1gZt5L/RubSIlw5B/xb5agKC86MRzxgLrWp1H4Kku RLXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=CufxdAmji2FvwTRaxMJreJo0AJO3O0rE5PnhWd3/o7Q=; b=dqrTp3vXUmrC/mgd6JhgiUU073QC5uu7Hzexr45F+dECGS3WSLZoqsderlN4iIOfj6 3F/F0COWnNzTvnd1Y/p6RcmpfDWIx/hDjGcFg9TwkMfes0M974/wncGecW+gcNRSIx2H p7s8p1aX9/Btz02OIwc2jvnzArTj2bJ34rRxe2VTA/IQIG5t/rA1oM7AoxtmSmfDdUuR LTLKMSnmJc0SyIcmqLYaEQzAmg0kSf+5hUnC1FtYS+i22VE8EQkZQL28o7Ev4/Dwmulv m3yPuuHEiA3Mj3me7BBjs5SN+VsCCQ7kCItLyWG6/38oHIwjD1cFNkqjLA7wqGo1P6Vs Jn7w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c17-20020a056402121100b004aab6380df0si4163353edw.548.2023.03.07.14.59.01; Tue, 07 Mar 2023 14:59:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231163AbjCGWsO (ORCPT + 99 others); Tue, 7 Mar 2023 17:48:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33634 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231232AbjCGWrN (ORCPT ); Tue, 7 Mar 2023 17:47:13 -0500 Received: from hosting.gsystem.sk (hosting.gsystem.sk [212.5.213.30]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 827CA1EBC3; Tue, 7 Mar 2023 14:47:06 -0800 (PST) Received: from gsql.ggedos.sk (off-20.infotel.telecom.sk [212.5.213.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by hosting.gsystem.sk (Postfix) with ESMTPSA id D24B77A073E; Tue, 7 Mar 2023 23:46:49 +0100 (CET) From: Ondrej Zary To: Damien Le Moal , Sudip Mukherjee Cc: Christoph Hellwig , Sergey Shtylyov , Jens Axboe , Tim Waugh , linux-block@vger.kernel.org, linux-parport@lists.infradead.org, linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 18/32] pata_parport-bpck6: merge ppc6_rd_port16_blk into bpck6_read_block Date: Tue, 7 Mar 2023 23:46:13 +0100 Message-Id: <20230307224627.28011-19-linux@zary.sk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20230307224627.28011-1-linux@zary.sk> References: <20230307224627.28011-1-linux@zary.sk> MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759751664278605918?= X-GMAIL-MSGID: =?utf-8?q?1759751664278605918?= ppc6_rd_port16_blk is only called by bpck6_read_block. Merge ppc6_rd_port16_blk into bpck6_read_block. Signed-off-by: Ondrej Zary --- drivers/ata/pata_parport/bpck6.c | 10 +++++++++- drivers/ata/pata_parport/ppc6lnx.c | 21 --------------------- 2 files changed, 9 insertions(+), 22 deletions(-) diff --git a/drivers/ata/pata_parport/bpck6.c b/drivers/ata/pata_parport/bpck6.c index 8e0094e3b02b..aaf6737891a5 100644 --- a/drivers/ata/pata_parport/bpck6.c +++ b/drivers/ata/pata_parport/bpck6.c @@ -42,7 +42,15 @@ static void bpck6_write_block(struct pi_adapter *pi, char *buf, int len) static void bpck6_read_block(struct pi_adapter *pi, char *buf, int len) { - ppc6_rd_port16_blk(pi, ATA_REG_DATA, buf, (u32)len>>1); + ppc6_send_cmd(pi, REG_BLKSIZE | ACCESS_REG | ACCESS_WRITE); + ppc6_wr_data_byte(pi, (u8)len); + ppc6_wr_data_byte(pi, (u8)(len >> 8)); + ppc6_wr_data_byte(pi, 0); + + ppc6_send_cmd(pi, CMD_PREFIX_SET | PREFIX_IO16 | PREFIX_BLK); + ppc6_send_cmd(pi, ATA_REG_DATA | ACCESS_PORT | ACCESS_READ); + ppc6_rd_data_blk(pi, buf, len); + ppc6_send_cmd(pi, CMD_PREFIX_RESET | PREFIX_IO16 | PREFIX_BLK); } static void bpck6_connect(struct pi_adapter *pi) diff --git a/drivers/ata/pata_parport/ppc6lnx.c b/drivers/ata/pata_parport/ppc6lnx.c index 35427742e4d3..ac336ce1695b 100644 --- a/drivers/ata/pata_parport/ppc6lnx.c +++ b/drivers/ata/pata_parport/ppc6lnx.c @@ -75,7 +75,6 @@ static u8 ppc6_rd_data_byte(struct pi_adapter *pi); static void ppc6_rd_data_blk(struct pi_adapter *pi, u8 *data, long count); static void ppc6_wait_for_fifo(struct pi_adapter *pi); static void ppc6_wr_data_blk(struct pi_adapter *pi, u8 *data, long count); -static void ppc6_rd_port16_blk(struct pi_adapter *pi, u8 port, u8 *data, long length); static void ppc6_wr_port16_blk(struct pi_adapter *pi, u8 port, u8 *data, long length); static void ppc6_wr_extout(struct pi_adapter *pi, u8 regdata); static int ppc6_open(struct pi_adapter *pi); @@ -479,26 +478,6 @@ static void ppc6_wr_data_blk(struct pi_adapter *pi, u8 *data, long count) //*************************************************************************** -static void ppc6_rd_port16_blk(struct pi_adapter *pi, u8 port, u8 *data, long length) -{ - length = length << 1; - - ppc6_send_cmd(pi, REG_BLKSIZE | ACCESS_REG | ACCESS_WRITE); - ppc6_wr_data_byte(pi, (u8)length); - ppc6_wr_data_byte(pi, (u8)(length >> 8)); - ppc6_wr_data_byte(pi, 0); - - ppc6_send_cmd(pi, CMD_PREFIX_SET | PREFIX_IO16 | PREFIX_BLK); - - ppc6_send_cmd(pi, port | ACCESS_PORT | ACCESS_READ); - - ppc6_rd_data_blk(pi, data, length); - - ppc6_send_cmd(pi, CMD_PREFIX_RESET | PREFIX_IO16 | PREFIX_BLK); -} - -//*************************************************************************** - static void ppc6_wr_port16_blk(struct pi_adapter *pi, u8 port, u8 *data, long length) { length = length << 1; From patchwork Tue Mar 7 22:46:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ondrej Zary X-Patchwork-Id: 65941 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp9082wrd; Tue, 7 Mar 2023 15:01:32 -0800 (PST) X-Google-Smtp-Source: AK7set+yOkDouy6XqN/f2UZq2JxplcWq4dx/iRk/2Dttt8JgnMkCXrM40/yQru0e26Okv96L7f/V X-Received: by 2002:a17:906:3fd2:b0:8ae:fa9f:d58e with SMTP id k18-20020a1709063fd200b008aefa9fd58emr17061698ejj.53.1678230092381; Tue, 07 Mar 2023 15:01:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678230092; cv=none; d=google.com; s=arc-20160816; b=Ylc6Bprk7veiTIATbpVcNbsLeABL71H4kTC0ZbHtJRamSFMByqNGXk98hkoQXsB5it 3DVntdvy0dBPQ99isBAl9NHKEGcMoRlwkGwYYogmQA89anUf6ASlDkxwPdV6zc5FtGDw 9jUEoXORclOBzcefNUpx/lMzsnlI5NXabgOcI4sd89DQM4ElbV+rqF6d6JRYFqCNr6Eh RZ2b3R/6cbjhXC2UKlclOoPBENgeiditmyXVqc++n+9b9gMQuYvHcrfae2t6jZr8952F EabrT1NijY5DYX4pVZALsE7G6J9bM9elrWTPIDCl+eMNHhCVPODxwUdA75bK8X8MuGgO KyoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=m+ashmzdgGnheki5+RkScIg1SHfmvtWAVxWetAL41j4=; b=kNeGnazV0pjpAUaoyV+aPkAOXMCJkH6Revgg1HXCUJg7NNnXeNGD9VZuX+eBNQdCA2 xHSawL+MVEKOPqR1VzGae99/q7NnG8v7SohpRBhOAovvrYBkn4DJKmTF8/UsLQOSqQoV ajmQnQzdQ0qg2XfvG4vKuGA0QHa2PJmp1yjH2sv94dDPDJFxdoa9RUHZgGMep0p6S3sP kNLjdWk8/rCxcpbMvKWhAmtMEpoLuk/fDUDffmzi6Ihfn9X3Dis1v4LDpCcw7bxaBVTk 2CL5LiYG2TT94faY2x1zWpXGsJZGFFzXR7hNAumTpCKedQBsyvp8mlMxaK61seRlJ8vF O/8g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y2-20020a1709064b0200b009063e29189csi2719466eju.841.2023.03.07.15.01.03; Tue, 07 Mar 2023 15:01:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231672AbjCGWsT (ORCPT + 99 others); Tue, 7 Mar 2023 17:48:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33422 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231546AbjCGWrV (ORCPT ); Tue, 7 Mar 2023 17:47:21 -0500 Received: from hosting.gsystem.sk (hosting.gsystem.sk [212.5.213.30]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E73FC9DE1A; Tue, 7 Mar 2023 14:47:07 -0800 (PST) Received: from gsql.ggedos.sk (off-20.infotel.telecom.sk [212.5.213.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by hosting.gsystem.sk (Postfix) with ESMTPSA id E109A7A0741; Tue, 7 Mar 2023 23:46:49 +0100 (CET) From: Ondrej Zary To: Damien Le Moal , Sudip Mukherjee Cc: Christoph Hellwig , Sergey Shtylyov , Jens Axboe , Tim Waugh , linux-block@vger.kernel.org, linux-parport@lists.infradead.org, linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 19/32] pata_parport-bpck6: merge ppc6_wr_port16_blk into bpck6_write_block Date: Tue, 7 Mar 2023 23:46:14 +0100 Message-Id: <20230307224627.28011-20-linux@zary.sk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20230307224627.28011-1-linux@zary.sk> References: <20230307224627.28011-1-linux@zary.sk> MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759751797785828442?= X-GMAIL-MSGID: =?utf-8?q?1759751797785828442?= ppc6_wr_port16_blk is only called by bpck6_write_block. Merge ppc6_wr_port16_blk into bpck6_write_block. Signed-off-by: Ondrej Zary --- drivers/ata/pata_parport/bpck6.c | 10 +++++++++- drivers/ata/pata_parport/ppc6lnx.c | 21 --------------------- 2 files changed, 9 insertions(+), 22 deletions(-) diff --git a/drivers/ata/pata_parport/bpck6.c b/drivers/ata/pata_parport/bpck6.c index aaf6737891a5..1c04fcaba74a 100644 --- a/drivers/ata/pata_parport/bpck6.c +++ b/drivers/ata/pata_parport/bpck6.c @@ -37,7 +37,15 @@ static void bpck6_write_regr(struct pi_adapter *pi, int cont, int reg, int val) static void bpck6_write_block(struct pi_adapter *pi, char *buf, int len) { - ppc6_wr_port16_blk(pi, ATA_REG_DATA, buf, (u32)len>>1); + ppc6_send_cmd(pi, REG_BLKSIZE | ACCESS_REG | ACCESS_WRITE); + ppc6_wr_data_byte(pi, (u8)len); + ppc6_wr_data_byte(pi, (u8)(len >> 8)); + ppc6_wr_data_byte(pi, 0); + + ppc6_send_cmd(pi, CMD_PREFIX_SET | PREFIX_IO16 | PREFIX_BLK); + ppc6_send_cmd(pi, ATA_REG_DATA | ACCESS_PORT | ACCESS_WRITE); + ppc6_wr_data_blk(pi, buf, len); + ppc6_send_cmd(pi, CMD_PREFIX_RESET | PREFIX_IO16 | PREFIX_BLK); } static void bpck6_read_block(struct pi_adapter *pi, char *buf, int len) diff --git a/drivers/ata/pata_parport/ppc6lnx.c b/drivers/ata/pata_parport/ppc6lnx.c index ac336ce1695b..d275de3f1ead 100644 --- a/drivers/ata/pata_parport/ppc6lnx.c +++ b/drivers/ata/pata_parport/ppc6lnx.c @@ -75,7 +75,6 @@ static u8 ppc6_rd_data_byte(struct pi_adapter *pi); static void ppc6_rd_data_blk(struct pi_adapter *pi, u8 *data, long count); static void ppc6_wait_for_fifo(struct pi_adapter *pi); static void ppc6_wr_data_blk(struct pi_adapter *pi, u8 *data, long count); -static void ppc6_wr_port16_blk(struct pi_adapter *pi, u8 port, u8 *data, long length); static void ppc6_wr_extout(struct pi_adapter *pi, u8 regdata); static int ppc6_open(struct pi_adapter *pi); @@ -478,26 +477,6 @@ static void ppc6_wr_data_blk(struct pi_adapter *pi, u8 *data, long count) //*************************************************************************** -static void ppc6_wr_port16_blk(struct pi_adapter *pi, u8 port, u8 *data, long length) -{ - length = length << 1; - - ppc6_send_cmd(pi, REG_BLKSIZE | ACCESS_REG | ACCESS_WRITE); - ppc6_wr_data_byte(pi, (u8)length); - ppc6_wr_data_byte(pi, (u8)(length >> 8)); - ppc6_wr_data_byte(pi, 0); - - ppc6_send_cmd(pi, CMD_PREFIX_SET | PREFIX_IO16 | PREFIX_BLK); - - ppc6_send_cmd(pi, port | ACCESS_PORT | ACCESS_WRITE); - - ppc6_wr_data_blk(pi, data, length); - - ppc6_send_cmd(pi, CMD_PREFIX_RESET | PREFIX_IO16 | PREFIX_BLK); -} - -//*************************************************************************** - static void ppc6_wr_extout(struct pi_adapter *pi, u8 regdata) { ppc6_send_cmd(pi, REG_VERSION | ACCESS_REG | ACCESS_WRITE); From patchwork Tue Mar 7 22:46:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ondrej Zary X-Patchwork-Id: 65924 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp5203wrd; Tue, 7 Mar 2023 14:51:26 -0800 (PST) X-Google-Smtp-Source: AK7set+u5s9FiZr1c3Kp9SK1fFVpWkPAb1qyk08ICbKs7gpI6WLyP2Oi9ZL9uyRMdoiHA9pHmXEu X-Received: by 2002:a17:90a:19:b0:23a:ad68:25a7 with SMTP id 25-20020a17090a001900b0023aad6825a7mr8694555pja.2.1678229486119; Tue, 07 Mar 2023 14:51:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678229486; cv=none; d=google.com; s=arc-20160816; b=L0HFNIESlEvhNyYuM+TKaWCmOYG8jQ38/4UeQ9hBMhxmtRt9vMy4phRv7fkEwwS9lv R9jUXqQ+YdX6jT+RtH3NISnpgoaA34TDYbWLbZf4s4F9B1ao29px4YFt8QdvlNSrAx8s MpKtWZOaKRNq60e5lRdSSZYcdE+FcKEZlstoqZVQCLXgX25XiLqLsygCCfhh5AspGDgu 2e3VXIdgnUnzzEtUQLh6tBqztnlvJIHe6YcW9UAx+2i8Z+JW8yOS5Qy54YOC1ZBU92c9 IjlSv6w4BttK4MdtBZMY9kZZiqUmwKugdYegG2o/Z0INLtrmhl4zf5kRlJyoi20uSbR3 YhdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=XEJvR9fSJQ/j4FIZkAnRNlmQb5zsNIg4ofG9MMTKsUA=; b=Q5fAEvaiOAF906Kh++5A6nTmIX6HL1ajuVxasp4jxNmY3zrnPklQOkRGa0qJbzNZpg n5XNYbeOem/lRUQwXlm08HWRKLTfPmcX5LPRslIbZ+pvy/JEdHs3mh6r5mzSlX9+msxl I1LjFRjycBxGa4RADf/y8QyQuTJ3yxbrLD9FfwZVuaq4gCo2Jd5R7s2zbelC01Oe/e3s na54vy6IRwJm97q5wgbujshdGNvjIaKuos3hlEzgQJmrhm5vxjhgwSqpEiTmFwaxPsDu SnpuXCABr/KKrnFbiG2dFJtkh2CSYtDNIAPSsCE8+DKIg7jmolpuM/HHbcABAE7BmD0T 5gMQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ms2-20020a17090b234200b00234ba949302si15537768pjb.91.2023.03.07.14.51.13; Tue, 07 Mar 2023 14:51:26 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231836AbjCGWsY (ORCPT + 99 others); Tue, 7 Mar 2023 17:48:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33438 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231555AbjCGWrV (ORCPT ); Tue, 7 Mar 2023 17:47:21 -0500 Received: from hosting.gsystem.sk (hosting.gsystem.sk [212.5.213.30]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 8426B9CBE4; Tue, 7 Mar 2023 14:47:07 -0800 (PST) Received: from gsql.ggedos.sk (off-20.infotel.telecom.sk [212.5.213.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by hosting.gsystem.sk (Postfix) with ESMTPSA id F351D7A0742; Tue, 7 Mar 2023 23:46:49 +0100 (CET) From: Ondrej Zary To: Damien Le Moal , Sudip Mukherjee Cc: Christoph Hellwig , Sergey Shtylyov , Jens Axboe , Tim Waugh , linux-block@vger.kernel.org, linux-parport@lists.infradead.org, linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 20/32] pata_parport-bpck6: merge ppc6_rd_data_blk into bpck6_read_block Date: Tue, 7 Mar 2023 23:46:15 +0100 Message-Id: <20230307224627.28011-21-linux@zary.sk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20230307224627.28011-1-linux@zary.sk> References: <20230307224627.28011-1-linux@zary.sk> MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759751161743164428?= X-GMAIL-MSGID: =?utf-8?q?1759751161743164428?= ppc6_rd_data_blk is only called by bpck6_read_block. Merge ppc6_rd_data_blk into bpck6_read_block. Signed-off-by: Ondrej Zary --- drivers/ata/pata_parport/bpck6.c | 49 +++++++++++++++- drivers/ata/pata_parport/ppc6lnx.c | 91 ------------------------------ 2 files changed, 48 insertions(+), 92 deletions(-) diff --git a/drivers/ata/pata_parport/bpck6.c b/drivers/ata/pata_parport/bpck6.c index 1c04fcaba74a..d379603424ff 100644 --- a/drivers/ata/pata_parport/bpck6.c +++ b/drivers/ata/pata_parport/bpck6.c @@ -57,7 +57,54 @@ static void bpck6_read_block(struct pi_adapter *pi, char *buf, int len) ppc6_send_cmd(pi, CMD_PREFIX_SET | PREFIX_IO16 | PREFIX_BLK); ppc6_send_cmd(pi, ATA_REG_DATA | ACCESS_PORT | ACCESS_READ); - ppc6_rd_data_blk(pi, buf, len); + + switch (mode_map[pi->mode]) { + case PPCMODE_UNI_SW: + case PPCMODE_UNI_FW: + while (len) { + u8 d; + + parport_frob_control(pi->pardev->port, + PARPORT_CONTROL_STROBE, + PARPORT_CONTROL_INIT); /* DATA STROBE */ + d = parport_read_status(pi->pardev->port); + d = ((d & 0x80) >> 1) | ((d & 0x38) >> 3); + parport_frob_control(pi->pardev->port, + PARPORT_CONTROL_STROBE, + PARPORT_CONTROL_STROBE); + d |= parport_read_status(pi->pardev->port) & 0xB8; + *buf++ = d; + len--; + } + break; + case PPCMODE_BI_SW: + case PPCMODE_BI_FW: + parport_data_reverse(pi->pardev->port); + while (len) { + parport_frob_control(pi->pardev->port, + PARPORT_CONTROL_STROBE, + PARPORT_CONTROL_STROBE | PARPORT_CONTROL_INIT); + *buf++ = parport_read_data(pi->pardev->port); + len--; + } + parport_frob_control(pi->pardev->port, PARPORT_CONTROL_STROBE, + 0); + parport_data_forward(pi->pardev->port); + break; + case PPCMODE_EPP_BYTE: + pi->pardev->port->ops->epp_read_data(pi->pardev->port, buf, len, + PARPORT_EPP_FAST_8); + break; + case PPCMODE_EPP_WORD: + pi->pardev->port->ops->epp_read_data(pi->pardev->port, buf, len, + PARPORT_EPP_FAST_16); + break; + case PPCMODE_EPP_DWORD: + pi->pardev->port->ops->epp_read_data(pi->pardev->port, buf, len, + PARPORT_EPP_FAST_32); + break; + } + ppc6_send_cmd(pi, CMD_PREFIX_RESET | PREFIX_IO16 | PREFIX_BLK); } diff --git a/drivers/ata/pata_parport/ppc6lnx.c b/drivers/ata/pata_parport/ppc6lnx.c index d275de3f1ead..679261e19ac5 100644 --- a/drivers/ata/pata_parport/ppc6lnx.c +++ b/drivers/ata/pata_parport/ppc6lnx.c @@ -72,7 +72,6 @@ static void ppc6_deselect(struct pi_adapter *pi); static void ppc6_send_cmd(struct pi_adapter *pi, u8 cmd); static void ppc6_wr_data_byte(struct pi_adapter *pi, u8 data); static u8 ppc6_rd_data_byte(struct pi_adapter *pi); -static void ppc6_rd_data_blk(struct pi_adapter *pi, u8 *data, long count); static void ppc6_wait_for_fifo(struct pi_adapter *pi); static void ppc6_wr_data_blk(struct pi_adapter *pi, u8 *data, long count); static void ppc6_wr_extout(struct pi_adapter *pi, u8 regdata); @@ -284,96 +283,6 @@ static u8 ppc6_rd_data_byte(struct pi_adapter *pi) //*************************************************************************** -static void ppc6_rd_data_blk(struct pi_adapter *pi, u8 *data, long count) -{ - switch (mode_map[pi->mode]) - { - case PPCMODE_UNI_SW : - case PPCMODE_UNI_FW : - { - while(count) - { - u8 d; - - parport_frob_control(pi->pardev->port, - PARPORT_CONTROL_STROBE, PARPORT_CONTROL_INIT); - - // DELAY - - d = parport_read_status(pi->pardev->port); - - d = ((d & 0x80) >> 1) | ((d & 0x38) >> 3); - - parport_frob_control(pi->pardev->port, - PARPORT_CONTROL_STROBE, PARPORT_CONTROL_STROBE); - - // DELAY - - d |= parport_read_status(pi->pardev->port) & 0xB8; - - *data++ = d; - count--; - } - - break; - } - - case PPCMODE_BI_SW : - case PPCMODE_BI_FW : - { - parport_data_reverse(pi->pardev->port); - - while(count) - { - parport_frob_control(pi->pardev->port, PARPORT_CONTROL_STROBE, - PARPORT_CONTROL_STROBE | PARPORT_CONTROL_INIT); - - *data++ = parport_read_data(pi->pardev->port); - count--; - } - - parport_frob_control(pi->pardev->port, PARPORT_CONTROL_STROBE, 0); - - parport_data_forward(pi->pardev->port); - - break; - } - - case PPCMODE_EPP_BYTE : - { - // DELAY - - pi->pardev->port->ops->epp_read_data(pi->pardev->port, - data, count, PARPORT_EPP_FAST_8); - - break; - } - - case PPCMODE_EPP_WORD : - { - // DELAY - - pi->pardev->port->ops->epp_read_data(pi->pardev->port, - data, count, PARPORT_EPP_FAST_16); - - break; - } - - case PPCMODE_EPP_DWORD : - { - // DELAY - - pi->pardev->port->ops->epp_read_data(pi->pardev->port, - data, count, PARPORT_EPP_FAST_32); - - break; - } - } - -} - -//*************************************************************************** - static void ppc6_wait_for_fifo(struct pi_adapter *pi) { int i; From patchwork Tue Mar 7 22:46:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ondrej Zary X-Patchwork-Id: 65920 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp4625wrd; Tue, 7 Mar 2023 14:49:55 -0800 (PST) X-Google-Smtp-Source: AK7set+IBQ87joLiLuoFS7fXq+bBguqldECIxudZbTN001gtEMUiRaBXKSLcxMqTxAqRQh4PbzyC X-Received: by 2002:a17:90b:4a8a:b0:237:b121:670b with SMTP id lp10-20020a17090b4a8a00b00237b121670bmr17981291pjb.7.1678229395182; Tue, 07 Mar 2023 14:49:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678229395; cv=none; d=google.com; s=arc-20160816; b=aBqOyYHEHVINBdJHD3WDQseN8z5zK14/687rxYvOxMhepYb1OvhNGyXc8o5nZuHf3O a+YqI1oPmk66Lf2MO3h0CyhYEeSczuBAPmR44KGVW0JNxLXU9LE+RyK3a894JIrC23Pq NTBLki4+HbZlhfqvzcfvRNId23VZv4urlIz/la4rVVpfsy123ataHnZm9lP1OEDu/duE hQCMfMFuJvRM1mecLK+pyIQAjxwPz8SVAu0SsvV/PVok9mT/KUw17ehvrsVOFOW5PXt4 u3AD5BAlj6CAvvJpeKbplQB5D1ru1gzYEtVFYkpxVTzpwWXvuM91bZK7UY9pzJ8ateG3 8W+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=MxBGOiKVyZiq0Mc8xsSeZmpwLTJHjWcTCyByt9WqcOE=; b=DIy/eVDd8JfRMbvkZY0fY3oJpBreH76NtHU1wFC+TNaxjAeUGXepnlo5kS01lHTRig ut44zU1VByXP4F7AQP0nPkGGc3wXcS/lcu/p/IHmrh24egAYFIjQIa0Es6XPDNgfYVK9 m+EAFHGbl8j3/TaUfewBh0oNhBtVcbH0Vk5fBJZ4VzCA+PwOOA0rPyHqI9vlCA3Hzq0n fCWzfaOL7b4INbRAZK/9LsdzDApdgrr3QjIPzh+1k0Nsi/6v77jf2GjNxhmANd0Up4kv 6sXD9E4XvCY1ARhGGhkI4CYtKaKiWWAq8CITQxfWTrMPVoj19WKTTQaGbFC2kMLGTPiR xvdA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e4-20020a17090a7c4400b0023a4606e410si13069912pjl.185.2023.03.07.14.49.42; Tue, 07 Mar 2023 14:49:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231862AbjCGWsj (ORCPT + 99 others); Tue, 7 Mar 2023 17:48:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34470 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230488AbjCGWr0 (ORCPT ); Tue, 7 Mar 2023 17:47:26 -0500 Received: from hosting.gsystem.sk (hosting.gsystem.sk [212.5.213.30]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id D914C59D9; Tue, 7 Mar 2023 14:47:07 -0800 (PST) Received: from gsql.ggedos.sk (off-20.infotel.telecom.sk [212.5.213.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by hosting.gsystem.sk (Postfix) with ESMTPSA id 143267A0749; Tue, 7 Mar 2023 23:46:50 +0100 (CET) From: Ondrej Zary To: Damien Le Moal , Sudip Mukherjee Cc: Christoph Hellwig , Sergey Shtylyov , Jens Axboe , Tim Waugh , linux-block@vger.kernel.org, linux-parport@lists.infradead.org, linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 21/32] pata_parport-bpck6: merge ppc6_wr_data_blk into bpck6_write_block Date: Tue, 7 Mar 2023 23:46:16 +0100 Message-Id: <20230307224627.28011-22-linux@zary.sk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20230307224627.28011-1-linux@zary.sk> References: <20230307224627.28011-1-linux@zary.sk> MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759751066244342982?= X-GMAIL-MSGID: =?utf-8?q?1759751066244342982?= ppc6_wr_data_blk is only called by bpck6_write_block. Merge ppc6_wr_data_blk into bpck6_write_block. Signed-off-by: Ondrej Zary --- drivers/ata/pata_parport/bpck6.c | 58 ++++++++++++++++++- drivers/ata/pata_parport/ppc6lnx.c | 91 ------------------------------ 2 files changed, 57 insertions(+), 92 deletions(-) diff --git a/drivers/ata/pata_parport/bpck6.c b/drivers/ata/pata_parport/bpck6.c index d379603424ff..27c1fa3bb336 100644 --- a/drivers/ata/pata_parport/bpck6.c +++ b/drivers/ata/pata_parport/bpck6.c @@ -37,6 +37,8 @@ static void bpck6_write_regr(struct pi_adapter *pi, int cont, int reg, int val) static void bpck6_write_block(struct pi_adapter *pi, char *buf, int len) { + u8 this, last; + ppc6_send_cmd(pi, REG_BLKSIZE | ACCESS_REG | ACCESS_WRITE); ppc6_wr_data_byte(pi, (u8)len); ppc6_wr_data_byte(pi, (u8)(len >> 8)); @@ -44,7 +46,61 @@ static void bpck6_write_block(struct pi_adapter *pi, char *buf, int len) ppc6_send_cmd(pi, CMD_PREFIX_SET | PREFIX_IO16 | PREFIX_BLK); ppc6_send_cmd(pi, ATA_REG_DATA | ACCESS_PORT | ACCESS_WRITE); - ppc6_wr_data_blk(pi, buf, len); + + switch (mode_map[pi->mode]) { + case PPCMODE_UNI_SW: + case PPCMODE_BI_SW: + while (len--) { + parport_write_data(pi->pardev->port, *buf++); + parport_frob_control(pi->pardev->port, 0, + PARPORT_CONTROL_INIT); + } + break; + case PPCMODE_UNI_FW: + case PPCMODE_BI_FW: + ppc6_send_cmd(pi, CMD_PREFIX_SET | PREFIX_FASTWR); + + parport_frob_control(pi->pardev->port, PARPORT_CONTROL_STROBE, + PARPORT_CONTROL_STROBE); + + last = *buf; + + parport_write_data(pi->pardev->port, last); + + while (len) { + this = *buf++; + len--; + + if (this == last) { + parport_frob_control(pi->pardev->port, 0, + PARPORT_CONTROL_INIT); + } else { + parport_write_data(pi->pardev->port, this); + last = this; + } + } + + parport_frob_control(pi->pardev->port, PARPORT_CONTROL_STROBE, + 0); + ppc6_send_cmd(pi, CMD_PREFIX_RESET | PREFIX_FASTWR); + break; + case PPCMODE_EPP_BYTE: + pi->pardev->port->ops->epp_write_data(pi->pardev->port, buf, + len, PARPORT_EPP_FAST_8); + ppc6_wait_for_fifo(pi); + break; + case PPCMODE_EPP_WORD: + pi->pardev->port->ops->epp_write_data(pi->pardev->port, buf, + len, PARPORT_EPP_FAST_16); + ppc6_wait_for_fifo(pi); + break; + case PPCMODE_EPP_DWORD: + pi->pardev->port->ops->epp_write_data(pi->pardev->port, buf, + len, PARPORT_EPP_FAST_32); + ppc6_wait_for_fifo(pi); + break; + } + ppc6_send_cmd(pi, CMD_PREFIX_RESET | PREFIX_IO16 | PREFIX_BLK); } diff --git a/drivers/ata/pata_parport/ppc6lnx.c b/drivers/ata/pata_parport/ppc6lnx.c index 679261e19ac5..3ba920251c1c 100644 --- a/drivers/ata/pata_parport/ppc6lnx.c +++ b/drivers/ata/pata_parport/ppc6lnx.c @@ -73,7 +73,6 @@ static void ppc6_send_cmd(struct pi_adapter *pi, u8 cmd); static void ppc6_wr_data_byte(struct pi_adapter *pi, u8 data); static u8 ppc6_rd_data_byte(struct pi_adapter *pi); static void ppc6_wait_for_fifo(struct pi_adapter *pi); -static void ppc6_wr_data_blk(struct pi_adapter *pi, u8 *data, long count); static void ppc6_wr_extout(struct pi_adapter *pi, u8 regdata); static int ppc6_open(struct pi_adapter *pi); @@ -296,96 +295,6 @@ static void ppc6_wait_for_fifo(struct pi_adapter *pi) //*************************************************************************** -static void ppc6_wr_data_blk(struct pi_adapter *pi, u8 *data, long count) -{ - switch (mode_map[pi->mode]) - { - case PPCMODE_UNI_SW : - case PPCMODE_BI_SW : - { - while(count--) - { - parport_write_data(pi->pardev->port, *data++); - - parport_frob_control(pi->pardev->port, 0, PARPORT_CONTROL_INIT); - } - - break; - } - - case PPCMODE_UNI_FW : - case PPCMODE_BI_FW : - { - u8 this, last; - - ppc6_send_cmd(pi, CMD_PREFIX_SET | PREFIX_FASTWR); - - parport_frob_control(pi->pardev->port, - PARPORT_CONTROL_STROBE, PARPORT_CONTROL_STROBE); - - last = *data; - - parport_write_data(pi->pardev->port, last); - - while(count) - { - this = *data++; - count--; - - if (this == last) - { - parport_frob_control(pi->pardev->port, - 0, PARPORT_CONTROL_INIT); - } - else - { - parport_write_data(pi->pardev->port, this); - - last = this; - } - } - - parport_frob_control(pi->pardev->port, PARPORT_CONTROL_STROBE, 0); - - ppc6_send_cmd(pi, CMD_PREFIX_RESET | PREFIX_FASTWR); - - break; - } - - case PPCMODE_EPP_BYTE : - { - pi->pardev->port->ops->epp_write_data(pi->pardev->port, - data, count, PARPORT_EPP_FAST_8); - - ppc6_wait_for_fifo(pi); - - break; - } - - case PPCMODE_EPP_WORD : - { - pi->pardev->port->ops->epp_write_data(pi->pardev->port, - data, count, PARPORT_EPP_FAST_16); - - ppc6_wait_for_fifo(pi); - - break; - } - - case PPCMODE_EPP_DWORD : - { - pi->pardev->port->ops->epp_write_data(pi->pardev->port, - data, count, PARPORT_EPP_FAST_32); - - ppc6_wait_for_fifo(pi); - - break; - } - } -} - -//*************************************************************************** - static void ppc6_wr_extout(struct pi_adapter *pi, u8 regdata) { ppc6_send_cmd(pi, REG_VERSION | ACCESS_REG | ACCESS_WRITE); From patchwork Tue Mar 7 22:46:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ondrej Zary X-Patchwork-Id: 65928 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp5551wrd; Tue, 7 Mar 2023 14:52:24 -0800 (PST) X-Google-Smtp-Source: AK7set9bICXYGuUGqRI1eeilr/s3qAA4cD4ZtfvxSiQfMjJ9su63vyp0gBMnrYuAloZOXss/Iz1h X-Received: by 2002:a17:902:7605:b0:19a:f02c:a06d with SMTP id k5-20020a170902760500b0019af02ca06dmr15052871pll.29.1678229544249; Tue, 07 Mar 2023 14:52:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678229544; cv=none; d=google.com; s=arc-20160816; b=NQ16+keo2In6glc4VqqLJ2sPByQrHAJ8rGVujV0Onq/qTxJnxmCJEoqqywDHUvN9fF m6fNpynTclJCfJFffq4cLkdVV+iNFhZ968OqB5BoqM7JrbfiMgApdhQSd4mbWgs9nzRW bif+/mTi4dGHtf7S7Fg/8xpwgrMOH7OePsN48n8hSQl0lWvaHVbeGzh3/gg5N4cUDj5d p4AJH0QXBU7hVtzddhVDJrpVWXJF6bOJPlPjQPu32D967lOYWQa78Y0rM9SFEhjdTSEq GDJg91XkKGowf5y0L8JvKk29EDQHdWIiiWOHgO48HqAShy7YuaRo/KkHc6EufT4DydX1 Kj6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=J/7aiPqC6MPic67exRdfNDfpi7MpDUzSLlDpk5TmuqE=; b=GeUl6Tj+37oMeqvGU56uQQ//QZ0YqEeVTdNUT8AR0LyRrD2M+O3a12WLnGmdrBBGfg 2qyKJvb9H4emcD6YIlIwyscGTNbUvdmloPyxryowAlavUsCQG3TBcjPdt3xyhF4EF5Vl 9HZ2xuvOULcZKXboTqqM8d4yjNxqCj0+o8sD+r4+OUZ1IvxGcUd0mHnkBafHIdW6Oxdh PsDZSQFQ92f+YcU8Yo98fD9UOYcFWWSceWxeXczSXEIqHdfDpi8EGlIcCTX5eqbXzX/0 Nb2sTnxA27ILUwlHtAePjQ2nU1qTxBRg4scs9H4VUvk+Qsfs40TN9BtzYMnXn6tBhTMz hnBQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d15-20020a170902cecf00b0019489437a80si14654855plg.144.2023.03.07.14.52.10; Tue, 07 Mar 2023 14:52:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231591AbjCGWtm (ORCPT + 99 others); Tue, 7 Mar 2023 17:49:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35228 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231348AbjCGWru (ORCPT ); Tue, 7 Mar 2023 17:47:50 -0500 Received: from hosting.gsystem.sk (hosting.gsystem.sk [212.5.213.30]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 8E2165371E; Tue, 7 Mar 2023 14:47:08 -0800 (PST) Received: from gsql.ggedos.sk (off-20.infotel.telecom.sk [212.5.213.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by hosting.gsystem.sk (Postfix) with ESMTPSA id 2FB3A7A074C; Tue, 7 Mar 2023 23:46:50 +0100 (CET) From: Ondrej Zary To: Damien Le Moal , Sudip Mukherjee Cc: Christoph Hellwig , Sergey Shtylyov , Jens Axboe , Tim Waugh , linux-block@vger.kernel.org, linux-parport@lists.infradead.org, linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 22/32] pata_parport-bpck6: move ppc6_wait_for_fifo to bpck6.c and rename Date: Tue, 7 Mar 2023 23:46:17 +0100 Message-Id: <20230307224627.28011-23-linux@zary.sk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20230307224627.28011-1-linux@zary.sk> References: <20230307224627.28011-1-linux@zary.sk> MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759751222482110816?= X-GMAIL-MSGID: =?utf-8?q?1759751222482110816?= Move ppc6_wait_for_fifo to bpck6.c and rename it to bpck6_wait_for_fifo Signed-off-by: Ondrej Zary --- drivers/ata/pata_parport/bpck6.c | 16 +++++++++++++--- drivers/ata/pata_parport/ppc6lnx.c | 14 -------------- 2 files changed, 13 insertions(+), 17 deletions(-) diff --git a/drivers/ata/pata_parport/bpck6.c b/drivers/ata/pata_parport/bpck6.c index 27c1fa3bb336..1f976ee04ef2 100644 --- a/drivers/ata/pata_parport/bpck6.c +++ b/drivers/ata/pata_parport/bpck6.c @@ -35,6 +35,16 @@ static void bpck6_write_regr(struct pi_adapter *pi, int cont, int reg, int val) ppc6_wr_data_byte(pi, val); } +static void bpck6_wait_for_fifo(struct pi_adapter *pi) +{ + int i; + + if (pi->private & fifo_wait) { + for (i = 0; i < 20; i++) + parport_read_status(pi->pardev->port); + } +} + static void bpck6_write_block(struct pi_adapter *pi, char *buf, int len) { u8 this, last; @@ -87,17 +97,17 @@ static void bpck6_write_block(struct pi_adapter *pi, char *buf, int len) case PPCMODE_EPP_BYTE: pi->pardev->port->ops->epp_write_data(pi->pardev->port, buf, len, PARPORT_EPP_FAST_8); - ppc6_wait_for_fifo(pi); + bpck6_wait_for_fifo(pi); break; case PPCMODE_EPP_WORD: pi->pardev->port->ops->epp_write_data(pi->pardev->port, buf, len, PARPORT_EPP_FAST_16); - ppc6_wait_for_fifo(pi); + bpck6_wait_for_fifo(pi); break; case PPCMODE_EPP_DWORD: pi->pardev->port->ops->epp_write_data(pi->pardev->port, buf, len, PARPORT_EPP_FAST_32); - ppc6_wait_for_fifo(pi); + bpck6_wait_for_fifo(pi); break; } diff --git a/drivers/ata/pata_parport/ppc6lnx.c b/drivers/ata/pata_parport/ppc6lnx.c index 3ba920251c1c..cd4fa31a5ff8 100644 --- a/drivers/ata/pata_parport/ppc6lnx.c +++ b/drivers/ata/pata_parport/ppc6lnx.c @@ -72,7 +72,6 @@ static void ppc6_deselect(struct pi_adapter *pi); static void ppc6_send_cmd(struct pi_adapter *pi, u8 cmd); static void ppc6_wr_data_byte(struct pi_adapter *pi, u8 data); static u8 ppc6_rd_data_byte(struct pi_adapter *pi); -static void ppc6_wait_for_fifo(struct pi_adapter *pi); static void ppc6_wr_extout(struct pi_adapter *pi, u8 regdata); static int ppc6_open(struct pi_adapter *pi); @@ -282,19 +281,6 @@ static u8 ppc6_rd_data_byte(struct pi_adapter *pi) //*************************************************************************** -static void ppc6_wait_for_fifo(struct pi_adapter *pi) -{ - int i; - - if (pi->private & fifo_wait) - { - for(i=0; i<20; i++) - parport_read_status(pi->pardev->port); - } -} - -//*************************************************************************** - static void ppc6_wr_extout(struct pi_adapter *pi, u8 regdata) { ppc6_send_cmd(pi, REG_VERSION | ACCESS_REG | ACCESS_WRITE); From patchwork Tue Mar 7 22:46:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ondrej Zary X-Patchwork-Id: 65927 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp5468wrd; Tue, 7 Mar 2023 14:52:11 -0800 (PST) X-Google-Smtp-Source: AK7set+p0Fx73Q4KpiJHjk5hlVOs7iKL9OOGb77u8/Y/1IGJUIJpo5Hz7/I50cBnmx5Vf8jeOjXN X-Received: by 2002:a05:6a20:8f04:b0:bf:4563:e647 with SMTP id b4-20020a056a208f0400b000bf4563e647mr18776576pzk.40.1678229531646; Tue, 07 Mar 2023 14:52:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678229531; cv=none; d=google.com; s=arc-20160816; b=JpxHuzJlN/BHYIGAHBfgDpEjd7trEajQrHi4XVRW5LoOBJE3CrWjI/lplNt0UoQf/3 zAaYc6bqNfjk6OnoLf3xO7py1yufLIBNDfy+85rHuWYq16ODFjrQwZtPxPW/JJgJP2sL 0+oSe2UkGre0SgDcWhcN6+zWz7NvaNAsmV5TlMpvX00qNUbICEC4ItoTWL0mUy57pCKB KJryUoSJwWaYuvDmFDEQPhMrP5tNwa/lBJlkr8gJs09eCe273C3IEd7mPszZYCpmAFB0 sSJoN7JsgxUS9b54unrgMfiQnCsW35BaPQBaoliMGw8dzLuWeNFI0irCNoodP8GvD9PB OysQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=L/OGCCzGTtunOvAt0ix/2Iscs1X3UcSOtts3pByL0KM=; b=V6Ww1vfa4RaHKt1zY0bMp8JKKhrZjNOazIHBiAgQCS4Gr5A4Juyb1dM8AunbMHExe9 qztFipgyc9tkKOuhHBD4ITAXqmyv1yhbFKNsVDzIYYh+/5fI/R0PU0T1VxfrxCnUnXog 4mEXXLwOiGHA7A0pCLDTnKIBx2Ok05wDKlYVEu3YsSMK6wx5eIEUwGvpARdjMQQprt5/ B3UGxdgzckM14KzyyfQrr1CqvP1Pkps4L8WWr8VjTYQzgwKtGX1GT6jyRruf/mwvAgMl wllSNqSLRMHb+ucUL2fQVfLCul1DN5eS8ft6sjZT/7Xd8mV4ez8I28sgKx8/YFlrzINl lPtg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p123-20020a622981000000b005939fff6d47si12183834pfp.326.2023.03.07.14.51.58; Tue, 07 Mar 2023 14:52:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230272AbjCGWt0 (ORCPT + 99 others); Tue, 7 Mar 2023 17:49:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34804 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231598AbjCGWrd (ORCPT ); Tue, 7 Mar 2023 17:47:33 -0500 Received: from hosting.gsystem.sk (hosting.gsystem.sk [212.5.213.30]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E6393867D3; Tue, 7 Mar 2023 14:47:08 -0800 (PST) Received: from gsql.ggedos.sk (off-20.infotel.telecom.sk [212.5.213.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by hosting.gsystem.sk (Postfix) with ESMTPSA id 425DB7A0750; Tue, 7 Mar 2023 23:46:50 +0100 (CET) From: Ondrej Zary To: Damien Le Moal , Sudip Mukherjee Cc: Christoph Hellwig , Sergey Shtylyov , Jens Axboe , Tim Waugh , linux-block@vger.kernel.org, linux-parport@lists.infradead.org, linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 23/32] pata_parport-bpck6: move ppc6_wr_extout to bpck6.c and rename Date: Tue, 7 Mar 2023 23:46:18 +0100 Message-Id: <20230307224627.28011-24-linux@zary.sk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20230307224627.28011-1-linux@zary.sk> References: <20230307224627.28011-1-linux@zary.sk> MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759751209359398462?= X-GMAIL-MSGID: =?utf-8?q?1759751209359398462?= Move ppc6_wr_extout to bpck6.c and rename it to bpck6_wr_extout Signed-off-by: Ondrej Zary --- drivers/ata/pata_parport/bpck6.c | 10 ++++++++-- drivers/ata/pata_parport/ppc6lnx.c | 10 ---------- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/drivers/ata/pata_parport/bpck6.c b/drivers/ata/pata_parport/bpck6.c index 1f976ee04ef2..968c9f3297e3 100644 --- a/drivers/ata/pata_parport/bpck6.c +++ b/drivers/ata/pata_parport/bpck6.c @@ -174,18 +174,24 @@ static void bpck6_read_block(struct pi_adapter *pi, char *buf, int len) ppc6_send_cmd(pi, CMD_PREFIX_RESET | PREFIX_IO16 | PREFIX_BLK); } +static void bpck6_wr_extout(struct pi_adapter *pi, u8 regdata) +{ + ppc6_send_cmd(pi, REG_VERSION | ACCESS_REG | ACCESS_WRITE); + ppc6_wr_data_byte(pi, (u8)((regdata & 0x03) << 6)); +} + static void bpck6_connect(struct pi_adapter *pi) { dev_dbg(&pi->dev, "connect\n"); ppc6_open(pi); - ppc6_wr_extout(pi, 0x3); + bpck6_wr_extout(pi, 0x3); } static void bpck6_disconnect(struct pi_adapter *pi) { dev_dbg(&pi->dev, "disconnect\n"); - ppc6_wr_extout(pi, 0x0); + bpck6_wr_extout(pi, 0x0); ppc6_deselect(pi); } diff --git a/drivers/ata/pata_parport/ppc6lnx.c b/drivers/ata/pata_parport/ppc6lnx.c index cd4fa31a5ff8..931bf67fabb9 100644 --- a/drivers/ata/pata_parport/ppc6lnx.c +++ b/drivers/ata/pata_parport/ppc6lnx.c @@ -72,7 +72,6 @@ static void ppc6_deselect(struct pi_adapter *pi); static void ppc6_send_cmd(struct pi_adapter *pi, u8 cmd); static void ppc6_wr_data_byte(struct pi_adapter *pi, u8 data); static u8 ppc6_rd_data_byte(struct pi_adapter *pi); -static void ppc6_wr_extout(struct pi_adapter *pi, u8 regdata); static int ppc6_open(struct pi_adapter *pi); //*************************************************************************** @@ -281,15 +280,6 @@ static u8 ppc6_rd_data_byte(struct pi_adapter *pi) //*************************************************************************** -static void ppc6_wr_extout(struct pi_adapter *pi, u8 regdata) -{ - ppc6_send_cmd(pi, REG_VERSION | ACCESS_REG | ACCESS_WRITE); - - ppc6_wr_data_byte(pi, (u8)((regdata & 0x03) << 6)); -} - -//*************************************************************************** - static int ppc6_open(struct pi_adapter *pi) { int ret; From patchwork Tue Mar 7 22:46:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ondrej Zary X-Patchwork-Id: 65936 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp7980wrd; Tue, 7 Mar 2023 14:59:25 -0800 (PST) X-Google-Smtp-Source: AK7set9ZFI+wriTHUvaJ9pwfaaqP1LCZX92pey1ELckV1OBb7p69t+WH1XFBqaWyEmRtltUqKUPh X-Received: by 2002:a17:906:af67:b0:8b1:2ebf:386c with SMTP id os7-20020a170906af6700b008b12ebf386cmr15291498ejb.11.1678229965458; Tue, 07 Mar 2023 14:59:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678229965; cv=none; d=google.com; s=arc-20160816; b=ktEqrMb2kZ3ZgA6G0DcgQ6IICCCJ71T483DMpGiDcct5jF6WXjwCUz/0a5hXsN2gv8 P01ozz5N07ssntJQHTRgcg+onuNb5HEeHiQq2fD/P2H2TWTU15MD9aehgraiAYINLntK NcmQbq63i6RpS1jyxbKYoFRQxdnrSmUAaYhsx4TxEILUUs0CX9DwCuFWcsY/xGSZVeVc pseaUw9x0TDJNBmmuH8imcsghkYD7G1p5VWc86PcoGpdEdNzTh7lQ4qYhTDKYU5nzX6x NmnThDr+ynu60iQkAJkyafjeTZeBB8DDhtrZUCndpb+Yo+FjIcfrx+nvIom3MsKvq7uA 7w+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=hUet9qEsKIkv6ckHXOG49LaODH7UW0+BWVVoYAkFVrQ=; b=DWS7SzE8Dufaigsz8LtlK54/myNAYHsXdcPze+57//ORq60Tv6Z4eL7mcbB5QlIV5W HlNjVyfe2L6guf0Vw0gYeE6VQjxvfEDWKbQM637fdRkO1s3K3twzWjUT0RYJjMlPN6GL 6aYOctL9FBQaPx6YnQDId4OXScPF9cJAbmFZpHTK5MxnN+AI1V+shcNWuy+qqSZqDnjG lvnIwjACmMK6+4++ppKu7gTxw8YpMtZ26y9jVV4yGl6x2WTZ6tcW2xjctuL0B8w7X5J3 f9ErBGSkqFwHiwvSrNLHj8ywG3j2sPKye6ENg+WQMMnV5LlhXOHUNs7I1E1P53qgE4KN 54tA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u17-20020a17090617d100b008c35e1f30fcsi10666029eje.404.2023.03.07.14.59.02; Tue, 07 Mar 2023 14:59:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231923AbjCGWt3 (ORCPT + 99 others); Tue, 7 Mar 2023 17:49:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33468 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230332AbjCGWrf (ORCPT ); Tue, 7 Mar 2023 17:47:35 -0500 Received: from hosting.gsystem.sk (hosting.gsystem.sk [212.5.213.30]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E68AA9BA45; Tue, 7 Mar 2023 14:47:08 -0800 (PST) Received: from gsql.ggedos.sk (off-20.infotel.telecom.sk [212.5.213.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by hosting.gsystem.sk (Postfix) with ESMTPSA id 5AE3D7A0755; Tue, 7 Mar 2023 23:46:50 +0100 (CET) From: Ondrej Zary To: Damien Le Moal , Sudip Mukherjee Cc: Christoph Hellwig , Sergey Shtylyov , Jens Axboe , Tim Waugh , linux-block@vger.kernel.org, linux-parport@lists.infradead.org, linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 24/32] pata_parport-bpck6: move ppc6_open to bpck6.c and rename Date: Tue, 7 Mar 2023 23:46:19 +0100 Message-Id: <20230307224627.28011-25-linux@zary.sk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20230307224627.28011-1-linux@zary.sk> References: <20230307224627.28011-1-linux@zary.sk> MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759751664128736382?= X-GMAIL-MSGID: =?utf-8?q?1759751664128736382?= Move ppc6_open to bpck6.c and rename it to bpck6_open Signed-off-by: Ondrej Zary --- drivers/ata/pata_parport/bpck6.c | 23 +++++++++++++++++++++-- drivers/ata/pata_parport/ppc6lnx.c | 28 ---------------------------- 2 files changed, 21 insertions(+), 30 deletions(-) diff --git a/drivers/ata/pata_parport/bpck6.c b/drivers/ata/pata_parport/bpck6.c index 968c9f3297e3..02f16dedfd29 100644 --- a/drivers/ata/pata_parport/bpck6.c +++ b/drivers/ata/pata_parport/bpck6.c @@ -174,6 +174,25 @@ static void bpck6_read_block(struct pi_adapter *pi, char *buf, int len) ppc6_send_cmd(pi, CMD_PREFIX_RESET | PREFIX_IO16 | PREFIX_BLK); } +static int bpck6_open(struct pi_adapter *pi) +{ + int ret = ppc6_select(pi); + + if (ret == 0) + return ret; + + pi->private = 0; + + ppc6_send_cmd(pi, ACCESS_REG | ACCESS_WRITE | REG_RAMSIZE); + ppc6_wr_data_byte(pi, RAMSIZE_128K); + + ppc6_send_cmd(pi, ACCESS_REG | ACCESS_READ | REG_VERSION); + if ((ppc6_rd_data_byte(pi) & 0x3F) == 0x0C) + pi->private |= fifo_wait; + + return ret; +} + static void bpck6_wr_extout(struct pi_adapter *pi, u8 regdata) { ppc6_send_cmd(pi, REG_VERSION | ACCESS_REG | ACCESS_WRITE); @@ -184,7 +203,7 @@ static void bpck6_connect(struct pi_adapter *pi) { dev_dbg(&pi->dev, "connect\n"); - ppc6_open(pi); + bpck6_open(pi); bpck6_wr_extout(pi, 0x3); } @@ -218,7 +237,7 @@ static int bpck6_probe_unit(struct pi_adapter *pi) /*LOWER DOWN TO UNIDIRECTIONAL*/ pi->mode = 0; - out = ppc6_open(pi); + out = bpck6_open(pi); dev_dbg(&pi->dev, "ppc_open returned %2x\n", out); diff --git a/drivers/ata/pata_parport/ppc6lnx.c b/drivers/ata/pata_parport/ppc6lnx.c index 931bf67fabb9..a902ede5ecc5 100644 --- a/drivers/ata/pata_parport/ppc6lnx.c +++ b/drivers/ata/pata_parport/ppc6lnx.c @@ -72,7 +72,6 @@ static void ppc6_deselect(struct pi_adapter *pi); static void ppc6_send_cmd(struct pi_adapter *pi, u8 cmd); static void ppc6_wr_data_byte(struct pi_adapter *pi, u8 data); static u8 ppc6_rd_data_byte(struct pi_adapter *pi); -static int ppc6_open(struct pi_adapter *pi); //*************************************************************************** @@ -277,30 +276,3 @@ static u8 ppc6_rd_data_byte(struct pi_adapter *pi) return(data); } - -//*************************************************************************** - -static int ppc6_open(struct pi_adapter *pi) -{ - int ret; - - ret = ppc6_select(pi); - - if (ret == 0) - return(ret); - - pi->private = 0; - - ppc6_send_cmd(pi, ACCESS_REG | ACCESS_WRITE | REG_RAMSIZE); - ppc6_wr_data_byte(pi, RAMSIZE_128K); - - ppc6_send_cmd(pi, ACCESS_REG | ACCESS_READ | REG_VERSION); - - if ((ppc6_rd_data_byte(pi) & 0x3F) == 0x0C) - pi->private |= fifo_wait; - - return(ret); -} - -//*************************************************************************** - From patchwork Tue Mar 7 22:46:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ondrej Zary X-Patchwork-Id: 65923 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp5199wrd; Tue, 7 Mar 2023 14:51:26 -0800 (PST) X-Google-Smtp-Source: AK7set/aAIUvZbwKaS9meqNK07T8vFwQ668u6Cb3rFaZvPQ2OkwruhqFSH/RpUjkXKO+xCF25Ir9 X-Received: by 2002:a05:6a20:3d0c:b0:cb:6e5d:6ce0 with SMTP id y12-20020a056a203d0c00b000cb6e5d6ce0mr18761911pzi.37.1678229485819; Tue, 07 Mar 2023 14:51:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678229485; cv=none; d=google.com; s=arc-20160816; b=AW2ndFMBev+NI8PXaNTSLyTvn2hf9s/7pg6h2t6zWqia/EG4hP0MPCSHHsjMVebbti 9HYphijMcg41yvhCDVo3J8DqTr3/xw1zaDvr16gTwbYm1mgIKskqLGgzPTPRCtwZtpd6 wNn+cs3rbFitSycvhzYPMHSkcTtyMzfLchg1SOJdanNk/bX1KXK7FGkKnWP54TCJe+eD V+giaj5lSRMhZTJko0xrNBy6oAlrMA4uh3iQYRn+CW+8fR9ne9c/JdEO9uoxrYGkVpFZ KuFMRCyurzjFU9CnwtOHfy4KuZkDgf9TH+mQIiQe+p1UBeTnr+mzRhadT/d8ZHJ1wZ0E sypA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=FjLw3tJWeMmwqBXrfiXe9xRjRfRTupvFBhxF2WmWBFg=; b=LmFnWbz6BBez9w98/4UEjy2fG8ozl1L0OxvvI5PdXCK2TV1RSZQfWrxqNgEPkhK2Ae +lxQvF52XX0r4c26sVdjbiHGWxoUSlBNPHB3eq6u/CcDmNvKnNGnPp2PPwfcFlKRKZl8 7IAGvBUm4c9R89NgzXH+ujsUFrP0EzMjmQRVLg9inspXCUH60Bpew4hU+bwfHpOeW42A e7kP2Dyd9Css686snfM4JklQGiSEJdveQArbTzqpTo8TFJ+IRZDQuSIZIBZW6ejJUTcG EdoJDwZpEetGJp45tj6VgYXBnW2VAVsYkFwO18z8LqysIziwoLOhQg2nOCa0C+JXzhf0 VeUg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r20-20020aa79634000000b005a85dd25ce3si13309435pfg.132.2023.03.07.14.51.13; Tue, 07 Mar 2023 14:51:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231842AbjCGWs2 (ORCPT + 99 others); Tue, 7 Mar 2023 17:48:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34102 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231600AbjCGWrV (ORCPT ); Tue, 7 Mar 2023 17:47:21 -0500 Received: from hosting.gsystem.sk (hosting.gsystem.sk [212.5.213.30]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 8B33D2ED57; Tue, 7 Mar 2023 14:47:08 -0800 (PST) Received: from gsql.ggedos.sk (off-20.infotel.telecom.sk [212.5.213.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by hosting.gsystem.sk (Postfix) with ESMTPSA id 734E07A0756; Tue, 7 Mar 2023 23:46:50 +0100 (CET) From: Ondrej Zary To: Damien Le Moal , Sudip Mukherjee Cc: Christoph Hellwig , Sergey Shtylyov , Jens Axboe , Tim Waugh , linux-block@vger.kernel.org, linux-parport@lists.infradead.org, linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 25/32] pata_parport-bpck6: merge ppc6_select into bpck6_open Date: Tue, 7 Mar 2023 23:46:20 +0100 Message-Id: <20230307224627.28011-26-linux@zary.sk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20230307224627.28011-1-linux@zary.sk> References: <20230307224627.28011-1-linux@zary.sk> MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759751161580536806?= X-GMAIL-MSGID: =?utf-8?q?1759751161580536806?= ppc6_select is only called by bpck6_open. Merge ppc6_select into bpck6_open. Signed-off-by: Ondrej Zary --- drivers/ata/pata_parport/bpck6.c | 68 ++++++++++++++++++++++++------ drivers/ata/pata_parport/ppc6lnx.c | 66 ----------------------------- 2 files changed, 55 insertions(+), 79 deletions(-) diff --git a/drivers/ata/pata_parport/bpck6.c b/drivers/ata/pata_parport/bpck6.c index 02f16dedfd29..9b05e1c827cd 100644 --- a/drivers/ata/pata_parport/bpck6.c +++ b/drivers/ata/pata_parport/bpck6.c @@ -176,21 +176,63 @@ static void bpck6_read_block(struct pi_adapter *pi, char *buf, int len) static int bpck6_open(struct pi_adapter *pi) { - int ret = ppc6_select(pi); - - if (ret == 0) - return ret; - - pi->private = 0; - - ppc6_send_cmd(pi, ACCESS_REG | ACCESS_WRITE | REG_RAMSIZE); - ppc6_wr_data_byte(pi, RAMSIZE_128K); + u8 i, j, k; + + pi->saved_r0 = parport_read_data(pi->pardev->port); + pi->saved_r2 = parport_read_control(pi->pardev->port) & 0x5F; + + parport_frob_control(pi->pardev->port, PARPORT_CONTROL_SELECT, + PARPORT_CONTROL_SELECT); + if (pi->saved_r0 == 'b') + parport_write_data(pi->pardev->port, 'x'); + parport_write_data(pi->pardev->port, 'b'); + parport_write_data(pi->pardev->port, 'p'); + parport_write_data(pi->pardev->port, pi->unit); + parport_write_data(pi->pardev->port, ~pi->unit); + + parport_frob_control(pi->pardev->port, PARPORT_CONTROL_SELECT, 0); + parport_write_control(pi->pardev->port, PARPORT_CONTROL_INIT); + + i = mode_map[pi->mode] & 0x0C; + if (i == 0) + i = (mode_map[pi->mode] & 2) | 1; + parport_write_data(pi->pardev->port, i); + + parport_frob_control(pi->pardev->port, PARPORT_CONTROL_SELECT, + PARPORT_CONTROL_SELECT); + parport_frob_control(pi->pardev->port, PARPORT_CONTROL_AUTOFD, + PARPORT_CONTROL_AUTOFD); + + j = ((i & 0x08) << 4) | ((i & 0x07) << 3); + k = parport_read_status(pi->pardev->port) & 0xB8; + if (j == k) { + parport_frob_control(pi->pardev->port, PARPORT_CONTROL_AUTOFD, 0); + k = (parport_read_status(pi->pardev->port) & 0xB8) ^ 0xB8; + if (j == k) { + if (i & 4) // EPP + parport_frob_control(pi->pardev->port, + PARPORT_CONTROL_SELECT | PARPORT_CONTROL_INIT, 0); + else // PPC/ECP + parport_frob_control(pi->pardev->port, + PARPORT_CONTROL_SELECT, 0); + + pi->private = 0; + + ppc6_send_cmd(pi, ACCESS_REG | ACCESS_WRITE | REG_RAMSIZE); + ppc6_wr_data_byte(pi, RAMSIZE_128K); + + ppc6_send_cmd(pi, ACCESS_REG | ACCESS_READ | REG_VERSION); + if ((ppc6_rd_data_byte(pi) & 0x3F) == 0x0C) + pi->private |= fifo_wait; + + return 1; + } + } - ppc6_send_cmd(pi, ACCESS_REG | ACCESS_READ | REG_VERSION); - if ((ppc6_rd_data_byte(pi) & 0x3F) == 0x0C) - pi->private |= fifo_wait; + parport_write_control(pi->pardev->port, pi->saved_r2); + parport_write_data(pi->pardev->port, pi->saved_r0); - return ret; + return 0; // FAIL } static void bpck6_wr_extout(struct pi_adapter *pi, u8 regdata) diff --git a/drivers/ata/pata_parport/ppc6lnx.c b/drivers/ata/pata_parport/ppc6lnx.c index a902ede5ecc5..16d0497dfeaa 100644 --- a/drivers/ata/pata_parport/ppc6lnx.c +++ b/drivers/ata/pata_parport/ppc6lnx.c @@ -67,7 +67,6 @@ //*************************************************************************** -static int ppc6_select(struct pi_adapter *pi); static void ppc6_deselect(struct pi_adapter *pi); static void ppc6_send_cmd(struct pi_adapter *pi, u8 cmd); static void ppc6_wr_data_byte(struct pi_adapter *pi, u8 data); @@ -78,71 +77,6 @@ static u8 ppc6_rd_data_byte(struct pi_adapter *pi); int mode_map[] = { PPCMODE_UNI_FW, PPCMODE_BI_FW, PPCMODE_EPP_BYTE, PPCMODE_EPP_WORD, PPCMODE_EPP_DWORD }; -static int ppc6_select(struct pi_adapter *pi) -{ - u8 i, j, k; - - pi->saved_r0 = parport_read_data(pi->pardev->port); - - pi->saved_r2 = parport_read_control(pi->pardev->port) & 0x5F; // readback ctrl - - parport_frob_control(pi->pardev->port, PARPORT_CONTROL_SELECT, PARPORT_CONTROL_SELECT); - - if (pi->saved_r0 == 'b') - parport_write_data(pi->pardev->port, 'x'); - - parport_write_data(pi->pardev->port, 'b'); - parport_write_data(pi->pardev->port, 'p'); - parport_write_data(pi->pardev->port, pi->unit); - parport_write_data(pi->pardev->port, ~pi->unit); - - parport_frob_control(pi->pardev->port, PARPORT_CONTROL_SELECT, 0); - - parport_write_control(pi->pardev->port, PARPORT_CONTROL_INIT); - - i = mode_map[pi->mode] & 0x0C; - - if (i == 0) - i = (mode_map[pi->mode] & 2) | 1; - - parport_write_data(pi->pardev->port, i); - - parport_frob_control(pi->pardev->port, PARPORT_CONTROL_SELECT, PARPORT_CONTROL_SELECT); - - // DELAY - - parport_frob_control(pi->pardev->port, PARPORT_CONTROL_AUTOFD, PARPORT_CONTROL_AUTOFD); - - j = ((i & 0x08) << 4) | ((i & 0x07) << 3); - - k = parport_read_status(pi->pardev->port) & 0xB8; - - if (j == k) - { - parport_frob_control(pi->pardev->port, PARPORT_CONTROL_AUTOFD, 0); - - k = (parport_read_status(pi->pardev->port) & 0xB8) ^ 0xB8; - - if (j == k) - { - if (i & 4) // EPP - parport_frob_control(pi->pardev->port, - PARPORT_CONTROL_SELECT | PARPORT_CONTROL_INIT, 0); - else // PPC/ECP - parport_frob_control(pi->pardev->port, - PARPORT_CONTROL_SELECT, 0); - - return(1); - } - } - - parport_write_control(pi->pardev->port, pi->saved_r2); - - parport_write_data(pi->pardev->port, pi->saved_r0); - - return(0); // FAIL -} - //*************************************************************************** static void ppc6_deselect(struct pi_adapter *pi) From patchwork Tue Mar 7 22:46:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ondrej Zary X-Patchwork-Id: 65925 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp5204wrd; Tue, 7 Mar 2023 14:51:26 -0800 (PST) X-Google-Smtp-Source: AK7set9/b3RhGYzRq3Go5t05WWuLpaqww6TU0wVIgOglufB+ib/JDzNrgVjHHrfWVhN/alfqvSYZ X-Received: by 2002:a05:6a20:8c97:b0:d0:4297:c698 with SMTP id k23-20020a056a208c9700b000d04297c698mr3596788pzh.9.1678229486125; Tue, 07 Mar 2023 14:51:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678229486; cv=none; d=google.com; s=arc-20160816; b=0W0W2DDEr36jM1Y0VtyUN7HIvqnJjAyYRNLpYY9BCpzCMR7zrllQBw/AFnWb3we0i7 uRXdY5qPD9UhHrwXvpW0n6BF1vWUjoDJNyY6JQ1zhFBeyE2o5hF0E/0p0FWL/ZTJ2Wqb LGXHa1DZUFE93uxcSv0I/aljuR0fYc+TuMhxAYC6Fr0gdvWldhES3oLzK9RTdKDoXiIG RO2rbHJCE/i7HGvDtaLqsDebP510b+6fbSctoyRQNFdV7PFBbWqYweMluZPYfhcOuZli 5iFD+wHJqynFU5PXN0SJFsJlAA1qFkmw2i0fHcevRaqIno15JLKX3KjTWM6fQb++M/mp e9/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=PvI4J/QpvdGwTb66uZ74ep5zH7botk5VHRIjY+25BKE=; b=qw7/ZMAujcWSOQA3j6eGNmi9qB9a5OZL6RR+i6kMgW0j5FNuYeZGdheoEEfarA7Ywr 4pAB+XVmwb0AvvS7ZfvOl3EIx3BMAMq7LEcmk4MQpfxn5qyA1bk8Sb2T0TCIvRPVQM3R ayF/lX+Cttu0f2YTpmKVoymPaMdM+HXz5c3ImaJiOAkbq6n3cP5K+0RwiQ9yzVhFU1fM YivtmQ5VnxkTK7ggEeTVBmN8d+piHGCwsskSyOOhYYEtpbx9YEGHi5KyVwKHYbgHdnJS HcUlzRWCy9WVhk4dHCAMhVkEhxnqiLIi7OM3zfZRyAwI7AT52dh+DF2/VT61EpQV8HwU n19Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p123-20020a622981000000b005939fff6d47si12183834pfp.326.2023.03.07.14.51.13; Tue, 07 Mar 2023 14:51:26 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230057AbjCGWtB (ORCPT + 99 others); Tue, 7 Mar 2023 17:49:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33252 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230029AbjCGWrd (ORCPT ); Tue, 7 Mar 2023 17:47:33 -0500 Received: from hosting.gsystem.sk (hosting.gsystem.sk [212.5.213.30]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E629516332; Tue, 7 Mar 2023 14:47:08 -0800 (PST) Received: from gsql.ggedos.sk (off-20.infotel.telecom.sk [212.5.213.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by hosting.gsystem.sk (Postfix) with ESMTPSA id 815EB7A075A; Tue, 7 Mar 2023 23:46:50 +0100 (CET) From: Ondrej Zary To: Damien Le Moal , Sudip Mukherjee Cc: Christoph Hellwig , Sergey Shtylyov , Jens Axboe , Tim Waugh , linux-block@vger.kernel.org, linux-parport@lists.infradead.org, linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 26/32] pata_parport-bpck6: move ppc6_deselect to bpck6.c and rename Date: Tue, 7 Mar 2023 23:46:21 +0100 Message-Id: <20230307224627.28011-27-linux@zary.sk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20230307224627.28011-1-linux@zary.sk> References: <20230307224627.28011-1-linux@zary.sk> MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759751161981104563?= X-GMAIL-MSGID: =?utf-8?q?1759751161981104563?= Move ppc6_deselect to bpck6.c and rename it to bpck6_deselect Signed-off-by: Ondrej Zary --- drivers/ata/pata_parport/bpck6.c | 19 +++++++++++++++++-- drivers/ata/pata_parport/ppc6lnx.c | 19 ------------------- 2 files changed, 17 insertions(+), 21 deletions(-) diff --git a/drivers/ata/pata_parport/bpck6.c b/drivers/ata/pata_parport/bpck6.c index 9b05e1c827cd..46a91b04aed3 100644 --- a/drivers/ata/pata_parport/bpck6.c +++ b/drivers/ata/pata_parport/bpck6.c @@ -235,6 +235,21 @@ static int bpck6_open(struct pi_adapter *pi) return 0; // FAIL } +static void bpck6_deselect(struct pi_adapter *pi) +{ + if (mode_map[pi->mode] & 4) // EPP + parport_frob_control(pi->pardev->port, PARPORT_CONTROL_INIT, + PARPORT_CONTROL_INIT); + else // PPC/ECP + parport_frob_control(pi->pardev->port, PARPORT_CONTROL_SELECT, + PARPORT_CONTROL_SELECT); + + parport_write_data(pi->pardev->port, pi->saved_r0); + parport_write_control(pi->pardev->port, + pi->saved_r2 | PARPORT_CONTROL_SELECT); + parport_write_control(pi->pardev->port, pi->saved_r2); +} + static void bpck6_wr_extout(struct pi_adapter *pi, u8 regdata) { ppc6_send_cmd(pi, REG_VERSION | ACCESS_REG | ACCESS_WRITE); @@ -253,7 +268,7 @@ static void bpck6_disconnect(struct pi_adapter *pi) { dev_dbg(&pi->dev, "disconnect\n"); bpck6_wr_extout(pi, 0x0); - ppc6_deselect(pi); + bpck6_deselect(pi); } static int bpck6_test_port(struct pi_adapter *pi) /* check for 8-bit port */ @@ -285,7 +300,7 @@ static int bpck6_probe_unit(struct pi_adapter *pi) if(out) { - ppc6_deselect(pi); + bpck6_deselect(pi); dev_dbg(&pi->dev, "leaving probe\n"); pi->mode = saved_mode; return(1); diff --git a/drivers/ata/pata_parport/ppc6lnx.c b/drivers/ata/pata_parport/ppc6lnx.c index 16d0497dfeaa..6c34bbbdf6db 100644 --- a/drivers/ata/pata_parport/ppc6lnx.c +++ b/drivers/ata/pata_parport/ppc6lnx.c @@ -67,7 +67,6 @@ //*************************************************************************** -static void ppc6_deselect(struct pi_adapter *pi); static void ppc6_send_cmd(struct pi_adapter *pi, u8 cmd); static void ppc6_wr_data_byte(struct pi_adapter *pi, u8 data); static u8 ppc6_rd_data_byte(struct pi_adapter *pi); @@ -79,24 +78,6 @@ int mode_map[] = { PPCMODE_UNI_FW, PPCMODE_BI_FW, PPCMODE_EPP_BYTE, //*************************************************************************** -static void ppc6_deselect(struct pi_adapter *pi) -{ - if (mode_map[pi->mode] & 4) // EPP - parport_frob_control(pi->pardev->port, - PARPORT_CONTROL_INIT, PARPORT_CONTROL_INIT); - else // PPC/ECP - parport_frob_control(pi->pardev->port, - PARPORT_CONTROL_SELECT, PARPORT_CONTROL_SELECT); - - parport_write_data(pi->pardev->port, pi->saved_r0); - - parport_write_control(pi->pardev->port, (pi->saved_r2 | PARPORT_CONTROL_SELECT)); - - parport_write_control(pi->pardev->port, pi->saved_r2); -} - -//*************************************************************************** - static void ppc6_send_cmd(struct pi_adapter *pi, u8 cmd) { switch (mode_map[pi->mode]) From patchwork Tue Mar 7 22:46:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ondrej Zary X-Patchwork-Id: 65929 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp5829wrd; Tue, 7 Mar 2023 14:53:14 -0800 (PST) X-Google-Smtp-Source: AK7set/DlX38K1Wx4mWNLWsOPe2QauaUe7mRklFfJCZg5SBqIzOZbCKwAObyRFYoo7l0LWpxrz8H X-Received: by 2002:aa7:98c3:0:b0:5a8:e3dc:4337 with SMTP id e3-20020aa798c3000000b005a8e3dc4337mr16945516pfm.16.1678229594515; Tue, 07 Mar 2023 14:53:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678229594; cv=none; d=google.com; s=arc-20160816; b=Cn00aWpTsoc/NXDHH4LoSni2lVu9/VRnS3B0Ak70nY8s9k73V91+rX1POArXJ8HzIY 0eAiIFkV+KIFA9aB0PfeNp1+Ho8zRA6jaJB+lCDEg2i5JaJMEDHvpZ5IAcJ2jOsuVD+D kLq38HqH/4RXJOoYomlML8Za4Luknrj6Jty1V0JukNv0tMxZ1xmzkiIBfKSV6kKrcVmV 6XSu0xPg3Wjflv05CLs6rEQ41rhtnjPKScT5PhGodE2pU0YDnM2a14ICwR+1CWiuzgWU epMe8hUdYKYPPPK0IS2Htdc8mqHbtsCTwBkGwGY/UJq/bKkfeIi/ssO3LEfbMhSw2J7O Cd0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=yRk1RlpMalmn8dTGSvOxnVb4WT3r3G/m8c9RfL88oHQ=; b=nnB5K+zh3borbvdNJuJNeK/KIXVMY6QvKef11RXHnlmhMwsvRb9clEwLSuIOPqtqDw NqADILymoQQFwLGazIXZKB9pbXfRmiYVWZjLy4y5Gy+J2V3vUioshTcS4SVOTGeD1eQ5 NQoi1xvM/KM2TwGKmuyMTjKsUDo75kkkxsNAU5Zy0MigHJ15WLBkEa8p8q9p+ngNX5QS hvW5vMQTHXoLdiNoMRelZomnspSVyG1CAzh5PjjIyxni6WejNgcchkJbY9qgCgJLz462 By9Qke61DNcGna51IU53TmX6ziM8LE5A3/o0n9sZ96mWjYL1WVPmDrbDvqLHVnPhBfH3 Wo5A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w186-20020a6230c3000000b005a7def83ee0si12534871pfw.210.2023.03.07.14.53.00; Tue, 07 Mar 2023 14:53:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231824AbjCGWtq (ORCPT + 99 others); Tue, 7 Mar 2023 17:49:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35246 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230268AbjCGWru (ORCPT ); Tue, 7 Mar 2023 17:47:50 -0500 Received: from hosting.gsystem.sk (hosting.gsystem.sk [212.5.213.30]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 4F26893125; Tue, 7 Mar 2023 14:47:08 -0800 (PST) Received: from gsql.ggedos.sk (off-20.infotel.telecom.sk [212.5.213.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by hosting.gsystem.sk (Postfix) with ESMTPSA id 977937A076F; Tue, 7 Mar 2023 23:46:50 +0100 (CET) From: Ondrej Zary To: Damien Le Moal , Sudip Mukherjee Cc: Christoph Hellwig , Sergey Shtylyov , Jens Axboe , Tim Waugh , linux-block@vger.kernel.org, linux-parport@lists.infradead.org, linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 27/32] pata_parport-bpck6: move ppc6_send_cmd to bpck6.c and rename Date: Tue, 7 Mar 2023 23:46:22 +0100 Message-Id: <20230307224627.28011-28-linux@zary.sk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20230307224627.28011-1-linux@zary.sk> References: <20230307224627.28011-1-linux@zary.sk> MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759751275286628242?= X-GMAIL-MSGID: =?utf-8?q?1759751275286628242?= Move ppc6_send_cmd to bpck6.c and rename it to bpck6_send_cmd Signed-off-by: Ondrej Zary --- drivers/ata/pata_parport/bpck6.c | 48 ++++++++++++++++++++---------- drivers/ata/pata_parport/ppc6lnx.c | 29 ------------------ 2 files changed, 33 insertions(+), 44 deletions(-) diff --git a/drivers/ata/pata_parport/bpck6.c b/drivers/ata/pata_parport/bpck6.c index 46a91b04aed3..32dc9e61e80c 100644 --- a/drivers/ata/pata_parport/bpck6.c +++ b/drivers/ata/pata_parport/bpck6.c @@ -19,11 +19,29 @@ #include "pata_parport.h" #include "ppc6lnx.c" +static void bpck6_send_cmd(struct pi_adapter *pi, u8 cmd) +{ + switch (mode_map[pi->mode]) { + case PPCMODE_UNI_SW: + case PPCMODE_UNI_FW: + case PPCMODE_BI_SW: + case PPCMODE_BI_FW: + parport_write_data(pi->pardev->port, cmd); + parport_frob_control(pi->pardev->port, 0, PARPORT_CONTROL_AUTOFD); + break; + case PPCMODE_EPP_BYTE: + case PPCMODE_EPP_WORD: + case PPCMODE_EPP_DWORD: + pi->pardev->port->ops->epp_write_addr(pi->pardev->port, &cmd, 1, 0); + break; + } +} + static int bpck6_read_regr(struct pi_adapter *pi, int cont, int reg) { u8 port = cont ? reg | 8 : reg; - ppc6_send_cmd(pi, port | ACCESS_PORT | ACCESS_READ); + bpck6_send_cmd(pi, port | ACCESS_PORT | ACCESS_READ); return ppc6_rd_data_byte(pi); } @@ -31,7 +49,7 @@ static void bpck6_write_regr(struct pi_adapter *pi, int cont, int reg, int val) { u8 port = cont ? reg | 8 : reg; - ppc6_send_cmd(pi, port | ACCESS_PORT | ACCESS_WRITE); + bpck6_send_cmd(pi, port | ACCESS_PORT | ACCESS_WRITE); ppc6_wr_data_byte(pi, val); } @@ -49,13 +67,13 @@ static void bpck6_write_block(struct pi_adapter *pi, char *buf, int len) { u8 this, last; - ppc6_send_cmd(pi, REG_BLKSIZE | ACCESS_REG | ACCESS_WRITE); + bpck6_send_cmd(pi, REG_BLKSIZE | ACCESS_REG | ACCESS_WRITE); ppc6_wr_data_byte(pi, (u8)len); ppc6_wr_data_byte(pi, (u8)(len >> 8)); ppc6_wr_data_byte(pi, 0); - ppc6_send_cmd(pi, CMD_PREFIX_SET | PREFIX_IO16 | PREFIX_BLK); - ppc6_send_cmd(pi, ATA_REG_DATA | ACCESS_PORT | ACCESS_WRITE); + bpck6_send_cmd(pi, CMD_PREFIX_SET | PREFIX_IO16 | PREFIX_BLK); + bpck6_send_cmd(pi, ATA_REG_DATA | ACCESS_PORT | ACCESS_WRITE); switch (mode_map[pi->mode]) { case PPCMODE_UNI_SW: @@ -68,7 +86,7 @@ static void bpck6_write_block(struct pi_adapter *pi, char *buf, int len) break; case PPCMODE_UNI_FW: case PPCMODE_BI_FW: - ppc6_send_cmd(pi, CMD_PREFIX_SET | PREFIX_FASTWR); + bpck6_send_cmd(pi, CMD_PREFIX_SET | PREFIX_FASTWR); parport_frob_control(pi->pardev->port, PARPORT_CONTROL_STROBE, PARPORT_CONTROL_STROBE); @@ -92,7 +110,7 @@ static void bpck6_write_block(struct pi_adapter *pi, char *buf, int len) parport_frob_control(pi->pardev->port, PARPORT_CONTROL_STROBE, 0); - ppc6_send_cmd(pi, CMD_PREFIX_RESET | PREFIX_FASTWR); + bpck6_send_cmd(pi, CMD_PREFIX_RESET | PREFIX_FASTWR); break; case PPCMODE_EPP_BYTE: pi->pardev->port->ops->epp_write_data(pi->pardev->port, buf, @@ -111,18 +129,18 @@ static void bpck6_write_block(struct pi_adapter *pi, char *buf, int len) break; } - ppc6_send_cmd(pi, CMD_PREFIX_RESET | PREFIX_IO16 | PREFIX_BLK); + bpck6_send_cmd(pi, CMD_PREFIX_RESET | PREFIX_IO16 | PREFIX_BLK); } static void bpck6_read_block(struct pi_adapter *pi, char *buf, int len) { - ppc6_send_cmd(pi, REG_BLKSIZE | ACCESS_REG | ACCESS_WRITE); + bpck6_send_cmd(pi, REG_BLKSIZE | ACCESS_REG | ACCESS_WRITE); ppc6_wr_data_byte(pi, (u8)len); ppc6_wr_data_byte(pi, (u8)(len >> 8)); ppc6_wr_data_byte(pi, 0); - ppc6_send_cmd(pi, CMD_PREFIX_SET | PREFIX_IO16 | PREFIX_BLK); - ppc6_send_cmd(pi, ATA_REG_DATA | ACCESS_PORT | ACCESS_READ); + bpck6_send_cmd(pi, CMD_PREFIX_SET | PREFIX_IO16 | PREFIX_BLK); + bpck6_send_cmd(pi, ATA_REG_DATA | ACCESS_PORT | ACCESS_READ); switch (mode_map[pi->mode]) { case PPCMODE_UNI_SW: @@ -171,7 +189,7 @@ static void bpck6_read_block(struct pi_adapter *pi, char *buf, int len) break; } - ppc6_send_cmd(pi, CMD_PREFIX_RESET | PREFIX_IO16 | PREFIX_BLK); + bpck6_send_cmd(pi, CMD_PREFIX_RESET | PREFIX_IO16 | PREFIX_BLK); } static int bpck6_open(struct pi_adapter *pi) @@ -218,10 +236,10 @@ static int bpck6_open(struct pi_adapter *pi) pi->private = 0; - ppc6_send_cmd(pi, ACCESS_REG | ACCESS_WRITE | REG_RAMSIZE); + bpck6_send_cmd(pi, ACCESS_REG | ACCESS_WRITE | REG_RAMSIZE); ppc6_wr_data_byte(pi, RAMSIZE_128K); - ppc6_send_cmd(pi, ACCESS_REG | ACCESS_READ | REG_VERSION); + bpck6_send_cmd(pi, ACCESS_REG | ACCESS_READ | REG_VERSION); if ((ppc6_rd_data_byte(pi) & 0x3F) == 0x0C) pi->private |= fifo_wait; @@ -252,7 +270,7 @@ static void bpck6_deselect(struct pi_adapter *pi) static void bpck6_wr_extout(struct pi_adapter *pi, u8 regdata) { - ppc6_send_cmd(pi, REG_VERSION | ACCESS_REG | ACCESS_WRITE); + bpck6_send_cmd(pi, REG_VERSION | ACCESS_REG | ACCESS_WRITE); ppc6_wr_data_byte(pi, (u8)((regdata & 0x03) << 6)); } diff --git a/drivers/ata/pata_parport/ppc6lnx.c b/drivers/ata/pata_parport/ppc6lnx.c index 6c34bbbdf6db..d3c3968fbfc8 100644 --- a/drivers/ata/pata_parport/ppc6lnx.c +++ b/drivers/ata/pata_parport/ppc6lnx.c @@ -67,7 +67,6 @@ //*************************************************************************** -static void ppc6_send_cmd(struct pi_adapter *pi, u8 cmd); static void ppc6_wr_data_byte(struct pi_adapter *pi, u8 data); static u8 ppc6_rd_data_byte(struct pi_adapter *pi); @@ -78,34 +77,6 @@ int mode_map[] = { PPCMODE_UNI_FW, PPCMODE_BI_FW, PPCMODE_EPP_BYTE, //*************************************************************************** -static void ppc6_send_cmd(struct pi_adapter *pi, u8 cmd) -{ - switch (mode_map[pi->mode]) - { - case PPCMODE_UNI_SW : - case PPCMODE_UNI_FW : - case PPCMODE_BI_SW : - case PPCMODE_BI_FW : - { - parport_write_data(pi->pardev->port, cmd); - parport_frob_control(pi->pardev->port, 0, PARPORT_CONTROL_AUTOFD); - - break; - } - - case PPCMODE_EPP_BYTE : - case PPCMODE_EPP_WORD : - case PPCMODE_EPP_DWORD : - { - pi->pardev->port->ops->epp_write_addr(pi->pardev->port, &cmd, 1, 0); - - break; - } - } -} - -//*************************************************************************** - static void ppc6_wr_data_byte(struct pi_adapter *pi, u8 data) { switch (mode_map[pi->mode]) From patchwork Tue Mar 7 22:46:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ondrej Zary X-Patchwork-Id: 65946 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp10542wrd; Tue, 7 Mar 2023 15:03:55 -0800 (PST) X-Google-Smtp-Source: AK7set9YFXJemthPXBJ1Qs3PVkZ6E9Acras/2JjeM+XUgn2/6/lunmDP5fs4H4vaKqsadCGRSVlG X-Received: by 2002:a17:906:b095:b0:7ad:aed7:a5da with SMTP id x21-20020a170906b09500b007adaed7a5damr18793022ejy.28.1678230235202; Tue, 07 Mar 2023 15:03:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678230235; cv=none; d=google.com; s=arc-20160816; b=iy2KLrQuG+R2+gHRfIGBtWj6cQJu9G84h7scQYm/iLhF8tjNI1fKII5y8yZDYq6cCv vCLu/K5/mgl0t6ayxof1hxgC9pUvgQ+uY/lmf/67A/LKdgi7pPPbYmR0VWsCo6DhykhD FoABAS3dgqhxtzyEm9myrvRFdTo7Ggl/u+jfnsp+J0YMdnzP5M0Vx5cm8L0TL0BUclSb s3Aa6Em6DFx+45xuC636AKCOmDr20AlJXB9CkUykVjAoZXhV0L7GjQsh08sd8dEQ7pTS wSr6u6iS8Rf7GFuG90JTWHD3m8UtmC9F6yb+x1qIdhDccrlerRLZIBe885nDkVtNm0CD M9ZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=Ahr73mNyTI5/RzwYeZNwyIGh9p6MliZLbPFza9HEq7s=; b=p9MhstLoIFrLs8kAUy2RxwcxCAEubqbGM1EAgm6IoqjOAfduYEaPgiLvpdzYNUu9rA JC+YNjTx/i8l52AvwR2ECjayuIJ7qDe5xqxviHse3dQEewVAPmAbT8/wFPYUE1bgon3F vTiyNXLfl0XxYMXnhMKQnT8N3WobgBiDHPiLAc79KbdzHX464MGCXBuXKpb1Md1YjzL/ iEU3Knvex2+3gsf+yeEXUX9MXj5u9peaYc/O756RU+b5HVpWGJPT/1nnC8owj2Ykacjr +PLsLDMO2piXxWVtyVeA45E5srR0h+USdXbgG4sgTJxxSYM7nSFJcsa/clrOu33alp0c JFwg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u17-20020a17090617d100b008c35e1f30fcsi10666029eje.404.2023.03.07.15.03.23; Tue, 07 Mar 2023 15:03:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231927AbjCGWtf (ORCPT + 99 others); Tue, 7 Mar 2023 17:49:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33784 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231776AbjCGWrp (ORCPT ); Tue, 7 Mar 2023 17:47:45 -0500 Received: from hosting.gsystem.sk (hosting.gsystem.sk [212.5.213.30]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 4C0F957D0C; Tue, 7 Mar 2023 14:47:08 -0800 (PST) Received: from gsql.ggedos.sk (off-20.infotel.telecom.sk [212.5.213.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by hosting.gsystem.sk (Postfix) with ESMTPSA id B21D77A0771; Tue, 7 Mar 2023 23:46:50 +0100 (CET) From: Ondrej Zary To: Damien Le Moal , Sudip Mukherjee Cc: Christoph Hellwig , Sergey Shtylyov , Jens Axboe , Tim Waugh , linux-block@vger.kernel.org, linux-parport@lists.infradead.org, linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 28/32] pata_parport-bpck6: move ppc6_rd_data_byte to bpck6.c and rename Date: Tue, 7 Mar 2023 23:46:23 +0100 Message-Id: <20230307224627.28011-29-linux@zary.sk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20230307224627.28011-1-linux@zary.sk> References: <20230307224627.28011-1-linux@zary.sk> MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759751947177210318?= X-GMAIL-MSGID: =?utf-8?q?1759751947177210318?= Move ppc6_rd_data_byte to bpck6.c and rename it to bpck6_rd_data_byte Signed-off-by: Ondrej Zary --- drivers/ata/pata_parport/bpck6.c | 38 ++++++++++++++++++- drivers/ata/pata_parport/ppc6lnx.c | 61 ------------------------------ 2 files changed, 36 insertions(+), 63 deletions(-) diff --git a/drivers/ata/pata_parport/bpck6.c b/drivers/ata/pata_parport/bpck6.c index 32dc9e61e80c..064696b6d68f 100644 --- a/drivers/ata/pata_parport/bpck6.c +++ b/drivers/ata/pata_parport/bpck6.c @@ -37,12 +37,46 @@ static void bpck6_send_cmd(struct pi_adapter *pi, u8 cmd) } } +static u8 bpck6_rd_data_byte(struct pi_adapter *pi) +{ + u8 data = 0; + + switch (mode_map[pi->mode]) { + case PPCMODE_UNI_SW: + case PPCMODE_UNI_FW: + parport_frob_control(pi->pardev->port, PARPORT_CONTROL_STROBE, + PARPORT_CONTROL_INIT); + data = parport_read_status(pi->pardev->port); + data = ((data & 0x80) >> 1) | ((data & 0x38) >> 3); + parport_frob_control(pi->pardev->port, PARPORT_CONTROL_STROBE, + PARPORT_CONTROL_STROBE); + data |= parport_read_status(pi->pardev->port) & 0xB8; + break; + case PPCMODE_BI_SW: + case PPCMODE_BI_FW: + parport_data_reverse(pi->pardev->port); + parport_frob_control(pi->pardev->port, PARPORT_CONTROL_STROBE, + PARPORT_CONTROL_STROBE | PARPORT_CONTROL_INIT); + data = parport_read_data(pi->pardev->port); + parport_frob_control(pi->pardev->port, PARPORT_CONTROL_STROBE, 0); + parport_data_forward(pi->pardev->port); + break; + case PPCMODE_EPP_BYTE: + case PPCMODE_EPP_WORD: + case PPCMODE_EPP_DWORD: + pi->pardev->port->ops->epp_read_data(pi->pardev->port, &data, 1, 0); + break; + } + + return data; +} + static int bpck6_read_regr(struct pi_adapter *pi, int cont, int reg) { u8 port = cont ? reg | 8 : reg; bpck6_send_cmd(pi, port | ACCESS_PORT | ACCESS_READ); - return ppc6_rd_data_byte(pi); + return bpck6_rd_data_byte(pi); } static void bpck6_write_regr(struct pi_adapter *pi, int cont, int reg, int val) @@ -240,7 +274,7 @@ static int bpck6_open(struct pi_adapter *pi) ppc6_wr_data_byte(pi, RAMSIZE_128K); bpck6_send_cmd(pi, ACCESS_REG | ACCESS_READ | REG_VERSION); - if ((ppc6_rd_data_byte(pi) & 0x3F) == 0x0C) + if ((bpck6_rd_data_byte(pi) & 0x3F) == 0x0C) pi->private |= fifo_wait; return 1; diff --git a/drivers/ata/pata_parport/ppc6lnx.c b/drivers/ata/pata_parport/ppc6lnx.c index d3c3968fbfc8..838af60a0d4d 100644 --- a/drivers/ata/pata_parport/ppc6lnx.c +++ b/drivers/ata/pata_parport/ppc6lnx.c @@ -68,7 +68,6 @@ //*************************************************************************** static void ppc6_wr_data_byte(struct pi_adapter *pi, u8 data); -static u8 ppc6_rd_data_byte(struct pi_adapter *pi); //*************************************************************************** @@ -102,63 +101,3 @@ static void ppc6_wr_data_byte(struct pi_adapter *pi, u8 data) } } } - -//*************************************************************************** - -static u8 ppc6_rd_data_byte(struct pi_adapter *pi) -{ - u8 data = 0; - - switch (mode_map[pi->mode]) - { - case PPCMODE_UNI_SW : - case PPCMODE_UNI_FW : - { - parport_frob_control(pi->pardev->port, - PARPORT_CONTROL_STROBE, PARPORT_CONTROL_INIT); - - // DELAY - - data = parport_read_status(pi->pardev->port); - - data = ((data & 0x80) >> 1) | ((data & 0x38) >> 3); - - parport_frob_control(pi->pardev->port, - PARPORT_CONTROL_STROBE, PARPORT_CONTROL_STROBE); - - // DELAY - - data |= parport_read_status(pi->pardev->port) & 0xB8; - - break; - } - - case PPCMODE_BI_SW : - case PPCMODE_BI_FW : - { - parport_data_reverse(pi->pardev->port); - - parport_frob_control(pi->pardev->port, PARPORT_CONTROL_STROBE, - PARPORT_CONTROL_STROBE | PARPORT_CONTROL_INIT); - - data = parport_read_data(pi->pardev->port); - - parport_frob_control(pi->pardev->port, PARPORT_CONTROL_STROBE, 0); - - parport_data_forward(pi->pardev->port); - - break; - } - - case PPCMODE_EPP_BYTE : - case PPCMODE_EPP_WORD : - case PPCMODE_EPP_DWORD : - { - pi->pardev->port->ops->epp_read_data(pi->pardev->port, &data, 1, 0); - - break; - } - } - - return(data); -} From patchwork Tue Mar 7 22:46:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ondrej Zary X-Patchwork-Id: 65950 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp10959wrd; Tue, 7 Mar 2023 15:04:35 -0800 (PST) X-Google-Smtp-Source: AK7set86B3f7YhBZQfLgi9kNlcztATf57nYY3Yrdf+YyGbiq8bmAaG8JIclCQe/t//K1UX1JDAi3 X-Received: by 2002:a17:907:6e28:b0:87d:ed60:cb7e with SMTP id sd40-20020a1709076e2800b0087ded60cb7emr21699230ejc.68.1678230275782; Tue, 07 Mar 2023 15:04:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678230275; cv=none; d=google.com; s=arc-20160816; b=ZdQHhisGfzXHbVRyXEfnfC3nUjArfr2eHO8i7QqfILNw62j5wFX6o4rOZr2grwSndV PCq8KzdrUdQbAOcjARX/mbMzvXTSl0kmzCa/eehbMPL71C9QjZxCAdXUOQfNSJtPZ6qt gd29ycOFA2lNTnqma0xkKUss5ZpVi1WUEBwmbpfUO3Krs7XGKxHAiWAbMyGn3M0li/Hp q71+Z52PBvtk4phG8Tvz4j/8kf9VB1Nb0niYUj6xw4gFD4RXu2sGiD6OYJfQDq47wzgd ZmHy8mLdY1MPjW7UhfquhuFSfJtRll3ilPStuIWSNe6xoSF7qIoJ9Ie1lT/Li2iOLn0O ZRCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=zXjRSOtwEObTyudjGavynFRYXXQUglnya93Fn46DR1E=; b=aXFvKgZn4gcf1OZ4hWfHuEV8688mlHGvVPSHqHjT20XwTvS7ijYbR5ZG+oQBgWN9WU DWrjSasFRpBSJOttpM1vleuSUCwWWice8PqjIMmqsLIWDt57oNm0R2RQJYvG2q+Pz6Uv el5Ds6ILSxmFGQ47EahOEa0iZi22VepajuofwVXmsaAo/PhG7zu1i4yHvLhjiSkpOU5H V6bHqpWtGtDtxKlVIQCYpT9gl1sxIS048u0sHcXyJ6djkKzp9Gq2WELdVTd6BGJ3H+TJ er1ILPEqySDqljQxsKncB66r10wrwYnLyyaep22d7ZUZV5+DkETm6nqnP379RplM4ScZ y0iw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id lj2-20020a170906f9c200b008cf5cc8f9aasi258209ejb.580.2023.03.07.15.03.56; Tue, 07 Mar 2023 15:04:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229951AbjCGWtL (ORCPT + 99 others); Tue, 7 Mar 2023 17:49:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33762 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231775AbjCGWrp (ORCPT ); Tue, 7 Mar 2023 17:47:45 -0500 Received: from hosting.gsystem.sk (hosting.gsystem.sk [212.5.213.30]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 6E3DC99C2D; Tue, 7 Mar 2023 14:47:09 -0800 (PST) Received: from gsql.ggedos.sk (off-20.infotel.telecom.sk [212.5.213.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by hosting.gsystem.sk (Postfix) with ESMTPSA id CAA287A0776; Tue, 7 Mar 2023 23:46:50 +0100 (CET) From: Ondrej Zary To: Damien Le Moal , Sudip Mukherjee Cc: Christoph Hellwig , Sergey Shtylyov , Jens Axboe , Tim Waugh , linux-block@vger.kernel.org, linux-parport@lists.infradead.org, linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 29/32] pata_parport-bpck6: move ppc6_wr_data_byte to bpck6.c and rename Date: Tue, 7 Mar 2023 23:46:24 +0100 Message-Id: <20230307224627.28011-30-linux@zary.sk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20230307224627.28011-1-linux@zary.sk> References: <20230307224627.28011-1-linux@zary.sk> MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759751989897813966?= X-GMAIL-MSGID: =?utf-8?q?1759751989897813966?= Move ppc6_wr_data_byte to bpck6.c and rename it to bpck6_wr_data_byte Signed-off-by: Ondrej Zary --- drivers/ata/pata_parport/bpck6.c | 36 ++++++++++++++++++++++-------- drivers/ata/pata_parport/ppc6lnx.c | 32 -------------------------- 2 files changed, 27 insertions(+), 41 deletions(-) diff --git a/drivers/ata/pata_parport/bpck6.c b/drivers/ata/pata_parport/bpck6.c index 064696b6d68f..f6d0916577b3 100644 --- a/drivers/ata/pata_parport/bpck6.c +++ b/drivers/ata/pata_parport/bpck6.c @@ -71,6 +71,24 @@ static u8 bpck6_rd_data_byte(struct pi_adapter *pi) return data; } +static void bpck6_wr_data_byte(struct pi_adapter *pi, u8 data) +{ + switch (mode_map[pi->mode]) { + case PPCMODE_UNI_SW: + case PPCMODE_UNI_FW: + case PPCMODE_BI_SW: + case PPCMODE_BI_FW: + parport_write_data(pi->pardev->port, data); + parport_frob_control(pi->pardev->port, 0, PARPORT_CONTROL_INIT); + break; + case PPCMODE_EPP_BYTE: + case PPCMODE_EPP_WORD: + case PPCMODE_EPP_DWORD: + pi->pardev->port->ops->epp_write_data(pi->pardev->port, &data, 1, 0); + break; + } +} + static int bpck6_read_regr(struct pi_adapter *pi, int cont, int reg) { u8 port = cont ? reg | 8 : reg; @@ -84,7 +102,7 @@ static void bpck6_write_regr(struct pi_adapter *pi, int cont, int reg, int val) u8 port = cont ? reg | 8 : reg; bpck6_send_cmd(pi, port | ACCESS_PORT | ACCESS_WRITE); - ppc6_wr_data_byte(pi, val); + bpck6_wr_data_byte(pi, val); } static void bpck6_wait_for_fifo(struct pi_adapter *pi) @@ -102,9 +120,9 @@ static void bpck6_write_block(struct pi_adapter *pi, char *buf, int len) u8 this, last; bpck6_send_cmd(pi, REG_BLKSIZE | ACCESS_REG | ACCESS_WRITE); - ppc6_wr_data_byte(pi, (u8)len); - ppc6_wr_data_byte(pi, (u8)(len >> 8)); - ppc6_wr_data_byte(pi, 0); + bpck6_wr_data_byte(pi, (u8)len); + bpck6_wr_data_byte(pi, (u8)(len >> 8)); + bpck6_wr_data_byte(pi, 0); bpck6_send_cmd(pi, CMD_PREFIX_SET | PREFIX_IO16 | PREFIX_BLK); bpck6_send_cmd(pi, ATA_REG_DATA | ACCESS_PORT | ACCESS_WRITE); @@ -169,9 +187,9 @@ static void bpck6_write_block(struct pi_adapter *pi, char *buf, int len) static void bpck6_read_block(struct pi_adapter *pi, char *buf, int len) { bpck6_send_cmd(pi, REG_BLKSIZE | ACCESS_REG | ACCESS_WRITE); - ppc6_wr_data_byte(pi, (u8)len); - ppc6_wr_data_byte(pi, (u8)(len >> 8)); - ppc6_wr_data_byte(pi, 0); + bpck6_wr_data_byte(pi, (u8)len); + bpck6_wr_data_byte(pi, (u8)(len >> 8)); + bpck6_wr_data_byte(pi, 0); bpck6_send_cmd(pi, CMD_PREFIX_SET | PREFIX_IO16 | PREFIX_BLK); bpck6_send_cmd(pi, ATA_REG_DATA | ACCESS_PORT | ACCESS_READ); @@ -271,7 +289,7 @@ static int bpck6_open(struct pi_adapter *pi) pi->private = 0; bpck6_send_cmd(pi, ACCESS_REG | ACCESS_WRITE | REG_RAMSIZE); - ppc6_wr_data_byte(pi, RAMSIZE_128K); + bpck6_wr_data_byte(pi, RAMSIZE_128K); bpck6_send_cmd(pi, ACCESS_REG | ACCESS_READ | REG_VERSION); if ((bpck6_rd_data_byte(pi) & 0x3F) == 0x0C) @@ -305,7 +323,7 @@ static void bpck6_deselect(struct pi_adapter *pi) static void bpck6_wr_extout(struct pi_adapter *pi, u8 regdata) { bpck6_send_cmd(pi, REG_VERSION | ACCESS_REG | ACCESS_WRITE); - ppc6_wr_data_byte(pi, (u8)((regdata & 0x03) << 6)); + bpck6_wr_data_byte(pi, (u8)((regdata & 0x03) << 6)); } static void bpck6_connect(struct pi_adapter *pi) diff --git a/drivers/ata/pata_parport/ppc6lnx.c b/drivers/ata/pata_parport/ppc6lnx.c index 838af60a0d4d..9a763cbda130 100644 --- a/drivers/ata/pata_parport/ppc6lnx.c +++ b/drivers/ata/pata_parport/ppc6lnx.c @@ -67,37 +67,5 @@ //*************************************************************************** -static void ppc6_wr_data_byte(struct pi_adapter *pi, u8 data); - -//*************************************************************************** - int mode_map[] = { PPCMODE_UNI_FW, PPCMODE_BI_FW, PPCMODE_EPP_BYTE, PPCMODE_EPP_WORD, PPCMODE_EPP_DWORD }; - -//*************************************************************************** - -static void ppc6_wr_data_byte(struct pi_adapter *pi, u8 data) -{ - switch (mode_map[pi->mode]) - { - case PPCMODE_UNI_SW : - case PPCMODE_UNI_FW : - case PPCMODE_BI_SW : - case PPCMODE_BI_FW : - { - parport_write_data(pi->pardev->port, data); - parport_frob_control(pi->pardev->port, 0, PARPORT_CONTROL_INIT); - - break; - } - - case PPCMODE_EPP_BYTE : - case PPCMODE_EPP_WORD : - case PPCMODE_EPP_DWORD : - { - pi->pardev->port->ops->epp_write_data(pi->pardev->port, &data, 1, 0); - - break; - } - } -} From patchwork Tue Mar 7 22:46:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ondrej Zary X-Patchwork-Id: 65926 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp5369wrd; Tue, 7 Mar 2023 14:51:56 -0800 (PST) X-Google-Smtp-Source: AK7set/+3TvHm+w4m55oP+iBur543mP6u8gSFxuFnvssDHYQvO+mZnEcCgv8NKIV51L8RlPtiwEd X-Received: by 2002:a05:6a20:a10c:b0:cb:f76c:ce49 with SMTP id q12-20020a056a20a10c00b000cbf76cce49mr18016754pzk.20.1678229515806; Tue, 07 Mar 2023 14:51:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678229515; cv=none; d=google.com; s=arc-20160816; b=EP2125EuGZXMoXtVmT/t+ZuwI3BPfIjiLwq+ExHGI3iZso189FTl/kI15FMzmMJpyE 5G6gFXYqbuVC6hFMaF2alH9DuuRHsv5Xzx0S2vwm76zOJN0WUFoIcidwC1EY7Lyg42ne 4YRoP5e4CybHJwOYRFCIqn+reFsTN4iQWYoJptyFqlk5pIzswqe32TkvyxLut5WMsItz 2qpo+zx5QL/8cVWq2EaVbGq8Bv3EzAVcLQjnQT1rIrL1JAu5Ul7bp44evncQ5YlJKDa/ VL3ueL/bi5SGUbJqcTKmJbO94offxFT31eSvjFSD0TuAUu9ePuQhat0eA7H+xCW5Ui+H Rw1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=b0o8aP6ubB1uRN/0AVpLDgAn4iUIa+kfChe/r0mC0c8=; b=07/+f8GhJpFmKjj/LUKV0h/52ZXeke7KdSu2OH2fNIQQbgLD0MY72PZz1V37e/qCmV +QcGkJ1ZvY34fvVop74TIbRZg3dWBaHcIswYIstuiFLshVWMzv9YYAHPDRHAZfIzADy/ pL5XOcDgjrdpvOioMUoBBrKUUr3QfokMqvWNWMy2OX0I6QmEU2rfmUMfNXBvZnKS5KcN wNarg7J+Ubyc5TlhOHRTL5rjWBrxTjWaMn5rZdKy8r2yonrEazHYDeKzK5tMYKABdbJc /Qs50wTjMuTupUmKbliFd70TlRD4AzCmghgWrMUrKPqJYixMtMk1amI6q3jTK3ijvNis 0PMQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w186-20020a6230c3000000b005a7def83ee0si12534871pfw.210.2023.03.07.14.51.42; Tue, 07 Mar 2023 14:51:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231785AbjCGWtW (ORCPT + 99 others); Tue, 7 Mar 2023 17:49:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33760 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231289AbjCGWrp (ORCPT ); Tue, 7 Mar 2023 17:47:45 -0500 Received: from hosting.gsystem.sk (hosting.gsystem.sk [212.5.213.30]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 4E7188C502; Tue, 7 Mar 2023 14:47:09 -0800 (PST) Received: from gsql.ggedos.sk (off-20.infotel.telecom.sk [212.5.213.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by hosting.gsystem.sk (Postfix) with ESMTPSA id E31577A0779; Tue, 7 Mar 2023 23:46:50 +0100 (CET) From: Ondrej Zary To: Damien Le Moal , Sudip Mukherjee Cc: Christoph Hellwig , Sergey Shtylyov , Jens Axboe , Tim Waugh , linux-block@vger.kernel.org, linux-parport@lists.infradead.org, linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 30/32] pata_parport-bpck6: move defines and mode_map to bpck6.c Date: Tue, 7 Mar 2023 23:46:25 +0100 Message-Id: <20230307224627.28011-31-linux@zary.sk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20230307224627.28011-1-linux@zary.sk> References: <20230307224627.28011-1-linux@zary.sk> MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759751192874790454?= X-GMAIL-MSGID: =?utf-8?q?1759751192874790454?= Move all register definitions and mode_map to bpck6.c Signed-off-by: Ondrej Zary --- drivers/ata/pata_parport/bpck6.c | 44 ++++++++++++++++++++++++ drivers/ata/pata_parport/ppc6lnx.c | 54 ------------------------------ 2 files changed, 44 insertions(+), 54 deletions(-) diff --git a/drivers/ata/pata_parport/bpck6.c b/drivers/ata/pata_parport/bpck6.c index f6d0916577b3..0ed6a97ab04f 100644 --- a/drivers/ata/pata_parport/bpck6.c +++ b/drivers/ata/pata_parport/bpck6.c @@ -19,6 +19,50 @@ #include "pata_parport.h" #include "ppc6lnx.c" +/* 60772 Commands */ +#define ACCESS_REG 0x00 +#define ACCESS_PORT 0x40 + +#define ACCESS_READ 0x00 +#define ACCESS_WRITE 0x20 + +/* 60772 Command Prefix */ +#define CMD_PREFIX_SET 0xe0 // Special command that modifies next command's operation +#define CMD_PREFIX_RESET 0xc0 // Resets current cmd modifier reg bits + #define PREFIX_IO16 0x01 // perform 16-bit wide I/O + #define PREFIX_FASTWR 0x04 // enable PPC mode fast-write + #define PREFIX_BLK 0x08 // enable block transfer mode + +/* 60772 Registers */ +#define REG_STATUS 0x00 // status register + #define STATUS_IRQA 0x01 // Peripheral IRQA line + #define STATUS_EEPROM_DO 0x40 // Serial EEPROM data bit +#define REG_VERSION 0x01 // PPC version register (read) +#define REG_HWCFG 0x02 // Hardware Config register +#define REG_RAMSIZE 0x03 // Size of RAM Buffer + #define RAMSIZE_128K 0x02 +#define REG_EEPROM 0x06 // EEPROM control register + #define EEPROM_SK 0x01 // eeprom SK bit + #define EEPROM_DI 0x02 // eeprom DI bit + #define EEPROM_CS 0x04 // eeprom CS bit + #define EEPROM_EN 0x08 // eeprom output enable +#define REG_BLKSIZE 0x08 // Block transfer len (24 bit) + +/* flags */ +#define fifo_wait 0x10 + +/* DONT CHANGE THESE LEST YOU BREAK EVERYTHING - BIT FIELD DEPENDENCIES */ +#define PPCMODE_UNI_SW 0 +#define PPCMODE_UNI_FW 1 +#define PPCMODE_BI_SW 2 +#define PPCMODE_BI_FW 3 +#define PPCMODE_EPP_BYTE 4 +#define PPCMODE_EPP_WORD 5 +#define PPCMODE_EPP_DWORD 6 + +int mode_map[] = { PPCMODE_UNI_FW, PPCMODE_BI_FW, PPCMODE_EPP_BYTE, + PPCMODE_EPP_WORD, PPCMODE_EPP_DWORD }; + static void bpck6_send_cmd(struct pi_adapter *pi, u8 cmd) { switch (mode_map[pi->mode]) { diff --git a/drivers/ata/pata_parport/ppc6lnx.c b/drivers/ata/pata_parport/ppc6lnx.c index 9a763cbda130..e72b1842adda 100644 --- a/drivers/ata/pata_parport/ppc6lnx.c +++ b/drivers/ata/pata_parport/ppc6lnx.c @@ -15,57 +15,3 @@ //*************************************************************************** -// 60772 Commands - -#define ACCESS_REG 0x00 -#define ACCESS_PORT 0x40 - -#define ACCESS_READ 0x00 -#define ACCESS_WRITE 0x20 - -// 60772 Command Prefix - -#define CMD_PREFIX_SET 0xe0 // Special command that modifies the next command's operation -#define CMD_PREFIX_RESET 0xc0 // Resets current cmd modifier reg bits - #define PREFIX_IO16 0x01 // perform 16-bit wide I/O - #define PREFIX_FASTWR 0x04 // enable PPC mode fast-write - #define PREFIX_BLK 0x08 // enable block transfer mode - -// 60772 Registers - -#define REG_STATUS 0x00 // status register - #define STATUS_IRQA 0x01 // Peripheral IRQA line - #define STATUS_EEPROM_DO 0x40 // Serial EEPROM data bit -#define REG_VERSION 0x01 // PPC version register (read) -#define REG_HWCFG 0x02 // Hardware Config register -#define REG_RAMSIZE 0x03 // Size of RAM Buffer - #define RAMSIZE_128K 0x02 -#define REG_EEPROM 0x06 // EEPROM control register - #define EEPROM_SK 0x01 // eeprom SK bit - #define EEPROM_DI 0x02 // eeprom DI bit - #define EEPROM_CS 0x04 // eeprom CS bit - #define EEPROM_EN 0x08 // eeprom output enable -#define REG_BLKSIZE 0x08 // Block transfer len (24 bit) - -//*************************************************************************** - -// ppc_flags - -#define fifo_wait 0x10 - -//*************************************************************************** - -// DONT CHANGE THESE LEST YOU BREAK EVERYTHING - BIT FIELD DEPENDENCIES - -#define PPCMODE_UNI_SW 0 -#define PPCMODE_UNI_FW 1 -#define PPCMODE_BI_SW 2 -#define PPCMODE_BI_FW 3 -#define PPCMODE_EPP_BYTE 4 -#define PPCMODE_EPP_WORD 5 -#define PPCMODE_EPP_DWORD 6 - -//*************************************************************************** - -int mode_map[] = { PPCMODE_UNI_FW, PPCMODE_BI_FW, PPCMODE_EPP_BYTE, - PPCMODE_EPP_WORD, PPCMODE_EPP_DWORD }; From patchwork Tue Mar 7 22:46:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ondrej Zary X-Patchwork-Id: 65921 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp5035wrd; Tue, 7 Mar 2023 14:51:01 -0800 (PST) X-Google-Smtp-Source: AK7set++pmyauQR6eMknhuVGak4mhc5cJieX8601hFAAvDXGUnXYaqX5VA51WskbCf94l006gdxT X-Received: by 2002:a17:902:e744:b0:19c:d169:cb3f with SMTP id p4-20020a170902e74400b0019cd169cb3fmr21231733plf.21.1678229460978; Tue, 07 Mar 2023 14:51:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678229460; cv=none; d=google.com; s=arc-20160816; b=xgmOnZlbWDT2gYC1L3hriULheoD2I7A77Kw8tjBmJOKrKQRHBIFWh+5L/z9Zltj/Rc 58PwhDX3aN6QBWyac1SmpddfxQiPSh56NQp7tseXdFHMK8WcYPpW1O++1kqT4BfbjWYz mo5Z2AzMW0D5dkGRRpUfIm1RQ8fkb+U8d4/YhHHZGyAKx22gAtKiu4g48IRb4Ct6VssY W7ujHDo79WfASNToY/LoUArQ3ie/QxTqyAAloBY83e3LJN0EpbYNrXb5Hw86to0xnGpi kyvND2VJBzPsJ8FQpz39zhxQ+JLuB9WU3Nr+HazcLvSkC2gdSnzrWZsPtAaf0iphKbly 705Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=pt9hfmQdsZxzTa/OunhmaCwjX0KClPyZoYdC36Cdqd8=; b=P1Xkm7dx6O9DBVYXmog+e1sFnHZtdHvzy6qW8i29B2SDPK+NB57kGXe6fqiX12I3aa FZDiuTXnuLy33DDUVvI8JJWiXS7O9stbLWMvXagGL01CY5hBpzmwjbRHiT+k8SCJFeT1 utK0QCCDS9BWWkA7beqamwitMEF/ZS3BLQKpLhSjlhL00f6dyU3VBjn8Em/rP9yItMc3 hXuGh64BcscsbYQ748oTwQqNCwcqwcF03Gj1fJzUxy3gvmy2cVEoHzAOZQuIj9kW8+V5 AlMZkgrzwhfpA8zuqnfDhwDkyNQ8DrDPg78ZPzUi8KlZAHlZv+FC2dnuHhPIzGNQnEnW AEwA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id kd13-20020a17090313cd00b0019aa6c46413si12623798plb.345.2023.03.07.14.50.46; Tue, 07 Mar 2023 14:51:00 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231897AbjCGWtO (ORCPT + 99 others); Tue, 7 Mar 2023 17:49:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35126 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231779AbjCGWrp (ORCPT ); Tue, 7 Mar 2023 17:47:45 -0500 Received: from hosting.gsystem.sk (hosting.gsystem.sk [212.5.213.30]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 0EEF7A0B29; Tue, 7 Mar 2023 14:47:08 -0800 (PST) Received: from gsql.ggedos.sk (off-20.infotel.telecom.sk [212.5.213.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by hosting.gsystem.sk (Postfix) with ESMTPSA id 074197A077A; Tue, 7 Mar 2023 23:46:51 +0100 (CET) From: Ondrej Zary To: Damien Le Moal , Sudip Mukherjee Cc: Christoph Hellwig , Sergey Shtylyov , Jens Axboe , Tim Waugh , linux-block@vger.kernel.org, linux-parport@lists.infradead.org, linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 31/32] pata_parport-bpck6: delete ppc6lnx.c Date: Tue, 7 Mar 2023 23:46:26 +0100 Message-Id: <20230307224627.28011-32-linux@zary.sk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20230307224627.28011-1-linux@zary.sk> References: <20230307224627.28011-1-linux@zary.sk> MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759751134767362099?= X-GMAIL-MSGID: =?utf-8?q?1759751134767362099?= Remove now empty ppc6lnx.c. Signed-off-by: Ondrej Zary Reviewed-by: Sergey Shtylyov --- drivers/ata/pata_parport/bpck6.c | 1 - drivers/ata/pata_parport/ppc6lnx.c | 17 ----------------- 2 files changed, 18 deletions(-) delete mode 100644 drivers/ata/pata_parport/ppc6lnx.c diff --git a/drivers/ata/pata_parport/bpck6.c b/drivers/ata/pata_parport/bpck6.c index 0ed6a97ab04f..53d0ad1d6e89 100644 --- a/drivers/ata/pata_parport/bpck6.c +++ b/drivers/ata/pata_parport/bpck6.c @@ -17,7 +17,6 @@ #include #include #include "pata_parport.h" -#include "ppc6lnx.c" /* 60772 Commands */ #define ACCESS_REG 0x00 diff --git a/drivers/ata/pata_parport/ppc6lnx.c b/drivers/ata/pata_parport/ppc6lnx.c deleted file mode 100644 index e72b1842adda..000000000000 --- a/drivers/ata/pata_parport/ppc6lnx.c +++ /dev/null @@ -1,17 +0,0 @@ -/* - ppc6lnx.c (c) 2001 Micro Solutions Inc. - Released under the terms of the GNU General Public license - - ppc6lnx.c is a par of the protocol driver for the Micro Solutions - "BACKPACK" parallel port IDE adapter - (Works on Series 6 drives) - -*/ - -//*************************************************************************** - -// PPC 6 Code in C sanitized for LINUX -// Original x86 ASM by Ron, Converted to C by Clive - -//*************************************************************************** - From patchwork Tue Mar 7 22:46:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ondrej Zary X-Patchwork-Id: 65922 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp5122wrd; Tue, 7 Mar 2023 14:51:13 -0800 (PST) X-Google-Smtp-Source: AK7set8u+SDw4uam2DYPtBErpw7boa0gliksUPhlaN1OXiORVq3jt6cr8oOyZDX76N9YD8xa2Vtr X-Received: by 2002:a17:90b:1e4f:b0:237:aed6:fff3 with SMTP id pi15-20020a17090b1e4f00b00237aed6fff3mr16389219pjb.44.1678229473231; Tue, 07 Mar 2023 14:51:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678229473; cv=none; d=google.com; s=arc-20160816; b=xQNxm4l5p7CuRYU5Mx3Li4/Vy5e9idvWO86+NT6sNeiCgrW9vMwwKCA0JxGz1xRNAH GgTFOXb9AjwEdmrD3UuVcvXxLRi2bEtZ0ugXdlnNE0Q09U0IpWhCSHA1v1pN3yeQtaSs 82GHxLQFRxSdledL2TLS/Yf4ZQVvVovGWj6nnUZ/Bn4VX1cAb9lRxQvhPY55z3bJSZlD HuXdWIGf+D8ibD7xh6RLGKyxBYh1gmajYcCAbXI9COzoTe9dH4wOMimDQvSTtto3myLD Z2q42baxiFy3X9dYfQkGn1CgpQGyMUTAOwAe0GKwF36QqgBmpUfYTXRjKfpQzIet+pEO zofg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=+xqPo6RzLMdLLcYZOFoY6b6kZUEC22dSSFVHlwNNi40=; b=TGWb/M0+UQE+mDuF4BY/XY6h6va8VafnJzFdHhF5kY5ASANYWxKVP699GSjFsYvb98 DVVl2DAmPRrOlUzR9GzCE/cMUbXGdVncA5unt9euH+6kyhGq7r4NiQemwbOrGuWxxAaX KJo7VtG8Uu+2j82Ohk9hSHNaSOkwyJ9PFiNsKsdyFaiThrgSLB7RE40GsHhnXLvHsYBf QSInQ1IPokfnIujA753zgOzd4pOsHRKhRasFsewIv25oCU6/+GohsWt/uugoFf2BCA7+ hCb2c+JvgDKTZ2DHqBSM8sKAQUpGOFifj5Rltemp1q2RDsz8HFYl6hc9xe5oO5LysVwK yrjQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 79-20020a630252000000b00502b278306fsi12790554pgc.568.2023.03.07.14.51.00; Tue, 07 Mar 2023 14:51:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231802AbjCGWtU (ORCPT + 99 others); Tue, 7 Mar 2023 17:49:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35128 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231785AbjCGWrp (ORCPT ); Tue, 7 Mar 2023 17:47:45 -0500 Received: from hosting.gsystem.sk (hosting.gsystem.sk [212.5.213.30]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 0EE4B9FE78; Tue, 7 Mar 2023 14:47:08 -0800 (PST) Received: from gsql.ggedos.sk (off-20.infotel.telecom.sk [212.5.213.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by hosting.gsystem.sk (Postfix) with ESMTPSA id 1D93D7A077D; Tue, 7 Mar 2023 23:46:51 +0100 (CET) From: Ondrej Zary To: Damien Le Moal , Sudip Mukherjee Cc: Christoph Hellwig , Sergey Shtylyov , Jens Axboe , Tim Waugh , linux-block@vger.kernel.org, linux-parport@lists.infradead.org, linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 32/32] pata_parport-bpck6: reduce indents in bpck6_open Date: Tue, 7 Mar 2023 23:46:27 +0100 Message-Id: <20230307224627.28011-33-linux@zary.sk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20230307224627.28011-1-linux@zary.sk> References: <20230307224627.28011-1-linux@zary.sk> MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759751147737814313?= X-GMAIL-MSGID: =?utf-8?q?1759751147737814313?= Reverse error handling conditions to reduce code indents in bpck6_open. Signed-off-by: Ondrej Zary --- drivers/ata/pata_parport/bpck6.c | 48 +++++++++++++++++--------------- 1 file changed, 25 insertions(+), 23 deletions(-) diff --git a/drivers/ata/pata_parport/bpck6.c b/drivers/ata/pata_parport/bpck6.c index 53d0ad1d6e89..295dbe5cdaa4 100644 --- a/drivers/ata/pata_parport/bpck6.c +++ b/drivers/ata/pata_parport/bpck6.c @@ -318,30 +318,32 @@ static int bpck6_open(struct pi_adapter *pi) j = ((i & 0x08) << 4) | ((i & 0x07) << 3); k = parport_read_status(pi->pardev->port) & 0xB8; - if (j == k) { - parport_frob_control(pi->pardev->port, PARPORT_CONTROL_AUTOFD, 0); - k = (parport_read_status(pi->pardev->port) & 0xB8) ^ 0xB8; - if (j == k) { - if (i & 4) // EPP - parport_frob_control(pi->pardev->port, - PARPORT_CONTROL_SELECT | PARPORT_CONTROL_INIT, 0); - else // PPC/ECP - parport_frob_control(pi->pardev->port, - PARPORT_CONTROL_SELECT, 0); - - pi->private = 0; - - bpck6_send_cmd(pi, ACCESS_REG | ACCESS_WRITE | REG_RAMSIZE); - bpck6_wr_data_byte(pi, RAMSIZE_128K); - - bpck6_send_cmd(pi, ACCESS_REG | ACCESS_READ | REG_VERSION); - if ((bpck6_rd_data_byte(pi) & 0x3F) == 0x0C) - pi->private |= fifo_wait; - - return 1; - } - } + if (j != k) + goto fail; + + parport_frob_control(pi->pardev->port, PARPORT_CONTROL_AUTOFD, 0); + k = (parport_read_status(pi->pardev->port) & 0xB8) ^ 0xB8; + if (j != k) + goto fail; + + if (i & 4) // EPP + parport_frob_control(pi->pardev->port, + PARPORT_CONTROL_SELECT | PARPORT_CONTROL_INIT, 0); + else // PPC/ECP + parport_frob_control(pi->pardev->port, PARPORT_CONTROL_SELECT, 0); + + pi->private = 0; + + bpck6_send_cmd(pi, ACCESS_REG | ACCESS_WRITE | REG_RAMSIZE); + bpck6_wr_data_byte(pi, RAMSIZE_128K); + + bpck6_send_cmd(pi, ACCESS_REG | ACCESS_READ | REG_VERSION); + if ((bpck6_rd_data_byte(pi) & 0x3F) == 0x0C) + pi->private |= fifo_wait; + + return 1; +fail: parport_write_control(pi->pardev->port, pi->saved_r2); parport_write_data(pi->pardev->port, pi->saved_r0);