From patchwork Wed Oct 15 11:01:42 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 38775 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f199.google.com (mail-lb0-f199.google.com [209.85.217.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 039AB20C4E for ; Wed, 15 Oct 2014 11:02:02 +0000 (UTC) Received: by mail-lb0-f199.google.com with SMTP id w7sf569651lbi.2 for ; Wed, 15 Oct 2014 04:02:01 -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=81cZuy5g2D/2Dt/qwLS+sR+av0WvZWV9HYiJ8n5j49w=; b=C4CiM2M3jXcFhYEwZhfAcGNWvohMgfx6XZZ2ilMKCjpJ0xMFiepHDBcX2jEZfkcfGm L8Liat//IUjOtH+5hAD49s0+FG48SBwbYMeWKEF8PbT16Me5J1Rl5ASfsOwN14mUTk4c llPTgBfADJ9wULbJ5fjRm+p9Oo5yzArbBF6dU+L+Tjh7asPgilr7YzGa/eoq+G4DpkIr TA38g+C0HUVFQCDh78+AI+uSWE1akKqlID3qqxC9H9x0WSvIpaSBWeSUITMs3wo/l0bq Gme+wuEb8/yuvLAR4+NOdCju4Cy0v0Sqq/PdPtEQHA1dJ9NXBprgMxn5tc/LEQB3LN7y lcvA== X-Gm-Message-State: ALoCoQmgy+Mrhe6z+ykZT9zhMHG7Xq+K8ThPSxbtnnVcJ42JR3M9T7f7csWkWYLc5/A4L+D54eBV X-Received: by 10.112.141.230 with SMTP id rr6mr1948289lbb.4.1413370921348; Wed, 15 Oct 2014 04:02:01 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.28.133 with SMTP id b5ls43230lah.26.gmail; Wed, 15 Oct 2014 04:02:01 -0700 (PDT) X-Received: by 10.152.21.39 with SMTP id s7mr11656109lae.0.1413370921171; Wed, 15 Oct 2014 04:02:01 -0700 (PDT) Received: from mail-la0-f48.google.com (mail-la0-f48.google.com [209.85.215.48]) by mx.google.com with ESMTPS id j2si29977233lbv.86.2014.10.15.04.02.01 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 15 Oct 2014 04:02:01 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.48 as permitted sender) client-ip=209.85.215.48; Received: by mail-la0-f48.google.com with SMTP id gi9so803176lab.21 for ; Wed, 15 Oct 2014 04:02:00 -0700 (PDT) X-Received: by 10.112.189.10 with SMTP id ge10mr11322698lbc.23.1413370920903; Wed, 15 Oct 2014 04:02:00 -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 c5csp569568lbz; Wed, 15 Oct 2014 04:02:00 -0700 (PDT) X-Received: by 10.70.127.134 with SMTP id ng6mr10179756pdb.138.1413370918189; Wed, 15 Oct 2014 04:01:58 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ca3si4007710pdb.140.2014.10.15.04.01.57 for ; Wed, 15 Oct 2014 04:01:58 -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 S1752093AbaJOLBx (ORCPT + 27 others); Wed, 15 Oct 2014 07:01:53 -0400 Received: from mailout1.w1.samsung.com ([210.118.77.11]:59929 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751118AbaJOLBw (ORCPT ); Wed, 15 Oct 2014 07:01:52 -0400 Received: from eucpsbgm2.samsung.com (unknown [203.254.199.245]) by mailout1.w1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0NDH00I8DG3WMK80@mailout1.w1.samsung.com> for linux-kernel@vger.kernel.org; Wed, 15 Oct 2014 12:04:44 +0100 (BST) X-AuditID: cbfec7f5-b7f776d000003e54-82-543e541d2cfa Received: from eusync4.samsung.com ( [203.254.199.214]) by eucpsbgm2.samsung.com (EUCPMTA) with SMTP id 19.58.15956.D145E345; Wed, 15 Oct 2014 12:01:49 +0100 (BST) Received: from amdc1339.digital.local ([106.116.147.30]) by eusync4.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0NDH001MJFYYKY50@eusync4.samsung.com>; Wed, 15 Oct 2014 12:01:49 +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 , Russell King , Stephen Rothwell Subject: [PATCH v4] drivers: of: add return value to of_reserved_mem_device_init Date: Wed, 15 Oct 2014 13:01:42 +0200 Message-id: <1413370902-28187-1-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.9.2 In-reply-to: <13963062.ORRNOhrvYD@wuerfel> References: <13963062.ORRNOhrvYD@wuerfel> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrFLMWRmVeSWpSXmKPExsVy+t/xa7qyIXYhBktnSFjMWb+GzeLvpGPs Fgf+7GC0WNndzGaxc907RouzTW/YLbZ3zmC3+HLlIZPFpsfXWC0u75rDZrH2yF12iwXHW1gt Nn94yWaxde9Vdgc+j5bmHjaP378mMXo03rjB5nG5r5fJo+vtFSaPO9f2sHmcmPGbxWPzknqP 2/8eM3us+/OKyaNvyypGj8+b5AJ4orhsUlJzMstSi/TtErgyli9/yF4wTbbiwOS6BsZTEl2M nBwSAiYSc9YdZYOwxSQu3FsPZHNxCAksZZTY9OUJM4TTxySxdNtSRpAqNgFDia63XWAdIgJu Ev/WHQLrYBZ4wyyx+sB/IIeDQ1ggQGLlZR+QGhYBVYmDS9+B9fIKeEgcnn+OCWKbnMT/lyvA bE4BLYmFm0+BzRQS0JSYc/YN4wRG3gWMDKsYRVNLkwuKk9JzjfSKE3OLS/PS9ZLzczcxQsL7 6w7GpcesDjEKcDAq8fByHLANEWJNLCuuzD3EKMHBrCTCm+hvFyLEm5JYWZValB9fVJqTWnyI kYmDU6qBke3ZLOlmG+7u9hBOs52XFZ63HV3ouVRtL9OJ94r7+KruVaXvuXSN0Ty7pXm6sWOk 2wmt/J9rd5rpMZaHneEyFf4RmN9c8GHfsTW8PvpHD07/EPujZk/rOubWiNSqQPcDp9iNGcue Hrg+x9bgwgXd3PiAkg11BT3f92Y6uj5r+84rXW5XMDVPiaU4I9FQi7moOBEAq/TeBE0CAAA= 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.215.48 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 --- This patch fixes build warining caused by commit 7bfa5ab6fa1b18f53fb94f922e107e6fbdc5e485 ("drivers: dma-coherent: add initialization from device tree"), which has been merged without this change and without fixing function return value. --- drivers/base/dma-contiguous.c | 3 ++- drivers/of/of_reserved_mem.c | 14 +++++++++----- include/linux/of_reserved_mem.h | 9 ++++++--- 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/drivers/base/dma-contiguous.c b/drivers/base/dma-contiguous.c index 473ff4892401..950fff9ce453 100644 --- a/drivers/base/dma-contiguous.c +++ b/drivers/base/dma-contiguous.c @@ -223,9 +223,10 @@ bool dma_release_from_contiguous(struct device *dev, struct page *pages, #undef pr_fmt #define pr_fmt(fmt) fmt -static void rmem_cma_device_init(struct reserved_mem *rmem, struct device *dev) +static int rmem_cma_device_init(struct reserved_mem *rmem, struct device *dev) { dev_set_cma_area(dev, rmem->priv); + return 0; } static void rmem_cma_device_release(struct reserved_mem *rmem, diff --git a/drivers/of/of_reserved_mem.c b/drivers/of/of_reserved_mem.c index 59fb12e84e6b..dc566b38645f 100644 --- a/drivers/of/of_reserved_mem.c +++ b/drivers/of/of_reserved_mem.c @@ -243,23 +243,27 @@ 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; + int ret; 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; + + ret = rmem->ops->device_init(rmem, dev); + if (ret == 0) + dev_info(dev, "assigned reserved memory node %s\n", rmem->name); - rmem->ops->device_init(rmem, dev); - dev_info(dev, "assigned reserved memory node %s\n", rmem->name); + return ret; } /** diff --git a/include/linux/of_reserved_mem.h b/include/linux/of_reserved_mem.h index 5b5efae09135..ad2f67054372 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) { }