Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core-2.6

* git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core-2.6: (64 commits)
debugfs: use specified mode to possibly mark files read/write only
debugfs: Fix terminology inconsistency of dir name to mount debugfs filesystem.
xen: remove driver_data direct access of struct device from more drivers
usb: gadget: at91_udc: remove driver_data direct access of struct device
uml: remove driver_data direct access of struct device
block/ps3: remove driver_data direct access of struct device
s390: remove driver_data direct access of struct device
parport: remove driver_data direct access of struct device
parisc: remove driver_data direct access of struct device
of_serial: remove driver_data direct access of struct device
mips: remove driver_data direct access of struct device
ipmi: remove driver_data direct access of struct device
infiniband: ehca: remove driver_data direct access of struct device
ibmvscsi: gadget: at91_udc: remove driver_data direct access of struct device
hvcs: remove driver_data direct access of struct device
xen block: remove driver_data direct access of struct device
thermal: remove driver_data direct access of struct device
scsi: remove driver_data direct access of struct device
pcmcia: remove driver_data direct access of struct device
PCIE: remove driver_data direct access of struct device
...

Manually fix up trivial conflicts due to different direct driver_data
direct access fixups in drivers/block/{ps3disk.c,ps3vram.c}

+875 -812
+1 -1
Documentation/DocBook/debugobjects.tmpl
··· 106 106 number of errors are printk'ed including a full stack trace. 107 107 </para> 108 108 <para> 109 - The statistics are available via debugfs/debug_objects/stats. 109 + The statistics are available via /sys/kernel/debug/debug_objects/stats. 110 110 They provide information about the number of warnings and the 111 111 number of successful fixups along with information about the 112 112 usage of the internal tracking objects and the state of the
+1 -1
Documentation/cdrom/packet-writing.txt
··· 117 117 118 118 To read pktcdvd device infos in human readable form, do: 119 119 120 - # cat /debug/pktcdvd/pktcdvd[0-7]/info 120 + # cat /sys/kernel/debug/pktcdvd/pktcdvd[0-7]/info 121 121 122 122 For a description of the debugfs interface look into the file: 123 123
+32
Documentation/driver-model/device.txt
··· 162 162 163 163 The file name will be 'power' with a mode of 0644 (-rw-r--r--). 164 164 165 + Word of warning: While the kernel allows device_create_file() and 166 + device_remove_file() to be called on a device at any time, userspace has 167 + strict expectations on when attributes get created. When a new device is 168 + registered in the kernel, a uevent is generated to notify userspace (like 169 + udev) that a new device is available. If attributes are added after the 170 + device is registered, then userspace won't get notified and userspace will 171 + not know about the new attributes. 172 + 173 + This is important for device driver that need to publish additional 174 + attributes for a device at driver probe time. If the device driver simply 175 + calls device_create_file() on the device structure passed to it, then 176 + userspace will never be notified of the new attributes. Instead, it should 177 + probably use class_create() and class->dev_attrs to set up a list of 178 + desired attributes in the modules_init function, and then in the .probe() 179 + hook, and then use device_create() to create a new device as a child 180 + of the probed device. The new device will generate a new uevent and 181 + properly advertise the new attributes to userspace. 182 + 183 + For example, if a driver wanted to add the following attributes: 184 + struct device_attribute mydriver_attribs[] = { 185 + __ATTR(port_count, 0444, port_count_show), 186 + __ATTR(serial_number, 0444, serial_number_show), 187 + NULL 188 + }; 189 + 190 + Then in the module init function is would do: 191 + mydriver_class = class_create(THIS_MODULE, "my_attrs"); 192 + mydriver_class.dev_attr = mydriver_attribs; 193 + 194 + And assuming 'dev' is the struct device passed into the probe hook, the driver 195 + probe function would do something like: 196 + create_device(&mydriver_class, dev, chrdev, &private_data, "my_name");
+35 -35
Documentation/fault-injection/fault-injection.txt
··· 29 29 fault-inject-debugfs kernel module provides some debugfs entries for runtime 30 30 configuration of fault-injection capabilities. 31 31 32 - - /debug/fail*/probability: 32 + - /sys/kernel/debug/fail*/probability: 33 33 34 34 likelihood of failure injection, in percent. 35 35 Format: <percent> 36 36 37 37 Note that one-failure-per-hundred is a very high error rate 38 38 for some testcases. Consider setting probability=100 and configure 39 - /debug/fail*/interval for such testcases. 39 + /sys/kernel/debug/fail*/interval for such testcases. 40 40 41 - - /debug/fail*/interval: 41 + - /sys/kernel/debug/fail*/interval: 42 42 43 43 specifies the interval between failures, for calls to 44 44 should_fail() that pass all the other tests. ··· 46 46 Note that if you enable this, by setting interval>1, you will 47 47 probably want to set probability=100. 48 48 49 - - /debug/fail*/times: 49 + - /sys/kernel/debug/fail*/times: 50 50 51 51 specifies how many times failures may happen at most. 52 52 A value of -1 means "no limit". 53 53 54 - - /debug/fail*/space: 54 + - /sys/kernel/debug/fail*/space: 55 55 56 56 specifies an initial resource "budget", decremented by "size" 57 57 on each call to should_fail(,size). Failure injection is 58 58 suppressed until "space" reaches zero. 59 59 60 - - /debug/fail*/verbose 60 + - /sys/kernel/debug/fail*/verbose 61 61 62 62 Format: { 0 | 1 | 2 } 63 63 specifies the verbosity of the messages when failure is ··· 65 65 log line per failure; '2' will print a call trace too -- useful 66 66 to debug the problems revealed by fault injection. 67 67 68 - - /debug/fail*/task-filter: 68 + - /sys/kernel/debug/fail*/task-filter: 69 69 70 70 Format: { 'Y' | 'N' } 71 71 A value of 'N' disables filtering by process (default). 72 72 Any positive value limits failures to only processes indicated by 73 73 /proc/<pid>/make-it-fail==1. 74 74 75 - - /debug/fail*/require-start: 76 - - /debug/fail*/require-end: 77 - - /debug/fail*/reject-start: 78 - - /debug/fail*/reject-end: 75 + - /sys/kernel/debug/fail*/require-start: 76 + - /sys/kernel/debug/fail*/require-end: 77 + - /sys/kernel/debug/fail*/reject-start: 78 + - /sys/kernel/debug/fail*/reject-end: 79 79 80 80 specifies the range of virtual addresses tested during 81 81 stacktrace walking. Failure is injected only if some caller ··· 84 84 Default required range is [0,ULONG_MAX) (whole of virtual address space). 85 85 Default rejected range is [0,0). 86 86 87 - - /debug/fail*/stacktrace-depth: 87 + - /sys/kernel/debug/fail*/stacktrace-depth: 88 88 89 89 specifies the maximum stacktrace depth walked during search 90 90 for a caller within [require-start,require-end) OR 91 91 [reject-start,reject-end). 92 92 93 - - /debug/fail_page_alloc/ignore-gfp-highmem: 93 + - /sys/kernel/debug/fail_page_alloc/ignore-gfp-highmem: 94 94 95 95 Format: { 'Y' | 'N' } 96 96 default is 'N', setting it to 'Y' won't inject failures into 97 97 highmem/user allocations. 98 98 99 - - /debug/failslab/ignore-gfp-wait: 100 - - /debug/fail_page_alloc/ignore-gfp-wait: 99 + - /sys/kernel/debug/failslab/ignore-gfp-wait: 100 + - /sys/kernel/debug/fail_page_alloc/ignore-gfp-wait: 101 101 102 102 Format: { 'Y' | 'N' } 103 103 default is 'N', setting it to 'Y' will inject failures 104 104 only into non-sleep allocations (GFP_ATOMIC allocations). 105 105 106 - - /debug/fail_page_alloc/min-order: 106 + - /sys/kernel/debug/fail_page_alloc/min-order: 107 107 108 108 specifies the minimum page allocation order to be injected 109 109 failures. ··· 166 166 #!/bin/bash 167 167 168 168 FAILTYPE=failslab 169 - echo Y > /debug/$FAILTYPE/task-filter 170 - echo 10 > /debug/$FAILTYPE/probability 171 - echo 100 > /debug/$FAILTYPE/interval 172 - echo -1 > /debug/$FAILTYPE/times 173 - echo 0 > /debug/$FAILTYPE/space 174 - echo 2 > /debug/$FAILTYPE/verbose 175 - echo 1 > /debug/$FAILTYPE/ignore-gfp-wait 169 + echo Y > /sys/kernel/debug/$FAILTYPE/task-filter 170 + echo 10 > /sys/kernel/debug/$FAILTYPE/probability 171 + echo 100 > /sys/kernel/debug/$FAILTYPE/interval 172 + echo -1 > /sys/kernel/debug/$FAILTYPE/times 173 + echo 0 > /sys/kernel/debug/$FAILTYPE/space 174 + echo 2 > /sys/kernel/debug/$FAILTYPE/verbose 175 + echo 1 > /sys/kernel/debug/$FAILTYPE/ignore-gfp-wait 176 176 177 177 faulty_system() 178 178 { ··· 217 217 exit 1 218 218 fi 219 219 220 - cat /sys/module/$module/sections/.text > /debug/$FAILTYPE/require-start 221 - cat /sys/module/$module/sections/.data > /debug/$FAILTYPE/require-end 220 + cat /sys/module/$module/sections/.text > /sys/kernel/debug/$FAILTYPE/require-start 221 + cat /sys/module/$module/sections/.data > /sys/kernel/debug/$FAILTYPE/require-end 222 222 223 - echo N > /debug/$FAILTYPE/task-filter 224 - echo 10 > /debug/$FAILTYPE/probability 225 - echo 100 > /debug/$FAILTYPE/interval 226 - echo -1 > /debug/$FAILTYPE/times 227 - echo 0 > /debug/$FAILTYPE/space 228 - echo 2 > /debug/$FAILTYPE/verbose 229 - echo 1 > /debug/$FAILTYPE/ignore-gfp-wait 230 - echo 1 > /debug/$FAILTYPE/ignore-gfp-highmem 231 - echo 10 > /debug/$FAILTYPE/stacktrace-depth 223 + echo N > /sys/kernel/debug/$FAILTYPE/task-filter 224 + echo 10 > /sys/kernel/debug/$FAILTYPE/probability 225 + echo 100 > /sys/kernel/debug/$FAILTYPE/interval 226 + echo -1 > /sys/kernel/debug/$FAILTYPE/times 227 + echo 0 > /sys/kernel/debug/$FAILTYPE/space 228 + echo 2 > /sys/kernel/debug/$FAILTYPE/verbose 229 + echo 1 > /sys/kernel/debug/$FAILTYPE/ignore-gfp-wait 230 + echo 1 > /sys/kernel/debug/$FAILTYPE/ignore-gfp-highmem 231 + echo 10 > /sys/kernel/debug/$FAILTYPE/stacktrace-depth 232 232 233 - trap "echo 0 > /debug/$FAILTYPE/probability" SIGINT SIGTERM EXIT 233 + trap "echo 0 > /sys/kernel/debug/$FAILTYPE/probability" SIGINT SIGTERM EXIT 234 234 235 235 echo "Injecting errors into the module $module... (interrupt to stop)" 236 236 sleep 1000000
+2 -1
Documentation/firmware_class/README
··· 77 77 seconds for the whole load operation. 78 78 79 79 - request_firmware_nowait() is also provided for convenience in 80 - non-user contexts. 80 + user contexts to request firmware asynchronously, but can't be called 81 + in atomic contexts. 81 82 82 83 83 84 about in-kernel persistence:
+3 -3
Documentation/kprobes.txt
··· 507 507 Appendix A: The kprobes debugfs interface 508 508 509 509 With recent kernels (> 2.6.20) the list of registered kprobes is visible 510 - under the /debug/kprobes/ directory (assuming debugfs is mounted at /debug). 510 + under the /sys/kernel/debug/kprobes/ directory (assuming debugfs is mounted at //sys/kernel/debug). 511 511 512 - /debug/kprobes/list: Lists all registered probes on the system 512 + /sys/kernel/debug/kprobes/list: Lists all registered probes on the system 513 513 514 514 c015d71a k vfs_read+0x0 515 515 c011a316 j do_fork+0x0 ··· 525 525 such probes are marked with [GONE]. If the probe is temporarily disabled, 526 526 such probes are marked with [DISABLED]. 527 527 528 - /debug/kprobes/enabled: Turn kprobes ON/OFF forcibly. 528 + /sys/kernel/debug/kprobes/enabled: Turn kprobes ON/OFF forcibly. 529 529 530 530 Provides a knob to globally and forcibly turn registered kprobes ON or OFF. 531 531 By default, all kprobes are enabled. By echoing "0" to this file, all
+142 -91
Documentation/trace/ftrace.txt
··· 7 7 (dual licensed under the GPL v2) 8 8 Reviewers: Elias Oltmanns, Randy Dunlap, Andrew Morton, 9 9 John Kacur, and David Teigland. 10 - 11 10 Written for: 2.6.28-rc2 12 11 13 12 Introduction ··· 32 33 Ftrace uses the debugfs file system to hold the control files as 33 34 well as the files to display output. 34 35 35 - To mount the debugfs system: 36 + When debugfs is configured into the kernel (which selecting any ftrace 37 + option will do) the directory /sys/kernel/debug will be created. To mount 38 + this directory, you can add to your /etc/fstab file: 36 39 37 - # mkdir /debug 38 - # mount -t debugfs nodev /debug 40 + debugfs /sys/kernel/debug debugfs defaults 0 0 39 41 40 - ( Note: it is more common to mount at /sys/kernel/debug, but for 41 - simplicity this document will use /debug) 42 + Or you can mount it at run time with: 43 + 44 + mount -t debugfs nodev /sys/kernel/debug 45 + 46 + For quicker access to that directory you may want to make a soft link to 47 + it: 48 + 49 + ln -s /sys/kernel/debug /debug 50 + 51 + Any selected ftrace option will also create a directory called tracing 52 + within the debugfs. The rest of the document will assume that you are in 53 + the ftrace directory (cd /sys/kernel/debug/tracing) and will only concentrate 54 + on the files within that directory and not distract from the content with 55 + the extended "/sys/kernel/debug/tracing" path name. 42 56 43 57 That's it! (assuming that you have ftrace configured into your kernel) 44 58 ··· 401 389 The trace_options file is used to control what gets printed in 402 390 the trace output. To see what is available, simply cat the file: 403 391 404 - cat /debug/tracing/trace_options 392 + cat trace_options 405 393 print-parent nosym-offset nosym-addr noverbose noraw nohex nobin \ 406 394 noblock nostacktrace nosched-tree nouserstacktrace nosym-userobj 407 395 408 396 To disable one of the options, echo in the option prepended with 409 397 "no". 410 398 411 - echo noprint-parent > /debug/tracing/trace_options 399 + echo noprint-parent > trace_options 412 400 413 401 To enable an option, leave off the "no". 414 402 415 - echo sym-offset > /debug/tracing/trace_options 403 + echo sym-offset > trace_options 416 404 417 405 Here are the available options: 418 406 ··· 488 476 This tracer simply records schedule switches. Here is an example 489 477 of how to use it. 490 478 491 - # echo sched_switch > /debug/tracing/current_tracer 492 - # echo 1 > /debug/tracing/tracing_enabled 479 + # echo sched_switch > current_tracer 480 + # echo 1 > tracing_enabled 493 481 # sleep 1 494 - # echo 0 > /debug/tracing/tracing_enabled 495 - # cat /debug/tracing/trace 482 + # echo 0 > tracing_enabled 483 + # cat trace 496 484 497 485 # tracer: sched_switch 498 486 # ··· 595 583 To reset the maximum, echo 0 into tracing_max_latency. Here is 596 584 an example: 597 585 598 - # echo irqsoff > /debug/tracing/current_tracer 599 - # echo 0 > /debug/tracing/tracing_max_latency 600 - # echo 1 > /debug/tracing/tracing_enabled 586 + # echo irqsoff > current_tracer 587 + # echo 0 > tracing_max_latency 588 + # echo 1 > tracing_enabled 601 589 # ls -ltr 602 590 [...] 603 - # echo 0 > /debug/tracing/tracing_enabled 604 - # cat /debug/tracing/latency_trace 591 + # echo 0 > tracing_enabled 592 + # cat latency_trace 605 593 # tracer: irqsoff 606 594 # 607 595 irqsoff latency trace v1.1.5 on 2.6.26 ··· 702 690 which preemption was disabled. The control of preemptoff tracer 703 691 is much like the irqsoff tracer. 704 692 705 - # echo preemptoff > /debug/tracing/current_tracer 706 - # echo 0 > /debug/tracing/tracing_max_latency 707 - # echo 1 > /debug/tracing/tracing_enabled 693 + # echo preemptoff > current_tracer 694 + # echo 0 > tracing_max_latency 695 + # echo 1 > tracing_enabled 708 696 # ls -ltr 709 697 [...] 710 - # echo 0 > /debug/tracing/tracing_enabled 711 - # cat /debug/tracing/latency_trace 698 + # echo 0 > tracing_enabled 699 + # cat latency_trace 712 700 # tracer: preemptoff 713 701 # 714 702 preemptoff latency trace v1.1.5 on 2.6.26-rc8 ··· 849 837 Again, using this trace is much like the irqsoff and preemptoff 850 838 tracers. 851 839 852 - # echo preemptirqsoff > /debug/tracing/current_tracer 853 - # echo 0 > /debug/tracing/tracing_max_latency 854 - # echo 1 > /debug/tracing/tracing_enabled 840 + # echo preemptirqsoff > current_tracer 841 + # echo 0 > tracing_max_latency 842 + # echo 1 > tracing_enabled 855 843 # ls -ltr 856 844 [...] 857 - # echo 0 > /debug/tracing/tracing_enabled 858 - # cat /debug/tracing/latency_trace 845 + # echo 0 > tracing_enabled 846 + # cat latency_trace 859 847 # tracer: preemptirqsoff 860 848 # 861 849 preemptirqsoff latency trace v1.1.5 on 2.6.26-rc8 ··· 1011 999 Instead of performing an 'ls', we will run 'sleep 1' under 1012 1000 'chrt' which changes the priority of the task. 1013 1001 1014 - # echo wakeup > /debug/tracing/current_tracer 1015 - # echo 0 > /debug/tracing/tracing_max_latency 1016 - # echo 1 > /debug/tracing/tracing_enabled 1002 + # echo wakeup > current_tracer 1003 + # echo 0 > tracing_max_latency 1004 + # echo 1 > tracing_enabled 1017 1005 # chrt -f 5 sleep 1 1018 - # echo 0 > /debug/tracing/tracing_enabled 1019 - # cat /debug/tracing/latency_trace 1006 + # echo 0 > tracing_enabled 1007 + # cat latency_trace 1020 1008 # tracer: wakeup 1021 1009 # 1022 1010 wakeup latency trace v1.1.5 on 2.6.26-rc8 ··· 1126 1114 ftrace_enabled is set; otherwise this tracer is a nop. 1127 1115 1128 1116 # sysctl kernel.ftrace_enabled=1 1129 - # echo function > /debug/tracing/current_tracer 1130 - # echo 1 > /debug/tracing/tracing_enabled 1117 + # echo function > current_tracer 1118 + # echo 1 > tracing_enabled 1131 1119 # usleep 1 1132 - # echo 0 > /debug/tracing/tracing_enabled 1133 - # cat /debug/tracing/trace 1120 + # echo 0 > tracing_enabled 1121 + # cat trace 1134 1122 # tracer: function 1135 1123 # 1136 1124 # TASK-PID CPU# TIMESTAMP FUNCTION ··· 1167 1155 [...] 1168 1156 int main(int argc, char *argv[]) { 1169 1157 [...] 1170 - trace_fd = open("/debug/tracing/tracing_enabled", O_WRONLY); 1158 + trace_fd = open(tracing_file("tracing_enabled"), O_WRONLY); 1171 1159 [...] 1172 1160 if (condition_hit()) { 1173 1161 write(trace_fd, "0", 1); ··· 1175 1163 [...] 1176 1164 } 1177 1165 1178 - Note: Here we hard coded the path name. The debugfs mount is not 1179 - guaranteed to be at /debug (and is more commonly at 1180 - /sys/kernel/debug). For simple one time traces, the above is 1181 - sufficent. For anything else, a search through /proc/mounts may 1182 - be needed to find where the debugfs file-system is mounted. 1183 - 1184 1166 1185 1167 Single thread tracing 1186 1168 --------------------- 1187 1169 1188 - By writing into /debug/tracing/set_ftrace_pid you can trace a 1170 + By writing into set_ftrace_pid you can trace a 1189 1171 single thread. For example: 1190 1172 1191 - # cat /debug/tracing/set_ftrace_pid 1173 + # cat set_ftrace_pid 1192 1174 no pid 1193 - # echo 3111 > /debug/tracing/set_ftrace_pid 1194 - # cat /debug/tracing/set_ftrace_pid 1175 + # echo 3111 > set_ftrace_pid 1176 + # cat set_ftrace_pid 1195 1177 3111 1196 - # echo function > /debug/tracing/current_tracer 1197 - # cat /debug/tracing/trace | head 1178 + # echo function > current_tracer 1179 + # cat trace | head 1198 1180 # tracer: function 1199 1181 # 1200 1182 # TASK-PID CPU# TIMESTAMP FUNCTION ··· 1199 1193 yum-updatesd-3111 [003] 1637.254683: lock_hrtimer_base <-hrtimer_try_to_cancel 1200 1194 yum-updatesd-3111 [003] 1637.254685: fget_light <-do_sys_poll 1201 1195 yum-updatesd-3111 [003] 1637.254686: pipe_poll <-do_sys_poll 1202 - # echo -1 > /debug/tracing/set_ftrace_pid 1203 - # cat /debug/tracing/trace |head 1196 + # echo -1 > set_ftrace_pid 1197 + # cat trace |head 1204 1198 # tracer: function 1205 1199 # 1206 1200 # TASK-PID CPU# TIMESTAMP FUNCTION ··· 1222 1216 #include <fcntl.h> 1223 1217 #include <unistd.h> 1224 1218 1219 + #define _STR(x) #x 1220 + #define STR(x) _STR(x) 1221 + #define MAX_PATH 256 1222 + 1223 + const char *find_debugfs(void) 1224 + { 1225 + static char debugfs[MAX_PATH+1]; 1226 + static int debugfs_found; 1227 + char type[100]; 1228 + FILE *fp; 1229 + 1230 + if (debugfs_found) 1231 + return debugfs; 1232 + 1233 + if ((fp = fopen("/proc/mounts","r")) == NULL) { 1234 + perror("/proc/mounts"); 1235 + return NULL; 1236 + } 1237 + 1238 + while (fscanf(fp, "%*s %" 1239 + STR(MAX_PATH) 1240 + "s %99s %*s %*d %*d\n", 1241 + debugfs, type) == 2) { 1242 + if (strcmp(type, "debugfs") == 0) 1243 + break; 1244 + } 1245 + fclose(fp); 1246 + 1247 + if (strcmp(type, "debugfs") != 0) { 1248 + fprintf(stderr, "debugfs not mounted"); 1249 + return NULL; 1250 + } 1251 + 1252 + debugfs_found = 1; 1253 + 1254 + return debugfs; 1255 + } 1256 + 1257 + const char *tracing_file(const char *file_name) 1258 + { 1259 + static char trace_file[MAX_PATH+1]; 1260 + snprintf(trace_file, MAX_PATH, "%s/%s", find_debugfs(), file_name); 1261 + return trace_file; 1262 + } 1263 + 1225 1264 int main (int argc, char **argv) 1226 1265 { 1227 1266 if (argc < 1) ··· 1277 1226 char line[64]; 1278 1227 int s; 1279 1228 1280 - ffd = open("/debug/tracing/current_tracer", O_WRONLY); 1229 + ffd = open(tracing_file("current_tracer"), O_WRONLY); 1281 1230 if (ffd < 0) 1282 1231 exit(-1); 1283 1232 write(ffd, "nop", 3); 1284 1233 1285 - fd = open("/debug/tracing/set_ftrace_pid", O_WRONLY); 1234 + fd = open(tracing_file("set_ftrace_pid"), O_WRONLY); 1286 1235 s = sprintf(line, "%d\n", getpid()); 1287 1236 write(fd, line, s); 1288 1237 ··· 1434 1383 tracing_cpu_mask file) or you might sometimes see unordered 1435 1384 function calls while cpu tracing switch. 1436 1385 1437 - hide: echo nofuncgraph-cpu > /debug/tracing/trace_options 1438 - show: echo funcgraph-cpu > /debug/tracing/trace_options 1386 + hide: echo nofuncgraph-cpu > trace_options 1387 + show: echo funcgraph-cpu > trace_options 1439 1388 1440 1389 - The duration (function's time of execution) is displayed on 1441 1390 the closing bracket line of a function or on the same line 1442 1391 than the current function in case of a leaf one. It is default 1443 1392 enabled. 1444 1393 1445 - hide: echo nofuncgraph-duration > /debug/tracing/trace_options 1446 - show: echo funcgraph-duration > /debug/tracing/trace_options 1394 + hide: echo nofuncgraph-duration > trace_options 1395 + show: echo funcgraph-duration > trace_options 1447 1396 1448 1397 - The overhead field precedes the duration field in case of 1449 1398 reached duration thresholds. 1450 1399 1451 - hide: echo nofuncgraph-overhead > /debug/tracing/trace_options 1452 - show: echo funcgraph-overhead > /debug/tracing/trace_options 1400 + hide: echo nofuncgraph-overhead > trace_options 1401 + show: echo funcgraph-overhead > trace_options 1453 1402 depends on: funcgraph-duration 1454 1403 1455 1404 ie: ··· 1478 1427 - The task/pid field displays the thread cmdline and pid which 1479 1428 executed the function. It is default disabled. 1480 1429 1481 - hide: echo nofuncgraph-proc > /debug/tracing/trace_options 1482 - show: echo funcgraph-proc > /debug/tracing/trace_options 1430 + hide: echo nofuncgraph-proc > trace_options 1431 + show: echo funcgraph-proc > trace_options 1483 1432 1484 1433 ie: 1485 1434 ··· 1502 1451 system clock since it started. A snapshot of this time is 1503 1452 given on each entry/exit of functions 1504 1453 1505 - hide: echo nofuncgraph-abstime > /debug/tracing/trace_options 1506 - show: echo funcgraph-abstime > /debug/tracing/trace_options 1454 + hide: echo nofuncgraph-abstime > trace_options 1455 + show: echo funcgraph-abstime > trace_options 1507 1456 1508 1457 ie: 1509 1458 ··· 1600 1549 1601 1550 available_filter_functions 1602 1551 1603 - # cat /debug/tracing/available_filter_functions 1552 + # cat available_filter_functions 1604 1553 put_prev_task_idle 1605 1554 kmem_cache_create 1606 1555 pick_next_task_rt ··· 1612 1561 If I am only interested in sys_nanosleep and hrtimer_interrupt: 1613 1562 1614 1563 # echo sys_nanosleep hrtimer_interrupt \ 1615 - > /debug/tracing/set_ftrace_filter 1616 - # echo ftrace > /debug/tracing/current_tracer 1617 - # echo 1 > /debug/tracing/tracing_enabled 1564 + > set_ftrace_filter 1565 + # echo ftrace > current_tracer 1566 + # echo 1 > tracing_enabled 1618 1567 # usleep 1 1619 - # echo 0 > /debug/tracing/tracing_enabled 1620 - # cat /debug/tracing/trace 1568 + # echo 0 > tracing_enabled 1569 + # cat trace 1621 1570 # tracer: ftrace 1622 1571 # 1623 1572 # TASK-PID CPU# TIMESTAMP FUNCTION ··· 1628 1577 1629 1578 To see which functions are being traced, you can cat the file: 1630 1579 1631 - # cat /debug/tracing/set_ftrace_filter 1580 + # cat set_ftrace_filter 1632 1581 hrtimer_interrupt 1633 1582 sys_nanosleep 1634 1583 ··· 1648 1597 otherwise the shell may expand the parameters into names 1649 1598 of files in the local directory. 1650 1599 1651 - # echo 'hrtimer_*' > /debug/tracing/set_ftrace_filter 1600 + # echo 'hrtimer_*' > set_ftrace_filter 1652 1601 1653 1602 Produces: 1654 1603 ··· 1669 1618 1670 1619 Notice that we lost the sys_nanosleep. 1671 1620 1672 - # cat /debug/tracing/set_ftrace_filter 1621 + # cat set_ftrace_filter 1673 1622 hrtimer_run_queues 1674 1623 hrtimer_run_pending 1675 1624 hrtimer_init ··· 1695 1644 To clear out a filter so that all functions will be recorded 1696 1645 again: 1697 1646 1698 - # echo > /debug/tracing/set_ftrace_filter 1699 - # cat /debug/tracing/set_ftrace_filter 1647 + # echo > set_ftrace_filter 1648 + # cat set_ftrace_filter 1700 1649 # 1701 1650 1702 1651 Again, now we want to append. 1703 1652 1704 - # echo sys_nanosleep > /debug/tracing/set_ftrace_filter 1705 - # cat /debug/tracing/set_ftrace_filter 1653 + # echo sys_nanosleep > set_ftrace_filter 1654 + # cat set_ftrace_filter 1706 1655 sys_nanosleep 1707 - # echo 'hrtimer_*' >> /debug/tracing/set_ftrace_filter 1708 - # cat /debug/tracing/set_ftrace_filter 1656 + # echo 'hrtimer_*' >> set_ftrace_filter 1657 + # cat set_ftrace_filter 1709 1658 hrtimer_run_queues 1710 1659 hrtimer_run_pending 1711 1660 hrtimer_init ··· 1728 1677 The set_ftrace_notrace prevents those functions from being 1729 1678 traced. 1730 1679 1731 - # echo '*preempt*' '*lock*' > /debug/tracing/set_ftrace_notrace 1680 + # echo '*preempt*' '*lock*' > set_ftrace_notrace 1732 1681 1733 1682 Produces: 1734 1683 ··· 1818 1767 trace_pipe is consumed. This means that subsequent reads will be 1819 1768 different. The trace is live. 1820 1769 1821 - # echo function > /debug/tracing/current_tracer 1822 - # cat /debug/tracing/trace_pipe > /tmp/trace.out & 1770 + # echo function > current_tracer 1771 + # cat trace_pipe > /tmp/trace.out & 1823 1772 [1] 4153 1824 - # echo 1 > /debug/tracing/tracing_enabled 1773 + # echo 1 > tracing_enabled 1825 1774 # usleep 1 1826 - # echo 0 > /debug/tracing/tracing_enabled 1827 - # cat /debug/tracing/trace 1775 + # echo 0 > tracing_enabled 1776 + # cat trace 1828 1777 # tracer: function 1829 1778 # 1830 1779 # TASK-PID CPU# TIMESTAMP FUNCTION ··· 1860 1809 CPU. To know the full size, multiply the number of possible CPUS 1861 1810 with the number of entries. 1862 1811 1863 - # cat /debug/tracing/buffer_size_kb 1812 + # cat buffer_size_kb 1864 1813 1408 (units kilobytes) 1865 1814 1866 1815 Note, to modify this, you must have tracing completely disabled. ··· 1868 1817 current_tracer is not set to "nop", an EINVAL error will be 1869 1818 returned. 1870 1819 1871 - # echo nop > /debug/tracing/current_tracer 1872 - # echo 10000 > /debug/tracing/buffer_size_kb 1873 - # cat /debug/tracing/buffer_size_kb 1820 + # echo nop > current_tracer 1821 + # echo 10000 > buffer_size_kb 1822 + # cat buffer_size_kb 1874 1823 10000 (units kilobytes) 1875 1824 1876 1825 The number of pages which will be allocated is limited to a 1877 1826 percentage of available memory. Allocating too much will produce 1878 1827 an error. 1879 1828 1880 - # echo 1000000000000 > /debug/tracing/buffer_size_kb 1829 + # echo 1000000000000 > buffer_size_kb 1881 1830 -bash: echo: write error: Cannot allocate memory 1882 - # cat /debug/tracing/buffer_size_kb 1831 + # cat buffer_size_kb 1883 1832 85 1884 1833 1885 1834 -----------
+13 -13
Documentation/trace/mmiotrace.txt
··· 32 32 Usage Quick Reference 33 33 --------------------- 34 34 35 - $ mount -t debugfs debugfs /debug 36 - $ echo mmiotrace > /debug/tracing/current_tracer 37 - $ cat /debug/tracing/trace_pipe > mydump.txt & 35 + $ mount -t debugfs debugfs /sys/kernel/debug 36 + $ echo mmiotrace > /sys/kernel/debug/tracing/current_tracer 37 + $ cat /sys/kernel/debug/tracing/trace_pipe > mydump.txt & 38 38 Start X or whatever. 39 - $ echo "X is up" > /debug/tracing/trace_marker 40 - $ echo nop > /debug/tracing/current_tracer 39 + $ echo "X is up" > /sys/kernel/debug/tracing/trace_marker 40 + $ echo nop > /sys/kernel/debug/tracing/current_tracer 41 41 Check for lost events. 42 42 43 43 44 44 Usage 45 45 ----- 46 46 47 - Make sure debugfs is mounted to /debug. If not, (requires root privileges) 48 - $ mount -t debugfs debugfs /debug 47 + Make sure debugfs is mounted to /sys/kernel/debug. If not, (requires root privileges) 48 + $ mount -t debugfs debugfs /sys/kernel/debug 49 49 50 50 Check that the driver you are about to trace is not loaded. 51 51 52 52 Activate mmiotrace (requires root privileges): 53 - $ echo mmiotrace > /debug/tracing/current_tracer 53 + $ echo mmiotrace > /sys/kernel/debug/tracing/current_tracer 54 54 55 55 Start storing the trace: 56 - $ cat /debug/tracing/trace_pipe > mydump.txt & 56 + $ cat /sys/kernel/debug/tracing/trace_pipe > mydump.txt & 57 57 The 'cat' process should stay running (sleeping) in the background. 58 58 59 59 Load the driver you want to trace and use it. Mmiotrace will only catch MMIO 60 60 accesses to areas that are ioremapped while mmiotrace is active. 61 61 62 62 During tracing you can place comments (markers) into the trace by 63 - $ echo "X is up" > /debug/tracing/trace_marker 63 + $ echo "X is up" > /sys/kernel/debug/tracing/trace_marker 64 64 This makes it easier to see which part of the (huge) trace corresponds to 65 65 which action. It is recommended to place descriptive markers about what you 66 66 do. 67 67 68 68 Shut down mmiotrace (requires root privileges): 69 - $ echo nop > /debug/tracing/current_tracer 69 + $ echo nop > /sys/kernel/debug/tracing/current_tracer 70 70 The 'cat' process exits. If it does not, kill it by issuing 'fg' command and 71 71 pressing ctrl+c. 72 72 ··· 78 78 events were lost, the trace is incomplete. You should enlarge the buffers and 79 79 try again. Buffers are enlarged by first seeing how large the current buffers 80 80 are: 81 - $ cat /debug/tracing/buffer_size_kb 81 + $ cat /sys/kernel/debug/tracing/buffer_size_kb 82 82 gives you a number. Approximately double this number and write it back, for 83 83 instance: 84 - $ echo 128000 > /debug/tracing/buffer_size_kb 84 + $ echo 128000 > /sys/kernel/debug/tracing/buffer_size_kb 85 85 Then start again from the top. 86 86 87 87 If you are doing a trace for a driver project, e.g. Nouveau, you should also
+1 -1
arch/mips/sni/eisa.c
··· 38 38 if (!r) 39 39 return r; 40 40 41 - eisa_root_dev.dev.driver_data = &eisa_bus_root; 41 + dev_set_drvdata(&eisa_root_dev.dev, &eisa_bus_root); 42 42 43 43 if (eisa_root_register(&eisa_bus_root)) { 44 44 /* A real bridge may have been registered before
+2 -2
arch/um/drivers/net_kern.c
··· 360 360 361 361 static void net_device_release(struct device *dev) 362 362 { 363 - struct uml_net *device = dev->driver_data; 363 + struct uml_net *device = dev_get_drvdata(dev); 364 364 struct net_device *netdev = device->dev; 365 365 struct uml_net_private *lp = netdev_priv(netdev); 366 366 ··· 440 440 device->pdev.id = n; 441 441 device->pdev.name = DRIVER_NAME; 442 442 device->pdev.dev.release = net_device_release; 443 - device->pdev.dev.driver_data = device; 443 + dev_set_drvdata(&device->pdev.dev, device); 444 444 if (platform_device_register(&device->pdev)) 445 445 goto out_free_netdev; 446 446 SET_NETDEV_DEV(dev,&device->pdev.dev);
+2 -2
arch/um/drivers/ubd_kern.c
··· 778 778 779 779 static void ubd_device_release(struct device *dev) 780 780 { 781 - struct ubd *ubd_dev = dev->driver_data; 781 + struct ubd *ubd_dev = dev_get_drvdata(dev); 782 782 783 783 blk_cleanup_queue(ubd_dev->queue); 784 784 *ubd_dev = ((struct ubd) DEFAULT_UBD); ··· 807 807 ubd_devs[unit].pdev.id = unit; 808 808 ubd_devs[unit].pdev.name = DRIVER_NAME; 809 809 ubd_devs[unit].pdev.dev.release = ubd_device_release; 810 - ubd_devs[unit].pdev.dev.driver_data = &ubd_devs[unit]; 810 + dev_set_drvdata(&ubd_devs[unit].pdev.dev, &ubd_devs[unit]); 811 811 platform_device_register(&ubd_devs[unit].pdev); 812 812 disk->driverfs_dev = &ubd_devs[unit].pdev.dev; 813 813 }
+6
arch/x86/kernel/cpuid.c
··· 182 182 .notifier_call = cpuid_class_cpu_callback, 183 183 }; 184 184 185 + static char *cpuid_nodename(struct device *dev) 186 + { 187 + return kasprintf(GFP_KERNEL, "cpu/%u/cpuid", MINOR(dev->devt)); 188 + } 189 + 185 190 static int __init cpuid_init(void) 186 191 { 187 192 int i, err = 0; ··· 203 198 err = PTR_ERR(cpuid_class); 204 199 goto out_chrdev; 205 200 } 201 + cpuid_class->nodename = cpuid_nodename; 206 202 for_each_online_cpu(i) { 207 203 err = cpuid_device_create(i); 208 204 if (err != 0)
+1
arch/x86/kernel/microcode_core.c
··· 236 236 static struct miscdevice microcode_dev = { 237 237 .minor = MICROCODE_MINOR, 238 238 .name = "microcode", 239 + .devnode = "cpu/microcode", 239 240 .fops = &microcode_fops, 240 241 }; 241 242
+6
arch/x86/kernel/msr.c
··· 196 196 .notifier_call = msr_class_cpu_callback, 197 197 }; 198 198 199 + static char *msr_nodename(struct device *dev) 200 + { 201 + return kasprintf(GFP_KERNEL, "cpu/%u/msr", MINOR(dev->devt)); 202 + } 203 + 199 204 static int __init msr_init(void) 200 205 { 201 206 int i, err = 0; ··· 217 212 err = PTR_ERR(msr_class); 218 213 goto out_chrdev; 219 214 } 215 + msr_class->nodename = msr_nodename; 220 216 for_each_online_cpu(i) { 221 217 err = msr_device_create(i); 222 218 if (err != 0)
+6
block/bsg.c
··· 1065 1065 1066 1066 static struct cdev bsg_cdev; 1067 1067 1068 + static char *bsg_nodename(struct device *dev) 1069 + { 1070 + return kasprintf(GFP_KERNEL, "bsg/%s", dev_name(dev)); 1071 + } 1072 + 1068 1073 static int __init bsg_init(void) 1069 1074 { 1070 1075 int ret, i; ··· 1090 1085 ret = PTR_ERR(bsg_class); 1091 1086 goto destroy_kmemcache; 1092 1087 } 1088 + bsg_class->nodename = bsg_nodename; 1093 1089 1094 1090 ret = alloc_chrdev_region(&devid, 0, BSG_MAX_DEVS, "bsg"); 1095 1091 if (ret)
+10
block/genhd.c
··· 996 996 .name = "block", 997 997 }; 998 998 999 + static char *block_nodename(struct device *dev) 1000 + { 1001 + struct gendisk *disk = dev_to_disk(dev); 1002 + 1003 + if (disk->nodename) 1004 + return disk->nodename(disk); 1005 + return NULL; 1006 + } 1007 + 999 1008 static struct device_type disk_type = { 1000 1009 .name = "disk", 1001 1010 .groups = disk_attr_groups, 1002 1011 .release = disk_release, 1012 + .nodename = block_nodename, 1003 1013 }; 1004 1014 1005 1015 #ifdef CONFIG_PROC_FS
+54 -3
drivers/base/core.c
··· 22 22 #include <linux/kallsyms.h> 23 23 #include <linux/semaphore.h> 24 24 #include <linux/mutex.h> 25 + #include <linux/async.h> 25 26 26 27 #include "base.h" 27 28 #include "power/power.h" ··· 162 161 struct device *dev = to_dev(kobj); 163 162 int retval = 0; 164 163 165 - /* add the major/minor if present */ 164 + /* add device node properties if present */ 166 165 if (MAJOR(dev->devt)) { 166 + const char *tmp; 167 + const char *name; 168 + 167 169 add_uevent_var(env, "MAJOR=%u", MAJOR(dev->devt)); 168 170 add_uevent_var(env, "MINOR=%u", MINOR(dev->devt)); 171 + name = device_get_nodename(dev, &tmp); 172 + if (name) { 173 + add_uevent_var(env, "DEVNAME=%s", name); 174 + kfree(tmp); 175 + } 169 176 } 170 177 171 178 if (dev->type && dev->type->name) ··· 883 874 * the name, and force the use of dev_name() 884 875 */ 885 876 if (dev->init_name) { 886 - dev_set_name(dev, dev->init_name); 877 + dev_set_name(dev, "%s", dev->init_name); 887 878 dev->init_name = NULL; 888 879 } 889 880 ··· 1137 1128 } 1138 1129 1139 1130 /** 1131 + * device_get_nodename - path of device node file 1132 + * @dev: device 1133 + * @tmp: possibly allocated string 1134 + * 1135 + * Return the relative path of a possible device node. 1136 + * Non-default names may need to allocate a memory to compose 1137 + * a name. This memory is returned in tmp and needs to be 1138 + * freed by the caller. 1139 + */ 1140 + const char *device_get_nodename(struct device *dev, const char **tmp) 1141 + { 1142 + char *s; 1143 + 1144 + *tmp = NULL; 1145 + 1146 + /* the device type may provide a specific name */ 1147 + if (dev->type && dev->type->nodename) 1148 + *tmp = dev->type->nodename(dev); 1149 + if (*tmp) 1150 + return *tmp; 1151 + 1152 + /* the class may provide a specific name */ 1153 + if (dev->class && dev->class->nodename) 1154 + *tmp = dev->class->nodename(dev); 1155 + if (*tmp) 1156 + return *tmp; 1157 + 1158 + /* return name without allocation, tmp == NULL */ 1159 + if (strchr(dev_name(dev), '!') == NULL) 1160 + return dev_name(dev); 1161 + 1162 + /* replace '!' in the name with '/' */ 1163 + *tmp = kstrdup(dev_name(dev), GFP_KERNEL); 1164 + if (!*tmp) 1165 + return NULL; 1166 + while ((s = strchr(*tmp, '!'))) 1167 + s[0] = '/'; 1168 + return *tmp; 1169 + } 1170 + 1171 + /** 1140 1172 * device_for_each_child - device child iterator. 1141 1173 * @parent: parent struct device. 1142 1174 * @data: data for the callback. ··· 1321 1271 if (!root) 1322 1272 return ERR_PTR(err); 1323 1273 1324 - err = dev_set_name(&root->dev, name); 1274 + err = dev_set_name(&root->dev, "%s", name); 1325 1275 if (err) { 1326 1276 kfree(root); 1327 1277 return ERR_PTR(err); ··· 1715 1665 kobject_put(sysfs_dev_char_kobj); 1716 1666 kobject_put(sysfs_dev_block_kobj); 1717 1667 kobject_put(dev_kobj); 1668 + async_synchronize_full(); 1718 1669 }
+5 -1
drivers/base/dd.c
··· 226 226 * pair is found, break out and return. 227 227 * 228 228 * Returns 1 if the device was bound to a driver; 229 - * 0 if no matching device was found; 229 + * 0 if no matching driver was found; 230 230 * -ENODEV if the device is not registered. 231 231 * 232 232 * When called for a USB interface, @dev->parent->sem must be held. ··· 320 320 devres_release_all(dev); 321 321 dev->driver = NULL; 322 322 klist_remove(&dev->p->knode_driver); 323 + if (dev->bus) 324 + blocking_notifier_call_chain(&dev->bus->p->bus_notifier, 325 + BUS_NOTIFY_UNBOUND_DRIVER, 326 + dev); 323 327 } 324 328 } 325 329
+19 -8
drivers/base/firmware_class.c
··· 40 40 static DEFINE_MUTEX(fw_lock); 41 41 42 42 struct firmware_priv { 43 - char fw_id[FIRMWARE_NAME_MAX]; 43 + char *fw_id; 44 44 struct completion completion; 45 45 struct bin_attribute attr_data; 46 46 struct firmware *fw; ··· 355 355 for (i = 0; i < fw_priv->nr_pages; i++) 356 356 __free_page(fw_priv->pages[i]); 357 357 kfree(fw_priv->pages); 358 + kfree(fw_priv->fw_id); 358 359 kfree(fw_priv); 359 - kfree(dev); 360 + put_device(dev); 360 361 361 362 module_put(THIS_MODULE); 362 363 } ··· 387 386 388 387 init_completion(&fw_priv->completion); 389 388 fw_priv->attr_data = firmware_attr_data_tmpl; 390 - strlcpy(fw_priv->fw_id, fw_name, FIRMWARE_NAME_MAX); 389 + fw_priv->fw_id = kstrdup(fw_name, GFP_KERNEL); 390 + if (!fw_priv->fw_id) { 391 + dev_err(device, "%s: Firmware name allocation failed\n", 392 + __func__); 393 + retval = -ENOMEM; 394 + goto error_kfree; 395 + } 391 396 392 397 fw_priv->timeout.function = firmware_class_timeout; 393 398 fw_priv->timeout.data = (u_long) fw_priv; 394 399 init_timer(&fw_priv->timeout); 395 400 396 - dev_set_name(f_dev, dev_name(device)); 401 + dev_set_name(f_dev, "%s", dev_name(device)); 397 402 f_dev->parent = device; 398 403 f_dev->class = &firmware_class; 399 404 dev_set_drvdata(f_dev, fw_priv); ··· 407 400 retval = device_register(f_dev); 408 401 if (retval) { 409 402 dev_err(device, "%s: device_register failed\n", __func__); 410 - goto error_kfree; 403 + put_device(f_dev); 404 + goto error_kfree_fw_id; 411 405 } 412 406 *dev_p = f_dev; 413 407 return 0; 414 408 409 + error_kfree_fw_id: 410 + kfree(fw_priv->fw_id); 415 411 error_kfree: 416 - kfree(fw_priv); 417 412 kfree(f_dev); 413 + kfree(fw_priv); 418 414 return retval; 419 415 } 420 416 ··· 625 615 * @cont: function will be called asynchronously when the firmware 626 616 * request is over. 627 617 * 628 - * Asynchronous variant of request_firmware() for contexts where 629 - * it is not possible to sleep. 618 + * Asynchronous variant of request_firmware() for user contexts where 619 + * it is not possible to sleep for long time. It can't be called 620 + * in atomic contexts. 630 621 **/ 631 622 int 632 623 request_firmware_nowait(
+4 -3
drivers/base/platform.c
··· 69 69 * @name: resource name 70 70 */ 71 71 struct resource *platform_get_resource_byname(struct platform_device *dev, 72 - unsigned int type, char *name) 72 + unsigned int type, 73 + const char *name) 73 74 { 74 75 int i; 75 76 ··· 89 88 * @dev: platform device 90 89 * @name: IRQ name 91 90 */ 92 - int platform_get_irq_byname(struct platform_device *dev, char *name) 91 + int platform_get_irq_byname(struct platform_device *dev, const char *name) 93 92 { 94 93 struct resource *r = platform_get_resource_byname(dev, IORESOURCE_IRQ, 95 94 name); ··· 245 244 if (pdev->id != -1) 246 245 dev_set_name(&pdev->dev, "%s.%d", pdev->name, pdev->id); 247 246 else 248 - dev_set_name(&pdev->dev, pdev->name); 247 + dev_set_name(&pdev->dev, "%s", pdev->name); 249 248 250 249 for (i = 0; i < pdev->num_resources; i++) { 251 250 struct resource *p, *r = &pdev->resource[i];
+7 -1
drivers/base/sys.c
··· 131 131 132 132 int sysdev_class_register(struct sysdev_class *cls) 133 133 { 134 + int retval; 135 + 134 136 pr_debug("Registering sysdev class '%s'\n", cls->name); 135 137 136 138 INIT_LIST_HEAD(&cls->drivers); ··· 140 138 cls->kset.kobj.parent = &system_kset->kobj; 141 139 cls->kset.kobj.ktype = &ktype_sysdev_class; 142 140 cls->kset.kobj.kset = system_kset; 143 - kobject_set_name(&cls->kset.kobj, cls->name); 141 + 142 + retval = kobject_set_name(&cls->kset.kobj, "%s", cls->name); 143 + if (retval) 144 + return retval; 145 + 144 146 return kset_register(&cls->kset); 145 147 } 146 148
+7
drivers/block/aoe/aoechr.c
··· 266 266 .owner = THIS_MODULE, 267 267 }; 268 268 269 + static char *aoe_nodename(struct device *dev) 270 + { 271 + return kasprintf(GFP_KERNEL, "etherd/%s", dev_name(dev)); 272 + } 273 + 269 274 int __init 270 275 aoechr_init(void) 271 276 { ··· 288 283 unregister_chrdev(AOE_MAJOR, "aoechr"); 289 284 return PTR_ERR(aoe_class); 290 285 } 286 + aoe_class->nodename = aoe_nodename; 287 + 291 288 for (i = 0; i < ARRAY_SIZE(chardevs); ++i) 292 289 device_create(aoe_class, NULL, 293 290 MKDEV(AOE_MAJOR, chardevs[i].minor), NULL,
+8 -1
drivers/block/pktcdvd.c
··· 430 430 /******************************************************************** 431 431 entries in debugfs 432 432 433 - /debugfs/pktcdvd[0-7]/ 433 + /sys/kernel/debug/pktcdvd[0-7]/ 434 434 info 435 435 436 436 *******************************************************************/ ··· 2855 2855 .media_changed = pkt_media_changed, 2856 2856 }; 2857 2857 2858 + static char *pktcdvd_nodename(struct gendisk *gd) 2859 + { 2860 + return kasprintf(GFP_KERNEL, "pktcdvd/%s", gd->disk_name); 2861 + } 2862 + 2858 2863 /* 2859 2864 * Set up mapping from pktcdvd device to CD-ROM device. 2860 2865 */ ··· 2912 2907 disk->fops = &pktcdvd_ops; 2913 2908 disk->flags = GENHD_FL_REMOVABLE; 2914 2909 strcpy(disk->disk_name, pd->name); 2910 + disk->nodename = pktcdvd_nodename; 2915 2911 disk->private_data = pd; 2916 2912 disk->queue = blk_alloc_queue(GFP_KERNEL); 2917 2913 if (!disk->queue) ··· 3068 3062 static struct miscdevice pkt_misc = { 3069 3063 .minor = MISC_DYNAMIC_MINOR, 3070 3064 .name = DRIVER_NAME, 3065 + .name = "pktcdvd/control", 3071 3066 .fops = &pkt_ctl_fops 3072 3067 }; 3073 3068
+7 -7
drivers/block/xen-blkfront.c
··· 753 753 754 754 /* Front end dir is a number, which is used as the id. */ 755 755 info->handle = simple_strtoul(strrchr(dev->nodename, '/')+1, NULL, 0); 756 - dev->dev.driver_data = info; 756 + dev_set_drvdata(&dev->dev, info); 757 757 758 758 err = talk_to_backend(dev, info); 759 759 if (err) { 760 760 kfree(info); 761 - dev->dev.driver_data = NULL; 761 + dev_set_drvdata(&dev->dev, NULL); 762 762 return err; 763 763 } 764 764 ··· 843 843 */ 844 844 static int blkfront_resume(struct xenbus_device *dev) 845 845 { 846 - struct blkfront_info *info = dev->dev.driver_data; 846 + struct blkfront_info *info = dev_get_drvdata(&dev->dev); 847 847 int err; 848 848 849 849 dev_dbg(&dev->dev, "blkfront_resume: %s\n", dev->nodename); ··· 922 922 */ 923 923 static void blkfront_closing(struct xenbus_device *dev) 924 924 { 925 - struct blkfront_info *info = dev->dev.driver_data; 925 + struct blkfront_info *info = dev_get_drvdata(&dev->dev); 926 926 unsigned long flags; 927 927 928 928 dev_dbg(&dev->dev, "blkfront_closing: %s removed\n", dev->nodename); ··· 957 957 static void backend_changed(struct xenbus_device *dev, 958 958 enum xenbus_state backend_state) 959 959 { 960 - struct blkfront_info *info = dev->dev.driver_data; 960 + struct blkfront_info *info = dev_get_drvdata(&dev->dev); 961 961 struct block_device *bd; 962 962 963 963 dev_dbg(&dev->dev, "blkfront:backend_changed.\n"); ··· 997 997 998 998 static int blkfront_remove(struct xenbus_device *dev) 999 999 { 1000 - struct blkfront_info *info = dev->dev.driver_data; 1000 + struct blkfront_info *info = dev_get_drvdata(&dev->dev); 1001 1001 1002 1002 dev_dbg(&dev->dev, "blkfront_remove: %s removed\n", dev->nodename); 1003 1003 ··· 1010 1010 1011 1011 static int blkfront_is_ready(struct xenbus_device *dev) 1012 1012 { 1013 - struct blkfront_info *info = dev->dev.driver_data; 1013 + struct blkfront_info *info = dev_get_drvdata(&dev->dev); 1014 1014 1015 1015 return info->is_ready; 1016 1016 }
+3 -3
drivers/char/hvcs.c
··· 347 347 348 348 static inline struct hvcs_struct *from_vio_dev(struct vio_dev *viod) 349 349 { 350 - return viod->dev.driver_data; 350 + return dev_get_drvdata(&viod->dev); 351 351 } 352 352 /* The sysfs interface for the driver and devices */ 353 353 ··· 785 785 kref_init(&hvcsd->kref); 786 786 787 787 hvcsd->vdev = dev; 788 - dev->dev.driver_data = hvcsd; 788 + dev_set_drvdata(&dev->dev, hvcsd); 789 789 790 790 hvcsd->index = index; 791 791 ··· 831 831 832 832 static int __devexit hvcs_remove(struct vio_dev *dev) 833 833 { 834 - struct hvcs_struct *hvcsd = dev->dev.driver_data; 834 + struct hvcs_struct *hvcsd = dev_get_drvdata(&dev->dev); 835 835 unsigned long flags; 836 836 struct tty_struct *tty; 837 837
+1
drivers/char/hw_random/core.c
··· 153 153 static struct miscdevice rng_miscdev = { 154 154 .minor = RNG_MISCDEV_MINOR, 155 155 .name = RNG_MODULE_NAME, 156 + .devnode = "hwrng", 156 157 .fops = &rng_chrdev_ops, 157 158 }; 158 159
+2 -2
drivers/char/ipmi/ipmi_si_intf.c
··· 2375 2375 info->io.addr_data, info->io.regsize, info->io.regspacing, 2376 2376 info->irq); 2377 2377 2378 - dev->dev.driver_data = (void *) info; 2378 + dev_set_drvdata(&dev->dev, info); 2379 2379 2380 2380 return try_smi_init(info); 2381 2381 } 2382 2382 2383 2383 static int __devexit ipmi_of_remove(struct of_device *dev) 2384 2384 { 2385 - cleanup_one_si(dev->dev.driver_data); 2385 + cleanup_one_si(dev_get_drvdata(&dev->dev)); 2386 2386 return 0; 2387 2387 } 2388 2388
+12 -3
drivers/char/misc.c
··· 168 168 .open = misc_open, 169 169 }; 170 170 171 - 172 171 /** 173 172 * misc_register - register a miscellaneous device 174 173 * @misc: device structure ··· 216 217 misc_minors[misc->minor >> 3] |= 1 << (misc->minor & 7); 217 218 dev = MKDEV(MISC_MAJOR, misc->minor); 218 219 219 - misc->this_device = device_create(misc_class, misc->parent, dev, NULL, 220 - "%s", misc->name); 220 + misc->this_device = device_create(misc_class, misc->parent, dev, 221 + misc, "%s", misc->name); 221 222 if (IS_ERR(misc->this_device)) { 222 223 err = PTR_ERR(misc->this_device); 223 224 goto out; ··· 263 264 EXPORT_SYMBOL(misc_register); 264 265 EXPORT_SYMBOL(misc_deregister); 265 266 267 + static char *misc_nodename(struct device *dev) 268 + { 269 + struct miscdevice *c = dev_get_drvdata(dev); 270 + 271 + if (c->devnode) 272 + return kstrdup(c->devnode, GFP_KERNEL); 273 + return NULL; 274 + } 275 + 266 276 static int __init misc_init(void) 267 277 { 268 278 int err; ··· 287 279 err = -EIO; 288 280 if (register_chrdev(MISC_MAJOR,"misc",&misc_fops)) 289 281 goto fail_printk; 282 + misc_class->nodename = misc_nodename; 290 283 return 0; 291 284 292 285 fail_printk:
+6
drivers/char/raw.c
··· 261 261 262 262 static struct cdev raw_cdev; 263 263 264 + static char *raw_nodename(struct device *dev) 265 + { 266 + return kasprintf(GFP_KERNEL, "raw/%s", dev_name(dev)); 267 + } 268 + 264 269 static int __init raw_init(void) 265 270 { 266 271 dev_t dev = MKDEV(RAW_MAJOR, 0); ··· 289 284 ret = PTR_ERR(raw_class); 290 285 goto error_region; 291 286 } 287 + raw_class->nodename = raw_nodename; 292 288 device_create(raw_class, NULL, MKDEV(RAW_MAJOR, 0), NULL, "rawctl"); 293 289 294 290 return 0;
+1 -1
drivers/eisa/pci_eisa.c
··· 31 31 } 32 32 33 33 pci_eisa_root.dev = &pdev->dev; 34 - pci_eisa_root.dev->driver_data = &pci_eisa_root; 35 34 pci_eisa_root.res = pdev->bus->resource[0]; 36 35 pci_eisa_root.bus_base_addr = pdev->bus->resource[0]->start; 37 36 pci_eisa_root.slots = EISA_MAX_SLOTS; 38 37 pci_eisa_root.dma_mask = pdev->dma_mask; 38 + dev_set_drvdata(pci_eisa_root.dev, &pci_eisa_root); 39 39 40 40 if (eisa_root_register (&pci_eisa_root)) { 41 41 printk (KERN_ERR "pci_eisa : Could not register EISA root\n");
+1 -1
drivers/eisa/virtual_root.c
··· 57 57 58 58 eisa_bus_root.force_probe = force_probe; 59 59 60 - eisa_root_dev.dev.driver_data = &eisa_bus_root; 60 + dev_set_drvdata(&eisa_root_dev.dev, &eisa_bus_root); 61 61 62 62 if (eisa_root_register (&eisa_bus_root)) { 63 63 /* A real bridge may have been registered before
+3 -3
drivers/firewire/fw-sbp2.c
··· 1125 1125 return -ENOMEM; 1126 1126 1127 1127 tgt = (struct sbp2_target *)shost->hostdata; 1128 - unit->device.driver_data = tgt; 1128 + dev_set_drvdata(&unit->device, tgt); 1129 1129 tgt->unit = unit; 1130 1130 kref_init(&tgt->kref); 1131 1131 INIT_LIST_HEAD(&tgt->lu_list); ··· 1180 1180 static int sbp2_remove(struct device *dev) 1181 1181 { 1182 1182 struct fw_unit *unit = fw_unit(dev); 1183 - struct sbp2_target *tgt = unit->device.driver_data; 1183 + struct sbp2_target *tgt = dev_get_drvdata(&unit->device); 1184 1184 1185 1185 sbp2_target_put(tgt); 1186 1186 return 0; ··· 1240 1240 1241 1241 static void sbp2_update(struct fw_unit *unit) 1242 1242 { 1243 - struct sbp2_target *tgt = unit->device.driver_data; 1243 + struct sbp2_target *tgt = dev_get_drvdata(&unit->device); 1244 1244 struct sbp2_logical_unit *lu; 1245 1245 1246 1246 fw_device_enable_phys_dma(fw_device(unit->device.parent));
+6 -6
drivers/gpu/drm/drm_debugfs.c
··· 105 105 ent = debugfs_create_file(files[i].name, S_IFREG | S_IRUGO, 106 106 root, tmp, &drm_debugfs_fops); 107 107 if (!ent) { 108 - DRM_ERROR("Cannot create /debugfs/dri/%s/%s\n", 108 + DRM_ERROR("Cannot create /sys/kernel/debug/dri/%s/%s\n", 109 109 name, files[i].name); 110 110 drm_free(tmp, sizeof(struct drm_info_node), 111 111 _DRM_DRIVER); ··· 133 133 * \param minor device minor number 134 134 * \param root DRI debugfs dir entry. 135 135 * 136 - * Create the DRI debugfs root entry "/debugfs/dri", the device debugfs root entry 137 - * "/debugfs/dri/%minor%/", and each entry in debugfs_list as 138 - * "/debugfs/dri/%minor%/%name%". 136 + * Create the DRI debugfs root entry "/sys/kernel/debug/dri", the device debugfs root entry 137 + * "/sys/kernel/debug/dri/%minor%/", and each entry in debugfs_list as 138 + * "/sys/kernel/debug/dri/%minor%/%name%". 139 139 */ 140 140 int drm_debugfs_init(struct drm_minor *minor, int minor_id, 141 141 struct dentry *root) ··· 148 148 sprintf(name, "%d", minor_id); 149 149 minor->debugfs_root = debugfs_create_dir(name, root); 150 150 if (!minor->debugfs_root) { 151 - DRM_ERROR("Cannot create /debugfs/dri/%s\n", name); 151 + DRM_ERROR("Cannot create /sys/kernel/debug/dri/%s\n", name); 152 152 return -1; 153 153 } 154 154 ··· 165 165 ret = dev->driver->debugfs_init(minor); 166 166 if (ret) { 167 167 DRM_ERROR("DRM: Driver failed to initialize " 168 - "/debugfs/dri.\n"); 168 + "/sys/kernel/debug/dri.\n"); 169 169 return ret; 170 170 } 171 171 }
+1 -1
drivers/gpu/drm/drm_drv.c
··· 339 339 340 340 drm_debugfs_root = debugfs_create_dir("dri", NULL); 341 341 if (!drm_debugfs_root) { 342 - DRM_ERROR("Cannot create /debugfs/dri\n"); 342 + DRM_ERROR("Cannot create /sys/kernel/debug/dri\n"); 343 343 ret = -1; 344 344 goto err_p3; 345 345 }
+1 -1
drivers/gpu/drm/drm_stub.c
··· 343 343 #if defined(CONFIG_DEBUG_FS) 344 344 ret = drm_debugfs_init(new_minor, minor_id, drm_debugfs_root); 345 345 if (ret) { 346 - DRM_ERROR("DRM: Failed to initialize /debugfs/dri.\n"); 346 + DRM_ERROR("DRM: Failed to initialize /sys/kernel/debug/dri.\n"); 347 347 goto err_g2; 348 348 } 349 349 #endif
+7
drivers/gpu/drm/drm_sysfs.c
··· 70 70 CORE_MINOR, CORE_PATCHLEVEL, CORE_DATE); 71 71 } 72 72 73 + static char *drm_nodename(struct device *dev) 74 + { 75 + return kasprintf(GFP_KERNEL, "dri/%s", dev_name(dev)); 76 + } 77 + 73 78 static CLASS_ATTR(version, S_IRUGO, version_show, NULL); 74 79 75 80 /** ··· 105 100 err = class_create_file(class, &class_attr_version); 106 101 if (err) 107 102 goto err_out_class; 103 + 104 + class->nodename = drm_nodename; 108 105 109 106 return class; 110 107
+6 -1
drivers/hid/usbhid/hiddev.c
··· 850 850 #endif 851 851 }; 852 852 853 + static char *hiddev_nodename(struct device *dev) 854 + { 855 + return kasprintf(GFP_KERNEL, "usb/%s", dev_name(dev)); 856 + } 857 + 853 858 static struct usb_class_driver hiddev_class = { 854 859 .name = "hiddev%d", 860 + .nodename = hiddev_nodename, 855 861 .fops = &hiddev_fops, 856 862 .minor_base = HIDDEV_MINOR_BASE, 857 863 }; ··· 960 954 { 961 955 return -ENODEV; 962 956 } 963 - 964 957 965 958 static /* const */ struct usb_driver hiddev_driver = { 966 959 .name = "hiddev",
+4 -2
drivers/ide/ide-pm.c
··· 3 3 4 4 int generic_ide_suspend(struct device *dev, pm_message_t mesg) 5 5 { 6 - ide_drive_t *drive = dev->driver_data, *pair = ide_get_pair_dev(drive); 6 + ide_drive_t *drive = dev_get_drvdata(dev); 7 + ide_drive_t *pair = ide_get_pair_dev(drive); 7 8 ide_hwif_t *hwif = drive->hwif; 8 9 struct request *rq; 9 10 struct request_pm_state rqpm; ··· 35 34 36 35 int generic_ide_resume(struct device *dev) 37 36 { 38 - ide_drive_t *drive = dev->driver_data, *pair = ide_get_pair_dev(drive); 37 + ide_drive_t *drive = dev_get_drvdata(dev); 38 + ide_drive_t *pair = ide_get_pair_dev(drive); 39 39 ide_hwif_t *hwif = drive->hwif; 40 40 struct request *rq; 41 41 struct request_pm_state rqpm;
+2 -2
drivers/ide/ide-probe.c
··· 535 535 536 536 /* register with global device tree */ 537 537 dev_set_name(&hwif->gendev, hwif->name); 538 - hwif->gendev.driver_data = hwif; 538 + dev_set_drvdata(&hwif->gendev, hwif); 539 539 if (hwif->gendev.parent == NULL) 540 540 hwif->gendev.parent = hwif->dev; 541 541 hwif->gendev.release = hwif_release_dev; ··· 987 987 int ret; 988 988 989 989 dev_set_name(dev, "%u.%u", hwif->index, i); 990 + dev_set_drvdata(dev, drive); 990 991 dev->parent = &hwif->gendev; 991 992 dev->bus = &ide_bus_type; 992 - dev->driver_data = drive; 993 993 dev->release = drive_release_dev; 994 994 995 995 ret = device_register(dev);
+1 -1
drivers/ide/ide_platform.c
··· 112 112 113 113 static int __devexit plat_ide_remove(struct platform_device *pdev) 114 114 { 115 - struct ide_host *host = pdev->dev.driver_data; 115 + struct ide_host *host = dev_get_drvdata(&pdev->dev); 116 116 117 117 ide_host_remove(host); 118 118
+7 -9
drivers/ieee1394/eth1394.c
··· 361 361 node_info->pdg.sz = 0; 362 362 node_info->fifo = CSR1212_INVALID_ADDR_SPACE; 363 363 364 - ud->device.driver_data = node_info; 364 + dev_set_drvdata(&ud->device, node_info); 365 365 new_node->ud = ud; 366 366 367 367 priv = netdev_priv(hi->dev); ··· 406 406 list_del(&old_node->list); 407 407 kfree(old_node); 408 408 409 - node_info = (struct eth1394_node_info*)ud->device.driver_data; 409 + node_info = dev_get_drvdata(&ud->device); 410 410 411 411 spin_lock_irqsave(&node_info->pdg.lock, flags); 412 412 /* The partial datagram list should be empty, but we'll just ··· 416 416 spin_unlock_irqrestore(&node_info->pdg.lock, flags); 417 417 418 418 kfree(node_info); 419 - ud->device.driver_data = NULL; 419 + dev_set_drvdata(&ud->device, NULL); 420 420 return 0; 421 421 } 422 422 ··· 688 688 ether1394_reset_priv(dev, 0); 689 689 690 690 list_for_each_entry(node, &priv->ip_node_list, list) { 691 - node_info = node->ud->device.driver_data; 691 + node_info = dev_get_drvdata(&node->ud->device); 692 692 693 693 spin_lock_irqsave(&node_info->pdg.lock, flags); 694 694 ··· 872 872 if (!node) 873 873 return cpu_to_be16(0); 874 874 875 - node_info = 876 - (struct eth1394_node_info *)node->ud->device.driver_data; 875 + node_info = dev_get_drvdata(&node->ud->device); 877 876 878 877 /* Update our speed/payload/fifo_offset table */ 879 878 node_info->maxpayload = maxpayload; ··· 1079 1080 priv->ud_list[NODEID_TO_NODE(srcid)] = ud; 1080 1081 } 1081 1082 1082 - node_info = (struct eth1394_node_info *)ud->device.driver_data; 1083 + node_info = dev_get_drvdata(&ud->device); 1083 1084 1084 1085 /* First, did we receive a fragmented or unfragmented datagram? */ 1085 1086 hdr->words.word1 = ntohs(hdr->words.word1); ··· 1616 1617 if (!node) 1617 1618 goto fail; 1618 1619 1619 - node_info = 1620 - (struct eth1394_node_info *)node->ud->device.driver_data; 1620 + node_info = dev_get_drvdata(&node->ud->device); 1621 1621 if (node_info->fifo == CSR1212_INVALID_ADDR_SPACE) 1622 1622 goto fail; 1623 1623
+4 -4
drivers/ieee1394/sbp2.c
··· 718 718 struct scsi_device *sdev; 719 719 720 720 ud = container_of(dev, struct unit_directory, device); 721 - lu = ud->device.driver_data; 721 + lu = dev_get_drvdata(&ud->device); 722 722 if (!lu) 723 723 return 0; 724 724 ··· 746 746 747 747 static int sbp2_update(struct unit_directory *ud) 748 748 { 749 - struct sbp2_lu *lu = ud->device.driver_data; 749 + struct sbp2_lu *lu = dev_get_drvdata(&ud->device); 750 750 751 751 if (sbp2_reconnect_device(lu) != 0) { 752 752 /* ··· 815 815 atomic_set(&lu->state, SBP2LU_STATE_RUNNING); 816 816 INIT_WORK(&lu->protocol_work, NULL); 817 817 818 - ud->device.driver_data = lu; 818 + dev_set_drvdata(&ud->device, lu); 819 819 820 820 hi = hpsb_get_hostinfo(&sbp2_highlevel, ud->ne->host); 821 821 if (!hi) { ··· 1051 1051 hpsb_unregister_addrspace(&sbp2_highlevel, hi->host, 1052 1052 lu->status_fifo_addr); 1053 1053 1054 - lu->ud->device.driver_data = NULL; 1054 + dev_set_drvdata(&lu->ud->device, NULL); 1055 1055 1056 1056 module_put(hi->host->driver->owner); 1057 1057 no_hi:
+1 -1
drivers/infiniband/core/sysfs.c
··· 760 760 int i; 761 761 762 762 class_dev->class = &ib_class; 763 - class_dev->driver_data = device; 764 763 class_dev->parent = device->dma_device; 765 764 dev_set_name(class_dev, device->name); 765 + dev_set_drvdata(class_dev, device); 766 766 767 767 INIT_LIST_HEAD(&device->port_list); 768 768
+4 -4
drivers/infiniband/hw/ehca/ehca_main.c
··· 636 636 struct hipz_query_hca *rblock; \ 637 637 int data; \ 638 638 \ 639 - shca = dev->driver_data; \ 639 + shca = dev_get_drvdata(dev); \ 640 640 \ 641 641 rblock = ehca_alloc_fw_ctrlblock(GFP_KERNEL); \ 642 642 if (!rblock) { \ ··· 680 680 struct device_attribute *attr, 681 681 char *buf) 682 682 { 683 - struct ehca_shca *shca = dev->driver_data; 683 + struct ehca_shca *shca = dev_get_drvdata(dev); 684 684 685 685 return sprintf(buf, "%llx\n", shca->ipz_hca_handle.handle); 686 686 ··· 749 749 750 750 shca->ofdev = dev; 751 751 shca->ipz_hca_handle.handle = *handle; 752 - dev->dev.driver_data = shca; 752 + dev_set_drvdata(&dev->dev, shca); 753 753 754 754 ret = ehca_sense_attributes(shca); 755 755 if (ret < 0) { ··· 878 878 879 879 static int __devexit ehca_remove(struct of_device *dev) 880 880 { 881 - struct ehca_shca *shca = dev->dev.driver_data; 881 + struct ehca_shca *shca = dev_get_drvdata(&dev->dev); 882 882 unsigned long flags; 883 883 int ret; 884 884
+6
drivers/input/input.c
··· 1265 1265 .uevent = input_dev_uevent, 1266 1266 }; 1267 1267 1268 + static char *input_nodename(struct device *dev) 1269 + { 1270 + return kasprintf(GFP_KERNEL, "input/%s", dev_name(dev)); 1271 + } 1272 + 1268 1273 struct class input_class = { 1269 1274 .name = "input", 1275 + .nodename = input_nodename, 1270 1276 }; 1271 1277 EXPORT_SYMBOL_GPL(input_class); 1272 1278
+1 -1
drivers/input/touchscreen/wm97xx-core.c
··· 569 569 mutex_init(&wm->codec_mutex); 570 570 571 571 wm->dev = dev; 572 - dev->driver_data = wm; 572 + dev_set_drvdata(dev, wm); 573 573 wm->ac97 = to_ac97_t(dev); 574 574 575 575 /* check that we have a supported codec */
+4 -4
drivers/input/xen-kbdfront.c
··· 114 114 xenbus_dev_fatal(dev, -ENOMEM, "allocating info structure"); 115 115 return -ENOMEM; 116 116 } 117 - dev->dev.driver_data = info; 117 + dev_set_drvdata(&dev->dev, info); 118 118 info->xbdev = dev; 119 119 info->irq = -1; 120 120 snprintf(info->phys, sizeof(info->phys), "xenbus/%s", dev->nodename); ··· 186 186 187 187 static int xenkbd_resume(struct xenbus_device *dev) 188 188 { 189 - struct xenkbd_info *info = dev->dev.driver_data; 189 + struct xenkbd_info *info = dev_get_drvdata(&dev->dev); 190 190 191 191 xenkbd_disconnect_backend(info); 192 192 memset(info->page, 0, PAGE_SIZE); ··· 195 195 196 196 static int xenkbd_remove(struct xenbus_device *dev) 197 197 { 198 - struct xenkbd_info *info = dev->dev.driver_data; 198 + struct xenkbd_info *info = dev_get_drvdata(&dev->dev); 199 199 200 200 xenkbd_disconnect_backend(info); 201 201 if (info->kbd) ··· 266 266 static void xenkbd_backend_changed(struct xenbus_device *dev, 267 267 enum xenbus_state backend_state) 268 268 { 269 - struct xenkbd_info *info = dev->dev.driver_data; 269 + struct xenkbd_info *info = dev_get_drvdata(&dev->dev); 270 270 int ret, val; 271 271 272 272 switch (backend_state) {
+1
drivers/md/dm-ioctl.c
··· 1513 1513 static struct miscdevice _dm_misc = { 1514 1514 .minor = MISC_DYNAMIC_MINOR, 1515 1515 .name = DM_NAME, 1516 + .devnode = "mapper/control", 1516 1517 .fops = &_ctl_fops 1517 1518 }; 1518 1519
+1 -1
drivers/media/common/tuners/tuner-xc2028.c
··· 48 48 "NICAM/A\n" 49 49 "NICAM/B\n"); 50 50 51 - static char firmware_name[FIRMWARE_NAME_MAX]; 51 + static char firmware_name[30]; 52 52 module_param_string(firmware_name, firmware_name, sizeof(firmware_name), 0); 53 53 MODULE_PARM_DESC(firmware_name, "Firmware file name. Allows overriding the " 54 54 "default firmware name\n");
+10
drivers/media/dvb/dvb-core/dvbdev.c
··· 447 447 return 0; 448 448 } 449 449 450 + static char *dvb_nodename(struct device *dev) 451 + { 452 + struct dvb_device *dvbdev = dev_get_drvdata(dev); 453 + 454 + return kasprintf(GFP_KERNEL, "dvb/adapter%d/%s%d", 455 + dvbdev->adapter->num, dnames[dvbdev->type], dvbdev->id); 456 + } 457 + 458 + 450 459 static int __init init_dvbdev(void) 451 460 { 452 461 int retval; ··· 478 469 goto error; 479 470 } 480 471 dvb_class->dev_uevent = dvb_uevent; 472 + dvb_class->nodename = dvb_nodename; 481 473 return 0; 482 474 483 475 error:
+1 -1
drivers/media/dvb/dvb-usb/dvb-usb.h
··· 196 196 #define CYPRESS_FX2 3 197 197 int usb_ctrl; 198 198 int (*download_firmware) (struct usb_device *, const struct firmware *); 199 - const char firmware[FIRMWARE_NAME_MAX]; 199 + const char *firmware; 200 200 int no_reconnect; 201 201 202 202 int size_of_priv;
+2 -2
drivers/media/dvb/firewire/firedtv-1394.c
··· 225 225 226 226 static int node_remove(struct device *dev) 227 227 { 228 - struct firedtv *fdtv = dev->driver_data; 228 + struct firedtv *fdtv = dev_get_drvdata(dev); 229 229 230 230 fdtv_dvb_unregister(fdtv); 231 231 ··· 242 242 243 243 static int node_update(struct unit_directory *ud) 244 244 { 245 - struct firedtv *fdtv = ud->device.driver_data; 245 + struct firedtv *fdtv = dev_get_drvdata(&ud->device); 246 246 247 247 if (fdtv->isochannel >= 0) 248 248 cmp_establish_pp_connection(fdtv, fdtv->subunit,
+1 -1
drivers/media/dvb/firewire/firedtv-dvb.c
··· 268 268 if (!fdtv) 269 269 return NULL; 270 270 271 - dev->driver_data = fdtv; 271 + dev_set_drvdata(dev, fdtv); 272 272 fdtv->device = dev; 273 273 fdtv->isochannel = -1; 274 274 fdtv->voltage = 0xff;
+6
drivers/media/video/dabusb.c
··· 747 747 .release = dabusb_release, 748 748 }; 749 749 750 + static char *dabusb_nodename(struct device *dev) 751 + { 752 + return kasprintf(GFP_KERNEL, "usb/%s", dev_name(dev)); 753 + } 754 + 750 755 static struct usb_class_driver dabusb_class = { 751 756 .name = "dabusb%d", 757 + .nodename = dabusb_nodename, 752 758 .fops = &dabusb_fops, 753 759 .minor_base = DABUSB_MINOR, 754 760 };
+11 -11
drivers/media/video/pvrusb2/pvrusb2-sysfs.c
··· 539 539 &sfp->attr_unit_number); 540 540 } 541 541 pvr2_sysfs_trace("Destroying class_dev id=%p",sfp->class_dev); 542 - sfp->class_dev->driver_data = NULL; 542 + dev_set_drvdata(sfp->class_dev, NULL); 543 543 device_unregister(sfp->class_dev); 544 544 sfp->class_dev = NULL; 545 545 } ··· 549 549 struct device_attribute *attr, char *buf) 550 550 { 551 551 struct pvr2_sysfs *sfp; 552 - sfp = (struct pvr2_sysfs *)class_dev->driver_data; 552 + sfp = dev_get_drvdata(class_dev); 553 553 if (!sfp) return -EINVAL; 554 554 return scnprintf(buf,PAGE_SIZE,"%d\n", 555 555 pvr2_hdw_v4l_get_minor_number(sfp->channel.hdw, ··· 561 561 struct device_attribute *attr, char *buf) 562 562 { 563 563 struct pvr2_sysfs *sfp; 564 - sfp = (struct pvr2_sysfs *)class_dev->driver_data; 564 + sfp = dev_get_drvdata(class_dev); 565 565 if (!sfp) return -EINVAL; 566 566 return scnprintf(buf,PAGE_SIZE,"%s\n", 567 567 pvr2_hdw_get_bus_info(sfp->channel.hdw)); ··· 572 572 struct device_attribute *attr, char *buf) 573 573 { 574 574 struct pvr2_sysfs *sfp; 575 - sfp = (struct pvr2_sysfs *)class_dev->driver_data; 575 + sfp = dev_get_drvdata(class_dev); 576 576 if (!sfp) return -EINVAL; 577 577 return scnprintf(buf,PAGE_SIZE,"%s\n", 578 578 pvr2_hdw_get_type(sfp->channel.hdw)); ··· 583 583 struct device_attribute *attr, char *buf) 584 584 { 585 585 struct pvr2_sysfs *sfp; 586 - sfp = (struct pvr2_sysfs *)class_dev->driver_data; 586 + sfp = dev_get_drvdata(class_dev); 587 587 if (!sfp) return -EINVAL; 588 588 return scnprintf(buf,PAGE_SIZE,"%s\n", 589 589 pvr2_hdw_get_desc(sfp->channel.hdw)); ··· 595 595 char *buf) 596 596 { 597 597 struct pvr2_sysfs *sfp; 598 - sfp = (struct pvr2_sysfs *)class_dev->driver_data; 598 + sfp = dev_get_drvdata(class_dev); 599 599 if (!sfp) return -EINVAL; 600 600 return scnprintf(buf,PAGE_SIZE,"%d\n", 601 601 pvr2_hdw_v4l_get_minor_number(sfp->channel.hdw, ··· 607 607 struct device_attribute *attr, char *buf) 608 608 { 609 609 struct pvr2_sysfs *sfp; 610 - sfp = (struct pvr2_sysfs *)class_dev->driver_data; 610 + sfp = dev_get_drvdata(class_dev); 611 611 if (!sfp) return -EINVAL; 612 612 return scnprintf(buf,PAGE_SIZE,"%d\n", 613 613 pvr2_hdw_get_unit_number(sfp->channel.hdw)); ··· 635 635 class_dev->parent = &usb_dev->dev; 636 636 637 637 sfp->class_dev = class_dev; 638 - class_dev->driver_data = sfp; 638 + dev_set_drvdata(class_dev, sfp); 639 639 ret = device_register(class_dev); 640 640 if (ret) { 641 641 pvr2_trace(PVR2_TRACE_ERROR_LEGS, ··· 792 792 struct device_attribute *attr, char *buf) 793 793 { 794 794 struct pvr2_sysfs *sfp; 795 - sfp = (struct pvr2_sysfs *)class_dev->driver_data; 795 + sfp = dev_get_drvdata(class_dev); 796 796 if (!sfp) return -EINVAL; 797 797 pvr2_hdw_trigger_module_log(sfp->channel.hdw); 798 798 return pvr2_debugifc_print_info(sfp->channel.hdw,buf,PAGE_SIZE); ··· 803 803 struct device_attribute *attr, char *buf) 804 804 { 805 805 struct pvr2_sysfs *sfp; 806 - sfp = (struct pvr2_sysfs *)class_dev->driver_data; 806 + sfp = dev_get_drvdata(class_dev); 807 807 if (!sfp) return -EINVAL; 808 808 return pvr2_debugifc_print_status(sfp->channel.hdw,buf,PAGE_SIZE); 809 809 } ··· 816 816 struct pvr2_sysfs *sfp; 817 817 int ret; 818 818 819 - sfp = (struct pvr2_sysfs *)class_dev->driver_data; 819 + sfp = dev_get_drvdata(class_dev); 820 820 if (!sfp) return -EINVAL; 821 821 822 822 ret = pvr2_debugifc_docmd(sfp->channel.hdw,buf,count);
+2 -2
drivers/mfd/htc-pasic3.c
··· 35 35 */ 36 36 void pasic3_write_register(struct device *dev, u32 reg, u8 val) 37 37 { 38 - struct pasic3_data *asic = dev->driver_data; 38 + struct pasic3_data *asic = dev_get_drvdata(dev); 39 39 int bus_shift = asic->bus_shift; 40 40 void __iomem *addr = asic->mapping + (REG_ADDR << bus_shift); 41 41 void __iomem *data = asic->mapping + (REG_DATA << bus_shift); ··· 50 50 */ 51 51 u8 pasic3_read_register(struct device *dev, u32 reg) 52 52 { 53 - struct pasic3_data *asic = dev->driver_data; 53 + struct pasic3_data *asic = dev_get_drvdata(dev); 54 54 int bus_shift = asic->bus_shift; 55 55 void __iomem *addr = asic->mapping + (REG_ADDR << bus_shift); 56 56 void __iomem *data = asic->mapping + (REG_DATA << bus_shift);
+1 -1
drivers/mfd/pcf50633-core.c
··· 618 618 619 619 pdev->dev.parent = pcf->dev; 620 620 pdev->dev.platform_data = &pdata->reg_init_data[i]; 621 - pdev->dev.driver_data = pcf; 621 + dev_set_drvdata(&pdev->dev, pcf); 622 622 pcf->regulator_pdev[i] = pdev; 623 623 624 624 platform_device_add(pdev);
+1 -1
drivers/mfd/wm8400-core.c
··· 265 265 266 266 mutex_init(&wm8400->io_lock); 267 267 268 - wm8400->dev->driver_data = wm8400; 268 + dev_set_drvdata(wm8400->dev, wm8400); 269 269 270 270 /* Check that this is actually a WM8400 */ 271 271 ret = wm8400->read_dev(wm8400->io_data, WM8400_RESET_ID, 1, &reg);
+2 -2
drivers/net/Kconfig
··· 2206 2206 depends on SKGE && DEBUG_FS 2207 2207 help 2208 2208 This option adds the ability to dump driver state for debugging. 2209 - The file debugfs/skge/ethX displays the state of the internal 2209 + The file /sys/kernel/debug/skge/ethX displays the state of the internal 2210 2210 transmit and receive rings. 2211 2211 2212 2212 If unsure, say N. ··· 2232 2232 depends on SKY2 && DEBUG_FS 2233 2233 help 2234 2234 This option adds the ability to dump driver state for debugging. 2235 - The file debugfs/sky2/ethX displays the state of the internal 2235 + The file /sys/kernel/debug/sky2/ethX displays the state of the internal 2236 2236 transmit and receive rings. 2237 2237 2238 2238 If unsure, say N.
+1
drivers/net/tun.c
··· 1366 1366 static struct miscdevice tun_miscdev = { 1367 1367 .minor = TUN_MINOR, 1368 1368 .name = "tun", 1369 + .devnode = "net/tun", 1369 1370 .fops = &tun_fops, 1370 1371 }; 1371 1372
+1 -1
drivers/net/wimax/i2400m/i2400m.h
··· 432 432 unsigned ready:1; /* all probing steps done */ 433 433 unsigned rx_reorder:1; /* RX reorder is enabled */ 434 434 u8 trace_msg_from_user; /* echo rx msgs to 'trace' pipe */ 435 - /* typed u8 so debugfs/u8 can tweak */ 435 + /* typed u8 so /sys/kernel/debug/u8 can tweak */ 436 436 enum i2400m_system_state state; 437 437 wait_queue_head_t state_wq; /* Woken up when on state updates */ 438 438
+2 -3
drivers/net/wireless/ath/ath5k/Kconfig
··· 28 28 Say Y, if and you will get debug options for ath5k. 29 29 To use this, you need to mount debugfs: 30 30 31 - mkdir /debug/ 32 - mount -t debugfs debug /debug/ 31 + mount -t debugfs debug /sys/kernel/debug 33 32 34 33 You will get access to files under: 35 - /debug/ath5k/phy0/ 34 + /sys/kernel/debug/ath5k/phy0/ 36 35 37 36 To enable debug, pass the debug level to the debug module 38 37 parameter. For example:
+6 -6
drivers/net/wireless/libertas/README
··· 72 72 location that is to be read. This parameter must be specified in 73 73 hexadecimal (its possible to preceed preceding the number with a "0x"). 74 74 75 - Path: /debugfs/libertas_wireless/ethX/registers/ 75 + Path: /sys/kernel/debug/libertas_wireless/ethX/registers/ 76 76 77 77 Usage: 78 78 echo "0xa123" > rdmac ; cat rdmac ··· 95 95 sleepparams 96 96 This command is used to set the sleepclock configurations 97 97 98 - Path: /debugfs/libertas_wireless/ethX/ 98 + Path: /sys/kernel/debug/libertas_wireless/ethX/ 99 99 100 100 Usage: 101 101 cat sleepparams: reads the current sleepclock configuration ··· 115 115 The subscribed_events directory contains the interface for the 116 116 subscribed events API. 117 117 118 - Path: /debugfs/libertas_wireless/ethX/subscribed_events/ 118 + Path: /sys/kernel/debug/libertas_wireless/ethX/subscribed_events/ 119 119 120 120 Each event is represented by a filename. Each filename consists of the 121 121 following three fields: ··· 165 165 extscan 166 166 This command is used to do a specific scan. 167 167 168 - Path: /debugfs/libertas_wireless/ethX/ 168 + Path: /sys/kernel/debug/libertas_wireless/ethX/ 169 169 170 170 Usage: echo "SSID" > extscan 171 171 ··· 179 179 Display the current contents of the driver scan table (ie. get the 180 180 scan results). 181 181 182 - Path: /debugfs/libertas_wireless/ethX/ 182 + Path: /sys/kernel/debug/libertas_wireless/ethX/ 183 183 184 184 Usage: 185 185 cat getscantable ··· 188 188 Initiate a customized scan and retrieve the results 189 189 190 190 191 - Path: /debugfs/libertas_wireless/ethX/ 191 + Path: /sys/kernel/debug/libertas_wireless/ethX/ 192 192 193 193 Usage: 194 194 echo "[ARGS]" > setuserscan
+4 -4
drivers/net/wireless/libertas/if_spi.c
··· 43 43 struct lbs_private *priv; 44 44 struct libertas_spi_platform_data *pdata; 45 45 46 - char helper_fw_name[FIRMWARE_NAME_MAX]; 47 - char main_fw_name[FIRMWARE_NAME_MAX]; 46 + char helper_fw_name[IF_SPI_FW_NAME_MAX]; 47 + char main_fw_name[IF_SPI_FW_NAME_MAX]; 48 48 49 49 /* The card ID and card revision, as reported by the hardware. */ 50 50 u16 card_id; ··· 1019 1019 lbs_pr_err("Unsupported chip_id: 0x%02x\n", card_id); 1020 1020 return -EAFNOSUPPORT; 1021 1021 } 1022 - snprintf(helper_fw, FIRMWARE_NAME_MAX, "libertas/gspi%d_hlp.bin", 1022 + snprintf(helper_fw, IF_SPI_FW_NAME_MAX, "libertas/gspi%d_hlp.bin", 1023 1023 chip_id_to_device_name[i].name); 1024 - snprintf(main_fw, FIRMWARE_NAME_MAX, "libertas/gspi%d.bin", 1024 + snprintf(main_fw, IF_SPI_FW_NAME_MAX, "libertas/gspi%d.bin", 1025 1025 chip_id_to_device_name[i].name); 1026 1026 return 0; 1027 1027 }
+3
drivers/net/wireless/libertas/if_spi.h
··· 22 22 #define IF_SPI_CMD_BUF_SIZE 2400 23 23 24 24 /***************** Firmware *****************/ 25 + 26 + #define IF_SPI_FW_NAME_MAX 30 27 + 25 28 struct chip_ident { 26 29 u16 chip_id; 27 30 u16 name;
+2 -6
drivers/net/wireless/libertas/if_usb.c
··· 61 61 { 62 62 struct lbs_private *priv = to_net_dev(dev)->ml_priv; 63 63 struct if_usb_card *cardp = priv->card; 64 - char fwname[FIRMWARE_NAME_MAX]; 65 64 int ret; 66 65 67 - sscanf(buf, "%29s", fwname); /* FIRMWARE_NAME_MAX - 1 = 29 */ 68 - ret = if_usb_prog_firmware(cardp, fwname, BOOT_CMD_UPDATE_FW); 66 + ret = if_usb_prog_firmware(cardp, buf, BOOT_CMD_UPDATE_FW); 69 67 if (ret == 0) 70 68 return count; 71 69 ··· 86 88 { 87 89 struct lbs_private *priv = to_net_dev(dev)->ml_priv; 88 90 struct if_usb_card *cardp = priv->card; 89 - char fwname[FIRMWARE_NAME_MAX]; 90 91 int ret; 91 92 92 - sscanf(buf, "%29s", fwname); /* FIRMWARE_NAME_MAX - 1 = 29 */ 93 - ret = if_usb_prog_firmware(cardp, fwname, BOOT_CMD_UPDATE_BOOT2); 93 + ret = if_usb_prog_firmware(cardp, buf, BOOT_CMD_UPDATE_BOOT2); 94 94 if (ret == 0) 95 95 return count; 96 96
+5 -5
drivers/net/xen-netfront.c
··· 1212 1212 } 1213 1213 1214 1214 info = netdev_priv(netdev); 1215 - dev->dev.driver_data = info; 1215 + dev_set_drvdata(&dev->dev, info); 1216 1216 1217 1217 err = register_netdev(info->netdev); 1218 1218 if (err) { ··· 1233 1233 1234 1234 fail: 1235 1235 free_netdev(netdev); 1236 - dev->dev.driver_data = NULL; 1236 + dev_set_drvdata(&dev->dev, NULL); 1237 1237 return err; 1238 1238 } 1239 1239 ··· 1275 1275 */ 1276 1276 static int netfront_resume(struct xenbus_device *dev) 1277 1277 { 1278 - struct netfront_info *info = dev->dev.driver_data; 1278 + struct netfront_info *info = dev_get_drvdata(&dev->dev); 1279 1279 1280 1280 dev_dbg(&dev->dev, "%s\n", dev->nodename); 1281 1281 ··· 1600 1600 static void backend_changed(struct xenbus_device *dev, 1601 1601 enum xenbus_state backend_state) 1602 1602 { 1603 - struct netfront_info *np = dev->dev.driver_data; 1603 + struct netfront_info *np = dev_get_drvdata(&dev->dev); 1604 1604 struct net_device *netdev = np->netdev; 1605 1605 1606 1606 dev_dbg(&dev->dev, "%s\n", xenbus_strstate(backend_state)); ··· 1774 1774 1775 1775 static int __devexit xennet_remove(struct xenbus_device *dev) 1776 1776 { 1777 - struct netfront_info *info = dev->dev.driver_data; 1777 + struct netfront_info *info = dev_get_drvdata(&dev->dev); 1778 1778 1779 1779 dev_dbg(&dev->dev, "%s\n", dev->nodename); 1780 1780
+1 -1
drivers/parisc/eisa.c
··· 373 373 if (result >= 0) { 374 374 /* FIXME : Don't enumerate the bus twice. */ 375 375 eisa_dev.root.dev = &dev->dev; 376 - dev->dev.driver_data = &eisa_dev.root; 376 + dev_set_drvdata(&dev->dev, &eisa_dev.root); 377 377 eisa_dev.root.bus_base_addr = 0; 378 378 eisa_dev.root.res = &eisa_dev.hba.io_space; 379 379 eisa_dev.root.slots = result;
+3 -3
drivers/parisc/sba_iommu.c
··· 2010 2010 void * sba_get_iommu(struct parisc_device *pci_hba) 2011 2011 { 2012 2012 struct parisc_device *sba_dev = parisc_parent(pci_hba); 2013 - struct sba_device *sba = sba_dev->dev.driver_data; 2013 + struct sba_device *sba = dev_get_drvdata(&sba_dev->dev); 2014 2014 char t = sba_dev->id.hw_type; 2015 2015 int iocnum = (pci_hba->hw_path >> 3); /* rope # */ 2016 2016 ··· 2031 2031 void sba_directed_lmmio(struct parisc_device *pci_hba, struct resource *r) 2032 2032 { 2033 2033 struct parisc_device *sba_dev = parisc_parent(pci_hba); 2034 - struct sba_device *sba = sba_dev->dev.driver_data; 2034 + struct sba_device *sba = dev_get_drvdata(&sba_dev->dev); 2035 2035 char t = sba_dev->id.hw_type; 2036 2036 int i; 2037 2037 int rope = (pci_hba->hw_path & (ROPES_PER_IOC-1)); /* rope # */ ··· 2073 2073 void sba_distributed_lmmio(struct parisc_device *pci_hba, struct resource *r ) 2074 2074 { 2075 2075 struct parisc_device *sba_dev = parisc_parent(pci_hba); 2076 - struct sba_device *sba = sba_dev->dev.driver_data; 2076 + struct sba_device *sba = dev_get_drvdata(&sba_dev->dev); 2077 2077 char t = sba_dev->id.hw_type; 2078 2078 int base, size; 2079 2079 int rope = (pci_hba->hw_path & (ROPES_PER_IOC-1)); /* rope # */
+2 -2
drivers/parport/parport_gsc.c
··· 376 376 /* PARPORT_IRQ_NONE */ PARPORT_DMA_NONE, NULL); 377 377 if (p) 378 378 parport_count++; 379 - dev->dev.driver_data = p; 379 + dev_set_drvdata(&dev->dev, p); 380 380 381 381 return 0; 382 382 } 383 383 384 384 static int __devexit parport_remove_chip(struct parisc_device *dev) 385 385 { 386 - struct parport *p = dev->dev.driver_data; 386 + struct parport *p = dev_get_drvdata(&dev->dev); 387 387 if (p) { 388 388 struct parport_gsc_private *priv = p->private_data; 389 389 struct parport_operations *ops = p->ops;
+1 -1
drivers/pci/pcie/portdrv_core.c
··· 275 275 memset(device, 0, sizeof(struct device)); 276 276 device->bus = &pcie_port_bus_type; 277 277 device->driver = NULL; 278 - device->driver_data = NULL; 278 + dev_set_drvdata(device, NULL); 279 279 device->release = release_pcie_device; /* callback to free pcie dev */ 280 280 dev_set_name(device, "%s:pcie%02x", 281 281 pci_name(parent), get_descriptor_id(port_type, service_type));
+5 -15
drivers/pcmcia/ds.c
··· 394 394 p_drv = to_pcmcia_drv(dev->driver); 395 395 s = p_dev->socket; 396 396 397 - /* The PCMCIA code passes the match data in via dev->driver_data 397 + /* The PCMCIA code passes the match data in via dev_set_drvdata(dev) 398 398 * which is an ugly hack. Once the driver probe is called it may 399 399 * and often will overwrite the match data so we must save it first 400 400 * ··· 404 404 * call which will then check whether there are two 405 405 * pseudo devices, and if not, add the second one. 406 406 */ 407 - did = p_dev->dev.driver_data; 407 + did = dev_get_drvdata(&p_dev->dev); 408 408 409 409 ds_dev_dbg(1, dev, "trying to bind to %s\n", p_drv->drv.name); 410 410 ··· 499 499 * pseudo multi-function card, we need to unbind 500 500 * all devices 501 501 */ 502 - did = p_dev->dev.driver_data; 502 + did = dev_get_drvdata(&p_dev->dev); 503 503 if (did && (did->match_flags & PCMCIA_DEV_ID_MATCH_DEVICE_NO) && 504 504 (p_dev->socket->device_count != 0) && 505 505 (p_dev->device_no == 0)) ··· 828 828 { 829 829 struct pcmcia_socket *s = dev->socket; 830 830 const struct firmware *fw; 831 - char path[FIRMWARE_NAME_MAX]; 832 831 int ret = -ENOMEM; 833 832 int no_funcs; 834 833 int old_funcs; ··· 838 839 839 840 ds_dev_dbg(1, &dev->dev, "trying to load CIS file %s\n", filename); 840 841 841 - if (strlen(filename) > (FIRMWARE_NAME_MAX - 1)) { 842 - dev_printk(KERN_WARNING, &dev->dev, 843 - "pcmcia: CIS filename is too long [%s]\n", 844 - filename); 845 - return -EINVAL; 846 - } 847 - 848 - snprintf(path, sizeof(path), "%s", filename); 849 - 850 - if (request_firmware(&fw, path, &dev->dev) == 0) { 842 + if (request_firmware(&fw, filename, &dev->dev) == 0) { 851 843 if (fw->size >= CISTPL_MAX_CIS_SIZE) { 852 844 ret = -EINVAL; 853 845 dev_printk(KERN_ERR, &dev->dev, ··· 978 988 return 0; 979 989 } 980 990 981 - dev->dev.driver_data = (void *) did; 991 + dev_set_drvdata(&dev->dev, did); 982 992 983 993 return 1; 984 994 }
+8 -8
drivers/s390/char/con3215.c
··· 364 364 int cstat, dstat; 365 365 int count; 366 366 367 - raw = cdev->dev.driver_data; 367 + raw = dev_get_drvdata(&cdev->dev); 368 368 req = (struct raw3215_req *) intparm; 369 369 cstat = irb->scsw.cmd.cstat; 370 370 dstat = irb->scsw.cmd.dstat; ··· 652 652 int line; 653 653 654 654 /* Console is special. */ 655 - if (raw3215[0] && (cdev->dev.driver_data == raw3215[0])) 655 + if (raw3215[0] && (raw3215[0] == dev_get_drvdata(&cdev->dev))) 656 656 return 0; 657 657 raw = kmalloc(sizeof(struct raw3215_info) + 658 658 RAW3215_INBUF_SIZE, GFP_KERNEL|GFP_DMA); ··· 686 686 } 687 687 init_waitqueue_head(&raw->empty_wait); 688 688 689 - cdev->dev.driver_data = raw; 689 + dev_set_drvdata(&cdev->dev, raw); 690 690 cdev->handler = raw3215_irq; 691 691 692 692 return 0; ··· 697 697 struct raw3215_info *raw; 698 698 699 699 ccw_device_set_offline(cdev); 700 - raw = cdev->dev.driver_data; 700 + raw = dev_get_drvdata(&cdev->dev); 701 701 if (raw) { 702 - cdev->dev.driver_data = NULL; 702 + dev_set_drvdata(&cdev->dev, NULL); 703 703 kfree(raw->buffer); 704 704 kfree(raw); 705 705 } ··· 709 709 { 710 710 struct raw3215_info *raw; 711 711 712 - raw = cdev->dev.driver_data; 712 + raw = dev_get_drvdata(&cdev->dev); 713 713 if (!raw) 714 714 return -ENODEV; 715 715 ··· 720 720 { 721 721 struct raw3215_info *raw; 722 722 723 - raw = cdev->dev.driver_data; 723 + raw = dev_get_drvdata(&cdev->dev); 724 724 if (!raw) 725 725 return -ENODEV; 726 726 ··· 898 898 raw->buffer = (char *) alloc_bootmem_low(RAW3215_BUFFER_SIZE); 899 899 raw->inbuf = (char *) alloc_bootmem_low(RAW3215_INBUF_SIZE); 900 900 raw->cdev = cdev; 901 - cdev->dev.driver_data = raw; 901 + dev_set_drvdata(&cdev->dev, raw); 902 902 cdev->handler = raw3215_irq; 903 903 904 904 raw->flags |= RAW3215_FIXED;
+8 -8
drivers/s390/char/raw3270.c
··· 357 357 struct raw3270_request *rq; 358 358 int rc; 359 359 360 - rp = (struct raw3270 *) cdev->dev.driver_data; 360 + rp = dev_get_drvdata(&cdev->dev); 361 361 if (!rp) 362 362 return; 363 363 rq = (struct raw3270_request *) intparm; ··· 831 831 if (rp->minor == -1) 832 832 return -EUSERS; 833 833 rp->cdev = cdev; 834 - cdev->dev.driver_data = rp; 834 + dev_set_drvdata(&cdev->dev, rp); 835 835 cdev->handler = raw3270_irq; 836 836 return 0; 837 837 } ··· 1112 1112 /* Disconnect from ccw_device. */ 1113 1113 cdev = rp->cdev; 1114 1114 rp->cdev = NULL; 1115 - cdev->dev.driver_data = NULL; 1115 + dev_set_drvdata(&cdev->dev, NULL); 1116 1116 cdev->handler = NULL; 1117 1117 1118 1118 /* Put ccw_device structure. */ ··· 1136 1136 raw3270_model_show(struct device *dev, struct device_attribute *attr, char *buf) 1137 1137 { 1138 1138 return snprintf(buf, PAGE_SIZE, "%i\n", 1139 - ((struct raw3270 *) dev->driver_data)->model); 1139 + ((struct raw3270 *) dev_get_drvdata(dev))->model); 1140 1140 } 1141 1141 static DEVICE_ATTR(model, 0444, raw3270_model_show, NULL); 1142 1142 ··· 1144 1144 raw3270_rows_show(struct device *dev, struct device_attribute *attr, char *buf) 1145 1145 { 1146 1146 return snprintf(buf, PAGE_SIZE, "%i\n", 1147 - ((struct raw3270 *) dev->driver_data)->rows); 1147 + ((struct raw3270 *) dev_get_drvdata(dev))->rows); 1148 1148 } 1149 1149 static DEVICE_ATTR(rows, 0444, raw3270_rows_show, NULL); 1150 1150 ··· 1152 1152 raw3270_columns_show(struct device *dev, struct device_attribute *attr, char *buf) 1153 1153 { 1154 1154 return snprintf(buf, PAGE_SIZE, "%i\n", 1155 - ((struct raw3270 *) dev->driver_data)->cols); 1155 + ((struct raw3270 *) dev_get_drvdata(dev))->cols); 1156 1156 } 1157 1157 static DEVICE_ATTR(columns, 0444, raw3270_columns_show, NULL); 1158 1158 ··· 1289 1289 struct raw3270_view *v; 1290 1290 struct raw3270_notifier *np; 1291 1291 1292 - rp = cdev->dev.driver_data; 1292 + rp = dev_get_drvdata(&cdev->dev); 1293 1293 /* 1294 1294 * _remove is the opposite of _probe; it's probe that 1295 1295 * should set up rp. raw3270_remove gets entered for ··· 1337 1337 { 1338 1338 struct raw3270 *rp; 1339 1339 1340 - rp = cdev->dev.driver_data; 1340 + rp = dev_get_drvdata(&cdev->dev); 1341 1341 if (test_bit(RAW3270_FLAGS_CONSOLE, &rp->flags)) 1342 1342 return -EBUSY; 1343 1343 raw3270_remove(cdev);
+1 -1
drivers/s390/char/tape_34xx.c
··· 1289 1289 tape_34xx_online(struct ccw_device *cdev) 1290 1290 { 1291 1291 return tape_generic_online( 1292 - cdev->dev.driver_data, 1292 + dev_get_drvdata(&cdev->dev), 1293 1293 &tape_discipline_34xx 1294 1294 ); 1295 1295 }
+1 -1
drivers/s390/char/tape_3590.c
··· 1703 1703 static int 1704 1704 tape_3590_online(struct ccw_device *cdev) 1705 1705 { 1706 - return tape_generic_online(cdev->dev.driver_data, 1706 + return tape_generic_online(dev_get_drvdata(&cdev->dev), 1707 1707 &tape_discipline_3590); 1708 1708 } 1709 1709
+11 -11
drivers/s390/char/tape_core.c
··· 92 92 { 93 93 struct tape_device *tdev; 94 94 95 - tdev = (struct tape_device *) dev->driver_data; 95 + tdev = dev_get_drvdata(dev); 96 96 return scnprintf(buf, PAGE_SIZE, "%i\n", tdev->medium_state); 97 97 } 98 98 ··· 104 104 { 105 105 struct tape_device *tdev; 106 106 107 - tdev = (struct tape_device *) dev->driver_data; 107 + tdev = dev_get_drvdata(dev); 108 108 return scnprintf(buf, PAGE_SIZE, "%i\n", tdev->first_minor); 109 109 } 110 110 ··· 116 116 { 117 117 struct tape_device *tdev; 118 118 119 - tdev = (struct tape_device *) dev->driver_data; 119 + tdev = dev_get_drvdata(dev); 120 120 return scnprintf(buf, PAGE_SIZE, "%s\n", (tdev->first_minor < 0) ? 121 121 "OFFLINE" : tape_state_verbose[tdev->tape_state]); 122 122 } ··· 130 130 struct tape_device *tdev; 131 131 ssize_t rc; 132 132 133 - tdev = (struct tape_device *) dev->driver_data; 133 + tdev = dev_get_drvdata(dev); 134 134 if (tdev->first_minor < 0) 135 135 return scnprintf(buf, PAGE_SIZE, "N/A\n"); 136 136 ··· 156 156 { 157 157 struct tape_device *tdev; 158 158 159 - tdev = (struct tape_device *) dev->driver_data; 159 + tdev = dev_get_drvdata(dev); 160 160 161 161 return scnprintf(buf, PAGE_SIZE, "%i\n", tdev->char_data.block_size); 162 162 } ··· 440 440 { 441 441 struct tape_device *device; 442 442 443 - device = cdev->dev.driver_data; 443 + device = dev_get_drvdata(&cdev->dev); 444 444 if (!device) { 445 445 return -ENODEV; 446 446 } ··· 583 583 tape_put_device(device); 584 584 return ret; 585 585 } 586 - cdev->dev.driver_data = device; 586 + dev_set_drvdata(&cdev->dev, device); 587 587 cdev->handler = __tape_do_irq; 588 588 device->cdev = cdev; 589 589 ccw_device_get_id(cdev, &dev_id); ··· 622 622 { 623 623 struct tape_device * device; 624 624 625 - device = cdev->dev.driver_data; 625 + device = dev_get_drvdata(&cdev->dev); 626 626 if (!device) { 627 627 return; 628 628 } ··· 662 662 tape_cleanup_device(device); 663 663 } 664 664 665 - if (cdev->dev.driver_data != NULL) { 665 + if (!dev_get_drvdata(&cdev->dev)) { 666 666 sysfs_remove_group(&cdev->dev.kobj, &tape_attr_group); 667 - cdev->dev.driver_data = tape_put_device(cdev->dev.driver_data); 667 + dev_set_drvdata(&cdev->dev, tape_put_device(dev_get_drvdata(&cdev->dev))); 668 668 } 669 669 } 670 670 ··· 1060 1060 struct tape_request *request; 1061 1061 int rc; 1062 1062 1063 - device = (struct tape_device *) cdev->dev.driver_data; 1063 + device = dev_get_drvdata(&cdev->dev); 1064 1064 if (device == NULL) { 1065 1065 return; 1066 1066 }
+6 -6
drivers/s390/char/vmlogrdr.c
··· 504 504 struct device_attribute *attr, 505 505 const char * buf, size_t count) 506 506 { 507 - struct vmlogrdr_priv_t *priv = dev->driver_data; 507 + struct vmlogrdr_priv_t *priv = dev_get_drvdata(dev); 508 508 ssize_t ret = count; 509 509 510 510 switch (buf[0]) { ··· 525 525 struct device_attribute *attr, 526 526 char *buf) 527 527 { 528 - struct vmlogrdr_priv_t *priv = dev->driver_data; 528 + struct vmlogrdr_priv_t *priv = dev_get_drvdata(dev); 529 529 return sprintf(buf, "%u\n", priv->autopurge); 530 530 } 531 531 ··· 541 541 542 542 char cp_command[80]; 543 543 char cp_response[80]; 544 - struct vmlogrdr_priv_t *priv = dev->driver_data; 544 + struct vmlogrdr_priv_t *priv = dev_get_drvdata(dev); 545 545 546 546 if (buf[0] != '1') 547 547 return -EINVAL; ··· 578 578 struct device_attribute *attr, 579 579 const char *buf, size_t count) 580 580 { 581 - struct vmlogrdr_priv_t *priv = dev->driver_data; 581 + struct vmlogrdr_priv_t *priv = dev_get_drvdata(dev); 582 582 ssize_t ret = count; 583 583 584 584 switch (buf[0]) { ··· 599 599 struct device_attribute *attr, 600 600 char *buf) 601 601 { 602 - struct vmlogrdr_priv_t *priv = dev->driver_data; 602 + struct vmlogrdr_priv_t *priv = dev_get_drvdata(dev); 603 603 return sprintf(buf, "%u\n", priv->autorecording); 604 604 } 605 605 ··· 612 612 struct device_attribute *attr, 613 613 const char * buf, size_t count) 614 614 { 615 - struct vmlogrdr_priv_t *priv = dev->driver_data; 615 + struct vmlogrdr_priv_t *priv = dev_get_drvdata(dev); 616 616 ssize_t ret; 617 617 618 618 switch (buf[0]) {
+8 -8
drivers/s390/char/vmur.c
··· 80 80 * 81 81 * Each ur device (urd) contains a reference to its corresponding ccw device 82 82 * (cdev) using the urd->cdev pointer. Each ccw device has a reference to the 83 - * ur device using the cdev->dev.driver_data pointer. 83 + * ur device using dev_get_drvdata(&cdev->dev) pointer. 84 84 * 85 85 * urd references: 86 86 * - ur_probe gets a urd reference, ur_remove drops the reference 87 - * (cdev->dev.driver_data) 87 + * dev_get_drvdata(&cdev->dev) 88 88 * - ur_open gets a urd reference, ur_relase drops the reference 89 89 * (urf->urd) 90 90 * ··· 92 92 * - urdev_alloc get a cdev reference (urd->cdev) 93 93 * - urdev_free drops the cdev reference (urd->cdev) 94 94 * 95 - * Setting and clearing of cdev->dev.driver_data is protected by the ccwdev lock 95 + * Setting and clearing of dev_get_drvdata(&cdev->dev) is protected by the ccwdev lock 96 96 */ 97 97 static struct urdev *urdev_alloc(struct ccw_device *cdev) 98 98 { ··· 131 131 unsigned long flags; 132 132 133 133 spin_lock_irqsave(get_ccwdev_lock(cdev), flags); 134 - urd = cdev->dev.driver_data; 134 + urd = dev_get_drvdata(&cdev->dev); 135 135 if (urd) 136 136 urdev_get(urd); 137 137 spin_unlock_irqrestore(get_ccwdev_lock(cdev), flags); ··· 310 310 TRACE("ur_int_handler: unsolicited interrupt\n"); 311 311 return; 312 312 } 313 - urd = cdev->dev.driver_data; 313 + urd = dev_get_drvdata(&cdev->dev); 314 314 BUG_ON(!urd); 315 315 /* On special conditions irb is an error pointer */ 316 316 if (IS_ERR(irb)) ··· 856 856 goto fail_remove_attr; 857 857 } 858 858 spin_lock_irq(get_ccwdev_lock(cdev)); 859 - cdev->dev.driver_data = urd; 859 + dev_set_drvdata(&cdev->dev, urd); 860 860 spin_unlock_irq(get_ccwdev_lock(cdev)); 861 861 862 862 mutex_unlock(&vmur_mutex); ··· 996 996 ur_remove_attributes(&cdev->dev); 997 997 998 998 spin_lock_irqsave(get_ccwdev_lock(cdev), flags); 999 - urdev_put(cdev->dev.driver_data); 1000 - cdev->dev.driver_data = NULL; 999 + urdev_put(dev_get_drvdata(&cdev->dev)); 1000 + dev_set_drvdata(&cdev->dev, NULL); 1001 1001 spin_unlock_irqrestore(get_ccwdev_lock(cdev), flags); 1002 1002 1003 1003 mutex_unlock(&vmur_mutex);
+26 -26
drivers/s390/net/claw.c
··· 290 290 if (!get_device(&cgdev->dev)) 291 291 return -ENODEV; 292 292 privptr = kzalloc(sizeof(struct claw_privbk), GFP_KERNEL); 293 - cgdev->dev.driver_data = privptr; 293 + dev_set_drvdata(&cgdev->dev, privptr); 294 294 if (privptr == NULL) { 295 295 probe_error(cgdev); 296 296 put_device(&cgdev->dev); ··· 597 597 598 598 CLAW_DBF_TEXT(4, trace, "clawirq"); 599 599 /* Bypass all 'unsolicited interrupts' */ 600 - if (!cdev->dev.driver_data) { 600 + privptr = dev_get_drvdata(&cdev->dev); 601 + if (!privptr) { 601 602 dev_warn(&cdev->dev, "An uninitialized CLAW device received an" 602 603 " IRQ, c-%02x d-%02x\n", 603 604 irb->scsw.cmd.cstat, irb->scsw.cmd.dstat); 604 605 CLAW_DBF_TEXT(2, trace, "badirq"); 605 606 return; 606 607 } 607 - privptr = (struct claw_privbk *)cdev->dev.driver_data; 608 608 609 609 /* Try to extract channel from driver data. */ 610 610 if (privptr->channel[READ].cdev == cdev) ··· 1986 1986 struct claw_privbk *privptr; 1987 1987 1988 1988 CLAW_DBF_TEXT(4, trace, "proberr"); 1989 - privptr = (struct claw_privbk *) cgdev->dev.driver_data; 1989 + privptr = dev_get_drvdata(&cgdev->dev); 1990 1990 if (privptr != NULL) { 1991 - cgdev->dev.driver_data = NULL; 1991 + dev_set_drvdata(&cgdev->dev, NULL); 1992 1992 kfree(privptr->p_env); 1993 1993 kfree(privptr->p_mtc_envelope); 1994 1994 kfree(privptr); ··· 2917 2917 dev_info(&cgdev->dev, "add for %s\n", 2918 2918 dev_name(&cgdev->cdev[READ]->dev)); 2919 2919 CLAW_DBF_TEXT(2, setup, "new_dev"); 2920 - privptr = cgdev->dev.driver_data; 2921 - cgdev->cdev[READ]->dev.driver_data = privptr; 2922 - cgdev->cdev[WRITE]->dev.driver_data = privptr; 2920 + privptr = dev_get_drvdata(&cgdev->dev); 2921 + dev_set_drvdata(&cgdev->cdev[READ]->dev, privptr); 2922 + dev_set_drvdata(&cgdev->cdev[WRITE]->dev, privptr); 2923 2923 if (!privptr) 2924 2924 return -ENODEV; 2925 2925 p_env = privptr->p_env; ··· 2956 2956 goto out; 2957 2957 } 2958 2958 dev->ml_priv = privptr; 2959 - cgdev->dev.driver_data = privptr; 2960 - cgdev->cdev[READ]->dev.driver_data = privptr; 2961 - cgdev->cdev[WRITE]->dev.driver_data = privptr; 2959 + dev_set_drvdata(&cgdev->dev, privptr); 2960 + dev_set_drvdata(&cgdev->cdev[READ]->dev, privptr); 2961 + dev_set_drvdata(&cgdev->cdev[WRITE]->dev, privptr); 2962 2962 /* sysfs magic */ 2963 2963 SET_NETDEV_DEV(dev, &cgdev->dev); 2964 2964 if (register_netdev(dev) != 0) { ··· 3024 3024 int ret; 3025 3025 3026 3026 CLAW_DBF_TEXT_(2, setup, "%s", dev_name(&cgdev->dev)); 3027 - priv = cgdev->dev.driver_data; 3027 + priv = dev_get_drvdata(&cgdev->dev); 3028 3028 if (!priv) 3029 3029 return -ENODEV; 3030 3030 ndev = priv->channel[READ].ndev; ··· 3054 3054 3055 3055 BUG_ON(!cgdev); 3056 3056 CLAW_DBF_TEXT_(2, setup, "%s", dev_name(&cgdev->dev)); 3057 - priv = cgdev->dev.driver_data; 3057 + priv = dev_get_drvdata(&cgdev->dev); 3058 3058 BUG_ON(!priv); 3059 3059 dev_info(&cgdev->dev, " will be removed.\n"); 3060 3060 if (cgdev->state == CCWGROUP_ONLINE) ··· 3069 3069 kfree(priv->channel[1].irb); 3070 3070 priv->channel[1].irb=NULL; 3071 3071 kfree(priv); 3072 - cgdev->dev.driver_data=NULL; 3073 - cgdev->cdev[READ]->dev.driver_data = NULL; 3074 - cgdev->cdev[WRITE]->dev.driver_data = NULL; 3072 + dev_set_drvdata(&cgdev->dev, NULL); 3073 + dev_set_drvdata(&cgdev->cdev[READ]->dev, NULL); 3074 + dev_set_drvdata(&cgdev->cdev[WRITE]->dev, NULL); 3075 3075 put_device(&cgdev->dev); 3076 3076 3077 3077 return; ··· 3087 3087 struct claw_privbk *priv; 3088 3088 struct claw_env * p_env; 3089 3089 3090 - priv = dev->driver_data; 3090 + priv = dev_get_drvdata(dev); 3091 3091 if (!priv) 3092 3092 return -ENODEV; 3093 3093 p_env = priv->p_env; ··· 3101 3101 struct claw_privbk *priv; 3102 3102 struct claw_env * p_env; 3103 3103 3104 - priv = dev->driver_data; 3104 + priv = dev_get_drvdata(dev); 3105 3105 if (!priv) 3106 3106 return -ENODEV; 3107 3107 p_env = priv->p_env; ··· 3125 3125 struct claw_privbk *priv; 3126 3126 struct claw_env * p_env; 3127 3127 3128 - priv = dev->driver_data; 3128 + priv = dev_get_drvdata(dev); 3129 3129 if (!priv) 3130 3130 return -ENODEV; 3131 3131 p_env = priv->p_env; ··· 3139 3139 struct claw_privbk *priv; 3140 3140 struct claw_env * p_env; 3141 3141 3142 - priv = dev->driver_data; 3142 + priv = dev_get_drvdata(dev); 3143 3143 if (!priv) 3144 3144 return -ENODEV; 3145 3145 p_env = priv->p_env; ··· 3163 3163 struct claw_privbk *priv; 3164 3164 struct claw_env * p_env; 3165 3165 3166 - priv = dev->driver_data; 3166 + priv = dev_get_drvdata(dev); 3167 3167 if (!priv) 3168 3168 return -ENODEV; 3169 3169 p_env = priv->p_env; ··· 3178 3178 struct claw_privbk *priv; 3179 3179 struct claw_env * p_env; 3180 3180 3181 - priv = dev->driver_data; 3181 + priv = dev_get_drvdata(dev); 3182 3182 if (!priv) 3183 3183 return -ENODEV; 3184 3184 p_env = priv->p_env; ··· 3212 3212 struct claw_privbk *priv; 3213 3213 struct claw_env * p_env; 3214 3214 3215 - priv = dev->driver_data; 3215 + priv = dev_get_drvdata(dev); 3216 3216 if (!priv) 3217 3217 return -ENODEV; 3218 3218 p_env = priv->p_env; ··· 3227 3227 struct claw_env * p_env; 3228 3228 int nnn,max; 3229 3229 3230 - priv = dev->driver_data; 3230 + priv = dev_get_drvdata(dev); 3231 3231 if (!priv) 3232 3232 return -ENODEV; 3233 3233 p_env = priv->p_env; ··· 3254 3254 struct claw_privbk *priv; 3255 3255 struct claw_env * p_env; 3256 3256 3257 - priv = dev->driver_data; 3257 + priv = dev_get_drvdata(dev); 3258 3258 if (!priv) 3259 3259 return -ENODEV; 3260 3260 p_env = priv->p_env; ··· 3269 3269 struct claw_env *p_env; 3270 3270 int nnn,max; 3271 3271 3272 - priv = dev->driver_data; 3272 + priv = dev_get_drvdata(dev); 3273 3273 if (!priv) 3274 3274 return -ENODEV; 3275 3275 p_env = priv->p_env;
+10 -10
drivers/s390/net/lcs.c
··· 1936 1936 { 1937 1937 struct lcs_card *card; 1938 1938 1939 - card = (struct lcs_card *)dev->driver_data; 1939 + card = dev_get_drvdata(dev); 1940 1940 1941 1941 if (!card) 1942 1942 return 0; ··· 1953 1953 struct lcs_card *card; 1954 1954 int value; 1955 1955 1956 - card = (struct lcs_card *)dev->driver_data; 1956 + card = dev_get_drvdata(dev); 1957 1957 1958 1958 if (!card) 1959 1959 return 0; ··· 1987 1987 { 1988 1988 struct lcs_card *card; 1989 1989 1990 - card = (struct lcs_card *)dev->driver_data; 1990 + card = dev_get_drvdata(dev); 1991 1991 1992 1992 return card ? sprintf(buf, "%u\n", card->lancmd_timeout) : 0; 1993 1993 } ··· 1998 1998 struct lcs_card *card; 1999 1999 int value; 2000 2000 2001 - card = (struct lcs_card *)dev->driver_data; 2001 + card = dev_get_drvdata(dev); 2002 2002 2003 2003 if (!card) 2004 2004 return 0; ··· 2017 2017 lcs_dev_recover_store(struct device *dev, struct device_attribute *attr, 2018 2018 const char *buf, size_t count) 2019 2019 { 2020 - struct lcs_card *card = dev->driver_data; 2020 + struct lcs_card *card = dev_get_drvdata(dev); 2021 2021 char *tmp; 2022 2022 int i; 2023 2023 ··· 2070 2070 put_device(&ccwgdev->dev); 2071 2071 return ret; 2072 2072 } 2073 - ccwgdev->dev.driver_data = card; 2073 + dev_set_drvdata(&ccwgdev->dev, card); 2074 2074 ccwgdev->cdev[0]->handler = lcs_irq; 2075 2075 ccwgdev->cdev[1]->handler = lcs_irq; 2076 2076 card->gdev = ccwgdev; ··· 2087 2087 struct lcs_card *card; 2088 2088 2089 2089 LCS_DBF_TEXT(2, setup, "regnetdv"); 2090 - card = (struct lcs_card *)ccwgdev->dev.driver_data; 2090 + card = dev_get_drvdata(&ccwgdev->dev); 2091 2091 if (card->dev->reg_state != NETREG_UNINITIALIZED) 2092 2092 return 0; 2093 2093 SET_NETDEV_DEV(card->dev, &ccwgdev->dev); ··· 2120 2120 enum lcs_dev_states recover_state; 2121 2121 int rc; 2122 2122 2123 - card = (struct lcs_card *)ccwgdev->dev.driver_data; 2123 + card = dev_get_drvdata(&ccwgdev->dev); 2124 2124 if (!card) 2125 2125 return -ENODEV; 2126 2126 ··· 2226 2226 int ret; 2227 2227 2228 2228 LCS_DBF_TEXT(3, setup, "shtdndev"); 2229 - card = (struct lcs_card *)ccwgdev->dev.driver_data; 2229 + card = dev_get_drvdata(&ccwgdev->dev); 2230 2230 if (!card) 2231 2231 return -ENODEV; 2232 2232 if (recovery_mode == 0) { ··· 2293 2293 { 2294 2294 struct lcs_card *card; 2295 2295 2296 - card = (struct lcs_card *)ccwgdev->dev.driver_data; 2296 + card = dev_get_drvdata(&ccwgdev->dev); 2297 2297 if (!card) 2298 2298 return; 2299 2299
+2 -2
drivers/s390/net/lcs.h
··· 34 34 * sysfs related stuff 35 35 */ 36 36 #define CARD_FROM_DEV(cdev) \ 37 - (struct lcs_card *) \ 38 - ((struct ccwgroup_device *)cdev->dev.driver_data)->dev.driver_data; 37 + (struct lcs_card *) dev_get_drvdata( \ 38 + &((struct ccwgroup_device *)dev_get_drvdata(&cdev->dev))->dev); 39 39 /** 40 40 * CCW commands used in this driver 41 41 */
+24 -23
drivers/s390/net/netiucv.c
··· 1452 1452 static ssize_t user_show(struct device *dev, struct device_attribute *attr, 1453 1453 char *buf) 1454 1454 { 1455 - struct netiucv_priv *priv = dev->driver_data; 1455 + struct netiucv_priv *priv = dev_get_drvdata(dev); 1456 1456 1457 1457 IUCV_DBF_TEXT(trace, 5, __func__); 1458 1458 return sprintf(buf, "%s\n", netiucv_printname(priv->conn->userid)); ··· 1461 1461 static ssize_t user_write(struct device *dev, struct device_attribute *attr, 1462 1462 const char *buf, size_t count) 1463 1463 { 1464 - struct netiucv_priv *priv = dev->driver_data; 1464 + struct netiucv_priv *priv = dev_get_drvdata(dev); 1465 1465 struct net_device *ndev = priv->conn->netdev; 1466 1466 char *p; 1467 1467 char *tmp; ··· 1518 1518 1519 1519 static ssize_t buffer_show (struct device *dev, struct device_attribute *attr, 1520 1520 char *buf) 1521 - { struct netiucv_priv *priv = dev->driver_data; 1521 + { 1522 + struct netiucv_priv *priv = dev_get_drvdata(dev); 1522 1523 1523 1524 IUCV_DBF_TEXT(trace, 5, __func__); 1524 1525 return sprintf(buf, "%d\n", priv->conn->max_buffsize); ··· 1528 1527 static ssize_t buffer_write (struct device *dev, struct device_attribute *attr, 1529 1528 const char *buf, size_t count) 1530 1529 { 1531 - struct netiucv_priv *priv = dev->driver_data; 1530 + struct netiucv_priv *priv = dev_get_drvdata(dev); 1532 1531 struct net_device *ndev = priv->conn->netdev; 1533 1532 char *e; 1534 1533 int bs1; ··· 1576 1575 static ssize_t dev_fsm_show (struct device *dev, struct device_attribute *attr, 1577 1576 char *buf) 1578 1577 { 1579 - struct netiucv_priv *priv = dev->driver_data; 1578 + struct netiucv_priv *priv = dev_get_drvdata(dev); 1580 1579 1581 1580 IUCV_DBF_TEXT(trace, 5, __func__); 1582 1581 return sprintf(buf, "%s\n", fsm_getstate_str(priv->fsm)); ··· 1587 1586 static ssize_t conn_fsm_show (struct device *dev, 1588 1587 struct device_attribute *attr, char *buf) 1589 1588 { 1590 - struct netiucv_priv *priv = dev->driver_data; 1589 + struct netiucv_priv *priv = dev_get_drvdata(dev); 1591 1590 1592 1591 IUCV_DBF_TEXT(trace, 5, __func__); 1593 1592 return sprintf(buf, "%s\n", fsm_getstate_str(priv->conn->fsm)); ··· 1598 1597 static ssize_t maxmulti_show (struct device *dev, 1599 1598 struct device_attribute *attr, char *buf) 1600 1599 { 1601 - struct netiucv_priv *priv = dev->driver_data; 1600 + struct netiucv_priv *priv = dev_get_drvdata(dev); 1602 1601 1603 1602 IUCV_DBF_TEXT(trace, 5, __func__); 1604 1603 return sprintf(buf, "%ld\n", priv->conn->prof.maxmulti); ··· 1608 1607 struct device_attribute *attr, 1609 1608 const char *buf, size_t count) 1610 1609 { 1611 - struct netiucv_priv *priv = dev->driver_data; 1610 + struct netiucv_priv *priv = dev_get_drvdata(dev); 1612 1611 1613 1612 IUCV_DBF_TEXT(trace, 4, __func__); 1614 1613 priv->conn->prof.maxmulti = 0; ··· 1620 1619 static ssize_t maxcq_show (struct device *dev, struct device_attribute *attr, 1621 1620 char *buf) 1622 1621 { 1623 - struct netiucv_priv *priv = dev->driver_data; 1622 + struct netiucv_priv *priv = dev_get_drvdata(dev); 1624 1623 1625 1624 IUCV_DBF_TEXT(trace, 5, __func__); 1626 1625 return sprintf(buf, "%ld\n", priv->conn->prof.maxcqueue); ··· 1629 1628 static ssize_t maxcq_write (struct device *dev, struct device_attribute *attr, 1630 1629 const char *buf, size_t count) 1631 1630 { 1632 - struct netiucv_priv *priv = dev->driver_data; 1631 + struct netiucv_priv *priv = dev_get_drvdata(dev); 1633 1632 1634 1633 IUCV_DBF_TEXT(trace, 4, __func__); 1635 1634 priv->conn->prof.maxcqueue = 0; ··· 1641 1640 static ssize_t sdoio_show (struct device *dev, struct device_attribute *attr, 1642 1641 char *buf) 1643 1642 { 1644 - struct netiucv_priv *priv = dev->driver_data; 1643 + struct netiucv_priv *priv = dev_get_drvdata(dev); 1645 1644 1646 1645 IUCV_DBF_TEXT(trace, 5, __func__); 1647 1646 return sprintf(buf, "%ld\n", priv->conn->prof.doios_single); ··· 1650 1649 static ssize_t sdoio_write (struct device *dev, struct device_attribute *attr, 1651 1650 const char *buf, size_t count) 1652 1651 { 1653 - struct netiucv_priv *priv = dev->driver_data; 1652 + struct netiucv_priv *priv = dev_get_drvdata(dev); 1654 1653 1655 1654 IUCV_DBF_TEXT(trace, 4, __func__); 1656 1655 priv->conn->prof.doios_single = 0; ··· 1662 1661 static ssize_t mdoio_show (struct device *dev, struct device_attribute *attr, 1663 1662 char *buf) 1664 1663 { 1665 - struct netiucv_priv *priv = dev->driver_data; 1664 + struct netiucv_priv *priv = dev_get_drvdata(dev); 1666 1665 1667 1666 IUCV_DBF_TEXT(trace, 5, __func__); 1668 1667 return sprintf(buf, "%ld\n", priv->conn->prof.doios_multi); ··· 1671 1670 static ssize_t mdoio_write (struct device *dev, struct device_attribute *attr, 1672 1671 const char *buf, size_t count) 1673 1672 { 1674 - struct netiucv_priv *priv = dev->driver_data; 1673 + struct netiucv_priv *priv = dev_get_drvdata(dev); 1675 1674 1676 1675 IUCV_DBF_TEXT(trace, 5, __func__); 1677 1676 priv->conn->prof.doios_multi = 0; ··· 1683 1682 static ssize_t txlen_show (struct device *dev, struct device_attribute *attr, 1684 1683 char *buf) 1685 1684 { 1686 - struct netiucv_priv *priv = dev->driver_data; 1685 + struct netiucv_priv *priv = dev_get_drvdata(dev); 1687 1686 1688 1687 IUCV_DBF_TEXT(trace, 5, __func__); 1689 1688 return sprintf(buf, "%ld\n", priv->conn->prof.txlen); ··· 1692 1691 static ssize_t txlen_write (struct device *dev, struct device_attribute *attr, 1693 1692 const char *buf, size_t count) 1694 1693 { 1695 - struct netiucv_priv *priv = dev->driver_data; 1694 + struct netiucv_priv *priv = dev_get_drvdata(dev); 1696 1695 1697 1696 IUCV_DBF_TEXT(trace, 4, __func__); 1698 1697 priv->conn->prof.txlen = 0; ··· 1704 1703 static ssize_t txtime_show (struct device *dev, struct device_attribute *attr, 1705 1704 char *buf) 1706 1705 { 1707 - struct netiucv_priv *priv = dev->driver_data; 1706 + struct netiucv_priv *priv = dev_get_drvdata(dev); 1708 1707 1709 1708 IUCV_DBF_TEXT(trace, 5, __func__); 1710 1709 return sprintf(buf, "%ld\n", priv->conn->prof.tx_time); ··· 1713 1712 static ssize_t txtime_write (struct device *dev, struct device_attribute *attr, 1714 1713 const char *buf, size_t count) 1715 1714 { 1716 - struct netiucv_priv *priv = dev->driver_data; 1715 + struct netiucv_priv *priv = dev_get_drvdata(dev); 1717 1716 1718 1717 IUCV_DBF_TEXT(trace, 4, __func__); 1719 1718 priv->conn->prof.tx_time = 0; ··· 1725 1724 static ssize_t txpend_show (struct device *dev, struct device_attribute *attr, 1726 1725 char *buf) 1727 1726 { 1728 - struct netiucv_priv *priv = dev->driver_data; 1727 + struct netiucv_priv *priv = dev_get_drvdata(dev); 1729 1728 1730 1729 IUCV_DBF_TEXT(trace, 5, __func__); 1731 1730 return sprintf(buf, "%ld\n", priv->conn->prof.tx_pending); ··· 1734 1733 static ssize_t txpend_write (struct device *dev, struct device_attribute *attr, 1735 1734 const char *buf, size_t count) 1736 1735 { 1737 - struct netiucv_priv *priv = dev->driver_data; 1736 + struct netiucv_priv *priv = dev_get_drvdata(dev); 1738 1737 1739 1738 IUCV_DBF_TEXT(trace, 4, __func__); 1740 1739 priv->conn->prof.tx_pending = 0; ··· 1746 1745 static ssize_t txmpnd_show (struct device *dev, struct device_attribute *attr, 1747 1746 char *buf) 1748 1747 { 1749 - struct netiucv_priv *priv = dev->driver_data; 1748 + struct netiucv_priv *priv = dev_get_drvdata(dev); 1750 1749 1751 1750 IUCV_DBF_TEXT(trace, 5, __func__); 1752 1751 return sprintf(buf, "%ld\n", priv->conn->prof.tx_max_pending); ··· 1755 1754 static ssize_t txmpnd_write (struct device *dev, struct device_attribute *attr, 1756 1755 const char *buf, size_t count) 1757 1756 { 1758 - struct netiucv_priv *priv = dev->driver_data; 1757 + struct netiucv_priv *priv = dev_get_drvdata(dev); 1759 1758 1760 1759 IUCV_DBF_TEXT(trace, 4, __func__); 1761 1760 priv->conn->prof.tx_max_pending = 0; ··· 1846 1845 if (ret) 1847 1846 goto out_unreg; 1848 1847 priv->dev = dev; 1849 - dev->driver_data = priv; 1848 + dev_set_drvdata(dev, priv); 1850 1849 return 0; 1851 1850 1852 1851 out_unreg:
+1 -1
drivers/scsi/aha1740.c
··· 646 646 647 647 static __devexit int aha1740_remove (struct device *dev) 648 648 { 649 - struct Scsi_Host *shpnt = dev->driver_data; 649 + struct Scsi_Host *shpnt = dev_get_drvdata(dev); 650 650 struct aha1740_hostdata *host = HOSTDATA (shpnt); 651 651 652 652 scsi_remove_host(shpnt);
+3 -3
drivers/scsi/ibmvscsi/ibmvscsi.c
··· 1877 1877 unsigned long wait_switch = 0; 1878 1878 int rc; 1879 1879 1880 - vdev->dev.driver_data = NULL; 1880 + dev_set_drvdata(&vdev->dev, NULL); 1881 1881 1882 1882 host = scsi_host_alloc(&driver_template, sizeof(*hostdata)); 1883 1883 if (!host) { ··· 1949 1949 scsi_scan_host(host); 1950 1950 } 1951 1951 1952 - vdev->dev.driver_data = hostdata; 1952 + dev_set_drvdata(&vdev->dev, hostdata); 1953 1953 return 0; 1954 1954 1955 1955 add_srp_port_failed: ··· 1968 1968 1969 1969 static int ibmvscsi_remove(struct vio_dev *vdev) 1970 1970 { 1971 - struct ibmvscsi_host_data *hostdata = vdev->dev.driver_data; 1971 + struct ibmvscsi_host_data *hostdata = dev_get_drvdata(&vdev->dev); 1972 1972 unmap_persist_bufs(hostdata); 1973 1973 release_event_pool(&hostdata->pool, hostdata); 1974 1974 ibmvscsi_ops->release_crq_queue(&hostdata->queue, hostdata,
+1 -1
drivers/scsi/ibmvscsi/ibmvstgt.c
··· 892 892 893 893 static int ibmvstgt_remove(struct vio_dev *dev) 894 894 { 895 - struct srp_target *target = (struct srp_target *) dev->dev.driver_data; 895 + struct srp_target *target = dev_get_drvdata(&dev->dev); 896 896 struct Scsi_Host *shost = target->shost; 897 897 struct vio_port *vport = target->ldata; 898 898
+1 -1
drivers/scsi/libsrp.c
··· 135 135 INIT_LIST_HEAD(&target->cmd_queue); 136 136 137 137 target->dev = dev; 138 - target->dev->driver_data = target; 138 + dev_set_drvdata(target->dev, target); 139 139 140 140 target->srp_iu_size = iu_size; 141 141 target->rx_ring_size = nr;
+1 -2
drivers/scsi/lpfc/lpfc_debugfs.c
··· 53 53 * debugfs interface 54 54 * 55 55 * To access this interface the user should: 56 - * # mkdir /debug 57 - * # mount -t debugfs none /debug 56 + * # mount -t debugfs none /sys/kernel/debug 58 57 * 59 58 * The lpfc debugfs directory hierarchy is: 60 59 * lpfc/lpfcX/vportY
+2 -2
drivers/serial/of_serial.c
··· 122 122 123 123 info->type = port_type; 124 124 info->line = ret; 125 - ofdev->dev.driver_data = info; 125 + dev_set_drvdata(&ofdev->dev, info); 126 126 return 0; 127 127 out: 128 128 kfree(info); ··· 135 135 */ 136 136 static int of_platform_serial_remove(struct of_device *ofdev) 137 137 { 138 - struct of_serial_info *info = ofdev->dev.driver_data; 138 + struct of_serial_info *info = dev_get_drvdata(&ofdev->dev); 139 139 switch (info->type) { 140 140 #ifdef CONFIG_SERIAL_8250 141 141 case PORT_8250 ... PORT_MAX_8250:
+2 -2
drivers/thermal/thermal_sys.c
··· 417 417 static ssize_t 418 418 name_show(struct device *dev, struct device_attribute *attr, char *buf) 419 419 { 420 - struct thermal_hwmon_device *hwmon = dev->driver_data; 420 + struct thermal_hwmon_device *hwmon = dev_get_drvdata(dev); 421 421 return sprintf(buf, "%s\n", hwmon->type); 422 422 } 423 423 static DEVICE_ATTR(name, 0444, name_show, NULL); ··· 488 488 result = PTR_ERR(hwmon->device); 489 489 goto free_mem; 490 490 } 491 - hwmon->device->driver_data = hwmon; 491 + dev_set_drvdata(hwmon->device, hwmon); 492 492 result = device_create_file(hwmon->device, &dev_attr_name); 493 493 if (result) 494 494 goto unregister_hwmon_device;
+5 -4
drivers/usb/atm/ueagle-atm.c
··· 306 306 #define FW_GET_BYTE(p) *((__u8 *) (p)) 307 307 308 308 #define FW_DIR "ueagle-atm/" 309 + #define UEA_FW_NAME_MAX 30 309 310 #define NB_MODEM 4 310 311 311 312 #define BULK_TIMEOUT 300 ··· 1565 1564 file = cmv_file[sc->modem_index]; 1566 1565 1567 1566 strcpy(cmv_name, FW_DIR); 1568 - strlcat(cmv_name, file, FIRMWARE_NAME_MAX); 1567 + strlcat(cmv_name, file, UEA_FW_NAME_MAX); 1569 1568 if (ver == 2) 1570 - strlcat(cmv_name, ".v2", FIRMWARE_NAME_MAX); 1569 + strlcat(cmv_name, ".v2", UEA_FW_NAME_MAX); 1571 1570 } 1572 1571 1573 1572 static int request_cmvs_old(struct uea_softc *sc, ··· 1575 1574 { 1576 1575 int ret, size; 1577 1576 u8 *data; 1578 - char cmv_name[FIRMWARE_NAME_MAX]; /* 30 bytes stack variable */ 1577 + char cmv_name[UEA_FW_NAME_MAX]; /* 30 bytes stack variable */ 1579 1578 1580 1579 cmvs_file_name(sc, cmv_name, 1); 1581 1580 ret = request_firmware(fw, cmv_name, &sc->usb_dev->dev); ··· 1609 1608 int ret, size; 1610 1609 u32 crc; 1611 1610 u8 *data; 1612 - char cmv_name[FIRMWARE_NAME_MAX]; /* 30 bytes stack variable */ 1611 + char cmv_name[UEA_FW_NAME_MAX]; /* 30 bytes stack variable */ 1613 1612 1614 1613 cmvs_file_name(sc, cmv_name, 2); 1615 1614 ret = request_firmware(fw, cmv_name, &sc->usb_dev->dev);
+6
drivers/usb/class/usblp.c
··· 1057 1057 .release = usblp_release, 1058 1058 }; 1059 1059 1060 + static char *usblp_nodename(struct device *dev) 1061 + { 1062 + return kasprintf(GFP_KERNEL, "usb/%s", dev_name(dev)); 1063 + } 1064 + 1060 1065 static struct usb_class_driver usblp_class = { 1061 1066 .name = "lp%d", 1067 + .nodename = usblp_nodename, 1062 1068 .fops = &usblp_fops, 1063 1069 .minor_base = USBLP_MINOR_BASE, 1064 1070 };
+12 -1
drivers/usb/core/file.c
··· 67 67 struct class *class; 68 68 } *usb_class; 69 69 70 + static char *usb_nodename(struct device *dev) 71 + { 72 + struct usb_class_driver *drv; 73 + 74 + drv = dev_get_drvdata(dev); 75 + if (!drv || !drv->nodename) 76 + return NULL; 77 + return drv->nodename(dev); 78 + } 79 + 70 80 static int init_usb_class(void) 71 81 { 72 82 int result = 0; ··· 100 90 kfree(usb_class); 101 91 usb_class = NULL; 102 92 } 93 + usb_class->class->nodename = usb_nodename; 103 94 104 95 exit: 105 96 return result; ··· 209 198 else 210 199 temp = name; 211 200 intf->usb_dev = device_create(usb_class->class, &intf->dev, 212 - MKDEV(USB_MAJOR, minor), NULL, 201 + MKDEV(USB_MAJOR, minor), class_driver, 213 202 "%s", temp); 214 203 if (IS_ERR(intf->usb_dev)) { 215 204 down_write(&minor_rwsem);
+11
drivers/usb/core/usb.c
··· 305 305 306 306 #endif /* CONFIG_PM */ 307 307 308 + 309 + static char *usb_nodename(struct device *dev) 310 + { 311 + struct usb_device *usb_dev; 312 + 313 + usb_dev = to_usb_device(dev); 314 + return kasprintf(GFP_KERNEL, "bus/usb/%03d/%03d", 315 + usb_dev->bus->busnum, usb_dev->devnum); 316 + } 317 + 308 318 struct device_type usb_device_type = { 309 319 .name = "usb_device", 310 320 .release = usb_release_dev, 311 321 .uevent = usb_dev_uevent, 322 + .nodename = usb_nodename, 312 323 .pm = &usb_device_pm_ops, 313 324 }; 314 325
+3 -3
drivers/usb/gadget/at91_udc.c
··· 1574 1574 1575 1575 udc->driver = driver; 1576 1576 udc->gadget.dev.driver = &driver->driver; 1577 - udc->gadget.dev.driver_data = &driver->driver; 1577 + dev_set_drvdata(&udc->gadget.dev, &driver->driver); 1578 1578 udc->enabled = 1; 1579 1579 udc->selfpowered = 1; 1580 1580 ··· 1583 1583 DBG("driver->bind() returned %d\n", retval); 1584 1584 udc->driver = NULL; 1585 1585 udc->gadget.dev.driver = NULL; 1586 - udc->gadget.dev.driver_data = NULL; 1586 + dev_set_drvdata(&udc->gadget.dev, NULL); 1587 1587 udc->enabled = 0; 1588 1588 udc->selfpowered = 0; 1589 1589 return retval; ··· 1613 1613 1614 1614 driver->unbind(&udc->gadget); 1615 1615 udc->gadget.dev.driver = NULL; 1616 - udc->gadget.dev.driver_data = NULL; 1616 + dev_set_drvdata(&udc->gadget.dev, NULL); 1617 1617 udc->driver = NULL; 1618 1618 1619 1619 DBG("unbound from %s\n", driver->driver.name);
+6
drivers/usb/misc/iowarrior.c
··· 726 726 .poll = iowarrior_poll, 727 727 }; 728 728 729 + static char *iowarrior_nodename(struct device *dev) 730 + { 731 + return kasprintf(GFP_KERNEL, "usb/%s", dev_name(dev)); 732 + } 733 + 729 734 /* 730 735 * usb class driver info in order to get a minor number from the usb core, 731 736 * and to have the device registered with devfs and the driver core 732 737 */ 733 738 static struct usb_class_driver iowarrior_class = { 734 739 .name = "iowarrior%d", 740 + .nodename = iowarrior_nodename, 735 741 .fops = &iowarrior_fops, 736 742 .minor_base = IOWARRIOR_MINOR_BASE, 737 743 };
+6
drivers/usb/misc/legousbtower.c
··· 266 266 .llseek = tower_llseek, 267 267 }; 268 268 269 + static char *legousbtower_nodename(struct device *dev) 270 + { 271 + return kasprintf(GFP_KERNEL, "usb/%s", dev_name(dev)); 272 + } 273 + 269 274 /* 270 275 * usb class driver info in order to get a minor number from the usb core, 271 276 * and to have the device registered with the driver core 272 277 */ 273 278 static struct usb_class_driver tower_class = { 274 279 .name = "legousbtower%d", 280 + .nodename = legousbtower_nodename, 275 281 .fops = &tower_fops, 276 282 .minor_base = LEGO_USB_TOWER_MINOR_BASE, 277 283 };
+4 -4
drivers/video/xen-fbfront.c
··· 384 384 fb_size = XENFB_DEFAULT_FB_LEN; 385 385 } 386 386 387 - dev->dev.driver_data = info; 387 + dev_set_drvdata(&dev->dev, info); 388 388 info->xbdev = dev; 389 389 info->irq = -1; 390 390 info->x1 = info->y1 = INT_MAX; ··· 503 503 504 504 static int xenfb_resume(struct xenbus_device *dev) 505 505 { 506 - struct xenfb_info *info = dev->dev.driver_data; 506 + struct xenfb_info *info = dev_get_drvdata(&dev->dev); 507 507 508 508 xenfb_disconnect_backend(info); 509 509 xenfb_init_shared_page(info, info->fb_info); ··· 512 512 513 513 static int xenfb_remove(struct xenbus_device *dev) 514 514 { 515 - struct xenfb_info *info = dev->dev.driver_data; 515 + struct xenfb_info *info = dev_get_drvdata(&dev->dev); 516 516 517 517 xenfb_disconnect_backend(info); 518 518 if (info->fb_info) { ··· 621 621 static void xenfb_backend_changed(struct xenbus_device *dev, 622 622 enum xenbus_state backend_state) 623 623 { 624 - struct xenfb_info *info = dev->dev.driver_data; 624 + struct xenfb_info *info = dev_get_drvdata(&dev->dev); 625 625 int val; 626 626 627 627 switch (backend_state) {
+64 -1
fs/debugfs/file.c
··· 67 67 return 0; 68 68 } 69 69 DEFINE_SIMPLE_ATTRIBUTE(fops_u8, debugfs_u8_get, debugfs_u8_set, "%llu\n"); 70 + DEFINE_SIMPLE_ATTRIBUTE(fops_u8_ro, debugfs_u8_get, NULL, "%llu\n"); 71 + DEFINE_SIMPLE_ATTRIBUTE(fops_u8_wo, NULL, debugfs_u8_set, "%llu\n"); 70 72 71 73 /** 72 74 * debugfs_create_u8 - create a debugfs file that is used to read and write an unsigned 8-bit value ··· 97 95 struct dentry *debugfs_create_u8(const char *name, mode_t mode, 98 96 struct dentry *parent, u8 *value) 99 97 { 98 + /* if there are no write bits set, make read only */ 99 + if (!(mode & S_IWUGO)) 100 + return debugfs_create_file(name, mode, parent, value, &fops_u8_ro); 101 + /* if there are no read bits set, make write only */ 102 + if (!(mode & S_IRUGO)) 103 + return debugfs_create_file(name, mode, parent, value, &fops_u8_wo); 104 + 100 105 return debugfs_create_file(name, mode, parent, value, &fops_u8); 101 106 } 102 107 EXPORT_SYMBOL_GPL(debugfs_create_u8); ··· 119 110 return 0; 120 111 } 121 112 DEFINE_SIMPLE_ATTRIBUTE(fops_u16, debugfs_u16_get, debugfs_u16_set, "%llu\n"); 113 + DEFINE_SIMPLE_ATTRIBUTE(fops_u16_ro, debugfs_u16_get, NULL, "%llu\n"); 114 + DEFINE_SIMPLE_ATTRIBUTE(fops_u16_wo, NULL, debugfs_u16_set, "%llu\n"); 122 115 123 116 /** 124 117 * debugfs_create_u16 - create a debugfs file that is used to read and write an unsigned 16-bit value ··· 149 138 struct dentry *debugfs_create_u16(const char *name, mode_t mode, 150 139 struct dentry *parent, u16 *value) 151 140 { 141 + /* if there are no write bits set, make read only */ 142 + if (!(mode & S_IWUGO)) 143 + return debugfs_create_file(name, mode, parent, value, &fops_u16_ro); 144 + /* if there are no read bits set, make write only */ 145 + if (!(mode & S_IRUGO)) 146 + return debugfs_create_file(name, mode, parent, value, &fops_u16_wo); 147 + 152 148 return debugfs_create_file(name, mode, parent, value, &fops_u16); 153 149 } 154 150 EXPORT_SYMBOL_GPL(debugfs_create_u16); ··· 171 153 return 0; 172 154 } 173 155 DEFINE_SIMPLE_ATTRIBUTE(fops_u32, debugfs_u32_get, debugfs_u32_set, "%llu\n"); 156 + DEFINE_SIMPLE_ATTRIBUTE(fops_u32_ro, debugfs_u32_get, NULL, "%llu\n"); 157 + DEFINE_SIMPLE_ATTRIBUTE(fops_u32_wo, NULL, debugfs_u32_set, "%llu\n"); 174 158 175 159 /** 176 160 * debugfs_create_u32 - create a debugfs file that is used to read and write an unsigned 32-bit value ··· 201 181 struct dentry *debugfs_create_u32(const char *name, mode_t mode, 202 182 struct dentry *parent, u32 *value) 203 183 { 184 + /* if there are no write bits set, make read only */ 185 + if (!(mode & S_IWUGO)) 186 + return debugfs_create_file(name, mode, parent, value, &fops_u32_ro); 187 + /* if there are no read bits set, make write only */ 188 + if (!(mode & S_IRUGO)) 189 + return debugfs_create_file(name, mode, parent, value, &fops_u32_wo); 190 + 204 191 return debugfs_create_file(name, mode, parent, value, &fops_u32); 205 192 } 206 193 EXPORT_SYMBOL_GPL(debugfs_create_u32); ··· 224 197 return 0; 225 198 } 226 199 DEFINE_SIMPLE_ATTRIBUTE(fops_u64, debugfs_u64_get, debugfs_u64_set, "%llu\n"); 200 + DEFINE_SIMPLE_ATTRIBUTE(fops_u64_ro, debugfs_u64_get, NULL, "%llu\n"); 201 + DEFINE_SIMPLE_ATTRIBUTE(fops_u64_wo, NULL, debugfs_u64_set, "%llu\n"); 227 202 228 203 /** 229 204 * debugfs_create_u64 - create a debugfs file that is used to read and write an unsigned 64-bit value ··· 254 225 struct dentry *debugfs_create_u64(const char *name, mode_t mode, 255 226 struct dentry *parent, u64 *value) 256 227 { 228 + /* if there are no write bits set, make read only */ 229 + if (!(mode & S_IWUGO)) 230 + return debugfs_create_file(name, mode, parent, value, &fops_u64_ro); 231 + /* if there are no read bits set, make write only */ 232 + if (!(mode & S_IRUGO)) 233 + return debugfs_create_file(name, mode, parent, value, &fops_u64_wo); 234 + 257 235 return debugfs_create_file(name, mode, parent, value, &fops_u64); 258 236 } 259 237 EXPORT_SYMBOL_GPL(debugfs_create_u64); 260 238 261 239 DEFINE_SIMPLE_ATTRIBUTE(fops_x8, debugfs_u8_get, debugfs_u8_set, "0x%02llx\n"); 240 + DEFINE_SIMPLE_ATTRIBUTE(fops_x8_ro, debugfs_u8_get, NULL, "0x%02llx\n"); 241 + DEFINE_SIMPLE_ATTRIBUTE(fops_x8_wo, NULL, debugfs_u8_set, "0x%02llx\n"); 262 242 263 243 DEFINE_SIMPLE_ATTRIBUTE(fops_x16, debugfs_u16_get, debugfs_u16_set, "0x%04llx\n"); 244 + DEFINE_SIMPLE_ATTRIBUTE(fops_x16_ro, debugfs_u16_get, NULL, "0x%04llx\n"); 245 + DEFINE_SIMPLE_ATTRIBUTE(fops_x16_wo, NULL, debugfs_u16_set, "0x%04llx\n"); 264 246 265 247 DEFINE_SIMPLE_ATTRIBUTE(fops_x32, debugfs_u32_get, debugfs_u32_set, "0x%08llx\n"); 248 + DEFINE_SIMPLE_ATTRIBUTE(fops_x32_ro, debugfs_u32_get, NULL, "0x%08llx\n"); 249 + DEFINE_SIMPLE_ATTRIBUTE(fops_x32_wo, NULL, debugfs_u32_set, "0x%08llx\n"); 266 250 267 251 /* 268 252 * debugfs_create_x{8,16,32} - create a debugfs file that is used to read and write an unsigned {8,16,32}-bit value ··· 298 256 struct dentry *debugfs_create_x8(const char *name, mode_t mode, 299 257 struct dentry *parent, u8 *value) 300 258 { 259 + /* if there are no write bits set, make read only */ 260 + if (!(mode & S_IWUGO)) 261 + return debugfs_create_file(name, mode, parent, value, &fops_x8_ro); 262 + /* if there are no read bits set, make write only */ 263 + if (!(mode & S_IRUGO)) 264 + return debugfs_create_file(name, mode, parent, value, &fops_x8_wo); 265 + 301 266 return debugfs_create_file(name, mode, parent, value, &fops_x8); 302 267 } 303 268 EXPORT_SYMBOL_GPL(debugfs_create_x8); ··· 322 273 struct dentry *debugfs_create_x16(const char *name, mode_t mode, 323 274 struct dentry *parent, u16 *value) 324 275 { 276 + /* if there are no write bits set, make read only */ 277 + if (!(mode & S_IWUGO)) 278 + return debugfs_create_file(name, mode, parent, value, &fops_x16_ro); 279 + /* if there are no read bits set, make write only */ 280 + if (!(mode & S_IRUGO)) 281 + return debugfs_create_file(name, mode, parent, value, &fops_x16_wo); 282 + 325 283 return debugfs_create_file(name, mode, parent, value, &fops_x16); 326 284 } 327 285 EXPORT_SYMBOL_GPL(debugfs_create_x16); ··· 346 290 struct dentry *debugfs_create_x32(const char *name, mode_t mode, 347 291 struct dentry *parent, u32 *value) 348 292 { 293 + /* if there are no write bits set, make read only */ 294 + if (!(mode & S_IWUGO)) 295 + return debugfs_create_file(name, mode, parent, value, &fops_x32_ro); 296 + /* if there are no read bits set, make write only */ 297 + if (!(mode & S_IRUGO)) 298 + return debugfs_create_file(name, mode, parent, value, &fops_x32_wo); 299 + 349 300 return debugfs_create_file(name, mode, parent, value, &fops_x32); 350 301 } 351 302 EXPORT_SYMBOL_GPL(debugfs_create_x32); ··· 482 419 }; 483 420 484 421 /** 485 - * debugfs_create_blob - create a debugfs file that is used to read and write a binary blob 422 + * debugfs_create_blob - create a debugfs file that is used to read a binary blob 486 423 * @name: a pointer to a string containing the name of the file to create. 487 424 * @mode: the permission that the file should have 488 425 * @parent: a pointer to the parent dentry for this file. This should be a
+11
fs/debugfs/inode.c
··· 403 403 } 404 404 child = list_entry(parent->d_subdirs.next, struct dentry, 405 405 d_u.d_child); 406 + next_sibling: 406 407 407 408 /* 408 409 * If "child" isn't empty, walk down the tree and ··· 417 416 } 418 417 __debugfs_remove(child, parent); 419 418 if (parent->d_subdirs.next == &child->d_u.d_child) { 419 + /* 420 + * Try the next sibling. 421 + */ 422 + if (child->d_u.d_child.next != &parent->d_subdirs) { 423 + child = list_entry(child->d_u.d_child.next, 424 + struct dentry, 425 + d_u.d_child); 426 + goto next_sibling; 427 + } 428 + 420 429 /* 421 430 * Avoid infinite loop if we fail to remove 422 431 * one dentry.
+4 -1
fs/sysfs/symlink.c
··· 192 192 { 193 193 int error = -ENOMEM; 194 194 unsigned long page = get_zeroed_page(GFP_KERNEL); 195 - if (page) 195 + if (page) { 196 196 error = sysfs_getlink(dentry, (char *) page); 197 + if (error < 0) 198 + free_page((unsigned long)page); 199 + } 197 200 nd_set_link(nd, error ? ERR_PTR(error) : (char *)page); 198 201 return NULL; 199 202 }
+5
include/linux/device.h
··· 114 114 #define BUS_NOTIFY_BOUND_DRIVER 0x00000003 /* driver bound to device */ 115 115 #define BUS_NOTIFY_UNBIND_DRIVER 0x00000004 /* driver about to be 116 116 unbound */ 117 + #define BUS_NOTIFY_UNBOUND_DRIVER 0x00000005 /* driver is unbound 118 + from the device */ 117 119 118 120 extern struct kset *bus_get_kset(struct bus_type *bus); 119 121 extern struct klist *bus_get_device_klist(struct bus_type *bus); ··· 194 192 struct kobject *dev_kobj; 195 193 196 194 int (*dev_uevent)(struct device *dev, struct kobj_uevent_env *env); 195 + char *(*nodename)(struct device *dev); 197 196 198 197 void (*class_release)(struct class *class); 199 198 void (*dev_release)(struct device *dev); ··· 290 287 const char *name; 291 288 struct attribute_group **groups; 292 289 int (*uevent)(struct device *dev, struct kobj_uevent_env *env); 290 + char *(*nodename)(struct device *dev); 293 291 void (*release)(struct device *dev); 294 292 295 293 struct dev_pm_ops *pm; ··· 490 486 extern int device_rename(struct device *dev, char *new_name); 491 487 extern int device_move(struct device *dev, struct device *new_parent, 492 488 enum dpm_order dpm_order); 489 + extern const char *device_get_nodename(struct device *dev, const char **tmp); 493 490 494 491 /* 495 492 * Root device objects for grouping under /sys/devices
+2 -2
include/linux/eisa.h
··· 78 78 /* Mimics pci.h... */ 79 79 static inline void *eisa_get_drvdata (struct eisa_device *edev) 80 80 { 81 - return edev->dev.driver_data; 81 + return dev_get_drvdata(&edev->dev); 82 82 } 83 83 84 84 static inline void eisa_set_drvdata (struct eisa_device *edev, void *data) 85 85 { 86 - edev->dev.driver_data = data; 86 + dev_set_drvdata(&edev->dev, data); 87 87 } 88 88 89 89 /* The EISA root device. There's rumours about machines with multiple
-1
include/linux/firmware.h
··· 5 5 #include <linux/types.h> 6 6 #include <linux/compiler.h> 7 7 8 - #define FIRMWARE_NAME_MAX 30 9 8 #define FW_ACTION_NOHOTPLUG 0 10 9 #define FW_ACTION_HOTPLUG 1 11 10
+1 -1
include/linux/genhd.h
··· 142 142 * disks that can't be partitioned. */ 143 143 144 144 char disk_name[DISK_NAME_LEN]; /* name of major driver */ 145 - 145 + char *(*nodename)(struct gendisk *gd); 146 146 /* Array of pointers to partitions indexed by partno. 147 147 * Protected with matching bdev lock but stat and other 148 148 * non-critical accesses use RCU. Always access through
+1 -1
include/linux/kernel.h
··· 408 408 * 409 409 * Use tracing_on/tracing_off when you want to quickly turn on or off 410 410 * tracing. It simply enables or disables the recording of the trace events. 411 - * This also corresponds to the user space debugfs/tracing/tracing_on 411 + * This also corresponds to the user space /sys/kernel/debug/tracing/tracing_on 412 412 * file, which gives a means for the kernel and userspace to interact. 413 413 * Place a tracing_off() in the kernel where you want tracing to end. 414 414 * From user space, examine the trace, and then echo 1 > tracing_on
+1
include/linux/miscdevice.h
··· 41 41 struct list_head list; 42 42 struct device *parent; 43 43 struct device *this_device; 44 + const char *devnode; 44 45 }; 45 46 46 47 extern int misc_register(struct miscdevice * misc);
+2 -2
include/linux/platform_device.h
··· 36 36 37 37 extern struct resource *platform_get_resource(struct platform_device *, unsigned int, unsigned int); 38 38 extern int platform_get_irq(struct platform_device *, unsigned int); 39 - extern struct resource *platform_get_resource_byname(struct platform_device *, unsigned int, char *); 40 - extern int platform_get_irq_byname(struct platform_device *, char *); 39 + extern struct resource *platform_get_resource_byname(struct platform_device *, unsigned int, const char *); 40 + extern int platform_get_irq_byname(struct platform_device *, const char *); 41 41 extern int platform_add_devices(struct platform_device **, int); 42 42 43 43 extern struct platform_device *platform_device_register_simple(const char *, int id,
+1 -1
include/linux/sched.h
··· 674 674 struct task_group *tg; 675 675 #ifdef CONFIG_SYSFS 676 676 struct kobject kobj; 677 - struct work_struct work; 677 + struct delayed_work work; 678 678 #endif 679 679 #endif 680 680
+2 -2
include/linux/tracepoint.h
··· 198 198 * * This is how the trace record is structured and will 199 199 * * be saved into the ring buffer. These are the fields 200 200 * * that will be exposed to user-space in 201 - * * /debug/tracing/events/<*>/format. 201 + * * /sys/kernel/debug/tracing/events/<*>/format. 202 202 * * 203 203 * * The declared 'local variable' is called '__entry' 204 204 * * ··· 258 258 * tracepoint callback (this is used by programmatic plugins and 259 259 * can also by used by generic instrumentation like SystemTap), and 260 260 * it is also used to expose a structured trace record in 261 - * /debug/tracing/events/. 261 + * /sys/kernel/debug/tracing/events/. 262 262 */ 263 263 264 264 #define TRACE_EVENT(name, proto, args, struct, assign, print) \
+3
include/linux/usb.h
··· 869 869 * struct usb_device_driver - identifies USB device driver to usbcore 870 870 * @name: The driver name should be unique among USB drivers, 871 871 * and should normally be the same as the module name. 872 + * @nodename: Callback to provide a naming hint for a possible 873 + * device node to create. 872 874 * @probe: Called to see if the driver is willing to manage a particular 873 875 * device. If it is, probe returns zero and uses dev_set_drvdata() 874 876 * to associate driver-specific data with the device. If unwilling ··· 914 912 */ 915 913 struct usb_class_driver { 916 914 char *name; 915 + char *(*nodename)(struct device *dev); 917 916 const struct file_operations *fops; 918 917 int minor_base; 919 918 };
+3 -3
init/Kconfig
··· 616 616 bool 617 617 618 618 config SYSFS_DEPRECATED_V2 619 - bool "Create deprecated sysfs layout for older userspace tools" 619 + bool "remove sysfs features which may confuse old userspace tools" 620 620 depends on SYSFS 621 - default y 621 + default n 622 622 select SYSFS_DEPRECATED 623 623 help 624 624 This option switches the layout of sysfs to the deprecated 625 - version. 625 + version. Do not use it on recent distributions. 626 626 627 627 The current sysfs layout features a unified device tree at 628 628 /sys/devices/, which is able to express a hierarchy between
+5 -5
kernel/trace/Kconfig
··· 147 147 disabled by default and can be runtime (re-)started 148 148 via: 149 149 150 - echo 0 > /debugfs/tracing/tracing_max_latency 150 + echo 0 > /sys/kernel/debug/tracing/tracing_max_latency 151 151 152 152 (Note that kernel size and overhead increases with this option 153 153 enabled. This option and the preempt-off timing option can be ··· 168 168 disabled by default and can be runtime (re-)started 169 169 via: 170 170 171 - echo 0 > /debugfs/tracing/tracing_max_latency 171 + echo 0 > /sys/kernel/debug/tracing/tracing_max_latency 172 172 173 173 (Note that kernel size and overhead increases with this option 174 174 enabled. This option and the irqs-off timing option can be ··· 261 261 This tracer profiles all the the likely and unlikely macros 262 262 in the kernel. It will display the results in: 263 263 264 - /debugfs/tracing/profile_annotated_branch 264 + /sys/kernel/debug/tracing/profile_annotated_branch 265 265 266 266 Note: this will add a significant overhead, only turn this 267 267 on if you need to profile the system's use of these macros. ··· 274 274 taken in the kernel is recorded whether it hit or miss. 275 275 The results will be displayed in: 276 276 277 - /debugfs/tracing/profile_branch 277 + /sys/kernel/debug/tracing/profile_branch 278 278 279 279 This option also enables the likely/unlikely profiler. 280 280 ··· 323 323 select KALLSYMS 324 324 help 325 325 This special tracer records the maximum stack footprint of the 326 - kernel and displays it in debugfs/tracing/stack_trace. 326 + kernel and displays it in /sys/kernel/debug/tracing/stack_trace. 327 327 328 328 This tracer works by hooking into every function call that the 329 329 kernel executes, and keeping a maximum stack depth value and
+11 -12
kernel/trace/trace.c
··· 344 344 /* 345 345 * Copy the new maximum trace into the separate maximum-trace 346 346 * structure. (this way the maximum trace is permanently saved, 347 - * for later retrieval via /debugfs/tracing/latency_trace) 347 + * for later retrieval via /sys/kernel/debug/tracing/latency_trace) 348 348 */ 349 349 static void 350 350 __update_max_tr(struct trace_array *tr, struct task_struct *tsk, int cpu) ··· 2414 2414 2415 2415 static const char readme_msg[] = 2416 2416 "tracing mini-HOWTO:\n\n" 2417 - "# mkdir /debug\n" 2418 - "# mount -t debugfs nodev /debug\n\n" 2419 - "# cat /debug/tracing/available_tracers\n" 2417 + "# mount -t debugfs nodev /sys/kernel/debug\n\n" 2418 + "# cat /sys/kernel/debug/tracing/available_tracers\n" 2420 2419 "wakeup preemptirqsoff preemptoff irqsoff function sched_switch nop\n\n" 2421 - "# cat /debug/tracing/current_tracer\n" 2420 + "# cat /sys/kernel/debug/tracing/current_tracer\n" 2422 2421 "nop\n" 2423 - "# echo sched_switch > /debug/tracing/current_tracer\n" 2424 - "# cat /debug/tracing/current_tracer\n" 2422 + "# echo sched_switch > /sys/kernel/debug/tracing/current_tracer\n" 2423 + "# cat /sys/kernel/debug/tracing/current_tracer\n" 2425 2424 "sched_switch\n" 2426 - "# cat /debug/tracing/trace_options\n" 2425 + "# cat /sys/kernel/debug/tracing/trace_options\n" 2427 2426 "noprint-parent nosym-offset nosym-addr noverbose\n" 2428 - "# echo print-parent > /debug/tracing/trace_options\n" 2429 - "# echo 1 > /debug/tracing/tracing_enabled\n" 2430 - "# cat /debug/tracing/trace > /tmp/trace.txt\n" 2431 - "# echo 0 > /debug/tracing/tracing_enabled\n" 2427 + "# echo print-parent > /sys/kernel/debug/tracing/trace_options\n" 2428 + "# echo 1 > /sys/kernel/debug/tracing/tracing_enabled\n" 2429 + "# cat /sys/kernel/debug/tracing/trace > /tmp/trace.txt\n" 2430 + "# echo 0 > /sys/kernel/debug/tracing/tracing_enabled\n" 2432 2431 ; 2433 2432 2434 2433 static ssize_t
+39 -28
kernel/user.c
··· 75 75 put_user_ns(up->user_ns); 76 76 } 77 77 78 - static struct user_struct *uid_hash_find(uid_t uid, struct hlist_head *hashent) 79 - { 80 - struct user_struct *user; 81 - struct hlist_node *h; 82 - 83 - hlist_for_each_entry(user, h, hashent, uidhash_node) { 84 - if (user->uid == uid) { 85 - atomic_inc(&user->__count); 86 - return user; 87 - } 88 - } 89 - 90 - return NULL; 91 - } 92 - 93 78 #ifdef CONFIG_USER_SCHED 94 79 95 80 static void sched_destroy_user(struct user_struct *up) ··· 103 118 #endif /* CONFIG_USER_SCHED */ 104 119 105 120 #if defined(CONFIG_USER_SCHED) && defined(CONFIG_SYSFS) 121 + 122 + static struct user_struct *uid_hash_find(uid_t uid, struct hlist_head *hashent) 123 + { 124 + struct user_struct *user; 125 + struct hlist_node *h; 126 + 127 + hlist_for_each_entry(user, h, hashent, uidhash_node) { 128 + if (user->uid == uid) { 129 + /* possibly resurrect an "almost deleted" object */ 130 + if (atomic_inc_return(&user->__count) == 1) 131 + cancel_delayed_work(&user->work); 132 + return user; 133 + } 134 + } 135 + 136 + return NULL; 137 + } 106 138 107 139 static struct kset *uids_kset; /* represents the /sys/kernel/uids/ directory */ 108 140 static DEFINE_MUTEX(uids_mutex); ··· 285 283 return uids_user_create(&root_user); 286 284 } 287 285 288 - /* work function to remove sysfs directory for a user and free up 286 + /* delayed work function to remove sysfs directory for a user and free up 289 287 * corresponding structures. 290 288 */ 291 289 static void cleanup_user_struct(struct work_struct *w) 292 290 { 293 - struct user_struct *up = container_of(w, struct user_struct, work); 291 + struct user_struct *up = container_of(w, struct user_struct, work.work); 294 292 unsigned long flags; 295 293 int remove_user = 0; 296 294 ··· 299 297 */ 300 298 uids_mutex_lock(); 301 299 302 - local_irq_save(flags); 303 - 304 - if (atomic_dec_and_lock(&up->__count, &uidhash_lock)) { 300 + spin_lock_irqsave(&uidhash_lock, flags); 301 + if (atomic_read(&up->__count) == 0) { 305 302 uid_hash_remove(up); 306 303 remove_user = 1; 307 - spin_unlock_irqrestore(&uidhash_lock, flags); 308 - } else { 309 - local_irq_restore(flags); 310 304 } 305 + spin_unlock_irqrestore(&uidhash_lock, flags); 311 306 312 307 if (!remove_user) 313 308 goto done; ··· 330 331 */ 331 332 static void free_user(struct user_struct *up, unsigned long flags) 332 333 { 333 - /* restore back the count */ 334 - atomic_inc(&up->__count); 335 334 spin_unlock_irqrestore(&uidhash_lock, flags); 336 - 337 - INIT_WORK(&up->work, cleanup_user_struct); 338 - schedule_work(&up->work); 335 + INIT_DELAYED_WORK(&up->work, cleanup_user_struct); 336 + schedule_delayed_work(&up->work, msecs_to_jiffies(1000)); 339 337 } 340 338 341 339 #else /* CONFIG_USER_SCHED && CONFIG_SYSFS */ 340 + 341 + static struct user_struct *uid_hash_find(uid_t uid, struct hlist_head *hashent) 342 + { 343 + struct user_struct *user; 344 + struct hlist_node *h; 345 + 346 + hlist_for_each_entry(user, h, hashent, uidhash_node) { 347 + if (user->uid == uid) { 348 + atomic_inc(&user->__count); 349 + return user; 350 + } 351 + } 352 + 353 + return NULL; 354 + } 342 355 343 356 int uids_sysfs_init(void) { return 0; } 344 357 static inline int uids_user_create(struct user_struct *up) { return 0; }
+6 -1
lib/kobject.c
··· 793 793 struct kobject *parent_kobj) 794 794 { 795 795 struct kset *kset; 796 + int retval; 796 797 797 798 kset = kzalloc(sizeof(*kset), GFP_KERNEL); 798 799 if (!kset) 799 800 return NULL; 800 - kobject_set_name(&kset->kobj, name); 801 + retval = kobject_set_name(&kset->kobj, name); 802 + if (retval) { 803 + kfree(kset); 804 + return NULL; 805 + } 801 806 kset->uevent_ops = uevent_ops; 802 807 kset->kobj.parent = parent_kobj; 803 808
+2 -1
samples/Kconfig
··· 26 26 This build trace event example modules. 27 27 28 28 config SAMPLE_KOBJECT 29 - tristate "Build kobject examples" 29 + tristate "Build kobject examples -- loadable modules only" 30 + depends on m 30 31 help 31 32 This config option will allow you to build a number of 32 33 different kobject sample modules showing how to use kobjects,
-121
samples/firmware_class/firmware_sample_driver.c
··· 1 - /* 2 - * firmware_sample_driver.c - 3 - * 4 - * Copyright (c) 2003 Manuel Estrada Sainz 5 - * 6 - * Sample code on how to use request_firmware() from drivers. 7 - * 8 - */ 9 - 10 - #include <linux/module.h> 11 - #include <linux/kernel.h> 12 - #include <linux/init.h> 13 - #include <linux/device.h> 14 - #include <linux/string.h> 15 - #include <linux/firmware.h> 16 - 17 - static struct device ghost_device = { 18 - .bus_id = "ghost0", 19 - }; 20 - 21 - 22 - static void sample_firmware_load(char *firmware, int size) 23 - { 24 - u8 buf[size+1]; 25 - memcpy(buf, firmware, size); 26 - buf[size] = '\0'; 27 - printk(KERN_INFO "firmware_sample_driver: firmware: %s\n", buf); 28 - } 29 - 30 - static void sample_probe_default(void) 31 - { 32 - /* uses the default method to get the firmware */ 33 - const struct firmware *fw_entry; 34 - int retval; 35 - 36 - printk(KERN_INFO "firmware_sample_driver: " 37 - "a ghost device got inserted :)\n"); 38 - 39 - retval = request_firmware(&fw_entry, "sample_driver_fw", &ghost_device); 40 - if (retval) { 41 - printk(KERN_ERR 42 - "firmware_sample_driver: Firmware not available\n"); 43 - return; 44 - } 45 - 46 - sample_firmware_load(fw_entry->data, fw_entry->size); 47 - 48 - release_firmware(fw_entry); 49 - 50 - /* finish setting up the device */ 51 - } 52 - 53 - static void sample_probe_specific(void) 54 - { 55 - int retval; 56 - /* Uses some specific hotplug support to get the firmware from 57 - * userspace directly into the hardware, or via some sysfs file */ 58 - 59 - /* NOTE: This currently doesn't work */ 60 - 61 - printk(KERN_INFO "firmware_sample_driver: " 62 - "a ghost device got inserted :)\n"); 63 - 64 - retval = request_firmware(NULL, "sample_driver_fw", &ghost_device); 65 - if (retval) { 66 - printk(KERN_ERR 67 - "firmware_sample_driver: Firmware load failed\n"); 68 - return; 69 - } 70 - 71 - /* request_firmware blocks until userspace finished, so at 72 - * this point the firmware should be already in the device */ 73 - 74 - /* finish setting up the device */ 75 - } 76 - 77 - static void sample_probe_async_cont(const struct firmware *fw, void *context) 78 - { 79 - if (!fw) { 80 - printk(KERN_ERR 81 - "firmware_sample_driver: firmware load failed\n"); 82 - return; 83 - } 84 - 85 - printk(KERN_INFO "firmware_sample_driver: device pointer \"%s\"\n", 86 - (char *)context); 87 - sample_firmware_load(fw->data, fw->size); 88 - } 89 - 90 - static void sample_probe_async(void) 91 - { 92 - /* Let's say that I can't sleep */ 93 - int error; 94 - error = request_firmware_nowait(THIS_MODULE, FW_ACTION_NOHOTPLUG, 95 - "sample_driver_fw", &ghost_device, 96 - "my device pointer", 97 - sample_probe_async_cont); 98 - if (error) 99 - printk(KERN_ERR "firmware_sample_driver:" 100 - " request_firmware_nowait failed\n"); 101 - } 102 - 103 - static int __init sample_init(void) 104 - { 105 - device_initialize(&ghost_device); 106 - /* since there is no real hardware insertion I just call the 107 - * sample probe functions here */ 108 - sample_probe_specific(); 109 - sample_probe_default(); 110 - sample_probe_async(); 111 - return 0; 112 - } 113 - 114 - static void __exit sample_exit(void) 115 - { 116 - } 117 - 118 - module_init(sample_init); 119 - module_exit(sample_exit); 120 - 121 - MODULE_LICENSE("GPL");
-204
samples/firmware_class/firmware_sample_firmware_class.c
··· 1 - /* 2 - * firmware_sample_firmware_class.c - 3 - * 4 - * Copyright (c) 2003 Manuel Estrada Sainz 5 - * 6 - * NOTE: This is just a probe of concept, if you think that your driver would 7 - * be well served by this mechanism please contact me first. 8 - * 9 - * DON'T USE THIS CODE AS IS 10 - * 11 - */ 12 - 13 - #include <linux/device.h> 14 - #include <linux/module.h> 15 - #include <linux/init.h> 16 - #include <linux/timer.h> 17 - #include <linux/slab.h> 18 - #include <linux/string.h> 19 - #include <linux/firmware.h> 20 - 21 - 22 - MODULE_AUTHOR("Manuel Estrada Sainz"); 23 - MODULE_DESCRIPTION("Hackish sample for using firmware class directly"); 24 - MODULE_LICENSE("GPL"); 25 - 26 - static inline struct class_device *to_class_dev(struct kobject *obj) 27 - { 28 - return container_of(obj, struct class_device, kobj); 29 - } 30 - 31 - static inline 32 - struct class_device_attribute *to_class_dev_attr(struct attribute *_attr) 33 - { 34 - return container_of(_attr, struct class_device_attribute, attr); 35 - } 36 - 37 - struct firmware_priv { 38 - char fw_id[FIRMWARE_NAME_MAX]; 39 - s32 loading:2; 40 - u32 abort:1; 41 - }; 42 - 43 - static ssize_t firmware_loading_show(struct class_device *class_dev, char *buf) 44 - { 45 - struct firmware_priv *fw_priv = class_get_devdata(class_dev); 46 - return sprintf(buf, "%d\n", fw_priv->loading); 47 - } 48 - 49 - static ssize_t firmware_loading_store(struct class_device *class_dev, 50 - const char *buf, size_t count) 51 - { 52 - struct firmware_priv *fw_priv = class_get_devdata(class_dev); 53 - int prev_loading = fw_priv->loading; 54 - 55 - fw_priv->loading = simple_strtol(buf, NULL, 10); 56 - 57 - switch (fw_priv->loading) { 58 - case -1: 59 - /* abort load an panic */ 60 - break; 61 - case 1: 62 - /* setup load */ 63 - break; 64 - case 0: 65 - if (prev_loading == 1) { 66 - /* finish load and get the device back to working 67 - * state */ 68 - } 69 - break; 70 - } 71 - 72 - return count; 73 - } 74 - static CLASS_DEVICE_ATTR(loading, 0644, 75 - firmware_loading_show, firmware_loading_store); 76 - 77 - static ssize_t firmware_data_read(struct kobject *kobj, 78 - struct bin_attribute *bin_attr, 79 - char *buffer, loff_t offset, size_t count) 80 - { 81 - struct class_device *class_dev = to_class_dev(kobj); 82 - struct firmware_priv *fw_priv = class_get_devdata(class_dev); 83 - 84 - /* read from the devices firmware memory */ 85 - 86 - return count; 87 - } 88 - static ssize_t firmware_data_write(struct kobject *kobj, 89 - struct bin_attribute *bin_attr, 90 - char *buffer, loff_t offset, size_t count) 91 - { 92 - struct class_device *class_dev = to_class_dev(kobj); 93 - struct firmware_priv *fw_priv = class_get_devdata(class_dev); 94 - 95 - /* write to the devices firmware memory */ 96 - 97 - return count; 98 - } 99 - static struct bin_attribute firmware_attr_data = { 100 - .attr = {.name = "data", .mode = 0644}, 101 - .size = 0, 102 - .read = firmware_data_read, 103 - .write = firmware_data_write, 104 - }; 105 - static int fw_setup_class_device(struct class_device *class_dev, 106 - const char *fw_name, 107 - struct device *device) 108 - { 109 - int retval; 110 - struct firmware_priv *fw_priv; 111 - 112 - fw_priv = kzalloc(sizeof(struct firmware_priv), GFP_KERNEL); 113 - if (!fw_priv) { 114 - retval = -ENOMEM; 115 - goto out; 116 - } 117 - 118 - memset(class_dev, 0, sizeof(*class_dev)); 119 - 120 - strncpy(fw_priv->fw_id, fw_name, FIRMWARE_NAME_MAX); 121 - fw_priv->fw_id[FIRMWARE_NAME_MAX-1] = '\0'; 122 - 123 - strncpy(class_dev->class_id, device->bus_id, BUS_ID_SIZE); 124 - class_dev->class_id[BUS_ID_SIZE-1] = '\0'; 125 - class_dev->dev = device; 126 - 127 - class_dev->class = &firmware_class; 128 - class_set_devdata(class_dev, fw_priv); 129 - retval = class_device_register(class_dev); 130 - if (retval) { 131 - printk(KERN_ERR "%s: class_device_register failed\n", 132 - __func__); 133 - goto error_free_fw_priv; 134 - } 135 - 136 - retval = sysfs_create_bin_file(&class_dev->kobj, &firmware_attr_data); 137 - if (retval) { 138 - printk(KERN_ERR "%s: sysfs_create_bin_file failed\n", 139 - __func__); 140 - goto error_unreg_class_dev; 141 - } 142 - 143 - retval = class_device_create_file(class_dev, 144 - &class_device_attr_loading); 145 - if (retval) { 146 - printk(KERN_ERR "%s: class_device_create_file failed\n", 147 - __func__); 148 - goto error_remove_data; 149 - } 150 - 151 - goto out; 152 - 153 - error_remove_data: 154 - sysfs_remove_bin_file(&class_dev->kobj, &firmware_attr_data); 155 - error_unreg_class_dev: 156 - class_device_unregister(class_dev); 157 - error_free_fw_priv: 158 - kfree(fw_priv); 159 - out: 160 - return retval; 161 - } 162 - static void fw_remove_class_device(struct class_device *class_dev) 163 - { 164 - struct firmware_priv *fw_priv = class_get_devdata(class_dev); 165 - 166 - class_device_remove_file(class_dev, &class_device_attr_loading); 167 - sysfs_remove_bin_file(&class_dev->kobj, &firmware_attr_data); 168 - class_device_unregister(class_dev); 169 - } 170 - 171 - static struct class_device *class_dev; 172 - 173 - static struct device my_device = { 174 - .bus_id = "my_dev0", 175 - }; 176 - 177 - static int __init firmware_sample_init(void) 178 - { 179 - int error; 180 - 181 - device_initialize(&my_device); 182 - class_dev = kmalloc(sizeof(struct class_device), GFP_KERNEL); 183 - if (!class_dev) 184 - return -ENOMEM; 185 - 186 - error = fw_setup_class_device(class_dev, "my_firmware_image", 187 - &my_device); 188 - if (error) { 189 - kfree(class_dev); 190 - return error; 191 - } 192 - return 0; 193 - 194 - } 195 - static void __exit firmware_sample_exit(void) 196 - { 197 - struct firmware_priv *fw_priv = class_get_devdata(class_dev); 198 - fw_remove_class_device(class_dev); 199 - kfree(fw_priv); 200 - kfree(class_dev); 201 - } 202 - 203 - module_init(firmware_sample_init); 204 - module_exit(firmware_sample_exit);
+3 -4
scripts/tracing/draw_functrace.py
··· 12 12 13 13 Usage: 14 14 Be sure that you have CONFIG_FUNCTION_TRACER 15 - # mkdir /debugfs 16 - # mount -t debug debug /debug 17 - # echo function > /debug/tracing/current_tracer 18 - $ cat /debug/tracing/trace_pipe > ~/raw_trace_func 15 + # mount -t debugfs nodev /sys/kernel/debug 16 + # echo function > /sys/kernel/debug/tracing/current_tracer 17 + $ cat /sys/kernel/debug/tracing/trace_pipe > ~/raw_trace_func 19 18 Wait some times but not too much, the script is a bit slow. 20 19 Break the pipe (Ctrl + Z) 21 20 $ scripts/draw_functrace.py < raw_trace_func > draw_functrace
+7
sound/sound_core.c
··· 27 27 MODULE_AUTHOR("Alan Cox"); 28 28 MODULE_LICENSE("GPL"); 29 29 30 + static char *sound_nodename(struct device *dev) 31 + { 32 + return kasprintf(GFP_KERNEL, "snd/%s", dev_name(dev)); 33 + } 34 + 30 35 static int __init init_soundcore(void) 31 36 { 32 37 int rc; ··· 45 40 cleanup_oss_soundcore(); 46 41 return PTR_ERR(sound_class); 47 42 } 43 + 44 + sound_class->nodename = sound_nodename; 48 45 49 46 return 0; 50 47 }