From: Ondrej Zary <linux@zary.sk>
To: Damien Le Moal <damien.lemoal@opensource.wdc.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 01/12] pata_parport: Remove pi_swab16 and pi_swab32
Date: Sat, 11 Feb 2023 15:42:21 +0100 [thread overview]
Message-ID: <20230211144232.15138-2-linux@zary.sk> (raw)
In-Reply-To: <20230211144232.15138-1-linux@zary.sk>
Convert comm and kbic drivers to use standard swab16.
Remove pi_swab16 and pi_swab32.
The funny thing: pi_swab32 was not swab32
Signed-off-by: Ondrej Zary <linux@zary.sk>
---
drivers/ata/pata_parport/comm.c | 7 +++++--
drivers/ata/pata_parport/kbic.c | 7 +++++--
include/linux/pata_parport.h | 17 -----------------
3 files changed, 10 insertions(+), 21 deletions(-)
diff --git a/drivers/ata/pata_parport/comm.c b/drivers/ata/pata_parport/comm.c
index 1775e7ed9336..11ed9fb57744 100644
--- a/drivers/ata/pata_parport/comm.c
+++ b/drivers/ata/pata_parport/comm.c
@@ -165,11 +165,14 @@ static void comm_write_block( PIA *pi, char * buf, int count )
break;
case 3: w3(0x48); (void)r1();
- for (k=0;k<count/2;k++) w4w(pi_swab16(buf,k));
+ for (k = 0; k < count / 2; k++)
+ w4w(swab16(((u16 *)buf)[k]));
break;
case 4: w3(0x48); (void)r1();
- for (k=0;k<count/4;k++) w4l(pi_swab32(buf,k));
+ for (k = 0; k < count / 4; k++)
+ w4l(swab16(((u16 *)buf)[2 * k]) |
+ swab16(((u16 *)buf)[2 * k + 1]) << 16);
break;
diff --git a/drivers/ata/pata_parport/kbic.c b/drivers/ata/pata_parport/kbic.c
index f0960eb68635..93430ca32a52 100644
--- a/drivers/ata/pata_parport/kbic.c
+++ b/drivers/ata/pata_parport/kbic.c
@@ -213,12 +213,15 @@ static void kbic_write_block( PIA *pi, char * buf, int count )
break;
case 4: w0(0xa0); w2(4); w2(6); w2(4); w3(0);
- for(k=0;k<count/2;k++) w4w(pi_swab16(buf,k));
+ for (k = 0; k < count / 2; k++)
+ w4w(swab16(((u16 *)buf)[k]));
w2(4); w2(0); w2(4);
break;
case 5: w0(0xa0); w2(4); w2(6); w2(4); w3(0);
- for(k=0;k<count/4;k++) w4l(pi_swab32(buf,k));
+ for (k = 0; k < count / 4; k++)
+ w4l(swab16(((u16 *)buf)[2 * k]) |
+ swab16(((u16 *)buf)[2 * k + 1]) << 16);
w2(4); w2(0); w2(4);
break;
diff --git a/include/linux/pata_parport.h b/include/linux/pata_parport.h
index 58781846f282..458544fe5e6c 100644
--- a/include/linux/pata_parport.h
+++ b/include/linux/pata_parport.h
@@ -54,23 +54,6 @@ typedef struct pi_adapter PIA; /* for paride protocol modules */
#define r4w() (delay_p, inw(pi->port + 4))
#define r4l() (delay_p, inl(pi->port + 4))
-static inline u16 pi_swab16(char *b, int k)
-{
- union { u16 u; char t[2]; } r;
-
- r.t[0] = b[2 * k + 1]; r.t[1] = b[2 * k];
- return r.u;
-}
-
-static inline u32 pi_swab32(char *b, int k)
-{
- union { u32 u; char f[4]; } r;
-
- r.f[0] = b[4 * k + 1]; r.f[1] = b[4 * k];
- r.f[2] = b[4 * k + 3]; r.f[3] = b[4 * k + 2];
- return r.u;
-}
-
struct pi_protocol {
char name[8];
--
Ondrej Zary
next prev parent reply other threads:[~2023-02-11 14:42 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-11 14:42 [PATCH 0/12] pata_parport: protocol drivers cleanups Ondrej Zary
2023-02-11 14:42 ` Ondrej Zary [this message]
2023-02-11 19:01 ` [PATCH 01/12] pata_parport: Remove pi_swab16 and pi_swab32 Sergey Shtylyov
2023-02-11 14:42 ` [PATCH 02/12] pata_parport: Introduce module_pata_parport_driver macro Ondrej Zary
2023-02-12 12:19 ` Sergey Shtylyov
2023-02-12 18:19 ` Ondrej Zary
2023-02-11 14:42 ` [PATCH 03/12] pata_parport: remove devtype from struct pi_adapter Ondrej Zary
2023-02-11 19:11 ` Sergey Shtylyov
2023-02-11 20:47 ` Ondrej Zary
2023-02-12 12:17 ` Damien Le Moal
2023-02-11 14:42 ` [PATCH 04/12] pata_parport: remove device " Ondrej Zary
2023-02-12 17:36 ` Sergey Shtylyov
2023-02-11 14:42 ` [PATCH 05/12] pata_parport: remove typedef struct PIA Ondrej Zary
2023-02-13 20:08 ` Sergey Shtylyov
2023-02-11 14:42 ` [PATCH 06/12] pata_parport: remove verbose parameter from log_adapter() Ondrej Zary
2023-02-11 20:43 ` Sergey Shtylyov
2023-02-11 14:42 ` [PATCH 07/12] pata_parport: remove scratch " Ondrej Zary
2023-02-12 17:14 ` Sergey Shtylyov
2023-02-11 14:42 ` [PATCH 08/12] pata_parport: use dev_* and print_hex_* instead of printk Ondrej Zary
2023-02-14 20:55 ` Sergei Shtylyov
2023-02-11 14:42 ` [PATCH 09/12] pata_parport: remove verbose parameter from test_proto() Ondrej Zary
2023-02-11 19:56 ` Sergey Shtylyov
2023-02-11 14:42 ` [PATCH 10/12] pata_parport: remove scratch " Ondrej Zary
2023-02-12 17:47 ` Sergey Shtylyov
2023-02-11 14:42 ` [PATCH 11/12] pata_parport: remove obsolete changelogs Ondrej Zary
2023-02-13 20:42 ` Sergey Shtylyov
2023-02-11 14:42 ` [PATCH 12/12] pata_parport: move pata_parport.h to drivers/ata/pata_parport Ondrej Zary
2023-02-13 20:51 ` Sergey Shtylyov
2023-02-11 20:59 ` [PATCH 0/12] pata_parport: protocol drivers cleanups Sergey Shtylyov
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=20230211144232.15138-2-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=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).