From: Igor Grinberg <grinberg@compulab.co.il>
To: u-boot@lists.denx.de
Subject: [U-Boot] Fwd: Re: [PATCH 2/3] env_mmc: support env partition setup in runtime
Date: Thu, 03 Jul 2014 11:36:49 +0300 [thread overview]
Message-ID: <53B51621.3060307@compulab.co.il> (raw)
In-Reply-To: <53AA7D53.4030405@compulab.co.il>
Hi Pantelis, Tom,
Apparently, Dmitry has sent the message in html format...
Resending now...
Sorry for that...
-------- Original Message --------
Subject: Re: [U-Boot] [PATCH 2/3] env_mmc: support env partition setup in runtime
Date: Wed, 25 Jun 2014 10:42:11 +0300
From: Dmitry Lifshitz <lifshitz@compulab.co.il>
To: Pantelis Antoniou <pantelis.antoniou@gmail.com>
CC: u-boot at lists.denx.de, Tom Rini <trini@ti.com>, Igor Grinberg <grinberg@compulab.co.il>
Hi Pantelis,
On 06/12/2014 06:10 PM, Pantelis Antoniou wrote:
> Hi Dmitry,
>
> I took a good look at the patch and there's a problem.
>
> On Apr 27, 2014, at 1:18 PM, Dmitry Lifshitz wrote:
>
>> Add callback with __weak annotation to allow setup of environment
>> partition number in runtime from a board file.
>>
>> Signed-off-by: Dmitry Lifshitz <lifshitz@compulab.co.il>
>> Signed-off-by: Igor Grinberg <grinberg@compulab.co.il>
>> ---
>> common/env_mmc.c | 35 ++++++++++++++++++++++++++---------
>> 1 files changed, 26 insertions(+), 9 deletions(-)
>>
>> diff --git a/common/env_mmc.c b/common/env_mmc.c
>> index 045428c..5d4b5f4 100644
>> --- a/common/env_mmc.c
>> +++ b/common/env_mmc.c
>> @@ -62,6 +62,30 @@ int env_init(void)
>> return 0;
>> }
>>
>> +
>> +#ifdef CONFIG_SYS_MMC_ENV_PART
>> +__weak uint mmc_get_env_part(struct mmc *mmc)
>> +{
>> + return CONFIG_SYS_MMC_ENV_PART;
>> +}
>> +
>> +static int mmc_set_env_part(struct mmc *mmc)
>> +{
>> + uint part = mmc_get_env_part(mmc);
>> +
>> + if (part != mmc->part_num) {
>> + if (mmc_switch_part(CONFIG_SYS_MMC_ENV_DEV, part)) {
>> + puts("MMC partition switch failed\n");
>> + return -1;
>> + }
>> + }
>> +
>> + return 0;
>> +}
>> +#else
>> +static inline int mmc_set_env_part(struct mmc *mmc) {return 0; };
>> +#endif
>> +
>> static int init_mmc_for_env(struct mmc *mmc)
>> {
>> if (!mmc) {
>> @@ -74,15 +98,8 @@ static int init_mmc_for_env(struct mmc *mmc)
>> return -1;
>> }
>>
> Just before this hunk, we have this:
>
>> #ifdef CONFIG_SYS_MMC_ENV_PART
>> int dev = CONFIG_SYS_MMC_ENV_DEV;
>>
>> #ifdef CONFIG_SPL_BUILD
>> dev = 0;
>> #endif
>> #endif
>>
> This appears to be broken for SPL in case that CONFIG_SYS_MMC_ENV_DEV is not 0.
Exactly as it was broken before the patch, right?
>
> SPL hardcoded dev to 0, while mmc_switch_part is implicitly operating on
> CONFIG_SYS_MMC_ENV_DEV.
>
> Please rework it so that the SPL case is unaffected.
This patch does not change the behavior and its purpose
is not fixing the current code.
The bug describe can be fixed by later patch and possibly
will require additional review and testing.
Given that this patch does not change the behavior, can it be accepted please ?
Regards,
Dmitry
>> -#ifdef CONFIG_SYS_MMC_ENV_PART
>> - if (CONFIG_SYS_MMC_ENV_PART != mmc->part_num) {
>> - if (mmc_switch_part(CONFIG_SYS_MMC_ENV_DEV,
>> - CONFIG_SYS_MMC_ENV_PART)) {
>> - puts("MMC partition switch failed\n");
>> - return -1;
>> - }
>> - }
>> -#endif
>> + if (mmc_set_env_part(mmc))
>> + return -1;
>>
>> return 0;
>> }
>> --
>> 1.7.5.4
>
>
next parent reply other threads:[~2014-07-03 8:36 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <53AA7D53.4030405@compulab.co.il>
2014-07-03 8:36 ` Igor Grinberg [this message]
2014-07-15 8:00 ` [U-Boot] Fwd: Re: [PATCH 2/3] env_mmc: support env partition setup in runtime Igor Grinberg
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=53B51621.3060307@compulab.co.il \
--to=grinberg@compulab.co.il \
--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