diff options
Diffstat (limited to 'drivers/scsi/pcmcia/nsp_cs.c')
-rw-r--r-- | drivers/scsi/pcmcia/nsp_cs.c | 67 |
1 files changed, 8 insertions, 59 deletions
diff --git a/drivers/scsi/pcmcia/nsp_cs.c b/drivers/scsi/pcmcia/nsp_cs.c index e48e9fb3c58c..9e3ab3fd5355 100644 --- a/drivers/scsi/pcmcia/nsp_cs.c +++ b/drivers/scsi/pcmcia/nsp_cs.c | |||
@@ -104,8 +104,6 @@ static struct scsi_host_template nsp_driver_template = { | |||
104 | #endif | 104 | #endif |
105 | }; | 105 | }; |
106 | 106 | ||
107 | static dev_info_t dev_info = {"nsp_cs"}; | ||
108 | |||
109 | static nsp_hw_data nsp_data_base; /* attach <-> detect glue */ | 107 | static nsp_hw_data nsp_data_base; /* attach <-> detect glue */ |
110 | 108 | ||
111 | 109 | ||
@@ -1595,19 +1593,17 @@ static int nsp_eh_host_reset(Scsi_Cmnd *SCpnt) | |||
1595 | configure the card at this point -- we wait until we receive a | 1593 | configure the card at this point -- we wait until we receive a |
1596 | card insertion event. | 1594 | card insertion event. |
1597 | ======================================================================*/ | 1595 | ======================================================================*/ |
1598 | static dev_link_t *nsp_cs_attach(void) | 1596 | static int nsp_cs_attach(struct pcmcia_device *p_dev) |
1599 | { | 1597 | { |
1600 | scsi_info_t *info; | 1598 | scsi_info_t *info; |
1601 | client_reg_t client_reg; | ||
1602 | dev_link_t *link; | 1599 | dev_link_t *link; |
1603 | int ret; | ||
1604 | nsp_hw_data *data = &nsp_data_base; | 1600 | nsp_hw_data *data = &nsp_data_base; |
1605 | 1601 | ||
1606 | nsp_dbg(NSP_DEBUG_INIT, "in"); | 1602 | nsp_dbg(NSP_DEBUG_INIT, "in"); |
1607 | 1603 | ||
1608 | /* Create new SCSI device */ | 1604 | /* Create new SCSI device */ |
1609 | info = kmalloc(sizeof(*info), GFP_KERNEL); | 1605 | info = kmalloc(sizeof(*info), GFP_KERNEL); |
1610 | if (info == NULL) { return NULL; } | 1606 | if (info == NULL) { return -ENOMEM; } |
1611 | memset(info, 0, sizeof(*info)); | 1607 | memset(info, 0, sizeof(*info)); |
1612 | link = &info->link; | 1608 | link = &info->link; |
1613 | link->priv = info; | 1609 | link->priv = info; |
@@ -1635,22 +1631,14 @@ static dev_link_t *nsp_cs_attach(void) | |||
1635 | link->conf.IntType = INT_MEMORY_AND_IO; | 1631 | link->conf.IntType = INT_MEMORY_AND_IO; |
1636 | link->conf.Present = PRESENT_OPTION; | 1632 | link->conf.Present = PRESENT_OPTION; |
1637 | 1633 | ||
1634 | link->handle = p_dev; | ||
1635 | p_dev->instance = link; | ||
1638 | 1636 | ||
1639 | /* Register with Card Services */ | 1637 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; |
1640 | link->next = NULL; | 1638 | nsp_cs_config(link); |
1641 | client_reg.dev_info = &dev_info; | ||
1642 | client_reg.Version = 0x0210; | ||
1643 | client_reg.event_callback_args.client_data = link; | ||
1644 | ret = pcmcia_register_client(&link->handle, &client_reg); | ||
1645 | if (ret != CS_SUCCESS) { | ||
1646 | cs_error(link->handle, RegisterClient, ret); | ||
1647 | nsp_cs_detach(link->handle); | ||
1648 | return NULL; | ||
1649 | } | ||
1650 | |||
1651 | 1639 | ||
1652 | nsp_dbg(NSP_DEBUG_INIT, "link=0x%p", link); | 1640 | nsp_dbg(NSP_DEBUG_INIT, "link=0x%p", link); |
1653 | return link; | 1641 | return 0; |
1654 | } /* nsp_cs_attach */ | 1642 | } /* nsp_cs_attach */ |
1655 | 1643 | ||
1656 | 1644 | ||
@@ -2056,44 +2044,6 @@ static int nsp_cs_resume(struct pcmcia_device *dev) | |||
2056 | return 0; | 2044 | return 0; |
2057 | } | 2045 | } |
2058 | 2046 | ||
2059 | /*====================================================================== | ||
2060 | |||
2061 | The card status event handler. Mostly, this schedules other | ||
2062 | stuff to run after an event is received. A CARD_REMOVAL event | ||
2063 | also sets some flags to discourage the net drivers from trying | ||
2064 | to talk to the card any more. | ||
2065 | |||
2066 | When a CARD_REMOVAL event is received, we immediately set a flag | ||
2067 | to block future accesses to this device. All the functions that | ||
2068 | actually access the device should check this flag to make sure | ||
2069 | the card is still present. | ||
2070 | |||
2071 | ======================================================================*/ | ||
2072 | static int nsp_cs_event(event_t event, | ||
2073 | int priority, | ||
2074 | event_callback_args_t *args) | ||
2075 | { | ||
2076 | dev_link_t *link = args->client_data; | ||
2077 | |||
2078 | nsp_dbg(NSP_DEBUG_INIT, "in, event=0x%08x", event); | ||
2079 | |||
2080 | switch (event) { | ||
2081 | case CS_EVENT_CARD_INSERTION: | ||
2082 | nsp_dbg(NSP_DEBUG_INIT, "event: insert"); | ||
2083 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | ||
2084 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,68)) | ||
2085 | info->bus = args->bus; | ||
2086 | #endif | ||
2087 | nsp_cs_config(link); | ||
2088 | break; | ||
2089 | default: | ||
2090 | nsp_dbg(NSP_DEBUG_INIT, "event: unknown"); | ||
2091 | break; | ||
2092 | } | ||
2093 | nsp_dbg(NSP_DEBUG_INIT, "end"); | ||
2094 | return 0; | ||
2095 | } /* nsp_cs_event */ | ||
2096 | |||
2097 | /*======================================================================* | 2047 | /*======================================================================* |
2098 | * module entry point | 2048 | * module entry point |
2099 | *====================================================================*/ | 2049 | *====================================================================*/ |
@@ -2115,8 +2065,7 @@ static struct pcmcia_driver nsp_driver = { | |||
2115 | .drv = { | 2065 | .drv = { |
2116 | .name = "nsp_cs", | 2066 | .name = "nsp_cs", |
2117 | }, | 2067 | }, |
2118 | .attach = nsp_cs_attach, | 2068 | .probe = nsp_cs_attach, |
2119 | .event = nsp_cs_event, | ||
2120 | .remove = nsp_cs_detach, | 2069 | .remove = nsp_cs_detach, |
2121 | .id_table = nsp_cs_ids, | 2070 | .id_table = nsp_cs_ids, |
2122 | .suspend = nsp_cs_suspend, | 2071 | .suspend = nsp_cs_suspend, |