login
Header Space

 
 

Re: [2.6 patch] drivers/pci/msi.c: move arch hooks to the top

Previous thread: Re: Socket by Grant Likely on Tuesday, December 11, 2007 - 5:09 pm. (1 message)

Next thread: [2.6 patch] crypto/geode-aes.c: add __dev{init,exit} annotations by Adrian Bunk on Tuesday, December 11, 2007 - 6:19 pm. (2 messages)
To: <gregkh@...>
Cc: <linux-kernel@...>, <linux-pci@...>
Date: Tuesday, December 11, 2007 - 6:19 pm

This patch fixes the following problem present with older gcc versions:

&lt;--  snip  --&gt;

...
  CC      drivers/pci/msi.o
/home/bunk/linux/kernel-2.6/git/linux-2.6/drivers/pci/msi.c:692: warning: weak declaration of `arch_msi_check_device' after first use results in unspecified behavior
/home/bunk/linux/kernel-2.6/git/linux-2.6/drivers/pci/msi.c:704: warning: weak declaration of `arch_setup_msi_irqs' after first use results in unspecified behavior
/home/bunk/linux/kernel-2.6/git/linux-2.6/drivers/pci/msi.c:724: warning: weak declaration of `arch_teardown_msi_irqs' after first use results in unspecified behavior
...

&lt;--  snip  --&gt;

Signed-off-by: Adrian Bunk &lt;bunk@kernel.org&gt;

---

 drivers/pci/msi.c |   91 ++++++++++++++++++++++------------------------
 1 file changed, 45 insertions(+), 46 deletions(-)

6b61f9979425bec016aefdddfd415f6fa5240b67 
diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
index 07c9f09..21c73d5 100644
--- a/drivers/pci/msi.c
+++ b/drivers/pci/msi.c
@@ -25,6 +25,51 @@
 
 static int pci_msi_enable = 1;
 
+/* Arch hooks */
+
+int __attribute__ ((weak))
+arch_msi_check_device(struct pci_dev *dev, int nvec, int type)
+{
+	return 0;
+}
+
+int __attribute__ ((weak))
+arch_setup_msi_irq(struct pci_dev *dev, struct msi_desc *entry)
+{
+	return 0;
+}
+
+int __attribute__ ((weak))
+arch_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
+{
+	struct msi_desc *entry;
+	int ret;
+
+	list_for_each_entry(entry, &amp;dev-&gt;msi_list, list) {
+		ret = arch_setup_msi_irq(dev, entry);
+		if (ret)
+			return ret;
+	}
+
+	return 0;
+}
+
+void __attribute__ ((weak)) arch_teardown_msi_irq(unsigned int irq)
+{
+	return;
+}
+
+void __attribute__ ((weak))
+arch_teardown_msi_irqs(struct pci_dev *dev)
+{
+	struct msi_desc *entry;
+
+	list_for_each_entry(entry, &amp;dev-&gt;msi_list, list) {
+		if (entry-&gt;irq != 0)
+			arch_teardown_msi_irq(entry-&gt;irq);
+	}
+}
+
 static void msi_set_enable(struct pci_dev *dev, int ena...
To: Adrian Bunk <bunk@...>
Cc: <gregkh@...>, <linux-kernel@...>, <linux-pci@...>
Date: Tuesday, December 11, 2007 - 6:44 pm

weak declaration of `arch_msi_check_device' after first use results in uns=
 weak declaration of `arch_setup_msi_irqs' after first use results in unspe=
 weak declaration of `arch_teardown_msi_irqs' after first use results in un=

They're declared in &lt;linux/msi.h&gt;, I don't see what it's problem is.

cheers

--=20
Michael Ellerman
OzLabs, IBM Australia Development Lab

wwweb: http://michael.ellerman.id.au
phone: +61 2 6212 1183 (tie line 70 21183)

We do not inherit the earth from our ancestors,
we borrow it from our children. - S.M.A.R.T Person
To: Michael Ellerman <michael@...>
Cc: <gregkh@...>, <linux-kernel@...>, <linux-pci@...>
Date: Tuesday, December 11, 2007 - 7:00 pm

Older gcc versions don't like that they cannot see that they are weak 
functions at the time when they are used.

I'm not sure whether the generated code does the right thing, but even 

cu
Adrian

-- 

       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed

--
To: Adrian Bunk <bunk@...>
Cc: <gregkh@...>, <linux-kernel@...>, <linux-pci@...>
Date: Tuesday, December 11, 2007 - 7:37 pm

ing: weak declaration of `arch_msi_check_device' after first use results in=
ing: weak declaration of `arch_setup_msi_irqs' after first use results in u=
ing: weak declaration of `arch_teardown_msi_irqs' after first use results i=

Sure.

--=20
Michael Ellerman
OzLabs, IBM Australia Development Lab

wwweb: http://michael.ellerman.id.au
phone: +61 2 6212 1183 (tie line 70 21183)

We do not inherit the earth from our ancestors,
we borrow it from our children. - S.M.A.R.T Person
Previous thread: Re: Socket by Grant Likely on Tuesday, December 11, 2007 - 5:09 pm. (1 message)

Next thread: [2.6 patch] crypto/geode-aes.c: add __dev{init,exit} annotations by Adrian Bunk on Tuesday, December 11, 2007 - 6:19 pm. (2 messages)
speck-geostationary