Hi Bin,

On Sun, 28 Jun 2020 at 03:55, Bin Meng <bmeng...@gmail.com> wrote:
>
> Hi Simon,
>
> On Sun, Jun 14, 2020 at 10:55 AM Simon Glass <s...@chromium.org> wrote:
> >
> > Add support for output of strings and streams of bytes.
> >
> > Signed-off-by: Simon Glass <s...@chromium.org>
> > Reviewed-by: Wolfgang Wallner <wolfgang.wall...@br-automation.com>
> > ---
> >
> > (no changes since v1)
> >
> >  include/acpi/acpigen.h | 19 +++++++++++++++++++
> >  lib/acpi/acpigen.c     | 14 ++++++++++++++
> >  test/dm/acpigen.c      | 42 ++++++++++++++++++++++++++++++++++++++++++
> >  3 files changed, 75 insertions(+)
> >
> > diff --git a/include/acpi/acpigen.h b/include/acpi/acpigen.h
> > index 8809cdb4e1..7365cce738 100644
> > --- a/include/acpi/acpigen.h
> > +++ b/include/acpi/acpigen.h
> > @@ -46,4 +46,23 @@ void acpigen_emit_word(struct acpi_ctx *ctx, uint data);
> >   */
> >  void acpigen_emit_dword(struct acpi_ctx *ctx, uint data);
> >
> > +/**
> > + * acpigen_emit_stream() - Emit a stream of bytes
> > + *
> > + * @ctx: ACPI context pointer
> > + * @data: Data to output
> > + * @size: Size of data in bytes
> > + */
> > +void acpigen_emit_stream(struct acpi_ctx *ctx, const char *data, int size);
> > +
> > +/**
> > + * acpigen_emit_string() - Emit a string
> > + *
> > + * Emit a string with a nul terminator
>
> nits: null

OK

>
> > + *
> > + * @ctx: ACPI context pointer
> > + * @str: String to output, or NULL for an empty string
> > + */
> > +void acpigen_emit_string(struct acpi_ctx *ctx, const char *str);
> > +
> >  #endif
> > diff --git a/lib/acpi/acpigen.c b/lib/acpi/acpigen.c
> > index 59bd3af0b7..1223f0d1c4 100644
> > --- a/lib/acpi/acpigen.c
> > +++ b/lib/acpi/acpigen.c
> > @@ -36,3 +36,17 @@ void acpigen_emit_dword(struct acpi_ctx *ctx, uint data)
> >         acpigen_emit_byte(ctx, (data >> 16) & 0xff);
> >         acpigen_emit_byte(ctx, (data >> 24) & 0xff);
> >  }
> > +
> > +void acpigen_emit_stream(struct acpi_ctx *ctx, const char *data, int size)
> > +{
> > +       int i;
> > +
> > +       for (i = 0; i < size; i++)
> > +               acpigen_emit_byte(ctx, data[i]);
> > +}
> > +
> > +void acpigen_emit_string(struct acpi_ctx *ctx, const char *str)
> > +{
> > +       acpigen_emit_stream(ctx, str, str ? strlen(str) : 0);
> > +       acpigen_emit_byte(ctx, '\0'); /* NUL */
>
> nits: NULL

I'll delete that as it is not necessary. But as mentioned before this
is ASCII NUL.

Regards,
SImon

Reply via email to