public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] [PNP] 'modalias' sysfs export
@ 2006-02-27 21:40 Pierre Ossman
  2006-03-01 19:45 ` Kay Sievers
  0 siblings, 1 reply; 33+ messages in thread
From: Pierre Ossman @ 2006-02-27 21:40 UTC (permalink / raw)
  To: ambx1, akpm; +Cc: Pierre Ossman, linux-kernel

User space hardware detection need the 'modalias' attributes in the
sysfs tree. This patch adds support to the PNP bus.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
---

 drivers/pnp/card.c      |   12 ++++++++++++
 drivers/pnp/interface.c |   12 ++++++++++++
 2 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/drivers/pnp/card.c b/drivers/pnp/card.c
index aaa568a..d33a88f 100644
--- a/drivers/pnp/card.c
+++ b/drivers/pnp/card.c
@@ -159,10 +159,22 @@ static ssize_t pnp_show_card_ids(struct 
 
 static DEVICE_ATTR(card_id,S_IRUGO,pnp_show_card_ids,NULL);
 
+static ssize_t pnp_card_modalias_show(struct device *dmdev, struct device_attribute *attr, char *buf)
+{
+	struct pnp_card *card = to_pnp_card(dmdev);
+	struct pnp_id * pos = card->id;
+
+	/* FIXME: modalias can only do one alias */
+	return sprintf(buf, "pnp:c%s\n", pos->id);
+}
+
+static DEVICE_ATTR(modalias,S_IRUGO,pnp_card_modalias_show,NULL);
+
 static int pnp_interface_attach_card(struct pnp_card *card)
 {
 	device_create_file(&card->dev,&dev_attr_name);
 	device_create_file(&card->dev,&dev_attr_card_id);
+	device_create_file(&card->dev,&dev_attr_modalias);
 	return 0;
 }
 
diff --git a/drivers/pnp/interface.c b/drivers/pnp/interface.c
index a2d8ce7..67bd17c 100644
--- a/drivers/pnp/interface.c
+++ b/drivers/pnp/interface.c
@@ -459,10 +459,22 @@ static ssize_t pnp_show_current_ids(stru
 
 static DEVICE_ATTR(id,S_IRUGO,pnp_show_current_ids,NULL);
 
+static ssize_t pnp_modalias_show(struct device *dmdev, struct device_attribute *attr, char *buf)
+{
+	struct pnp_dev *dev = to_pnp_dev(dmdev);
+	struct pnp_id * pos = dev->id;
+
+	/* FIXME: modalias can only do one alias */
+	return sprintf(buf, "pnp:d%s\n", pos->id);
+}
+
+static DEVICE_ATTR(modalias,S_IRUGO,pnp_modalias_show,NULL);
+
 int pnp_interface_attach_device(struct pnp_dev *dev)
 {
 	device_create_file(&dev->dev,&dev_attr_options);
 	device_create_file(&dev->dev,&dev_attr_resources);
 	device_create_file(&dev->dev,&dev_attr_id);
+	device_create_file(&dev->dev,&dev_attr_modalias);
 	return 0;
 }


^ permalink raw reply related	[flat|nested] 33+ messages in thread
* Re: [PATCH] [PNP] 'modalias' sysfs export
@ 2006-03-11 17:07 Andrey Borzenkov
  0 siblings, 0 replies; 33+ messages in thread
From: Andrey Borzenkov @ 2006-03-11 17:07 UTC (permalink / raw)
  To: linux-kernel; +Cc: Pierre Ossman, Kay Sievers, Arjan van de Ven

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

> Arjan van de Ven wrote:
> > On Sat, 2006-03-11 at 17:05 +0100, Pierre Ossman wrote:
> >> Here is a patch for doing multi line modalias for PNP devices. This will
> >> break udev, so that needs to be updated first.
> >
> > how could this EVER be acceptable???
>
> Soon I would hope. The modalias attribute currently only supports one
> alias (i.e. one line). This isn't enough for PNP, so if we want to
> support that bus (which I assume we do) we need to extend the interface.
> udev could be updated and be backwards compatible, the kernel can not
> (excluding adding another interface to the same data). So this patch
> should lag the update to udev a bit (i.e. I'm not suggesting it be
> applied now).

actually it is not that much udev but modprobe issue and modprobe already 
supports multiple modules on command line (modprobe --all, module-init-tools 
3.3.2 that I have here). So assuming module aliases cannot have embedded 
spaces and udev properly space-splits command line (I have not checked, but 
it should be the case IIRC) udev simply has to use 'modprobe --all $modalias' 
to be compatible with this patch. It also remains backwards compatible with 
single-alias modalias.

Or do I miss something obvious here? I understand that alternative is to make 
every alias appear as separate device in sysfs, but I do not know PNP 
structure well enough to decide if it makes sense.

- -andrey
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.1 (GNU/Linux)

iD8DBQFEEwPNR6LMutpd94wRAhpTAJ9DQ6gj4SM+6Arxqxb3hM5PA01cHACgjZQs
yrONSgp3+TAo1p2qzR1tAHg=
=eq0n
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 33+ messages in thread

end of thread, other threads:[~2006-05-12 11:09 UTC | newest]

Thread overview: 33+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-02-27 21:40 [PATCH] [PNP] 'modalias' sysfs export Pierre Ossman
2006-03-01 19:45 ` Kay Sievers
2006-03-02  8:39   ` Pierre Ossman
2006-03-02 16:58     ` Kay Sievers
2006-03-03 11:52       ` Pierre Ossman
2006-03-11 16:05         ` Pierre Ossman
2006-03-11 16:15           ` Arjan van de Ven
2006-03-11 16:21             ` Pierre Ossman
2006-03-12  1:38           ` Andrew Morton
2006-03-12  4:05             ` Kay Sievers
2006-03-12  4:29             ` Adam Belay
2006-03-12  5:09               ` Kay Sievers
2006-03-12  6:01                 ` Adam Belay
2006-03-12 11:17             ` Pierre Ossman
2006-03-12 11:33               ` Matthieu CASTET
2006-03-12 17:23               ` Kay Sievers
2006-03-12 22:55                 ` Andrew Morton
2006-03-13  4:14                   ` Kay Sievers
2006-03-13  6:02                     ` Adam Belay
2006-03-13  6:21                       ` Kay Sievers
2006-03-13  7:04                         ` Adam Belay
2006-03-13  7:26                         ` Adam Belay
2006-03-13  7:36                           ` Kay Sievers
2006-03-14  1:25                             ` Adam Belay
2006-03-13 16:57                 ` Bill Nottingham
2006-03-13 19:24                   ` Kay Sievers
2006-03-13 22:26                     ` Bill Nottingham
2006-03-14 12:29                       ` Sergey Vlasov
2006-03-14 12:47                         ` Pierre Ossman
2006-03-14 15:00                           ` Sergey Vlasov
2006-05-09 17:41                         ` Pozsar Balazs
2006-05-12 11:09                           ` Kay Sievers
  -- strict thread matches above, loose matches on Subject: below --
2006-03-11 17:07 Andrey Borzenkov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox