From mboxrd@z Thu Jan 1 00:00:00 1970 From: Logan Gunthorpe Subject: Re: [PATCH 01/14] chardev: add helper function to register char devs with a struct device Date: Tue, 21 Feb 2017 16:41:01 -0700 Message-ID: <0f24273d-028c-9fa3-3fe7-975d2b0540f8@deltatee.com> 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> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linux-nvdimm-bounces-hn68Rpc1hR1g9hUCZPvPmw@public.gmane.org Sender: "Linux-nvdimm" To: Dan Williams Cc: Alessandro Zummo , Jan Kara , linux-iio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-pci-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Linus Walleij , Jarkko Sakkinen , Alexandre Bounine , Alexandre Belloni , Peter Meerwald-Stadler , linux-scsi , Peter Huewe , Parav Pandit , Sean Hefty , Alexandre Courbot , Lars-Peter Clausen , "James E.J. Bottomley" , rtc-linux-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org, Leon Romanovsky , "linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw@public.gmane.org" , linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Richard Weinberger , Jason Gunthorpe , Marek List-Id: linux-input@vger.kernel.org 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 >