From: "George Spelvin" <linux-gpGsJRJZ3PBBDgjK7y7TUQ@public.gmane.org>
To: linux-gpGsJRJZ3PBBDgjK7y7TUQ@public.gmane.org,
pavel-+ZI9xUNit7I@public.gmane.org
Cc: arik-Ix1uc/W3ht7QT0dZR+AlfA@public.gmane.org,
david.gnedt-rFfgOQFw6VLk7+2FdBfRIA@public.gmane.org,
eliad-Ix1uc/W3ht7QT0dZR+AlfA@public.gmane.org,
jan.nikitenko-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
laurent.pinchart+renesas-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-mmc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-wireless-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linville-2XuSBdqkA4R54TAoqtyWWQ@public.gmane.org,
luca-XPOmlcxoEMv1KXRcyAk9cg@public.gmane.org,
tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org
Subject: [PATCH 2/3] drivers/mmc/host/mmc_spi.c: Use get/put_unaligned_be32
Date: 11 May 2014 06:05:02 -0400 [thread overview]
Message-ID: <20140511100502.1491.qmail@ns.horizon.com> (raw)
In-Reply-To: <20140511100211.1334.qmail-HzZAx2gCgqrSUeElwK9/Pw@public.gmane.org>
Very minor source and binary size reduction.
Signed-off-by: George Spelvin <linux-gpGsJRJZ3PBBDgjK7y7TUQ@public.gmane.org>
---
I spotted this while making the previous crc7 change.
This looks simple enough, but I don't actually have one of these devices to test.
At least one other careful desk-check is solicited.
drivers/mmc/host/mmc_spi.c | 18 ++++++------------
1 file changed, 6 insertions(+), 12 deletions(-)
diff --git a/drivers/mmc/host/mmc_spi.c b/drivers/mmc/host/mmc_spi.c
index 338e2202ea..cc8d4a6099 100644
--- a/drivers/mmc/host/mmc_spi.c
+++ b/drivers/mmc/host/mmc_spi.c
@@ -448,7 +448,6 @@ mmc_spi_command_send(struct mmc_spi_host *host,
{
struct scratch *data = host->data;
u8 *cp = data->status;
- u32 arg = cmd->arg;
int status;
struct spi_transfer *t;
@@ -465,14 +464,12 @@ mmc_spi_command_send(struct mmc_spi_host *host,
* We init the whole buffer to all-ones, which is what we need
* to write while we're reading (later) response data.
*/
- memset(cp++, 0xff, sizeof(data->status));
+ memset(cp, 0xff, sizeof(data->status));
- *cp++ = 0x40 | cmd->opcode;
- *cp++ = (u8)(arg >> 24);
- *cp++ = (u8)(arg >> 16);
- *cp++ = (u8)(arg >> 8);
- *cp++ = (u8)arg;
- *cp++ = crc7_be(0, &data->status[1], 5) | 0x01;
+ cp[1] = 0x40 | cmd->opcode;
+ put_unaligned_be32(cmd->arg, cp+2);
+ cp[6] = crc7_be(0, cp+1, 5) | 0x01;
+ cp += 7;
/* Then, read up to 13 bytes (while writing all-ones):
* - N(CR) (== 1..8) bytes of all-ones
@@ -711,10 +708,7 @@ mmc_spi_writeblock(struct mmc_spi_host *host, struct spi_transfer *t,
* so we have to cope with this situation and check the response
* bit-by-bit. Arggh!!!
*/
- pattern = scratch->status[0] << 24;
- pattern |= scratch->status[1] << 16;
- pattern |= scratch->status[2] << 8;
- pattern |= scratch->status[3];
+ pattern = get_unaligned_be32(scratch->status);
/* First 3 bit of pattern are undefined */
pattern |= 0xE0000000;
--
1.9.2
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2014-05-11 10:05 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20140511082811.GA2695@xo-6d-61-c0.localdomain>
2014-05-11 10:02 ` [PATCH v2 1/3] lib/crc7: Shift crc7() output left 1 bit George Spelvin
[not found] ` <20140511100211.1334.qmail-HzZAx2gCgqrSUeElwK9/Pw@public.gmane.org>
2014-05-11 10:05 ` George Spelvin [this message]
[not found] ` <20140511100502.1491.qmail-HzZAx2gCgqrSUeElwK9/Pw@public.gmane.org>
2014-05-11 10:33 ` [PATCH 2/3] drivers/mmc/host/mmc_spi.c: Use get/put_unaligned_be32 Pavel Machek
2014-05-14 10:17 ` Ulf Hansson
2014-05-14 12:23 ` George Spelvin
[not found] ` <20140514122357.11052.qmail-HzZAx2gCgqrSUeElwK9/Pw@public.gmane.org>
2014-05-14 12:30 ` Ulf Hansson
2014-05-14 14:50 ` John W. Linville
2014-05-12 8:05 ` Geert Uytterhoeven
2014-05-11 10:07 ` [PATCH 3/3] drivers/net/wireless/ti/wl*/spi.c: Simplify CRC computation George Spelvin
[not found] ` <20140511100743.1712.qmail-HzZAx2gCgqrSUeElwK9/Pw@public.gmane.org>
2014-05-11 10:36 ` Pavel Machek
2014-05-11 10:32 ` [PATCH v2 1/3] lib/crc7: Shift crc7() output left 1 bit Pavel Machek
2014-05-14 10:14 ` Ulf Hansson
2014-05-15 0:37 ` H. Peter Anvin
2014-05-15 1:15 ` George Spelvin
2014-05-15 1:26 ` H. Peter Anvin
2014-05-15 2:02 ` George Spelvin
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=20140511100502.1491.qmail@ns.horizon.com \
--to=linux-gpgsjrjz3pbbdgjk7y7tuq@public.gmane.org \
--cc=arik-Ix1uc/W3ht7QT0dZR+AlfA@public.gmane.org \
--cc=david.gnedt-rFfgOQFw6VLk7+2FdBfRIA@public.gmane.org \
--cc=eliad-Ix1uc/W3ht7QT0dZR+AlfA@public.gmane.org \
--cc=jan.nikitenko-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=laurent.pinchart+renesas-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-mmc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-wireless-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linville-2XuSBdqkA4R54TAoqtyWWQ@public.gmane.org \
--cc=luca-XPOmlcxoEMv1KXRcyAk9cg@public.gmane.org \
--cc=pavel-+ZI9xUNit7I@public.gmane.org \
--cc=tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org \
/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).