Received: by 10.223.185.116 with SMTP id b49csp867281wrg; Wed, 21 Feb 2018 08:11:25 -0800 (PST) X-Google-Smtp-Source: AH8x2249IIW3tV6M6mjzekLcdorq/T61EZ0JIMbbWvmJTRAwa1BrXu0Io0ammvJwj2ExUAju6cWx X-Received: by 10.98.141.65 with SMTP id z62mr3807235pfd.129.1519229484907; Wed, 21 Feb 2018 08:11:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519229484; cv=none; d=google.com; s=arc-20160816; b=sQTtVbMH9IMTp3meyLn6ex8kSKHgu6VpBfGOysxrp+wMuvt3H1XcTIBqaIOsoppNLR 2OhO6snkTRkIRvL8YXpb49lFIuhtV04fFhC7osbgZK29XtPoEJghguAzEW5Vqb7TQP4h qRlrAcejR1pwz18FM2FFIIJxNvpMEbQraSSDlbekLefjAZj5KrsHAd3kqcetsbpxQB50 DUk6ZwStYkPGxwBtWqogyAtlS76uvRuFV7jx5f/4kEMRnuRrLHy2jE+bgGPo+vfrWOl4 eJTPk0mnvn0jSIEffdjRnzwPLjdPWYulgdf/6x5GgAcZ9+AjSOKbBh8v6njPedgDxbi+ EpNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=2eRuiKkVOSjVyKdyRzJqnOey37eKu5HNRTUmAyq3/Q4=; b=ciyeVuQK5CUClhbzbRlEN1dN5i/SdA9tazp6QK2YNqAgVUndMxO8wsQe0L5pdpUdNo MERNrn2uBHtN4kufxAQ+5Mt+cRZeULkQ3V8cedA+EBatkr2+0DmX6pCoQ4/Nx6xkPHsp joi26cZjX3lws+SAnj/noow8o0cD18X70DKkwTdWX+RQUQVOboQK7PVys6oQn5ihCUA3 jXTiJNvomrgsoh5Gt/4Av7nu+qwF+m2W5IP6VwjL6ozImJ3XYdgseNLSG+lCNgAOQRa4 YVrbOgBnAPG5myChcdmV+9v8RfNxA3legZQmwBRpfs3jK5PJoNyibXHaLw1wNMvhku4T yXXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=q7MBe7Mb; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o64si1879361pfb.346.2018.02.21.08.11.08; Wed, 21 Feb 2018 08:11:24 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=q7MBe7Mb; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932978AbeBUKV4 (ORCPT + 99 others); Wed, 21 Feb 2018 05:21:56 -0500 Received: from mail-qk0-f195.google.com ([209.85.220.195]:34003 "EHLO mail-qk0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932631AbeBUKVw (ORCPT ); Wed, 21 Feb 2018 05:21:52 -0500 Received: by mail-qk0-f195.google.com with SMTP id l206so1279097qke.1; Wed, 21 Feb 2018 02:21:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=2eRuiKkVOSjVyKdyRzJqnOey37eKu5HNRTUmAyq3/Q4=; b=q7MBe7MbUuopzR0L12zvapPuyAmyeRiHaO1UGeAlLx9SNKPlcDhWCLyNz9qHTQBryN 5Sdyrm66ge56diewEHIo7yJY2gdQAOempF+2kywqJVus1dFThjSQn/lqCa6lA59L1bNC yMMNgjaXXZekJMYFqs72Ryg4UPD4ubKOgXt7UgXkPdwalSRyhdEirhBRJC5zzyZod1R5 YDMxD1UYFjPFLLEXuzMV6pXIoyCdsL6gdUF0gtUNdqjqXBb/4pzCKa/PbP71oMtpbPLj cdJqDuUsRSzty2zwAB0UJPkh1VDREBpQGiLgxgVmq7eqJ5DlGavxdXBv8ECZ71JqBsbc zR6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=2eRuiKkVOSjVyKdyRzJqnOey37eKu5HNRTUmAyq3/Q4=; b=DRENV62rke581aou6RfDOmfTaI7In3EHASdVOSjLhoPAxCZtdI3s9IRJT+muoyUhco EzbRzgdszph093zc3obp4wGYakhyYv8i+uucGfChNClUKswkp2r11UWg7fBd++wkDwQu z84id9wsdj5sOJAyUubCqS+rhygcDn00aMnEuNxC9hdZZblrZut7n2zlUZ7TgnkpfWfX l8P9hGDCs6ebg+j2SDQ7JbMdxFfdy24VtbVyiNPDmJq01OHmJ7lv6MaewPlb9bAfRTLm wVKCxKaTHYKsLAUo5A32u1k0Oe7W+dohjxzROTihCpAxmMCkXFw3IsET+NlGcc3ighEA HN2g== X-Gm-Message-State: APf1xPDlx9Mk2WHwt1kCMTk1HptB2lESMChxdW7fqEnMGkvkwkiD/iNO B5oomIQAsNX4/EQ781+wChlbLbTbES5hnXqMzk8= X-Received: by 10.55.170.209 with SMTP id t200mr4373014qke.228.1519208511363; Wed, 21 Feb 2018 02:21:51 -0800 (PST) MIME-Version: 1.0 Received: by 10.200.47.219 with HTTP; Wed, 21 Feb 2018 02:21:50 -0800 (PST) In-Reply-To: <20180220231046.32638-5-laurent.pinchart+renesas@ideasonboard.com> References: <20180220231046.32638-1-laurent.pinchart+renesas@ideasonboard.com> <20180220231046.32638-5-laurent.pinchart+renesas@ideasonboard.com> From: Geert Uytterhoeven Date: Wed, 21 Feb 2018 11:21:50 +0100 X-Google-Sender-Auth: hssHMDE-t_z5XBxKm4JdIqPpmhs Message-ID: Subject: Re: [PATCH v4 04/16] of: changesets: Introduce changeset helper methods To: Laurent Pinchart Cc: DRI Development , Linux-Renesas , Pantelis Antoniou , Rob Herring , Frank Rowand , Matt Porter , Koen Kooi , Guenter Roeck , Marek Vasut , Wolfram Sang , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , Linux Kernel Mailing List , Linux I2C Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Laurent, On Wed, Feb 21, 2018 at 12:10 AM, Laurent Pinchart wrote: > From: Pantelis Antoniou > > 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 > [Fixed memory leak in __of_changeset_add_update_property_copy()] > Signed-off-by: Laurent Pinchart You missed one fix I have in my topic/overlays branch https://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-drivers.git/commit/?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/ > +} > + > +/** > + * 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); > +} Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds