linux-renesas-soc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>,
	DRI Development <dri-devel@lists.freedesktop.org>,
	Linux-Renesas <linux-renesas-soc@vger.kernel.org>,
	Pantelis Antoniou <pantelis.antoniou@konsulko.com>,
	Rob Herring <robh@kernel.org>,
	Frank Rowand <frowand.list@gmail.com>,
	Matt Porter <mporter@konsulko.com>,
	Koen Kooi <koen@dominion.thruhere.net>,
	Guenter Roeck <linux@roeck-us.net>, Marek Vasut <marex@denx.de>,
	Wolfram Sang <wsa@the-dreams.de>,
	"open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS"
	<devicetree@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Linux I2C <linux-i2c@vger.kernel.org>
Subject: Re: [PATCH v4 04/16] of: changesets: Introduce changeset helper methods
Date: Wed, 21 Feb 2018 14:19:02 +0200	[thread overview]
Message-ID: <2176862.3cxL0kyTvc@avalon> (raw)
In-Reply-To: <CAMuHMdVJfKXWNFaN259JQ1bOVZQSbC-=u4Kmys2PE+HLa=xQKw@mail.gmail.com>

Hi Geert,

On Wednesday, 21 February 2018 12:21:50 EET Geert Uytterhoeven wrote:
> On Wed, Feb 21, 2018 at 12:10 AM, Laurent Pinchart wrote:
> > From: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
> > 
> > Changesets are very powerful, but the lack of a helper API
> > makes using them cumbersome. Introduce a simple copy based
> > API that makes things considerably easier.
> > 
> > To wit, adding a property using the raw API.
> > 
> >         struct property *prop;
> >         prop = kzalloc(sizeof(*prop)), GFP_KERNEL);
> >         prop->name = kstrdup("compatible");
> >         prop->value = kstrdup("foo,bar");
> >         prop->length = strlen(prop->value) + 1;
> >         of_changeset_add_property(ocs, np, prop);
> > 
> > while using the helper API
> > 
> >         of_changeset_add_property_string(ocs, np, "compatible",
> >         
> >                         "foo,bar");
> > 
> > Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
> > [Fixed memory leak in __of_changeset_add_update_property_copy()]
> > Signed-off-by: Laurent Pinchart
> > <laurent.pinchart+renesas@ideasonboard.com>
> 
> You missed one fix I have in my topic/overlays branch
> https://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-drivers.git/co
> mmit/?h=topic/overlays&id=150f95b9dec77ce371c229f7ac4d6dd8620bef4a
> > --- a/include/linux/of.h
> > +++ b/include/linux/of.h
> > 
> > +/**
> > + * of_changeset_add_property_u32 - Create a new u32 property
> > + *
> > + * @ocs:       changeset pointer
> > + * @np:                device node pointer
> > + * @name:      name of the property
> > + * @val:       value in host endian format
> > + *
> > + * Adds a u32 property to the changeset.
> > + *
> > + * Returns zero on success, a negative error value otherwise.
> > + */
> > +static inline int of_changeset_add_property_u32(struct of_changeset *ocs,
> > +               struct device_node *np, const char *name, u32 val)
> > +{
> > +       val = cpu_to_be32(val);
> 
> You must use an intermediate, to avoid complaints from sparse:
> 
>     __be32 x = cpu_to_be32(val);
> 
> > +       return __of_changeset_add_update_property_copy(ocs, np, name,
> > &val,
> > +                       sizeof(val), false);
> 
> s/val/x/

I'll fix both in the next version, thanks.

> > +}
> > +
> > +/**
> > + * of_changeset_update_property_u32 - Update u32 property
> > + *
> > + * @ocs:       changeset pointer
> > + * @np:                device node pointer
> > + * @name:      name of the property
> > + * @val:       value in host endian format
> > + *
> > + * Updates a u32 property to the changeset.
> > + *
> > + * Returns zero on success, a negative error value otherwise.
> > + */
> > +static inline int of_changeset_update_property_u32(
> > +       struct of_changeset *ocs, struct device_node *np,
> > +       const char *name, u32 val)
> > +{
> > +       val = cpu_to_be32(val);
> 
> Oh, a new one.
> 
> > +       return __of_changeset_add_update_property_copy(ocs, np, name,
> > &val,
> > +                       sizeof(val), true);
> > +}

-- 
Regards,

Laurent Pinchart

  reply	other threads:[~2018-02-21 12:18 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-20 23:10 [PATCH v4 00/16] R-Car DU: Convert LVDS code to bridge driver Laurent Pinchart
2018-02-20 23:10 ` [PATCH v4 01/16] dt-bindings: display: renesas: Add R-Car LVDS encoder DT bindings Laurent Pinchart
2018-02-21  8:35   ` Sergei Shtylyov
2018-02-21 19:50     ` Laurent Pinchart
2018-02-20 23:10 ` [PATCH v4 02/16] dt-bindings: display: renesas: Deprecate LVDS support in the DU bindings Laurent Pinchart
2018-02-20 23:10 ` [PATCH v4 03/16] of: dynamic: Add __of_node_dupv() Laurent Pinchart
2018-02-21 10:26   ` Geert Uytterhoeven
2018-02-21 12:15     ` Laurent Pinchart
2018-02-21 23:16   ` Rob Herring
2018-02-20 23:10 ` [PATCH v4 04/16] of: changesets: Introduce changeset helper methods Laurent Pinchart
2018-02-21 10:21   ` Geert Uytterhoeven
2018-02-21 12:19     ` Laurent Pinchart [this message]
2018-02-21 15:23     ` Rob Herring
2018-02-21 15:46       ` Geert Uytterhoeven
2018-02-21 23:14   ` Rob Herring
2018-02-20 23:10 ` [PATCH v4 05/16] of: changeset: Add of_changeset_node_move method Laurent Pinchart
2018-02-21 23:20   ` Rob Herring
2018-02-21 23:40     ` Laurent Pinchart
2018-02-20 23:10 ` [PATCH v4 06/16] of: unittest: changeset helpers Laurent Pinchart
2018-02-21 23:10   ` Rob Herring
2018-02-21 23:39     ` Laurent Pinchart
2018-02-21 23:49       ` Rob Herring
2018-02-20 23:10 ` [PATCH v4 07/16] i2c: demux: Use changeset helpers for clarity Laurent Pinchart
2018-02-21  8:06   ` Wolfram Sang
2018-02-20 23:10 ` [PATCH v4 08/16] drm: rcar-du: Fix legacy DT to create LVDS encoder nodes Laurent Pinchart
2018-02-21 23:28   ` Rob Herring
2018-02-21 23:54     ` Laurent Pinchart
2018-02-20 23:10 ` [PATCH v4 09/16] drm: rcar-du: Convert LVDS encoder code to bridge driver Laurent Pinchart
2018-02-20 23:10 ` [PATCH v4 10/16] ARM: dts: r8a7790: Convert to new LVDS DT bindings Laurent Pinchart
2018-02-20 23:10 ` [PATCH v4 11/16] ARM: dts: r8a7791: " Laurent Pinchart
2018-02-23  9:32   ` Sergei Shtylyov
2018-02-23  9:37     ` Laurent Pinchart
2018-02-23  9:51   ` Sergei Shtylyov
2018-02-27 10:26     ` Laurent Pinchart
2018-02-20 23:10 ` [PATCH v4 12/16] ARM: dts: r8a7792: Convert to new DU " Laurent Pinchart
2018-02-20 23:10 ` [PATCH v4 13/16] ARM: dts: r8a7793: Convert to new LVDS " Laurent Pinchart
2018-02-20 23:10 ` [PATCH v4 14/16] ARM: dts: r8a7794: Convert to new DU " Laurent Pinchart
2018-02-21  8:26   ` Sergei Shtylyov
2018-02-20 23:10 ` [PATCH v4 15/16] arm64: dts: renesas: r8a7795: Convert to new LVDS " Laurent Pinchart
2018-02-20 23:10 ` [PATCH v4 16/16] arm64: dts: renesas: r8a7796: " Laurent Pinchart
2018-02-21 16:39 ` [PATCH v4 00/16] R-Car DU: Convert LVDS code to bridge driver Simon Horman
2018-05-24  8:00   ` Laurent Pinchart
2018-05-25 10:13     ` Simon Horman
2018-05-25 10:23       ` Laurent Pinchart
2018-05-28  9:39         ` Simon Horman
2018-05-28  9:45           ` Laurent Pinchart
2018-05-28 10:29             ` Simon Horman
2018-06-05  8:16               ` Simon Horman
2018-02-22  6:07 ` Frank Rowand
2018-02-22 10:25   ` Laurent Pinchart
2018-02-23  3:20     ` Frank Rowand
2018-02-23  9:25       ` Laurent Pinchart
2018-02-23 19:35         ` Frank Rowand

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=2176862.3cxL0kyTvc@avalon \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=frowand.list@gmail.com \
    --cc=geert@linux-m68k.org \
    --cc=koen@dominion.thruhere.net \
    --cc=laurent.pinchart+renesas@ideasonboard.com \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=marex@denx.de \
    --cc=mporter@konsulko.com \
    --cc=pantelis.antoniou@konsulko.com \
    --cc=robh@kernel.org \
    --cc=wsa@the-dreams.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;
as well as URLs for NNTP newsgroup(s).