[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMpxmJW1j9+KAj12OKs3njUWy+UA5B993Pyd=xmo4k8LM-8GUw@mail.gmail.com>
Date: Tue, 10 Nov 2020 15:52:00 +0100
From: Bartosz Golaszewski <bgolaszewski@...libre.com>
To: Jan Kiszka <jan.kiszka@...mens.com>
Cc: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Bartosz Golaszewski <brgl@...ev.pl>,
Linus Walleij <linus.walleij@...aro.org>,
David Laight <David.Laight@...lab.com>,
linux-gpio <linux-gpio@...r.kernel.org>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v3 6/7] gpio: exar: switch to using regmap
On Tue, Nov 10, 2020 at 3:50 PM Jan Kiszka <jan.kiszka@...mens.com> wrote:
>
>
> On 10.11.20 15:30, Bartosz Golaszewski wrote:
> > On Tue, Nov 10, 2020 at 3:26 PM Andy Shevchenko
> > <andriy.shevchenko@...ux.intel.com> wrote:
> >>
> >> On Tue, Nov 10, 2020 at 04:26:24PM +0200, Andy Shevchenko wrote:
> >>> On Tue, Nov 10, 2020 at 01:34:05PM +0100, Bartosz Golaszewski wrote:
> >>>> From: Bartosz Golaszewski <bgolaszewski@...libre.com>
> >>>>
> >>>> We can simplify the code in gpio-exar by using regmap. This allows us to
> >>>> drop the mutex (regmap provides its own locking) and we can also reuse
> >>>> regmap's bit operations instead of implementing our own update function.
> >>>
> >>> ...
> >>>
> >>>> + /*
> >>>> + * We don't need to check the return values of mmio regmap operations (unless
> >>>> + * the regmap has a clock attached which is not the case here).
> >>>> + */
> >>>> + exar_gpio->regs = devm_regmap_init_mmio(dev, p, &exar_regmap_config);
> >>>> + if (IS_ERR(exar_gpio->regs))
> >>>> + return PTR_ERR(exar_gpio->regs);
> >>>>
> >>>> index = ida_alloc(&ida_index, GFP_KERNEL);
> >>>> - if (index < 0) {
> >>>> - ret = index;
> >>>> - goto err_mutex_destroy;
> >>>> - }
> >>>> + if (index < 0)
> >>>> + return index;
> >>>
> >>> And below you effectively use p as regmap!
> >>> That's what renaming of variable regs -> regmap or map can easily reveal.
> >>>
> >>> exar_gpio->regs = p;
> >>
> >> Jan, if you remove this line, does it help?
> >>
> >
> > Ha! I guess you were right saying that keeping the name is asking for
> > trouble then. :)
> >
> > I think that may be it but address width should still be changed to 16.
> >
>
> Removing the line that Andy found made things work here. And switching
> to 16 for reg_bits didn't make things worse again.
>
> Jan
Alright! I'll send a v4 with these things fixed then.
Bartosz
Powered by blists - more mailing lists