diff options
author | Linus Torvalds <torvalds@g5.osdl.org> | 2006-01-12 17:00:47 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-01-12 17:00:47 -0500 |
commit | 58cba4650a7a414eabd2b40cc9d8e45fcdf192d9 (patch) | |
tree | 9aedb8e87eba92dc203aa169d4f7459a21be9e34 /drivers/pcmcia/socket_sysfs.c | |
parent | 37ef4399a6bb265d3035e6d6e45f7677b132a3ba (diff) | |
parent | db1019ca0548b263989bc98900eaf15107e533ad (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/brodo/pcmcia-fixes-2.6
Diffstat (limited to 'drivers/pcmcia/socket_sysfs.c')
-rw-r--r-- | drivers/pcmcia/socket_sysfs.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/drivers/pcmcia/socket_sysfs.c b/drivers/pcmcia/socket_sysfs.c index 7a7744662d54..5ab1cdef7c48 100644 --- a/drivers/pcmcia/socket_sysfs.c +++ b/drivers/pcmcia/socket_sysfs.c | |||
@@ -98,6 +98,30 @@ static ssize_t pccard_store_insert(struct class_device *dev, const char *buf, si | |||
98 | } | 98 | } |
99 | static CLASS_DEVICE_ATTR(card_insert, 0200, NULL, pccard_store_insert); | 99 | static CLASS_DEVICE_ATTR(card_insert, 0200, NULL, pccard_store_insert); |
100 | 100 | ||
101 | |||
102 | static ssize_t pccard_show_card_pm_state(struct class_device *dev, char *buf) | ||
103 | { | ||
104 | struct pcmcia_socket *s = to_socket(dev); | ||
105 | return sprintf(buf, "%s\n", s->state & SOCKET_SUSPEND ? "off" : "on"); | ||
106 | } | ||
107 | |||
108 | static ssize_t pccard_store_card_pm_state(struct class_device *dev, const char *buf, size_t count) | ||
109 | { | ||
110 | ssize_t ret = -EINVAL; | ||
111 | struct pcmcia_socket *s = to_socket(dev); | ||
112 | |||
113 | if (!count) | ||
114 | return -EINVAL; | ||
115 | |||
116 | if (!(s->state & SOCKET_SUSPEND) && !strncmp(buf, "off", 3)) | ||
117 | ret = pcmcia_suspend_card(s); | ||
118 | else if ((s->state & SOCKET_SUSPEND) && !strncmp(buf, "on", 2)) | ||
119 | ret = pcmcia_resume_card(s); | ||
120 | |||
121 | return ret ? -ENODEV : count; | ||
122 | } | ||
123 | static CLASS_DEVICE_ATTR(card_pm_state, 0644, pccard_show_card_pm_state, pccard_store_card_pm_state); | ||
124 | |||
101 | static ssize_t pccard_store_eject(struct class_device *dev, const char *buf, size_t count) | 125 | static ssize_t pccard_store_eject(struct class_device *dev, const char *buf, size_t count) |
102 | { | 126 | { |
103 | ssize_t ret; | 127 | ssize_t ret; |
@@ -320,6 +344,7 @@ static struct class_device_attribute *pccard_socket_attributes[] = { | |||
320 | &class_device_attr_card_vpp, | 344 | &class_device_attr_card_vpp, |
321 | &class_device_attr_card_vcc, | 345 | &class_device_attr_card_vcc, |
322 | &class_device_attr_card_insert, | 346 | &class_device_attr_card_insert, |
347 | &class_device_attr_card_pm_state, | ||
323 | &class_device_attr_card_eject, | 348 | &class_device_attr_card_eject, |
324 | &class_device_attr_card_irq_mask, | 349 | &class_device_attr_card_irq_mask, |
325 | &class_device_attr_available_resources_setup_done, | 350 | &class_device_attr_available_resources_setup_done, |