diff mbox

[U-Boot,4/6] config_distro_bootcmd.h: Add shared block definition for the host interface

Message ID 1424385674-19920-5-git-send-email-sjoerd.simons@collabora.co.uk
State Superseded
Delegated to: Simon Glass
Headers show

Commit Message

Sjoerd Simons Feb. 19, 2015, 10:41 p.m. UTC
Define the common shared block environment for the host interface in
preperation for the sandbox build to use config_distro_bootcmd.

Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
---
 include/config_distro_bootcmd.h | 13 +++++++++++++
 1 file changed, 13 insertions(+)

Comments

Simon Glass Feb. 20, 2015, 7:23 p.m. UTC | #1
+Stephen who knows more about this stuff

On 19 February 2015 at 15:41, Sjoerd Simons
<sjoerd.simons@collabora.co.uk> wrote:
> Define the common shared block environment for the host interface in
> preperation for the sandbox build to use config_distro_bootcmd.
>
> Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
> ---
>  include/config_distro_bootcmd.h | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
>
> diff --git a/include/config_distro_bootcmd.h b/include/config_distro_bootcmd.h
> index 07a0b3b..ff0e3a8 100644
> --- a/include/config_distro_bootcmd.h
> +++ b/include/config_distro_bootcmd.h
> @@ -32,6 +32,18 @@
>  #define BOOTENV_DEV_NAME_BLKDEV(devtypeu, devtypel, instance) \
>         #devtypel #instance " "
>
> +#ifdef CONFIG_SANDBOX
> +#define BOOTENV_SHARED_HOST    BOOTENV_SHARED_BLKDEV(host)
> +#define BOOTENV_DEV_HOST       BOOTENV_DEV_BLKDEV
> +#define BOOTENV_DEV_NAME_HOST  BOOTENV_DEV_NAME_BLKDEV
> +#else
> +#define BOOTENV_SHARED_HOST
> +#define BOOTENV_DEV_HOST \
> +       BOOT_TARGET_DEVICES_references_HOST_without_CONFIG_SANDBOX
> +#define BOOTENV_DEV_NAME_HOST \

Can we use upper case in #defines?

> +       BOOT_TARGET_DEVICES_references_HOST_without_CONFIG_SANDBOX
> +#endif
> +
>  #ifdef CONFIG_CMD_MMC
>  #define BOOTENV_SHARED_MMC     BOOTENV_SHARED_BLKDEV(mmc)
>  #define BOOTENV_DEV_MMC                BOOTENV_DEV_BLKDEV
> @@ -151,6 +163,7 @@
>  #define BOOTENV_DEV(devtypeu, devtypel, instance) \
>         BOOTENV_DEV_##devtypeu(devtypeu, devtypel, instance)
>  #define BOOTENV \
> +       BOOTENV_SHARED_HOST \
>         BOOTENV_SHARED_MMC \
>         BOOTENV_SHARED_USB \
>         BOOTENV_SHARED_SATA \
> --
> 2.1.4
>

Regards,
Simon
Sjoerd Simons Feb. 28, 2015, 2:05 p.m. UTC | #2
On Fri, 2015-02-20 at 12:23 -0700, Simon Glass wrote:
> +Stephen who knows more about this stuff
> 
> On 19 February 2015 at 15:41, Sjoerd Simons
> <sjoerd.simons@collabora.co.uk> wrote:
> > Define the common shared block environment for the host interface in
> > preperation for the sandbox build to use config_distro_bootcmd.
> >
> > Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
> > ---
> >  include/config_distro_bootcmd.h | 13 +++++++++++++
> >  1 file changed, 13 insertions(+)
> >
> > diff --git a/include/config_distro_bootcmd.h b/include/config_distro_bootcmd.h
> > index 07a0b3b..ff0e3a8 100644
> > --- a/include/config_distro_bootcmd.h
> > +++ b/include/config_distro_bootcmd.h
> > @@ -32,6 +32,18 @@
> >  #define BOOTENV_DEV_NAME_BLKDEV(devtypeu, devtypel, instance) \
> >         #devtypel #instance " "
> >
> > +#ifdef CONFIG_SANDBOX
> > +#define BOOTENV_SHARED_HOST    BOOTENV_SHARED_BLKDEV(host)
> > +#define BOOTENV_DEV_HOST       BOOTENV_DEV_BLKDEV
> > +#define BOOTENV_DEV_NAME_HOST  BOOTENV_DEV_NAME_BLKDEV
> > +#else
> > +#define BOOTENV_SHARED_HOST
> > +#define BOOTENV_DEV_HOST \
> > +       BOOT_TARGET_DEVICES_references_HOST_without_CONFIG_SANDBOX
> > +#define BOOTENV_DEV_NAME_HOST \
> 
> Can we use upper case in #defines?

The reason for this is that it is consistent with all other block device
blocks in that file e.g:

#define BOOTENV_DEV_SATA \
   BOOT_TARGET_DEVICES_references_SATA_without_CONFIG_CMD_SATA

So i'd prefer to to keep it that way. Btw, note that this is used for
compile time error reporting rather then something you'd refer to in
code.
Simon Glass Feb. 28, 2015, 2:14 p.m. UTC | #3
+Stephen for real this time

Hi Sjoerd,

On 28 February 2015 at 07:05, Sjoerd Simons
<sjoerd.simons@collabora.co.uk> wrote:
> On Fri, 2015-02-20 at 12:23 -0700, Simon Glass wrote:
>> +Stephen who knows more about this stuff
>>
>> On 19 February 2015 at 15:41, Sjoerd Simons
>> <sjoerd.simons@collabora.co.uk> wrote:
>> > Define the common shared block environment for the host interface in
>> > preperation for the sandbox build to use config_distro_bootcmd.
>> >
>> > Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
>> > ---
>> >  include/config_distro_bootcmd.h | 13 +++++++++++++
>> >  1 file changed, 13 insertions(+)
>> >
>> > diff --git a/include/config_distro_bootcmd.h b/include/config_distro_bootcmd.h
>> > index 07a0b3b..ff0e3a8 100644
>> > --- a/include/config_distro_bootcmd.h
>> > +++ b/include/config_distro_bootcmd.h
>> > @@ -32,6 +32,18 @@
>> >  #define BOOTENV_DEV_NAME_BLKDEV(devtypeu, devtypel, instance) \
>> >         #devtypel #instance " "
>> >
>> > +#ifdef CONFIG_SANDBOX
>> > +#define BOOTENV_SHARED_HOST    BOOTENV_SHARED_BLKDEV(host)
>> > +#define BOOTENV_DEV_HOST       BOOTENV_DEV_BLKDEV
>> > +#define BOOTENV_DEV_NAME_HOST  BOOTENV_DEV_NAME_BLKDEV
>> > +#else
>> > +#define BOOTENV_SHARED_HOST
>> > +#define BOOTENV_DEV_HOST \
>> > +       BOOT_TARGET_DEVICES_references_HOST_without_CONFIG_SANDBOX
>> > +#define BOOTENV_DEV_NAME_HOST \
>>
>> Can we use upper case in #defines?
>
> The reason for this is that it is consistent with all other block device
> blocks in that file e.g:
>
> #define BOOTENV_DEV_SATA \
>    BOOT_TARGET_DEVICES_references_SATA_without_CONFIG_CMD_SATA
>
> So i'd prefer to to keep it that way. Btw, note that this is used for
> compile time error reporting rather then something you'd refer to in
> code.

OK I see.

Regards,
Simon
Stephen Warren March 2, 2015, 4:54 p.m. UTC | #4
On 02/28/2015 07:14 AM, Simon Glass wrote:
> +Stephen for real this time
>
> Hi Sjoerd,
>
> On 28 February 2015 at 07:05, Sjoerd Simons
> <sjoerd.simons@collabora.co.uk> wrote:
>> On Fri, 2015-02-20 at 12:23 -0700, Simon Glass wrote:
>>> +Stephen who knows more about this stuff
>>>
>>> On 19 February 2015 at 15:41, Sjoerd Simons
>>> <sjoerd.simons@collabora.co.uk> wrote:
>>>> Define the common shared block environment for the host interface in
>>>> preperation for the sandbox build to use config_distro_bootcmd.
>>>>
>>>> Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
>>>> ---
>>>>   include/config_distro_bootcmd.h | 13 +++++++++++++
>>>>   1 file changed, 13 insertions(+)
>>>>
>>>> diff --git a/include/config_distro_bootcmd.h b/include/config_distro_bootcmd.h
>>>> index 07a0b3b..ff0e3a8 100644
>>>> --- a/include/config_distro_bootcmd.h
>>>> +++ b/include/config_distro_bootcmd.h
>>>> @@ -32,6 +32,18 @@
>>>>   #define BOOTENV_DEV_NAME_BLKDEV(devtypeu, devtypel, instance) \
>>>>          #devtypel #instance " "
>>>>
>>>> +#ifdef CONFIG_SANDBOX
>>>> +#define BOOTENV_SHARED_HOST    BOOTENV_SHARED_BLKDEV(host)
>>>> +#define BOOTENV_DEV_HOST       BOOTENV_DEV_BLKDEV
>>>> +#define BOOTENV_DEV_NAME_HOST  BOOTENV_DEV_NAME_BLKDEV
>>>> +#else
>>>> +#define BOOTENV_SHARED_HOST
>>>> +#define BOOTENV_DEV_HOST \
>>>> +       BOOT_TARGET_DEVICES_references_HOST_without_CONFIG_SANDBOX
>>>> +#define BOOTENV_DEV_NAME_HOST \
>>>
>>> Can we use upper case in #defines?
>>
>> The reason for this is that it is consistent with all other block device
>> blocks in that file e.g:
>>
>> #define BOOTENV_DEV_SATA \
>>     BOOT_TARGET_DEVICES_references_SATA_without_CONFIG_CMD_SATA
>>
>> So i'd prefer to to keep it that way. Btw, note that this is used for
>> compile time error reporting rather then something you'd refer to in
>> code.
>
> OK I see.

Yes, in this case that mixed-case variable name is essentially an error 
message to the user. The mixed case hopefully makes it more legible 
since only other variable names are in upper case, and the rest of the 
warning text is lower case. We can't use e.g. #error here, since this 
error can only be detected in the middle of a macro expansion rather 
than via some top-level singleton #if/#ifdef check.
Simon Glass March 2, 2015, 6:58 p.m. UTC | #5
Hi,

On 2 March 2015 at 09:54, Stephen Warren <swarren@wwwdotorg.org> wrote:
> On 02/28/2015 07:14 AM, Simon Glass wrote:
>>
>> +Stephen for real this time
>>
>> Hi Sjoerd,
>>
>> On 28 February 2015 at 07:05, Sjoerd Simons
>> <sjoerd.simons@collabora.co.uk> wrote:
>>>
>>> On Fri, 2015-02-20 at 12:23 -0700, Simon Glass wrote:
>>>>
>>>> +Stephen who knows more about this stuff
>>>>
>>>> On 19 February 2015 at 15:41, Sjoerd Simons
>>>> <sjoerd.simons@collabora.co.uk> wrote:
>>>>>
>>>>> Define the common shared block environment for the host interface in
>>>>> preperation for the sandbox build to use config_distro_bootcmd.
>>>>>
>>>>> Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
>>>>> ---
>>>>>   include/config_distro_bootcmd.h | 13 +++++++++++++
>>>>>   1 file changed, 13 insertions(+)
>>>>>
>>>>> diff --git a/include/config_distro_bootcmd.h
>>>>> b/include/config_distro_bootcmd.h
>>>>> index 07a0b3b..ff0e3a8 100644
>>>>> --- a/include/config_distro_bootcmd.h
>>>>> +++ b/include/config_distro_bootcmd.h
>>>>> @@ -32,6 +32,18 @@
>>>>>   #define BOOTENV_DEV_NAME_BLKDEV(devtypeu, devtypel, instance) \
>>>>>          #devtypel #instance " "
>>>>>
>>>>> +#ifdef CONFIG_SANDBOX
>>>>> +#define BOOTENV_SHARED_HOST    BOOTENV_SHARED_BLKDEV(host)
>>>>> +#define BOOTENV_DEV_HOST       BOOTENV_DEV_BLKDEV
>>>>> +#define BOOTENV_DEV_NAME_HOST  BOOTENV_DEV_NAME_BLKDEV
>>>>> +#else
>>>>> +#define BOOTENV_SHARED_HOST
>>>>> +#define BOOTENV_DEV_HOST \
>>>>> +       BOOT_TARGET_DEVICES_references_HOST_without_CONFIG_SANDBOX
>>>>> +#define BOOTENV_DEV_NAME_HOST \
>>>>
>>>>
>>>> Can we use upper case in #defines?
>>>
>>>
>>> The reason for this is that it is consistent with all other block device
>>> blocks in that file e.g:
>>>
>>> #define BOOTENV_DEV_SATA \
>>>     BOOT_TARGET_DEVICES_references_SATA_without_CONFIG_CMD_SATA
>>>
>>> So i'd prefer to to keep it that way. Btw, note that this is used for
>>> compile time error reporting rather then something you'd refer to in
>>> code.
>>
>>
>> OK I see.
>
>
> Yes, in this case that mixed-case variable name is essentially an error
> message to the user. The mixed case hopefully makes it more legible since
> only other variable names are in upper case, and the rest of the warning
> text is lower case. We can't use e.g. #error here, since this error can only
> be detected in the middle of a macro expansion rather than via some
> top-level singleton #if/#ifdef check.

Makes sense. Maybe we could add a comment to this effect?

Regards,
Simon
diff mbox

Patch

diff --git a/include/config_distro_bootcmd.h b/include/config_distro_bootcmd.h
index 07a0b3b..ff0e3a8 100644
--- a/include/config_distro_bootcmd.h
+++ b/include/config_distro_bootcmd.h
@@ -32,6 +32,18 @@ 
 #define BOOTENV_DEV_NAME_BLKDEV(devtypeu, devtypel, instance) \
 	#devtypel #instance " "
 
+#ifdef CONFIG_SANDBOX
+#define BOOTENV_SHARED_HOST	BOOTENV_SHARED_BLKDEV(host)
+#define BOOTENV_DEV_HOST	BOOTENV_DEV_BLKDEV
+#define BOOTENV_DEV_NAME_HOST	BOOTENV_DEV_NAME_BLKDEV
+#else
+#define BOOTENV_SHARED_HOST
+#define BOOTENV_DEV_HOST \
+	BOOT_TARGET_DEVICES_references_HOST_without_CONFIG_SANDBOX
+#define BOOTENV_DEV_NAME_HOST \
+	BOOT_TARGET_DEVICES_references_HOST_without_CONFIG_SANDBOX
+#endif
+
 #ifdef CONFIG_CMD_MMC
 #define BOOTENV_SHARED_MMC	BOOTENV_SHARED_BLKDEV(mmc)
 #define BOOTENV_DEV_MMC		BOOTENV_DEV_BLKDEV
@@ -151,6 +163,7 @@ 
 #define BOOTENV_DEV(devtypeu, devtypel, instance) \
 	BOOTENV_DEV_##devtypeu(devtypeu, devtypel, instance)
 #define BOOTENV \
+	BOOTENV_SHARED_HOST \
 	BOOTENV_SHARED_MMC \
 	BOOTENV_SHARED_USB \
 	BOOTENV_SHARED_SATA \