[PATCH 1/5] nvmem: Use helper variable in nvmem_register_cdev()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Add struct cdev * helper variable to nvmem_register_cdev() in order to
avoid repeating &nvmem->cdev a bunch of times

Signed-off-by: Andrey Smirnov <andrew.smirnov@xxxxxxxxx>
---
 drivers/nvmem/core.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c
index 6cf98f62af..092e3b4f4a 100644
--- a/drivers/nvmem/core.c
+++ b/drivers/nvmem/core.c
@@ -90,16 +90,17 @@ static struct cdev_operations nvmem_chrdev_ops = {
 static int nvmem_register_cdev(struct nvmem_device *nvmem, const char *name)
 {
 	struct device_d *dev = &nvmem->dev;
+	struct cdev *cdev = &nvmem->cdev;
 	const char *alias;
 
 	alias = of_alias_get(dev->device_node);
 
-	nvmem->cdev.name = xstrdup(alias ?: name);
-	nvmem->cdev.ops = &nvmem_chrdev_ops;
-	nvmem->cdev.dev = &nvmem->dev;
-	nvmem->cdev.size = nvmem->size;
+	cdev->name = xstrdup(alias ?: name);
+	cdev->ops = &nvmem_chrdev_ops;
+	cdev->dev = &nvmem->dev;
+	cdev->size = nvmem->size;
 
-	return devfs_create(&nvmem->cdev);
+	return devfs_create(cdev);
 }
 
 static struct nvmem_device *of_nvmem_find(struct device_node *nvmem_np)
-- 
2.21.0


_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux