Commit 31d6168a authored by Russell King's avatar Russell King

[ARM] ecard.c: pass a function pointer for kecardd

parent 74db1a37
...@@ -54,13 +54,8 @@ ...@@ -54,13 +54,8 @@
#define HAVE_EXPMASK #define HAVE_EXPMASK
#endif #endif
enum req {
req_readbytes,
req_reset
};
struct ecard_request { struct ecard_request {
enum req req; void (*fn)(struct ecard_request *);
ecard_t *ec; ecard_t *ec;
unsigned int address; unsigned int address;
unsigned int length; unsigned int length;
...@@ -131,15 +126,14 @@ slot_to_ecard(unsigned int slot) ...@@ -131,15 +126,14 @@ slot_to_ecard(unsigned int slot)
#define POD_INT_ADDR(x) ((volatile unsigned char *)\ #define POD_INT_ADDR(x) ((volatile unsigned char *)\
((BUS_ADDR((x)) - IO_BASE) + IO_START)) ((BUS_ADDR((x)) - IO_BASE) + IO_START))
static inline void ecard_task_reset(struct ecard_request *req) static void ecard_task_reset(struct ecard_request *req)
{ {
struct expansion_card *ec = req->ec; struct expansion_card *ec = req->ec;
if (ec->loader) if (ec->loader)
ecard_loader_reset(POD_INT_ADDR(ec->podaddr), ec->loader); ecard_loader_reset(POD_INT_ADDR(ec->podaddr), ec->loader);
} }
static void static void ecard_task_readbytes(struct ecard_request *req)
ecard_task_readbytes(struct ecard_request *req)
{ {
unsigned char *buf = (unsigned char *)req->buffer; unsigned char *buf = (unsigned char *)req->buffer;
volatile unsigned char *base_addr = volatile unsigned char *base_addr =
...@@ -208,19 +202,6 @@ ecard_task_readbytes(struct ecard_request *req) ...@@ -208,19 +202,6 @@ ecard_task_readbytes(struct ecard_request *req)
} }
static void ecard_do_request(struct ecard_request *req)
{
switch (req->req) {
case req_readbytes:
ecard_task_readbytes(req);
break;
case req_reset:
ecard_task_reset(req);
break;
}
}
static DECLARE_WAIT_QUEUE_HEAD(ecard_wait); static DECLARE_WAIT_QUEUE_HEAD(ecard_wait);
static struct ecard_request *ecard_req; static struct ecard_request *ecard_req;
static DECLARE_MUTEX(ecard_sem); static DECLARE_MUTEX(ecard_sem);
...@@ -298,7 +279,7 @@ ecard_task(void * unused) ...@@ -298,7 +279,7 @@ ecard_task(void * unused)
req = xchg(&ecard_req, NULL); req = xchg(&ecard_req, NULL);
if (req != NULL) { if (req != NULL) {
ecard_do_request(req); req->fn(req);
complete(req->complete); complete(req->complete);
} }
} }
...@@ -340,7 +321,7 @@ ecard_readbytes(void *addr, ecard_t *ec, int off, int len, int useld) ...@@ -340,7 +321,7 @@ ecard_readbytes(void *addr, ecard_t *ec, int off, int len, int useld)
{ {
struct ecard_request req; struct ecard_request req;
req.req = req_readbytes; req.fn = ecard_task_readbytes;
req.ec = ec; req.ec = ec;
req.address = off; req.address = off;
req.length = len; req.length = len;
...@@ -1150,7 +1131,7 @@ static void ecard_drv_shutdown(struct device *dev) ...@@ -1150,7 +1131,7 @@ static void ecard_drv_shutdown(struct device *dev)
if (drv->shutdown) if (drv->shutdown)
drv->shutdown(ec); drv->shutdown(ec);
ecard_release(ec); ecard_release(ec);
req.req = req_reset; req.fn = ecard_task_reset;
req.ec = ec; req.ec = ec;
ecard_call(&req); ecard_call(&req);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment