From patchwork Mon May 16 16:41:24 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pantelis Antoniou X-Patchwork-Id: 622674 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3r7mT44jfcz9sdb for ; Tue, 17 May 2016 02:42:00 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=konsulko.com header.i=@konsulko.com header.b=I+I4q8oR; dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754409AbcEPQlh (ORCPT ); Mon, 16 May 2016 12:41:37 -0400 Received: from mail-wm0-f49.google.com ([74.125.82.49]:36152 "EHLO mail-wm0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754346AbcEPQlf (ORCPT ); Mon, 16 May 2016 12:41:35 -0400 Received: by mail-wm0-f49.google.com with SMTP id n129so108396652wmn.1 for ; Mon, 16 May 2016 09:41:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=konsulko.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=QH4bDvioddqF2VGhqVL2CKwgS6mF5dX3fu5JAmEr/bg=; b=I+I4q8oRAJk/eCnHpOk3iWKCv2WZbdPRwAzbDTZc08q2hcQ2CVQ9pj1uqr3PIrZGTL nc4zn3ZO1upXB8UHGCZMlfm3v8MU34ECc2E7tIei24Rr3SMoFo4F50wVUmOXXmxNcZHE lia+jyTgYalSSBAgjo3jHRJtFVaqrq0iBAoY0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=QH4bDvioddqF2VGhqVL2CKwgS6mF5dX3fu5JAmEr/bg=; b=QGCBmxpTjyayDvAucs+X3h0dNTOTEDm5F1ChNL9UZJBmP65HwJUc0Sp/BBvjtLyf8B cqWhZQADb+JlJbYdkESrz3KtGQPUCHsdAyJszfKgd5Eff3d7ruLXcyf6DlV28JrUhqZd d2Ukm7pWYM6XxM+f14KWGHq2GsU4OkSnQm3xL8XRh0XdfXaZrBmO26zhgtlx2rjUBfjp m7wRx+YHuVLl5VVli25t1jyH2H8/f7dq2i2Vcc7OGQ8c9CuToey1Vd+V5d62w6TCNdB5 MXuVvTlFkSbqCDMZvE7Rm7f2OVjVun86knBpJVghfcUZHz0O55Odd0+k1q74/HIBmDSh QrPw== X-Gm-Message-State: AOPr4FWRj1JsZcUdTxmpRL95ioW7yosc/Qv/UPCXiqZYxBPGATgLoEPFqZXGiJ5+EYG+sg== X-Received: by 10.28.178.129 with SMTP id b123mr19440392wmf.2.1463416893980; Mon, 16 May 2016 09:41:33 -0700 (PDT) Received: from sles11esa.localdomain ([195.97.110.117]) by smtp.gmail.com with ESMTPSA id a63sm8498026wmh.11.2016.05.16.09.41.31 (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 16 May 2016 09:41:33 -0700 (PDT) From: Pantelis Antoniou To: Rob Herring Cc: Frank Rowand , Matt Porter , Koen Kooi , Guenter Roeck , Marek Vasut , Wolfram Sang , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org, Pantelis Antoniou , Pantelis Antoniou Subject: [PATCH v2 1/5] of: dynamic: Add __of_node_dupv() Date: Mon, 16 May 2016 19:41:24 +0300 Message-Id: <1463416888-22044-2-git-send-email-pantelis.antoniou@konsulko.com> X-Mailer: git-send-email 1.7.12 In-Reply-To: <1463416888-22044-1-git-send-email-pantelis.antoniou@konsulko.com> References: <1463416888-22044-1-git-send-email-pantelis.antoniou@konsulko.com> Sender: linux-i2c-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org Add an __of_node_dupv() private method and make __of_node_dup() use it. This is required for the subsequent changeset accessors which will make use of it. Signed-off-by: Pantelis Antoniou --- drivers/of/dynamic.c | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/drivers/of/dynamic.c b/drivers/of/dynamic.c index 4145b44..e4dea94 100644 --- a/drivers/of/dynamic.c +++ b/drivers/of/dynamic.c @@ -394,8 +394,9 @@ struct property *__of_prop_dup(const struct property *prop, gfp_t allocflags) } /** - * __of_node_dup() - Duplicate or create an empty device node dynamically. - * @fmt: Format string (plus vargs) for new full name of the device node + * __of_node_dupv() - Duplicate or create an empty device node dynamically. + * @fmt: Format string for new full name of the device node + * @vargs: va_list containing the arugments for the node full name * * Create an device tree node, either by duplicating an empty node or by allocating * an empty one suitable for further modification. The node data are @@ -403,17 +404,15 @@ struct property *__of_prop_dup(const struct property *prop, gfp_t allocflags) * OF_DETACHED bits set. Returns the newly allocated node or NULL on out of * memory error. */ -struct device_node *__of_node_dup(const struct device_node *np, const char *fmt, ...) +struct device_node *__of_node_dupv(const struct device_node *np, + const char *fmt, va_list vargs) { - va_list vargs; struct device_node *node; node = kzalloc(sizeof(*node), GFP_KERNEL); if (!node) return NULL; - va_start(vargs, fmt); node->full_name = kvasprintf(GFP_KERNEL, fmt, vargs); - va_end(vargs); if (!node->full_name) { kfree(node); return NULL; @@ -445,6 +444,24 @@ struct device_node *__of_node_dup(const struct device_node *np, const char *fmt, return NULL; } +/** + * __of_node_dup() - Duplicate or create an empty device node dynamically. + * @fmt: Format string (plus vargs) for new full name of the device node + * + * See: __of_node_dupv() + */ +struct device_node *__of_node_dup(const struct device_node *np, + const char *fmt, ...) +{ + va_list vargs; + struct device_node *node; + + va_start(vargs, fmt); + node = __of_node_dupv(np, fmt, vargs); + va_end(vargs); + return node; +} + static void __of_changeset_entry_destroy(struct of_changeset_entry *ce) { of_node_put(ce->np);