mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Kenn Humborg <kenn@linux.ie>
To: Linux-Kernel <linux-kernel@vger.kernel.org>
Subject: Platform device matching
Date: Sun, 25 Apr 2004 23:05:11 +0100	[thread overview]
Message-ID: <20040425220511.GA20808@excalibur.research.wombat.ie> (raw)


I'm looking at the code for binding platform devices with drivers.  
However, platform_match() doesn't seem to agree with its kerneldoc
comment:

drivers/base/platform.c:
 50 /**
 51  *      platform_match - bind platform device to platform driver.
 52  *      @dev:   device.
 53  *      @drv:   driver.
 54  *
 55  *      Platform device IDs are assumed to be encoded like this: 
 56  *      "<name><instance>", where <name> is a short description of the 
 57  *      type of device, like "pci" or "floppy", and <instance> is the 
 58  *      enumerated instance of the device, like '' or '42'.
 59  *      Driver IDs are simply "<name>". 
 60  *      So, extract the <name> from the device, and compare it against 
 61  *      the name of the driver. Return whether they match or not.
 62  */
 63 
 64 static int platform_match(struct device * dev, struct device_driver * drv)
 65 {
 66         struct platform_device *pdev = container_of(dev, struct platform_device, dev);
 67 
 68         return (strncmp(pdev->name, drv->name, BUS_ID_SIZE) == 0);
 69 }

Shouldn't that really be

 64 static int platform_match(struct device * dev, struct device_driver * drv)
 65 {
 66         struct platform_device *pdev = container_of(dev, struct platform_device, dev);
 67 
 68         return (strncmp(pdev->name, drv->name, strlen(drv->name)) == 0);
 69 }

So that, for example, the 'floppy' driver will match with any of the 
'floppy', 'floppy0' and 'floppy1' devices?

Later,
Kenn



             reply	other threads:[~2004-04-25 22:05 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-04-25 22:05 Kenn Humborg [this message]
2004-04-25 23:00 ` Russell King
2004-04-25 23:17   ` Kenn Humborg
2004-04-25 23:27     ` Russell King
2004-04-25 23:35       ` Kenn Humborg
2004-05-02  6:55         ` Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040425220511.GA20808@excalibur.research.wombat.ie \
    --to=kenn@linux.ie \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®