[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aTnqbW5JFOdO1XFQ@smile.fi.intel.com>
Date: Wed, 10 Dec 2025 23:47:25 +0200
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: Christian Marangi <ansuelsmth@...il.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>, linux-kernel@...r.kernel.org,
Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>
Subject: Re: [PATCH] resource: provide 0args DEFINE_RES variant for unset
resource desc
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
Powered by blists - more mailing lists