[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75VePD-ROfnFtwU33Jt_h9a-qBC0QwRQcQfgmEbyOV22CKA@mail.gmail.com>
Date: Tue, 21 Jun 2022 11:22:03 +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 04/49] regmap-irq: Introduce config registers for irq types
On Mon, Jun 20, 2022 at 10:08 PM Aidan MacDonald
<aidanmacdonald.0x0@...il.com> wrote:
>
> Config registers provide a more uniform approach to handling irq type
> registers. They are essentially an extension of the virtual registers
> used by the qcom-pm8008 driver.
>
> Config registers can be represented as a 2D array:
>
> config_base[0] reg0,0 reg0,1 reg0,2 reg0,3
> config_base[1] reg1,0 reg1,1 reg1,2 reg1,3
> config_base[2] reg2,0 reg2,1 reg2,2 reg2,3
>
> There are 'num_config_bases' base registers, each of which is used to
> address 'num_config_regs' registers. The addresses are calculated in
> the same way as for other bases. It is assumed that an irq's type is
> controlled by one column of registers; that column is identified by
> the irq's 'type_reg_offset'.
>
> The set_type_config() callback is responsible for updating the config
> register contents. It receives an array of buffers (each represents a
> row of registers) and the index of the column to update, along with
> the 'struct regmap_irq' description and requested irq type.
>
> Buffered values are written to registers in regmap_irq_sync_unlock().
> Note that the entire register contents are overwritten, which is a
> minor change in behavior from type registers via 'type_base'.
...
> + ret = regmap_write(map, reg, d->config_buf[i][j]);
> + if (ret != 0)
if (ret)
> + dev_err(d->map->dev,
> + "Failed to write config %x: %d\n",
> + reg, ret);
> + }
...
> + * regmap_irq_set_type_config_simple() - Simple IRQ type configuration callback.
> + *
Redundant line.
...
> + d->config_buf = kcalloc(chip->num_config_bases,
> + sizeof(*d->config_buf), GFP_KERNEL);
> + if (!d->config_buf)
> + goto err_alloc;
> +
> + for (i = 0; i < chip->num_config_regs; i++) {
> + d->config_buf[i] = kcalloc(chip->num_config_regs,
> + sizeof(unsigned int),
Can it be sizeof(**d->config_buf) ?
> + GFP_KERNEL);
> + if (!d->config_buf[i])
> + goto err_alloc;
> + }
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists