Commit b5ab04dc authored by Dominik Brodowski's avatar Dominik Brodowski Committed by Russell King

[PCMCIA] Callbacks use pcmcia_socket not integer.

This patch updates the callbacks to the socket drivers to take the
corresponding struct pcmcia_socket as argument instead of the "socket
number".

 drivers/pcmcia/bulkmem.c    |    6 +++---
 drivers/pcmcia/cistpl.c     |    4 ++--
 drivers/pcmcia/cs.c         |   18 +++++++++---------
 drivers/pcmcia/i82092.c     |   36 +++++++++++++++++++++++-------------
 drivers/pcmcia/i82092aa.h   |   20 ++++++++++----------
 drivers/pcmcia/i82365.c     |   34 +++++++++++++++++++++++-----------
 drivers/pcmcia/pci_socket.c |   40 ++++++++++++++++++++--------------------
 drivers/pcmcia/rsrc_mgr.c   |    2 +-
 drivers/pcmcia/tcic.c       |   35 ++++++++++++++++++-----------------
 include/pcmcia/ss.h         |   22 ++++++++++++----------
 10 files changed, 121 insertions(+), 96 deletions(-)
parent 63159f81
...@@ -259,7 +259,7 @@ static int mtd_modify_window(window_handle_t win, mtd_mod_win_t *req) ...@@ -259,7 +259,7 @@ static int mtd_modify_window(window_handle_t win, mtd_mod_win_t *req)
win->ctl.flags |= MAP_ATTRIB; win->ctl.flags |= MAP_ATTRIB;
win->ctl.speed = req->AccessSpeed; win->ctl.speed = req->AccessSpeed;
win->ctl.card_start = req->CardOffset; win->ctl.card_start = req->CardOffset;
win->sock->ss_entry->set_mem_map(win->sock->sock, &win->ctl); win->sock->ss_entry->set_mem_map(win->sock, &win->ctl);
return CS_SUCCESS; return CS_SUCCESS;
} }
...@@ -272,7 +272,7 @@ static int mtd_set_vpp(client_handle_t handle, mtd_vpp_req_t *req) ...@@ -272,7 +272,7 @@ static int mtd_set_vpp(client_handle_t handle, mtd_vpp_req_t *req)
return CS_BAD_VPP; return CS_BAD_VPP;
s = SOCKET(handle); s = SOCKET(handle);
s->socket.Vpp = req->Vpp1; s->socket.Vpp = req->Vpp1;
if (s->ss_entry->set_socket(s->sock, &s->socket)) if (s->ss_entry->set_socket(s, &s->socket))
return CS_BAD_VPP; return CS_BAD_VPP;
return CS_SUCCESS; return CS_SUCCESS;
} }
...@@ -287,7 +287,7 @@ static int mtd_rdy_mask(client_handle_t handle, mtd_rdy_req_t *req) ...@@ -287,7 +287,7 @@ static int mtd_rdy_mask(client_handle_t handle, mtd_rdy_req_t *req)
s->socket.csc_mask |= SS_READY; s->socket.csc_mask |= SS_READY;
else else
s->socket.csc_mask &= ~SS_READY; s->socket.csc_mask &= ~SS_READY;
if (s->ss_entry->set_socket(s->sock, &s->socket)) if (s->ss_entry->set_socket(s, &s->socket))
return CS_GENERAL_FAILURE; return CS_GENERAL_FAILURE;
return CS_SUCCESS; return CS_SUCCESS;
} }
......
...@@ -86,7 +86,7 @@ void release_cis_mem(socket_info_t *s) ...@@ -86,7 +86,7 @@ void release_cis_mem(socket_info_t *s)
{ {
if (s->cis_mem.sys_start != 0) { if (s->cis_mem.sys_start != 0) {
s->cis_mem.flags &= ~MAP_ACTIVE; s->cis_mem.flags &= ~MAP_ACTIVE;
s->ss_entry->set_mem_map(s->sock, &s->cis_mem); s->ss_entry->set_mem_map(s, &s->cis_mem);
if (!(s->cap.features & SS_CAP_STATIC_MAP)) if (!(s->cap.features & SS_CAP_STATIC_MAP))
release_mem_region(s->cis_mem.sys_start, s->cap.map_size); release_mem_region(s->cis_mem.sys_start, s->cap.map_size);
iounmap(s->cis_virt); iounmap(s->cis_virt);
...@@ -119,7 +119,7 @@ set_cis_map(socket_info_t *s, unsigned int card_offset, unsigned int flags) ...@@ -119,7 +119,7 @@ set_cis_map(socket_info_t *s, unsigned int card_offset, unsigned int flags)
} }
mem->card_start = card_offset; mem->card_start = card_offset;
mem->flags = flags; mem->flags = flags;
s->ss_entry->set_mem_map(s->sock, mem); s->ss_entry->set_mem_map(s, mem);
if (s->cap.features & SS_CAP_STATIC_MAP) { if (s->cap.features & SS_CAP_STATIC_MAP) {
if (s->cis_virt) if (s->cis_virt)
iounmap(s->cis_virt); iounmap(s->cis_virt);
......
...@@ -243,7 +243,7 @@ static int register_callback(socket_info_t *s, void (*handler)(void *, unsigned ...@@ -243,7 +243,7 @@ static int register_callback(socket_info_t *s, void (*handler)(void *, unsigned
if (handler && !try_module_get(s->ss_entry->owner)) if (handler && !try_module_get(s->ss_entry->owner))
return -ENODEV; return -ENODEV;
error = s->ss_entry->register_callback(s->sock, handler, info); error = s->ss_entry->register_callback(s, handler, info);
if (!handler) if (!handler)
module_put(s->ss_entry->owner); module_put(s->ss_entry->owner);
return error; return error;
...@@ -251,34 +251,34 @@ static int register_callback(socket_info_t *s, void (*handler)(void *, unsigned ...@@ -251,34 +251,34 @@ static int register_callback(socket_info_t *s, void (*handler)(void *, unsigned
static int get_socket_status(socket_info_t *s, int *val) static int get_socket_status(socket_info_t *s, int *val)
{ {
return s->ss_entry->get_status(s->sock, val); return s->ss_entry->get_status(s, val);
} }
static int set_socket(socket_info_t *s, socket_state_t *state) static int set_socket(socket_info_t *s, socket_state_t *state)
{ {
return s->ss_entry->set_socket(s->sock, state); return s->ss_entry->set_socket(s, state);
} }
static int set_io_map(socket_info_t *s, struct pccard_io_map *io) static int set_io_map(socket_info_t *s, struct pccard_io_map *io)
{ {
return s->ss_entry->set_io_map(s->sock, io); return s->ss_entry->set_io_map(s, io);
} }
static int set_mem_map(socket_info_t *s, struct pccard_mem_map *mem) static int set_mem_map(socket_info_t *s, struct pccard_mem_map *mem)
{ {
return s->ss_entry->set_mem_map(s->sock, mem); return s->ss_entry->set_mem_map(s, mem);
} }
static int suspend_socket(socket_info_t *s) static int suspend_socket(socket_info_t *s)
{ {
s->socket = dead_socket; s->socket = dead_socket;
return s->ss_entry->suspend(s->sock); return s->ss_entry->suspend(s);
} }
static int init_socket(socket_info_t *s) static int init_socket(socket_info_t *s)
{ {
s->socket = dead_socket; s->socket = dead_socket;
return s->ss_entry->init(s->sock); return s->ss_entry->init(s);
} }
/*====================================================================*/ /*====================================================================*/
...@@ -375,7 +375,7 @@ static int pcmcia_add_socket(struct class_device *class_dev) ...@@ -375,7 +375,7 @@ static int pcmcia_add_socket(struct class_device *class_dev)
spin_lock_init(&socket->lock); spin_lock_init(&socket->lock);
init_socket(socket); init_socket(socket);
socket->ss_entry->inquire_socket(socket->sock, &socket->cap); socket->ss_entry->inquire_socket(socket, &socket->cap);
init_completion(&socket->thread_done); init_completion(&socket->thread_done);
init_waitqueue_head(&socket->thread_wait); init_waitqueue_head(&socket->thread_wait);
...@@ -394,7 +394,7 @@ static int pcmcia_add_socket(struct class_device *class_dev) ...@@ -394,7 +394,7 @@ static int pcmcia_add_socket(struct class_device *class_dev)
sprintf(name, "%02d", socket->sock); sprintf(name, "%02d", socket->sock);
socket->proc = proc_mkdir(name, proc_pccard); socket->proc = proc_mkdir(name, proc_pccard);
if (socket->proc) if (socket->proc)
socket->ss_entry->proc_setup(socket->sock, socket->proc); socket->ss_entry->proc_setup(socket, socket->proc);
#ifdef PCMCIA_DEBUG #ifdef PCMCIA_DEBUG
if (socket->proc) if (socket->proc)
create_proc_read_entry("clients", 0, socket->proc, create_proc_read_entry("clients", 0, socket->proc,
......
...@@ -80,6 +80,7 @@ static struct pccard_operations i82092aa_operations = { ...@@ -80,6 +80,7 @@ static struct pccard_operations i82092aa_operations = {
/* The card can do upto 4 sockets, allocate a structure for each of them */ /* The card can do upto 4 sockets, allocate a structure for each of them */
struct socket_info { struct socket_info {
int number;
int card_state; /* 0 = no socket, int card_state; /* 0 = no socket,
1 = empty socket, 1 = empty socket,
2 = card but not initialized, 2 = card but not initialized,
...@@ -144,6 +145,8 @@ static int __init i82092aa_pci_probe(struct pci_dev *dev, const struct pci_devic ...@@ -144,6 +145,8 @@ static int __init i82092aa_pci_probe(struct pci_dev *dev, const struct pci_devic
sockets[i].cap.map_size = 0x1000; sockets[i].cap.map_size = 0x1000;
sockets[i].cap.irq_mask = 0; sockets[i].cap.irq_mask = 0;
sockets[i].cap.pci_irq = dev->irq; sockets[i].cap.pci_irq = dev->irq;
sockets[i].number = i;
if (card_present(i)) { if (card_present(i)) {
sockets[i].card_state = 3; sockets[i].card_state = 3;
...@@ -443,7 +446,7 @@ static void set_bridge_state(int sock) ...@@ -443,7 +446,7 @@ static void set_bridge_state(int sock)
static int i82092aa_init(unsigned int s) static int i82092aa_init(struct pcmcia_socket *sock)
{ {
int i; int i;
pccard_io_map io = { 0, 0, 0, 0, 1 }; pccard_io_map io = { 0, 0, 0, 0, 1 };
...@@ -452,21 +455,21 @@ static int i82092aa_init(unsigned int s) ...@@ -452,21 +455,21 @@ static int i82092aa_init(unsigned int s)
enter("i82092aa_init"); enter("i82092aa_init");
mem.sys_stop = 0x0fff; mem.sys_stop = 0x0fff;
i82092aa_set_socket(s, &dead_socket); i82092aa_set_socket(sock, &dead_socket);
for (i = 0; i < 2; i++) { for (i = 0; i < 2; i++) {
io.map = i; io.map = i;
i82092aa_set_io_map(s, &io); i82092aa_set_io_map(sock, &io);
} }
for (i = 0; i < 5; i++) { for (i = 0; i < 5; i++) {
mem.map = i; mem.map = i;
i82092aa_set_mem_map(s, &mem); i82092aa_set_mem_map(sock, &mem);
} }
leave("i82092aa_init"); leave("i82092aa_init");
return 0; return 0;
} }
static int i82092aa_suspend(unsigned int sock) static int i82092aa_suspend(struct pcmcia_socket *sock)
{ {
int retval; int retval;
enter("i82092aa_suspend"); enter("i82092aa_suspend");
...@@ -475,8 +478,9 @@ static int i82092aa_suspend(unsigned int sock) ...@@ -475,8 +478,9 @@ static int i82092aa_suspend(unsigned int sock)
return retval; return retval;
} }
static int i82092aa_register_callback(unsigned int sock, void (*handler)(void *, unsigned int), void * info) static int i82092aa_register_callback(struct pcmcia_socket *socket, void (*handler)(void *, unsigned int), void * info)
{ {
unsigned int sock = container_of(socket, struct socket_info, socket)->number;
enter("i82092aa_register_callback"); enter("i82092aa_register_callback");
sockets[sock].handler = handler; sockets[sock].handler = handler;
sockets[sock].info = info; sockets[sock].info = info;
...@@ -484,8 +488,9 @@ static int i82092aa_register_callback(unsigned int sock, void (*handler)(void *, ...@@ -484,8 +488,9 @@ static int i82092aa_register_callback(unsigned int sock, void (*handler)(void *,
return 0; return 0;
} /* i82092aa_register_callback */ } /* i82092aa_register_callback */
static int i82092aa_inquire_socket(unsigned int sock, socket_cap_t *cap) static int i82092aa_inquire_socket(struct pcmcia_socket *socket, socket_cap_t *cap)
{ {
unsigned int sock = container_of(socket, struct socket_info, socket)->number;
enter("i82092aa_inquire_socket"); enter("i82092aa_inquire_socket");
*cap = sockets[sock].cap; *cap = sockets[sock].cap;
leave("i82092aa_inquire_socket"); leave("i82092aa_inquire_socket");
...@@ -493,8 +498,9 @@ static int i82092aa_inquire_socket(unsigned int sock, socket_cap_t *cap) ...@@ -493,8 +498,9 @@ static int i82092aa_inquire_socket(unsigned int sock, socket_cap_t *cap)
} /* i82092aa_inquire_socket */ } /* i82092aa_inquire_socket */
static int i82092aa_get_status(unsigned int sock, u_int *value) static int i82092aa_get_status(struct pcmcia_socket *socket, u_int *value)
{ {
unsigned int sock = container_of(socket, struct socket_info, socket)->number;
unsigned int status; unsigned int status;
enter("i82092aa_get_status"); enter("i82092aa_get_status");
...@@ -535,8 +541,9 @@ static int i82092aa_get_status(unsigned int sock, u_int *value) ...@@ -535,8 +541,9 @@ static int i82092aa_get_status(unsigned int sock, u_int *value)
} }
static int i82092aa_get_socket(unsigned int sock, socket_state_t *state) static int i82092aa_get_socket(struct pcmcia_socket *socket, socket_state_t *state)
{ {
unsigned int sock = container_of(socket, struct socket_info, socket)->number;
unsigned char reg,vcc,vpp; unsigned char reg,vcc,vpp;
enter("i82092aa_get_socket"); enter("i82092aa_get_socket");
...@@ -606,8 +613,9 @@ static int i82092aa_get_socket(unsigned int sock, socket_state_t *state) ...@@ -606,8 +613,9 @@ static int i82092aa_get_socket(unsigned int sock, socket_state_t *state)
return 0; return 0;
} }
static int i82092aa_set_socket(unsigned int sock, socket_state_t *state) static int i82092aa_set_socket(struct pcmcia_socket *socket, socket_state_t *state)
{ {
unsigned int sock = container_of(socket, struct socket_info, socket)->number;
unsigned char reg; unsigned char reg;
enter("i82092aa_set_socket"); enter("i82092aa_set_socket");
...@@ -702,8 +710,9 @@ static int i82092aa_set_socket(unsigned int sock, socket_state_t *state) ...@@ -702,8 +710,9 @@ static int i82092aa_set_socket(unsigned int sock, socket_state_t *state)
return 0; return 0;
} }
static int i82092aa_set_io_map(unsigned sock, struct pccard_io_map *io) static int i82092aa_set_io_map(struct pcmcia_socket *socket, struct pccard_io_map *io)
{ {
unsigned int sock = container_of(socket, struct socket_info, socket)->number;
unsigned char map, ioctl; unsigned char map, ioctl;
enter("i82092aa_set_io_map"); enter("i82092aa_set_io_map");
...@@ -745,8 +754,9 @@ static int i82092aa_set_io_map(unsigned sock, struct pccard_io_map *io) ...@@ -745,8 +754,9 @@ static int i82092aa_set_io_map(unsigned sock, struct pccard_io_map *io)
return 0; return 0;
} }
static int i82092aa_set_mem_map(unsigned sock, struct pccard_mem_map *mem) static int i82092aa_set_mem_map(struct pcmcia_socket *socket, struct pccard_mem_map *mem)
{ {
unsigned int sock = container_of(socket, struct socket_info, socket)->number;
unsigned short base, i; unsigned short base, i;
unsigned char map; unsigned char map;
...@@ -822,7 +832,7 @@ static int i82092aa_set_mem_map(unsigned sock, struct pccard_mem_map *mem) ...@@ -822,7 +832,7 @@ static int i82092aa_set_mem_map(unsigned sock, struct pccard_mem_map *mem)
return 0; return 0;
} }
static void i82092aa_proc_setup(unsigned int sock, struct proc_dir_entry *base) static void i82092aa_proc_setup(struct pcmcia_socket *socket, struct proc_dir_entry *base)
{ {
} }
......
...@@ -28,16 +28,16 @@ static irqreturn_t i82092aa_interrupt(int irq, void *dev, struct pt_regs *regs); ...@@ -28,16 +28,16 @@ static irqreturn_t i82092aa_interrupt(int irq, void *dev, struct pt_regs *regs);
static int i82092aa_get_status(unsigned int sock, u_int *value); static int i82092aa_get_status(struct pcmcia_socket *socket, u_int *value);
static int i82092aa_get_socket(unsigned int sock, socket_state_t *state); static int i82092aa_get_socket(struct pcmcia_socket *socket, socket_state_t *state);
static int i82092aa_set_socket(unsigned int sock, socket_state_t *state); static int i82092aa_set_socket(struct pcmcia_socket *socket, socket_state_t *state);
static int i82092aa_set_io_map(unsigned int sock, struct pccard_io_map *io); static int i82092aa_set_io_map(struct pcmcia_socket *socket, struct pccard_io_map *io);
static int i82092aa_set_mem_map(unsigned int sock, struct pccard_mem_map *mem); static int i82092aa_set_mem_map(struct pcmcia_socket *socket, struct pccard_mem_map *mem);
static int i82092aa_init(unsigned int s); static int i82092aa_init(struct pcmcia_socket *socket);
static int i82092aa_suspend(unsigned int sock); static int i82092aa_suspend(struct pcmcia_socket *socket);
static int i82092aa_register_callback(unsigned int sock, void (*handler)(void *, unsigned int), void * info); static int i82092aa_register_callback(struct pcmcia_socket *socket, void (*handler)(void *, unsigned int), void * info);
static int i82092aa_inquire_socket(unsigned int sock, socket_cap_t *cap); static int i82092aa_inquire_socket(struct pcmcia_socket *socket, socket_cap_t *cap);
static void i82092aa_proc_setup(unsigned int sock, struct proc_dir_entry *base); static void i82092aa_proc_setup(struct pcmcia_socket *socket, struct proc_dir_entry *base);
#endif #endif
...@@ -167,6 +167,7 @@ typedef struct vg46x_state_t { ...@@ -167,6 +167,7 @@ typedef struct vg46x_state_t {
typedef struct socket_info_t { typedef struct socket_info_t {
u_short type, flags; u_short type, flags;
struct pcmcia_socket socket; struct pcmcia_socket socket;
unsigned int number;
socket_cap_t cap; socket_cap_t cap;
ioaddr_t ioaddr; ioaddr_t ioaddr;
u_short psock; u_short psock;
...@@ -1014,8 +1015,9 @@ static void pcic_interrupt_wrapper(u_long data) ...@@ -1014,8 +1015,9 @@ static void pcic_interrupt_wrapper(u_long data)
/*====================================================================*/ /*====================================================================*/
static int pcic_register_callback(unsigned int sock, void (*handler)(void *, unsigned int), void * info) static int pcic_register_callback(struct pcmcia_socket *s, void (*handler)(void *, unsigned int), void * info)
{ {
unsigned int sock = container_of(s, struct socket_info_t, socket)->number;
socket[sock].handler = handler; socket[sock].handler = handler;
socket[sock].info = info; socket[sock].info = info;
return 0; return 0;
...@@ -1023,8 +1025,9 @@ static int pcic_register_callback(unsigned int sock, void (*handler)(void *, uns ...@@ -1023,8 +1025,9 @@ static int pcic_register_callback(unsigned int sock, void (*handler)(void *, uns
/*====================================================================*/ /*====================================================================*/
static int pcic_inquire_socket(unsigned int sock, socket_cap_t *cap) static int pcic_inquire_socket(struct pcmcia_socket *s, socket_cap_t *cap)
{ {
unsigned int sock = container_of(s, struct socket_info_t, socket)->number;
*cap = socket[sock].cap; *cap = socket[sock].cap;
return 0; return 0;
} /* pcic_inquire_socket */ } /* pcic_inquire_socket */
...@@ -1371,9 +1374,9 @@ static int proc_read_exca(char *buf, char **start, off_t pos, ...@@ -1371,9 +1374,9 @@ static int proc_read_exca(char *buf, char **start, off_t pos,
return (p - buf); return (p - buf);
} }
static void pcic_proc_setup(unsigned int sock, struct proc_dir_entry *base) static void pcic_proc_setup(struct pcmcia_socket *sock, struct proc_dir_entry *base)
{ {
socket_info_t *s = &socket[sock]; socket_info_t *s = container_of(sock, struct socket_info_t, socket);
if (s->flags & IS_ALIVE) if (s->flags & IS_ALIVE)
return; return;
...@@ -1421,8 +1424,10 @@ static void pcic_proc_remove(u_short sock) ...@@ -1421,8 +1424,10 @@ static void pcic_proc_remove(u_short sock)
#endif #endif
static int pcic_get_status(unsigned int sock, u_int *value) static int pcic_get_status(struct pcmcia_socket *s, u_int *value)
{ {
unsigned int sock = container_of(s, struct socket_info_t, socket)->number;
if (socket[sock].flags & IS_ALIVE) { if (socket[sock].flags & IS_ALIVE) {
*value = 0; *value = 0;
return -EINVAL; return -EINVAL;
...@@ -1431,39 +1436,45 @@ static int pcic_get_status(unsigned int sock, u_int *value) ...@@ -1431,39 +1436,45 @@ static int pcic_get_status(unsigned int sock, u_int *value)
LOCKED(i365_get_status(sock, value)); LOCKED(i365_get_status(sock, value));
} }
static int pcic_get_socket(unsigned int sock, socket_state_t *state) static int pcic_get_socket(struct pcmcia_socket *s, socket_state_t *state)
{ {
unsigned int sock = container_of(s, struct socket_info_t, socket)->number;
if (socket[sock].flags & IS_ALIVE) if (socket[sock].flags & IS_ALIVE)
return -EINVAL; return -EINVAL;
LOCKED(i365_get_socket(sock, state)); LOCKED(i365_get_socket(sock, state));
} }
static int pcic_set_socket(unsigned int sock, socket_state_t *state) static int pcic_set_socket(struct pcmcia_socket *s, socket_state_t *state)
{ {
unsigned int sock = container_of(s, struct socket_info_t, socket)->number;
if (socket[sock].flags & IS_ALIVE) if (socket[sock].flags & IS_ALIVE)
return -EINVAL; return -EINVAL;
LOCKED(i365_set_socket(sock, state)); LOCKED(i365_set_socket(sock, state));
} }
static int pcic_set_io_map(unsigned int sock, struct pccard_io_map *io) static int pcic_set_io_map(struct pcmcia_socket *s, struct pccard_io_map *io)
{ {
unsigned int sock = container_of(s, struct socket_info_t, socket)->number;
if (socket[sock].flags & IS_ALIVE) if (socket[sock].flags & IS_ALIVE)
return -EINVAL; return -EINVAL;
LOCKED(i365_set_io_map(sock, io)); LOCKED(i365_set_io_map(sock, io));
} }
static int pcic_set_mem_map(unsigned int sock, struct pccard_mem_map *mem) static int pcic_set_mem_map(struct pcmcia_socket *s, struct pccard_mem_map *mem)
{ {
unsigned int sock = container_of(s, struct socket_info_t, socket)->number;
if (socket[sock].flags & IS_ALIVE) if (socket[sock].flags & IS_ALIVE)
return -EINVAL; return -EINVAL;
LOCKED(i365_set_mem_map(sock, mem)); LOCKED(i365_set_mem_map(sock, mem));
} }
static int pcic_init(unsigned int s) static int pcic_init(struct pcmcia_socket *s)
{ {
int i; int i;
pccard_io_map io = { 0, 0, 0, 0, 1 }; pccard_io_map io = { 0, 0, 0, 0, 1 };
...@@ -1482,7 +1493,7 @@ static int pcic_init(unsigned int s) ...@@ -1482,7 +1493,7 @@ static int pcic_init(unsigned int s)
return 0; return 0;
} }
static int pcic_suspend(unsigned int sock) static int pcic_suspend(struct pcmcia_socket *sock)
{ {
return pcic_set_socket(sock, &dead_socket); return pcic_set_socket(sock, &dead_socket);
} }
...@@ -1558,6 +1569,7 @@ static int __init init_i82365(void) ...@@ -1558,6 +1569,7 @@ static int __init init_i82365(void)
for (i = 0; i < sockets; i++) { for (i = 0; i < sockets; i++) {
socket[i].socket.dev.dev = &i82365_device.dev; socket[i].socket.dev.dev = &i82365_device.dev;
socket[i].socket.ss_entry = &pcic_operations; socket[i].socket.ss_entry = &pcic_operations;
socket[i].number = i;
ret = pcmcia_register_socket(&socket[i].socket); ret = pcmcia_register_socket(&socket[i].socket);
if (ret && i--) { if (ret && i--) {
for (; i>= 0; i--) for (; i>= 0; i--)
......
...@@ -38,44 +38,44 @@ ...@@ -38,44 +38,44 @@
#define MAX_SOCKETS (8) #define MAX_SOCKETS (8)
static pci_socket_t pci_socket_array[MAX_SOCKETS]; static pci_socket_t pci_socket_array[MAX_SOCKETS];
static int pci_init_socket(unsigned int sock) static int pci_init_socket(struct pcmcia_socket *sock)
{ {
pci_socket_t *socket = pci_socket_array + sock; pci_socket_t *socket = container_of(sock, struct pci_socket, socket);
if (socket->op && socket->op->init) if (socket->op && socket->op->init)
return socket->op->init(socket); return socket->op->init(socket);
return -EINVAL; return -EINVAL;
} }
static int pci_suspend_socket(unsigned int sock) static int pci_suspend_socket(struct pcmcia_socket *sock)
{ {
pci_socket_t *socket = pci_socket_array + sock; pci_socket_t *socket = container_of(sock, struct pci_socket, socket);
if (socket->op && socket->op->suspend) if (socket->op && socket->op->suspend)
return socket->op->suspend(socket); return socket->op->suspend(socket);
return -EINVAL; return -EINVAL;
} }
static int pci_register_callback(unsigned int sock, void (*handler)(void *, unsigned int), void * info) static int pci_register_callback(struct pcmcia_socket *sock, void (*handler)(void *, unsigned int), void * info)
{ {
pci_socket_t *socket = pci_socket_array + sock; pci_socket_t *socket = container_of(sock, struct pci_socket, socket);
socket->handler = handler; socket->handler = handler;
socket->info = info; socket->info = info;
return 0; return 0;
} }
static int pci_inquire_socket(unsigned int sock, socket_cap_t *cap) static int pci_inquire_socket(struct pcmcia_socket *sock, socket_cap_t *cap)
{ {
pci_socket_t *socket = pci_socket_array + sock; pci_socket_t *socket = container_of(sock, struct pci_socket, socket);
*cap = socket->cap; *cap = socket->cap;
return 0; return 0;
} }
static int pci_get_status(unsigned int sock, unsigned int *value) static int pci_get_status(struct pcmcia_socket *sock, unsigned int *value)
{ {
pci_socket_t *socket = pci_socket_array + sock; pci_socket_t *socket = container_of(sock, struct pci_socket, socket);
if (socket->op && socket->op->get_status) if (socket->op && socket->op->get_status)
return socket->op->get_status(socket, value); return socket->op->get_status(socket, value);
...@@ -83,45 +83,45 @@ static int pci_get_status(unsigned int sock, unsigned int *value) ...@@ -83,45 +83,45 @@ static int pci_get_status(unsigned int sock, unsigned int *value)
return -EINVAL; return -EINVAL;
} }
static int pci_get_socket(unsigned int sock, socket_state_t *state) static int pci_get_socket(struct pcmcia_socket *sock, socket_state_t *state)
{ {
pci_socket_t *socket = pci_socket_array + sock; pci_socket_t *socket = container_of(sock, struct pci_socket, socket);
if (socket->op && socket->op->get_socket) if (socket->op && socket->op->get_socket)
return socket->op->get_socket(socket, state); return socket->op->get_socket(socket, state);
return -EINVAL; return -EINVAL;
} }
static int pci_set_socket(unsigned int sock, socket_state_t *state) static int pci_set_socket(struct pcmcia_socket *sock, socket_state_t *state)
{ {
pci_socket_t *socket = pci_socket_array + sock; pci_socket_t *socket = container_of(sock, struct pci_socket, socket);
if (socket->op && socket->op->set_socket) if (socket->op && socket->op->set_socket)
return socket->op->set_socket(socket, state); return socket->op->set_socket(socket, state);
return -EINVAL; return -EINVAL;
} }
static int pci_set_io_map(unsigned int sock, struct pccard_io_map *io) static int pci_set_io_map(struct pcmcia_socket *sock, struct pccard_io_map *io)
{ {
pci_socket_t *socket = pci_socket_array + sock; pci_socket_t *socket = container_of(sock, struct pci_socket, socket);
if (socket->op && socket->op->set_io_map) if (socket->op && socket->op->set_io_map)
return socket->op->set_io_map(socket, io); return socket->op->set_io_map(socket, io);
return -EINVAL; return -EINVAL;
} }
static int pci_set_mem_map(unsigned int sock, struct pccard_mem_map *mem) static int pci_set_mem_map(struct pcmcia_socket *sock, struct pccard_mem_map *mem)
{ {
pci_socket_t *socket = pci_socket_array + sock; pci_socket_t *socket = container_of(sock, struct pci_socket, socket);
if (socket->op && socket->op->set_mem_map) if (socket->op && socket->op->set_mem_map)
return socket->op->set_mem_map(socket, mem); return socket->op->set_mem_map(socket, mem);
return -EINVAL; return -EINVAL;
} }
static void pci_proc_setup(unsigned int sock, struct proc_dir_entry *base) static void pci_proc_setup(struct pcmcia_socket *sock, struct proc_dir_entry *base)
{ {
pci_socket_t *socket = pci_socket_array + sock; pci_socket_t *socket = container_of(sock, struct pci_socket, socket);
if (socket->op && socket->op->proc_setup) if (socket->op && socket->op->proc_setup)
socket->op->proc_setup(socket, base); socket->op->proc_setup(socket, base);
......
...@@ -372,7 +372,7 @@ static int checksum(socket_info_t *s, u_long base) ...@@ -372,7 +372,7 @@ static int checksum(socket_info_t *s, u_long base)
s->cis_virt = ioremap(base, s->cap.map_size); s->cis_virt = ioremap(base, s->cap.map_size);
s->cis_mem.card_start = 0; s->cis_mem.card_start = 0;
s->cis_mem.flags = MAP_ACTIVE; s->cis_mem.flags = MAP_ACTIVE;
s->ss_entry->set_mem_map(s->sock, &s->cis_mem); s->ss_entry->set_mem_map(s, &s->cis_mem);
/* Don't bother checking every word... */ /* Don't bother checking every word... */
a = 0; b = -1; a = 0; b = -1;
for (i = 0; i < s->cap.map_size; i += 44) { for (i = 0; i < s->cap.map_size; i += 44) {
......
...@@ -644,18 +644,19 @@ static void tcic_timer(u_long data) ...@@ -644,18 +644,19 @@ static void tcic_timer(u_long data)
/*====================================================================*/ /*====================================================================*/
static int tcic_register_callback(unsigned int lsock, void (*handler)(void *, unsigned int), void * info) static int tcic_register_callback(struct pcmcia_socket *sock, void (*handler)(void *, unsigned int), void * info)
{ {
socket_table[lsock].handler = handler; u_short psock = container_of(sock, socket_info_t, socket)->psock;
socket_table[lsock].info = info; socket_table[psock].handler = handler;
socket_table[psock].info = info;
return 0; return 0;
} /* tcic_register_callback */ } /* tcic_register_callback */
/*====================================================================*/ /*====================================================================*/
static int tcic_get_status(unsigned int lsock, u_int *value) static int tcic_get_status(struct pcmcia_socket *sock, u_int *value)
{ {
u_short psock = socket_table[lsock].psock; u_short psock = container_of(sock, socket_info_t, socket)->psock;
u_char reg; u_char reg;
tcic_setl(TCIC_ADDR, (psock << TCIC_ADDR_SS_SHFT) tcic_setl(TCIC_ADDR, (psock << TCIC_ADDR_SS_SHFT)
...@@ -679,7 +680,7 @@ static int tcic_get_status(unsigned int lsock, u_int *value) ...@@ -679,7 +680,7 @@ static int tcic_get_status(unsigned int lsock, u_int *value)
/*====================================================================*/ /*====================================================================*/
static int tcic_inquire_socket(unsigned int lsock, socket_cap_t *cap) static int tcic_inquire_socket(struct pcmcia_socket *sock, socket_cap_t *cap)
{ {
*cap = tcic_cap; *cap = tcic_cap;
return 0; return 0;
...@@ -687,9 +688,9 @@ static int tcic_inquire_socket(unsigned int lsock, socket_cap_t *cap) ...@@ -687,9 +688,9 @@ static int tcic_inquire_socket(unsigned int lsock, socket_cap_t *cap)
/*====================================================================*/ /*====================================================================*/
static int tcic_get_socket(unsigned int lsock, socket_state_t *state) static int tcic_get_socket(struct pcmcia_socket *sock, socket_state_t *state)
{ {
u_short psock = socket_table[lsock].psock; u_short psock = container_of(sock, socket_info_t, socket)->psock;
u_char reg; u_char reg;
u_short scf1, scf2; u_short scf1, scf2;
...@@ -740,9 +741,9 @@ static int tcic_get_socket(unsigned int lsock, socket_state_t *state) ...@@ -740,9 +741,9 @@ static int tcic_get_socket(unsigned int lsock, socket_state_t *state)
/*====================================================================*/ /*====================================================================*/
static int tcic_set_socket(unsigned int lsock, socket_state_t *state) static int tcic_set_socket(struct pcmcia_socket *sock, socket_state_t *state)
{ {
u_short psock = socket_table[lsock].psock; u_short psock = container_of(sock, socket_info_t, socket)->psock;
u_char reg; u_char reg;
u_short scf1, scf2; u_short scf1, scf2;
...@@ -815,9 +816,9 @@ static int tcic_set_socket(unsigned int lsock, socket_state_t *state) ...@@ -815,9 +816,9 @@ static int tcic_set_socket(unsigned int lsock, socket_state_t *state)
/*====================================================================*/ /*====================================================================*/
static int tcic_set_io_map(unsigned int lsock, struct pccard_io_map *io) static int tcic_set_io_map(struct pcmcia_socket *sock, struct pccard_io_map *io)
{ {
u_short psock = socket_table[lsock].psock; u_short psock = container_of(sock, socket_info_t, socket)->psock;
u_int addr; u_int addr;
u_short base, len, ioctl; u_short base, len, ioctl;
...@@ -852,9 +853,9 @@ static int tcic_set_io_map(unsigned int lsock, struct pccard_io_map *io) ...@@ -852,9 +853,9 @@ static int tcic_set_io_map(unsigned int lsock, struct pccard_io_map *io)
/*====================================================================*/ /*====================================================================*/
static int tcic_set_mem_map(unsigned int lsock, struct pccard_mem_map *mem) static int tcic_set_mem_map(struct pcmcia_socket *sock, struct pccard_mem_map *mem)
{ {
u_short psock = socket_table[lsock].psock; u_short psock = container_of(sock, socket_info_t, socket)->psock;
u_short addr, ctl; u_short addr, ctl;
u_long base, len, mmap; u_long base, len, mmap;
...@@ -896,11 +897,11 @@ static int tcic_set_mem_map(unsigned int lsock, struct pccard_mem_map *mem) ...@@ -896,11 +897,11 @@ static int tcic_set_mem_map(unsigned int lsock, struct pccard_mem_map *mem)
/*====================================================================*/ /*====================================================================*/
static void tcic_proc_setup(unsigned int sock, struct proc_dir_entry *base) static void tcic_proc_setup(struct pcmcia_socket *sock, struct proc_dir_entry *base)
{ {
} }
static int tcic_init(unsigned int s) static int tcic_init(struct pcmcia_socket *s)
{ {
int i; int i;
pccard_io_map io = { 0, 0, 0, 0, 1 }; pccard_io_map io = { 0, 0, 0, 0, 1 };
...@@ -919,7 +920,7 @@ static int tcic_init(unsigned int s) ...@@ -919,7 +920,7 @@ static int tcic_init(unsigned int s)
return 0; return 0;
} }
static int tcic_suspend(unsigned int sock) static int tcic_suspend(struct pcmcia_socket *sock)
{ {
return tcic_set_socket(sock, &dead_socket); return tcic_set_socket(sock, &dead_socket);
} }
......
...@@ -126,18 +126,20 @@ typedef struct cb_bridge_map { ...@@ -126,18 +126,20 @@ typedef struct cb_bridge_map {
/* /*
* Socket operations. * Socket operations.
*/ */
struct pcmcia_socket;
struct pccard_operations { struct pccard_operations {
struct module *owner; struct module *owner;
int (*init)(unsigned int sock); int (*init)(struct pcmcia_socket *sock);
int (*suspend)(unsigned int sock); int (*suspend)(struct pcmcia_socket *sock);
int (*register_callback)(unsigned int sock, void (*handler)(void *, unsigned int), void * info); int (*register_callback)(struct pcmcia_socket *sock, void (*handler)(void *, unsigned int), void * info);
int (*inquire_socket)(unsigned int sock, socket_cap_t *cap); int (*inquire_socket)(struct pcmcia_socket *sock, socket_cap_t *cap);
int (*get_status)(unsigned int sock, u_int *value); int (*get_status)(struct pcmcia_socket *sock, u_int *value);
int (*get_socket)(unsigned int sock, socket_state_t *state); int (*get_socket)(struct pcmcia_socket *sock, socket_state_t *state);
int (*set_socket)(unsigned int sock, socket_state_t *state); int (*set_socket)(struct pcmcia_socket *sock, socket_state_t *state);
int (*set_io_map)(unsigned int sock, struct pccard_io_map *io); int (*set_io_map)(struct pcmcia_socket *sock, struct pccard_io_map *io);
int (*set_mem_map)(unsigned int sock, struct pccard_mem_map *mem); int (*set_mem_map)(struct pcmcia_socket *sock, struct pccard_mem_map *mem);
void (*proc_setup)(unsigned int sock, struct proc_dir_entry *base); void (*proc_setup)(struct pcmcia_socket *sock, struct proc_dir_entry *base);
}; };
/* /*
......
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