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