Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 52cab578 authored by Jody McIntyre's avatar Jody McIntyre
Browse files
parents 0a75c23a 46f25dff
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
This file details changes in 2.6 which affect PCMCIA card driver authors:

* 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);
       int (*resume)           (struct pcmcia_device *dev);
  should be initialized in struct pcmcia_driver, and handle
  (SUSPEND == RESET_PHYSICAL) and (RESUME == CARD_RESET) events

* event handler initialization in struct pcmcia_driver (as of 2.6.13)
   The event handler is notified of all events, and must be initialized
   as the event() callback in the driver's struct pcmcia_driver.
+1 −1
Original line number Diff line number Diff line
@@ -518,7 +518,7 @@ show_cpuinfo (struct seq_file *m, void *v)
	char family[32], features[128], *cp, sep;
	struct cpuinfo_ia64 *c = v;
	unsigned long mask;
	unsigned int proc_freq;
	unsigned long proc_freq;
	int i;

	mask = c->features;
+1 −1
Original line number Diff line number Diff line
@@ -700,7 +700,7 @@ int ia64_pci_legacy_read(struct pci_bus *bus, u16 port, u32 *val, u8 size)
 */
int ia64_pci_legacy_write(struct pci_dev *bus, u16 port, u32 val, u8 size)
{
	int ret = 0;
	int ret = size;

	switch (size) {
	case 1:
+1 −0
Original line number Diff line number Diff line
@@ -62,6 +62,7 @@ int dpm_runtime_suspend(struct device * dev, pm_message_t state)
	up(&dpm_sem);
	return error;
}
EXPORT_SYMBOL(dpm_runtime_suspend);


#if 0
+30 −79
Original line number Diff line number Diff line
@@ -87,14 +87,8 @@ 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(dev_link_t *);

static dev_link_t *dev_list = NULL;
static void bluecard_detach(struct pcmcia_device *p_dev);


/* Default baud rate: 57600, 115200, 230400 or 460800 */
@@ -862,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;
@@ -889,50 +881,24 @@ static dev_link_t *bluecard_attach(void)
	link->conf.Vcc = 50;
	link->conf.IntType = INT_MEMORY_AND_IO;

	/* Register with Card Services */
	link->next = dev_list;
	dev_list = link;
	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);
		return NULL;
	}
	link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
	bluecard_config(link);

	return link;
	return 0;
}


static void bluecard_detach(dev_link_t *link)
static void bluecard_detach(struct pcmcia_device *p_dev)
{
	dev_link_t *link = dev_to_instance(p_dev);
	bluecard_info_t *info = link->priv;
	dev_link_t **linkp;
	int ret;

	/* Locate device structure */
	for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next)
		if (*linkp == link)
			break;

	if (*linkp == NULL)
		return;

	if (link->state & DEV_CONFIG)
		bluecard_release(link);

	if (link->handle) {
		ret = pcmcia_deregister_client(link->handle);
		if (ret != CS_SUCCESS)
			cs_error(link->handle, DeregisterClient, ret);
	}

	/* Unlink device structure, free bits */
	*linkp = link->next;

	kfree(info);
}

@@ -1045,39 +1011,24 @@ static void bluecard_release(dev_link_t *link)
	link->state &= ~DEV_CONFIG;
}


static int bluecard_event(event_t event, int priority, event_callback_args_t *args)
static int bluecard_suspend(struct pcmcia_device *dev)
{
	dev_link_t *link = args->client_data;
	bluecard_info_t *info = link->priv;
	dev_link_t *link = dev_to_instance(dev);

	switch (event) {
	case CS_EVENT_CARD_REMOVAL:
		link->state &= ~DEV_PRESENT;
		if (link->state & DEV_CONFIG) {
			bluecard_close(info);
			bluecard_release(link);
		}
		break;
	case CS_EVENT_CARD_INSERTION:
		link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
		bluecard_config(link);
		break;
	case CS_EVENT_PM_SUSPEND:
	link->state |= DEV_SUSPEND;
		/* Fall through... */
	case CS_EVENT_RESET_PHYSICAL:
	if (link->state & DEV_CONFIG)
		pcmcia_release_configuration(link->handle);
		break;
	case CS_EVENT_PM_RESUME:

	return 0;
}

static int bluecard_resume(struct pcmcia_device *dev)
{
	dev_link_t *link = dev_to_instance(dev);

	link->state &= ~DEV_SUSPEND;
		/* Fall through... */
	case CS_EVENT_CARD_RESET:
	if (DEV_OK(link))
		pcmcia_request_configuration(link->handle, &link->conf);
		break;
	}

	return 0;
}
@@ -1095,10 +1046,11 @@ static struct pcmcia_driver bluecard_driver = {
	.drv		= {
		.name	= "bluecard_cs",
	},
	.attach		= bluecard_attach,
	.event		= bluecard_event,
	.detach		= bluecard_detach,
	.probe		= bluecard_attach,
	.remove		= bluecard_detach,
	.id_table	= bluecard_ids,
	.suspend	= bluecard_suspend,
	.resume		= bluecard_resume,
};

static int __init init_bluecard_cs(void)
@@ -1110,7 +1062,6 @@ static int __init init_bluecard_cs(void)
static void __exit exit_bluecard_cs(void)
{
	pcmcia_unregister_driver(&bluecard_driver);
	BUG_ON(dev_list != NULL);
}

module_init(init_bluecard_cs);
Loading