aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pcmcia
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2005-12-08 17:50:36 -0500
committerDominik Brodowski <linux@dominikbrodowski.net>2006-01-05 18:27:57 -0500
commit002dbb2d0d42b4a2c1eef2012c2fe7af48163b3c (patch)
tree10f16863e7302e36df41b0d65006633c286779c3 /drivers/pcmcia
parent1371d3be045a6a1a8b828b838069b5fe6e0ab4c6 (diff)
[PATCH] pcmcia: export stored values in sysfs
Export the stored values instead of re-reading everything in the socket information sysfs files, and make them accessible to all users, not only to root. Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Diffstat (limited to 'drivers/pcmcia')
-rw-r--r--drivers/pcmcia/socket_sysfs.c27
1 files changed, 10 insertions, 17 deletions
diff --git a/drivers/pcmcia/socket_sysfs.c b/drivers/pcmcia/socket_sysfs.c
index 4a3150a7854c..e074bc1f101f 100644
--- a/drivers/pcmcia/socket_sysfs.c
+++ b/drivers/pcmcia/socket_sysfs.c
@@ -42,35 +42,28 @@
42 42
43static ssize_t pccard_show_type(struct class_device *dev, char *buf) 43static ssize_t pccard_show_type(struct class_device *dev, char *buf)
44{ 44{
45 int val;
46 struct pcmcia_socket *s = to_socket(dev); 45 struct pcmcia_socket *s = to_socket(dev);
47 46
48 if (!(s->state & SOCKET_PRESENT)) 47 if (!(s->state & SOCKET_PRESENT))
49 return -ENODEV; 48 return -ENODEV;
50 s->ops->get_status(s, &val); 49 if (s->state & SOCKET_CARDBUS)
51 if (val & SS_CARDBUS)
52 return sprintf(buf, "32-bit\n"); 50 return sprintf(buf, "32-bit\n");
53 if (val & SS_DETECT) 51 return sprintf(buf, "16-bit\n");
54 return sprintf(buf, "16-bit\n");
55 return sprintf(buf, "invalid\n");
56} 52}
57static CLASS_DEVICE_ATTR(card_type, 0400, pccard_show_type, NULL); 53static CLASS_DEVICE_ATTR(card_type, 0444, pccard_show_type, NULL);
58 54
59static ssize_t pccard_show_voltage(struct class_device *dev, char *buf) 55static ssize_t pccard_show_voltage(struct class_device *dev, char *buf)
60{ 56{
61 int val;
62 struct pcmcia_socket *s = to_socket(dev); 57 struct pcmcia_socket *s = to_socket(dev);
63 58
64 if (!(s->state & SOCKET_PRESENT)) 59 if (!(s->state & SOCKET_PRESENT))
65 return -ENODEV; 60 return -ENODEV;
66 s->ops->get_status(s, &val); 61 if (s->socket.Vcc)
67 if (val & SS_3VCARD) 62 return sprintf(buf, "%d.%dV\n", s->socket.Vcc / 10,
68 return sprintf(buf, "3.3V\n"); 63 s->socket.Vcc % 10);
69 if (val & SS_XVCARD) 64 return sprintf(buf, "X.XV\n");
70 return sprintf(buf, "X.XV\n");
71 return sprintf(buf, "5.0V\n");
72} 65}
73static CLASS_DEVICE_ATTR(card_voltage, 0400, pccard_show_voltage, NULL); 66static CLASS_DEVICE_ATTR(card_voltage, 0444, pccard_show_voltage, NULL);
74 67
75static ssize_t pccard_show_vpp(struct class_device *dev, char *buf) 68static ssize_t pccard_show_vpp(struct class_device *dev, char *buf)
76{ 69{
@@ -79,7 +72,7 @@ static ssize_t pccard_show_vpp(struct class_device *dev, char *buf)
79 return -ENODEV; 72 return -ENODEV;
80 return sprintf(buf, "%d.%dV\n", s->socket.Vpp / 10, s->socket.Vpp % 10); 73 return sprintf(buf, "%d.%dV\n", s->socket.Vpp / 10, s->socket.Vpp % 10);
81} 74}
82static CLASS_DEVICE_ATTR(card_vpp, 0400, pccard_show_vpp, NULL); 75static CLASS_DEVICE_ATTR(card_vpp, 0444, pccard_show_vpp, NULL);
83 76
84static ssize_t pccard_show_vcc(struct class_device *dev, char *buf) 77static ssize_t pccard_show_vcc(struct class_device *dev, char *buf)
85{ 78{
@@ -88,7 +81,7 @@ static ssize_t pccard_show_vcc(struct class_device *dev, char *buf)
88 return -ENODEV; 81 return -ENODEV;
89 return sprintf(buf, "%d.%dV\n", s->socket.Vcc / 10, s->socket.Vcc % 10); 82 return sprintf(buf, "%d.%dV\n", s->socket.Vcc / 10, s->socket.Vcc % 10);
90} 83}
91static CLASS_DEVICE_ATTR(card_vcc, 0400, pccard_show_vcc, NULL); 84static CLASS_DEVICE_ATTR(card_vcc, 0444, pccard_show_vcc, NULL);
92 85
93 86
94static ssize_t pccard_store_insert(struct class_device *dev, const char *buf, size_t count) 87static ssize_t pccard_store_insert(struct class_device *dev, const char *buf, size_t count)