[PATCH 1/3] PNP: cleanup pnp_fixup_device()

Previous thread: Re: Linux 2.6.26-rc1 - pgtable_32.c:178 pmd_bad by Jeff Chua on Monday, May 5, 2008 - 6:06 pm. (44 messages)

Next thread: [PATCH 2/3] PNP: add pnp_build_option() to the API by Rene Herman on Monday, May 5, 2008 - 6:08 pm. (1 message)
From: Rene Herman
Date: Monday, May 5, 2008 - 6:08 pm

Hi Bjorn.

In response to off-list AD181x thread, small cleanup to quirk handling.

Patch 3/3 does the actual work. Mind if I feed this stuff through you? And,
mind this, period? Not wed to it or anything...

Signed-off-by: Rene Herman <rene.herman@gmail.com>

From: Rene Herman
Date: Monday, May 5, 2008 - 6:14 pm

This by the way is still against your v5. I see there are changes in current 
mainline again. If you need me to regenerate against mainline, please say.

Rene.
--

From: Bjorn Helgaas
Date: Tuesday, May 6, 2008 - 10:15 am

On Monday 05 May 2008 07:08:09 pm Rene Herman wrote:


I'm sort of attached to keeping this similar to pci_do_fixups()
and keeping the symbol, even though the #ifdef is ugly.  I do
like getting rid of the "0x%p" and adding the PNP ID.

--

From: Rene Herman
Date: Saturday, May 10, 2008 - 2:48 pm

Okay. This better? Makes it a bit more similar even.

===
PNP: cleanup pnp_fixup_device()

Make it look a bit more like pci_fixup_device/pci_do_fixups. Also
print the PnP ID and delete the () from the "foo+0x0/0x1234()".

Signed-off-by: Rene Herman <rene.herman@gmail.com>
---
drivers/pnp/quirks.c |   20 ++++++++------------
1 files changed, 8 insertions(+), 12 deletions(-)

diff --git a/drivers/pnp/quirks.c b/drivers/pnp/quirks.c
index d049a22..a1af2f9 100644
--- a/drivers/pnp/quirks.c
+++ b/drivers/pnp/quirks.c
@@ -212,20 +212,16 @@ static struct pnp_fixup pnp_fixups[] = {

void pnp_fixup_device(struct pnp_dev *dev)
{
-	int i = 0;
-	void (*quirk)(struct pnp_dev *);
-
-	while (*pnp_fixups[i].id) {
-		if (compare_pnp_id(dev->id, pnp_fixups[i].id)) {
-			quirk = pnp_fixups[i].quirk_function;
+	struct pnp_fixup *f;

+	for (f = pnp_fixups; *f->id; f++) {
+		if (!compare_pnp_id(dev->id, f->id))
+			continue;
#ifdef DEBUG
-			dev_dbg(&dev->dev, "calling ");
-			print_fn_descriptor_symbol("%s()\n",
-				(unsigned long) *quirk);
+		dev_dbg(&dev->dev, "%s: calling ", f->id);
+		print_fn_descriptor_symbol("%s\n",
+				(unsigned long) f->quirk_function);
#endif
-			(*quirk)(dev);
-		}
-		i++;
+		f->quirk_function(dev);
	}
}


--

Previous thread: Re: Linux 2.6.26-rc1 - pgtable_32.c:178 pmd_bad by Jeff Chua on Monday, May 5, 2008 - 6:06 pm. (44 messages)

Next thread: [PATCH 2/3] PNP: add pnp_build_option() to the API by Rene Herman on Monday, May 5, 2008 - 6:08 pm. (1 message)