linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bart Van Assche <bvanassche@acm.org>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Christoph Hellwig <hch@lst.de>,
	"Martin K . Petersen" <martin.petersen@oracle.com>,
	linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org,
	Bart Van Assche <bvanassche@acm.org>,
	Russell King <rmk+kernel@armlinux.org.uk>
Subject: [PATCH 7/9] arm/ecard: Use get_unaligned_le{16,24}()
Date: Mon, 28 Oct 2019 13:06:58 -0700	[thread overview]
Message-ID: <20191028200700.213753-8-bvanassche@acm.org> (raw)
In-Reply-To: <20191028200700.213753-1-bvanassche@acm.org>

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 --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


  parent reply	other threads:[~2019-10-28 20:07 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-28 20:06 [PATCH 0/9] Consolidate {get,put}_unaligned_[bl]e24() definitions Bart Van Assche
2019-10-28 20:06 ` [PATCH 1/9] linux/unaligned/byteshift.h: Remove superfluous casts Bart Van Assche
2019-10-28 20:06 ` [PATCH 2/9] c6x: Include <linux/unaligned/generic.h> instead of duplicating it Bart Van Assche
2019-11-07  3:09   ` Bart Van Assche
2019-11-07 13:54   ` Mark Salter
2019-10-28 20:06 ` [PATCH 3/9] treewide: Consolidate {get,put}_unaligned_[bl]e24() definitions Bart Van Assche
2019-10-28 20:06 ` [PATCH 4/9] drivers/iio: Sign extend without triggering implementation-defined behavior Bart Van Assche
2019-10-30 19:43   ` Jonathan Cameron
2019-10-30 20:02   ` Peter Zijlstra
2019-10-30 22:13     ` Douglas Gilbert
2019-10-31 17:55       ` Bart Van Assche
2019-10-28 20:06 ` [PATCH 5/9] scsi/st: Use get_unaligned_signed_be24() Bart Van Assche
2019-10-28 20:06 ` [PATCH 6/9] scsi/trace: Use get_unaligned_be*() Bart Van Assche
2019-10-28 20:06 ` Bart Van Assche [this message]
2019-10-28 20:06 ` [PATCH 8/9] IB/qib: Sign extend without triggering implementation-defined behavior Bart Van Assche
2019-10-28 20:07 ` [PATCH 9/9] ASoC/fsl_spdif: Use put_unaligned_be24() instead of open-coding it Bart Van Assche
2019-10-28 20:24   ` Mark Brown
2019-10-28 20:49     ` Bart Van Assche
2019-10-28 21:52 ` [PATCH 0/9] Consolidate {get,put}_unaligned_[bl]e24() definitions Peter Zijlstra
2019-10-28 22:02   ` Bart Van Assche
2019-10-29  1:10 ` Douglas Gilbert

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=20191028200700.213753-8-bvanassche@acm.org \
    --to=bvanassche@acm.org \
    --cc=hch@lst.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=rmk+kernel@armlinux.org.uk \
    --cc=tglx@linutronix.de \
    /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).