[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75VeGfBUq+jhyZ3F9M2JaaSZMe1+y9+-89bQTW0SCRgUkVg@mail.gmail.com>
Date: Tue, 21 Jun 2022 11:51:16 +0200
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: Aidan MacDonald <aidanmacdonald.0x0@...il.com>
Cc: Mark Brown <broonie@...nel.org>, Andy Gross <agross@...nel.org>,
Bjorn Andersson <bjorn.andersson@...aro.org>,
Srinivas Kandagatla <srinivas.kandagatla@...aro.org>,
Banajit Goswami <bgoswami@...eaurora.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
"Rafael J. Wysocki" <rafael@...nel.org>,
Chanwoo Choi <cw00.choi@...sung.com>,
Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>,
Bartlomiej Zolnierkiewicz <b.zolnierkie@...sung.com>,
MyungJoo Ham <myungjoo.ham@...sung.com>,
Michael Walle <michael@...le.cc>,
Linus Walleij <linus.walleij@...aro.org>,
Bartosz Golaszewski <brgl@...ev.pl>,
Thomas Gleixner <tglx@...utronix.de>,
Marc Zyngier <maz@...nel.org>,
Lee Jones <lee.jones@...aro.org>,
Manivannan Sadhasivam <mani@...nel.org>,
Cristian Ciocaltea <cristian.ciocaltea@...il.com>,
Chen-Yu Tsai <wens@...e.org>, tharvey@...eworks.com,
rjones@...eworks.com, Matti Vaittinen <mazziesaccount@...il.com>,
orsonzhai@...il.com, baolin.wang7@...il.com, zhang.lyra@...il.com,
Jernej Skrabec <jernej.skrabec@...il.com>,
Samuel Holland <samuel@...lland.org>,
Liam Girdwood <lgirdwood@...il.com>,
Jaroslav Kysela <perex@...ex.cz>,
Takashi Iwai <tiwai@...e.com>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
"open list:GPIO SUBSYSTEM" <linux-gpio@...r.kernel.org>,
linux-actions@...ts.infradead.org,
linux-arm-msm <linux-arm-msm@...r.kernel.org>,
linux-arm Mailing List <linux-arm-kernel@...ts.infradead.org>,
linux-sunxi@...ts.linux.dev,
ALSA Development Mailing List <alsa-devel@...a-project.org>
Subject: Re: [PATCH 47/49] regmap-irq: Add get_irq_reg() callback
On Mon, Jun 20, 2022 at 10:12 PM Aidan MacDonald
<aidanmacdonald.0x0@...il.com> 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
Powered by blists - more mailing lists