Re: [PATCH] [PNP] 'modalias' sysfs export

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Here is a patch for doing multi line modalias for PNP devices. This will
break udev, so that needs to be updated first.

I had a longer look at the card part and it seems that module aliases
cannot be reliably used for it. Not without restructuring the system at
least. The possible combinations explode when you notice that the driver
ids needs to be just at subset of the card, without any ordering.

If I got my calculations right, a PNP card would have to have roughly
2^(2n) aliases, where n is the number of device ids. So right now, I
lean towards only adding modalias support for the non-card part of the
PNP layer.

Andrew, do you want a fix for the patch in -mm or can you remove the
part of it that modifies drivers/pnp/card.c by yourself?

Rgds
Pierre

[PNP] Export all aliases through the modalias attribute

From: Pierre Ossman <[email protected]>

In order to be backwards compatible, we previously only exported the first
of all the PNP module aliases. We should instead export all aliases,
delimited by newlines.
---

 drivers/pnp/interface.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/pnp/interface.c b/drivers/pnp/interface.c
index 67bd17c..8e78923 100644
--- a/drivers/pnp/interface.c
+++ b/drivers/pnp/interface.c
@@ -461,11 +461,15 @@ static DEVICE_ATTR(id,S_IRUGO,pnp_show_c
 
 static ssize_t pnp_modalias_show(struct device *dmdev, struct device_attribute *attr, char *buf)
 {
+	char *str = 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);
+	while (pos) {
+		str += sprintf(str,"pnp:d%s\n", pos->id);
+		pos = pos->next;
+	}
+	return (str - buf);
 }
 
 static DEVICE_ATTR(modalias,S_IRUGO,pnp_modalias_show,NULL);

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux