Break circulare dependency on struct ethosu_device

The 'struct ethosu_device' has been passed as argument to classes.
This creates a circular dependency dependency and it gives all
classes full visibility to all resources in the device struct. This
patch removes the circular dependency.

Using device_lock() and device_unlock() to for synchronization.

Change-Id: I8322e6530c72d7bd67f48f411b4f14b612be2706
diff --git a/kernel/ethosu_driver.c b/kernel/ethosu_driver.c
index c6fc8cd..6e5bfb9 100644
--- a/kernel/ethosu_driver.c
+++ b/kernel/ethosu_driver.c
@@ -57,7 +57,6 @@
 static int ethosu_rpmsg_probe(struct rpmsg_device *rpdev)
 {
 	struct device *dev = &rpdev->dev;
-	struct ethosu_device *edev;
 	int minor;
 	int ret;
 
@@ -69,15 +68,8 @@
 		return -ENOMEM;
 	}
 
-	edev = devm_kzalloc(dev, sizeof(*edev), GFP_KERNEL);
-	if (!edev)
-		return -ENOMEM;
-
-	dev_set_drvdata(dev, edev);
-
 	/* Initialize device */
-	ret = ethosu_dev_init(edev, rpdev, ethosu_class,
-			      MKDEV(MAJOR(devt), minor));
+	ret = ethosu_dev_init(rpdev, ethosu_class, MKDEV(MAJOR(devt), minor));
 	if (ret)
 		return ret;
 
@@ -88,12 +80,13 @@
 
 static void ethosu_rpmsg_remove(struct rpmsg_device *rpdev)
 {
-	struct ethosu_device *edev = dev_get_drvdata(&rpdev->dev);
+	struct device *dev = &rpdev->dev;
+	struct ethosu_device *edev = dev_get_drvdata(dev);
 
-	dev_info(&rpdev->dev, "%s", __FUNCTION__);
+	dev_info(dev, "%s", __FUNCTION__);
 
 	clear_bit(MINOR(edev->devt), minors);
-	ethosu_dev_deinit(edev);
+	ethosu_dev_deinit(rpdev);
 }
 
 static int ethosu_rpmsg_cb(struct rpmsg_device *rpdev,