From: "Andreas Bießmann" <andreas.devel@googlemail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 4/4] mmc: atmel: Zap global 'initialized' variable
Date: Sat, 24 Oct 2015 01:00:47 +0200 [thread overview]
Message-ID: <562ABC1F.4070204@googlemail.com> (raw)
In-Reply-To: <1445625991-5343-4-git-send-email-marex@denx.de>
On 23.10.15 20:46, Marek Vasut wrote:
> Global variables are bad. Get rid of this particular one, so we can
> correctly instantiate multiple atmel mci interfaces, without having
> them interfere with one another.
>
> Signed-off-by: Marek Vasut <marex@denx.de>
Reviewed-by: Andreas Bie?mann <andreas.devel@googlemail.com>
> ---
> drivers/mmc/gen_atmel_mci.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/mmc/gen_atmel_mci.c b/drivers/mmc/gen_atmel_mci.c
> index abc77cc..9a0332f 100644
> --- a/drivers/mmc/gen_atmel_mci.c
> +++ b/drivers/mmc/gen_atmel_mci.c
> @@ -35,10 +35,9 @@
> struct atmel_mci_priv {
> struct mmc_config cfg;
> struct atmel_mci *mci;
> + unsigned int initialized:1;
> };
>
> -static int initialized = 0;
> -
> /* Read Atmel MCI IP version */
> static unsigned int atmel_mci_get_version(struct atmel_mci *mci)
> {
> @@ -121,7 +120,7 @@ static void mci_set_mode(struct mmc *mmc, u32 hz, u32 blklen)
>
> udelay(50);
>
> - initialized = 1;
> + priv->initialized = 1;
> }
>
> /* Return the CMDR with flags for a given command and data packet */
> @@ -210,7 +209,7 @@ mci_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, struct mmc_data *data)
> u32 error_flags = 0;
> u32 status;
>
> - if (!initialized) {
> + if (!priv->initialized) {
> puts ("MCI not initialized!\n");
> return COMM_ERR;
> }
> @@ -415,6 +414,7 @@ int atmel_mci_init(void *regs)
> cfg->ops = &atmel_mci_ops;
>
> priv->mci = (struct atmel_mci *)regs;
> + priv->initialized = 0;
>
> /* need to be able to pass these in on a board by board basis */
> cfg->voltages = MMC_VDD_32_33 | MMC_VDD_33_34;
>
next prev parent reply other threads:[~2015-10-23 23:00 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-23 18:46 [U-Boot] [PATCH 1/4] mmc: atmel: Silence debug output Marek Vasut
2015-10-23 18:46 ` [U-Boot] [PATCH 2/4] mmc: atmel: Fix clock configuration Marek Vasut
2015-10-23 22:49 ` Andreas Bießmann
2015-11-01 21:02 ` [U-Boot] [U-Boot,2/4] " Andreas Bießmann
2015-10-23 18:46 ` [U-Boot] [PATCH 3/4] mmc: atmel: Implement proper private data Marek Vasut
2015-10-23 22:59 ` Andreas Bießmann
2015-10-23 23:29 ` Marek Vasut
2015-10-24 8:35 ` Andreas Bießmann
2015-10-24 12:52 ` Marek Vasut
2015-11-01 21:03 ` [U-Boot] [U-Boot, " Andreas Bießmann
2015-10-23 18:46 ` [U-Boot] [PATCH 4/4] mmc: atmel: Zap global 'initialized' variable Marek Vasut
2015-10-23 23:00 ` Andreas Bießmann [this message]
2015-11-01 21:03 ` [U-Boot] [U-Boot, " Andreas Bießmann
2015-10-23 22:48 ` [U-Boot] [PATCH 1/4] mmc: atmel: Silence debug output Andreas Bießmann
2015-11-01 21:02 ` [U-Boot] [U-Boot,1/4] " Andreas Bießmann
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=562ABC1F.4070204@googlemail.com \
--to=andreas.devel@googlemail.com \
--cc=u-boot@lists.denx.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