Re: [U-Boot] [PATCH v2 01/17] fdt: Tidy up a few fdtdec problems

2011-12-05 Thread Stephen Warren
On 12/02/2011 07:11 PM, Simon Glass wrote:
...
 +int fdtdec_get_is_enabled(const void *blob, int node)
  {
   const char *cell;
  
   cell = fdt_getprop(blob, node, status, NULL);
   if (cell)
 - return 0 == strcmp(cell, ok);
 - return default_val;
 + return 0 == strcmp(cell, okay);
 + return 1;
  }

The kernel accepts both okay (standard) and ok (non-standard). I assume
the latter is required for some in-use-but-technically-incorrect .dts
files. I imagine U-Boot should act like the kernel here.

(Sorry if I wasn't clear here before; that's certainly what I intended
to mean)

-- 
nvpublic
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v2 01/17] fdt: Tidy up a few fdtdec problems

2011-12-05 Thread Simon Glass
Hi Stephen,

On Mon, Dec 5, 2011 at 1:27 PM, Stephen Warren swar...@nvidia.com wrote:
 On 12/02/2011 07:11 PM, Simon Glass wrote:
 ...
 +int fdtdec_get_is_enabled(const void *blob, int node)
  {
       const char *cell;

       cell = fdt_getprop(blob, node, status, NULL);
       if (cell)
 -             return 0 == strcmp(cell, ok);
 -     return default_val;
 +             return 0 == strcmp(cell, okay);
 +     return 1;
  }

 The kernel accepts both okay (standard) and ok (non-standard). I assume
 the latter is required for some in-use-but-technically-incorrect .dts
 files. I imagine U-Boot should act like the kernel here.

Given that we are just starting out with fdt, do you think it would be
better to not bloat the code in this way? I don't mind either way -
just asking :-)

Regards,
Simon


 (Sorry if I wasn't clear here before; that's certainly what I intended
 to mean)

 --
 nvpublic
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v2 01/17] fdt: Tidy up a few fdtdec problems

2011-12-05 Thread Stephen Warren
On 12/05/2011 02:40 PM, Simon Glass wrote:
 Hi Stephen,
 
 On Mon, Dec 5, 2011 at 1:27 PM, Stephen Warren swar...@nvidia.com wrote:
 On 12/02/2011 07:11 PM, Simon Glass wrote:
 ...
 +int fdtdec_get_is_enabled(const void *blob, int node)
  {
   const char *cell;

   cell = fdt_getprop(blob, node, status, NULL);
   if (cell)
 - return 0 == strcmp(cell, ok);
 - return default_val;
 + return 0 == strcmp(cell, okay);
 + return 1;
  }

 The kernel accepts both okay (standard) and ok (non-standard). I assume
 the latter is required for some in-use-but-technically-incorrect .dts
 files. I imagine U-Boot should act like the kernel here.
 
 Given that we are just starting out with fdt, do you think it would be
 better to not bloat the code in this way? I don't mind either way -
 just asking :-)

My point is that there are probably .dts files using ok instead of
okay or the kernel wouldn't support ok. People will probably want to
use those with U-Boot without changing anything else. So, U-Boot should
interpret the FDT in the same way as the kernel.

-- 
nvpublic
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v2 01/17] fdt: Tidy up a few fdtdec problems

2011-12-05 Thread Simon Glass
Hi Stephen,

On Mon, Dec 5, 2011 at 2:07 PM, Stephen Warren swar...@nvidia.com wrote:
 On 12/05/2011 02:40 PM, Simon Glass wrote:
 Hi Stephen,

 On Mon, Dec 5, 2011 at 1:27 PM, Stephen Warren swar...@nvidia.com wrote:
 On 12/02/2011 07:11 PM, Simon Glass wrote:
 ...
 +int fdtdec_get_is_enabled(const void *blob, int node)
  {
       const char *cell;

       cell = fdt_getprop(blob, node, status, NULL);
       if (cell)
 -             return 0 == strcmp(cell, ok);
 -     return default_val;
 +             return 0 == strcmp(cell, okay);
 +     return 1;
  }

 The kernel accepts both okay (standard) and ok (non-standard). I assume
 the latter is required for some in-use-but-technically-incorrect .dts
 files. I imagine U-Boot should act like the kernel here.

 Given that we are just starting out with fdt, do you think it would be
 better to not bloat the code in this way? I don't mind either way -
 just asking :-)

 My point is that there are probably .dts files using ok instead of
 okay or the kernel wouldn't support ok. People will probably want to
 use those with U-Boot without changing anything else. So, U-Boot should
 interpret the FDT in the same way as the kernel.

