From nobody Thu Sep 11 15:01:13 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B3E66C61DA4 for ; Sat, 18 Feb 2023 22:02:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229613AbjBRWCo (ORCPT ); Sat, 18 Feb 2023 17:02:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52110 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230137AbjBRWCS (ORCPT ); Sat, 18 Feb 2023 17:02:18 -0500 Received: from hosting.gsystem.sk (hosting.gsystem.sk [212.5.213.30]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 91E3F12BD2; Sat, 18 Feb 2023 14:02:10 -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 E04D87A0728; Sat, 18 Feb 2023 23:02:03 +0100 (CET) From: Ondrej Zary To: Damien Le Moal 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/18] pata_parport: remove scratch parameter from test_proto() Date: Sat, 18 Feb 2023 23:01:36 +0100 Message-Id: <20230218220138.5692-17-linux@zary.sk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20230218220138.5692-1-linux@zary.sk> References: <20230218220138.5692-1-linux@zary.sk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Don't pass around a pointer to scratch buffer. Use local buffers in protocols that need it. Reviewed-by: Sergey Shtylyov Signed-off-by: Ondrej Zary --- drivers/ata/pata_parport/bpck.c | 2 +- drivers/ata/pata_parport/epat.c | 3 ++- drivers/ata/pata_parport/epia.c | 3 ++- drivers/ata/pata_parport/friq.c | 3 ++- drivers/ata/pata_parport/frpw.c | 3 ++- drivers/ata/pata_parport/pata_parport.c | 23 +++++++++++------------ include/linux/pata_parport.h | 2 +- 7 files changed, 21 insertions(+), 18 deletions(-) diff --git a/drivers/ata/pata_parport/bpck.c b/drivers/ata/pata_parport/bpc= k.c index 2072e291fd16..ecb98bf0e6de 100644 --- a/drivers/ata/pata_parport/bpck.c +++ b/drivers/ata/pata_parport/bpck.c @@ -274,7 +274,7 @@ static void bpck_force_spp(struct pi_adapter *pi) =20 #define TEST_LEN 16 =20 -static int bpck_test_proto(struct pi_adapter *pi, char *scratch) +static int bpck_test_proto(struct pi_adapter *pi) =20 { int i, e, l, h, om; char buf[TEST_LEN]; diff --git a/drivers/ata/pata_parport/epat.c b/drivers/ata/pata_parport/epa= t.c index 4877b39ed04c..609614b2c69e 100644 --- a/drivers/ata/pata_parport/epat.c +++ b/drivers/ata/pata_parport/epat.c @@ -246,10 +246,11 @@ static void epat_disconnect(struct pi_adapter *pi) w2(pi->saved_r2); } =20 -static int epat_test_proto(struct pi_adapter *pi, char *scratch) +static int epat_test_proto(struct pi_adapter *pi) =20 { int k, j, f, cc; int e[2] =3D {0,0}; + char scratch[512]; =20 epat_connect(pi); cc =3D RR(0xd); diff --git a/drivers/ata/pata_parport/epia.c b/drivers/ata/pata_parport/epi= a.c index e7401351463a..970532619aeb 100644 --- a/drivers/ata/pata_parport/epia.c +++ b/drivers/ata/pata_parport/epia.c @@ -232,10 +232,11 @@ static void epia_write_block(struct pi_adapter *pi, c= har *buf, int count) =20 } =20 -static int epia_test_proto(struct pi_adapter *pi, char *scratch) +static int epia_test_proto(struct pi_adapter *pi) =20 { int j, k, f; int e[2] =3D {0,0}; + char scratch[512]; =20 epia_connect(pi); for (j=3D0;j<2;j++) { diff --git a/drivers/ata/pata_parport/friq.c b/drivers/ata/pata_parport/fri= q.c index df15b210f355..1888e8bcb884 100644 --- a/drivers/ata/pata_parport/friq.c +++ b/drivers/ata/pata_parport/friq.c @@ -178,10 +178,11 @@ static void friq_disconnect(struct pi_adapter *pi) w2(pi->saved_r2); }=20 =20 -static int friq_test_proto(struct pi_adapter *pi, char *scratch) +static int friq_test_proto(struct pi_adapter *pi) =20 { int j, k, r; int e[2] =3D {0,0}; + char scratch[512]; =20 pi->saved_r0 =3D r0();=09 w0(0xff); udelay(20); CMD(0x3d); /* turn the power on */ diff --git a/drivers/ata/pata_parport/frpw.c b/drivers/ata/pata_parport/frp= w.c index 0d4e84806350..484b5b9d31eb 100644 --- a/drivers/ata/pata_parport/frpw.c +++ b/drivers/ata/pata_parport/frpw.c @@ -219,10 +219,11 @@ static int frpw_test_pnp(struct pi_adapter *pi) a hack :-( */ =20 -static int frpw_test_proto(struct pi_adapter *pi, char *scratch) +static int frpw_test_proto(struct pi_adapter *pi) =20 { int j, k, r; int e[2] =3D {0,0}; + char scratch[512]; =20 if ((pi->private>>1) !=3D pi->port) pi->private =3D frpw_test_pnp(pi) + 2*pi->port; diff --git a/drivers/ata/pata_parport/pata_parport.c b/drivers/ata/pata_par= port/pata_parport.c index 27aa2419af02..77a3e5a3f062 100644 --- a/drivers/ata/pata_parport/pata_parport.c +++ b/drivers/ata/pata_parport/pata_parport.c @@ -276,7 +276,7 @@ static void pi_release(struct pi_adapter *pi) module_put(pi->proto->owner); } =20 -static int default_test_proto(struct pi_adapter *pi, char *scratch) +static int default_test_proto(struct pi_adapter *pi) { int j, k; int e[2] =3D { 0, 0 }; @@ -300,21 +300,21 @@ static int default_test_proto(struct pi_adapter *pi, = char *scratch) return e[0] && e[1]; /* not here if both > 0 */ } =20 -static int pi_test_proto(struct pi_adapter *pi, char *scratch) +static int pi_test_proto(struct pi_adapter *pi) { int res; =20 parport_claim_or_block(pi->pardev); if (pi->proto->test_proto) - res =3D pi->proto->test_proto(pi, scratch); + res =3D pi->proto->test_proto(pi); else - res =3D default_test_proto(pi, scratch); + res =3D default_test_proto(pi); parport_release(pi->pardev); =20 return res; } =20 -static bool pi_probe_mode(struct pi_adapter *pi, int max, char *scratch) +static bool pi_probe_mode(struct pi_adapter *pi, int max) { int best, range; =20 @@ -326,7 +326,7 @@ static bool pi_probe_mode(struct pi_adapter *pi, int ma= x, char *scratch) range =3D 8; if (range =3D=3D 8 && pi->port % 8) return false; - return !pi_test_proto(pi, scratch); + return !pi_test_proto(pi); } best =3D -1; for (pi->mode =3D 0; pi->mode < max; pi->mode++) { @@ -335,14 +335,14 @@ static bool pi_probe_mode(struct pi_adapter *pi, int = max, char *scratch) range =3D 8; if (range =3D=3D 8 && pi->port % 8) break; - if (!pi_test_proto(pi, scratch)) + if (!pi_test_proto(pi)) best =3D pi->mode; } pi->mode =3D best; return best > -1; } =20 -static bool pi_probe_unit(struct pi_adapter *pi, int unit, char *scratch) +static bool pi_probe_unit(struct pi_adapter *pi, int unit) { int max, s, e; =20 @@ -367,14 +367,14 @@ static bool pi_probe_unit(struct pi_adapter *pi, int = unit, char *scratch) for (pi->unit =3D s; pi->unit < e; pi->unit++) { if (pi->proto->probe_unit(pi)) { parport_release(pi->pardev); - return pi_probe_mode(pi, max, scratch); + return pi_probe_mode(pi, max); } } parport_release(pi->pardev); return false; } =20 - return pi_probe_mode(pi, max, scratch); + return pi_probe_mode(pi, max); } =20 static void pata_parport_dev_release(struct device *dev) @@ -419,7 +419,6 @@ static struct pi_adapter *pi_init_one(struct parport *p= arport, struct pi_protocol *pr, int mode, int unit, int delay) { struct pardev_cb par_cb =3D { }; - char scratch[512]; const struct ata_port_info *ppi[] =3D { &pata_parport_port_info }; struct ata_host *host; struct pi_adapter *pi; @@ -469,7 +468,7 @@ static struct pi_adapter *pi_init_one(struct parport *p= arport, if (!pi->pardev) goto out_module_put; =20 - if (!pi_probe_unit(pi, unit, scratch)) { + if (!pi_probe_unit(pi, unit)) { dev_info(&pi->dev, "Adapter not found\n"); goto out_unreg_parport; } diff --git a/include/linux/pata_parport.h b/include/linux/pata_parport.h index e45bb1896003..bbfa4e63ee85 100644 --- a/include/linux/pata_parport.h +++ b/include/linux/pata_parport.h @@ -67,7 +67,7 @@ struct pi_protocol { =20 int (*test_port)(struct pi_adapter *pi); int (*probe_unit)(struct pi_adapter *pi); - int (*test_proto)(struct pi_adapter *pi, char *scratch); + int (*test_proto)(struct pi_adapter *pi); void (*log_adapter)(struct pi_adapter *pi); =20 int (*init_proto)(struct pi_adapter *pi); --=20 Ondrej Zary