From: Dominik Brodowski <linux@brodo.de>
To: Patrick Mochel <mochel@osdl.org>
Cc: torvalds@transmeta.com, jt@hpl.hp.com,
Linux kernel mailing list <linux-kernel@vger.kernel.org>,
mika.penttila@kolumbus.fi
Subject: [PATCH] driver model: fix platform_match [Was: Re: [PATCH] pcmcia: get initialization ordering right [Was: [PATCH 2.5] : i82365 & platform_bus_type]]
Date: Wed, 5 Mar 2003 07:39:12 +0100 [thread overview]
Message-ID: <20030305063912.GA2520@brodo.de> (raw)
In-Reply-To: <Pine.LNX.4.33.0303040831120.992-100000@localhost.localdomain>
Hi Pat,
On Tue, Mar 04, 2003 at 08:35:05AM -0600, Patrick Mochel wrote:
>
> 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.
...
> +
> + if (sscanf(dev->bus_id,"%s",name))
> + return (strcmp(name,drv->name) == 0);
Unfortunately, this won't work: digits are perfectly valid entries of
strings. However, we have the name without the appending instance still
saved in platform_device pdev->name... so what about this?
diff -ruN linux-original/drivers/base/platform.c linux/drivers/base/platform.c
--- linux-original/drivers/base/platform.c 2003-03-05 07:19:19.000000000 +0100
+++ linux/drivers/base/platform.c 2003-03-05 07:22:31.000000000 +0100
@@ -59,12 +59,9 @@
static int platform_match(struct device * dev, struct device_driver * drv)
{
- char name[BUS_ID_SIZE];
+ struct platform_device *pdev = container_of(dev, struct platform_device, dev);
- if (sscanf(dev->bus_id,"%s",name))
- return (strcmp(name,drv->name) == 0);
-
- return 0;
+ return (strncmp(pdev->name, drv->name, BUS_ID_SIZE) == 0);
}
struct bus_type platform_bus_type = {
next prev parent reply other threads:[~2003-03-05 6:31 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-03-04 8:30 [PATCH] pcmcia: get initialization ordering right [Was: [PATCH 2.5] : i82365 & platform_bus_type] mika.penttila
2003-03-04 9:54 ` Dominik Brodowski
2003-03-04 14:35 ` Patrick Mochel
2003-03-04 17:16 ` Jean Tourrilhes
2003-03-04 17:48 ` Patrick Mochel
2003-03-04 18:54 ` Jean Tourrilhes
2003-03-04 19:47 ` Dominik Brodowski
2003-03-05 6:39 ` Dominik Brodowski [this message]
2003-03-05 16:16 ` [PATCH] driver model: fix platform_match [Was: Re: [PATCH] pcmcia: get initialization ordering right [Was: [PATCH 2.5] : i82365 & platform_bus_type]] Patrick Mochel
2003-03-15 2:03 ` Jean Tourrilhes
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=20030305063912.GA2520@brodo.de \
--to=linux@brodo.de \
--cc=jt@hpl.hp.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mika.penttila@kolumbus.fi \
--cc=mochel@osdl.org \
--cc=torvalds@transmeta.com \
/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;
as well as URLs for NNTP newsgroup(s).