From patchwork Thu Oct 9 12:18:00 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 38503 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f200.google.com (mail-wi0-f200.google.com [209.85.212.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 13170202DB for ; Thu, 9 Oct 2014 12:18:24 +0000 (UTC) Received: by mail-wi0-f200.google.com with SMTP id cc10sf826999wib.7 for ; Thu, 09 Oct 2014 05:18:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=suua2VVleEYH8mcHiflLHXXkiaFMI6GJteWXaaqB+vU=; b=RUW12P2rAQULN6TXYgV3kFWroXeIvXZS9M1QPO02p6HcnAFyCSCZkcAjqLGhk80lYv NHYB64a4kQogsSmt4hbC+aFme8IH6XqUne/Zg8QLXopUL17A7Mct8BKY8SUzNygCmbNt 1M+I83dpuFINjTpiLkXtuvV7fAhPc2B5SmBJld+38rl8Kf6hQVPPuKLH0Y3Av530oe9O tAO49krdlQjhUFcgjGSaCI3WMBYfvWR1vhHnDdJ4zniZkP0piscoT1EdBpVW04p4s22N zZoT4mOYUCwHTVTos8pQxtKoPHeV7JZWtfbUBTiFPihVMW2OKPE1tdAgRU3VdLKJapqp jH8w== X-Gm-Message-State: ALoCoQkB1fjrCQ6Ar7xs05vl3R+BBNZ+wmJfuSx7MRIpiU4VlWgeoETijLPPEyN4vKvvxmY8ODk4 X-Received: by 10.194.249.134 with SMTP id yu6mr2619336wjc.1.1412857104262; Thu, 09 Oct 2014 05:18:24 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.153.11.164 with SMTP id ej4ls167724lad.83.gmail; Thu, 09 Oct 2014 05:18:24 -0700 (PDT) X-Received: by 10.112.161.234 with SMTP id xv10mr17443715lbb.96.1412857103960; Thu, 09 Oct 2014 05:18:23 -0700 (PDT) Received: from mail-lb0-f179.google.com (mail-lb0-f179.google.com [209.85.217.179]) by mx.google.com with ESMTPS id 1si4120708lai.41.2014.10.09.05.18.23 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 09 Oct 2014 05:18:23 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.179 as permitted sender) client-ip=209.85.217.179; Received: by mail-lb0-f179.google.com with SMTP id l4so974178lbv.24 for ; Thu, 09 Oct 2014 05:18:23 -0700 (PDT) X-Received: by 10.152.22.42 with SMTP id a10mr4076079laf.56.1412857103421; Thu, 09 Oct 2014 05:18:23 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.84.229 with SMTP id c5csp233418lbz; Thu, 9 Oct 2014 05:18:22 -0700 (PDT) X-Received: by 10.60.125.135 with SMTP id mq7mr22422175oeb.11.1412857101932; Thu, 09 Oct 2014 05:18:21 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g9si376823oif.54.2014.10.09.05.18.19 for ; Thu, 09 Oct 2014 05:18:20 -0700 (PDT) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755695AbaJIMSR (ORCPT + 27 others); Thu, 9 Oct 2014 08:18:17 -0400 Received: from mailout4.w1.samsung.com ([210.118.77.14]:47532 "EHLO mailout4.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754562AbaJIMSJ (ORCPT ); Thu, 9 Oct 2014 08:18:09 -0400 Received: from eucpsbgm1.samsung.com (unknown [203.254.199.244]) by mailout4.w1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0ND60003UFMU6570@mailout4.w1.samsung.com> for linux-kernel@vger.kernel.org; Thu, 09 Oct 2014 13:20:54 +0100 (BST) X-AuditID: cbfec7f4-b7f156d0000063c7-27-54367cfea7e0 Received: from eusync2.samsung.com ( [203.254.199.212]) by eucpsbgm1.samsung.com (EUCPMTA) with SMTP id 54.41.25543.EFC76345; Thu, 09 Oct 2014 13:18:06 +0100 (BST) Received: from amdc1339.digital.local ([106.116.147.30]) by eusync2.samsung.com (Oracle Communications Messaging Server 7u4-23.01 (7.0.4.23.0) 64bit (built Aug 10 2011)) with ESMTPA id <0ND600F1MFI2LP70@eusync2.samsung.com>; Thu, 09 Oct 2014 13:18:06 +0100 (BST) From: Marek Szyprowski To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Marek Szyprowski , linaro-mm-sig@lists.linaro.org, Arnd Bergmann , Michal Nazarewicz , Andrew Morton , Grant Likely , Laura Abbott , Josh Cartwright , Joonsoo Kim , Kyungmin Park Subject: [PATCH v3] drivers: of: add return value to of_reserved_mem_device_init Date: Thu, 09 Oct 2014 14:18:00 +0200 Message-id: <1412857080-5100-1-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.9.2 In-reply-to: <1410434561-9294-2-git-send-email-m.szyprowski@samsung.com> References: <1410434561-9294-2-git-send-email-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrGLMWRmVeSWpSXmKPExsVy+t/xK7r/asxCDC402FrMWb+GzeLvpGPs Fgf+7GC0WNndzGaxc907RouzTW/YLbZ3zmC3+HLlIZPFpsfXWC0u75rDZrH2yF12iwXHW1gd eDx+/5rE6HG5r5fJo+vtFSaPO9f2sHmcmPGbxWPzknqP2/8eM3us+/OKyaNvyypGj8+b5AK4 orhsUlJzMstSi/TtErgyPp1azVxwXaTiz9zdjA2MSwS7GDk5JARMJNatb2aHsMUkLtxbzwZi CwksZZRov2DZxcgFZPcxSRycuBCsiE3AUKLrbRdYkYiAm8S/dYfYQIqYBSYzS1xbuIepi5GD Q1ggQOLmIwOQGhYBVYntV66C1fMKuEscaTzACrFMTuL/yxVMIDangIdE+49mFojF7hIXlvxk ncDIu4CRYRWjaGppckFxUnquoV5xYm5xaV66XnJ+7iZGSNh+2cG4+JjVIUYBDkYlHt4H/0xD hFgTy4orcw8xSnAwK4nwvskyCxHiTUmsrEotyo8vKs1JLT7EyMTBKdXAWLGm1/ambbNjiJ6q 7OUe8YdVdgEaE3oyfzSISO0q6l5sF6NqGiBtpDO/aL9rwJ/G6vdPti+5FRnyKkdnz+P4yxW9 cgxqNiV6RX0HywqbWCYcFu17F/vAV6vwRgmjsOwB35TuWSdO6tu+XnElL1pcv+4ge90mAfFG hpZ2hfA7L1cf0t62WkWJpTgj0VCLuag4EQAYArL5OQIAAA== Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: m.szyprowski@samsung.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.179 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Driver calling of_reserved_mem_device_init() might be interested if the initialization has been successful or not, so add support for returning error code. Signed-off-by: Marek Szyprowski --- drivers/of/of_reserved_mem.c | 7 ++++--- include/linux/of_reserved_mem.h | 9 ++++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/drivers/of/of_reserved_mem.c b/drivers/of/of_reserved_mem.c index 59fb12e..70780ad 100644 --- a/drivers/of/of_reserved_mem.c +++ b/drivers/of/of_reserved_mem.c @@ -243,23 +243,24 @@ static inline struct reserved_mem *__find_rmem(struct device_node *node) * This function assign memory region pointed by "memory-region" device tree * property to the given device. */ -void of_reserved_mem_device_init(struct device *dev) +int of_reserved_mem_device_init(struct device *dev) { struct reserved_mem *rmem; struct device_node *np; np = of_parse_phandle(dev->of_node, "memory-region", 0); if (!np) - return; + return -ENODEV; rmem = __find_rmem(np); of_node_put(np); if (!rmem || !rmem->ops || !rmem->ops->device_init) - return; + return -EINVAL; rmem->ops->device_init(rmem, dev); dev_info(dev, "assigned reserved memory node %s\n", rmem->name); + return 0; } /** diff --git a/include/linux/of_reserved_mem.h b/include/linux/of_reserved_mem.h index 5b5efae..ad2f670 100644 --- a/include/linux/of_reserved_mem.h +++ b/include/linux/of_reserved_mem.h @@ -16,7 +16,7 @@ struct reserved_mem { }; struct reserved_mem_ops { - void (*device_init)(struct reserved_mem *rmem, + int (*device_init)(struct reserved_mem *rmem, struct device *dev); void (*device_release)(struct reserved_mem *rmem, struct device *dev); @@ -28,14 +28,17 @@ typedef int (*reservedmem_of_init_fn)(struct reserved_mem *rmem); _OF_DECLARE(reservedmem, name, compat, init, reservedmem_of_init_fn) #ifdef CONFIG_OF_RESERVED_MEM -void of_reserved_mem_device_init(struct device *dev); +int of_reserved_mem_device_init(struct device *dev); void of_reserved_mem_device_release(struct device *dev); void fdt_init_reserved_mem(void); void fdt_reserved_mem_save_node(unsigned long node, const char *uname, phys_addr_t base, phys_addr_t size); #else -static inline void of_reserved_mem_device_init(struct device *dev) { } +static inline int of_reserved_mem_device_init(struct device *dev) +{ + return -ENOSYS; +} static inline void of_reserved_mem_device_release(struct device *pdev) { } static inline void fdt_init_reserved_mem(void) { }