OK, how about:
return 0 == strncmp(cell, ok, 2);

(I do feel that if you do this sort of thing you end up with people
using 'ok' even in new fdts, since they look at code like this and
think it is fine)

Regards,
Simon


 --
 nvpublic
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v2 01/17] fdt: Tidy up a few fdtdec problems

2011-12-05 Thread Scott Wood
On 12/05/2011 04:11 PM, Simon Glass wrote:
 Hi Stephen,
 
 On Mon, Dec 5, 2011 at 2:07 PM, Stephen Warren swar...@nvidia.com wrote:
 My point is that there are probably .dts files using ok instead of
 okay or the kernel wouldn't support ok. People will probably want to
 use those with U-Boot without changing anything else. So, U-Boot should
 interpret the FDT in the same way as the kernel.

The kernel has to deal with real Open Firmware systems, some of which
pass buggy trees.  U-Boot should not blindly imitate all of Linux's
workarounds.

 OK, how about:
   return 0 == strncmp(cell, ok, 2);
 
 (I do feel that if you do this sort of thing you end up with people
 using 'ok' even in new fdts, since they look at code like this and
 think it is fine)

Indeed.

-Scott

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v2 01/17] fdt: Tidy up a few fdtdec problems

2011-12-05 Thread Stephen Warren
On 12/05/2011 03:18 PM, Scott Wood wrote:
 On 12/05/2011 04:11 PM, Simon Glass wrote:
 Hi Stephen,

 On Mon, Dec 5, 2011 at 2:07 PM, Stephen Warren swar...@nvidia.com wrote:
 My point is that there are probably .dts files using ok instead of
 okay or the kernel wouldn't support ok. People will probably want to
 use those with U-Boot without changing anything else. So, U-Boot should
 interpret the FDT in the same way as the kernel.
 
 The kernel has to deal with real Open Firmware systems, some of which
 pass buggy trees.  U-Boot should not blindly imitate all of Linux's
 workarounds.

If it's certain that we'll never see anyone writing FDTs with ok in
them instead of okay (because such FDTs were only autogenerated by
Open Firmware), then I'm fine with the original code.

 OK, how about:
  return 0 == strncmp(cell, ok, 2);

 (I do feel that if you do this sort of thing you end up with people
 using 'ok' even in new fdts, since they look at code like this and
 think it is fine)

That'd be buggy since it'd allow a lot more than ok/okay. A comment in
the code would avoid the issue.

-- 
nvpublic
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v2 01/17] fdt: Tidy up a few fdtdec problems

2011-12-05 Thread Simon Glass
Hi Stephen,

On Mon, Dec 5, 2011 at 2:25 PM, Stephen Warren swar...@nvidia.com wrote:
 On 12/05/2011 03:18 PM, Scott Wood wrote:
 On 12/05/2011 04:11 PM, Simon Glass wrote:
 Hi Stephen,

 On Mon, Dec 5, 2011 at 2:07 PM, Stephen Warren swar...@nvidia.com wrote:
 My point is that there are probably .dts files using ok instead of
 okay or the kernel wouldn't support ok. People will probably want to
 use those with U-Boot without changing anything else. So, U-Boot should
 interpret the FDT in the same way as the kernel.

 The kernel has to deal with real Open Firmware systems, some of which
 pass buggy trees.  U-Boot should not blindly imitate all of Linux's
 workarounds.

 If it's certain that we'll never see anyone writing FDTs with ok in
 them instead of okay (because such FDTs were only autogenerated by
 Open Firmware), then I'm fine with the original code.

 OK, how about:
              return 0 == strncmp(cell, ok, 2);

 (I do feel that if you do this sort of thing you end up with people
 using 'ok' even in new fdts, since they look at code like this and
 think it is fine)

 That'd be buggy since it'd allow a lot more than ok/okay. A comment in
 the code would avoid the issue.

Hmm, ok I will revert to okay and add a comment.

Regards,
Simon


 --
 nvpublic
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot