Message ID | 20230511142735.316445-1-maxime.chevallier@bootlin.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:6358:3046:b0:115:7a1d:dabb with SMTP id p6csp4488240rwl; Thu, 11 May 2023 07:41:26 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6SskS/qZQi5XzqxxOrD2Ig2LVASGhvSynmBph0eQ+UUPtf4APP/50HHkVpINoHH58AW/6Z X-Received: by 2002:a05:6a20:7487:b0:f5:6cb8:105 with SMTP id p7-20020a056a20748700b000f56cb80105mr29262347pzd.45.1683816086060; Thu, 11 May 2023 07:41:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683816086; cv=none; d=google.com; s=arc-20160816; b=yr1cJhwQxTuh6e1cxkSaUOvl/kaU7KYtB8b1kR6JYbVBRf8pg64WaSCZ/UJlne6VzS 1gbZJ4TakaBHEyyxGD4EWlGpeQH7AaQ4EbZbHx6iCKat/vxBphvIrkCeZLGe7nvB62Dy JakYok80U6nqdgrZNiWzLMoOAfwdo0YL33WVxUGxS9LXOXHS83+S/KJC3D3Ox8tZ/Oei 08pR2GdTQwOEc9jfw00WnTliY6EN/1Ln/6FXAKCFj8obSYRN468qc8cceHR6Vl5vIfQ+ XF/iP/pfer6i/+s7G6S0HacRCubdg0wrtLS22XBXJ3TTjat0XIg4ybUMndR5ZMjBMFgT QlrA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=ug+p6iCVf1udbSgRyqpW9GXjPr5g4rDBs4xk10bbhb4=; b=jH4P77Hbie6Hfnm6Xd0zu4BYGCyeGSbdWm1f86UjwaBuv/M3CQyKRTHPcAUizU/Iq2 ynvhmXvBrRVf/Nl8QaF8qaLnCR/TO2dLMQ8zJHl1QOG1DZ+fZdyt9w3y6Xpxgn4O7mOb bQ/d/nb5S6+UIjaIcDVWSV7yhV5kAGgC5VgYqgJFRFLuCL0GMlBK4dC4S91s72rdZeZq 2vVO9lmCY4hHvnowhQwkX7ZgDzG+CPlxsT7Z7oA/9uW7b3znMIAfO2ur4YCzBQZtyqRh YOS3WkelFZzFmakECigfwEt6mfI8obvpwUCa3zD/PTHhF22e2XIvb/FzaW2fD0aCwdak sozw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=c51IF4h2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z1-20020a63b901000000b0051b554df1besi6464210pge.840.2023.05.11.07.41.13; Thu, 11 May 2023 07:41:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=c51IF4h2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238526AbjEKO3m (ORCPT <rfc822;peekingduck44@gmail.com> + 99 others); Thu, 11 May 2023 10:29:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44030 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238522AbjEKO3Y (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 11 May 2023 10:29:24 -0400 Received: from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net [217.70.183.195]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 919C61162E for <linux-kernel@vger.kernel.org>; Thu, 11 May 2023 07:28:21 -0700 (PDT) Received: (Authenticated sender: maxime.chevallier@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id 9DB0660006; Thu, 11 May 2023 14:27:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1683815257; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=ug+p6iCVf1udbSgRyqpW9GXjPr5g4rDBs4xk10bbhb4=; b=c51IF4h2kvzjIHi4IVnW5nBHSP3LXsR/MIfPMBzfbQvEyDh/KRmu7vXIjsd/zDY3y2ZlEr vEAfYjbVvVjOUTmEV9LuagCdnE4GWAsunUWjHy23ZUZnA0jBoPTuv857888c+0qsay9FYZ /J4g1mj6raAMJ728V+un4jM5YHa6CFMvGRNX+2CQIgvWA9rbDVoqCc2BoTH4CF8nyhQXjf JKQ+tu1KPcioi880HgOZUBdg4bYx3r/EyCv3qC6PVivqY3dr+rdLWluJQsYLilVEB00Df/ mylDHCsoesiC1ImhyJ9uhspKWmqEiIECrKKEQOKbyMtbimworshw1+QsztnrKA== From: Maxime Chevallier <maxime.chevallier@bootlin.com> To: Mark Brown <broonie@kernel.org>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, "Rafael J . Wysocki" <rafael@kernel.org>, Colin Foster <colin.foster@in-advantage.com> Cc: Maxime Chevallier <maxime.chevallier@bootlin.com>, linux-kernel@vger.kernel.org, thomas.petazzoni@bootlin.com, alexis.lothore@bootlin.com Subject: [PATCH] regmap: mmio: Allow passing an empty config->reg_stride Date: Thu, 11 May 2023 16:27:35 +0200 Message-Id: <20230511142735.316445-1-maxime.chevallier@bootlin.com> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1765609136737143344?= X-GMAIL-MSGID: =?utf-8?q?1765609136737143344?= |
Series |
regmap: mmio: Allow passing an empty config->reg_stride
|
|
Commit Message
Maxime Chevallier
May 11, 2023, 2:27 p.m. UTC
Regmap's stride is used for MMIO regmaps to check the correctness of
reg_width. However, it's acceptable to pass an empty config->reg_stride,
in that case the actual stride used is 1.
There are valid cases now to pass an empty stride, when using
down/upshifting of register address. In this case, the stride value
loses its sense, so ignore the reg_width when the stride isn't set.
Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
---
This patch is a followup on the discussion here [1]. The regmap core
actually supports pretty-well not passing a stride, and uses a value of
1 by default. However regmap-mmio has specific checks for that case,
which is the only place such a check needs to be added.
[1] : https://lore.kernel.org/all/20230420150617.381922-1-maxime.chevallier@bootlin.com/
drivers/base/regmap/regmap-mmio.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
On Thu, 11 May 2023 16:27:35 +0200, Maxime Chevallier wrote: > Regmap's stride is used for MMIO regmaps to check the correctness of > reg_width. However, it's acceptable to pass an empty config->reg_stride, > in that case the actual stride used is 1. > > There are valid cases now to pass an empty stride, when using > down/upshifting of register address. In this case, the stride value > loses its sense, so ignore the reg_width when the stride isn't set. > > [...] Applied to https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap.git for-next Thanks! [1/1] regmap: mmio: Allow passing an empty config->reg_stride commit: e12ff28764937dd58c8613f16065da60da149048 All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted. You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed. If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced. Please add any relevant lists and maintainers to the CCs when replying to this mail. Thanks, Mark
diff --git a/drivers/base/regmap/regmap-mmio.c b/drivers/base/regmap/regmap-mmio.c index 3ccdd86a97e7..8132b5c101c4 100644 --- a/drivers/base/regmap/regmap-mmio.c +++ b/drivers/base/regmap/regmap-mmio.c @@ -448,7 +448,7 @@ static struct regmap_mmio_context *regmap_mmio_gen_context(struct device *dev, if (min_stride < 0) return ERR_PTR(min_stride); - if (config->reg_stride < min_stride) + if (config->reg_stride && config->reg_stride < min_stride) return ERR_PTR(-EINVAL); if (config->use_relaxed_mmio && config->io_port)