On Tue, Dec 26, 2023 at 12:21:05PM -0700, Mark Hasemeyer wrote:
> In some cases, it would be nice to instantiate a struct resource with
> custom flags. For example, creating an IRQ resource with a flag that
> marks the interrupt as wake capable.
>
> Add a set of macros to provide custom flag arguments.
> Suggested-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Was it @intel.com? Please, use @linux.intel.com anyway.
> Signed-off-by: Mark Hasemeyer <markhas@chromium.org>
Tag block must _not_ have any blank line(s).
Otherwise LGTM,
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
While we will have user only for IRQ case, the rest are added for symmetry's
sake, I think it's okay and we might even have more (existing) users to convert
to new macros (at least it rings a bell to me for a few places).
@@ -163,28 +163,38 @@ enum {
.desc = IORES_DESC_NONE, \
}
+#define DEFINE_RES_IO_NAMED_FLAGS(_start, _size, _name, _flags) \
+ DEFINE_RES_NAMED((_start), (_size), (_name), (_flags) | IORESOURCE_IO)
#define DEFINE_RES_IO_NAMED(_start, _size, _name) \
- DEFINE_RES_NAMED((_start), (_size), (_name), IORESOURCE_IO)
+ DEFINE_RES_IO_NAMED_FLAGS((_start), (_size), (_name), 0)
#define DEFINE_RES_IO(_start, _size) \
DEFINE_RES_IO_NAMED((_start), (_size), NULL)
+#define DEFINE_RES_MEM_NAMED_FLAGS(_start, _size, _name, _flags) \
+ DEFINE_RES_NAMED((_start), (_size), (_name), (_flags) | IORESOURCE_MEM)
#define DEFINE_RES_MEM_NAMED(_start, _size, _name) \
- DEFINE_RES_NAMED((_start), (_size), (_name), IORESOURCE_MEM)
+ DEFINE_RES_MEM_NAMED_FLAGS((_start), (_size), (_name), 0)
#define DEFINE_RES_MEM(_start, _size) \
DEFINE_RES_MEM_NAMED((_start), (_size), NULL)
+#define DEFINE_RES_REG_NAMED_FLAGS(_start, _size, _name, _flags) \
+ DEFINE_RES_NAMED((_start), (_size), (_name), (_flags) | IORESOURCE_REG)
#define DEFINE_RES_REG_NAMED(_start, _size, _name) \
- DEFINE_RES_NAMED((_start), (_size), (_name), IORESOURCE_REG)
+ DEFINE_RES_REG_NAMED_FLAGS((_start), (_size), (_name), 0)
#define DEFINE_RES_REG(_start, _size) \
DEFINE_RES_REG_NAMED((_start), (_size), NULL)
+#define DEFINE_RES_IRQ_NAMED_FLAGS(_irq, _name, _flags) \
+ DEFINE_RES_NAMED((_irq), 1, (_name), (_flags) | IORESOURCE_IRQ)
#define DEFINE_RES_IRQ_NAMED(_irq, _name) \
- DEFINE_RES_NAMED((_irq), 1, (_name), IORESOURCE_IRQ)
+ DEFINE_RES_IRQ_NAMED_FLAGS((_irq), (_name), 0)
#define DEFINE_RES_IRQ(_irq) \
DEFINE_RES_IRQ_NAMED((_irq), NULL)
+#define DEFINE_RES_DMA_NAMED_FLAGS(_dma, _name, _flags) \
+ DEFINE_RES_NAMED((_dma), 1, (_name), (_flags) | IORESOURCE_DMA)
#define DEFINE_RES_DMA_NAMED(_dma, _name) \
- DEFINE_RES_NAMED((_dma), 1, (_name), IORESOURCE_DMA)
+ DEFINE_RES_DMA_NAMED_FLAGS((_dma), (_name), 0)
#define DEFINE_RES_DMA(_dma) \
DEFINE_RES_DMA_NAMED((_dma), NULL)