Commit 9aa8cd9f authored by Adam Belay's avatar Adam Belay

[PNP]: Add additonal sysfs entries

This patch adds some aditional information to sysfs for pnp cards.  It
should be useful for userland tools.
parent c3b29725
...@@ -139,6 +139,39 @@ static void pnp_release_card(struct device *dmdev) ...@@ -139,6 +139,39 @@ static void pnp_release_card(struct device *dmdev)
kfree(card); kfree(card);
} }
static ssize_t pnp_show_card_name(struct device *dmdev, char *buf)
{
char *str = buf;
struct pnp_card *card = to_pnp_card(dmdev);
str += sprintf(str,"%s\n", card->name);
return (str - buf);
}
static DEVICE_ATTR(name,S_IRUGO,pnp_show_card_name,NULL);
static ssize_t pnp_show_card_ids(struct device *dmdev, char *buf)
{
char *str = buf;
struct pnp_card *card = to_pnp_card(dmdev);
struct pnp_id * pos = card->id;
while (pos) {
str += sprintf(str,"%s\n", pos->id);
pos = pos->next;
}
return (str - buf);
}
static DEVICE_ATTR(card_id,S_IRUGO,pnp_show_card_ids,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);
return 0;
}
/** /**
* pnp_add_card - adds a PnP card to the PnP Layer * pnp_add_card - adds a PnP card to the PnP Layer
* @card: pointer to the card to add * @card: pointer to the card to add
...@@ -158,6 +191,7 @@ int pnp_add_card(struct pnp_card * card) ...@@ -158,6 +191,7 @@ int pnp_add_card(struct pnp_card * card)
error = device_register(&card->dev); error = device_register(&card->dev);
if (error == 0) { if (error == 0) {
pnp_interface_attach_card(card);
spin_lock(&pnp_lock); spin_lock(&pnp_lock);
list_add_tail(&card->global_list, &pnp_cards); list_add_tail(&card->global_list, &pnp_cards);
list_add_tail(&card->protocol_list, &card->protocol->cards); list_add_tail(&card->protocol_list, &card->protocol->cards);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment