Re: Platform device matching, & weird strncmp usage

From: Benjamin Herrenschmidt
Date: Fri Jan 06 2006 - 01:02:05 EST


On Fri, 2006-01-06 at 16:59 +1100, Benjamin Herrenschmidt wrote:
> Hi !
>
> In 2.6.15, platform device matching works according to this comment in
> the code, or rather are supposed to:

.../...

Just in case my analysis is correct, here's an untested fix:

---

Platform device matching doesn't work when an "id" is used.

Signed-off-by: Benjamin Herrenschmidt <benh@xxxxxxxxxxxxxxxxxxx>

--- linux-work.orig/drivers/base/platform.c 2005-11-24 17:18:43.000000000 +1100
+++ linux-work/drivers/base/platform.c 2006-01-06 16:59:59.000000000 +1100
@@ -447,7 +447,8 @@ static int platform_match(struct device
{
struct platform_device *pdev = container_of(dev, struct platform_device, dev);

- return (strncmp(pdev->name, drv->name, BUS_ID_SIZE) == 0);
+ return strncmp(pdev->name, drv->name,
+ min(BUS_ID_SIZE, strlen(drv->name))) == 0;
}

static int platform_suspend(struct device * dev, pm_message_t state)


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/