[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aLhcwuj-Bg39n6W3@smile.fi.intel.com>
Date: Wed, 3 Sep 2025 18:20:34 +0300
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>
Cc: LKML <linux-kernel@...r.kernel.org>, Peter Tyser <ptyser@...-inc.com>,
Lee Jones <lee@...nel.org>
Subject: Re: [PATCH v1 1/2] resource: Introduce resource_rebase() helper
On Wed, Sep 03, 2025 at 03:29:00PM +0300, Ilpo Järvinen wrote:
> On Wed, 3 Sep 2025, Andy Shevchenko wrote:
...
> > +static inline void resource_rebase(struct resource *res, resource_size_t start)
> > +{
> > + resource_set_range(res, start + res->start, resource_size(res));
> > +}
>
> This seems fine, it's nice to get rid of complex ->end calculations. But I
> wanted to mention another common case which is resetting the base to zero.
> Are we expected to use resource_rebase() for those cases too? I've been
> thinking of adding something like resource_reset().
>
> resource_rebase(res, 0) would work for those cases but it doesn't then
> carry the intent of "removing" the base in its name. Opinions?
Another case I have just realised is repeated "rebase" over the statically
global resource (when driver is in but device is bind-unbind-and-repeat).
Perhaps rebase has to be idempotent. That will do exactly, if I'm not mistaken,
what you are telling as a _reset() by default.
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists