diff options
149 files changed, 2664 insertions, 1170 deletions
diff --git a/Documentation/DocBook/uio-howto.tmpl b/Documentation/DocBook/uio-howto.tmpl index 52e1b79ce0e6..8f6e3b2403c7 100644 --- a/Documentation/DocBook/uio-howto.tmpl +++ b/Documentation/DocBook/uio-howto.tmpl | |||
| @@ -42,6 +42,13 @@ GPL version 2. | |||
| 42 | 42 | ||
| 43 | <revhistory> | 43 | <revhistory> |
| 44 | <revision> | 44 | <revision> |
| 45 | <revnumber>0.8</revnumber> | ||
| 46 | <date>2008-12-24</date> | ||
| 47 | <authorinitials>hjk</authorinitials> | ||
| 48 | <revremark>Added name attributes in mem and portio sysfs directories. | ||
| 49 | </revremark> | ||
| 50 | </revision> | ||
| 51 | <revision> | ||
| 45 | <revnumber>0.7</revnumber> | 52 | <revnumber>0.7</revnumber> |
| 46 | <date>2008-12-23</date> | 53 | <date>2008-12-23</date> |
| 47 | <authorinitials>hjk</authorinitials> | 54 | <authorinitials>hjk</authorinitials> |
| @@ -303,12 +310,19 @@ interested in translating it, please email me | |||
| 303 | appear if the size of the mapping is not 0. | 310 | appear if the size of the mapping is not 0. |
| 304 | </para> | 311 | </para> |
| 305 | <para> | 312 | <para> |
| 306 | Each <filename>mapX/</filename> directory contains two read-only files | 313 | Each <filename>mapX/</filename> directory contains four read-only files |
| 307 | that show start address and size of the memory: | 314 | that show attributes of the memory: |
| 308 | </para> | 315 | </para> |
| 309 | <itemizedlist> | 316 | <itemizedlist> |
| 310 | <listitem> | 317 | <listitem> |
| 311 | <para> | 318 | <para> |
| 319 | <filename>name</filename>: A string identifier for this mapping. This | ||
| 320 | is optional, the string can be empty. Drivers can set this to make it | ||
| 321 | easier for userspace to find the correct mapping. | ||
| 322 | </para> | ||
| 323 | </listitem> | ||
| 324 | <listitem> | ||
| 325 | <para> | ||
| 312 | <filename>addr</filename>: The address of memory that can be mapped. | 326 | <filename>addr</filename>: The address of memory that can be mapped. |
| 313 | </para> | 327 | </para> |
| 314 | </listitem> | 328 | </listitem> |
| @@ -366,12 +380,19 @@ offset = N * getpagesize(); | |||
| 366 | <filename>/sys/class/uio/uioX/portio/</filename>. | 380 | <filename>/sys/class/uio/uioX/portio/</filename>. |
| 367 | </para> | 381 | </para> |
| 368 | <para> | 382 | <para> |
| 369 | Each <filename>portX/</filename> directory contains three read-only | 383 | Each <filename>portX/</filename> directory contains four read-only |
| 370 | files that show start, size, and type of the port region: | 384 | files that show name, start, size, and type of the port region: |
| 371 | </para> | 385 | </para> |
| 372 | <itemizedlist> | 386 | <itemizedlist> |
| 373 | <listitem> | 387 | <listitem> |
| 374 | <para> | 388 | <para> |
| 389 | <filename>name</filename>: A string identifier for this port region. | ||
| 390 | The string is optional and can be empty. Drivers can set it to make it | ||
| 391 | easier for userspace to find a certain port region. | ||
| 392 | </para> | ||
| 393 | </listitem> | ||
| 394 | <listitem> | ||
| 395 | <para> | ||
| 375 | <filename>start</filename>: The first port of this region. | 396 | <filename>start</filename>: The first port of this region. |
| 376 | </para> | 397 | </para> |
| 377 | </listitem> | 398 | </listitem> |
diff --git a/Documentation/dynamic-debug-howto.txt b/Documentation/dynamic-debug-howto.txt new file mode 100644 index 000000000000..674c5663d346 --- /dev/null +++ b/Documentation/dynamic-debug-howto.txt | |||
| @@ -0,0 +1,240 @@ | |||
| 1 | |||
| 2 | Introduction | ||
| 3 | ============ | ||
| 4 | |||
| 5 | This document describes how to use the dynamic debug (ddebug) feature. | ||
| 6 | |||
| 7 | Dynamic debug is designed to allow you to dynamically enable/disable kernel | ||
| 8 | code to obtain additional kernel information. Currently, if | ||
| 9 | CONFIG_DYNAMIC_DEBUG is set, then all pr_debug()/dev_debug() calls can be | ||
| 10 | dynamically enabled per-callsite. | ||
| 11 | |||
| 12 | Dynamic debug has even more useful features: | ||
| 13 | |||
| 14 | * Simple query language allows turning on and off debugging statements by | ||
| 15 | matching any combination of: | ||
| 16 | |||
| 17 | - source filename | ||
| 18 | - function name | ||
| 19 | - line number (including ranges of line numbers) | ||
| 20 | - module name | ||
| 21 | - format string | ||
| 22 | |||
| 23 | * Provides a debugfs control file: <debugfs>/dynamic_debug/control which can be | ||
| 24 | read to display the complete list of known debug statements, to help guide you | ||
| 25 | |||
| 26 | Controlling dynamic debug Behaviour | ||
| 27 | =============================== | ||
| 28 | |||
| 29 | The behaviour of pr_debug()/dev_debug()s are controlled via writing to a | ||
| 30 | control file in the 'debugfs' filesystem. Thus, you must first mount the debugfs | ||
| 31 | filesystem, in order to make use of this feature. Subsequently, we refer to the | ||
| 32 | control file as: <debugfs>/dynamic_debug/control. For example, if you want to | ||
| 33 | enable printing from source file 'svcsock.c', line 1603 you simply do: | ||
| 34 | |||
| 35 | nullarbor:~ # echo 'file svcsock.c line 1603 +p' > | ||
| 36 | <debugfs>/dynamic_debug/control | ||
| 37 | |||
| 38 | If you make a mistake with the syntax, the write will fail thus: | ||
| 39 | |||
| 40 | nullarbor:~ # echo 'file svcsock.c wtf 1 +p' > | ||
| 41 | <debugfs>/dynamic_debug/control | ||
| 42 | -bash: echo: write error: Invalid argument | ||
| 43 | |||
| 44 | Viewing Dynamic Debug Behaviour | ||
| 45 | =========================== | ||
| 46 | |||
| 47 | You can view the currently configured behaviour of all the debug statements | ||
| 48 | via: | ||
| 49 | |||
| 50 | nullarbor:~ # cat <debugfs>/dynamic_debug/control | ||
| 51 | # filename:lineno [module]function flags format | ||
| 52 | /usr/src/packages/BUILD/sgi-enhancednfs-1.4/default/net/sunrpc/svc_rdma.c:323 [svcxprt_rdma]svc_rdma_cleanup - "SVCRDMA Module Removed, deregister RPC RDMA transport\012" | ||
| 53 | /usr/src/packages/BUILD/sgi-enhancednfs-1.4/default/net/sunrpc/svc_rdma.c:341 [svcxprt_rdma]svc_rdma_init - "\011max_inline : %d\012" | ||
| 54 | /usr/src/packages/BUILD/sgi-enhancednfs-1.4/default/net/sunrpc/svc_rdma.c:340 [svcxprt_rdma]svc_rdma_init - "\011sq_depth : %d\012" | ||
| 55 | /usr/src/packages/BUILD/sgi-enhancednfs-1.4/default/net/sunrpc/svc_rdma.c:338 [svcxprt_rdma]svc_rdma_init - "\011max_requests : %d\012" | ||
| 56 | ... | ||
| 57 | |||
| 58 | |||
| 59 | You can also apply standard Unix text manipulation filters to this | ||
| 60 | data, e.g. | ||
| 61 | |||
| 62 | nullarbor:~ # grep -i rdma <debugfs>/dynamic_debug/control | wc -l | ||
| 63 | 62 | ||
| 64 | |||
| 65 | nullarbor:~ # grep -i tcp <debugfs>/dynamic_debug/control | wc -l | ||
| 66 | 42 | ||
| 67 | |||
| 68 | Note in particular that the third column shows the enabled behaviour | ||
| 69 | flags for each debug statement callsite (see below for definitions of the | ||
| 70 | flags). The default value, no extra behaviour enabled, is "-". So | ||
| 71 | you can view all the debug statement callsites with any non-default flags: | ||
| 72 | |||
| 73 | nullarbor:~ # awk '$3 != "-"' <debugfs>/dynamic_debug/control | ||
| 74 | # filename:lineno [module]function flags format | ||
| 75 | /usr/src/packages/BUILD/sgi-enhancednfs-1.4/default/net/sunrpc/svcsock.c:1603 [sunrpc]svc_send p "svc_process: st_sendto returned %d\012" | ||
| 76 | |||
| 77 | |||
| 78 | Command Language Reference | ||
| 79 | ========================== | ||
| 80 | |||
| 81 | At the lexical level, a command comprises a sequence of words separated | ||
| 82 | by whitespace characters. Note that newlines are treated as word | ||
| 83 | separators and do *not* end a command or allow multiple commands to | ||
| 84 | be done together. So these are all equivalent: | ||
| 85 | |||
| 86 | nullarbor:~ # echo -c 'file svcsock.c line 1603 +p' > | ||
| 87 | <debugfs>/dynamic_debug/control | ||
| 88 | nullarbor:~ # echo -c ' file svcsock.c line 1603 +p ' > | ||
| 89 | <debugfs>/dynamic_debug/control | ||
| 90 | nullarbor:~ # echo -c 'file svcsock.c\nline 1603 +p' > | ||
| 91 | <debugfs>/dynamic_debug/control | ||
| 92 | nullarbor:~ # echo -n 'file svcsock.c line 1603 +p' > | ||
| 93 | <debugfs>/dynamic_debug/control | ||
| 94 | |||
| 95 | Commands are bounded by a write() system call. If you want to do | ||
| 96 | multiple commands you need to do a separate "echo" for each, like: | ||
| 97 | |||
| 98 | nullarbor:~ # echo 'file svcsock.c line 1603 +p' > /proc/dprintk ;\ | ||
| 99 | > echo 'file svcsock.c line 1563 +p' > /proc/dprintk | ||
| 100 | |||
| 101 | or even like: | ||
| 102 | |||
| 103 | nullarbor:~ # ( | ||
| 104 | > echo 'file svcsock.c line 1603 +p' ;\ | ||
| 105 | > echo 'file svcsock.c line 1563 +p' ;\ | ||
| 106 | > ) > /proc/dprintk | ||
| 107 | |||
| 108 | At the syntactical level, a command comprises a sequence of match | ||
| 109 | specifications, followed by a flags change specification. | ||
| 110 | |||
| 111 | command ::= match-spec* flags-spec | ||
| 112 | |||
| 113 | The match-spec's are used to choose a subset of the known dprintk() | ||
| 114 | callsites to which to apply the flags-spec. Think of them as a query | ||
| 115 | with implicit ANDs between each pair. Note that an empty list of | ||
| 116 | match-specs is possible, but is not very useful because it will not | ||
| 117 | match any debug statement callsites. | ||
| 118 | |||
| 119 | A match specification comprises a keyword, which controls the attribute | ||
| 120 | of the callsite to be compared, and a value to compare against. Possible | ||
| 121 | keywords are: | ||
| 122 | |||
| 123 | match-spec ::= 'func' string | | ||
| 124 | 'file' string | | ||
| 125 | 'module' string | | ||
| 126 | 'format' string | | ||
| 127 | 'line' line-range | ||
| 128 | |||
| 129 | line-range ::= lineno | | ||
| 130 | '-'lineno | | ||
| 131 | lineno'-' | | ||
| 132 | lineno'-'lineno | ||
| 133 | // Note: line-range cannot contain space, e.g. | ||
| 134 | // "1-30" is valid range but "1 - 30" is not. | ||
| 135 | |||
| 136 | lineno ::= unsigned-int | ||
| 137 | |||
| 138 | The meanings of each keyword are: | ||
| 139 | |||
| 140 | func | ||
| 141 | The given string is compared against the function name | ||
| 142 | of each callsite. Example: | ||
| 143 | |||
| 144 | func svc_tcp_accept | ||
| 145 | |||
| 146 | file | ||
| 147 | The given string is compared against either the full | ||
| 148 | pathname or the basename of the source file of each | ||
| 149 | callsite. Examples: | ||
| 150 | |||
| 151 | file svcsock.c | ||
| 152 | file /usr/src/packages/BUILD/sgi-enhancednfs-1.4/default/net/sunrpc/svcsock.c | ||
| 153 | |||
| 154 | module | ||
| 155 | The given string is compared against the module name | ||
| 156 | of each callsite. The module name is the string as | ||
| 157 | seen in "lsmod", i.e. without the directory or the .ko | ||
| 158 | suffix and with '-' changed to '_'. Examples: | ||
| 159 | |||
| 160 | module sunrpc | ||
| 161 | module nfsd | ||
| 162 | |||
| 163 | format | ||
| 164 | The given string is searched for in the dynamic debug format | ||
| 165 | string. Note that the string does not need to match the | ||
| 166 | entire format, only some part. Whitespace and other | ||
| 167 | special characters can be escaped using C octal character | ||
| 168 | escape \ooo notation, e.g. the space character is \040. | ||
| 169 | Alternatively, the string can be enclosed in double quote | ||
| 170 | characters (") or single quote characters ('). | ||
| 171 | Examples: | ||
| 172 | |||
| 173 | format svcrdma: // many of the NFS/RDMA server dprintks | ||
| 174 | format readahead // some dprintks in the readahead cache | ||
| 175 | format nfsd:\040SETATTR // one way to match a format with whitespace | ||
| 176 | format "nfsd: SETATTR" // a neater way to match a format with whitespace | ||
| 177 | format 'nfsd: SETATTR' // yet another way to match a format with whitespace | ||
| 178 | |||
| 179 | line | ||
| 180 | The given line number or range of line numbers is compared | ||
| 181 | against the line number of each dprintk() callsite. A single | ||
| 182 | line number matches the callsite line number exactly. A | ||
| 183 | range of line numbers matches any callsite between the first | ||
| 184 | and last line number inclusive. An empty first number means | ||
| 185 | the first line in the file, an empty line number means the | ||
| 186 | last number in the file. Examples: | ||
| 187 | |||
| 188 | line 1603 // exactly line 1603 | ||
| 189 | line 1600-1605 // the six lines from line 1600 to line 1605 | ||
| 190 | line -1605 // the 1605 lines from line 1 to line 1605 | ||
| 191 | line 1600- // all lines from line 1600 to the end of the file | ||
| 192 | |||
| 193 | The flags specification comprises a change operation followed | ||
| 194 | by one or more flag characters. The change operation is one | ||
| 195 | of the characters: | ||
| 196 | |||
| 197 | - | ||
| 198 | remove the given flags | ||
| 199 | |||
| 200 | + | ||
| 201 | add the given flags | ||
| 202 | |||
| 203 | = | ||
| 204 | set the flags to the given flags | ||
| 205 | |||
| 206 | The flags are: | ||
| 207 | |||
| 208 | p | ||
| 209 | Causes a printk() message to be emitted to dmesg | ||
| 210 | |||
| 211 | Note the regexp ^[-+=][scp]+$ matches a flags specification. | ||
| 212 | Note also that there is no convenient syntax to remove all | ||
| 213 | the flags at once, you need to use "-psc". | ||
| 214 | |||
| 215 | Examples | ||
| 216 | ======== | ||
| 217 | |||
| 218 | // enable the message at line 1603 of file svcsock.c | ||
| 219 | nullarbor:~ # echo -n 'file svcsock.c line 1603 +p' > | ||
| 220 | <debugfs>/dynamic_debug/control | ||
| 221 | |||
| 222 | // enable all the messages in file svcsock.c | ||
| 223 | nullarbor:~ # echo -n 'file svcsock.c +p' > | ||
| 224 | <debugfs>/dynamic_debug/control | ||
| 225 | |||
| 226 | // enable all the messages in the NFS server module | ||
| 227 | nullarbor:~ # echo -n 'module nfsd +p' > | ||
| 228 | <debugfs>/dynamic_debug/control | ||
| 229 | |||
| 230 | // enable all 12 messages in the function svc_process() | ||
| 231 | nullarbor:~ # echo -n 'func svc_process +p' > | ||
| 232 | <debugfs>/dynamic_debug/control | ||
| 233 | |||
| 234 | // disable all 12 messages in the function svc_process() | ||
| 235 | nullarbor:~ # echo -n 'func svc_process -p' > | ||
| 236 | <debugfs>/dynamic_debug/control | ||
| 237 | |||
| 238 | // enable messages for NFS calls READ, READLINK, READDIR and READDIR+. | ||
| 239 | nullarbor:~ # echo -n 'format "nfsd: READ" +p' > | ||
| 240 | <debugfs>/dynamic_debug/control | ||
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt index 224263e7711f..1a29ff3df3c5 100644 --- a/Documentation/kernel-parameters.txt +++ b/Documentation/kernel-parameters.txt | |||
| @@ -1826,11 +1826,6 @@ and is between 256 and 4096 characters. It is defined in the file | |||
| 1826 | autoconfiguration. | 1826 | autoconfiguration. |
| 1827 | Ranges are in pairs (memory base and size). | 1827 | Ranges are in pairs (memory base and size). |
| 1828 | 1828 | ||
| 1829 | dynamic_printk Enables pr_debug()/dev_dbg() calls if | ||
| 1830 | CONFIG_DYNAMIC_PRINTK_DEBUG has been enabled. | ||
| 1831 | These can also be switched on/off via | ||
| 1832 | <debugfs>/dynamic_printk/modules | ||
| 1833 | |||
| 1834 | print-fatal-signals= | 1829 | print-fatal-signals= |
| 1835 | [KNL] debug: print fatal signals | 1830 | [KNL] debug: print fatal signals |
| 1836 | print-fatal-signals=1: print segfault info to | 1831 | print-fatal-signals=1: print segfault info to |
diff --git a/arch/mips/basler/excite/excite_iodev.c b/arch/mips/basler/excite/excite_iodev.c index a1e3526b4a94..dfbfd7e2ac08 100644 --- a/arch/mips/basler/excite/excite_iodev.c +++ b/arch/mips/basler/excite/excite_iodev.c | |||
| @@ -33,8 +33,8 @@ | |||
| 33 | 33 | ||
| 34 | 34 | ||
| 35 | static const struct resource *iodev_get_resource(struct platform_device *, const char *, unsigned int); | 35 | static const struct resource *iodev_get_resource(struct platform_device *, const char *, unsigned int); |
| 36 | static int __init iodev_probe(struct device *); | 36 | static int __init iodev_probe(struct platform_device *); |
| 37 | static int __exit iodev_remove(struct device *); | 37 | static int __exit iodev_remove(struct platform_device *); |
| 38 | static int iodev_open(struct inode *, struct file *); | 38 | static int iodev_open(struct inode *, struct file *); |
| 39 | static int iodev_release(struct inode *, struct file *); | 39 | static int iodev_release(struct inode *, struct file *); |
| 40 | static ssize_t iodev_read(struct file *, char __user *, size_t s, loff_t *); | 40 | static ssize_t iodev_read(struct file *, char __user *, size_t s, loff_t *); |
| @@ -65,13 +65,13 @@ static struct miscdevice miscdev = | |||
| 65 | .fops = &fops | 65 | .fops = &fops |
| 66 | }; | 66 | }; |
| 67 | 67 | ||
| 68 | static struct device_driver iodev_driver = | 68 | static struct platform_driver iodev_driver = { |
| 69 | { | 69 | .driver = { |
| 70 | .name = (char *) iodev_name, | 70 | .name = iodev_name, |
| 71 | .bus = &platform_bus_type, | 71 | .owner = THIS_MODULE, |
| 72 | .owner = THIS_MODULE, | 72 | }, |
| 73 | .probe = iodev_probe, | 73 | .probe = iodev_probe, |
| 74 | .remove = __exit_p(iodev_remove) | 74 | .remove = __devexit_p(iodev_remove), |
| 75 | }; | 75 | }; |
| 76 | 76 | ||
| 77 | 77 | ||
| @@ -89,11 +89,10 @@ iodev_get_resource(struct platform_device *pdv, const char *name, | |||
| 89 | 89 | ||
| 90 | 90 | ||
| 91 | /* No hotplugging on the platform bus - use __init */ | 91 | /* No hotplugging on the platform bus - use __init */ |
| 92 | static int __init iodev_probe(struct device *dev) | 92 | static int __init iodev_probe(struct platform_device *dev) |
| 93 | { | 93 | { |
| 94 | struct platform_device * const pdv = to_platform_device(dev); | ||
| 95 | const struct resource * const ri = | 94 | const struct resource * const ri = |
| 96 | iodev_get_resource(pdv, IODEV_RESOURCE_IRQ, IORESOURCE_IRQ); | 95 | iodev_get_resource(dev, IODEV_RESOURCE_IRQ, IORESOURCE_IRQ); |
| 97 | 96 | ||
| 98 | if (unlikely(!ri)) | 97 | if (unlikely(!ri)) |
| 99 | return -ENXIO; | 98 | return -ENXIO; |
| @@ -104,7 +103,7 @@ static int __init iodev_probe(struct device *dev) | |||
| 104 | 103 | ||
| 105 | 104 | ||
| 106 | 105 | ||
| 107 | static int __exit iodev_remove(struct device *dev) | 106 | static int __exit iodev_remove(struct platform_device *dev) |
| 108 | { | 107 | { |
| 109 | return misc_deregister(&miscdev); | 108 | return misc_deregister(&miscdev); |
| 110 | } | 109 | } |
| @@ -160,14 +159,14 @@ static irqreturn_t iodev_irqhdl(int irq, void *ctxt) | |||
| 160 | 159 | ||
| 161 | static int __init iodev_init_module(void) | 160 | static int __init iodev_init_module(void) |
| 162 | { | 161 | { |
| 163 | return driver_register(&iodev_driver); | 162 | return platform_driver_register(&iodev_driver); |
| 164 | } | 163 | } |
| 165 | 164 | ||
| 166 | 165 | ||
| 167 | 166 | ||
| 168 | static void __exit iodev_cleanup_module(void) | 167 | static void __exit iodev_cleanup_module(void) |
| 169 | { | 168 | { |
| 170 | driver_unregister(&iodev_driver); | 169 | platform_driver_unregister(&iodev_driver); |
| 171 | } | 170 | } |
| 172 | 171 | ||
| 173 | module_init(iodev_init_module); | 172 | module_init(iodev_init_module); |
diff --git a/arch/powerpc/platforms/ps3/system-bus.c b/arch/powerpc/platforms/ps3/system-bus.c index 58311a867851..a705fffbb498 100644 --- a/arch/powerpc/platforms/ps3/system-bus.c +++ b/arch/powerpc/platforms/ps3/system-bus.c | |||
| @@ -376,7 +376,7 @@ static int ps3_system_bus_probe(struct device *_dev) | |||
| 376 | struct ps3_system_bus_driver *drv; | 376 | struct ps3_system_bus_driver *drv; |
| 377 | 377 | ||
| 378 | BUG_ON(!dev); | 378 | BUG_ON(!dev); |
| 379 | pr_debug(" -> %s:%d: %s\n", __func__, __LINE__, _dev->bus_id); | 379 | dev_dbg(_dev, "%s:%d\n", __func__, __LINE__); |
| 380 | 380 | ||
| 381 | drv = ps3_system_bus_dev_to_system_bus_drv(dev); | 381 | drv = ps3_system_bus_dev_to_system_bus_drv(dev); |
| 382 | BUG_ON(!drv); | 382 | BUG_ON(!drv); |
| @@ -398,7 +398,7 @@ static int ps3_system_bus_remove(struct device *_dev) | |||
| 398 | struct ps3_system_bus_driver *drv; | 398 | struct ps3_system_bus_driver *drv; |
| 399 | 399 | ||
| 400 | BUG_ON(!dev); | 400 | BUG_ON(!dev); |
| 401 | pr_debug(" -> %s:%d: %s\n", __func__, __LINE__, _dev->bus_id); | 401 | dev_dbg(_dev, "%s:%d\n", __func__, __LINE__); |
| 402 | 402 | ||
| 403 | drv = ps3_system_bus_dev_to_system_bus_drv(dev); | 403 | drv = ps3_system_bus_dev_to_system_bus_drv(dev); |
| 404 | BUG_ON(!drv); | 404 | BUG_ON(!drv); |
diff --git a/drivers/acpi/dock.c b/drivers/acpi/dock.c index 35094f230b1e..7af7db1ba8c4 100644 --- a/drivers/acpi/dock.c +++ b/drivers/acpi/dock.c | |||
| @@ -977,7 +977,7 @@ static int dock_add(acpi_handle handle) | |||
| 977 | sizeof(struct dock_station *)); | 977 | sizeof(struct dock_station *)); |
| 978 | 978 | ||
| 979 | /* we want the dock device to send uevents */ | 979 | /* we want the dock device to send uevents */ |
| 980 | dock_device->dev.uevent_suppress = 0; | 980 | dev_set_uevent_suppress(&dock_device->dev, 0); |
| 981 | 981 | ||
| 982 | if (is_dock(handle)) | 982 | if (is_dock(handle)) |
| 983 | dock_station->flags |= DOCK_IS_DOCK; | 983 | dock_station->flags |= DOCK_IS_DOCK; |
diff --git a/drivers/amba/bus.c b/drivers/amba/bus.c index 00c46e0b40e4..3d763fdf99b7 100644 --- a/drivers/amba/bus.c +++ b/drivers/amba/bus.c | |||
| @@ -210,7 +210,7 @@ int amba_device_register(struct amba_device *dev, struct resource *parent) | |||
| 210 | dev->dev.release = amba_device_release; | 210 | dev->dev.release = amba_device_release; |
| 211 | dev->dev.bus = &amba_bustype; | 211 | dev->dev.bus = &amba_bustype; |
| 212 | dev->dev.dma_mask = &dev->dma_mask; | 212 | dev->dev.dma_mask = &dev->dma_mask; |
| 213 | dev->res.name = dev->dev.bus_id; | 213 | dev->res.name = dev_name(&dev->dev); |
| 214 | 214 | ||
| 215 | if (!dev->dev.coherent_dma_mask && dev->dma_mask) | 215 | if (!dev->dev.coherent_dma_mask && dev->dma_mask) |
| 216 | dev_warn(&dev->dev, "coherent dma mask is unset\n"); | 216 | dev_warn(&dev->dev, "coherent dma mask is unset\n"); |
| @@ -294,7 +294,7 @@ static int amba_find_match(struct device *dev, void *data) | |||
| 294 | if (d->parent) | 294 | if (d->parent) |
| 295 | r &= d->parent == dev->parent; | 295 | r &= d->parent == dev->parent; |
| 296 | if (d->busid) | 296 | if (d->busid) |
| 297 | r &= strcmp(dev->bus_id, d->busid) == 0; | 297 | r &= strcmp(dev_name(dev), d->busid) == 0; |
| 298 | 298 | ||
| 299 | if (r) { | 299 | if (r) { |
| 300 | get_device(dev); | 300 | get_device(dev); |
diff --git a/drivers/base/base.h b/drivers/base/base.h index 9f50f1b545dc..ddc97496db4a 100644 --- a/drivers/base/base.h +++ b/drivers/base/base.h | |||
| @@ -63,6 +63,32 @@ struct class_private { | |||
| 63 | #define to_class(obj) \ | 63 | #define to_class(obj) \ |
| 64 | container_of(obj, struct class_private, class_subsys.kobj) | 64 | container_of(obj, struct class_private, class_subsys.kobj) |
| 65 | 65 | ||
| 66 | /** | ||
| 67 | * struct device_private - structure to hold the private to the driver core portions of the device structure. | ||
| 68 | * | ||
| 69 | * @klist_children - klist containing all children of this device | ||
| 70 | * @knode_parent - node in sibling list | ||
| 71 | * @knode_driver - node in driver list | ||
| 72 | * @knode_bus - node in bus list | ||
| 73 | * @device - pointer back to the struct class that this structure is | ||
| 74 | * associated with. | ||
| 75 | * | ||
| 76 | * Nothing outside of the driver core should ever touch these fields. | ||
| 77 | */ | ||
| 78 | struct device_private { | ||
| 79 | struct klist klist_children; | ||
| 80 | struct klist_node knode_parent; | ||
| 81 | struct klist_node knode_driver; | ||
| 82 | struct klist_node knode_bus; | ||
| 83 | struct device *device; | ||
| 84 | }; | ||
| 85 | #define to_device_private_parent(obj) \ | ||
| 86 | container_of(obj, struct device_private, knode_parent) | ||
| 87 | #define to_device_private_driver(obj) \ | ||
| 88 | container_of(obj, struct device_private, knode_driver) | ||
| 89 | #define to_device_private_bus(obj) \ | ||
| 90 | container_of(obj, struct device_private, knode_bus) | ||
| 91 | |||
| 66 | /* initialisation functions */ | 92 | /* initialisation functions */ |
| 67 | extern int devices_init(void); | 93 | extern int devices_init(void); |
| 68 | extern int buses_init(void); | 94 | extern int buses_init(void); |
| @@ -86,6 +112,11 @@ extern void bus_remove_driver(struct device_driver *drv); | |||
| 86 | 112 | ||
| 87 | extern void driver_detach(struct device_driver *drv); | 113 | extern void driver_detach(struct device_driver *drv); |
| 88 | extern int driver_probe_device(struct device_driver *drv, struct device *dev); | 114 | extern int driver_probe_device(struct device_driver *drv, struct device *dev); |
| 115 | static inline int driver_match_device(struct device_driver *drv, | ||
| 116 | struct device *dev) | ||
| 117 | { | ||
| 118 | return drv->bus->match && drv->bus->match(dev, drv); | ||
| 119 | } | ||
| 89 | 120 | ||
| 90 | extern void sysdev_shutdown(void); | 121 | extern void sysdev_shutdown(void); |
| 91 | 122 | ||
diff --git a/drivers/base/bus.c b/drivers/base/bus.c index 83f32b891fa9..dc030f1f00f1 100644 --- a/drivers/base/bus.c +++ b/drivers/base/bus.c | |||
| @@ -198,7 +198,7 @@ static ssize_t driver_bind(struct device_driver *drv, | |||
| 198 | int err = -ENODEV; | 198 | int err = -ENODEV; |
| 199 | 199 | ||
| 200 | dev = bus_find_device_by_name(bus, NULL, buf); | 200 | dev = bus_find_device_by_name(bus, NULL, buf); |
| 201 | if (dev && dev->driver == NULL) { | 201 | if (dev && dev->driver == NULL && driver_match_device(drv, dev)) { |
| 202 | if (dev->parent) /* Needed for USB */ | 202 | if (dev->parent) /* Needed for USB */ |
| 203 | down(&dev->parent->sem); | 203 | down(&dev->parent->sem); |
| 204 | down(&dev->sem); | 204 | down(&dev->sem); |
| @@ -253,7 +253,14 @@ static ssize_t store_drivers_probe(struct bus_type *bus, | |||
| 253 | static struct device *next_device(struct klist_iter *i) | 253 | static struct device *next_device(struct klist_iter *i) |
| 254 | { | 254 | { |
| 255 | struct klist_node *n = klist_next(i); | 255 | struct klist_node *n = klist_next(i); |
| 256 | return n ? container_of(n, struct device, knode_bus) : NULL; | 256 | struct device *dev = NULL; |
| 257 | struct device_private *dev_prv; | ||
| 258 | |||
| 259 | if (n) { | ||
| 260 | dev_prv = to_device_private_bus(n); | ||
| 261 | dev = dev_prv->device; | ||
| 262 | } | ||
| 263 | return dev; | ||
| 257 | } | 264 | } |
| 258 | 265 | ||
| 259 | /** | 266 | /** |
| @@ -286,7 +293,7 @@ int bus_for_each_dev(struct bus_type *bus, struct device *start, | |||
| 286 | return -EINVAL; | 293 | return -EINVAL; |
| 287 | 294 | ||
| 288 | klist_iter_init_node(&bus->p->klist_devices, &i, | 295 | klist_iter_init_node(&bus->p->klist_devices, &i, |
| 289 | (start ? &start->knode_bus : NULL)); | 296 | (start ? &start->p->knode_bus : NULL)); |
| 290 | while ((dev = next_device(&i)) && !error) | 297 | while ((dev = next_device(&i)) && !error) |
| 291 | error = fn(dev, data); | 298 | error = fn(dev, data); |
| 292 | klist_iter_exit(&i); | 299 | klist_iter_exit(&i); |
| @@ -320,7 +327,7 @@ struct device *bus_find_device(struct bus_type *bus, | |||
| 320 | return NULL; | 327 | return NULL; |
| 321 | 328 | ||
| 322 | klist_iter_init_node(&bus->p->klist_devices, &i, | 329 | klist_iter_init_node(&bus->p->klist_devices, &i, |
| 323 | (start ? &start->knode_bus : NULL)); | 330 | (start ? &start->p->knode_bus : NULL)); |
| 324 | while ((dev = next_device(&i))) | 331 | while ((dev = next_device(&i))) |
| 325 | if (match(dev, data) && get_device(dev)) | 332 | if (match(dev, data) && get_device(dev)) |
| 326 | break; | 333 | break; |
| @@ -507,7 +514,8 @@ void bus_attach_device(struct device *dev) | |||
| 507 | ret = device_attach(dev); | 514 | ret = device_attach(dev); |
| 508 | WARN_ON(ret < 0); | 515 | WARN_ON(ret < 0); |
| 509 | if (ret >= 0) | 516 | if (ret >= 0) |
| 510 | klist_add_tail(&dev->knode_bus, &bus->p->klist_devices); | 517 | klist_add_tail(&dev->p->knode_bus, |
| 518 | &bus->p->klist_devices); | ||
| 511 | } | 519 | } |
| 512 | } | 520 | } |
| 513 | 521 | ||
| @@ -528,8 +536,8 @@ void bus_remove_device(struct device *dev) | |||
| 528 | sysfs_remove_link(&dev->bus->p->devices_kset->kobj, | 536 | sysfs_remove_link(&dev->bus->p->devices_kset->kobj, |
| 529 | dev_name(dev)); | 537 | dev_name(dev)); |
| 530 | device_remove_attrs(dev->bus, dev); | 538 | device_remove_attrs(dev->bus, dev); |
| 531 | if (klist_node_attached(&dev->knode_bus)) | 539 | if (klist_node_attached(&dev->p->knode_bus)) |
| 532 | klist_del(&dev->knode_bus); | 540 | klist_del(&dev->p->knode_bus); |
| 533 | 541 | ||
| 534 | pr_debug("bus: '%s': remove device %s\n", | 542 | pr_debug("bus: '%s': remove device %s\n", |
| 535 | dev->bus->name, dev_name(dev)); | 543 | dev->bus->name, dev_name(dev)); |
| @@ -831,14 +839,16 @@ static void bus_remove_attrs(struct bus_type *bus) | |||
| 831 | 839 | ||
| 832 | static void klist_devices_get(struct klist_node *n) | 840 | static void klist_devices_get(struct klist_node *n) |
| 833 | { | 841 | { |
| 834 | struct device *dev = container_of(n, struct device, knode_bus); | 842 | struct device_private *dev_prv = to_device_private_bus(n); |
| 843 | struct device *dev = dev_prv->device; | ||
| 835 | 844 | ||
| 836 | get_device(dev); | 845 | get_device(dev); |
| 837 | } | 846 | } |
| 838 | 847 | ||
| 839 | static void klist_devices_put(struct klist_node *n) | 848 | static void klist_devices_put(struct klist_node *n) |
| 840 | { | 849 | { |
| 841 | struct device *dev = container_of(n, struct device, knode_bus); | 850 | struct device_private *dev_prv = to_device_private_bus(n); |
| 851 | struct device *dev = dev_prv->device; | ||
| 842 | 852 | ||
| 843 | put_device(dev); | 853 | put_device(dev); |
| 844 | } | 854 | } |
| @@ -932,6 +942,7 @@ bus_uevent_fail: | |||
| 932 | kset_unregister(&bus->p->subsys); | 942 | kset_unregister(&bus->p->subsys); |
| 933 | kfree(bus->p); | 943 | kfree(bus->p); |
| 934 | out: | 944 | out: |
| 945 | bus->p = NULL; | ||
| 935 | return retval; | 946 | return retval; |
| 936 | } | 947 | } |
| 937 | EXPORT_SYMBOL_GPL(bus_register); | 948 | EXPORT_SYMBOL_GPL(bus_register); |
| @@ -953,6 +964,7 @@ void bus_unregister(struct bus_type *bus) | |||
| 953 | bus_remove_file(bus, &bus_attr_uevent); | 964 | bus_remove_file(bus, &bus_attr_uevent); |
| 954 | kset_unregister(&bus->p->subsys); | 965 | kset_unregister(&bus->p->subsys); |
| 955 | kfree(bus->p); | 966 | kfree(bus->p); |
| 967 | bus->p = NULL; | ||
| 956 | } | 968 | } |
| 957 | EXPORT_SYMBOL_GPL(bus_unregister); | 969 | EXPORT_SYMBOL_GPL(bus_unregister); |
| 958 | 970 | ||
| @@ -993,18 +1005,20 @@ static void device_insertion_sort_klist(struct device *a, struct list_head *list | |||
| 993 | { | 1005 | { |
| 994 | struct list_head *pos; | 1006 | struct list_head *pos; |
| 995 | struct klist_node *n; | 1007 | struct klist_node *n; |
| 1008 | struct device_private *dev_prv; | ||
| 996 | struct device *b; | 1009 | struct device *b; |
| 997 | 1010 | ||
| 998 | list_for_each(pos, list) { | 1011 | list_for_each(pos, list) { |
| 999 | n = container_of(pos, struct klist_node, n_node); | 1012 | n = container_of(pos, struct klist_node, n_node); |
| 1000 | b = container_of(n, struct device, knode_bus); | 1013 | dev_prv = to_device_private_bus(n); |
| 1014 | b = dev_prv->device; | ||
| 1001 | if (compare(a, b) <= 0) { | 1015 | if (compare(a, b) <= 0) { |
| 1002 | list_move_tail(&a->knode_bus.n_node, | 1016 | list_move_tail(&a->p->knode_bus.n_node, |
| 1003 | &b->knode_bus.n_node); | 1017 | &b->p->knode_bus.n_node); |
| 1004 | return; | 1018 | return; |
| 1005 | } | 1019 | } |
| 1006 | } | 1020 | } |
| 1007 | list_move_tail(&a->knode_bus.n_node, list); | 1021 | list_move_tail(&a->p->knode_bus.n_node, list); |
| 1008 | } | 1022 | } |
| 1009 | 1023 | ||
| 1010 | void bus_sort_breadthfirst(struct bus_type *bus, | 1024 | void bus_sort_breadthfirst(struct bus_type *bus, |
| @@ -1014,6 +1028,7 @@ void bus_sort_breadthfirst(struct bus_type *bus, | |||
| 1014 | LIST_HEAD(sorted_devices); | 1028 | LIST_HEAD(sorted_devices); |
| 1015 | struct list_head *pos, *tmp; | 1029 | struct list_head *pos, *tmp; |
| 1016 | struct klist_node *n; | 1030 | struct klist_node *n; |
| 1031 | struct device_private *dev_prv; | ||
| 1017 | struct device *dev; | 1032 | struct device *dev; |
| 1018 | struct klist *device_klist; | 1033 | struct klist *device_klist; |
| 1019 | 1034 | ||
| @@ -1022,7 +1037,8 @@ void bus_sort_breadthfirst(struct bus_type *bus, | |||
| 1022 | spin_lock(&device_klist->k_lock); | 1037 | spin_lock(&device_klist->k_lock); |
| 1023 | list_for_each_safe(pos, tmp, &device_klist->k_list) { | 1038 | list_for_each_safe(pos, tmp, &device_klist->k_list) { |
| 1024 | n = container_of(pos, struct klist_node, n_node); | 1039 | n = container_of(pos, struct klist_node, n_node); |
| 1025 | dev = container_of(n, struct device, knode_bus); | 1040 | dev_prv = to_device_private_bus(n); |
| 1041 | dev = dev_prv->device; | ||
| 1026 | device_insertion_sort_klist(dev, &sorted_devices, compare); | 1042 | device_insertion_sort_klist(dev, &sorted_devices, compare); |
| 1027 | } | 1043 | } |
| 1028 | list_splice(&sorted_devices, &device_klist->k_list); | 1044 | list_splice(&sorted_devices, &device_klist->k_list); |
diff --git a/drivers/base/core.c b/drivers/base/core.c index f3eae630e589..e73c92d13a23 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c | |||
| @@ -109,6 +109,7 @@ static struct sysfs_ops dev_sysfs_ops = { | |||
| 109 | static void device_release(struct kobject *kobj) | 109 | static void device_release(struct kobject *kobj) |
| 110 | { | 110 | { |
| 111 | struct device *dev = to_dev(kobj); | 111 | struct device *dev = to_dev(kobj); |
| 112 | struct device_private *p = dev->p; | ||
| 112 | 113 | ||
| 113 | if (dev->release) | 114 | if (dev->release) |
| 114 | dev->release(dev); | 115 | dev->release(dev); |
| @@ -120,6 +121,7 @@ static void device_release(struct kobject *kobj) | |||
| 120 | WARN(1, KERN_ERR "Device '%s' does not have a release() " | 121 | WARN(1, KERN_ERR "Device '%s' does not have a release() " |
| 121 | "function, it is broken and must be fixed.\n", | 122 | "function, it is broken and must be fixed.\n", |
| 122 | dev_name(dev)); | 123 | dev_name(dev)); |
| 124 | kfree(p); | ||
| 123 | } | 125 | } |
| 124 | 126 | ||
| 125 | static struct kobj_type device_ktype = { | 127 | static struct kobj_type device_ktype = { |
| @@ -134,8 +136,6 @@ static int dev_uevent_filter(struct kset *kset, struct kobject *kobj) | |||
| 134 | 136 | ||
| 135 | if (ktype == &device_ktype) { | 137 | if (ktype == &device_ktype) { |
| 136 | struct device *dev = to_dev(kobj); | 138 | struct device *dev = to_dev(kobj); |
| 137 | if (dev->uevent_suppress) | ||
| 138 | return 0; | ||
| 139 | if (dev->bus) | 139 | if (dev->bus) |
| 140 | return 1; | 140 | return 1; |
| 141 | if (dev->class) | 141 | if (dev->class) |
| @@ -507,14 +507,16 @@ EXPORT_SYMBOL_GPL(device_schedule_callback_owner); | |||
| 507 | 507 | ||
| 508 | static void klist_children_get(struct klist_node *n) | 508 | static void klist_children_get(struct klist_node *n) |
| 509 | { | 509 | { |
| 510 | struct device *dev = container_of(n, struct device, knode_parent); | 510 | struct device_private *p = to_device_private_parent(n); |
| 511 | struct device *dev = p->device; | ||
| 511 | 512 | ||
| 512 | get_device(dev); | 513 | get_device(dev); |
| 513 | } | 514 | } |
| 514 | 515 | ||
| 515 | static void klist_children_put(struct klist_node *n) | 516 | static void klist_children_put(struct klist_node *n) |
| 516 | { | 517 | { |
| 517 | struct device *dev = container_of(n, struct device, knode_parent); | 518 | struct device_private *p = to_device_private_parent(n); |
| 519 | struct device *dev = p->device; | ||
| 518 | 520 | ||
| 519 | put_device(dev); | 521 | put_device(dev); |
| 520 | } | 522 | } |
| @@ -538,8 +540,6 @@ void device_initialize(struct device *dev) | |||
| 538 | { | 540 | { |
| 539 | dev->kobj.kset = devices_kset; | 541 | dev->kobj.kset = devices_kset; |
| 540 | kobject_init(&dev->kobj, &device_ktype); | 542 | kobject_init(&dev->kobj, &device_ktype); |
| 541 | klist_init(&dev->klist_children, klist_children_get, | ||
| 542 | klist_children_put); | ||
| 543 | INIT_LIST_HEAD(&dev->dma_pools); | 543 | INIT_LIST_HEAD(&dev->dma_pools); |
| 544 | init_MUTEX(&dev->sem); | 544 | init_MUTEX(&dev->sem); |
| 545 | spin_lock_init(&dev->devres_lock); | 545 | spin_lock_init(&dev->devres_lock); |
| @@ -777,17 +777,12 @@ static void device_remove_class_symlinks(struct device *dev) | |||
| 777 | int dev_set_name(struct device *dev, const char *fmt, ...) | 777 | int dev_set_name(struct device *dev, const char *fmt, ...) |
| 778 | { | 778 | { |
| 779 | va_list vargs; | 779 | va_list vargs; |
| 780 | char *s; | 780 | int err; |
| 781 | 781 | ||
| 782 | va_start(vargs, fmt); | 782 | va_start(vargs, fmt); |
| 783 | vsnprintf(dev->bus_id, sizeof(dev->bus_id), fmt, vargs); | 783 | err = kobject_set_name_vargs(&dev->kobj, fmt, vargs); |
| 784 | va_end(vargs); | 784 | va_end(vargs); |
| 785 | 785 | return err; | |
| 786 | /* ewww... some of these buggers have / in the name... */ | ||
| 787 | while ((s = strchr(dev->bus_id, '/'))) | ||
| 788 | *s = '!'; | ||
| 789 | |||
| 790 | return 0; | ||
| 791 | } | 786 | } |
| 792 | EXPORT_SYMBOL_GPL(dev_set_name); | 787 | EXPORT_SYMBOL_GPL(dev_set_name); |
| 793 | 788 | ||
| @@ -864,12 +859,26 @@ int device_add(struct device *dev) | |||
| 864 | if (!dev) | 859 | if (!dev) |
| 865 | goto done; | 860 | goto done; |
| 866 | 861 | ||
| 867 | /* Temporarily support init_name if it is set. | 862 | dev->p = kzalloc(sizeof(*dev->p), GFP_KERNEL); |
| 868 | * It will override bus_id for now */ | 863 | if (!dev->p) { |
| 869 | if (dev->init_name) | 864 | error = -ENOMEM; |
| 870 | dev_set_name(dev, "%s", dev->init_name); | 865 | goto done; |
| 866 | } | ||
| 867 | dev->p->device = dev; | ||
| 868 | klist_init(&dev->p->klist_children, klist_children_get, | ||
| 869 | klist_children_put); | ||
| 870 | |||
| 871 | /* | ||
| 872 | * for statically allocated devices, which should all be converted | ||
| 873 | * some day, we need to initialize the name. We prevent reading back | ||
| 874 | * the name, and force the use of dev_name() | ||
| 875 | */ | ||
| 876 | if (dev->init_name) { | ||
| 877 | dev_set_name(dev, dev->init_name); | ||
| 878 | dev->init_name = NULL; | ||
| 879 | } | ||
| 871 | 880 | ||
| 872 | if (!strlen(dev->bus_id)) | 881 | if (!dev_name(dev)) |
| 873 | goto done; | 882 | goto done; |
| 874 | 883 | ||
| 875 | pr_debug("device: '%s': %s\n", dev_name(dev), __func__); | 884 | pr_debug("device: '%s': %s\n", dev_name(dev), __func__); |
| @@ -928,7 +937,8 @@ int device_add(struct device *dev) | |||
| 928 | kobject_uevent(&dev->kobj, KOBJ_ADD); | 937 | kobject_uevent(&dev->kobj, KOBJ_ADD); |
| 929 | bus_attach_device(dev); | 938 | bus_attach_device(dev); |
| 930 | if (parent) | 939 | if (parent) |
| 931 | klist_add_tail(&dev->knode_parent, &parent->klist_children); | 940 | klist_add_tail(&dev->p->knode_parent, |
| 941 | &parent->p->klist_children); | ||
| 932 | 942 | ||
| 933 | if (dev->class) { | 943 | if (dev->class) { |
| 934 | mutex_lock(&dev->class->p->class_mutex); | 944 | mutex_lock(&dev->class->p->class_mutex); |
| @@ -1042,7 +1052,7 @@ void device_del(struct device *dev) | |||
| 1042 | device_pm_remove(dev); | 1052 | device_pm_remove(dev); |
| 1043 | dpm_sysfs_remove(dev); | 1053 | dpm_sysfs_remove(dev); |
| 1044 | if (parent) | 1054 | if (parent) |
| 1045 | klist_del(&dev->knode_parent); | 1055 | klist_del(&dev->p->knode_parent); |
| 1046 | if (MAJOR(dev->devt)) { | 1056 | if (MAJOR(dev->devt)) { |
| 1047 | device_remove_sys_dev_entry(dev); | 1057 | device_remove_sys_dev_entry(dev); |
| 1048 | device_remove_file(dev, &devt_attr); | 1058 | device_remove_file(dev, &devt_attr); |
| @@ -1103,7 +1113,14 @@ void device_unregister(struct device *dev) | |||
| 1103 | static struct device *next_device(struct klist_iter *i) | 1113 | static struct device *next_device(struct klist_iter *i) |
| 1104 | { | 1114 | { |
| 1105 | struct klist_node *n = klist_next(i); | 1115 | struct klist_node *n = klist_next(i); |
| 1106 | return n ? container_of(n, struct device, knode_parent) : NULL; | 1116 | struct device *dev = NULL; |
| 1117 | struct device_private *p; | ||
| 1118 | |||
| 1119 | if (n) { | ||
| 1120 | p = to_device_private_parent(n); | ||
| 1121 | dev = p->device; | ||
| 1122 | } | ||
| 1123 | return dev; | ||
| 1107 | } | 1124 | } |
| 1108 | 1125 | ||
| 1109 | /** | 1126 | /** |
| @@ -1125,7 +1142,7 @@ int device_for_each_child(struct device *parent, void *data, | |||
| 1125 | struct device *child; | 1142 | struct device *child; |
| 1126 | int error = 0; | 1143 | int error = 0; |
| 1127 | 1144 | ||
| 1128 | klist_iter_init(&parent->klist_children, &i); | 1145 | klist_iter_init(&parent->p->klist_children, &i); |
| 1129 | while ((child = next_device(&i)) && !error) | 1146 | while ((child = next_device(&i)) && !error) |
| 1130 | error = fn(child, data); | 1147 | error = fn(child, data); |
| 1131 | klist_iter_exit(&i); | 1148 | klist_iter_exit(&i); |
| @@ -1156,7 +1173,7 @@ struct device *device_find_child(struct device *parent, void *data, | |||
| 1156 | if (!parent) | 1173 | if (!parent) |
| 1157 | return NULL; | 1174 | return NULL; |
| 1158 | 1175 | ||
| 1159 | klist_iter_init(&parent->klist_children, &i); | 1176 | klist_iter_init(&parent->p->klist_children, &i); |
| 1160 | while ((child = next_device(&i))) | 1177 | while ((child = next_device(&i))) |
| 1161 | if (match(child, data) && get_device(child)) | 1178 | if (match(child, data) && get_device(child)) |
| 1162 | break; | 1179 | break; |
| @@ -1348,7 +1365,10 @@ struct device *device_create_vargs(struct class *class, struct device *parent, | |||
| 1348 | dev->release = device_create_release; | 1365 | dev->release = device_create_release; |
| 1349 | dev_set_drvdata(dev, drvdata); | 1366 | dev_set_drvdata(dev, drvdata); |
| 1350 | 1367 | ||
| 1351 | vsnprintf(dev->bus_id, BUS_ID_SIZE, fmt, args); | 1368 | retval = kobject_set_name_vargs(&dev->kobj, fmt, args); |
| 1369 | if (retval) | ||
| 1370 | goto error; | ||
| 1371 | |||
| 1352 | retval = device_register(dev); | 1372 | retval = device_register(dev); |
| 1353 | if (retval) | 1373 | if (retval) |
| 1354 | goto error; | 1374 | goto error; |
| @@ -1452,19 +1472,15 @@ int device_rename(struct device *dev, char *new_name) | |||
| 1452 | old_class_name = make_class_name(dev->class->name, &dev->kobj); | 1472 | old_class_name = make_class_name(dev->class->name, &dev->kobj); |
| 1453 | #endif | 1473 | #endif |
| 1454 | 1474 | ||
| 1455 | old_device_name = kmalloc(BUS_ID_SIZE, GFP_KERNEL); | 1475 | old_device_name = kstrdup(dev_name(dev), GFP_KERNEL); |
| 1456 | if (!old_device_name) { | 1476 | if (!old_device_name) { |
| 1457 | error = -ENOMEM; | 1477 | error = -ENOMEM; |
| 1458 | goto out; | 1478 | goto out; |
| 1459 | } | 1479 | } |
| 1460 | strlcpy(old_device_name, dev->bus_id, BUS_ID_SIZE); | ||
| 1461 | strlcpy(dev->bus_id, new_name, BUS_ID_SIZE); | ||
| 1462 | 1480 | ||
| 1463 | error = kobject_rename(&dev->kobj, new_name); | 1481 | error = kobject_rename(&dev->kobj, new_name); |
| 1464 | if (error) { | 1482 | if (error) |
| 1465 | strlcpy(dev->bus_id, old_device_name, BUS_ID_SIZE); | ||
| 1466 | goto out; | 1483 | goto out; |
| 1467 | } | ||
| 1468 | 1484 | ||
| 1469 | #ifdef CONFIG_SYSFS_DEPRECATED | 1485 | #ifdef CONFIG_SYSFS_DEPRECATED |
| 1470 | if (old_class_name) { | 1486 | if (old_class_name) { |
| @@ -1545,8 +1561,10 @@ out: | |||
| 1545 | * device_move - moves a device to a new parent | 1561 | * device_move - moves a device to a new parent |
| 1546 | * @dev: the pointer to the struct device to be moved | 1562 | * @dev: the pointer to the struct device to be moved |
| 1547 | * @new_parent: the new parent of the device (can by NULL) | 1563 | * @new_parent: the new parent of the device (can by NULL) |
| 1564 | * @dpm_order: how to reorder the dpm_list | ||
| 1548 | */ | 1565 | */ |
| 1549 | int device_move(struct device *dev, struct device *new_parent) | 1566 | int device_move(struct device *dev, struct device *new_parent, |
| 1567 | enum dpm_order dpm_order) | ||
| 1550 | { | 1568 | { |
| 1551 | int error; | 1569 | int error; |
| 1552 | struct device *old_parent; | 1570 | struct device *old_parent; |
| @@ -1556,6 +1574,7 @@ int device_move(struct device *dev, struct device *new_parent) | |||
| 1556 | if (!dev) | 1574 | if (!dev) |
| 1557 | return -EINVAL; | 1575 | return -EINVAL; |
| 1558 | 1576 | ||
| 1577 | device_pm_lock(); | ||
| 1559 | new_parent = get_device(new_parent); | 1578 | new_parent = get_device(new_parent); |
| 1560 | new_parent_kobj = get_device_parent(dev, new_parent); | 1579 | new_parent_kobj = get_device_parent(dev, new_parent); |
| 1561 | 1580 | ||
| @@ -1570,9 +1589,10 @@ int device_move(struct device *dev, struct device *new_parent) | |||
| 1570 | old_parent = dev->parent; | 1589 | old_parent = dev->parent; |
| 1571 | dev->parent = new_parent; | 1590 | dev->parent = new_parent; |
| 1572 | if (old_parent) | 1591 | if (old_parent) |
| 1573 | klist_remove(&dev->knode_parent); | 1592 | klist_remove(&dev->p->knode_parent); |
| 1574 | if (new_parent) { | 1593 | if (new_parent) { |
| 1575 | klist_add_tail(&dev->knode_parent, &new_parent->klist_children); | 1594 | klist_add_tail(&dev->p->knode_parent, |
| 1595 | &new_parent->p->klist_children); | ||
| 1576 | set_dev_node(dev, dev_to_node(new_parent)); | 1596 | set_dev_node(dev, dev_to_node(new_parent)); |
| 1577 | } | 1597 | } |
| 1578 | 1598 | ||
| @@ -1584,11 +1604,11 @@ int device_move(struct device *dev, struct device *new_parent) | |||
| 1584 | device_move_class_links(dev, new_parent, old_parent); | 1604 | device_move_class_links(dev, new_parent, old_parent); |
| 1585 | if (!kobject_move(&dev->kobj, &old_parent->kobj)) { | 1605 | if (!kobject_move(&dev->kobj, &old_parent->kobj)) { |
| 1586 | if (new_parent) | 1606 | if (new_parent) |
| 1587 | klist_remove(&dev->knode_parent); | 1607 | klist_remove(&dev->p->knode_parent); |
| 1588 | dev->parent = old_parent; | 1608 | dev->parent = old_parent; |
| 1589 | if (old_parent) { | 1609 | if (old_parent) { |
| 1590 | klist_add_tail(&dev->knode_parent, | 1610 | klist_add_tail(&dev->p->knode_parent, |
| 1591 | &old_parent->klist_children); | 1611 | &old_parent->p->klist_children); |
| 1592 | set_dev_node(dev, dev_to_node(old_parent)); | 1612 | set_dev_node(dev, dev_to_node(old_parent)); |
| 1593 | } | 1613 | } |
| 1594 | } | 1614 | } |
| @@ -1596,9 +1616,23 @@ int device_move(struct device *dev, struct device *new_parent) | |||
| 1596 | put_device(new_parent); | 1616 | put_device(new_parent); |
| 1597 | goto out; | 1617 | goto out; |
| 1598 | } | 1618 | } |
| 1619 | switch (dpm_order) { | ||
| 1620 | case DPM_ORDER_NONE: | ||
| 1621 | break; | ||
| 1622 | case DPM_ORDER_DEV_AFTER_PARENT: | ||
| 1623 | device_pm_move_after(dev, new_parent); | ||
| 1624 | break; | ||
| 1625 | case DPM_ORDER_PARENT_BEFORE_DEV: | ||
| 1626 | device_pm_move_before(new_parent, dev); | ||
| 1627 | break; | ||
| 1628 | case DPM_ORDER_DEV_LAST: | ||
| 1629 | device_pm_move_last(dev); | ||
| 1630 | break; | ||
| 1631 | } | ||
| 1599 | out_put: | 1632 | out_put: |
| 1600 | put_device(old_parent); | 1633 | put_device(old_parent); |
| 1601 | out: | 1634 | out: |
| 1635 | device_pm_unlock(); | ||
| 1602 | put_device(dev); | 1636 | put_device(dev); |
| 1603 | return error; | 1637 | return error; |
| 1604 | } | 1638 | } |
diff --git a/drivers/base/dd.c b/drivers/base/dd.c index 135231239103..f17c3266a0e0 100644 --- a/drivers/base/dd.c +++ b/drivers/base/dd.c | |||
| @@ -30,7 +30,7 @@ | |||
| 30 | 30 | ||
| 31 | static void driver_bound(struct device *dev) | 31 | static void driver_bound(struct device *dev) |
| 32 | { | 32 | { |
| 33 | if (klist_node_attached(&dev->knode_driver)) { | 33 | if (klist_node_attached(&dev->p->knode_driver)) { |
| 34 | printk(KERN_WARNING "%s: device %s already bound\n", | 34 | printk(KERN_WARNING "%s: device %s already bound\n", |
| 35 | __func__, kobject_name(&dev->kobj)); | 35 | __func__, kobject_name(&dev->kobj)); |
| 36 | return; | 36 | return; |
| @@ -43,7 +43,7 @@ static void driver_bound(struct device *dev) | |||
| 43 | blocking_notifier_call_chain(&dev->bus->p->bus_notifier, | 43 | blocking_notifier_call_chain(&dev->bus->p->bus_notifier, |
| 44 | BUS_NOTIFY_BOUND_DRIVER, dev); | 44 | BUS_NOTIFY_BOUND_DRIVER, dev); |
| 45 | 45 | ||
| 46 | klist_add_tail(&dev->knode_driver, &dev->driver->p->klist_devices); | 46 | klist_add_tail(&dev->p->knode_driver, &dev->driver->p->klist_devices); |
| 47 | } | 47 | } |
| 48 | 48 | ||
| 49 | static int driver_sysfs_add(struct device *dev) | 49 | static int driver_sysfs_add(struct device *dev) |
| @@ -172,16 +172,12 @@ int driver_probe_done(void) | |||
| 172 | /** | 172 | /** |
| 173 | * wait_for_device_probe | 173 | * wait_for_device_probe |
| 174 | * Wait for device probing to be completed. | 174 | * Wait for device probing to be completed. |
| 175 | * | ||
| 176 | * Note: this function polls at 100 msec intervals. | ||
| 177 | */ | 175 | */ |
| 178 | int wait_for_device_probe(void) | 176 | void wait_for_device_probe(void) |
| 179 | { | 177 | { |
| 180 | /* wait for the known devices to complete their probing */ | 178 | /* wait for the known devices to complete their probing */ |
| 181 | while (driver_probe_done() != 0) | 179 | wait_event(probe_waitqueue, atomic_read(&probe_count) == 0); |
| 182 | msleep(100); | ||
| 183 | async_synchronize_full(); | 180 | async_synchronize_full(); |
| 184 | return 0; | ||
| 185 | } | 181 | } |
| 186 | 182 | ||
| 187 | /** | 183 | /** |
| @@ -189,14 +185,8 @@ int wait_for_device_probe(void) | |||
| 189 | * @drv: driver to bind a device to | 185 | * @drv: driver to bind a device to |
| 190 | * @dev: device to try to bind to the driver | 186 | * @dev: device to try to bind to the driver |
| 191 | * | 187 | * |
| 192 | * First, we call the bus's match function, if one present, which should | 188 | * This function returns -ENODEV if the device is not registered, |
| 193 | * compare the device IDs the driver supports with the device IDs of the | 189 | * 1 if the device is bound sucessfully and 0 otherwise. |
| 194 | * device. Note we don't do this ourselves because we don't know the | ||
| 195 | * format of the ID structures, nor what is to be considered a match and | ||
| 196 | * what is not. | ||
| 197 | * | ||
| 198 | * This function returns 1 if a match is found, -ENODEV if the device is | ||
| 199 | * not registered, and 0 otherwise. | ||
| 200 | * | 190 | * |
| 201 | * This function must be called with @dev->sem held. When called for a | 191 | * This function must be called with @dev->sem held. When called for a |
| 202 | * USB interface, @dev->parent->sem must be held as well. | 192 | * USB interface, @dev->parent->sem must be held as well. |
| @@ -207,21 +197,22 @@ int driver_probe_device(struct device_driver *drv, struct device *dev) | |||
| 207 | 197 | ||
| 208 | if (!device_is_registered(dev)) | 198 | if (!device_is_registered(dev)) |
| 209 | return -ENODEV; | 199 | return -ENODEV; |
| 210 | if (drv->bus->match && !drv->bus->match(dev, drv)) | ||
| 211 | goto done; | ||
| 212 | 200 | ||
| 213 | pr_debug("bus: '%s': %s: matched device %s with driver %s\n", | 201 | pr_debug("bus: '%s': %s: matched device %s with driver %s\n", |
| 214 | drv->bus->name, __func__, dev_name(dev), drv->name); | 202 | drv->bus->name, __func__, dev_name(dev), drv->name); |
| 215 | 203 | ||
| 216 | ret = really_probe(dev, drv); | 204 | ret = really_probe(dev, drv); |
| 217 | 205 | ||
| 218 | done: | ||
| 219 | return ret; | 206 | return ret; |
| 220 | } | 207 | } |
| 221 | 208 | ||
| 222 | static int __device_attach(struct device_driver *drv, void *data) | 209 | static int __device_attach(struct device_driver *drv, void *data) |
| 223 | { | 210 | { |
| 224 | struct device *dev = data; | 211 | struct device *dev = data; |
| 212 | |||
| 213 | if (!driver_match_device(drv, dev)) | ||
| 214 | return 0; | ||
| 215 | |||
| 225 | return driver_probe_device(drv, dev); | 216 | return driver_probe_device(drv, dev); |
| 226 | } | 217 | } |
| 227 | 218 | ||
| @@ -274,7 +265,7 @@ static int __driver_attach(struct device *dev, void *data) | |||
| 274 | * is an error. | 265 | * is an error. |
| 275 | */ | 266 | */ |
| 276 | 267 | ||
| 277 | if (drv->bus->match && !drv->bus->match(dev, drv)) | 268 | if (!driver_match_device(drv, dev)) |
| 278 | return 0; | 269 | return 0; |
| 279 | 270 | ||
| 280 | if (dev->parent) /* Needed for USB */ | 271 | if (dev->parent) /* Needed for USB */ |
| @@ -327,7 +318,7 @@ static void __device_release_driver(struct device *dev) | |||
| 327 | drv->remove(dev); | 318 | drv->remove(dev); |
| 328 | devres_release_all(dev); | 319 | devres_release_all(dev); |
| 329 | dev->driver = NULL; | 320 | dev->driver = NULL; |
| 330 | klist_remove(&dev->knode_driver); | 321 | klist_remove(&dev->p->knode_driver); |
| 331 | } | 322 | } |
| 332 | } | 323 | } |
| 333 | 324 | ||
| @@ -357,6 +348,7 @@ EXPORT_SYMBOL_GPL(device_release_driver); | |||
| 357 | */ | 348 | */ |
| 358 | void driver_detach(struct device_driver *drv) | 349 | void driver_detach(struct device_driver *drv) |
| 359 | { | 350 | { |
| 351 | struct device_private *dev_prv; | ||
| 360 | struct device *dev; | 352 | struct device *dev; |
| 361 | 353 | ||
| 362 | for (;;) { | 354 | for (;;) { |
| @@ -365,8 +357,10 @@ void driver_detach(struct device_driver *drv) | |||
| 365 | spin_unlock(&drv->p->klist_devices.k_lock); | 357 | spin_unlock(&drv->p->klist_devices.k_lock); |
| 366 | break; | 358 | break; |
| 367 | } | 359 | } |
| 368 | dev = list_entry(drv->p->klist_devices.k_list.prev, | 360 | dev_prv = list_entry(drv->p->klist_devices.k_list.prev, |
| 369 | struct device, knode_driver.n_node); | 361 | struct device_private, |
| 362 | knode_driver.n_node); | ||
| 363 | dev = dev_prv->device; | ||
| 370 | get_device(dev); | 364 | get_device(dev); |
| 371 | spin_unlock(&drv->p->klist_devices.k_lock); | 365 | spin_unlock(&drv->p->klist_devices.k_lock); |
| 372 | 366 | ||
diff --git a/drivers/base/driver.c b/drivers/base/driver.c index 1e2bda780e48..c51f11bb29ae 100644 --- a/drivers/base/driver.c +++ b/drivers/base/driver.c | |||
| @@ -19,7 +19,14 @@ | |||
| 19 | static struct device *next_device(struct klist_iter *i) | 19 | static struct device *next_device(struct klist_iter *i) |
| 20 | { | 20 | { |
| 21 | struct klist_node *n = klist_next(i); | 21 | struct klist_node *n = klist_next(i); |
| 22 | return n ? container_of(n, struct device, knode_driver) : NULL; | 22 | struct device *dev = NULL; |
| 23 | struct device_private *dev_prv; | ||
| 24 | |||
| 25 | if (n) { | ||
| 26 | dev_prv = to_device_private_driver(n); | ||
| 27 | dev = dev_prv->device; | ||
| 28 | } | ||
| 29 | return dev; | ||
| 23 | } | 30 | } |
| 24 | 31 | ||
| 25 | /** | 32 | /** |
| @@ -42,7 +49,7 @@ int driver_for_each_device(struct device_driver *drv, struct device *start, | |||
| 42 | return -EINVAL; | 49 | return -EINVAL; |
| 43 | 50 | ||
| 44 | klist_iter_init_node(&drv->p->klist_devices, &i, | 51 | klist_iter_init_node(&drv->p->klist_devices, &i, |
| 45 | start ? &start->knode_driver : NULL); | 52 | start ? &start->p->knode_driver : NULL); |
| 46 | while ((dev = next_device(&i)) && !error) | 53 | while ((dev = next_device(&i)) && !error) |
| 47 | error = fn(dev, data); | 54 | error = fn(dev, data); |
| 48 | klist_iter_exit(&i); | 55 | klist_iter_exit(&i); |
| @@ -76,7 +83,7 @@ struct device *driver_find_device(struct device_driver *drv, | |||
| 76 | return NULL; | 83 | return NULL; |
| 77 | 84 | ||
| 78 | klist_iter_init_node(&drv->p->klist_devices, &i, | 85 | klist_iter_init_node(&drv->p->klist_devices, &i, |
| 79 | (start ? &start->knode_driver : NULL)); | 86 | (start ? &start->p->knode_driver : NULL)); |
| 80 | while ((dev = next_device(&i))) | 87 | while ((dev = next_device(&i))) |
| 81 | if (match(dev, data) && get_device(dev)) | 88 | if (match(dev, data) && get_device(dev)) |
| 82 | break; | 89 | break; |
| @@ -216,6 +223,8 @@ int driver_register(struct device_driver *drv) | |||
| 216 | int ret; | 223 | int ret; |
| 217 | struct device_driver *other; | 224 | struct device_driver *other; |
| 218 | 225 | ||
| 226 | BUG_ON(!drv->bus->p); | ||
| 227 | |||
| 219 | if ((drv->bus->probe && drv->probe) || | 228 | if ((drv->bus->probe && drv->probe) || |
| 220 | (drv->bus->remove && drv->remove) || | 229 | (drv->bus->remove && drv->remove) || |
| 221 | (drv->bus->shutdown && drv->shutdown)) | 230 | (drv->bus->shutdown && drv->shutdown)) |
diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c index 44699d9dd85c..d3a59c688fe4 100644 --- a/drivers/base/firmware_class.c +++ b/drivers/base/firmware_class.c | |||
| @@ -319,7 +319,7 @@ static int fw_register_device(struct device **dev_p, const char *fw_name, | |||
| 319 | f_dev->parent = device; | 319 | f_dev->parent = device; |
| 320 | f_dev->class = &firmware_class; | 320 | f_dev->class = &firmware_class; |
| 321 | dev_set_drvdata(f_dev, fw_priv); | 321 | dev_set_drvdata(f_dev, fw_priv); |
| 322 | f_dev->uevent_suppress = 1; | 322 | dev_set_uevent_suppress(f_dev, 1); |
| 323 | retval = device_register(f_dev); | 323 | retval = device_register(f_dev); |
| 324 | if (retval) { | 324 | if (retval) { |
| 325 | dev_err(device, "%s: device_register failed\n", __func__); | 325 | dev_err(device, "%s: device_register failed\n", __func__); |
| @@ -366,7 +366,7 @@ static int fw_setup_device(struct firmware *fw, struct device **dev_p, | |||
| 366 | } | 366 | } |
| 367 | 367 | ||
| 368 | if (uevent) | 368 | if (uevent) |
| 369 | f_dev->uevent_suppress = 0; | 369 | dev_set_uevent_suppress(f_dev, 0); |
| 370 | *dev_p = f_dev; | 370 | *dev_p = f_dev; |
| 371 | goto out; | 371 | goto out; |
| 372 | 372 | ||
diff --git a/drivers/base/platform.c b/drivers/base/platform.c index 349a1013603f..d2198f64ad4e 100644 --- a/drivers/base/platform.c +++ b/drivers/base/platform.c | |||
| @@ -217,6 +217,7 @@ int platform_device_add_data(struct platform_device *pdev, const void *data, | |||
| 217 | if (d) { | 217 | if (d) { |
| 218 | memcpy(d, data, size); | 218 | memcpy(d, data, size); |
| 219 | pdev->dev.platform_data = d; | 219 | pdev->dev.platform_data = d; |
| 220 | pdev->platform_data = d; | ||
| 220 | } | 221 | } |
| 221 | return d ? 0 : -ENOMEM; | 222 | return d ? 0 : -ENOMEM; |
| 222 | } | 223 | } |
| @@ -246,6 +247,21 @@ int platform_device_add(struct platform_device *pdev) | |||
| 246 | else | 247 | else |
| 247 | dev_set_name(&pdev->dev, pdev->name); | 248 | dev_set_name(&pdev->dev, pdev->name); |
| 248 | 249 | ||
| 250 | /* We will remove platform_data field from struct device | ||
| 251 | * if all platform devices pass its platform specific data | ||
| 252 | * from platform_device. The conversion is going to be a | ||
| 253 | * long time, so we allow the two cases coexist to make | ||
| 254 | * this kind of fix more easily*/ | ||
| 255 | if (pdev->platform_data && pdev->dev.platform_data) { | ||
| 256 | printk(KERN_ERR | ||
| 257 | "%s: use which platform_data?\n", | ||
| 258 | dev_name(&pdev->dev)); | ||
| 259 | } else if (pdev->platform_data) { | ||
| 260 | pdev->dev.platform_data = pdev->platform_data; | ||
| 261 | } else if (pdev->dev.platform_data) { | ||
| 262 | pdev->platform_data = pdev->dev.platform_data; | ||
| 263 | } | ||
| 264 | |||
| 249 | for (i = 0; i < pdev->num_resources; i++) { | 265 | for (i = 0; i < pdev->num_resources; i++) { |
| 250 | struct resource *p, *r = &pdev->resource[i]; | 266 | struct resource *p, *r = &pdev->resource[i]; |
| 251 | 267 | ||
| @@ -584,10 +600,25 @@ static int platform_uevent(struct device *dev, struct kobj_uevent_env *env) | |||
| 584 | { | 600 | { |
| 585 | struct platform_device *pdev = to_platform_device(dev); | 601 | struct platform_device *pdev = to_platform_device(dev); |
| 586 | 602 | ||
| 587 | add_uevent_var(env, "MODALIAS=platform:%s", pdev->name); | 603 | add_uevent_var(env, "MODALIAS=%s%s", PLATFORM_MODULE_PREFIX, |
| 604 | (pdev->id_entry) ? pdev->id_entry->name : pdev->name); | ||
| 588 | return 0; | 605 | return 0; |
| 589 | } | 606 | } |
| 590 | 607 | ||
| 608 | static const struct platform_device_id *platform_match_id( | ||
| 609 | struct platform_device_id *id, | ||
| 610 | struct platform_device *pdev) | ||
| 611 | { | ||
| 612 | while (id->name[0]) { | ||
| 613 | if (strcmp(pdev->name, id->name) == 0) { | ||
| 614 | pdev->id_entry = id; | ||
| 615 | return id; | ||
| 616 | } | ||
| 617 | id++; | ||
| 618 | } | ||
| 619 | return NULL; | ||
| 620 | } | ||
| 621 | |||
| 591 | /** | 622 | /** |
| 592 | * platform_match - bind platform device to platform driver. | 623 | * platform_match - bind platform device to platform driver. |
| 593 | * @dev: device. | 624 | * @dev: device. |
| @@ -603,9 +634,14 @@ static int platform_uevent(struct device *dev, struct kobj_uevent_env *env) | |||
| 603 | */ | 634 | */ |
| 604 | static int platform_match(struct device *dev, struct device_driver *drv) | 635 | static int platform_match(struct device *dev, struct device_driver *drv) |
| 605 | { | 636 | { |
| 606 | struct platform_device *pdev; | 637 | struct platform_device *pdev = to_platform_device(dev); |
| 638 | struct platform_driver *pdrv = to_platform_driver(drv); | ||
| 607 | 639 | ||
| 608 | pdev = container_of(dev, struct platform_device, dev); | 640 | /* match against the id table first */ |
| 641 | if (pdrv->id_table) | ||
| 642 | return platform_match_id(pdrv->id_table, pdev) != NULL; | ||
| 643 | |||
| 644 | /* fall-back to driver name match */ | ||
| 609 | return (strcmp(pdev->name, drv->name) == 0); | 645 | return (strcmp(pdev->name, drv->name) == 0); |
| 610 | } | 646 | } |
| 611 | 647 | ||
| @@ -623,26 +659,24 @@ static int platform_legacy_suspend(struct device *dev, pm_message_t mesg) | |||
| 623 | 659 | ||
| 624 | static int platform_legacy_suspend_late(struct device *dev, pm_message_t mesg) | 660 | static int platform_legacy_suspend_late(struct device *dev, pm_message_t mesg) |
| 625 | { | 661 | { |
| 626 | struct platform_driver *drv = to_platform_driver(dev->driver); | 662 | struct platform_driver *pdrv = to_platform_driver(dev->driver); |
| 627 | struct platform_device *pdev; | 663 | struct platform_device *pdev = to_platform_device(dev); |
| 628 | int ret = 0; | 664 | int ret = 0; |
| 629 | 665 | ||
| 630 | pdev = container_of(dev, struct platform_device, dev); | 666 | if (dev->driver && pdrv->suspend_late) |
| 631 | if (dev->driver && drv->suspend_late) | 667 | ret = pdrv->suspend_late(pdev, mesg); |
| 632 | ret = drv->suspend_late(pdev, mesg); | ||
| 633 | 668 | ||
| 634 | return ret; | 669 | return ret; |
| 635 | } | 670 | } |
| 636 | 671 | ||
| 637 | static int platform_legacy_resume_early(struct device *dev) | 672 | static int platform_legacy_resume_early(struct device *dev) |
| 638 | { | 673 | { |
| 639 | struct platform_driver *drv = to_platform_driver(dev->driver); | 674 | struct platform_driver *pdrv = to_platform_driver(dev->driver); |
| 640 | struct platform_device *pdev; | 675 | struct platform_device *pdev = to_platform_device(dev); |
| 641 | int ret = 0; | 676 | int ret = 0; |
| 642 | 677 | ||
| 643 | pdev = container_of(dev, struct platform_device, dev); | 678 | if (dev->driver && pdrv->resume_early) |
| 644 | if (dev->driver && drv->resume_early) | 679 | ret = pdrv->resume_early(pdev); |
| 645 | ret = drv->resume_early(pdev); | ||
| 646 | 680 | ||
| 647 | return ret; | 681 | return ret; |
| 648 | } | 682 | } |
diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c index 2d14f4ae6c01..e255341682c8 100644 --- a/drivers/base/power/main.c +++ b/drivers/base/power/main.c | |||
| @@ -107,6 +107,50 @@ void device_pm_remove(struct device *dev) | |||
| 107 | } | 107 | } |
| 108 | 108 | ||
| 109 | /** | 109 | /** |
| 110 | * device_pm_move_before - move device in dpm_list | ||
| 111 | * @deva: Device to move in dpm_list | ||
| 112 | * @devb: Device @deva should come before | ||
| 113 | */ | ||
| 114 | void device_pm_move_before(struct device *deva, struct device *devb) | ||
| 115 | { | ||
| 116 | pr_debug("PM: Moving %s:%s before %s:%s\n", | ||
| 117 | deva->bus ? deva->bus->name : "No Bus", | ||
| 118 | kobject_name(&deva->kobj), | ||
| 119 | devb->bus ? devb->bus->name : "No Bus", | ||
| 120 | kobject_name(&devb->kobj)); | ||
| 121 | /* Delete deva from dpm_list and reinsert before devb. */ | ||
| 122 | list_move_tail(&deva->power.entry, &devb->power.entry); | ||
| 123 | } | ||
| 124 | |||
| 125 | /** | ||
| 126 | * device_pm_move_after - move device in dpm_list | ||
| 127 | * @deva: Device to move in dpm_list | ||
| 128 | * @devb: Device @deva should come after | ||
| 129 | */ | ||
| 130 | void device_pm_move_after(struct device *deva, struct device *devb) | ||
| 131 | { | ||
| 132 | pr_debug("PM: Moving %s:%s after %s:%s\n", | ||
| 133 | deva->bus ? deva->bus->name : "No Bus", | ||
| 134 | kobject_name(&deva->kobj), | ||
| 135 | devb->bus ? devb->bus->name : "No Bus", | ||
| 136 | kobject_name(&devb->kobj)); | ||
| 137 | /* Delete deva from dpm_list and reinsert after devb. */ | ||
| 138 | list_move(&deva->power.entry, &devb->power.entry); | ||
| 139 | } | ||
| 140 | |||
| 141 | /** | ||
| 142 | * device_pm_move_last - move device to end of dpm_list | ||
| 143 | * @dev: Device to move in dpm_list | ||
| 144 | */ | ||
| 145 | void device_pm_move_last(struct device *dev) | ||
| 146 | { | ||
| 147 | pr_debug("PM: Moving %s:%s to end of list\n", | ||
| 148 | dev->bus ? dev->bus->name : "No Bus", | ||
| 149 | kobject_name(&dev->kobj)); | ||
| 150 | list_move_tail(&dev->power.entry, &dpm_list); | ||
| 151 | } | ||
| 152 | |||
| 153 | /** | ||
| 110 | * pm_op - execute the PM operation appropiate for given PM event | 154 | * pm_op - execute the PM operation appropiate for given PM event |
| 111 | * @dev: Device. | 155 | * @dev: Device. |
| 112 | * @ops: PM operations to choose from. | 156 | * @ops: PM operations to choose from. |
diff --git a/drivers/base/power/power.h b/drivers/base/power/power.h index 41f51fae042f..c7cb4fc3735c 100644 --- a/drivers/base/power/power.h +++ b/drivers/base/power/power.h | |||
| @@ -18,11 +18,19 @@ static inline struct device *to_device(struct list_head *entry) | |||
| 18 | 18 | ||
| 19 | extern void device_pm_add(struct device *); | 19 | extern void device_pm_add(struct device *); |
| 20 | extern void device_pm_remove(struct device *); | 20 | extern void device_pm_remove(struct device *); |
| 21 | extern void device_pm_move_before(struct device *, struct device *); | ||
| 22 | extern void device_pm_move_after(struct device *, struct device *); | ||
| 23 | extern void device_pm_move_last(struct device *); | ||
| 21 | 24 | ||
| 22 | #else /* CONFIG_PM_SLEEP */ | 25 | #else /* CONFIG_PM_SLEEP */ |
| 23 | 26 | ||
| 24 | static inline void device_pm_add(struct device *dev) {} | 27 | static inline void device_pm_add(struct device *dev) {} |
| 25 | static inline void device_pm_remove(struct device *dev) {} | 28 | static inline void device_pm_remove(struct device *dev) {} |
| 29 | static inline void device_pm_move_before(struct device *deva, | ||
| 30 | struct device *devb) {} | ||
| 31 | static inline void device_pm_move_after(struct device *deva, | ||
| 32 | struct device *devb) {} | ||
| 33 | static inline void device_pm_move_last(struct device *dev) {} | ||
| 26 | 34 | ||
| 27 | #endif | 35 | #endif |
| 28 | 36 | ||
diff --git a/drivers/base/sys.c b/drivers/base/sys.c index b428c8c4bc64..cbd36cf59a0f 100644 --- a/drivers/base/sys.c +++ b/drivers/base/sys.c | |||
| @@ -30,10 +30,10 @@ | |||
| 30 | 30 | ||
| 31 | 31 | ||
| 32 | static ssize_t | 32 | static ssize_t |
| 33 | sysdev_show(struct kobject * kobj, struct attribute * attr, char * buffer) | 33 | sysdev_show(struct kobject *kobj, struct attribute *attr, char *buffer) |
| 34 | { | 34 | { |
| 35 | struct sys_device * sysdev = to_sysdev(kobj); | 35 | struct sys_device *sysdev = to_sysdev(kobj); |
| 36 | struct sysdev_attribute * sysdev_attr = to_sysdev_attr(attr); | 36 | struct sysdev_attribute *sysdev_attr = to_sysdev_attr(attr); |
| 37 | 37 | ||
| 38 | if (sysdev_attr->show) | 38 | if (sysdev_attr->show) |
| 39 | return sysdev_attr->show(sysdev, sysdev_attr, buffer); | 39 | return sysdev_attr->show(sysdev, sysdev_attr, buffer); |
| @@ -42,11 +42,11 @@ sysdev_show(struct kobject * kobj, struct attribute * attr, char * buffer) | |||
| 42 | 42 | ||
| 43 | 43 | ||
| 44 | static ssize_t | 44 | static ssize_t |
| 45 | sysdev_store(struct kobject * kobj, struct attribute * attr, | 45 | sysdev_store(struct kobject *kobj, struct attribute *attr, |
| 46 | const char * buffer, size_t count) | 46 | const char *buffer, size_t count) |
| 47 | { | 47 | { |
| 48 | struct sys_device * sysdev = to_sysdev(kobj); | 48 | struct sys_device *sysdev = to_sysdev(kobj); |
| 49 | struct sysdev_attribute * sysdev_attr = to_sysdev_attr(attr); | 49 | struct sysdev_attribute *sysdev_attr = to_sysdev_attr(attr); |
| 50 | 50 | ||
| 51 | if (sysdev_attr->store) | 51 | if (sysdev_attr->store) |
| 52 | return sysdev_attr->store(sysdev, sysdev_attr, buffer, count); | 52 | return sysdev_attr->store(sysdev, sysdev_attr, buffer, count); |
| @@ -63,13 +63,13 @@ static struct kobj_type ktype_sysdev = { | |||
| 63 | }; | 63 | }; |
| 64 | 64 | ||
| 65 | 65 | ||
| 66 | int sysdev_create_file(struct sys_device * s, struct sysdev_attribute * a) | 66 | int sysdev_create_file(struct sys_device *s, struct sysdev_attribute *a) |
| 67 | { | 67 | { |
| 68 | return sysfs_create_file(&s->kobj, &a->attr); | 68 | return sysfs_create_file(&s->kobj, &a->attr); |
| 69 | } | 69 | } |
| 70 | 70 | ||
| 71 | 71 | ||
| 72 | void sysdev_remove_file(struct sys_device * s, struct sysdev_attribute * a) | 72 | void sysdev_remove_file(struct sys_device *s, struct sysdev_attribute *a) |
| 73 | { | 73 | { |
| 74 | sysfs_remove_file(&s->kobj, &a->attr); | 74 | sysfs_remove_file(&s->kobj, &a->attr); |
| 75 | } | 75 | } |
| @@ -84,7 +84,7 @@ EXPORT_SYMBOL_GPL(sysdev_remove_file); | |||
| 84 | static ssize_t sysdev_class_show(struct kobject *kobj, struct attribute *attr, | 84 | static ssize_t sysdev_class_show(struct kobject *kobj, struct attribute *attr, |
| 85 | char *buffer) | 85 | char *buffer) |
| 86 | { | 86 | { |
| 87 | struct sysdev_class * class = to_sysdev_class(kobj); | 87 | struct sysdev_class *class = to_sysdev_class(kobj); |
| 88 | struct sysdev_class_attribute *class_attr = to_sysdev_class_attr(attr); | 88 | struct sysdev_class_attribute *class_attr = to_sysdev_class_attr(attr); |
| 89 | 89 | ||
| 90 | if (class_attr->show) | 90 | if (class_attr->show) |
| @@ -95,8 +95,8 @@ static ssize_t sysdev_class_show(struct kobject *kobj, struct attribute *attr, | |||
| 95 | static ssize_t sysdev_class_store(struct kobject *kobj, struct attribute *attr, | 95 | static ssize_t sysdev_class_store(struct kobject *kobj, struct attribute *attr, |
| 96 | const char *buffer, size_t count) | 96 | const char *buffer, size_t count) |
| 97 | { | 97 | { |
| 98 | struct sysdev_class * class = to_sysdev_class(kobj); | 98 | struct sysdev_class *class = to_sysdev_class(kobj); |
| 99 | struct sysdev_class_attribute * class_attr = to_sysdev_class_attr(attr); | 99 | struct sysdev_class_attribute *class_attr = to_sysdev_class_attr(attr); |
| 100 | 100 | ||
| 101 | if (class_attr->store) | 101 | if (class_attr->store) |
| 102 | return class_attr->store(class, buffer, count); | 102 | return class_attr->store(class, buffer, count); |
| @@ -128,7 +128,7 @@ EXPORT_SYMBOL_GPL(sysdev_class_remove_file); | |||
| 128 | 128 | ||
| 129 | static struct kset *system_kset; | 129 | static struct kset *system_kset; |
| 130 | 130 | ||
| 131 | int sysdev_class_register(struct sysdev_class * cls) | 131 | int sysdev_class_register(struct sysdev_class *cls) |
| 132 | { | 132 | { |
| 133 | pr_debug("Registering sysdev class '%s'\n", cls->name); | 133 | pr_debug("Registering sysdev class '%s'\n", cls->name); |
| 134 | 134 | ||
| @@ -141,7 +141,7 @@ int sysdev_class_register(struct sysdev_class * cls) | |||
| 141 | return kset_register(&cls->kset); | 141 | return kset_register(&cls->kset); |
| 142 | } | 142 | } |
| 143 | 143 | ||
| 144 | void sysdev_class_unregister(struct sysdev_class * cls) | 144 | void sysdev_class_unregister(struct sysdev_class *cls) |
| 145 | { | 145 | { |
| 146 | pr_debug("Unregistering sysdev class '%s'\n", | 146 | pr_debug("Unregistering sysdev class '%s'\n", |
| 147 | kobject_name(&cls->kset.kobj)); | 147 | kobject_name(&cls->kset.kobj)); |
| @@ -203,8 +203,8 @@ int sysdev_driver_register(struct sysdev_class *cls, struct sysdev_driver *drv) | |||
| 203 | * @cls: Class driver belongs to. | 203 | * @cls: Class driver belongs to. |
| 204 | * @drv: Driver. | 204 | * @drv: Driver. |
| 205 | */ | 205 | */ |
| 206 | void sysdev_driver_unregister(struct sysdev_class * cls, | 206 | void sysdev_driver_unregister(struct sysdev_class *cls, |
| 207 | struct sysdev_driver * drv) | 207 | struct sysdev_driver *drv) |
| 208 | { | 208 | { |
| 209 | mutex_lock(&sysdev_drivers_lock); | 209 | mutex_lock(&sysdev_drivers_lock); |
| 210 | list_del_init(&drv->entry); | 210 | list_del_init(&drv->entry); |
| @@ -229,10 +229,10 @@ EXPORT_SYMBOL_GPL(sysdev_driver_unregister); | |||
| 229 | * @sysdev: device in question | 229 | * @sysdev: device in question |
| 230 | * | 230 | * |
| 231 | */ | 231 | */ |
| 232 | int sysdev_register(struct sys_device * sysdev) | 232 | int sysdev_register(struct sys_device *sysdev) |
| 233 | { | 233 | { |
| 234 | int error; | 234 | int error; |
| 235 | struct sysdev_class * cls = sysdev->cls; | 235 | struct sysdev_class *cls = sysdev->cls; |
| 236 | 236 | ||
| 237 | if (!cls) | 237 | if (!cls) |
| 238 | return -EINVAL; | 238 | return -EINVAL; |
| @@ -252,7 +252,7 @@ int sysdev_register(struct sys_device * sysdev) | |||
| 252 | sysdev->id); | 252 | sysdev->id); |
| 253 | 253 | ||
| 254 | if (!error) { | 254 | if (!error) { |
| 255 | struct sysdev_driver * drv; | 255 | struct sysdev_driver *drv; |
| 256 | 256 | ||
| 257 | pr_debug("Registering sys device '%s'\n", | 257 | pr_debug("Registering sys device '%s'\n", |
| 258 | kobject_name(&sysdev->kobj)); | 258 | kobject_name(&sysdev->kobj)); |
| @@ -274,9 +274,9 @@ int sysdev_register(struct sys_device * sysdev) | |||
| 274 | return error; | 274 | return error; |
| 275 | } | 275 | } |
| 276 | 276 | ||
| 277 | void sysdev_unregister(struct sys_device * sysdev) | 277 | void sysdev_unregister(struct sys_device *sysdev) |
| 278 | { | 278 | { |
| 279 | struct sysdev_driver * drv; | 279 | struct sysdev_driver *drv; |
| 280 | 280 | ||
| 281 | mutex_lock(&sysdev_drivers_lock); | 281 | mutex_lock(&sysdev_drivers_lock); |
| 282 | list_for_each_entry(drv, &sysdev->cls->drivers, entry) { | 282 | list_for_each_entry(drv, &sysdev->cls->drivers, entry) { |
| @@ -305,19 +305,19 @@ void sysdev_unregister(struct sys_device * sysdev) | |||
| 305 | */ | 305 | */ |
| 306 | void sysdev_shutdown(void) | 306 | void sysdev_shutdown(void) |
| 307 | { | 307 | { |
| 308 | struct sysdev_class * cls; | 308 | struct sysdev_class *cls; |
| 309 | 309 | ||
| 310 | pr_debug("Shutting Down System Devices\n"); | 310 | pr_debug("Shutting Down System Devices\n"); |
| 311 | 311 | ||
| 312 | mutex_lock(&sysdev_drivers_lock); | 312 | mutex_lock(&sysdev_drivers_lock); |
| 313 | list_for_each_entry_reverse(cls, &system_kset->list, kset.kobj.entry) { | 313 | list_for_each_entry_reverse(cls, &system_kset->list, kset.kobj.entry) { |
| 314 | struct sys_device * sysdev; | 314 | struct sys_device *sysdev; |
| 315 | 315 | ||
| 316 | pr_debug("Shutting down type '%s':\n", | 316 | pr_debug("Shutting down type '%s':\n", |
| 317 | kobject_name(&cls->kset.kobj)); | 317 | kobject_name(&cls->kset.kobj)); |
| 318 | 318 | ||
| 319 | list_for_each_entry(sysdev, &cls->kset.list, kobj.entry) { | 319 | list_for_each_entry(sysdev, &cls->kset.list, kobj.entry) { |
| 320 | struct sysdev_driver * drv; | 320 | struct sysdev_driver *drv; |
| 321 | pr_debug(" %s\n", kobject_name(&sysdev->kobj)); | 321 | pr_debug(" %s\n", kobject_name(&sysdev->kobj)); |
| 322 | 322 | ||
| 323 | /* Call auxillary drivers first */ | 323 | /* Call auxillary drivers first */ |
| @@ -364,7 +364,7 @@ static void __sysdev_resume(struct sys_device *dev) | |||
| 364 | */ | 364 | */ |
| 365 | int sysdev_suspend(pm_message_t state) | 365 | int sysdev_suspend(pm_message_t state) |
| 366 | { | 366 | { |
| 367 | struct sysdev_class * cls; | 367 | struct sysdev_class *cls; |
| 368 | struct sys_device *sysdev, *err_dev; | 368 | struct sys_device *sysdev, *err_dev; |
| 369 | struct sysdev_driver *drv, *err_drv; | 369 | struct sysdev_driver *drv, *err_drv; |
| 370 | int ret; | 370 | int ret; |
| @@ -442,12 +442,12 @@ EXPORT_SYMBOL_GPL(sysdev_suspend); | |||
| 442 | */ | 442 | */ |
| 443 | int sysdev_resume(void) | 443 | int sysdev_resume(void) |
| 444 | { | 444 | { |
| 445 | struct sysdev_class * cls; | 445 | struct sysdev_class *cls; |
| 446 | 446 | ||
| 447 | pr_debug("Resuming System Devices\n"); | 447 | pr_debug("Resuming System Devices\n"); |
| 448 | 448 | ||
| 449 | list_for_each_entry(cls, &system_kset->list, kset.kobj.entry) { | 449 | list_for_each_entry(cls, &system_kset->list, kset.kobj.entry) { |
| 450 | struct sys_device * sysdev; | 450 | struct sys_device *sysdev; |
| 451 | 451 | ||
| 452 | pr_debug("Resuming type '%s':\n", | 452 | pr_debug("Resuming type '%s':\n", |
| 453 | kobject_name(&cls->kset.kobj)); | 453 | kobject_name(&cls->kset.kobj)); |
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c index 83d8ed39433d..c2c95e614506 100644 --- a/drivers/block/floppy.c +++ b/drivers/block/floppy.c | |||
| @@ -4135,10 +4135,9 @@ static int have_no_fdc = -ENODEV; | |||
| 4135 | static ssize_t floppy_cmos_show(struct device *dev, | 4135 | static ssize_t floppy_cmos_show(struct device *dev, |
| 4136 | struct device_attribute *attr, char *buf) | 4136 | struct device_attribute *attr, char *buf) |
| 4137 | { | 4137 | { |
| 4138 | struct platform_device *p; | 4138 | struct platform_device *p = to_platform_device(dev); |
| 4139 | int drive; | 4139 | int drive; |
| 4140 | 4140 | ||
| 4141 | p = container_of(dev, struct platform_device,dev); | ||
| 4142 | drive = p->id; | 4141 | drive = p->id; |
| 4143 | return sprintf(buf, "%X\n", UDP->cmos); | 4142 | return sprintf(buf, "%X\n", UDP->cmos); |
| 4144 | } | 4143 | } |
diff --git a/drivers/char/tpm/tpm_atmel.c b/drivers/char/tpm/tpm_atmel.c index d0e7926eb486..c64a1bc65349 100644 --- a/drivers/char/tpm/tpm_atmel.c +++ b/drivers/char/tpm/tpm_atmel.c | |||
| @@ -168,12 +168,22 @@ static void atml_plat_remove(void) | |||
| 168 | } | 168 | } |
| 169 | } | 169 | } |
| 170 | 170 | ||
| 171 | static struct device_driver atml_drv = { | 171 | static int tpm_atml_suspend(struct platform_device *dev, pm_message_t msg) |
| 172 | .name = "tpm_atmel", | 172 | { |
| 173 | .bus = &platform_bus_type, | 173 | return tpm_pm_suspend(&dev->dev, msg); |
| 174 | .owner = THIS_MODULE, | 174 | } |
| 175 | .suspend = tpm_pm_suspend, | 175 | |
| 176 | .resume = tpm_pm_resume, | 176 | static int tpm_atml_resume(struct platform_device *dev) |
| 177 | { | ||
| 178 | return tpm_pm_resume(&dev->dev); | ||
| 179 | } | ||
| 180 | static struct platform_driver atml_drv = { | ||
| 181 | .driver = { | ||
| 182 | .name = "tpm_atmel", | ||
| 183 | .owner = THIS_MODULE, | ||
| 184 | }, | ||
| 185 | .suspend = tpm_atml_suspend, | ||
| 186 | .resume = tpm_atml_resume, | ||
| 177 | }; | 187 | }; |
| 178 | 188 | ||
| 179 | static int __init init_atmel(void) | 189 | static int __init init_atmel(void) |
| @@ -184,7 +194,7 @@ static int __init init_atmel(void) | |||
| 184 | unsigned long base; | 194 | unsigned long base; |
| 185 | struct tpm_chip *chip; | 195 | struct tpm_chip *chip; |
| 186 | 196 | ||
| 187 | rc = driver_register(&atml_drv); | 197 | rc = platform_driver_register(&atml_drv); |
| 188 | if (rc) | 198 | if (rc) |
| 189 | return rc; | 199 | return rc; |
| 190 | 200 | ||
| @@ -223,13 +233,13 @@ err_rel_reg: | |||
| 223 | atmel_release_region(base, | 233 | atmel_release_region(base, |
| 224 | region_size); | 234 | region_size); |
| 225 | err_unreg_drv: | 235 | err_unreg_drv: |
| 226 | driver_unregister(&atml_drv); | 236 | platform_driver_unregister(&atml_drv); |
| 227 | return rc; | 237 | return rc; |
| 228 | } | 238 | } |
| 229 | 239 | ||
| 230 | static void __exit cleanup_atmel(void) | 240 | static void __exit cleanup_atmel(void) |
| 231 | { | 241 | { |
| 232 | driver_unregister(&atml_drv); | 242 | platform_driver_unregister(&atml_drv); |
| 233 | atml_plat_remove(); | 243 | atml_plat_remove(); |
| 234 | } | 244 | } |
| 235 | 245 | ||
diff --git a/drivers/char/tpm/tpm_tis.c b/drivers/char/tpm/tpm_tis.c index 717af7ad1bdf..aec1931608aa 100644 --- a/drivers/char/tpm/tpm_tis.c +++ b/drivers/char/tpm/tpm_tis.c | |||
| @@ -654,12 +654,22 @@ module_param_string(hid, tpm_pnp_tbl[TIS_HID_USR_IDX].id, | |||
| 654 | sizeof(tpm_pnp_tbl[TIS_HID_USR_IDX].id), 0444); | 654 | sizeof(tpm_pnp_tbl[TIS_HID_USR_IDX].id), 0444); |
| 655 | MODULE_PARM_DESC(hid, "Set additional specific HID for this driver to probe"); | 655 | MODULE_PARM_DESC(hid, "Set additional specific HID for this driver to probe"); |
| 656 | 656 | ||
| 657 | static struct device_driver tis_drv = { | 657 | static int tpm_tis_suspend(struct platform_device *dev, pm_message_t msg) |
| 658 | .name = "tpm_tis", | 658 | { |
| 659 | .bus = &platform_bus_type, | 659 | return tpm_pm_suspend(&dev->dev, msg); |
| 660 | .owner = THIS_MODULE, | 660 | } |
| 661 | .suspend = tpm_pm_suspend, | 661 | |
| 662 | .resume = tpm_pm_resume, | 662 | static int tpm_tis_resume(struct platform_device *dev) |
| 663 | { | ||
| 664 | return tpm_pm_resume(&dev->dev); | ||
| 665 | } | ||
| 666 | static struct platform_driver tis_drv = { | ||
| 667 | .driver = { | ||
| 668 | .name = "tpm_tis", | ||
| 669 | .owner = THIS_MODULE, | ||
| 670 | }, | ||
| 671 | .suspend = tpm_tis_suspend, | ||
| 672 | .resume = tpm_tis_resume, | ||
| 663 | }; | 673 | }; |
| 664 | 674 | ||
| 665 | static struct platform_device *pdev; | 675 | static struct platform_device *pdev; |
| @@ -672,14 +682,14 @@ static int __init init_tis(void) | |||
| 672 | int rc; | 682 | int rc; |
| 673 | 683 | ||
| 674 | if (force) { | 684 | if (force) { |
| 675 | rc = driver_register(&tis_drv); | 685 | rc = platform_driver_register(&tis_drv); |
| 676 | if (rc < 0) | 686 | if (rc < 0) |
| 677 | return rc; | 687 | return rc; |
| 678 | if (IS_ERR(pdev=platform_device_register_simple("tpm_tis", -1, NULL, 0))) | 688 | if (IS_ERR(pdev=platform_device_register_simple("tpm_tis", -1, NULL, 0))) |
| 679 | return PTR_ERR(pdev); | 689 | return PTR_ERR(pdev); |
| 680 | if((rc=tpm_tis_init(&pdev->dev, TIS_MEM_BASE, TIS_MEM_LEN, 0)) != 0) { | 690 | if((rc=tpm_tis_init(&pdev->dev, TIS_MEM_BASE, TIS_MEM_LEN, 0)) != 0) { |
| 681 | platform_device_unregister(pdev); | 691 | platform_device_unregister(pdev); |
| 682 | driver_unregister(&tis_drv); | 692 | platform_driver_unregister(&tis_drv); |
| 683 | } | 693 | } |
| 684 | return rc; | 694 | return rc; |
| 685 | } | 695 | } |
| @@ -711,7 +721,7 @@ static void __exit cleanup_tis(void) | |||
| 711 | 721 | ||
| 712 | if (force) { | 722 | if (force) { |
| 713 | platform_device_unregister(pdev); | 723 | platform_device_unregister(pdev); |
| 714 | driver_unregister(&tis_drv); | 724 | platform_driver_unregister(&tis_drv); |
| 715 | } else | 725 | } else |
| 716 | pnp_unregister_driver(&tis_pnp_driver); | 726 | pnp_unregister_driver(&tis_pnp_driver); |
| 717 | } | 727 | } |
diff --git a/drivers/char/vc_screen.c b/drivers/char/vc_screen.c index 4f3b3f95fc42..d94d25c12aa8 100644 --- a/drivers/char/vc_screen.c +++ b/drivers/char/vc_screen.c | |||
| @@ -479,18 +479,18 @@ static const struct file_operations vcs_fops = { | |||
| 479 | 479 | ||
| 480 | static struct class *vc_class; | 480 | static struct class *vc_class; |
| 481 | 481 | ||
| 482 | void vcs_make_sysfs(struct tty_struct *tty) | 482 | void vcs_make_sysfs(int index) |
| 483 | { | 483 | { |
| 484 | device_create(vc_class, NULL, MKDEV(VCS_MAJOR, tty->index + 1), NULL, | 484 | device_create(vc_class, NULL, MKDEV(VCS_MAJOR, index + 1), NULL, |
| 485 | "vcs%u", tty->index + 1); | 485 | "vcs%u", index + 1); |
| 486 | device_create(vc_class, NULL, MKDEV(VCS_MAJOR, tty->index + 129), NULL, | 486 | device_create(vc_class, NULL, MKDEV(VCS_MAJOR, index + 129), NULL, |
| 487 | "vcsa%u", tty->index + 1); | 487 | "vcsa%u", index + 1); |
| 488 | } | 488 | } |
| 489 | 489 | ||
| 490 | void vcs_remove_sysfs(struct tty_struct *tty) | 490 | void vcs_remove_sysfs(int index) |
| 491 | { | 491 | { |
| 492 | device_destroy(vc_class, MKDEV(VCS_MAJOR, tty->index + 1)); | 492 | device_destroy(vc_class, MKDEV(VCS_MAJOR, index + 1)); |
| 493 | device_destroy(vc_class, MKDEV(VCS_MAJOR, tty->index + 129)); | 493 | device_destroy(vc_class, MKDEV(VCS_MAJOR, index + 129)); |
| 494 | } | 494 | } |
| 495 | 495 | ||
| 496 | int __init vcs_init(void) | 496 | int __init vcs_init(void) |
diff --git a/drivers/char/vt.c b/drivers/char/vt.c index 7900bd63b36d..2c1d133819b5 100644 --- a/drivers/char/vt.c +++ b/drivers/char/vt.c | |||
| @@ -778,6 +778,7 @@ int vc_allocate(unsigned int currcons) /* return 0 on success */ | |||
| 778 | } | 778 | } |
| 779 | vc->vc_kmalloced = 1; | 779 | vc->vc_kmalloced = 1; |
| 780 | vc_init(vc, vc->vc_rows, vc->vc_cols, 1); | 780 | vc_init(vc, vc->vc_rows, vc->vc_cols, 1); |
| 781 | vcs_make_sysfs(currcons); | ||
| 781 | atomic_notifier_call_chain(&vt_notifier_list, VT_ALLOCATE, ¶m); | 782 | atomic_notifier_call_chain(&vt_notifier_list, VT_ALLOCATE, ¶m); |
| 782 | } | 783 | } |
| 783 | return 0; | 784 | return 0; |
| @@ -987,7 +988,9 @@ void vc_deallocate(unsigned int currcons) | |||
| 987 | if (vc_cons_allocated(currcons)) { | 988 | if (vc_cons_allocated(currcons)) { |
| 988 | struct vc_data *vc = vc_cons[currcons].d; | 989 | struct vc_data *vc = vc_cons[currcons].d; |
| 989 | struct vt_notifier_param param = { .vc = vc }; | 990 | struct vt_notifier_param param = { .vc = vc }; |
| 991 | |||
| 990 | atomic_notifier_call_chain(&vt_notifier_list, VT_DEALLOCATE, ¶m); | 992 | atomic_notifier_call_chain(&vt_notifier_list, VT_DEALLOCATE, ¶m); |
| 993 | vcs_remove_sysfs(currcons); | ||
| 991 | vc->vc_sw->con_deinit(vc); | 994 | vc->vc_sw->con_deinit(vc); |
| 992 | put_pid(vc->vt_pid); | 995 | put_pid(vc->vt_pid); |
| 993 | module_put(vc->vc_sw->owner); | 996 | module_put(vc->vc_sw->owner); |
| @@ -2775,7 +2778,6 @@ static int con_open(struct tty_struct *tty, struct file *filp) | |||
| 2775 | tty->termios->c_iflag |= IUTF8; | 2778 | tty->termios->c_iflag |= IUTF8; |
| 2776 | else | 2779 | else |
| 2777 | tty->termios->c_iflag &= ~IUTF8; | 2780 | tty->termios->c_iflag &= ~IUTF8; |
| 2778 | vcs_make_sysfs(tty); | ||
| 2779 | release_console_sem(); | 2781 | release_console_sem(); |
| 2780 | return ret; | 2782 | return ret; |
| 2781 | } | 2783 | } |
| @@ -2795,7 +2797,6 @@ static void con_shutdown(struct tty_struct *tty) | |||
| 2795 | BUG_ON(vc == NULL); | 2797 | BUG_ON(vc == NULL); |
| 2796 | acquire_console_sem(); | 2798 | acquire_console_sem(); |
| 2797 | vc->vc_tty = NULL; | 2799 | vc->vc_tty = NULL; |
| 2798 | vcs_remove_sysfs(tty); | ||
| 2799 | release_console_sem(); | 2800 | release_console_sem(); |
| 2800 | tty_shutdown(tty); | 2801 | tty_shutdown(tty); |
| 2801 | } | 2802 | } |
diff --git a/drivers/dio/dio.c b/drivers/dio/dio.c index 10c3c498358c..55dd88d82d6d 100644 --- a/drivers/dio/dio.c +++ b/drivers/dio/dio.c | |||
| @@ -182,7 +182,7 @@ static int __init dio_init(void) | |||
| 182 | 182 | ||
| 183 | /* Initialize the DIO bus */ | 183 | /* Initialize the DIO bus */ |
| 184 | INIT_LIST_HEAD(&dio_bus.devices); | 184 | INIT_LIST_HEAD(&dio_bus.devices); |
| 185 | strcpy(dio_bus.dev.bus_id, "dio"); | 185 | dev_set_name(&dio_bus.dev, "dio"); |
| 186 | error = device_register(&dio_bus.dev); | 186 | error = device_register(&dio_bus.dev); |
| 187 | if (error) { | 187 | if (error) { |
| 188 | pr_err("DIO: Error registering dio_bus\n"); | 188 | pr_err("DIO: Error registering dio_bus\n"); |
| @@ -237,7 +237,7 @@ static int __init dio_init(void) | |||
| 237 | dev->scode = scode; | 237 | dev->scode = scode; |
| 238 | dev->resource.start = pa; | 238 | dev->resource.start = pa; |
| 239 | dev->resource.end = pa + DIO_SIZE(scode, va); | 239 | dev->resource.end = pa + DIO_SIZE(scode, va); |
| 240 | sprintf(dev->dev.bus_id,"%02x", scode); | 240 | dev_set_name(&dev->dev, "%02x", scode); |
| 241 | 241 | ||
| 242 | /* read the ID byte(s) and encode if necessary. */ | 242 | /* read the ID byte(s) and encode if necessary. */ |
| 243 | prid = DIO_ID(va); | 243 | prid = DIO_ID(va); |
diff --git a/drivers/dma/dw_dmac.c b/drivers/dma/dw_dmac.c index a97c07eef7ec..20ad3d26bec2 100644 --- a/drivers/dma/dw_dmac.c +++ b/drivers/dma/dw_dmac.c | |||
| @@ -1011,7 +1011,7 @@ static int __init dw_probe(struct platform_device *pdev) | |||
| 1011 | dma_writel(dw, CFG, DW_CFG_DMA_EN); | 1011 | dma_writel(dw, CFG, DW_CFG_DMA_EN); |
| 1012 | 1012 | ||
| 1013 | printk(KERN_INFO "%s: DesignWare DMA Controller, %d channels\n", | 1013 | printk(KERN_INFO "%s: DesignWare DMA Controller, %d channels\n", |
| 1014 | pdev->dev.bus_id, dw->dma.chancnt); | 1014 | dev_name(&pdev->dev), dw->dma.chancnt); |
| 1015 | 1015 | ||
| 1016 | dma_async_device_register(&dw->dma); | 1016 | dma_async_device_register(&dw->dma); |
| 1017 | 1017 | ||
diff --git a/drivers/edac/cell_edac.c b/drivers/edac/cell_edac.c index 24f3ca851523..cb0f639f049d 100644 --- a/drivers/edac/cell_edac.c +++ b/drivers/edac/cell_edac.c | |||
| @@ -198,7 +198,7 @@ static int __devinit cell_edac_probe(struct platform_device *pdev) | |||
| 198 | mci->edac_cap = EDAC_FLAG_EC | EDAC_FLAG_SECDED; | 198 | mci->edac_cap = EDAC_FLAG_EC | EDAC_FLAG_SECDED; |
| 199 | mci->mod_name = "cell_edac"; | 199 | mci->mod_name = "cell_edac"; |
| 200 | mci->ctl_name = "MIC"; | 200 | mci->ctl_name = "MIC"; |
| 201 | mci->dev_name = pdev->dev.bus_id; | 201 | mci->dev_name = dev_name(&pdev->dev); |
| 202 | mci->edac_check = cell_edac_check; | 202 | mci->edac_check = cell_edac_check; |
| 203 | cell_edac_init_csrows(mci); | 203 | cell_edac_init_csrows(mci); |
| 204 | 204 | ||
diff --git a/drivers/edac/mpc85xx_edac.c b/drivers/edac/mpc85xx_edac.c index 853ef37ec006..4637a4a757df 100644 --- a/drivers/edac/mpc85xx_edac.c +++ b/drivers/edac/mpc85xx_edac.c | |||
| @@ -218,7 +218,7 @@ static int __devinit mpc85xx_pci_err_probe(struct of_device *op, | |||
| 218 | pci->dev = &op->dev; | 218 | pci->dev = &op->dev; |
| 219 | pci->mod_name = EDAC_MOD_STR; | 219 | pci->mod_name = EDAC_MOD_STR; |
| 220 | pci->ctl_name = pdata->name; | 220 | pci->ctl_name = pdata->name; |
| 221 | pci->dev_name = op->dev.bus_id; | 221 | pci->dev_name = dev_name(&op->dev); |
| 222 | 222 | ||
| 223 | if (edac_op_state == EDAC_OPSTATE_POLL) | 223 | if (edac_op_state == EDAC_OPSTATE_POLL) |
| 224 | pci->edac_check = mpc85xx_pci_check; | 224 | pci->edac_check = mpc85xx_pci_check; |
diff --git a/drivers/edac/mv64x60_edac.c b/drivers/edac/mv64x60_edac.c index 083ce8d0c63d..5131aaae8e03 100644 --- a/drivers/edac/mv64x60_edac.c +++ b/drivers/edac/mv64x60_edac.c | |||
| @@ -121,7 +121,7 @@ static int __devinit mv64x60_pci_err_probe(struct platform_device *pdev) | |||
| 121 | pdata->irq = NO_IRQ; | 121 | pdata->irq = NO_IRQ; |
| 122 | platform_set_drvdata(pdev, pci); | 122 | platform_set_drvdata(pdev, pci); |
| 123 | pci->dev = &pdev->dev; | 123 | pci->dev = &pdev->dev; |
| 124 | pci->dev_name = pdev->dev.bus_id; | 124 | pci->dev_name = dev_name(&pdev->dev); |
| 125 | pci->mod_name = EDAC_MOD_STR; | 125 | pci->mod_name = EDAC_MOD_STR; |
| 126 | pci->ctl_name = pdata->name; | 126 | pci->ctl_name = pdata->name; |
| 127 | 127 | ||
| @@ -294,7 +294,7 @@ static int __devinit mv64x60_sram_err_probe(struct platform_device *pdev) | |||
| 294 | pdata->irq = NO_IRQ; | 294 | pdata->irq = NO_IRQ; |
| 295 | edac_dev->dev = &pdev->dev; | 295 | edac_dev->dev = &pdev->dev; |
| 296 | platform_set_drvdata(pdev, edac_dev); | 296 | platform_set_drvdata(pdev, edac_dev); |
| 297 | edac_dev->dev_name = pdev->dev.bus_id; | 297 | edac_dev->dev_name = dev_name(&pdev->dev); |
| 298 | 298 | ||
| 299 | r = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 299 | r = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
| 300 | if (!r) { | 300 | if (!r) { |
| @@ -462,7 +462,7 @@ static int __devinit mv64x60_cpu_err_probe(struct platform_device *pdev) | |||
| 462 | pdata->irq = NO_IRQ; | 462 | pdata->irq = NO_IRQ; |
| 463 | edac_dev->dev = &pdev->dev; | 463 | edac_dev->dev = &pdev->dev; |
| 464 | platform_set_drvdata(pdev, edac_dev); | 464 | platform_set_drvdata(pdev, edac_dev); |
| 465 | edac_dev->dev_name = pdev->dev.bus_id; | 465 | edac_dev->dev_name = dev_name(&pdev->dev); |
| 466 | 466 | ||
| 467 | r = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 467 | r = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
| 468 | if (!r) { | 468 | if (!r) { |
| @@ -713,7 +713,7 @@ static int __devinit mv64x60_mc_err_probe(struct platform_device *pdev) | |||
| 713 | platform_set_drvdata(pdev, mci); | 713 | platform_set_drvdata(pdev, mci); |
| 714 | pdata->name = "mv64x60_mc_err"; | 714 | pdata->name = "mv64x60_mc_err"; |
| 715 | pdata->irq = NO_IRQ; | 715 | pdata->irq = NO_IRQ; |
| 716 | mci->dev_name = pdev->dev.bus_id; | 716 | mci->dev_name = dev_name(&pdev->dev); |
| 717 | pdata->edac_idx = edac_mc_idx++; | 717 | pdata->edac_idx = edac_mc_idx++; |
| 718 | 718 | ||
| 719 | r = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 719 | r = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
diff --git a/drivers/eisa/eisa-bus.c b/drivers/eisa/eisa-bus.c index c950bf8606d9..66958b3f10b4 100644 --- a/drivers/eisa/eisa-bus.c +++ b/drivers/eisa/eisa-bus.c | |||
| @@ -200,7 +200,7 @@ static int __init eisa_init_device (struct eisa_root_device *root, | |||
| 200 | edev->dev.bus = &eisa_bus_type; | 200 | edev->dev.bus = &eisa_bus_type; |
| 201 | edev->dev.dma_mask = &edev->dma_mask; | 201 | edev->dev.dma_mask = &edev->dma_mask; |
| 202 | edev->dev.coherent_dma_mask = edev->dma_mask; | 202 | edev->dev.coherent_dma_mask = edev->dma_mask; |
| 203 | sprintf (edev->dev.bus_id, "%02X:%02X", root->bus_nr, slot); | 203 | dev_set_name(&edev->dev, "%02X:%02X", root->bus_nr, slot); |
| 204 | 204 | ||
| 205 | for (i = 0; i < EISA_MAX_RESOURCES; i++) { | 205 | for (i = 0; i < EISA_MAX_RESOURCES; i++) { |
| 206 | #ifdef CONFIG_EISA_NAMES | 206 | #ifdef CONFIG_EISA_NAMES |
| @@ -301,7 +301,7 @@ static int __init eisa_probe (struct eisa_root_device *root) | |||
| 301 | struct eisa_device *edev; | 301 | struct eisa_device *edev; |
| 302 | 302 | ||
| 303 | printk (KERN_INFO "EISA: Probing bus %d at %s\n", | 303 | printk (KERN_INFO "EISA: Probing bus %d at %s\n", |
| 304 | root->bus_nr, root->dev->bus_id); | 304 | root->bus_nr, dev_name(root->dev)); |
| 305 | 305 | ||
| 306 | /* First try to get hold of slot 0. If there is no device | 306 | /* First try to get hold of slot 0. If there is no device |
| 307 | * here, simply fail, unless root->force_probe is set. */ | 307 | * here, simply fail, unless root->force_probe is set. */ |
diff --git a/drivers/gpio/bt8xxgpio.c b/drivers/gpio/bt8xxgpio.c index 7a1168249dd5..984b587f0f96 100644 --- a/drivers/gpio/bt8xxgpio.c +++ b/drivers/gpio/bt8xxgpio.c | |||
| @@ -160,7 +160,7 @@ static void bt8xxgpio_gpio_setup(struct bt8xxgpio *bg) | |||
| 160 | { | 160 | { |
| 161 | struct gpio_chip *c = &bg->gpio; | 161 | struct gpio_chip *c = &bg->gpio; |
| 162 | 162 | ||
| 163 | c->label = bg->pdev->dev.bus_id; | 163 | c->label = dev_name(&bg->pdev->dev); |
| 164 | c->owner = THIS_MODULE; | 164 | c->owner = THIS_MODULE; |
| 165 | c->direction_input = bt8xxgpio_gpio_direction_input; | 165 | c->direction_input = bt8xxgpio_gpio_direction_input; |
| 166 | c->get = bt8xxgpio_gpio_get; | 166 | c->get = bt8xxgpio_gpio_get; |
diff --git a/drivers/gpu/drm/drm_sysfs.c b/drivers/gpu/drm/drm_sysfs.c index 5aa6780652aa..186d08159d48 100644 --- a/drivers/gpu/drm/drm_sysfs.c +++ b/drivers/gpu/drm/drm_sysfs.c | |||
| @@ -359,8 +359,8 @@ int drm_sysfs_connector_add(struct drm_connector *connector) | |||
| 359 | DRM_DEBUG("adding \"%s\" to sysfs\n", | 359 | DRM_DEBUG("adding \"%s\" to sysfs\n", |
| 360 | drm_get_connector_name(connector)); | 360 | drm_get_connector_name(connector)); |
| 361 | 361 | ||
| 362 | snprintf(connector->kdev.bus_id, BUS_ID_SIZE, "card%d-%s", | 362 | dev_set_name(&connector->kdev, "card%d-%s", |
| 363 | dev->primary->index, drm_get_connector_name(connector)); | 363 | dev->primary->index, drm_get_connector_name(connector)); |
| 364 | ret = device_register(&connector->kdev); | 364 | ret = device_register(&connector->kdev); |
| 365 | 365 | ||
| 366 | if (ret) { | 366 | if (ret) { |
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c index e7d984866de0..fbb9030b68a5 100644 --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c | |||
| @@ -841,7 +841,7 @@ int i2c_attach_client(struct i2c_client *client) | |||
| 841 | 841 | ||
| 842 | if (client->driver && !is_newstyle_driver(client->driver)) { | 842 | if (client->driver && !is_newstyle_driver(client->driver)) { |
| 843 | client->dev.release = i2c_client_release; | 843 | client->dev.release = i2c_client_release; |
| 844 | client->dev.uevent_suppress = 1; | 844 | dev_set_uevent_suppress(&client->dev, 1); |
| 845 | } else | 845 | } else |
| 846 | client->dev.release = i2c_client_dev_release; | 846 | client->dev.release = i2c_client_dev_release; |
| 847 | 847 | ||
diff --git a/drivers/ide/au1xxx-ide.c b/drivers/ide/au1xxx-ide.c index 79a2dfed8eb7..154ec2cf734f 100644 --- a/drivers/ide/au1xxx-ide.c +++ b/drivers/ide/au1xxx-ide.c | |||
| @@ -536,9 +536,8 @@ static const struct ide_port_info au1xxx_port_info = { | |||
| 536 | #endif | 536 | #endif |
| 537 | }; | 537 | }; |
| 538 | 538 | ||
| 539 | static int au_ide_probe(struct device *dev) | 539 | static int au_ide_probe(struct platform_device *dev) |
| 540 | { | 540 | { |
| 541 | struct platform_device *pdev = to_platform_device(dev); | ||
| 542 | _auide_hwif *ahwif = &auide_hwif; | 541 | _auide_hwif *ahwif = &auide_hwif; |
| 543 | struct resource *res; | 542 | struct resource *res; |
| 544 | struct ide_host *host; | 543 | struct ide_host *host; |
| @@ -552,23 +551,23 @@ static int au_ide_probe(struct device *dev) | |||
| 552 | #endif | 551 | #endif |
| 553 | 552 | ||
| 554 | memset(&auide_hwif, 0, sizeof(_auide_hwif)); | 553 | memset(&auide_hwif, 0, sizeof(_auide_hwif)); |
| 555 | ahwif->irq = platform_get_irq(pdev, 0); | 554 | ahwif->irq = platform_get_irq(dev, 0); |
| 556 | 555 | ||
| 557 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 556 | res = platform_get_resource(dev, IORESOURCE_MEM, 0); |
| 558 | 557 | ||
| 559 | if (res == NULL) { | 558 | if (res == NULL) { |
| 560 | pr_debug("%s %d: no base address\n", DRV_NAME, pdev->id); | 559 | pr_debug("%s %d: no base address\n", DRV_NAME, dev->id); |
| 561 | ret = -ENODEV; | 560 | ret = -ENODEV; |
| 562 | goto out; | 561 | goto out; |
| 563 | } | 562 | } |
| 564 | if (ahwif->irq < 0) { | 563 | if (ahwif->irq < 0) { |
| 565 | pr_debug("%s %d: no IRQ\n", DRV_NAME, pdev->id); | 564 | pr_debug("%s %d: no IRQ\n", DRV_NAME, dev->id); |
| 566 | ret = -ENODEV; | 565 | ret = -ENODEV; |
| 567 | goto out; | 566 | goto out; |
| 568 | } | 567 | } |
| 569 | 568 | ||
| 570 | if (!request_mem_region(res->start, res->end - res->start + 1, | 569 | if (!request_mem_region(res->start, res->end - res->start + 1, |
| 571 | pdev->name)) { | 570 | dev->name)) { |
| 572 | pr_debug("%s: request_mem_region failed\n", DRV_NAME); | 571 | pr_debug("%s: request_mem_region failed\n", DRV_NAME); |
| 573 | ret = -EBUSY; | 572 | ret = -EBUSY; |
| 574 | goto out; | 573 | goto out; |
| @@ -583,7 +582,7 @@ static int au_ide_probe(struct device *dev) | |||
| 583 | memset(&hw, 0, sizeof(hw)); | 582 | memset(&hw, 0, sizeof(hw)); |
| 584 | auide_setup_ports(&hw, ahwif); | 583 | auide_setup_ports(&hw, ahwif); |
| 585 | hw.irq = ahwif->irq; | 584 | hw.irq = ahwif->irq; |
| 586 | hw.dev = dev; | 585 | hw.dev = &dev->dev; |
| 587 | hw.chipset = ide_au1xxx; | 586 | hw.chipset = ide_au1xxx; |
| 588 | 587 | ||
| 589 | ret = ide_host_add(&au1xxx_port_info, hws, &host); | 588 | ret = ide_host_add(&au1xxx_port_info, hws, &host); |
| @@ -592,7 +591,7 @@ static int au_ide_probe(struct device *dev) | |||
| 592 | 591 | ||
| 593 | auide_hwif.hwif = host->ports[0]; | 592 | auide_hwif.hwif = host->ports[0]; |
| 594 | 593 | ||
| 595 | dev_set_drvdata(dev, host); | 594 | platform_set_drvdata(dev, host); |
| 596 | 595 | ||
| 597 | printk(KERN_INFO "Au1xxx IDE(builtin) configured for %s\n", mode ); | 596 | printk(KERN_INFO "Au1xxx IDE(builtin) configured for %s\n", mode ); |
| 598 | 597 | ||
| @@ -600,38 +599,39 @@ static int au_ide_probe(struct device *dev) | |||
| 600 | return ret; | 599 | return ret; |
| 601 | } | 600 | } |
| 602 | 601 | ||
| 603 | static int au_ide_remove(struct device *dev) | 602 | static int au_ide_remove(struct platform_device *dev) |
| 604 | { | 603 | { |
| 605 | struct platform_device *pdev = to_platform_device(dev); | ||
| 606 | struct resource *res; | 604 | struct resource *res; |
| 607 | struct ide_host *host = dev_get_drvdata(dev); | 605 | struct ide_host *host = platform_get_drvdata(dev); |
| 608 | _auide_hwif *ahwif = &auide_hwif; | 606 | _auide_hwif *ahwif = &auide_hwif; |
| 609 | 607 | ||
| 610 | ide_host_remove(host); | 608 | ide_host_remove(host); |
| 611 | 609 | ||
| 612 | iounmap((void *)ahwif->regbase); | 610 | iounmap((void *)ahwif->regbase); |
| 613 | 611 | ||
| 614 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 612 | res = platform_get_resource(dev, IORESOURCE_MEM, 0); |
| 615 | release_mem_region(res->start, res->end - res->start + 1); | 613 | release_mem_region(res->start, res->end - res->start + 1); |
| 616 | 614 | ||
| 617 | return 0; | 615 | return 0; |
| 618 | } | 616 | } |
| 619 | 617 | ||
| 620 | static struct device_driver au1200_ide_driver = { | 618 | static struct platform_driver au1200_ide_driver = { |
| 621 | .name = "au1200-ide", | 619 | .driver = { |
| 622 | .bus = &platform_bus_type, | 620 | .name = "au1200-ide", |
| 621 | .owner = THIS_MODULE, | ||
| 622 | }, | ||
| 623 | .probe = au_ide_probe, | 623 | .probe = au_ide_probe, |
| 624 | .remove = au_ide_remove, | 624 | .remove = au_ide_remove, |
| 625 | }; | 625 | }; |
| 626 | 626 | ||
| 627 | static int __init au_ide_init(void) | 627 | static int __init au_ide_init(void) |
| 628 | { | 628 | { |
| 629 | return driver_register(&au1200_ide_driver); | 629 | return platform_driver_register(&au1200_ide_driver); |
| 630 | } | 630 | } |
| 631 | 631 | ||
| 632 | static void __exit au_ide_exit(void) | 632 | static void __exit au_ide_exit(void) |
| 633 | { | 633 | { |
| 634 | driver_unregister(&au1200_ide_driver); | 634 | platform_driver_unregister(&au1200_ide_driver); |
| 635 | } | 635 | } |
| 636 | 636 | ||
| 637 | MODULE_LICENSE("GPL"); | 637 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/isdn/gigaset/ser-gigaset.c b/drivers/isdn/gigaset/ser-gigaset.c index ac245e7e96a5..3071a52467ed 100644 --- a/drivers/isdn/gigaset/ser-gigaset.c +++ b/drivers/isdn/gigaset/ser-gigaset.c | |||
| @@ -389,8 +389,7 @@ static void gigaset_freecshw(struct cardstate *cs) | |||
| 389 | 389 | ||
| 390 | static void gigaset_device_release(struct device *dev) | 390 | static void gigaset_device_release(struct device *dev) |
| 391 | { | 391 | { |
| 392 | struct platform_device *pdev = | 392 | struct platform_device *pdev = to_platform_device(dev); |
| 393 | container_of(dev, struct platform_device, dev); | ||
| 394 | 393 | ||
| 395 | /* adapted from platform_device_release() in drivers/base/platform.c */ | 394 | /* adapted from platform_device_release() in drivers/base/platform.c */ |
| 396 | //FIXME is this actually necessary? | 395 | //FIXME is this actually necessary? |
diff --git a/drivers/mca/mca-bus.c b/drivers/mca/mca-bus.c index ef2dbfe74714..ada5ebbaa255 100644 --- a/drivers/mca/mca-bus.c +++ b/drivers/mca/mca-bus.c | |||
| @@ -110,7 +110,7 @@ int __init mca_register_device(int bus, struct mca_device *mca_dev) | |||
| 110 | 110 | ||
| 111 | mca_dev->dev.parent = &mca_bus->dev; | 111 | mca_dev->dev.parent = &mca_bus->dev; |
| 112 | mca_dev->dev.bus = &mca_bus_type; | 112 | mca_dev->dev.bus = &mca_bus_type; |
| 113 | sprintf (mca_dev->dev.bus_id, "%02d:%02X", bus, mca_dev->slot); | 113 | dev_set_name(&mca_dev->dev, "%02d:%02X", bus, mca_dev->slot); |
| 114 | mca_dev->dma_mask = mca_bus->default_dma_mask; | 114 | mca_dev->dma_mask = mca_bus->default_dma_mask; |
| 115 | mca_dev->dev.dma_mask = &mca_dev->dma_mask; | 115 | mca_dev->dev.dma_mask = &mca_dev->dma_mask; |
| 116 | mca_dev->dev.coherent_dma_mask = mca_dev->dma_mask; | 116 | mca_dev->dev.coherent_dma_mask = mca_dev->dma_mask; |
| @@ -151,7 +151,7 @@ struct mca_bus * __devinit mca_attach_bus(int bus) | |||
| 151 | if (!mca_bus) | 151 | if (!mca_bus) |
| 152 | return NULL; | 152 | return NULL; |
| 153 | 153 | ||
| 154 | sprintf(mca_bus->dev.bus_id,"mca%d",bus); | 154 | dev_set_name(&mca_bus->dev, "mca%d", bus); |
| 155 | sprintf(mca_bus->name,"Host %s MCA Bridge", bus ? "Secondary" : "Primary"); | 155 | sprintf(mca_bus->name,"Host %s MCA Bridge", bus ? "Secondary" : "Primary"); |
| 156 | if (device_register(&mca_bus->dev)) { | 156 | if (device_register(&mca_bus->dev)) { |
| 157 | kfree(mca_bus); | 157 | kfree(mca_bus); |
diff --git a/drivers/media/radio/radio-tea5764.c b/drivers/media/radio/radio-tea5764.c index 4d35308fc1ff..393623818ade 100644 --- a/drivers/media/radio/radio-tea5764.c +++ b/drivers/media/radio/radio-tea5764.c | |||
| @@ -298,7 +298,8 @@ static int vidioc_querycap(struct file *file, void *priv, | |||
| 298 | 298 | ||
| 299 | strlcpy(v->driver, dev->dev.driver->name, sizeof(v->driver)); | 299 | strlcpy(v->driver, dev->dev.driver->name, sizeof(v->driver)); |
| 300 | strlcpy(v->card, dev->name, sizeof(v->card)); | 300 | strlcpy(v->card, dev->name, sizeof(v->card)); |
| 301 | snprintf(v->bus_info, sizeof(v->bus_info), "I2C:%s", dev->dev.bus_id); | 301 | snprintf(v->bus_info, sizeof(v->bus_info), |
| 302 | "I2C:%s", dev_name(&dev->dev)); | ||
| 302 | v->version = RADIO_VERSION; | 303 | v->version = RADIO_VERSION; |
| 303 | v->capabilities = V4L2_CAP_TUNER | V4L2_CAP_RADIO; | 304 | v->capabilities = V4L2_CAP_TUNER | V4L2_CAP_RADIO; |
| 304 | return 0; | 305 | return 0; |
diff --git a/drivers/media/video/v4l2-device.c b/drivers/media/video/v4l2-device.c index cf9d4c7f571a..8a4b74f3129f 100644 --- a/drivers/media/video/v4l2-device.c +++ b/drivers/media/video/v4l2-device.c | |||
| @@ -34,7 +34,7 @@ int v4l2_device_register(struct device *dev, struct v4l2_device *v4l2_dev) | |||
| 34 | spin_lock_init(&v4l2_dev->lock); | 34 | spin_lock_init(&v4l2_dev->lock); |
| 35 | v4l2_dev->dev = dev; | 35 | v4l2_dev->dev = dev; |
| 36 | snprintf(v4l2_dev->name, sizeof(v4l2_dev->name), "%s %s", | 36 | snprintf(v4l2_dev->name, sizeof(v4l2_dev->name), "%s %s", |
| 37 | dev->driver->name, dev->bus_id); | 37 | dev->driver->name, dev_name(dev)); |
| 38 | dev_set_drvdata(dev, v4l2_dev); | 38 | dev_set_drvdata(dev, v4l2_dev); |
| 39 | return 0; | 39 | return 0; |
| 40 | } | 40 | } |
diff --git a/drivers/mfd/mcp-core.c b/drivers/mfd/mcp-core.c index 6063dc2b52e8..57271cb3b316 100644 --- a/drivers/mfd/mcp-core.c +++ b/drivers/mfd/mcp-core.c | |||
| @@ -214,7 +214,7 @@ EXPORT_SYMBOL(mcp_host_alloc); | |||
| 214 | 214 | ||
| 215 | int mcp_host_register(struct mcp *mcp) | 215 | int mcp_host_register(struct mcp *mcp) |
| 216 | { | 216 | { |
| 217 | strcpy(mcp->attached_device.bus_id, "mcp0"); | 217 | dev_set_name(&mcp->attached_device, "mcp0"); |
| 218 | return device_register(&mcp->attached_device); | 218 | return device_register(&mcp->attached_device); |
| 219 | } | 219 | } |
| 220 | EXPORT_SYMBOL(mcp_host_register); | 220 | EXPORT_SYMBOL(mcp_host_register); |
diff --git a/drivers/mfd/ucb1x00-core.c b/drivers/mfd/ucb1x00-core.c index 6860c924f364..fea9085fe52c 100644 --- a/drivers/mfd/ucb1x00-core.c +++ b/drivers/mfd/ucb1x00-core.c | |||
| @@ -492,7 +492,7 @@ static int ucb1x00_probe(struct mcp *mcp) | |||
| 492 | 492 | ||
| 493 | ucb->dev.class = &ucb1x00_class; | 493 | ucb->dev.class = &ucb1x00_class; |
| 494 | ucb->dev.parent = &mcp->attached_device; | 494 | ucb->dev.parent = &mcp->attached_device; |
| 495 | strlcpy(ucb->dev.bus_id, "ucb1x00", sizeof(ucb->dev.bus_id)); | 495 | dev_set_name(&ucb->dev, "ucb1x00"); |
| 496 | 496 | ||
| 497 | spin_lock_init(&ucb->lock); | 497 | spin_lock_init(&ucb->lock); |
| 498 | spin_lock_init(&ucb->io_lock); | 498 | spin_lock_init(&ucb->io_lock); |
diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c index 2b1196e6142c..e94e92001e7c 100644 --- a/drivers/mmc/host/atmel-mci.c +++ b/drivers/mmc/host/atmel-mci.c | |||
| @@ -1603,7 +1603,7 @@ static int __init atmci_probe(struct platform_device *pdev) | |||
| 1603 | 1603 | ||
| 1604 | tasklet_init(&host->tasklet, atmci_tasklet_func, (unsigned long)host); | 1604 | tasklet_init(&host->tasklet, atmci_tasklet_func, (unsigned long)host); |
| 1605 | 1605 | ||
| 1606 | ret = request_irq(irq, atmci_interrupt, 0, pdev->dev.bus_id, host); | 1606 | ret = request_irq(irq, atmci_interrupt, 0, dev_name(&pdev->dev), host); |
| 1607 | if (ret) | 1607 | if (ret) |
| 1608 | goto err_request_irq; | 1608 | goto err_request_irq; |
| 1609 | 1609 | ||
diff --git a/drivers/mmc/host/of_mmc_spi.c b/drivers/mmc/host/of_mmc_spi.c index fb2921f8099d..0c44d560bf1a 100644 --- a/drivers/mmc/host/of_mmc_spi.c +++ b/drivers/mmc/host/of_mmc_spi.c | |||
| @@ -103,7 +103,7 @@ struct mmc_spi_platform_data *mmc_spi_get_pdata(struct spi_device *spi) | |||
| 103 | if (!gpio_is_valid(oms->gpios[i])) | 103 | if (!gpio_is_valid(oms->gpios[i])) |
| 104 | continue; | 104 | continue; |
| 105 | 105 | ||
| 106 | ret = gpio_request(oms->gpios[i], dev->bus_id); | 106 | ret = gpio_request(oms->gpios[i], dev_name(dev)); |
| 107 | if (ret < 0) { | 107 | if (ret < 0) { |
| 108 | oms->gpios[i] = -EINVAL; | 108 | oms->gpios[i] = -EINVAL; |
| 109 | continue; | 109 | continue; |
diff --git a/drivers/mtd/maps/pxa2xx-flash.c b/drivers/mtd/maps/pxa2xx-flash.c index 771139c5bf87..e9026cb1c5b2 100644 --- a/drivers/mtd/maps/pxa2xx-flash.c +++ b/drivers/mtd/maps/pxa2xx-flash.c | |||
| @@ -41,9 +41,8 @@ struct pxa2xx_flash_info { | |||
| 41 | static const char *probes[] = { "RedBoot", "cmdlinepart", NULL }; | 41 | static const char *probes[] = { "RedBoot", "cmdlinepart", NULL }; |
| 42 | 42 | ||
| 43 | 43 | ||
| 44 | static int __init pxa2xx_flash_probe(struct device *dev) | 44 | static int __init pxa2xx_flash_probe(struct platform_device *pdev) |
| 45 | { | 45 | { |
| 46 | struct platform_device *pdev = to_platform_device(dev); | ||
| 47 | struct flash_platform_data *flash = pdev->dev.platform_data; | 46 | struct flash_platform_data *flash = pdev->dev.platform_data; |
| 48 | struct pxa2xx_flash_info *info; | 47 | struct pxa2xx_flash_info *info; |
| 49 | struct mtd_partition *parts; | 48 | struct mtd_partition *parts; |
| @@ -114,15 +113,15 @@ static int __init pxa2xx_flash_probe(struct device *dev) | |||
| 114 | add_mtd_device(info->mtd); | 113 | add_mtd_device(info->mtd); |
| 115 | } | 114 | } |
| 116 | 115 | ||
| 117 | dev_set_drvdata(dev, info); | 116 | platform_set_drvdata(pdev, info); |
| 118 | return 0; | 117 | return 0; |
| 119 | } | 118 | } |
| 120 | 119 | ||
| 121 | static int __exit pxa2xx_flash_remove(struct device *dev) | 120 | static int __exit pxa2xx_flash_remove(struct platform_device *dev) |
| 122 | { | 121 | { |
| 123 | struct pxa2xx_flash_info *info = dev_get_drvdata(dev); | 122 | struct pxa2xx_flash_info *info = platform_get_drvdata(dev); |
| 124 | 123 | ||
| 125 | dev_set_drvdata(dev, NULL); | 124 | platform_set_drvdata(dev, NULL); |
| 126 | 125 | ||
| 127 | #ifdef CONFIG_MTD_PARTITIONS | 126 | #ifdef CONFIG_MTD_PARTITIONS |
| 128 | if (info->nr_parts) | 127 | if (info->nr_parts) |
| @@ -141,9 +140,9 @@ static int __exit pxa2xx_flash_remove(struct device *dev) | |||
| 141 | } | 140 | } |
| 142 | 141 | ||
| 143 | #ifdef CONFIG_PM | 142 | #ifdef CONFIG_PM |
| 144 | static int pxa2xx_flash_suspend(struct device *dev, pm_message_t state) | 143 | static int pxa2xx_flash_suspend(struct platform_device *dev, pm_message_t state) |
| 145 | { | 144 | { |
| 146 | struct pxa2xx_flash_info *info = dev_get_drvdata(dev); | 145 | struct pxa2xx_flash_info *info = platform_get_drvdata(dev); |
| 147 | int ret = 0; | 146 | int ret = 0; |
| 148 | 147 | ||
| 149 | if (info->mtd && info->mtd->suspend) | 148 | if (info->mtd && info->mtd->suspend) |
| @@ -151,17 +150,17 @@ static int pxa2xx_flash_suspend(struct device *dev, pm_message_t state) | |||
| 151 | return ret; | 150 | return ret; |
| 152 | } | 151 | } |
| 153 | 152 | ||
| 154 | static int pxa2xx_flash_resume(struct device *dev) | 153 | static int pxa2xx_flash_resume(struct platform_device *dev) |
| 155 | { | 154 | { |
| 156 | struct pxa2xx_flash_info *info = dev_get_drvdata(dev); | 155 | struct pxa2xx_flash_info *info = platform_get_drvdata(dev); |
| 157 | 156 | ||
| 158 | if (info->mtd && info->mtd->resume) | 157 | if (info->mtd && info->mtd->resume) |
| 159 | info->mtd->resume(info->mtd); | 158 | info->mtd->resume(info->mtd); |
| 160 | return 0; | 159 | return 0; |
| 161 | } | 160 | } |
| 162 | static void pxa2xx_flash_shutdown(struct device *dev) | 161 | static void pxa2xx_flash_shutdown(struct platform_device *dev) |
| 163 | { | 162 | { |
| 164 | struct pxa2xx_flash_info *info = dev_get_drvdata(dev); | 163 | struct pxa2xx_flash_info *info = platform_get_drvdata(dev); |
| 165 | 164 | ||
| 166 | if (info && info->mtd->suspend(info->mtd) == 0) | 165 | if (info && info->mtd->suspend(info->mtd) == 0) |
| 167 | info->mtd->resume(info->mtd); | 166 | info->mtd->resume(info->mtd); |
| @@ -172,11 +171,13 @@ static void pxa2xx_flash_shutdown(struct device *dev) | |||
| 172 | #define pxa2xx_flash_shutdown NULL | 171 | #define pxa2xx_flash_shutdown NULL |
| 173 | #endif | 172 | #endif |
| 174 | 173 | ||
| 175 | static struct device_driver pxa2xx_flash_driver = { | 174 | static struct platform_driver pxa2xx_flash_driver = { |
| 176 | .name = "pxa2xx-flash", | 175 | .driver = { |
| 177 | .bus = &platform_bus_type, | 176 | .name = "pxa2xx-flash", |
| 177 | .owner = THIS_MODULE, | ||
| 178 | }, | ||
| 178 | .probe = pxa2xx_flash_probe, | 179 | .probe = pxa2xx_flash_probe, |
| 179 | .remove = __exit_p(pxa2xx_flash_remove), | 180 | .remove = __devexit_p(pxa2xx_flash_remove), |
| 180 | .suspend = pxa2xx_flash_suspend, | 181 | .suspend = pxa2xx_flash_suspend, |
| 181 | .resume = pxa2xx_flash_resume, | 182 | .resume = pxa2xx_flash_resume, |
| 182 | .shutdown = pxa2xx_flash_shutdown, | 183 | .shutdown = pxa2xx_flash_shutdown, |
| @@ -184,12 +185,12 @@ static struct device_driver pxa2xx_flash_driver = { | |||
| 184 | 185 | ||
| 185 | static int __init init_pxa2xx_flash(void) | 186 | static int __init init_pxa2xx_flash(void) |
| 186 | { | 187 | { |
| 187 | return driver_register(&pxa2xx_flash_driver); | 188 | return platform_driver_register(&pxa2xx_flash_driver); |
| 188 | } | 189 | } |
| 189 | 190 | ||
| 190 | static void __exit cleanup_pxa2xx_flash(void) | 191 | static void __exit cleanup_pxa2xx_flash(void) |
| 191 | { | 192 | { |
| 192 | driver_unregister(&pxa2xx_flash_driver); | 193 | platform_driver_unregister(&pxa2xx_flash_driver); |
| 193 | } | 194 | } |
| 194 | 195 | ||
| 195 | module_init(init_pxa2xx_flash); | 196 | module_init(init_pxa2xx_flash); |
diff --git a/drivers/mtd/nand/excite_nandflash.c b/drivers/mtd/nand/excite_nandflash.c index ced14b5294d5..72446fb48d4b 100644 --- a/drivers/mtd/nand/excite_nandflash.c +++ b/drivers/mtd/nand/excite_nandflash.c | |||
| @@ -128,11 +128,11 @@ static int excite_nand_devready(struct mtd_info *mtd) | |||
| 128 | * The binding to the mtd and all allocated | 128 | * The binding to the mtd and all allocated |
| 129 | * resources are released. | 129 | * resources are released. |
| 130 | */ | 130 | */ |
| 131 | static int __exit excite_nand_remove(struct device *dev) | 131 | static int __exit excite_nand_remove(struct platform_device *dev) |
| 132 | { | 132 | { |
| 133 | struct excite_nand_drvdata * const this = dev_get_drvdata(dev); | 133 | struct excite_nand_drvdata * const this = platform_get_drvdata(dev); |
| 134 | 134 | ||
| 135 | dev_set_drvdata(dev, NULL); | 135 | platform_set_drvdata(dev, NULL); |
| 136 | 136 | ||
| 137 | if (unlikely(!this)) { | 137 | if (unlikely(!this)) { |
| 138 | printk(KERN_ERR "%s: called %s without private data!!", | 138 | printk(KERN_ERR "%s: called %s without private data!!", |
| @@ -159,9 +159,8 @@ static int __exit excite_nand_remove(struct device *dev) | |||
| 159 | * it can allocate all necessary resources then calls the | 159 | * it can allocate all necessary resources then calls the |
| 160 | * nand layer to look for devices. | 160 | * nand layer to look for devices. |
| 161 | */ | 161 | */ |
| 162 | static int __init excite_nand_probe(struct device *dev) | 162 | static int __init excite_nand_probe(struct platform_device *pdev) |
| 163 | { | 163 | { |
| 164 | struct platform_device * const pdev = to_platform_device(dev); | ||
| 165 | struct excite_nand_drvdata *drvdata; /* private driver data */ | 164 | struct excite_nand_drvdata *drvdata; /* private driver data */ |
| 166 | struct nand_chip *board_chip; /* private flash chip data */ | 165 | struct nand_chip *board_chip; /* private flash chip data */ |
| 167 | struct mtd_info *board_mtd; /* mtd info for this board */ | 166 | struct mtd_info *board_mtd; /* mtd info for this board */ |
| @@ -175,7 +174,7 @@ static int __init excite_nand_probe(struct device *dev) | |||
| 175 | } | 174 | } |
| 176 | 175 | ||
| 177 | /* bind private data into driver */ | 176 | /* bind private data into driver */ |
| 178 | dev_set_drvdata(dev, drvdata); | 177 | platform_set_drvdata(pdev, drvdata); |
| 179 | 178 | ||
| 180 | /* allocate and map the resource */ | 179 | /* allocate and map the resource */ |
| 181 | drvdata->regs = | 180 | drvdata->regs = |
| @@ -219,23 +218,25 @@ static int __init excite_nand_probe(struct device *dev) | |||
| 219 | return 0; | 218 | return 0; |
| 220 | } | 219 | } |
| 221 | 220 | ||
| 222 | static struct device_driver excite_nand_driver = { | 221 | static struct platform_driver excite_nand_driver = { |
| 223 | .name = "excite_nand", | 222 | .driver = { |
| 224 | .bus = &platform_bus_type, | 223 | .name = "excite_nand", |
| 224 | .owner = THIS_MODULE, | ||
| 225 | }, | ||
| 225 | .probe = excite_nand_probe, | 226 | .probe = excite_nand_probe, |
| 226 | .remove = __exit_p(excite_nand_remove) | 227 | .remove = __devexit_p(excite_nand_remove) |
| 227 | }; | 228 | }; |
| 228 | 229 | ||
| 229 | static int __init excite_nand_init(void) | 230 | static int __init excite_nand_init(void) |
| 230 | { | 231 | { |
| 231 | pr_info("Basler eXcite nand flash driver Version " | 232 | pr_info("Basler eXcite nand flash driver Version " |
| 232 | EXCITE_NANDFLASH_VERSION "\n"); | 233 | EXCITE_NANDFLASH_VERSION "\n"); |
| 233 | return driver_register(&excite_nand_driver); | 234 | return platform_driver_register(&excite_nand_driver); |
| 234 | } | 235 | } |
| 235 | 236 | ||
| 236 | static void __exit excite_nand_exit(void) | 237 | static void __exit excite_nand_exit(void) |
| 237 | { | 238 | { |
| 238 | driver_unregister(&excite_nand_driver); | 239 | platform_driver_unregister(&excite_nand_driver); |
| 239 | } | 240 | } |
| 240 | 241 | ||
| 241 | module_init(excite_nand_init); | 242 | module_init(excite_nand_init); |
diff --git a/drivers/mtd/nand/ndfc.c b/drivers/mtd/nand/ndfc.c index 582cf80f555a..89bf85af642c 100644 --- a/drivers/mtd/nand/ndfc.c +++ b/drivers/mtd/nand/ndfc.c | |||
| @@ -187,7 +187,7 @@ static int ndfc_chip_init(struct ndfc_controller *ndfc, | |||
| 187 | return -ENODEV; | 187 | return -ENODEV; |
| 188 | 188 | ||
| 189 | ndfc->mtd.name = kasprintf(GFP_KERNEL, "%s.%s", | 189 | ndfc->mtd.name = kasprintf(GFP_KERNEL, "%s.%s", |
| 190 | ndfc->ofdev->dev.bus_id, flash_np->name); | 190 | dev_name(&ndfc->ofdev->dev), flash_np->name); |
| 191 | if (!ndfc->mtd.name) { | 191 | if (!ndfc->mtd.name) { |
| 192 | ret = -ENOMEM; | 192 | ret = -ENOMEM; |
| 193 | goto err; | 193 | goto err; |
diff --git a/drivers/mtd/onenand/generic.c b/drivers/mtd/onenand/generic.c index 5b69e7773c6c..3a496c33fb52 100644 --- a/drivers/mtd/onenand/generic.c +++ b/drivers/mtd/onenand/generic.c | |||
| @@ -36,10 +36,9 @@ struct onenand_info { | |||
| 36 | struct onenand_chip onenand; | 36 | struct onenand_chip onenand; |
| 37 | }; | 37 | }; |
| 38 | 38 | ||
| 39 | static int __devinit generic_onenand_probe(struct device *dev) | 39 | static int __devinit generic_onenand_probe(struct platform_device *pdev) |
| 40 | { | 40 | { |
| 41 | struct onenand_info *info; | 41 | struct onenand_info *info; |
| 42 | struct platform_device *pdev = to_platform_device(dev); | ||
| 43 | struct flash_platform_data *pdata = pdev->dev.platform_data; | 42 | struct flash_platform_data *pdata = pdev->dev.platform_data; |
| 44 | struct resource *res = pdev->resource; | 43 | struct resource *res = pdev->resource; |
| 45 | unsigned long size = res->end - res->start + 1; | 44 | unsigned long size = res->end - res->start + 1; |
| @@ -49,7 +48,7 @@ static int __devinit generic_onenand_probe(struct device *dev) | |||
| 49 | if (!info) | 48 | if (!info) |
| 50 | return -ENOMEM; | 49 | return -ENOMEM; |
| 51 | 50 | ||
| 52 | if (!request_mem_region(res->start, size, dev->driver->name)) { | 51 | if (!request_mem_region(res->start, size, pdev->dev.driver->name)) { |
| 53 | err = -EBUSY; | 52 | err = -EBUSY; |
| 54 | goto out_free_info; | 53 | goto out_free_info; |
| 55 | } | 54 | } |
| @@ -82,7 +81,7 @@ static int __devinit generic_onenand_probe(struct device *dev) | |||
| 82 | #endif | 81 | #endif |
| 83 | err = add_mtd_device(&info->mtd); | 82 | err = add_mtd_device(&info->mtd); |
| 84 | 83 | ||
| 85 | dev_set_drvdata(&pdev->dev, info); | 84 | platform_set_drvdata(pdev, info); |
| 86 | 85 | ||
| 87 | return 0; | 86 | return 0; |
| 88 | 87 | ||
| @@ -96,14 +95,13 @@ out_free_info: | |||
| 96 | return err; | 95 | return err; |
| 97 | } | 96 | } |
| 98 | 97 | ||
| 99 | static int __devexit generic_onenand_remove(struct device *dev) | 98 | static int __devexit generic_onenand_remove(struct platform_device *pdev) |
| 100 | { | 99 | { |
| 101 | struct platform_device *pdev = to_platform_device(dev); | 100 | struct onenand_info *info = platform_get_drvdata(pdev); |
| 102 | struct onenand_info *info = dev_get_drvdata(&pdev->dev); | ||
| 103 | struct resource *res = pdev->resource; | 101 | struct resource *res = pdev->resource; |
| 104 | unsigned long size = res->end - res->start + 1; | 102 | unsigned long size = res->end - res->start + 1; |
| 105 | 103 | ||
| 106 | dev_set_drvdata(&pdev->dev, NULL); | 104 | platform_set_drvdata(pdev, NULL); |
| 107 | 105 | ||
| 108 | if (info) { | 106 | if (info) { |
| 109 | if (info->parts) | 107 | if (info->parts) |
| @@ -120,9 +118,11 @@ static int __devexit generic_onenand_remove(struct device *dev) | |||
| 120 | return 0; | 118 | return 0; |
| 121 | } | 119 | } |
| 122 | 120 | ||
| 123 | static struct device_driver generic_onenand_driver = { | 121 | static struct platform_driver generic_onenand_driver = { |
| 124 | .name = DRIVER_NAME, | 122 | .driver = { |
| 125 | .bus = &platform_bus_type, | 123 | .name = DRIVER_NAME, |
| 124 | .owner = THIS_MODULE, | ||
| 125 | }, | ||
| 126 | .probe = generic_onenand_probe, | 126 | .probe = generic_onenand_probe, |
| 127 | .remove = __devexit_p(generic_onenand_remove), | 127 | .remove = __devexit_p(generic_onenand_remove), |
| 128 | }; | 128 | }; |
| @@ -131,12 +131,12 @@ MODULE_ALIAS(DRIVER_NAME); | |||
| 131 | 131 | ||
| 132 | static int __init generic_onenand_init(void) | 132 | static int __init generic_onenand_init(void) |
| 133 | { | 133 | { |
| 134 | return driver_register(&generic_onenand_driver); | 134 | return platform_driver_register(&generic_onenand_driver); |
| 135 | } | 135 | } |
| 136 | 136 | ||
| 137 | static void __exit generic_onenand_exit(void) | 137 | static void __exit generic_onenand_exit(void) |
| 138 | { | 138 | { |
| 139 | driver_unregister(&generic_onenand_driver); | 139 | platform_driver_unregister(&generic_onenand_driver); |
| 140 | } | 140 | } |
| 141 | 141 | ||
| 142 | module_init(generic_onenand_init); | 142 | module_init(generic_onenand_init); |
diff --git a/drivers/net/arm/ks8695net.c b/drivers/net/arm/ks8695net.c index f3a127434897..35cd264abae7 100644 --- a/drivers/net/arm/ks8695net.c +++ b/drivers/net/arm/ks8695net.c | |||
| @@ -1059,7 +1059,7 @@ ks8695_get_drvinfo(struct net_device *ndev, struct ethtool_drvinfo *info) | |||
| 1059 | { | 1059 | { |
| 1060 | strlcpy(info->driver, MODULENAME, sizeof(info->driver)); | 1060 | strlcpy(info->driver, MODULENAME, sizeof(info->driver)); |
| 1061 | strlcpy(info->version, MODULEVERSION, sizeof(info->version)); | 1061 | strlcpy(info->version, MODULEVERSION, sizeof(info->version)); |
| 1062 | strlcpy(info->bus_info, ndev->dev.parent->bus_id, | 1062 | strlcpy(info->bus_info, dev_name(ndev->dev.parent), |
| 1063 | sizeof(info->bus_info)); | 1063 | sizeof(info->bus_info)); |
| 1064 | } | 1064 | } |
| 1065 | 1065 | ||
diff --git a/drivers/net/au1000_eth.c b/drivers/net/au1000_eth.c index 9c875bb3f76c..79aec32c6add 100644 --- a/drivers/net/au1000_eth.c +++ b/drivers/net/au1000_eth.c | |||
| @@ -355,8 +355,8 @@ static int mii_probe (struct net_device *dev) | |||
| 355 | /* now we are supposed to have a proper phydev, to attach to... */ | 355 | /* now we are supposed to have a proper phydev, to attach to... */ |
| 356 | BUG_ON(phydev->attached_dev); | 356 | BUG_ON(phydev->attached_dev); |
| 357 | 357 | ||
| 358 | phydev = phy_connect(dev, phydev->dev.bus_id, &au1000_adjust_link, 0, | 358 | phydev = phy_connect(dev, dev_name(&phydev->dev), &au1000_adjust_link, |
| 359 | PHY_INTERFACE_MODE_MII); | 359 | 0, PHY_INTERFACE_MODE_MII); |
| 360 | 360 | ||
| 361 | if (IS_ERR(phydev)) { | 361 | if (IS_ERR(phydev)) { |
| 362 | printk(KERN_ERR "%s: Could not attach to PHY\n", dev->name); | 362 | printk(KERN_ERR "%s: Could not attach to PHY\n", dev->name); |
| @@ -381,8 +381,8 @@ static int mii_probe (struct net_device *dev) | |||
| 381 | aup->phy_dev = phydev; | 381 | aup->phy_dev = phydev; |
| 382 | 382 | ||
| 383 | printk(KERN_INFO "%s: attached PHY driver [%s] " | 383 | printk(KERN_INFO "%s: attached PHY driver [%s] " |
| 384 | "(mii_bus:phy_addr=%s, irq=%d)\n", | 384 | "(mii_bus:phy_addr=%s, irq=%d)\n", dev->name, |
| 385 | dev->name, phydev->drv->name, phydev->dev.bus_id, phydev->irq); | 385 | phydev->drv->name, dev_name(&phydev->dev), phydev->irq); |
| 386 | 386 | ||
| 387 | return 0; | 387 | return 0; |
| 388 | } | 388 | } |
diff --git a/drivers/net/bfin_mac.c b/drivers/net/bfin_mac.c index 78e31aa861e0..9afe8092dfc4 100644 --- a/drivers/net/bfin_mac.c +++ b/drivers/net/bfin_mac.c | |||
| @@ -415,11 +415,11 @@ static int mii_probe(struct net_device *dev) | |||
| 415 | } | 415 | } |
| 416 | 416 | ||
| 417 | #if defined(CONFIG_BFIN_MAC_RMII) | 417 | #if defined(CONFIG_BFIN_MAC_RMII) |
| 418 | phydev = phy_connect(dev, phydev->dev.bus_id, &bfin_mac_adjust_link, 0, | 418 | phydev = phy_connect(dev, dev_name(&phydev->dev), &bfin_mac_adjust_link, |
| 419 | PHY_INTERFACE_MODE_RMII); | 419 | 0, PHY_INTERFACE_MODE_RMII); |
| 420 | #else | 420 | #else |
| 421 | phydev = phy_connect(dev, phydev->dev.bus_id, &bfin_mac_adjust_link, 0, | 421 | phydev = phy_connect(dev, dev_name(&phydev->dev), &bfin_mac_adjust_link, |
| 422 | PHY_INTERFACE_MODE_MII); | 422 | 0, PHY_INTERFACE_MODE_MII); |
| 423 | #endif | 423 | #endif |
| 424 | 424 | ||
| 425 | if (IS_ERR(phydev)) { | 425 | if (IS_ERR(phydev)) { |
| @@ -447,7 +447,7 @@ static int mii_probe(struct net_device *dev) | |||
| 447 | printk(KERN_INFO "%s: attached PHY driver [%s] " | 447 | printk(KERN_INFO "%s: attached PHY driver [%s] " |
| 448 | "(mii_bus:phy_addr=%s, irq=%d, mdc_clk=%dHz(mdc_div=%d)" | 448 | "(mii_bus:phy_addr=%s, irq=%d, mdc_clk=%dHz(mdc_div=%d)" |
| 449 | "@sclk=%dMHz)\n", | 449 | "@sclk=%dMHz)\n", |
| 450 | DRV_NAME, phydev->drv->name, phydev->dev.bus_id, phydev->irq, | 450 | DRV_NAME, phydev->drv->name, dev_name(&phydev->dev), phydev->irq, |
| 451 | MDC_CLK, mdc_div, sclk/1000000); | 451 | MDC_CLK, mdc_div, sclk/1000000); |
| 452 | 452 | ||
| 453 | return 0; | 453 | return 0; |
| @@ -488,7 +488,7 @@ static void bfin_mac_ethtool_getdrvinfo(struct net_device *dev, | |||
| 488 | strcpy(info->driver, DRV_NAME); | 488 | strcpy(info->driver, DRV_NAME); |
| 489 | strcpy(info->version, DRV_VERSION); | 489 | strcpy(info->version, DRV_VERSION); |
| 490 | strcpy(info->fw_version, "N/A"); | 490 | strcpy(info->fw_version, "N/A"); |
| 491 | strcpy(info->bus_info, dev->dev.bus_id); | 491 | strcpy(info->bus_info, dev_name(&dev->dev)); |
| 492 | } | 492 | } |
| 493 | 493 | ||
| 494 | static struct ethtool_ops bfin_mac_ethtool_ops = { | 494 | static struct ethtool_ops bfin_mac_ethtool_ops = { |
diff --git a/drivers/net/bmac.c b/drivers/net/bmac.c index 8a546a33d581..1ab58375d061 100644 --- a/drivers/net/bmac.c +++ b/drivers/net/bmac.c | |||
| @@ -1240,7 +1240,7 @@ static void bmac_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *inf | |||
| 1240 | { | 1240 | { |
| 1241 | struct bmac_data *bp = netdev_priv(dev); | 1241 | struct bmac_data *bp = netdev_priv(dev); |
| 1242 | strcpy(info->driver, "bmac"); | 1242 | strcpy(info->driver, "bmac"); |
| 1243 | strcpy(info->bus_info, bp->mdev->ofdev.dev.bus_id); | 1243 | strcpy(info->bus_info, dev_name(&bp->mdev->ofdev.dev)); |
| 1244 | } | 1244 | } |
| 1245 | 1245 | ||
| 1246 | static const struct ethtool_ops bmac_ethtool_ops = { | 1246 | static const struct ethtool_ops bmac_ethtool_ops = { |
diff --git a/drivers/net/cpmac.c b/drivers/net/cpmac.c index f66548751c38..79741c5f9fe7 100644 --- a/drivers/net/cpmac.c +++ b/drivers/net/cpmac.c | |||
| @@ -1161,7 +1161,7 @@ static int __devinit cpmac_probe(struct platform_device *pdev) | |||
| 1161 | priv->msg_enable = netif_msg_init(debug_level, 0xff); | 1161 | priv->msg_enable = netif_msg_init(debug_level, 0xff); |
| 1162 | memcpy(dev->dev_addr, pdata->dev_addr, sizeof(dev->dev_addr)); | 1162 | memcpy(dev->dev_addr, pdata->dev_addr, sizeof(dev->dev_addr)); |
| 1163 | 1163 | ||
| 1164 | priv->phy = phy_connect(dev, cpmac_mii->phy_map[phy_id]->dev.bus_id, | 1164 | priv->phy = phy_connect(dev, dev_name(&cpmac_mii->phy_map[phy_id]->dev), |
| 1165 | &cpmac_adjust_link, 0, PHY_INTERFACE_MODE_MII); | 1165 | &cpmac_adjust_link, 0, PHY_INTERFACE_MODE_MII); |
| 1166 | if (IS_ERR(priv->phy)) { | 1166 | if (IS_ERR(priv->phy)) { |
| 1167 | if (netif_msg_drv(priv)) | 1167 | if (netif_msg_drv(priv)) |
diff --git a/drivers/net/declance.c b/drivers/net/declance.c index 7ce3053530f9..861c867fca87 100644 --- a/drivers/net/declance.c +++ b/drivers/net/declance.c | |||
| @@ -1027,7 +1027,7 @@ static int __init dec_lance_probe(struct device *bdev, const int type) | |||
| 1027 | printk(version); | 1027 | printk(version); |
| 1028 | 1028 | ||
| 1029 | if (bdev) | 1029 | if (bdev) |
| 1030 | snprintf(name, sizeof(name), "%s", bdev->bus_id); | 1030 | snprintf(name, sizeof(name), "%s", dev_name(bdev)); |
| 1031 | else { | 1031 | else { |
| 1032 | i = 0; | 1032 | i = 0; |
| 1033 | dev = root_lance_dev; | 1033 | dev = root_lance_dev; |
| @@ -1105,10 +1105,10 @@ static int __init dec_lance_probe(struct device *bdev, const int type) | |||
| 1105 | 1105 | ||
| 1106 | start = to_tc_dev(bdev)->resource.start; | 1106 | start = to_tc_dev(bdev)->resource.start; |
| 1107 | len = to_tc_dev(bdev)->resource.end - start + 1; | 1107 | len = to_tc_dev(bdev)->resource.end - start + 1; |
| 1108 | if (!request_mem_region(start, len, bdev->bus_id)) { | 1108 | if (!request_mem_region(start, len, dev_name(bdev))) { |
| 1109 | printk(KERN_ERR | 1109 | printk(KERN_ERR |
| 1110 | "%s: Unable to reserve MMIO resource\n", | 1110 | "%s: Unable to reserve MMIO resource\n", |
| 1111 | bdev->bus_id); | 1111 | dev_name(bdev)); |
| 1112 | ret = -EBUSY; | 1112 | ret = -EBUSY; |
| 1113 | goto err_out_dev; | 1113 | goto err_out_dev; |
| 1114 | } | 1114 | } |
diff --git a/drivers/net/depca.c b/drivers/net/depca.c index e4cef491dc73..55625dbbae5a 100644 --- a/drivers/net/depca.c +++ b/drivers/net/depca.c | |||
| @@ -606,8 +606,8 @@ static int __init depca_hw_init (struct net_device *dev, struct device *device) | |||
| 606 | if (!mem_start || lp->adapter < DEPCA || lp->adapter >=unknown) | 606 | if (!mem_start || lp->adapter < DEPCA || lp->adapter >=unknown) |
| 607 | return -ENXIO; | 607 | return -ENXIO; |
| 608 | 608 | ||
| 609 | printk ("%s: %s at 0x%04lx", | 609 | printk("%s: %s at 0x%04lx", |
| 610 | device->bus_id, depca_signature[lp->adapter], ioaddr); | 610 | dev_name(device), depca_signature[lp->adapter], ioaddr); |
| 611 | 611 | ||
| 612 | switch (lp->depca_bus) { | 612 | switch (lp->depca_bus) { |
| 613 | #ifdef CONFIG_MCA | 613 | #ifdef CONFIG_MCA |
| @@ -669,7 +669,7 @@ static int __init depca_hw_init (struct net_device *dev, struct device *device) | |||
| 669 | 669 | ||
| 670 | spin_lock_init(&lp->lock); | 670 | spin_lock_init(&lp->lock); |
| 671 | sprintf(lp->adapter_name, "%s (%s)", | 671 | sprintf(lp->adapter_name, "%s (%s)", |
| 672 | depca_signature[lp->adapter], device->bus_id); | 672 | depca_signature[lp->adapter], dev_name(device)); |
| 673 | status = -EBUSY; | 673 | status = -EBUSY; |
| 674 | 674 | ||
| 675 | /* Initialisation Block */ | 675 | /* Initialisation Block */ |
diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c index dfe92264e825..8e7c16535ad7 100644 --- a/drivers/net/ehea/ehea_main.c +++ b/drivers/net/ehea/ehea_main.c | |||
| @@ -3040,7 +3040,7 @@ static struct device *ehea_register_port(struct ehea_port *port, | |||
| 3040 | port->ofdev.dev.parent = &port->adapter->ofdev->dev; | 3040 | port->ofdev.dev.parent = &port->adapter->ofdev->dev; |
| 3041 | port->ofdev.dev.bus = &ibmebus_bus_type; | 3041 | port->ofdev.dev.bus = &ibmebus_bus_type; |
| 3042 | 3042 | ||
| 3043 | sprintf(port->ofdev.dev.bus_id, "port%d", port_name_cnt++); | 3043 | dev_set_name(&port->ofdev.dev, "port%d", port_name_cnt++); |
| 3044 | port->ofdev.dev.release = logical_port_release; | 3044 | port->ofdev.dev.release = logical_port_release; |
| 3045 | 3045 | ||
| 3046 | ret = of_device_register(&port->ofdev); | 3046 | ret = of_device_register(&port->ofdev); |
diff --git a/drivers/net/jazzsonic.c b/drivers/net/jazzsonic.c index 334ff9e12cdd..14248cfc3dfd 100644 --- a/drivers/net/jazzsonic.c +++ b/drivers/net/jazzsonic.c | |||
| @@ -131,7 +131,8 @@ static int __init sonic_probe1(struct net_device *dev) | |||
| 131 | if (sonic_debug && version_printed++ == 0) | 131 | if (sonic_debug && version_printed++ == 0) |
| 132 | printk(version); | 132 | printk(version); |
| 133 | 133 | ||
| 134 | printk(KERN_INFO "%s: Sonic ethernet found at 0x%08lx, ", lp->device->bus_id, dev->base_addr); | 134 | printk(KERN_INFO "%s: Sonic ethernet found at 0x%08lx, ", |
| 135 | dev_name(lp->device), dev->base_addr); | ||
| 135 | 136 | ||
| 136 | /* | 137 | /* |
| 137 | * Put the sonic into software reset, then | 138 | * Put the sonic into software reset, then |
| @@ -156,7 +157,8 @@ static int __init sonic_probe1(struct net_device *dev) | |||
| 156 | if ((lp->descriptors = dma_alloc_coherent(lp->device, | 157 | if ((lp->descriptors = dma_alloc_coherent(lp->device, |
| 157 | SIZEOF_SONIC_DESC * SONIC_BUS_SCALE(lp->dma_bitmode), | 158 | SIZEOF_SONIC_DESC * SONIC_BUS_SCALE(lp->dma_bitmode), |
| 158 | &lp->descriptors_laddr, GFP_KERNEL)) == NULL) { | 159 | &lp->descriptors_laddr, GFP_KERNEL)) == NULL) { |
| 159 | printk(KERN_ERR "%s: couldn't alloc DMA memory for descriptors.\n", lp->device->bus_id); | 160 | printk(KERN_ERR "%s: couldn't alloc DMA memory for descriptors.\n", |
| 161 | dev_name(lp->device)); | ||
| 160 | goto out; | 162 | goto out; |
| 161 | } | 163 | } |
| 162 | 164 | ||
diff --git a/drivers/net/macb.c b/drivers/net/macb.c index f6c4936e2fa8..f4086542c358 100644 --- a/drivers/net/macb.c +++ b/drivers/net/macb.c | |||
| @@ -211,10 +211,10 @@ static int macb_mii_probe(struct net_device *dev) | |||
| 211 | 211 | ||
| 212 | /* attach the mac to the phy */ | 212 | /* attach the mac to the phy */ |
| 213 | if (pdata && pdata->is_rmii) { | 213 | if (pdata && pdata->is_rmii) { |
| 214 | phydev = phy_connect(dev, phydev->dev.bus_id, | 214 | phydev = phy_connect(dev, dev_name(&phydev->dev), |
| 215 | &macb_handle_link_change, 0, PHY_INTERFACE_MODE_RMII); | 215 | &macb_handle_link_change, 0, PHY_INTERFACE_MODE_RMII); |
| 216 | } else { | 216 | } else { |
| 217 | phydev = phy_connect(dev, phydev->dev.bus_id, | 217 | phydev = phy_connect(dev, dev_name(&phydev->dev), |
| 218 | &macb_handle_link_change, 0, PHY_INTERFACE_MODE_MII); | 218 | &macb_handle_link_change, 0, PHY_INTERFACE_MODE_MII); |
| 219 | } | 219 | } |
| 220 | 220 | ||
| @@ -1077,7 +1077,7 @@ static void macb_get_drvinfo(struct net_device *dev, | |||
| 1077 | 1077 | ||
| 1078 | strcpy(info->driver, bp->pdev->dev.driver->name); | 1078 | strcpy(info->driver, bp->pdev->dev.driver->name); |
| 1079 | strcpy(info->version, "$Revision: 1.14 $"); | 1079 | strcpy(info->version, "$Revision: 1.14 $"); |
| 1080 | strcpy(info->bus_info, bp->pdev->dev.bus_id); | 1080 | strcpy(info->bus_info, dev_name(&bp->pdev->dev)); |
| 1081 | } | 1081 | } |
| 1082 | 1082 | ||
| 1083 | static struct ethtool_ops macb_ethtool_ops = { | 1083 | static struct ethtool_ops macb_ethtool_ops = { |
| @@ -1234,8 +1234,8 @@ static int __init macb_probe(struct platform_device *pdev) | |||
| 1234 | 1234 | ||
| 1235 | phydev = bp->phy_dev; | 1235 | phydev = bp->phy_dev; |
| 1236 | printk(KERN_INFO "%s: attached PHY driver [%s] " | 1236 | printk(KERN_INFO "%s: attached PHY driver [%s] " |
| 1237 | "(mii_bus:phy_addr=%s, irq=%d)\n", | 1237 | "(mii_bus:phy_addr=%s, irq=%d)\n", dev->name, |
| 1238 | dev->name, phydev->drv->name, phydev->dev.bus_id, phydev->irq); | 1238 | phydev->drv->name, dev_name(&phydev->dev), phydev->irq); |
| 1239 | 1239 | ||
| 1240 | return 0; | 1240 | return 0; |
| 1241 | 1241 | ||
diff --git a/drivers/net/macsonic.c b/drivers/net/macsonic.c index 205bb05c25d6..527166e35d56 100644 --- a/drivers/net/macsonic.c +++ b/drivers/net/macsonic.c | |||
| @@ -176,7 +176,8 @@ static int __init macsonic_init(struct net_device *dev) | |||
| 176 | if ((lp->descriptors = dma_alloc_coherent(lp->device, | 176 | if ((lp->descriptors = dma_alloc_coherent(lp->device, |
| 177 | SIZEOF_SONIC_DESC * SONIC_BUS_SCALE(lp->dma_bitmode), | 177 | SIZEOF_SONIC_DESC * SONIC_BUS_SCALE(lp->dma_bitmode), |
| 178 | &lp->descriptors_laddr, GFP_KERNEL)) == NULL) { | 178 | &lp->descriptors_laddr, GFP_KERNEL)) == NULL) { |
| 179 | printk(KERN_ERR "%s: couldn't alloc DMA memory for descriptors.\n", lp->device->bus_id); | 179 | printk(KERN_ERR "%s: couldn't alloc DMA memory for descriptors.\n", |
| 180 | dev_name(lp->device)); | ||
| 180 | return -ENOMEM; | 181 | return -ENOMEM; |
| 181 | } | 182 | } |
| 182 | 183 | ||
| @@ -337,7 +338,7 @@ static int __init mac_onboard_sonic_probe(struct net_device *dev) | |||
| 337 | sonic_version_printed = 1; | 338 | sonic_version_printed = 1; |
| 338 | } | 339 | } |
| 339 | printk(KERN_INFO "%s: onboard / comm-slot SONIC at 0x%08lx\n", | 340 | printk(KERN_INFO "%s: onboard / comm-slot SONIC at 0x%08lx\n", |
| 340 | lp->device->bus_id, dev->base_addr); | 341 | dev_name(lp->device), dev->base_addr); |
| 341 | 342 | ||
| 342 | /* The PowerBook's SONIC is 16 bit always. */ | 343 | /* The PowerBook's SONIC is 16 bit always. */ |
| 343 | if (macintosh_config->ident == MAC_MODEL_PB520) { | 344 | if (macintosh_config->ident == MAC_MODEL_PB520) { |
| @@ -370,10 +371,10 @@ static int __init mac_onboard_sonic_probe(struct net_device *dev) | |||
| 370 | } | 371 | } |
| 371 | printk(KERN_INFO | 372 | printk(KERN_INFO |
| 372 | "%s: revision 0x%04x, using %d bit DMA and register offset %d\n", | 373 | "%s: revision 0x%04x, using %d bit DMA and register offset %d\n", |
| 373 | lp->device->bus_id, sr, lp->dma_bitmode?32:16, lp->reg_offset); | 374 | dev_name(lp->device), sr, lp->dma_bitmode?32:16, lp->reg_offset); |
| 374 | 375 | ||
| 375 | #if 0 /* This is sometimes useful to find out how MacOS configured the card. */ | 376 | #if 0 /* This is sometimes useful to find out how MacOS configured the card. */ |
| 376 | printk(KERN_INFO "%s: DCR: 0x%04x, DCR2: 0x%04x\n", lp->device->bus_id, | 377 | printk(KERN_INFO "%s: DCR: 0x%04x, DCR2: 0x%04x\n", dev_name(lp->device), |
| 377 | SONIC_READ(SONIC_DCR) & 0xffff, SONIC_READ(SONIC_DCR2) & 0xffff); | 378 | SONIC_READ(SONIC_DCR) & 0xffff, SONIC_READ(SONIC_DCR2) & 0xffff); |
| 378 | #endif | 379 | #endif |
| 379 | 380 | ||
| @@ -525,12 +526,12 @@ static int __init mac_nubus_sonic_probe(struct net_device *dev) | |||
| 525 | sonic_version_printed = 1; | 526 | sonic_version_printed = 1; |
| 526 | } | 527 | } |
| 527 | printk(KERN_INFO "%s: %s in slot %X\n", | 528 | printk(KERN_INFO "%s: %s in slot %X\n", |
| 528 | lp->device->bus_id, ndev->board->name, ndev->board->slot); | 529 | dev_name(lp->device), ndev->board->name, ndev->board->slot); |
| 529 | printk(KERN_INFO "%s: revision 0x%04x, using %d bit DMA and register offset %d\n", | 530 | printk(KERN_INFO "%s: revision 0x%04x, using %d bit DMA and register offset %d\n", |
| 530 | lp->device->bus_id, SONIC_READ(SONIC_SR), dma_bitmode?32:16, reg_offset); | 531 | dev_name(lp->device), SONIC_READ(SONIC_SR), dma_bitmode?32:16, reg_offset); |
| 531 | 532 | ||
| 532 | #if 0 /* This is sometimes useful to find out how MacOS configured the card. */ | 533 | #if 0 /* This is sometimes useful to find out how MacOS configured the card. */ |
| 533 | printk(KERN_INFO "%s: DCR: 0x%04x, DCR2: 0x%04x\n", lp->device->bus_id, | 534 | printk(KERN_INFO "%s: DCR: 0x%04x, DCR2: 0x%04x\n", dev_name(lp->device), |
| 534 | SONIC_READ(SONIC_DCR) & 0xffff, SONIC_READ(SONIC_DCR2) & 0xffff); | 535 | SONIC_READ(SONIC_DCR) & 0xffff, SONIC_READ(SONIC_DCR2) & 0xffff); |
| 535 | #endif | 536 | #endif |
| 536 | 537 | ||
diff --git a/drivers/net/mipsnet.c b/drivers/net/mipsnet.c index 4e7a5faf0351..664835b822fb 100644 --- a/drivers/net/mipsnet.c +++ b/drivers/net/mipsnet.c | |||
| @@ -237,7 +237,7 @@ static void mipsnet_set_mclist(struct net_device *dev) | |||
| 237 | { | 237 | { |
| 238 | } | 238 | } |
| 239 | 239 | ||
| 240 | static int __init mipsnet_probe(struct device *dev) | 240 | static int __init mipsnet_probe(struct platform_device *dev) |
| 241 | { | 241 | { |
| 242 | struct net_device *netdev; | 242 | struct net_device *netdev; |
| 243 | int err; | 243 | int err; |
| @@ -248,7 +248,7 @@ static int __init mipsnet_probe(struct device *dev) | |||
| 248 | goto out; | 248 | goto out; |
| 249 | } | 249 | } |
| 250 | 250 | ||
| 251 | dev_set_drvdata(dev, netdev); | 251 | platform_set_drvdata(dev, netdev); |
| 252 | 252 | ||
| 253 | netdev->open = mipsnet_open; | 253 | netdev->open = mipsnet_open; |
| 254 | netdev->stop = mipsnet_close; | 254 | netdev->stop = mipsnet_close; |
| @@ -293,23 +293,25 @@ out: | |||
| 293 | return err; | 293 | return err; |
| 294 | } | 294 | } |
| 295 | 295 | ||
| 296 | static int __devexit mipsnet_device_remove(struct device *device) | 296 | static int __devexit mipsnet_device_remove(struct platform_device *device) |
| 297 | { | 297 | { |
| 298 | struct net_device *dev = dev_get_drvdata(device); | 298 | struct net_device *dev = platform_get_drvdata(device); |
| 299 | 299 | ||
| 300 | unregister_netdev(dev); | 300 | unregister_netdev(dev); |
| 301 | release_region(dev->base_addr, sizeof(struct mipsnet_regs)); | 301 | release_region(dev->base_addr, sizeof(struct mipsnet_regs)); |
| 302 | free_netdev(dev); | 302 | free_netdev(dev); |
| 303 | dev_set_drvdata(device, NULL); | 303 | platform_set_drvdata(device, NULL); |
| 304 | 304 | ||
| 305 | return 0; | 305 | return 0; |
| 306 | } | 306 | } |
| 307 | 307 | ||
| 308 | static struct device_driver mipsnet_driver = { | 308 | static struct platform_driver mipsnet_driver = { |
| 309 | .name = mipsnet_string, | 309 | .driver = { |
| 310 | .bus = &platform_bus_type, | 310 | .name = mipsnet_string, |
| 311 | .probe = mipsnet_probe, | 311 | .owner = THIS_MODULE, |
| 312 | .remove = __devexit_p(mipsnet_device_remove), | 312 | }, |
| 313 | .probe = mipsnet_probe, | ||
| 314 | .remove = __devexit_p(mipsnet_device_remove), | ||
| 313 | }; | 315 | }; |
| 314 | 316 | ||
| 315 | static int __init mipsnet_init_module(void) | 317 | static int __init mipsnet_init_module(void) |
| @@ -319,7 +321,7 @@ static int __init mipsnet_init_module(void) | |||
| 319 | printk(KERN_INFO "MIPSNet Ethernet driver. Version: %s. " | 321 | printk(KERN_INFO "MIPSNet Ethernet driver. Version: %s. " |
| 320 | "(c)2005 MIPS Technologies, Inc.\n", MIPSNET_VERSION); | 322 | "(c)2005 MIPS Technologies, Inc.\n", MIPSNET_VERSION); |
| 321 | 323 | ||
| 322 | err = driver_register(&mipsnet_driver); | 324 | err = platform_driver_register(&mipsnet_driver); |
| 323 | if (err) | 325 | if (err) |
| 324 | printk(KERN_ERR "Driver registration failed\n"); | 326 | printk(KERN_ERR "Driver registration failed\n"); |
| 325 | 327 | ||
| @@ -328,7 +330,7 @@ static int __init mipsnet_init_module(void) | |||
| 328 | 330 | ||
| 329 | static void __exit mipsnet_exit_module(void) | 331 | static void __exit mipsnet_exit_module(void) |
| 330 | { | 332 | { |
| 331 | driver_unregister(&mipsnet_driver); | 333 | platform_driver_unregister(&mipsnet_driver); |
| 332 | } | 334 | } |
| 333 | 335 | ||
| 334 | module_init(mipsnet_init_module); | 336 | module_init(mipsnet_init_module); |
diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c index b0bc3bc18e9c..fe4e158c893d 100644 --- a/drivers/net/mv643xx_eth.c +++ b/drivers/net/mv643xx_eth.c | |||
| @@ -2588,7 +2588,7 @@ static void phy_init(struct mv643xx_eth_private *mp, int speed, int duplex) | |||
| 2588 | 2588 | ||
| 2589 | phy_reset(mp); | 2589 | phy_reset(mp); |
| 2590 | 2590 | ||
| 2591 | phy_attach(mp->dev, phy->dev.bus_id, 0, PHY_INTERFACE_MODE_GMII); | 2591 | phy_attach(mp->dev, dev_name(&phy->dev), 0, PHY_INTERFACE_MODE_GMII); |
| 2592 | 2592 | ||
| 2593 | if (speed == 0) { | 2593 | if (speed == 0) { |
| 2594 | phy->autoneg = AUTONEG_ENABLE; | 2594 | phy->autoneg = AUTONEG_ENABLE; |
diff --git a/drivers/net/sb1250-mac.c b/drivers/net/sb1250-mac.c index 31e38fae017f..845431c186ac 100644 --- a/drivers/net/sb1250-mac.c +++ b/drivers/net/sb1250-mac.c | |||
| @@ -2478,7 +2478,7 @@ static int sbmac_mii_probe(struct net_device *dev) | |||
| 2478 | return -ENXIO; | 2478 | return -ENXIO; |
| 2479 | } | 2479 | } |
| 2480 | 2480 | ||
| 2481 | phy_dev = phy_connect(dev, phy_dev->dev.bus_id, &sbmac_mii_poll, 0, | 2481 | phy_dev = phy_connect(dev, dev_name(&phy_dev->dev), &sbmac_mii_poll, 0, |
| 2482 | PHY_INTERFACE_MODE_GMII); | 2482 | PHY_INTERFACE_MODE_GMII); |
| 2483 | if (IS_ERR(phy_dev)) { | 2483 | if (IS_ERR(phy_dev)) { |
| 2484 | printk(KERN_ERR "%s: could not attach to PHY\n", dev->name); | 2484 | printk(KERN_ERR "%s: could not attach to PHY\n", dev->name); |
| @@ -2500,7 +2500,7 @@ static int sbmac_mii_probe(struct net_device *dev) | |||
| 2500 | 2500 | ||
| 2501 | pr_info("%s: attached PHY driver [%s] (mii_bus:phy_addr=%s, irq=%d)\n", | 2501 | pr_info("%s: attached PHY driver [%s] (mii_bus:phy_addr=%s, irq=%d)\n", |
| 2502 | dev->name, phy_dev->drv->name, | 2502 | dev->name, phy_dev->drv->name, |
| 2503 | phy_dev->dev.bus_id, phy_dev->irq); | 2503 | dev_name(&phy_dev->dev), phy_dev->irq); |
| 2504 | 2504 | ||
| 2505 | sc->phy_dev = phy_dev; | 2505 | sc->phy_dev = phy_dev; |
| 2506 | 2506 | ||
| @@ -2697,7 +2697,7 @@ static int __init sbmac_probe(struct platform_device *pldev) | |||
| 2697 | sbm_base = ioremap_nocache(res->start, res->end - res->start + 1); | 2697 | sbm_base = ioremap_nocache(res->start, res->end - res->start + 1); |
| 2698 | if (!sbm_base) { | 2698 | if (!sbm_base) { |
| 2699 | printk(KERN_ERR "%s: unable to map device registers\n", | 2699 | printk(KERN_ERR "%s: unable to map device registers\n", |
| 2700 | pldev->dev.bus_id); | 2700 | dev_name(&pldev->dev)); |
| 2701 | err = -ENOMEM; | 2701 | err = -ENOMEM; |
| 2702 | goto out_out; | 2702 | goto out_out; |
| 2703 | } | 2703 | } |
| @@ -2708,7 +2708,7 @@ static int __init sbmac_probe(struct platform_device *pldev) | |||
| 2708 | * If we find a zero, skip this MAC. | 2708 | * If we find a zero, skip this MAC. |
| 2709 | */ | 2709 | */ |
| 2710 | sbmac_orig_hwaddr = __raw_readq(sbm_base + R_MAC_ETHERNET_ADDR); | 2710 | sbmac_orig_hwaddr = __raw_readq(sbm_base + R_MAC_ETHERNET_ADDR); |
| 2711 | pr_debug("%s: %sconfiguring MAC at 0x%08Lx\n", pldev->dev.bus_id, | 2711 | pr_debug("%s: %sconfiguring MAC at 0x%08Lx\n", dev_name(&pldev->dev), |
| 2712 | sbmac_orig_hwaddr ? "" : "not ", (long long)res->start); | 2712 | sbmac_orig_hwaddr ? "" : "not ", (long long)res->start); |
| 2713 | if (sbmac_orig_hwaddr == 0) { | 2713 | if (sbmac_orig_hwaddr == 0) { |
| 2714 | err = 0; | 2714 | err = 0; |
| @@ -2721,7 +2721,7 @@ static int __init sbmac_probe(struct platform_device *pldev) | |||
| 2721 | dev = alloc_etherdev(sizeof(struct sbmac_softc)); | 2721 | dev = alloc_etherdev(sizeof(struct sbmac_softc)); |
| 2722 | if (!dev) { | 2722 | if (!dev) { |
| 2723 | printk(KERN_ERR "%s: unable to allocate etherdev\n", | 2723 | printk(KERN_ERR "%s: unable to allocate etherdev\n", |
| 2724 | pldev->dev.bus_id); | 2724 | dev_name(&pldev->dev)); |
| 2725 | err = -ENOMEM; | 2725 | err = -ENOMEM; |
| 2726 | goto out_unmap; | 2726 | goto out_unmap; |
| 2727 | } | 2727 | } |
diff --git a/drivers/net/smc911x.c b/drivers/net/smc911x.c index 223cde0d43be..293610334a77 100644 --- a/drivers/net/smc911x.c +++ b/drivers/net/smc911x.c | |||
| @@ -1545,7 +1545,7 @@ smc911x_ethtool_getdrvinfo(struct net_device *dev, struct ethtool_drvinfo *info) | |||
| 1545 | { | 1545 | { |
| 1546 | strncpy(info->driver, CARDNAME, sizeof(info->driver)); | 1546 | strncpy(info->driver, CARDNAME, sizeof(info->driver)); |
| 1547 | strncpy(info->version, version, sizeof(info->version)); | 1547 | strncpy(info->version, version, sizeof(info->version)); |
| 1548 | strncpy(info->bus_info, dev->dev.parent->bus_id, sizeof(info->bus_info)); | 1548 | strncpy(info->bus_info, dev_name(dev->dev.parent), sizeof(info->bus_info)); |
| 1549 | } | 1549 | } |
| 1550 | 1550 | ||
| 1551 | static int smc911x_ethtool_nwayreset(struct net_device *dev) | 1551 | static int smc911x_ethtool_nwayreset(struct net_device *dev) |
diff --git a/drivers/net/smc91x.c b/drivers/net/smc91x.c index b215a8d85e62..0b6da9501444 100644 --- a/drivers/net/smc91x.c +++ b/drivers/net/smc91x.c | |||
| @@ -1614,7 +1614,7 @@ smc_ethtool_getdrvinfo(struct net_device *dev, struct ethtool_drvinfo *info) | |||
| 1614 | { | 1614 | { |
| 1615 | strncpy(info->driver, CARDNAME, sizeof(info->driver)); | 1615 | strncpy(info->driver, CARDNAME, sizeof(info->driver)); |
| 1616 | strncpy(info->version, version, sizeof(info->version)); | 1616 | strncpy(info->version, version, sizeof(info->version)); |
| 1617 | strncpy(info->bus_info, dev->dev.parent->bus_id, sizeof(info->bus_info)); | 1617 | strncpy(info->bus_info, dev_name(dev->dev.parent), sizeof(info->bus_info)); |
| 1618 | } | 1618 | } |
| 1619 | 1619 | ||
| 1620 | static int smc_ethtool_nwayreset(struct net_device *dev) | 1620 | static int smc_ethtool_nwayreset(struct net_device *dev) |
diff --git a/drivers/net/smsc911x.c b/drivers/net/smsc911x.c index d1590ac55e4b..ab18ee0f60f3 100644 --- a/drivers/net/smsc911x.c +++ b/drivers/net/smsc911x.c | |||
| @@ -769,7 +769,7 @@ static int smsc911x_mii_probe(struct net_device *dev) | |||
| 769 | return -ENODEV; | 769 | return -ENODEV; |
| 770 | } | 770 | } |
| 771 | 771 | ||
| 772 | phydev = phy_connect(dev, phydev->dev.bus_id, | 772 | phydev = phy_connect(dev, dev_name(&phydev->dev), |
| 773 | &smsc911x_phy_adjust_link, 0, pdata->config.phy_interface); | 773 | &smsc911x_phy_adjust_link, 0, pdata->config.phy_interface); |
| 774 | 774 | ||
| 775 | if (IS_ERR(phydev)) { | 775 | if (IS_ERR(phydev)) { |
| @@ -778,7 +778,8 @@ static int smsc911x_mii_probe(struct net_device *dev) | |||
| 778 | } | 778 | } |
| 779 | 779 | ||
| 780 | pr_info("%s: attached PHY driver [%s] (mii_bus:phy_addr=%s, irq=%d)\n", | 780 | pr_info("%s: attached PHY driver [%s] (mii_bus:phy_addr=%s, irq=%d)\n", |
| 781 | dev->name, phydev->drv->name, phydev->dev.bus_id, phydev->irq); | 781 | dev->name, phydev->drv->name, |
| 782 | dev_name(&phydev->dev), phydev->irq); | ||
| 782 | 783 | ||
| 783 | /* mask with MAC supported features */ | 784 | /* mask with MAC supported features */ |
| 784 | phydev->supported &= (PHY_BASIC_FEATURES | SUPPORTED_Pause | | 785 | phydev->supported &= (PHY_BASIC_FEATURES | SUPPORTED_Pause | |
| @@ -1549,7 +1550,7 @@ static void smsc911x_ethtool_getdrvinfo(struct net_device *dev, | |||
| 1549 | { | 1550 | { |
| 1550 | strlcpy(info->driver, SMSC_CHIPNAME, sizeof(info->driver)); | 1551 | strlcpy(info->driver, SMSC_CHIPNAME, sizeof(info->driver)); |
| 1551 | strlcpy(info->version, SMSC_DRV_VERSION, sizeof(info->version)); | 1552 | strlcpy(info->version, SMSC_DRV_VERSION, sizeof(info->version)); |
| 1552 | strlcpy(info->bus_info, dev->dev.parent->bus_id, | 1553 | strlcpy(info->bus_info, dev_name(dev->dev.parent), |
| 1553 | sizeof(info->bus_info)); | 1554 | sizeof(info->bus_info)); |
| 1554 | } | 1555 | } |
| 1555 | 1556 | ||
diff --git a/drivers/net/smsc9420.c b/drivers/net/smsc9420.c index 4e15ae068b3f..72f1348eb809 100644 --- a/drivers/net/smsc9420.c +++ b/drivers/net/smsc9420.c | |||
| @@ -1160,7 +1160,7 @@ static int smsc9420_mii_probe(struct net_device *dev) | |||
| 1160 | smsc_info(PROBE, "PHY addr %d, phy_id 0x%08X", phydev->addr, | 1160 | smsc_info(PROBE, "PHY addr %d, phy_id 0x%08X", phydev->addr, |
| 1161 | phydev->phy_id); | 1161 | phydev->phy_id); |
| 1162 | 1162 | ||
| 1163 | phydev = phy_connect(dev, phydev->dev.bus_id, | 1163 | phydev = phy_connect(dev, dev_name(&phydev->dev), |
| 1164 | &smsc9420_phy_adjust_link, 0, PHY_INTERFACE_MODE_MII); | 1164 | &smsc9420_phy_adjust_link, 0, PHY_INTERFACE_MODE_MII); |
| 1165 | 1165 | ||
| 1166 | if (IS_ERR(phydev)) { | 1166 | if (IS_ERR(phydev)) { |
| @@ -1169,7 +1169,7 @@ static int smsc9420_mii_probe(struct net_device *dev) | |||
| 1169 | } | 1169 | } |
| 1170 | 1170 | ||
| 1171 | pr_info("%s: attached PHY driver [%s] (mii_bus:phy_addr=%s, irq=%d)\n", | 1171 | pr_info("%s: attached PHY driver [%s] (mii_bus:phy_addr=%s, irq=%d)\n", |
| 1172 | dev->name, phydev->drv->name, phydev->dev.bus_id, phydev->irq); | 1172 | dev->name, phydev->drv->name, dev_name(&phydev->dev), phydev->irq); |
| 1173 | 1173 | ||
| 1174 | /* mask with MAC supported features */ | 1174 | /* mask with MAC supported features */ |
| 1175 | phydev->supported &= (PHY_BASIC_FEATURES | SUPPORTED_Pause | | 1175 | phydev->supported &= (PHY_BASIC_FEATURES | SUPPORTED_Pause | |
diff --git a/drivers/net/tc35815.c b/drivers/net/tc35815.c index bcd0e60cbda9..e1f8eb96a45c 100644 --- a/drivers/net/tc35815.c +++ b/drivers/net/tc35815.c | |||
| @@ -725,7 +725,7 @@ static int tc_mii_probe(struct net_device *dev) | |||
| 725 | } | 725 | } |
| 726 | 726 | ||
| 727 | /* attach the mac to the phy */ | 727 | /* attach the mac to the phy */ |
| 728 | phydev = phy_connect(dev, phydev->dev.bus_id, | 728 | phydev = phy_connect(dev, dev_name(&phydev->dev), |
| 729 | &tc_handle_link_change, 0, | 729 | &tc_handle_link_change, 0, |
| 730 | lp->chiptype == TC35815_TX4939 ? | 730 | lp->chiptype == TC35815_TX4939 ? |
| 731 | PHY_INTERFACE_MODE_RMII : PHY_INTERFACE_MODE_MII); | 731 | PHY_INTERFACE_MODE_RMII : PHY_INTERFACE_MODE_MII); |
| @@ -735,7 +735,7 @@ static int tc_mii_probe(struct net_device *dev) | |||
| 735 | } | 735 | } |
| 736 | printk(KERN_INFO "%s: attached PHY driver [%s] " | 736 | printk(KERN_INFO "%s: attached PHY driver [%s] " |
| 737 | "(mii_bus:phy_addr=%s, id=%x)\n", | 737 | "(mii_bus:phy_addr=%s, id=%x)\n", |
| 738 | dev->name, phydev->drv->name, phydev->dev.bus_id, | 738 | dev->name, phydev->drv->name, dev_name(&phydev->dev), |
| 739 | phydev->phy_id); | 739 | phydev->phy_id); |
| 740 | 740 | ||
| 741 | /* mask with MAC supported features */ | 741 | /* mask with MAC supported features */ |
diff --git a/drivers/net/wimax/i2400m/driver.c b/drivers/net/wimax/i2400m/driver.c index e80a0b65a754..d58b971faa64 100644 --- a/drivers/net/wimax/i2400m/driver.c +++ b/drivers/net/wimax/i2400m/driver.c | |||
| @@ -613,7 +613,7 @@ int i2400m_setup(struct i2400m *i2400m, enum i2400m_bri bm_flags) | |||
| 613 | d_fnstart(3, dev, "(i2400m %p)\n", i2400m); | 613 | d_fnstart(3, dev, "(i2400m %p)\n", i2400m); |
| 614 | 614 | ||
| 615 | snprintf(wimax_dev->name, sizeof(wimax_dev->name), | 615 | snprintf(wimax_dev->name, sizeof(wimax_dev->name), |
| 616 | "i2400m-%s:%s", dev->bus->name, dev->bus_id); | 616 | "i2400m-%s:%s", dev->bus->name, dev_name(dev)); |
| 617 | 617 | ||
| 618 | i2400m->bm_cmd_buf = kzalloc(I2400M_BM_CMD_BUF_SIZE, GFP_KERNEL); | 618 | i2400m->bm_cmd_buf = kzalloc(I2400M_BM_CMD_BUF_SIZE, GFP_KERNEL); |
| 619 | if (i2400m->bm_cmd_buf == NULL) { | 619 | if (i2400m->bm_cmd_buf == NULL) { |
diff --git a/drivers/net/wimax/i2400m/usb-notif.c b/drivers/net/wimax/i2400m/usb-notif.c index 9702c22b2497..0528879f6d39 100644 --- a/drivers/net/wimax/i2400m/usb-notif.c +++ b/drivers/net/wimax/i2400m/usb-notif.c | |||
| @@ -102,7 +102,7 @@ int i2400mu_notification_grok(struct i2400mu *i2400mu, const void *buf, | |||
| 102 | dev_err(dev, "HW BUG? Unknown/unexpected data in notification " | 102 | dev_err(dev, "HW BUG? Unknown/unexpected data in notification " |
| 103 | "message (%zu bytes)\n", buf_len); | 103 | "message (%zu bytes)\n", buf_len); |
| 104 | snprintf(prefix, sizeof(prefix), "%s %s: ", | 104 | snprintf(prefix, sizeof(prefix), "%s %s: ", |
| 105 | dev_driver_string(dev) , dev->bus_id); | 105 | dev_driver_string(dev) , dev_name(dev)); |
| 106 | if (buf_len > 64) { | 106 | if (buf_len > 64) { |
| 107 | print_hex_dump(KERN_ERR, prefix, DUMP_PREFIX_OFFSET, | 107 | print_hex_dump(KERN_ERR, prefix, DUMP_PREFIX_OFFSET, |
| 108 | 8, 4, buf, 64, 0); | 108 | 8, 4, buf, 64, 0); |
diff --git a/drivers/net/xtsonic.c b/drivers/net/xtsonic.c index 03a3f34e9039..a12a7211c982 100644 --- a/drivers/net/xtsonic.c +++ b/drivers/net/xtsonic.c | |||
| @@ -183,7 +183,7 @@ static int __init sonic_probe1(struct net_device *dev) | |||
| 183 | 183 | ||
| 184 | if (lp->descriptors == NULL) { | 184 | if (lp->descriptors == NULL) { |
| 185 | printk(KERN_ERR "%s: couldn't alloc DMA memory for " | 185 | printk(KERN_ERR "%s: couldn't alloc DMA memory for " |
| 186 | " descriptors.\n", lp->device->bus_id); | 186 | " descriptors.\n", dev_name(lp->device)); |
| 187 | goto out; | 187 | goto out; |
| 188 | } | 188 | } |
| 189 | 189 | ||
diff --git a/drivers/pci/hotplug/cpqphp_sysfs.c b/drivers/pci/hotplug/cpqphp_sysfs.c index a13abf55d784..8450f4a6568a 100644 --- a/drivers/pci/hotplug/cpqphp_sysfs.c +++ b/drivers/pci/hotplug/cpqphp_sysfs.c | |||
| @@ -225,7 +225,8 @@ void cpqhp_shutdown_debugfs(void) | |||
| 225 | 225 | ||
| 226 | void cpqhp_create_debugfs_files(struct controller *ctrl) | 226 | void cpqhp_create_debugfs_files(struct controller *ctrl) |
| 227 | { | 227 | { |
| 228 | ctrl->dentry = debugfs_create_file(ctrl->pci_dev->dev.bus_id, S_IRUGO, root, ctrl, &debug_ops); | 228 | ctrl->dentry = debugfs_create_file(dev_name(&ctrl->pci_dev->dev), |
| 229 | S_IRUGO, root, ctrl, &debug_ops); | ||
| 229 | } | 230 | } |
| 230 | 231 | ||
| 231 | void cpqhp_remove_debugfs_files(struct controller *ctrl) | 232 | void cpqhp_remove_debugfs_files(struct controller *ctrl) |
diff --git a/drivers/pcmcia/au1000_generic.c b/drivers/pcmcia/au1000_generic.c index fc1de46fd20a..90013341cd5f 100644 --- a/drivers/pcmcia/au1000_generic.c +++ b/drivers/pcmcia/au1000_generic.c | |||
| @@ -468,13 +468,13 @@ out: | |||
| 468 | return ret; | 468 | return ret; |
| 469 | } | 469 | } |
| 470 | 470 | ||
| 471 | int au1x00_drv_pcmcia_remove(struct device *dev) | 471 | int au1x00_drv_pcmcia_remove(struct platform_device *dev) |
| 472 | { | 472 | { |
| 473 | struct skt_dev_info *sinfo = dev_get_drvdata(dev); | 473 | struct skt_dev_info *sinfo = platform_get_drvdata(dev); |
| 474 | int i; | 474 | int i; |
| 475 | 475 | ||
| 476 | mutex_lock(&pcmcia_sockets_lock); | 476 | mutex_lock(&pcmcia_sockets_lock); |
| 477 | dev_set_drvdata(dev, NULL); | 477 | platform_set_drvdata(dev, NULL); |
| 478 | 478 | ||
| 479 | for (i = 0; i < sinfo->nskt; i++) { | 479 | for (i = 0; i < sinfo->nskt; i++) { |
| 480 | struct au1000_pcmcia_socket *skt = PCMCIA_SOCKET(i); | 480 | struct au1000_pcmcia_socket *skt = PCMCIA_SOCKET(i); |
| @@ -498,13 +498,13 @@ int au1x00_drv_pcmcia_remove(struct device *dev) | |||
| 498 | * PCMCIA "Driver" API | 498 | * PCMCIA "Driver" API |
| 499 | */ | 499 | */ |
| 500 | 500 | ||
| 501 | static int au1x00_drv_pcmcia_probe(struct device *dev) | 501 | static int au1x00_drv_pcmcia_probe(struct platform_device *dev) |
| 502 | { | 502 | { |
| 503 | int i, ret = -ENODEV; | 503 | int i, ret = -ENODEV; |
| 504 | 504 | ||
| 505 | mutex_lock(&pcmcia_sockets_lock); | 505 | mutex_lock(&pcmcia_sockets_lock); |
| 506 | for (i=0; i < ARRAY_SIZE(au1x00_pcmcia_hw_init); i++) { | 506 | for (i=0; i < ARRAY_SIZE(au1x00_pcmcia_hw_init); i++) { |
| 507 | ret = au1x00_pcmcia_hw_init[i](dev); | 507 | ret = au1x00_pcmcia_hw_init[i](&dev->dev); |
| 508 | if (ret == 0) | 508 | if (ret == 0) |
| 509 | break; | 509 | break; |
| 510 | } | 510 | } |
| @@ -512,14 +512,26 @@ static int au1x00_drv_pcmcia_probe(struct device *dev) | |||
| 512 | return ret; | 512 | return ret; |
| 513 | } | 513 | } |
| 514 | 514 | ||
| 515 | static int au1x00_drv_pcmcia_suspend(struct platform_device *dev, | ||
| 516 | pm_message_t state) | ||
| 517 | { | ||
| 518 | return pcmcia_socket_dev_suspend(&dev->dev, state); | ||
| 519 | } | ||
| 520 | |||
| 521 | static int au1x00_drv_pcmcia_resume(struct platform_device *dev) | ||
| 522 | { | ||
| 523 | return pcmcia_socket_dev_resume(&dev->dev); | ||
| 524 | } | ||
| 515 | 525 | ||
| 516 | static struct device_driver au1x00_pcmcia_driver = { | 526 | static struct platform_driver au1x00_pcmcia_driver = { |
| 527 | .driver = { | ||
| 528 | .name = "au1x00-pcmcia", | ||
| 529 | .owner = THIS_MODULE, | ||
| 530 | }, | ||
| 517 | .probe = au1x00_drv_pcmcia_probe, | 531 | .probe = au1x00_drv_pcmcia_probe, |
| 518 | .remove = au1x00_drv_pcmcia_remove, | 532 | .remove = au1x00_drv_pcmcia_remove, |
| 519 | .name = "au1x00-pcmcia", | 533 | .suspend = au1x00_drv_pcmcia_suspend, |
| 520 | .bus = &platform_bus_type, | 534 | .resume = au1x00_drv_pcmcia_resume, |
| 521 | .suspend = pcmcia_socket_dev_suspend, | ||
| 522 | .resume = pcmcia_socket_dev_resume, | ||
| 523 | }; | 535 | }; |
| 524 | 536 | ||
| 525 | 537 | ||
| @@ -533,8 +545,7 @@ static struct device_driver au1x00_pcmcia_driver = { | |||
| 533 | static int __init au1x00_pcmcia_init(void) | 545 | static int __init au1x00_pcmcia_init(void) |
| 534 | { | 546 | { |
| 535 | int error = 0; | 547 | int error = 0; |
| 536 | if ((error = driver_register(&au1x00_pcmcia_driver))) | 548 | error = platform_driver_register(&au1x00_pcmcia_driver); |
| 537 | return error; | ||
| 538 | return error; | 549 | return error; |
| 539 | } | 550 | } |
| 540 | 551 | ||
| @@ -544,7 +555,7 @@ static int __init au1x00_pcmcia_init(void) | |||
| 544 | */ | 555 | */ |
| 545 | static void __exit au1x00_pcmcia_exit(void) | 556 | static void __exit au1x00_pcmcia_exit(void) |
| 546 | { | 557 | { |
| 547 | driver_unregister(&au1x00_pcmcia_driver); | 558 | platform_driver_unregister(&au1x00_pcmcia_driver); |
| 548 | } | 559 | } |
| 549 | 560 | ||
| 550 | module_init(au1x00_pcmcia_init); | 561 | module_init(au1x00_pcmcia_init); |
diff --git a/drivers/pcmcia/i82365.c b/drivers/pcmcia/i82365.c index 71653ab84890..40d4953e4b12 100644 --- a/drivers/pcmcia/i82365.c +++ b/drivers/pcmcia/i82365.c | |||
| @@ -1238,6 +1238,16 @@ static int pcic_init(struct pcmcia_socket *s) | |||
| 1238 | return 0; | 1238 | return 0; |
| 1239 | } | 1239 | } |
| 1240 | 1240 | ||
| 1241 | static int i82365_drv_pcmcia_suspend(struct platform_device *dev, | ||
| 1242 | pm_message_t state) | ||
| 1243 | { | ||
| 1244 | return pcmcia_socket_dev_suspend(&dev->dev, state); | ||
| 1245 | } | ||
| 1246 | |||
| 1247 | static int i82365_drv_pcmcia_resume(struct platform_device *dev) | ||
| 1248 | { | ||
| 1249 | return pcmcia_socket_dev_resume(&dev->dev); | ||
| 1250 | } | ||
| 1241 | static struct pccard_operations pcic_operations = { | 1251 | static struct pccard_operations pcic_operations = { |
| 1242 | .init = pcic_init, | 1252 | .init = pcic_init, |
| 1243 | .get_status = pcic_get_status, | 1253 | .get_status = pcic_get_status, |
| @@ -1248,11 +1258,13 @@ static struct pccard_operations pcic_operations = { | |||
| 1248 | 1258 | ||
| 1249 | /*====================================================================*/ | 1259 | /*====================================================================*/ |
| 1250 | 1260 | ||
| 1251 | static struct device_driver i82365_driver = { | 1261 | static struct platform_driver i82365_driver = { |
| 1252 | .name = "i82365", | 1262 | .driver = { |
| 1253 | .bus = &platform_bus_type, | 1263 | .name = "i82365", |
| 1254 | .suspend = pcmcia_socket_dev_suspend, | 1264 | .owner = THIS_MODULE, |
| 1255 | .resume = pcmcia_socket_dev_resume, | 1265 | }, |
| 1266 | .suspend = i82365_drv_pcmcia_suspend, | ||
| 1267 | .resume = i82365_drv_pcmcia_resume, | ||
| 1256 | }; | 1268 | }; |
| 1257 | 1269 | ||
| 1258 | static struct platform_device *i82365_device; | 1270 | static struct platform_device *i82365_device; |
| @@ -1261,7 +1273,7 @@ static int __init init_i82365(void) | |||
| 1261 | { | 1273 | { |
| 1262 | int i, ret; | 1274 | int i, ret; |
| 1263 | 1275 | ||
| 1264 | ret = driver_register(&i82365_driver); | 1276 | ret = platform_driver_register(&i82365_driver); |
| 1265 | if (ret) | 1277 | if (ret) |
| 1266 | goto err_out; | 1278 | goto err_out; |
| 1267 | 1279 | ||
| @@ -1337,7 +1349,7 @@ err_dev_unregister: | |||
| 1337 | pnp_disable_dev(i82365_pnpdev); | 1349 | pnp_disable_dev(i82365_pnpdev); |
| 1338 | #endif | 1350 | #endif |
| 1339 | err_driver_unregister: | 1351 | err_driver_unregister: |
| 1340 | driver_unregister(&i82365_driver); | 1352 | platform_driver_unregister(&i82365_driver); |
| 1341 | err_out: | 1353 | err_out: |
| 1342 | return ret; | 1354 | return ret; |
| 1343 | } /* init_i82365 */ | 1355 | } /* init_i82365 */ |
| @@ -1365,7 +1377,7 @@ static void __exit exit_i82365(void) | |||
| 1365 | if (i82365_pnpdev) | 1377 | if (i82365_pnpdev) |
| 1366 | pnp_disable_dev(i82365_pnpdev); | 1378 | pnp_disable_dev(i82365_pnpdev); |
| 1367 | #endif | 1379 | #endif |
| 1368 | driver_unregister(&i82365_driver); | 1380 | platform_driver_unregister(&i82365_driver); |
| 1369 | } /* exit_i82365 */ | 1381 | } /* exit_i82365 */ |
| 1370 | 1382 | ||
| 1371 | module_init(init_i82365); | 1383 | module_init(init_i82365); |
diff --git a/drivers/pcmcia/m32r_cfc.c b/drivers/pcmcia/m32r_cfc.c index 2ab4f22c21de..62b4ecc97c46 100644 --- a/drivers/pcmcia/m32r_cfc.c +++ b/drivers/pcmcia/m32r_cfc.c | |||
| @@ -696,13 +696,25 @@ static struct pccard_operations pcc_operations = { | |||
| 696 | .set_mem_map = pcc_set_mem_map, | 696 | .set_mem_map = pcc_set_mem_map, |
| 697 | }; | 697 | }; |
| 698 | 698 | ||
| 699 | static int cfc_drv_pcmcia_suspend(struct platform_device *dev, | ||
| 700 | pm_message_t state) | ||
| 701 | { | ||
| 702 | return pcmcia_socket_dev_suspend(&dev->dev, state); | ||
| 703 | } | ||
| 704 | |||
| 705 | static int cfc_drv_pcmcia_resume(struct platform_device *dev) | ||
| 706 | { | ||
| 707 | return pcmcia_socket_dev_resume(&dev->dev); | ||
| 708 | } | ||
| 699 | /*====================================================================*/ | 709 | /*====================================================================*/ |
| 700 | 710 | ||
| 701 | static struct device_driver pcc_driver = { | 711 | static struct platform_driver pcc_driver = { |
| 702 | .name = "cfc", | 712 | .driver = { |
| 703 | .bus = &platform_bus_type, | 713 | .name = "cfc", |
| 704 | .suspend = pcmcia_socket_dev_suspend, | 714 | .owner = THIS_MODULE, |
| 705 | .resume = pcmcia_socket_dev_resume, | 715 | }, |
| 716 | .suspend = cfc_drv_pcmcia_suspend, | ||
| 717 | .resume = cfc_drv_pcmcia_resume, | ||
| 706 | }; | 718 | }; |
| 707 | 719 | ||
| 708 | static struct platform_device pcc_device = { | 720 | static struct platform_device pcc_device = { |
| @@ -716,13 +728,13 @@ static int __init init_m32r_pcc(void) | |||
| 716 | { | 728 | { |
| 717 | int i, ret; | 729 | int i, ret; |
| 718 | 730 | ||
| 719 | ret = driver_register(&pcc_driver); | 731 | ret = platform_driver_register(&pcc_driver); |
| 720 | if (ret) | 732 | if (ret) |
| 721 | return ret; | 733 | return ret; |
| 722 | 734 | ||
| 723 | ret = platform_device_register(&pcc_device); | 735 | ret = platform_device_register(&pcc_device); |
| 724 | if (ret){ | 736 | if (ret){ |
| 725 | driver_unregister(&pcc_driver); | 737 | platform_driver_unregister(&pcc_driver); |
| 726 | return ret; | 738 | return ret; |
| 727 | } | 739 | } |
| 728 | 740 | ||
| @@ -754,7 +766,7 @@ static int __init init_m32r_pcc(void) | |||
| 754 | if (pcc_sockets == 0) { | 766 | if (pcc_sockets == 0) { |
| 755 | printk("socket is not found.\n"); | 767 | printk("socket is not found.\n"); |
| 756 | platform_device_unregister(&pcc_device); | 768 | platform_device_unregister(&pcc_device); |
| 757 | driver_unregister(&pcc_driver); | 769 | platform_driver_unregister(&pcc_driver); |
| 758 | return -ENODEV; | 770 | return -ENODEV; |
| 759 | } | 771 | } |
| 760 | 772 | ||
| @@ -802,7 +814,7 @@ static void __exit exit_m32r_pcc(void) | |||
| 802 | if (poll_interval != 0) | 814 | if (poll_interval != 0) |
| 803 | del_timer_sync(&poll_timer); | 815 | del_timer_sync(&poll_timer); |
| 804 | 816 | ||
| 805 | driver_unregister(&pcc_driver); | 817 | platform_driver_unregister(&pcc_driver); |
| 806 | } /* exit_m32r_pcc */ | 818 | } /* exit_m32r_pcc */ |
| 807 | 819 | ||
| 808 | module_init(init_m32r_pcc); | 820 | module_init(init_m32r_pcc); |
diff --git a/drivers/pcmcia/m32r_pcc.c b/drivers/pcmcia/m32r_pcc.c index 2f108c23dbd9..12034b41d196 100644 --- a/drivers/pcmcia/m32r_pcc.c +++ b/drivers/pcmcia/m32r_pcc.c | |||
| @@ -672,13 +672,25 @@ static struct pccard_operations pcc_operations = { | |||
| 672 | .set_mem_map = pcc_set_mem_map, | 672 | .set_mem_map = pcc_set_mem_map, |
| 673 | }; | 673 | }; |
| 674 | 674 | ||
| 675 | static int pcc_drv_pcmcia_suspend(struct platform_device *dev, | ||
| 676 | pm_message_t state) | ||
| 677 | { | ||
| 678 | return pcmcia_socket_dev_suspend(&dev->dev, state); | ||
| 679 | } | ||
| 680 | |||
| 681 | static int pcc_drv_pcmcia_resume(struct platform_device *dev) | ||
| 682 | { | ||
| 683 | return pcmcia_socket_dev_resume(&dev->dev); | ||
| 684 | } | ||
| 675 | /*====================================================================*/ | 685 | /*====================================================================*/ |
| 676 | 686 | ||
| 677 | static struct device_driver pcc_driver = { | 687 | static struct platform_driver pcc_driver = { |
| 678 | .name = "pcc", | 688 | .driver = { |
| 679 | .bus = &platform_bus_type, | 689 | .name = "pcc", |
| 680 | .suspend = pcmcia_socket_dev_suspend, | 690 | .owner = THIS_MODULE, |
| 681 | .resume = pcmcia_socket_dev_resume, | 691 | }, |
| 692 | .suspend = pcc_drv_pcmcia_suspend, | ||
| 693 | .resume = pcc_drv_pcmcia_resume, | ||
| 682 | }; | 694 | }; |
| 683 | 695 | ||
| 684 | static struct platform_device pcc_device = { | 696 | static struct platform_device pcc_device = { |
| @@ -692,13 +704,13 @@ static int __init init_m32r_pcc(void) | |||
| 692 | { | 704 | { |
| 693 | int i, ret; | 705 | int i, ret; |
| 694 | 706 | ||
| 695 | ret = driver_register(&pcc_driver); | 707 | ret = platform_driver_register(&pcc_driver); |
| 696 | if (ret) | 708 | if (ret) |
| 697 | return ret; | 709 | return ret; |
| 698 | 710 | ||
| 699 | ret = platform_device_register(&pcc_device); | 711 | ret = platform_device_register(&pcc_device); |
| 700 | if (ret){ | 712 | if (ret){ |
| 701 | driver_unregister(&pcc_driver); | 713 | platform_driver_unregister(&pcc_driver); |
| 702 | return ret; | 714 | return ret; |
| 703 | } | 715 | } |
| 704 | 716 | ||
| @@ -715,7 +727,7 @@ static int __init init_m32r_pcc(void) | |||
| 715 | if (pcc_sockets == 0) { | 727 | if (pcc_sockets == 0) { |
| 716 | printk("socket is not found.\n"); | 728 | printk("socket is not found.\n"); |
| 717 | platform_device_unregister(&pcc_device); | 729 | platform_device_unregister(&pcc_device); |
| 718 | driver_unregister(&pcc_driver); | 730 | platform_driver_unregister(&pcc_driver); |
| 719 | return -ENODEV; | 731 | return -ENODEV; |
| 720 | } | 732 | } |
| 721 | 733 | ||
| @@ -763,7 +775,7 @@ static void __exit exit_m32r_pcc(void) | |||
| 763 | if (poll_interval != 0) | 775 | if (poll_interval != 0) |
| 764 | del_timer_sync(&poll_timer); | 776 | del_timer_sync(&poll_timer); |
| 765 | 777 | ||
| 766 | driver_unregister(&pcc_driver); | 778 | platform_driver_unregister(&pcc_driver); |
| 767 | } /* exit_m32r_pcc */ | 779 | } /* exit_m32r_pcc */ |
| 768 | 780 | ||
| 769 | module_init(init_m32r_pcc); | 781 | module_init(init_m32r_pcc); |
diff --git a/drivers/pcmcia/rsrc_mgr.c b/drivers/pcmcia/rsrc_mgr.c index c0e2afc79e3e..e592e0e0d7ed 100644 --- a/drivers/pcmcia/rsrc_mgr.c +++ b/drivers/pcmcia/rsrc_mgr.c | |||
| @@ -153,7 +153,7 @@ static struct resource *iodyn_find_io_region(unsigned long base, int num, | |||
| 153 | unsigned long align, struct pcmcia_socket *s) | 153 | unsigned long align, struct pcmcia_socket *s) |
| 154 | { | 154 | { |
| 155 | struct resource *res = make_resource(0, num, IORESOURCE_IO, | 155 | struct resource *res = make_resource(0, num, IORESOURCE_IO, |
| 156 | s->dev.bus_id); | 156 | dev_name(&s->dev)); |
| 157 | struct pcmcia_align_data data; | 157 | struct pcmcia_align_data data; |
| 158 | unsigned long min = base; | 158 | unsigned long min = base; |
| 159 | int ret; | 159 | int ret; |
diff --git a/drivers/pcmcia/sa1100_generic.c b/drivers/pcmcia/sa1100_generic.c index c5b2a44b4c37..d8da5ac844e9 100644 --- a/drivers/pcmcia/sa1100_generic.c +++ b/drivers/pcmcia/sa1100_generic.c | |||
| @@ -65,7 +65,7 @@ static int (*sa11x0_pcmcia_hw_init[])(struct device *dev) = { | |||
| 65 | #endif | 65 | #endif |
| 66 | }; | 66 | }; |
| 67 | 67 | ||
| 68 | static int sa11x0_drv_pcmcia_probe(struct device *dev) | 68 | static int sa11x0_drv_pcmcia_probe(struct platform_device *dev) |
| 69 | { | 69 | { |
| 70 | int i, ret = -ENODEV; | 70 | int i, ret = -ENODEV; |
| 71 | 71 | ||
| @@ -73,7 +73,7 @@ static int sa11x0_drv_pcmcia_probe(struct device *dev) | |||
| 73 | * Initialise any "on-board" PCMCIA sockets. | 73 | * Initialise any "on-board" PCMCIA sockets. |
| 74 | */ | 74 | */ |
| 75 | for (i = 0; i < ARRAY_SIZE(sa11x0_pcmcia_hw_init); i++) { | 75 | for (i = 0; i < ARRAY_SIZE(sa11x0_pcmcia_hw_init); i++) { |
| 76 | ret = sa11x0_pcmcia_hw_init[i](dev); | 76 | ret = sa11x0_pcmcia_hw_init[i](&dev->dev); |
| 77 | if (ret == 0) | 77 | if (ret == 0) |
| 78 | break; | 78 | break; |
| 79 | } | 79 | } |
| @@ -81,13 +81,31 @@ static int sa11x0_drv_pcmcia_probe(struct device *dev) | |||
| 81 | return ret; | 81 | return ret; |
| 82 | } | 82 | } |
| 83 | 83 | ||
| 84 | static struct device_driver sa11x0_pcmcia_driver = { | 84 | static int sa11x0_drv_pcmcia_remove(struct platform_device *dev) |
| 85 | { | ||
| 86 | return soc_common_drv_pcmcia_remove(&dev->dev); | ||
| 87 | } | ||
| 88 | |||
| 89 | static int sa11x0_drv_pcmcia_suspend(struct platform_device *dev, | ||
| 90 | pm_message_t state) | ||
| 91 | { | ||
| 92 | return pcmcia_socket_dev_suspend(&dev->dev, state); | ||
| 93 | } | ||
| 94 | |||
| 95 | static int sa11x0_drv_pcmcia_resume(struct platform_device *dev) | ||
| 96 | { | ||
| 97 | return pcmcia_socket_dev_resume(&dev->dev); | ||
| 98 | } | ||
| 99 | |||
| 100 | static struct platform_driver sa11x0_pcmcia_driver = { | ||
| 101 | .driver = { | ||
| 102 | .name = "sa11x0-pcmcia", | ||
| 103 | .owner = THIS_MODULE, | ||
| 104 | }, | ||
| 85 | .probe = sa11x0_drv_pcmcia_probe, | 105 | .probe = sa11x0_drv_pcmcia_probe, |
| 86 | .remove = soc_common_drv_pcmcia_remove, | 106 | .remove = sa11x0_drv_pcmcia_remove, |
| 87 | .name = "sa11x0-pcmcia", | 107 | .suspend = sa11x0_drv_pcmcia_suspend, |
| 88 | .bus = &platform_bus_type, | 108 | .resume = sa11x0_drv_pcmcia_resume, |
| 89 | .suspend = pcmcia_socket_dev_suspend, | ||
| 90 | .resume = pcmcia_socket_dev_resume, | ||
| 91 | }; | 109 | }; |
| 92 | 110 | ||
| 93 | /* sa11x0_pcmcia_init() | 111 | /* sa11x0_pcmcia_init() |
| @@ -100,7 +118,7 @@ static struct device_driver sa11x0_pcmcia_driver = { | |||
| 100 | */ | 118 | */ |
| 101 | static int __init sa11x0_pcmcia_init(void) | 119 | static int __init sa11x0_pcmcia_init(void) |
| 102 | { | 120 | { |
| 103 | return driver_register(&sa11x0_pcmcia_driver); | 121 | return platform_driver_register(&sa11x0_pcmcia_driver); |
| 104 | } | 122 | } |
| 105 | 123 | ||
| 106 | /* sa11x0_pcmcia_exit() | 124 | /* sa11x0_pcmcia_exit() |
| @@ -110,7 +128,7 @@ static int __init sa11x0_pcmcia_init(void) | |||
| 110 | */ | 128 | */ |
| 111 | static void __exit sa11x0_pcmcia_exit(void) | 129 | static void __exit sa11x0_pcmcia_exit(void) |
| 112 | { | 130 | { |
| 113 | driver_unregister(&sa11x0_pcmcia_driver); | 131 | platform_driver_unregister(&sa11x0_pcmcia_driver); |
| 114 | } | 132 | } |
| 115 | 133 | ||
| 116 | MODULE_AUTHOR("John Dorsey <john+@cs.cmu.edu>"); | 134 | MODULE_AUTHOR("John Dorsey <john+@cs.cmu.edu>"); |
diff --git a/drivers/pcmcia/tcic.c b/drivers/pcmcia/tcic.c index 2a613e920fd4..9ad97ea836e8 100644 --- a/drivers/pcmcia/tcic.c +++ b/drivers/pcmcia/tcic.c | |||
| @@ -363,13 +363,25 @@ static int __init get_tcic_id(void) | |||
| 363 | return id; | 363 | return id; |
| 364 | } | 364 | } |
| 365 | 365 | ||
| 366 | static int tcic_drv_pcmcia_suspend(struct platform_device *dev, | ||
| 367 | pm_message_t state) | ||
| 368 | { | ||
| 369 | return pcmcia_socket_dev_suspend(&dev->dev, state); | ||
| 370 | } | ||
| 371 | |||
| 372 | static int tcic_drv_pcmcia_resume(struct platform_device *dev) | ||
| 373 | { | ||
| 374 | return pcmcia_socket_dev_resume(&dev->dev); | ||
| 375 | } | ||
| 366 | /*====================================================================*/ | 376 | /*====================================================================*/ |
| 367 | 377 | ||
| 368 | static struct device_driver tcic_driver = { | 378 | static struct platform_driver tcic_driver = { |
| 369 | .name = "tcic-pcmcia", | 379 | .driver = { |
| 370 | .bus = &platform_bus_type, | 380 | .name = "tcic-pcmcia", |
| 371 | .suspend = pcmcia_socket_dev_suspend, | 381 | .owner = THIS_MODULE, |
| 372 | .resume = pcmcia_socket_dev_resume, | 382 | }, |
| 383 | .suspend = tcic_drv_pcmcia_suspend, | ||
| 384 | .resume = tcic_drv_pcmcia_resume, | ||
| 373 | }; | 385 | }; |
| 374 | 386 | ||
| 375 | static struct platform_device tcic_device = { | 387 | static struct platform_device tcic_device = { |
| @@ -383,7 +395,7 @@ static int __init init_tcic(void) | |||
| 383 | int i, sock, ret = 0; | 395 | int i, sock, ret = 0; |
| 384 | u_int mask, scan; | 396 | u_int mask, scan; |
| 385 | 397 | ||
| 386 | if (driver_register(&tcic_driver)) | 398 | if (platform_driver_register(&tcic_driver)) |
| 387 | return -1; | 399 | return -1; |
| 388 | 400 | ||
| 389 | printk(KERN_INFO "Databook TCIC-2 PCMCIA probe: "); | 401 | printk(KERN_INFO "Databook TCIC-2 PCMCIA probe: "); |
| @@ -391,7 +403,7 @@ static int __init init_tcic(void) | |||
| 391 | 403 | ||
| 392 | if (!request_region(tcic_base, 16, "tcic-2")) { | 404 | if (!request_region(tcic_base, 16, "tcic-2")) { |
| 393 | printk("could not allocate ports,\n "); | 405 | printk("could not allocate ports,\n "); |
| 394 | driver_unregister(&tcic_driver); | 406 | platform_driver_unregister(&tcic_driver); |
| 395 | return -ENODEV; | 407 | return -ENODEV; |
| 396 | } | 408 | } |
| 397 | else { | 409 | else { |
| @@ -414,7 +426,7 @@ static int __init init_tcic(void) | |||
| 414 | if (sock == 0) { | 426 | if (sock == 0) { |
| 415 | printk("not found.\n"); | 427 | printk("not found.\n"); |
| 416 | release_region(tcic_base, 16); | 428 | release_region(tcic_base, 16); |
| 417 | driver_unregister(&tcic_driver); | 429 | platform_driver_unregister(&tcic_driver); |
| 418 | return -ENODEV; | 430 | return -ENODEV; |
| 419 | } | 431 | } |
| 420 | 432 | ||
| @@ -542,7 +554,7 @@ static void __exit exit_tcic(void) | |||
| 542 | } | 554 | } |
| 543 | 555 | ||
| 544 | platform_device_unregister(&tcic_device); | 556 | platform_device_unregister(&tcic_device); |
| 545 | driver_unregister(&tcic_driver); | 557 | platform_driver_unregister(&tcic_driver); |
| 546 | } /* exit_tcic */ | 558 | } /* exit_tcic */ |
| 547 | 559 | ||
| 548 | /*====================================================================*/ | 560 | /*====================================================================*/ |
diff --git a/drivers/pcmcia/vrc4171_card.c b/drivers/pcmcia/vrc4171_card.c index b2c412419059..659421d0ca46 100644 --- a/drivers/pcmcia/vrc4171_card.c +++ b/drivers/pcmcia/vrc4171_card.c | |||
| @@ -704,24 +704,37 @@ static int __devinit vrc4171_card_setup(char *options) | |||
| 704 | 704 | ||
| 705 | __setup("vrc4171_card=", vrc4171_card_setup); | 705 | __setup("vrc4171_card=", vrc4171_card_setup); |
| 706 | 706 | ||
| 707 | static struct device_driver vrc4171_card_driver = { | 707 | static int vrc4171_card_suspend(struct platform_device *dev, |
| 708 | .name = vrc4171_card_name, | 708 | pm_message_t state) |
| 709 | .bus = &platform_bus_type, | 709 | { |
| 710 | .suspend = pcmcia_socket_dev_suspend, | 710 | return pcmcia_socket_dev_suspend(&dev->dev, state); |
| 711 | .resume = pcmcia_socket_dev_resume, | 711 | } |
| 712 | |||
| 713 | static int vrc4171_card_resume(struct platform_device *dev) | ||
| 714 | { | ||
| 715 | return pcmcia_socket_dev_resume(&dev->dev); | ||
| 716 | } | ||
| 717 | |||
| 718 | static struct platform_driver vrc4171_card_driver = { | ||
| 719 | .driver = { | ||
| 720 | .name = vrc4171_card_name, | ||
| 721 | .owner = THIS_MODULE, | ||
| 722 | }, | ||
| 723 | .suspend = vrc4171_card_suspend, | ||
| 724 | .resume = vrc4171_card_resume, | ||
| 712 | }; | 725 | }; |
| 713 | 726 | ||
| 714 | static int __devinit vrc4171_card_init(void) | 727 | static int __devinit vrc4171_card_init(void) |
| 715 | { | 728 | { |
| 716 | int retval; | 729 | int retval; |
| 717 | 730 | ||
| 718 | retval = driver_register(&vrc4171_card_driver); | 731 | retval = platform_driver_register(&vrc4171_card_driver); |
| 719 | if (retval < 0) | 732 | if (retval < 0) |
| 720 | return retval; | 733 | return retval; |
| 721 | 734 | ||
| 722 | retval = platform_device_register(&vrc4171_card_device); | 735 | retval = platform_device_register(&vrc4171_card_device); |
| 723 | if (retval < 0) { | 736 | if (retval < 0) { |
| 724 | driver_unregister(&vrc4171_card_driver); | 737 | platform_driver_unregister(&vrc4171_card_driver); |
| 725 | return retval; | 738 | return retval; |
| 726 | } | 739 | } |
| 727 | 740 | ||
| @@ -735,11 +748,12 @@ static int __devinit vrc4171_card_init(void) | |||
| 735 | if (retval < 0) { | 748 | if (retval < 0) { |
| 736 | vrc4171_remove_sockets(); | 749 | vrc4171_remove_sockets(); |
| 737 | platform_device_unregister(&vrc4171_card_device); | 750 | platform_device_unregister(&vrc4171_card_device); |
| 738 | driver_unregister(&vrc4171_card_driver); | 751 | platform_driver_unregister(&vrc4171_card_driver); |
| 739 | return retval; | 752 | return retval; |
| 740 | } | 753 | } |
| 741 | 754 | ||
| 742 | printk(KERN_INFO "%s, connected to IRQ %d\n", vrc4171_card_driver.name, vrc4171_irq); | 755 | printk(KERN_INFO "%s, connected to IRQ %d\n", |
| 756 | vrc4171_card_driver.driver.name, vrc4171_irq); | ||
| 743 | 757 | ||
| 744 | return 0; | 758 | return 0; |
| 745 | } | 759 | } |
| @@ -749,7 +763,7 @@ static void __devexit vrc4171_card_exit(void) | |||
| 749 | free_irq(vrc4171_irq, vrc4171_sockets); | 763 | free_irq(vrc4171_irq, vrc4171_sockets); |
| 750 | vrc4171_remove_sockets(); | 764 | vrc4171_remove_sockets(); |
| 751 | platform_device_unregister(&vrc4171_card_device); | 765 | platform_device_unregister(&vrc4171_card_device); |
| 752 | driver_unregister(&vrc4171_card_driver); | 766 | platform_driver_unregister(&vrc4171_card_driver); |
| 753 | } | 767 | } |
| 754 | 768 | ||
| 755 | module_init(vrc4171_card_init); | 769 | module_init(vrc4171_card_init); |
diff --git a/drivers/rapidio/rio-driver.c b/drivers/rapidio/rio-driver.c index addb87cf44d9..3222fa3c808c 100644 --- a/drivers/rapidio/rio-driver.c +++ b/drivers/rapidio/rio-driver.c | |||
| @@ -193,7 +193,7 @@ static int rio_match_bus(struct device *dev, struct device_driver *drv) | |||
| 193 | } | 193 | } |
| 194 | 194 | ||
| 195 | static struct device rio_bus = { | 195 | static struct device rio_bus = { |
| 196 | .bus_id = "rapidio", | 196 | .init_name = "rapidio", |
| 197 | }; | 197 | }; |
| 198 | 198 | ||
| 199 | struct bus_type rio_bus_type = { | 199 | struct bus_type rio_bus_type = { |
diff --git a/drivers/rtc/rtc-at91sam9.c b/drivers/rtc/rtc-at91sam9.c index d5e4e637ddec..86c61f143515 100644 --- a/drivers/rtc/rtc-at91sam9.c +++ b/drivers/rtc/rtc-at91sam9.c | |||
| @@ -351,7 +351,7 @@ static int __init at91_rtc_probe(struct platform_device *pdev) | |||
| 351 | /* register irq handler after we know what name we'll use */ | 351 | /* register irq handler after we know what name we'll use */ |
| 352 | ret = request_irq(AT91_ID_SYS, at91_rtc_interrupt, | 352 | ret = request_irq(AT91_ID_SYS, at91_rtc_interrupt, |
| 353 | IRQF_DISABLED | IRQF_SHARED, | 353 | IRQF_DISABLED | IRQF_SHARED, |
| 354 | rtc->rtcdev->dev.bus_id, rtc); | 354 | dev_name(&rtc->rtcdev->dev), rtc); |
| 355 | if (ret) { | 355 | if (ret) { |
| 356 | dev_dbg(&pdev->dev, "can't share IRQ %d?\n", AT91_ID_SYS); | 356 | dev_dbg(&pdev->dev, "can't share IRQ %d?\n", AT91_ID_SYS); |
| 357 | rtc_device_unregister(rtc->rtcdev); | 357 | rtc_device_unregister(rtc->rtcdev); |
| @@ -366,7 +366,7 @@ static int __init at91_rtc_probe(struct platform_device *pdev) | |||
| 366 | 366 | ||
| 367 | if (gpbr_readl(rtc) == 0) | 367 | if (gpbr_readl(rtc) == 0) |
| 368 | dev_warn(&pdev->dev, "%s: SET TIME!\n", | 368 | dev_warn(&pdev->dev, "%s: SET TIME!\n", |
| 369 | rtc->rtcdev->dev.bus_id); | 369 | dev_name(&rtc->rtcdev->dev)); |
| 370 | 370 | ||
| 371 | return 0; | 371 | return 0; |
| 372 | 372 | ||
diff --git a/drivers/rtc/rtc-omap.c b/drivers/rtc/rtc-omap.c index 2cbeb0794f14..bd1ce8e2bc18 100644 --- a/drivers/rtc/rtc-omap.c +++ b/drivers/rtc/rtc-omap.c | |||
| @@ -377,13 +377,13 @@ static int __init omap_rtc_probe(struct platform_device *pdev) | |||
| 377 | 377 | ||
| 378 | /* handle periodic and alarm irqs */ | 378 | /* handle periodic and alarm irqs */ |
| 379 | if (request_irq(omap_rtc_timer, rtc_irq, IRQF_DISABLED, | 379 | if (request_irq(omap_rtc_timer, rtc_irq, IRQF_DISABLED, |
| 380 | rtc->dev.bus_id, rtc)) { | 380 | dev_name(&rtc->dev), rtc)) { |
| 381 | pr_debug("%s: RTC timer interrupt IRQ%d already claimed\n", | 381 | pr_debug("%s: RTC timer interrupt IRQ%d already claimed\n", |
| 382 | pdev->name, omap_rtc_timer); | 382 | pdev->name, omap_rtc_timer); |
| 383 | goto fail0; | 383 | goto fail0; |
| 384 | } | 384 | } |
| 385 | if (request_irq(omap_rtc_alarm, rtc_irq, IRQF_DISABLED, | 385 | if (request_irq(omap_rtc_alarm, rtc_irq, IRQF_DISABLED, |
| 386 | rtc->dev.bus_id, rtc)) { | 386 | dev_name(&rtc->dev), rtc)) { |
| 387 | pr_debug("%s: RTC alarm interrupt IRQ%d already claimed\n", | 387 | pr_debug("%s: RTC alarm interrupt IRQ%d already claimed\n", |
| 388 | pdev->name, omap_rtc_alarm); | 388 | pdev->name, omap_rtc_alarm); |
| 389 | goto fail1; | 389 | goto fail1; |
diff --git a/drivers/rtc/rtc-twl4030.c b/drivers/rtc/rtc-twl4030.c index ad35f76c46b7..a6341e4f9a0f 100644 --- a/drivers/rtc/rtc-twl4030.c +++ b/drivers/rtc/rtc-twl4030.c | |||
| @@ -426,7 +426,7 @@ static int __devinit twl4030_rtc_probe(struct platform_device *pdev) | |||
| 426 | 426 | ||
| 427 | ret = request_irq(irq, twl4030_rtc_interrupt, | 427 | ret = request_irq(irq, twl4030_rtc_interrupt, |
| 428 | IRQF_TRIGGER_RISING, | 428 | IRQF_TRIGGER_RISING, |
| 429 | rtc->dev.bus_id, rtc); | 429 | dev_name(&rtc->dev), rtc); |
| 430 | if (ret < 0) { | 430 | if (ret < 0) { |
| 431 | dev_err(&pdev->dev, "IRQ is not free.\n"); | 431 | dev_err(&pdev->dev, "IRQ is not free.\n"); |
| 432 | goto out1; | 432 | goto out1; |
diff --git a/drivers/s390/cio/ccwgroup.c b/drivers/s390/cio/ccwgroup.c index 918e6fce2573..b91c1719b075 100644 --- a/drivers/s390/cio/ccwgroup.c +++ b/drivers/s390/cio/ccwgroup.c | |||
| @@ -104,8 +104,9 @@ ccwgroup_ungroup_store(struct device *dev, struct device_attribute *attr, const | |||
| 104 | rc = device_schedule_callback(dev, ccwgroup_ungroup_callback); | 104 | rc = device_schedule_callback(dev, ccwgroup_ungroup_callback); |
| 105 | out: | 105 | out: |
| 106 | if (rc) { | 106 | if (rc) { |
| 107 | /* Release onoff "lock" when ungrouping failed. */ | 107 | if (rc != -EAGAIN) |
| 108 | atomic_set(&gdev->onoff, 0); | 108 | /* Release onoff "lock" when ungrouping failed. */ |
| 109 | atomic_set(&gdev->onoff, 0); | ||
| 109 | return rc; | 110 | return rc; |
| 110 | } | 111 | } |
| 111 | return count; | 112 | return count; |
diff --git a/drivers/s390/cio/chsc_sch.c b/drivers/s390/cio/chsc_sch.c index 0a2f2edafc03..93eca1731b81 100644 --- a/drivers/s390/cio/chsc_sch.c +++ b/drivers/s390/cio/chsc_sch.c | |||
| @@ -84,8 +84,8 @@ static int chsc_subchannel_probe(struct subchannel *sch) | |||
| 84 | kfree(private); | 84 | kfree(private); |
| 85 | } else { | 85 | } else { |
| 86 | sch->private = private; | 86 | sch->private = private; |
| 87 | if (sch->dev.uevent_suppress) { | 87 | if (dev_get_uevent_suppress(&sch->dev)) { |
| 88 | sch->dev.uevent_suppress = 0; | 88 | dev_set_uevent_suppress(&sch->dev, 0); |
| 89 | kobject_uevent(&sch->dev.kobj, KOBJ_ADD); | 89 | kobject_uevent(&sch->dev.kobj, KOBJ_ADD); |
| 90 | } | 90 | } |
| 91 | } | 91 | } |
diff --git a/drivers/s390/cio/css.c b/drivers/s390/cio/css.c index 8019288bc6de..427d11d88069 100644 --- a/drivers/s390/cio/css.c +++ b/drivers/s390/cio/css.c | |||
| @@ -272,7 +272,7 @@ static int css_register_subchannel(struct subchannel *sch) | |||
| 272 | * the subchannel driver can decide itself when it wants to inform | 272 | * the subchannel driver can decide itself when it wants to inform |
| 273 | * userspace of its existence. | 273 | * userspace of its existence. |
| 274 | */ | 274 | */ |
| 275 | sch->dev.uevent_suppress = 1; | 275 | dev_set_uevent_suppress(&sch->dev, 1); |
| 276 | css_update_ssd_info(sch); | 276 | css_update_ssd_info(sch); |
| 277 | /* make it known to the system */ | 277 | /* make it known to the system */ |
| 278 | ret = css_sch_device_register(sch); | 278 | ret = css_sch_device_register(sch); |
| @@ -287,7 +287,7 @@ static int css_register_subchannel(struct subchannel *sch) | |||
| 287 | * a fitting driver module may be loaded based on the | 287 | * a fitting driver module may be loaded based on the |
| 288 | * modalias. | 288 | * modalias. |
| 289 | */ | 289 | */ |
| 290 | sch->dev.uevent_suppress = 0; | 290 | dev_set_uevent_suppress(&sch->dev, 0); |
| 291 | kobject_uevent(&sch->dev.kobj, KOBJ_ADD); | 291 | kobject_uevent(&sch->dev.kobj, KOBJ_ADD); |
| 292 | } | 292 | } |
| 293 | return ret; | 293 | return ret; |
diff --git a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c index 23d5752349b5..e28f8ae53453 100644 --- a/drivers/s390/cio/device.c +++ b/drivers/s390/cio/device.c | |||
| @@ -799,7 +799,7 @@ static void sch_attach_disconnected_device(struct subchannel *sch, | |||
| 799 | return; | 799 | return; |
| 800 | other_sch = to_subchannel(cdev->dev.parent); | 800 | other_sch = to_subchannel(cdev->dev.parent); |
| 801 | /* Note: device_move() changes cdev->dev.parent */ | 801 | /* Note: device_move() changes cdev->dev.parent */ |
| 802 | ret = device_move(&cdev->dev, &sch->dev); | 802 | ret = device_move(&cdev->dev, &sch->dev, DPM_ORDER_PARENT_BEFORE_DEV); |
| 803 | if (ret) { | 803 | if (ret) { |
| 804 | CIO_MSG_EVENT(0, "Moving disconnected device 0.%x.%04x failed " | 804 | CIO_MSG_EVENT(0, "Moving disconnected device 0.%x.%04x failed " |
| 805 | "(ret=%d)!\n", cdev->private->dev_id.ssid, | 805 | "(ret=%d)!\n", cdev->private->dev_id.ssid, |
| @@ -830,7 +830,7 @@ static void sch_attach_orphaned_device(struct subchannel *sch, | |||
| 830 | * Try to move the ccw device to its new subchannel. | 830 | * Try to move the ccw device to its new subchannel. |
| 831 | * Note: device_move() changes cdev->dev.parent | 831 | * Note: device_move() changes cdev->dev.parent |
| 832 | */ | 832 | */ |
| 833 | ret = device_move(&cdev->dev, &sch->dev); | 833 | ret = device_move(&cdev->dev, &sch->dev, DPM_ORDER_PARENT_BEFORE_DEV); |
| 834 | if (ret) { | 834 | if (ret) { |
| 835 | CIO_MSG_EVENT(0, "Moving device 0.%x.%04x from orphanage " | 835 | CIO_MSG_EVENT(0, "Moving device 0.%x.%04x from orphanage " |
| 836 | "failed (ret=%d)!\n", | 836 | "failed (ret=%d)!\n", |
| @@ -897,7 +897,8 @@ void ccw_device_move_to_orphanage(struct work_struct *work) | |||
| 897 | * ccw device can take its place on the subchannel. | 897 | * ccw device can take its place on the subchannel. |
| 898 | * Note: device_move() changes cdev->dev.parent | 898 | * Note: device_move() changes cdev->dev.parent |
| 899 | */ | 899 | */ |
| 900 | ret = device_move(&cdev->dev, &css->pseudo_subchannel->dev); | 900 | ret = device_move(&cdev->dev, &css->pseudo_subchannel->dev, |
| 901 | DPM_ORDER_NONE); | ||
| 901 | if (ret) { | 902 | if (ret) { |
| 902 | CIO_MSG_EVENT(0, "Moving device 0.%x.%04x to orphanage failed " | 903 | CIO_MSG_EVENT(0, "Moving device 0.%x.%04x to orphanage failed " |
| 903 | "(ret=%d)!\n", cdev->private->dev_id.ssid, | 904 | "(ret=%d)!\n", cdev->private->dev_id.ssid, |
| @@ -981,7 +982,7 @@ io_subchannel_register(struct work_struct *work) | |||
| 981 | * Now we know this subchannel will stay, we can throw | 982 | * Now we know this subchannel will stay, we can throw |
| 982 | * our delayed uevent. | 983 | * our delayed uevent. |
| 983 | */ | 984 | */ |
| 984 | sch->dev.uevent_suppress = 0; | 985 | dev_set_uevent_suppress(&sch->dev, 0); |
| 985 | kobject_uevent(&sch->dev.kobj, KOBJ_ADD); | 986 | kobject_uevent(&sch->dev.kobj, KOBJ_ADD); |
| 986 | /* make it known to the system */ | 987 | /* make it known to the system */ |
| 987 | ret = ccw_device_register(cdev); | 988 | ret = ccw_device_register(cdev); |
| @@ -1129,7 +1130,7 @@ static void ccw_device_move_to_sch(struct work_struct *work) | |||
| 1129 | * Try to move the ccw device to its new subchannel. | 1130 | * Try to move the ccw device to its new subchannel. |
| 1130 | * Note: device_move() changes cdev->dev.parent | 1131 | * Note: device_move() changes cdev->dev.parent |
| 1131 | */ | 1132 | */ |
| 1132 | rc = device_move(&cdev->dev, &sch->dev); | 1133 | rc = device_move(&cdev->dev, &sch->dev, DPM_ORDER_PARENT_BEFORE_DEV); |
| 1133 | mutex_unlock(&sch->reg_mutex); | 1134 | mutex_unlock(&sch->reg_mutex); |
| 1134 | if (rc) { | 1135 | if (rc) { |
| 1135 | CIO_MSG_EVENT(0, "Moving device 0.%x.%04x to subchannel " | 1136 | CIO_MSG_EVENT(0, "Moving device 0.%x.%04x to subchannel " |
| @@ -1243,7 +1244,7 @@ static int io_subchannel_probe(struct subchannel *sch) | |||
| 1243 | * the ccw_device and exit. This happens for all early | 1244 | * the ccw_device and exit. This happens for all early |
| 1244 | * devices, e.g. the console. | 1245 | * devices, e.g. the console. |
| 1245 | */ | 1246 | */ |
| 1246 | sch->dev.uevent_suppress = 0; | 1247 | dev_set_uevent_suppress(&sch->dev, 0); |
| 1247 | kobject_uevent(&sch->dev.kobj, KOBJ_ADD); | 1248 | kobject_uevent(&sch->dev.kobj, KOBJ_ADD); |
| 1248 | cdev->dev.groups = ccwdev_attr_groups; | 1249 | cdev->dev.groups = ccwdev_attr_groups; |
| 1249 | device_initialize(&cdev->dev); | 1250 | device_initialize(&cdev->dev); |
diff --git a/drivers/s390/net/qeth_l3_main.c b/drivers/s390/net/qeth_l3_main.c index 3d04920b9bb9..0dcc036d34aa 100644 --- a/drivers/s390/net/qeth_l3_main.c +++ b/drivers/s390/net/qeth_l3_main.c | |||
| @@ -1038,7 +1038,7 @@ static int qeth_l3_setadapter_parms(struct qeth_card *card) | |||
| 1038 | rc = qeth_query_setadapterparms(card); | 1038 | rc = qeth_query_setadapterparms(card); |
| 1039 | if (rc) { | 1039 | if (rc) { |
| 1040 | QETH_DBF_MESSAGE(2, "%s couldn't set adapter parameters: " | 1040 | QETH_DBF_MESSAGE(2, "%s couldn't set adapter parameters: " |
| 1041 | "0x%x\n", card->gdev->dev.bus_id, rc); | 1041 | "0x%x\n", dev_name(&card->gdev->dev), rc); |
| 1042 | return rc; | 1042 | return rc; |
| 1043 | } | 1043 | } |
| 1044 | if (qeth_adp_supported(card, IPA_SETADP_ALTER_MAC_ADDRESS)) { | 1044 | if (qeth_adp_supported(card, IPA_SETADP_ALTER_MAC_ADDRESS)) { |
diff --git a/drivers/scsi/a4000t.c b/drivers/scsi/a4000t.c index d4bda2017746..61af3d91ac8a 100644 --- a/drivers/scsi/a4000t.c +++ b/drivers/scsi/a4000t.c | |||
| @@ -35,7 +35,7 @@ static struct platform_device *a4000t_scsi_device; | |||
| 35 | 35 | ||
| 36 | #define A4000T_SCSI_ADDR 0xdd0040 | 36 | #define A4000T_SCSI_ADDR 0xdd0040 |
| 37 | 37 | ||
| 38 | static int __devinit a4000t_probe(struct device *dev) | 38 | static int __devinit a4000t_probe(struct platform_device *dev) |
| 39 | { | 39 | { |
| 40 | struct Scsi_Host *host; | 40 | struct Scsi_Host *host; |
| 41 | struct NCR_700_Host_Parameters *hostdata; | 41 | struct NCR_700_Host_Parameters *hostdata; |
| @@ -61,7 +61,8 @@ static int __devinit a4000t_probe(struct device *dev) | |||
| 61 | hostdata->dcntl_extra = EA_710; | 61 | hostdata->dcntl_extra = EA_710; |
| 62 | 62 | ||
| 63 | /* and register the chip */ | 63 | /* and register the chip */ |
| 64 | host = NCR_700_detect(&a4000t_scsi_driver_template, hostdata, dev); | 64 | host = NCR_700_detect(&a4000t_scsi_driver_template, hostdata, |
| 65 | &dev->dev); | ||
| 65 | if (!host) { | 66 | if (!host) { |
| 66 | printk(KERN_ERR "a4000t-scsi: No host detected; " | 67 | printk(KERN_ERR "a4000t-scsi: No host detected; " |
| 67 | "board configuration problem?\n"); | 68 | "board configuration problem?\n"); |
| @@ -78,7 +79,7 @@ static int __devinit a4000t_probe(struct device *dev) | |||
| 78 | goto out_put_host; | 79 | goto out_put_host; |
| 79 | } | 80 | } |
| 80 | 81 | ||
| 81 | dev_set_drvdata(dev, host); | 82 | platform_set_drvdata(dev, host); |
| 82 | scsi_scan_host(host); | 83 | scsi_scan_host(host); |
| 83 | 84 | ||
| 84 | return 0; | 85 | return 0; |
| @@ -93,9 +94,9 @@ static int __devinit a4000t_probe(struct device *dev) | |||
| 93 | return -ENODEV; | 94 | return -ENODEV; |
| 94 | } | 95 | } |
| 95 | 96 | ||
| 96 | static __devexit int a4000t_device_remove(struct device *dev) | 97 | static __devexit int a4000t_device_remove(struct platform_device *dev) |
| 97 | { | 98 | { |
| 98 | struct Scsi_Host *host = dev_get_drvdata(dev); | 99 | struct Scsi_Host *host = platform_get_drvdata(dev); |
| 99 | struct NCR_700_Host_Parameters *hostdata = shost_priv(host); | 100 | struct NCR_700_Host_Parameters *hostdata = shost_priv(host); |
| 100 | 101 | ||
| 101 | scsi_remove_host(host); | 102 | scsi_remove_host(host); |
| @@ -108,25 +109,27 @@ static __devexit int a4000t_device_remove(struct device *dev) | |||
| 108 | return 0; | 109 | return 0; |
| 109 | } | 110 | } |
| 110 | 111 | ||
| 111 | static struct device_driver a4000t_scsi_driver = { | 112 | static struct platform_driver a4000t_scsi_driver = { |
| 112 | .name = "a4000t-scsi", | 113 | .driver = { |
| 113 | .bus = &platform_bus_type, | 114 | .name = "a4000t-scsi", |
| 114 | .probe = a4000t_probe, | 115 | .owner = THIS_MODULE, |
| 115 | .remove = __devexit_p(a4000t_device_remove), | 116 | }, |
| 117 | .probe = a4000t_probe, | ||
| 118 | .remove = __devexit_p(a4000t_device_remove), | ||
| 116 | }; | 119 | }; |
| 117 | 120 | ||
| 118 | static int __init a4000t_scsi_init(void) | 121 | static int __init a4000t_scsi_init(void) |
| 119 | { | 122 | { |
| 120 | int err; | 123 | int err; |
| 121 | 124 | ||
| 122 | err = driver_register(&a4000t_scsi_driver); | 125 | err = platform_driver_register(&a4000t_scsi_driver); |
| 123 | if (err) | 126 | if (err) |
| 124 | return err; | 127 | return err; |
| 125 | 128 | ||
| 126 | a4000t_scsi_device = platform_device_register_simple("a4000t-scsi", | 129 | a4000t_scsi_device = platform_device_register_simple("a4000t-scsi", |
| 127 | -1, NULL, 0); | 130 | -1, NULL, 0); |
| 128 | if (IS_ERR(a4000t_scsi_device)) { | 131 | if (IS_ERR(a4000t_scsi_device)) { |
| 129 | driver_unregister(&a4000t_scsi_driver); | 132 | platform_driver_register(&a4000t_scsi_driver); |
| 130 | return PTR_ERR(a4000t_scsi_device); | 133 | return PTR_ERR(a4000t_scsi_device); |
| 131 | } | 134 | } |
| 132 | 135 | ||
| @@ -136,7 +139,7 @@ static int __init a4000t_scsi_init(void) | |||
| 136 | static void __exit a4000t_scsi_exit(void) | 139 | static void __exit a4000t_scsi_exit(void) |
| 137 | { | 140 | { |
| 138 | platform_device_unregister(a4000t_scsi_device); | 141 | platform_device_unregister(a4000t_scsi_device); |
| 139 | driver_unregister(&a4000t_scsi_driver); | 142 | platform_driver_unregister(&a4000t_scsi_driver); |
| 140 | } | 143 | } |
| 141 | 144 | ||
| 142 | module_init(a4000t_scsi_init); | 145 | module_init(a4000t_scsi_init); |
diff --git a/drivers/scsi/bvme6000_scsi.c b/drivers/scsi/bvme6000_scsi.c index d858f3d41274..5799cb5cba6b 100644 --- a/drivers/scsi/bvme6000_scsi.c +++ b/drivers/scsi/bvme6000_scsi.c | |||
| @@ -34,7 +34,7 @@ static struct scsi_host_template bvme6000_scsi_driver_template = { | |||
| 34 | static struct platform_device *bvme6000_scsi_device; | 34 | static struct platform_device *bvme6000_scsi_device; |
| 35 | 35 | ||
| 36 | static __devinit int | 36 | static __devinit int |
| 37 | bvme6000_probe(struct device *dev) | 37 | bvme6000_probe(struct platform_device *dev) |
| 38 | { | 38 | { |
| 39 | struct Scsi_Host *host; | 39 | struct Scsi_Host *host; |
| 40 | struct NCR_700_Host_Parameters *hostdata; | 40 | struct NCR_700_Host_Parameters *hostdata; |
| @@ -58,7 +58,8 @@ bvme6000_probe(struct device *dev) | |||
| 58 | hostdata->ctest7_extra = CTEST7_TT1; | 58 | hostdata->ctest7_extra = CTEST7_TT1; |
| 59 | 59 | ||
| 60 | /* and register the chip */ | 60 | /* and register the chip */ |
| 61 | host = NCR_700_detect(&bvme6000_scsi_driver_template, hostdata, dev); | 61 | host = NCR_700_detect(&bvme6000_scsi_driver_template, hostdata, |
| 62 | &dev->dev); | ||
| 62 | if (!host) { | 63 | if (!host) { |
| 63 | printk(KERN_ERR "bvme6000-scsi: No host detected; " | 64 | printk(KERN_ERR "bvme6000-scsi: No host detected; " |
| 64 | "board configuration problem?\n"); | 65 | "board configuration problem?\n"); |
| @@ -73,7 +74,7 @@ bvme6000_probe(struct device *dev) | |||
| 73 | goto out_put_host; | 74 | goto out_put_host; |
| 74 | } | 75 | } |
| 75 | 76 | ||
| 76 | dev_set_drvdata(dev, host); | 77 | platform_set_drvdata(dev, host); |
| 77 | scsi_scan_host(host); | 78 | scsi_scan_host(host); |
| 78 | 79 | ||
| 79 | return 0; | 80 | return 0; |
| @@ -87,9 +88,9 @@ bvme6000_probe(struct device *dev) | |||
| 87 | } | 88 | } |
| 88 | 89 | ||
| 89 | static __devexit int | 90 | static __devexit int |
| 90 | bvme6000_device_remove(struct device *dev) | 91 | bvme6000_device_remove(struct platform_device *dev) |
| 91 | { | 92 | { |
| 92 | struct Scsi_Host *host = dev_get_drvdata(dev); | 93 | struct Scsi_Host *host = platform_get_drvdata(dev); |
| 93 | struct NCR_700_Host_Parameters *hostdata = shost_priv(host); | 94 | struct NCR_700_Host_Parameters *hostdata = shost_priv(host); |
| 94 | 95 | ||
| 95 | scsi_remove_host(host); | 96 | scsi_remove_host(host); |
| @@ -100,25 +101,27 @@ bvme6000_device_remove(struct device *dev) | |||
| 100 | return 0; | 101 | return 0; |
| 101 | } | 102 | } |
| 102 | 103 | ||
| 103 | static struct device_driver bvme6000_scsi_driver = { | 104 | static struct platform_driver bvme6000_scsi_driver = { |
| 104 | .name = "bvme6000-scsi", | 105 | .driver = { |
| 105 | .bus = &platform_bus_type, | 106 | .name = "bvme6000-scsi", |
| 106 | .probe = bvme6000_probe, | 107 | .owner = THIS_MODULE, |
| 107 | .remove = __devexit_p(bvme6000_device_remove), | 108 | }, |
| 109 | .probe = bvme6000_probe, | ||
| 110 | .remove = __devexit_p(bvme6000_device_remove), | ||
| 108 | }; | 111 | }; |
| 109 | 112 | ||
| 110 | static int __init bvme6000_scsi_init(void) | 113 | static int __init bvme6000_scsi_init(void) |
| 111 | { | 114 | { |
| 112 | int err; | 115 | int err; |
| 113 | 116 | ||
| 114 | err = driver_register(&bvme6000_scsi_driver); | 117 | err = platform_driver_register(&bvme6000_scsi_driver); |
| 115 | if (err) | 118 | if (err) |
| 116 | return err; | 119 | return err; |
| 117 | 120 | ||
| 118 | bvme6000_scsi_device = platform_device_register_simple("bvme6000-scsi", | 121 | bvme6000_scsi_device = platform_device_register_simple("bvme6000-scsi", |
| 119 | -1, NULL, 0); | 122 | -1, NULL, 0); |
| 120 | if (IS_ERR(bvme6000_scsi_device)) { | 123 | if (IS_ERR(bvme6000_scsi_device)) { |
| 121 | driver_unregister(&bvme6000_scsi_driver); | 124 | platform_driver_unregister(&bvme6000_scsi_driver); |
| 122 | return PTR_ERR(bvme6000_scsi_device); | 125 | return PTR_ERR(bvme6000_scsi_device); |
| 123 | } | 126 | } |
| 124 | 127 | ||
| @@ -128,7 +131,7 @@ static int __init bvme6000_scsi_init(void) | |||
| 128 | static void __exit bvme6000_scsi_exit(void) | 131 | static void __exit bvme6000_scsi_exit(void) |
| 129 | { | 132 | { |
| 130 | platform_device_unregister(bvme6000_scsi_device); | 133 | platform_device_unregister(bvme6000_scsi_device); |
| 131 | driver_unregister(&bvme6000_scsi_driver); | 134 | platform_driver_unregister(&bvme6000_scsi_driver); |
| 132 | } | 135 | } |
| 133 | 136 | ||
| 134 | module_init(bvme6000_scsi_init); | 137 | module_init(bvme6000_scsi_init); |
diff --git a/drivers/scsi/mvme16x_scsi.c b/drivers/scsi/mvme16x_scsi.c index b264b499d982..b5fbfd6ce870 100644 --- a/drivers/scsi/mvme16x_scsi.c +++ b/drivers/scsi/mvme16x_scsi.c | |||
| @@ -34,7 +34,7 @@ static struct scsi_host_template mvme16x_scsi_driver_template = { | |||
| 34 | static struct platform_device *mvme16x_scsi_device; | 34 | static struct platform_device *mvme16x_scsi_device; |
| 35 | 35 | ||
| 36 | static __devinit int | 36 | static __devinit int |
| 37 | mvme16x_probe(struct device *dev) | 37 | mvme16x_probe(struct platform_device *dev) |
| 38 | { | 38 | { |
| 39 | struct Scsi_Host * host = NULL; | 39 | struct Scsi_Host * host = NULL; |
| 40 | struct NCR_700_Host_Parameters *hostdata; | 40 | struct NCR_700_Host_Parameters *hostdata; |
| @@ -64,7 +64,8 @@ mvme16x_probe(struct device *dev) | |||
| 64 | hostdata->ctest7_extra = CTEST7_TT1; | 64 | hostdata->ctest7_extra = CTEST7_TT1; |
| 65 | 65 | ||
| 66 | /* and register the chip */ | 66 | /* and register the chip */ |
| 67 | host = NCR_700_detect(&mvme16x_scsi_driver_template, hostdata, dev); | 67 | host = NCR_700_detect(&mvme16x_scsi_driver_template, hostdata, |
| 68 | &dev->dev); | ||
| 68 | if (!host) { | 69 | if (!host) { |
| 69 | printk(KERN_ERR "mvme16x-scsi: No host detected; " | 70 | printk(KERN_ERR "mvme16x-scsi: No host detected; " |
| 70 | "board configuration problem?\n"); | 71 | "board configuration problem?\n"); |
| @@ -88,7 +89,7 @@ mvme16x_probe(struct device *dev) | |||
| 88 | out_be32(0xfff4202c, v); | 89 | out_be32(0xfff4202c, v); |
| 89 | } | 90 | } |
| 90 | 91 | ||
| 91 | dev_set_drvdata(dev, host); | 92 | platform_set_drvdata(dev, host); |
| 92 | scsi_scan_host(host); | 93 | scsi_scan_host(host); |
| 93 | 94 | ||
| 94 | return 0; | 95 | return 0; |
| @@ -102,9 +103,9 @@ mvme16x_probe(struct device *dev) | |||
| 102 | } | 103 | } |
| 103 | 104 | ||
| 104 | static __devexit int | 105 | static __devexit int |
| 105 | mvme16x_device_remove(struct device *dev) | 106 | mvme16x_device_remove(struct platform_device *dev) |
| 106 | { | 107 | { |
| 107 | struct Scsi_Host *host = dev_get_drvdata(dev); | 108 | struct Scsi_Host *host = platform_get_drvdata(dev); |
| 108 | struct NCR_700_Host_Parameters *hostdata = shost_priv(host); | 109 | struct NCR_700_Host_Parameters *hostdata = shost_priv(host); |
| 109 | 110 | ||
| 110 | /* Disable scsi chip ints */ | 111 | /* Disable scsi chip ints */ |
| @@ -123,25 +124,27 @@ mvme16x_device_remove(struct device *dev) | |||
| 123 | return 0; | 124 | return 0; |
| 124 | } | 125 | } |
| 125 | 126 | ||
| 126 | static struct device_driver mvme16x_scsi_driver = { | 127 | static struct platform_driver mvme16x_scsi_driver = { |
| 127 | .name = "mvme16x-scsi", | 128 | .driver = { |
| 128 | .bus = &platform_bus_type, | 129 | .name = "mvme16x-scsi", |
| 129 | .probe = mvme16x_probe, | 130 | .owner = THIS_MODULE, |
| 130 | .remove = __devexit_p(mvme16x_device_remove), | 131 | }, |
| 132 | .probe = mvme16x_probe, | ||
| 133 | .remove = __devexit_p(mvme16x_device_remove), | ||
| 131 | }; | 134 | }; |
| 132 | 135 | ||
| 133 | static int __init mvme16x_scsi_init(void) | 136 | static int __init mvme16x_scsi_init(void) |
| 134 | { | 137 | { |
| 135 | int err; | 138 | int err; |
| 136 | 139 | ||
| 137 | err = driver_register(&mvme16x_scsi_driver); | 140 | err = platform_driver_register(&mvme16x_scsi_driver); |
| 138 | if (err) | 141 | if (err) |
| 139 | return err; | 142 | return err; |
| 140 | 143 | ||
| 141 | mvme16x_scsi_device = platform_device_register_simple("mvme16x-scsi", | 144 | mvme16x_scsi_device = platform_device_register_simple("mvme16x-scsi", |
| 142 | -1, NULL, 0); | 145 | -1, NULL, 0); |
| 143 | if (IS_ERR(mvme16x_scsi_device)) { | 146 | if (IS_ERR(mvme16x_scsi_device)) { |
| 144 | driver_unregister(&mvme16x_scsi_driver); | 147 | platform_driver_unregister(&mvme16x_scsi_driver); |
| 145 | return PTR_ERR(mvme16x_scsi_device); | 148 | return PTR_ERR(mvme16x_scsi_device); |
| 146 | } | 149 | } |
| 147 | 150 | ||
| @@ -151,7 +154,7 @@ static int __init mvme16x_scsi_init(void) | |||
| 151 | static void __exit mvme16x_scsi_exit(void) | 154 | static void __exit mvme16x_scsi_exit(void) |
| 152 | { | 155 | { |
| 153 | platform_device_unregister(mvme16x_scsi_device); | 156 | platform_device_unregister(mvme16x_scsi_device); |
| 154 | driver_unregister(&mvme16x_scsi_driver); | 157 | platform_driver_unregister(&mvme16x_scsi_driver); |
| 155 | } | 158 | } |
| 156 | 159 | ||
| 157 | module_init(mvme16x_scsi_init); | 160 | module_init(mvme16x_scsi_init); |
diff --git a/drivers/serial/sunzilog.c b/drivers/serial/sunzilog.c index 45a299f35617..e09d3cebb4fb 100644 --- a/drivers/serial/sunzilog.c +++ b/drivers/serial/sunzilog.c | |||
| @@ -1438,12 +1438,12 @@ static int __devinit zs_probe(struct of_device *op, const struct of_device_id *m | |||
| 1438 | } else { | 1438 | } else { |
| 1439 | printk(KERN_INFO "%s: Keyboard at MMIO 0x%llx (irq = %d) " | 1439 | printk(KERN_INFO "%s: Keyboard at MMIO 0x%llx (irq = %d) " |
| 1440 | "is a %s\n", | 1440 | "is a %s\n", |
| 1441 | op->dev.bus_id, | 1441 | dev_name(&op->dev), |
| 1442 | (unsigned long long) up[0].port.mapbase, | 1442 | (unsigned long long) up[0].port.mapbase, |
| 1443 | op->irqs[0], sunzilog_type(&up[0].port)); | 1443 | op->irqs[0], sunzilog_type(&up[0].port)); |
| 1444 | printk(KERN_INFO "%s: Mouse at MMIO 0x%llx (irq = %d) " | 1444 | printk(KERN_INFO "%s: Mouse at MMIO 0x%llx (irq = %d) " |
| 1445 | "is a %s\n", | 1445 | "is a %s\n", |
| 1446 | op->dev.bus_id, | 1446 | dev_name(&op->dev), |
| 1447 | (unsigned long long) up[1].port.mapbase, | 1447 | (unsigned long long) up[1].port.mapbase, |
| 1448 | op->irqs[0], sunzilog_type(&up[1].port)); | 1448 | op->irqs[0], sunzilog_type(&up[1].port)); |
| 1449 | kbm_inst++; | 1449 | kbm_inst++; |
diff --git a/drivers/sh/maple/maple.c b/drivers/sh/maple/maple.c index c71bb4b4ce84..cab1ab7cfb78 100644 --- a/drivers/sh/maple/maple.c +++ b/drivers/sh/maple/maple.c | |||
| @@ -379,7 +379,6 @@ static void maple_attach_driver(struct maple_device *mdev) | |||
| 379 | dev_info(&mdev->dev, "no driver found\n"); | 379 | dev_info(&mdev->dev, "no driver found\n"); |
| 380 | mdev->driver = &maple_unsupported_device; | 380 | mdev->driver = &maple_unsupported_device; |
| 381 | } | 381 | } |
| 382 | |||
| 383 | dev_set_name(&mdev->dev, "%d:0%d.%lX", mdev->port, | 382 | dev_set_name(&mdev->dev, "%d:0%d.%lX", mdev->port, |
| 384 | mdev->unit, function); | 383 | mdev->unit, function); |
| 385 | } | 384 | } |
diff --git a/drivers/spi/atmel_spi.c b/drivers/spi/atmel_spi.c index 56ff3e6864ea..12e443cc4ac9 100644 --- a/drivers/spi/atmel_spi.c +++ b/drivers/spi/atmel_spi.c | |||
| @@ -322,7 +322,7 @@ static void atmel_spi_next_message(struct spi_master *master) | |||
| 322 | spi = msg->spi; | 322 | spi = msg->spi; |
| 323 | 323 | ||
| 324 | dev_dbg(master->dev.parent, "start message %p for %s\n", | 324 | dev_dbg(master->dev.parent, "start message %p for %s\n", |
| 325 | msg, spi->dev.bus_id); | 325 | msg, dev_name(&spi->dev)); |
| 326 | 326 | ||
| 327 | /* select chip if it's not still active */ | 327 | /* select chip if it's not still active */ |
| 328 | if (as->stay) { | 328 | if (as->stay) { |
| @@ -627,7 +627,7 @@ static int atmel_spi_setup(struct spi_device *spi) | |||
| 627 | if (!asd) | 627 | if (!asd) |
| 628 | return -ENOMEM; | 628 | return -ENOMEM; |
| 629 | 629 | ||
| 630 | ret = gpio_request(npcs_pin, spi->dev.bus_id); | 630 | ret = gpio_request(npcs_pin, dev_name(&spi->dev)); |
| 631 | if (ret) { | 631 | if (ret) { |
| 632 | kfree(asd); | 632 | kfree(asd); |
| 633 | return ret; | 633 | return ret; |
| @@ -668,7 +668,7 @@ static int atmel_spi_transfer(struct spi_device *spi, struct spi_message *msg) | |||
| 668 | as = spi_master_get_devdata(spi->master); | 668 | as = spi_master_get_devdata(spi->master); |
| 669 | 669 | ||
| 670 | dev_dbg(controller, "new message %p submitted for %s\n", | 670 | dev_dbg(controller, "new message %p submitted for %s\n", |
| 671 | msg, spi->dev.bus_id); | 671 | msg, dev_name(&spi->dev)); |
| 672 | 672 | ||
| 673 | if (unlikely(list_empty(&msg->transfers))) | 673 | if (unlikely(list_empty(&msg->transfers))) |
| 674 | return -EINVAL; | 674 | return -EINVAL; |
| @@ -803,7 +803,7 @@ static int __init atmel_spi_probe(struct platform_device *pdev) | |||
| 803 | as->clk = clk; | 803 | as->clk = clk; |
| 804 | 804 | ||
| 805 | ret = request_irq(irq, atmel_spi_interrupt, 0, | 805 | ret = request_irq(irq, atmel_spi_interrupt, 0, |
| 806 | pdev->dev.bus_id, master); | 806 | dev_name(&pdev->dev), master); |
| 807 | if (ret) | 807 | if (ret) |
| 808 | goto out_unmap_regs; | 808 | goto out_unmap_regs; |
| 809 | 809 | ||
diff --git a/drivers/spi/mpc52xx_psc_spi.c b/drivers/spi/mpc52xx_psc_spi.c index 3b97803e1d11..68c77a911595 100644 --- a/drivers/spi/mpc52xx_psc_spi.c +++ b/drivers/spi/mpc52xx_psc_spi.c | |||
| @@ -429,7 +429,7 @@ static int __init mpc52xx_psc_spi_do_probe(struct device *dev, u32 regaddr, | |||
| 429 | INIT_LIST_HEAD(&mps->queue); | 429 | INIT_LIST_HEAD(&mps->queue); |
| 430 | 430 | ||
| 431 | mps->workqueue = create_singlethread_workqueue( | 431 | mps->workqueue = create_singlethread_workqueue( |
| 432 | master->dev.parent->bus_id); | 432 | dev_name(master->dev.parent)); |
| 433 | if (mps->workqueue == NULL) { | 433 | if (mps->workqueue == NULL) { |
| 434 | ret = -EBUSY; | 434 | ret = -EBUSY; |
| 435 | goto free_irq; | 435 | goto free_irq; |
diff --git a/drivers/spi/omap2_mcspi.c b/drivers/spi/omap2_mcspi.c index 454a2712e629..1c65e380c845 100644 --- a/drivers/spi/omap2_mcspi.c +++ b/drivers/spi/omap2_mcspi.c | |||
| @@ -1003,7 +1003,7 @@ static int __init omap2_mcspi_probe(struct platform_device *pdev) | |||
| 1003 | goto err1; | 1003 | goto err1; |
| 1004 | } | 1004 | } |
| 1005 | if (!request_mem_region(r->start, (r->end - r->start) + 1, | 1005 | if (!request_mem_region(r->start, (r->end - r->start) + 1, |
| 1006 | pdev->dev.bus_id)) { | 1006 | dev_name(&pdev->dev))) { |
| 1007 | status = -EBUSY; | 1007 | status = -EBUSY; |
| 1008 | goto err1; | 1008 | goto err1; |
| 1009 | } | 1009 | } |
diff --git a/drivers/spi/omap_uwire.c b/drivers/spi/omap_uwire.c index bab6ff061e91..60b5381c65c4 100644 --- a/drivers/spi/omap_uwire.c +++ b/drivers/spi/omap_uwire.c | |||
| @@ -245,7 +245,7 @@ static int uwire_txrx(struct spi_device *spi, struct spi_transfer *t) | |||
| 245 | 245 | ||
| 246 | #ifdef VERBOSE | 246 | #ifdef VERBOSE |
| 247 | pr_debug("%s: write-%d =%04x\n", | 247 | pr_debug("%s: write-%d =%04x\n", |
| 248 | spi->dev.bus_id, bits, val); | 248 | dev_name(&spi->dev), bits, val); |
| 249 | #endif | 249 | #endif |
| 250 | if (wait_uwire_csr_flag(CSRB, 0, 0)) | 250 | if (wait_uwire_csr_flag(CSRB, 0, 0)) |
| 251 | goto eio; | 251 | goto eio; |
| @@ -305,7 +305,7 @@ static int uwire_txrx(struct spi_device *spi, struct spi_transfer *t) | |||
| 305 | status += bytes; | 305 | status += bytes; |
| 306 | #ifdef VERBOSE | 306 | #ifdef VERBOSE |
| 307 | pr_debug("%s: read-%d =%04x\n", | 307 | pr_debug("%s: read-%d =%04x\n", |
| 308 | spi->dev.bus_id, bits, val); | 308 | dev_name(&spi->dev), bits, val); |
| 309 | #endif | 309 | #endif |
| 310 | 310 | ||
| 311 | } | 311 | } |
| @@ -331,7 +331,7 @@ static int uwire_setup_transfer(struct spi_device *spi, struct spi_transfer *t) | |||
| 331 | uwire = spi_master_get_devdata(spi->master); | 331 | uwire = spi_master_get_devdata(spi->master); |
| 332 | 332 | ||
| 333 | if (spi->chip_select > 3) { | 333 | if (spi->chip_select > 3) { |
| 334 | pr_debug("%s: cs%d?\n", spi->dev.bus_id, spi->chip_select); | 334 | pr_debug("%s: cs%d?\n", dev_name(&spi->dev), spi->chip_select); |
| 335 | status = -ENODEV; | 335 | status = -ENODEV; |
| 336 | goto done; | 336 | goto done; |
| 337 | } | 337 | } |
| @@ -343,7 +343,7 @@ static int uwire_setup_transfer(struct spi_device *spi, struct spi_transfer *t) | |||
| 343 | bits = 8; | 343 | bits = 8; |
| 344 | 344 | ||
| 345 | if (bits > 16) { | 345 | if (bits > 16) { |
| 346 | pr_debug("%s: wordsize %d?\n", spi->dev.bus_id, bits); | 346 | pr_debug("%s: wordsize %d?\n", dev_name(&spi->dev), bits); |
| 347 | status = -ENODEV; | 347 | status = -ENODEV; |
| 348 | goto done; | 348 | goto done; |
| 349 | } | 349 | } |
| @@ -378,7 +378,7 @@ static int uwire_setup_transfer(struct spi_device *spi, struct spi_transfer *t) | |||
| 378 | hz = t->speed_hz; | 378 | hz = t->speed_hz; |
| 379 | 379 | ||
| 380 | if (!hz) { | 380 | if (!hz) { |
| 381 | pr_debug("%s: zero speed?\n", spi->dev.bus_id); | 381 | pr_debug("%s: zero speed?\n", dev_name(&spi->dev)); |
| 382 | status = -EINVAL; | 382 | status = -EINVAL; |
| 383 | goto done; | 383 | goto done; |
| 384 | } | 384 | } |
| @@ -406,7 +406,7 @@ static int uwire_setup_transfer(struct spi_device *spi, struct spi_transfer *t) | |||
| 406 | } | 406 | } |
| 407 | if (div1_idx == 4) { | 407 | if (div1_idx == 4) { |
| 408 | pr_debug("%s: lowest clock %ld, need %d\n", | 408 | pr_debug("%s: lowest clock %ld, need %d\n", |
| 409 | spi->dev.bus_id, rate / 10 / 8, hz); | 409 | dev_name(&spi->dev), rate / 10 / 8, hz); |
| 410 | status = -EDOM; | 410 | status = -EDOM; |
| 411 | goto done; | 411 | goto done; |
| 412 | } | 412 | } |
diff --git a/drivers/spi/orion_spi.c b/drivers/spi/orion_spi.c index 014becb7d530..c8b0babdc2a6 100644 --- a/drivers/spi/orion_spi.c +++ b/drivers/spi/orion_spi.c | |||
| @@ -496,7 +496,7 @@ static int __init orion_spi_probe(struct platform_device *pdev) | |||
| 496 | } | 496 | } |
| 497 | 497 | ||
| 498 | if (!request_mem_region(r->start, (r->end - r->start) + 1, | 498 | if (!request_mem_region(r->start, (r->end - r->start) + 1, |
| 499 | pdev->dev.bus_id)) { | 499 | dev_name(&pdev->dev))) { |
| 500 | status = -EBUSY; | 500 | status = -EBUSY; |
| 501 | goto out; | 501 | goto out; |
| 502 | } | 502 | } |
diff --git a/drivers/spi/pxa2xx_spi.c b/drivers/spi/pxa2xx_spi.c index d0fc4ca2f656..ec24f2d16f3c 100644 --- a/drivers/spi/pxa2xx_spi.c +++ b/drivers/spi/pxa2xx_spi.c | |||
| @@ -1333,7 +1333,7 @@ static int __init init_queue(struct driver_data *drv_data) | |||
| 1333 | 1333 | ||
| 1334 | INIT_WORK(&drv_data->pump_messages, pump_messages); | 1334 | INIT_WORK(&drv_data->pump_messages, pump_messages); |
| 1335 | drv_data->workqueue = create_singlethread_workqueue( | 1335 | drv_data->workqueue = create_singlethread_workqueue( |
| 1336 | drv_data->master->dev.parent->bus_id); | 1336 | dev_name(drv_data->master->dev.parent)); |
| 1337 | if (drv_data->workqueue == NULL) | 1337 | if (drv_data->workqueue == NULL) |
| 1338 | return -EBUSY; | 1338 | return -EBUSY; |
| 1339 | 1339 | ||
| @@ -1462,7 +1462,7 @@ static int __init pxa2xx_spi_probe(struct platform_device *pdev) | |||
| 1462 | drv_data->mask_sr = SSSR_TINT | SSSR_RFS | SSSR_TFS | SSSR_ROR; | 1462 | drv_data->mask_sr = SSSR_TINT | SSSR_RFS | SSSR_TFS | SSSR_ROR; |
| 1463 | } | 1463 | } |
| 1464 | 1464 | ||
| 1465 | status = request_irq(ssp->irq, ssp_int, 0, dev->bus_id, drv_data); | 1465 | status = request_irq(ssp->irq, ssp_int, 0, dev_name(dev), drv_data); |
| 1466 | if (status < 0) { | 1466 | if (status < 0) { |
| 1467 | dev_err(&pdev->dev, "cannot get IRQ %d\n", ssp->irq); | 1467 | dev_err(&pdev->dev, "cannot get IRQ %d\n", ssp->irq); |
| 1468 | goto out_error_master_alloc; | 1468 | goto out_error_master_alloc; |
diff --git a/drivers/spi/spi_bfin5xx.c b/drivers/spi/spi_bfin5xx.c index 7fea3cf4588a..3410b0c55ed2 100644 --- a/drivers/spi/spi_bfin5xx.c +++ b/drivers/spi/spi_bfin5xx.c | |||
| @@ -1160,8 +1160,8 @@ static inline int init_queue(struct driver_data *drv_data) | |||
| 1160 | 1160 | ||
| 1161 | /* init messages workqueue */ | 1161 | /* init messages workqueue */ |
| 1162 | INIT_WORK(&drv_data->pump_messages, pump_messages); | 1162 | INIT_WORK(&drv_data->pump_messages, pump_messages); |
| 1163 | drv_data->workqueue = | 1163 | drv_data->workqueue = create_singlethread_workqueue( |
| 1164 | create_singlethread_workqueue(drv_data->master->dev.parent->bus_id); | 1164 | dev_name(drv_data->master->dev.parent)); |
| 1165 | if (drv_data->workqueue == NULL) | 1165 | if (drv_data->workqueue == NULL) |
| 1166 | return -EBUSY; | 1166 | return -EBUSY; |
| 1167 | 1167 | ||
diff --git a/drivers/spi/spi_gpio.c b/drivers/spi/spi_gpio.c index f5ed9721aabb..d2866c293dee 100644 --- a/drivers/spi/spi_gpio.c +++ b/drivers/spi/spi_gpio.c | |||
| @@ -191,7 +191,7 @@ static int spi_gpio_setup(struct spi_device *spi) | |||
| 191 | return -EINVAL; | 191 | return -EINVAL; |
| 192 | 192 | ||
| 193 | if (!spi->controller_state) { | 193 | if (!spi->controller_state) { |
| 194 | status = gpio_request(cs, spi->dev.bus_id); | 194 | status = gpio_request(cs, dev_name(&spi->dev)); |
| 195 | if (status) | 195 | if (status) |
| 196 | return status; | 196 | return status; |
| 197 | status = gpio_direction_output(cs, spi->mode & SPI_CS_HIGH); | 197 | status = gpio_direction_output(cs, spi->mode & SPI_CS_HIGH); |
diff --git a/drivers/spi/spi_imx.c b/drivers/spi/spi_imx.c index 269a55ec52ef..0480d8bb19d3 100644 --- a/drivers/spi/spi_imx.c +++ b/drivers/spi/spi_imx.c | |||
| @@ -1381,7 +1381,7 @@ static int __init init_queue(struct driver_data *drv_data) | |||
| 1381 | 1381 | ||
| 1382 | INIT_WORK(&drv_data->work, pump_messages); | 1382 | INIT_WORK(&drv_data->work, pump_messages); |
| 1383 | drv_data->workqueue = create_singlethread_workqueue( | 1383 | drv_data->workqueue = create_singlethread_workqueue( |
| 1384 | drv_data->master->dev.parent->bus_id); | 1384 | dev_name(drv_data->master->dev.parent)); |
| 1385 | if (drv_data->workqueue == NULL) | 1385 | if (drv_data->workqueue == NULL) |
| 1386 | return -EBUSY; | 1386 | return -EBUSY; |
| 1387 | 1387 | ||
| @@ -1525,7 +1525,8 @@ static int __init spi_imx_probe(struct platform_device *pdev) | |||
| 1525 | status = -ENODEV; | 1525 | status = -ENODEV; |
| 1526 | goto err_no_irqres; | 1526 | goto err_no_irqres; |
| 1527 | } | 1527 | } |
| 1528 | status = request_irq(irq, spi_int, IRQF_DISABLED, dev->bus_id, drv_data); | 1528 | status = request_irq(irq, spi_int, IRQF_DISABLED, |
| 1529 | dev_name(dev), drv_data); | ||
| 1529 | if (status < 0) { | 1530 | if (status < 0) { |
| 1530 | dev_err(&pdev->dev, "probe - cannot get IRQ (%d)\n", status); | 1531 | dev_err(&pdev->dev, "probe - cannot get IRQ (%d)\n", status); |
| 1531 | goto err_no_irqres; | 1532 | goto err_no_irqres; |
diff --git a/drivers/spi/spi_mpc83xx.c b/drivers/spi/spi_mpc83xx.c index ac0e3e4b3c54..44a2b46ccb79 100644 --- a/drivers/spi/spi_mpc83xx.c +++ b/drivers/spi/spi_mpc83xx.c | |||
| @@ -637,7 +637,7 @@ static int __init mpc83xx_spi_probe(struct platform_device *dev) | |||
| 637 | INIT_LIST_HEAD(&mpc83xx_spi->queue); | 637 | INIT_LIST_HEAD(&mpc83xx_spi->queue); |
| 638 | 638 | ||
| 639 | mpc83xx_spi->workqueue = create_singlethread_workqueue( | 639 | mpc83xx_spi->workqueue = create_singlethread_workqueue( |
| 640 | master->dev.parent->bus_id); | 640 | dev_name(master->dev.parent)); |
| 641 | if (mpc83xx_spi->workqueue == NULL) { | 641 | if (mpc83xx_spi->workqueue == NULL) { |
| 642 | ret = -EBUSY; | 642 | ret = -EBUSY; |
| 643 | goto free_irq; | 643 | goto free_irq; |
| @@ -649,7 +649,7 @@ static int __init mpc83xx_spi_probe(struct platform_device *dev) | |||
| 649 | 649 | ||
| 650 | printk(KERN_INFO | 650 | printk(KERN_INFO |
| 651 | "%s: MPC83xx SPI Controller driver at 0x%p (irq = %d)\n", | 651 | "%s: MPC83xx SPI Controller driver at 0x%p (irq = %d)\n", |
| 652 | dev->dev.bus_id, mpc83xx_spi->base, mpc83xx_spi->irq); | 652 | dev_name(&dev->dev), mpc83xx_spi->base, mpc83xx_spi->irq); |
| 653 | 653 | ||
| 654 | return ret; | 654 | return ret; |
| 655 | 655 | ||
diff --git a/drivers/spi/spi_txx9.c b/drivers/spi/spi_txx9.c index 2296f37ea3c6..29cbb065618a 100644 --- a/drivers/spi/spi_txx9.c +++ b/drivers/spi/spi_txx9.c | |||
| @@ -404,7 +404,8 @@ static int __init txx9spi_probe(struct platform_device *dev) | |||
| 404 | if (ret) | 404 | if (ret) |
| 405 | goto exit; | 405 | goto exit; |
| 406 | 406 | ||
| 407 | c->workqueue = create_singlethread_workqueue(master->dev.parent->bus_id); | 407 | c->workqueue = create_singlethread_workqueue( |
| 408 | dev_name(master->dev.parent)); | ||
| 408 | if (!c->workqueue) | 409 | if (!c->workqueue) |
| 409 | goto exit_busy; | 410 | goto exit_busy; |
| 410 | c->last_chipselect = -1; | 411 | c->last_chipselect = -1; |
diff --git a/drivers/tc/tc.c b/drivers/tc/tc.c index f77f62a4b325..e5bd4470a570 100644 --- a/drivers/tc/tc.c +++ b/drivers/tc/tc.c | |||
| @@ -86,7 +86,7 @@ static void __init tc_bus_add_devices(struct tc_bus *tbus) | |||
| 86 | slot); | 86 | slot); |
| 87 | goto out_err; | 87 | goto out_err; |
| 88 | } | 88 | } |
| 89 | sprintf(tdev->dev.bus_id, "tc%x", slot); | 89 | dev_set_name(&tdev->dev, "tc%x", slot); |
| 90 | tdev->bus = tbus; | 90 | tdev->bus = tbus; |
| 91 | tdev->dev.parent = &tbus->dev; | 91 | tdev->dev.parent = &tbus->dev; |
| 92 | tdev->dev.bus = &tc_bus_type; | 92 | tdev->dev.bus = &tc_bus_type; |
| @@ -104,7 +104,7 @@ static void __init tc_bus_add_devices(struct tc_bus *tbus) | |||
| 104 | tdev->vendor[8] = 0; | 104 | tdev->vendor[8] = 0; |
| 105 | tdev->name[8] = 0; | 105 | tdev->name[8] = 0; |
| 106 | 106 | ||
| 107 | pr_info("%s: %s %s %s\n", tdev->dev.bus_id, tdev->vendor, | 107 | pr_info("%s: %s %s %s\n", dev_name(&tdev->dev), tdev->vendor, |
| 108 | tdev->name, tdev->firmware); | 108 | tdev->name, tdev->firmware); |
| 109 | 109 | ||
| 110 | devsize = readb(module + offset + TC_SLOT_SIZE); | 110 | devsize = readb(module + offset + TC_SLOT_SIZE); |
| @@ -118,7 +118,7 @@ static void __init tc_bus_add_devices(struct tc_bus *tbus) | |||
| 118 | } else { | 118 | } else { |
| 119 | printk(KERN_ERR "%s: Cannot provide slot space " | 119 | printk(KERN_ERR "%s: Cannot provide slot space " |
| 120 | "(%dMiB required, up to %dMiB supported)\n", | 120 | "(%dMiB required, up to %dMiB supported)\n", |
| 121 | tdev->dev.bus_id, devsize >> 20, | 121 | dev_name(&tdev->dev), devsize >> 20, |
| 122 | max(slotsize, extslotsize) >> 20); | 122 | max(slotsize, extslotsize) >> 20); |
| 123 | kfree(tdev); | 123 | kfree(tdev); |
| 124 | goto out_err; | 124 | goto out_err; |
| @@ -146,7 +146,7 @@ static int __init tc_init(void) | |||
| 146 | return 0; | 146 | return 0; |
| 147 | 147 | ||
| 148 | INIT_LIST_HEAD(&tc_bus.devices); | 148 | INIT_LIST_HEAD(&tc_bus.devices); |
| 149 | strcpy(tc_bus.dev.bus_id, "tc"); | 149 | dev_set_name(&tc_bus.dev, "tc"); |
| 150 | device_register(&tc_bus.dev); | 150 | device_register(&tc_bus.dev); |
| 151 | 151 | ||
| 152 | if (tc_bus.info.slot_size) { | 152 | if (tc_bus.info.slot_size) { |
diff --git a/drivers/uio/Kconfig b/drivers/uio/Kconfig index 04b954cfce76..7f86534de269 100644 --- a/drivers/uio/Kconfig +++ b/drivers/uio/Kconfig | |||
| @@ -58,6 +58,24 @@ config UIO_SMX | |||
| 58 | 58 | ||
| 59 | If you compile this as a module, it will be called uio_smx. | 59 | If you compile this as a module, it will be called uio_smx. |
| 60 | 60 | ||
| 61 | config UIO_AEC | ||
| 62 | tristate "AEC video timestamp device" | ||
| 63 | depends on PCI | ||
| 64 | default n | ||
| 65 | help | ||
| 66 | |||
| 67 | UIO driver for the Adrienne Electronics Corporation PCI time | ||
| 68 | code device. | ||
| 69 | |||
| 70 | This device differs from other UIO devices since it uses I/O | ||
| 71 | ports instead of memory mapped I/O. In order to make it | ||
| 72 | possible for UIO to work with this device a utility, uioport, | ||
| 73 | can be used to read and write the ports: | ||
| 74 | |||
| 75 | git clone git://ifup.org/philips/uioport.git | ||
| 76 | |||
| 77 | If you compile this as a module, it will be called uio_aec. | ||
| 78 | |||
| 61 | config UIO_SERCOS3 | 79 | config UIO_SERCOS3 |
| 62 | tristate "Automata Sercos III PCI card driver" | 80 | tristate "Automata Sercos III PCI card driver" |
| 63 | default n | 81 | default n |
diff --git a/drivers/uio/Makefile b/drivers/uio/Makefile index e69558149859..5c2586d75797 100644 --- a/drivers/uio/Makefile +++ b/drivers/uio/Makefile | |||
| @@ -3,4 +3,5 @@ obj-$(CONFIG_UIO_CIF) += uio_cif.o | |||
| 3 | obj-$(CONFIG_UIO_PDRV) += uio_pdrv.o | 3 | obj-$(CONFIG_UIO_PDRV) += uio_pdrv.o |
| 4 | obj-$(CONFIG_UIO_PDRV_GENIRQ) += uio_pdrv_genirq.o | 4 | obj-$(CONFIG_UIO_PDRV_GENIRQ) += uio_pdrv_genirq.o |
| 5 | obj-$(CONFIG_UIO_SMX) += uio_smx.o | 5 | obj-$(CONFIG_UIO_SMX) += uio_smx.o |
| 6 | obj-$(CONFIG_UIO_AEC) += uio_aec.o | ||
| 6 | obj-$(CONFIG_UIO_SERCOS3) += uio_sercos3.o | 7 | obj-$(CONFIG_UIO_SERCOS3) += uio_sercos3.o |
diff --git a/drivers/uio/uio.c b/drivers/uio/uio.c index 4ca85a113aa2..03efb065455f 100644 --- a/drivers/uio/uio.c +++ b/drivers/uio/uio.c | |||
| @@ -61,6 +61,14 @@ struct uio_map { | |||
| 61 | }; | 61 | }; |
| 62 | #define to_map(map) container_of(map, struct uio_map, kobj) | 62 | #define to_map(map) container_of(map, struct uio_map, kobj) |
| 63 | 63 | ||
| 64 | static ssize_t map_name_show(struct uio_mem *mem, char *buf) | ||
| 65 | { | ||
| 66 | if (unlikely(!mem->name)) | ||
| 67 | mem->name = ""; | ||
| 68 | |||
| 69 | return sprintf(buf, "%s\n", mem->name); | ||
| 70 | } | ||
| 71 | |||
| 64 | static ssize_t map_addr_show(struct uio_mem *mem, char *buf) | 72 | static ssize_t map_addr_show(struct uio_mem *mem, char *buf) |
| 65 | { | 73 | { |
| 66 | return sprintf(buf, "0x%lx\n", mem->addr); | 74 | return sprintf(buf, "0x%lx\n", mem->addr); |
| @@ -82,6 +90,8 @@ struct map_sysfs_entry { | |||
| 82 | ssize_t (*store)(struct uio_mem *, const char *, size_t); | 90 | ssize_t (*store)(struct uio_mem *, const char *, size_t); |
| 83 | }; | 91 | }; |
| 84 | 92 | ||
| 93 | static struct map_sysfs_entry name_attribute = | ||
| 94 | __ATTR(name, S_IRUGO, map_name_show, NULL); | ||
| 85 | static struct map_sysfs_entry addr_attribute = | 95 | static struct map_sysfs_entry addr_attribute = |
| 86 | __ATTR(addr, S_IRUGO, map_addr_show, NULL); | 96 | __ATTR(addr, S_IRUGO, map_addr_show, NULL); |
| 87 | static struct map_sysfs_entry size_attribute = | 97 | static struct map_sysfs_entry size_attribute = |
| @@ -90,6 +100,7 @@ static struct map_sysfs_entry offset_attribute = | |||
| 90 | __ATTR(offset, S_IRUGO, map_offset_show, NULL); | 100 | __ATTR(offset, S_IRUGO, map_offset_show, NULL); |
| 91 | 101 | ||
| 92 | static struct attribute *attrs[] = { | 102 | static struct attribute *attrs[] = { |
| 103 | &name_attribute.attr, | ||
| 93 | &addr_attribute.attr, | 104 | &addr_attribute.attr, |
| 94 | &size_attribute.attr, | 105 | &size_attribute.attr, |
| 95 | &offset_attribute.attr, | 106 | &offset_attribute.attr, |
| @@ -133,6 +144,14 @@ struct uio_portio { | |||
| 133 | }; | 144 | }; |
| 134 | #define to_portio(portio) container_of(portio, struct uio_portio, kobj) | 145 | #define to_portio(portio) container_of(portio, struct uio_portio, kobj) |
| 135 | 146 | ||
| 147 | static ssize_t portio_name_show(struct uio_port *port, char *buf) | ||
| 148 | { | ||
| 149 | if (unlikely(!port->name)) | ||
| 150 | port->name = ""; | ||
| 151 | |||
| 152 | return sprintf(buf, "%s\n", port->name); | ||
| 153 | } | ||
| 154 | |||
| 136 | static ssize_t portio_start_show(struct uio_port *port, char *buf) | 155 | static ssize_t portio_start_show(struct uio_port *port, char *buf) |
| 137 | { | 156 | { |
| 138 | return sprintf(buf, "0x%lx\n", port->start); | 157 | return sprintf(buf, "0x%lx\n", port->start); |
| @@ -159,6 +178,8 @@ struct portio_sysfs_entry { | |||
| 159 | ssize_t (*store)(struct uio_port *, const char *, size_t); | 178 | ssize_t (*store)(struct uio_port *, const char *, size_t); |
| 160 | }; | 179 | }; |
| 161 | 180 | ||
| 181 | static struct portio_sysfs_entry portio_name_attribute = | ||
| 182 | __ATTR(name, S_IRUGO, portio_name_show, NULL); | ||
| 162 | static struct portio_sysfs_entry portio_start_attribute = | 183 | static struct portio_sysfs_entry portio_start_attribute = |
| 163 | __ATTR(start, S_IRUGO, portio_start_show, NULL); | 184 | __ATTR(start, S_IRUGO, portio_start_show, NULL); |
| 164 | static struct portio_sysfs_entry portio_size_attribute = | 185 | static struct portio_sysfs_entry portio_size_attribute = |
| @@ -167,6 +188,7 @@ static struct portio_sysfs_entry portio_porttype_attribute = | |||
| 167 | __ATTR(porttype, S_IRUGO, portio_porttype_show, NULL); | 188 | __ATTR(porttype, S_IRUGO, portio_porttype_show, NULL); |
| 168 | 189 | ||
| 169 | static struct attribute *portio_attrs[] = { | 190 | static struct attribute *portio_attrs[] = { |
| 191 | &portio_name_attribute.attr, | ||
| 170 | &portio_start_attribute.attr, | 192 | &portio_start_attribute.attr, |
| 171 | &portio_size_attribute.attr, | 193 | &portio_size_attribute.attr, |
| 172 | &portio_porttype_attribute.attr, | 194 | &portio_porttype_attribute.attr, |
| @@ -686,7 +708,8 @@ static int uio_mmap(struct file *filep, struct vm_area_struct *vma) | |||
| 686 | return -EINVAL; | 708 | return -EINVAL; |
| 687 | 709 | ||
| 688 | requested_pages = (vma->vm_end - vma->vm_start) >> PAGE_SHIFT; | 710 | requested_pages = (vma->vm_end - vma->vm_start) >> PAGE_SHIFT; |
| 689 | actual_pages = (idev->info->mem[mi].size + PAGE_SIZE -1) >> PAGE_SHIFT; | 711 | actual_pages = ((idev->info->mem[mi].addr & ~PAGE_MASK) |
| 712 | + idev->info->mem[mi].size + PAGE_SIZE -1) >> PAGE_SHIFT; | ||
| 690 | if (requested_pages > actual_pages) | 713 | if (requested_pages > actual_pages) |
| 691 | return -EINVAL; | 714 | return -EINVAL; |
| 692 | 715 | ||
diff --git a/drivers/uio/uio_aec.c b/drivers/uio/uio_aec.c new file mode 100644 index 000000000000..b7830e9a3baa --- /dev/null +++ b/drivers/uio/uio_aec.c | |||
| @@ -0,0 +1,175 @@ | |||
| 1 | /* | ||
| 2 | * uio_aec.c -- simple driver for Adrienne Electronics Corp time code PCI device | ||
| 3 | * | ||
| 4 | * Copyright (C) 2008 Brandon Philips <brandon@ifup.org> | ||
| 5 | * | ||
| 6 | * This program is free software; you can redistribute it and/or modify it | ||
| 7 | * under the terms of the GNU General Public License version 2 as published | ||
| 8 | * by the Free Software Foundation. | ||
| 9 | * | ||
| 10 | * This program is distributed in the hope that it will be useful, | ||
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 13 | * GNU General Public License for more details. | ||
| 14 | * | ||
| 15 | * You should have received a copy of the GNU General Public License along | ||
| 16 | * with this program; if not, write to the Free Software Foundation, Inc., 59 | ||
| 17 | * Temple Place, Suite 330, Boston, MA 02111-1307, USA. | ||
| 18 | */ | ||
| 19 | |||
| 20 | #include <linux/kernel.h> | ||
| 21 | #include <linux/module.h> | ||
| 22 | #include <linux/pci.h> | ||
| 23 | #include <linux/init.h> | ||
| 24 | #include <linux/interrupt.h> | ||
| 25 | #include <linux/cdev.h> | ||
| 26 | #include <linux/fs.h> | ||
| 27 | #include <linux/io.h> | ||
| 28 | #include <linux/uaccess.h> | ||
| 29 | #include <linux/uio_driver.h> | ||
| 30 | |||
| 31 | #define PCI_VENDOR_ID_AEC 0xaecb | ||
| 32 | #define PCI_DEVICE_ID_AEC_VITCLTC 0x6250 | ||
| 33 | |||
| 34 | #define INT_ENABLE_ADDR 0xFC | ||
| 35 | #define INT_ENABLE 0x10 | ||
| 36 | #define INT_DISABLE 0x0 | ||
| 37 | |||
| 38 | #define INT_MASK_ADDR 0x2E | ||
| 39 | #define INT_MASK_ALL 0x3F | ||
| 40 | |||
| 41 | #define INTA_DRVR_ADDR 0xFE | ||
| 42 | #define INTA_ENABLED_FLAG 0x08 | ||
| 43 | #define INTA_FLAG 0x01 | ||
| 44 | |||
| 45 | #define MAILBOX 0x0F | ||
| 46 | |||
| 47 | static struct pci_device_id ids[] = { | ||
| 48 | { PCI_DEVICE(PCI_VENDOR_ID_AEC, PCI_DEVICE_ID_AEC_VITCLTC), }, | ||
| 49 | { 0, } | ||
| 50 | }; | ||
| 51 | MODULE_DEVICE_TABLE(pci, ids); | ||
| 52 | |||
| 53 | static irqreturn_t aectc_irq(int irq, struct uio_info *dev_info) | ||
| 54 | { | ||
| 55 | void __iomem *int_flag = dev_info->priv + INTA_DRVR_ADDR; | ||
| 56 | unsigned char status = ioread8(int_flag); | ||
| 57 | |||
| 58 | |||
| 59 | if ((status & INTA_ENABLED_FLAG) && (status & INTA_FLAG)) { | ||
| 60 | /* application writes 0x00 to 0x2F to get next interrupt */ | ||
| 61 | status = ioread8(dev_info->priv + MAILBOX); | ||
| 62 | return IRQ_HANDLED; | ||
| 63 | } | ||
| 64 | |||
| 65 | return IRQ_NONE; | ||
| 66 | } | ||
| 67 | |||
| 68 | static void print_board_data(struct pci_dev *pdev, struct uio_info *i) | ||
| 69 | { | ||
| 70 | dev_info(&pdev->dev, "PCI-TC board vendor: %x%x number: %x%x" | ||
| 71 | " revision: %c%c\n", | ||
| 72 | ioread8(i->priv + 0x01), | ||
| 73 | ioread8(i->priv + 0x00), | ||
| 74 | ioread8(i->priv + 0x03), | ||
| 75 | ioread8(i->priv + 0x02), | ||
| 76 | ioread8(i->priv + 0x06), | ||
| 77 | ioread8(i->priv + 0x07)); | ||
| 78 | } | ||
| 79 | |||
| 80 | static int __devinit probe(struct pci_dev *pdev, const struct pci_device_id *id) | ||
| 81 | { | ||
| 82 | struct uio_info *info; | ||
| 83 | int ret; | ||
| 84 | |||
| 85 | info = kzalloc(sizeof(struct uio_info), GFP_KERNEL); | ||
| 86 | if (!info) | ||
| 87 | return -ENOMEM; | ||
| 88 | |||
| 89 | if (pci_enable_device(pdev)) | ||
| 90 | goto out_free; | ||
| 91 | |||
| 92 | if (pci_request_regions(pdev, "aectc")) | ||
| 93 | goto out_disable; | ||
| 94 | |||
| 95 | info->name = "aectc"; | ||
| 96 | info->port[0].start = pci_resource_start(pdev, 0); | ||
| 97 | if (!info->port[0].start) | ||
| 98 | goto out_release; | ||
| 99 | info->priv = pci_iomap(pdev, 0, 0); | ||
| 100 | if (!info->priv) | ||
| 101 | goto out_release; | ||
| 102 | info->port[0].size = pci_resource_len(pdev, 0); | ||
| 103 | info->port[0].porttype = UIO_PORT_GPIO; | ||
| 104 | |||
| 105 | info->version = "0.0.1"; | ||
| 106 | info->irq = pdev->irq; | ||
| 107 | info->irq_flags = IRQF_SHARED; | ||
| 108 | info->handler = aectc_irq; | ||
| 109 | |||
| 110 | print_board_data(pdev, info); | ||
| 111 | ret = uio_register_device(&pdev->dev, info); | ||
| 112 | if (ret) | ||
| 113 | goto out_unmap; | ||
| 114 | |||
| 115 | iowrite32(INT_ENABLE, info->priv + INT_ENABLE_ADDR); | ||
| 116 | iowrite8(INT_MASK_ALL, info->priv + INT_MASK_ADDR); | ||
| 117 | if (!(ioread8(info->priv + INTA_DRVR_ADDR) | ||
| 118 | & INTA_ENABLED_FLAG)) | ||
| 119 | dev_err(&pdev->dev, "aectc: interrupts not enabled\n"); | ||
| 120 | |||
| 121 | pci_set_drvdata(pdev, info); | ||
| 122 | |||
| 123 | return 0; | ||
| 124 | |||
| 125 | out_unmap: | ||
| 126 | pci_iounmap(pdev, info->priv); | ||
| 127 | out_release: | ||
| 128 | pci_release_regions(pdev); | ||
| 129 | out_disable: | ||
| 130 | pci_disable_device(pdev); | ||
| 131 | out_free: | ||
| 132 | kfree(info); | ||
| 133 | return -ENODEV; | ||
| 134 | } | ||
| 135 | |||
| 136 | static void remove(struct pci_dev *pdev) | ||
| 137 | { | ||
| 138 | struct uio_info *info = pci_get_drvdata(pdev); | ||
| 139 | |||
| 140 | /* disable interrupts */ | ||
| 141 | iowrite8(INT_DISABLE, info->priv + INT_MASK_ADDR); | ||
| 142 | iowrite32(INT_DISABLE, info->priv + INT_ENABLE_ADDR); | ||
| 143 | /* read mailbox to ensure board drops irq */ | ||
| 144 | ioread8(info->priv + MAILBOX); | ||
| 145 | |||
| 146 | uio_unregister_device(info); | ||
| 147 | pci_release_regions(pdev); | ||
| 148 | pci_disable_device(pdev); | ||
| 149 | pci_set_drvdata(pdev, NULL); | ||
| 150 | iounmap(info->priv); | ||
| 151 | |||
| 152 | kfree(info); | ||
| 153 | } | ||
| 154 | |||
| 155 | static struct pci_driver pci_driver = { | ||
| 156 | .name = "aectc", | ||
| 157 | .id_table = ids, | ||
| 158 | .probe = probe, | ||
| 159 | .remove = remove, | ||
| 160 | }; | ||
| 161 | |||
| 162 | static int __init aectc_init(void) | ||
| 163 | { | ||
| 164 | return pci_register_driver(&pci_driver); | ||
| 165 | } | ||
| 166 | |||
| 167 | static void __exit aectc_exit(void) | ||
| 168 | { | ||
| 169 | pci_unregister_driver(&pci_driver); | ||
| 170 | } | ||
| 171 | |||
| 172 | MODULE_LICENSE("GPL"); | ||
| 173 | |||
| 174 | module_init(aectc_init); | ||
| 175 | module_exit(aectc_exit); | ||
diff --git a/drivers/usb/gadget/ci13xxx_udc.c b/drivers/usb/gadget/ci13xxx_udc.c index bebf911c7e5f..7f4e5eb1dc80 100644 --- a/drivers/usb/gadget/ci13xxx_udc.c +++ b/drivers/usb/gadget/ci13xxx_udc.c | |||
| @@ -2626,7 +2626,7 @@ static int udc_probe(struct device *dev, void __iomem *regs, const char *name) | |||
| 2626 | INIT_LIST_HEAD(&udc->gadget.ep_list); | 2626 | INIT_LIST_HEAD(&udc->gadget.ep_list); |
| 2627 | udc->gadget.ep0 = NULL; | 2627 | udc->gadget.ep0 = NULL; |
| 2628 | 2628 | ||
| 2629 | strcpy(udc->gadget.dev.bus_id, "gadget"); | 2629 | dev_set_name(&udc->gadget.dev, "gadget"); |
| 2630 | udc->gadget.dev.dma_mask = dev->dma_mask; | 2630 | udc->gadget.dev.dma_mask = dev->dma_mask; |
| 2631 | udc->gadget.dev.parent = dev; | 2631 | udc->gadget.dev.parent = dev; |
| 2632 | udc->gadget.dev.release = udc_release; | 2632 | udc->gadget.dev.release = udc_release; |
diff --git a/drivers/usb/gadget/imx_udc.c b/drivers/usb/gadget/imx_udc.c index 77c5d0a8a06e..cd67ac75e624 100644 --- a/drivers/usb/gadget/imx_udc.c +++ b/drivers/usb/gadget/imx_udc.c | |||
| @@ -1186,8 +1186,8 @@ static struct imx_udc_struct controller = { | |||
| 1186 | .ep0 = &controller.imx_ep[0].ep, | 1186 | .ep0 = &controller.imx_ep[0].ep, |
| 1187 | .name = driver_name, | 1187 | .name = driver_name, |
| 1188 | .dev = { | 1188 | .dev = { |
| 1189 | .bus_id = "gadget", | 1189 | .init_name = "gadget", |
| 1190 | }, | 1190 | }, |
| 1191 | }, | 1191 | }, |
| 1192 | 1192 | ||
| 1193 | .imx_ep[0] = { | 1193 | .imx_ep[0] = { |
diff --git a/drivers/usb/host/fhci-dbg.c b/drivers/usb/host/fhci-dbg.c index 34e14edf390b..ea8a4255c5da 100644 --- a/drivers/usb/host/fhci-dbg.c +++ b/drivers/usb/host/fhci-dbg.c | |||
| @@ -108,7 +108,7 @@ void fhci_dfs_create(struct fhci_hcd *fhci) | |||
| 108 | { | 108 | { |
| 109 | struct device *dev = fhci_to_hcd(fhci)->self.controller; | 109 | struct device *dev = fhci_to_hcd(fhci)->self.controller; |
| 110 | 110 | ||
| 111 | fhci->dfs_root = debugfs_create_dir(dev->bus_id, NULL); | 111 | fhci->dfs_root = debugfs_create_dir(dev_name(dev), NULL); |
| 112 | if (!fhci->dfs_root) { | 112 | if (!fhci->dfs_root) { |
| 113 | WARN_ON(1); | 113 | WARN_ON(1); |
| 114 | return; | 114 | return; |
diff --git a/drivers/usb/host/fhci-hcd.c b/drivers/usb/host/fhci-hcd.c index ba622cc8a9ba..0951818ef93b 100644 --- a/drivers/usb/host/fhci-hcd.c +++ b/drivers/usb/host/fhci-hcd.c | |||
| @@ -583,7 +583,7 @@ static int __devinit of_fhci_probe(struct of_device *ofdev, | |||
| 583 | if (sprop && strcmp(sprop, "host")) | 583 | if (sprop && strcmp(sprop, "host")) |
| 584 | return -ENODEV; | 584 | return -ENODEV; |
| 585 | 585 | ||
| 586 | hcd = usb_create_hcd(&fhci_driver, dev, dev->bus_id); | 586 | hcd = usb_create_hcd(&fhci_driver, dev, dev_name(dev)); |
| 587 | if (!hcd) { | 587 | if (!hcd) { |
| 588 | dev_err(dev, "could not create hcd\n"); | 588 | dev_err(dev, "could not create hcd\n"); |
| 589 | return -ENOMEM; | 589 | return -ENOMEM; |
| @@ -650,7 +650,7 @@ static int __devinit of_fhci_probe(struct of_device *ofdev, | |||
| 650 | } | 650 | } |
| 651 | } | 651 | } |
| 652 | 652 | ||
| 653 | ret = gpio_request(gpio, dev->bus_id); | 653 | ret = gpio_request(gpio, dev_name(dev)); |
| 654 | if (ret) { | 654 | if (ret) { |
| 655 | dev_err(dev, "failed to request gpio %d", i); | 655 | dev_err(dev, "failed to request gpio %d", i); |
| 656 | goto err_gpios; | 656 | goto err_gpios; |
diff --git a/drivers/video/au1100fb.c b/drivers/video/au1100fb.c index 62bd4441b5e0..378f27745a1d 100644 --- a/drivers/video/au1100fb.c +++ b/drivers/video/au1100fb.c | |||
| @@ -457,7 +457,7 @@ static struct fb_ops au1100fb_ops = | |||
| 457 | 457 | ||
| 458 | /* AU1100 LCD controller device driver */ | 458 | /* AU1100 LCD controller device driver */ |
| 459 | 459 | ||
| 460 | static int __init au1100fb_drv_probe(struct device *dev) | 460 | static int __init au1100fb_drv_probe(struct platform_device *dev) |
| 461 | { | 461 | { |
| 462 | struct au1100fb_device *fbdev = NULL; | 462 | struct au1100fb_device *fbdev = NULL; |
| 463 | struct resource *regs_res; | 463 | struct resource *regs_res; |
| @@ -475,7 +475,7 @@ static int __init au1100fb_drv_probe(struct device *dev) | |||
| 475 | 475 | ||
| 476 | fbdev->panel = &known_lcd_panels[drv_info.panel_idx]; | 476 | fbdev->panel = &known_lcd_panels[drv_info.panel_idx]; |
| 477 | 477 | ||
| 478 | dev_set_drvdata(dev, (void*)fbdev); | 478 | platform_set_drvdata(dev, (void *)fbdev); |
| 479 | 479 | ||
| 480 | /* Allocate region for our registers and map them */ | 480 | /* Allocate region for our registers and map them */ |
| 481 | if (!(regs_res = platform_get_resource(to_platform_device(dev), | 481 | if (!(regs_res = platform_get_resource(to_platform_device(dev), |
| @@ -583,19 +583,19 @@ failed: | |||
| 583 | fb_dealloc_cmap(&fbdev->info.cmap); | 583 | fb_dealloc_cmap(&fbdev->info.cmap); |
| 584 | } | 584 | } |
| 585 | kfree(fbdev); | 585 | kfree(fbdev); |
| 586 | dev_set_drvdata(dev, NULL); | 586 | platform_set_drvdata(dev, NULL); |
| 587 | 587 | ||
| 588 | return 0; | 588 | return 0; |
| 589 | } | 589 | } |
| 590 | 590 | ||
| 591 | int au1100fb_drv_remove(struct device *dev) | 591 | int au1100fb_drv_remove(struct platform_device *dev) |
| 592 | { | 592 | { |
| 593 | struct au1100fb_device *fbdev = NULL; | 593 | struct au1100fb_device *fbdev = NULL; |
| 594 | 594 | ||
| 595 | if (!dev) | 595 | if (!dev) |
| 596 | return -ENODEV; | 596 | return -ENODEV; |
| 597 | 597 | ||
| 598 | fbdev = (struct au1100fb_device*) dev_get_drvdata(dev); | 598 | fbdev = (struct au1100fb_device *) platform_get_drvdata(dev); |
| 599 | 599 | ||
| 600 | #if !defined(CONFIG_FRAMEBUFFER_CONSOLE) && defined(CONFIG_LOGO) | 600 | #if !defined(CONFIG_FRAMEBUFFER_CONSOLE) && defined(CONFIG_LOGO) |
| 601 | au1100fb_fb_blank(VESA_POWERDOWN, &fbdev->info); | 601 | au1100fb_fb_blank(VESA_POWERDOWN, &fbdev->info); |
| @@ -620,9 +620,9 @@ int au1100fb_drv_remove(struct device *dev) | |||
| 620 | static u32 sys_clksrc; | 620 | static u32 sys_clksrc; |
| 621 | static struct au1100fb_regs fbregs; | 621 | static struct au1100fb_regs fbregs; |
| 622 | 622 | ||
| 623 | int au1100fb_drv_suspend(struct device *dev, pm_message_t state) | 623 | int au1100fb_drv_suspend(struct platform_device *dev, pm_message_t state) |
| 624 | { | 624 | { |
| 625 | struct au1100fb_device *fbdev = dev_get_drvdata(dev); | 625 | struct au1100fb_device *fbdev = platform_get_drvdata(dev); |
| 626 | 626 | ||
| 627 | if (!fbdev) | 627 | if (!fbdev) |
| 628 | return 0; | 628 | return 0; |
| @@ -641,9 +641,9 @@ int au1100fb_drv_suspend(struct device *dev, pm_message_t state) | |||
| 641 | return 0; | 641 | return 0; |
| 642 | } | 642 | } |
| 643 | 643 | ||
| 644 | int au1100fb_drv_resume(struct device *dev) | 644 | int au1100fb_drv_resume(struct platform_device *dev) |
| 645 | { | 645 | { |
| 646 | struct au1100fb_device *fbdev = dev_get_drvdata(dev); | 646 | struct au1100fb_device *fbdev = platform_get_drvdata(dev); |
| 647 | 647 | ||
| 648 | if (!fbdev) | 648 | if (!fbdev) |
| 649 | return 0; | 649 | return 0; |
| @@ -663,10 +663,11 @@ int au1100fb_drv_resume(struct device *dev) | |||
| 663 | #define au1100fb_drv_resume NULL | 663 | #define au1100fb_drv_resume NULL |
| 664 | #endif | 664 | #endif |
| 665 | 665 | ||
| 666 | static struct device_driver au1100fb_driver = { | 666 | static struct platform_driver au1100fb_driver = { |
| 667 | .name = "au1100-lcd", | 667 | .driver = { |
| 668 | .bus = &platform_bus_type, | 668 | .name = "au1100-lcd", |
| 669 | 669 | .owner = THIS_MODULE, | |
| 670 | }, | ||
| 670 | .probe = au1100fb_drv_probe, | 671 | .probe = au1100fb_drv_probe, |
| 671 | .remove = au1100fb_drv_remove, | 672 | .remove = au1100fb_drv_remove, |
| 672 | .suspend = au1100fb_drv_suspend, | 673 | .suspend = au1100fb_drv_suspend, |
| @@ -753,12 +754,12 @@ int __init au1100fb_init(void) | |||
| 753 | return ret; | 754 | return ret; |
| 754 | } | 755 | } |
| 755 | 756 | ||
| 756 | return driver_register(&au1100fb_driver); | 757 | return platform_driver_register(&au1100fb_driver); |
| 757 | } | 758 | } |
| 758 | 759 | ||
| 759 | void __exit au1100fb_cleanup(void) | 760 | void __exit au1100fb_cleanup(void) |
| 760 | { | 761 | { |
| 761 | driver_unregister(&au1100fb_driver); | 762 | platform_driver_unregister(&au1100fb_driver); |
| 762 | 763 | ||
| 763 | kfree(drv_info.opt_mode); | 764 | kfree(drv_info.opt_mode); |
| 764 | } | 765 | } |
diff --git a/drivers/video/au1200fb.c b/drivers/video/au1200fb.c index 03e57ef88378..0d96f1d2d4c5 100644 --- a/drivers/video/au1200fb.c +++ b/drivers/video/au1200fb.c | |||
| @@ -1622,7 +1622,7 @@ static int au1200fb_init_fbinfo(struct au1200fb_device *fbdev) | |||
| 1622 | 1622 | ||
| 1623 | /* AU1200 LCD controller device driver */ | 1623 | /* AU1200 LCD controller device driver */ |
| 1624 | 1624 | ||
| 1625 | static int au1200fb_drv_probe(struct device *dev) | 1625 | static int au1200fb_drv_probe(struct platform_device *dev) |
| 1626 | { | 1626 | { |
| 1627 | struct au1200fb_device *fbdev; | 1627 | struct au1200fb_device *fbdev; |
| 1628 | unsigned long page; | 1628 | unsigned long page; |
| @@ -1645,7 +1645,7 @@ static int au1200fb_drv_probe(struct device *dev) | |||
| 1645 | /* Allocate the framebuffer to the maximum screen size */ | 1645 | /* Allocate the framebuffer to the maximum screen size */ |
| 1646 | fbdev->fb_len = (win->w[plane].xres * win->w[plane].yres * bpp) / 8; | 1646 | fbdev->fb_len = (win->w[plane].xres * win->w[plane].yres * bpp) / 8; |
| 1647 | 1647 | ||
| 1648 | fbdev->fb_mem = dma_alloc_noncoherent(dev, | 1648 | fbdev->fb_mem = dma_alloc_noncoherent(&dev->dev, |
| 1649 | PAGE_ALIGN(fbdev->fb_len), | 1649 | PAGE_ALIGN(fbdev->fb_len), |
| 1650 | &fbdev->fb_phys, GFP_KERNEL); | 1650 | &fbdev->fb_phys, GFP_KERNEL); |
| 1651 | if (!fbdev->fb_mem) { | 1651 | if (!fbdev->fb_mem) { |
| @@ -1715,7 +1715,7 @@ failed: | |||
| 1715 | return ret; | 1715 | return ret; |
| 1716 | } | 1716 | } |
| 1717 | 1717 | ||
| 1718 | static int au1200fb_drv_remove(struct device *dev) | 1718 | static int au1200fb_drv_remove(struct platform_device *dev) |
| 1719 | { | 1719 | { |
| 1720 | struct au1200fb_device *fbdev; | 1720 | struct au1200fb_device *fbdev; |
| 1721 | int plane; | 1721 | int plane; |
| @@ -1733,7 +1733,8 @@ static int au1200fb_drv_remove(struct device *dev) | |||
| 1733 | /* Clean up all probe data */ | 1733 | /* Clean up all probe data */ |
| 1734 | unregister_framebuffer(&fbdev->fb_info); | 1734 | unregister_framebuffer(&fbdev->fb_info); |
| 1735 | if (fbdev->fb_mem) | 1735 | if (fbdev->fb_mem) |
| 1736 | dma_free_noncoherent(dev, PAGE_ALIGN(fbdev->fb_len), | 1736 | dma_free_noncoherent(&dev->dev, |
| 1737 | PAGE_ALIGN(fbdev->fb_len), | ||
| 1737 | fbdev->fb_mem, fbdev->fb_phys); | 1738 | fbdev->fb_mem, fbdev->fb_phys); |
| 1738 | if (fbdev->fb_info.cmap.len != 0) | 1739 | if (fbdev->fb_info.cmap.len != 0) |
| 1739 | fb_dealloc_cmap(&fbdev->fb_info.cmap); | 1740 | fb_dealloc_cmap(&fbdev->fb_info.cmap); |
| @@ -1747,22 +1748,24 @@ static int au1200fb_drv_remove(struct device *dev) | |||
| 1747 | } | 1748 | } |
| 1748 | 1749 | ||
| 1749 | #ifdef CONFIG_PM | 1750 | #ifdef CONFIG_PM |
| 1750 | static int au1200fb_drv_suspend(struct device *dev, u32 state, u32 level) | 1751 | static int au1200fb_drv_suspend(struct platform_device *dev, u32 state) |
| 1751 | { | 1752 | { |
| 1752 | /* TODO */ | 1753 | /* TODO */ |
| 1753 | return 0; | 1754 | return 0; |
| 1754 | } | 1755 | } |
| 1755 | 1756 | ||
| 1756 | static int au1200fb_drv_resume(struct device *dev, u32 level) | 1757 | static int au1200fb_drv_resume(struct platform_device *dev) |
| 1757 | { | 1758 | { |
| 1758 | /* TODO */ | 1759 | /* TODO */ |
| 1759 | return 0; | 1760 | return 0; |
| 1760 | } | 1761 | } |
| 1761 | #endif /* CONFIG_PM */ | 1762 | #endif /* CONFIG_PM */ |
| 1762 | 1763 | ||
| 1763 | static struct device_driver au1200fb_driver = { | 1764 | static struct platform_driver au1200fb_driver = { |
| 1764 | .name = "au1200-lcd", | 1765 | .driver = { |
| 1765 | .bus = &platform_bus_type, | 1766 | .name = "au1200-lcd", |
| 1767 | .owner = THIS_MODULE, | ||
| 1768 | }, | ||
| 1766 | .probe = au1200fb_drv_probe, | 1769 | .probe = au1200fb_drv_probe, |
| 1767 | .remove = au1200fb_drv_remove, | 1770 | .remove = au1200fb_drv_remove, |
| 1768 | #ifdef CONFIG_PM | 1771 | #ifdef CONFIG_PM |
| @@ -1906,12 +1909,12 @@ static int __init au1200fb_init(void) | |||
| 1906 | printk(KERN_INFO "Power management device entry for the au1200fb loaded.\n"); | 1909 | printk(KERN_INFO "Power management device entry for the au1200fb loaded.\n"); |
| 1907 | #endif | 1910 | #endif |
| 1908 | 1911 | ||
| 1909 | return driver_register(&au1200fb_driver); | 1912 | return platform_driver_register(&au1200fb_driver); |
| 1910 | } | 1913 | } |
| 1911 | 1914 | ||
| 1912 | static void __exit au1200fb_cleanup(void) | 1915 | static void __exit au1200fb_cleanup(void) |
| 1913 | { | 1916 | { |
| 1914 | driver_unregister(&au1200fb_driver); | 1917 | platform_driver_unregister(&au1200fb_driver); |
| 1915 | } | 1918 | } |
| 1916 | 1919 | ||
| 1917 | module_init(au1200fb_init); | 1920 | module_init(au1200fb_init); |
diff --git a/drivers/video/pmag-ba-fb.c b/drivers/video/pmag-ba-fb.c index 3a3f80f65219..0573ec685a57 100644 --- a/drivers/video/pmag-ba-fb.c +++ b/drivers/video/pmag-ba-fb.c | |||
| @@ -151,7 +151,7 @@ static int __init pmagbafb_probe(struct device *dev) | |||
| 151 | 151 | ||
| 152 | info = framebuffer_alloc(sizeof(struct pmagbafb_par), dev); | 152 | info = framebuffer_alloc(sizeof(struct pmagbafb_par), dev); |
| 153 | if (!info) { | 153 | if (!info) { |
| 154 | printk(KERN_ERR "%s: Cannot allocate memory\n", dev->bus_id); | 154 | printk(KERN_ERR "%s: Cannot allocate memory\n", dev_name(dev)); |
| 155 | return -ENOMEM; | 155 | return -ENOMEM; |
| 156 | } | 156 | } |
| 157 | 157 | ||
| @@ -160,7 +160,7 @@ static int __init pmagbafb_probe(struct device *dev) | |||
| 160 | 160 | ||
| 161 | if (fb_alloc_cmap(&info->cmap, 256, 0) < 0) { | 161 | if (fb_alloc_cmap(&info->cmap, 256, 0) < 0) { |
| 162 | printk(KERN_ERR "%s: Cannot allocate color map\n", | 162 | printk(KERN_ERR "%s: Cannot allocate color map\n", |
| 163 | dev->bus_id); | 163 | dev_name(dev)); |
| 164 | err = -ENOMEM; | 164 | err = -ENOMEM; |
| 165 | goto err_alloc; | 165 | goto err_alloc; |
| 166 | } | 166 | } |
| @@ -173,8 +173,9 @@ static int __init pmagbafb_probe(struct device *dev) | |||
| 173 | /* Request the I/O MEM resource. */ | 173 | /* Request the I/O MEM resource. */ |
| 174 | start = tdev->resource.start; | 174 | start = tdev->resource.start; |
| 175 | len = tdev->resource.end - start + 1; | 175 | len = tdev->resource.end - start + 1; |
| 176 | if (!request_mem_region(start, len, dev->bus_id)) { | 176 | if (!request_mem_region(start, len, dev_name(dev))) { |
| 177 | printk(KERN_ERR "%s: Cannot reserve FB region\n", dev->bus_id); | 177 | printk(KERN_ERR "%s: Cannot reserve FB region\n", |
| 178 | dev_name(dev)); | ||
| 178 | err = -EBUSY; | 179 | err = -EBUSY; |
| 179 | goto err_cmap; | 180 | goto err_cmap; |
| 180 | } | 181 | } |
| @@ -183,7 +184,7 @@ static int __init pmagbafb_probe(struct device *dev) | |||
| 183 | info->fix.mmio_start = start; | 184 | info->fix.mmio_start = start; |
| 184 | par->mmio = ioremap_nocache(info->fix.mmio_start, info->fix.mmio_len); | 185 | par->mmio = ioremap_nocache(info->fix.mmio_start, info->fix.mmio_len); |
| 185 | if (!par->mmio) { | 186 | if (!par->mmio) { |
| 186 | printk(KERN_ERR "%s: Cannot map MMIO\n", dev->bus_id); | 187 | printk(KERN_ERR "%s: Cannot map MMIO\n", dev_name(dev)); |
| 187 | err = -ENOMEM; | 188 | err = -ENOMEM; |
| 188 | goto err_resource; | 189 | goto err_resource; |
| 189 | } | 190 | } |
| @@ -194,7 +195,7 @@ static int __init pmagbafb_probe(struct device *dev) | |||
| 194 | info->screen_base = ioremap_nocache(info->fix.smem_start, | 195 | info->screen_base = ioremap_nocache(info->fix.smem_start, |
| 195 | info->fix.smem_len); | 196 | info->fix.smem_len); |
| 196 | if (!info->screen_base) { | 197 | if (!info->screen_base) { |
| 197 | printk(KERN_ERR "%s: Cannot map FB\n", dev->bus_id); | 198 | printk(KERN_ERR "%s: Cannot map FB\n", dev_name(dev)); |
| 198 | err = -ENOMEM; | 199 | err = -ENOMEM; |
| 199 | goto err_mmio_map; | 200 | goto err_mmio_map; |
| 200 | } | 201 | } |
| @@ -205,14 +206,14 @@ static int __init pmagbafb_probe(struct device *dev) | |||
| 205 | err = register_framebuffer(info); | 206 | err = register_framebuffer(info); |
| 206 | if (err < 0) { | 207 | if (err < 0) { |
| 207 | printk(KERN_ERR "%s: Cannot register framebuffer\n", | 208 | printk(KERN_ERR "%s: Cannot register framebuffer\n", |
| 208 | dev->bus_id); | 209 | dev_name(dev)); |
| 209 | goto err_smem_map; | 210 | goto err_smem_map; |
| 210 | } | 211 | } |
| 211 | 212 | ||
| 212 | get_device(dev); | 213 | get_device(dev); |
| 213 | 214 | ||
| 214 | pr_info("fb%d: %s frame buffer device at %s\n", | 215 | pr_info("fb%d: %s frame buffer device at %s\n", |
| 215 | info->node, info->fix.id, dev->bus_id); | 216 | info->node, info->fix.id, dev_name(dev)); |
| 216 | 217 | ||
| 217 | return 0; | 218 | return 0; |
| 218 | 219 | ||
diff --git a/drivers/video/pmagb-b-fb.c b/drivers/video/pmagb-b-fb.c index 9b80597241b0..98748723af9f 100644 --- a/drivers/video/pmagb-b-fb.c +++ b/drivers/video/pmagb-b-fb.c | |||
| @@ -258,7 +258,7 @@ static int __init pmagbbfb_probe(struct device *dev) | |||
| 258 | 258 | ||
| 259 | info = framebuffer_alloc(sizeof(struct pmagbbfb_par), dev); | 259 | info = framebuffer_alloc(sizeof(struct pmagbbfb_par), dev); |
| 260 | if (!info) { | 260 | if (!info) { |
| 261 | printk(KERN_ERR "%s: Cannot allocate memory\n", dev->bus_id); | 261 | printk(KERN_ERR "%s: Cannot allocate memory\n", dev_name(dev)); |
| 262 | return -ENOMEM; | 262 | return -ENOMEM; |
| 263 | } | 263 | } |
| 264 | 264 | ||
| @@ -267,7 +267,7 @@ static int __init pmagbbfb_probe(struct device *dev) | |||
| 267 | 267 | ||
| 268 | if (fb_alloc_cmap(&info->cmap, 256, 0) < 0) { | 268 | if (fb_alloc_cmap(&info->cmap, 256, 0) < 0) { |
| 269 | printk(KERN_ERR "%s: Cannot allocate color map\n", | 269 | printk(KERN_ERR "%s: Cannot allocate color map\n", |
| 270 | dev->bus_id); | 270 | dev_name(dev)); |
| 271 | err = -ENOMEM; | 271 | err = -ENOMEM; |
| 272 | goto err_alloc; | 272 | goto err_alloc; |
| 273 | } | 273 | } |
| @@ -280,8 +280,9 @@ static int __init pmagbbfb_probe(struct device *dev) | |||
| 280 | /* Request the I/O MEM resource. */ | 280 | /* Request the I/O MEM resource. */ |
| 281 | start = tdev->resource.start; | 281 | start = tdev->resource.start; |
| 282 | len = tdev->resource.end - start + 1; | 282 | len = tdev->resource.end - start + 1; |
| 283 | if (!request_mem_region(start, len, dev->bus_id)) { | 283 | if (!request_mem_region(start, len, dev_name(dev))) { |
| 284 | printk(KERN_ERR "%s: Cannot reserve FB region\n", dev->bus_id); | 284 | printk(KERN_ERR "%s: Cannot reserve FB region\n", |
| 285 | dev_name(dev)); | ||
| 285 | err = -EBUSY; | 286 | err = -EBUSY; |
| 286 | goto err_cmap; | 287 | goto err_cmap; |
| 287 | } | 288 | } |
| @@ -290,7 +291,7 @@ static int __init pmagbbfb_probe(struct device *dev) | |||
| 290 | info->fix.mmio_start = start; | 291 | info->fix.mmio_start = start; |
| 291 | par->mmio = ioremap_nocache(info->fix.mmio_start, info->fix.mmio_len); | 292 | par->mmio = ioremap_nocache(info->fix.mmio_start, info->fix.mmio_len); |
| 292 | if (!par->mmio) { | 293 | if (!par->mmio) { |
| 293 | printk(KERN_ERR "%s: Cannot map MMIO\n", dev->bus_id); | 294 | printk(KERN_ERR "%s: Cannot map MMIO\n", dev_name(dev)); |
| 294 | err = -ENOMEM; | 295 | err = -ENOMEM; |
| 295 | goto err_resource; | 296 | goto err_resource; |
| 296 | } | 297 | } |
| @@ -301,7 +302,7 @@ static int __init pmagbbfb_probe(struct device *dev) | |||
| 301 | info->fix.smem_start = start + PMAGB_B_FBMEM; | 302 | info->fix.smem_start = start + PMAGB_B_FBMEM; |
| 302 | par->smem = ioremap_nocache(info->fix.smem_start, info->fix.smem_len); | 303 | par->smem = ioremap_nocache(info->fix.smem_start, info->fix.smem_len); |
| 303 | if (!par->smem) { | 304 | if (!par->smem) { |
| 304 | printk(KERN_ERR "%s: Cannot map FB\n", dev->bus_id); | 305 | printk(KERN_ERR "%s: Cannot map FB\n", dev_name(dev)); |
| 305 | err = -ENOMEM; | 306 | err = -ENOMEM; |
| 306 | goto err_mmio_map; | 307 | goto err_mmio_map; |
| 307 | } | 308 | } |
| @@ -316,7 +317,7 @@ static int __init pmagbbfb_probe(struct device *dev) | |||
| 316 | err = register_framebuffer(info); | 317 | err = register_framebuffer(info); |
| 317 | if (err < 0) { | 318 | if (err < 0) { |
| 318 | printk(KERN_ERR "%s: Cannot register framebuffer\n", | 319 | printk(KERN_ERR "%s: Cannot register framebuffer\n", |
| 319 | dev->bus_id); | 320 | dev_name(dev)); |
| 320 | goto err_smem_map; | 321 | goto err_smem_map; |
| 321 | } | 322 | } |
| 322 | 323 | ||
| @@ -328,7 +329,7 @@ static int __init pmagbbfb_probe(struct device *dev) | |||
| 328 | par->osc1 / 1000, par->osc1 % 1000); | 329 | par->osc1 / 1000, par->osc1 % 1000); |
| 329 | 330 | ||
| 330 | pr_info("fb%d: %s frame buffer device at %s\n", | 331 | pr_info("fb%d: %s frame buffer device at %s\n", |
| 331 | info->node, info->fix.id, dev->bus_id); | 332 | info->node, info->fix.id, dev_name(dev)); |
| 332 | pr_info("fb%d: Osc0: %s, Osc1: %s, Osc%u selected\n", | 333 | pr_info("fb%d: Osc0: %s, Osc1: %s, Osc%u selected\n", |
| 333 | info->node, freq0, par->osc1 ? freq1 : "disabled", | 334 | info->node, freq0, par->osc1 ? freq1 : "disabled", |
| 334 | par->osc1 != 0); | 335 | par->osc1 != 0); |
diff --git a/drivers/video/ps3fb.c b/drivers/video/ps3fb.c index 87f826e4c958..e00c1dff55de 100644 --- a/drivers/video/ps3fb.c +++ b/drivers/video/ps3fb.c | |||
| @@ -1213,7 +1213,7 @@ static int __devinit ps3fb_probe(struct ps3_system_bus_device *dev) | |||
| 1213 | dev->core.driver_data = info; | 1213 | dev->core.driver_data = info; |
| 1214 | 1214 | ||
| 1215 | dev_info(info->device, "%s %s, using %u KiB of video memory\n", | 1215 | dev_info(info->device, "%s %s, using %u KiB of video memory\n", |
| 1216 | dev_driver_string(info->dev), info->dev->bus_id, | 1216 | dev_driver_string(info->dev), dev_name(info->dev), |
| 1217 | info->fix.smem_len >> 10); | 1217 | info->fix.smem_len >> 10); |
| 1218 | 1218 | ||
| 1219 | task = kthread_run(ps3fbd, info, DEVICE_NAME); | 1219 | task = kthread_run(ps3fbd, info, DEVICE_NAME); |
diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c index b433b8ac76d9..92ea0ab44ce2 100644 --- a/drivers/video/sh_mobile_lcdcfb.c +++ b/drivers/video/sh_mobile_lcdcfb.c | |||
| @@ -737,7 +737,7 @@ static int __init sh_mobile_lcdc_probe(struct platform_device *pdev) | |||
| 737 | } | 737 | } |
| 738 | 738 | ||
| 739 | error = request_irq(i, sh_mobile_lcdc_irq, IRQF_DISABLED, | 739 | error = request_irq(i, sh_mobile_lcdc_irq, IRQF_DISABLED, |
| 740 | pdev->dev.bus_id, priv); | 740 | dev_name(&pdev->dev), priv); |
| 741 | if (error) { | 741 | if (error) { |
| 742 | dev_err(&pdev->dev, "unable to request irq\n"); | 742 | dev_err(&pdev->dev, "unable to request irq\n"); |
| 743 | goto err1; | 743 | goto err1; |
diff --git a/drivers/video/tmiofb.c b/drivers/video/tmiofb.c index 7baf2dd12d50..a1eb0862255b 100644 --- a/drivers/video/tmiofb.c +++ b/drivers/video/tmiofb.c | |||
| @@ -751,7 +751,7 @@ static int __devinit tmiofb_probe(struct platform_device *dev) | |||
| 751 | } | 751 | } |
| 752 | 752 | ||
| 753 | retval = request_irq(irq, &tmiofb_irq, IRQF_DISABLED, | 753 | retval = request_irq(irq, &tmiofb_irq, IRQF_DISABLED, |
| 754 | dev->dev.bus_id, info); | 754 | dev_name(&dev->dev), info); |
| 755 | 755 | ||
| 756 | if (retval) | 756 | if (retval) |
| 757 | goto err_request_irq; | 757 | goto err_request_irq; |
diff --git a/drivers/watchdog/rm9k_wdt.c b/drivers/watchdog/rm9k_wdt.c index f1ae3729a19e..cce1982a1b58 100644 --- a/drivers/watchdog/rm9k_wdt.c +++ b/drivers/watchdog/rm9k_wdt.c | |||
| @@ -59,8 +59,8 @@ static long wdt_gpi_ioctl(struct file *, unsigned int, unsigned long); | |||
| 59 | static int wdt_gpi_notify(struct notifier_block *, unsigned long, void *); | 59 | static int wdt_gpi_notify(struct notifier_block *, unsigned long, void *); |
| 60 | static const struct resource *wdt_gpi_get_resource(struct platform_device *, | 60 | static const struct resource *wdt_gpi_get_resource(struct platform_device *, |
| 61 | const char *, unsigned int); | 61 | const char *, unsigned int); |
| 62 | static int __init wdt_gpi_probe(struct device *); | 62 | static int __init wdt_gpi_probe(struct platform_device *); |
| 63 | static int __exit wdt_gpi_remove(struct device *); | 63 | static int __exit wdt_gpi_remove(struct platform_device *); |
| 64 | 64 | ||
| 65 | 65 | ||
| 66 | static const char wdt_gpi_name[] = "wdt_gpi"; | 66 | static const char wdt_gpi_name[] = "wdt_gpi"; |
| @@ -346,10 +346,9 @@ static const struct resource *wdt_gpi_get_resource(struct platform_device *pdv, | |||
| 346 | } | 346 | } |
| 347 | 347 | ||
| 348 | /* No hotplugging on the platform bus - use __init */ | 348 | /* No hotplugging on the platform bus - use __init */ |
| 349 | static int __init wdt_gpi_probe(struct device *dev) | 349 | static int __init wdt_gpi_probe(struct platform_device *pdv) |
| 350 | { | 350 | { |
| 351 | int res; | 351 | int res; |
| 352 | struct platform_device * const pdv = to_platform_device(dev); | ||
| 353 | const struct resource | 352 | const struct resource |
| 354 | * const rr = wdt_gpi_get_resource(pdv, WDT_RESOURCE_REGS, | 353 | * const rr = wdt_gpi_get_resource(pdv, WDT_RESOURCE_REGS, |
| 355 | IORESOURCE_MEM), | 354 | IORESOURCE_MEM), |
| @@ -374,7 +373,7 @@ static int __init wdt_gpi_probe(struct device *dev) | |||
| 374 | return res; | 373 | return res; |
| 375 | } | 374 | } |
| 376 | 375 | ||
| 377 | static int __exit wdt_gpi_remove(struct device *dev) | 376 | static int __exit wdt_gpi_remove(struct platform_device *dev) |
| 378 | { | 377 | { |
| 379 | int res; | 378 | int res; |
| 380 | 379 | ||
| @@ -387,15 +386,13 @@ static int __exit wdt_gpi_remove(struct device *dev) | |||
| 387 | 386 | ||
| 388 | 387 | ||
| 389 | /* Device driver init & exit */ | 388 | /* Device driver init & exit */ |
| 390 | static struct device_driver wdt_gpi_driver = { | 389 | static struct platform_driver wgt_gpi_driver = { |
| 391 | .name = (char *) wdt_gpi_name, | 390 | .driver = { |
| 392 | .bus = &platform_bus_type, | 391 | .name = wdt_gpi_name, |
| 393 | .owner = THIS_MODULE, | 392 | .owner = THIS_MODULE, |
| 393 | }, | ||
| 394 | .probe = wdt_gpi_probe, | 394 | .probe = wdt_gpi_probe, |
| 395 | .remove = __exit_p(wdt_gpi_remove), | 395 | .remove = __devexit_p(wdt_gpi_remove), |
| 396 | .shutdown = NULL, | ||
| 397 | .suspend = NULL, | ||
| 398 | .resume = NULL, | ||
| 399 | }; | 396 | }; |
| 400 | 397 | ||
| 401 | static int __init wdt_gpi_init_module(void) | 398 | static int __init wdt_gpi_init_module(void) |
| @@ -403,12 +400,12 @@ static int __init wdt_gpi_init_module(void) | |||
| 403 | atomic_set(&opencnt, 1); | 400 | atomic_set(&opencnt, 1); |
| 404 | if (timeout > MAX_TIMEOUT_SECONDS) | 401 | if (timeout > MAX_TIMEOUT_SECONDS) |
| 405 | timeout = MAX_TIMEOUT_SECONDS; | 402 | timeout = MAX_TIMEOUT_SECONDS; |
| 406 | return driver_register(&wdt_gpi_driver); | 403 | return platform_driver_register(&wdt_gpi_driver); |
| 407 | } | 404 | } |
| 408 | 405 | ||
| 409 | static void __exit wdt_gpi_cleanup_module(void) | 406 | static void __exit wdt_gpi_cleanup_module(void) |
| 410 | { | 407 | { |
| 411 | driver_unregister(&wdt_gpi_driver); | 408 | platform_driver_unregister(&wdt_gpi_driver); |
| 412 | } | 409 | } |
| 413 | 410 | ||
| 414 | module_init(wdt_gpi_init_module); | 411 | module_init(wdt_gpi_init_module); |
diff --git a/drivers/zorro/zorro.c b/drivers/zorro/zorro.c index a1585d6f6486..d45fb34e2d23 100644 --- a/drivers/zorro/zorro.c +++ b/drivers/zorro/zorro.c | |||
| @@ -140,7 +140,7 @@ static int __init zorro_init(void) | |||
| 140 | 140 | ||
| 141 | /* Initialize the Zorro bus */ | 141 | /* Initialize the Zorro bus */ |
| 142 | INIT_LIST_HEAD(&zorro_bus.devices); | 142 | INIT_LIST_HEAD(&zorro_bus.devices); |
| 143 | strcpy(zorro_bus.dev.bus_id, "zorro"); | 143 | dev_set_name(&zorro_bus.dev, "zorro"); |
| 144 | error = device_register(&zorro_bus.dev); | 144 | error = device_register(&zorro_bus.dev); |
| 145 | if (error) { | 145 | if (error) { |
| 146 | pr_err("Zorro: Error registering zorro_bus\n"); | 146 | pr_err("Zorro: Error registering zorro_bus\n"); |
| @@ -167,7 +167,7 @@ static int __init zorro_init(void) | |||
| 167 | if (request_resource(zorro_find_parent_resource(z), &z->resource)) | 167 | if (request_resource(zorro_find_parent_resource(z), &z->resource)) |
| 168 | pr_err("Zorro: Address space collision on device %s %pR\n", | 168 | pr_err("Zorro: Address space collision on device %s %pR\n", |
| 169 | z->name, &z->resource); | 169 | z->name, &z->resource); |
| 170 | sprintf(z->dev.bus_id, "%02x", i); | 170 | dev_set_name(&z->dev, "%02x", i); |
| 171 | z->dev.parent = &zorro_bus.dev; | 171 | z->dev.parent = &zorro_bus.dev; |
| 172 | z->dev.bus = &zorro_bus_type; | 172 | z->dev.bus = &zorro_bus_type; |
| 173 | error = device_register(&z->dev); | 173 | error = device_register(&z->dev); |
diff --git a/fs/partitions/check.c b/fs/partitions/check.c index 6d720243f5f4..38e337d51ced 100644 --- a/fs/partitions/check.c +++ b/fs/partitions/check.c | |||
| @@ -400,7 +400,7 @@ struct hd_struct *add_partition(struct gendisk *disk, int partno, | |||
| 400 | pdev->devt = devt; | 400 | pdev->devt = devt; |
| 401 | 401 | ||
| 402 | /* delay uevent until 'holders' subdir is created */ | 402 | /* delay uevent until 'holders' subdir is created */ |
| 403 | pdev->uevent_suppress = 1; | 403 | dev_set_uevent_suppress(pdev, 1); |
| 404 | err = device_add(pdev); | 404 | err = device_add(pdev); |
| 405 | if (err) | 405 | if (err) |
| 406 | goto out_put; | 406 | goto out_put; |
| @@ -410,7 +410,7 @@ struct hd_struct *add_partition(struct gendisk *disk, int partno, | |||
| 410 | if (!p->holder_dir) | 410 | if (!p->holder_dir) |
| 411 | goto out_del; | 411 | goto out_del; |
| 412 | 412 | ||
| 413 | pdev->uevent_suppress = 0; | 413 | dev_set_uevent_suppress(pdev, 0); |
| 414 | if (flags & ADDPART_FLAG_WHOLEDISK) { | 414 | if (flags & ADDPART_FLAG_WHOLEDISK) { |
| 415 | err = device_create_file(pdev, &dev_attr_whole_disk); | 415 | err = device_create_file(pdev, &dev_attr_whole_disk); |
| 416 | if (err) | 416 | if (err) |
| @@ -422,7 +422,7 @@ struct hd_struct *add_partition(struct gendisk *disk, int partno, | |||
| 422 | rcu_assign_pointer(ptbl->part[partno], p); | 422 | rcu_assign_pointer(ptbl->part[partno], p); |
| 423 | 423 | ||
| 424 | /* suppress uevent if the disk supresses it */ | 424 | /* suppress uevent if the disk supresses it */ |
| 425 | if (!ddev->uevent_suppress) | 425 | if (!dev_get_uevent_suppress(pdev)) |
| 426 | kobject_uevent(&pdev->kobj, KOBJ_ADD); | 426 | kobject_uevent(&pdev->kobj, KOBJ_ADD); |
| 427 | 427 | ||
| 428 | return p; | 428 | return p; |
| @@ -455,7 +455,7 @@ void register_disk(struct gendisk *disk) | |||
| 455 | dev_set_name(ddev, disk->disk_name); | 455 | dev_set_name(ddev, disk->disk_name); |
| 456 | 456 | ||
| 457 | /* delay uevents, until we scanned partition table */ | 457 | /* delay uevents, until we scanned partition table */ |
| 458 | ddev->uevent_suppress = 1; | 458 | dev_set_uevent_suppress(ddev, 1); |
| 459 | 459 | ||
| 460 | if (device_add(ddev)) | 460 | if (device_add(ddev)) |
| 461 | return; | 461 | return; |
| @@ -490,7 +490,7 @@ void register_disk(struct gendisk *disk) | |||
| 490 | 490 | ||
| 491 | exit: | 491 | exit: |
| 492 | /* announce disk after possible partitions are created */ | 492 | /* announce disk after possible partitions are created */ |
| 493 | ddev->uevent_suppress = 0; | 493 | dev_set_uevent_suppress(ddev, 0); |
| 494 | kobject_uevent(&ddev->kobj, KOBJ_ADD); | 494 | kobject_uevent(&ddev->kobj, KOBJ_ADD); |
| 495 | 495 | ||
| 496 | /* announce possible partitions */ | 496 | /* announce possible partitions */ |
diff --git a/fs/sysfs/bin.c b/fs/sysfs/bin.c index f2c478c3424e..07703d3ff4a1 100644 --- a/fs/sysfs/bin.c +++ b/fs/sysfs/bin.c | |||
| @@ -21,15 +21,28 @@ | |||
| 21 | #include <linux/module.h> | 21 | #include <linux/module.h> |
| 22 | #include <linux/slab.h> | 22 | #include <linux/slab.h> |
| 23 | #include <linux/mutex.h> | 23 | #include <linux/mutex.h> |
| 24 | #include <linux/mm.h> | ||
| 24 | 25 | ||
| 25 | #include <asm/uaccess.h> | 26 | #include <asm/uaccess.h> |
| 26 | 27 | ||
| 27 | #include "sysfs.h" | 28 | #include "sysfs.h" |
| 28 | 29 | ||
| 30 | /* | ||
| 31 | * There's one bin_buffer for each open file. | ||
| 32 | * | ||
| 33 | * filp->private_data points to bin_buffer and | ||
| 34 | * sysfs_dirent->s_bin_attr.buffers points to a the bin_buffer s | ||
| 35 | * sysfs_dirent->s_bin_attr.buffers is protected by sysfs_bin_lock | ||
| 36 | */ | ||
| 37 | static DEFINE_MUTEX(sysfs_bin_lock); | ||
| 38 | |||
| 29 | struct bin_buffer { | 39 | struct bin_buffer { |
| 30 | struct mutex mutex; | 40 | struct mutex mutex; |
| 31 | void *buffer; | 41 | void *buffer; |
| 32 | int mmapped; | 42 | int mmapped; |
| 43 | struct vm_operations_struct *vm_ops; | ||
| 44 | struct file *file; | ||
| 45 | struct hlist_node list; | ||
| 33 | }; | 46 | }; |
| 34 | 47 | ||
| 35 | static int | 48 | static int |
| @@ -168,6 +181,175 @@ out_free: | |||
| 168 | return count; | 181 | return count; |
| 169 | } | 182 | } |
| 170 | 183 | ||
| 184 | static void bin_vma_open(struct vm_area_struct *vma) | ||
| 185 | { | ||
| 186 | struct file *file = vma->vm_file; | ||
| 187 | struct bin_buffer *bb = file->private_data; | ||
| 188 | struct sysfs_dirent *attr_sd = file->f_path.dentry->d_fsdata; | ||
| 189 | |||
| 190 | if (!bb->vm_ops || !bb->vm_ops->open) | ||
| 191 | return; | ||
| 192 | |||
| 193 | if (!sysfs_get_active_two(attr_sd)) | ||
| 194 | return; | ||
| 195 | |||
| 196 | bb->vm_ops->open(vma); | ||
| 197 | |||
| 198 | sysfs_put_active_two(attr_sd); | ||
| 199 | } | ||
| 200 | |||
| 201 | static void bin_vma_close(struct vm_area_struct *vma) | ||
| 202 | { | ||
| 203 | struct file *file = vma->vm_file; | ||
| 204 | struct bin_buffer *bb = file->private_data; | ||
| 205 | struct sysfs_dirent *attr_sd = file->f_path.dentry->d_fsdata; | ||
| 206 | |||
| 207 | if (!bb->vm_ops || !bb->vm_ops->close) | ||
| 208 | return; | ||
| 209 | |||
| 210 | if (!sysfs_get_active_two(attr_sd)) | ||
| 211 | return; | ||
| 212 | |||
| 213 | bb->vm_ops->close(vma); | ||
| 214 | |||
| 215 | sysfs_put_active_two(attr_sd); | ||
| 216 | } | ||
| 217 | |||
| 218 | static int bin_fault(struct vm_area_struct *vma, struct vm_fault *vmf) | ||
| 219 | { | ||
| 220 | struct file *file = vma->vm_file; | ||
| 221 | struct bin_buffer *bb = file->private_data; | ||
| 222 | struct sysfs_dirent *attr_sd = file->f_path.dentry->d_fsdata; | ||
| 223 | int ret; | ||
| 224 | |||
| 225 | if (!bb->vm_ops || !bb->vm_ops->fault) | ||
| 226 | return VM_FAULT_SIGBUS; | ||
| 227 | |||
| 228 | if (!sysfs_get_active_two(attr_sd)) | ||
| 229 | return VM_FAULT_SIGBUS; | ||
| 230 | |||
| 231 | ret = bb->vm_ops->fault(vma, vmf); | ||
| 232 | |||
| 233 | sysfs_put_active_two(attr_sd); | ||
| 234 | return ret; | ||
| 235 | } | ||
| 236 | |||
| 237 | static int bin_page_mkwrite(struct vm_area_struct *vma, struct page *page) | ||
| 238 | { | ||
| 239 | struct file *file = vma->vm_file; | ||
| 240 | struct bin_buffer *bb = file->private_data; | ||
| 241 | struct sysfs_dirent *attr_sd = file->f_path.dentry->d_fsdata; | ||
| 242 | int ret; | ||
| 243 | |||
| 244 | if (!bb->vm_ops) | ||
| 245 | return -EINVAL; | ||
| 246 | |||
| 247 | if (!bb->vm_ops->page_mkwrite) | ||
| 248 | return 0; | ||
| 249 | |||
| 250 | if (!sysfs_get_active_two(attr_sd)) | ||
| 251 | return -EINVAL; | ||
| 252 | |||
| 253 | ret = bb->vm_ops->page_mkwrite(vma, page); | ||
| 254 | |||
| 255 | sysfs_put_active_two(attr_sd); | ||
| 256 | return ret; | ||
| 257 | } | ||
| 258 | |||
| 259 | static int bin_access(struct vm_area_struct *vma, unsigned long addr, | ||
| 260 | void *buf, int len, int write) | ||
| 261 | { | ||
| 262 | struct file *file = vma->vm_file; | ||
| 263 | struct bin_buffer *bb = file->private_data; | ||
| 264 | struct sysfs_dirent *attr_sd = file->f_path.dentry->d_fsdata; | ||
| 265 | int ret; | ||
| 266 | |||
| 267 | if (!bb->vm_ops || !bb->vm_ops->access) | ||
| 268 | return -EINVAL; | ||
| 269 | |||
| 270 | if (!sysfs_get_active_two(attr_sd)) | ||
| 271 | return -EINVAL; | ||
| 272 | |||
| 273 | ret = bb->vm_ops->access(vma, addr, buf, len, write); | ||
| 274 | |||
| 275 | sysfs_put_active_two(attr_sd); | ||
| 276 | return ret; | ||
| 277 | } | ||
| 278 | |||
| 279 | #ifdef CONFIG_NUMA | ||
| 280 | static int bin_set_policy(struct vm_area_struct *vma, struct mempolicy *new) | ||
| 281 | { | ||
| 282 | struct file *file = vma->vm_file; | ||
| 283 | struct bin_buffer *bb = file->private_data; | ||
| 284 | struct sysfs_dirent *attr_sd = file->f_path.dentry->d_fsdata; | ||
| 285 | int ret; | ||
| 286 | |||
| 287 | if (!bb->vm_ops || !bb->vm_ops->set_policy) | ||
| 288 | return 0; | ||
| 289 | |||
| 290 | if (!sysfs_get_active_two(attr_sd)) | ||
| 291 | return -EINVAL; | ||
| 292 | |||
| 293 | ret = bb->vm_ops->set_policy(vma, new); | ||
| 294 | |||
| 295 | sysfs_put_active_two(attr_sd); | ||
| 296 | return ret; | ||
| 297 | } | ||
| 298 | |||
| 299 | static struct mempolicy *bin_get_policy(struct vm_area_struct *vma, | ||
| 300 | unsigned long addr) | ||
| 301 | { | ||
| 302 | struct file *file = vma->vm_file; | ||
| 303 | struct bin_buffer *bb = file->private_data; | ||
| 304 | struct sysfs_dirent *attr_sd = file->f_path.dentry->d_fsdata; | ||
| 305 | struct mempolicy *pol; | ||
| 306 | |||
| 307 | if (!bb->vm_ops || !bb->vm_ops->get_policy) | ||
| 308 | return vma->vm_policy; | ||
| 309 | |||
| 310 | if (!sysfs_get_active_two(attr_sd)) | ||
| 311 | return vma->vm_policy; | ||
| 312 | |||
| 313 | pol = bb->vm_ops->get_policy(vma, addr); | ||
| 314 | |||
| 315 | sysfs_put_active_two(attr_sd); | ||
| 316 | return pol; | ||
| 317 | } | ||
| 318 | |||
| 319 | static int bin_migrate(struct vm_area_struct *vma, const nodemask_t *from, | ||
| 320 | const nodemask_t *to, unsigned long flags) | ||
| 321 | { | ||
| 322 | struct file *file = vma->vm_file; | ||
| 323 | struct bin_buffer *bb = file->private_data; | ||
| 324 | struct sysfs_dirent *attr_sd = file->f_path.dentry->d_fsdata; | ||
| 325 | int ret; | ||
| 326 | |||
| 327 | if (!bb->vm_ops || !bb->vm_ops->migrate) | ||
| 328 | return 0; | ||
| 329 | |||
| 330 | if (!sysfs_get_active_two(attr_sd)) | ||
| 331 | return 0; | ||
| 332 | |||
| 333 | ret = bb->vm_ops->migrate(vma, from, to, flags); | ||
| 334 | |||
| 335 | sysfs_put_active_two(attr_sd); | ||
| 336 | return ret; | ||
| 337 | } | ||
| 338 | #endif | ||
| 339 | |||
| 340 | static struct vm_operations_struct bin_vm_ops = { | ||
| 341 | .open = bin_vma_open, | ||
| 342 | .close = bin_vma_close, | ||
| 343 | .fault = bin_fault, | ||
| 344 | .page_mkwrite = bin_page_mkwrite, | ||
| 345 | .access = bin_access, | ||
| 346 | #ifdef CONFIG_NUMA | ||
| 347 | .set_policy = bin_set_policy, | ||
| 348 | .get_policy = bin_get_policy, | ||
| 349 | .migrate = bin_migrate, | ||
| 350 | #endif | ||
| 351 | }; | ||
| 352 | |||
| 171 | static int mmap(struct file *file, struct vm_area_struct *vma) | 353 | static int mmap(struct file *file, struct vm_area_struct *vma) |
| 172 | { | 354 | { |
| 173 | struct bin_buffer *bb = file->private_data; | 355 | struct bin_buffer *bb = file->private_data; |
| @@ -179,18 +361,37 @@ static int mmap(struct file *file, struct vm_area_struct *vma) | |||
| 179 | mutex_lock(&bb->mutex); | 361 | mutex_lock(&bb->mutex); |
| 180 | 362 | ||
| 181 | /* need attr_sd for attr, its parent for kobj */ | 363 | /* need attr_sd for attr, its parent for kobj */ |
| 364 | rc = -ENODEV; | ||
| 182 | if (!sysfs_get_active_two(attr_sd)) | 365 | if (!sysfs_get_active_two(attr_sd)) |
| 183 | return -ENODEV; | 366 | goto out_unlock; |
| 184 | 367 | ||
| 185 | rc = -EINVAL; | 368 | rc = -EINVAL; |
| 186 | if (attr->mmap) | 369 | if (!attr->mmap) |
| 187 | rc = attr->mmap(kobj, attr, vma); | 370 | goto out_put; |
| 371 | |||
| 372 | rc = attr->mmap(kobj, attr, vma); | ||
| 373 | if (rc) | ||
| 374 | goto out_put; | ||
| 188 | 375 | ||
| 189 | if (rc == 0 && !bb->mmapped) | 376 | /* |
| 190 | bb->mmapped = 1; | 377 | * PowerPC's pci_mmap of legacy_mem uses shmem_zero_setup() |
| 191 | else | 378 | * to satisfy versions of X which crash if the mmap fails: that |
| 192 | sysfs_put_active_two(attr_sd); | 379 | * substitutes a new vm_file, and we don't then want bin_vm_ops. |
| 380 | */ | ||
| 381 | if (vma->vm_file != file) | ||
| 382 | goto out_put; | ||
| 193 | 383 | ||
| 384 | rc = -EINVAL; | ||
| 385 | if (bb->mmapped && bb->vm_ops != vma->vm_ops) | ||
| 386 | goto out_put; | ||
| 387 | |||
| 388 | rc = 0; | ||
| 389 | bb->mmapped = 1; | ||
| 390 | bb->vm_ops = vma->vm_ops; | ||
| 391 | vma->vm_ops = &bin_vm_ops; | ||
| 392 | out_put: | ||
| 393 | sysfs_put_active_two(attr_sd); | ||
| 394 | out_unlock: | ||
| 194 | mutex_unlock(&bb->mutex); | 395 | mutex_unlock(&bb->mutex); |
| 195 | 396 | ||
| 196 | return rc; | 397 | return rc; |
| @@ -223,8 +424,13 @@ static int open(struct inode * inode, struct file * file) | |||
| 223 | goto err_out; | 424 | goto err_out; |
| 224 | 425 | ||
| 225 | mutex_init(&bb->mutex); | 426 | mutex_init(&bb->mutex); |
| 427 | bb->file = file; | ||
| 226 | file->private_data = bb; | 428 | file->private_data = bb; |
| 227 | 429 | ||
| 430 | mutex_lock(&sysfs_bin_lock); | ||
| 431 | hlist_add_head(&bb->list, &attr_sd->s_bin_attr.buffers); | ||
| 432 | mutex_unlock(&sysfs_bin_lock); | ||
| 433 | |||
| 228 | /* open succeeded, put active references */ | 434 | /* open succeeded, put active references */ |
| 229 | sysfs_put_active_two(attr_sd); | 435 | sysfs_put_active_two(attr_sd); |
| 230 | return 0; | 436 | return 0; |
| @@ -237,11 +443,12 @@ static int open(struct inode * inode, struct file * file) | |||
| 237 | 443 | ||
| 238 | static int release(struct inode * inode, struct file * file) | 444 | static int release(struct inode * inode, struct file * file) |
| 239 | { | 445 | { |
| 240 | struct sysfs_dirent *attr_sd = file->f_path.dentry->d_fsdata; | ||
| 241 | struct bin_buffer *bb = file->private_data; | 446 | struct bin_buffer *bb = file->private_data; |
| 242 | 447 | ||
| 243 | if (bb->mmapped) | 448 | mutex_lock(&sysfs_bin_lock); |
| 244 | sysfs_put_active_two(attr_sd); | 449 | hlist_del(&bb->list); |
| 450 | mutex_unlock(&sysfs_bin_lock); | ||
| 451 | |||
| 245 | kfree(bb->buffer); | 452 | kfree(bb->buffer); |
| 246 | kfree(bb); | 453 | kfree(bb); |
| 247 | return 0; | 454 | return 0; |
| @@ -256,6 +463,26 @@ const struct file_operations bin_fops = { | |||
| 256 | .release = release, | 463 | .release = release, |
| 257 | }; | 464 | }; |
| 258 | 465 | ||
| 466 | |||
| 467 | void unmap_bin_file(struct sysfs_dirent *attr_sd) | ||
| 468 | { | ||
| 469 | struct bin_buffer *bb; | ||
| 470 | struct hlist_node *tmp; | ||
| 471 | |||
| 472 | if (sysfs_type(attr_sd) != SYSFS_KOBJ_BIN_ATTR) | ||
| 473 | return; | ||
| 474 | |||
| 475 | mutex_lock(&sysfs_bin_lock); | ||
| 476 | |||
| 477 | hlist_for_each_entry(bb, tmp, &attr_sd->s_bin_attr.buffers, list) { | ||
| 478 | struct inode *inode = bb->file->f_path.dentry->d_inode; | ||
| 479 | |||
| 480 | unmap_mapping_range(inode->i_mapping, 0, 0, 1); | ||
| 481 | } | ||
| 482 | |||
| 483 | mutex_unlock(&sysfs_bin_lock); | ||
| 484 | } | ||
| 485 | |||
| 259 | /** | 486 | /** |
| 260 | * sysfs_create_bin_file - create binary file for object. | 487 | * sysfs_create_bin_file - create binary file for object. |
| 261 | * @kobj: object. | 488 | * @kobj: object. |
diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c index 82d3b79d0e08..66aeb4fff0c3 100644 --- a/fs/sysfs/dir.c +++ b/fs/sysfs/dir.c | |||
| @@ -434,6 +434,26 @@ int __sysfs_add_one(struct sysfs_addrm_cxt *acxt, struct sysfs_dirent *sd) | |||
| 434 | } | 434 | } |
| 435 | 435 | ||
| 436 | /** | 436 | /** |
| 437 | * sysfs_pathname - return full path to sysfs dirent | ||
| 438 | * @sd: sysfs_dirent whose path we want | ||
| 439 | * @path: caller allocated buffer | ||
| 440 | * | ||
| 441 | * Gives the name "/" to the sysfs_root entry; any path returned | ||
| 442 | * is relative to wherever sysfs is mounted. | ||
| 443 | * | ||
| 444 | * XXX: does no error checking on @path size | ||
| 445 | */ | ||
| 446 | static char *sysfs_pathname(struct sysfs_dirent *sd, char *path) | ||
| 447 | { | ||
| 448 | if (sd->s_parent) { | ||
| 449 | sysfs_pathname(sd->s_parent, path); | ||
| 450 | strcat(path, "/"); | ||
| 451 | } | ||
| 452 | strcat(path, sd->s_name); | ||
| 453 | return path; | ||
| 454 | } | ||
| 455 | |||
| 456 | /** | ||
| 437 | * sysfs_add_one - add sysfs_dirent to parent | 457 | * sysfs_add_one - add sysfs_dirent to parent |
| 438 | * @acxt: addrm context to use | 458 | * @acxt: addrm context to use |
| 439 | * @sd: sysfs_dirent to be added | 459 | * @sd: sysfs_dirent to be added |
| @@ -458,8 +478,16 @@ int sysfs_add_one(struct sysfs_addrm_cxt *acxt, struct sysfs_dirent *sd) | |||
| 458 | int ret; | 478 | int ret; |
| 459 | 479 | ||
| 460 | ret = __sysfs_add_one(acxt, sd); | 480 | ret = __sysfs_add_one(acxt, sd); |
| 461 | WARN(ret == -EEXIST, KERN_WARNING "sysfs: duplicate filename '%s' " | 481 | if (ret == -EEXIST) { |
| 462 | "can not be created\n", sd->s_name); | 482 | char *path = kzalloc(PATH_MAX, GFP_KERNEL); |
| 483 | WARN(1, KERN_WARNING | ||
| 484 | "sysfs: cannot create duplicate filename '%s'\n", | ||
| 485 | (path == NULL) ? sd->s_name : | ||
| 486 | strcat(strcat(sysfs_pathname(acxt->parent_sd, path), "/"), | ||
| 487 | sd->s_name)); | ||
| 488 | kfree(path); | ||
| 489 | } | ||
| 490 | |||
| 463 | return ret; | 491 | return ret; |
| 464 | } | 492 | } |
| 465 | 493 | ||
| @@ -581,6 +609,7 @@ void sysfs_addrm_finish(struct sysfs_addrm_cxt *acxt) | |||
| 581 | 609 | ||
| 582 | sysfs_drop_dentry(sd); | 610 | sysfs_drop_dentry(sd); |
| 583 | sysfs_deactivate(sd); | 611 | sysfs_deactivate(sd); |
| 612 | unmap_bin_file(sd); | ||
| 584 | sysfs_put(sd); | 613 | sysfs_put(sd); |
| 585 | } | 614 | } |
| 586 | } | 615 | } |
diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c index 1f4a3f877262..289c43a47263 100644 --- a/fs/sysfs/file.c +++ b/fs/sysfs/file.c | |||
| @@ -659,13 +659,16 @@ void sysfs_remove_file_from_group(struct kobject *kobj, | |||
| 659 | EXPORT_SYMBOL_GPL(sysfs_remove_file_from_group); | 659 | EXPORT_SYMBOL_GPL(sysfs_remove_file_from_group); |
| 660 | 660 | ||
| 661 | struct sysfs_schedule_callback_struct { | 661 | struct sysfs_schedule_callback_struct { |
| 662 | struct kobject *kobj; | 662 | struct list_head workq_list; |
| 663 | struct kobject *kobj; | ||
| 663 | void (*func)(void *); | 664 | void (*func)(void *); |
| 664 | void *data; | 665 | void *data; |
| 665 | struct module *owner; | 666 | struct module *owner; |
| 666 | struct work_struct work; | 667 | struct work_struct work; |
| 667 | }; | 668 | }; |
| 668 | 669 | ||
| 670 | static DEFINE_MUTEX(sysfs_workq_mutex); | ||
| 671 | static LIST_HEAD(sysfs_workq); | ||
| 669 | static void sysfs_schedule_callback_work(struct work_struct *work) | 672 | static void sysfs_schedule_callback_work(struct work_struct *work) |
| 670 | { | 673 | { |
| 671 | struct sysfs_schedule_callback_struct *ss = container_of(work, | 674 | struct sysfs_schedule_callback_struct *ss = container_of(work, |
| @@ -674,6 +677,9 @@ static void sysfs_schedule_callback_work(struct work_struct *work) | |||
| 674 | (ss->func)(ss->data); | 677 | (ss->func)(ss->data); |
| 675 | kobject_put(ss->kobj); | 678 | kobject_put(ss->kobj); |
| 676 | module_put(ss->owner); | 679 | module_put(ss->owner); |
| 680 | mutex_lock(&sysfs_workq_mutex); | ||
| 681 | list_del(&ss->workq_list); | ||
| 682 | mutex_unlock(&sysfs_workq_mutex); | ||
| 677 | kfree(ss); | 683 | kfree(ss); |
| 678 | } | 684 | } |
| 679 | 685 | ||
| @@ -695,15 +701,25 @@ static void sysfs_schedule_callback_work(struct work_struct *work) | |||
| 695 | * until @func returns. | 701 | * until @func returns. |
| 696 | * | 702 | * |
| 697 | * Returns 0 if the request was submitted, -ENOMEM if storage could not | 703 | * Returns 0 if the request was submitted, -ENOMEM if storage could not |
| 698 | * be allocated, -ENODEV if a reference to @owner isn't available. | 704 | * be allocated, -ENODEV if a reference to @owner isn't available, |
| 705 | * -EAGAIN if a callback has already been scheduled for @kobj. | ||
| 699 | */ | 706 | */ |
| 700 | int sysfs_schedule_callback(struct kobject *kobj, void (*func)(void *), | 707 | int sysfs_schedule_callback(struct kobject *kobj, void (*func)(void *), |
| 701 | void *data, struct module *owner) | 708 | void *data, struct module *owner) |
| 702 | { | 709 | { |
| 703 | struct sysfs_schedule_callback_struct *ss; | 710 | struct sysfs_schedule_callback_struct *ss, *tmp; |
| 704 | 711 | ||
| 705 | if (!try_module_get(owner)) | 712 | if (!try_module_get(owner)) |
| 706 | return -ENODEV; | 713 | return -ENODEV; |
| 714 | |||
| 715 | mutex_lock(&sysfs_workq_mutex); | ||
| 716 | list_for_each_entry_safe(ss, tmp, &sysfs_workq, workq_list) | ||
| 717 | if (ss->kobj == kobj) { | ||
| 718 | mutex_unlock(&sysfs_workq_mutex); | ||
| 719 | return -EAGAIN; | ||
| 720 | } | ||
| 721 | mutex_unlock(&sysfs_workq_mutex); | ||
| 722 | |||
| 707 | ss = kmalloc(sizeof(*ss), GFP_KERNEL); | 723 | ss = kmalloc(sizeof(*ss), GFP_KERNEL); |
| 708 | if (!ss) { | 724 | if (!ss) { |
| 709 | module_put(owner); | 725 | module_put(owner); |
| @@ -715,6 +731,10 @@ int sysfs_schedule_callback(struct kobject *kobj, void (*func)(void *), | |||
| 715 | ss->data = data; | 731 | ss->data = data; |
| 716 | ss->owner = owner; | 732 | ss->owner = owner; |
| 717 | INIT_WORK(&ss->work, sysfs_schedule_callback_work); | 733 | INIT_WORK(&ss->work, sysfs_schedule_callback_work); |
| 734 | INIT_LIST_HEAD(&ss->workq_list); | ||
| 735 | mutex_lock(&sysfs_workq_mutex); | ||
| 736 | list_add_tail(&ss->workq_list, &sysfs_workq); | ||
| 737 | mutex_unlock(&sysfs_workq_mutex); | ||
| 718 | schedule_work(&ss->work); | 738 | schedule_work(&ss->work); |
| 719 | return 0; | 739 | return 0; |
| 720 | } | 740 | } |
diff --git a/fs/sysfs/inode.c b/fs/sysfs/inode.c index dfa3d94cfc74..555f0ff988df 100644 --- a/fs/sysfs/inode.c +++ b/fs/sysfs/inode.c | |||
| @@ -147,6 +147,7 @@ static void sysfs_init_inode(struct sysfs_dirent *sd, struct inode *inode) | |||
| 147 | { | 147 | { |
| 148 | struct bin_attribute *bin_attr; | 148 | struct bin_attribute *bin_attr; |
| 149 | 149 | ||
| 150 | inode->i_private = sysfs_get(sd); | ||
| 150 | inode->i_mapping->a_ops = &sysfs_aops; | 151 | inode->i_mapping->a_ops = &sysfs_aops; |
| 151 | inode->i_mapping->backing_dev_info = &sysfs_backing_dev_info; | 152 | inode->i_mapping->backing_dev_info = &sysfs_backing_dev_info; |
| 152 | inode->i_op = &sysfs_inode_operations; | 153 | inode->i_op = &sysfs_inode_operations; |
| @@ -214,6 +215,22 @@ struct inode * sysfs_get_inode(struct sysfs_dirent *sd) | |||
| 214 | return inode; | 215 | return inode; |
| 215 | } | 216 | } |
| 216 | 217 | ||
| 218 | /* | ||
| 219 | * The sysfs_dirent serves as both an inode and a directory entry for sysfs. | ||
| 220 | * To prevent the sysfs inode numbers from being freed prematurely we take a | ||
| 221 | * reference to sysfs_dirent from the sysfs inode. A | ||
| 222 | * super_operations.delete_inode() implementation is needed to drop that | ||
| 223 | * reference upon inode destruction. | ||
| 224 | */ | ||
| 225 | void sysfs_delete_inode(struct inode *inode) | ||
| 226 | { | ||
| 227 | struct sysfs_dirent *sd = inode->i_private; | ||
| 228 | |||
| 229 | truncate_inode_pages(&inode->i_data, 0); | ||
| 230 | clear_inode(inode); | ||
| 231 | sysfs_put(sd); | ||
| 232 | } | ||
| 233 | |||
| 217 | int sysfs_hash_and_remove(struct sysfs_dirent *dir_sd, const char *name) | 234 | int sysfs_hash_and_remove(struct sysfs_dirent *dir_sd, const char *name) |
| 218 | { | 235 | { |
| 219 | struct sysfs_addrm_cxt acxt; | 236 | struct sysfs_addrm_cxt acxt; |
diff --git a/fs/sysfs/mount.c b/fs/sysfs/mount.c index ab343e371d64..49749955ccaf 100644 --- a/fs/sysfs/mount.c +++ b/fs/sysfs/mount.c | |||
| @@ -17,11 +17,10 @@ | |||
| 17 | #include <linux/pagemap.h> | 17 | #include <linux/pagemap.h> |
| 18 | #include <linux/init.h> | 18 | #include <linux/init.h> |
| 19 | #include <linux/module.h> | 19 | #include <linux/module.h> |
| 20 | #include <linux/magic.h> | ||
| 20 | 21 | ||
| 21 | #include "sysfs.h" | 22 | #include "sysfs.h" |
| 22 | 23 | ||
| 23 | /* Random magic number */ | ||
| 24 | #define SYSFS_MAGIC 0x62656572 | ||
| 25 | 24 | ||
| 26 | static struct vfsmount *sysfs_mount; | 25 | static struct vfsmount *sysfs_mount; |
| 27 | struct super_block * sysfs_sb = NULL; | 26 | struct super_block * sysfs_sb = NULL; |
| @@ -30,6 +29,7 @@ struct kmem_cache *sysfs_dir_cachep; | |||
| 30 | static const struct super_operations sysfs_ops = { | 29 | static const struct super_operations sysfs_ops = { |
| 31 | .statfs = simple_statfs, | 30 | .statfs = simple_statfs, |
| 32 | .drop_inode = generic_delete_inode, | 31 | .drop_inode = generic_delete_inode, |
| 32 | .delete_inode = sysfs_delete_inode, | ||
| 33 | }; | 33 | }; |
| 34 | 34 | ||
| 35 | struct sysfs_dirent sysfs_root = { | 35 | struct sysfs_dirent sysfs_root = { |
| @@ -53,7 +53,9 @@ static int sysfs_fill_super(struct super_block *sb, void *data, int silent) | |||
| 53 | sysfs_sb = sb; | 53 | sysfs_sb = sb; |
| 54 | 54 | ||
| 55 | /* get root inode, initialize and unlock it */ | 55 | /* get root inode, initialize and unlock it */ |
| 56 | mutex_lock(&sysfs_mutex); | ||
| 56 | inode = sysfs_get_inode(&sysfs_root); | 57 | inode = sysfs_get_inode(&sysfs_root); |
| 58 | mutex_unlock(&sysfs_mutex); | ||
| 57 | if (!inode) { | 59 | if (!inode) { |
| 58 | pr_debug("sysfs: could not get root inode\n"); | 60 | pr_debug("sysfs: could not get root inode\n"); |
| 59 | return -ENOMEM; | 61 | return -ENOMEM; |
diff --git a/fs/sysfs/sysfs.h b/fs/sysfs/sysfs.h index 93c6d6b27c4d..3fa0d98481e2 100644 --- a/fs/sysfs/sysfs.h +++ b/fs/sysfs/sysfs.h | |||
| @@ -28,6 +28,7 @@ struct sysfs_elem_attr { | |||
| 28 | 28 | ||
| 29 | struct sysfs_elem_bin_attr { | 29 | struct sysfs_elem_bin_attr { |
| 30 | struct bin_attribute *bin_attr; | 30 | struct bin_attribute *bin_attr; |
| 31 | struct hlist_head buffers; | ||
| 31 | }; | 32 | }; |
| 32 | 33 | ||
| 33 | /* | 34 | /* |
| @@ -145,6 +146,7 @@ static inline void __sysfs_put(struct sysfs_dirent *sd) | |||
| 145 | * inode.c | 146 | * inode.c |
| 146 | */ | 147 | */ |
| 147 | struct inode *sysfs_get_inode(struct sysfs_dirent *sd); | 148 | struct inode *sysfs_get_inode(struct sysfs_dirent *sd); |
| 149 | void sysfs_delete_inode(struct inode *inode); | ||
| 148 | int sysfs_setattr(struct dentry *dentry, struct iattr *iattr); | 150 | int sysfs_setattr(struct dentry *dentry, struct iattr *iattr); |
| 149 | int sysfs_hash_and_remove(struct sysfs_dirent *dir_sd, const char *name); | 151 | int sysfs_hash_and_remove(struct sysfs_dirent *dir_sd, const char *name); |
| 150 | int sysfs_inode_init(void); | 152 | int sysfs_inode_init(void); |
| @@ -163,6 +165,7 @@ int sysfs_add_file_mode(struct sysfs_dirent *dir_sd, | |||
| 163 | * bin.c | 165 | * bin.c |
| 164 | */ | 166 | */ |
| 165 | extern const struct file_operations bin_fops; | 167 | extern const struct file_operations bin_fops; |
| 168 | void unmap_bin_file(struct sysfs_dirent *attr_sd); | ||
| 166 | 169 | ||
| 167 | /* | 170 | /* |
| 168 | * symlink.c | 171 | * symlink.c |
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h index c61fab1dd2f8..aca40b93bd28 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h | |||
| @@ -80,6 +80,11 @@ | |||
| 80 | VMLINUX_SYMBOL(__start___tracepoints) = .; \ | 80 | VMLINUX_SYMBOL(__start___tracepoints) = .; \ |
| 81 | *(__tracepoints) \ | 81 | *(__tracepoints) \ |
| 82 | VMLINUX_SYMBOL(__stop___tracepoints) = .; \ | 82 | VMLINUX_SYMBOL(__stop___tracepoints) = .; \ |
| 83 | /* implement dynamic printk debug */ \ | ||
| 84 | . = ALIGN(8); \ | ||
| 85 | VMLINUX_SYMBOL(__start___verbose) = .; \ | ||
| 86 | *(__verbose) \ | ||
| 87 | VMLINUX_SYMBOL(__stop___verbose) = .; \ | ||
| 83 | LIKELY_PROFILE() \ | 88 | LIKELY_PROFILE() \ |
| 84 | BRANCH_PROFILE() | 89 | BRANCH_PROFILE() |
| 85 | 90 | ||
| @@ -309,15 +314,7 @@ | |||
| 309 | CPU_DISCARD(init.data) \ | 314 | CPU_DISCARD(init.data) \ |
| 310 | CPU_DISCARD(init.rodata) \ | 315 | CPU_DISCARD(init.rodata) \ |
| 311 | MEM_DISCARD(init.data) \ | 316 | MEM_DISCARD(init.data) \ |
| 312 | MEM_DISCARD(init.rodata) \ | 317 | MEM_DISCARD(init.rodata) |
| 313 | /* implement dynamic printk debug */ \ | ||
| 314 | VMLINUX_SYMBOL(__start___verbose_strings) = .; \ | ||
| 315 | *(__verbose_strings) \ | ||
| 316 | VMLINUX_SYMBOL(__stop___verbose_strings) = .; \ | ||
| 317 | . = ALIGN(8); \ | ||
| 318 | VMLINUX_SYMBOL(__start___verbose) = .; \ | ||
| 319 | *(__verbose) \ | ||
| 320 | VMLINUX_SYMBOL(__stop___verbose) = .; | ||
| 321 | 318 | ||
| 322 | #define INIT_TEXT \ | 319 | #define INIT_TEXT \ |
| 323 | *(.init.text) \ | 320 | *(.init.text) \ |
diff --git a/include/linux/console.h b/include/linux/console.h index a67a90cf8268..dcca5339ceb3 100644 --- a/include/linux/console.h +++ b/include/linux/console.h | |||
| @@ -137,8 +137,8 @@ extern void resume_console(void); | |||
| 137 | int mda_console_init(void); | 137 | int mda_console_init(void); |
| 138 | void prom_con_init(void); | 138 | void prom_con_init(void); |
| 139 | 139 | ||
| 140 | void vcs_make_sysfs(struct tty_struct *tty); | 140 | void vcs_make_sysfs(int index); |
| 141 | void vcs_remove_sysfs(struct tty_struct *tty); | 141 | void vcs_remove_sysfs(int index); |
| 142 | 142 | ||
| 143 | /* Some debug stub to catch some of the obvious races in the VT code */ | 143 | /* Some debug stub to catch some of the obvious races in the VT code */ |
| 144 | #if 1 | 144 | #if 1 |
diff --git a/include/linux/device.h b/include/linux/device.h index 47f343c7bdda..2918c0e8fdfd 100644 --- a/include/linux/device.h +++ b/include/linux/device.h | |||
| @@ -28,6 +28,7 @@ | |||
| 28 | #define BUS_ID_SIZE 20 | 28 | #define BUS_ID_SIZE 20 |
| 29 | 29 | ||
| 30 | struct device; | 30 | struct device; |
| 31 | struct device_private; | ||
| 31 | struct device_driver; | 32 | struct device_driver; |
| 32 | struct driver_private; | 33 | struct driver_private; |
| 33 | struct class; | 34 | struct class; |
| @@ -147,7 +148,7 @@ extern void put_driver(struct device_driver *drv); | |||
| 147 | extern struct device_driver *driver_find(const char *name, | 148 | extern struct device_driver *driver_find(const char *name, |
| 148 | struct bus_type *bus); | 149 | struct bus_type *bus); |
| 149 | extern int driver_probe_done(void); | 150 | extern int driver_probe_done(void); |
| 150 | extern int wait_for_device_probe(void); | 151 | extern void wait_for_device_probe(void); |
| 151 | 152 | ||
| 152 | 153 | ||
| 153 | /* sysfs interface for exporting driver attributes */ | 154 | /* sysfs interface for exporting driver attributes */ |
| @@ -367,15 +368,11 @@ struct device_dma_parameters { | |||
| 367 | }; | 368 | }; |
| 368 | 369 | ||
| 369 | struct device { | 370 | struct device { |
| 370 | struct klist klist_children; | ||
| 371 | struct klist_node knode_parent; /* node in sibling list */ | ||
| 372 | struct klist_node knode_driver; | ||
| 373 | struct klist_node knode_bus; | ||
| 374 | struct device *parent; | 371 | struct device *parent; |
| 375 | 372 | ||
| 373 | struct device_private *p; | ||
| 374 | |||
| 376 | struct kobject kobj; | 375 | struct kobject kobj; |
| 377 | char bus_id[BUS_ID_SIZE]; /* position on parent bus */ | ||
| 378 | unsigned uevent_suppress:1; | ||
| 379 | const char *init_name; /* initial name of the device */ | 376 | const char *init_name; /* initial name of the device */ |
| 380 | struct device_type *type; | 377 | struct device_type *type; |
| 381 | 378 | ||
| @@ -387,8 +384,13 @@ struct device { | |||
| 387 | struct device_driver *driver; /* which driver has allocated this | 384 | struct device_driver *driver; /* which driver has allocated this |
| 388 | device */ | 385 | device */ |
| 389 | void *driver_data; /* data private to the driver */ | 386 | void *driver_data; /* data private to the driver */ |
| 390 | void *platform_data; /* Platform specific data, device | 387 | |
| 391 | core doesn't touch it */ | 388 | void *platform_data; /* We will remove platform_data |
| 389 | field if all platform devices | ||
| 390 | pass its platform specific data | ||
| 391 | from platform_device->platform_data, | ||
| 392 | other kind of devices should not | ||
| 393 | use platform_data. */ | ||
| 392 | struct dev_pm_info power; | 394 | struct dev_pm_info power; |
| 393 | 395 | ||
| 394 | #ifdef CONFIG_NUMA | 396 | #ifdef CONFIG_NUMA |
| @@ -427,8 +429,7 @@ struct device { | |||
| 427 | 429 | ||
| 428 | static inline const char *dev_name(const struct device *dev) | 430 | static inline const char *dev_name(const struct device *dev) |
| 429 | { | 431 | { |
| 430 | /* will be changed into kobject_name(&dev->kobj) in the near future */ | 432 | return kobject_name(&dev->kobj); |
| 431 | return dev->bus_id; | ||
| 432 | } | 433 | } |
| 433 | 434 | ||
| 434 | extern int dev_set_name(struct device *dev, const char *name, ...) | 435 | extern int dev_set_name(struct device *dev, const char *name, ...) |
| @@ -463,6 +464,16 @@ static inline void dev_set_drvdata(struct device *dev, void *data) | |||
| 463 | dev->driver_data = data; | 464 | dev->driver_data = data; |
| 464 | } | 465 | } |
| 465 | 466 | ||
| 467 | static inline unsigned int dev_get_uevent_suppress(const struct device *dev) | ||
| 468 | { | ||
| 469 | return dev->kobj.uevent_suppress; | ||
| 470 | } | ||
| 471 | |||
| 472 | static inline void dev_set_uevent_suppress(struct device *dev, int val) | ||
| 473 | { | ||
| 474 | dev->kobj.uevent_suppress = val; | ||
| 475 | } | ||
| 476 | |||
| 466 | static inline int device_is_registered(struct device *dev) | 477 | static inline int device_is_registered(struct device *dev) |
| 467 | { | 478 | { |
| 468 | return dev->kobj.state_in_sysfs; | 479 | return dev->kobj.state_in_sysfs; |
| @@ -483,7 +494,8 @@ extern int device_for_each_child(struct device *dev, void *data, | |||
| 483 | extern struct device *device_find_child(struct device *dev, void *data, | 494 | extern struct device *device_find_child(struct device *dev, void *data, |
| 484 | int (*match)(struct device *dev, void *data)); | 495 | int (*match)(struct device *dev, void *data)); |
| 485 | extern int device_rename(struct device *dev, char *new_name); | 496 | extern int device_rename(struct device *dev, char *new_name); |
| 486 | extern int device_move(struct device *dev, struct device *new_parent); | 497 | extern int device_move(struct device *dev, struct device *new_parent, |
| 498 | enum dpm_order dpm_order); | ||
| 487 | 499 | ||
| 488 | /* | 500 | /* |
| 489 | * Root device objects for grouping under /sys/devices | 501 | * Root device objects for grouping under /sys/devices |
| @@ -570,7 +582,7 @@ extern const char *dev_driver_string(const struct device *dev); | |||
| 570 | #if defined(DEBUG) | 582 | #if defined(DEBUG) |
| 571 | #define dev_dbg(dev, format, arg...) \ | 583 | #define dev_dbg(dev, format, arg...) \ |
| 572 | dev_printk(KERN_DEBUG , dev , format , ## arg) | 584 | dev_printk(KERN_DEBUG , dev , format , ## arg) |
| 573 | #elif defined(CONFIG_DYNAMIC_PRINTK_DEBUG) | 585 | #elif defined(CONFIG_DYNAMIC_DEBUG) |
| 574 | #define dev_dbg(dev, format, ...) do { \ | 586 | #define dev_dbg(dev, format, ...) do { \ |
| 575 | dynamic_dev_dbg(dev, format, ##__VA_ARGS__); \ | 587 | dynamic_dev_dbg(dev, format, ##__VA_ARGS__); \ |
| 576 | } while (0) | 588 | } while (0) |
diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h new file mode 100644 index 000000000000..baabf33be244 --- /dev/null +++ b/include/linux/dynamic_debug.h | |||
| @@ -0,0 +1,88 @@ | |||
| 1 | #ifndef _DYNAMIC_DEBUG_H | ||
| 2 | #define _DYNAMIC_DEBUG_H | ||
| 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 | /* | ||
| 12 | * An instance of this structure is created in a special | ||
| 13 | * ELF section at every dynamic debug callsite. At runtime, | ||
| 14 | * the special section is treated as an array of these. | ||
| 15 | */ | ||
| 16 | struct _ddebug { | ||
| 17 | /* | ||
| 18 | * These fields are used to drive the user interface | ||
| 19 | * for selecting and displaying debug callsites. | ||
| 20 | */ | ||
| 21 | const char *modname; | ||
| 22 | const char *function; | ||
| 23 | const char *filename; | ||
| 24 | const char *format; | ||
| 25 | char primary_hash; | ||
| 26 | char secondary_hash; | ||
| 27 | unsigned int lineno:24; | ||
| 28 | /* | ||
| 29 | * The flags field controls the behaviour at the callsite. | ||
| 30 | * The bits here are changed dynamically when the user | ||
| 31 | * writes commands to <debugfs>/dynamic_debug/ddebug | ||
| 32 | */ | ||
| 33 | #define _DPRINTK_FLAGS_PRINT (1<<0) /* printk() a message using the format */ | ||
| 34 | #define _DPRINTK_FLAGS_DEFAULT 0 | ||
| 35 | unsigned int flags:8; | ||
| 36 | } __attribute__((aligned(8))); | ||
| 37 | |||
| 38 | |||
| 39 | int ddebug_add_module(struct _ddebug *tab, unsigned int n, | ||
| 40 | const char *modname); | ||
| 41 | |||
| 42 | #if defined(CONFIG_DYNAMIC_DEBUG) | ||
| 43 | extern int ddebug_remove_module(char *mod_name); | ||
| 44 | |||
| 45 | #define __dynamic_dbg_enabled(dd) ({ \ | ||
| 46 | int __ret = 0; \ | ||
| 47 | if (unlikely((dynamic_debug_enabled & (1LL << DEBUG_HASH)) && \ | ||
| 48 | (dynamic_debug_enabled2 & (1LL << DEBUG_HASH2)))) \ | ||
| 49 | if (unlikely(dd.flags)) \ | ||
| 50 | __ret = 1; \ | ||
| 51 | __ret; }) | ||
| 52 | |||
| 53 | #define dynamic_pr_debug(fmt, ...) do { \ | ||
| 54 | static struct _ddebug descriptor \ | ||
| 55 | __used \ | ||
| 56 | __attribute__((section("__verbose"), aligned(8))) = \ | ||
| 57 | { KBUILD_MODNAME, __func__, __FILE__, fmt, DEBUG_HASH, \ | ||
| 58 | DEBUG_HASH2, __LINE__, _DPRINTK_FLAGS_DEFAULT }; \ | ||
| 59 | if (__dynamic_dbg_enabled(descriptor)) \ | ||
| 60 | printk(KERN_DEBUG KBUILD_MODNAME ":" pr_fmt(fmt), \ | ||
| 61 | ##__VA_ARGS__); \ | ||
| 62 | } while (0) | ||
| 63 | |||
| 64 | |||
| 65 | #define dynamic_dev_dbg(dev, fmt, ...) do { \ | ||
| 66 | static struct _ddebug descriptor \ | ||
| 67 | __used \ | ||
| 68 | __attribute__((section("__verbose"), aligned(8))) = \ | ||
| 69 | { KBUILD_MODNAME, __func__, __FILE__, fmt, DEBUG_HASH, \ | ||
| 70 | DEBUG_HASH2, __LINE__, _DPRINTK_FLAGS_DEFAULT }; \ | ||
| 71 | if (__dynamic_dbg_enabled(descriptor)) \ | ||
| 72 | dev_printk(KERN_DEBUG, dev, \ | ||
| 73 | KBUILD_MODNAME ": " pr_fmt(fmt),\ | ||
| 74 | ##__VA_ARGS__); \ | ||
| 75 | } while (0) | ||
| 76 | |||
| 77 | #else | ||
| 78 | |||
| 79 | static inline int ddebug_remove_module(char *mod) | ||
| 80 | { | ||
| 81 | return 0; | ||
| 82 | } | ||
| 83 | |||
| 84 | #define dynamic_pr_debug(fmt, ...) do { } while (0) | ||
| 85 | #define dynamic_dev_dbg(dev, format, ...) do { } while (0) | ||
| 86 | #endif | ||
| 87 | |||
| 88 | #endif | ||
diff --git a/include/linux/dynamic_printk.h b/include/linux/dynamic_printk.h deleted file mode 100644 index 2d528d009074..000000000000 --- a/include/linux/dynamic_printk.h +++ /dev/null | |||
| @@ -1,93 +0,0 @@ | |||
| 1 | #ifndef _DYNAMIC_PRINTK_H | ||
| 2 | #define _DYNAMIC_PRINTK_H | ||
| 3 | |||
| 4 | #define DYNAMIC_DEBUG_HASH_BITS 6 | ||
| 5 | #define DEBUG_HASH_TABLE_SIZE (1 << DYNAMIC_DEBUG_HASH_BITS) | ||
| 6 | |||
| 7 | #define TYPE_BOOLEAN 1 | ||
| 8 | |||
| 9 | #define DYNAMIC_ENABLED_ALL 0 | ||
| 10 | #define DYNAMIC_ENABLED_NONE 1 | ||
| 11 | #define DYNAMIC_ENABLED_SOME 2 | ||
| 12 | |||
| 13 | extern int dynamic_enabled; | ||
| 14 | |||
| 15 | /* dynamic_printk_enabled, and dynamic_printk_enabled2 are bitmasks in which | ||
| 16 | * bit n is set to 1 if any modname hashes into the bucket n, 0 otherwise. They | ||
| 17 | * use independent hash functions, to reduce the chance of false positives. | ||
| 18 | */ | ||
| 19 | extern long long dynamic_printk_enabled; | ||
| 20 | extern long long dynamic_printk_enabled2; | ||
| 21 | |||
| 22 | struct mod_debug { | ||
| 23 | char *modname; | ||
| 24 | char *logical_modname; | ||
| 25 | char *flag_names; | ||
| 26 | int type; | ||
| 27 | int hash; | ||
| 28 | int hash2; | ||
| 29 | } __attribute__((aligned(8))); | ||
| 30 | |||
| 31 | int register_dynamic_debug_module(char *mod_name, int type, char *share_name, | ||
| 32 | char *flags, int hash, int hash2); | ||
| 33 | |||
| 34 | #if defined(CONFIG_DYNAMIC_PRINTK_DEBUG) | ||
| 35 | extern int unregister_dynamic_debug_module(char *mod_name); | ||
| 36 | extern int __dynamic_dbg_enabled_helper(char *modname, int type, | ||
| 37 | int value, int hash); | ||
| 38 | |||
| 39 | #define __dynamic_dbg_enabled(module, type, value, level, hash) ({ \ | ||
| 40 | int __ret = 0; \ | ||
| 41 | if (unlikely((dynamic_printk_enabled & (1LL << DEBUG_HASH)) && \ | ||
| 42 | (dynamic_printk_enabled2 & (1LL << DEBUG_HASH2)))) \ | ||
| 43 | __ret = __dynamic_dbg_enabled_helper(module, type, \ | ||
| 44 | value, hash);\ | ||
| 45 | __ret; }) | ||
| 46 | |||
| 47 | #define dynamic_pr_debug(fmt, ...) do { \ | ||
| 48 | static char mod_name[] \ | ||
| 49 | __attribute__((section("__verbose_strings"))) \ | ||
| 50 | = KBUILD_MODNAME; \ | ||
| 51 | static struct mod_debug descriptor \ | ||
| 52 | __used \ | ||
| 53 | __attribute__((section("__verbose"), aligned(8))) = \ | ||
| 54 | { mod_name, mod_name, NULL, TYPE_BOOLEAN, DEBUG_HASH, DEBUG_HASH2 };\ | ||
| 55 | if (__dynamic_dbg_enabled(KBUILD_MODNAME, TYPE_BOOLEAN, \ | ||
| 56 | 0, 0, DEBUG_HASH)) \ | ||
| 57 | printk(KERN_DEBUG KBUILD_MODNAME ":" fmt, \ | ||
| 58 | ##__VA_ARGS__); \ | ||
| 59 | } while (0) | ||
| 60 | |||
| 61 | #define dynamic_dev_dbg(dev, format, ...) do { \ | ||
| 62 | static char mod_name[] \ | ||
| 63 | __attribute__((section("__verbose_strings"))) \ | ||
| 64 | = KBUILD_MODNAME; \ | ||
| 65 | static struct mod_debug descriptor \ | ||
| 66 | __used \ | ||
| 67 | __attribute__((section("__verbose"), aligned(8))) = \ | ||
| 68 | { mod_name, mod_name, NULL, TYPE_BOOLEAN, DEBUG_HASH, DEBUG_HASH2 };\ | ||
| 69 | if (__dynamic_dbg_enabled(KBUILD_MODNAME, TYPE_BOOLEAN, \ | ||
| 70 | 0, 0, DEBUG_HASH)) \ | ||
| 71 | dev_printk(KERN_DEBUG, dev, \ | ||
| 72 | KBUILD_MODNAME ": " format, \ | ||
| 73 | ##__VA_ARGS__); \ | ||
| 74 | } while (0) | ||
| 75 | |||
| 76 | #else | ||
| 77 | |||
| 78 | static inline int unregister_dynamic_debug_module(const char *mod_name) | ||
| 79 | { | ||
| 80 | return 0; | ||
| 81 | } | ||
| 82 | static inline int __dynamic_dbg_enabled_helper(char *modname, int type, | ||
| 83 | int value, int hash) | ||
| 84 | { | ||
| 85 | return 0; | ||
| 86 | } | ||
| 87 | |||
| 88 | #define __dynamic_dbg_enabled(module, type, value, level, hash) ({ 0; }) | ||
| 89 | #define dynamic_pr_debug(fmt, ...) do { } while (0) | ||
| 90 | #define dynamic_dev_dbg(dev, format, ...) do { } while (0) | ||
| 91 | #endif | ||
| 92 | |||
| 93 | #endif | ||
diff --git a/include/linux/kernel.h b/include/linux/kernel.h index 7fa371898e3e..914918abfdd1 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h | |||
| @@ -16,7 +16,7 @@ | |||
| 16 | #include <linux/log2.h> | 16 | #include <linux/log2.h> |
| 17 | #include <linux/typecheck.h> | 17 | #include <linux/typecheck.h> |
| 18 | #include <linux/ratelimit.h> | 18 | #include <linux/ratelimit.h> |
| 19 | #include <linux/dynamic_printk.h> | 19 | #include <linux/dynamic_debug.h> |
| 20 | #include <asm/byteorder.h> | 20 | #include <asm/byteorder.h> |
| 21 | #include <asm/bug.h> | 21 | #include <asm/bug.h> |
| 22 | 22 | ||
| @@ -358,9 +358,10 @@ static inline char *pack_hex_byte(char *buf, u8 byte) | |||
| 358 | #if defined(DEBUG) | 358 | #if defined(DEBUG) |
| 359 | #define pr_debug(fmt, ...) \ | 359 | #define pr_debug(fmt, ...) \ |
| 360 | printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) | 360 | printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) |
| 361 | #elif defined(CONFIG_DYNAMIC_PRINTK_DEBUG) | 361 | #elif defined(CONFIG_DYNAMIC_DEBUG) |
| 362 | /* dynamic_pr_debug() uses pr_fmt() internally so we don't need it here */ | ||
| 362 | #define pr_debug(fmt, ...) do { \ | 363 | #define pr_debug(fmt, ...) do { \ |
| 363 | dynamic_pr_debug(pr_fmt(fmt), ##__VA_ARGS__); \ | 364 | dynamic_pr_debug(fmt, ##__VA_ARGS__); \ |
| 364 | } while (0) | 365 | } while (0) |
| 365 | #else | 366 | #else |
| 366 | #define pr_debug(fmt, ...) \ | 367 | #define pr_debug(fmt, ...) \ |
diff --git a/include/linux/kobject.h b/include/linux/kobject.h index 5437ac0276e2..58ae8e00fcdd 100644 --- a/include/linux/kobject.h +++ b/include/linux/kobject.h | |||
| @@ -68,10 +68,13 @@ struct kobject { | |||
| 68 | unsigned int state_in_sysfs:1; | 68 | unsigned int state_in_sysfs:1; |
| 69 | unsigned int state_add_uevent_sent:1; | 69 | unsigned int state_add_uevent_sent:1; |
| 70 | unsigned int state_remove_uevent_sent:1; | 70 | unsigned int state_remove_uevent_sent:1; |
| 71 | unsigned int uevent_suppress:1; | ||
| 71 | }; | 72 | }; |
| 72 | 73 | ||
| 73 | extern int kobject_set_name(struct kobject *kobj, const char *name, ...) | 74 | extern int kobject_set_name(struct kobject *kobj, const char *name, ...) |
| 74 | __attribute__((format(printf, 2, 3))); | 75 | __attribute__((format(printf, 2, 3))); |
| 76 | extern int kobject_set_name_vargs(struct kobject *kobj, const char *fmt, | ||
| 77 | va_list vargs); | ||
| 75 | 78 | ||
| 76 | static inline const char *kobject_name(const struct kobject *kobj) | 79 | static inline const char *kobject_name(const struct kobject *kobj) |
| 77 | { | 80 | { |
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h index fde86671f48f..1bf5900ffe43 100644 --- a/include/linux/mod_devicetable.h +++ b/include/linux/mod_devicetable.h | |||
| @@ -454,4 +454,13 @@ struct dmi_system_id { | |||
| 454 | 454 | ||
| 455 | #define DMI_MATCH(a, b) { a, b } | 455 | #define DMI_MATCH(a, b) { a, b } |
| 456 | 456 | ||
| 457 | #define PLATFORM_NAME_SIZE 20 | ||
| 458 | #define PLATFORM_MODULE_PREFIX "platform:" | ||
| 459 | |||
| 460 | struct platform_device_id { | ||
| 461 | char name[PLATFORM_NAME_SIZE]; | ||
| 462 | kernel_ulong_t driver_data | ||
| 463 | __attribute__((aligned(sizeof(kernel_ulong_t)))); | ||
| 464 | }; | ||
| 465 | |||
| 457 | #endif /* LINUX_MOD_DEVICETABLE_H */ | 466 | #endif /* LINUX_MOD_DEVICETABLE_H */ |
diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h index 9a342699c607..76e470a299bf 100644 --- a/include/linux/platform_device.h +++ b/include/linux/platform_device.h | |||
| @@ -12,6 +12,7 @@ | |||
| 12 | #define _PLATFORM_DEVICE_H_ | 12 | #define _PLATFORM_DEVICE_H_ |
| 13 | 13 | ||
| 14 | #include <linux/device.h> | 14 | #include <linux/device.h> |
| 15 | #include <linux/mod_devicetable.h> | ||
| 15 | 16 | ||
| 16 | struct platform_device { | 17 | struct platform_device { |
| 17 | const char * name; | 18 | const char * name; |
| @@ -19,8 +20,13 @@ struct platform_device { | |||
| 19 | struct device dev; | 20 | struct device dev; |
| 20 | u32 num_resources; | 21 | u32 num_resources; |
| 21 | struct resource * resource; | 22 | struct resource * resource; |
| 23 | void *platform_data; | ||
| 24 | |||
| 25 | struct platform_device_id *id_entry; | ||
| 22 | }; | 26 | }; |
| 23 | 27 | ||
| 28 | #define platform_get_device_id(pdev) ((pdev)->id_entry) | ||
| 29 | |||
| 24 | #define to_platform_device(x) container_of((x), struct platform_device, dev) | 30 | #define to_platform_device(x) container_of((x), struct platform_device, dev) |
| 25 | 31 | ||
| 26 | extern int platform_device_register(struct platform_device *); | 32 | extern int platform_device_register(struct platform_device *); |
| @@ -56,6 +62,7 @@ struct platform_driver { | |||
| 56 | int (*resume_early)(struct platform_device *); | 62 | int (*resume_early)(struct platform_device *); |
| 57 | int (*resume)(struct platform_device *); | 63 | int (*resume)(struct platform_device *); |
| 58 | struct device_driver driver; | 64 | struct device_driver driver; |
| 65 | struct platform_device_id *id_table; | ||
| 59 | }; | 66 | }; |
| 60 | 67 | ||
| 61 | extern int platform_driver_register(struct platform_driver *); | 68 | extern int platform_driver_register(struct platform_driver *); |
diff --git a/include/linux/pm.h b/include/linux/pm.h index 24ba5f67b3a3..1d4e2d289821 100644 --- a/include/linux/pm.h +++ b/include/linux/pm.h | |||
| @@ -400,6 +400,9 @@ extern void __suspend_report_result(const char *function, void *fn, int ret); | |||
| 400 | 400 | ||
| 401 | #else /* !CONFIG_PM_SLEEP */ | 401 | #else /* !CONFIG_PM_SLEEP */ |
| 402 | 402 | ||
| 403 | #define device_pm_lock() do {} while (0) | ||
| 404 | #define device_pm_unlock() do {} while (0) | ||
| 405 | |||
| 403 | static inline int device_suspend(pm_message_t state) | 406 | static inline int device_suspend(pm_message_t state) |
| 404 | { | 407 | { |
| 405 | return 0; | 408 | return 0; |
| @@ -409,6 +412,14 @@ static inline int device_suspend(pm_message_t state) | |||
| 409 | 412 | ||
| 410 | #endif /* !CONFIG_PM_SLEEP */ | 413 | #endif /* !CONFIG_PM_SLEEP */ |
| 411 | 414 | ||
| 415 | /* How to reorder dpm_list after device_move() */ | ||
| 416 | enum dpm_order { | ||
| 417 | DPM_ORDER_NONE, | ||
| 418 | DPM_ORDER_DEV_AFTER_PARENT, | ||
| 419 | DPM_ORDER_PARENT_BEFORE_DEV, | ||
| 420 | DPM_ORDER_DEV_LAST, | ||
| 421 | }; | ||
| 422 | |||
| 412 | /* | 423 | /* |
| 413 | * Global Power Management flags | 424 | * Global Power Management flags |
| 414 | * Used to keep APM and ACPI from both being active | 425 | * Used to keep APM and ACPI from both being active |
diff --git a/include/linux/uio_driver.h b/include/linux/uio_driver.h index a0bb6bd2e5c1..5dcc9ff72f69 100644 --- a/include/linux/uio_driver.h +++ b/include/linux/uio_driver.h | |||
| @@ -22,6 +22,7 @@ struct uio_map; | |||
| 22 | 22 | ||
| 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 | * @addr: address of the device's memory | 26 | * @addr: address of the device's memory |
| 26 | * @size: size of IO | 27 | * @size: size of IO |
| 27 | * @memtype: type of memory addr points to | 28 | * @memtype: type of memory addr points to |
| @@ -29,6 +30,7 @@ struct uio_map; | |||
| 29 | * @map: for use by the UIO core only. | 30 | * @map: for use by the UIO core only. |
| 30 | */ | 31 | */ |
| 31 | struct uio_mem { | 32 | struct uio_mem { |
| 33 | const char *name; | ||
| 32 | unsigned long addr; | 34 | unsigned long addr; |
| 33 | unsigned long size; | 35 | unsigned long size; |
| 34 | int memtype; | 36 | int memtype; |
| @@ -42,12 +44,14 @@ struct uio_portio; | |||
| 42 | 44 | ||
| 43 | /** | 45 | /** |
| 44 | * struct uio_port - description of a UIO port region | 46 | * struct uio_port - description of a UIO port region |
| 47 | * @name: name of the port region for identification | ||
| 45 | * @start: start of port region | 48 | * @start: start of port region |
| 46 | * @size: size of port region | 49 | * @size: size of port region |
| 47 | * @porttype: type of port (see UIO_PORT_* below) | 50 | * @porttype: type of port (see UIO_PORT_* below) |
| 48 | * @portio: for use by the UIO core only. | 51 | * @portio: for use by the UIO core only. |
| 49 | */ | 52 | */ |
| 50 | struct uio_port { | 53 | struct uio_port { |
| 54 | const char *name; | ||
| 51 | unsigned long start; | 55 | unsigned long start; |
| 52 | unsigned long size; | 56 | unsigned long size; |
| 53 | int porttype; | 57 | int porttype; |
diff --git a/include/linux/wimax/debug.h b/include/linux/wimax/debug.h index ba0c49399a83..c703e0340423 100644 --- a/include/linux/wimax/debug.h +++ b/include/linux/wimax/debug.h | |||
| @@ -178,7 +178,7 @@ void __d_head(char *head, size_t head_size, | |||
| 178 | WARN_ON(1); | 178 | WARN_ON(1); |
| 179 | } else | 179 | } else |
| 180 | snprintf(head, head_size, "%s %s: ", | 180 | snprintf(head, head_size, "%s %s: ", |
| 181 | dev_driver_string(dev), dev->bus_id); | 181 | dev_driver_string(dev), dev_name(dev)); |
| 182 | } | 182 | } |
| 183 | 183 | ||
| 184 | 184 | ||
diff --git a/kernel/module.c b/kernel/module.c index 1196f5d11700..77672233387f 100644 --- a/kernel/module.c +++ b/kernel/module.c | |||
| @@ -822,7 +822,7 @@ SYSCALL_DEFINE2(delete_module, const char __user *, name_user, | |||
| 822 | mutex_lock(&module_mutex); | 822 | mutex_lock(&module_mutex); |
| 823 | /* Store the name of the last unloaded module for diagnostic purposes */ | 823 | /* Store the name of the last unloaded module for diagnostic purposes */ |
| 824 | strlcpy(last_unloaded_module, mod->name, sizeof(last_unloaded_module)); | 824 | strlcpy(last_unloaded_module, mod->name, sizeof(last_unloaded_module)); |
| 825 | unregister_dynamic_debug_module(mod->name); | 825 | ddebug_remove_module(mod->name); |
| 826 | free_module(mod); | 826 | free_module(mod); |
| 827 | 827 | ||
| 828 | out: | 828 | out: |
| @@ -1827,19 +1827,13 @@ static inline void add_kallsyms(struct module *mod, | |||
| 1827 | } | 1827 | } |
| 1828 | #endif /* CONFIG_KALLSYMS */ | 1828 | #endif /* CONFIG_KALLSYMS */ |
| 1829 | 1829 | ||
| 1830 | static void dynamic_printk_setup(struct mod_debug *debug, unsigned int num) | 1830 | static void dynamic_debug_setup(struct _ddebug *debug, unsigned int num) |
| 1831 | { | 1831 | { |
| 1832 | #ifdef CONFIG_DYNAMIC_PRINTK_DEBUG | 1832 | #ifdef CONFIG_DYNAMIC_DEBUG |
| 1833 | unsigned int i; | 1833 | if (ddebug_add_module(debug, num, debug->modname)) |
| 1834 | 1834 | printk(KERN_ERR "dynamic debug error adding module: %s\n", | |
| 1835 | for (i = 0; i < num; i++) { | 1835 | debug->modname); |
| 1836 | register_dynamic_debug_module(debug[i].modname, | 1836 | #endif |
| 1837 | debug[i].type, | ||
| 1838 | debug[i].logical_modname, | ||
| 1839 | debug[i].flag_names, | ||
| 1840 | debug[i].hash, debug[i].hash2); | ||
| 1841 | } | ||
| 1842 | #endif /* CONFIG_DYNAMIC_PRINTK_DEBUG */ | ||
| 1843 | } | 1837 | } |
| 1844 | 1838 | ||
| 1845 | static void *module_alloc_update_bounds(unsigned long size) | 1839 | static void *module_alloc_update_bounds(unsigned long size) |
| @@ -2213,12 +2207,13 @@ static noinline struct module *load_module(void __user *umod, | |||
| 2213 | add_kallsyms(mod, sechdrs, symindex, strindex, secstrings); | 2207 | add_kallsyms(mod, sechdrs, symindex, strindex, secstrings); |
| 2214 | 2208 | ||
| 2215 | if (!mod->taints) { | 2209 | if (!mod->taints) { |
| 2216 | struct mod_debug *debug; | 2210 | struct _ddebug *debug; |
| 2217 | unsigned int num_debug; | 2211 | unsigned int num_debug; |
| 2218 | 2212 | ||
| 2219 | debug = section_objs(hdr, sechdrs, secstrings, "__verbose", | 2213 | debug = section_objs(hdr, sechdrs, secstrings, "__verbose", |
| 2220 | sizeof(*debug), &num_debug); | 2214 | sizeof(*debug), &num_debug); |
| 2221 | dynamic_printk_setup(debug, num_debug); | 2215 | if (debug) |
| 2216 | dynamic_debug_setup(debug, num_debug); | ||
| 2222 | } | 2217 | } |
| 2223 | 2218 | ||
| 2224 | /* sechdrs[0].sh_size is always zero */ | 2219 | /* sechdrs[0].sh_size is always zero */ |
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index 1bcf9cd4baa0..8fee0a13ac58 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug | |||
| @@ -847,60 +847,70 @@ config BUILD_DOCSRC | |||
| 847 | 847 | ||
| 848 | Say N if you are unsure. | 848 | Say N if you are unsure. |
| 849 | 849 | ||
| 850 | config DYNAMIC_PRINTK_DEBUG | 850 | config DYNAMIC_DEBUG |
| 851 | bool "Enable dynamic printk() call support" | 851 | bool "Enable dynamic printk() support" |
| 852 | default n | 852 | default n |
| 853 | depends on PRINTK | 853 | depends on PRINTK |
| 854 | depends on DEBUG_FS | ||
| 854 | select PRINTK_DEBUG | 855 | select PRINTK_DEBUG |
| 855 | help | 856 | help |
| 856 | 857 | ||
| 857 | Compiles debug level messages into the kernel, which would not | 858 | Compiles debug level messages into the kernel, which would not |
| 858 | otherwise be available at runtime. These messages can then be | 859 | otherwise be available at runtime. These messages can then be |
| 859 | enabled/disabled on a per module basis. This mechanism implicitly | 860 | enabled/disabled based on various levels of scope - per source file, |
| 860 | enables all pr_debug() and dev_dbg() calls. The impact of this | 861 | function, module, format string, and line number. This mechanism |
| 861 | compile option is a larger kernel text size of about 2%. | 862 | implicitly enables all pr_debug() and dev_dbg() calls. The impact of |
| 863 | this compile option is a larger kernel text size of about 2%. | ||
| 862 | 864 | ||
| 863 | Usage: | 865 | Usage: |
| 864 | 866 | ||
| 865 | Dynamic debugging is controlled by the debugfs file, | 867 | Dynamic debugging is controlled via the 'dynamic_debug/ddebug' file, |
| 866 | dynamic_printk/modules. This file contains a list of the modules that | 868 | which is contained in the 'debugfs' filesystem. Thus, the debugfs |
| 867 | can be enabled. The format of the file is the module name, followed | 869 | filesystem must first be mounted before making use of this feature. |
| 868 | by a set of flags that can be enabled. The first flag is always the | 870 | We refer the control file as: <debugfs>/dynamic_debug/ddebug. This |
| 869 | 'enabled' flag. For example: | 871 | file contains a list of the debug statements that can be enabled. The |
| 872 | format for each line of the file is: | ||
| 870 | 873 | ||
| 871 | <module_name> <enabled=0/1> | 874 | filename:lineno [module]function flags format |
| 872 | . | ||
| 873 | . | ||
| 874 | . | ||
| 875 | 875 | ||
| 876 | <module_name> : Name of the module in which the debug call resides | 876 | filename : source file of the debug statement |
| 877 | <enabled=0/1> : whether the messages are enabled or not | 877 | lineno : line number of the debug statement |
| 878 | module : module that contains the debug statement | ||
| 879 | function : function that contains the debug statement | ||
| 880 | flags : 'p' means the line is turned 'on' for printing | ||
| 881 | format : the format used for the debug statement | ||
| 878 | 882 | ||
| 879 | From a live system: | 883 | From a live system: |
| 880 | 884 | ||
| 881 | snd_hda_intel enabled=0 | 885 | nullarbor:~ # cat <debugfs>/dynamic_debug/ddebug |
| 882 | fixup enabled=0 | 886 | # filename:lineno [module]function flags format |
| 883 | driver enabled=0 | 887 | fs/aio.c:222 [aio]__put_ioctx - "__put_ioctx:\040freeing\040%p\012" |
| 888 | fs/aio.c:248 [aio]ioctx_alloc - "ENOMEM:\040nr_events\040too\040high\012" | ||
| 889 | fs/aio.c:1770 [aio]sys_io_cancel - "calling\040cancel\012" | ||
| 884 | 890 | ||
| 885 | Enable a module: | 891 | Example usage: |
| 886 | 892 | ||
| 887 | $echo "set enabled=1 <module_name>" > dynamic_printk/modules | 893 | // enable the message at line 1603 of file svcsock.c |
| 894 | nullarbor:~ # echo -n 'file svcsock.c line 1603 +p' > | ||
| 895 | <debugfs>/dynamic_debug/ddebug | ||
| 888 | 896 | ||
| 889 | Disable a module: | 897 | // enable all the messages in file svcsock.c |
| 898 | nullarbor:~ # echo -n 'file svcsock.c +p' > | ||
| 899 | <debugfs>/dynamic_debug/ddebug | ||
| 890 | 900 | ||
| 891 | $echo "set enabled=0 <module_name>" > dynamic_printk/modules | 901 | // enable all the messages in the NFS server module |
| 902 | nullarbor:~ # echo -n 'module nfsd +p' > | ||
| 903 | <debugfs>/dynamic_debug/ddebug | ||
| 892 | 904 | ||
| 893 | Enable all modules: | 905 | // enable all 12 messages in the function svc_process() |
| 906 | nullarbor:~ # echo -n 'func svc_process +p' > | ||
| 907 | <debugfs>/dynamic_debug/ddebug | ||
| 894 | 908 | ||
| 895 | $echo "set enabled=1 all" > dynamic_printk/modules | 909 | // disable all 12 messages in the function svc_process() |
| 910 | nullarbor:~ # echo -n 'func svc_process -p' > | ||
| 911 | <debugfs>/dynamic_debug/ddebug | ||
| 896 | 912 | ||
| 897 | Disable all modules: | 913 | See Documentation/dynamic-debug-howto.txt for additional information. |
| 898 | |||
| 899 | $echo "set enabled=0 all" > dynamic_printk/modules | ||
| 900 | |||
| 901 | Finally, passing "dynamic_printk" at the command line enables | ||
| 902 | debugging for all modules. This mode can be turned off via the above | ||
| 903 | disable command. | ||
| 904 | 914 | ||
| 905 | source "samples/Kconfig" | 915 | source "samples/Kconfig" |
| 906 | 916 | ||
diff --git a/lib/Makefile b/lib/Makefile index b2c09da02cae..0dd9229fab7e 100644 --- a/lib/Makefile +++ b/lib/Makefile | |||
| @@ -82,7 +82,7 @@ obj-$(CONFIG_HAVE_LMB) += lmb.o | |||
| 82 | 82 | ||
| 83 | obj-$(CONFIG_HAVE_ARCH_TRACEHOOK) += syscall.o | 83 | obj-$(CONFIG_HAVE_ARCH_TRACEHOOK) += syscall.o |
| 84 | 84 | ||
| 85 | obj-$(CONFIG_DYNAMIC_PRINTK_DEBUG) += dynamic_printk.o | 85 | obj-$(CONFIG_DYNAMIC_DEBUG) += dynamic_debug.o |
| 86 | 86 | ||
| 87 | obj-$(CONFIG_NLATTR) += nlattr.o | 87 | obj-$(CONFIG_NLATTR) += nlattr.o |
| 88 | 88 | ||
diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c new file mode 100644 index 000000000000..833139ce1e22 --- /dev/null +++ b/lib/dynamic_debug.c | |||
| @@ -0,0 +1,769 @@ | |||
| 1 | /* | ||
| 2 | * lib/dynamic_debug.c | ||
| 3 | * | ||
| 4 | * make pr_debug()/dev_dbg() calls runtime configurable based upon their | ||
| 5 | * source module. | ||
| 6 | * | ||
| 7 | * Copyright (C) 2008 Jason Baron <jbaron@redhat.com> | ||
| 8 | * By Greg Banks <gnb@melbourne.sgi.com> | ||
| 9 | * Copyright (c) 2008 Silicon Graphics Inc. All Rights Reserved. | ||
| 10 | */ | ||
| 11 | |||
| 12 | #include <linux/kernel.h> | ||
| 13 | #include <linux/module.h> | ||
| 14 | #include <linux/moduleparam.h> | ||
| 15 | #include <linux/kallsyms.h> | ||
| 16 | #include <linux/version.h> | ||
| 17 | #include <linux/types.h> | ||
| 18 | #include <linux/mutex.h> | ||
| 19 | #include <linux/proc_fs.h> | ||
| 20 | #include <linux/seq_file.h> | ||
| 21 | #include <linux/list.h> | ||
| 22 | #include <linux/sysctl.h> | ||
| 23 | #include <linux/ctype.h> | ||
| 24 | #include <linux/uaccess.h> | ||
| 25 | #include <linux/dynamic_debug.h> | ||
| 26 | #include <linux/debugfs.h> | ||
| 27 | |||
| 28 | extern struct _ddebug __start___verbose[]; | ||
| 29 | extern struct _ddebug __stop___verbose[]; | ||
| 30 | |||
| 31 | /* dynamic_debug_enabled, and dynamic_debug_enabled2 are bitmasks in which | ||
| 32 | * bit n is set to 1 if any modname hashes into the bucket n, 0 otherwise. They | ||
| 33 | * use independent hash functions, to reduce the chance of false positives. | ||
| 34 | */ | ||
| 35 | long long dynamic_debug_enabled; | ||
| 36 | EXPORT_SYMBOL_GPL(dynamic_debug_enabled); | ||
| 37 | long long dynamic_debug_enabled2; | ||
| 38 | EXPORT_SYMBOL_GPL(dynamic_debug_enabled2); | ||
| 39 | |||
| 40 | struct ddebug_table { | ||
| 41 | struct list_head link; | ||
| 42 | char *mod_name; | ||
| 43 | unsigned int num_ddebugs; | ||
| 44 | unsigned int num_enabled; | ||
| 45 | struct _ddebug *ddebugs; | ||
| 46 | }; | ||
| 47 | |||
| 48 | struct ddebug_query { | ||
| 49 | const char *filename; | ||
| 50 | const char *module; | ||
| 51 | const char *function; | ||
| 52 | const char *format; | ||
| 53 | unsigned int first_lineno, last_lineno; | ||
| 54 | }; | ||
| 55 | |||
| 56 | struct ddebug_iter { | ||
| 57 | struct ddebug_table *table; | ||
| 58 | unsigned int idx; | ||
| 59 | }; | ||
| 60 | |||
| 61 | static DEFINE_MUTEX(ddebug_lock); | ||
| 62 | static LIST_HEAD(ddebug_tables); | ||
| 63 | static int verbose = 0; | ||
| 64 | |||
| 65 | /* Return the last part of a pathname */ | ||
| 66 | static inline const char *basename(const char *path) | ||
| 67 | { | ||
| 68 | const char *tail = strrchr(path, '/'); | ||
| 69 | return tail ? tail+1 : path; | ||
| 70 | } | ||
| 71 | |||
| 72 | /* format a string into buf[] which describes the _ddebug's flags */ | ||
| 73 | static char *ddebug_describe_flags(struct _ddebug *dp, char *buf, | ||
| 74 | size_t maxlen) | ||
| 75 | { | ||
| 76 | char *p = buf; | ||
| 77 | |||
| 78 | BUG_ON(maxlen < 4); | ||
| 79 | if (dp->flags & _DPRINTK_FLAGS_PRINT) | ||
| 80 | *p++ = 'p'; | ||
| 81 | if (p == buf) | ||
| 82 | *p++ = '-'; | ||
| 83 | *p = '\0'; | ||
| 84 | |||
| 85 | return buf; | ||
| 86 | } | ||
| 87 | |||
| 88 | /* | ||
| 89 | * must be called with ddebug_lock held | ||
| 90 | */ | ||
| 91 | |||
| 92 | static int disabled_hash(char hash, bool first_table) | ||
| 93 | { | ||
| 94 | struct ddebug_table *dt; | ||
| 95 | char table_hash_value; | ||
| 96 | |||
| 97 | list_for_each_entry(dt, &ddebug_tables, link) { | ||
| 98 | if (first_table) | ||
| 99 | table_hash_value = dt->ddebugs->primary_hash; | ||
| 100 | else | ||
| 101 | table_hash_value = dt->ddebugs->secondary_hash; | ||
| 102 | if (dt->num_enabled && (hash == table_hash_value)) | ||
| 103 | return 0; | ||
| 104 | } | ||
| 105 | return 1; | ||
| 106 | } | ||
| 107 | |||
| 108 | /* | ||
| 109 | * Search the tables for _ddebug's which match the given | ||
| 110 | * `query' and apply the `flags' and `mask' to them. Tells | ||
| 111 | * the user which ddebug's were changed, or whether none | ||
| 112 | * were matched. | ||
| 113 | */ | ||
| 114 | static void ddebug_change(const struct ddebug_query *query, | ||
| 115 | unsigned int flags, unsigned int mask) | ||
| 116 | { | ||
| 117 | int i; | ||
| 118 | struct ddebug_table *dt; | ||
| 119 | unsigned int newflags; | ||
| 120 | unsigned int nfound = 0; | ||
| 121 | char flagbuf[8]; | ||
| 122 | |||
| 123 | /* search for matching ddebugs */ | ||
| 124 | mutex_lock(&ddebug_lock); | ||
| 125 | list_for_each_entry(dt, &ddebug_tables, link) { | ||
| 126 | |||
| 127 | /* match against the module name */ | ||
| 128 | if (query->module != NULL && | ||
| 129 | strcmp(query->module, dt->mod_name)) | ||
| 130 | continue; | ||
| 131 | |||
| 132 | for (i = 0 ; i < dt->num_ddebugs ; i++) { | ||
| 133 | struct _ddebug *dp = &dt->ddebugs[i]; | ||
| 134 | |||
| 135 | /* match against the source filename */ | ||
| 136 | if (query->filename != NULL && | ||
| 137 | strcmp(query->filename, dp->filename) && | ||
| 138 | strcmp(query->filename, basename(dp->filename))) | ||
| 139 | continue; | ||
| 140 | |||
| 141 | /* match against the function */ | ||
| 142 | if (query->function != NULL && | ||
| 143 | strcmp(query->function, dp->function)) | ||
| 144 | continue; | ||
| 145 | |||
| 146 | /* match against the format */ | ||
| 147 | if (query->format != NULL && | ||
| 148 | strstr(dp->format, query->format) == NULL) | ||
| 149 | continue; | ||
| 150 | |||
| 151 | /* match against the line number range */ | ||
| 152 | if (query->first_lineno && | ||
| 153 | dp->lineno < query->first_lineno) | ||
| 154 | continue; | ||
| 155 | if (query->last_lineno && | ||
| 156 | dp->lineno > query->last_lineno) | ||
| 157 | continue; | ||
| 158 | |||
| 159 | nfound++; | ||
| 160 | |||
| 161 | newflags = (dp->flags & mask) | flags; | ||
| 162 | if (newflags == dp->flags) | ||
| 163 | continue; | ||
| 164 | |||
| 165 | if (!newflags) | ||
| 166 | dt->num_enabled--; | ||
| 167 | else if (!dp-flags) | ||
| 168 | dt->num_enabled++; | ||
| 169 | dp->flags = newflags; | ||
| 170 | if (newflags) { | ||
| 171 | dynamic_debug_enabled |= | ||
| 172 | (1LL << dp->primary_hash); | ||
| 173 | dynamic_debug_enabled2 |= | ||
| 174 | (1LL << dp->secondary_hash); | ||
| 175 | } else { | ||
| 176 | if (disabled_hash(dp->primary_hash, true)) | ||
| 177 | dynamic_debug_enabled &= | ||
| 178 | ~(1LL << dp->primary_hash); | ||
| 179 | if (disabled_hash(dp->secondary_hash, false)) | ||
| 180 | dynamic_debug_enabled2 &= | ||
| 181 | ~(1LL << dp->secondary_hash); | ||
| 182 | } | ||
| 183 | if (verbose) | ||
| 184 | printk(KERN_INFO | ||
| 185 | "ddebug: changed %s:%d [%s]%s %s\n", | ||
| 186 | dp->filename, dp->lineno, | ||
| 187 | dt->mod_name, dp->function, | ||
| 188 | ddebug_describe_flags(dp, flagbuf, | ||
| 189 | sizeof(flagbuf))); | ||
| 190 | } | ||
| 191 | } | ||
| 192 | mutex_unlock(&ddebug_lock); | ||
| 193 | |||
| 194 | if (!nfound && verbose) | ||
| 195 | printk(KERN_INFO "ddebug: no matches for query\n"); | ||
| 196 | } | ||
| 197 | |||
| 198 | /* | ||
| 199 | * Split the buffer `buf' into space-separated words. | ||
| 200 | * Handles simple " and ' quoting, i.e. without nested, | ||
| 201 | * embedded or escaped \". Return the number of words | ||
| 202 | * or <0 on error. | ||
| 203 | */ | ||
| 204 | static int ddebug_tokenize(char *buf, char *words[], int maxwords) | ||
| 205 | { | ||
| 206 | int nwords = 0; | ||
| 207 | |||
| 208 | while (*buf) { | ||
| 209 | char *end; | ||
| 210 | |||
| 211 | /* Skip leading whitespace */ | ||
| 212 | while (*buf && isspace(*buf)) | ||
| 213 | buf++; | ||
| 214 | if (!*buf) | ||
| 215 | break; /* oh, it was trailing whitespace */ | ||
| 216 | |||
| 217 | /* Run `end' over a word, either whitespace separated or quoted */ | ||
| 218 | if (*buf == '"' || *buf == '\'') { | ||
| 219 | int quote = *buf++; | ||
| 220 | for (end = buf ; *end && *end != quote ; end++) | ||
| 221 | ; | ||
| 222 | if (!*end) | ||
| 223 | return -EINVAL; /* unclosed quote */ | ||
| 224 | } else { | ||
| 225 | for (end = buf ; *end && !isspace(*end) ; end++) | ||
| 226 | ; | ||
| 227 | BUG_ON(end == buf); | ||
| 228 | } | ||
| 229 | /* Here `buf' is the start of the word, `end' is one past the end */ | ||
| 230 | |||
| 231 | if (nwords == maxwords) | ||
| 232 | return -EINVAL; /* ran out of words[] before bytes */ | ||
| 233 | if (*end) | ||
| 234 | *end++ = '\0'; /* terminate the word */ | ||
| 235 | words[nwords++] = buf; | ||
| 236 | buf = end; | ||
| 237 | } | ||
| 238 | |||
| 239 | if (verbose) { | ||
| 240 | int i; | ||
| 241 | printk(KERN_INFO "%s: split into words:", __func__); | ||
| 242 | for (i = 0 ; i < nwords ; i++) | ||
| 243 | printk(" \"%s\"", words[i]); | ||
| 244 | printk("\n"); | ||
| 245 | } | ||
| 246 | |||
| 247 | return nwords; | ||
| 248 | } | ||
| 249 | |||
| 250 | /* | ||
| 251 | * Parse a single line number. Note that the empty string "" | ||
| 252 | * is treated as a special case and converted to zero, which | ||
| 253 | * is later treated as a "don't care" value. | ||
| 254 | */ | ||
| 255 | static inline int parse_lineno(const char *str, unsigned int *val) | ||
| 256 | { | ||
| 257 | char *end = NULL; | ||
| 258 | BUG_ON(str == NULL); | ||
| 259 | if (*str == '\0') { | ||
| 260 | *val = 0; | ||
| 261 | return 0; | ||
| 262 | } | ||
| 263 | *val = simple_strtoul(str, &end, 10); | ||
| 264 | return end == NULL || end == str || *end != '\0' ? -EINVAL : 0; | ||
| 265 | } | ||
| 266 | |||
| 267 | /* | ||
| 268 | * Undo octal escaping in a string, inplace. This is useful to | ||
| 269 | * allow the user to express a query which matches a format | ||
| 270 | * containing embedded spaces. | ||
| 271 | */ | ||
| 272 | #define isodigit(c) ((c) >= '0' && (c) <= '7') | ||
| 273 | static char *unescape(char *str) | ||
| 274 | { | ||
| 275 | char *in = str; | ||
| 276 | char *out = str; | ||
| 277 | |||
| 278 | while (*in) { | ||
| 279 | if (*in == '\\') { | ||
| 280 | if (in[1] == '\\') { | ||
| 281 | *out++ = '\\'; | ||
| 282 | in += 2; | ||
| 283 | continue; | ||
| 284 | } else if (in[1] == 't') { | ||
| 285 | *out++ = '\t'; | ||
| 286 | in += 2; | ||
| 287 | continue; | ||
| 288 | } else if (in[1] == 'n') { | ||
| 289 | *out++ = '\n'; | ||
| 290 | in += 2; | ||
| 291 | continue; | ||
| 292 | } else if (isodigit(in[1]) && | ||
| 293 | isodigit(in[2]) && | ||
| 294 | isodigit(in[3])) { | ||
| 295 | *out++ = ((in[1] - '0')<<6) | | ||
| 296 | ((in[2] - '0')<<3) | | ||
| 297 | (in[3] - '0'); | ||
| 298 | in += 4; | ||
| 299 | continue; | ||
| 300 | } | ||
| 301 | } | ||
| 302 | *out++ = *in++; | ||
| 303 | } | ||
| 304 | *out = '\0'; | ||
| 305 | |||
| 306 | return str; | ||
| 307 | } | ||
| 308 | |||
| 309 | /* | ||
| 310 | * Parse words[] as a ddebug query specification, which is a series | ||
| 311 | * of (keyword, value) pairs chosen from these possibilities: | ||
| 312 | * | ||
| 313 | * func <function-name> | ||
| 314 | * file <full-pathname> | ||
| 315 | * file <base-filename> | ||
| 316 | * module <module-name> | ||
| 317 | * format <escaped-string-to-find-in-format> | ||
| 318 | * line <lineno> | ||
| 319 | * line <first-lineno>-<last-lineno> // where either may be empty | ||
| 320 | */ | ||
| 321 | static int ddebug_parse_query(char *words[], int nwords, | ||
| 322 | struct ddebug_query *query) | ||
| 323 | { | ||
| 324 | unsigned int i; | ||
| 325 | |||
| 326 | /* check we have an even number of words */ | ||
| 327 | if (nwords % 2 != 0) | ||
| 328 | return -EINVAL; | ||
| 329 | memset(query, 0, sizeof(*query)); | ||
| 330 | |||
| 331 | for (i = 0 ; i < nwords ; i += 2) { | ||
| 332 | if (!strcmp(words[i], "func")) | ||
| 333 | query->function = words[i+1]; | ||
| 334 | else if (!strcmp(words[i], "file")) | ||
| 335 | query->filename = words[i+1]; | ||
| 336 | else if (!strcmp(words[i], "module")) | ||
| 337 | query->module = words[i+1]; | ||
| 338 | else if (!strcmp(words[i], "format")) | ||
| 339 | query->format = unescape(words[i+1]); | ||
| 340 | else if (!strcmp(words[i], "line")) { | ||
| 341 | char *first = words[i+1]; | ||
| 342 | char *last = strchr(first, '-'); | ||
| 343 | if (last) | ||
| 344 | *last++ = '\0'; | ||
| 345 | if (parse_lineno(first, &query->first_lineno) < 0) | ||
| 346 | return -EINVAL; | ||
| 347 | if (last != NULL) { | ||
| 348 | /* range <first>-<last> */ | ||
| 349 | if (parse_lineno(last, &query->last_lineno) < 0) | ||
| 350 | return -EINVAL; | ||
| 351 | } else { | ||
| 352 | query->last_lineno = query->first_lineno; | ||
| 353 | } | ||
| 354 | } else { | ||
| 355 | if (verbose) | ||
| 356 | printk(KERN_ERR "%s: unknown keyword \"%s\"\n", | ||
| 357 | __func__, words[i]); | ||
| 358 | return -EINVAL; | ||
| 359 | } | ||
| 360 | } | ||
| 361 | |||
| 362 | if (verbose) | ||
| 363 | printk(KERN_INFO "%s: q->function=\"%s\" q->filename=\"%s\" " | ||
| 364 | "q->module=\"%s\" q->format=\"%s\" q->lineno=%u-%u\n", | ||
| 365 | __func__, query->function, query->filename, | ||
| 366 | query->module, query->format, query->first_lineno, | ||
| 367 | query->last_lineno); | ||
| 368 | |||
| 369 | return 0; | ||
| 370 | } | ||
| 371 | |||
| 372 | /* | ||
| 373 | * Parse `str' as a flags specification, format [-+=][p]+. | ||
| 374 | * Sets up *maskp and *flagsp to be used when changing the | ||
| 375 | * flags fields of matched _ddebug's. Returns 0 on success | ||
| 376 | * or <0 on error. | ||
| 377 | */ | ||
| 378 | static int ddebug_parse_flags(const char *str, unsigned int *flagsp, | ||
| 379 | unsigned int *maskp) | ||
| 380 | { | ||
| 381 | unsigned flags = 0; | ||
| 382 | int op = '='; | ||
| 383 | |||
| 384 | switch (*str) { | ||
| 385 | case '+': | ||
| 386 | case '-': | ||
| 387 | case '=': | ||
| 388 | op = *str++; | ||
| 389 | break; | ||
| 390 | default: | ||
| 391 | return -EINVAL; | ||
| 392 | } | ||
| 393 | if (verbose) | ||
| 394 | printk(KERN_INFO "%s: op='%c'\n", __func__, op); | ||
| 395 | |||
| 396 | for ( ; *str ; ++str) { | ||
| 397 | switch (*str) { | ||
| 398 | case 'p': | ||
| 399 | flags |= _DPRINTK_FLAGS_PRINT; | ||
| 400 | break; | ||
| 401 | default: | ||
| 402 | return -EINVAL; | ||
| 403 | } | ||
| 404 | } | ||
| 405 | if (flags == 0) | ||
| 406 | return -EINVAL; | ||
| 407 | if (verbose) | ||
| 408 | printk(KERN_INFO "%s: flags=0x%x\n", __func__, flags); | ||
| 409 | |||
| 410 | /* calculate final *flagsp, *maskp according to mask and op */ | ||
| 411 | switch (op) { | ||
| 412 | case '=': | ||
| 413 | *maskp = 0; | ||
| 414 | *flagsp = flags; | ||
| 415 | break; | ||
| 416 | case '+': | ||
| 417 | *maskp = ~0U; | ||
| 418 | *flagsp = flags; | ||
| 419 | break; | ||
| 420 | case '-': | ||
| 421 | *maskp = ~flags; | ||
| 422 | *flagsp = 0; | ||
| 423 | break; | ||
| 424 | } | ||
| 425 | if (verbose) | ||
| 426 | printk(KERN_INFO "%s: *flagsp=0x%x *maskp=0x%x\n", | ||
| 427 | __func__, *flagsp, *maskp); | ||
| 428 | return 0; | ||
| 429 | } | ||
| 430 | |||
| 431 | /* | ||
| 432 | * File_ops->write method for <debugfs>/dynamic_debug/conrol. Gathers the | ||
| 433 | * command text from userspace, parses and executes it. | ||
| 434 | */ | ||
| 435 | static ssize_t ddebug_proc_write(struct file *file, const char __user *ubuf, | ||
| 436 | size_t len, loff_t *offp) | ||
| 437 | { | ||
| 438 | unsigned int flags = 0, mask = 0; | ||
| 439 | struct ddebug_query query; | ||
| 440 | #define MAXWORDS 9 | ||
| 441 | int nwords; | ||
| 442 | char *words[MAXWORDS]; | ||
| 443 | char tmpbuf[256]; | ||
| 444 | |||
| 445 | if (len == 0) | ||
| 446 | return 0; | ||
| 447 | /* we don't check *offp -- multiple writes() are allowed */ | ||
| 448 | if (len > sizeof(tmpbuf)-1) | ||
| 449 | return -E2BIG; | ||
| 450 | if (copy_from_user(tmpbuf, ubuf, len)) | ||
| 451 | return -EFAULT; | ||
| 452 | tmpbuf[len] = '\0'; | ||
| 453 | if (verbose) | ||
| 454 | printk(KERN_INFO "%s: read %d bytes from userspace\n", | ||
| 455 | __func__, (int)len); | ||
| 456 | |||
| 457 | nwords = ddebug_tokenize(tmpbuf, words, MAXWORDS); | ||
| 458 | if (nwords < 0) | ||
| 459 | return -EINVAL; | ||
| 460 | if (ddebug_parse_query(words, nwords-1, &query)) | ||
| 461 | return -EINVAL; | ||
| 462 | if (ddebug_parse_flags(words[nwords-1], &flags, &mask)) | ||
| 463 | return -EINVAL; | ||
| 464 | |||
| 465 | /* actually go and implement the change */ | ||
| 466 | ddebug_change(&query, flags, mask); | ||
| 467 | |||
| 468 | *offp += len; | ||
| 469 | return len; | ||
| 470 | } | ||
| 471 | |||
| 472 | /* | ||
| 473 | * Set the iterator to point to the first _ddebug object | ||
| 474 | * and return a pointer to that first object. Returns | ||
| 475 | * NULL if there are no _ddebugs at all. | ||
| 476 | */ | ||
| 477 | static struct _ddebug *ddebug_iter_first(struct ddebug_iter *iter) | ||
| 478 | { | ||
| 479 | if (list_empty(&ddebug_tables)) { | ||
| 480 | iter->table = NULL; | ||
| 481 | iter->idx = 0; | ||
| 482 | return NULL; | ||
| 483 | } | ||
| 484 | iter->table = list_entry(ddebug_tables.next, | ||
| 485 | struct ddebug_table, link); | ||
| 486 | iter->idx = 0; | ||
| 487 | return &iter->table->ddebugs[iter->idx]; | ||
| 488 | } | ||
| 489 | |||
| 490 | /* | ||
| 491 | * Advance the iterator to point to the next _ddebug | ||
| 492 | * object from the one the iterator currently points at, | ||
| 493 | * and returns a pointer to the new _ddebug. Returns | ||
| 494 | * NULL if the iterator has seen all the _ddebugs. | ||
| 495 | */ | ||
| 496 | static struct _ddebug *ddebug_iter_next(struct ddebug_iter *iter) | ||
| 497 | { | ||
| 498 | if (iter->table == NULL) | ||
| 499 | return NULL; | ||
| 500 | if (++iter->idx == iter->table->num_ddebugs) { | ||
| 501 | /* iterate to next table */ | ||
| 502 | iter->idx = 0; | ||
| 503 | if (list_is_last(&iter->table->link, &ddebug_tables)) { | ||
| 504 | iter->table = NULL; | ||
| 505 | return NULL; | ||
| 506 | } | ||
| 507 | iter->table = list_entry(iter->table->link.next, | ||
| 508 | struct ddebug_table, link); | ||
| 509 | } | ||
| 510 | return &iter->table->ddebugs[iter->idx]; | ||
| 511 | } | ||
| 512 | |||
| 513 | /* | ||
| 514 | * Seq_ops start method. Called at the start of every | ||
| 515 | * read() call from userspace. Takes the ddebug_lock and | ||
| 516 | * seeks the seq_file's iterator to the given position. | ||
| 517 | */ | ||
| 518 | static void *ddebug_proc_start(struct seq_file *m, loff_t *pos) | ||
| 519 | { | ||
| 520 | struct ddebug_iter *iter = m->private; | ||
| 521 | struct _ddebug *dp; | ||
| 522 | int n = *pos; | ||
| 523 | |||
| 524 | if (verbose) | ||
| 525 | printk(KERN_INFO "%s: called m=%p *pos=%lld\n", | ||
| 526 | __func__, m, (unsigned long long)*pos); | ||
| 527 | |||
| 528 | mutex_lock(&ddebug_lock); | ||
| 529 | |||
| 530 | if (!n) | ||
| 531 | return SEQ_START_TOKEN; | ||
| 532 | if (n < 0) | ||
| 533 | return NULL; | ||
| 534 | dp = ddebug_iter_first(iter); | ||
| 535 | while (dp != NULL && --n > 0) | ||
| 536 | dp = ddebug_iter_next(iter); | ||
| 537 | return dp; | ||
| 538 | } | ||
| 539 | |||
| 540 | /* | ||
| 541 | * Seq_ops next method. Called several times within a read() | ||
| 542 | * call from userspace, with ddebug_lock held. Walks to the | ||
| 543 | * next _ddebug object with a special case for the header line. | ||
| 544 | */ | ||
| 545 | static void *ddebug_proc_next(struct seq_file *m, void *p, loff_t *pos) | ||
| 546 | { | ||
| 547 | struct ddebug_iter *iter = m->private; | ||
| 548 | struct _ddebug *dp; | ||
| 549 | |||
| 550 | if (verbose) | ||
| 551 | printk(KERN_INFO "%s: called m=%p p=%p *pos=%lld\n", | ||
| 552 | __func__, m, p, (unsigned long long)*pos); | ||
| 553 | |||
| 554 | if (p == SEQ_START_TOKEN) | ||
| 555 | dp = ddebug_iter_first(iter); | ||
| 556 | else | ||
| 557 | dp = ddebug_iter_next(iter); | ||
| 558 | ++*pos; | ||
| 559 | return dp; | ||
| 560 | } | ||
| 561 | |||
| 562 | /* | ||
| 563 | * Seq_ops show method. Called several times within a read() | ||
| 564 | * call from userspace, with ddebug_lock held. Formats the | ||
| 565 | * current _ddebug as a single human-readable line, with a | ||
| 566 | * special case for the header line. | ||
| 567 | */ | ||
| 568 | static int ddebug_proc_show(struct seq_file *m, void *p) | ||
| 569 | { | ||
| 570 | struct ddebug_iter *iter = m->private; | ||
| 571 | struct _ddebug *dp = p; | ||
| 572 | char flagsbuf[8]; | ||
| 573 | |||
| 574 | if (verbose) | ||
| 575 | printk(KERN_INFO "%s: called m=%p p=%p\n", | ||
| 576 | __func__, m, p); | ||
| 577 | |||
| 578 | if (p == SEQ_START_TOKEN) { | ||
| 579 | seq_puts(m, | ||
| 580 | "# filename:lineno [module]function flags format\n"); | ||
| 581 | return 0; | ||
| 582 | } | ||
| 583 | |||
| 584 | seq_printf(m, "%s:%u [%s]%s %s \"", | ||
| 585 | dp->filename, dp->lineno, | ||
| 586 | iter->table->mod_name, dp->function, | ||
| 587 | ddebug_describe_flags(dp, flagsbuf, sizeof(flagsbuf))); | ||
| 588 | seq_escape(m, dp->format, "\t\r\n\""); | ||
| 589 | seq_puts(m, "\"\n"); | ||
| 590 | |||
| 591 | return 0; | ||
| 592 | } | ||
| 593 | |||
| 594 | /* | ||
| 595 | * Seq_ops stop method. Called at the end of each read() | ||
| 596 | * call from userspace. Drops ddebug_lock. | ||
| 597 | */ | ||
| 598 | static void ddebug_proc_stop(struct seq_file *m, void *p) | ||
| 599 | { | ||
| 600 | if (verbose) | ||
| 601 | printk(KERN_INFO "%s: called m=%p p=%p\n", | ||
| 602 | __func__, m, p); | ||
| 603 | mutex_unlock(&ddebug_lock); | ||
| 604 | } | ||
| 605 | |||
| 606 | static const struct seq_operations ddebug_proc_seqops = { | ||
| 607 | .start = ddebug_proc_start, | ||
| 608 | .next = ddebug_proc_next, | ||
| 609 | .show = ddebug_proc_show, | ||
| 610 | .stop = ddebug_proc_stop | ||
| 611 | }; | ||
| 612 | |||
| 613 | /* | ||
| 614 | * File_ops->open method for <debugfs>/dynamic_debug/control. Does the seq_file | ||
| 615 | * setup dance, and also creates an iterator to walk the _ddebugs. | ||
| 616 | * Note that we create a seq_file always, even for O_WRONLY files | ||
| 617 | * where it's not needed, as doing so simplifies the ->release method. | ||
| 618 | */ | ||
| 619 | static int ddebug_proc_open(struct inode *inode, struct file *file) | ||
| 620 | { | ||
| 621 | struct ddebug_iter *iter; | ||
| 622 | int err; | ||
| 623 | |||
| 624 | if (verbose) | ||
| 625 | printk(KERN_INFO "%s: called\n", __func__); | ||
| 626 | |||
| 627 | iter = kzalloc(sizeof(*iter), GFP_KERNEL); | ||
| 628 | if (iter == NULL) | ||
| 629 | return -ENOMEM; | ||
| 630 | |||
| 631 | err = seq_open(file, &ddebug_proc_seqops); | ||
| 632 | if (err) { | ||
| 633 | kfree(iter); | ||
| 634 | return err; | ||
| 635 | } | ||
| 636 | ((struct seq_file *) file->private_data)->private = iter; | ||
| 637 | return 0; | ||
| 638 | } | ||
| 639 | |||
| 640 | static const struct file_operations ddebug_proc_fops = { | ||
| 641 | .owner = THIS_MODULE, | ||
| 642 | .open = ddebug_proc_open, | ||
| 643 | .read = seq_read, | ||
| 644 | .llseek = seq_lseek, | ||
| 645 | .release = seq_release_private, | ||
| 646 | .write = ddebug_proc_write | ||
| 647 | }; | ||
| 648 | |||
| 649 | /* | ||
| 650 | * Allocate a new ddebug_table for the given module | ||
| 651 | * and add it to the global list. | ||
| 652 | */ | ||
| 653 | int ddebug_add_module(struct _ddebug *tab, unsigned int n, | ||
| 654 | const char *name) | ||
| 655 | { | ||
| 656 | struct ddebug_table *dt; | ||
| 657 | char *new_name; | ||
| 658 | |||
| 659 | dt = kzalloc(sizeof(*dt), GFP_KERNEL); | ||
| 660 | if (dt == NULL) | ||
| 661 | return -ENOMEM; | ||
| 662 | new_name = kstrdup(name, GFP_KERNEL); | ||
| 663 | if (new_name == NULL) { | ||
| 664 | kfree(dt); | ||
| 665 | return -ENOMEM; | ||
| 666 | } | ||
| 667 | dt->mod_name = new_name; | ||
| 668 | dt->num_ddebugs = n; | ||
| 669 | dt->num_enabled = 0; | ||
| 670 | dt->ddebugs = tab; | ||
| 671 | |||
| 672 | mutex_lock(&ddebug_lock); | ||
| 673 | list_add_tail(&dt->link, &ddebug_tables); | ||
| 674 | mutex_unlock(&ddebug_lock); | ||
| 675 | |||
| 676 | if (verbose) | ||
| 677 | printk(KERN_INFO "%u debug prints in module %s\n", | ||
| 678 | n, dt->mod_name); | ||
| 679 | return 0; | ||
| 680 | } | ||
| 681 | EXPORT_SYMBOL_GPL(ddebug_add_module); | ||
| 682 | |||
| 683 | static void ddebug_table_free(struct ddebug_table *dt) | ||
| 684 | { | ||
| 685 | list_del_init(&dt->link); | ||
| 686 | kfree(dt->mod_name); | ||
| 687 | kfree(dt); | ||
| 688 | } | ||
| 689 | |||
| 690 | /* | ||
| 691 | * Called in response to a module being unloaded. Removes | ||
| 692 | * any ddebug_table's which point at the module. | ||
| 693 | */ | ||
| 694 | int ddebug_remove_module(char *mod_name) | ||
| 695 | { | ||
| 696 | struct ddebug_table *dt, *nextdt; | ||
| 697 | int ret = -ENOENT; | ||
| 698 | |||
| 699 | if (verbose) | ||
| 700 | printk(KERN_INFO "%s: removing module \"%s\"\n", | ||
| 701 | __func__, mod_name); | ||
| 702 | |||
| 703 | mutex_lock(&ddebug_lock); | ||
| 704 | list_for_each_entry_safe(dt, nextdt, &ddebug_tables, link) { | ||
| 705 | if (!strcmp(dt->mod_name, mod_name)) { | ||
| 706 | ddebug_table_free(dt); | ||
| 707 | ret = 0; | ||
| 708 | } | ||
| 709 | } | ||
| 710 | mutex_unlock(&ddebug_lock); | ||
| 711 | return ret; | ||
| 712 | } | ||
| 713 | EXPORT_SYMBOL_GPL(ddebug_remove_module); | ||
| 714 | |||
| 715 | static void ddebug_remove_all_tables(void) | ||
| 716 | { | ||
| 717 | mutex_lock(&ddebug_lock); | ||
| 718 | while (!list_empty(&ddebug_tables)) { | ||
| 719 | struct ddebug_table *dt = list_entry(ddebug_tables.next, | ||
| 720 | struct ddebug_table, | ||
| 721 | link); | ||
| 722 | ddebug_table_free(dt); | ||
| 723 | } | ||
| 724 | mutex_unlock(&ddebug_lock); | ||
| 725 | } | ||
| 726 | |||
| 727 | static int __init dynamic_debug_init(void) | ||
| 728 | { | ||
| 729 | struct dentry *dir, *file; | ||
| 730 | struct _ddebug *iter, *iter_start; | ||
| 731 | const char *modname = NULL; | ||
| 732 | int ret = 0; | ||
| 733 | int n = 0; | ||
| 734 | |||
| 735 | dir = debugfs_create_dir("dynamic_debug", NULL); | ||
| 736 | if (!dir) | ||
| 737 | return -ENOMEM; | ||
| 738 | file = debugfs_create_file("control", 0644, dir, NULL, | ||
| 739 | &ddebug_proc_fops); | ||
| 740 | if (!file) { | ||
| 741 | debugfs_remove(dir); | ||
| 742 | return -ENOMEM; | ||
| 743 | } | ||
| 744 | if (__start___verbose != __stop___verbose) { | ||
| 745 | iter = __start___verbose; | ||
| 746 | modname = iter->modname; | ||
| 747 | iter_start = iter; | ||
| 748 | for (; iter < __stop___verbose; iter++) { | ||
| 749 | if (strcmp(modname, iter->modname)) { | ||
| 750 | ret = ddebug_add_module(iter_start, n, modname); | ||
| 751 | if (ret) | ||
| 752 | goto out_free; | ||
| 753 | n = 0; | ||
| 754 | modname = iter->modname; | ||
| 755 | iter_start = iter; | ||
| 756 | } | ||
| 757 | n++; | ||
| 758 | } | ||
| 759 | ret = ddebug_add_module(iter_start, n, modname); | ||
| 760 | } | ||
| 761 | out_free: | ||
| 762 | if (ret) { | ||
| 763 | ddebug_remove_all_tables(); | ||
| 764 | debugfs_remove(dir); | ||
| 765 | debugfs_remove(file); | ||
| 766 | } | ||
| 767 | return 0; | ||
| 768 | } | ||
| 769 | module_init(dynamic_debug_init); | ||
diff --git a/lib/dynamic_printk.c b/lib/dynamic_printk.c deleted file mode 100644 index 165a19763dc9..000000000000 --- a/lib/dynamic_printk.c +++ /dev/null | |||
| @@ -1,414 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * lib/dynamic_printk.c | ||
| 3 | * | ||
| 4 | * make pr_debug()/dev_dbg() calls runtime configurable based upon their | ||
| 5 | * their source module. | ||
| 6 | * | ||
| 7 | * Copyright (C) 2008 Red Hat, Inc., Jason Baron <jbaron@redhat.com> | ||
| 8 | */ | ||
| 9 | |||
| 10 | #include <linux/kernel.h> | ||
| 11 | #include <linux/module.h> | ||
| 12 | #include <linux/uaccess.h> | ||
| 13 | #include <linux/seq_file.h> | ||
| 14 | #include <linux/debugfs.h> | ||
| 15 | #include <linux/fs.h> | ||
| 16 | |||
| 17 | extern struct mod_debug __start___verbose[]; | ||
| 18 | extern struct mod_debug __stop___verbose[]; | ||
| 19 | |||
| 20 | struct debug_name { | ||
| 21 | struct hlist_node hlist; | ||
| 22 | struct hlist_node hlist2; | ||
| 23 | int hash1; | ||
| 24 | int hash2; | ||
| 25 | char *name; | ||
| 26 | int enable; | ||
| 27 | int type; | ||
| 28 | }; | ||
| 29 | |||
| 30 | static int nr_entries; | ||
| 31 | static int num_enabled; | ||
| 32 | int dynamic_enabled = DYNAMIC_ENABLED_NONE; | ||
| 33 | static struct hlist_head module_table[DEBUG_HASH_TABLE_SIZE] = | ||
| 34 | { [0 ... DEBUG_HASH_TABLE_SIZE-1] = HLIST_HEAD_INIT }; | ||
| 35 | static struct hlist_head module_table2[DEBUG_HASH_TABLE_SIZE] = | ||
| 36 | { [0 ... DEBUG_HASH_TABLE_SIZE-1] = HLIST_HEAD_INIT }; | ||
| 37 | static DECLARE_MUTEX(debug_list_mutex); | ||
| 38 | |||
| 39 | /* dynamic_printk_enabled, and dynamic_printk_enabled2 are bitmasks in which | ||
| 40 | * bit n is set to 1 if any modname hashes into the bucket n, 0 otherwise. They | ||
| 41 | * use independent hash functions, to reduce the chance of false positives. | ||
| 42 | */ | ||
| 43 | long long dynamic_printk_enabled; | ||
| 44 | EXPORT_SYMBOL_GPL(dynamic_printk_enabled); | ||
| 45 | long long dynamic_printk_enabled2; | ||
| 46 | EXPORT_SYMBOL_GPL(dynamic_printk_enabled2); | ||
| 47 | |||
| 48 | /* returns the debug module pointer. */ | ||
| 49 | static struct debug_name *find_debug_module(char *module_name) | ||
| 50 | { | ||
| 51 | int i; | ||
| 52 | struct hlist_head *head; | ||
| 53 | struct hlist_node *node; | ||
| 54 | struct debug_name *element; | ||
| 55 | |||
| 56 | element = NULL; | ||
| 57 | for (i = 0; i < DEBUG_HASH_TABLE_SIZE; i++) { | ||
| 58 | head = &module_table[i]; | ||
| 59 | hlist_for_each_entry_rcu(element, node, head, hlist) | ||
| 60 | if (!strcmp(element->name, module_name)) | ||
| 61 | return element; | ||
| 62 | } | ||
| 63 | return NULL; | ||
| 64 | } | ||
| 65 | |||
| 66 | /* returns the debug module pointer. */ | ||
| 67 | static struct debug_name *find_debug_module_hash(char *module_name, int hash) | ||
| 68 | { | ||
| 69 | struct hlist_head *head; | ||
| 70 | struct hlist_node *node; | ||
| 71 | struct debug_name *element; | ||
| 72 | |||
| 73 | element = NULL; | ||
| 74 | head = &module_table[hash]; | ||
| 75 | hlist_for_each_entry_rcu(element, node, head, hlist) | ||
| 76 | if (!strcmp(element->name, module_name)) | ||
| 77 | return element; | ||
| 78 | return NULL; | ||
| 79 | } | ||
| 80 | |||
| 81 | /* caller must hold mutex*/ | ||
| 82 | static int __add_debug_module(char *mod_name, int hash, int hash2) | ||
| 83 | { | ||
| 84 | struct debug_name *new; | ||
| 85 | char *module_name; | ||
| 86 | int ret = 0; | ||
| 87 | |||
| 88 | if (find_debug_module(mod_name)) { | ||
| 89 | ret = -EINVAL; | ||
| 90 | goto out; | ||
| 91 | } | ||
| 92 | module_name = kmalloc(strlen(mod_name) + 1, GFP_KERNEL); | ||
| 93 | if (!module_name) { | ||
| 94 | ret = -ENOMEM; | ||
| 95 | goto out; | ||
| 96 | } | ||
| 97 | module_name = strcpy(module_name, mod_name); | ||
| 98 | module_name[strlen(mod_name)] = '\0'; | ||
| 99 | new = kzalloc(sizeof(struct debug_name), GFP_KERNEL); | ||
| 100 | if (!new) { | ||
| 101 | kfree(module_name); | ||
| 102 | ret = -ENOMEM; | ||
| 103 | goto out; | ||
| 104 | } | ||
| 105 | INIT_HLIST_NODE(&new->hlist); | ||
| 106 | INIT_HLIST_NODE(&new->hlist2); | ||
| 107 | new->name = module_name; | ||
| 108 | new->hash1 = hash; | ||
| 109 | new->hash2 = hash2; | ||
| 110 | hlist_add_head_rcu(&new->hlist, &module_table[hash]); | ||
| 111 | hlist_add_head_rcu(&new->hlist2, &module_table2[hash2]); | ||
| 112 | nr_entries++; | ||
| 113 | out: | ||
| 114 | return ret; | ||
| 115 | } | ||
| 116 | |||
| 117 | int unregister_dynamic_debug_module(char *mod_name) | ||
| 118 | { | ||
| 119 | struct debug_name *element; | ||
| 120 | int ret = 0; | ||
| 121 | |||
| 122 | down(&debug_list_mutex); | ||
| 123 | element = find_debug_module(mod_name); | ||
| 124 | if (!element) { | ||
| 125 | ret = -EINVAL; | ||
| 126 | goto out; | ||
| 127 | } | ||
| 128 | hlist_del_rcu(&element->hlist); | ||
| 129 | hlist_del_rcu(&element->hlist2); | ||
| 130 | synchronize_rcu(); | ||
| 131 | kfree(element->name); | ||
| 132 | if (element->enable) | ||
| 133 | num_enabled--; | ||
| 134 | kfree(element); | ||
| 135 | nr_entries--; | ||
| 136 | out: | ||
| 137 | up(&debug_list_mutex); | ||
| 138 | return ret; | ||
| 139 | } | ||
| 140 | EXPORT_SYMBOL_GPL(unregister_dynamic_debug_module); | ||
| 141 | |||
| 142 | int register_dynamic_debug_module(char *mod_name, int type, char *share_name, | ||
| 143 | char *flags, int hash, int hash2) | ||
| 144 | { | ||
| 145 | struct debug_name *elem; | ||
| 146 | int ret = 0; | ||
| 147 | |||
| 148 | down(&debug_list_mutex); | ||
| 149 | elem = find_debug_module(mod_name); | ||
| 150 | if (!elem) { | ||
| 151 | if (__add_debug_module(mod_name, hash, hash2)) | ||
| 152 | goto out; | ||
| 153 | elem = find_debug_module(mod_name); | ||
| 154 | if (dynamic_enabled == DYNAMIC_ENABLED_ALL && | ||
| 155 | !strcmp(mod_name, share_name)) { | ||
| 156 | elem->enable = true; | ||
| 157 | num_enabled++; | ||
| 158 | } | ||
| 159 | } | ||
| 160 | elem->type |= type; | ||
| 161 | out: | ||
| 162 | up(&debug_list_mutex); | ||
| 163 | return ret; | ||
| 164 | } | ||
| 165 | EXPORT_SYMBOL_GPL(register_dynamic_debug_module); | ||
| 166 | |||
| 167 | int __dynamic_dbg_enabled_helper(char *mod_name, int type, int value, int hash) | ||
| 168 | { | ||
| 169 | struct debug_name *elem; | ||
| 170 | int ret = 0; | ||
| 171 | |||
| 172 | if (dynamic_enabled == DYNAMIC_ENABLED_ALL) | ||
| 173 | return 1; | ||
| 174 | rcu_read_lock(); | ||
| 175 | elem = find_debug_module_hash(mod_name, hash); | ||
| 176 | if (elem && elem->enable) | ||
| 177 | ret = 1; | ||
| 178 | rcu_read_unlock(); | ||
| 179 | return ret; | ||
| 180 | } | ||
| 181 | EXPORT_SYMBOL_GPL(__dynamic_dbg_enabled_helper); | ||
| 182 | |||
| 183 | static void set_all(bool enable) | ||
| 184 | { | ||
| 185 | struct debug_name *e; | ||
| 186 | struct hlist_node *node; | ||
| 187 | int i; | ||
| 188 | long long enable_mask; | ||
| 189 | |||
| 190 | for (i = 0; i < DEBUG_HASH_TABLE_SIZE; i++) { | ||
| 191 | if (module_table[i].first != NULL) { | ||
| 192 | hlist_for_each_entry(e, node, &module_table[i], hlist) { | ||
| 193 | e->enable = enable; | ||
| 194 | } | ||
| 195 | } | ||
| 196 | } | ||
| 197 | if (enable) | ||
| 198 | enable_mask = ULLONG_MAX; | ||
| 199 | else | ||
| 200 | enable_mask = 0; | ||
| 201 | dynamic_printk_enabled = enable_mask; | ||
| 202 | dynamic_printk_enabled2 = enable_mask; | ||
| 203 | } | ||
| 204 | |||
| 205 | static int disabled_hash(int i, bool first_table) | ||
| 206 | { | ||
| 207 | struct debug_name *e; | ||
| 208 | struct hlist_node *node; | ||
| 209 | |||
| 210 | if (first_table) { | ||
| 211 | hlist_for_each_entry(e, node, &module_table[i], hlist) { | ||
| 212 | if (e->enable) | ||
| 213 | return 0; | ||
| 214 | } | ||
| 215 | } else { | ||
| 216 | hlist_for_each_entry(e, node, &module_table2[i], hlist2) { | ||
| 217 | if (e->enable) | ||
| 218 | return 0; | ||
| 219 | } | ||
| 220 | } | ||
| 221 | return 1; | ||
| 222 | } | ||
| 223 | |||
| 224 | static ssize_t pr_debug_write(struct file *file, const char __user *buf, | ||
| 225 | size_t length, loff_t *ppos) | ||
| 226 | { | ||
| 227 | char *buffer, *s, *value_str, *setting_str; | ||
| 228 | int err, value; | ||
| 229 | struct debug_name *elem = NULL; | ||
| 230 | int all = 0; | ||
| 231 | |||
| 232 | if (length > PAGE_SIZE || length < 0) | ||
| 233 | return -EINVAL; | ||
| 234 | |||
| 235 | buffer = (char *)__get_free_page(GFP_KERNEL); | ||
| 236 | if (!buffer) | ||
| 237 | return -ENOMEM; | ||
| 238 | |||
| 239 | err = -EFAULT; | ||
| 240 | if (copy_from_user(buffer, buf, length)) | ||
| 241 | goto out; | ||
| 242 | |||
| 243 | err = -EINVAL; | ||
| 244 | if (length < PAGE_SIZE) | ||
| 245 | buffer[length] = '\0'; | ||
| 246 | else if (buffer[PAGE_SIZE-1]) | ||
| 247 | goto out; | ||
| 248 | |||
| 249 | err = -EINVAL; | ||
| 250 | down(&debug_list_mutex); | ||
| 251 | |||
| 252 | if (strncmp("set", buffer, 3)) | ||
| 253 | goto out_up; | ||
| 254 | s = buffer + 3; | ||
| 255 | setting_str = strsep(&s, "="); | ||
| 256 | if (s == NULL) | ||
| 257 | goto out_up; | ||
| 258 | setting_str = strstrip(setting_str); | ||
| 259 | value_str = strsep(&s, " "); | ||
| 260 | if (s == NULL) | ||
| 261 | goto out_up; | ||
| 262 | s = strstrip(s); | ||
| 263 | if (!strncmp(s, "all", 3)) | ||
| 264 | all = 1; | ||
| 265 | else | ||
| 266 | elem = find_debug_module(s); | ||
| 267 | if (!strncmp(setting_str, "enable", 6)) { | ||
| 268 | value = !!simple_strtol(value_str, NULL, 10); | ||
| 269 | if (all) { | ||
| 270 | if (value) { | ||
| 271 | set_all(true); | ||
| 272 | num_enabled = nr_entries; | ||
| 273 | dynamic_enabled = DYNAMIC_ENABLED_ALL; | ||
| 274 | } else { | ||
| 275 | set_all(false); | ||
| 276 | num_enabled = 0; | ||
| 277 | dynamic_enabled = DYNAMIC_ENABLED_NONE; | ||
| 278 | } | ||
| 279 | err = 0; | ||
| 280 | } else if (elem) { | ||
| 281 | if (value && (elem->enable == 0)) { | ||
| 282 | dynamic_printk_enabled |= (1LL << elem->hash1); | ||
| 283 | dynamic_printk_enabled2 |= (1LL << elem->hash2); | ||
| 284 | elem->enable = 1; | ||
| 285 | num_enabled++; | ||
| 286 | dynamic_enabled = DYNAMIC_ENABLED_SOME; | ||
| 287 | err = 0; | ||
| 288 | printk(KERN_DEBUG | ||
| 289 | "debugging enabled for module %s\n", | ||
| 290 | elem->name); | ||
| 291 | } else if (!value && (elem->enable == 1)) { | ||
| 292 | elem->enable = 0; | ||
| 293 | num_enabled--; | ||
| 294 | if (disabled_hash(elem->hash1, true)) | ||
| 295 | dynamic_printk_enabled &= | ||
| 296 | ~(1LL << elem->hash1); | ||
| 297 | if (disabled_hash(elem->hash2, false)) | ||
| 298 | dynamic_printk_enabled2 &= | ||
| 299 | ~(1LL << elem->hash2); | ||
| 300 | if (num_enabled) | ||
| 301 | dynamic_enabled = DYNAMIC_ENABLED_SOME; | ||
| 302 | else | ||
| 303 | dynamic_enabled = DYNAMIC_ENABLED_NONE; | ||
| 304 | err = 0; | ||
| 305 | printk(KERN_DEBUG | ||
| 306 | "debugging disabled for module %s\n", | ||
| 307 | elem->name); | ||
| 308 | } | ||
| 309 | } | ||
| 310 | } | ||
| 311 | if (!err) | ||
| 312 | err = length; | ||
| 313 | out_up: | ||
| 314 | up(&debug_list_mutex); | ||
| 315 | out: | ||
| 316 | free_page((unsigned long)buffer); | ||
| 317 | return err; | ||
| 318 | } | ||
| 319 | |||
| 320 | static void *pr_debug_seq_start(struct seq_file *f, loff_t *pos) | ||
| 321 | { | ||
| 322 | return (*pos < DEBUG_HASH_TABLE_SIZE) ? pos : NULL; | ||
| 323 | } | ||
| 324 | |||
| 325 | static void *pr_debug_seq_next(struct seq_file *s, void *v, loff_t *pos) | ||
| 326 | { | ||
| 327 | (*pos)++; | ||
| 328 | if (*pos >= DEBUG_HASH_TABLE_SIZE) | ||
| 329 | return NULL; | ||
| 330 | return pos; | ||
| 331 | } | ||
| 332 | |||
| 333 | static void pr_debug_seq_stop(struct seq_file *s, void *v) | ||
| 334 | { | ||
| 335 | /* Nothing to do */ | ||
| 336 | } | ||
| 337 | |||
| 338 | static int pr_debug_seq_show(struct seq_file *s, void *v) | ||
| 339 | { | ||
| 340 | struct hlist_head *head; | ||
| 341 | struct hlist_node *node; | ||
| 342 | struct debug_name *elem; | ||
| 343 | unsigned int i = *(loff_t *) v; | ||
| 344 | |||
| 345 | rcu_read_lock(); | ||
| 346 | head = &module_table[i]; | ||
| 347 | hlist_for_each_entry_rcu(elem, node, head, hlist) { | ||
| 348 | seq_printf(s, "%s enabled=%d", elem->name, elem->enable); | ||
| 349 | seq_printf(s, "\n"); | ||
| 350 | } | ||
| 351 | rcu_read_unlock(); | ||
| 352 | return 0; | ||
| 353 | } | ||
| 354 | |||
| 355 | static struct seq_operations pr_debug_seq_ops = { | ||
| 356 | .start = pr_debug_seq_start, | ||
| 357 | .next = pr_debug_seq_next, | ||
| 358 | .stop = pr_debug_seq_stop, | ||
| 359 | .show = pr_debug_seq_show | ||
| 360 | }; | ||
| 361 | |||
| 362 | static int pr_debug_open(struct inode *inode, struct file *filp) | ||
| 363 | { | ||
| 364 | return seq_open(filp, &pr_debug_seq_ops); | ||
| 365 | } | ||
| 366 | |||
| 367 | static const struct file_operations pr_debug_operations = { | ||
| 368 | .open = pr_debug_open, | ||
| 369 | .read = seq_read, | ||
| 370 | .write = pr_debug_write, | ||
| 371 | .llseek = seq_lseek, | ||
| 372 | .release = seq_release, | ||
| 373 | }; | ||
| 374 | |||
| 375 | static int __init dynamic_printk_init(void) | ||
| 376 | { | ||
| 377 | struct dentry *dir, *file; | ||
| 378 | struct mod_debug *iter; | ||
| 379 | unsigned long value; | ||
| 380 | |||
| 381 | dir = debugfs_create_dir("dynamic_printk", NULL); | ||
| 382 | if (!dir) | ||
| 383 | return -ENOMEM; | ||
| 384 | file = debugfs_create_file("modules", 0644, dir, NULL, | ||
| 385 | &pr_debug_operations); | ||
| 386 | if (!file) { | ||
| 387 | debugfs_remove(dir); | ||
| 388 | return -ENOMEM; | ||
| 389 | } | ||
| 390 | for (value = (unsigned long)__start___verbose; | ||
| 391 | value < (unsigned long)__stop___verbose; | ||
| 392 | value += sizeof(struct mod_debug)) { | ||
| 393 | iter = (struct mod_debug *)value; | ||
| 394 | register_dynamic_debug_module(iter->modname, | ||
| 395 | iter->type, | ||
| 396 | iter->logical_modname, | ||
| 397 | iter->flag_names, iter->hash, iter->hash2); | ||
| 398 | } | ||
| 399 | if (dynamic_enabled == DYNAMIC_ENABLED_ALL) | ||
| 400 | set_all(true); | ||
| 401 | return 0; | ||
| 402 | } | ||
| 403 | module_init(dynamic_printk_init); | ||
| 404 | /* may want to move this earlier so we can get traces as early as possible */ | ||
| 405 | |||
| 406 | static int __init dynamic_printk_setup(char *str) | ||
| 407 | { | ||
| 408 | if (str) | ||
| 409 | return -ENOENT; | ||
| 410 | dynamic_enabled = DYNAMIC_ENABLED_ALL; | ||
| 411 | return 0; | ||
| 412 | } | ||
| 413 | /* Use early_param(), so we can get debug output as early as possible */ | ||
| 414 | early_param("dynamic_printk", dynamic_printk_setup); | ||
diff --git a/lib/kobject.c b/lib/kobject.c index 0487d1f64806..a6dec32f2ddd 100644 --- a/lib/kobject.c +++ b/lib/kobject.c | |||
| @@ -212,7 +212,7 @@ static int kobject_add_internal(struct kobject *kobj) | |||
| 212 | * @fmt: format string used to build the name | 212 | * @fmt: format string used to build the name |
| 213 | * @vargs: vargs to format the string. | 213 | * @vargs: vargs to format the string. |
| 214 | */ | 214 | */ |
| 215 | static int kobject_set_name_vargs(struct kobject *kobj, const char *fmt, | 215 | int kobject_set_name_vargs(struct kobject *kobj, const char *fmt, |
| 216 | va_list vargs) | 216 | va_list vargs) |
| 217 | { | 217 | { |
| 218 | const char *old_name = kobj->name; | 218 | const char *old_name = kobj->name; |
diff --git a/lib/kobject_uevent.c b/lib/kobject_uevent.c index 318328ddbd1c..e68e743bd861 100644 --- a/lib/kobject_uevent.c +++ b/lib/kobject_uevent.c | |||
| @@ -118,6 +118,13 @@ int kobject_uevent_env(struct kobject *kobj, enum kobject_action action, | |||
| 118 | kset = top_kobj->kset; | 118 | kset = top_kobj->kset; |
| 119 | uevent_ops = kset->uevent_ops; | 119 | uevent_ops = kset->uevent_ops; |
| 120 | 120 | ||
| 121 | /* skip the event, if uevent_suppress is set*/ | ||
| 122 | if (kobj->uevent_suppress) { | ||
| 123 | pr_debug("kobject: '%s' (%p): %s: uevent_suppress " | ||
| 124 | "caused the event to drop!\n", | ||
| 125 | kobject_name(kobj), kobj, __func__); | ||
| 126 | return 0; | ||
| 127 | } | ||
| 121 | /* skip the event, if the filter returns zero. */ | 128 | /* skip the event, if the filter returns zero. */ |
| 122 | if (uevent_ops && uevent_ops->filter) | 129 | if (uevent_ops && uevent_ops->filter) |
| 123 | if (!uevent_ops->filter(kset, kobj)) { | 130 | if (!uevent_ops->filter(kset, kobj)) { |
| @@ -248,7 +255,7 @@ int kobject_uevent_env(struct kobject *kobj, enum kobject_action action, | |||
| 248 | goto exit; | 255 | goto exit; |
| 249 | 256 | ||
| 250 | retval = call_usermodehelper(argv[0], argv, | 257 | retval = call_usermodehelper(argv[0], argv, |
| 251 | env->envp, UMH_WAIT_EXEC); | 258 | env->envp, UMH_NO_WAIT); |
| 252 | } | 259 | } |
| 253 | 260 | ||
| 254 | exit: | 261 | exit: |
diff --git a/net/bluetooth/hci_sysfs.c b/net/bluetooth/hci_sysfs.c index 1a1f916be44e..ed82796d4a0f 100644 --- a/net/bluetooth/hci_sysfs.c +++ b/net/bluetooth/hci_sysfs.c | |||
| @@ -140,7 +140,7 @@ static void del_conn(struct work_struct *work) | |||
| 140 | dev = device_find_child(&conn->dev, NULL, __match_tty); | 140 | dev = device_find_child(&conn->dev, NULL, __match_tty); |
| 141 | if (!dev) | 141 | if (!dev) |
| 142 | break; | 142 | break; |
| 143 | device_move(dev, NULL); | 143 | device_move(dev, NULL, DPM_ORDER_DEV_LAST); |
| 144 | put_device(dev); | 144 | put_device(dev); |
| 145 | } | 145 | } |
| 146 | 146 | ||
diff --git a/net/bluetooth/rfcomm/tty.c b/net/bluetooth/rfcomm/tty.c index d030c69cb5a3..abdc703a11d2 100644 --- a/net/bluetooth/rfcomm/tty.c +++ b/net/bluetooth/rfcomm/tty.c | |||
| @@ -731,7 +731,8 @@ static int rfcomm_tty_open(struct tty_struct *tty, struct file *filp) | |||
| 731 | remove_wait_queue(&dev->wait, &wait); | 731 | remove_wait_queue(&dev->wait, &wait); |
| 732 | 732 | ||
| 733 | if (err == 0) | 733 | if (err == 0) |
| 734 | device_move(dev->tty_dev, rfcomm_get_device(dev)); | 734 | device_move(dev->tty_dev, rfcomm_get_device(dev), |
| 735 | DPM_ORDER_DEV_AFTER_PARENT); | ||
| 735 | 736 | ||
| 736 | rfcomm_tty_copy_pending(dev); | 737 | rfcomm_tty_copy_pending(dev); |
| 737 | 738 | ||
| @@ -751,7 +752,7 @@ static void rfcomm_tty_close(struct tty_struct *tty, struct file *filp) | |||
| 751 | 752 | ||
| 752 | if (atomic_dec_and_test(&dev->opened)) { | 753 | if (atomic_dec_and_test(&dev->opened)) { |
| 753 | if (dev->tty_dev->parent) | 754 | if (dev->tty_dev->parent) |
| 754 | device_move(dev->tty_dev, NULL); | 755 | device_move(dev->tty_dev, NULL, DPM_ORDER_DEV_LAST); |
| 755 | 756 | ||
| 756 | /* Close DLC and dettach TTY */ | 757 | /* Close DLC and dettach TTY */ |
| 757 | rfcomm_dlc_close(dev->dlc, 0); | 758 | rfcomm_dlc_close(dev->dlc, 0); |
diff --git a/net/netfilter/nf_conntrack_pptp.c b/net/netfilter/nf_conntrack_pptp.c index 9e169ef2e854..12bd09dbd36c 100644 --- a/net/netfilter/nf_conntrack_pptp.c +++ b/net/netfilter/nf_conntrack_pptp.c | |||
| @@ -66,7 +66,7 @@ void | |||
| 66 | struct nf_conntrack_expect *exp) __read_mostly; | 66 | struct nf_conntrack_expect *exp) __read_mostly; |
| 67 | EXPORT_SYMBOL_GPL(nf_nat_pptp_hook_expectfn); | 67 | EXPORT_SYMBOL_GPL(nf_nat_pptp_hook_expectfn); |
| 68 | 68 | ||
| 69 | #if defined(DEBUG) || defined(CONFIG_DYNAMIC_PRINTK_DEBUG) | 69 | #if defined(DEBUG) || defined(CONFIG_DYNAMIC_DEBUG) |
| 70 | /* PptpControlMessageType names */ | 70 | /* PptpControlMessageType names */ |
| 71 | const char *const pptp_msg_name[] = { | 71 | const char *const pptp_msg_name[] = { |
| 72 | "UNKNOWN_MESSAGE", | 72 | "UNKNOWN_MESSAGE", |
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index e06365775bdf..c18fa150b6fe 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib | |||
| @@ -97,7 +97,7 @@ modname_flags = $(if $(filter 1,$(words $(modname))),\ | |||
| 97 | -D"KBUILD_MODNAME=KBUILD_STR($(call name-fix,$(modname)))") | 97 | -D"KBUILD_MODNAME=KBUILD_STR($(call name-fix,$(modname)))") |
| 98 | 98 | ||
| 99 | #hash values | 99 | #hash values |
| 100 | ifdef CONFIG_DYNAMIC_PRINTK_DEBUG | 100 | ifdef CONFIG_DYNAMIC_DEBUG |
| 101 | debug_flags = -D"DEBUG_HASH=$(shell ./scripts/basic/hash djb2 $(@D)$(modname))"\ | 101 | debug_flags = -D"DEBUG_HASH=$(shell ./scripts/basic/hash djb2 $(@D)$(modname))"\ |
| 102 | -D"DEBUG_HASH2=$(shell ./scripts/basic/hash r5 $(@D)$(modname))" | 102 | -D"DEBUG_HASH2=$(shell ./scripts/basic/hash r5 $(@D)$(modname))" |
| 103 | else | 103 | else |
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c index 4eea60b1693e..a3344285ccf4 100644 --- a/scripts/mod/file2alias.c +++ b/scripts/mod/file2alias.c | |||
| @@ -710,6 +710,14 @@ static int do_dmi_entry(const char *filename, struct dmi_system_id *id, | |||
| 710 | strcat(alias, ":"); | 710 | strcat(alias, ":"); |
| 711 | return 1; | 711 | return 1; |
| 712 | } | 712 | } |
| 713 | |||
| 714 | static int do_platform_entry(const char *filename, | ||
| 715 | struct platform_device_id *id, char *alias) | ||
| 716 | { | ||
| 717 | sprintf(alias, PLATFORM_MODULE_PREFIX "%s", id->name); | ||
| 718 | return 1; | ||
| 719 | } | ||
| 720 | |||
| 713 | /* Ignore any prefix, eg. some architectures prepend _ */ | 721 | /* Ignore any prefix, eg. some architectures prepend _ */ |
| 714 | static inline int sym_is(const char *symbol, const char *name) | 722 | static inline int sym_is(const char *symbol, const char *name) |
| 715 | { | 723 | { |
| @@ -849,6 +857,10 @@ void handle_moddevtable(struct module *mod, struct elf_info *info, | |||
| 849 | do_table(symval, sym->st_size, | 857 | do_table(symval, sym->st_size, |
| 850 | sizeof(struct dmi_system_id), "dmi", | 858 | sizeof(struct dmi_system_id), "dmi", |
| 851 | do_dmi_entry, mod); | 859 | do_dmi_entry, mod); |
| 860 | else if (sym_is(symname, "__mod_platform_device_table")) | ||
| 861 | do_table(symval, sym->st_size, | ||
| 862 | sizeof(struct platform_device_id), "platform", | ||
| 863 | do_platform_entry, mod); | ||
| 852 | free(zeros); | 864 | free(zeros); |
| 853 | } | 865 | } |
| 854 | 866 | ||
