Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756194Ab3JGUQE (ORCPT ); Mon, 7 Oct 2013 16:16:04 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:33675 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754396Ab3JGUP6 (ORCPT ); Mon, 7 Oct 2013 16:15:58 -0400 Date: Mon, 7 Oct 2013 13:10:44 -0700 From: Greg KH To: Larry Finger Cc: linux-kernel@vger.kernel.org Subject: Re: [RFC] Add inline routine to free memory used in kobject name Message-ID: <20131007201044.GA6305@kroah.com> References: <5252f2cd.33yoX1hUWLRsRUrq%Larry.Finger@lwfinger.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5252f2cd.33yoX1hUWLRsRUrq%Larry.Finger@lwfinger.net> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1492 Lines: 47 On Mon, Oct 07, 2013 at 12:43:41PM -0500, Larry Finger wrote: > At present, if one wants to free the memory allocation used for > a dev->kobj name, it is necessary to go quite deeply into the structure. Why would you ever want to do this? > To avoid this much dependence on the structure details in driver > code, a new inline routine is created. > > Signed-off-by: Larry Finger > --- > > Index: wireless-testing-save/include/linux/device.h > =================================================================== > --- wireless-testing-save.orig/include/linux/device.h > +++ wireless-testing-save/include/linux/device.h > @@ -27,6 +27,7 @@ > #include > #include > #include > +#include > > struct device; > struct device_private; > @@ -789,6 +790,11 @@ static inline const char *dev_name(const > return kobject_name(&dev->kobj); > } > > +static inline void dev_free_name(struct device *dev) > +{ > + kfree(dev->kobj.name); > +} Please show how you would use this function, I can't add functions that no one calls. And given that this type of thing hasn't been needed before, I'm thinking that it still isn't needed :) thanks, greg k-h -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/