Subject: Re: linux-next: manual merge of the pcmcia tree with the pxa tree

From: Russell King - ARM Linux <[email-masked]>
Date: Mon, 30 Nov 2009 09:48:13 +0000

On Mon, Nov 30, 2009 at 10:24:44AM +0100, Marc Zyngier wrote:
> Sounds good. I'll post rebased patches as soon as PCMCIA hits Linus'
> tree.

What would be a better idea is to rework the driver once my changes have
hit.  If you need to pass additional data around, you can do it like this:

struct my_socket {
	struct soc_pcmcia_socket skt;
	...
};

#define to_my_socket(s) container_of(s, struct my_socket, skt)

static struct pcmcia_low_level my_ops = {
};

static int my_probe(struct platform_device *dev)
{
	struct my_socket *skts;

	pxa2xx_drv_pcmcia_ops(&my_ops);

	skts = kzalloc(sizeof(*skts) * nr, GFP_KERNEL);
	if (!skts)
		...

	for (i = 0; i < nr; i++) {
		skts[i].skt.nr = i;
		skts[i].skt.ops = &my_ops;
		skts[i].skt.socket.owner = THIS_MODULE;
		skts[i].skt.socket.parent = &dev->dev;
		skts[i].skt.socket.pci_irq = the_socket_irq;
		ret = pxa2xx_drv_pcmcia_add_one(&skts[i].skt);
		if (ret)
			goto free_registered_sockets_and_return_ret;
	}
}