diff mbox

[U-Boot,2/3] dfu: add static alt num count in dfu_config_entities()

Message ID 1396255729-6573-3-git-send-email-l.majewski@samsung.com
State Superseded
Delegated to: Marek Vasut
Headers show

Commit Message

Łukasz Majewski March 31, 2014, 8:48 a.m. UTC
From: Przemyslaw Marczak <p.marczak@samsung.com>

Thanks to this multiple calls of function dfu_config_entities() give continuous
dfu alt numbering until call dfu_free_entities().

This allows to store dfu entities in multiple env variables.

Change-Id: Ibca7e785bfca9f53b64d3dff0490185b06841b54
Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
---
 drivers/dfu/dfu.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

Marek Vasut March 31, 2014, 9:01 a.m. UTC | #1
On Monday, March 31, 2014 at 10:48:48 AM, Lukasz Majewski wrote:
> From: Przemyslaw Marczak <p.marczak@samsung.com>
> 
> Thanks to this multiple calls of function dfu_config_entities() give
> continuous dfu alt numbering until call dfu_free_entities().
> 
> This allows to store dfu entities in multiple env variables.
> 
> Change-Id: Ibca7e785bfca9f53b64d3dff0490185b06841b54
> Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
> ---
>  drivers/dfu/dfu.c |    6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/dfu/dfu.c b/drivers/dfu/dfu.c
> index f94c412..e15f959 100644
> --- a/drivers/dfu/dfu.c
> +++ b/drivers/dfu/dfu.c
> @@ -19,6 +19,7 @@
>  static bool dfu_reset_request;
>  static LIST_HEAD(dfu_list);
>  static int dfu_alt_num;
> +static int alt_num_count;

Can the variable name here be any less consistent with the rest ... ? ;-)

[...]

Best regards,
Marek Vasut
Łukasz Majewski March 31, 2014, 9:15 a.m. UTC | #2
Hi Marek,

> On Monday, March 31, 2014 at 10:48:48 AM, Lukasz Majewski wrote:
> > From: Przemyslaw Marczak <p.marczak@samsung.com>
> > 
> > Thanks to this multiple calls of function dfu_config_entities() give
> > continuous dfu alt numbering until call dfu_free_entities().
> > 
> > This allows to store dfu entities in multiple env variables.
> > 
> > Change-Id: Ibca7e785bfca9f53b64d3dff0490185b06841b54
> > Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
> > ---
> >  drivers/dfu/dfu.c |    6 +++++-
> >  1 file changed, 5 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/dfu/dfu.c b/drivers/dfu/dfu.c
> > index f94c412..e15f959 100644
> > --- a/drivers/dfu/dfu.c
> > +++ b/drivers/dfu/dfu.c
> > @@ -19,6 +19,7 @@
> >  static bool dfu_reset_request;
> >  static LIST_HEAD(dfu_list);
> >  static int dfu_alt_num;
> > +static int alt_num_count;
> 
> Can the variable name here be any less consistent with the
> rest ... ? ;-)

I think, that something like dfu_alt_num_cnt would fit better there.

> 
> [...]
> 
> Best regards,
> Marek Vasut
Przemyslaw Marczak April 1, 2014, 6:47 a.m. UTC | #3
Hello,
This code was applied to u-boot-samsung few weeks ago.

On 03/31/2014 11:15 AM, Lukasz Majewski wrote:
> Hi Marek,
>
>> On Monday, March 31, 2014 at 10:48:48 AM, Lukasz Majewski wrote:
>>> From: Przemyslaw Marczak <p.marczak@samsung.com>
>>>
>>> Thanks to this multiple calls of function dfu_config_entities() give
>>> continuous dfu alt numbering until call dfu_free_entities().
>>>
>>> This allows to store dfu entities in multiple env variables.
>>>
>>> Change-Id: Ibca7e785bfca9f53b64d3dff0490185b06841b54
>>> Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
>>> ---
>>>   drivers/dfu/dfu.c |    6 +++++-
>>>   1 file changed, 5 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/dfu/dfu.c b/drivers/dfu/dfu.c
>>> index f94c412..e15f959 100644
>>> --- a/drivers/dfu/dfu.c
>>> +++ b/drivers/dfu/dfu.c
>>> @@ -19,6 +19,7 @@
>>>   static bool dfu_reset_request;
>>>   static LIST_HEAD(dfu_list);
>>>   static int dfu_alt_num;
>>> +static int alt_num_count;
>>
>> Can the variable name here be any less consistent with the
>> rest ... ? ;-)
>
> I think, that something like dfu_alt_num_cnt would fit better there.
>
>>
>> [...]
>>
>> Best regards,
>> Marek Vasut
>
>

Thanks
Marek Vasut April 1, 2014, 6:49 a.m. UTC | #4
On Tuesday, April 01, 2014 at 08:47:05 AM, Przemyslaw Marczak wrote:
> Hello,
> This code was applied to u-boot-samsung few weeks ago.

Please do NOT top-post. Why did it arrive in the ML yesterday ?

