Re: [PATCH] PnP Updates for 2.6.2-rc2

From: Adam Belay
Date: Fri Jan 30 2004 - 00:25:22 EST


This patch adds some aditional information to sysfs for pnp cards. It should be
useful for userland tools.

--- a/drivers/pnp/card.c 2004-01-29 23:08:49.000000000 +0000
+++ b/drivers/pnp/card.c 2004-01-29 23:03:23.000000000 +0000
@@ -139,6 +139,39 @@
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
* @card: pointer to the card to add
@@ -158,6 +191,7 @@
error = device_register(&card->dev);

if (error == 0) {
+ pnp_interface_attach_card(card);
spin_lock(&pnp_lock);
list_add_tail(&card->global_list, &pnp_cards);
list_add_tail(&card->protocol_list, &card->protocol->cards);
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/