diff mbox series

[7/9] arm/ecard: Use get_unaligned_le{16,24}()

Message ID 20191028200700.213753-8-bvanassche@acm.org (mailing list archive)
State Not Applicable
Headers show
Series Consolidate {get,put}_unaligned_[bl]e24() definitions | expand

Commit Message

Bart Van Assche Oct. 28, 2019, 8:06 p.m. UTC
Use these functions instead of open-coding them.

Cc: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 arch/arm/mach-rpc/ecard.c | 18 ++++--------------
 1 file changed, 4 insertions(+), 14 deletions(-)
diff mbox series

Patch

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;