[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <5252f2cd.33yoX1hUWLRsRUrq%Larry.Finger@lwfinger.net>
Date: Mon, 07 Oct 2013 12:43:41 -0500
From: Larry Finger <Larry.Finger@...inger.net>
To: gregkh@...uxfoundation.org
Cc: linux-kernel@...r.kernel.org
Subject: [RFC] Add inline routine to free memory used in kobject name
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@...inger.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, ...);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists