Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754214AbaEAAhY (ORCPT ); Wed, 30 Apr 2014 20:37:24 -0400 Received: from arroyo.ext.ti.com ([192.94.94.40]:51402 "EHLO arroyo.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753881AbaEAAhS (ORCPT ); Wed, 30 Apr 2014 20:37:18 -0400 From: Suman Anna To: Ohad Ben-Cohen , Mark Rutland , Kumar Gala CC: Tony Lindgren , Josh Cartwright , Bjorn Andersson , , , , , Suman Anna Subject: [PATCHv5 RFC 13/15] hwspinlock/omap: use OF helper to get reserved locks Date: Wed, 30 Apr 2014 19:34:34 -0500 Message-ID: <1398904476-26200-14-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 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Retrieve the number of reserved locks for OMAP by using the of_hwspin_lock_get_num_reserved_locks() OF helper function provided by the hwspinlock core. The range sanity check will be performed by the hwspinlock core during the registration. Signed-off-by: Suman Anna --- drivers/hwspinlock/omap_hwspinlock.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/hwspinlock/omap_hwspinlock.c b/drivers/hwspinlock/omap_hwspinlock.c index 1d0c78e..0dad783 100644 --- a/drivers/hwspinlock/omap_hwspinlock.c +++ b/drivers/hwspinlock/omap_hwspinlock.c @@ -143,6 +143,12 @@ static int omap_hwspinlock_probe(struct platform_device *pdev) for (i = 0, hwlock = &bank->lock[0]; i < num_locks; i++, hwlock++) hwlock->priv = io_base + LOCK_BASE_OFFSET + sizeof(u32) * i; + reserved_locks = of_hwspin_lock_get_num_reserved_locks(node); + if (reserved_locks < 0) { + ret = -EINVAL; + goto iounmap_base; + } + ret = hwspin_lock_register(bank, &pdev->dev, &omap_hwspinlock_ops, base_id, num_locks, reserved_locks); if (ret) -- 1.9.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/