[PATCH 4/5] card vpp / vcc

Dominik Brodowski linux at dominikbrodowski.de
Tue May 11 22:28:46 BST 2004


Add attributes "card_vpp" and "card_vcc" which return these voltages, like
"3.3V"

 drivers/pcmcia/socket_sysfs.c |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+)

diff -ruN linux-original/drivers/pcmcia/socket_sysfs.c linux/drivers/pcmcia/socket_sysfs.c
--- linux-original/drivers/pcmcia/socket_sysfs.c	2004-05-11 19:29:59.150249248 +0200
+++ linux/drivers/pcmcia/socket_sysfs.c	2004-05-11 19:31:26.618951984 +0200
@@ -74,9 +74,29 @@
 }
 static CLASS_DEVICE_ATTR(card_voltage, 0400, pccard_show_voltage, NULL);
 
+static ssize_t pccard_show_vpp(struct class_device *dev, char *buf)
+{
+	struct pcmcia_socket *s = to_socket(dev);
+	if (!(s->state & SOCKET_PRESENT))
+		return -ENODEV;
+	return sprintf(buf, "%d.%dV\n", s->socket.Vpp / 10, s->socket.Vpp % 10);
+}
+static CLASS_DEVICE_ATTR(card_vpp, 0400, pccard_show_vpp, NULL);
+
+static ssize_t pccard_show_vcc(struct class_device *dev, char *buf)
+{
+	struct pcmcia_socket *s = to_socket(dev);
+	if (!(s->state & SOCKET_PRESENT))
+		return -ENODEV;
+	return sprintf(buf, "%d.%dV\n", s->socket.Vcc / 10, s->socket.Vcc % 10);
+}
+static CLASS_DEVICE_ATTR(card_vcc, 0400, pccard_show_vcc, NULL);
+
 static struct class_device_attribute *pccard_socket_attributes[] = {
 	&class_device_attr_card_type,
 	&class_device_attr_card_voltage,
+	&class_device_attr_card_vpp,
+	&class_device_attr_card_vcc,
 	NULL,
 };
 



More information about the linux-pcmcia mailing list