diff options
| author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-12-23 21:40:48 -0800 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-12-23 21:40:48 -0800 |
| commit | 5c6a8adbf5688f8923d13da42444d7abb819a1dc (patch) | |
| tree | 93f080c0811a747aaaa034f91d280696686c3700 /dbus.patch | |
| parent | 8ae2e05857e82516180aeb07b936a1a97e655865 (diff) | |
| download | patches-5c6a8adbf5688f8923d13da42444d7abb819a1dc.tar.gz | |
get dbus minor allocation working, and building properly
Diffstat (limited to 'dbus.patch')
| -rw-r--r-- | dbus.patch | 45 |
1 files changed, 35 insertions, 10 deletions
diff --git a/dbus.patch b/dbus.patch index 45e1fac10db1cd..01152d8f4c78ea 100644 --- a/dbus.patch +++ b/dbus.patch @@ -1,9 +1,9 @@ --- - drivers/char/Kconfig | 3 +++ - drivers/char/Makefile | 1 + - drivers/char/dbus.c | 32 ++++++++++++++++++++++++++++++++ - include/linux/dbus.h | 15 +++++++++++++++ - 4 files changed, 51 insertions(+) + drivers/char/Kconfig | 3 ++ + drivers/char/Makefile | 1 + drivers/char/dbus.c | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++ + include/linux/dbus.h | 15 +++++++++++++ + 4 files changed, 76 insertions(+) --- a/drivers/char/Kconfig +++ b/drivers/char/Kconfig @@ -25,7 +25,7 @@ +obj-$(CONFIG_DBUS) += dbus.o --- /dev/null +++ b/drivers/char/dbus.c -@@ -0,0 +1,32 @@ +@@ -0,0 +1,57 @@ +/* + * dbus - in kernel dbus functionality + * @@ -44,18 +44,43 @@ +static DEFINE_MUTEX(minor_lock); +static DEFINE_IDR(minor_idr); + ++static int minor_get(void) ++{ ++ int minor = -ENOMEM; ++ int retval; ++ ++ mutex_lock(&minor_lock); ++ if (idr_pre_get(&minor_idr, GFP_KERNEL) == 0) ++ goto exit; ++ retval = idr_get_new(&minor_idr, NULL, &minor); ++ if (retval < 0) { ++ minor = retval; ++ if (retval == -EAGAIN) ++ minor = -ENOMEM; ++ } ++exit: ++ mutex_unlock(&minor_lock); ++ return minor; ++} ++ ++static void minor_free(int minor) ++{ ++ mutex_lock(&minor_lock); ++ idr_remove(&minor_idr, minor); ++ mutex_unlock(&minor_lock); ++} + -+static int init(void) ++static int dbus_init(void) +{ + return 0; +} + -+static void exit(void) ++static void dbus_exit(void) +{ +} + -+module_init(init); -+module_exit(exit); ++module_init(dbus_init); ++module_exit(dbus_exit); + +MODULE_LICENSE("GPLv2"); --- /dev/null |
