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 1cgK3u-0004tM-B8 for linux-mtd@lists.infradead.org; Tue, 21 Feb 2017 23:41:39 +0000 To: Dan Williams References: <1487653253-11497-1-git-send-email-logang@deltatee.com> <1487653253-11497-2-git-send-email-logang@deltatee.com> <20170221053522.GA1466@dtor-ws> <17f32963-1d0e-5d17-64c9-742b05415722@deltatee.com> Cc: Dmitry Torokhov , Greg Kroah-Hartman , Alexander Viro , Johannes Thumshirn , Jan Kara , Arnd Bergmann , Sajjan Vikas C , 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 , linux-pci@vger.kernel.org, osd-dev@open-osd.org, linux-scsi , 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 , "linux-kernel@vger.kernel.org" From: Logan Gunthorpe Message-ID: <0f24273d-028c-9fa3-3fe7-975d2b0540f8@deltatee.com> Date: Tue, 21 Feb 2017 16:41:01 -0700 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [PATCH 01/14] chardev: add helper function to register char devs with a struct device List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Hey, Ok, I'll do a v2 later this week with some of the feedback and tags? Logan On 21/02/17 11:18 AM, Dan Williams wrote: > On Mon, Feb 20, 2017 at 10:35 PM, Logan Gunthorpe wrote: >> >> >> On 20/02/17 10:35 PM, Dmitry Torokhov wrote: >>> My only objection is to this statement. There is absolutely nothing that >>> prevents from calling device_unregister() first and cdev_del() later. >>> Refcounting will sort it all out. >> >> Yeah, I was really trying to warn people against calling cdev_del within >> the release function of the device. If you do that, then the cdev >> reference will block the device from ever getting released. >> >> Certainly, you could call device_unregister followed by cdev_del. I >> could reword this if you feel it necessary. > > I agree with Dmitry, just delete the statement in parenthesis and the > rest is fine. If you're modifying this patch it might be good to take > the opportunity to add a WARN_ON(!parent->kobj.state_initialized) to > catch attempts to call device_add_cdev() with an uninitialized device. > > You can also add: > > Signed-off-by: Dan Williams >