mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Christian Marangi <ansuelsmth@gmail.com>
Cc: "Andrew Morton" <akpm@linux-foundation.org>,
	linux-kernel@vger.kernel.org,
	"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
Subject: Re: [PATCH] resource: provide 0args DEFINE_RES variant for unset resource desc
Date: Wed, 10 Dec 2025 23:47:25 +0200	[thread overview]
Message-ID: <aTnqbW5JFOdO1XFQ@smile.fi.intel.com> (raw)
In-Reply-To: <20251210180312.3869-1-ansuelsmth@gmail.com>

On Wed, Dec 10, 2025 at 07:03:07PM +0100, Christian Marangi wrote:
> Provide a variant of DEFINE_RES that takes 0 arguments to inizialize an
> "unset" resource descriptor.
> 
> This should be used for the improper case of
> 
> 	struct resource res = {};
> 
> where DEFINE_RES() should be used.
> 
> With this new helper variant, it would result in:
> 
> 	struct resource res = DEFINE_RES();
> 
> instead of having to define the full 3 arguments:
> 
> 	struct resource res = DEFINE_RES(0, 0, IORESOURCE_UNSET);
> 
> DEFINE_RES() with no args, will set the flags to IORESOURCE_UNSET
> signaling the resource descriptor is UNSET and doesn't reflect an actual
> resource currently.

...

> +#define DEFINE_RES(...)							\
> +	CONCATENATE(__DEFINE_RES, COUNT_ARGS(__VA_ARGS__))		\
> +		    (__VA_ARGS__)
	CONCATENATE(__DEFINE_RES, COUNT_ARGS(__VA_ARGS__))(__VA_ARGS__)

Can be one line. Moreover, it will be even better to show that we imply
a function call here.

And this requires including args.h.

-- 
With Best Regards,
Andy Shevchenko



      parent reply	other threads:[~2025-12-10 21:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-10 18:03 Christian Marangi
2025-12-10 21:26 ` Bjorn Helgaas
2025-12-10 21:47 ` Andy Shevchenko [this message]

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=aTnqbW5JFOdO1XFQ@smile.fi.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=ansuelsmth@gmail.com \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®