Received: by 10.223.185.116 with SMTP id b49csp680688wrg; Wed, 21 Feb 2018 05:18:15 -0800 (PST) X-Google-Smtp-Source: AH8x224NOOeW+2miO7kVfFld1mDzIaAIeE07vCcY6E8lPvIf79xIKNaH3RxFLiaPV28fOqiOMhYr X-Received: by 10.98.80.89 with SMTP id e86mr3299329pfb.46.1519219095043; Wed, 21 Feb 2018 05:18:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519219095; cv=none; d=google.com; s=arc-20160816; b=QMSSUm5bXeMiXsP4fgOfrUfMyLgOk6krXfA6S+sizv39u/JqgQqALrSPZF67RBDJqC g9lQ/rKpoYhQFuANKXuzE6WP3ItZF1YRmBDvNJEE9oNaD3CqAVZByrVzUyuuoqQdToB8 +FrSnHAu1kebXPHRWOXG3fPTTvi6j4t1H6FX6w1czLfwARRaswJMylKzLzmcDqbYzIyf ra0X+13f19LaA6HwcpkPTMsh3U5UpS9VEBXJtFLUmxxyQiKvQGGdGwPq8MHpmH1BjqO5 E8lYFHfyxpAcB0ift8Eg5zrlDNJbPjvf21kuVodp1l0oCZm0C3x4wYnSp0s5bS4+X0YM +2gA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:organization:message-id:date:subject:cc:to :from:dkim-signature:arc-authentication-results; bh=Eyr+7vBWHXTxWlq34rdxIwtoD8z5sns+EmFskEEa+vw=; b=BMQOdGd9QPBqlAVIrAlr9fsKWvUeZxa36mUfDq5vUGqIgesNsFG+gZXXPKD8XlCpPJ O/kSqkNB8ciZR9/iLi/HsvqLgdfek+N6OMYeM8YLJvuMTFNZdhgKeQh76O7gzhCpwHad Xto1LLxNaP6iigiqNWI7CXtME3VdTPmlRoBOc2o8mCx3vJUHH+TkwXbclYfB6p0J2dU0 wXSCtszUwiVUJ2HYeON6yfcBVV/VHuhqZMzcuibIBSDbEgQo/q+8hyA4kVcQ8jhL/SPY fOsdb0UiQGD2tnpnkIFU/MY+BprNXHwk98JiQHQSi1bZVXh30egT7ARsQl9zOty/OjRU 7GlQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=PQNQYBQe; 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 z21-v6si1086204plo.545.2018.02.21.05.18.00; Wed, 21 Feb 2018 05:18:14 -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=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=PQNQYBQe; 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 S1752159AbeBUMSX (ORCPT + 99 others); Wed, 21 Feb 2018 07:18:23 -0500 Received: from galahad.ideasonboard.com ([185.26.127.97]:47290 "EHLO galahad.ideasonboard.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751639AbeBUMSV (ORCPT ); Wed, 21 Feb 2018 07:18:21 -0500 Received: from avalon.localnet (dfj612ybrt5fhg77mgycy-3.rev.dnainternet.fi [IPv6:2001:14ba:21f5:5b00:2e86:4862:ef6a:2804]) by galahad.ideasonboard.com (Postfix) with ESMTPSA id 439B7200D4; Wed, 21 Feb 2018 13:16:38 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1519215398; bh=nfxNnSrAz7M55Oqt3APLUbiwxWGiSodquXfeT48hHFM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PQNQYBQenZWjh+uRWknBktJVPW9D08JlnIRONtzXOyrrq+kfRqQFiFvAwmZgQwFPg tuMLO9bjipQp9c3GVQDBB9ekKfrjtcULQyIzwcoSYZqrmkGH4fGx1TOCoR3BrUwzl1 7V6/qBXvKHuAxWHuCYJfhGVXlK+8cKGzf0bCF4WA= From: Laurent Pinchart To: Geert Uytterhoeven Cc: Laurent Pinchart , 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 Subject: Re: [PATCH v4 04/16] of: changesets: Introduce changeset helper methods Date: Wed, 21 Feb 2018 14:19:02 +0200 Message-ID: <2176862.3cxL0kyTvc@avalon> Organization: Ideas on Board Oy In-Reply-To: References: <20180220231046.32638-1-laurent.pinchart+renesas@ideasonboard.com> <20180220231046.32638-5-laurent.pinchart+renesas@ideasonboard.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > > > > 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/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