diff mbox series

[v3,1/9] kernel/resource: Introduce request_muxed_mem_region()

Message ID 20220119230626.31560-2-terry.bowman@amd.com
State Superseded
Headers show
Series i2c: piix4: Replace cd6h/cd7h port I/O accesses with MMIO accesses | expand

Commit Message

Terry Bowman Jan. 19, 2022, 11:06 p.m. UTC
Support for requesting muxed memory region is implemented but not
currently callable as a macro. Add the request muxed memory
region macro.

MMIO memory accesses can be synchronized using request_mem_region() which
is already available. This call will return failure if the resource is
busy. The 'muxed' version of this macro will handle a busy resource by
using a wait queue to retry until the resource is available.

Signed-off-by: Terry Bowman <terry.bowman@amd.com>
---
 include/linux/ioport.h | 2 ++
 1 file changed, 2 insertions(+)

Comments

Andy Shevchenko Jan. 20, 2022, 11:16 a.m. UTC | #1
On Thu, Jan 20, 2022 at 1:06 AM Terry Bowman <terry.bowman@amd.com> wrote:
>
> Support for requesting muxed memory region is implemented but not
> currently callable as a macro. Add the request muxed memory
> region macro.
>
> MMIO memory accesses can be synchronized using request_mem_region() which
> is already available. This call will return failure if the resource is
> busy. The 'muxed' version of this macro will handle a busy resource by
> using a wait queue to retry until the resource is available.

...

> @@ -262,6 +262,8 @@ resource_union(struct resource *r1, struct resource *r2, struct resource *r)
>  #define request_muxed_region(start,n,name)     __request_region(&ioport_resource, (start), (n), (name), IORESOURCE_MUXED)
>  #define __request_mem_region(start,n,name, excl) __request_region(&iomem_resource, (start), (n), (name), excl)
>  #define request_mem_region(start,n,name) __request_region(&iomem_resource, (start), (n), (name), 0)

> +#define request_muxed_mem_region(start, n, name) \
> +       __request_region(&iomem_resource, (start), (n), (name), IORESOURCE_MUXED)

Looking around tells me that this name is inconsistent, I would expect it to be

request_mem_region_muxed()

>  #define request_mem_region_exclusive(start,n,name) \
>         __request_region(&iomem_resource, (start), (n), (name), IORESOURCE_EXCLUSIVE)

If you are fine with this, take my
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Terry Bowman Jan. 20, 2022, 1:53 p.m. UTC | #2
On 1/20/22 5:16 AM, Andy Shevchenko wrote:
> On Thu, Jan 20, 2022 at 1:06 AM Terry Bowman <terry.bowman@amd.com> wrote:
>>
>> Support for requesting muxed memory region is implemented but not
>> currently callable as a macro. Add the request muxed memory
>> region macro.
>>
>> MMIO memory accesses can be synchronized using request_mem_region() which
>> is already available. This call will return failure if the resource is
>> busy. The 'muxed' version of this macro will handle a busy resource by
>> using a wait queue to retry until the resource is available.
> 
> ...
> 
>> @@ -262,6 +262,8 @@ resource_union(struct resource *r1, struct resource *r2, struct resource *r)
>>  #define request_muxed_region(start,n,name)     __request_region(&ioport_resource, (start), (n), (name), IORESOURCE_MUXED)
>>  #define __request_mem_region(start,n,name, excl) __request_region(&iomem_resource, (start), (n), (name), excl)
>>  #define request_mem_region(start,n,name) __request_region(&iomem_resource, (start), (n), (name), 0)
> 
>> +#define request_muxed_mem_region(start, n, name) \
>> +       __request_region(&iomem_resource, (start), (n), (name), IORESOURCE_MUXED)
> 
> Looking around tells me that this name is inconsistent, I would expect it to be
> 
> request_mem_region_muxed()
> 
>>  #define request_mem_region_exclusive(start,n,name) \
>>         __request_region(&iomem_resource, (start), (n), (name), IORESOURCE_EXCLUSIVE)
> 
> If you are fine with this, take my
> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
> 
                                                                      
I'm fine with the rename. I'll update as you requested in the next series
revision and add your "reviewed-by" to this patch.

Regards,
Terry
diff mbox series

Patch

diff --git a/include/linux/ioport.h b/include/linux/ioport.h
index 8359c50f9988..2a5567de318b 100644
--- a/include/linux/ioport.h
+++ b/include/linux/ioport.h
@@ -262,6 +262,8 @@  resource_union(struct resource *r1, struct resource *r2, struct resource *r)
 #define request_muxed_region(start,n,name)	__request_region(&ioport_resource, (start), (n), (name), IORESOURCE_MUXED)
 #define __request_mem_region(start,n,name, excl) __request_region(&iomem_resource, (start), (n), (name), excl)
 #define request_mem_region(start,n,name) __request_region(&iomem_resource, (start), (n), (name), 0)
+#define request_muxed_mem_region(start, n, name) \
+	__request_region(&iomem_resource, (start), (n), (name), IORESOURCE_MUXED)
 #define request_mem_region_exclusive(start,n,name) \
 	__request_region(&iomem_resource, (start), (n), (name), IORESOURCE_EXCLUSIVE)
 #define rename_region(region, newname) do { (region)->name = (newname); } while (0)