diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-10-25 06:13:59 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-10-25 06:13:59 -0400 |
commit | 2d03423b2319cc854adeb28a03f65de5b5e0ab63 (patch) | |
tree | 20d9ddb661f3247f5dfaa6da8212123ed14a24c4 | |
parent | 59e52534172d845ebffb0d7e85fc56fb7b857051 (diff) | |
parent | 2bbcb8788311a40714b585fc11b51da6ffa2ab92 (diff) |
Merge branch 'driver-core-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core
* 'driver-core-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (38 commits)
mm: memory hotplug: Check if pages are correctly reserved on a per-section basis
Revert "memory hotplug: Correct page reservation checking"
Update email address for stable patch submission
dynamic_debug: fix undefined reference to `__netdev_printk'
dynamic_debug: use a single printk() to emit messages
dynamic_debug: remove num_enabled accounting
dynamic_debug: consolidate repetitive struct _ddebug descriptor definitions
uio: Support physical addresses >32 bits on 32-bit systems
sysfs: add unsigned long cast to prevent compile warning
drivers: base: print rejected matches with DEBUG_DRIVER
memory hotplug: Correct page reservation checking
memory hotplug: Refuse to add unaligned memory regions
remove the messy code file Documentation/zh_CN/SubmitChecklist
ARM: mxc: convert device creation to use platform_device_register_full
new helper to create platform devices with dma mask
docs/driver-model: Update device class docs
docs/driver-model: Document device.groups
kobj_uevent: Ignore if some listeners cannot handle message
dynamic_debug: make netif_dbg() call __netdev_printk()
dynamic_debug: make netdev_dbg() call __netdev_printk()
...
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. |
533 | Fill in the address of your memory block. This address is the one that | 533 | Fill in the address of your memory block. This address is the one that |
534 | appears in sysfs. | 534 | appears 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 | |||
48 | and actually register it with the class, which happens with the | 48 | and actually register it with the class, which happens with the |
49 | class's register_dev callback. | 49 | class's register_dev callback. |
50 | 50 | ||
51 | NOTE: The device class structures and core routines to manipulate them | ||
52 | are not in the mainline kernel, so the discussion is still a bit | ||
53 | speculative. | ||
54 | |||
55 | 51 | ||
56 | Driver | 52 | Driver |
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 | ||
48 | Attributes of devices can be exported via drivers using a simple | 48 | Attributes of devices can be exported by a device driver through sysfs. |
49 | procfs-like interface. | ||
50 | 49 | ||
51 | Please see Documentation/filesystems/sysfs.txt for more information | 50 | Please see Documentation/filesystems/sysfs.txt for more information |
52 | on how sysfs works. | 51 | on how sysfs works. |
53 | 52 | ||
53 | As explained in Documentation/kobject.txt, device attributes must be be | ||
54 | created before the KOBJ_ADD uevent is generated. The only way to realize | ||
55 | that is by defining an attribute group. | ||
56 | |||
54 | Attributes are declared using a macro called DEVICE_ATTR: | 57 | Attributes 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 | ||
58 | Example: | 61 | Example: |
59 | 62 | ||
60 | DEVICE_ATTR(power,0644,show_power,store_power); | 63 | static DEVICE_ATTR(type, 0444, show_type, NULL); |
64 | static DEVICE_ATTR(power, 0644, show_power, store_power); | ||
61 | 65 | ||
62 | This declares a structure of type struct device_attribute named | 66 | This 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 | 67 | names 'dev_attr_type' and 'dev_attr_power'. These two attributes can be |
64 | directory using: | 68 | organized as follows into a group: |
65 | 69 | ||
66 | int device_create_file(struct device *device, struct device_attribute * entry); | 70 | static struct attribute *dev_attrs[] = { |
67 | void 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 | ||
69 | Example: | 76 | static struct attribute_group dev_attr_group = { |
77 | .attrs = dev_attrs, | ||
78 | }; | ||
79 | |||
80 | static const struct attribute_group *dev_attr_groups[] = { | ||
81 | &dev_attr_group, | ||
82 | NULL, | ||
83 | }; | ||
84 | |||
85 | This array of groups can then be associated with a device by setting the | ||
86 | group pointer in struct device before device_register() is invoked: | ||
70 | 87 | ||
71 | device_create_file(dev,&dev_attr_power); | 88 | dev->groups = dev_attr_groups; |
72 | device_remove_file(dev,&dev_attr_power); | 89 | device_register(dev); |
73 | 90 | ||
74 | The file name will be 'power' with a mode of 0644 (-rw-r--r--). | 91 | The device_register() function will use the 'groups' pointer to create the |
92 | device attributes and the device_unregister() function will use this pointer | ||
93 | to remove the device attributes. | ||
75 | 94 | ||
76 | Word of warning: While the kernel allows device_create_file() and | 95 | Word of warning: While the kernel allows device_create_file() and |
77 | device_remove_file() to be called on a device at any time, userspace has | 96 | device_remove_file() to be called on a device at any time, userspace has |
@@ -84,24 +103,4 @@ not know about the new attributes. | |||
84 | This is important for device driver that need to publish additional | 103 | This is important for device driver that need to publish additional |
85 | attributes for a device at driver probe time. If the device driver simply | 104 | attributes for a device at driver probe time. If the device driver simply |
86 | calls device_create_file() on the device structure passed to it, then | 105 | calls device_create_file() on the device structure passed to it, then |
87 | userspace will never be notified of the new attributes. Instead, it should | 106 | userspace will never be notified of the new attributes. |
88 | probably use class_create() and class->dev_attrs to set up a list of | ||
89 | desired attributes in the modules_init function, and then in the .probe() | ||
90 | hook, and then use device_create() to create a new device as a child | ||
91 | of the probed device. The new device will generate a new uevent and | ||
92 | properly advertise the new attributes to userspace. | ||
93 | |||
94 | For example, if a driver wanted to add the following attributes: | ||
95 | struct device_attribute mydriver_attribs[] = { | ||
96 | __ATTR(port_count, 0444, port_count_show), | ||
97 | __ATTR(serial_number, 0444, serial_number_show), | ||
98 | NULL | ||
99 | }; | ||
100 | |||
101 | Then 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 | |||
105 | And assuming 'dev' is the struct device passed into the probe hook, the driver | ||
106 | probe 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. | |||
4 | Patrick Mochel <mochel@osdl.org> | 4 | Patrick Mochel <mochel@osdl.org> |
5 | Mike Murphy <mamurph@cs.clemson.edu> | 5 | Mike Murphy <mamurph@cs.clemson.edu> |
6 | 6 | ||
7 | Revised: 15 July 2010 | 7 | Revised: 16 August 2011 |
8 | Original: 10 January 2003 | 8 | Original: 10 January 2003 |
9 | 9 | ||
10 | 10 | ||
@@ -370,3 +370,11 @@ int driver_create_file(struct device_driver *, const struct driver_attribute *); | |||
370 | void driver_remove_file(struct device_driver *, const struct driver_attribute *); | 370 | void driver_remove_file(struct device_driver *, const struct driver_attribute *); |
371 | 371 | ||
372 | 372 | ||
373 | Documentation | ||
374 | ~~~~~~~~~~~~~ | ||
375 | |||
376 | The sysfs directory structure and the attributes in each directory define an | ||
377 | ABI between the kernel and user space. As for any ABI, it is important that | ||
378 | this ABI is stable and properly documented. All new sysfs attributes must be | ||
379 | documented in Documentation/ABI. See also Documentation/ABI/README for more | ||
380 | information. | ||
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 | |||
24 | Procedure for submitting patches to the -stable tree: | 24 | Procedure 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 @@ | |||
1 | Chinese translated version of Documentation/SubmitChecklist | ||
2 | |||
3 | If you have any comment or update to the content, please contact the | ||
4 | original document maintainer directly. However, if you have a problem | ||
5 | communicating in English you can also ask the Chinese maintainer for | ||
6 | help. Contact the Chinese maintainer if this translation is outdated | ||
7 | or if there is a problem with the translation. | ||
8 | |||
9 | Chinese maintainer: Harry Wei <harryxiyou@gmail.com> | ||
10 | --------------------------------------------------------------------- | ||
11 | Documentation/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 | --------------------------------------------------------------------- | ||
24 | LinuxÄÚºËÌá½»Çåµ¥ | ||
25 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
26 | |||
27 | ÕâÀïÓÐһЩÄں˿ª·¢ÕßÓ¦¸Ã×öµÄ»ù±¾ÊÂÇ飬Èç¹ûËûÃÇÏë¿´µ½×Ô¼ºµÄÄں˲¹¶¡Ìá½» | ||
28 | ±»½ÓÊܵĸü¿ì¡£ | ||
29 | |||
30 | ÕâЩ¶¼Êdz¬³öDocumentation/SubmittingPatchesÎĵµÀïËùÌṩµÄÒÔ¼°ÆäËû | ||
31 | ¹ØÓÚÌá½»LinuxÄں˲¹¶¡µÄ˵Ã÷¡£ | ||
32 | |||
33 | 1£ºÈç¹ûÄãʹÓÃÁËÒ»¸ö¹¦ÄÜÄÇô¾Í#include¶¨Òå/ÉùÃ÷ÄǸö¹¦ÄܵÄÄǸöÎļþ¡£ | ||
34 | ²»ÒªÒÀ¿¿ÆäËû¼ä½ÓÒýÈ붨Òå/ÉùÃ÷ÄǸö¹¦ÄܵÄÍ·Îļþ¡£ | ||
35 | |||
36 | 2£º¹¹½¨¼ò½àÊÊÓûòÕ߸ü¸ÄCONFIGÑ¡Ïî =y£¬=m£¬»òÕß=n¡£ | ||
37 | ²»ÒªÓбàÒ뾯¸æ/´íÎó£¬ ²»ÒªÓÐÁ´½Ó¾¯¸æ/´íÎó¡£ | ||
38 | |||
39 | 2b£ºÍ¨¹ý allnoconfig, allmodconfig | ||
40 | |||
41 | 2c£ºµ±Ê¹Óà 0=builddir ³É¹¦µØ¹¹½¨ | ||
42 | |||
43 | 3£ºÍ¨¹ýʹÓñ¾µØ½»²æ±àÒ빤¾ß»òÕßÆäËûһЩ¹¹½¨²úËù£¬ÔÚ¶àCPU¿ò¼ÜÉϹ¹½¨¡£ | ||
44 | |||
45 | 4£ºppc64 ÊÇÒ»¸öºÜºÃµÄ¼ì²é½»²æ±àÒëµÄ¿ò¼Ü£¬ÒòΪËüÍùÍù°Ñ¡®unsigned long¡¯ | ||
46 | µ±64λֵÀ´Ê¹Óᣠ| ||
47 | |||
48 | 5£º°´ÕÕDocumentation/CodingStyleÎļþÀïµÄÏêϸÃèÊö£¬¼ì²éÄã²¹¶¡µÄÕûÌå·ç¸ñ¡£ | ||
49 | ʹÓò¹¶¡·ç¸ñ¼ì²éËöËéµÄÎ¥¹æ(scripts/checkpatch.pl)£¬ÉóºËÔ±ÓÅÏÈÌá½»¡£ | ||
50 | ÄãÓ¦¸Ãµ÷ÕûÒÅÁôÔÚÄã²¹¶¡ÖеÄËùÓÐÎ¥¹æ¡£ | ||
51 | |||
52 | 6£ºÈκθüлòÕ߸Ķ¯CONFIGÑ¡Ï²»ÄÜ´òÂÒÅäÖò˵¥¡£ | ||
53 | |||
54 | 7£ºËùÓеÄKconfigÑ¡Ïî¸üж¼ÒªÓÐ˵Ã÷ÎÄ×Ö¡£ | ||
55 | |||
56 | 8£ºÒѾÈÏÕæµØ×ܽáÁËÏà¹ØµÄKconfig×éºÏ¡£ÕâÊǺÜÄÑͨ¹ý²âÊÔ×öºÃµÄ--ÄÔÁ¦ÔÚÕâÀïϽµ¡£ | ||
57 | |||
58 | 9£º¼ì²é¾ßÓмò½àÐÔ¡£ | ||
59 | |||
60 | 10£ºÊ¹ÓÃ'make checkstack'ºÍ'make namespacecheck'¼ì²é£¬È»ºóÐÞ¸ÄËùÕÒµ½µÄÎÊÌâ¡£ | ||
61 | ×¢Ò⣺¶ÑÕ»¼ì²é²»»áÃ÷È·µØ³öÏÖÎÊÌ⣬µ«ÊÇÈκεÄÒ»¸öº¯ÊýÔÚ¶ÑÕ»ÉÏʹÓöàÓÚ512×Ö½Ú | ||
62 | ¶¼Òª×¼±¸Ð޸ġ£ | ||
63 | |||
64 | 11£º°üº¬kernel-docµ½È«¾ÖÄÚºËAPIsÎļþ¡££¨²»ÒªÇó¾²Ì¬µÄº¯Êý£¬µ«ÊÇ°üº¬Ò²ÎÞËùν¡££© | ||
65 | ʹÓÃ'make htmldocs'»òÕß'make mandocs'À´¼ì²ékernel-doc£¬È»ºóÐÞ¸ÄÈκΠ| ||
66 | ·¢ÏÖµÄÎÊÌâ¡£ | ||
67 | |||
68 | 12£ºÒѾͨ¹ý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 | |||
73 | 13£ºÒѾ¶¼¹¹½¨²¢ÇÒʹÓûòÕß²»Ê¹Óà CONFIG_SMP ºÍ CONFIG_PREEMPT²âÊÔÖ´ÐÐʱ¼ä¡£ | ||
74 | |||
75 | 14£ºÈç¹û²¹¶¡Ó°ÏìIO/Disk£¬µÈµÈ£ºÒѾͨ¹ýʹÓûòÕß²»Ê¹Óà CONFIG_LBDAF ²âÊÔ¡£ | ||
76 | |||
77 | 15£ºËùÓеÄcodepathsÒѾÐÐʹËùÓÐlockdepÆôÓù¦ÄÜ¡£ | ||
78 | |||
79 | 16£ºËùÓеÄ/proc¼Ç¼¸üж¼Òª×÷³ÉÎļþ·ÅÔÚDocumentation/Ŀ¼Ï¡£ | ||
80 | |||
81 | 17£ºËùÓеÄÄÚºËÆô¶¯²ÎÊý¸üж¼±»¼Ç¼µ½Documentation/kernel-parameters.txtÎļþÖС£ | ||
82 | |||
83 | 18£ºËùÓеÄÄ£¿é²ÎÊý¸üж¼ÓÃMODULE_PARM_DESC()¼Ç¼¡£ | ||
84 | |||
85 | 19£ºËùÓеÄÓû§¿Õ¼ä½Ó¿Ú¸üж¼±»¼Ç¼µ½Documentation/ABI/¡£²é¿´Documentation/ABI/README | ||
86 | ¿ÉÒÔ»ñµÃ¸ü¶àµÄÐÅÏ¢¡£¸Ä±äÓû§¿Õ¼ä½Ó¿ÚµÄ²¹¶¡Ó¦¸Ã±»Óʼþ³Ë͸ølinux-api@vger.kernel.org¡£ | ||
87 | |||
88 | 20£º¼ì²éËüÊDz»ÊǶ¼Í¨¹ý`make headers_check'¡£ | ||
89 | |||
90 | 21£ºÒѾͨ¹ýÖÁÉÙÒýÈëslabºÍpage-allocationʧ°Ü¼ì²é¡£²é¿´Documentation/fault-injection/¡£ | ||
91 | |||
92 | 22£ºÐ¼ÓÈëµÄÔ´ÂëÒѾͨ¹ý`gcc -W'£¨Ê¹ÓÃ"make EXTRA_CFLAGS=-W"£©±àÒë¡£ÕâÑù½«²úÉúºÜ¶à·³ÄÕ£¬ | ||
93 | µ«ÊǶÔÓÚÑ°ÕÒ©¶´ºÜÓÐÒæ´¦£¬ÀýÈç:"warning: comparison between signed and unsigned"¡£ | ||
94 | |||
95 | 23£ºµ±Ëü±»ºÏ²¢µ½-mm²¹¶¡¼¯ºóÔÙ²âÊÔ£¬ÓÃÀ´È·¶¨ËüÊÇ·ñ»¹ºÍ²¹¶¡¶ÓÁÐÖеÄÆäËû²¹¶¡Ò»Æð¹¤×÷ÒÔ¼°ÔÚVM£¬VFS | ||
96 | ºÍÆäËû×ÓϵͳÖи÷¸ö±ä»¯¡£ | ||
97 | |||
98 | 24£ºËùÓеÄÄÚ´æÆÁÕÏ{e.g., barrier(), rmb(), wmb()}ÐèÒªÔÚÔ´´úÂëÖеÄÒ»¸ö×¢ÊÍÀ´½âÊÍËûÃǶ¼ÊǸÉʲôµÄ | ||
99 | ÒÔ¼°ÔÒò¡£ | ||
100 | |||
101 | 25£ºÈç¹ûÓÐÈκÎÊäÈëÊä³ö¿ØÖƵIJ¹¶¡±»Ìí¼Ó£¬Ò²Òª¸üÐÂDocumentation/ioctl/ioctl-number.txt¡£ | ||
102 | |||
103 | 26£ºÈç¹ûÄãµÄ¸ü¸Ä´úÂëÒÀ¿¿»òÕßʹÓÃÈκεÄÄÚºË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 | |||
2294 | S: Maintained | 2294 | S: Maintained |
2295 | F: drivers/net/wan/dscc4.c | 2295 | F: drivers/net/wan/dscc4.c |
2296 | 2296 | ||
2297 | DYNAMIC DEBUG | ||
2298 | M: Jason Baron <jbaron@redhat.com> | ||
2299 | S: Maintained | ||
2300 | F: lib/dynamic_debug.c | ||
2301 | F: include/linux/dynamic_debug.h | ||
2302 | |||
2297 | DZ DECSTATION DZ11 SERIAL DRIVER | 2303 | DZ DECSTATION DZ11 SERIAL DRIVER |
2298 | M: "Maciej W. Rozycki" <macro@linux-mips.org> | 2304 | M: "Maciej W. Rozycki" <macro@linux-mips.org> |
2299 | S: Maintained | 2305 | S: 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 | ||
40 | struct 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) { | ||
83 | err: | ||
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 | |||
93 | struct device mxc_aips_bus = { | 40 | struct 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 @@ | |||
14 | extern struct device mxc_aips_bus; | 14 | extern struct device mxc_aips_bus; |
15 | extern struct device mxc_ahb_bus; | 15 | extern struct device mxc_ahb_bus; |
16 | 16 | ||
17 | struct platform_device *imx_add_platform_device_dmamask( | 17 | static 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 | ||
22 | static inline struct platform_device *imx_add_platform_device( | 34 | static 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 | ||
1767 | static int __dev_printk(const char *level, const struct device *dev, | 1767 | int __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 | } |
1776 | EXPORT_SYMBOL(__dev_printk); | ||
1776 | 1777 | ||
1777 | int dev_printk(const char *level, const struct device *dev, | 1778 | int 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 | */ | ||
230 | static 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 | */ |
230 | static int | 266 | static int |
231 | memory_block_action(unsigned long phys_index, unsigned long action) | 267 | memory_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) | |||
375 | EXPORT_SYMBOL_GPL(platform_device_unregister); | 375 | EXPORT_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 | */ |
391 | struct platform_device *platform_device_register_resndata( | 385 | struct 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) { |
416 | err: | 425 | err: |
426 | kfree(pdev->dev.dma_mask); | ||
427 | |||
428 | err_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 | } |
423 | EXPORT_SYMBOL_GPL(platform_device_register_resndata); | 435 | EXPORT_SYMBOL_GPL(platform_device_register_full); |
424 | 436 | ||
425 | static int platform_drv_probe(struct device *_dev) | 437 | static 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 | ||
601 | static ssize_t store_pch_mac(struct device *dev, struct device_attribute *attr, | 607 | static 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 | ||
70 | static ssize_t map_addr_show(struct uio_mem *mem, char *buf) | 70 | static 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 | ||
75 | static ssize_t map_size_show(struct uio_mem *mem, char *buf) | 75 | static 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 | ||
80 | static ssize_t map_offset_show(struct uio_mem *mem, char *buf) | 80 | static 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 | ||
85 | struct map_sysfs_entry { | 85 | struct 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; |
754 | out: | ||
755 | return result; | ||
756 | out_put: | 753 | out_put: |
757 | kobject_put(&cdev->kobj); | 754 | kobject_put(&cdev->kobj); |
758 | out_unregister: | 755 | out_unregister: |
759 | unregister_chrdev_region(uio_dev, UIO_MAX_DEVICES); | 756 | unregister_chrdev_region(uio_dev, UIO_MAX_DEVICES); |
760 | goto out; | 757 | out: |
758 | return result; | ||
761 | } | 759 | } |
762 | 760 | ||
763 | static void uio_major_cleanup(void) | 761 | static 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 @@ | |||
33 | struct uio_pci_generic_dev { | 32 | struct 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 | ||
39 | static inline struct uio_pci_generic_dev * | 37 | static 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) | |||
83 | done: | 80 | done: |
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 |
256 | static const struct of_device_id __devinitconst uio_of_genirq_match[] = { | 256 | static const struct of_device_id uio_of_genirq_match[] = { |
257 | { /* empty for now */ }, | 257 | { /* empty for now */ }, |
258 | }; | 258 | }; |
259 | MODULE_DEVICE_TABLE(of, uio_of_genirq_match); | 259 | MODULE_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); | |||
43 | static void sysfs_link_sibling(struct sysfs_dirent *sd) | 43 | static 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 | */ |
72 | static void sysfs_unlink_sibling(struct sysfs_dirent *sd) | 100 | static 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 | */ |
127 | void sysfs_put_active(struct sysfs_dirent *sd) | 150 | void 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) | |||
744 | static void __sysfs_remove_dir(struct sysfs_dirent *dir_sd) | 783 | static 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 | ||
205 | static 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 | |||
217 | static void sysfs_refresh_inode(struct sysfs_dirent *sd, struct inode *inode) | 205 | static 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 | ||
236 | int sysfs_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat) | 224 | int 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 | ||
15 | struct sysfs_open_dirent; | 16 | struct 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 */ |
18 | struct sysfs_elem_dir { | 19 | struct 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 | ||
24 | struct sysfs_elem_symlink { | 28 | struct 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 | ||
788 | extern int __dev_printk(const char *level, const struct device *dev, | ||
789 | struct va_format *vaf); | ||
788 | extern int dev_printk(const char *level, const struct device *dev, | 790 | extern 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 | ||
810 | static inline int __dev_printk(const char *level, const struct device *dev, | ||
811 | struct va_format *vaf) | ||
812 | { return 0; } | ||
808 | static inline int dev_printk(const char *level, const struct device *dev, | 813 | static 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 | */ | ||
8 | extern long long dynamic_debug_enabled; | ||
9 | extern 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); | |||
47 | extern int __dynamic_pr_debug(struct _ddebug *descriptor, const char *fmt, ...) | 40 | extern 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 { \ | 43 | struct device; |
51 | static struct _ddebug descriptor \ | 44 | |
52 | __used \ | 45 | extern 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__); \ | 50 | struct net_device; |
58 | } while (0) | 51 | |
59 | 52 | extern 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, ...) \ | ||
70 | do { \ | ||
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, ...) \ | ||
78 | do { \ | ||
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, ...) \ | ||
86 | do { \ | ||
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 | ||
2620 | extern int __netdev_printk(const char *level, const struct net_device *dev, | ||
2621 | struct va_format *vaf); | ||
2622 | |||
2620 | extern int netdev_printk(const char *level, const struct net_device *dev, | 2623 | extern 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...) \ |
2646 | do { \ | 2649 | do { \ |
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...) \ |
2713 | do { \ | 2715 | do { \ |
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 | |||
49 | extern int platform_get_irq_byname(struct platform_device *, const char *); | 49 | extern int platform_get_irq_byname(struct platform_device *, const char *); |
50 | extern int platform_add_devices(struct platform_device **, int); | 50 | extern int platform_add_devices(struct platform_device **, int); |
51 | 51 | ||
52 | extern struct platform_device *platform_device_register_resndata( | 52 | struct 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 | }; | ||
65 | extern 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 | */ | ||
82 | static 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 | */ |
32 | struct uio_mem { | 35 | struct 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 | ||
33 | extern struct _ddebug __start___verbose[]; | 37 | extern struct _ddebug __start___verbose[]; |
34 | extern struct _ddebug __stop___verbose[]; | 38 | extern 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 | |||
426 | static int remaining(int wrote) | ||
427 | { | ||
428 | if (PREFIX_SIZE - wrote > 0) | ||
429 | return PREFIX_SIZE - wrote; | ||
430 | return 0; | ||
431 | } | ||
432 | |||
433 | static 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 | |||
429 | int __dynamic_pr_debug(struct _ddebug *descriptor, const char *fmt, ...) | 464 | int __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 | } |
456 | EXPORT_SYMBOL(__dynamic_pr_debug); | 482 | EXPORT_SYMBOL(__dynamic_pr_debug); |
457 | 483 | ||
484 | int __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 | } | ||
503 | EXPORT_SYMBOL(__dynamic_dev_dbg); | ||
504 | |||
505 | #ifdef CONFIG_NET | ||
506 | |||
507 | int __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 | } | ||
526 | EXPORT_SYMBOL(__dynamic_netdev_dbg); | ||
527 | |||
528 | #endif | ||
529 | |||
458 | static __initdata char ddebug_setup_string[1024]; | 530 | static __initdata char ddebug_setup_string[1024]; |
459 | static __init int ddebug_setup_query(char *str) | 531 | static __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) | |||
627 | static void ddebug_proc_stop(struct seq_file *m, void *p) | 696 | static 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 | } |
710 | EXPORT_SYMBOL_GPL(ddebug_add_module); | 776 | EXPORT_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 | ||
6301 | static int __netdev_printk(const char *level, const struct net_device *dev, | 6301 | int __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 | } |
6316 | EXPORT_SYMBOL(__netdev_printk); | ||
6316 | 6317 | ||
6317 | int netdev_printk(const char *level, const struct net_device *dev, | 6318 | int netdev_printk(const char *level, const struct net_device *dev, |
6318 | const char *format, ...) | 6319 | const char *format, ...) |