Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 018CAC433DF for ; Tue, 9 Jun 2020 14:35:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C37C72078C for ; Tue, 9 Jun 2020 14:35:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591713335; bh=yTSfLVVa/4q+G+xdsELkHjOQHjS5m+v+/oO7DnmXjtA=; h=From:To:Cc:Subject:Date:List-ID:From; b=qq0g6VgaUuvium4jB9MkrM9b5Uc76Ji4IcenKj8fkl12KFBlNI9v0mpDg8sK3Fwcu hn85PDGcUi2ref2UznEAsjnCcZgX6CLQ0dupOgp82TmWi4NLZdH9XONGhi8989q4WA uZedpGRSr6Y0Nm1AM/ZJzhFjQTZS6VniBMqqDz0I= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728601AbgFIOfd (ORCPT ); Tue, 9 Jun 2020 10:35:33 -0400 Received: from mail.kernel.org ([198.145.29.99]:36740 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726395AbgFIOfc (ORCPT ); Tue, 9 Jun 2020 10:35:32 -0400 Received: from kozik-lap.mshome.net (unknown [194.230.155.184]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6BA1D20737; Tue, 9 Jun 2020 14:35:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591713331; bh=yTSfLVVa/4q+G+xdsELkHjOQHjS5m+v+/oO7DnmXjtA=; h=From:To:Cc:Subject:Date:From; b=zsfYWaBDkGkeoxhKp+mefjDW+8CjhVFjt2Eer1p60QQL5qumj3yqgRIJZmz1d+qQG fzGWEB7WuHNskWGeHp7au4unqLwjGvcWy18GhNoaX4fPEfBmgW87JRwWIUyLXHMWKc TlqrlTtSSnQUmaslRbWeHAUVoB2ovIi0RPYMHwZw= From: Krzysztof Kozlowski To: stable@vger.kernel.org Cc: Stefan Agner , Mark Brown , Thierry Reding , Krzysztof Kozlowski Subject: [PATCH STABLE v4.4+] pwm: fsl-ftm: Use flat regmap cache Date: Tue, 9 Jun 2020 16:35:17 +0200 Message-Id: <20200609143517.31243-1-krzk@kernel.org> X-Mailer: git-send-email 2.17.1 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Stefan Agner commit ad06fdeeef1cbadf86ebbe510e8079abada8b44e upstream. Use flat regmap cache to avoid lockdep warning at probe: [ 0.697285] WARNING: CPU: 0 PID: 1 at kernel/locking/lockdep.c:2755 lockdep_trace_alloc+0x15c/0x160() [ 0.697449] DEBUG_LOCKS_WARN_ON(irqs_disabled_flags(flags)) The RB-tree regmap cache needs to allocate new space on first writes. However, allocations in an atomic context (e.g. when a spinlock is held) are not allowed. The function regmap_write calls map->lock, which acquires a spinlock in the fast_io case. Since the pwm-fsl-ftm driver uses MMIO, the regmap bus of type regmap_mmio is being used which has fast_io set to true. The MMIO space of the pwm-fsl-ftm driver is reasonable condense, hence using the much faster flat regmap cache is anyway the better choice. Signed-off-by: Stefan Agner Cc: Mark Brown Signed-off-by: Thierry Reding Signed-off-by: Krzysztof Kozlowski --- Fixes lockdep warning. Apply to v4.4 and newer. --- drivers/pwm/pwm-fsl-ftm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pwm/pwm-fsl-ftm.c b/drivers/pwm/pwm-fsl-ftm.c index 7225ac6b3df5..fad968eb75f6 100644 --- a/drivers/pwm/pwm-fsl-ftm.c +++ b/drivers/pwm/pwm-fsl-ftm.c @@ -392,7 +392,7 @@ static const struct regmap_config fsl_pwm_regmap_config = { .max_register = FTM_PWMLOAD, .volatile_reg = fsl_pwm_volatile_reg, - .cache_type = REGCACHE_RBTREE, + .cache_type = REGCACHE_FLAT, }; static int fsl_pwm_probe(struct platform_device *pdev) -- 2.17.1