Skip to content

Commit c813b4e

Browse files
committed
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: (46 commits) UIO: Fix mapping of logical and virtual memory UIO: add automata sercos3 pci card support UIO: Change driver name of uio_pdrv UIO: Add alignment warnings for uio-mem Driver core: add bus_sort_breadthfirst() function NET: convert the phy_device file to use bus_find_device_by_name kobject: Cleanup kobject_rename and !CONFIG_SYSFS kobject: Fix kobject_rename and !CONFIG_SYSFS sysfs: Make dir and name args to sysfs_notify() const platform: add new device registration helper sysfs: use ilookup5() instead of ilookup5_nowait() PNP: create device attributes via default device attributes Driver core: make bus_find_device_by_name() more robust usb: turn dev_warn+WARN_ON combos into dev_WARN debug: use dev_WARN() rather than WARN_ON() in device_pm_add() debug: Introduce a dev_WARN() function sysfs: fix deadlock device model: Do a quickcheck for driver binding before doing an expensive check Driver core: Fix cleanup in device_create_vargs(). Driver core: Clarify device cleanup. ...
2 parents c8d8a23 + 02683ff commit c813b4e

131 files changed

Lines changed: 1786 additions & 617 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎Documentation/kernel-parameters.txt‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1714,6 +1714,11 @@ and is between 256 and 4096 characters. It is defined in the file
17141714
autoconfiguration.
17151715
Ranges are in pairs (memory base and size).
17161716

1717+
dynamic_printk
1718+
Enables pr_debug()/dev_dbg() calls if
1719+
CONFIG_DYNAMIC_PRINTK_DEBUG has been enabled. These can also
1720+
be switched on/off via <debugfs>/dynamic_printk/modules
1721+
17171722
print-fatal-signals=
17181723
[KNL] debug: print fatal signals
17191724
print-fatal-signals=1: print segfault info to

‎Documentation/kobject.txt‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,10 @@ the name of the kobject, call kobject_rename():
118118

119119
int kobject_rename(struct kobject *kobj, const char *new_name);
120120

121+
Note kobject_rename does perform any locking or have a solid notion of
122+
what names are valid so the provide must provide their own sanity checking
123+
and serialization.
124+
121125
There is a function called kobject_set_name() but that is legacy cruft and
122126
is being removed. If your code needs to call this function, it is
123127
incorrect and needs to be fixed.

‎arch/mips/kernel/rtlx.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -522,8 +522,8 @@ static int __init rtlx_module_init(void)
522522
atomic_set(&channel_wqs[i].in_open, 0);
523523
mutex_init(&channel_wqs[i].mutex);
524524

525-
dev = device_create_drvdata(mt_class, NULL, MKDEV(major, i),
526-
NULL, "%s%d", module_name, i);
525+
dev = device_create(mt_class, NULL, MKDEV(major, i), NULL,
526+
"%s%d", module_name, i);
527527
if (IS_ERR(dev)) {
528528
err = PTR_ERR(dev);
529529
goto out_chrdev;

‎arch/mips/sibyte/common/sb_tbprof.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -576,8 +576,7 @@ static int __init sbprof_tb_init(void)
576576

577577
tb_class = tbc;
578578

579-
dev = device_create_drvdata(tbc, NULL, MKDEV(SBPROF_TB_MAJOR, 0),
580-
NULL, "tb");
579+
dev = device_create(tbc, NULL, MKDEV(SBPROF_TB_MAJOR, 0), NULL, "tb");
581580
if (IS_ERR(dev)) {
582581
err = PTR_ERR(dev);
583582
goto out_class;

‎arch/x86/kernel/cpuid.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,8 @@ static __cpuinit int cpuid_device_create(int cpu)
147147
{
148148
struct device *dev;
149149

150-
dev = device_create_drvdata(cpuid_class, NULL, MKDEV(CPUID_MAJOR, cpu),
151-
NULL, "cpu%d", cpu);
150+
dev = device_create(cpuid_class, NULL, MKDEV(CPUID_MAJOR, cpu), NULL,
151+
"cpu%d", cpu);
152152
return IS_ERR(dev) ? PTR_ERR(dev) : 0;
153153
}
154154

‎arch/x86/kernel/dumpstack_32.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include <linux/kexec.h>
1414
#include <linux/bug.h>
1515
#include <linux/nmi.h>
16+
#include <linux/sysfs.h>
1617

1718
#include <asm/stacktrace.h>
1819

@@ -343,6 +344,7 @@ int __kprobes __die(const char *str, struct pt_regs *regs, long err)
343344
printk("DEBUG_PAGEALLOC");
344345
#endif
345346
printk("\n");
347+
sysfs_printk_last_file();
346348
if (notify_die(DIE_OOPS, str, regs, err,
347349
current->thread.trap_no, SIGSEGV) == NOTIFY_STOP)
348350
return 1;

‎arch/x86/kernel/dumpstack_64.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include <linux/kexec.h>
1414
#include <linux/bug.h>
1515
#include <linux/nmi.h>
16+
#include <linux/sysfs.h>
1617

1718
#include <asm/stacktrace.h>
1819

@@ -489,6 +490,7 @@ int __kprobes __die(const char *str, struct pt_regs *regs, long err)
489490
printk("DEBUG_PAGEALLOC");
490491
#endif
491492
printk("\n");
493+
sysfs_printk_last_file();
492494
if (notify_die(DIE_OOPS, str, regs, err,
493495
current->thread.trap_no, SIGSEGV) == NOTIFY_STOP)
494496
return 1;

‎arch/x86/kernel/msr.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,8 @@ static int __cpuinit msr_device_create(int cpu)
163163
{
164164
struct device *dev;
165165

166-
dev = device_create_drvdata(msr_class, NULL, MKDEV(MSR_MAJOR, cpu),
167-
NULL, "msr%d", cpu);
166+
dev = device_create(msr_class, NULL, MKDEV(MSR_MAJOR, cpu), NULL,
167+
"msr%d", cpu);
168168
return IS_ERR(dev) ? PTR_ERR(dev) : 0;
169169
}
170170

‎block/bsg.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1024,8 +1024,7 @@ int bsg_register_queue(struct request_queue *q, struct device *parent,
10241024
bcd->release = release;
10251025
kref_init(&bcd->ref);
10261026
dev = MKDEV(bsg_major, bcd->minor);
1027-
class_dev = device_create_drvdata(bsg_class, parent, dev, NULL,
1028-
"%s", devname);
1027+
class_dev = device_create(bsg_class, parent, dev, NULL, "%s", devname);
10291028
if (IS_ERR(class_dev)) {
10301029
ret = PTR_ERR(class_dev);
10311030
goto put_dev;

‎drivers/base/bus.c‎

Lines changed: 51 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -333,9 +333,7 @@ static int match_name(struct device *dev, void *data)
333333
{
334334
const char *name = data;
335335

336-
if (strcmp(name, dev->bus_id) == 0)
337-
return 1;
338-
return 0;
336+
return sysfs_streq(name, dev->bus_id);
339337
}
340338

341339
/**
@@ -982,6 +980,56 @@ struct klist *bus_get_device_klist(struct bus_type *bus)
982980
}
983981
EXPORT_SYMBOL_GPL(bus_get_device_klist);
984982

983+
/*
984+
* Yes, this forcably breaks the klist abstraction temporarily. It
985+
* just wants to sort the klist, not change reference counts and
986+
* take/drop locks rapidly in the process. It does all this while
987+
* holding the lock for the list, so objects can't otherwise be
988+
* added/removed while we're swizzling.
989+
*/
990+
static void device_insertion_sort_klist(struct device *a, struct list_head *list,
991+
int (*compare)(const struct device *a,
992+
const struct device *b))
993+
{
994+
struct list_head *pos;
995+
struct klist_node *n;
996+
struct device *b;
997+
998+
list_for_each(pos, list) {
999+
n = container_of(pos, struct klist_node, n_node);
1000+
b = container_of(n, struct device, knode_bus);
1001+
if (compare(a, b) <= 0) {
1002+
list_move_tail(&a->knode_bus.n_node,
1003+
&b->knode_bus.n_node);
1004+
return;
1005+
}
1006+
}
1007+
list_move_tail(&a->knode_bus.n_node, list);
1008+
}
1009+
1010+
void bus_sort_breadthfirst(struct bus_type *bus,
1011+
int (*compare)(const struct device *a,
1012+
const struct device *b))
1013+
{
1014+
LIST_HEAD(sorted_devices);
1015+
struct list_head *pos, *tmp;
1016+
struct klist_node *n;
1017+
struct device *dev;
1018+
struct klist *device_klist;
1019+
1020+
device_klist = bus_get_device_klist(bus);
1021+
1022+
spin_lock(&device_klist->k_lock);
1023+
list_for_each_safe(pos, tmp, &device_klist->k_list) {
1024+
n = container_of(pos, struct klist_node, n_node);
1025+
dev = container_of(n, struct device, knode_bus);
1026+
device_insertion_sort_klist(dev, &sorted_devices, compare);
1027+
}
1028+
list_splice(&sorted_devices, &device_klist->k_list);
1029+
spin_unlock(&device_klist->k_lock);
1030+
}
1031+
EXPORT_SYMBOL_GPL(bus_sort_breadthfirst);
1032+
9851033
int __init buses_init(void)
9861034
{
9871035
bus_kset = kset_create_and_add("bus", &bus_uevent_ops, NULL);

0 commit comments

Comments
 (0)