msm: pil: Make register code into a bus
Make struct pil_device into a wrapper around struct device so
that we can group all pil devices in the system onto one logical
pil bus. This will allow us to make 'online' sysfs nodes that
userspace can poll on in a later patch. Also, add an unregister
function so that devices can be removed if a module is removed.
Change-Id: I5e6c4286e3fb2149bdf2311fe23588364349eb54
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
diff --git a/arch/arm/mach-msm/pil-gss.c b/arch/arm/mach-msm/pil-gss.c
index 26b97fa..c4477ff 100644
--- a/arch/arm/mach-msm/pil-gss.c
+++ b/arch/arm/mach-msm/pil-gss.c
@@ -64,6 +64,7 @@
unsigned long start_addr;
struct delayed_work work;
struct clk *xo;
+ struct pil_device *pil;
};
static int nop_verify_blob(struct pil_desc *pil, u32 phy_addr, size_t size)
@@ -329,7 +330,6 @@
struct gss_data *drv;
struct resource *res;
struct pil_desc *desc;
- int ret;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!res)
@@ -363,6 +363,7 @@
desc->name = "gss";
desc->dev = &pdev->dev;
+ desc->owner = THIS_MODULE;
if (pas_supported(PAS_GSS) > 0) {
desc->ops = &pil_gss_ops_trusted;
@@ -374,17 +375,19 @@
INIT_DELAYED_WORK(&drv->work, remove_gss_proxy_votes);
- ret = msm_pil_register(desc);
- if (ret) {
+ drv->pil = msm_pil_register(desc);
+ if (IS_ERR(drv->pil)) {
flush_delayed_work_sync(&drv->work);
clk_put(drv->xo);
+ return PTR_ERR(drv->pil);
}
- return ret;
+ return 0;
}
static int __devexit pil_gss_remove(struct platform_device *pdev)
{
struct gss_data *drv = platform_get_drvdata(pdev);
+ msm_pil_unregister(drv->pil);
flush_delayed_work_sync(&drv->work);
clk_put(drv->xo);
return 0;