diff options
Diffstat (limited to 'drivers/pcmcia/socket_sysfs.c')
-rw-r--r-- | drivers/pcmcia/socket_sysfs.c | 30 |
1 files changed, 11 insertions, 19 deletions
diff --git a/drivers/pcmcia/socket_sysfs.c b/drivers/pcmcia/socket_sysfs.c index 4a3150a7854c..7a7744662d54 100644 --- a/drivers/pcmcia/socket_sysfs.c +++ b/drivers/pcmcia/socket_sysfs.c | |||
@@ -42,35 +42,28 @@ | |||
42 | 42 | ||
43 | static ssize_t pccard_show_type(struct class_device *dev, char *buf) | 43 | static 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 | } |
57 | static CLASS_DEVICE_ATTR(card_type, 0400, pccard_show_type, NULL); | 53 | static CLASS_DEVICE_ATTR(card_type, 0444, pccard_show_type, NULL); |
58 | 54 | ||
59 | static ssize_t pccard_show_voltage(struct class_device *dev, char *buf) | 55 | static 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 | } |
73 | static CLASS_DEVICE_ATTR(card_voltage, 0400, pccard_show_voltage, NULL); | 66 | static CLASS_DEVICE_ATTR(card_voltage, 0444, pccard_show_voltage, NULL); |
74 | 67 | ||
75 | static ssize_t pccard_show_vpp(struct class_device *dev, char *buf) | 68 | static 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 | } |
82 | static CLASS_DEVICE_ATTR(card_vpp, 0400, pccard_show_vpp, NULL); | 75 | static CLASS_DEVICE_ATTR(card_vpp, 0444, pccard_show_vpp, NULL); |
83 | 76 | ||
84 | static ssize_t pccard_show_vcc(struct class_device *dev, char *buf) | 77 | static 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 | } |
91 | static CLASS_DEVICE_ATTR(card_vcc, 0400, pccard_show_vcc, NULL); | 84 | static CLASS_DEVICE_ATTR(card_vcc, 0444, pccard_show_vcc, NULL); |
92 | 85 | ||
93 | 86 | ||
94 | static ssize_t pccard_store_insert(struct class_device *dev, const char *buf, size_t count) | 87 | static ssize_t pccard_store_insert(struct class_device *dev, const char *buf, size_t count) |
@@ -292,10 +285,9 @@ static ssize_t pccard_store_cis(struct kobject *kobj, char *buf, loff_t off, siz | |||
292 | if (!(s->state & SOCKET_PRESENT)) | 285 | if (!(s->state & SOCKET_PRESENT)) |
293 | return -ENODEV; | 286 | return -ENODEV; |
294 | 287 | ||
295 | cis = kmalloc(sizeof(cisdump_t), GFP_KERNEL); | 288 | cis = kzalloc(sizeof(cisdump_t), GFP_KERNEL); |
296 | if (!cis) | 289 | if (!cis) |
297 | return -ENOMEM; | 290 | return -ENOMEM; |
298 | memset(cis, 0, sizeof(cisdump_t)); | ||
299 | 291 | ||
300 | cis->Length = count + 1; | 292 | cis->Length = count + 1; |
301 | memcpy(cis->Data, buf, count); | 293 | memcpy(cis->Data, buf, count); |