You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
[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>
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
This file details changes in 2.6 which affect PCMCIA card driver authors:
|
||||
|
||||
* Unify detach and REMOVAL event code (as of 2.6.16)
|
||||
void (*remove) (struct pcmcia_device *dev);
|
||||
* Unify detach and REMOVAL event code, as well as attach and INSERTION
|
||||
code (as of 2.6.16)
|
||||
void (*remove) (struct pcmcia_device *dev);
|
||||
int (*probe) (struct pcmcia_device *dev);
|
||||
|
||||
* Move suspend, resume and reset out of event handler (as of 2.6.16)
|
||||
int (*suspend) (struct pcmcia_device *dev);
|
||||
|
||||
@@ -87,11 +87,7 @@ typedef struct bluecard_info_t {
|
||||
|
||||
static void bluecard_config(dev_link_t *link);
|
||||
static void bluecard_release(dev_link_t *link);
|
||||
static int bluecard_event(event_t event, int priority, event_callback_args_t *args);
|
||||
|
||||
static dev_info_t dev_info = "bluecard_cs";
|
||||
|
||||
static dev_link_t *bluecard_attach(void);
|
||||
static void bluecard_detach(struct pcmcia_device *p_dev);
|
||||
|
||||
|
||||
@@ -860,17 +856,15 @@ static int bluecard_close(bluecard_info_t *info)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static dev_link_t *bluecard_attach(void)
|
||||
static int bluecard_attach(struct pcmcia_device *p_dev)
|
||||
{
|
||||
bluecard_info_t *info;
|
||||
client_reg_t client_reg;
|
||||
dev_link_t *link;
|
||||
int ret;
|
||||
|
||||
/* Create new info device */
|
||||
info = kzalloc(sizeof(*info), GFP_KERNEL);
|
||||
if (!info)
|
||||
return NULL;
|
||||
return -ENOMEM;
|
||||
|
||||
link = &info->link;
|
||||
link->priv = info;
|
||||
@@ -887,20 +881,13 @@ static dev_link_t *bluecard_attach(void)
|
||||
link->conf.Vcc = 50;
|
||||
link->conf.IntType = INT_MEMORY_AND_IO;
|
||||
|
||||
/* Register with Card Services */
|
||||
link->next = NULL;
|
||||
client_reg.dev_info = &dev_info;
|
||||
client_reg.Version = 0x0210;
|
||||
client_reg.event_callback_args.client_data = link;
|
||||
link->handle = p_dev;
|
||||
p_dev->instance = link;
|
||||
|
||||
ret = pcmcia_register_client(&link->handle, &client_reg);
|
||||
if (ret != CS_SUCCESS) {
|
||||
cs_error(link->handle, RegisterClient, ret);
|
||||
bluecard_detach(link->handle);
|
||||
return NULL;
|
||||
}
|
||||
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
|
||||
bluecard_config(link);
|
||||
|
||||
return link;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -1046,20 +1033,6 @@ static int bluecard_resume(struct pcmcia_device *dev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int bluecard_event(event_t event, int priority, event_callback_args_t *args)
|
||||
{
|
||||
dev_link_t *link = args->client_data;
|
||||
|
||||
switch (event) {
|
||||
case CS_EVENT_CARD_INSERTION:
|
||||
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
|
||||
bluecard_config(link);
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct pcmcia_device_id bluecard_ids[] = {
|
||||
PCMCIA_DEVICE_PROD_ID12("BlueCard", "LSE041", 0xbaf16fbf, 0x657cc15e),
|
||||
PCMCIA_DEVICE_PROD_ID12("BTCFCARD", "LSE139", 0xe3987764, 0x2524b59c),
|
||||
@@ -1073,8 +1046,7 @@ static struct pcmcia_driver bluecard_driver = {
|
||||
.drv = {
|
||||
.name = "bluecard_cs",
|
||||
},
|
||||
.attach = bluecard_attach,
|
||||
.event = bluecard_event,
|
||||
.probe = bluecard_attach,
|
||||
.remove = bluecard_detach,
|
||||
.id_table = bluecard_ids,
|
||||
.suspend = bluecard_suspend,
|
||||
|
||||
@@ -90,11 +90,7 @@ typedef struct bt3c_info_t {
|
||||
|
||||
static void bt3c_config(dev_link_t *link);
|
||||
static void bt3c_release(dev_link_t *link);
|
||||
static int bt3c_event(event_t event, int priority, event_callback_args_t *args);
|
||||
|
||||
static dev_info_t dev_info = "bt3c_cs";
|
||||
|
||||
static dev_link_t *bt3c_attach(void);
|
||||
static void bt3c_detach(struct pcmcia_device *p_dev);
|
||||
|
||||
|
||||
@@ -661,17 +657,15 @@ static int bt3c_close(bt3c_info_t *info)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static dev_link_t *bt3c_attach(void)
|
||||
static int bt3c_attach(struct pcmcia_device *p_dev)
|
||||
{
|
||||
bt3c_info_t *info;
|
||||
client_reg_t client_reg;
|
||||
dev_link_t *link;
|
||||
int ret;
|
||||
|
||||
/* Create new info device */
|
||||
info = kzalloc(sizeof(*info), GFP_KERNEL);
|
||||
if (!info)
|
||||
return NULL;
|
||||
return -ENOMEM;
|
||||
|
||||
link = &info->link;
|
||||
link->priv = info;
|
||||
@@ -688,20 +682,13 @@ static dev_link_t *bt3c_attach(void)
|
||||
link->conf.Vcc = 50;
|
||||
link->conf.IntType = INT_MEMORY_AND_IO;
|
||||
|
||||
/* Register with Card Services */
|
||||
link->next = NULL;
|
||||
client_reg.dev_info = &dev_info;
|
||||
client_reg.Version = 0x0210;
|
||||
client_reg.event_callback_args.client_data = link;
|
||||
link->handle = p_dev;
|
||||
p_dev->instance = link;
|
||||
|
||||
ret = pcmcia_register_client(&link->handle, &client_reg);
|
||||
if (ret != CS_SUCCESS) {
|
||||
cs_error(link->handle, RegisterClient, ret);
|
||||
bt3c_detach(link->handle);
|
||||
return NULL;
|
||||
}
|
||||
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
|
||||
bt3c_config(link);
|
||||
|
||||
return link;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -892,19 +879,6 @@ static int bt3c_resume(struct pcmcia_device *dev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int bt3c_event(event_t event, int priority, event_callback_args_t *args)
|
||||
{
|
||||
dev_link_t *link = args->client_data;
|
||||
|
||||
switch (event) {
|
||||
case CS_EVENT_CARD_INSERTION:
|
||||
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
|
||||
bt3c_config(link);
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct pcmcia_device_id bt3c_ids[] = {
|
||||
PCMCIA_DEVICE_PROD_ID13("3COM", "Bluetooth PC Card", 0xefce0a31, 0xd4ce9b02),
|
||||
@@ -917,8 +891,7 @@ static struct pcmcia_driver bt3c_driver = {
|
||||
.drv = {
|
||||
.name = "bt3c_cs",
|
||||
},
|
||||
.attach = bt3c_attach,
|
||||
.event = bt3c_event,
|
||||
.probe = bt3c_attach,
|
||||
.remove = bt3c_detach,
|
||||
.id_table = bt3c_ids,
|
||||
.suspend = bt3c_suspend,
|
||||
|
||||
@@ -86,11 +86,7 @@ typedef struct btuart_info_t {
|
||||
|
||||
static void btuart_config(dev_link_t *link);
|
||||
static void btuart_release(dev_link_t *link);
|
||||
static int btuart_event(event_t event, int priority, event_callback_args_t *args);
|
||||
|
||||
static dev_info_t dev_info = "btuart_cs";
|
||||
|
||||
static dev_link_t *btuart_attach(void);
|
||||
static void btuart_detach(struct pcmcia_device *p_dev);
|
||||
|
||||
|
||||
@@ -580,17 +576,15 @@ static int btuart_close(btuart_info_t *info)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static dev_link_t *btuart_attach(void)
|
||||
static int btuart_attach(struct pcmcia_device *p_dev)
|
||||
{
|
||||
btuart_info_t *info;
|
||||
client_reg_t client_reg;
|
||||
dev_link_t *link;
|
||||
int ret;
|
||||
|
||||
/* Create new info device */
|
||||
info = kzalloc(sizeof(*info), GFP_KERNEL);
|
||||
if (!info)
|
||||
return NULL;
|
||||
return -ENOMEM;
|
||||
|
||||
link = &info->link;
|
||||
link->priv = info;
|
||||
@@ -607,20 +601,13 @@ static dev_link_t *btuart_attach(void)
|
||||
link->conf.Vcc = 50;
|
||||
link->conf.IntType = INT_MEMORY_AND_IO;
|
||||
|
||||
/* Register with Card Services */
|
||||
link->next = NULL;
|
||||
client_reg.dev_info = &dev_info;
|
||||
client_reg.Version = 0x0210;
|
||||
client_reg.event_callback_args.client_data = link;
|
||||
link->handle = p_dev;
|
||||
p_dev->instance = link;
|
||||
|
||||
ret = pcmcia_register_client(&link->handle, &client_reg);
|
||||
if (ret != CS_SUCCESS) {
|
||||
cs_error(link->handle, RegisterClient, ret);
|
||||
btuart_detach(link->handle);
|
||||
return NULL;
|
||||
}
|
||||
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
|
||||
btuart_config(link);
|
||||
|
||||
return link;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -813,20 +800,6 @@ static int btuart_resume(struct pcmcia_device *dev)
|
||||
}
|
||||
|
||||
|
||||
static int btuart_event(event_t event, int priority, event_callback_args_t *args)
|
||||
{
|
||||
dev_link_t *link = args->client_data;
|
||||
|
||||
switch (event) {
|
||||
case CS_EVENT_CARD_INSERTION:
|
||||
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
|
||||
btuart_config(link);
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct pcmcia_device_id btuart_ids[] = {
|
||||
/* don't use this driver. Use serial_cs + hci_uart instead */
|
||||
PCMCIA_DEVICE_NULL
|
||||
@@ -838,8 +811,7 @@ static struct pcmcia_driver btuart_driver = {
|
||||
.drv = {
|
||||
.name = "btuart_cs",
|
||||
},
|
||||
.attach = btuart_attach,
|
||||
.event = btuart_event,
|
||||
.probe = btuart_attach,
|
||||
.remove = btuart_detach,
|
||||
.id_table = btuart_ids,
|
||||
.suspend = btuart_suspend,
|
||||
|
||||
@@ -89,11 +89,7 @@ typedef struct dtl1_info_t {
|
||||
|
||||
static void dtl1_config(dev_link_t *link);
|
||||
static void dtl1_release(dev_link_t *link);
|
||||
static int dtl1_event(event_t event, int priority, event_callback_args_t *args);
|
||||
|
||||
static dev_info_t dev_info = "dtl1_cs";
|
||||
|
||||
static dev_link_t *dtl1_attach(void);
|
||||
static void dtl1_detach(struct pcmcia_device *p_dev);
|
||||
|
||||
|
||||
@@ -559,17 +555,15 @@ static int dtl1_close(dtl1_info_t *info)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static dev_link_t *dtl1_attach(void)
|
||||
static int dtl1_attach(struct pcmcia_device *p_dev)
|
||||
{
|
||||
dtl1_info_t *info;
|
||||
client_reg_t client_reg;
|
||||
dev_link_t *link;
|
||||
int ret;
|
||||
|
||||
/* Create new info device */
|
||||
info = kzalloc(sizeof(*info), GFP_KERNEL);
|
||||
if (!info)
|
||||
return NULL;
|
||||
return -ENOMEM;
|
||||
|
||||
link = &info->link;
|
||||
link->priv = info;
|
||||
@@ -586,20 +580,13 @@ static dev_link_t *dtl1_attach(void)
|
||||
link->conf.Vcc = 50;
|
||||
link->conf.IntType = INT_MEMORY_AND_IO;
|
||||
|
||||
/* Register with Card Services */
|
||||
link->next = NULL;
|
||||
client_reg.dev_info = &dev_info;
|
||||
client_reg.Version = 0x0210;
|
||||
client_reg.event_callback_args.client_data = link;
|
||||
link->handle = p_dev;
|
||||
p_dev->instance = link;
|
||||
|
||||
ret = pcmcia_register_client(&link->handle, &client_reg);
|
||||
if (ret != CS_SUCCESS) {
|
||||
cs_error(link->handle, RegisterClient, ret);
|
||||
dtl1_detach(link->handle);
|
||||
return NULL;
|
||||
}
|
||||
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
|
||||
dtl1_config(link);
|
||||
|
||||
return link;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -764,19 +751,6 @@ static int dtl1_resume(struct pcmcia_device *dev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int dtl1_event(event_t event, int priority, event_callback_args_t *args)
|
||||
{
|
||||
dev_link_t *link = args->client_data;
|
||||
|
||||
switch (event) {
|
||||
case CS_EVENT_CARD_INSERTION:
|
||||
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
|
||||
dtl1_config(link);
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct pcmcia_device_id dtl1_ids[] = {
|
||||
PCMCIA_DEVICE_PROD_ID12("Nokia Mobile Phones", "DTL-1", 0xe1bfdd64, 0xe168480d),
|
||||
@@ -790,8 +764,7 @@ static struct pcmcia_driver dtl1_driver = {
|
||||
.drv = {
|
||||
.name = "dtl1_cs",
|
||||
},
|
||||
.attach = dtl1_attach,
|
||||
.event = dtl1_event,
|
||||
.probe = dtl1_attach,
|
||||
.remove = dtl1_detach,
|
||||
.id_table = dtl1_ids,
|
||||
.suspend = dtl1_suspend,
|
||||
|
||||
@@ -66,7 +66,6 @@ static char *version = "cm4000_cs.c v2.4.0gm5 - All bugs added by Harald Welte";
|
||||
#define T_100MSEC msecs_to_jiffies(100)
|
||||
#define T_500MSEC msecs_to_jiffies(500)
|
||||
|
||||
static void cm4000_detach(struct pcmcia_device *p_dev);
|
||||
static void cm4000_release(dev_link_t *link);
|
||||
|
||||
static int major; /* major number we get from the kernel */
|
||||
@@ -156,7 +155,6 @@ struct cm4000_dev {
|
||||
/*sbuf*/ 512*sizeof(char) - \
|
||||
/*queue*/ 4*sizeof(wait_queue_head_t))
|
||||
|
||||
static dev_info_t dev_info = MODULE_NAME;
|
||||
static dev_link_t *dev_table[CM4000_MAX_DEV];
|
||||
|
||||
/* This table doesn't use spaces after the comma between fields and thus
|
||||
@@ -1864,38 +1862,6 @@ cs_release:
|
||||
link->state &= ~DEV_CONFIG_PENDING;
|
||||
}
|
||||
|
||||
static int cm4000_event(event_t event, int priority,
|
||||
event_callback_args_t *args)
|
||||
{
|
||||
dev_link_t *link;
|
||||
struct cm4000_dev *dev;
|
||||
int devno;
|
||||
|
||||
link = args->client_data;
|
||||
dev = link->priv;
|
||||
|
||||
DEBUGP(3, dev, "-> cm4000_event\n");
|
||||
for (devno = 0; devno < CM4000_MAX_DEV; devno++)
|
||||
if (dev_table[devno] == link)
|
||||
break;
|
||||
|
||||
if (devno == CM4000_MAX_DEV)
|
||||
return CS_BAD_ADAPTER;
|
||||
|
||||
switch (event) {
|
||||
case CS_EVENT_CARD_INSERTION:
|
||||
DEBUGP(5, dev, "CS_EVENT_CARD_INSERTION\n");
|
||||
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
|
||||
cm4000_config(link, devno);
|
||||
break;
|
||||
default:
|
||||
DEBUGP(5, dev, "unknown event %.2x\n", event);
|
||||
break;
|
||||
}
|
||||
DEBUGP(3, dev, "<- cm4000_event\n");
|
||||
return CS_SUCCESS;
|
||||
}
|
||||
|
||||
static int cm4000_suspend(struct pcmcia_device *p_dev)
|
||||
{
|
||||
dev_link_t *link = dev_to_instance(p_dev);
|
||||
@@ -1935,11 +1901,10 @@ static void cm4000_release(dev_link_t *link)
|
||||
pcmcia_release_io(link->handle, &link->io);
|
||||
}
|
||||
|
||||
static dev_link_t *cm4000_attach(void)
|
||||
static int cm4000_attach(struct pcmcia_device *p_dev)
|
||||
{
|
||||
struct cm4000_dev *dev;
|
||||
dev_link_t *link;
|
||||
client_reg_t client_reg;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < CM4000_MAX_DEV; i++)
|
||||
@@ -1948,41 +1913,31 @@ static dev_link_t *cm4000_attach(void)
|
||||
|
||||
if (i == CM4000_MAX_DEV) {
|
||||
printk(KERN_NOTICE MODULE_NAME ": all devices in use\n");
|
||||
return NULL;
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
/* create a new cm4000_cs device */
|
||||
dev = kzalloc(sizeof(struct cm4000_dev), GFP_KERNEL);
|
||||
if (dev == NULL)
|
||||
return NULL;
|
||||
return -ENOMEM;
|
||||
|
||||
link = &dev->link;
|
||||
link->priv = dev;
|
||||
link->conf.IntType = INT_MEMORY_AND_IO;
|
||||
dev_table[i] = link;
|
||||
|
||||
/* register with card services */
|
||||
client_reg.dev_info = &dev_info;
|
||||
client_reg.EventMask =
|
||||
CS_EVENT_CARD_INSERTION | CS_EVENT_CARD_REMOVAL |
|
||||
CS_EVENT_RESET_PHYSICAL | CS_EVENT_CARD_RESET |
|
||||
CS_EVENT_PM_SUSPEND | CS_EVENT_PM_RESUME;
|
||||
client_reg.Version = 0x0210;
|
||||
client_reg.event_callback_args.client_data = link;
|
||||
|
||||
i = pcmcia_register_client(&link->handle, &client_reg);
|
||||
if (i) {
|
||||
cs_error(link->handle, RegisterClient, i);
|
||||
cm4000_detach(link->handle);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
init_waitqueue_head(&dev->devq);
|
||||
init_waitqueue_head(&dev->ioq);
|
||||
init_waitqueue_head(&dev->atrq);
|
||||
init_waitqueue_head(&dev->readq);
|
||||
|
||||
return link;
|
||||
link->handle = p_dev;
|
||||
p_dev->instance = link;
|
||||
|
||||
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
|
||||
cm4000_config(link, i);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void cm4000_detach(struct pcmcia_device *p_dev)
|
||||
@@ -2031,11 +1986,10 @@ static struct pcmcia_driver cm4000_driver = {
|
||||
.drv = {
|
||||
.name = "cm4000_cs",
|
||||
},
|
||||
.attach = cm4000_attach,
|
||||
.probe = cm4000_attach,
|
||||
.remove = cm4000_detach,
|
||||
.suspend = cm4000_suspend,
|
||||
.resume = cm4000_resume,
|
||||
.event = cm4000_event,
|
||||
.id_table = cm4000_ids,
|
||||
};
|
||||
|
||||
|
||||
@@ -65,7 +65,6 @@ static char *version =
|
||||
#define POLL_PERIOD msecs_to_jiffies(10)
|
||||
|
||||
static void reader_release(dev_link_t *link);
|
||||
static void reader_detach(struct pcmcia_device *p_dev);
|
||||
|
||||
static int major;
|
||||
|
||||
@@ -86,7 +85,6 @@ struct reader_dev {
|
||||
struct timer_list poll_timer;
|
||||
};
|
||||
|
||||
static dev_info_t dev_info = MODULE_NAME;
|
||||
static dev_link_t *dev_table[CM_MAX_DEV];
|
||||
|
||||
#ifndef PCMCIA_DEBUG
|
||||
@@ -629,39 +627,6 @@ cs_release:
|
||||
link->state &= ~DEV_CONFIG_PENDING;
|
||||
}
|
||||
|
||||
static int reader_event(event_t event, int priority,
|
||||
event_callback_args_t *args)
|
||||
{
|
||||
dev_link_t *link;
|
||||
struct reader_dev *dev;
|
||||
int devno;
|
||||
|
||||
link = args->client_data;
|
||||
dev = link->priv;
|
||||
DEBUGP(3, dev, "-> reader_event\n");
|
||||
for (devno = 0; devno < CM_MAX_DEV; devno++) {
|
||||
if (dev_table[devno] == link)
|
||||
break;
|
||||
}
|
||||
if (devno == CM_MAX_DEV)
|
||||
return CS_BAD_ADAPTER;
|
||||
|
||||
switch (event) {
|
||||
case CS_EVENT_CARD_INSERTION:
|
||||
DEBUGP(5, dev, "CS_EVENT_CARD_INSERTION\n");
|
||||
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
|
||||
reader_config(link, devno);
|
||||
break;
|
||||
|
||||
default:
|
||||
DEBUGP(5, dev, "reader_event: unknown event %.2x\n",
|
||||
event);
|
||||
break;
|
||||
}
|
||||
DEBUGP(3, dev, "<- reader_event\n");
|
||||
return CS_SUCCESS;
|
||||
}
|
||||
|
||||
static int reader_suspend(struct pcmcia_device *p_dev)
|
||||
{
|
||||
dev_link_t *link = dev_to_instance(p_dev);
|
||||
@@ -691,11 +656,10 @@ static void reader_release(dev_link_t *link)
|
||||
pcmcia_release_io(link->handle, &link->io);
|
||||
}
|
||||
|
||||
static dev_link_t *reader_attach(void)
|
||||
static int reader_attach(struct pcmcia_device *p_dev)
|
||||
{
|
||||
struct reader_dev *dev;
|
||||
dev_link_t *link;
|
||||
client_reg_t client_reg;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < CM_MAX_DEV; i++) {
|
||||
@@ -704,11 +668,11 @@ static dev_link_t *reader_attach(void)
|
||||
}
|
||||
|
||||
if (i == CM_MAX_DEV)
|
||||
return NULL;
|
||||
return -ENODEV;
|
||||
|
||||
dev = kzalloc(sizeof(struct reader_dev), GFP_KERNEL);
|
||||
if (dev == NULL)
|
||||
return NULL;
|
||||
return -ENOMEM;
|
||||
|
||||
dev->timeout = CCID_DRIVER_MINIMUM_TIMEOUT;
|
||||
dev->buffer_status = 0;
|
||||
@@ -719,20 +683,6 @@ static dev_link_t *reader_attach(void)
|
||||
link->conf.IntType = INT_MEMORY_AND_IO;
|
||||
dev_table[i] = link;
|
||||
|
||||
client_reg.dev_info = &dev_info;
|
||||
client_reg.Attributes = INFO_IO_CLIENT | INFO_CARD_SHARE;
|
||||
client_reg.EventMask=
|
||||
CS_EVENT_CARD_INSERTION | CS_EVENT_CARD_REMOVAL |
|
||||
CS_EVENT_RESET_PHYSICAL | CS_EVENT_CARD_RESET |
|
||||
CS_EVENT_PM_SUSPEND | CS_EVENT_PM_RESUME;
|
||||
client_reg.Version = 0x0210;
|
||||
client_reg.event_callback_args.client_data = link;
|
||||
i = pcmcia_register_client(&link->handle, &client_reg);
|
||||
if (i) {
|
||||
cs_error(link->handle, RegisterClient, i);
|
||||
reader_detach(link->handle);
|
||||
return NULL;
|
||||
}
|
||||
init_waitqueue_head(&dev->devq);
|
||||
init_waitqueue_head(&dev->poll_wait);
|
||||
init_waitqueue_head(&dev->read_wait);
|
||||
@@ -740,7 +690,13 @@ static dev_link_t *reader_attach(void)
|
||||
init_timer(&dev->poll_timer);
|
||||
dev->poll_timer.function = &cm4040_do_poll;
|
||||
|
||||
return link;
|
||||
link->handle = p_dev;
|
||||
p_dev->instance = link;
|
||||
|
||||
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
|
||||
reader_config(link, i);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void reader_detach(struct pcmcia_device *p_dev)
|
||||
@@ -790,11 +746,10 @@ static struct pcmcia_driver reader_driver = {
|
||||
.drv = {
|
||||
.name = "cm4040_cs",
|
||||
},
|
||||
.attach = reader_attach,
|
||||
.probe = reader_attach,
|
||||
.remove = reader_detach,
|
||||
.suspend = reader_suspend,
|
||||
.resume = reader_resume,
|
||||
.event = reader_event,
|
||||
.id_table = cm4040_ids,
|
||||
};
|
||||
|
||||
|
||||
@@ -486,13 +486,8 @@ static void mgslpc_wait_until_sent(struct tty_struct *tty, int timeout);
|
||||
|
||||
static void mgslpc_config(dev_link_t *link);
|
||||
static void mgslpc_release(u_long arg);
|
||||
static int mgslpc_event(event_t event, int priority,
|
||||
event_callback_args_t *args);
|
||||
static dev_link_t *mgslpc_attach(void);
|
||||
static void mgslpc_detach(struct pcmcia_device *p_dev);
|
||||
|
||||
static dev_info_t dev_info = "synclink_cs";
|
||||
|
||||
/*
|
||||
* 1st function defined in .text section. Calling this function in
|
||||
* init_module() followed by a breakpoint allows a remote debugger
|
||||
@@ -538,12 +533,10 @@ static void ldisc_receive_buf(struct tty_struct *tty,
|
||||
}
|
||||
}
|
||||
|
||||
static dev_link_t *mgslpc_attach(void)
|
||||
static int mgslpc_attach(struct pcmcia_device *p_dev)
|
||||
{
|
||||
MGSLPC_INFO *info;
|
||||
dev_link_t *link;
|
||||
client_reg_t client_reg;
|
||||
int ret;
|
||||
|
||||
if (debug_level >= DEBUG_LEVEL_INFO)
|
||||
printk("mgslpc_attach\n");
|
||||
@@ -551,7 +544,7 @@ static dev_link_t *mgslpc_attach(void)
|
||||
info = (MGSLPC_INFO *)kmalloc(sizeof(MGSLPC_INFO), GFP_KERNEL);
|
||||
if (!info) {
|
||||
printk("Error can't allocate device instance data\n");
|
||||
return NULL;
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
memset(info, 0, sizeof(MGSLPC_INFO));
|
||||
@@ -586,23 +579,15 @@ static dev_link_t *mgslpc_attach(void)
|
||||
link->conf.Vcc = 50;
|
||||
link->conf.IntType = INT_MEMORY_AND_IO;
|
||||
|
||||
/* Register with Card Services */
|
||||
link->next = NULL;
|
||||
link->handle = p_dev;
|
||||
p_dev->instance = link;
|
||||
|
||||
client_reg.dev_info = &dev_info;
|
||||
client_reg.Version = 0x0210;
|
||||
client_reg.event_callback_args.client_data = link;
|
||||
|
||||
ret = pcmcia_register_client(&link->handle, &client_reg);
|
||||
if (ret != CS_SUCCESS) {
|
||||
cs_error(link->handle, RegisterClient, ret);
|
||||
mgslpc_detach(link->handle);
|
||||
return NULL;
|
||||
}
|
||||
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
|
||||
mgslpc_config(link);
|
||||
|
||||
mgslpc_add_device(info);
|
||||
|
||||
return link;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Card has been inserted.
|
||||
@@ -778,23 +763,6 @@ static int mgslpc_resume(struct pcmcia_device *dev)
|
||||
}
|
||||
|
||||
|
||||
static int mgslpc_event(event_t event, int priority,
|
||||
event_callback_args_t *args)
|
||||
{
|
||||
dev_link_t *link = args->client_data;
|
||||
|
||||
if (debug_level >= DEBUG_LEVEL_INFO)
|
||||
printk("mgslpc_event(0x%06x)\n", event);
|
||||
|
||||
switch (event) {
|
||||
case CS_EVENT_CARD_INSERTION:
|
||||
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
|
||||
mgslpc_config(link);
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int mgslpc_paranoia_check(MGSLPC_INFO *info,
|
||||
char *name, const char *routine)
|
||||
{
|
||||
@@ -3071,8 +3039,7 @@ static struct pcmcia_driver mgslpc_driver = {
|
||||
.drv = {
|
||||
.name = "synclink_cs",
|
||||
},
|
||||
.attach = mgslpc_attach,
|
||||
.event = mgslpc_event,
|
||||
.probe = mgslpc_attach,
|
||||
.remove = mgslpc_detach,
|
||||
.id_table = mgslpc_ids,
|
||||
.suspend = mgslpc_suspend,
|
||||
|
||||
+14
-42
@@ -88,12 +88,8 @@ typedef struct ide_info_t {
|
||||
} ide_info_t;
|
||||
|
||||
static void ide_release(dev_link_t *);
|
||||
static int ide_event(event_t event, int priority,
|
||||
event_callback_args_t *args);
|
||||
static void ide_config(dev_link_t *);
|
||||
|
||||
static dev_info_t dev_info = "ide-cs";
|
||||
|
||||
static dev_link_t *ide_attach(void);
|
||||
static void ide_detach(struct pcmcia_device *p_dev);
|
||||
|
||||
|
||||
@@ -107,18 +103,17 @@ static void ide_detach(struct pcmcia_device *p_dev);
|
||||
|
||||
======================================================================*/
|
||||
|
||||
static dev_link_t *ide_attach(void)
|
||||
static int ide_attach(struct pcmcia_device *p_dev)
|
||||
{
|
||||
ide_info_t *info;
|
||||
dev_link_t *link;
|
||||
client_reg_t client_reg;
|
||||
int ret;
|
||||
|
||||
|
||||
DEBUG(0, "ide_attach()\n");
|
||||
|
||||
/* Create new ide device */
|
||||
info = kzalloc(sizeof(*info), GFP_KERNEL);
|
||||
if (!info) return NULL;
|
||||
if (!info)
|
||||
return -ENOMEM;
|
||||
link = &info->link; link->priv = info;
|
||||
|
||||
link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO;
|
||||
@@ -129,20 +124,14 @@ static dev_link_t *ide_attach(void)
|
||||
link->conf.Attributes = CONF_ENABLE_IRQ;
|
||||
link->conf.Vcc = 50;
|
||||
link->conf.IntType = INT_MEMORY_AND_IO;
|
||||
|
||||
/* Register with Card Services */
|
||||
link->next = NULL;
|
||||
client_reg.dev_info = &dev_info;
|
||||
client_reg.Version = 0x0210;
|
||||
client_reg.event_callback_args.client_data = link;
|
||||
ret = pcmcia_register_client(&link->handle, &client_reg);
|
||||
if (ret != CS_SUCCESS) {
|
||||
cs_error(link->handle, RegisterClient, ret);
|
||||
ide_detach(link->handle);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return link;
|
||||
|
||||
link->handle = p_dev;
|
||||
p_dev->instance = link;
|
||||
|
||||
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
|
||||
ide_config(link);
|
||||
|
||||
return 0;
|
||||
} /* ide_attach */
|
||||
|
||||
/*======================================================================
|
||||
@@ -421,22 +410,6 @@ static int ide_resume(struct pcmcia_device *dev)
|
||||
|
||||
======================================================================*/
|
||||
|
||||
int ide_event(event_t event, int priority,
|
||||
event_callback_args_t *args)
|
||||
{
|
||||
dev_link_t *link = args->client_data;
|
||||
|
||||
DEBUG(1, "ide_event(0x%06x)\n", event);
|
||||
|
||||
switch (event) {
|
||||
case CS_EVENT_CARD_INSERTION:
|
||||
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
|
||||
ide_config(link);
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
} /* ide_event */
|
||||
|
||||
static struct pcmcia_device_id ide_ids[] = {
|
||||
PCMCIA_DEVICE_FUNC_ID(4),
|
||||
PCMCIA_DEVICE_MANF_CARD(0x0032, 0x0704),
|
||||
@@ -481,8 +454,7 @@ static struct pcmcia_driver ide_cs_driver = {
|
||||
.drv = {
|
||||
.name = "ide-cs",
|
||||
},
|
||||
.attach = ide_attach,
|
||||
.event = ide_event,
|
||||
.probe = ide_attach,
|
||||
.remove = ide_detach,
|
||||
.id_table = ide_ids,
|
||||
.suspend = ide_suspend,
|
||||
|
||||
@@ -53,8 +53,6 @@ MODULE_LICENSE("GPL");
|
||||
|
||||
static void avmcs_config(dev_link_t *link);
|
||||
static void avmcs_release(dev_link_t *link);
|
||||
static int avmcs_event(event_t event, int priority,
|
||||
event_callback_args_t *args);
|
||||
|
||||
/*
|
||||
The attach() and detach() entry points are used to create and destroy
|
||||
@@ -62,17 +60,8 @@ static int avmcs_event(event_t event, int priority,
|
||||
needed to manage one actual PCMCIA card.
|
||||
*/
|
||||
|
||||
static dev_link_t *avmcs_attach(void);
|
||||
static void avmcs_detach(struct pcmcia_device *p_dev);
|
||||
|
||||
/*
|
||||
The dev_info variable is the "key" that is used to match up this
|
||||
device driver with appropriate cards, through the card configuration
|
||||
database.
|
||||
*/
|
||||
|
||||
static dev_info_t dev_info = "avm_cs";
|
||||
|
||||
/*
|
||||
A linked list of "instances" of the skeleton device. Each actual
|
||||
PCMCIA card corresponds to one device instance, and is described
|
||||
@@ -110,13 +99,11 @@ typedef struct local_info_t {
|
||||
|
||||
======================================================================*/
|
||||
|
||||
static dev_link_t *avmcs_attach(void)
|
||||
static int avmcs_attach(struct pcmcia_device *p_dev)
|
||||
{
|
||||
client_reg_t client_reg;
|
||||
dev_link_t *link;
|
||||
local_info_t *local;
|
||||
int ret;
|
||||
|
||||
|
||||
/* Initialize the dev_link_t structure */
|
||||
link = kmalloc(sizeof(struct dev_link_t), GFP_KERNEL);
|
||||
if (!link)
|
||||
@@ -147,24 +134,19 @@ static dev_link_t *avmcs_attach(void)
|
||||
goto err_kfree;
|
||||
memset(local, 0, sizeof(local_info_t));
|
||||
link->priv = local;
|
||||
|
||||
/* Register with Card Services */
|
||||
link->next = NULL;
|
||||
client_reg.dev_info = &dev_info;
|
||||
client_reg.Version = 0x0210;
|
||||
client_reg.event_callback_args.client_data = link;
|
||||
ret = pcmcia_register_client(&link->handle, &client_reg);
|
||||
if (ret != 0) {
|
||||
cs_error(link->handle, RegisterClient, ret);
|
||||
avmcs_detach(link->handle);
|
||||
goto err;
|
||||
}
|
||||
return link;
|
||||
|
||||
link->handle = p_dev;
|
||||
p_dev->instance = link;
|
||||
|
||||
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
|
||||
avmcs_config(link);
|
||||
|
||||
return 0;
|
||||
|
||||
err_kfree:
|
||||
kfree(link);
|
||||
err:
|
||||
return NULL;
|
||||
return -EINVAL;
|
||||
} /* avmcs_attach */
|
||||
|
||||
/*======================================================================
|
||||
@@ -433,19 +415,6 @@ static int avmcs_resume(struct pcmcia_device *dev)
|
||||
|
||||
======================================================================*/
|
||||
|
||||
static int avmcs_event(event_t event, int priority,
|
||||
event_callback_args_t *args)
|
||||
{
|
||||
dev_link_t *link = args->client_data;
|
||||
|
||||
switch (event) {
|
||||
case CS_EVENT_CARD_INSERTION:
|
||||
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
|
||||
avmcs_config(link);
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
} /* avmcs_event */
|
||||
|
||||
static struct pcmcia_device_id avmcs_ids[] = {
|
||||
PCMCIA_DEVICE_PROD_ID12("AVM", "ISDN-Controller B1", 0x95d42008, 0x845dc335),
|
||||
@@ -460,8 +429,7 @@ static struct pcmcia_driver avmcs_driver = {
|
||||
.drv = {
|
||||
.name = "avm_cs",
|
||||
},
|
||||
.attach = avmcs_attach,
|
||||
.event = avmcs_event,
|
||||
.probe = avmcs_attach,
|
||||
.remove = avmcs_detach,
|
||||
.id_table = avmcs_ids,
|
||||
.suspend= avmcs_suspend,
|
||||
|
||||
@@ -69,8 +69,6 @@ module_param(isdnprot, int, 0);
|
||||
|
||||
static void avma1cs_config(dev_link_t *link);
|
||||
static void avma1cs_release(dev_link_t *link);
|
||||
static int avma1cs_event(event_t event, int priority,
|
||||
event_callback_args_t *args);
|
||||
|
||||
/*
|
||||
The attach() and detach() entry points are used to create and destroy
|
||||
@@ -78,16 +76,8 @@ static int avma1cs_event(event_t event, int priority,
|
||||
needed to manage one actual PCMCIA card.
|
||||
*/
|
||||
|
||||
static dev_link_t *avma1cs_attach(void);
|
||||
static void avma1cs_detach(struct pcmcia_device *p_dev);
|
||||
|
||||
/*
|
||||
The dev_info variable is the "key" that is used to match up this
|
||||
device driver with appropriate cards, through the card configuration
|
||||
database.
|
||||
*/
|
||||
|
||||
static dev_info_t dev_info = "avma1_cs";
|
||||
|
||||
/*
|
||||
A linked list of "instances" of the skeleton device. Each actual
|
||||
@@ -126,26 +116,24 @@ typedef struct local_info_t {
|
||||
|
||||
======================================================================*/
|
||||
|
||||
static dev_link_t *avma1cs_attach(void)
|
||||
static int avma1cs_attach(struct pcmcia_device *p_dev)
|
||||
{
|
||||
client_reg_t client_reg;
|
||||
dev_link_t *link;
|
||||
local_info_t *local;
|
||||
int ret;
|
||||
|
||||
|
||||
DEBUG(0, "avma1cs_attach()\n");
|
||||
|
||||
/* Initialize the dev_link_t structure */
|
||||
link = kmalloc(sizeof(struct dev_link_t), GFP_KERNEL);
|
||||
if (!link)
|
||||
return NULL;
|
||||
return -ENOMEM;
|
||||
memset(link, 0, sizeof(struct dev_link_t));
|
||||
|
||||
/* Allocate space for private device-specific data */
|
||||
local = kmalloc(sizeof(local_info_t), GFP_KERNEL);
|
||||
if (!local) {
|
||||
kfree(link);
|
||||
return NULL;
|
||||
return -ENOMEM;
|
||||
}
|
||||
memset(local, 0, sizeof(local_info_t));
|
||||
link->priv = local;
|
||||
@@ -170,19 +158,13 @@ static dev_link_t *avma1cs_attach(void)
|
||||
link->conf.ConfigIndex = 1;
|
||||
link->conf.Present = PRESENT_OPTION;
|
||||
|
||||
/* Register with Card Services */
|
||||
link->next = NULL;
|
||||
client_reg.dev_info = &dev_info;
|
||||
client_reg.Version = 0x0210;
|
||||
client_reg.event_callback_args.client_data = link;
|
||||
ret = pcmcia_register_client(&link->handle, &client_reg);
|
||||
if (ret != 0) {
|
||||
cs_error(link->handle, RegisterClient, ret);
|
||||
avma1cs_detach(link->handle);
|
||||
return NULL;
|
||||
}
|
||||
link->handle = p_dev;
|
||||
p_dev->instance = link;
|
||||
|
||||
return link;
|
||||
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
|
||||
avma1cs_config(link);
|
||||
|
||||
return 0;
|
||||
} /* avma1cs_attach */
|
||||
|
||||
/*======================================================================
|
||||
@@ -430,35 +412,6 @@ static int avma1cs_resume(struct pcmcia_device *dev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*======================================================================
|
||||
|
||||
The card status event handler. Mostly, this schedules other
|
||||
stuff to run after an event is received. A CARD_REMOVAL event
|
||||
also sets some flags to discourage the net drivers from trying
|
||||
to talk to the card any more.
|
||||
|
||||
When a CARD_REMOVAL event is received, we immediately set a flag
|
||||
to block future accesses to this device. All the functions that
|
||||
actually access the device should check this flag to make sure
|
||||
the card is still present.
|
||||
|
||||
======================================================================*/
|
||||
|
||||
static int avma1cs_event(event_t event, int priority,
|
||||
event_callback_args_t *args)
|
||||
{
|
||||
dev_link_t *link = args->client_data;
|
||||
|
||||
DEBUG(1, "avma1cs_event(0x%06x)\n", event);
|
||||
|
||||
switch (event) {
|
||||
case CS_EVENT_CARD_INSERTION:
|
||||
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
|
||||
avma1cs_config(link);
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
} /* avma1cs_event */
|
||||
|
||||
static struct pcmcia_device_id avma1cs_ids[] = {
|
||||
PCMCIA_DEVICE_PROD_ID12("AVM", "ISDN A", 0x95d42008, 0xadc9d4bb),
|
||||
@@ -472,8 +425,7 @@ static struct pcmcia_driver avma1cs_driver = {
|
||||
.drv = {
|
||||
.name = "avma1_cs",
|
||||
},
|
||||
.attach = avma1cs_attach,
|
||||
.event = avma1cs_event,
|
||||
.probe = avma1cs_attach,
|
||||
.remove = avma1cs_detach,
|
||||
.id_table = avma1cs_ids,
|
||||
.suspend = avma1cs_suspend,
|
||||
|
||||
@@ -96,8 +96,6 @@ module_param(protocol, int, 0);
|
||||
|
||||
static void elsa_cs_config(dev_link_t *link);
|
||||
static void elsa_cs_release(dev_link_t *link);
|
||||
static int elsa_cs_event(event_t event, int priority,
|
||||
event_callback_args_t *args);
|
||||
|
||||
/*
|
||||
The attach() and detach() entry points are used to create and destroy
|
||||
@@ -105,27 +103,8 @@ static int elsa_cs_event(event_t event, int priority,
|
||||
needed to manage one actual PCMCIA card.
|
||||
*/
|
||||
|
||||
static dev_link_t *elsa_cs_attach(void);
|
||||
static void elsa_cs_detach(struct pcmcia_device *p_dev);
|
||||
|
||||
/*
|
||||
The dev_info variable is the "key" that is used to match up this
|
||||
device driver with appropriate cards, through the card configuration
|
||||
database.
|
||||
*/
|
||||
|
||||
static dev_info_t dev_info = "elsa_cs";
|
||||
|
||||
/*
|
||||
A linked list of "instances" of the elsa_cs device. Each actual
|
||||
PCMCIA card corresponds to one device instance, and is described
|
||||
by one dev_link_t structure (defined in ds.h).
|
||||
|
||||
You may not want to use a linked list for this -- for example, the
|
||||
memory card driver uses an array of dev_link_t pointers, where minor
|
||||
device numbers are used to derive the corresponding array index.
|
||||
*/
|
||||
|
||||
/*
|
||||
A driver needs to provide a dev_node_t structure for each device
|
||||
on a card. In some cases, there is only one device per card (for
|
||||
@@ -160,18 +139,16 @@ typedef struct local_info_t {
|
||||
|
||||
======================================================================*/
|
||||
|
||||
static dev_link_t *elsa_cs_attach(void)
|
||||
static int elsa_cs_attach(struct pcmcia_device *p_dev)
|
||||
{
|
||||
client_reg_t client_reg;
|
||||
dev_link_t *link;
|
||||
local_info_t *local;
|
||||
int ret;
|
||||
|
||||
DEBUG(0, "elsa_cs_attach()\n");
|
||||
|
||||
/* Allocate space for private device-specific data */
|
||||
local = kmalloc(sizeof(local_info_t), GFP_KERNEL);
|
||||
if (!local) return NULL;
|
||||
if (!local) return -ENOMEM;
|
||||
memset(local, 0, sizeof(local_info_t));
|
||||
local->cardnr = -1;
|
||||
link = &local->link; link->priv = local;
|
||||
@@ -196,19 +173,13 @@ static dev_link_t *elsa_cs_attach(void)
|
||||
link->conf.Vcc = 50;
|
||||
link->conf.IntType = INT_MEMORY_AND_IO;
|
||||
|
||||
/* Register with Card Services */
|
||||
link->next = NULL;
|
||||
client_reg.dev_info = &dev_info;
|
||||
client_reg.Version = 0x0210;
|
||||
client_reg.event_callback_args.client_data = link;
|
||||
ret = pcmcia_register_client(&link->handle, &client_reg);
|
||||
if (ret != CS_SUCCESS) {
|
||||
cs_error(link->handle, RegisterClient, ret);
|
||||
elsa_cs_detach(link->handle);
|
||||
return NULL;
|
||||
}
|
||||
link->handle = p_dev;
|
||||
p_dev->instance = link;
|
||||
|
||||
return link;
|
||||
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
|
||||
elsa_cs_config(link);
|
||||
|
||||
return 0;
|
||||
} /* elsa_cs_attach */
|
||||
|
||||
/*======================================================================
|
||||
@@ -447,36 +418,6 @@ static int elsa_resume(struct pcmcia_device *p_dev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*======================================================================
|
||||
|
||||
The card status event handler. Mostly, this schedules other
|
||||
stuff to run after an event is received. A CARD_REMOVAL event
|
||||
also sets some flags to discourage the net drivers from trying
|
||||
to talk to the card any more.
|
||||
|
||||
When a CARD_REMOVAL event is received, we immediately set a flag
|
||||
to block future accesses to this device. All the functions that
|
||||
actually access the device should check this flag to make sure
|
||||
the card is still present.
|
||||
|
||||
======================================================================*/
|
||||
|
||||
static int elsa_cs_event(event_t event, int priority,
|
||||
event_callback_args_t *args)
|
||||
{
|
||||
dev_link_t *link = args->client_data;
|
||||
|
||||
DEBUG(1, "elsa_cs_event(%d)\n", event);
|
||||
|
||||
switch (event) {
|
||||
case CS_EVENT_CARD_INSERTION:
|
||||
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
|
||||
elsa_cs_config(link);
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
} /* elsa_cs_event */
|
||||
|
||||
static struct pcmcia_device_id elsa_ids[] = {
|
||||
PCMCIA_DEVICE_PROD_ID12("ELSA AG (Aachen, Germany)", "MicroLink ISDN/MC ", 0x983de2c4, 0x333ba257),
|
||||
PCMCIA_DEVICE_PROD_ID12("ELSA GmbH, Aachen", "MicroLink ISDN/MC ", 0x639e5718, 0x333ba257),
|
||||
@@ -489,8 +430,7 @@ static struct pcmcia_driver elsa_cs_driver = {
|
||||
.drv = {
|
||||
.name = "elsa_cs",
|
||||
},
|
||||
.attach = elsa_cs_attach,
|
||||
.event = elsa_cs_event,
|
||||
.probe = elsa_cs_attach,
|
||||
.remove = elsa_cs_detach,
|
||||
.id_table = elsa_ids,
|
||||
.suspend = elsa_suspend,
|
||||
|
||||
@@ -97,8 +97,6 @@ module_param(protocol, int, 0);
|
||||
|
||||
static void sedlbauer_config(dev_link_t *link);
|
||||
static void sedlbauer_release(dev_link_t *link);
|
||||
static int sedlbauer_event(event_t event, int priority,
|
||||
event_callback_args_t *args);
|
||||
|
||||
/*
|
||||
The attach() and detach() entry points are used to create and destroy
|
||||
@@ -106,7 +104,6 @@ static int sedlbauer_event(event_t event, int priority,
|
||||
needed to manage one actual PCMCIA card.
|
||||
*/
|
||||
|
||||
static dev_link_t *sedlbauer_attach(void);
|
||||
static void sedlbauer_detach(struct pcmcia_device *p_dev);
|
||||
|
||||
/*
|
||||
@@ -116,24 +113,6 @@ static void sedlbauer_detach(struct pcmcia_device *p_dev);
|
||||
less on other parts of the kernel.
|
||||
*/
|
||||
|
||||
/*
|
||||
The dev_info variable is the "key" that is used to match up this
|
||||
device driver with appropriate cards, through the card configuration
|
||||
database.
|
||||
*/
|
||||
|
||||
static dev_info_t dev_info = "sedlbauer_cs";
|
||||
|
||||
/*
|
||||
A linked list of "instances" of the sedlbauer device. Each actual
|
||||
PCMCIA card corresponds to one device instance, and is described
|
||||
by one dev_link_t structure (defined in ds.h).
|
||||
|
||||
You may not want to use a linked list for this -- for example, the
|
||||
memory card driver uses an array of dev_link_t pointers, where minor
|
||||
device numbers are used to derive the corresponding array index.
|
||||
*/
|
||||
|
||||
/*
|
||||
A driver needs to provide a dev_node_t structure for each device
|
||||
on a card. In some cases, there is only one device per card (for
|
||||
@@ -169,18 +148,16 @@ typedef struct local_info_t {
|
||||
|
||||
======================================================================*/
|
||||
|
||||
static dev_link_t *sedlbauer_attach(void)
|
||||
static int sedlbauer_attach(struct pcmcia_device *p_dev)
|
||||
{
|
||||
local_info_t *local;
|
||||
dev_link_t *link;
|
||||
client_reg_t client_reg;
|
||||
int ret;
|
||||
|
||||
DEBUG(0, "sedlbauer_attach()\n");
|
||||
|
||||
/* Allocate space for private device-specific data */
|
||||
local = kmalloc(sizeof(local_info_t), GFP_KERNEL);
|
||||
if (!local) return NULL;
|
||||
if (!local) return -ENOMEM;
|
||||
memset(local, 0, sizeof(local_info_t));
|
||||
local->cardnr = -1;
|
||||
link = &local->link; link->priv = local;
|
||||
@@ -210,19 +187,13 @@ static dev_link_t *sedlbauer_attach(void)
|
||||
link->conf.Vcc = 50;
|
||||
link->conf.IntType = INT_MEMORY_AND_IO;
|
||||
|
||||
/* Register with Card Services */
|
||||
link->next = NULL;
|
||||
client_reg.dev_info = &dev_info;
|
||||
client_reg.Version = 0x0210;
|
||||
client_reg.event_callback_args.client_data = link;
|
||||
ret = pcmcia_register_client(&link->handle, &client_reg);
|
||||
if (ret != CS_SUCCESS) {
|
||||
cs_error(link->handle, RegisterClient, ret);
|
||||
sedlbauer_detach(link->handle);
|
||||
return NULL;
|
||||
}
|
||||
link->handle = p_dev;
|
||||
p_dev->instance = link;
|
||||
|
||||
return link;
|
||||
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
|
||||
sedlbauer_config(link);
|
||||
|
||||
return 0;
|
||||
} /* sedlbauer_attach */
|
||||
|
||||
/*======================================================================
|
||||
@@ -541,33 +512,6 @@ static int sedlbauer_resume(struct pcmcia_device *p_dev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*======================================================================
|
||||
|
||||
The card status event handler. Mostly, this schedules other
|
||||
stuff to run after an event is received.
|
||||
|
||||
When a CARD_REMOVAL event is received, we immediately set a
|
||||
private flag to block future accesses to this device. All the
|
||||
functions that actually access the device should check this flag
|
||||
to make sure the card is still present.
|
||||
|
||||
======================================================================*/
|
||||
|
||||
static int sedlbauer_event(event_t event, int priority,
|
||||
event_callback_args_t *args)
|
||||
{
|
||||
dev_link_t *link = args->client_data;
|
||||
|
||||
DEBUG(1, "sedlbauer_event(0x%06x)\n", event);
|
||||
|
||||
switch (event) {
|
||||
case CS_EVENT_CARD_INSERTION:
|
||||
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
|
||||
sedlbauer_config(link);
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
} /* sedlbauer_event */
|
||||
|
||||
static struct pcmcia_device_id sedlbauer_ids[] = {
|
||||
PCMCIA_DEVICE_PROD_ID123("SEDLBAUER", "speed star II", "V 3.1", 0x81fb79f5, 0xf3612e1d, 0x6b95c78a),
|
||||
@@ -586,8 +530,7 @@ static struct pcmcia_driver sedlbauer_driver = {
|
||||
.drv = {
|
||||
.name = "sedlbauer_cs",
|
||||
},
|
||||
.attach = sedlbauer_attach,
|
||||
.event = sedlbauer_event,
|
||||
.probe = sedlbauer_attach,
|
||||
.remove = sedlbauer_detach,
|
||||
.id_table = sedlbauer_ids,
|
||||
.suspend = sedlbauer_suspend,
|
||||
|
||||
@@ -77,8 +77,6 @@ module_param(protocol, int, 0);
|
||||
|
||||
static void teles_cs_config(dev_link_t *link);
|
||||
static void teles_cs_release(dev_link_t *link);
|
||||
static int teles_cs_event(event_t event, int priority,
|
||||
event_callback_args_t *args);
|
||||
|
||||
/*
|
||||
The attach() and detach() entry points are used to create and destroy
|
||||
@@ -86,17 +84,8 @@ static int teles_cs_event(event_t event, int priority,
|
||||
needed to manage one actual PCMCIA card.
|
||||
*/
|
||||
|
||||
static dev_link_t *teles_attach(void);
|
||||
static void teles_detach(struct pcmcia_device *p_dev);
|
||||
|
||||
/*
|
||||
The dev_info variable is the "key" that is used to match up this
|
||||
device driver with appropriate cards, through the card configuration
|
||||
database.
|
||||
*/
|
||||
|
||||
static dev_info_t dev_info = "teles_cs";
|
||||
|
||||
/*
|
||||
A linked list of "instances" of the teles_cs device. Each actual
|
||||
PCMCIA card corresponds to one device instance, and is described
|
||||
@@ -141,18 +130,16 @@ typedef struct local_info_t {
|
||||
|
||||
======================================================================*/
|
||||
|
||||
static dev_link_t *teles_attach(void)
|
||||
static int teles_attach(struct pcmcia_device *p_dev)
|
||||
{
|
||||
client_reg_t client_reg;
|
||||
dev_link_t *link;
|
||||
local_info_t *local;
|
||||
int ret;
|
||||
|
||||
DEBUG(0, "teles_attach()\n");
|
||||
|
||||
/* Allocate space for private device-specific data */
|
||||
local = kmalloc(sizeof(local_info_t), GFP_KERNEL);
|
||||
if (!local) return NULL;
|
||||
if (!local) return -ENOMEM;
|
||||
memset(local, 0, sizeof(local_info_t));
|
||||
local->cardnr = -1;
|
||||
link = &local->link; link->priv = local;
|
||||
@@ -177,19 +164,13 @@ static dev_link_t *teles_attach(void)
|
||||
link->conf.Vcc = 50;
|
||||
link->conf.IntType = INT_MEMORY_AND_IO;
|
||||
|
||||
/* Register with Card Services */
|
||||
link->next = NULL;
|
||||
client_reg.dev_info = &dev_info;
|
||||
client_reg.Version = 0x0210;
|
||||
client_reg.event_callback_args.client_data = link;
|
||||
ret = pcmcia_register_client(&link->handle, &client_reg);
|
||||
if (ret != CS_SUCCESS) {
|
||||
cs_error(link->handle, RegisterClient, ret);
|
||||
teles_detach(link->handle);
|
||||
return NULL;
|
||||
}
|
||||
link->handle = p_dev;
|
||||
p_dev->instance = link;
|
||||
|
||||
return link;
|
||||
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
|
||||
teles_cs_config(link);
|
||||
|
||||
return 0;
|
||||
} /* teles_attach */
|
||||
|
||||
/*======================================================================
|
||||
@@ -428,35 +409,6 @@ static int teles_resume(struct pcmcia_device *p_dev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*======================================================================
|
||||
|
||||
The card status event handler. Mostly, this schedules other
|
||||
stuff to run after an event is received. A CARD_REMOVAL event
|
||||
also sets some flags to discourage the net drivers from trying
|
||||
to talk to the card any more.
|
||||
|
||||
When a CARD_REMOVAL event is received, we immediately set a flag
|
||||
to block future accesses to this device. All the functions that
|
||||
actually access the device should check this flag to make sure
|
||||
the card is still present.
|
||||
|
||||
======================================================================*/
|
||||
|
||||
static int teles_cs_event(event_t event, int priority,
|
||||
event_callback_args_t *args)
|
||||
{
|
||||
dev_link_t *link = args->client_data;
|
||||
|
||||
DEBUG(1, "teles_cs_event(%d)\n", event);
|
||||
|
||||
switch (event) {
|
||||
case CS_EVENT_CARD_INSERTION:
|
||||
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
|
||||
teles_cs_config(link);
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
} /* teles_cs_event */
|
||||
|
||||
static struct pcmcia_device_id teles_ids[] = {
|
||||
PCMCIA_DEVICE_PROD_ID12("TELES", "S0/PC", 0x67b50eae, 0xe9e70119),
|
||||
@@ -469,8 +421,7 @@ static struct pcmcia_driver teles_cs_driver = {
|
||||
.drv = {
|
||||
.name = "teles_cs",
|
||||
},
|
||||
.attach = teles_attach,
|
||||
.event = teles_cs_event,
|
||||
.probe = teles_attach,
|
||||
.remove = teles_detach,
|
||||
.id_table = teles_ids,
|
||||
.suspend = teles_suspend,
|
||||
|
||||
@@ -66,8 +66,6 @@ struct pcmciamtd_dev {
|
||||
};
|
||||
|
||||
|
||||
static dev_info_t dev_info = "pcmciamtd";
|
||||
|
||||
/* Module parameters */
|
||||
|
||||
/* 2 = do 16-bit transfers, 1 = do 8-bit transfers */
|
||||
@@ -708,30 +706,6 @@ static int pcmciamtd_resume(struct pcmcia_device *dev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* The card status event handler. Mostly, this schedules other
|
||||
* stuff to run after an event is received. A CARD_REMOVAL event
|
||||
* also sets some flags to discourage the driver from trying
|
||||
* to talk to the card any more.
|
||||
*/
|
||||
|
||||
static int pcmciamtd_event(event_t event, int priority,
|
||||
event_callback_args_t *args)
|
||||
{
|
||||
dev_link_t *link = args->client_data;
|
||||
|
||||
DEBUG(1, "event=0x%06x", event);
|
||||
switch (event) {
|
||||
case CS_EVENT_CARD_INSERTION:
|
||||
DEBUG(2, "EVENT_CARD_INSERTION");
|
||||
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
|
||||
pcmciamtd_config(link);
|
||||
break;
|
||||
default:
|
||||
DEBUG(2, "Unknown event %d", event);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* This deletes a driver "instance". The device is de-registered
|
||||
* with Card Services. If it has been released, all local data
|
||||
@@ -762,16 +736,14 @@ static void pcmciamtd_detach(struct pcmcia_device *p_dev)
|
||||
* with Card Services.
|
||||
*/
|
||||
|
||||
static dev_link_t *pcmciamtd_attach(void)
|
||||
static int pcmciamtd_attach(struct pcmcia_device *p_dev)
|
||||
{
|
||||
struct pcmciamtd_dev *dev;
|
||||
dev_link_t *link;
|
||||
client_reg_t client_reg;
|
||||
int ret;
|
||||
|
||||
/* Create new memory card device */
|
||||
dev = kmalloc(sizeof(*dev), GFP_KERNEL);
|
||||
if (!dev) return NULL;
|
||||
if (!dev) return -ENOMEM;
|
||||
DEBUG(1, "dev=0x%p", dev);
|
||||
|
||||
memset(dev, 0, sizeof(*dev));
|
||||
@@ -782,20 +754,13 @@ static dev_link_t *pcmciamtd_attach(void)
|
||||
link->conf.IntType = INT_MEMORY;
|
||||
|
||||
link->next = NULL;
|
||||
link->handle = p_dev;
|
||||
p_dev->instance = link;
|
||||
|
||||
/* Register with Card Services */
|
||||
client_reg.dev_info = &dev_info;
|
||||
client_reg.Version = 0x0210;
|
||||
client_reg.event_callback_args.client_data = link;
|
||||
DEBUG(2, "Calling RegisterClient");
|
||||
ret = pcmcia_register_client(&link->handle, &client_reg);
|
||||
if (ret != 0) {
|
||||
cs_error(link->handle, RegisterClient, ret);
|
||||
pcmciamtd_detach(link->handle);
|
||||
return NULL;
|
||||
}
|
||||
DEBUG(2, "link = %p", link);
|
||||
return link;
|
||||
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
|
||||
pcmciamtd_config(link);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct pcmcia_device_id pcmciamtd_ids[] = {
|
||||
@@ -829,8 +794,7 @@ static struct pcmcia_driver pcmciamtd_driver = {
|
||||
.drv = {
|
||||
.name = "pcmciamtd"
|
||||
},
|
||||
.attach = pcmciamtd_attach,
|
||||
.event = pcmciamtd_event,
|
||||
.probe = pcmciamtd_attach,
|
||||
.remove = pcmciamtd_detach,
|
||||
.owner = THIS_MODULE,
|
||||
.id_table = pcmciamtd_ids,
|
||||
|
||||
@@ -227,8 +227,6 @@ static char mii_preamble_required = 0;
|
||||
|
||||
static void tc574_config(dev_link_t *link);
|
||||
static void tc574_release(dev_link_t *link);
|
||||
static int tc574_event(event_t event, int priority,
|
||||
event_callback_args_t *args);
|
||||
|
||||
static void mdio_sync(kio_addr_t ioaddr, int bits);
|
||||
static int mdio_read(kio_addr_t ioaddr, int phy_id, int location);
|
||||
@@ -250,9 +248,6 @@ static int el3_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
|
||||
static struct ethtool_ops netdev_ethtool_ops;
|
||||
static void set_rx_mode(struct net_device *dev);
|
||||
|
||||
static dev_info_t dev_info = "3c574_cs";
|
||||
|
||||
static dev_link_t *tc574_attach(void);
|
||||
static void tc574_detach(struct pcmcia_device *p_dev);
|
||||
|
||||
/*
|
||||
@@ -261,20 +256,18 @@ static void tc574_detach(struct pcmcia_device *p_dev);
|
||||
with Card Services.
|
||||
*/
|
||||
|
||||
static dev_link_t *tc574_attach(void)
|
||||
static int tc574_attach(struct pcmcia_device *p_dev)
|
||||
{
|
||||
struct el3_private *lp;
|
||||
client_reg_t client_reg;
|
||||
dev_link_t *link;
|
||||
struct net_device *dev;
|
||||
int ret;
|
||||
|
||||
DEBUG(0, "3c574_attach()\n");
|
||||
|
||||
/* Create the PC card device object. */
|
||||
dev = alloc_etherdev(sizeof(struct el3_private));
|
||||
if (!dev)
|
||||
return NULL;
|
||||
return -ENOMEM;
|
||||
lp = netdev_priv(dev);
|
||||
link = &lp->link;
|
||||
link->priv = dev;
|
||||
@@ -305,19 +298,13 @@ static dev_link_t *tc574_attach(void)
|
||||
dev->watchdog_timeo = TX_TIMEOUT;
|
||||
#endif
|
||||
|
||||
/* Register with Card Services */
|
||||
link->next = NULL;
|
||||
client_reg.dev_info = &dev_info;
|
||||
client_reg.Version = 0x0210;
|
||||
client_reg.event_callback_args.client_data = link;
|
||||
ret = pcmcia_register_client(&link->handle, &client_reg);
|
||||
if (ret != 0) {
|
||||
cs_error(link->handle, RegisterClient, ret);
|
||||
tc574_detach(link->handle);
|
||||
return NULL;
|
||||
}
|
||||
link->handle = p_dev;
|
||||
p_dev->instance = link;
|
||||
|
||||
return link;
|
||||
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
|
||||
tc574_config(link);
|
||||
|
||||
return 0;
|
||||
} /* tc574_attach */
|
||||
|
||||
/*
|
||||
@@ -565,29 +552,6 @@ static int tc574_resume(struct pcmcia_device *p_dev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
The card status event handler. Mostly, this schedules other
|
||||
stuff to run after an event is received. A CARD_REMOVAL event
|
||||
also sets some flags to discourage the net drivers from trying
|
||||
to talk to the card any more.
|
||||
*/
|
||||
|
||||
static int tc574_event(event_t event, int priority,
|
||||
event_callback_args_t *args)
|
||||
{
|
||||
dev_link_t *link = args->client_data;
|
||||
|
||||
DEBUG(1, "3c574_event(0x%06x)\n", event);
|
||||
|
||||
switch (event) {
|
||||
case CS_EVENT_CARD_INSERTION:
|
||||
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
|
||||
tc574_config(link);
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
} /* tc574_event */
|
||||
|
||||
static void dump_status(struct net_device *dev)
|
||||
{
|
||||
kio_addr_t ioaddr = dev->base_addr;
|
||||
@@ -1282,8 +1246,7 @@ static struct pcmcia_driver tc574_driver = {
|
||||
.drv = {
|
||||
.name = "3c574_cs",
|
||||
},
|
||||
.attach = tc574_attach,
|
||||
.event = tc574_event,
|
||||
.probe = tc574_attach,
|
||||
.remove = tc574_detach,
|
||||
.id_table = tc574_ids,
|
||||
.suspend = tc574_suspend,
|
||||
|
||||
@@ -143,8 +143,6 @@ DRV_NAME ".c " DRV_VERSION " 2001/10/13 00:08:50 (David Hinds)";
|
||||
|
||||
static void tc589_config(dev_link_t *link);
|
||||
static void tc589_release(dev_link_t *link);
|
||||
static int tc589_event(event_t event, int priority,
|
||||
event_callback_args_t *args);
|
||||
|
||||
static u16 read_eeprom(kio_addr_t ioaddr, int index);
|
||||
static void tc589_reset(struct net_device *dev);
|
||||
@@ -161,9 +159,6 @@ static void el3_tx_timeout(struct net_device *dev);
|
||||
static void set_multicast_list(struct net_device *dev);
|
||||
static struct ethtool_ops netdev_ethtool_ops;
|
||||
|
||||
static dev_info_t dev_info = "3c589_cs";
|
||||
|
||||
static dev_link_t *tc589_attach(void);
|
||||
static void tc589_detach(struct pcmcia_device *p_dev);
|
||||
|
||||
/*======================================================================
|
||||
@@ -174,20 +169,18 @@ static void tc589_detach(struct pcmcia_device *p_dev);
|
||||
|
||||
======================================================================*/
|
||||
|
||||
static dev_link_t *tc589_attach(void)
|
||||
static int tc589_attach(struct pcmcia_device *p_dev)
|
||||
{
|
||||
struct el3_private *lp;
|
||||
client_reg_t client_reg;
|
||||
dev_link_t *link;
|
||||
struct net_device *dev;
|
||||
int ret;
|
||||
|
||||
DEBUG(0, "3c589_attach()\n");
|
||||
|
||||
|
||||
/* Create new ethernet device */
|
||||
dev = alloc_etherdev(sizeof(struct el3_private));
|
||||
if (!dev)
|
||||
return NULL;
|
||||
return -ENOMEM;
|
||||
lp = netdev_priv(dev);
|
||||
link = &lp->link;
|
||||
link->priv = dev;
|
||||
@@ -204,7 +197,7 @@ static dev_link_t *tc589_attach(void)
|
||||
link->conf.IntType = INT_MEMORY_AND_IO;
|
||||
link->conf.ConfigIndex = 1;
|
||||
link->conf.Present = PRESENT_OPTION;
|
||||
|
||||
|
||||
/* The EL3-specific entries in the device structure. */
|
||||
SET_MODULE_OWNER(dev);
|
||||
dev->hard_start_xmit = &el3_start_xmit;
|
||||
@@ -219,19 +212,13 @@ static dev_link_t *tc589_attach(void)
|
||||
#endif
|
||||
SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops);
|
||||
|
||||
/* Register with Card Services */
|
||||
link->next = NULL;
|
||||
client_reg.dev_info = &dev_info;
|
||||
client_reg.Version = 0x0210;
|
||||
client_reg.event_callback_args.client_data = link;
|
||||
ret = pcmcia_register_client(&link->handle, &client_reg);
|
||||
if (ret != 0) {
|
||||
cs_error(link->handle, RegisterClient, ret);
|
||||
tc589_detach(link->handle);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return link;
|
||||
link->handle = p_dev;
|
||||
p_dev->instance = link;
|
||||
|
||||
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
|
||||
tc589_config(link);
|
||||
|
||||
return 0;
|
||||
} /* tc589_attach */
|
||||
|
||||
/*======================================================================
|
||||
@@ -439,31 +426,6 @@ static int tc589_resume(struct pcmcia_device *p_dev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*======================================================================
|
||||
|
||||
The card status event handler. Mostly, this schedules other
|
||||
stuff to run after an event is received. A CARD_REMOVAL event
|
||||
also sets some flags to discourage the net drivers from trying
|
||||
to talk to the card any more.
|
||||
|
||||
======================================================================*/
|
||||
|
||||
static int tc589_event(event_t event, int priority,
|
||||
event_callback_args_t *args)
|
||||
{
|
||||
dev_link_t *link = args->client_data;
|
||||
|
||||
DEBUG(1, "3c589_event(0x%06x)\n", event);
|
||||
|
||||
switch (event) {
|
||||
case CS_EVENT_CARD_INSERTION:
|
||||
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
|
||||
tc589_config(link);
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
} /* tc589_event */
|
||||
|
||||
/*====================================================================*/
|
||||
|
||||
/*
|
||||
@@ -1057,8 +1019,7 @@ static struct pcmcia_driver tc589_driver = {
|
||||
.drv = {
|
||||
.name = "3c589_cs",
|
||||
},
|
||||
.attach = tc589_attach,
|
||||
.event = tc589_event,
|
||||
.probe = tc589_attach,
|
||||
.remove = tc589_detach,
|
||||
.id_table = tc589_ids,
|
||||
.suspend = tc589_suspend,
|
||||
|
||||
@@ -87,8 +87,6 @@ static char *version =
|
||||
|
||||
static void axnet_config(dev_link_t *link);
|
||||
static void axnet_release(dev_link_t *link);
|
||||
static int axnet_event(event_t event, int priority,
|
||||
event_callback_args_t *args);
|
||||
static int axnet_open(struct net_device *dev);
|
||||
static int axnet_close(struct net_device *dev);
|
||||
static int axnet_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
|
||||
@@ -107,11 +105,8 @@ static void block_input(struct net_device *dev, int count,
|
||||
static void block_output(struct net_device *dev, int count,
|
||||
const u_char *buf, const int start_page);
|
||||
|
||||
static dev_link_t *axnet_attach(void);
|
||||
static void axnet_detach(struct pcmcia_device *p_dev);
|
||||
|
||||
static dev_info_t dev_info = "axnet_cs";
|
||||
|
||||
static void axdev_setup(struct net_device *dev);
|
||||
static void AX88190_init(struct net_device *dev, int startp);
|
||||
static int ax_open(struct net_device *dev);
|
||||
@@ -146,13 +141,11 @@ static inline axnet_dev_t *PRIV(struct net_device *dev)
|
||||
|
||||
======================================================================*/
|
||||
|
||||
static dev_link_t *axnet_attach(void)
|
||||
static int axnet_attach(struct pcmcia_device *p_dev)
|
||||
{
|
||||
axnet_dev_t *info;
|
||||
dev_link_t *link;
|
||||
struct net_device *dev;
|
||||
client_reg_t client_reg;
|
||||
int ret;
|
||||
|
||||
DEBUG(0, "axnet_attach()\n");
|
||||
|
||||
@@ -160,7 +153,7 @@ static dev_link_t *axnet_attach(void)
|
||||
"eth%d", axdev_setup);
|
||||
|
||||
if (!dev)
|
||||
return NULL;
|
||||
return -ENOMEM;
|
||||
|
||||
info = PRIV(dev);
|
||||
link = &info->link;
|
||||
@@ -175,19 +168,13 @@ static dev_link_t *axnet_attach(void)
|
||||
dev->do_ioctl = &axnet_ioctl;
|
||||
SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops);
|
||||
|
||||
/* Register with Card Services */
|
||||
link->next = NULL;
|
||||
client_reg.dev_info = &dev_info;
|
||||
client_reg.Version = 0x0210;
|
||||
client_reg.event_callback_args.client_data = link;
|
||||
ret = pcmcia_register_client(&link->handle, &client_reg);
|
||||
if (ret != CS_SUCCESS) {
|
||||
cs_error(link->handle, RegisterClient, ret);
|
||||
axnet_detach(link->handle);
|
||||
return NULL;
|
||||
}
|
||||
link->handle = p_dev;
|
||||
p_dev->instance = link;
|
||||
|
||||
return link;
|
||||
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
|
||||
axnet_config(link);
|
||||
|
||||
return 0;
|
||||
} /* axnet_attach */
|
||||
|
||||
/*======================================================================
|
||||
@@ -511,31 +498,6 @@ static int axnet_resume(struct pcmcia_device *p_dev)
|
||||
}
|
||||
|
||||
|
||||
/*======================================================================
|
||||
|
||||
The card status event handler. Mostly, this schedules other
|
||||
stuff to run after an event is received. A CARD_REMOVAL event
|
||||
also sets some flags to discourage the net drivers from trying
|
||||
to talk to the card any more.
|
||||
|
||||
======================================================================*/
|
||||
|
||||
static int axnet_event(event_t event, int priority,
|
||||
event_callback_args_t *args)
|
||||
{
|
||||
dev_link_t *link = args->client_data;
|
||||
|
||||
DEBUG(2, "axnet_event(0x%06x)\n", event);
|
||||
|
||||
switch (event) {
|
||||
case CS_EVENT_CARD_INSERTION:
|
||||
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
|
||||
axnet_config(link);
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
} /* axnet_event */
|
||||
|
||||
/*======================================================================
|
||||
|
||||
MII interface support
|
||||
@@ -608,7 +570,7 @@ static int axnet_open(struct net_device *dev)
|
||||
|
||||
link->open++;
|
||||
|
||||
request_irq(dev->irq, ei_irq_wrapper, SA_SHIRQ, dev_info, dev);
|
||||
request_irq(dev->irq, ei_irq_wrapper, SA_SHIRQ, "axnet_cs", dev);
|
||||
|
||||
info->link_status = 0x00;
|
||||
init_timer(&info->watchdog);
|
||||
@@ -869,8 +831,7 @@ static struct pcmcia_driver axnet_cs_driver = {
|
||||
.drv = {
|
||||
.name = "axnet_cs",
|
||||
},
|
||||
.attach = axnet_attach,
|
||||
.event = axnet_event,
|
||||
.probe = axnet_attach,
|
||||
.remove = axnet_detach,
|
||||
.id_table = axnet_ids,
|
||||
.suspend = axnet_suspend,
|
||||
|
||||
@@ -120,12 +120,7 @@ MODULE_LICENSE("GPL");
|
||||
|
||||
static void com20020_config(dev_link_t *link);
|
||||
static void com20020_release(dev_link_t *link);
|
||||
static int com20020_event(event_t event, int priority,
|
||||
event_callback_args_t *args);
|
||||
|
||||
static dev_info_t dev_info = "com20020_cs";
|
||||
|
||||
static dev_link_t *com20020_attach(void);
|
||||
static void com20020_detach(struct pcmcia_device *p_dev);
|
||||
|
||||
/*====================================================================*/
|
||||
@@ -143,21 +138,19 @@ typedef struct com20020_dev_t {
|
||||
|
||||
======================================================================*/
|
||||
|
||||
static dev_link_t *com20020_attach(void)
|
||||
static int com20020_attach(struct pcmcia_device *p_dev)
|
||||
{
|
||||
client_reg_t client_reg;
|
||||
dev_link_t *link;
|
||||
com20020_dev_t *info;
|
||||
struct net_device *dev;
|
||||
int ret;
|
||||
struct arcnet_local *lp;
|
||||
|
||||
|
||||
DEBUG(0, "com20020_attach()\n");
|
||||
|
||||
/* Create new network device */
|
||||
link = kmalloc(sizeof(struct dev_link_t), GFP_KERNEL);
|
||||
if (!link)
|
||||
return NULL;
|
||||
return -ENOMEM;
|
||||
|
||||
info = kmalloc(sizeof(struct com20020_dev_t), GFP_KERNEL);
|
||||
if (!info)
|
||||
@@ -189,29 +182,19 @@ static dev_link_t *com20020_attach(void)
|
||||
link->conf.IntType = INT_MEMORY_AND_IO;
|
||||
link->conf.Present = PRESENT_OPTION;
|
||||
|
||||
|
||||
link->irq.Instance = info->dev = dev;
|
||||
link->priv = info;
|
||||
|
||||
/* Register with Card Services */
|
||||
link->next = NULL;
|
||||
client_reg.dev_info = &dev_info;
|
||||
client_reg.Version = 0x0210;
|
||||
client_reg.event_callback_args.client_data = link;
|
||||
ret = pcmcia_register_client(&link->handle, &client_reg);
|
||||
if (ret != 0) {
|
||||
cs_error(link->handle, RegisterClient, ret);
|
||||
com20020_detach(link->handle);
|
||||
return NULL;
|
||||
}
|
||||
link->state |= DEV_PRESENT;
|
||||
com20020_config(link);
|
||||
|
||||
return link;
|
||||
return 0;
|
||||
|
||||
fail_alloc_dev:
|
||||
kfree(info);
|
||||
fail_alloc_info:
|
||||
kfree(link);
|
||||
return NULL;
|
||||
return -ENOMEM;
|
||||
} /* com20020_attach */
|
||||
|
||||
/*======================================================================
|
||||
@@ -442,31 +425,6 @@ static int com20020_resume(struct pcmcia_device *p_dev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*======================================================================
|
||||
|
||||
The card status event handler. Mostly, this schedules other
|
||||
stuff to run after an event is received. A CARD_REMOVAL event
|
||||
also sets some flags to discourage the net drivers from trying
|
||||
to talk to the card any more.
|
||||
|
||||
======================================================================*/
|
||||
|
||||
static int com20020_event(event_t event, int priority,
|
||||
event_callback_args_t *args)
|
||||
{
|
||||
dev_link_t *link = args->client_data;
|
||||
|
||||
DEBUG(1, "com20020_event(0x%06x)\n", event);
|
||||
|
||||
switch (event) {
|
||||
case CS_EVENT_CARD_INSERTION:
|
||||
link->state |= DEV_PRESENT;
|
||||
com20020_config(link);
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
} /* com20020_event */
|
||||
|
||||
static struct pcmcia_device_id com20020_ids[] = {
|
||||
PCMCIA_DEVICE_PROD_ID12("Contemporary Control Systems, Inc.", "PCM20 Arcnet Adapter", 0x59991666, 0x95dfffaf),
|
||||
PCMCIA_DEVICE_NULL
|
||||
@@ -478,8 +436,7 @@ static struct pcmcia_driver com20020_cs_driver = {
|
||||
.drv = {
|
||||
.name = "com20020_cs",
|
||||
},
|
||||
.attach = com20020_attach,
|
||||
.event = com20020_event,
|
||||
.probe = com20020_attach,
|
||||
.remove = com20020_detach,
|
||||
.id_table = com20020_ids,
|
||||
.suspend = com20020_suspend,
|
||||
|
||||
@@ -88,9 +88,6 @@ static void fmvj18x_config(dev_link_t *link);
|
||||
static int fmvj18x_get_hwinfo(dev_link_t *link, u_char *node_id);
|
||||
static int fmvj18x_setup_mfc(dev_link_t *link);
|
||||
static void fmvj18x_release(dev_link_t *link);
|
||||
static int fmvj18x_event(event_t event, int priority,
|
||||
event_callback_args_t *args);
|
||||
static dev_link_t *fmvj18x_attach(void);
|
||||
static void fmvj18x_detach(struct pcmcia_device *p_dev);
|
||||
|
||||
/*
|
||||
@@ -108,8 +105,6 @@ static void set_rx_mode(struct net_device *dev);
|
||||
static void fjn_tx_timeout(struct net_device *dev);
|
||||
static struct ethtool_ops netdev_ethtool_ops;
|
||||
|
||||
static dev_info_t dev_info = "fmvj18x_cs";
|
||||
|
||||
/*
|
||||
card type
|
||||
*/
|
||||
@@ -233,20 +228,18 @@ typedef struct local_info_t {
|
||||
#define BANK_1U 0x24 /* bank 1 (CONFIG_1) */
|
||||
#define BANK_2U 0x28 /* bank 2 (CONFIG_1) */
|
||||
|
||||
static dev_link_t *fmvj18x_attach(void)
|
||||
static int fmvj18x_attach(struct pcmcia_device *p_dev)
|
||||
{
|
||||
local_info_t *lp;
|
||||
dev_link_t *link;
|
||||
struct net_device *dev;
|
||||
client_reg_t client_reg;
|
||||
int ret;
|
||||
|
||||
|
||||
DEBUG(0, "fmvj18x_attach()\n");
|
||||
|
||||
/* Make up a FMVJ18x specific data structure */
|
||||
dev = alloc_etherdev(sizeof(local_info_t));
|
||||
if (!dev)
|
||||
return NULL;
|
||||
return -ENOMEM;
|
||||
lp = netdev_priv(dev);
|
||||
link = &lp->link;
|
||||
link->priv = dev;
|
||||
@@ -261,7 +254,7 @@ static dev_link_t *fmvj18x_attach(void)
|
||||
link->irq.IRQInfo1 = IRQ_LEVEL_ID;
|
||||
link->irq.Handler = &fjn_interrupt;
|
||||
link->irq.Instance = dev;
|
||||
|
||||
|
||||
/* General socket configuration */
|
||||
link->conf.Attributes = CONF_ENABLE_IRQ;
|
||||
link->conf.Vcc = 50;
|
||||
@@ -280,20 +273,14 @@ static dev_link_t *fmvj18x_attach(void)
|
||||
dev->watchdog_timeo = TX_TIMEOUT;
|
||||
#endif
|
||||
SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops);
|
||||
|
||||
/* Register with Card Services */
|
||||
link->next = NULL;
|
||||
client_reg.dev_info = &dev_info;
|
||||
client_reg.Version = 0x0210;
|
||||
client_reg.event_callback_args.client_data = link;
|
||||
ret = pcmcia_register_client(&link->handle, &client_reg);
|
||||
if (ret != 0) {
|
||||
cs_error(link->handle, RegisterClient, ret);
|
||||
fmvj18x_detach(link->handle);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return link;
|
||||
link->handle = p_dev;
|
||||
p_dev->instance = link;
|
||||
|
||||
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
|
||||
fmvj18x_config(link);
|
||||
|
||||
return 0;
|
||||
} /* fmvj18x_attach */
|
||||
|
||||
/*====================================================================*/
|
||||
@@ -734,22 +721,6 @@ static int fmvj18x_resume(struct pcmcia_device *p_dev)
|
||||
|
||||
/*====================================================================*/
|
||||
|
||||
static int fmvj18x_event(event_t event, int priority,
|
||||
event_callback_args_t *args)
|
||||
{
|
||||
dev_link_t *link = args->client_data;
|
||||
|
||||
DEBUG(1, "fmvj18x_event(0x%06x)\n", event);
|
||||
|
||||
switch (event) {
|
||||
case CS_EVENT_CARD_INSERTION:
|
||||
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
|
||||
fmvj18x_config(link);
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
} /* fmvj18x_event */
|
||||
|
||||
static struct pcmcia_device_id fmvj18x_ids[] = {
|
||||
PCMCIA_DEVICE_MANF_CARD(0x0004, 0x0004),
|
||||
PCMCIA_DEVICE_PROD_ID12("EAGLE Technology", "NE200 ETHERNET LAN MBH10302 04", 0x528c88c4, 0x74f91e59),
|
||||
@@ -780,8 +751,7 @@ static struct pcmcia_driver fmvj18x_cs_driver = {
|
||||
.drv = {
|
||||
.name = "fmvj18x_cs",
|
||||
},
|
||||
.attach = fmvj18x_attach,
|
||||
.event = fmvj18x_event,
|
||||
.probe = fmvj18x_attach,
|
||||
.remove = fmvj18x_detach,
|
||||
.id_table = fmvj18x_ids,
|
||||
.suspend = fmvj18x_suspend,
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user