[v3,2/5] ACPI: Make acpi_dev_irqresource_disabled() public
diff mbox series

Message ID 1606324841-217570-3-git-send-email-john.garry@huawei.com
State New, archived
Headers show
Series
  • Support managed interrupts for platform devices
Related show

Commit Message

John Garry Nov. 25, 2020, 5:20 p.m. UTC
To allow the platform device to "put" an irq, make the function to reset
an ACPI companion device irq resource public.

Signed-off-by: John Garry <john.garry@huawei.com>
---
 drivers/acpi/resource.c | 2 +-
 include/linux/acpi.h    | 5 +++++
 2 files changed, 6 insertions(+), 1 deletion(-)

Comments

Rafael J. Wysocki Nov. 25, 2020, 5:43 p.m. UTC | #1
On Wed, Nov 25, 2020 at 6:25 PM John Garry <john.garry@huawei.com> wrote:
>
> To allow the platform device to "put" an irq, make the function to reset
> an ACPI companion device irq resource public.
>
> Signed-off-by: John Garry <john.garry@huawei.com>

I'd rather move it to kernel/resource.c as it is not ACPI-specific and
its only connection to ACPI is that it is used in the ACPI resources
management code.

> ---
>  drivers/acpi/resource.c | 2 +-
>  include/linux/acpi.h    | 5 +++++
>  2 files changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/acpi/resource.c b/drivers/acpi/resource.c
> index ad04824ca3ba..0999a98cab3c 100644
> --- a/drivers/acpi/resource.c
> +++ b/drivers/acpi/resource.c
> @@ -380,7 +380,7 @@ unsigned int acpi_dev_get_irq_type(int triggering, int polarity)
>  }
>  EXPORT_SYMBOL_GPL(acpi_dev_get_irq_type);
>
> -static void acpi_dev_irqresource_disabled(struct resource *res, u32 gsi)
> +void acpi_dev_irqresource_disabled(struct resource *res, u32 gsi)
>  {
>         res->start = gsi;
>         res->end = gsi;
> diff --git a/include/linux/acpi.h b/include/linux/acpi.h
> index 39263c6b52e1..d5101e36a645 100644
> --- a/include/linux/acpi.h
> +++ b/include/linux/acpi.h
> @@ -467,6 +467,7 @@ bool acpi_dev_resource_ext_address_space(struct acpi_resource *ares,
>                                          struct resource_win *win);
>  unsigned long acpi_dev_irq_flags(u8 triggering, u8 polarity, u8 shareable);
>  unsigned int acpi_dev_get_irq_type(int triggering, int polarity);
> +void acpi_dev_irqresource_disabled(struct resource *res, u32 gsi);
>  bool acpi_dev_resource_interrupt(struct acpi_resource *ares, int index,
>                                  struct resource *res);
>
> @@ -939,6 +940,10 @@ static inline struct acpi_device *acpi_resource_consumer(struct resource *res)
>         return NULL;
>  }
>
> +static inline void acpi_dev_irqresource_disabled(struct resource *res, u32 gsi)
> +{
> +}
> +
>  #endif /* !CONFIG_ACPI */
>
>  #ifdef CONFIG_ACPI_HOTPLUG_IOAPIC
> --
> 2.26.2
>
John Garry Nov. 26, 2020, 8:49 a.m. UTC | #2
On 25/11/2020 17:43, Rafael J. Wysocki wrote:
> On Wed, Nov 25, 2020 at 6:25 PM John Garry<john.garry@huawei.com>  wrote:
>> To allow the platform device to "put" an irq, make the function to reset
>> an ACPI companion device irq resource public.
>>
>> Signed-off-by: John Garry<john.garry@huawei.com>
> I'd rather move it to kernel/resource.c as it is not ACPI-specific and
> its only connection to ACPI is that it is used in the ACPI resources
> management code.
> 

Hi Rafael,

That's ok, but we could also just put in include/linux/ioport.h as a 
static inline as it’s so small. Not so important, I guess.

And I'm not sure how this part could be merged, so maybe I can do as 2x 
patches now - 1. add resource.c function 2. remove ACPI duplicate. - so 
we have the option to merge ACPI part later if it makes things easier.

Thanks,
John
Rafael J. Wysocki Nov. 26, 2020, 2:24 p.m. UTC | #3
On Thu, Nov 26, 2020 at 9:49 AM John Garry <john.garry@huawei.com> wrote:
>
> On 25/11/2020 17:43, Rafael J. Wysocki wrote:
> > On Wed, Nov 25, 2020 at 6:25 PM John Garry<john.garry@huawei.com>  wrote:
> >> To allow the platform device to "put" an irq, make the function to reset
> >> an ACPI companion device irq resource public.
> >>
> >> Signed-off-by: John Garry<john.garry@huawei.com>
> > I'd rather move it to kernel/resource.c as it is not ACPI-specific and
> > its only connection to ACPI is that it is used in the ACPI resources
> > management code.
> >
>
> Hi Rafael,
>
> That's ok, but we could also just put in include/linux/ioport.h as a
> static inline as it’s so small. Not so important, I guess.
>
> And I'm not sure how this part could be merged, so maybe I can do as 2x
> patches now - 1. add resource.c function 2. remove ACPI duplicate. - so
> we have the option to merge ACPI part later if it makes things easier.

That would work too.

My point really was that exporting that function from ACPI was rather confusing.

Patch
diff mbox series

diff --git a/drivers/acpi/resource.c b/drivers/acpi/resource.c
index ad04824ca3ba..0999a98cab3c 100644
--- a/drivers/acpi/resource.c
+++ b/drivers/acpi/resource.c
@@ -380,7 +380,7 @@  unsigned int acpi_dev_get_irq_type(int triggering, int polarity)
 }
 EXPORT_SYMBOL_GPL(acpi_dev_get_irq_type);
 
-static void acpi_dev_irqresource_disabled(struct resource *res, u32 gsi)
+void acpi_dev_irqresource_disabled(struct resource *res, u32 gsi)
 {
 	res->start = gsi;
 	res->end = gsi;
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 39263c6b52e1..d5101e36a645 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -467,6 +467,7 @@  bool acpi_dev_resource_ext_address_space(struct acpi_resource *ares,
 					 struct resource_win *win);
 unsigned long acpi_dev_irq_flags(u8 triggering, u8 polarity, u8 shareable);
 unsigned int acpi_dev_get_irq_type(int triggering, int polarity);
+void acpi_dev_irqresource_disabled(struct resource *res, u32 gsi);
 bool acpi_dev_resource_interrupt(struct acpi_resource *ares, int index,
 				 struct resource *res);
 
@@ -939,6 +940,10 @@  static inline struct acpi_device *acpi_resource_consumer(struct resource *res)
 	return NULL;
 }
 
+static inline void acpi_dev_irqresource_disabled(struct resource *res, u32 gsi)
+{
+}
+
 #endif	/* !CONFIG_ACPI */
 
 #ifdef CONFIG_ACPI_HOTPLUG_IOAPIC