> On 03/31/2014 11:15 AM, Lukasz Majewski wrote:
> > Hi Marek,
> > 
> >> On Monday, March 31, 2014 at 10:48:48 AM, Lukasz Majewski wrote:
> >>> From: Przemyslaw Marczak <p.marczak@samsung.com>
> >>> 
> >>> Thanks to this multiple calls of function dfu_config_entities() give
> >>> continuous dfu alt numbering until call dfu_free_entities().
> >>> 
> >>> This allows to store dfu entities in multiple env variables.
> >>> 
> >>> Change-Id: Ibca7e785bfca9f53b64d3dff0490185b06841b54
> >>> Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
> >>> ---
> >>> 
> >>>   drivers/dfu/dfu.c |    6 +++++-
> >>>   1 file changed, 5 insertions(+), 1 deletion(-)
> >>> 
> >>> diff --git a/drivers/dfu/dfu.c b/drivers/dfu/dfu.c
> >>> index f94c412..e15f959 100644
> >>> --- a/drivers/dfu/dfu.c
> >>> +++ b/drivers/dfu/dfu.c
> >>> @@ -19,6 +19,7 @@
> >>> 
> >>>   static bool dfu_reset_request;
> >>>   static LIST_HEAD(dfu_list);
> >>>   static int dfu_alt_num;
> >>> 
> >>> +static int alt_num_count;
> >> 
> >> Can the variable name here be any less consistent with the
> >> rest ... ? ;-)
> > 
> > I think, that something like dfu_alt_num_cnt would fit better there.
> > 
> >> [...]
> >> 
> >> Best regards,
> >> Marek Vasut
> 
> Thanks

Best regards,
Marek Vasut
Łukasz Majewski April 1, 2014, 7:45 a.m. UTC | #5
Hi Marek,

> On Tuesday, April 01, 2014 at 08:47:05 AM, Przemyslaw Marczak wrote:
> > Hello,
> > This code was applied to u-boot-samsung few weeks ago.
> 
> Please do NOT top-post. Why did it arrive in the ML yesterday ?

It was mine over-zeal :-). Sorry for confusion.

> 
> > On 03/31/2014 11:15 AM, Lukasz Majewski wrote:
> > > Hi Marek,
> > > 
> > >> On Monday, March 31, 2014 at 10:48:48 AM, Lukasz Majewski wrote:
> > >>> From: Przemyslaw Marczak <p.marczak@samsung.com>
> > >>> 
> > >>> Thanks to this multiple calls of function dfu_config_entities()
> > >>> give continuous dfu alt numbering until call
> > >>> dfu_free_entities().
> > >>> 
> > >>> This allows to store dfu entities in multiple env variables.
> > >>> 
> > >>> Change-Id: Ibca7e785bfca9f53b64d3dff0490185b06841b54
> > >>> Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
> > >>> ---
> > >>> 
> > >>>   drivers/dfu/dfu.c |    6 +++++-
> > >>>   1 file changed, 5 insertions(+), 1 deletion(-)
> > >>> 
> > >>> diff --git a/drivers/dfu/dfu.c b/drivers/dfu/dfu.c
> > >>> index f94c412..e15f959 100644
> > >>> --- a/drivers/dfu/dfu.c
> > >>> +++ b/drivers/dfu/dfu.c
> > >>> @@ -19,6 +19,7 @@
> > >>> 
> > >>>   static bool dfu_reset_request;
> > >>>   static LIST_HEAD(dfu_list);
> > >>>   static int dfu_alt_num;
> > >>> 
> > >>> +static int alt_num_count;
> > >> 
> > >> Can the variable name here be any less consistent with the
> > >> rest ... ? ;-)
> > > 
> > > I think, that something like dfu_alt_num_cnt would fit better
> > > there.
> > > 
> > >> [...]
> > >> 
> > >> Best regards,
> > >> Marek Vasut
> > 
> > Thanks
> 
> Best regards,
> Marek Vasut
diff mbox

Patch

diff --git a/drivers/dfu/dfu.c b/drivers/dfu/dfu.c
index f94c412..e15f959 100644
--- a/drivers/dfu/dfu.c
+++ b/drivers/dfu/dfu.c
@@ -19,6 +19,7 @@ 
 static bool dfu_reset_request;
 static LIST_HEAD(dfu_list);
 static int dfu_alt_num;
+static int alt_num_count;
 
 bool dfu_reset(void)
 {
@@ -379,6 +380,8 @@  void dfu_free_entities(void)
 	if (t)
 		free(t);
 	INIT_LIST_HEAD(&dfu_list);
+
+	alt_num_count = 0;
 }
 
 int dfu_config_entities(char *env, char *interface, int num)
@@ -396,11 +399,12 @@  int dfu_config_entities(char *env, char *interface, int num)
 	for (i = 0; i < dfu_alt_num; i++) {
 
 		s = strsep(&env, ";");
-		ret = dfu_fill_entity(&dfu[i], s, i, interface, num);
+		ret = dfu_fill_entity(&dfu[i], s, alt_num_count, interface, num);
 		if (ret)
 			return -1;
 
 		list_add_tail(&dfu[i].list, &dfu_list);
+		alt_num_count++;
 	}
 
 	return 0;