mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v1 1/1] resource: Split DEFINE_RES_NAMED_DESC() out of DEFINE_RES_NAMED()
@ 2025-03-13 16:09 Andy Shevchenko
  2025-03-17  9:50 ` Andy Shevchenko
  2025-03-17 16:56 ` Andrew Morton
  0 siblings, 2 replies; 4+ messages in thread
From: Andy Shevchenko @ 2025-03-13 16:09 UTC (permalink / raw)
  To: Andy Shevchenko, Ilpo Järvinen, linux-kernel; +Cc: Andy Shevchenko

In some cases it would be useful to supply predefined descriptor
of the resource. For this, introduce DEFINE_RES_NAMED_DESC() macro.

While at it, provide DEFINE_RES() that takes only start, size,
and flags.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 include/linux/ioport.h | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/include/linux/ioport.h b/include/linux/ioport.h
index f437502224cd..a740aebc372d 100644
--- a/include/linux/ioport.h
+++ b/include/linux/ioport.h
@@ -157,15 +157,20 @@ enum {
 };
 
 /* helpers to define resources */
-#define DEFINE_RES_NAMED(_start, _size, _name, _flags)			\
+#define DEFINE_RES_NAMED_DESC(_start, _size, _name, _flags, _desc)	\
 (struct resource) {							\
 		.start = (_start),					\
 		.end = (_start) + (_size) - 1,				\
 		.name = (_name),					\
 		.flags = (_flags),					\
-		.desc = IORES_DESC_NONE,				\
+		.desc = (_desc),					\
 	}
 
+#define DEFINE_RES_NAMED(_start, _size, _name, _flags)			\
+	DEFINE_RES_NAMED_DESC(_start, _size, _name, _flags, IORES_DESC_NONE)
+#define DEFINE_RES(_start, _size, _flags)				\
+	DEFINE_RES_NAMED(_start, _size, NULL, _flags)
+
 #define DEFINE_RES_IO_NAMED(_start, _size, _name)			\
 	DEFINE_RES_NAMED((_start), (_size), (_name), IORESOURCE_IO)
 #define DEFINE_RES_IO(_start, _size)					\
-- 
2.47.2


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v1 1/1] resource: Split DEFINE_RES_NAMED_DESC() out of DEFINE_RES_NAMED()
  2025-03-13 16:09 [PATCH v1 1/1] resource: Split DEFINE_RES_NAMED_DESC() out of DEFINE_RES_NAMED() Andy Shevchenko
@ 2025-03-17  9:50 ` Andy Shevchenko
  2025-03-17 16:56 ` Andrew Morton
  1 sibling, 0 replies; 4+ messages in thread
From: Andy Shevchenko @ 2025-03-17  9:50 UTC (permalink / raw)
  To: Ilpo Järvinen, linux-kernel; +Cc: Andrew Morton, Arnd Bergmann

+Cc: Andrew.

Andrew, olease, tell me if you want a resend as I just noticed that the header
is orphaned.

Arnd, do we have any plans to have a record in MAINTAINERS for the (currently
orphaned) headers?

