[tpmdd-devel,04/14] gpiolib: utilize new device_add_cdev helper function

Submitted by Logan Gunthorpe on Feb. 21, 2017, 5 a.m.

Details

Message ID 1487653253-11497-5-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/gpio/gpiolib.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Patch hide | download patch | download mbox

diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index a07ae9e..04dbc4a 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -1036,9 +1036,8 @@  static int gpiochip_setup_dev(struct gpio_device *gdev)
 
 	cdev_init(&gdev->chrdev, &gpio_fileops);
 	gdev->chrdev.owner = THIS_MODULE;
-	gdev->chrdev.kobj.parent = &gdev->dev.kobj;
 	gdev->dev.devt = MKDEV(MAJOR(gpio_devt), gdev->id);
-	status = cdev_add(&gdev->chrdev, gdev->dev.devt, 1);
+	status = device_add_cdev(&gdev->dev, &gdev->chrdev);
 	if (status < 0)
 		chip_warn(gdev->chip, "failed to add char device %d:%d\n",
 			  MAJOR(gpio_devt), gdev->id);