summaryrefslogtreecommitdiff
path: root/arch/arm/mach-sa1100/ipaq-sleeve-cf.c
blob: 8f0b8ae8b75c639b0142f44a627752fbad2d5ac5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#include <linux/ipaq-sleeve.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/slab.h>

struct ipaq_sleeve_cf_data {
	struct platform_device *skt;
};

static int ipaq_sleeve_cf_probe(struct device *dev)
{
	struct ipaq_option_device *idev = to_ipaq_option_device(dev);
	struct ipaq_sleeve_cf_data *cf;
	struct platform_device_info pinfo = {
		.parent = dev,
		.name = "sa11x0-pcmcia",
		.id = 0,
		.data = &idev->id,
		.size_data = sizeof(idev->id),
	};

	cf = devm_kzalloc(dev, sizeof(*cf), GFP_KERNEL);
	if (!cf)
		return -ENOMEM;

	cf->skt = platform_device_register_full(&pinfo);
	if (IS_ERR(cf->skt)) {
		dev_err(dev, "unable to register pcmcia device: %ld\n",
			PTR_ERR(cf->skt));
		return PTR_ERR(cf->skt);
	}

	dev_set_drvdata(dev, cf);

	return 0;
}

static int ipaq_sleeve_cf_remove(struct device *dev)
{
	struct ipaq_sleeve_cf_data *cf = dev_get_drvdata(dev);

	platform_device_unregister(cf->skt);

	return 0;
}

static const struct ipaq_option_id ipaq_sleeve_cf_ids[] = {
	{	/* Compaq CompactFlash sleeve */
		.vendor = 0x1125,
		.device = 0xcf11,
	}, {	/* Compaq single PCMCIA sleeve */
		.vendor = 0x1125,
		.device = 0xd7c3,
	}, { },
};

static struct ipaq_option_driver ipaq_sleeve_cf = {
	.id_table = ipaq_sleeve_cf_ids,
	.driver = {
		.name = "ipaq-sleeve-cf",
		.probe = ipaq_sleeve_cf_probe,
		.remove = ipaq_sleeve_cf_remove,
	},
};

module_driver(ipaq_sleeve_cf, ipaq_option_driver_register,
	ipaq_option_driver_unregister);

MODULE_LICENSE("GPL");
MODULE_DEVICE_TABLE(ipaq, ipaq_sleeve_cf_ids);