public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Larry Finger <Larry.Finger@lwfinger.net>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [RFC] Add inline routine to free memory used in kobject name
Date: Mon, 7 Oct 2013 13:10:44 -0700	[thread overview]
Message-ID: <20131007201044.GA6305@kroah.com> (raw)
In-Reply-To: <5252f2cd.33yoX1hUWLRsRUrq%Larry.Finger@lwfinger.net>

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 <Larry.Finger@lwfinger.net>
> ---
> 
> 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 <linux/ratelimit.h>
>  #include <linux/uidgid.h>
>  #include <asm/device.h>
> +#include <linux/slab.h>
>  
>  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

  reply	other threads:[~2013-10-07 20:16 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-07 17:43 [RFC] Add inline routine to free memory used in kobject name Larry Finger
2013-10-07 20:10 ` Greg KH [this message]
2013-10-07 20:39   ` Larry Finger
2013-10-08  1:58     ` Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20131007201044.GA6305@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=Larry.Finger@lwfinger.net \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox