From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from ale.deltatee.com ([207.54.116.67]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cg2bi-0002q6-MV for linux-mtd@lists.infradead.org; Tue, 21 Feb 2017 05:03:27 +0000 From: Logan Gunthorpe To: Greg Kroah-Hartman , Dan Williams , Alexander Viro , Johannes Thumshirn , Jan Kara , Arnd Bergmann , Sajjan Vikas C , Dmitry Torokhov , Linus Walleij , Alexandre Courbot , Peter Huewe , Marcel Selhorst , Jarkko Sakkinen , Jason Gunthorpe , Olof Johansson , Doug Ledford , Sean Hefty , Hal Rosenstock , Dmitry Vyukov , Haggai Eran , Parav Pandit , Leon Romanovsky , Jonathan Cameron , Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler , Hans Verkuil , Mauro Carvalho Chehab , Artem Bityutskiy , Richard Weinberger , David Woodhouse , Brian Norris , Boris Brezillon , Marek Vasut , Cyrille Pitchen , Matt Porter , Alexandre Bounine , Andrew Morton , Joe Perches , Lorenzo Stoakes , Vladimir Zapolskiy , Alessandro Zummo , Alexandre Belloni , Boaz Harrosh , Benny Halevy , "James E.J. Bottomley" , "Martin K. Petersen" , Stephen Bates , Bjorn Helgaas Cc: linux-pci@vger.kernel.org, osd-dev@open-osd.org, linux-scsi@vger.kernel.org, rtc-linux@googlegroups.com, linux-mtd@lists.infradead.org, linux-media@vger.kernel.org, linux-iio@vger.kernel.org, linux-rdma@vger.kernel.org, tpmdd-devel@lists.sourceforge.net, linux-gpio@vger.kernel.org, linux-input@vger.kernel.org, linux-nvdimm@lists.01.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Logan Gunthorpe Date: Mon, 20 Feb 2017 22:00:45 -0700 Message-Id: <1487653253-11497-7-git-send-email-logang@deltatee.com> In-Reply-To: <1487653253-11497-1-git-send-email-logang@deltatee.com> References: <1487653253-11497-1-git-send-email-logang@deltatee.com> Subject: [PATCH 06/14] platform/chrome: utilize new device_add_cdev helper function List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Signed-off-by: Logan Gunthorpe --- drivers/platform/chrome/cros_ec_dev.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/platform/chrome/cros_ec_dev.c b/drivers/platform/chrome/cros_ec_dev.c index 47268ec..658fb99 100644 --- a/drivers/platform/chrome/cros_ec_dev.c +++ b/drivers/platform/chrome/cros_ec_dev.c @@ -388,7 +388,6 @@ static int ec_device_probe(struct platform_device *pdev) int retval = -ENOMEM; struct device *dev = &pdev->dev; struct cros_ec_platform *ec_platform = dev_get_platdata(dev); - dev_t devno = MKDEV(ec_major, pdev->id); struct cros_ec_dev *ec = kzalloc(sizeof(*ec), GFP_KERNEL); if (!ec) @@ -401,6 +400,7 @@ static int ec_device_probe(struct platform_device *pdev) ec->features[0] = -1U; /* Not cached yet */ ec->features[1] = -1U; /* Not cached yet */ device_initialize(&ec->class_dev); + ec->class_dev.devt = MKDEV(ec_major, pdev->id); cdev_init(&ec->cdev, &fops); /* @@ -408,8 +408,7 @@ static int ec_device_probe(struct platform_device *pdev) * Link cdev to the class device to be sure device is not used * before unbinding it. */ - ec->cdev.kobj.parent = &ec->class_dev.kobj; - retval = cdev_add(&ec->cdev, devno, 1); + retval = device_add_cdev(&ec->class_dev, &ec->cdev); if (retval) { dev_err(dev, ": failed to add character device\n"); goto cdev_add_failed; @@ -420,7 +419,6 @@ static int ec_device_probe(struct platform_device *pdev) * Link to the character device for creating the /dev entry * in devtmpfs. */ - ec->class_dev.devt = ec->cdev.dev; ec->class_dev.class = &cros_class; ec->class_dev.parent = dev; ec->class_dev.release = __remove; -- 2.1.4