Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cpcap-core: Register the driver early in the boot process. #16

Merged
merged 1 commit into from
Nov 4, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 37 additions & 12 deletions drivers/mfd/cpcap-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,18 +53,6 @@ static struct miscdevice cpcap_dev = {
.fops = &cpcap_fops,
};

static struct spi_driver cpcap_driver = {
.driver = {
.name = "cpcap",
.bus = &spi_bus_type,
.owner = THIS_MODULE,
},
.probe = cpcap_probe,
.remove = cpcap_remove,
};

module_spi_driver(cpcap_driver);

static struct platform_device cpcap_adc_device = {
.name = "cpcap_adc",
.id = -1,
Expand Down Expand Up @@ -588,6 +576,43 @@ int cpcap_disable_offmode_wakeups(bool disable)
return retval;
}

static const struct of_device_id cpcap_of_match[] = {
{ .compatible = "mot,cpcap" },
{ },
};
MODULE_DEVICE_TABLE(of, cpcap_of_match);

static struct spi_driver cpcap_spi_driver = {
.driver = {
.name = CPCAP_DEV_NAME,
.bus = &spi_bus_type,
.owner = THIS_MODULE,
.of_match_table = of_match_ptr(cpcap_of_match),
},
.probe = cpcap_probe,
.remove = cpcap_remove,
};

static int __init cpcap_spi_init(void)
{
int ret;

ret = spi_register_driver(&cpcap_spi_driver);
if (ret != 0)
pr_err("Failed to register CPCAP (Core) SPI driver: %d\n", ret);

return 0;
}

/* init early so consumer devices can complete system boot */
subsys_initcall(cpcap_spi_init);

static void __exit cpcap_spi_exit(void)
{
spi_unregister_driver(&cpcap_spi_driver);
}
module_exit(cpcap_spi_exit);

MODULE_ALIAS("platform:cpcap");
MODULE_DESCRIPTION("CPCAP driver");
MODULE_AUTHOR("Motorola");
Expand Down