From patchwork Fri Nov 3 11:43:16 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 117877 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp3354392qgn; Fri, 3 Nov 2017 04:43:24 -0700 (PDT) X-Google-Smtp-Source: ABhQp+QCmyUvWImndSJiK9uaLr9V3VfwJniI96uXRh9HXeEfDzK88WgrCbywKNwUPIF8k0Y/jc3o X-Received: by 10.84.131.109 with SMTP id 100mr6691125pld.140.1509709404015; Fri, 03 Nov 2017 04:43:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1509709404; cv=none; d=google.com; s=arc-20160816; b=W3tb35pTqn7e19kEDKKLd0xw15en/DAAN5mzPPivW5a94wmKWtPuESA16dIKXvKGjQ wp+0Q2giOSUx4uJ/Oru/BrjgOfFQon6U2hPfKCr0LRwiXx2iBrrYJHyfuksZOGMNMxx2 mi9QFsrNtN7IlO/DGXQOaM519Ea1FddBV5aJetfYD4kpVV9UDnDajLc3BLFFPAEnPgef oJmiLQavoW7QVaXL+0/Md6LuQCSQnieEkhkTjIZr4Oe4+ws/xJ5t0L/DgqOIXcyaGdIi ZE78gTEraNmPdD2/8drheeDP0HyUNQjgx83n0hy2gPkVUp5Qv9hoQcrZmwGij0SEL2N2 9dvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=iZWOwz8/0sccHYwXho2hNBzN8vsxHOYiRW1raD2inrY=; b=kWnw4UCnk39hUT7YyZ7PCZ2Zo2mIJvqAtAFfDQXMw1f7Fb/CLRaa48CPeZBC3ZE22K x0SnzYU3FQgeCqHozP639EDwGFSTDfZWgg/54AzGXLWWoTgbVXFB/HusaLJDy/8sMx+0 H8MSHfdQyqEfi02/LIZEt3kTxBcnoo0Eugj5Wny2BBnE3JI/xxljwBe2fI1NojZTdgQ4 7bjlFtxMoybM4+cmsvZ1y312JTBxC++c/1nEvpJy86psBOuHsafxuZuqGUVPCLhhjXN9 tyIzqyxHrLUn8mUPZo8t3edw25c5NMXEKE1lM42bPAvJ6edj5PZNxZIuuFVE7SiOAIsB 190A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=uOY5PZZO; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v21si6394575pgc.739.2017.11.03.04.43.23; Fri, 03 Nov 2017 04:43:24 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=uOY5PZZO; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756054AbdKCLnV (ORCPT + 26 others); Fri, 3 Nov 2017 07:43:21 -0400 Received: from heliosphere.sirena.org.uk ([172.104.155.198]:48494 "EHLO heliosphere.sirena.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752854AbdKCLnU (ORCPT ); Fri, 3 Nov 2017 07:43:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sirena.org.uk; s=20170815-heliosphere; h=Message-Id:Date:Subject:Cc:To:From :Sender:Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=iZWOwz8/0sccHYwXho2hNBzN8vsxHOYiRW1raD2inrY=; b=uOY5PZZOhk/kyQ0Gmt5zrCyW+ jfezN9zpwblIZ0ljfhYY5Gkhj34f8SYrPHmmNO84qhQNmGJu7StJXPuWcR/wOkbYxxkID6KCykG06 8M/GYuAkGChTcaV2aq8cohMooj67Zqth6baLPed2cxPuKtXGpZvYuBiRb+g1TLOvxrrhg=; Received: from cpc102320-sgyl38-2-0-cust46.18-2.cable.virginm.net ([82.37.168.47] helo=finisterre.ee.mobilebroadband) by heliosphere.sirena.org.uk with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1eAaNa-0008AG-Ef; Fri, 03 Nov 2017 11:43:18 +0000 Received: by finisterre.ee.mobilebroadband (Postfix, from userid 1000) id C929544005B; Fri, 3 Nov 2017 11:43:17 +0000 (GMT) From: Mark Brown To: Baolin Wang Cc: linux-kernel@vger.kernel.org, Mark Brown Subject: [PATCH] regmap: Add a config option for hwspinlock Date: Fri, 3 Nov 2017 12:43:16 +0100 Message-Id: <20171103114316.1738-1-broonie@kernel.org> X-Mailer: git-send-email 2.14.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Unlike other lock types hwspinlocks are optional and can be built modular so we can't use them unconditionally in regmap so add a config option that drivers that want to use hwspinlocks with regmap can select which will ensure that hwspinlock is built in. Signed-off-by: Mark Brown --- drivers/base/regmap/Kconfig | 4 ++++ drivers/base/regmap/regmap.c | 7 +++++++ 2 files changed, 11 insertions(+) -- 2.14.1 diff --git a/drivers/base/regmap/Kconfig b/drivers/base/regmap/Kconfig index 073c0b77e5b3..2d5e849f79c9 100644 --- a/drivers/base/regmap/Kconfig +++ b/drivers/base/regmap/Kconfig @@ -5,6 +5,7 @@ config REGMAP default y if (REGMAP_I2C || REGMAP_SPI || REGMAP_SPMI || REGMAP_W1 || REGMAP_AC97 || REGMAP_MMIO || REGMAP_IRQ) select IRQ_DOMAIN if REGMAP_IRQ + select HWSPINLOCK if REGMAP_HWSPINLOCK bool config REGCACHE_COMPRESSED @@ -36,3 +37,6 @@ config REGMAP_MMIO config REGMAP_IRQ bool + +config REGMAP_HWSPINLOCK + bool diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c index 999e981a174a..ff6ef6a579c6 100644 --- a/drivers/base/regmap/regmap.c +++ b/drivers/base/regmap/regmap.c @@ -414,6 +414,7 @@ static unsigned int regmap_parse_64_native(const void *buf) } #endif +#ifdef REGMAP_HWSPINLOCK static void regmap_lock_hwlock(void *__map) { struct regmap *map = __map; @@ -456,6 +457,7 @@ static void regmap_unlock_hwlock_irqrestore(void *__map) hwspin_unlock_irqrestore(map->hwlock, &map->spinlock_flags); } +#endif static void regmap_lock_mutex(void *__map) { @@ -672,6 +674,7 @@ struct regmap *__regmap_init(struct device *dev, map->unlock = config->unlock; map->lock_arg = config->lock_arg; } else if (config->hwlock_id) { +#ifdef REGMAP_HWSPINLOCK map->hwlock = hwspin_lock_request_specific(config->hwlock_id); if (!map->hwlock) { ret = -ENXIO; @@ -694,6 +697,10 @@ struct regmap *__regmap_init(struct device *dev, } map->lock_arg = map; +#else + ret = -EINVAL; + goto err; +#endif } else { if ((bus && bus->fast_io) || config->fast_io) {