[PATCH] Clean up suspend
Russell King
rmk+pcmcia at arm.linux.org.uk
Sun Mar 20 11:16:18 EST 2005
Where suspend is implemented, all socket drivers set their socket state
to "dead_socket" as the first thing in their suspend ops method. Factor
this out to the core PCMCIA code.
This allows us to kill some suspend methods, and reduce the references
to "dead_socket". Note that the suspend ops method is now optional.
Signed-off-by: Russell King <rmk at arm.linux.org.uk>
diff -up -x BitKeeper -x ChangeSet -x SCCS -x _xlk -x '*.orig' -x '*.rej' orig/drivers/pcmcia/au1000_generic.c linux/drivers/pcmcia/au1000_generic.c
--- orig/drivers/pcmcia/au1000_generic.c Sun Feb 6 11:38:32 2005
+++ linux/drivers/pcmcia/au1000_generic.c Sun Mar 20 14:29:05 2005
@@ -156,15 +156,12 @@ static int au1x00_pcmcia_sock_init(struc
static int au1x00_pcmcia_suspend(struct pcmcia_socket *sock)
{
struct au1000_pcmcia_socket *skt = to_au1000_socket(sock);
- int ret;
debug("suspending socket %u\n", skt->nr);
- ret = au1x00_pcmcia_config_skt(skt, &dead_socket);
- if (ret == 0)
- skt->ops->socket_suspend(skt);
+ skt->ops->socket_suspend(skt);
- return ret;
+ return 0;
}
static DEFINE_SPINLOCK(status_lock);
diff -up -x BitKeeper -x ChangeSet -x SCCS -x _xlk -x '*.orig' -x '*.rej' orig/drivers/pcmcia/cs.c linux/drivers/pcmcia/cs.c
--- orig/drivers/pcmcia/cs.c Sun Mar 20 16:09:29 2005
+++ linux/drivers/pcmcia/cs.c Sun Mar 20 15:27:37 2005
@@ -565,7 +565,9 @@ static int socket_suspend(struct pcmcia_
send_event(skt, CS_EVENT_PM_SUSPEND, CS_EVENT_PRI_LOW);
skt->socket = dead_socket;
- skt->ops->suspend(skt);
+ skt->ops->set_socket(skt, &skt->socket);
+ if (skt->ops->suspend)
+ skt->ops->suspend(skt);
skt->state |= SOCKET_SUSPEND;
return CS_SUCCESS;
diff -up -x BitKeeper -x ChangeSet -x SCCS -x _xlk -x '*.orig' -x '*.rej' orig/drivers/pcmcia/hd64465_ss.c linux/drivers/pcmcia/hd64465_ss.c
--- orig/drivers/pcmcia/hd64465_ss.c Sun Feb 6 11:38:33 2005
+++ linux/drivers/pcmcia/hd64465_ss.c Sun Mar 20 15:10:33 2005
@@ -353,20 +353,6 @@ static int hs_init(struct pcmcia_socket
/*============================================================*/
-static int hs_suspend(struct pcmcia_socket *s)
-{
-#ifdef HD64465_DEBUG
- hs_socket_t *sp = container_of(s, struct hs_socket_t, socket);
- DPRINTK("hs_suspend(%d)\n", sp->number);
-#endif
-
- /* TODO */
-
- return 0;
-}
-
-/*============================================================*/
-
static int hs_get_status(struct pcmcia_socket *s, u_int *value)
{
@@ -763,7 +749,6 @@ static irqreturn_t hs_interrupt(int irq,
static struct pccard_operations hs_operations = {
.init = hs_init,
- .suspend = hs_suspend,
.get_status = hs_get_status,
.get_socket = hs_get_socket,
.set_socket = hs_set_socket,
diff -up -x BitKeeper -x ChangeSet -x SCCS -x _xlk -x '*.orig' -x '*.rej' orig/drivers/pcmcia/i82092.c linux/drivers/pcmcia/i82092.c
--- orig/drivers/pcmcia/i82092.c Sun Feb 6 11:38:33 2005
+++ linux/drivers/pcmcia/i82092.c Sun Mar 20 14:39:36 2005
@@ -65,7 +65,6 @@ static struct pci_driver i82092aa_pci_dr
/* the pccard structure and its functions */
static struct pccard_operations i82092aa_operations = {
.init = i82092aa_init,
- .suspend = i82092aa_suspend,
.get_status = i82092aa_get_status,
.get_socket = i82092aa_get_socket,
.set_socket = i82092aa_set_socket,
@@ -440,15 +439,6 @@ static int i82092aa_init(struct pcmcia_s
return 0;
}
-static int i82092aa_suspend(struct pcmcia_socket *sock)
-{
- int retval;
- enter("i82092aa_suspend");
- retval = i82092aa_set_socket(sock, &dead_socket);
- leave("i82092aa_suspend");
- return retval;
-}
-
static int i82092aa_get_status(struct pcmcia_socket *socket, u_int *value)
{
unsigned int sock = container_of(socket, struct socket_info, socket)->number;
diff -up -x BitKeeper -x ChangeSet -x SCCS -x _xlk -x '*.orig' -x '*.rej' orig/drivers/pcmcia/i82092aa.h linux/drivers/pcmcia/i82092aa.h
--- orig/drivers/pcmcia/i82092aa.h Wed Jul 2 22:44:06 2003
+++ linux/drivers/pcmcia/i82092aa.h Sun Mar 20 16:11:18 2005
@@ -34,7 +34,6 @@ static int i82092aa_set_socket(struct pc
static int i82092aa_set_io_map(struct pcmcia_socket *socket, struct pccard_io_map *io);
static int i82092aa_set_mem_map(struct pcmcia_socket *socket, struct pccard_mem_map *mem);
static int i82092aa_init(struct pcmcia_socket *socket);
-static int i82092aa_suspend(struct pcmcia_socket *socket);
#endif
diff -up -x BitKeeper -x ChangeSet -x SCCS -x _xlk -x '*.orig' -x '*.rej' orig/drivers/pcmcia/i82365.c linux/drivers/pcmcia/i82365.c
--- orig/drivers/pcmcia/i82365.c Sun Feb 13 17:26:58 2005
+++ linux/drivers/pcmcia/i82365.c Sun Mar 20 14:39:36 2005
@@ -1322,14 +1322,8 @@ static int pcic_init(struct pcmcia_socke
return 0;
}
-static int pcic_suspend(struct pcmcia_socket *sock)
-{
- return pcic_set_socket(sock, &dead_socket);
-}
-
static struct pccard_operations pcic_operations = {
.init = pcic_init,
- .suspend = pcic_suspend,
.get_status = pcic_get_status,
.get_socket = pcic_get_socket,
.set_socket = pcic_set_socket,
diff -up -x BitKeeper -x ChangeSet -x SCCS -x _xlk -x '*.orig' -x '*.rej' orig/drivers/pcmcia/m32r_cfc.c linux/drivers/pcmcia/m32r_cfc.c
--- orig/drivers/pcmcia/m32r_cfc.c Sun Feb 13 17:26:58 2005
+++ linux/drivers/pcmcia/m32r_cfc.c Sun Mar 20 14:38:36 2005
@@ -732,15 +732,8 @@ static int pcc_init(struct pcmcia_socket
return 0;
}
-static int pcc_suspend(struct pcmcia_socket *sock)
-{
- debug(3, "m32r_cfc: pcc_suspend()\n");
- return pcc_set_socket(sock, &dead_socket);
-}
-
static struct pccard_operations pcc_operations = {
.init = pcc_init,
- .suspend = pcc_suspend,
.get_status = pcc_get_status,
.get_socket = pcc_get_socket,
.set_socket = pcc_set_socket,
diff -up -x BitKeeper -x ChangeSet -x SCCS -x _xlk -x '*.orig' -x '*.rej' orig/drivers/pcmcia/m32r_pcc.c linux/drivers/pcmcia/m32r_pcc.c
--- orig/drivers/pcmcia/m32r_pcc.c Sun Feb 13 17:26:58 2005
+++ linux/drivers/pcmcia/m32r_pcc.c Sun Mar 20 14:38:36 2005
@@ -685,14 +685,8 @@ static int pcc_init(struct pcmcia_socket
return 0;
}
-static int pcc_suspend(struct pcmcia_socket *sock)
-{
- return pcc_set_socket(sock, &dead_socket);
-}
-
static struct pccard_operations pcc_operations = {
.init = pcc_init,
- .suspend = pcc_suspend,
.get_status = pcc_get_status,
.get_socket = pcc_get_socket,
.set_socket = pcc_set_socket,
diff -up -x BitKeeper -x ChangeSet -x SCCS -x _xlk -x '*.orig' -x '*.rej' orig/drivers/pcmcia/pd6729.c linux/drivers/pcmcia/pd6729.c
--- orig/drivers/pcmcia/pd6729.c Sat Mar 19 11:22:13 2005
+++ linux/drivers/pcmcia/pd6729.c Sun Mar 20 14:37:56 2005
@@ -615,11 +615,6 @@ static int pd6729_set_mem_map(struct pcm
return 0;
}
-static int pd6729_suspend(struct pcmcia_socket *sock)
-{
- return pd6729_set_socket(sock, &dead_socket);
-}
-
static int pd6729_init(struct pcmcia_socket *sock)
{
int i;
@@ -644,7 +639,6 @@ static int pd6729_init(struct pcmcia_soc
/* the pccard structure and its functions */
static struct pccard_operations pd6729_operations = {
.init = pd6729_init,
- .suspend = pd6729_suspend,
.get_status = pd6729_get_status,
.get_socket = pd6729_get_socket,
.set_socket = pd6729_set_socket,
diff -up -x BitKeeper -x ChangeSet -x SCCS -x _xlk -x '*.orig' -x '*.rej' orig/drivers/pcmcia/soc_common.c linux/drivers/pcmcia/soc_common.c
--- orig/drivers/pcmcia/soc_common.c Fri Feb 25 16:31:02 2005
+++ linux/drivers/pcmcia/soc_common.c Sun Mar 20 14:26:41 2005
@@ -197,15 +197,12 @@ static int soc_common_pcmcia_sock_init(s
static int soc_common_pcmcia_suspend(struct pcmcia_socket *sock)
{
struct soc_pcmcia_socket *skt = to_soc_pcmcia_socket(sock);
- int ret;
debug(skt, 2, "suspending socket\n");
- ret = soc_common_pcmcia_config_skt(skt, &dead_socket);
- if (ret == 0)
- skt->ops->socket_suspend(skt);
+ skt->ops->socket_suspend(skt);
- return ret;
+ return 0;
}
static DEFINE_SPINLOCK(status_lock);
diff -up -x BitKeeper -x ChangeSet -x SCCS -x _xlk -x '*.orig' -x '*.rej' orig/drivers/pcmcia/tcic.c linux/drivers/pcmcia/tcic.c
--- orig/drivers/pcmcia/tcic.c Sun Feb 6 11:38:33 2005
+++ linux/drivers/pcmcia/tcic.c Sun Mar 20 14:37:18 2005
@@ -888,14 +888,8 @@ static int tcic_init(struct pcmcia_socke
return 0;
}
-static int tcic_suspend(struct pcmcia_socket *sock)
-{
- return tcic_set_socket(sock, &dead_socket);
-}
-
static struct pccard_operations tcic_operations = {
.init = tcic_init,
- .suspend = tcic_suspend,
.get_status = tcic_get_status,
.get_socket = tcic_get_socket,
.set_socket = tcic_set_socket,
diff -up -x BitKeeper -x ChangeSet -x SCCS -x _xlk -x '*.orig' -x '*.rej' orig/drivers/pcmcia/vrc4171_card.c linux/drivers/pcmcia/vrc4171_card.c
--- orig/drivers/pcmcia/vrc4171_card.c Sat Mar 19 11:22:13 2005
+++ linux/drivers/pcmcia/vrc4171_card.c Sun Mar 20 15:11:38 2005
@@ -249,11 +249,6 @@ static int pccard_init(struct pcmcia_soc
return 0;
}
-static int pccard_suspend(struct pcmcia_socket *sock)
-{
- return -EINVAL;
-}
-
static int pccard_get_status(struct pcmcia_socket *sock, u_int *value)
{
unsigned int slot;
@@ -554,7 +549,6 @@ static int pccard_set_mem_map(struct pcm
static struct pccard_operations vrc4171_pccard_operations = {
.init = pccard_init,
- .suspend = pccard_suspend,
.get_status = pccard_get_status,
.get_socket = pccard_get_socket,
.set_socket = pccard_set_socket,
diff -up -x BitKeeper -x ChangeSet -x SCCS -x _xlk -x '*.orig' -x '*.rej' orig/drivers/pcmcia/vrc4173_cardu.c linux/drivers/pcmcia/vrc4173_cardu.c
--- orig/drivers/pcmcia/vrc4173_cardu.c Sat Mar 19 11:22:13 2005
+++ linux/drivers/pcmcia/vrc4173_cardu.c Sun Mar 20 15:11:53 2005
@@ -141,11 +141,6 @@ static int cardu_init(unsigned int slot)
return 0;
}
-static int cardu_suspend(unsigned int slot)
-{
- return -EINVAL;
-}
-
static int cardu_register_callback(unsigned int sock,
void (*handler)(void *, unsigned int),
void * info)
@@ -433,7 +428,6 @@ static void cardu_proc_setup(unsigned in
static struct pccard_operations cardu_operations = {
.init = cardu_init,
- .suspend = cardu_suspend,
.register_callback = cardu_register_callback,
.inquire_socket = cardu_inquire_socket,
.get_status = cardu_get_status,
diff -up -x BitKeeper -x ChangeSet -x SCCS -x _xlk -x '*.orig' -x '*.rej' orig/drivers/pcmcia/yenta_socket.c linux/drivers/pcmcia/yenta_socket.c
--- orig/drivers/pcmcia/yenta_socket.c Sat Mar 19 11:22:13 2005
+++ linux/drivers/pcmcia/yenta_socket.c Sun Mar 20 14:27:05 2005
@@ -506,8 +506,6 @@ static int yenta_sock_suspend(struct pcm
{
struct yenta_socket *socket = container_of(sock, struct yenta_socket, socket);
- yenta_set_socket(sock, &dead_socket);
-
/* Disable CSC interrupts */
cb_writel(socket, CB_SOCKET_MASK, 0x0);
--
Russell King
Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/
maintainer of: 2.6 Serial core
More information about the linux-pcmcia
mailing list