lkml.org 
[lkml]   [2006]   [Jan]   [6]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
SubjectRe: Platform device matching, & weird strncmp usage
FromBenjamin Herrenschmidt <>
DateFri, 06 Jan 2006 17:04:17 +1100
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@kernel.crashing.org>

--- 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@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-01-06 06:05    [from the cache]
©2003-2008