On Tue, 4 Mar 2003, Dominik Brodowski wrote:
> Hi Pat,
>
> How is it supposed to work then? I thought adding a platform_device and
> platform_driver with the same name and bus_id causes the platform_driver to
> be bound to the platform_device?
Erm yes. Color me lazy, I just hadn't implemented that yet.. You've hit
something else no one had used before.
This patch is completley untested, but it should work.
-pat
===== drivers/base/platform.c 1.5 vs edited =====
--- 1.5/drivers/base/platform.c Fri Oct 18 13:27:29 2002
+++ edited/drivers/base/platform.c Tue Mar 4 08:34:10 2003
@@ -41,9 +41,29 @@
if (pdev)
device_unregister(&pdev->dev);
}
-
+
+
+/**
+ * platform_match - bind platform device to platform driver.
+ * @dev: device.
+ * @drv: driver.
+ *
+ * Platform device IDs are assumed to be encoded like this:
+ * "<name><instance>", where <name> is a short description of the
+ * type of device, like "pci" or "floppy", and <instance> is the
+ * enumerated instance of the device, like '0' or '42'.
+ * Driver IDs are simply "<name>".
+ * So, extract the <name> from the device, and compare it against
+ * the name of the driver. Return whether they match or not.
+ */
+
static int platform_match(struct device * dev, struct device_driver * drv)
{
+ char name[BUS_ID_SIZE];
+
+ if (sscanf(dev->bus_id,"%s",name))
+ return (strcmp(name,drv->name) == 0);
+
return 0;
}
-
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/
This archive was generated by hypermail 2b29 : Fri Mar 07 2003 - 22:00:24 EST