aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2006-03-01 18:02:33 -0500
committerDominik Brodowski <linux@dominikbrodowski.net>2006-03-31 10:15:52 -0500
commit8661bb5b4af1849c1f5a4e80c4e275fd13c155d6 (patch)
treead99d85ea8d6f5c4c99b93f869bfd412994fb4ee /drivers/scsi
parent50db3fdbbc98260fb538c1cc3f8cc597ba7bffe7 (diff)
[PATCH] pcmcia: default suspend and resume handling
In all but one case, the suspend and resume functions of PCMCIA drivers contain mostly of calls to pcmcia_release_configuration() and pcmcia_request_configuration(). Therefore, move this code out of the drivers and into the core. Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/pcmcia/aha152x_stub.c18
-rw-r--r--drivers/scsi/pcmcia/fdomain_stub.c17
-rw-r--r--drivers/scsi/pcmcia/nsp_cs.c10
-rw-r--r--drivers/scsi/pcmcia/qlogic_stub.c13
-rw-r--r--drivers/scsi/pcmcia/sym53c500_cs.c15
5 files changed, 2 insertions, 71 deletions
diff --git a/drivers/scsi/pcmcia/aha152x_stub.c b/drivers/scsi/pcmcia/aha152x_stub.c
index e7f9d26a0d7c..7fbef1e51685 100644
--- a/drivers/scsi/pcmcia/aha152x_stub.c
+++ b/drivers/scsi/pcmcia/aha152x_stub.c
@@ -251,27 +251,12 @@ static void aha152x_release_cs(dev_link_t *link)
251 pcmcia_disable_device(link->handle); 251 pcmcia_disable_device(link->handle);
252} 252}
253 253
254static int aha152x_suspend(struct pcmcia_device *dev)
255{
256 dev_link_t *link = dev_to_instance(dev);
257
258 link->state |= DEV_SUSPEND;
259 if (link->state & DEV_CONFIG)
260 pcmcia_release_configuration(link->handle);
261
262 return 0;
263}
264
265static int aha152x_resume(struct pcmcia_device *dev) 254static int aha152x_resume(struct pcmcia_device *dev)
266{ 255{
267 dev_link_t *link = dev_to_instance(dev); 256 dev_link_t *link = dev_to_instance(dev);
268 scsi_info_t *info = link->priv; 257 scsi_info_t *info = link->priv;
269 258
270 link->state &= ~DEV_SUSPEND; 259 aha152x_host_reset_host(info->host);
271 if (link->state & DEV_CONFIG) {
272 pcmcia_request_configuration(link->handle, &link->conf);
273 aha152x_host_reset_host(info->host);
274 }
275 260
276 return 0; 261 return 0;
277} 262}
@@ -294,7 +279,6 @@ static struct pcmcia_driver aha152x_cs_driver = {
294 .probe = aha152x_attach, 279 .probe = aha152x_attach,
295 .remove = aha152x_detach, 280 .remove = aha152x_detach,
296 .id_table = aha152x_ids, 281 .id_table = aha152x_ids,
297 .suspend = aha152x_suspend,
298 .resume = aha152x_resume, 282 .resume = aha152x_resume,
299}; 283};
300 284
diff --git a/drivers/scsi/pcmcia/fdomain_stub.c b/drivers/scsi/pcmcia/fdomain_stub.c
index fb7221cf511f..20b9b27c60dd 100644
--- a/drivers/scsi/pcmcia/fdomain_stub.c
+++ b/drivers/scsi/pcmcia/fdomain_stub.c
@@ -220,26 +220,12 @@ static void fdomain_release(dev_link_t *link)
220 220
221/*====================================================================*/ 221/*====================================================================*/
222 222
223static int fdomain_suspend(struct pcmcia_device *dev)
224{
225 dev_link_t *link = dev_to_instance(dev);
226
227 link->state |= DEV_SUSPEND;
228 if (link->state & DEV_CONFIG)
229 pcmcia_release_configuration(link->handle);
230
231 return 0;
232}
233
234static int fdomain_resume(struct pcmcia_device *dev) 223static int fdomain_resume(struct pcmcia_device *dev)
235{ 224{
236 dev_link_t *link = dev_to_instance(dev); 225 dev_link_t *link = dev_to_instance(dev);
237 226
238 link->state &= ~DEV_SUSPEND; 227 if (link->state & DEV_CONFIG)
239 if (link->state & DEV_CONFIG) {
240 pcmcia_request_configuration(link->handle, &link->conf);
241 fdomain_16x0_bus_reset(NULL); 228 fdomain_16x0_bus_reset(NULL);
242 }
243 229
244 return 0; 230 return 0;
245} 231}
@@ -260,7 +246,6 @@ static struct pcmcia_driver fdomain_cs_driver = {
260 .probe = fdomain_attach, 246 .probe = fdomain_attach,
261 .remove = fdomain_detach, 247 .remove = fdomain_detach,
262 .id_table = fdomain_ids, 248 .id_table = fdomain_ids,
263 .suspend = fdomain_suspend,
264 .resume = fdomain_resume, 249 .resume = fdomain_resume,
265}; 250};
266 251
diff --git a/drivers/scsi/pcmcia/nsp_cs.c b/drivers/scsi/pcmcia/nsp_cs.c
index d469e0d16224..e313b40b7043 100644
--- a/drivers/scsi/pcmcia/nsp_cs.c
+++ b/drivers/scsi/pcmcia/nsp_cs.c
@@ -1987,8 +1987,6 @@ static int nsp_cs_suspend(struct pcmcia_device *dev)
1987 scsi_info_t *info = link->priv; 1987 scsi_info_t *info = link->priv;
1988 nsp_hw_data *data; 1988 nsp_hw_data *data;
1989 1989
1990 link->state |= DEV_SUSPEND;
1991
1992 nsp_dbg(NSP_DEBUG_INIT, "event: suspend"); 1990 nsp_dbg(NSP_DEBUG_INIT, "event: suspend");
1993 1991
1994 if (info->host != NULL) { 1992 if (info->host != NULL) {
@@ -2001,9 +1999,6 @@ static int nsp_cs_suspend(struct pcmcia_device *dev)
2001 1999
2002 info->stop = 1; 2000 info->stop = 1;
2003 2001
2004 if (link->state & DEV_CONFIG)
2005 pcmcia_release_configuration(link->handle);
2006
2007 return 0; 2002 return 0;
2008} 2003}
2009 2004
@@ -2015,11 +2010,6 @@ static int nsp_cs_resume(struct pcmcia_device *dev)
2015 2010
2016 nsp_dbg(NSP_DEBUG_INIT, "event: resume"); 2011 nsp_dbg(NSP_DEBUG_INIT, "event: resume");
2017 2012
2018 link->state &= ~DEV_SUSPEND;
2019
2020 if (link->state & DEV_CONFIG)
2021 pcmcia_request_configuration(link->handle, &link->conf);
2022
2023 info->stop = 0; 2013 info->stop = 0;
2024 2014
2025 if (info->host != NULL) { 2015 if (info->host != NULL) {
diff --git a/drivers/scsi/pcmcia/qlogic_stub.c b/drivers/scsi/pcmcia/qlogic_stub.c
index 1e27059cd462..5a8da5143bd1 100644
--- a/drivers/scsi/pcmcia/qlogic_stub.c
+++ b/drivers/scsi/pcmcia/qlogic_stub.c
@@ -311,22 +311,10 @@ static void qlogic_release(dev_link_t *link)
311 311
312/*====================================================================*/ 312/*====================================================================*/
313 313
314static int qlogic_suspend(struct pcmcia_device *dev)
315{
316 dev_link_t *link = dev_to_instance(dev);
317
318 link->state |= DEV_SUSPEND;
319 if (link->state & DEV_CONFIG)
320 pcmcia_release_configuration(link->handle);
321
322 return 0;
323}
324
325static int qlogic_resume(struct pcmcia_device *dev) 314static int qlogic_resume(struct pcmcia_device *dev)
326{ 315{
327 dev_link_t *link = dev_to_instance(dev); 316 dev_link_t *link = dev_to_instance(dev);
328 317
329 link->state &= ~DEV_SUSPEND;
330 if (link->state & DEV_CONFIG) { 318 if (link->state & DEV_CONFIG) {
331 scsi_info_t *info = link->priv; 319 scsi_info_t *info = link->priv;
332 320
@@ -375,7 +363,6 @@ static struct pcmcia_driver qlogic_cs_driver = {
375 .probe = qlogic_attach, 363 .probe = qlogic_attach,
376 .remove = qlogic_detach, 364 .remove = qlogic_detach,
377 .id_table = qlogic_ids, 365 .id_table = qlogic_ids,
378 .suspend = qlogic_suspend,
379 .resume = qlogic_resume, 366 .resume = qlogic_resume,
380}; 367};
381 368
diff --git a/drivers/scsi/pcmcia/sym53c500_cs.c b/drivers/scsi/pcmcia/sym53c500_cs.c
index 42d002b6d1a5..4a6988567de5 100644
--- a/drivers/scsi/pcmcia/sym53c500_cs.c
+++ b/drivers/scsi/pcmcia/sym53c500_cs.c
@@ -857,26 +857,12 @@ cs_failed:
857 return; 857 return;
858} /* SYM53C500_config */ 858} /* SYM53C500_config */
859 859
860static int sym53c500_suspend(struct pcmcia_device *dev)
861{
862 dev_link_t *link = dev_to_instance(dev);
863
864 link->state |= DEV_SUSPEND;
865 if (link->state & DEV_CONFIG)
866 pcmcia_release_configuration(link->handle);
867
868 return 0;
869}
870
871static int sym53c500_resume(struct pcmcia_device *dev) 860static int sym53c500_resume(struct pcmcia_device *dev)
872{ 861{
873 dev_link_t *link = dev_to_instance(dev); 862 dev_link_t *link = dev_to_instance(dev);
874 struct scsi_info_t *info = link->priv; 863 struct scsi_info_t *info = link->priv;
875 864
876 link->state &= ~DEV_SUSPEND;
877 if (link->state & DEV_CONFIG) { 865 if (link->state & DEV_CONFIG) {
878 pcmcia_request_configuration(link->handle, &link->conf);
879
880 /* See earlier comment about manufacturer IDs. */ 866 /* See earlier comment about manufacturer IDs. */
881 if ((info->manf_id == MANFID_MACNICA) || 867 if ((info->manf_id == MANFID_MACNICA) ||
882 (info->manf_id == MANFID_PIONEER) || 868 (info->manf_id == MANFID_PIONEER) ||
@@ -963,7 +949,6 @@ static struct pcmcia_driver sym53c500_cs_driver = {
963 .probe = SYM53C500_attach, 949 .probe = SYM53C500_attach,
964 .remove = SYM53C500_detach, 950 .remove = SYM53C500_detach,
965 .id_table = sym53c500_ids, 951 .id_table = sym53c500_ids,
966 .suspend = sym53c500_suspend,
967 .resume = sym53c500_resume, 952 .resume = sym53c500_resume,
968}; 953};
969 954