OSDN Git Service

esoc: Fix integration with SSR driver
authorArun KS <arunks@codeaurora.org>
Mon, 16 Jan 2017 09:09:52 +0000 (14:39 +0530)
committerArun KS <arunks@codeaurora.org>
Sun, 30 Apr 2017 05:34:28 +0000 (11:04 +0530)
SSR driver expects subsystem descriptor device type to be
struct platform_device, whereas esoc driver is passing a
struct device instead. This results in a NULL pointer crash
during platform_get_irq in subsystem_restart.c. Fix esoc
driver to pass platform_device.

Change-Id: I93d02623cb7ac14ea3171c3792a4c52c73a74dea
Signed-off-by: Arun KS <arunks@codeaurora.org>
Signed-off-by: Srivatsa Vaddagiri <vatsa@codeaurora.org>
drivers/esoc/esoc-mdm-4x.c
drivers/esoc/esoc.h
drivers/esoc/esoc_bus.c

index 1e5f35d..9ddd91c 100644 (file)
@@ -748,6 +748,7 @@ static int mdm9x25_setup_hw(struct mdm_ctrl *mdm,
                dev_err(mdm->dev, "cannot allocate esoc device\n");
                return PTR_ERR(esoc);
        }
+       esoc->pdev = pdev;
        mdm->mdm_queue = alloc_workqueue("mdm_queue", 0, 0);
        if (!mdm->mdm_queue) {
                dev_err(mdm->dev, "could not create mdm_queue\n");
@@ -818,6 +819,7 @@ static int mdm9x35_setup_hw(struct mdm_ctrl *mdm,
                dev_err(mdm->dev, "cannot allocate esoc device\n");
                return PTR_ERR(esoc);
        }
+       esoc->pdev = pdev;
        mdm->mdm_queue = alloc_workqueue("mdm_queue", 0, 0);
        if (!mdm->mdm_queue) {
                dev_err(mdm->dev, "could not create mdm_queue\n");
@@ -906,6 +908,7 @@ static int mdm9x55_setup_hw(struct mdm_ctrl *mdm,
                dev_err(mdm->dev, "cannot allocate esoc device\n");
                return PTR_ERR(esoc);
        }
+       esoc->pdev = pdev;
        mdm->mdm_queue = alloc_workqueue("mdm_queue", 0, 0);
        if (!mdm->mdm_queue) {
                dev_err(mdm->dev, "could not create mdm_queue\n");
index 755fb24..11e36f7 100644 (file)
@@ -49,6 +49,7 @@ struct esoc_eng {
  * @link_info: additional info about the physical link.
  * @parent: parent device.
  * @dev: device for userspace interface.
+ * @pdev: platform device to interface with SSR driver.
  * @id: id of the external device.
  * @owner: owner of the device.
  * @clink_ops: control operations for the control link
@@ -66,6 +67,7 @@ struct esoc_clink {
        const char *link_info;
        struct device *parent;
        struct device dev;
+       struct platform_device *pdev;
        unsigned int id;
        struct module *owner;
        const struct esoc_clink_ops const *clink_ops;
index f925607..94f5276 100644 (file)
@@ -189,7 +189,7 @@ int esoc_clink_register_ssr(struct esoc_clink *esoc_clink)
        snprintf(subsys_name, len, "esoc%d", esoc_clink->id);
        esoc_clink->subsys.name = subsys_name;
        esoc_clink->dev.of_node = esoc_clink->np;
-       esoc_clink->subsys.dev = &esoc_clink->dev;
+       esoc_clink->subsys.dev = &esoc_clink->pdev->dev;
        esoc_clink->subsys_dev = subsys_register(&esoc_clink->subsys);
        if (IS_ERR_OR_NULL(esoc_clink->subsys_dev)) {
                dev_err(&esoc_clink->dev, "failed to register ssr node\n");