From: Pierre Ossman User space hardware detection needs the 'modalias' attributes in the sysfs tree. This patch adds support to the PNP bus. Signed-off-by: Pierre Ossman Cc: Adam Belay Cc: Greg KH Signed-off-by: Andrew Morton --- drivers/pnp/card.c | 12 ++++++++++++ drivers/pnp/interface.c | 12 ++++++++++++ 2 files changed, 24 insertions(+) diff -puN drivers/pnp/card.c~pnp-modalias-sysfs-export drivers/pnp/card.c --- devel/drivers/pnp/card.c~pnp-modalias-sysfs-export 2006-02-27 19:44:44.000000000 -0800 +++ devel-akpm/drivers/pnp/card.c 2006-02-27 19:44:44.000000000 -0800 @@ -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 -puN drivers/pnp/interface.c~pnp-modalias-sysfs-export drivers/pnp/interface.c --- devel/drivers/pnp/interface.c~pnp-modalias-sysfs-export 2006-02-27 19:44:44.000000000 -0800 +++ devel-akpm/drivers/pnp/interface.c 2006-02-27 19:44:44.000000000 -0800 @@ -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; } _