Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp3643347iog; Tue, 21 Jun 2022 03:02:08 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vpxAcyAv1W5WzzHSiyLLan4zO7J4fYa0eur5iFa6WMhhePfV9DTly7+0Qr6Lx+gDFcOtPL X-Received: by 2002:a17:906:6a1a:b0:711:ec13:b7bc with SMTP id qw26-20020a1709066a1a00b00711ec13b7bcmr24979937ejc.688.1655805727791; Tue, 21 Jun 2022 03:02:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655805727; cv=none; d=google.com; s=arc-20160816; b=gOpmd2K9g0fobDFOgKrFap1c3KkxYUjO1E82dYfBAyxJC4ZjoN6G9OpNJDirUsAQq2 rzY2RD72oTTDKC2JsdO3nUqNb2+w13ni9nLaAqAkfMNDFBfYAq9juj1KsFvuJ89CIlja vBCgD9H8bxSc0tN+rkwt5A/oekRrzpfnVa3kUriYM43IIB3KDzvuWdbN2rCC5D+ouh6K I72Ns4kJWOxdJGplCyl77Y8NZp8v0Ubj+foTnCyzO1Xf4j1j2qaN1b44oreys5zgEhgK X6krmMDoMWr7TJ8G7XKdGZxmFvGlvokT3fOe8L/GM2XRwRotpLrxd2bYMfarTIY8pUHJ oM3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=G4W5iRCpxf3logbYUk+vaaUqbarkwwxMMo6upR9gUBQ=; b=egB0b+ODy4xkZxpITxdz06/wbWpd13k0rAdCPa72z72PgZWngVt9Jw0O2N6uRm6uhy 8NYUmMDVqQpmwhE0gAt+GU6UdF2NvlSO6vsAeVHw/Vb4Qp+Ltwy70h4mryxjWg92mSa3 Ft3VOk/rpDCmm9qv6xUNGLh5taJl6oajurusuAVFQSdFhL2GNffibgCraROfzZsEewHV NL7DY5Mu+vyUEduLEu9o/CIuMYMeHVVPi4pzBklJ7TG2u199wpQTTQtt2bA9wO2VLPnC wkJwq4b+Zuy9tsQxGUFlIRVjP/ghPxjdI9Z09ti/Yp69xieU/qOzTveAkEKy/PRg+sAB Mvvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=F0iKTn0I; 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 dx26-20020a170906a85a00b00711cdee84a5si14594354ejb.570.2022.06.21.03.01.40; Tue, 21 Jun 2022 03:02:07 -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=F0iKTn0I; 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 S1348138AbiFUJv5 (ORCPT + 99 others); Tue, 21 Jun 2022 05:51:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34714 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232828AbiFUJvz (ORCPT ); Tue, 21 Jun 2022 05:51:55 -0400 Received: from mail-ed1-x534.google.com (mail-ed1-x534.google.com [IPv6:2a00:1450:4864:20::534]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D66F327B2D; Tue, 21 Jun 2022 02:51:54 -0700 (PDT) Received: by mail-ed1-x534.google.com with SMTP id cf14so8825284edb.8; Tue, 21 Jun 2022 02:51:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=G4W5iRCpxf3logbYUk+vaaUqbarkwwxMMo6upR9gUBQ=; b=F0iKTn0IOPk1RyoIOXx/9fQrQDEUk5S+5p/PPjKPXwc6epvlQST71mWhxR+3waqXCB 8hYjHeK4kQBeh/zfnt8/Gd8m+FNvsHQojomMiE00ZoSMMoPCBmxiqXxRF2r1SU5v9k46 Kv5bnO0ly5N7kd0NckGXgl7qGBHBvHYAhAN63gHHeZyCo6bAMhnaJ2sYiwp3oPpXGEH3 6XchV5hNnxVAkNSd3UVw0UzBrN2cQ6+/VTxPNrklzoDcSUwASVvijaAQrWC95FgtqYxJ fSkvYOc61sxOfweyaUW/pFZcpDp7Gv/lyIqAEKbVzLxcPJEMGWZW70kD4F7aQeiKBMkB jArw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=G4W5iRCpxf3logbYUk+vaaUqbarkwwxMMo6upR9gUBQ=; b=m1nJb6ST5JNEgOTaq9ZEDSi46vEOkK5/8J38nYsY5Sr+9Qe2+PV93ukM5eOd4dEBDG l9ty1nd81ZMEeMMB2tB28DQzRICy33F1oHxFZEe07e15hKM6SN4OZsNkXX8qj9geBc0+ MsG3uE9tBi5CqScOFf+dSQRgDwrfeJBqI2uqEPlcGoM1oO5hC5Xd2UQ8ZpNhxHJMJvqJ 32+GpdtPxS2kv+4FUipJEHGQQBnjaA8ACdbarAswvjz9MjRjDR6WnIXIR/K6czX3POm7 OgLHbScM9P/GqVpm22s0dBdLzyosEbqjBP6RS0K45tMzmpUkBtwKIvPglcW2mDL4CWwM wB3w== X-Gm-Message-State: AJIora9kVg3OyF5Ntp7zo9Wujbid1GN1KTEeJTo4GmtWli/NhA+lchvC zPG+mnO5IoRqdpr6A4/CKh/qdRfX+SeTETKJabo= X-Received: by 2002:aa7:d29a:0:b0:435:705f:1319 with SMTP id w26-20020aa7d29a000000b00435705f1319mr18633856edq.54.1655805113414; Tue, 21 Jun 2022 02:51:53 -0700 (PDT) MIME-Version: 1.0 References: <20220620200644.1961936-1-aidanmacdonald.0x0@gmail.com> <20220620200644.1961936-48-aidanmacdonald.0x0@gmail.com> In-Reply-To: <20220620200644.1961936-48-aidanmacdonald.0x0@gmail.com> From: Andy Shevchenko Date: Tue, 21 Jun 2022 11:51:16 +0200 Message-ID: Subject: Re: [PATCH 47/49] regmap-irq: Add get_irq_reg() callback To: Aidan MacDonald Cc: Mark Brown , Andy Gross , Bjorn Andersson , Srinivas Kandagatla , Banajit Goswami , Greg Kroah-Hartman , "Rafael J. Wysocki" , Chanwoo Choi , Krzysztof Kozlowski , Bartlomiej Zolnierkiewicz , MyungJoo Ham , Michael Walle , Linus Walleij , Bartosz Golaszewski , Thomas Gleixner , Marc Zyngier , Lee Jones , Manivannan Sadhasivam , Cristian Ciocaltea , Chen-Yu Tsai , tharvey@gateworks.com, rjones@gateworks.com, Matti Vaittinen , orsonzhai@gmail.com, baolin.wang7@gmail.com, zhang.lyra@gmail.com, Jernej Skrabec , Samuel Holland , Liam Girdwood , Jaroslav Kysela , Takashi Iwai , Linux Kernel Mailing List , "open list:GPIO SUBSYSTEM" , linux-actions@lists.infradead.org, linux-arm-msm , linux-arm Mailing List , linux-sunxi@lists.linux.dev, ALSA Development Mailing List Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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 On Mon, Jun 20, 2022 at 10:12 PM Aidan MacDonald wrote: > > Replace the internal sub_irq_reg() function with a public callback > that drivers can use when they have more complex register layouts. > The default implementation is regmap_irq_get_irq_reg_linear(), used > if the chip doesn't provide its own callback. ... > + /* > + * While possible that a user-defined get_irq_reg callback might be ->get_irq_reg() > + * linear enough to support bulk reads, most of the time it won't. > + * Therefore only allow them if the default callback is being used. > + */ > return !map->use_single_read && map->reg_stride == 1 && > - data->irq_reg_stride == 1; > + data->irq_reg_stride == 1 && > + data->get_irq_reg == regmap_irq_get_irq_reg_linear; If initially this had been as return _reg_stride && irq_reg_stride && !map->use_single_read; you would have done less changes by squeezing a new condition just in between the other two. It will preserve the grouping of the checks as well. > } ... > + /* > + * Note we can't use get_irq_reg() here because the offsets ->get_irq_reg() > + * in 'subreg' are *not* interchangeable with indices. > + */ ... > + /* > + * For not_fixed_stride, don't use get_irq_reg(). Ditto. > + * It would produce an incorrect result. > + */ ... > + reg = chip->main_status + > + (i * map->reg_stride * > + data->irq_reg_stride); Parentheses are not necessary. And perhaps the last two can be put on a single line. ... > + /* > + * NOTE: This is for backward compatibility only and will be removed FIXME ? > + * when not_fixed_stride is dropped (it's only used by qcom-pm8008). > + */ -- With Best Regards, Andy Shevchenko