Received: by 2002:ac0:de83:0:0:0:0:0 with SMTP id b3csp594017imk; Sun, 3 Jul 2022 04:22:31 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sv8UQ1xmMA7Kvwv4GT5NSevs8vU9PIf7lZBQRgcJmtqhedTjb2hRIc6uLCAjnyPG5zt80T X-Received: by 2002:a17:906:9508:b0:726:9589:6da7 with SMTP id u8-20020a170906950800b0072695896da7mr10004675ejx.505.1656847351365; Sun, 03 Jul 2022 04:22:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656847351; cv=none; d=google.com; s=arc-20160816; b=FDpWrrvzWEip0OFhNh4mmA0VG7sqnT5hBGYOk5EhUMSl1RyLbRhEpsq8XL6PvojuAl nkxUq+P3hctJ6fvsq9yeSqpd3YAy0nHt9argqhQoho4P0lm0fCLGsVsKWkva1k3+BJj4 9lzUJ+x3wtK/2Qach9xlvGpKA4GneFNdkeRkiy3abjF+Xoa7AWWJPrDV0bbHJkQSOp0h HvO8w2GUM+jBBk9aOF0y5nNukkK4JtDM+xveHKznL8x0UknqPYXKInWAlpRAiPPuLO3E t88Twb3FmSP6QJpSCQWpAmyG933ODXESG7N3Hn1IZrTert+g8PtVijXIOteyV9dZgYWB eAHw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=yGdqQ4oAuggJEmpNM1D1Sw+hLvuTVREq9oE+Alw71tA=; b=xd+swMJ248PePiT6pyApjqFS4LcRTP/8ejh2IEumCyKu3GkqtI0Y6MF+wqodp18ZLo VzbSjXiMYOtQffIIBH9fR1PZ8SM20lpIqJqQLQM05xtiUeR6VNEBR9X8oFmpuZ1oCjDI Ey/7AIJiomkwnsm2uaTkhlXnMx0M45DCT/j+/HQ1nVtWANG/OEonqUBLAyiV9wrVbRlY Y/duNKFCNgqq7R2FuLYc4soLzQtqSH7eE+Tqyhdp36cG7xsSjmjm2efzj+gK12Oe4iLd 8xeHs4q1aMeNzoq3NKZ0J2R2XgP9BxlYz6IEFfXQOSrXrvAThjukf7rHXrX+xcycPBur TSLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=EG+vkCFg; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id kt10-20020a170906aaca00b00726bdd2064dsi19058068ejb.3.2022.07.03.04.22.06; Sun, 03 Jul 2022 04:22:31 -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=@gmail.com header.s=20210112 header.b=EG+vkCFg; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232715AbiGCLUh (ORCPT + 99 others); Sun, 3 Jul 2022 07:20:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40668 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232694AbiGCLUX (ORCPT ); Sun, 3 Jul 2022 07:20:23 -0400 Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D2899A458; Sun, 3 Jul 2022 04:20:22 -0700 (PDT) Received: by mail-wr1-x42f.google.com with SMTP id o4so9471974wrh.3; Sun, 03 Jul 2022 04:20:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=yGdqQ4oAuggJEmpNM1D1Sw+hLvuTVREq9oE+Alw71tA=; b=EG+vkCFgVJoNQmekAArWwhAIumrg5B9uWzpello5Vp+bS2/wq4tdmTeIUPTizpCB75 ZKndRpeWlUGYYWnRKCkM3mUqQ03DggomNogks1Tk0/PmueWOvqbBSiNtmri1j87Ga0+B ZbB3tj6DXGApQCCQRFGbSWja7kdb8NVRKlz6/hhGePxSA/NrMJz5YcqhyRugr8coFW5S nKutK5XQq+JMPOVWBH3JyJY9JJpH7LUmmOPIJfLVEkUnKiaLURHIKRJlRDuw22MAZCdj KBEVD1bvV2LdHFIt7qimYhPKGhivQFDaMGTFix6jdNQU8hniPzLclR4YG+zh2l7N9ydx d2Og== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=yGdqQ4oAuggJEmpNM1D1Sw+hLvuTVREq9oE+Alw71tA=; b=o/N6fSIu/RXxrHnfnt2XmoAIS+A5NzvLL7KHBBbj1mh5jBJYO+LvmiJLB1cOjQj7ha pwztGnxG6eduVd7mrz3MxWJPqojoBaN036GBpg4AiUkinjVPSCnQKT5vtPlPhfvCNoas z3ZxsHjRK8w05Bg5ALTtYH13q0vK5Gn4noBUzt759912CfLUXP/eu0OMECyD6NOhEdQ7 a1lGHWtYAqJ3haXeCTj7hObwgU47TUklHv5kSo4ttbAGd0AK0fB30Yg5MGXpDIHAi772 LXobbuxL49YoK1ifepOAs+Q0+zCxaN7oYR/s5XLHWS9eRaYH428XFgcoy3y2WxSuCPD/ wk4A== X-Gm-Message-State: AJIora9IoT2FVTzCmvqh5fFnadu3j+JG/lWzmVBfpAPavOHqthCcoYMV yHnQrPJjk1+9AyrUrvSml/M= X-Received: by 2002:a5d:4d8e:0:b0:21d:68d4:56eb with SMTP id b14-20020a5d4d8e000000b0021d68d456ebmr1571358wru.40.1656847221425; Sun, 03 Jul 2022 04:20:21 -0700 (PDT) Received: from localhost (92.40.202.9.threembb.co.uk. [92.40.202.9]) by smtp.gmail.com with ESMTPSA id q5-20020adff945000000b0021b9585276dsm26735987wrr.101.2022.07.03.04.20.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Jul 2022 04:20:20 -0700 (PDT) From: Aidan MacDonald To: broonie@kernel.org Cc: gregkh@linuxfoundation.org, rafael@kernel.org, andy.shevchenko@gmail.com, krzk@kernel.org, m.szyprowski@samsung.com, mazziesaccount@gmail.com, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org Subject: [PATCH v3 07/12] regmap-irq: Refactor checks for status bulk read support Date: Sun, 3 Jul 2022 12:20:56 +0100 Message-Id: <20220703112101.24493-8-aidanmacdonald.0x0@gmail.com> In-Reply-To: <20220703112101.24493-1-aidanmacdonald.0x0@gmail.com> References: <20220703112101.24493-1-aidanmacdonald.0x0@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,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: X-Mailing-List: linux-kernel@vger.kernel.org There are several conditions that must be satisfied to support bulk read of status registers. Move the check into a function to avoid duplicating it in two places. Signed-off-by: Aidan MacDonald --- drivers/base/regmap/regmap-irq.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/drivers/base/regmap/regmap-irq.c b/drivers/base/regmap/regmap-irq.c index 7e93dd8af56b..5f9a5856c45e 100644 --- a/drivers/base/regmap/regmap-irq.c +++ b/drivers/base/regmap/regmap-irq.c @@ -73,6 +73,14 @@ struct regmap_irq *irq_to_regmap_irq(struct regmap_irq_chip_data *data, return &data->chip->irqs[irq]; } +static bool regmap_irq_can_bulk_read_status(struct regmap_irq_chip_data *data) +{ + struct regmap *map = data->map; + + return data->irq_reg_stride == 1 && map->reg_stride == 1 && + !map->use_single_read; +} + static void regmap_irq_lock(struct irq_data *data) { struct regmap_irq_chip_data *d = irq_data_get_irq_chip_data(data); @@ -467,8 +475,7 @@ static irqreturn_t regmap_irq_thread(int irq, void *d) } } - } else if (!map->use_single_read && map->reg_stride == 1 && - data->irq_reg_stride == 1) { + } else if (regmap_irq_can_bulk_read_status(data)) { u8 *buf8 = data->status_reg_buf; u16 *buf16 = data->status_reg_buf; @@ -729,8 +736,7 @@ int regmap_add_irq_chip_fwnode(struct fwnode_handle *fwnode, else d->irq_reg_stride = 1; - if (!map->use_single_read && map->reg_stride == 1 && - d->irq_reg_stride == 1) { + if (regmap_irq_can_bulk_read_status(d)) { d->status_reg_buf = kmalloc_array(chip->num_regs, map->format.val_bytes, GFP_KERNEL); -- 2.35.1