[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20191018165430.abyhbdodrjurx6g7@holly.lan>
Date: Fri, 18 Oct 2019 17:54:30 +0100
From: Daniel Thompson <daniel.thompson@...aro.org>
To: Lee Jones <lee.jones@...aro.org>
Cc: broonie@...nel.org, linus.walleij@...aro.org, arnd@...db.de,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
dilinger@...ued.net
Subject: Re: [PATCH 2/4] mfd: cs5535-mfd: Remove mfd_cell->id hack
On Fri, Oct 18, 2019 at 01:56:06PM +0100, Lee Jones wrote:
> The current implementation abuses the platform 'id' mfd_cell member
> to index into the correct resources entry. If we place all cells
> into their numbered slots, we can cycle through all the cell entries
> and only process the populated ones which avoids this behaviour.
>
> Signed-off-by: Lee Jones <lee.jones@...aro.org>
> ---
> drivers/mfd/cs5535-mfd.c | 31 +++++++++++++------------------
> 1 file changed, 13 insertions(+), 18 deletions(-)
>
> diff --git a/drivers/mfd/cs5535-mfd.c b/drivers/mfd/cs5535-mfd.c
> index 2c47afc22d24..b01e5bb4ed03 100644
> --- a/drivers/mfd/cs5535-mfd.c
> +++ b/drivers/mfd/cs5535-mfd.c
> @@ -115,16 +110,16 @@ static int cs5535_mfd_probe(struct pci_dev *pdev,
> return err;
>
> /* fill in IO range for each cell; subdrivers handle the region */
> - for (i = 0; i < ARRAY_SIZE(cs5535_mfd_cells); i++) {
> - int bar = cs5535_mfd_cells[i].id;
> - struct resource *r = &cs5535_mfd_resources[bar];
> + for (i = 0; i < NR_BARS; i++) {
> + struct mfd_cell *cell = &cs5535_mfd_cells[i];
> + struct resource *r = &cs5535_mfd_resources[i];
>
> - r->flags = IORESOURCE_IO;
> - r->start = pci_resource_start(pdev, bar);
> - r->end = pci_resource_end(pdev, bar);
> + if (!cell)
> + continue;
cell will never be null. Should this be cell->num_resources instead?
Daniel.
Powered by blists - more mailing lists