[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230218220138.5692-4-linux@zary.sk>
Date: Sat, 18 Feb 2023 23:01:23 +0100
From: Ondrej Zary <linux@...y.sk>
To: Damien Le Moal <damien.lemoal@...nsource.wdc.com>
Cc: Christoph Hellwig <hch@....de>,
Sergey Shtylyov <s.shtylyov@....ru>,
Jens Axboe <axboe@...nel.dk>, Tim Waugh <tim@...erelk.net>,
linux-block@...r.kernel.org, linux-parport@...ts.infradead.org,
linux-ide@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH 03/18] pata_parport: Remove pi_swab16 and pi_swab32
Convert comm and kbic drivers to use standard swab16.
Remove pi_swab16 and pi_swab32.
Reviewed-by: Sergey Shtylyov <s.shtylyov@....ru>
Signed-off-by: Ondrej Zary <linux@...y.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
Powered by blists - more mailing lists