mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Pierre Ossman <drzeus@drzeus.cx>
To: ambx1@neo.rr.com, akpm@osdl.org
Cc: Pierre Ossman <drzeus-list@drzeus.cx>
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] [PNP] 'modalias' sysfs export
Date: Mon, 27 Feb 2006 22:40:19 +0100	[thread overview]
Message-ID: <20060227214018.3937.14572.stgit@poseidon.drzeus.cx> (raw)

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;
 }


             reply	other threads:[~2006-02-27 21:40 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-27 21:40 Pierre Ossman [this message]
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
2006-03-11 17:07 Andrey Borzenkov

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=20060227214018.3937.14572.stgit@poseidon.drzeus.cx \
    --to=drzeus@drzeus.cx \
    --cc=akpm@osdl.org \
    --cc=ambx1@neo.rr.com \
    --cc=drzeus-list@drzeus.cx \
    /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®