thermal_cooling_device_unregister(qmp->cooling_devs[i].cdev);
  }
  
+ /**
+  * qmp_get() - get a qmp handle from a device
+  * @dev: client device pointer
+  *
+  * Return: handle to qmp device on success, ERR_PTR() on failure
+  */
+ struct qmp *qmp_get(struct device *dev)
+ {
+       struct platform_device *pdev;
+       struct device_node *np;
+       struct qmp *qmp;
+ 
+       if (!dev || !dev->of_node)
+               return ERR_PTR(-EINVAL);
+ 
+       np = of_parse_phandle(dev->of_node, "qcom,qmp", 0);
+       if (!np)
+               return ERR_PTR(-ENODEV);
+ 
+       pdev = of_find_device_by_node(np);
+       of_node_put(np);
+       if (!pdev)
+               return ERR_PTR(-EINVAL);
+ 
+       qmp = platform_get_drvdata(pdev);
+ 
+       return qmp ? qmp : ERR_PTR(-EPROBE_DEFER);
+ }
+ EXPORT_SYMBOL(qmp_get);
+ 
+ /**
+  * qmp_put() - release a qmp handle
+  * @qmp: qmp handle obtained from qmp_get()
+  */
+ void qmp_put(struct qmp *qmp)
+ {
+       /*
+        * Match get_device() inside of_find_device_by_node() in
+        * qmp_get()
+        */
+       if (!IS_ERR_OR_NULL(qmp))
+               put_device(qmp->dev);
+ }
+ EXPORT_SYMBOL(qmp_put);
+ 
  static int qmp_probe(struct platform_device *pdev)
  {
 -      struct resource *res;
        struct qmp *qmp;
        int irq;
        int ret;