aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/pcmcia/sym53c500_cs.c
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2005-11-14 15:21:18 -0500
committerDominik Brodowski <linux@dominikbrodowski.net>2006-01-05 17:59:02 -0500
commit98e4c28b7ec390c2dad6a4c69d69629c0f7e8b10 (patch)
treeb3d46f0643352e541d6a39e6da09059687cf713d /drivers/scsi/pcmcia/sym53c500_cs.c
parent63e7ebd06402951bc8863ba5b7bc9b9f42044849 (diff)
[PATCH] pcmcia: new suspend core
Move the suspend and resume methods out of the event handler, and into special functions. Also use these functions for pre- and post-reset, as almost all drivers already do, and the remaining ones can easily be converted. Bugfix to include/pcmcia/ds.c Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Diffstat (limited to 'drivers/scsi/pcmcia/sym53c500_cs.c')
-rw-r--r--drivers/scsi/pcmcia/sym53c500_cs.c69
1 files changed, 40 insertions, 29 deletions
diff --git a/drivers/scsi/pcmcia/sym53c500_cs.c b/drivers/scsi/pcmcia/sym53c500_cs.c
index 98b64b2aa8ee..c4e3e2294c66 100644
--- a/drivers/scsi/pcmcia/sym53c500_cs.c
+++ b/drivers/scsi/pcmcia/sym53c500_cs.c
@@ -872,11 +872,48 @@ cs_failed:
872 return; 872 return;
873} /* SYM53C500_config */ 873} /* SYM53C500_config */
874 874
875static int sym53c500_suspend(struct pcmcia_device *dev)
876{
877 dev_link_t *link = dev_to_instance(dev);
878
879 link->state |= DEV_SUSPEND;
880 if (link->state & DEV_CONFIG)
881 pcmcia_release_configuration(link->handle);
882
883 return 0;
884}
885
886static int sym53c500_resume(struct pcmcia_device *dev)
887{
888 dev_link_t *link = dev_to_instance(dev);
889 struct scsi_info_t *info = link->priv;
890
891 link->state &= ~DEV_SUSPEND;
892 if (link->state & DEV_CONFIG) {
893 pcmcia_request_configuration(link->handle, &link->conf);
894
895 /* See earlier comment about manufacturer IDs. */
896 if ((info->manf_id == MANFID_MACNICA) ||
897 (info->manf_id == MANFID_PIONEER) ||
898 (info->manf_id == 0x0098)) {
899 outb(0x80, link->io.BasePort1 + 0xd);
900 outb(0x24, link->io.BasePort1 + 0x9);
901 outb(0x04, link->io.BasePort1 + 0xd);
902 }
903 /*
904 * If things don't work after a "resume",
905 * this is a good place to start looking.
906 */
907 SYM53C500_int_host_reset(link->io.BasePort1);
908 }
909
910 return 0;
911}
912
875static int 913static int
876SYM53C500_event(event_t event, int priority, event_callback_args_t *args) 914SYM53C500_event(event_t event, int priority, event_callback_args_t *args)
877{ 915{
878 dev_link_t *link = args->client_data; 916 dev_link_t *link = args->client_data;
879 struct scsi_info_t *info = link->priv;
880 917
881 DEBUG(1, "SYM53C500_event(0x%06x)\n", event); 918 DEBUG(1, "SYM53C500_event(0x%06x)\n", event);
882 919
@@ -890,34 +927,6 @@ SYM53C500_event(event_t event, int priority, event_callback_args_t *args)
890 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 927 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
891 SYM53C500_config(link); 928 SYM53C500_config(link);
892 break; 929 break;
893 case CS_EVENT_PM_SUSPEND:
894 link->state |= DEV_SUSPEND;
895 /* Fall through... */
896 case CS_EVENT_RESET_PHYSICAL:
897 if (link->state & DEV_CONFIG)
898 pcmcia_release_configuration(link->handle);
899 break;
900 case CS_EVENT_PM_RESUME:
901 link->state &= ~DEV_SUSPEND;
902 /* Fall through... */
903 case CS_EVENT_CARD_RESET:
904 if (link->state & DEV_CONFIG) {
905 pcmcia_request_configuration(link->handle, &link->conf);
906 /* See earlier comment about manufacturer IDs. */
907 if ((info->manf_id == MANFID_MACNICA) ||
908 (info->manf_id == MANFID_PIONEER) ||
909 (info->manf_id == 0x0098)) {
910 outb(0x80, link->io.BasePort1 + 0xd);
911 outb(0x24, link->io.BasePort1 + 0x9);
912 outb(0x04, link->io.BasePort1 + 0xd);
913 }
914 /*
915 * If things don't work after a "resume",
916 * this is a good place to start looking.
917 */
918 SYM53C500_int_host_reset(link->io.BasePort1);
919 }
920 break;
921 } 930 }
922 return 0; 931 return 0;
923} /* SYM53C500_event */ 932} /* SYM53C500_event */
@@ -1012,6 +1021,8 @@ static struct pcmcia_driver sym53c500_cs_driver = {
1012 .event = SYM53C500_event, 1021 .event = SYM53C500_event,
1013 .detach = SYM53C500_detach, 1022 .detach = SYM53C500_detach,
1014 .id_table = sym53c500_ids, 1023 .id_table = sym53c500_ids,
1024 .suspend = sym53c500_suspend,
1025 .resume = sym53c500_resume,
1015}; 1026};
1016 1027
1017static int __init 1028static int __init