aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/DocBook/uio-howto.tmpl2
-rw-r--r--Documentation/driver-model/binding.txt4
-rw-r--r--Documentation/driver-model/device.txt65
-rw-r--r--Documentation/filesystems/sysfs.txt10
-rw-r--r--Documentation/stable_kernel_rules.txt14
-rw-r--r--Documentation/zh_CN/SubmitChecklist109
-rw-r--r--MAINTAINERS6
-rw-r--r--arch/arm/plat-mxc/devices.c53
-rw-r--r--arch/arm/plat-mxc/include/mach/devices-common.h16
-rw-r--r--drivers/base/core.c5
-rw-r--r--drivers/base/dd.c3
-rw-r--r--drivers/base/memory.c62
-rw-r--r--drivers/base/platform.c54
-rw-r--r--drivers/misc/pch_phub.c10
-rw-r--r--drivers/uio/uio.c14
-rw-r--r--drivers/uio/uio_pci_generic.c5
-rw-r--r--drivers/uio/uio_pdrv_genirq.c2
-rw-r--r--fs/debugfs/inode.c2
-rw-r--r--fs/sysfs/dir.c168
-rw-r--r--fs/sysfs/inode.c14
-rw-r--r--fs/sysfs/sysfs.h17
-rw-r--r--include/linux/device.h5
-rw-r--r--include/linux/dynamic_debug.h76
-rw-r--r--include/linux/netdevice.h10
-rw-r--r--include/linux/platform_device.h48
-rw-r--r--include/linux/uio_driver.h7
-rw-r--r--lib/dynamic_debug.c173
-rw-r--r--lib/kobject_uevent.c2
-rw-r--r--net/core/dev.c3
29 files changed, 527 insertions, 432 deletions
diff --git a/Documentation/DocBook/uio-howto.tmpl b/Documentation/DocBook/uio-howto.tmpl
index 7c4b514d62b1..54883de5d5f9 100644
--- a/Documentation/DocBook/uio-howto.tmpl
+++ b/Documentation/DocBook/uio-howto.tmpl
@@ -529,7 +529,7 @@ memory (e.g. allocated with <function>kmalloc()</function>). There's also
529</para></listitem> 529</para></listitem>
530 530
531<listitem><para> 531<listitem><para>
532<varname>unsigned long addr</varname>: Required if the mapping is used. 532<varname>phys_addr_t addr</varname>: Required if the mapping is used.
533Fill in the address of your memory block. This address is the one that 533Fill in the address of your memory block. This address is the one that
534appears in sysfs. 534appears in sysfs.
535</para></listitem> 535</para></listitem>
diff --git a/Documentation/driver-model/binding.txt b/Documentation/driver-model/binding.txt
index f7ec9d625bfc..abfc8e290d53 100644
--- a/Documentation/driver-model/binding.txt
+++ b/Documentation/driver-model/binding.txt
@@ -48,10 +48,6 @@ devclass_add_device is called to enumerate the device within the class
48and actually register it with the class, which happens with the 48and actually register it with the class, which happens with the
49class's register_dev callback. 49class's register_dev callback.
50 50
51NOTE: The device class structures and core routines to manipulate them
52are not in the mainline kernel, so the discussion is still a bit
53speculative.
54
55 51
56Driver 52Driver
57~~~~~~ 53~~~~~~
diff --git a/Documentation/driver-model/device.txt b/Documentation/driver-model/device.txt
index bdefe728a737..1e70220d20f4 100644
--- a/Documentation/driver-model/device.txt
+++ b/Documentation/driver-model/device.txt
@@ -45,33 +45,52 @@ struct device_attribute {
45 const char *buf, size_t count); 45 const char *buf, size_t count);
46}; 46};
47 47
48Attributes of devices can be exported via drivers using a simple 48Attributes of devices can be exported by a device driver through sysfs.
49procfs-like interface.
50 49
51Please see Documentation/filesystems/sysfs.txt for more information 50Please see Documentation/filesystems/sysfs.txt for more information
52on how sysfs works. 51on how sysfs works.
53 52
53As explained in Documentation/kobject.txt, device attributes must be be
54created before the KOBJ_ADD uevent is generated. The only way to realize
55that is by defining an attribute group.
56
54Attributes are declared using a macro called DEVICE_ATTR: 57Attributes are declared using a macro called DEVICE_ATTR:
55 58
56#define DEVICE_ATTR(name,mode,show,store) 59#define DEVICE_ATTR(name,mode,show,store)
57 60
58Example: 61Example:
59 62
60DEVICE_ATTR(power,0644,show_power,store_power); 63static DEVICE_ATTR(type, 0444, show_type, NULL);
64static DEVICE_ATTR(power, 0644, show_power, store_power);
61 65
62This declares a structure of type struct device_attribute named 66This declares two structures of type struct device_attribute with respective
63'dev_attr_power'. This can then be added and removed to the device's 67names 'dev_attr_type' and 'dev_attr_power'. These two attributes can be
64directory using: 68organized as follows into a group:
65 69
66int device_create_file(struct device *device, struct device_attribute * entry); 70static struct attribute *dev_attrs[] = {
67void device_remove_file(struct device * dev, struct device_attribute * attr); 71 &dev_attr_type.attr,
72 &dev_attr_power.attr,
73 NULL,
74};
68 75
69Example: 76static struct attribute_group dev_attr_group = {
77 .attrs = dev_attrs,
78};
79
80static const struct attribute_group *dev_attr_groups[] = {
81 &dev_attr_group,
82 NULL,
83};
84
85This array of groups can then be associated with a device by setting the
86group pointer in struct device before device_register() is invoked:
70 87
71device_create_file(dev,&dev_attr_power); 88 dev->groups = dev_attr_groups;
72device_remove_file(dev,&dev_attr_power); 89 device_register(dev);
73 90
74The file name will be 'power' with a mode of 0644 (-rw-r--r--). 91The device_register() function will use the 'groups' pointer to create the
92device attributes and the device_unregister() function will use this pointer
93to remove the device attributes.
75 94
76Word of warning: While the kernel allows device_create_file() and 95Word of warning: While the kernel allows device_create_file() and
77device_remove_file() to be called on a device at any time, userspace has 96device_remove_file() to be called on a device at any time, userspace has
@@ -84,24 +103,4 @@ not know about the new attributes.
84This is important for device driver that need to publish additional 103This is important for device driver that need to publish additional
85attributes for a device at driver probe time. If the device driver simply 104attributes for a device at driver probe time. If the device driver simply
86calls device_create_file() on the device structure passed to it, then 105calls device_create_file() on the device structure passed to it, then
87userspace will never be notified of the new attributes. Instead, it should 106userspace will never be notified of the new attributes.
88probably use class_create() and class->dev_attrs to set up a list of
89desired attributes in the modules_init function, and then in the .probe()
90hook, and then use device_create() to create a new device as a child
91of the probed device. The new device will generate a new uevent and
92properly advertise the new attributes to userspace.
93
94For example, if a driver wanted to add the following attributes:
95struct device_attribute mydriver_attribs[] = {
96 __ATTR(port_count, 0444, port_count_show),
97 __ATTR(serial_number, 0444, serial_number_show),
98 NULL
99};
100
101Then in the module init function is would do:
102 mydriver_class = class_create(THIS_MODULE, "my_attrs");
103 mydriver_class.dev_attr = mydriver_attribs;
104
105And assuming 'dev' is the struct device passed into the probe hook, the driver
106probe function would do something like:
107 device_create(&mydriver_class, dev, chrdev, &private_data, "my_name");
diff --git a/Documentation/filesystems/sysfs.txt b/Documentation/filesystems/sysfs.txt
index 597f728e7b4e..07235caec22c 100644
--- a/Documentation/filesystems/sysfs.txt
+++ b/Documentation/filesystems/sysfs.txt
@@ -4,7 +4,7 @@ sysfs - _The_ filesystem for exporting kernel objects.
4Patrick Mochel <mochel@osdl.org> 4Patrick Mochel <mochel@osdl.org>
5Mike Murphy <mamurph@cs.clemson.edu> 5Mike Murphy <mamurph@cs.clemson.edu>
6 6
7Revised: 15 July 2010 7Revised: 16 August 2011
8Original: 10 January 2003 8Original: 10 January 2003
9 9
10 10
@@ -370,3 +370,11 @@ int driver_create_file(struct device_driver *, const struct driver_attribute *);
370void driver_remove_file(struct device_driver *, const struct driver_attribute *); 370void driver_remove_file(struct device_driver *, const struct driver_attribute *);
371 371
372 372
373Documentation
374~~~~~~~~~~~~~
375
376The sysfs directory structure and the attributes in each directory define an
377ABI between the kernel and user space. As for any ABI, it is important that
378this ABI is stable and properly documented. All new sysfs attributes must be
379documented in Documentation/ABI. See also Documentation/ABI/README for more
380information.
diff --git a/Documentation/stable_kernel_rules.txt b/Documentation/stable_kernel_rules.txt
index e213f45cf9d7..21fd05c28e73 100644
--- a/Documentation/stable_kernel_rules.txt
+++ b/Documentation/stable_kernel_rules.txt
@@ -24,10 +24,10 @@ Rules on what kind of patches are accepted, and which ones are not, into the
24Procedure for submitting patches to the -stable tree: 24Procedure for submitting patches to the -stable tree:
25 25
26 - Send the patch, after verifying that it follows the above rules, to 26 - Send the patch, after verifying that it follows the above rules, to
27 stable@kernel.org. You must note the upstream commit ID in the changelog 27 stable@vger.kernel.org. You must note the upstream commit ID in the
28 of your submission. 28 changelog of your submission.
29 - To have the patch automatically included in the stable tree, add the tag 29 - To have the patch automatically included in the stable tree, add the tag
30 Cc: stable@kernel.org 30 Cc: stable@vger.kernel.org
31 in the sign-off area. Once the patch is merged it will be applied to 31 in the sign-off area. Once the patch is merged it will be applied to
32 the stable tree without anything else needing to be done by the author 32 the stable tree without anything else needing to be done by the author
33 or subsystem maintainer. 33 or subsystem maintainer.
@@ -35,10 +35,10 @@ Procedure for submitting patches to the -stable tree:
35 cherry-picked than this can be specified in the following format in 35 cherry-picked than this can be specified in the following format in
36 the sign-off area: 36 the sign-off area:
37 37
38 Cc: <stable@kernel.org> # .32.x: a1f84a3: sched: Check for idle 38 Cc: <stable@vger.kernel.org> # .32.x: a1f84a3: sched: Check for idle
39 Cc: <stable@kernel.org> # .32.x: 1b9508f: sched: Rate-limit newidle 39 Cc: <stable@vger.kernel.org> # .32.x: 1b9508f: sched: Rate-limit newidle
40 Cc: <stable@kernel.org> # .32.x: fd21073: sched: Fix affinity logic 40 Cc: <stable@vger.kernel.org> # .32.x: fd21073: sched: Fix affinity logic
41 Cc: <stable@kernel.org> # .32.x 41 Cc: <stable@vger.kernel.org> # .32.x
42 Signed-off-by: Ingo Molnar <mingo@elte.hu> 42 Signed-off-by: Ingo Molnar <mingo@elte.hu>
43 43
44 The tag sequence has the meaning of: 44 The tag sequence has the meaning of:
diff --git a/Documentation/zh_CN/SubmitChecklist b/Documentation/zh_CN/SubmitChecklist
deleted file mode 100644
index 4c741d6bc048..000000000000
--- a/Documentation/zh_CN/SubmitChecklist
+++ /dev/null
@@ -1,109 +0,0 @@
1Chinese translated version of Documentation/SubmitChecklist
2
3If you have any comment or update to the content, please contact the
4original document maintainer directly. However, if you have a problem
5communicating in English you can also ask the Chinese maintainer for
6help. Contact the Chinese maintainer if this translation is outdated
7or if there is a problem with the translation.
8
9Chinese maintainer: Harry Wei <harryxiyou@gmail.com>
10---------------------------------------------------------------------
11Documentation/SubmitChecklist µÄÖÐÎÄ·­Òë
12
13Èç¹ûÏëÆÀÂÛ»ò¸üб¾ÎĵÄÄÚÈÝ£¬ÇëÖ±½ÓÁªÏµÔ­ÎĵµµÄά»¤Õß¡£Èç¹ûÄãʹÓÃÓ¢ÎÄ
14½»Á÷ÓÐÀ§ÄѵĻ°£¬Ò²¿ÉÒÔÏòÖÐÎÄ°æά»¤ÕßÇóÖú¡£Èç¹û±¾·­Òë¸üв»¼°Ê±»òÕß·­
15Òë´æÔÚÎÊÌ⣬ÇëÁªÏµÖÐÎÄ°æά»¤Õß¡£
16
17ÖÐÎÄ°æά»¤Õߣº ¼ÖÍþÍþ Harry Wei <harryxiyou@gmail.com>
18ÖÐÎÄ°æ·­ÒëÕߣº ¼ÖÍþÍþ Harry Wei <harryxiyou@gmail.com>
19ÖÐÎÄ°æУÒëÕߣº ¼ÖÍþÍþ Harry Wei <harryxiyou@gmail.com>
20
21
22ÒÔÏÂΪÕýÎÄ
23---------------------------------------------------------------------
24LinuxÄÚºËÌá½»Çåµ¥
25~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
26
27ÕâÀïÓÐһЩÄں˿ª·¢ÕßÓ¦¸Ã×öµÄ»ù±¾ÊÂÇ飬Èç¹ûËûÃÇÏë¿´µ½×Ô¼ºµÄÄں˲¹¶¡Ìá½»
28±»½ÓÊܵĸü¿ì¡£
29
30ÕâЩ¶¼Êdz¬³öDocumentation/SubmittingPatchesÎĵµÀïËùÌṩµÄÒÔ¼°ÆäËû
31¹ØÓÚÌá½»LinuxÄں˲¹¶¡µÄ˵Ã÷¡£
32
331£ºÈç¹ûÄãʹÓÃÁËÒ»¸ö¹¦ÄÜÄÇô¾Í#include¶¨Òå/ÉùÃ÷ÄǸö¹¦ÄܵÄÄǸöÎļþ¡£
34 ²»ÒªÒÀ¿¿ÆäËû¼ä½ÓÒýÈ붨Òå/ÉùÃ÷ÄǸö¹¦ÄܵÄÍ·Îļþ¡£
35
362£º¹¹½¨¼ò½àÊÊÓûòÕ߸ü¸ÄCONFIGÑ¡Ïî =y£¬=m£¬»òÕß=n¡£
37 ²»ÒªÓбàÒ뾯¸æ/´íÎó£¬ ²»ÒªÓÐÁ´½Ó¾¯¸æ/´íÎó¡£
38
392b£ºÍ¨¹ý allnoconfig, allmodconfig
40
412c£ºµ±Ê¹Óà 0=builddir ³É¹¦µØ¹¹½¨
42
433£ºÍ¨¹ýʹÓñ¾µØ½»²æ±àÒ빤¾ß»òÕßÆäËûһЩ¹¹½¨²úËù£¬ÔÚ¶àCPU¿ò¼ÜÉϹ¹½¨¡£
44
454£ºppc64 ÊÇÒ»¸öºÜºÃµÄ¼ì²é½»²æ±àÒëµÄ¿ò¼Ü£¬ÒòΪËüÍùÍù°Ñ¡®unsigned long¡¯
46 µ±64λֵÀ´Ê¹Óá£
47
485£º°´ÕÕDocumentation/CodingStyleÎļþÀïµÄÏêϸÃèÊö£¬¼ì²éÄã²¹¶¡µÄÕûÌå·ç¸ñ¡£
49 ʹÓò¹¶¡·ç¸ñ¼ì²éËöËéµÄÎ¥¹æ(scripts/checkpatch.pl)£¬ÉóºËÔ±ÓÅÏÈÌá½»¡£
50 ÄãÓ¦¸Ãµ÷ÕûÒÅÁôÔÚÄã²¹¶¡ÖеÄËùÓÐÎ¥¹æ¡£
51
526£ºÈκθüлòÕ߸Ķ¯CONFIGÑ¡Ï²»ÄÜ´òÂÒÅäÖò˵¥¡£
53
547£ºËùÓеÄKconfigÑ¡Ïî¸üж¼ÒªÓÐ˵Ã÷ÎÄ×Ö¡£
55
568£ºÒѾ­ÈÏÕæµØ×ܽáÁËÏà¹ØµÄKconfig×éºÏ¡£ÕâÊǺÜÄÑͨ¹ý²âÊÔ×öºÃµÄ--ÄÔÁ¦ÔÚÕâÀïϽµ¡£
57
589£º¼ì²é¾ßÓмò½àÐÔ¡£
59
6010£ºÊ¹ÓÃ'make checkstack'ºÍ'make namespacecheck'¼ì²é£¬È»ºóÐÞ¸ÄËùÕÒµ½µÄÎÊÌâ¡£
61 ×¢Ò⣺¶ÑÕ»¼ì²é²»»áÃ÷È·µØ³öÏÖÎÊÌ⣬µ«ÊÇÈκεÄÒ»¸öº¯ÊýÔÚ¶ÑÕ»ÉÏʹÓöàÓÚ512×Ö½Ú
62 ¶¼Òª×¼±¸Ð޸ġ£
63
6411£º°üº¬kernel-docµ½È«¾ÖÄÚºËAPIsÎļþ¡££¨²»ÒªÇó¾²Ì¬µÄº¯Êý£¬µ«ÊÇ°üº¬Ò²ÎÞËùν¡££©
65 ʹÓÃ'make htmldocs'»òÕß'make mandocs'À´¼ì²ékernel-doc£¬È»ºóÐÞ¸ÄÈκÎ
66 ·¢ÏÖµÄÎÊÌâ¡£
67
6812£ºÒѾ­Í¨¹ýCONFIG_PREEMPT, CONFIG_DEBUG_PREEMPT,
69 CONFIG_DEBUG_SLAB, CONFIG_DEBUG_PAGEALLOC, CONFIG_DEBUG_MUTEXES,
70 CONFIG_DEBUG_SPINLOCK, CONFIG_DEBUG_ATOMIC_SLEEP²âÊÔ£¬²¢ÇÒͬʱ¶¼
71 ʹÄÜ¡£
72
7313£ºÒѾ­¶¼¹¹½¨²¢ÇÒʹÓûòÕß²»Ê¹Óà CONFIG_SMP ºÍ CONFIG_PREEMPT²âÊÔÖ´ÐÐʱ¼ä¡£
74
7514£ºÈç¹û²¹¶¡Ó°ÏìIO/Disk£¬µÈµÈ£ºÒѾ­Í¨¹ýʹÓûòÕß²»Ê¹Óà CONFIG_LBDAF ²âÊÔ¡£
76
7715£ºËùÓеÄcodepathsÒѾ­ÐÐʹËùÓÐlockdepÆôÓù¦ÄÜ¡£
78
7916£ºËùÓеÄ/proc¼Ç¼¸üж¼Òª×÷³ÉÎļþ·ÅÔÚDocumentation/Ŀ¼Ï¡£
80
8117£ºËùÓеÄÄÚºËÆô¶¯²ÎÊý¸üж¼±»¼Ç¼µ½Documentation/kernel-parameters.txtÎļþÖС£
82
8318£ºËùÓеÄÄ£¿é²ÎÊý¸üж¼ÓÃMODULE_PARM_DESC()¼Ç¼¡£
84
8519£ºËùÓеÄÓû§¿Õ¼ä½Ó¿Ú¸üж¼±»¼Ç¼µ½Documentation/ABI/¡£²é¿´Documentation/ABI/README
86 ¿ÉÒÔ»ñµÃ¸ü¶àµÄÐÅÏ¢¡£¸Ä±äÓû§¿Õ¼ä½Ó¿ÚµÄ²¹¶¡Ó¦¸Ã±»Óʼþ³­Ë͸ølinux-api@vger.kernel.org¡£
87
8820£º¼ì²éËüÊDz»ÊǶ¼Í¨¹ý`make headers_check'¡£
89
9021£ºÒѾ­Í¨¹ýÖÁÉÙÒýÈëslabºÍpage-allocationʧ°Ü¼ì²é¡£²é¿´Documentation/fault-injection/¡£
91
9222£ºÐ¼ÓÈëµÄÔ´ÂëÒѾ­Í¨¹ý`gcc -W'£¨Ê¹ÓÃ"make EXTRA_CFLAGS=-W"£©±àÒë¡£ÕâÑù½«²úÉúºÜ¶à·³ÄÕ£¬
93 µ«ÊǶÔÓÚÑ°ÕÒ©¶´ºÜÓÐÒæ´¦£¬ÀýÈç:"warning: comparison between signed and unsigned"¡£
94
9523£ºµ±Ëü±»ºÏ²¢µ½-mm²¹¶¡¼¯ºóÔÙ²âÊÔ£¬ÓÃÀ´È·¶¨ËüÊÇ·ñ»¹ºÍ²¹¶¡¶ÓÁÐÖеÄÆäËû²¹¶¡Ò»Æð¹¤×÷ÒÔ¼°ÔÚVM£¬VFS
96 ºÍÆäËû×ÓϵͳÖи÷¸ö±ä»¯¡£
97
9824£ºËùÓеÄÄÚ´æÆÁÕÏ{e.g., barrier(), rmb(), wmb()}ÐèÒªÔÚÔ´´úÂëÖеÄÒ»¸ö×¢ÊÍÀ´½âÊÍËûÃǶ¼ÊǸÉʲôµÄ
99 ÒÔ¼°Ô­Òò¡£
100
10125£ºÈç¹ûÓÐÈκÎÊäÈëÊä³ö¿ØÖƵIJ¹¶¡±»Ìí¼Ó£¬Ò²Òª¸üÐÂDocumentation/ioctl/ioctl-number.txt¡£
102
10326£ºÈç¹ûÄãµÄ¸ü¸Ä´úÂëÒÀ¿¿»òÕßʹÓÃÈκεÄÄÚºËAPIs»òÕßÓëÏÂÃæµÄkconfig·ûºÅÓйØϵµÄ¹¦ÄÜ£¬Äã¾ÍÒª
104 ʹÓÃÏà¹ØµÄkconfig·ûºÅ¹Ø±Õ£¬ and/or =m£¨Èç¹ûÑ¡ÏîÌṩ£©[ÔÚͬһʱ¼ä²»ÊÇËùÓõĶ¼ÆôÓ㬽ö½ö¸÷¸ö»òÕß×ÔÓÉ
105 ×éºÏËûÃÇ]£º
106
107 CONFIG_SMP, CONFIG_SYSFS, CONFIG_PROC_FS, CONFIG_INPUT, CONFIG_PCI,
108 CONFIG_BLOCK, CONFIG_PM, CONFIG_HOTPLUG, CONFIG_MAGIC_SYSRQ,
109 CONFIG_NET, CONFIG_INET=n (ºóÒ»¸öʹÓà CONFIG_NET=y)
diff --git a/MAINTAINERS b/MAINTAINERS
index 5ccf370e052b..e1b0c92b48fc 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -2294,6 +2294,12 @@ L: netdev@vger.kernel.org
2294S: Maintained 2294S: Maintained
2295F: drivers/net/wan/dscc4.c 2295F: drivers/net/wan/dscc4.c
2296 2296
2297DYNAMIC DEBUG
2298M: Jason Baron <jbaron@redhat.com>
2299S: Maintained
2300F: lib/dynamic_debug.c
2301F: include/linux/dynamic_debug.h
2302
2297DZ DECSTATION DZ11 SERIAL DRIVER 2303DZ DECSTATION DZ11 SERIAL DRIVER
2298M: "Maciej W. Rozycki" <macro@linux-mips.org> 2304M: "Maciej W. Rozycki" <macro@linux-mips.org>
2299S: Maintained 2305S: Maintained
diff --git a/arch/arm/plat-mxc/devices.c b/arch/arm/plat-mxc/devices.c
index 0d6ed31bdbf2..a34b2ae895f2 100644
--- a/arch/arm/plat-mxc/devices.c
+++ b/arch/arm/plat-mxc/devices.c
@@ -37,59 +37,6 @@ int __init mxc_register_device(struct platform_device *pdev, void *data)
37 return ret; 37 return ret;
38} 38}
39 39
40struct platform_device *__init imx_add_platform_device_dmamask(
41 const char *name, int id,
42 const struct resource *res, unsigned int num_resources,
43 const void *data, size_t size_data, u64 dmamask)
44{
45 int ret = -ENOMEM;
46 struct platform_device *pdev;
47
48 pdev = platform_device_alloc(name, id);
49 if (!pdev)
50 goto err;
51
52 if (dmamask) {
53 /*
54 * This memory isn't freed when the device is put,
55 * I don't have a nice idea for that though. Conceptually
56 * dma_mask in struct device should not be a pointer.
57 * See http://thread.gmane.org/gmane.linux.kernel.pci/9081
58 */
59 pdev->dev.dma_mask =
60 kmalloc(sizeof(*pdev->dev.dma_mask), GFP_KERNEL);
61 if (!pdev->dev.dma_mask)
62 /* ret is still -ENOMEM; */
63 goto err;
64
65 *pdev->dev.dma_mask = dmamask;
66 pdev->dev.coherent_dma_mask = dmamask;
67 }
68
69 if (res) {
70 ret = platform_device_add_resources(pdev, res, num_resources);
71 if (ret)
72 goto err;
73 }
74
75 if (data) {
76 ret = platform_device_add_data(pdev, data, size_data);
77 if (ret)
78 goto err;
79 }
80
81 ret = platform_device_add(pdev);
82 if (ret) {
83err:
84 if (dmamask)
85 kfree(pdev->dev.dma_mask);
86 platform_device_put(pdev);
87 return ERR_PTR(ret);
88 }
89
90 return pdev;
91}
92
93struct device mxc_aips_bus = { 40struct device mxc_aips_bus = {
94 .init_name = "mxc_aips", 41 .init_name = "mxc_aips",
95 .parent = &platform_bus, 42 .parent = &platform_bus,
diff --git a/arch/arm/plat-mxc/include/mach/devices-common.h b/arch/arm/plat-mxc/include/mach/devices-common.h
index 524538aabc4b..543525d76a60 100644
--- a/arch/arm/plat-mxc/include/mach/devices-common.h
+++ b/arch/arm/plat-mxc/include/mach/devices-common.h
@@ -14,10 +14,22 @@
14extern struct device mxc_aips_bus; 14extern struct device mxc_aips_bus;
15extern struct device mxc_ahb_bus; 15extern struct device mxc_ahb_bus;
16 16
17struct platform_device *imx_add_platform_device_dmamask( 17static inline struct platform_device *imx_add_platform_device_dmamask(
18 const char *name, int id, 18 const char *name, int id,
19 const struct resource *res, unsigned int num_resources, 19 const struct resource *res, unsigned int num_resources,
20 const void *data, size_t size_data, u64 dmamask); 20 const void *data, size_t size_data, u64 dmamask)
21{
22 struct platform_device_info pdevinfo = {
23 .name = name,
24 .id = id,
25 .res = res,
26 .num_res = num_resources,
27 .data = data,
28 .size_data = size_data,
29 .dma_mask = dmamask,
30 };
31 return platform_device_register_full(&pdevinfo);
32}
21 33
22static inline struct platform_device *imx_add_platform_device( 34static inline struct platform_device *imx_add_platform_device(
23 const char *name, int id, 35 const char *name, int id,
diff --git a/drivers/base/core.c b/drivers/base/core.c
index bc8729d603a7..82c865452c70 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -1764,8 +1764,8 @@ void device_shutdown(void)
1764 1764
1765#ifdef CONFIG_PRINTK 1765#ifdef CONFIG_PRINTK
1766 1766
1767static int __dev_printk(const char *level, const struct device *dev, 1767int __dev_printk(const char *level, const struct device *dev,
1768 struct va_format *vaf) 1768 struct va_format *vaf)
1769{ 1769{
1770 if (!dev) 1770 if (!dev)
1771 return printk("%s(NULL device *): %pV", level, vaf); 1771 return printk("%s(NULL device *): %pV", level, vaf);
@@ -1773,6 +1773,7 @@ static int __dev_printk(const char *level, const struct device *dev,
1773 return printk("%s%s %s: %pV", 1773 return printk("%s%s %s: %pV",
1774 level, dev_driver_string(dev), dev_name(dev), vaf); 1774 level, dev_driver_string(dev), dev_name(dev), vaf);
1775} 1775}
1776EXPORT_SYMBOL(__dev_printk);
1776 1777
1777int dev_printk(const char *level, const struct device *dev, 1778int dev_printk(const char *level, const struct device *dev,
1778 const char *fmt, ...) 1779 const char *fmt, ...)
diff --git a/drivers/base/dd.c b/drivers/base/dd.c
index 6658da743c3a..142e3d600f14 100644
--- a/drivers/base/dd.c
+++ b/drivers/base/dd.c
@@ -147,6 +147,9 @@ probe_failed:
147 printk(KERN_WARNING 147 printk(KERN_WARNING
148 "%s: probe of %s failed with error %d\n", 148 "%s: probe of %s failed with error %d\n",
149 drv->name, dev_name(dev), ret); 149 drv->name, dev_name(dev), ret);
150 } else {
151 pr_debug("%s: probe of %s rejects match %d\n",
152 drv->name, dev_name(dev), ret);
150 } 153 }
151 /* 154 /*
152 * Ignore errors returned by ->probe so that the next driver can try 155 * Ignore errors returned by ->probe so that the next driver can try
diff --git a/drivers/base/memory.c b/drivers/base/memory.c
index 2840ed4668c1..8272d92d22c0 100644
--- a/drivers/base/memory.c
+++ b/drivers/base/memory.c
@@ -224,13 +224,48 @@ int memory_isolate_notify(unsigned long val, void *v)
224} 224}
225 225
226/* 226/*
227 * The probe routines leave the pages reserved, just as the bootmem code does.
228 * Make sure they're still that way.
229 */
230static bool pages_correctly_reserved(unsigned long start_pfn,
231 unsigned long nr_pages)
232{
233 int i, j;
234 struct page *page;
235 unsigned long pfn = start_pfn;
236
237 /*
238 * memmap between sections is not contiguous except with
239 * SPARSEMEM_VMEMMAP. We lookup the page once per section
240 * and assume memmap is contiguous within each section
241 */
242 for (i = 0; i < sections_per_block; i++, pfn += PAGES_PER_SECTION) {
243 if (WARN_ON_ONCE(!pfn_valid(pfn)))
244 return false;
245 page = pfn_to_page(pfn);
246
247 for (j = 0; j < PAGES_PER_SECTION; j++) {
248 if (PageReserved(page + j))
249 continue;
250
251 printk(KERN_WARNING "section number %ld page number %d "
252 "not reserved, was it already online?\n",
253 pfn_to_section_nr(pfn), j);
254
255 return false;
256 }
257 }
258
259 return true;
260}
261
262/*
227 * MEMORY_HOTPLUG depends on SPARSEMEM in mm/Kconfig, so it is 263 * MEMORY_HOTPLUG depends on SPARSEMEM in mm/Kconfig, so it is
228 * OK to have direct references to sparsemem variables in here. 264 * OK to have direct references to sparsemem variables in here.
229 */ 265 */
230static int 266static int
231memory_block_action(unsigned long phys_index, unsigned long action) 267memory_block_action(unsigned long phys_index, unsigned long action)
232{ 268{
233 int i;
234 unsigned long start_pfn, start_paddr; 269 unsigned long start_pfn, start_paddr;
235 unsigned long nr_pages = PAGES_PER_SECTION * sections_per_block; 270 unsigned long nr_pages = PAGES_PER_SECTION * sections_per_block;
236 struct page *first_page; 271 struct page *first_page;
@@ -238,26 +273,13 @@ memory_block_action(unsigned long phys_index, unsigned long action)
238 273
239 first_page = pfn_to_page(phys_index << PFN_SECTION_SHIFT); 274 first_page = pfn_to_page(phys_index << PFN_SECTION_SHIFT);
240 275
241 /*
242 * The probe routines leave the pages reserved, just
243 * as the bootmem code does. Make sure they're still
244 * that way.
245 */
246 if (action == MEM_ONLINE) {
247 for (i = 0; i < nr_pages; i++) {
248 if (PageReserved(first_page+i))
249 continue;
250
251 printk(KERN_WARNING "section number %ld page number %d "
252 "not reserved, was it already online?\n",
253 phys_index, i);
254 return -EBUSY;
255 }
256 }
257
258 switch (action) { 276 switch (action) {
259 case MEM_ONLINE: 277 case MEM_ONLINE:
260 start_pfn = page_to_pfn(first_page); 278 start_pfn = page_to_pfn(first_page);
279
280 if (!pages_correctly_reserved(start_pfn, nr_pages))
281 return -EBUSY;
282
261 ret = online_pages(start_pfn, nr_pages); 283 ret = online_pages(start_pfn, nr_pages);
262 break; 284 break;
263 case MEM_OFFLINE: 285 case MEM_OFFLINE:
@@ -380,9 +402,13 @@ memory_probe_store(struct class *class, struct class_attribute *attr,
380 u64 phys_addr; 402 u64 phys_addr;
381 int nid; 403 int nid;
382 int i, ret; 404 int i, ret;
405 unsigned long pages_per_block = PAGES_PER_SECTION * sections_per_block;
383 406
384 phys_addr = simple_strtoull(buf, NULL, 0); 407 phys_addr = simple_strtoull(buf, NULL, 0);
385 408
409 if (phys_addr & ((pages_per_block << PAGE_SHIFT) - 1))
410 return -EINVAL;
411
386 for (i = 0; i < sections_per_block; i++) { 412 for (i = 0; i < sections_per_block; i++) {
387 nid = memory_add_physaddr_to_nid(phys_addr); 413 nid = memory_add_physaddr_to_nid(phys_addr);
388 ret = add_memory(nid, phys_addr, 414 ret = add_memory(nid, phys_addr,
diff --git a/drivers/base/platform.c b/drivers/base/platform.c
index 99a5272d7c2f..7a24895543e7 100644
--- a/drivers/base/platform.c
+++ b/drivers/base/platform.c
@@ -375,52 +375,64 @@ void platform_device_unregister(struct platform_device *pdev)
375EXPORT_SYMBOL_GPL(platform_device_unregister); 375EXPORT_SYMBOL_GPL(platform_device_unregister);
376 376
377/** 377/**
378 * platform_device_register_resndata - add a platform-level device with 378 * platform_device_register_full - add a platform-level device with
379 * resources and platform-specific data 379 * resources and platform-specific data
380 * 380 *
381 * @parent: parent device for the device we're adding 381 * @pdevinfo: data used to create device
382 * @name: base name of the device we're adding
383 * @id: instance id
384 * @res: set of resources that needs to be allocated for the device
385 * @num: number of resources
386 * @data: platform specific data for this platform device
387 * @size: size of platform specific data
388 * 382 *
389 * Returns &struct platform_device pointer on success, or ERR_PTR() on error. 383 * Returns &struct platform_device pointer on success, or ERR_PTR() on error.
390 */ 384 */
391struct platform_device *platform_device_register_resndata( 385struct platform_device *platform_device_register_full(
392 struct device *parent, 386 struct platform_device_info *pdevinfo)
393 const char *name, int id,
394 const struct resource *res, unsigned int num,
395 const void *data, size_t size)
396{ 387{
397 int ret = -ENOMEM; 388 int ret = -ENOMEM;
398 struct platform_device *pdev; 389 struct platform_device *pdev;
399 390
400 pdev = platform_device_alloc(name, id); 391 pdev = platform_device_alloc(pdevinfo->name, pdevinfo->id);
401 if (!pdev) 392 if (!pdev)
402 goto err; 393 goto err_alloc;
403 394
404 pdev->dev.parent = parent; 395 pdev->dev.parent = pdevinfo->parent;
396
397 if (pdevinfo->dma_mask) {
398 /*
399 * This memory isn't freed when the device is put,
400 * I don't have a nice idea for that though. Conceptually
401 * dma_mask in struct device should not be a pointer.
402 * See http://thread.gmane.org/gmane.linux.kernel.pci/9081
403 */
404 pdev->dev.dma_mask =
405 kmalloc(sizeof(*pdev->dev.dma_mask), GFP_KERNEL);
406 if (!pdev->dev.dma_mask)
407 goto err;
408
409 *pdev->dev.dma_mask = pdevinfo->dma_mask;
410 pdev->dev.coherent_dma_mask = pdevinfo->dma_mask;
411 }
405 412
406 ret = platform_device_add_resources(pdev, res, num); 413 ret = platform_device_add_resources(pdev,
414 pdevinfo->res, pdevinfo->num_res);
407 if (ret) 415 if (ret)
408 goto err; 416 goto err;
409 417
410 ret = platform_device_add_data(pdev, data, size); 418 ret = platform_device_add_data(pdev,
419 pdevinfo->data, pdevinfo->size_data);
411 if (ret) 420 if (ret)
412 goto err; 421 goto err;
413 422
414 ret = platform_device_add(pdev); 423 ret = platform_device_add(pdev);
415 if (ret) { 424 if (ret) {
416err: 425err:
426 kfree(pdev->dev.dma_mask);
427
428err_alloc:
417 platform_device_put(pdev); 429 platform_device_put(pdev);
418 return ERR_PTR(ret); 430 return ERR_PTR(ret);
419 } 431 }
420 432
421 return pdev; 433 return pdev;
422} 434}
423EXPORT_SYMBOL_GPL(platform_device_register_resndata); 435EXPORT_SYMBOL_GPL(platform_device_register_full);
424 436
425static int platform_drv_probe(struct device *_dev) 437static int platform_drv_probe(struct device *_dev)
426{ 438{
@@ -614,7 +626,7 @@ static int platform_uevent(struct device *dev, struct kobj_uevent_env *env)
614 return rc; 626 return rc;
615 627
616 add_uevent_var(env, "MODALIAS=%s%s", PLATFORM_MODULE_PREFIX, 628 add_uevent_var(env, "MODALIAS=%s%s", PLATFORM_MODULE_PREFIX,
617 (pdev->id_entry) ? pdev->id_entry->name : pdev->name); 629 pdev->name);
618 return 0; 630 return 0;
619} 631}
620 632
diff --git a/drivers/misc/pch_phub.c b/drivers/misc/pch_phub.c
index 0fd7e77bee29..dee33addcaeb 100644
--- a/drivers/misc/pch_phub.c
+++ b/drivers/misc/pch_phub.c
@@ -90,6 +90,7 @@
90#define PCH_PHUB_INTPIN_REG_WPERMIT_REG3 0x002C 90#define PCH_PHUB_INTPIN_REG_WPERMIT_REG3 0x002C
91#define PCH_PHUB_INT_REDUCE_CONTROL_REG_BASE 0x0040 91#define PCH_PHUB_INT_REDUCE_CONTROL_REG_BASE 0x0040
92#define CLKCFG_REG_OFFSET 0x500 92#define CLKCFG_REG_OFFSET 0x500
93#define FUNCSEL_REG_OFFSET 0x508
93 94
94#define PCH_PHUB_OROM_SIZE 15360 95#define PCH_PHUB_OROM_SIZE 15360
95 96
@@ -108,6 +109,7 @@
108 * @intpin_reg_wpermit_reg3: INTPIN_REG_WPERMIT register 3 val 109 * @intpin_reg_wpermit_reg3: INTPIN_REG_WPERMIT register 3 val
109 * @int_reduce_control_reg: INT_REDUCE_CONTROL registers val 110 * @int_reduce_control_reg: INT_REDUCE_CONTROL registers val
110 * @clkcfg_reg: CLK CFG register val 111 * @clkcfg_reg: CLK CFG register val
112 * @funcsel_reg: Function select register value
111 * @pch_phub_base_address: Register base address 113 * @pch_phub_base_address: Register base address
112 * @pch_phub_extrom_base_address: external rom base address 114 * @pch_phub_extrom_base_address: external rom base address
113 * @pch_mac_start_address: MAC address area start address 115 * @pch_mac_start_address: MAC address area start address
@@ -128,6 +130,7 @@ struct pch_phub_reg {
128 u32 intpin_reg_wpermit_reg3; 130 u32 intpin_reg_wpermit_reg3;
129 u32 int_reduce_control_reg[MAX_NUM_INT_REDUCE_CONTROL_REG]; 131 u32 int_reduce_control_reg[MAX_NUM_INT_REDUCE_CONTROL_REG];
130 u32 clkcfg_reg; 132 u32 clkcfg_reg;
133 u32 funcsel_reg;
131 void __iomem *pch_phub_base_address; 134 void __iomem *pch_phub_base_address;
132 void __iomem *pch_phub_extrom_base_address; 135 void __iomem *pch_phub_extrom_base_address;
133 u32 pch_mac_start_address; 136 u32 pch_mac_start_address;
@@ -211,6 +214,8 @@ static void pch_phub_save_reg_conf(struct pci_dev *pdev)
211 __func__, i, chip->int_reduce_control_reg[i]); 214 __func__, i, chip->int_reduce_control_reg[i]);
212 } 215 }
213 chip->clkcfg_reg = ioread32(p + CLKCFG_REG_OFFSET); 216 chip->clkcfg_reg = ioread32(p + CLKCFG_REG_OFFSET);
217 if ((chip->ioh_type == 2) || (chip->ioh_type == 4))
218 chip->funcsel_reg = ioread32(p + FUNCSEL_REG_OFFSET);
214} 219}
215 220
216/* pch_phub_restore_reg_conf - restore register configuration */ 221/* pch_phub_restore_reg_conf - restore register configuration */
@@ -271,6 +276,8 @@ static void pch_phub_restore_reg_conf(struct pci_dev *pdev)
271 } 276 }
272 277
273 iowrite32(chip->clkcfg_reg, p + CLKCFG_REG_OFFSET); 278 iowrite32(chip->clkcfg_reg, p + CLKCFG_REG_OFFSET);
279 if ((chip->ioh_type == 2) || (chip->ioh_type == 4))
280 iowrite32(chip->funcsel_reg, p + FUNCSEL_REG_OFFSET);
274} 281}
275 282
276/** 283/**
@@ -594,8 +601,7 @@ static ssize_t show_pch_mac(struct device *dev, struct device_attribute *attr,
594 601
595 pch_phub_read_gbe_mac_addr(chip, mac); 602 pch_phub_read_gbe_mac_addr(chip, mac);
596 603
597 return sprintf(buf, "%02x:%02x:%02x:%02x:%02x:%02x\n", 604 return sprintf(buf, "%pM\n", mac);
598 mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
599} 605}
600 606
601static ssize_t store_pch_mac(struct device *dev, struct device_attribute *attr, 607static ssize_t store_pch_mac(struct device *dev, struct device_attribute *attr,
diff --git a/drivers/uio/uio.c b/drivers/uio/uio.c
index d2efe823c20d..a783d533a1a6 100644
--- a/drivers/uio/uio.c
+++ b/drivers/uio/uio.c
@@ -69,7 +69,7 @@ static ssize_t map_name_show(struct uio_mem *mem, char *buf)
69 69
70static ssize_t map_addr_show(struct uio_mem *mem, char *buf) 70static ssize_t map_addr_show(struct uio_mem *mem, char *buf)
71{ 71{
72 return sprintf(buf, "0x%lx\n", mem->addr); 72 return sprintf(buf, "0x%llx\n", (unsigned long long)mem->addr);
73} 73}
74 74
75static ssize_t map_size_show(struct uio_mem *mem, char *buf) 75static ssize_t map_size_show(struct uio_mem *mem, char *buf)
@@ -79,7 +79,7 @@ static ssize_t map_size_show(struct uio_mem *mem, char *buf)
79 79
80static ssize_t map_offset_show(struct uio_mem *mem, char *buf) 80static ssize_t map_offset_show(struct uio_mem *mem, char *buf)
81{ 81{
82 return sprintf(buf, "0x%lx\n", mem->addr & ~PAGE_MASK); 82 return sprintf(buf, "0x%llx\n", (unsigned long long)mem->addr & ~PAGE_MASK);
83} 83}
84 84
85struct map_sysfs_entry { 85struct map_sysfs_entry {
@@ -634,8 +634,7 @@ static int uio_vma_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
634 if (idev->info->mem[mi].memtype == UIO_MEM_LOGICAL) 634 if (idev->info->mem[mi].memtype == UIO_MEM_LOGICAL)
635 page = virt_to_page(idev->info->mem[mi].addr + offset); 635 page = virt_to_page(idev->info->mem[mi].addr + offset);
636 else 636 else
637 page = vmalloc_to_page((void *)idev->info->mem[mi].addr 637 page = vmalloc_to_page((void *)(unsigned long)idev->info->mem[mi].addr + offset);
638 + offset);
639 get_page(page); 638 get_page(page);
640 vmf->page = page; 639 vmf->page = page;
641 return 0; 640 return 0;
@@ -750,14 +749,13 @@ static int uio_major_init(void)
750 749
751 uio_major = MAJOR(uio_dev); 750 uio_major = MAJOR(uio_dev);
752 uio_cdev = cdev; 751 uio_cdev = cdev;
753 result = 0; 752 return 0;
754out:
755 return result;
756out_put: 753out_put:
757 kobject_put(&cdev->kobj); 754 kobject_put(&cdev->kobj);
758out_unregister: 755out_unregister:
759 unregister_chrdev_region(uio_dev, UIO_MAX_DEVICES); 756 unregister_chrdev_region(uio_dev, UIO_MAX_DEVICES);
760 goto out; 757out:
758 return result;
761} 759}
762 760
763static void uio_major_cleanup(void) 761static void uio_major_cleanup(void)
diff --git a/drivers/uio/uio_pci_generic.c b/drivers/uio/uio_pci_generic.c
index fc22e1e6f215..02bd47bdee1c 100644
--- a/drivers/uio/uio_pci_generic.c
+++ b/drivers/uio/uio_pci_generic.c
@@ -24,7 +24,6 @@
24#include <linux/pci.h> 24#include <linux/pci.h>
25#include <linux/slab.h> 25#include <linux/slab.h>
26#include <linux/uio_driver.h> 26#include <linux/uio_driver.h>
27#include <linux/spinlock.h>
28 27
29#define DRIVER_VERSION "0.01.0" 28#define DRIVER_VERSION "0.01.0"
30#define DRIVER_AUTHOR "Michael S. Tsirkin <mst@redhat.com>" 29#define DRIVER_AUTHOR "Michael S. Tsirkin <mst@redhat.com>"
@@ -33,7 +32,6 @@
33struct uio_pci_generic_dev { 32struct uio_pci_generic_dev {
34 struct uio_info info; 33 struct uio_info info;
35 struct pci_dev *pdev; 34 struct pci_dev *pdev;
36 spinlock_t lock; /* guards command register accesses */
37}; 35};
38 36
39static inline struct uio_pci_generic_dev * 37static inline struct uio_pci_generic_dev *
@@ -57,7 +55,6 @@ static irqreturn_t irqhandler(int irq, struct uio_info *info)
57 BUILD_BUG_ON(PCI_COMMAND % 4); 55 BUILD_BUG_ON(PCI_COMMAND % 4);
58 BUILD_BUG_ON(PCI_COMMAND + 2 != PCI_STATUS); 56 BUILD_BUG_ON(PCI_COMMAND + 2 != PCI_STATUS);
59 57
60 spin_lock_irq(&gdev->lock);
61 pci_block_user_cfg_access(pdev); 58 pci_block_user_cfg_access(pdev);
62 59
63 /* Read both command and status registers in a single 32-bit operation. 60 /* Read both command and status registers in a single 32-bit operation.
@@ -83,7 +80,6 @@ static irqreturn_t irqhandler(int irq, struct uio_info *info)
83done: 80done:
84 81
85 pci_unblock_user_cfg_access(pdev); 82 pci_unblock_user_cfg_access(pdev);
86 spin_unlock_irq(&gdev->lock);
87 return ret; 83 return ret;
88} 84}
89 85
@@ -158,7 +154,6 @@ static int __devinit probe(struct pci_dev *pdev,
158 gdev->info.irq_flags = IRQF_SHARED; 154 gdev->info.irq_flags = IRQF_SHARED;
159 gdev->info.handler = irqhandler; 155 gdev->info.handler = irqhandler;
160 gdev->pdev = pdev; 156 gdev->pdev = pdev;
161 spin_lock_init(&gdev->lock);
162 157
163 if (uio_register_device(&pdev->dev, &gdev->info)) 158 if (uio_register_device(&pdev->dev, &gdev->info))
164 goto err_register; 159 goto err_register;
diff --git a/drivers/uio/uio_pdrv_genirq.c b/drivers/uio/uio_pdrv_genirq.c
index bae96d246760..0b2ed71e3bfa 100644
--- a/drivers/uio/uio_pdrv_genirq.c
+++ b/drivers/uio/uio_pdrv_genirq.c
@@ -253,7 +253,7 @@ static const struct dev_pm_ops uio_pdrv_genirq_dev_pm_ops = {
253}; 253};
254 254
255#ifdef CONFIG_OF 255#ifdef CONFIG_OF
256static const struct of_device_id __devinitconst uio_of_genirq_match[] = { 256static const struct of_device_id uio_of_genirq_match[] = {
257 { /* empty for now */ }, 257 { /* empty for now */ },
258}; 258};
259MODULE_DEVICE_TABLE(of, uio_of_genirq_match); 259MODULE_DEVICE_TABLE(of, uio_of_genirq_match);
diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c
index e7a7a2f07324..f3a257d7a985 100644
--- a/fs/debugfs/inode.c
+++ b/fs/debugfs/inode.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * file.c - part of debugfs, a tiny little debug file system 2 * inode.c - part of debugfs, a tiny little debug file system
3 * 3 *
4 * Copyright (C) 2004 Greg Kroah-Hartman <greg@kroah.com> 4 * Copyright (C) 2004 Greg Kroah-Hartman <greg@kroah.com>
5 * Copyright (C) 2004 IBM Inc. 5 * Copyright (C) 2004 IBM Inc.
diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c
index ea9120a830d8..83bb9d1f30aa 100644
--- a/fs/sysfs/dir.c
+++ b/fs/sysfs/dir.c
@@ -43,20 +43,48 @@ static DEFINE_IDA(sysfs_ino_ida);
43static void sysfs_link_sibling(struct sysfs_dirent *sd) 43static void sysfs_link_sibling(struct sysfs_dirent *sd)
44{ 44{
45 struct sysfs_dirent *parent_sd = sd->s_parent; 45 struct sysfs_dirent *parent_sd = sd->s_parent;
46 struct sysfs_dirent **pos;
47 46
48 BUG_ON(sd->s_sibling); 47 struct rb_node **p;
49 48 struct rb_node *parent;
50 /* Store directory entries in order by ino. This allows 49
51 * readdir to properly restart without having to add a 50 if (sysfs_type(sd) == SYSFS_DIR)
52 * cursor into the s_dir.children list. 51 parent_sd->s_dir.subdirs++;
53 */ 52
54 for (pos = &parent_sd->s_dir.children; *pos; pos = &(*pos)->s_sibling) { 53 p = &parent_sd->s_dir.inode_tree.rb_node;
55 if (sd->s_ino < (*pos)->s_ino) 54 parent = NULL;
56 break; 55 while (*p) {
56 parent = *p;
57#define node rb_entry(parent, struct sysfs_dirent, inode_node)
58 if (sd->s_ino < node->s_ino) {
59 p = &node->inode_node.rb_left;
60 } else if (sd->s_ino > node->s_ino) {
61 p = &node->inode_node.rb_right;
62 } else {
63 printk(KERN_CRIT "sysfs: inserting duplicate inode '%lx'\n",
64 (unsigned long) sd->s_ino);
65 BUG();
66 }
67#undef node
57 } 68 }
58 sd->s_sibling = *pos; 69 rb_link_node(&sd->inode_node, parent, p);
59 *pos = sd; 70 rb_insert_color(&sd->inode_node, &parent_sd->s_dir.inode_tree);
71
72 p = &parent_sd->s_dir.name_tree.rb_node;
73 parent = NULL;
74 while (*p) {
75 int c;
76 parent = *p;
77#define node rb_entry(parent, struct sysfs_dirent, name_node)
78 c = strcmp(sd->s_name, node->s_name);
79 if (c < 0) {
80 p = &node->name_node.rb_left;
81 } else {
82 p = &node->name_node.rb_right;
83 }
84#undef node
85 }
86 rb_link_node(&sd->name_node, parent, p);
87 rb_insert_color(&sd->name_node, &parent_sd->s_dir.name_tree);
60} 88}
61 89
62/** 90/**
@@ -71,16 +99,11 @@ static void sysfs_link_sibling(struct sysfs_dirent *sd)
71 */ 99 */
72static void sysfs_unlink_sibling(struct sysfs_dirent *sd) 100static void sysfs_unlink_sibling(struct sysfs_dirent *sd)
73{ 101{
74 struct sysfs_dirent **pos; 102 if (sysfs_type(sd) == SYSFS_DIR)
103 sd->s_parent->s_dir.subdirs--;
75 104
76 for (pos = &sd->s_parent->s_dir.children; *pos; 105 rb_erase(&sd->inode_node, &sd->s_parent->s_dir.inode_tree);
77 pos = &(*pos)->s_sibling) { 106 rb_erase(&sd->name_node, &sd->s_parent->s_dir.name_tree);
78 if (*pos == sd) {
79 *pos = sd->s_sibling;
80 sd->s_sibling = NULL;
81 break;
82 }
83 }
84} 107}
85 108
86/** 109/**
@@ -126,7 +149,6 @@ struct sysfs_dirent *sysfs_get_active(struct sysfs_dirent *sd)
126 */ 149 */
127void sysfs_put_active(struct sysfs_dirent *sd) 150void sysfs_put_active(struct sysfs_dirent *sd)
128{ 151{
129 struct completion *cmpl;
130 int v; 152 int v;
131 153
132 if (unlikely(!sd)) 154 if (unlikely(!sd))
@@ -138,10 +160,9 @@ void sysfs_put_active(struct sysfs_dirent *sd)
138 return; 160 return;
139 161
140 /* atomic_dec_return() is a mb(), we'll always see the updated 162 /* atomic_dec_return() is a mb(), we'll always see the updated
141 * sd->s_sibling. 163 * sd->u.completion.
142 */ 164 */
143 cmpl = (void *)sd->s_sibling; 165 complete(sd->u.completion);
144 complete(cmpl);
145} 166}
146 167
147/** 168/**
@@ -155,16 +176,16 @@ static void sysfs_deactivate(struct sysfs_dirent *sd)
155 DECLARE_COMPLETION_ONSTACK(wait); 176 DECLARE_COMPLETION_ONSTACK(wait);
156 int v; 177 int v;
157 178
158 BUG_ON(sd->s_sibling || !(sd->s_flags & SYSFS_FLAG_REMOVED)); 179 BUG_ON(!(sd->s_flags & SYSFS_FLAG_REMOVED));
159 180
160 if (!(sysfs_type(sd) & SYSFS_ACTIVE_REF)) 181 if (!(sysfs_type(sd) & SYSFS_ACTIVE_REF))
161 return; 182 return;
162 183
163 sd->s_sibling = (void *)&wait; 184 sd->u.completion = (void *)&wait;
164 185
165 rwsem_acquire(&sd->dep_map, 0, 0, _RET_IP_); 186 rwsem_acquire(&sd->dep_map, 0, 0, _RET_IP_);
166 /* atomic_add_return() is a mb(), put_active() will always see 187 /* atomic_add_return() is a mb(), put_active() will always see
167 * the updated sd->s_sibling. 188 * the updated sd->u.completion.
168 */ 189 */
169 v = atomic_add_return(SD_DEACTIVATED_BIAS, &sd->s_active); 190 v = atomic_add_return(SD_DEACTIVATED_BIAS, &sd->s_active);
170 191
@@ -173,8 +194,6 @@ static void sysfs_deactivate(struct sysfs_dirent *sd)
173 wait_for_completion(&wait); 194 wait_for_completion(&wait);
174 } 195 }
175 196
176 sd->s_sibling = NULL;
177
178 lock_acquired(&sd->dep_map, _RET_IP_); 197 lock_acquired(&sd->dep_map, _RET_IP_);
179 rwsem_release(&sd->dep_map, 1, _RET_IP_); 198 rwsem_release(&sd->dep_map, 1, _RET_IP_);
180} 199}
@@ -490,7 +509,7 @@ void sysfs_remove_one(struct sysfs_addrm_cxt *acxt, struct sysfs_dirent *sd)
490 } 509 }
491 510
492 sd->s_flags |= SYSFS_FLAG_REMOVED; 511 sd->s_flags |= SYSFS_FLAG_REMOVED;
493 sd->s_sibling = acxt->removed; 512 sd->u.removed_list = acxt->removed;
494 acxt->removed = sd; 513 acxt->removed = sd;
495} 514}
496 515
@@ -514,8 +533,7 @@ void sysfs_addrm_finish(struct sysfs_addrm_cxt *acxt)
514 while (acxt->removed) { 533 while (acxt->removed) {
515 struct sysfs_dirent *sd = acxt->removed; 534 struct sysfs_dirent *sd = acxt->removed;
516 535
517 acxt->removed = sd->s_sibling; 536 acxt->removed = sd->u.removed_list;
518 sd->s_sibling = NULL;
519 537
520 sysfs_deactivate(sd); 538 sysfs_deactivate(sd);
521 unmap_bin_file(sd); 539 unmap_bin_file(sd);
@@ -540,15 +558,36 @@ struct sysfs_dirent *sysfs_find_dirent(struct sysfs_dirent *parent_sd,
540 const void *ns, 558 const void *ns,
541 const unsigned char *name) 559 const unsigned char *name)
542{ 560{
543 struct sysfs_dirent *sd; 561 struct rb_node *p = parent_sd->s_dir.name_tree.rb_node;
562 struct sysfs_dirent *found = NULL;
563
564 while (p) {
565 int c;
566#define node rb_entry(p, struct sysfs_dirent, name_node)
567 c = strcmp(name, node->s_name);
568 if (c < 0) {
569 p = node->name_node.rb_left;
570 } else if (c > 0) {
571 p = node->name_node.rb_right;
572 } else {
573 found = node;
574 p = node->name_node.rb_left;
575 }
576#undef node
577 }
544 578
545 for (sd = parent_sd->s_dir.children; sd; sd = sd->s_sibling) { 579 if (found && ns) {
546 if (ns && sd->s_ns && (sd->s_ns != ns)) 580 while (found->s_ns && found->s_ns != ns) {
547 continue; 581 p = rb_next(&found->name_node);
548 if (!strcmp(sd->s_name, name)) 582 if (!p)
549 return sd; 583 return NULL;
584 found = rb_entry(p, struct sysfs_dirent, name_node);
585 if (strcmp(name, found->s_name))
586 return NULL;
587 }
550 } 588 }
551 return NULL; 589
590 return found;
552} 591}
553 592
554/** 593/**
@@ -744,21 +783,19 @@ void sysfs_remove_subdir(struct sysfs_dirent *sd)
744static void __sysfs_remove_dir(struct sysfs_dirent *dir_sd) 783static void __sysfs_remove_dir(struct sysfs_dirent *dir_sd)
745{ 784{
746 struct sysfs_addrm_cxt acxt; 785 struct sysfs_addrm_cxt acxt;
747 struct sysfs_dirent **pos; 786 struct rb_node *pos;
748 787
749 if (!dir_sd) 788 if (!dir_sd)
750 return; 789 return;
751 790
752 pr_debug("sysfs %s: removing dir\n", dir_sd->s_name); 791 pr_debug("sysfs %s: removing dir\n", dir_sd->s_name);
753 sysfs_addrm_start(&acxt, dir_sd); 792 sysfs_addrm_start(&acxt, dir_sd);
754 pos = &dir_sd->s_dir.children; 793 pos = rb_first(&dir_sd->s_dir.inode_tree);
755 while (*pos) { 794 while (pos) {
756 struct sysfs_dirent *sd = *pos; 795 struct sysfs_dirent *sd = rb_entry(pos, struct sysfs_dirent, inode_node);
757 796 pos = rb_next(pos);
758 if (sysfs_type(sd) != SYSFS_DIR) 797 if (sysfs_type(sd) != SYSFS_DIR)
759 sysfs_remove_one(&acxt, sd); 798 sysfs_remove_one(&acxt, sd);
760 else
761 pos = &(*pos)->s_sibling;
762 } 799 }
763 sysfs_addrm_finish(&acxt); 800 sysfs_addrm_finish(&acxt);
764 801
@@ -881,12 +918,28 @@ static struct sysfs_dirent *sysfs_dir_pos(const void *ns,
881 pos = NULL; 918 pos = NULL;
882 } 919 }
883 if (!pos && (ino > 1) && (ino < INT_MAX)) { 920 if (!pos && (ino > 1) && (ino < INT_MAX)) {
884 pos = parent_sd->s_dir.children; 921 struct rb_node *p = parent_sd->s_dir.inode_tree.rb_node;
885 while (pos && (ino > pos->s_ino)) 922 while (p) {
886 pos = pos->s_sibling; 923#define node rb_entry(p, struct sysfs_dirent, inode_node)
924 if (ino < node->s_ino) {
925 pos = node;
926 p = node->inode_node.rb_left;
927 } else if (ino > node->s_ino) {
928 p = node->inode_node.rb_right;
929 } else {
930 pos = node;
931 break;
932 }
933#undef node
934 }
935 }
936 while (pos && pos->s_ns && pos->s_ns != ns) {
937 struct rb_node *p = rb_next(&pos->inode_node);
938 if (!p)
939 pos = NULL;
940 else
941 pos = rb_entry(p, struct sysfs_dirent, inode_node);
887 } 942 }
888 while (pos && pos->s_ns && pos->s_ns != ns)
889 pos = pos->s_sibling;
890 return pos; 943 return pos;
891} 944}
892 945
@@ -894,10 +947,13 @@ static struct sysfs_dirent *sysfs_dir_next_pos(const void *ns,
894 struct sysfs_dirent *parent_sd, ino_t ino, struct sysfs_dirent *pos) 947 struct sysfs_dirent *parent_sd, ino_t ino, struct sysfs_dirent *pos)
895{ 948{
896 pos = sysfs_dir_pos(ns, parent_sd, ino, pos); 949 pos = sysfs_dir_pos(ns, parent_sd, ino, pos);
897 if (pos) 950 if (pos) do {
898 pos = pos->s_sibling; 951 struct rb_node *p = rb_next(&pos->inode_node);
899 while (pos && pos->s_ns && pos->s_ns != ns) 952 if (!p)
900 pos = pos->s_sibling; 953 pos = NULL;
954 else
955 pos = rb_entry(p, struct sysfs_dirent, inode_node);
956 } while (pos && pos->s_ns && pos->s_ns != ns);
901 return pos; 957 return pos;
902} 958}
903 959
diff --git a/fs/sysfs/inode.c b/fs/sysfs/inode.c
index e3f091a81c72..1ee18c81df78 100644
--- a/fs/sysfs/inode.c
+++ b/fs/sysfs/inode.c
@@ -202,18 +202,6 @@ static inline void set_inode_attr(struct inode * inode, struct iattr * iattr)
202 inode->i_ctime = iattr->ia_ctime; 202 inode->i_ctime = iattr->ia_ctime;
203} 203}
204 204
205static int sysfs_count_nlink(struct sysfs_dirent *sd)
206{
207 struct sysfs_dirent *child;
208 int nr = 0;
209
210 for (child = sd->s_dir.children; child; child = child->s_sibling)
211 if (sysfs_type(child) == SYSFS_DIR)
212 nr++;
213
214 return nr + 2;
215}
216
217static void sysfs_refresh_inode(struct sysfs_dirent *sd, struct inode *inode) 205static void sysfs_refresh_inode(struct sysfs_dirent *sd, struct inode *inode)
218{ 206{
219 struct sysfs_inode_attrs *iattrs = sd->s_iattr; 207 struct sysfs_inode_attrs *iattrs = sd->s_iattr;
@@ -230,7 +218,7 @@ static void sysfs_refresh_inode(struct sysfs_dirent *sd, struct inode *inode)
230 } 218 }
231 219
232 if (sysfs_type(sd) == SYSFS_DIR) 220 if (sysfs_type(sd) == SYSFS_DIR)
233 inode->i_nlink = sysfs_count_nlink(sd); 221 inode->i_nlink = sd->s_dir.subdirs + 2;
234} 222}
235 223
236int sysfs_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat) 224int sysfs_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat)
diff --git a/fs/sysfs/sysfs.h b/fs/sysfs/sysfs.h
index 845ab3ad229d..ce29e28b766d 100644
--- a/fs/sysfs/sysfs.h
+++ b/fs/sysfs/sysfs.h
@@ -11,14 +11,18 @@
11#include <linux/lockdep.h> 11#include <linux/lockdep.h>
12#include <linux/kobject_ns.h> 12#include <linux/kobject_ns.h>
13#include <linux/fs.h> 13#include <linux/fs.h>
14#include <linux/rbtree.h>
14 15
15struct sysfs_open_dirent; 16struct sysfs_open_dirent;
16 17
17/* type-specific structures for sysfs_dirent->s_* union members */ 18/* type-specific structures for sysfs_dirent->s_* union members */
18struct sysfs_elem_dir { 19struct sysfs_elem_dir {
19 struct kobject *kobj; 20 struct kobject *kobj;
20 /* children list starts here and goes through sd->s_sibling */ 21
21 struct sysfs_dirent *children; 22 unsigned long subdirs;
23
24 struct rb_root inode_tree;
25 struct rb_root name_tree;
22}; 26};
23 27
24struct sysfs_elem_symlink { 28struct sysfs_elem_symlink {
@@ -56,9 +60,16 @@ struct sysfs_dirent {
56 struct lockdep_map dep_map; 60 struct lockdep_map dep_map;
57#endif 61#endif
58 struct sysfs_dirent *s_parent; 62 struct sysfs_dirent *s_parent;
59 struct sysfs_dirent *s_sibling;
60 const char *s_name; 63 const char *s_name;
61 64
65 struct rb_node inode_node;
66 struct rb_node name_node;
67
68 union {
69 struct completion *completion;
70 struct sysfs_dirent *removed_list;
71 } u;
72
62 const void *s_ns; /* namespace tag */ 73 const void *s_ns; /* namespace tag */
63 union { 74 union {
64 struct sysfs_elem_dir s_dir; 75 struct sysfs_elem_dir s_dir;
diff --git a/include/linux/device.h b/include/linux/device.h
index c20dfbfc49b4..4639419522da 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -785,6 +785,8 @@ extern const char *dev_driver_string(const struct device *dev);
785 785
786#ifdef CONFIG_PRINTK 786#ifdef CONFIG_PRINTK
787 787
788extern int __dev_printk(const char *level, const struct device *dev,
789 struct va_format *vaf);
788extern int dev_printk(const char *level, const struct device *dev, 790extern int dev_printk(const char *level, const struct device *dev,
789 const char *fmt, ...) 791 const char *fmt, ...)
790 __attribute__ ((format (printf, 3, 4))); 792 __attribute__ ((format (printf, 3, 4)));
@@ -805,6 +807,9 @@ extern int _dev_info(const struct device *dev, const char *fmt, ...)
805 807
806#else 808#else
807 809
810static inline int __dev_printk(const char *level, const struct device *dev,
811 struct va_format *vaf)
812 { return 0; }
808static inline int dev_printk(const char *level, const struct device *dev, 813static inline int dev_printk(const char *level, const struct device *dev,
809 const char *fmt, ...) 814 const char *fmt, ...)
810 __attribute__ ((format (printf, 3, 4))); 815 __attribute__ ((format (printf, 3, 4)));
diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h
index e747ecd48e1c..13aae8087b56 100644
--- a/include/linux/dynamic_debug.h
+++ b/include/linux/dynamic_debug.h
@@ -1,13 +1,6 @@
1#ifndef _DYNAMIC_DEBUG_H 1#ifndef _DYNAMIC_DEBUG_H
2#define _DYNAMIC_DEBUG_H 2#define _DYNAMIC_DEBUG_H
3 3
4/* dynamic_printk_enabled, and dynamic_printk_enabled2 are bitmasks in which
5 * bit n is set to 1 if any modname hashes into the bucket n, 0 otherwise. They
6 * use independent hash functions, to reduce the chance of false positives.
7 */
8extern long long dynamic_debug_enabled;
9extern long long dynamic_debug_enabled2;
10
11/* 4/*
12 * An instance of this structure is created in a special 5 * An instance of this structure is created in a special
13 * ELF section at every dynamic debug callsite. At runtime, 6 * ELF section at every dynamic debug callsite. At runtime,
@@ -47,26 +40,55 @@ extern int ddebug_remove_module(const char *mod_name);
47extern int __dynamic_pr_debug(struct _ddebug *descriptor, const char *fmt, ...) 40extern int __dynamic_pr_debug(struct _ddebug *descriptor, const char *fmt, ...)
48 __attribute__ ((format (printf, 2, 3))); 41 __attribute__ ((format (printf, 2, 3)));
49 42
50#define dynamic_pr_debug(fmt, ...) do { \ 43struct device;
51 static struct _ddebug descriptor \ 44
52 __used \ 45extern int __dynamic_dev_dbg(struct _ddebug *descriptor,
53 __attribute__((section("__verbose"), aligned(8))) = \ 46 const struct device *dev,
54 { KBUILD_MODNAME, __func__, __FILE__, fmt, __LINE__, \ 47 const char *fmt, ...)
55 _DPRINTK_FLAGS_DEFAULT }; \ 48 __attribute__ ((format (printf, 3, 4)));
56 if (unlikely(descriptor.enabled)) \ 49
57 __dynamic_pr_debug(&descriptor, pr_fmt(fmt), ##__VA_ARGS__); \ 50struct net_device;
58 } while (0) 51
59 52extern int __dynamic_netdev_dbg(struct _ddebug *descriptor,
60 53 const struct net_device *dev,
61#define dynamic_dev_dbg(dev, fmt, ...) do { \ 54 const char *fmt, ...)
62 static struct _ddebug descriptor \ 55 __attribute__ ((format (printf, 3, 4)));
63 __used \ 56
64 __attribute__((section("__verbose"), aligned(8))) = \ 57#define DEFINE_DYNAMIC_DEBUG_METADATA(name, fmt) \
65 { KBUILD_MODNAME, __func__, __FILE__, fmt, __LINE__, \ 58 static struct _ddebug __used __aligned(8) \
66 _DPRINTK_FLAGS_DEFAULT }; \ 59 __attribute__((section("__verbose"))) name = { \
67 if (unlikely(descriptor.enabled)) \ 60 .modname = KBUILD_MODNAME, \
68 dev_printk(KERN_DEBUG, dev, fmt, ##__VA_ARGS__); \ 61 .function = __func__, \
69 } while (0) 62 .filename = __FILE__, \
63 .format = (fmt), \
64 .lineno = __LINE__, \
65 .flags = _DPRINTK_FLAGS_DEFAULT, \
66 .enabled = false, \
67 }
68
69#define dynamic_pr_debug(fmt, ...) \
70do { \
71 DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \
72 if (unlikely(descriptor.enabled)) \
73 __dynamic_pr_debug(&descriptor, pr_fmt(fmt), \
74 ##__VA_ARGS__); \
75} while (0)
76
77#define dynamic_dev_dbg(dev, fmt, ...) \
78do { \
79 DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \
80 if (unlikely(descriptor.enabled)) \
81 __dynamic_dev_dbg(&descriptor, dev, fmt, \
82 ##__VA_ARGS__); \
83} while (0)
84
85#define dynamic_netdev_dbg(dev, fmt, ...) \
86do { \
87 DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \
88 if (unlikely(descriptor.enabled)) \
89 __dynamic_netdev_dbg(&descriptor, dev, fmt, \
90 ##__VA_ARGS__); \
91} while (0)
70 92
71#else 93#else
72 94
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index ddee79bb8f15..279726039f00 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -2617,6 +2617,9 @@ static inline const char *netdev_name(const struct net_device *dev)
2617 return dev->name; 2617 return dev->name;
2618} 2618}
2619 2619
2620extern int __netdev_printk(const char *level, const struct net_device *dev,
2621 struct va_format *vaf);
2622
2620extern int netdev_printk(const char *level, const struct net_device *dev, 2623extern int netdev_printk(const char *level, const struct net_device *dev,
2621 const char *format, ...) 2624 const char *format, ...)
2622 __attribute__ ((format (printf, 3, 4))); 2625 __attribute__ ((format (printf, 3, 4)));
@@ -2644,8 +2647,7 @@ extern int netdev_info(const struct net_device *dev, const char *format, ...)
2644#elif defined(CONFIG_DYNAMIC_DEBUG) 2647#elif defined(CONFIG_DYNAMIC_DEBUG)
2645#define netdev_dbg(__dev, format, args...) \ 2648#define netdev_dbg(__dev, format, args...) \
2646do { \ 2649do { \
2647 dynamic_dev_dbg((__dev)->dev.parent, "%s: " format, \ 2650 dynamic_netdev_dbg(__dev, format, ##args); \
2648 netdev_name(__dev), ##args); \
2649} while (0) 2651} while (0)
2650#else 2652#else
2651#define netdev_dbg(__dev, format, args...) \ 2653#define netdev_dbg(__dev, format, args...) \
@@ -2712,9 +2714,7 @@ do { \
2712#define netif_dbg(priv, type, netdev, format, args...) \ 2714#define netif_dbg(priv, type, netdev, format, args...) \
2713do { \ 2715do { \
2714 if (netif_msg_##type(priv)) \ 2716 if (netif_msg_##type(priv)) \
2715 dynamic_dev_dbg((netdev)->dev.parent, \ 2717 dynamic_netdev_dbg(netdev, format, ##args); \
2716 "%s: " format, \
2717 netdev_name(netdev), ##args); \
2718} while (0) 2718} while (0)
2719#else 2719#else
2720#define netif_dbg(priv, type, dev, format, args...) \ 2720#define netif_dbg(priv, type, dev, format, args...) \
diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h
index 27bb05aae70d..651a066686ac 100644
--- a/include/linux/platform_device.h
+++ b/include/linux/platform_device.h
@@ -49,10 +49,54 @@ extern struct resource *platform_get_resource_byname(struct platform_device *, u
49extern int platform_get_irq_byname(struct platform_device *, const char *); 49extern int platform_get_irq_byname(struct platform_device *, const char *);
50extern int platform_add_devices(struct platform_device **, int); 50extern int platform_add_devices(struct platform_device **, int);
51 51
52extern struct platform_device *platform_device_register_resndata( 52struct platform_device_info {
53 struct device *parent;
54
55 const char *name;
56 int id;
57
58 const struct resource *res;
59 unsigned int num_res;
60
61 const void *data;
62 size_t size_data;
63 u64 dma_mask;
64};
65extern struct platform_device *platform_device_register_full(
66 struct platform_device_info *pdevinfo);
67
68/**
69 * platform_device_register_resndata - add a platform-level device with
70 * resources and platform-specific data
71 *
72 * @parent: parent device for the device we're adding
73 * @name: base name of the device we're adding
74 * @id: instance id
75 * @res: set of resources that needs to be allocated for the device
76 * @num: number of resources
77 * @data: platform specific data for this platform device
78 * @size: size of platform specific data
79 *
80 * Returns &struct platform_device pointer on success, or ERR_PTR() on error.
81 */
82static inline struct platform_device *platform_device_register_resndata(
53 struct device *parent, const char *name, int id, 83 struct device *parent, const char *name, int id,
54 const struct resource *res, unsigned int num, 84 const struct resource *res, unsigned int num,
55 const void *data, size_t size); 85 const void *data, size_t size) {
86
87 struct platform_device_info pdevinfo = {
88 .parent = parent,
89 .name = name,
90 .id = id,
91 .res = res,
92 .num_res = num,
93 .data = data,
94 .size_data = size,
95 .dma_mask = 0,
96 };
97
98 return platform_device_register_full(&pdevinfo);
99}
56 100
57/** 101/**
58 * platform_device_register_simple - add a platform-level device and its resources 102 * platform_device_register_simple - add a platform-level device and its resources
diff --git a/include/linux/uio_driver.h b/include/linux/uio_driver.h
index 665517c05eaf..fd99ff9298c6 100644
--- a/include/linux/uio_driver.h
+++ b/include/linux/uio_driver.h
@@ -23,7 +23,10 @@ struct uio_map;
23/** 23/**
24 * struct uio_mem - description of a UIO memory region 24 * struct uio_mem - description of a UIO memory region
25 * @name: name of the memory region for identification 25 * @name: name of the memory region for identification
26 * @addr: address of the device's memory 26 * @addr: address of the device's memory (phys_addr is used since
27 * addr can be logical, virtual, or physical & phys_addr_t
28 * should always be large enough to handle any of the
29 * address types)
27 * @size: size of IO 30 * @size: size of IO
28 * @memtype: type of memory addr points to 31 * @memtype: type of memory addr points to
29 * @internal_addr: ioremap-ped version of addr, for driver internal use 32 * @internal_addr: ioremap-ped version of addr, for driver internal use
@@ -31,7 +34,7 @@ struct uio_map;
31 */ 34 */
32struct uio_mem { 35struct uio_mem {
33 const char *name; 36 const char *name;
34 unsigned long addr; 37 phys_addr_t addr;
35 unsigned long size; 38 unsigned long size;
36 int memtype; 39 int memtype;
37 void __iomem *internal_addr; 40 void __iomem *internal_addr;
diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c
index 79fc20b65e74..dcdade39e47f 100644
--- a/lib/dynamic_debug.c
+++ b/lib/dynamic_debug.c
@@ -10,6 +10,8 @@
10 * Copyright (C) 2011 Bart Van Assche. All Rights Reserved. 10 * Copyright (C) 2011 Bart Van Assche. All Rights Reserved.
11 */ 11 */
12 12
13#define pr_fmt(fmt) KBUILD_MODNAME ":%s: " fmt, __func__
14
13#include <linux/kernel.h> 15#include <linux/kernel.h>
14#include <linux/module.h> 16#include <linux/module.h>
15#include <linux/moduleparam.h> 17#include <linux/moduleparam.h>
@@ -29,6 +31,8 @@
29#include <linux/jump_label.h> 31#include <linux/jump_label.h>
30#include <linux/hardirq.h> 32#include <linux/hardirq.h>
31#include <linux/sched.h> 33#include <linux/sched.h>
34#include <linux/device.h>
35#include <linux/netdevice.h>
32 36
33extern struct _ddebug __start___verbose[]; 37extern struct _ddebug __start___verbose[];
34extern struct _ddebug __stop___verbose[]; 38extern struct _ddebug __stop___verbose[];
@@ -37,7 +41,6 @@ struct ddebug_table {
37 struct list_head link; 41 struct list_head link;
38 char *mod_name; 42 char *mod_name;
39 unsigned int num_ddebugs; 43 unsigned int num_ddebugs;
40 unsigned int num_enabled;
41 struct _ddebug *ddebugs; 44 struct _ddebug *ddebugs;
42}; 45};
43 46
@@ -147,19 +150,13 @@ static void ddebug_change(const struct ddebug_query *query,
147 newflags = (dp->flags & mask) | flags; 150 newflags = (dp->flags & mask) | flags;
148 if (newflags == dp->flags) 151 if (newflags == dp->flags)
149 continue; 152 continue;
150
151 if (!newflags)
152 dt->num_enabled--;
153 else if (!dp->flags)
154 dt->num_enabled++;
155 dp->flags = newflags; 153 dp->flags = newflags;
156 if (newflags) 154 if (newflags)
157 dp->enabled = 1; 155 dp->enabled = 1;
158 else 156 else
159 dp->enabled = 0; 157 dp->enabled = 0;
160 if (verbose) 158 if (verbose)
161 printk(KERN_INFO 159 pr_info("changed %s:%d [%s]%s %s\n",
162 "ddebug: changed %s:%d [%s]%s %s\n",
163 dp->filename, dp->lineno, 160 dp->filename, dp->lineno,
164 dt->mod_name, dp->function, 161 dt->mod_name, dp->function,
165 ddebug_describe_flags(dp, flagbuf, 162 ddebug_describe_flags(dp, flagbuf,
@@ -169,7 +166,7 @@ static void ddebug_change(const struct ddebug_query *query,
169 mutex_unlock(&ddebug_lock); 166 mutex_unlock(&ddebug_lock);
170 167
171 if (!nfound && verbose) 168 if (!nfound && verbose)
172 printk(KERN_INFO "ddebug: no matches for query\n"); 169 pr_info("no matches for query\n");
173} 170}
174 171
175/* 172/*
@@ -214,10 +211,10 @@ static int ddebug_tokenize(char *buf, char *words[], int maxwords)
214 211
215 if (verbose) { 212 if (verbose) {
216 int i; 213 int i;
217 printk(KERN_INFO "%s: split into words:", __func__); 214 pr_info("split into words:");
218 for (i = 0 ; i < nwords ; i++) 215 for (i = 0 ; i < nwords ; i++)
219 printk(" \"%s\"", words[i]); 216 pr_cont(" \"%s\"", words[i]);
220 printk("\n"); 217 pr_cont("\n");
221 } 218 }
222 219
223 return nwords; 220 return nwords;
@@ -329,16 +326,15 @@ static int ddebug_parse_query(char *words[], int nwords,
329 } 326 }
330 } else { 327 } else {
331 if (verbose) 328 if (verbose)
332 printk(KERN_ERR "%s: unknown keyword \"%s\"\n", 329 pr_err("unknown keyword \"%s\"\n", words[i]);
333 __func__, words[i]);
334 return -EINVAL; 330 return -EINVAL;
335 } 331 }
336 } 332 }
337 333
338 if (verbose) 334 if (verbose)
339 printk(KERN_INFO "%s: q->function=\"%s\" q->filename=\"%s\" " 335 pr_info("q->function=\"%s\" q->filename=\"%s\" "
340 "q->module=\"%s\" q->format=\"%s\" q->lineno=%u-%u\n", 336 "q->module=\"%s\" q->format=\"%s\" q->lineno=%u-%u\n",
341 __func__, query->function, query->filename, 337 query->function, query->filename,
342 query->module, query->format, query->first_lineno, 338 query->module, query->format, query->first_lineno,
343 query->last_lineno); 339 query->last_lineno);
344 340
@@ -367,7 +363,7 @@ static int ddebug_parse_flags(const char *str, unsigned int *flagsp,
367 return -EINVAL; 363 return -EINVAL;
368 } 364 }
369 if (verbose) 365 if (verbose)
370 printk(KERN_INFO "%s: op='%c'\n", __func__, op); 366 pr_info("op='%c'\n", op);
371 367
372 for ( ; *str ; ++str) { 368 for ( ; *str ; ++str) {
373 for (i = ARRAY_SIZE(opt_array) - 1; i >= 0; i--) { 369 for (i = ARRAY_SIZE(opt_array) - 1; i >= 0; i--) {
@@ -382,7 +378,7 @@ static int ddebug_parse_flags(const char *str, unsigned int *flagsp,
382 if (flags == 0) 378 if (flags == 0)
383 return -EINVAL; 379 return -EINVAL;
384 if (verbose) 380 if (verbose)
385 printk(KERN_INFO "%s: flags=0x%x\n", __func__, flags); 381 pr_info("flags=0x%x\n", flags);
386 382
387 /* calculate final *flagsp, *maskp according to mask and op */ 383 /* calculate final *flagsp, *maskp according to mask and op */
388 switch (op) { 384 switch (op) {
@@ -400,8 +396,7 @@ static int ddebug_parse_flags(const char *str, unsigned int *flagsp,
400 break; 396 break;
401 } 397 }
402 if (verbose) 398 if (verbose)
403 printk(KERN_INFO "%s: *flagsp=0x%x *maskp=0x%x\n", 399 pr_info("*flagsp=0x%x *maskp=0x%x\n", *flagsp, *maskp);
404 __func__, *flagsp, *maskp);
405 return 0; 400 return 0;
406} 401}
407 402
@@ -426,40 +421,117 @@ static int ddebug_exec_query(char *query_string)
426 return 0; 421 return 0;
427} 422}
428 423
424#define PREFIX_SIZE 64
425
426static int remaining(int wrote)
427{
428 if (PREFIX_SIZE - wrote > 0)
429 return PREFIX_SIZE - wrote;
430 return 0;
431}
432
433static char *dynamic_emit_prefix(const struct _ddebug *desc, char *buf)
434{
435 int pos_after_tid;
436 int pos = 0;
437
438 pos += snprintf(buf + pos, remaining(pos), "%s", KERN_DEBUG);
439 if (desc->flags & _DPRINTK_FLAGS_INCL_TID) {
440 if (in_interrupt())
441 pos += snprintf(buf + pos, remaining(pos), "%s ",
442 "<intr>");
443 else
444 pos += snprintf(buf + pos, remaining(pos), "[%d] ",
445 task_pid_vnr(current));
446 }
447 pos_after_tid = pos;
448 if (desc->flags & _DPRINTK_FLAGS_INCL_MODNAME)
449 pos += snprintf(buf + pos, remaining(pos), "%s:",
450 desc->modname);
451 if (desc->flags & _DPRINTK_FLAGS_INCL_FUNCNAME)
452 pos += snprintf(buf + pos, remaining(pos), "%s:",
453 desc->function);
454 if (desc->flags & _DPRINTK_FLAGS_INCL_LINENO)
455 pos += snprintf(buf + pos, remaining(pos), "%d:", desc->lineno);
456 if (pos - pos_after_tid)
457 pos += snprintf(buf + pos, remaining(pos), " ");
458 if (pos >= PREFIX_SIZE)
459 buf[PREFIX_SIZE - 1] = '\0';
460
461 return buf;
462}
463
429int __dynamic_pr_debug(struct _ddebug *descriptor, const char *fmt, ...) 464int __dynamic_pr_debug(struct _ddebug *descriptor, const char *fmt, ...)
430{ 465{
431 va_list args; 466 va_list args;
432 int res; 467 int res;
468 struct va_format vaf;
469 char buf[PREFIX_SIZE];
433 470
434 BUG_ON(!descriptor); 471 BUG_ON(!descriptor);
435 BUG_ON(!fmt); 472 BUG_ON(!fmt);
436 473
437 va_start(args, fmt); 474 va_start(args, fmt);
438 res = printk(KERN_DEBUG); 475 vaf.fmt = fmt;
439 if (descriptor->flags & _DPRINTK_FLAGS_INCL_TID) { 476 vaf.va = &args;
440 if (in_interrupt()) 477 res = printk("%s%pV", dynamic_emit_prefix(descriptor, buf), &vaf);
441 res += printk(KERN_CONT "<intr> ");
442 else
443 res += printk(KERN_CONT "[%d] ", task_pid_vnr(current));
444 }
445 if (descriptor->flags & _DPRINTK_FLAGS_INCL_MODNAME)
446 res += printk(KERN_CONT "%s:", descriptor->modname);
447 if (descriptor->flags & _DPRINTK_FLAGS_INCL_FUNCNAME)
448 res += printk(KERN_CONT "%s:", descriptor->function);
449 if (descriptor->flags & _DPRINTK_FLAGS_INCL_LINENO)
450 res += printk(KERN_CONT "%d ", descriptor->lineno);
451 res += vprintk(fmt, args);
452 va_end(args); 478 va_end(args);
453 479
454 return res; 480 return res;
455} 481}
456EXPORT_SYMBOL(__dynamic_pr_debug); 482EXPORT_SYMBOL(__dynamic_pr_debug);
457 483
484int __dynamic_dev_dbg(struct _ddebug *descriptor,
485 const struct device *dev, const char *fmt, ...)
486{
487 struct va_format vaf;
488 va_list args;
489 int res;
490 char buf[PREFIX_SIZE];
491
492 BUG_ON(!descriptor);
493 BUG_ON(!fmt);
494
495 va_start(args, fmt);
496 vaf.fmt = fmt;
497 vaf.va = &args;
498 res = __dev_printk(dynamic_emit_prefix(descriptor, buf), dev, &vaf);
499 va_end(args);
500
501 return res;
502}
503EXPORT_SYMBOL(__dynamic_dev_dbg);
504
505#ifdef CONFIG_NET
506
507int __dynamic_netdev_dbg(struct _ddebug *descriptor,
508 const struct net_device *dev, const char *fmt, ...)
509{
510 struct va_format vaf;
511 va_list args;
512 int res;
513 char buf[PREFIX_SIZE];
514
515 BUG_ON(!descriptor);
516 BUG_ON(!fmt);
517
518 va_start(args, fmt);
519 vaf.fmt = fmt;
520 vaf.va = &args;
521 res = __netdev_printk(dynamic_emit_prefix(descriptor, buf), dev, &vaf);
522 va_end(args);
523
524 return res;
525}
526EXPORT_SYMBOL(__dynamic_netdev_dbg);
527
528#endif
529
458static __initdata char ddebug_setup_string[1024]; 530static __initdata char ddebug_setup_string[1024];
459static __init int ddebug_setup_query(char *str) 531static __init int ddebug_setup_query(char *str)
460{ 532{
461 if (strlen(str) >= 1024) { 533 if (strlen(str) >= 1024) {
462 pr_warning("ddebug boot param string too large\n"); 534 pr_warn("ddebug boot param string too large\n");
463 return 0; 535 return 0;
464 } 536 }
465 strcpy(ddebug_setup_string, str); 537 strcpy(ddebug_setup_string, str);
@@ -487,8 +559,7 @@ static ssize_t ddebug_proc_write(struct file *file, const char __user *ubuf,
487 return -EFAULT; 559 return -EFAULT;
488 tmpbuf[len] = '\0'; 560 tmpbuf[len] = '\0';
489 if (verbose) 561 if (verbose)
490 printk(KERN_INFO "%s: read %d bytes from userspace\n", 562 pr_info("read %d bytes from userspace\n", (int)len);
491 __func__, (int)len);
492 563
493 ret = ddebug_exec_query(tmpbuf); 564 ret = ddebug_exec_query(tmpbuf);
494 if (ret) 565 if (ret)
@@ -551,8 +622,7 @@ static void *ddebug_proc_start(struct seq_file *m, loff_t *pos)
551 int n = *pos; 622 int n = *pos;
552 623
553 if (verbose) 624 if (verbose)
554 printk(KERN_INFO "%s: called m=%p *pos=%lld\n", 625 pr_info("called m=%p *pos=%lld\n", m, (unsigned long long)*pos);
555 __func__, m, (unsigned long long)*pos);
556 626
557 mutex_lock(&ddebug_lock); 627 mutex_lock(&ddebug_lock);
558 628
@@ -577,8 +647,8 @@ static void *ddebug_proc_next(struct seq_file *m, void *p, loff_t *pos)
577 struct _ddebug *dp; 647 struct _ddebug *dp;
578 648
579 if (verbose) 649 if (verbose)
580 printk(KERN_INFO "%s: called m=%p p=%p *pos=%lld\n", 650 pr_info("called m=%p p=%p *pos=%lld\n",
581 __func__, m, p, (unsigned long long)*pos); 651 m, p, (unsigned long long)*pos);
582 652
583 if (p == SEQ_START_TOKEN) 653 if (p == SEQ_START_TOKEN)
584 dp = ddebug_iter_first(iter); 654 dp = ddebug_iter_first(iter);
@@ -601,8 +671,7 @@ static int ddebug_proc_show(struct seq_file *m, void *p)
601 char flagsbuf[8]; 671 char flagsbuf[8];
602 672
603 if (verbose) 673 if (verbose)
604 printk(KERN_INFO "%s: called m=%p p=%p\n", 674 pr_info("called m=%p p=%p\n", m, p);
605 __func__, m, p);
606 675
607 if (p == SEQ_START_TOKEN) { 676 if (p == SEQ_START_TOKEN) {
608 seq_puts(m, 677 seq_puts(m,
@@ -627,8 +696,7 @@ static int ddebug_proc_show(struct seq_file *m, void *p)
627static void ddebug_proc_stop(struct seq_file *m, void *p) 696static void ddebug_proc_stop(struct seq_file *m, void *p)
628{ 697{
629 if (verbose) 698 if (verbose)
630 printk(KERN_INFO "%s: called m=%p p=%p\n", 699 pr_info("called m=%p p=%p\n", m, p);
631 __func__, m, p);
632 mutex_unlock(&ddebug_lock); 700 mutex_unlock(&ddebug_lock);
633} 701}
634 702
@@ -651,7 +719,7 @@ static int ddebug_proc_open(struct inode *inode, struct file *file)
651 int err; 719 int err;
652 720
653 if (verbose) 721 if (verbose)
654 printk(KERN_INFO "%s: called\n", __func__); 722 pr_info("called\n");
655 723
656 iter = kzalloc(sizeof(*iter), GFP_KERNEL); 724 iter = kzalloc(sizeof(*iter), GFP_KERNEL);
657 if (iter == NULL) 725 if (iter == NULL)
@@ -695,7 +763,6 @@ int ddebug_add_module(struct _ddebug *tab, unsigned int n,
695 } 763 }
696 dt->mod_name = new_name; 764 dt->mod_name = new_name;
697 dt->num_ddebugs = n; 765 dt->num_ddebugs = n;
698 dt->num_enabled = 0;
699 dt->ddebugs = tab; 766 dt->ddebugs = tab;
700 767
701 mutex_lock(&ddebug_lock); 768 mutex_lock(&ddebug_lock);
@@ -703,8 +770,7 @@ int ddebug_add_module(struct _ddebug *tab, unsigned int n,
703 mutex_unlock(&ddebug_lock); 770 mutex_unlock(&ddebug_lock);
704 771
705 if (verbose) 772 if (verbose)
706 printk(KERN_INFO "%u debug prints in module %s\n", 773 pr_info("%u debug prints in module %s\n", n, dt->mod_name);
707 n, dt->mod_name);
708 return 0; 774 return 0;
709} 775}
710EXPORT_SYMBOL_GPL(ddebug_add_module); 776EXPORT_SYMBOL_GPL(ddebug_add_module);
@@ -726,8 +792,7 @@ int ddebug_remove_module(const char *mod_name)
726 int ret = -ENOENT; 792 int ret = -ENOENT;
727 793
728 if (verbose) 794 if (verbose)
729 printk(KERN_INFO "%s: removing module \"%s\"\n", 795 pr_info("removing module \"%s\"\n", mod_name);
730 __func__, mod_name);
731 796
732 mutex_lock(&ddebug_lock); 797 mutex_lock(&ddebug_lock);
733 list_for_each_entry_safe(dt, nextdt, &ddebug_tables, link) { 798 list_for_each_entry_safe(dt, nextdt, &ddebug_tables, link) {
@@ -803,8 +868,8 @@ static int __init dynamic_debug_init(void)
803 if (ddebug_setup_string[0] != '\0') { 868 if (ddebug_setup_string[0] != '\0') {
804 ret = ddebug_exec_query(ddebug_setup_string); 869 ret = ddebug_exec_query(ddebug_setup_string);
805 if (ret) 870 if (ret)
806 pr_warning("Invalid ddebug boot param %s", 871 pr_warn("Invalid ddebug boot param %s",
807 ddebug_setup_string); 872 ddebug_setup_string);
808 else 873 else
809 pr_info("ddebug initialized with string %s", 874 pr_info("ddebug initialized with string %s",
810 ddebug_setup_string); 875 ddebug_setup_string);
diff --git a/lib/kobject_uevent.c b/lib/kobject_uevent.c
index 70af0a7f97c0..ad72a03ce5e9 100644
--- a/lib/kobject_uevent.c
+++ b/lib/kobject_uevent.c
@@ -282,7 +282,7 @@ int kobject_uevent_env(struct kobject *kobj, enum kobject_action action,
282 kobj_bcast_filter, 282 kobj_bcast_filter,
283 kobj); 283 kobj);
284 /* ENOBUFS should be handled in userspace */ 284 /* ENOBUFS should be handled in userspace */
285 if (retval == -ENOBUFS) 285 if (retval == -ENOBUFS || retval == -ESRCH)
286 retval = 0; 286 retval = 0;
287 } else 287 } else
288 retval = -ENOMEM; 288 retval = -ENOMEM;
diff --git a/net/core/dev.c b/net/core/dev.c
index b10ff0a71855..231d3125bf26 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -6298,7 +6298,7 @@ const char *netdev_drivername(const struct net_device *dev)
6298 return empty; 6298 return empty;
6299} 6299}
6300 6300
6301static int __netdev_printk(const char *level, const struct net_device *dev, 6301int __netdev_printk(const char *level, const struct net_device *dev,
6302 struct va_format *vaf) 6302 struct va_format *vaf)
6303{ 6303{
6304 int r; 6304 int r;
@@ -6313,6 +6313,7 @@ static int __netdev_printk(const char *level, const struct net_device *dev,
6313 6313
6314 return r; 6314 return r;
6315} 6315}
6316EXPORT_SYMBOL(__netdev_printk);
6316 6317
6317int netdev_printk(const char *level, const struct net_device *dev, 6318int netdev_printk(const char *level, const struct net_device *dev,
6318 const char *format, ...) 6319 const char *format, ...)