mmc: core: add proper be32 annotation
Annotate big endian values correctly and make sparse happy. In mmc_app_send_scr remove scr function parameter as it was updating card->raw_scr anyway. Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
This commit is contained in:
parent
861183f115
commit
06c9ccb78e
|
@ -305,7 +305,7 @@ mmc_send_cxd_data(struct mmc_card *card, struct mmc_host *host,
|
||||||
int mmc_send_csd(struct mmc_card *card, u32 *csd)
|
int mmc_send_csd(struct mmc_card *card, u32 *csd)
|
||||||
{
|
{
|
||||||
int ret, i;
|
int ret, i;
|
||||||
u32 *csd_tmp;
|
__be32 *csd_tmp;
|
||||||
|
|
||||||
if (!mmc_host_is_spi(card->host))
|
if (!mmc_host_is_spi(card->host))
|
||||||
return mmc_send_cxd_native(card->host, card->rca << 16,
|
return mmc_send_cxd_native(card->host, card->rca << 16,
|
||||||
|
@ -330,7 +330,7 @@ int mmc_send_csd(struct mmc_card *card, u32 *csd)
|
||||||
int mmc_send_cid(struct mmc_host *host, u32 *cid)
|
int mmc_send_cid(struct mmc_host *host, u32 *cid)
|
||||||
{
|
{
|
||||||
int ret, i;
|
int ret, i;
|
||||||
u32 *cid_tmp;
|
__be32 *cid_tmp;
|
||||||
|
|
||||||
if (!mmc_host_is_spi(host)) {
|
if (!mmc_host_is_spi(host)) {
|
||||||
if (!host->card)
|
if (!host->card)
|
||||||
|
|
|
@ -225,7 +225,7 @@ static int mmc_decode_scr(struct mmc_card *card)
|
||||||
static int mmc_read_ssr(struct mmc_card *card)
|
static int mmc_read_ssr(struct mmc_card *card)
|
||||||
{
|
{
|
||||||
unsigned int au, es, et, eo;
|
unsigned int au, es, et, eo;
|
||||||
u32 *raw_ssr;
|
__be32 *raw_ssr;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (!(card->csd.cmdclass & CCC_APP_SPEC)) {
|
if (!(card->csd.cmdclass & CCC_APP_SPEC)) {
|
||||||
|
@ -853,7 +853,7 @@ int mmc_sd_setup_card(struct mmc_host *host, struct mmc_card *card,
|
||||||
/*
|
/*
|
||||||
* Fetch SCR from card.
|
* Fetch SCR from card.
|
||||||
*/
|
*/
|
||||||
err = mmc_app_send_scr(card, card->raw_scr);
|
err = mmc_app_send_scr(card);
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
|
|
|
@ -232,14 +232,14 @@ int mmc_send_relative_addr(struct mmc_host *host, unsigned int *rca)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int mmc_app_send_scr(struct mmc_card *card, u32 *scr)
|
int mmc_app_send_scr(struct mmc_card *card)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
struct mmc_request mrq = {};
|
struct mmc_request mrq = {};
|
||||||
struct mmc_command cmd = {};
|
struct mmc_command cmd = {};
|
||||||
struct mmc_data data = {};
|
struct mmc_data data = {};
|
||||||
struct scatterlist sg;
|
struct scatterlist sg;
|
||||||
void *data_buf;
|
__be32 *scr;
|
||||||
|
|
||||||
/* NOTE: caller guarantees scr is heap-allocated */
|
/* NOTE: caller guarantees scr is heap-allocated */
|
||||||
|
|
||||||
|
@ -250,8 +250,8 @@ int mmc_app_send_scr(struct mmc_card *card, u32 *scr)
|
||||||
/* dma onto stack is unsafe/nonportable, but callers to this
|
/* dma onto stack is unsafe/nonportable, but callers to this
|
||||||
* routine normally provide temporary on-stack buffers ...
|
* routine normally provide temporary on-stack buffers ...
|
||||||
*/
|
*/
|
||||||
data_buf = kmalloc(sizeof(card->raw_scr), GFP_KERNEL);
|
scr = kmalloc(sizeof(card->raw_scr), GFP_KERNEL);
|
||||||
if (data_buf == NULL)
|
if (!scr)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
mrq.cmd = &cmd;
|
mrq.cmd = &cmd;
|
||||||
|
@ -267,23 +267,22 @@ int mmc_app_send_scr(struct mmc_card *card, u32 *scr)
|
||||||
data.sg = &sg;
|
data.sg = &sg;
|
||||||
data.sg_len = 1;
|
data.sg_len = 1;
|
||||||
|
|
||||||
sg_init_one(&sg, data_buf, 8);
|
sg_init_one(&sg, scr, 8);
|
||||||
|
|
||||||
mmc_set_data_timeout(&data, card);
|
mmc_set_data_timeout(&data, card);
|
||||||
|
|
||||||
mmc_wait_for_req(card->host, &mrq);
|
mmc_wait_for_req(card->host, &mrq);
|
||||||
|
|
||||||
memcpy(scr, data_buf, sizeof(card->raw_scr));
|
card->raw_scr[0] = be32_to_cpu(scr[0]);
|
||||||
kfree(data_buf);
|
card->raw_scr[1] = be32_to_cpu(scr[1]);
|
||||||
|
|
||||||
|
kfree(scr);
|
||||||
|
|
||||||
if (cmd.error)
|
if (cmd.error)
|
||||||
return cmd.error;
|
return cmd.error;
|
||||||
if (data.error)
|
if (data.error)
|
||||||
return data.error;
|
return data.error;
|
||||||
|
|
||||||
scr[0] = be32_to_cpu(scr[0]);
|
|
||||||
scr[1] = be32_to_cpu(scr[1]);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ int mmc_app_set_bus_width(struct mmc_card *card, int width);
|
||||||
int mmc_send_app_op_cond(struct mmc_host *host, u32 ocr, u32 *rocr);
|
int mmc_send_app_op_cond(struct mmc_host *host, u32 ocr, u32 *rocr);
|
||||||
int mmc_send_if_cond(struct mmc_host *host, u32 ocr);
|
int mmc_send_if_cond(struct mmc_host *host, u32 ocr);
|
||||||
int mmc_send_relative_addr(struct mmc_host *host, unsigned int *rca);
|
int mmc_send_relative_addr(struct mmc_host *host, unsigned int *rca);
|
||||||
int mmc_app_send_scr(struct mmc_card *card, u32 *scr);
|
int mmc_app_send_scr(struct mmc_card *card);
|
||||||
int mmc_sd_switch(struct mmc_card *card, int mode, int group,
|
int mmc_sd_switch(struct mmc_card *card, int mode, int group,
|
||||||
u8 value, u8 *resp);
|
u8 value, u8 *resp);
|
||||||
int mmc_app_sd_status(struct mmc_card *card, void *ssr);
|
int mmc_app_sd_status(struct mmc_card *card, void *ssr);
|
||||||
|
|
Loading…
Reference in New Issue