summaryrefslogtreecommitdiff
path: root/kernel-devel/module-basics/vain_plat/vain_plat_4.c
blob: e76901c472266fe3fb344bd1d31bb6850f241fe1 (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
static int __devexit vain_plat_remove(struct platform_device *pdev)
{
	struct vain_plat_info *info = platform_get_drvdata(pdev);
	struct resource *res;

	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
	iounmap(info->base);
	release_mem_region(res->start, resource_size(res));
	platform_set_drvdata(pdev, NULL);

	kfree (info);

	return 0;
}

static const struct of_device_id vain_match[] = {
	{ .compatible = "example,vain", },
	{ /* end of table */ }
};

static struct platform_driver vain_plat_driver = {
	.driver		= {
		.name	= "vain_plat",
		.owner	= THIS_MODULE,
		.of_match_table = vain_match,
	},
	.probe		= vain_plat_probe,
	.remove		= __devexit_p(vain_plat_remove),
};