diff options
author | Dominik Brodowski <linux@dominikbrodowski.net> | 2005-11-14 15:25:51 -0500 |
---|---|---|
committer | Dominik Brodowski <linux@dominikbrodowski.net> | 2006-01-05 18:03:24 -0500 |
commit | f8cfa618dccbdc6dab5297f75779566a388a98fd (patch) | |
tree | b91e0952038dafc6e03bf8b1d8948b1fdefec031 /drivers/scsi/pcmcia/sym53c500_cs.c | |
parent | b463581154f3f3eecda27cae60df813fefcd84d3 (diff) |
[PATCH] pcmcia: unify attach, EVENT_CARD_INSERTION handlers into one probe callback
Unify the EVENT_CARD_INSERTION and "attach" callbacks to one unified
probe() callback. As all in-kernel drivers are changed to this new
callback, there will be no temporary backwards-compatibility. Inside a
probe() function, each driver _must_ set struct pcmcia_device
*p_dev->instance and instance->handle correctly.
With these patches, the basic driver interface for 16-bit PCMCIA drivers
now has the classic four callbacks known also from other buses:
int (*probe) (struct pcmcia_device *dev);
void (*remove) (struct pcmcia_device *dev);
int (*suspend) (struct pcmcia_device *dev);
int (*resume) (struct pcmcia_device *dev);
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.c | 53 |
1 files changed, 10 insertions, 43 deletions
diff --git a/drivers/scsi/pcmcia/sym53c500_cs.c b/drivers/scsi/pcmcia/sym53c500_cs.c index 87d50b33475e..3a4dd6f5b81f 100644 --- a/drivers/scsi/pcmcia/sym53c500_cs.c +++ b/drivers/scsi/pcmcia/sym53c500_cs.c | |||
@@ -228,14 +228,6 @@ enum Phase { | |||
228 | 228 | ||
229 | /* ================================================================== */ | 229 | /* ================================================================== */ |
230 | 230 | ||
231 | /* | ||
232 | * Global (within this module) variables other than | ||
233 | * sym53c500_driver_template (the scsi_host_template). | ||
234 | */ | ||
235 | static dev_info_t dev_info = "sym53c500_cs"; | ||
236 | |||
237 | /* ================================================================== */ | ||
238 | |||
239 | static void | 231 | static void |
240 | chip_init(int io_port) | 232 | chip_init(int io_port) |
241 | { | 233 | { |
@@ -909,22 +901,6 @@ static int sym53c500_resume(struct pcmcia_device *dev) | |||
909 | return 0; | 901 | return 0; |
910 | } | 902 | } |
911 | 903 | ||
912 | static int | ||
913 | SYM53C500_event(event_t event, int priority, event_callback_args_t *args) | ||
914 | { | ||
915 | dev_link_t *link = args->client_data; | ||
916 | |||
917 | DEBUG(1, "SYM53C500_event(0x%06x)\n", event); | ||
918 | |||
919 | switch (event) { | ||
920 | case CS_EVENT_CARD_INSERTION: | ||
921 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | ||
922 | SYM53C500_config(link); | ||
923 | break; | ||
924 | } | ||
925 | return 0; | ||
926 | } /* SYM53C500_event */ | ||
927 | |||
928 | static void | 904 | static void |
929 | SYM53C500_detach(struct pcmcia_device *p_dev) | 905 | SYM53C500_detach(struct pcmcia_device *p_dev) |
930 | { | 906 | { |
@@ -939,20 +915,18 @@ SYM53C500_detach(struct pcmcia_device *p_dev) | |||
939 | link->priv = NULL; | 915 | link->priv = NULL; |
940 | } /* SYM53C500_detach */ | 916 | } /* SYM53C500_detach */ |
941 | 917 | ||
942 | static dev_link_t * | 918 | static int |
943 | SYM53C500_attach(void) | 919 | SYM53C500_attach(struct pcmcia_device *p_dev) |
944 | { | 920 | { |
945 | struct scsi_info_t *info; | 921 | struct scsi_info_t *info; |
946 | client_reg_t client_reg; | ||
947 | dev_link_t *link; | 922 | dev_link_t *link; |
948 | int ret; | ||
949 | 923 | ||
950 | DEBUG(0, "SYM53C500_attach()\n"); | 924 | DEBUG(0, "SYM53C500_attach()\n"); |
951 | 925 | ||
952 | /* Create new SCSI device */ | 926 | /* Create new SCSI device */ |
953 | info = kmalloc(sizeof(*info), GFP_KERNEL); | 927 | info = kmalloc(sizeof(*info), GFP_KERNEL); |
954 | if (!info) | 928 | if (!info) |
955 | return NULL; | 929 | return -ENOMEM; |
956 | memset(info, 0, sizeof(*info)); | 930 | memset(info, 0, sizeof(*info)); |
957 | link = &info->link; | 931 | link = &info->link; |
958 | link->priv = info; | 932 | link->priv = info; |
@@ -966,19 +940,13 @@ SYM53C500_attach(void) | |||
966 | link->conf.IntType = INT_MEMORY_AND_IO; | 940 | link->conf.IntType = INT_MEMORY_AND_IO; |
967 | link->conf.Present = PRESENT_OPTION; | 941 | link->conf.Present = PRESENT_OPTION; |
968 | 942 | ||
969 | /* Register with Card Services */ | 943 | link->handle = p_dev; |
970 | link->next = NULL; | 944 | p_dev->instance = link; |
971 | client_reg.dev_info = &dev_info; | ||
972 | client_reg.Version = 0x0210; | ||
973 | client_reg.event_callback_args.client_data = link; | ||
974 | ret = pcmcia_register_client(&link->handle, &client_reg); | ||
975 | if (ret != 0) { | ||
976 | cs_error(link->handle, RegisterClient, ret); | ||
977 | SYM53C500_detach(link->handle); | ||
978 | return NULL; | ||
979 | } | ||
980 | 945 | ||
981 | return link; | 946 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; |
947 | SYM53C500_config(link); | ||
948 | |||
949 | return 0; | ||
982 | } /* SYM53C500_attach */ | 950 | } /* SYM53C500_attach */ |
983 | 951 | ||
984 | MODULE_AUTHOR("Bob Tracy <rct@frus.com>"); | 952 | MODULE_AUTHOR("Bob Tracy <rct@frus.com>"); |
@@ -998,8 +966,7 @@ static struct pcmcia_driver sym53c500_cs_driver = { | |||
998 | .drv = { | 966 | .drv = { |
999 | .name = "sym53c500_cs", | 967 | .name = "sym53c500_cs", |
1000 | }, | 968 | }, |
1001 | .attach = SYM53C500_attach, | 969 | .probe = SYM53C500_attach, |
1002 | .event = SYM53C500_event, | ||
1003 | .remove = SYM53C500_detach, | 970 | .remove = SYM53C500_detach, |
1004 | .id_table = sym53c500_ids, | 971 | .id_table = sym53c500_ids, |
1005 | .suspend = sym53c500_suspend, | 972 | .suspend = sym53c500_suspend, |