All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Peter Tyser <ptyser@xes-inc.com>, Lee Jones <lee@kernel.org>
Subject: Re: [PATCH v1 1/2] resource: Introduce resource_rebase() helper
Date: Wed, 3 Sep 2025 18:20:34 +0300	[thread overview]
Message-ID: <aLhcwuj-Bg39n6W3@smile.fi.intel.com> (raw)
In-Reply-To: <e1d7bc7c-6862-919c-a637-bfabce591b62@linux.intel.com>

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



  reply	other threads:[~2025-09-03 15:20 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-03  8:12 [PATCH v1 0/2] mfd: lpc_ich: Simplify GPIO resource handling Andy Shevchenko
2025-09-03  8:12 ` [PATCH v1 1/2] resource: Introduce resource_rebase() helper Andy Shevchenko
2025-09-03 12:29   ` Ilpo Järvinen
2025-09-03 15:20     ` Andy Shevchenko [this message]
2025-09-03  8:12 ` [PATCH v1 2/2] mfd: lpc_ich: Convert to use resource_rebase() Andy Shevchenko
2025-09-03 10:45   ` Andy Shevchenko
2025-09-03 12:19     ` Ilpo Järvinen
2025-09-04  8:08 ` [PATCH v1 0/2] mfd: lpc_ich: Simplify GPIO resource handling Andy Shevchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aLhcwuj-Bg39n6W3@smile.fi.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=lee@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ptyser@xes-inc.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.