[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20191028200700.213753-8-bvanassche@acm.org>
Date: Mon, 28 Oct 2019 13:06:58 -0700
From: Bart Van Assche <bvanassche@....org>
To: Peter Zijlstra <peterz@...radead.org>
Cc: Ingo Molnar <mingo@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>,
Christoph Hellwig <hch@....de>,
"Martin K . Petersen" <martin.petersen@...cle.com>,
linux-kernel@...r.kernel.org, linux-scsi@...r.kernel.org,
Bart Van Assche <bvanassche@....org>,
Russell King <rmk+kernel@...linux.org.uk>
Subject: [PATCH 7/9] arm/ecard: Use get_unaligned_le{16,24}()
Use these functions instead of open-coding them.
Cc: Russell King <rmk+kernel@...linux.org.uk>
Signed-off-by: Bart Van Assche <bvanassche@....org>
---
arch/arm/mach-rpc/ecard.c | 18 ++++--------------
1 file changed, 4 insertions(+), 14 deletions(-)
diff --git a/arch/arm/mach-rpc/ecard.c b/arch/arm/mach-rpc/ecard.c
index 75cfad2cb143..4db4ef085fcb 100644
--- a/arch/arm/mach-rpc/ecard.c
+++ b/arch/arm/mach-rpc/ecard.c
@@ -89,16 +89,6 @@ ecard_loader_reset(unsigned long base, loader_t loader);
asmlinkage extern int
ecard_loader_read(int off, unsigned long base, loader_t loader);
-static inline unsigned short ecard_getu16(unsigned char *v)
-{
- return v[0] | v[1] << 8;
-}
-
-static inline signed long ecard_gets24(unsigned char *v)
-{
- return v[0] | v[1] << 8 | v[2] << 16 | ((v[2] & 0x80) ? 0xff000000 : 0);
-}
-
static inline ecard_t *slot_to_ecard(unsigned int slot)
{
return slot < MAX_ECARDS ? slot_to_expcard[slot] : NULL;
@@ -915,13 +905,13 @@ static int __init ecard_probe(int slot, unsigned irq, card_type_t type)
ec->cid.cd = cid.r_cd;
ec->cid.is = cid.r_is;
ec->cid.w = cid.r_w;
- ec->cid.manufacturer = ecard_getu16(cid.r_manu);
- ec->cid.product = ecard_getu16(cid.r_prod);
+ ec->cid.manufacturer = get_unaligned_le16(cid.r_manu);
+ ec->cid.product = get_unaligned_le16(cid.r_prod);
ec->cid.country = cid.r_country;
ec->cid.irqmask = cid.r_irqmask;
- ec->cid.irqoff = ecard_gets24(cid.r_irqoff);
+ ec->cid.irqoff = get_unaligned_le24_sign_extend(cid.r_irqoff);
ec->cid.fiqmask = cid.r_fiqmask;
- ec->cid.fiqoff = ecard_gets24(cid.r_fiqoff);
+ ec->cid.fiqoff = get_unaligned_le24_sign_extend(cid.r_fiqoff);
ec->fiqaddr =
ec->irqaddr = addr;
--
2.24.0.rc0.303.g954a862665-goog
Powered by blists - more mailing lists