[PATCH 09/14] media: utilize new device_add_cdev helper function

Logan Gunthorpe
2017-02-21T05:00:48Z

Signed-off-by: Logan Gunthorpe <logang-OTvnGxWRz7hWk0Htik3J/w@public.gmane.org>
---
drivers/media/cec/cec-core.c | 3 +--
drivers/media/media-devnode.c | 3 +--
2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/media/cec/cec-core.c b/drivers/media/cec/cec-core.c
index aca3ab8..a475aa5 100644
--- a/drivers/media/cec/cec-core.c
+++ b/drivers/media/cec/cec-core.c
@@ -137,10 +137,9 @@ static int __must_check cec_devnode_register(struct cec_devnode *devnode,

/* Part 2: Initialize and register the character device */
cdev_init(&devnode->cdev, &cec_devnode_fops);
- devnode->cdev.kobj.parent = &devnode->dev.kobj;
devnode->cdev.owner = owner;

- ret = cdev_add(&devnode->cdev, devnode->dev.devt, 1);
+ ret = device_add_cdev(&devnode->dev, &devnode->cdev);
if (ret < 0) {
pr_err("%s: cdev_add failed\n", __func__);
goto clr_bit;
diff --git a/drivers/media/media-devnode.c b/drivers/media/media-devnode.c
index f2772ba..8d4718c 100644
--- a/drivers/media/media-devnode.c
+++ b/drivers/media/media-devnode.c
@@ -255,9 +255,8 @@ int __must_check media_devnode_register(struct media_device *mdev,
/* Part 2: Initialize and register the character device */
cdev_init(&devnode->cdev, &media_devnode_fops);
devnode->cdev.owner = owner;
- devnode->cdev.kobj.parent = &devnode->dev.kobj;

- ret = cdev_add(&devnode->cdev, MKDEV(MAJOR(media_dev_t), devnode->minor), 1);
+ ret = device_add_cdev(&devnode->dev, &devnode->cdev);
if (ret < 0) {
pr_err("%s: cdev_add failed\n", __func__);
goto cdev_add_error;
--
2.1.4