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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Use these functions instead of open-coding them.

Cc: Russell King <rmk+kernel@xxxxxxxxxxxxxxx>
Signed-off-by: Bart Van Assche <bvanassche@xxxxxxx>
---
 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




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux