[tpmdd-devel,09/14] media: utilize new device_add_cdev helper function

Message ID 1487653253-11497-10-git-send-email-logang@deltatee.com
State New
Headers show

Commit Message

Logan Gunthorpe Feb. 21, 2017, 5 a.m.
Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
---
 drivers/media/cec/cec-core.c  | 3 +--
 drivers/media/media-devnode.c | 3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)

Patch

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;