public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [RFC] Add inline routine to free memory used in kobject name
@ 2013-10-07 17:43 Larry Finger
  2013-10-07 20:10 ` Greg KH
  0 siblings, 1 reply; 4+ messages in thread
From: Larry Finger @ 2013-10-07 17:43 UTC (permalink / raw)
  To: gregkh; +Cc: linux-kernel

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.
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);
+}
+
 extern __printf(2, 3)
 int dev_set_name(struct device *dev, const char *name, ...);
 

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-10-08  2:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2013-10-07 20:39   ` Larry Finger
2013-10-08  1:58     ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox