2022-08-08 09:44:14

by Huacai Chen

[permalink] [raw]
Subject: [PATCH] irqchip/loongson-pch-pic: Move find_pch_pic() into CONFIG_ACPI

MIPS doesn't declare find_pch_pic(), which makes a build warning:

>> drivers/irqchip/irq-loongson-pch-pic.c:51:5: warning: no previous prototype for function 'find_pch_pic' [-Wmissing-prototypes]
int find_pch_pic(u32 gsi)
^
drivers/irqchip/irq-loongson-pch-pic.c:51:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
int find_pch_pic(u32 gsi)
^
static
1 warning generated.

Move find_pch_pic() into CONFIG_ACPI which only used by LoongArch to fix
the warning.

Reported-by: kernel test robot <[email protected]>
Signed-off-by: Huacai Chen <[email protected]>
---
drivers/irqchip/irq-loongson-pch-pic.c | 38 +++++++++++++-------------
1 file changed, 19 insertions(+), 19 deletions(-)

diff --git a/drivers/irqchip/irq-loongson-pch-pic.c b/drivers/irqchip/irq-loongson-pch-pic.c
index b6f1392964b1..b987b6517d59 100644
--- a/drivers/irqchip/irq-loongson-pch-pic.c
+++ b/drivers/irqchip/irq-loongson-pch-pic.c
@@ -48,25 +48,6 @@ static struct pch_pic *pch_pic_priv[MAX_IO_PICS];

struct fwnode_handle *pch_pic_handle[MAX_IO_PICS];

-int find_pch_pic(u32 gsi)
-{
- int i;
-
- /* Find the PCH_PIC that manages this GSI. */
- for (i = 0; i < MAX_IO_PICS; i++) {
- struct pch_pic *priv = pch_pic_priv[i];
-
- if (!priv)
- return -1;
-
- if (gsi >= priv->gsi_base && gsi < (priv->gsi_base + priv->vec_count))
- return i;
- }
-
- pr_err("ERROR: Unable to locate PCH_PIC for GSI %d\n", gsi);
- return -1;
-}
-
static void pch_pic_bitset(struct pch_pic *priv, int offset, int bit)
{
u32 reg;
@@ -325,6 +306,25 @@ IRQCHIP_DECLARE(pch_pic, "loongson,pch-pic-1.0", pch_pic_of_init);
#endif

#ifdef CONFIG_ACPI
+int find_pch_pic(u32 gsi)
+{
+ int i;
+
+ /* Find the PCH_PIC that manages this GSI. */
+ for (i = 0; i < MAX_IO_PICS; i++) {
+ struct pch_pic *priv = pch_pic_priv[i];
+
+ if (!priv)
+ return -1;
+
+ if (gsi >= priv->gsi_base && gsi < (priv->gsi_base + priv->vec_count))
+ return i;
+ }
+
+ pr_err("ERROR: Unable to locate PCH_PIC for GSI %d\n", gsi);
+ return -1;
+}
+
static int __init
pch_lpc_parse_madt(union acpi_subtable_headers *header,
const unsigned long end)
--
2.31.1


2022-08-08 09:46:48

by Marc Zyngier

[permalink] [raw]
Subject: Re: [PATCH] irqchip/loongson-pch-pic: Move find_pch_pic() into CONFIG_ACPI

On 2022-08-08 09:53, Huacai Chen wrote:
> MIPS doesn't declare find_pch_pic(), which makes a build warning:
>
>>> drivers/irqchip/irq-loongson-pch-pic.c:51:5: warning: no previous
>>> prototype for function 'find_pch_pic' [-Wmissing-prototypes]
> int find_pch_pic(u32 gsi)
> ^
> drivers/irqchip/irq-loongson-pch-pic.c:51:1: note: declare 'static'
> if the function is not intended to be used outside of this translation
> unit
> int find_pch_pic(u32 gsi)
> ^
> static
> 1 warning generated.
>
> Move find_pch_pic() into CONFIG_ACPI which only used by LoongArch to
> fix
> the warning.
>
> Reported-by: kernel test robot <[email protected]>
> Signed-off-by: Huacai Chen <[email protected]>
> ---
> drivers/irqchip/irq-loongson-pch-pic.c | 38 +++++++++++++-------------
> 1 file changed, 19 insertions(+), 19 deletions(-)
>
> diff --git a/drivers/irqchip/irq-loongson-pch-pic.c
> b/drivers/irqchip/irq-loongson-pch-pic.c
> index b6f1392964b1..b987b6517d59 100644
> --- a/drivers/irqchip/irq-loongson-pch-pic.c
> +++ b/drivers/irqchip/irq-loongson-pch-pic.c
> @@ -48,25 +48,6 @@ static struct pch_pic *pch_pic_priv[MAX_IO_PICS];
>
> struct fwnode_handle *pch_pic_handle[MAX_IO_PICS];
>
> -int find_pch_pic(u32 gsi)
> -{
> - int i;
> -
> - /* Find the PCH_PIC that manages this GSI. */
> - for (i = 0; i < MAX_IO_PICS; i++) {
> - struct pch_pic *priv = pch_pic_priv[i];
> -
> - if (!priv)
> - return -1;
> -
> - if (gsi >= priv->gsi_base && gsi < (priv->gsi_base +
> priv->vec_count))
> - return i;
> - }
> -
> - pr_err("ERROR: Unable to locate PCH_PIC for GSI %d\n", gsi);
> - return -1;
> -}
> -
> static void pch_pic_bitset(struct pch_pic *priv, int offset, int bit)
> {
> u32 reg;
> @@ -325,6 +306,25 @@ IRQCHIP_DECLARE(pch_pic, "loongson,pch-pic-1.0",
> pch_pic_of_init);
> #endif
>
> #ifdef CONFIG_ACPI
> +int find_pch_pic(u32 gsi)
> +{
> + int i;
> +
> + /* Find the PCH_PIC that manages this GSI. */
> + for (i = 0; i < MAX_IO_PICS; i++) {
> + struct pch_pic *priv = pch_pic_priv[i];
> +
> + if (!priv)
> + return -1;
> +
> + if (gsi >= priv->gsi_base && gsi < (priv->gsi_base +
> priv->vec_count))
> + return i;
> + }
> +
> + pr_err("ERROR: Unable to locate PCH_PIC for GSI %d\n", gsi);
> + return -1;
> +}
> +
> static int __init
> pch_lpc_parse_madt(union acpi_subtable_headers *header,
> const unsigned long end)

While you're fixing this, can you also please fix this:

$ git grep find_pch_pic
arch/loongarch/include/asm/irq.h:extern int find_pch_pic(u32 gsi);
arch/loongarch/include/asm/irq.h:int find_pch_pic(u32 gsi);

Thanks,

M.
--
Jazz is not dead. It just smells funny...

2022-08-08 09:47:02

by Huacai Chen

[permalink] [raw]
Subject: Re: [PATCH] irqchip/loongson-pch-pic: Move find_pch_pic() into CONFIG_ACPI

Hi, Marc,

On Mon, Aug 8, 2022 at 5:05 PM Marc Zyngier <[email protected]> wrote:
>
> On 2022-08-08 09:53, Huacai Chen wrote:
> > MIPS doesn't declare find_pch_pic(), which makes a build warning:
> >
> >>> drivers/irqchip/irq-loongson-pch-pic.c:51:5: warning: no previous
> >>> prototype for function 'find_pch_pic' [-Wmissing-prototypes]
> > int find_pch_pic(u32 gsi)
> > ^
> > drivers/irqchip/irq-loongson-pch-pic.c:51:1: note: declare 'static'
> > if the function is not intended to be used outside of this translation
> > unit
> > int find_pch_pic(u32 gsi)
> > ^
> > static
> > 1 warning generated.
> >
> > Move find_pch_pic() into CONFIG_ACPI which only used by LoongArch to
> > fix
> > the warning.
> >
> > Reported-by: kernel test robot <[email protected]>
> > Signed-off-by: Huacai Chen <[email protected]>
> > ---
> > drivers/irqchip/irq-loongson-pch-pic.c | 38 +++++++++++++-------------
> > 1 file changed, 19 insertions(+), 19 deletions(-)
> >
> > diff --git a/drivers/irqchip/irq-loongson-pch-pic.c
> > b/drivers/irqchip/irq-loongson-pch-pic.c
> > index b6f1392964b1..b987b6517d59 100644
> > --- a/drivers/irqchip/irq-loongson-pch-pic.c
> > +++ b/drivers/irqchip/irq-loongson-pch-pic.c
> > @@ -48,25 +48,6 @@ static struct pch_pic *pch_pic_priv[MAX_IO_PICS];
> >
> > struct fwnode_handle *pch_pic_handle[MAX_IO_PICS];
> >
> > -int find_pch_pic(u32 gsi)
> > -{
> > - int i;
> > -
> > - /* Find the PCH_PIC that manages this GSI. */
> > - for (i = 0; i < MAX_IO_PICS; i++) {
> > - struct pch_pic *priv = pch_pic_priv[i];
> > -
> > - if (!priv)
> > - return -1;
> > -
> > - if (gsi >= priv->gsi_base && gsi < (priv->gsi_base +
> > priv->vec_count))
> > - return i;
> > - }
> > -
> > - pr_err("ERROR: Unable to locate PCH_PIC for GSI %d\n", gsi);
> > - return -1;
> > -}
> > -
> > static void pch_pic_bitset(struct pch_pic *priv, int offset, int bit)
> > {
> > u32 reg;
> > @@ -325,6 +306,25 @@ IRQCHIP_DECLARE(pch_pic, "loongson,pch-pic-1.0",
> > pch_pic_of_init);
> > #endif
> >
> > #ifdef CONFIG_ACPI
> > +int find_pch_pic(u32 gsi)
> > +{
> > + int i;
> > +
> > + /* Find the PCH_PIC that manages this GSI. */
> > + for (i = 0; i < MAX_IO_PICS; i++) {
> > + struct pch_pic *priv = pch_pic_priv[i];
> > +
> > + if (!priv)
> > + return -1;
> > +
> > + if (gsi >= priv->gsi_base && gsi < (priv->gsi_base +
> > priv->vec_count))
> > + return i;
> > + }
> > +
> > + pr_err("ERROR: Unable to locate PCH_PIC for GSI %d\n", gsi);
> > + return -1;
> > +}
> > +
> > static int __init
> > pch_lpc_parse_madt(union acpi_subtable_headers *header,
> > const unsigned long end)
>
> While you're fixing this, can you also please fix this:
>
> $ git grep find_pch_pic
> arch/loongarch/include/asm/irq.h:extern int find_pch_pic(u32 gsi);
> arch/loongarch/include/asm/irq.h:int find_pch_pic(u32 gsi);
OK, I will send V2 for that, thanks.

Huacai
>
> Thanks,
>
> M.
> --
> Jazz is not dead. It just smells funny...