From patchwork Thu May 1 00:34:36 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suman Anna X-Patchwork-Id: 4096671 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 9AF97BFF02 for ; Thu, 1 May 2014 00:38:08 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BB303202DD for ; Thu, 1 May 2014 00:38:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CC3E9201DE for ; Thu, 1 May 2014 00:38:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754310AbaEAAhe (ORCPT ); Wed, 30 Apr 2014 20:37:34 -0400 Received: from bear.ext.ti.com ([192.94.94.41]:54180 "EHLO bear.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751016AbaEAAhb (ORCPT ); Wed, 30 Apr 2014 20:37:31 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id s410b924011383; Wed, 30 Apr 2014 19:37:09 -0500 Received: from DFLE73.ent.ti.com (dfle73.ent.ti.com [128.247.5.110]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id s410b9jm021112; Wed, 30 Apr 2014 19:37:09 -0500 Received: from dflp32.itg.ti.com (10.64.6.15) by DFLE73.ent.ti.com (128.247.5.110) with Microsoft SMTP Server id 14.3.174.1; Wed, 30 Apr 2014 19:37:08 -0500 Received: from legion.dal.design.ti.com (legion.dal.design.ti.com [128.247.22.53]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id s410b8Df011523; Wed, 30 Apr 2014 19:37:08 -0500 Received: from localhost (irmo.am.dhcp.ti.com [128.247.71.175]) by legion.dal.design.ti.com (8.11.7p1+Sun/8.11.7) with ESMTP id s410b8t02530; Wed, 30 Apr 2014 19:37:08 -0500 (CDT) From: Suman Anna To: Ohad Ben-Cohen , Mark Rutland , Kumar Gala CC: Tony Lindgren , Josh Cartwright , Bjorn Andersson , , , , , Suman Anna Subject: [PATCHv5 RFC 15/15] hwspinlock/core: change return codes of_hwspin_lock_request_specific Date: Wed, 30 Apr 2014 19:34:36 -0500 Message-ID: <1398904476-26200-16-git-send-email-s-anna@ti.com> X-Mailer: git-send-email 1.9.2 In-Reply-To: <1398904476-26200-1-git-send-email-s-anna@ti.com> References: <1398904476-26200-1-git-send-email-s-anna@ti.com> MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Changed the return statements to return an ERR_PTR instead of NULL in case of an error. This patch helps with deferred probing of any client users if the corresponding hwspinlock bank is not yet registered with the hwspinlock core. Signed-off-by: Suman Anna --- TODO: Collapse into Patch4, "hwspinlock/core: add common OF helpers" if accepted to go with the current series --- Documentation/hwspinlock.txt | 4 ++-- drivers/hwspinlock/hwspinlock_core.c | 9 +++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Documentation/hwspinlock.txt b/Documentation/hwspinlock.txt index bf1c7e46..10d7ecc 100644 --- a/Documentation/hwspinlock.txt +++ b/Documentation/hwspinlock.txt @@ -50,8 +50,8 @@ independent, drivers. struct hwspinlock *of_hwspin_lock_request_specific( struct device_node *np, const char *propname, int index); - - assign a specific hwspinlock id and return its address, or NULL - if that hwspinlock is already in use. This function is the OF + - assign a specific hwspinlock id and return its address, or an equivalent + ERR_PTR() if that hwspinlock is already in use. This function is the OF equivalent of hwspin_lock_request_specific() function, and provides a means for users of the hwspinlock module to request a specific hwspinlock using the phandle of the hwspinlock device. diff --git a/drivers/hwspinlock/hwspinlock_core.c b/drivers/hwspinlock/hwspinlock_core.c index 56c4303..a838dbd 100644 --- a/drivers/hwspinlock/hwspinlock_core.c +++ b/drivers/hwspinlock/hwspinlock_core.c @@ -722,7 +722,8 @@ EXPORT_SYMBOL_GPL(hwspin_lock_request_specific); * lock number is indexed relative to the hwspinlock device, unlike the * hwspin_lock_request_specific() which is an absolute lock number. * - * Returns the address of the assigned hwspinlock, or NULL on error + * Returns the address of the assigned hwspinlock, or an equivalent + * ERR_PTR() on error */ struct hwspinlock *of_hwspin_lock_request_specific(struct device_node *np, const char *propname, @@ -736,7 +737,7 @@ struct hwspinlock *of_hwspin_lock_request_specific(struct device_node *np, ret = of_parse_phandle_with_args(np, propname, "#hwlock-cells", index, &args); if (ret) - return NULL; + return ERR_PTR(ret); mutex_lock(&hwspinlock_tree_lock); list_for_each_entry(bank, &hwspinlock_devices, list) @@ -744,11 +745,11 @@ struct hwspinlock *of_hwspin_lock_request_specific(struct device_node *np, break; mutex_unlock(&hwspinlock_tree_lock); if (&bank->list == &hwspinlock_devices) - return NULL; + return ERR_PTR(-EPROBE_DEFER); id = bank->ops->of_xlate(bank, &args); if (id < 0 || id >= bank->num_locks) - return NULL; + return ERR_PTR(-EINVAL); id += bank->base_id; return hwspin_lock_request_specific(id);