[PATCH 2/2 V2] MMC: cleanup endianity conversions and style problems | |
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] | |
This patch cleans up endianity conversions im mmc core
and style errors in the 'for' statements
Signed-off-by: Tomas Winkler <tomas.winkler@xxxxxxxxx>
---
drivers/mmc/card/block.c | 5 ++---
drivers/mmc/core/mmc_ops.c | 15 ++++++++-------
drivers/mmc/core/sd_ops.c | 7 ++++---
3 files changed, 14 insertions(+), 13 deletions(-)
diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
index 4b0f822..fbee07f 100644
--- a/drivers/mmc/card/block.c
+++ b/drivers/mmc/card/block.c
@@ -144,7 +144,7 @@ struct mmc_blk_request {
static u32 mmc_sd_num_wr_blocks(struct mmc_card *card)
{
int err;
- u32 blocks;
+ __be32 blocks;
struct mmc_request mrq;
struct mmc_command cmd;
@@ -203,9 +203,8 @@ static u32 mmc_sd_num_wr_blocks(struct mmc_card *card)
if (cmd.error || data.error)
return (u32)-1;
- blocks = ntohl(blocks);
- return blocks;
+ return be32_to_cpu(blocks);
}
static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req)
diff --git a/drivers/mmc/core/mmc_ops.c b/drivers/mmc/core/mmc_ops.c
index 64b05c6..8187aea 100644
--- a/drivers/mmc/core/mmc_ops.c
+++ b/drivers/mmc/core/mmc_ops.c
@@ -267,17 +267,18 @@ mmc_send_cxd_data(struct mmc_card *card, struct mmc_host *host,
int mmc_send_csd(struct mmc_card *card, u32 *csd)
{
int ret, i;
+ __be32 csd_buf[4];
if (!mmc_host_is_spi(card->host))
return mmc_send_cxd_native(card->host, card->rca << 16,
csd, MMC_SEND_CSD);
- ret = mmc_send_cxd_data(card, card->host, MMC_SEND_CSD, csd, 16);
+ ret = mmc_send_cxd_data(card, card->host, MMC_SEND_CSD, csd_buf, 16);
if (ret)
return ret;
- for (i = 0;i < 4;i++)
- csd[i] = be32_to_cpu(csd[i]);
+ for (i = 0; i < 4; i++)
+ csd[i] = be32_to_cpu(csd_buf[i]);
return 0;
}
@@ -285,7 +286,7 @@ int mmc_send_csd(struct mmc_card *card, u32 *csd)
int mmc_send_cid(struct mmc_host *host, u32 *cid)
{
int ret, i;
-
+ __be32 cid_buf[4];
if (!mmc_host_is_spi(host)) {
if (!host->card)
return -EINVAL;
@@ -293,12 +294,12 @@ int mmc_send_cid(struct mmc_host *host, u32 *cid)
cid, MMC_SEND_CID);
}
- ret = mmc_send_cxd_data(NULL, host, MMC_SEND_CID, cid, 16);
+ ret = mmc_send_cxd_data(NULL, host, MMC_SEND_CID, cid_buf, 16);
if (ret)
return ret;
- for (i = 0;i < 4;i++)
- cid[i] = be32_to_cpu(cid[i]);
+ for (i = 0; i < 4; i++)
+ cid[i] = be32_to_cpu(cid_buf[i]);
return 0;
}
diff --git a/drivers/mmc/core/sd_ops.c b/drivers/mmc/core/sd_ops.c
index 0d96080..7ef7b6c 100644
--- a/drivers/mmc/core/sd_ops.c
+++ b/drivers/mmc/core/sd_ops.c
@@ -254,6 +254,7 @@ int mmc_app_send_scr(struct mmc_card *card, u32 *scr)
struct mmc_command cmd;
struct mmc_data data;
struct scatterlist sg;
+ __be32 scr_buf[2];
BUG_ON(!card);
BUG_ON(!card->host);
@@ -282,7 +283,7 @@ int mmc_app_send_scr(struct mmc_card *card, u32 *scr)
data.sg = &sg;
data.sg_len = 1;
- sg_init_one(&sg, scr, 8);
+ sg_init_one(&sg, scr_buf, 8);
mmc_set_data_timeout(&data, card);
@@ -293,8 +294,8 @@ int mmc_app_send_scr(struct mmc_card *card, u32 *scr)
if (data.error)
return data.error;
- scr[0] = be32_to_cpu(scr[0]);
- scr[1] = be32_to_cpu(scr[1]);
+ scr[0] = be32_to_cpu(scr_buf[0]);
+ scr[1] = be32_to_cpu(scr_buf[1]);
return 0;
}
--
1.5.4.1
---------------------------------------------------------------------
Intel Israel (74) Limited
This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Site Home] [Other Archives] [Linux Kernel Newbies] [Linux Kernel Testers] [Linux SH] [Linux Omap] [Linux Kbuild] [Linux Tape] [Linux Input] [Linux Kernel Janitors] [Linux Doc] [Linux Man Pages] [Linux Standards] [Kernel Announce] [Memory] [Netdev] [Git] [Linux PCI] [NUMA] [Netfilter] [Netfilter Devel] [SELinux] [Bugtraq] [Writing Drivers] [Linux Serial] [Linux PPP] [Kernel MM Commits] [Linux Security Module] [Ext4] [Linux BTRFS] [Linux NFS] [Linux Cachefs] [Reiser FS] [Fastboot] [Linux RT Users] [Linux Virtualization] [LVS Devel] [KVM] [KVM PPC] [KVM ia64] [Linux Containers] [Util Linux NG] [Sk Drivers] [Wireless] [Linux Bluetooth] [Ethernet Bridging] [Embedded Linux] [Sparse] [Linux Arch] [Linux ACPI] [Linux IBM ACPI] [Linux OpenGL] [Linux Power Management] [Linux DCCP] [ALSA Devel] [Linux USB] [Large Format Photos] [DVD Store] [Tux] [Gimp] [Yosemite News] [Linux PA RISC] [MIPS Linux] [S390 Linux] [ARM Linux] [ARM Kernel] [Sparc Linux] [Linux Security] [Linux Sound] [Video 4 Linux] [Linux for the blind] [Linux IDE] [Linux RAID] [Linux SCSI] [Linux SMP] [Linux AXP] [Linux Alpha] [Linux M68K] [Linux ia64] [Linux 8086] [Linux x86_64] [Linux Apps] [Linux X.25] [Linux Crypto] [DM Crypt] [LInux Btrace] [Utrace Devel] [Yosemite Photos] [Linux Resources] [Older Kernel Mail]
![]() |
![]() |