aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pcmcia/pcmcia_ioctl.c
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2008-06-20 07:24:31 -0400
committerDominik Brodowski <linux@dominikbrodowski.net>2008-06-24 09:33:44 -0400
commit4aeba0134f1e54cfd881e118b039ab6ed8b99126 (patch)
tree6e289b39fe5d0592334ceb5a3e45d05864bb5e9e /drivers/pcmcia/pcmcia_ioctl.c
parent6351a71cfae2839cf6e63329d3d85eb46a4bc2c7 (diff)
pcmcia: (re)move {pcmcia,pccard}_get_status
Except for one debug message in a driver marked BROKEN, pcmcia_get_status is only used by the ioctl. Therefore, move it to pcmcia_ioctl.c and unexport it. Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Diffstat (limited to 'drivers/pcmcia/pcmcia_ioctl.c')
-rw-r--r--drivers/pcmcia/pcmcia_ioctl.c61
1 files changed, 61 insertions, 0 deletions
diff --git a/drivers/pcmcia/pcmcia_ioctl.c b/drivers/pcmcia/pcmcia_ioctl.c
index 2d0521019536..afd00e7bbbef 100644
--- a/drivers/pcmcia/pcmcia_ioctl.c
+++ b/drivers/pcmcia/pcmcia_ioctl.c
@@ -32,6 +32,7 @@
32#include <pcmcia/cs_types.h> 32#include <pcmcia/cs_types.h>
33#include <pcmcia/cs.h> 33#include <pcmcia/cs.h>
34#include <pcmcia/cistpl.h> 34#include <pcmcia/cistpl.h>
35#include <pcmcia/cisreg.h>
35#include <pcmcia/ds.h> 36#include <pcmcia/ds.h>
36#include <pcmcia/ss.h> 37#include <pcmcia/ss.h>
37 38
@@ -224,6 +225,66 @@ static int pcmcia_adjust_resource_info(adjust_t *adj)
224 return (ret); 225 return (ret);
225} 226}
226 227
228/** pccard_get_status
229 *
230 * Get the current socket state bits. We don't support the latched
231 * SocketState yet: I haven't seen any point for it.
232 */
233
234static int pccard_get_status(struct pcmcia_socket *s,
235 struct pcmcia_device *p_dev,
236 cs_status_t *status)
237{
238 config_t *c;
239 int val;
240
241 s->ops->get_status(s, &val);
242 status->CardState = status->SocketState = 0;
243 status->CardState |= (val & SS_DETECT) ? CS_EVENT_CARD_DETECT : 0;
244 status->CardState |= (val & SS_CARDBUS) ? CS_EVENT_CB_DETECT : 0;
245 status->CardState |= (val & SS_3VCARD) ? CS_EVENT_3VCARD : 0;
246 status->CardState |= (val & SS_XVCARD) ? CS_EVENT_XVCARD : 0;
247 if (s->state & SOCKET_SUSPEND)
248 status->CardState |= CS_EVENT_PM_SUSPEND;
249 if (!(s->state & SOCKET_PRESENT))
250 return CS_NO_CARD;
251
252 c = (p_dev) ? p_dev->function_config : NULL;
253
254 if ((c != NULL) && (c->state & CONFIG_LOCKED) &&
255 (c->IntType & (INT_MEMORY_AND_IO | INT_ZOOMED_VIDEO))) {
256 u_char reg;
257 if (c->CardValues & PRESENT_PIN_REPLACE) {
258 pcmcia_read_cis_mem(s, 1, (c->ConfigBase+CISREG_PRR)>>1, 1, &reg);
259 status->CardState |=
260 (reg & PRR_WP_STATUS) ? CS_EVENT_WRITE_PROTECT : 0;
261 status->CardState |=
262 (reg & PRR_READY_STATUS) ? CS_EVENT_READY_CHANGE : 0;
263 status->CardState |=
264 (reg & PRR_BVD2_STATUS) ? CS_EVENT_BATTERY_LOW : 0;
265 status->CardState |=
266 (reg & PRR_BVD1_STATUS) ? CS_EVENT_BATTERY_DEAD : 0;
267 } else {
268 /* No PRR? Then assume we're always ready */
269 status->CardState |= CS_EVENT_READY_CHANGE;
270 }
271 if (c->CardValues & PRESENT_EXT_STATUS) {
272 pcmcia_read_cis_mem(s, 1, (c->ConfigBase+CISREG_ESR)>>1, 1, &reg);
273 status->CardState |=
274 (reg & ESR_REQ_ATTN) ? CS_EVENT_REQUEST_ATTENTION : 0;
275 }
276 return CS_SUCCESS;
277 }
278 status->CardState |=
279 (val & SS_WRPROT) ? CS_EVENT_WRITE_PROTECT : 0;
280 status->CardState |=
281 (val & SS_BATDEAD) ? CS_EVENT_BATTERY_DEAD : 0;
282 status->CardState |=
283 (val & SS_BATWARN) ? CS_EVENT_BATTERY_LOW : 0;
284 status->CardState |=
285 (val & SS_READY) ? CS_EVENT_READY_CHANGE : 0;
286 return CS_SUCCESS;
287} /* pccard_get_status */
227 288
228/*====================================================================== 289/*======================================================================
229 290