On Thu, Mar 13, 2025 at 06:09:40PM +0200, Andy Shevchenko wrote:
> In some cases it would be useful to supply predefined descriptor
> of the resource. For this, introduce DEFINE_RES_NAMED_DESC() macro.
> 
> While at it, provide DEFINE_RES() that takes only start, size,
> and flags.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  include/linux/ioport.h | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/include/linux/ioport.h b/include/linux/ioport.h
> index f437502224cd..a740aebc372d 100644
> --- a/include/linux/ioport.h
> +++ b/include/linux/ioport.h
> @@ -157,15 +157,20 @@ enum {
>  };
>  
>  /* helpers to define resources */
> -#define DEFINE_RES_NAMED(_start, _size, _name, _flags)			\
> +#define DEFINE_RES_NAMED_DESC(_start, _size, _name, _flags, _desc)	\
>  (struct resource) {							\
>  		.start = (_start),					\
>  		.end = (_start) + (_size) - 1,				\
>  		.name = (_name),					\
>  		.flags = (_flags),					\
> -		.desc = IORES_DESC_NONE,				\
> +		.desc = (_desc),					\
>  	}
>  
> +#define DEFINE_RES_NAMED(_start, _size, _name, _flags)			\
> +	DEFINE_RES_NAMED_DESC(_start, _size, _name, _flags, IORES_DESC_NONE)
> +#define DEFINE_RES(_start, _size, _flags)				\
> +	DEFINE_RES_NAMED(_start, _size, NULL, _flags)
> +
>  #define DEFINE_RES_IO_NAMED(_start, _size, _name)			\
>  	DEFINE_RES_NAMED((_start), (_size), (_name), IORESOURCE_IO)
>  #define DEFINE_RES_IO(_start, _size)					\

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v1 1/1] resource: Split DEFINE_RES_NAMED_DESC() out of DEFINE_RES_NAMED()
  2025-03-13 16:09 [PATCH v1 1/1] resource: Split DEFINE_RES_NAMED_DESC() out of DEFINE_RES_NAMED() Andy Shevchenko
  2025-03-17  9:50 ` Andy Shevchenko
@ 2025-03-17 16:56 ` Andrew Morton
  2025-03-17 17:14   ` Andy Shevchenko
  1 sibling, 1 reply; 4+ messages in thread
From: Andrew Morton @ 2025-03-17 16:56 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: Ilpo Järvinen, linux-kernel, Andy Shevchenko

On Thu, 13 Mar 2025 18:09:40 +0200 Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:

> In some cases it would be useful to supply predefined descriptor
> of the resource. For this, introduce DEFINE_RES_NAMED_DESC() macro.
> 
> While at it, provide DEFINE_RES() that takes only start, size,
> and flags.
> 
> ...
>
> --- a/include/linux/ioport.h
> +++ b/include/linux/ioport.h
> @@ -157,15 +157,20 @@ enum {
>  };
>  
>  /* helpers to define resources */
> -#define DEFINE_RES_NAMED(_start, _size, _name, _flags)			\
> +#define DEFINE_RES_NAMED_DESC(_start, _size, _name, _flags, _desc)	\
>  (struct resource) {							\
>  		.start = (_start),					\
>  		.end = (_start) + (_size) - 1,				\
>  		.name = (_name),					\
>  		.flags = (_flags),					\
> -		.desc = IORES_DESC_NONE,				\
> +		.desc = (_desc),					\
>  	}
>  
> +#define DEFINE_RES_NAMED(_start, _size, _name, _flags)			\
> +	DEFINE_RES_NAMED_DESC(_start, _size, _name, _flags, IORES_DESC_NONE)
> +#define DEFINE_RES(_start, _size, _flags)				\
> +	DEFINE_RES_NAMED(_start, _size, NULL, _flags)
> +
>  #define DEFINE_RES_IO_NAMED(_start, _size, _name)			\
>  	DEFINE_RES_NAMED((_start), (_size), (_name), IORESOURCE_IO)
>  #define DEFINE_RES_IO(_start, _size)					\

But the new DEFINE_RES_NAMED_DESC() has no users.  Can we add some?  To
demonstrate the usefulness of the new macro and to test it.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v1 1/1] resource: Split DEFINE_RES_NAMED_DESC() out of DEFINE_RES_NAMED()
  2025-03-17 16:56 ` Andrew Morton
@ 2025-03-17 17:14   ` Andy Shevchenko
  0 siblings, 0 replies; 4+ messages in thread
From: Andy Shevchenko @ 2025-03-17 17:14 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Ilpo Järvinen, linux-kernel

On Mon, Mar 17, 2025 at 09:56:54AM -0700, Andrew Morton wrote:
> On Thu, 13 Mar 2025 18:09:40 +0200 Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:

...

> But the new DEFINE_RES_NAMED_DESC() has no users.  Can we add some?  To
> demonstrate the usefulness of the new macro and to test it.

Sure.

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-03-17 17:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-03-13 16:09 [PATCH v1 1/1] resource: Split DEFINE_RES_NAMED_DESC() out of DEFINE_RES_NAMED() Andy Shevchenko
2025-03-17  9:50 ` Andy Shevchenko
2025-03-17 16:56 ` Andrew Morton
2025-03-17 17:14   ` Andy Shevchenko

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®