Re: Platform device matching

Kenn Humborg
2004-04-25T23:17:14Z

On Mon, Apr 26, 2004 at 12:00:50AM +0100, Russell King wrote:
> On Sun, Apr 25, 2004 at 11:05:11PM +0100, Kenn Humborg wrote:
> > I'm looking at the code for binding platform devices with drivers.
> > However, platform_match() doesn't seem to agree with its kerneldoc
> > comment:
>
> The code is correct as stands. The documentation is behind times. All
> platform devices are "<name><instance-number>" so it's correct that the
> "floppy" driver matches "floppy0" and "floppy1" etc.

Forgive me if I am being dense, but I still don't see how that works.

The current code:

return (strncmp(pdev->name, drv->name, BUS_ID_SIZE) == 0);

will only return 1 if pdev->name and drv->name are _identical_ for the
first 20 bytes. Which "floppy" and "floppy0" are not.

Could it be that all current platform devices are initially named
as "<name>" and the instance number is only appended after matching
has been done?

Later,
Kenn