From: Ondrej Zary <linux@zary.sk>
To: Damien Le Moal <damien.lemoal@opensource.wdc.com>,
Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Cc: Christoph Hellwig <hch@lst.de>,
Sergey Shtylyov <s.shtylyov@omp.ru>, Jens Axboe <axboe@kernel.dk>,
Tim Waugh <tim@cyberelk.net>,
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 [thread overview]
Message-ID: <20230307224627.28011-33-linux@zary.sk> (raw)
In-Reply-To: <20230307224627.28011-1-linux@zary.sk>
Reverse error handling conditions to reduce code indents in bpck6_open.
Signed-off-by: Ondrej Zary <linux@zary.sk>
---
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);
--
Ondrej Zary
next prev parent reply other threads:[~2023-03-07 22:49 UTC|newest]
Thread overview: 55+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-07 22:45 [PATCH 00/32] pata_parport-bpck6: rework bpck6 protocol driver Ondrej Zary
2023-03-07 22:45 ` [PATCH 01/32] pata_parport-bpck6: remove useless defines Ondrej Zary
2023-03-08 10:28 ` Sergei Shtylyov
2023-03-07 22:45 ` [PATCH 02/32] pata_parport-bpck6: remove useless range check from read/write_regr Ondrej Zary
2023-03-08 18:03 ` Sergey Shtylyov
2023-03-07 22:45 ` [PATCH 03/32] pata_parport-bpck6: don't cast pi->pardev to struct pardevice * Ondrej Zary
2023-03-08 18:15 ` Sergey Shtylyov
2023-03-07 22:45 ` [PATCH 04/32] pata_parport-bpck6: pass around struct pi_adapter * Ondrej Zary
2023-03-08 20:33 ` Sergey Shtylyov
2023-03-09 20:58 ` Ondrej Zary
2023-03-10 10:19 ` Sergey Shtylyov
2023-03-08 20:34 ` Sergey Shtylyov
2023-03-07 22:46 ` [PATCH 05/32] pata_parport-bpck6: remove lpt_addr from struct ppc_storage Ondrej Zary
2023-03-11 15:43 ` Sergey Shtylyov
2023-03-07 22:46 ` [PATCH 06/32] pata_parport-bpck6: remove ppc_id " Ondrej Zary
2023-03-08 20:41 ` Sergey Shtylyov
2023-03-07 22:46 ` [PATCH 07/32] pata_parport-bpck6: remove org_* " Ondrej Zary
2023-03-08 20:43 ` Sergey Shtylyov
2023-03-07 22:46 ` [PATCH 08/32] pata_parport-bpck6: remove mode " Ondrej Zary
2023-03-11 17:07 ` Sergey Shtylyov
2023-03-07 22:46 ` [PATCH 09/32] pata_parport-bpck6: remove " Ondrej Zary
2023-03-11 19:30 ` Sergey Shtylyov
2023-03-07 22:46 ` [PATCH 10/32] pata_parport-bpck6: remove parallel port bit defines Ondrej Zary
2023-03-07 22:46 ` [PATCH 11/32] parport_pc: add 16-bit and 8-bit fast EPP transfer flags Ondrej Zary
2023-03-11 20:09 ` Sergey Shtylyov
2023-03-11 20:31 ` Sergey Shtylyov
2023-03-07 22:46 ` [PATCH 12/32] pata_parport-bpck6: use parport access functions instead of port I/O Ondrej Zary
2023-03-07 22:46 ` [PATCH 13/32] pata_parport-bpck6: use parport_frob_control and remove CUR_CTRL Ondrej Zary
2023-03-07 22:46 ` [PATCH 14/32] pata_parport-bpck6: remove PPC_FLAGS Ondrej Zary
2023-03-11 20:12 ` Sergey Shtylyov
2023-03-07 22:46 ` [PATCH 15/32] pata_parport-bpck6: remove ppc6_close Ondrej Zary
2023-03-07 22:46 ` [PATCH 16/32] pata_parport-bpck6: merge ppc6_rd_port into bpck6_read_regr Ondrej Zary
2023-03-07 22:46 ` [PATCH 17/32] pata_parport-bpck6: merge ppc6_wr_port into bpck6_write_regr Ondrej Zary
2023-03-07 22:46 ` [PATCH 18/32] pata_parport-bpck6: merge ppc6_rd_port16_blk into bpck6_read_block Ondrej Zary
2023-03-07 22:46 ` [PATCH 19/32] pata_parport-bpck6: merge ppc6_wr_port16_blk into bpck6_write_block Ondrej Zary
2023-03-07 22:46 ` [PATCH 20/32] pata_parport-bpck6: merge ppc6_rd_data_blk into bpck6_read_block Ondrej Zary
2023-03-07 22:46 ` [PATCH 21/32] pata_parport-bpck6: merge ppc6_wr_data_blk into bpck6_write_block Ondrej Zary
2023-03-07 22:46 ` [PATCH 22/32] pata_parport-bpck6: move ppc6_wait_for_fifo to bpck6.c and rename Ondrej Zary
2023-03-07 22:46 ` [PATCH 23/32] pata_parport-bpck6: move ppc6_wr_extout " Ondrej Zary
2023-03-07 22:46 ` [PATCH 24/32] pata_parport-bpck6: move ppc6_open " Ondrej Zary
2023-03-07 22:46 ` [PATCH 25/32] pata_parport-bpck6: merge ppc6_select into bpck6_open Ondrej Zary
2023-03-07 22:46 ` [PATCH 26/32] pata_parport-bpck6: move ppc6_deselect to bpck6.c and rename Ondrej Zary
2023-03-07 22:46 ` [PATCH 27/32] pata_parport-bpck6: move ppc6_send_cmd " Ondrej Zary
2023-03-07 22:46 ` [PATCH 28/32] pata_parport-bpck6: move ppc6_rd_data_byte " Ondrej Zary
2023-03-07 22:46 ` [PATCH 29/32] pata_parport-bpck6: move ppc6_wr_data_byte " Ondrej Zary
2023-03-07 22:46 ` [PATCH 30/32] pata_parport-bpck6: move defines and mode_map to bpck6.c Ondrej Zary
2023-03-07 22:46 ` [PATCH 31/32] pata_parport-bpck6: delete ppc6lnx.c Ondrej Zary
2023-03-11 20:15 ` Sergey Shtylyov
2023-03-07 22:46 ` Ondrej Zary [this message]
2023-03-11 20:00 ` [PATCH 00/32] pata_parport-bpck6: rework bpck6 protocol driver Sergey Shtylyov
2023-03-18 18:55 ` Ondrej Zary
2023-03-19 20:02 ` Sergey Shtylyov
2023-03-22 12:10 ` Ondrej Zary
2023-03-22 22:34 ` Damien Le Moal
2023-03-26 9:08 ` Sudip Mukherjee
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230307224627.28011-33-linux@zary.sk \
--to=linux@zary.sk \
--cc=axboe@kernel.dk \
--cc=damien.lemoal@opensource.wdc.com \
--cc=hch@lst.de \
--cc=linux-block@vger.kernel.org \
--cc=linux-ide@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-parport@lists.infradead.org \
--cc=s.shtylyov@omp.ru \
--cc=sudipm.mukherjee@gmail.com \
--cc=tim@cyberelk.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).