summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-01-06 17:02:07 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2009-01-06 17:02:07 -0800
commit40d7ee5d162203b40b5f4fbb312ab016edddb97f (patch)
tree432db33df85f7f244676127a189a828dfbf2877b /lib
parent5fec8bdbf9a1c4df4ad3f20e52aa2d8caed490c8 (diff)
parentb8ac9fc0e8cda9f9776019c5b0464b0c6d2d4c90 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core-2.6: (60 commits) uio: make uio_info's name and version const UIO: Documentation for UIO ioport info handling UIO: Pass information about ioports to userspace (V2) UIO: uio_pdrv_genirq: allow custom irq_flags UIO: use pci_ioremap_bar() in drivers/uio arm: struct device - replace bus_id with dev_name(), dev_set_name() libata: struct device - replace bus_id with dev_name(), dev_set_name() avr: struct device - replace bus_id with dev_name(), dev_set_name() block: struct device - replace bus_id with dev_name(), dev_set_name() chris: struct device - replace bus_id with dev_name(), dev_set_name() dmi: struct device - replace bus_id with dev_name(), dev_set_name() gadget: struct device - replace bus_id with dev_name(), dev_set_name() gpio: struct device - replace bus_id with dev_name(), dev_set_name() gpu: struct device - replace bus_id with dev_name(), dev_set_name() hwmon: struct device - replace bus_id with dev_name(), dev_set_name() i2o: struct device - replace bus_id with dev_name(), dev_set_name() IA64: struct device - replace bus_id with dev_name(), dev_set_name() i7300_idle: struct device - replace bus_id with dev_name(), dev_set_name() infiniband: struct device - replace bus_id with dev_name(), dev_set_name() ISDN: struct device - replace bus_id with dev_name(), dev_set_name() ...
Diffstat (limited to 'lib')
-rw-r--r--lib/dynamic_printk.c58
-rw-r--r--lib/klist.c43
-rw-r--r--lib/kobject_uevent.c8
-rw-r--r--lib/swiotlb.c2
4 files changed, 72 insertions, 39 deletions
diff --git a/lib/dynamic_printk.c b/lib/dynamic_printk.c
index 8e30295e856..165a19763dc 100644
--- a/lib/dynamic_printk.c
+++ b/lib/dynamic_printk.c
@@ -277,40 +277,34 @@ static ssize_t pr_debug_write(struct file *file, const char __user *buf,
dynamic_enabled = DYNAMIC_ENABLED_NONE;
}
err = 0;
- } else {
- if (elem) {
- if (value && (elem->enable == 0)) {
- dynamic_printk_enabled |=
- (1LL << elem->hash1);
- dynamic_printk_enabled2 |=
- (1LL << elem->hash2);
- elem->enable = 1;
- num_enabled++;
- dynamic_enabled = DYNAMIC_ENABLED_SOME;
- err = 0;
- printk(KERN_DEBUG
- "debugging enabled for module %s\n",
- elem->name);
- } else if (!value && (elem->enable == 1)) {
- elem->enable = 0;
- num_enabled--;
- if (disabled_hash(elem->hash1, true))
- dynamic_printk_enabled &=
+ } else if (elem) {
+ if (value && (elem->enable == 0)) {
+ dynamic_printk_enabled |= (1LL << elem->hash1);
+ dynamic_printk_enabled2 |= (1LL << elem->hash2);
+ elem->enable = 1;
+ num_enabled++;
+ dynamic_enabled = DYNAMIC_ENABLED_SOME;
+ err = 0;
+ printk(KERN_DEBUG
+ "debugging enabled for module %s\n",
+ elem->name);
+ } else if (!value && (elem->enable == 1)) {
+ elem->enable = 0;
+ num_enabled--;
+ if (disabled_hash(elem->hash1, true))
+ dynamic_printk_enabled &=
~(1LL << elem->hash1);
- if (disabled_hash(elem->hash2, false))
- dynamic_printk_enabled2 &=
+ if (disabled_hash(elem->hash2, false))
+ dynamic_printk_enabled2 &=
~(1LL << elem->hash2);
- if (num_enabled)
- dynamic_enabled =
- DYNAMIC_ENABLED_SOME;
- else
- dynamic_enabled =
- DYNAMIC_ENABLED_NONE;
- err = 0;
- printk(KERN_DEBUG
- "debugging disabled for module "
- "%s\n", elem->name);
- }
+ if (num_enabled)
+ dynamic_enabled = DYNAMIC_ENABLED_SOME;
+ else
+ dynamic_enabled = DYNAMIC_ENABLED_NONE;
+ err = 0;
+ printk(KERN_DEBUG
+ "debugging disabled for module %s\n",
+ elem->name);
}
}
}
diff --git a/lib/klist.c b/lib/klist.c
index bbdd3015c2c..573d6068a42 100644
--- a/lib/klist.c
+++ b/lib/klist.c
@@ -36,6 +36,7 @@
#include <linux/klist.h>
#include <linux/module.h>
+#include <linux/sched.h>
/*
* Use the lowest bit of n_klist to mark deleted nodes and exclude
@@ -108,7 +109,6 @@ static void add_tail(struct klist *k, struct klist_node *n)
static void klist_node_init(struct klist *k, struct klist_node *n)
{
INIT_LIST_HEAD(&n->n_node);
- init_completion(&n->n_removed);
kref_init(&n->n_ref);
knode_set_klist(n, k);
if (k->get)
@@ -171,13 +171,34 @@ void klist_add_before(struct klist_node *n, struct klist_node *pos)
}
EXPORT_SYMBOL_GPL(klist_add_before);
+struct klist_waiter {
+ struct list_head list;
+ struct klist_node *node;
+ struct task_struct *process;
+ int woken;
+};
+
+static DEFINE_SPINLOCK(klist_remove_lock);
+static LIST_HEAD(klist_remove_waiters);
+
static void klist_release(struct kref *kref)
{
+ struct klist_waiter *waiter, *tmp;
struct klist_node *n = container_of(kref, struct klist_node, n_ref);
WARN_ON(!knode_dead(n));
list_del(&n->n_node);
- complete(&n->n_removed);
+ spin_lock(&klist_remove_lock);
+ list_for_each_entry_safe(waiter, tmp, &klist_remove_waiters, list) {
+ if (waiter->node != n)
+ continue;
+
+ waiter->woken = 1;
+ mb();
+ wake_up_process(waiter->process);
+ list_del(&waiter->list);
+ }
+ spin_unlock(&klist_remove_lock);
knode_set_klist(n, NULL);
}
@@ -217,8 +238,24 @@ EXPORT_SYMBOL_GPL(klist_del);
*/
void klist_remove(struct klist_node *n)
{
+ struct klist_waiter waiter;
+
+ waiter.node = n;
+ waiter.process = current;
+ waiter.woken = 0;
+ spin_lock(&klist_remove_lock);
+ list_add(&waiter.list, &klist_remove_waiters);
+ spin_unlock(&klist_remove_lock);
+
klist_del(n);
- wait_for_completion(&n->n_removed);
+
+ for (;;) {
+ set_current_state(TASK_UNINTERRUPTIBLE);
+ if (waiter.woken)
+ break;
+ schedule();
+ }
+ __set_current_state(TASK_RUNNING);
}
EXPORT_SYMBOL_GPL(klist_remove);
diff --git a/lib/kobject_uevent.c b/lib/kobject_uevent.c
index 3f914725bda..318328ddbd1 100644
--- a/lib/kobject_uevent.c
+++ b/lib/kobject_uevent.c
@@ -165,7 +165,7 @@ int kobject_uevent_env(struct kobject *kobj, enum kobject_action action,
/* keys passed in from the caller */
if (envp_ext) {
for (i = 0; envp_ext[i]; i++) {
- retval = add_uevent_var(env, envp_ext[i]);
+ retval = add_uevent_var(env, "%s", envp_ext[i]);
if (retval)
goto exit;
}
@@ -225,8 +225,10 @@ int kobject_uevent_env(struct kobject *kobj, enum kobject_action action,
}
NETLINK_CB(skb).dst_group = 1;
- netlink_broadcast(uevent_sock, skb, 0, 1, GFP_KERNEL);
- }
+ retval = netlink_broadcast(uevent_sock, skb, 0, 1,
+ GFP_KERNEL);
+ } else
+ retval = -ENOMEM;
}
#endif
diff --git a/lib/swiotlb.c b/lib/swiotlb.c
index 7f5e21b9c16..c2a4e640145 100644
--- a/lib/swiotlb.c
+++ b/lib/swiotlb.c
@@ -647,7 +647,7 @@ swiotlb_full(struct device *dev, size_t size, int dir, int do_panic)
* the damage, or panic when the transfer is too big.
*/
printk(KERN_ERR "DMA: Out of SW-IOMMU space for %zu bytes at "
- "device %s\n", size, dev ? dev->bus_id : "?");
+ "device %s\n", size, dev ? dev_name(dev) : "?");
if (size > io_tlb_overflow && do_panic) {
if (dir == DMA_FROM_DEVICE || dir == DMA_BIDIRECTIONAL)