mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-11-18 23:54:26 +08:00
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}
This commit is contained in:
commit
6fd03301d7
@ -106,7 +106,7 @@
|
||||
number of errors are printk'ed including a full stack trace.
|
||||
</para>
|
||||
<para>
|
||||
The statistics are available via debugfs/debug_objects/stats.
|
||||
The statistics are available via /sys/kernel/debug/debug_objects/stats.
|
||||
They provide information about the number of warnings and the
|
||||
number of successful fixups along with information about the
|
||||
usage of the internal tracking objects and the state of the
|
||||
|
@ -117,7 +117,7 @@ Using the pktcdvd debugfs interface
|
||||
|
||||
To read pktcdvd device infos in human readable form, do:
|
||||
|
||||
# cat /debug/pktcdvd/pktcdvd[0-7]/info
|
||||
# cat /sys/kernel/debug/pktcdvd/pktcdvd[0-7]/info
|
||||
|
||||
For a description of the debugfs interface look into the file:
|
||||
|
||||
|
@ -162,3 +162,35 @@ device_remove_file(dev,&dev_attr_power);
|
||||
|
||||
The file name will be 'power' with a mode of 0644 (-rw-r--r--).
|
||||
|
||||
Word of warning: While the kernel allows device_create_file() and
|
||||
device_remove_file() to be called on a device at any time, userspace has
|
||||
strict expectations on when attributes get created. When a new device is
|
||||
registered in the kernel, a uevent is generated to notify userspace (like
|
||||
udev) that a new device is available. If attributes are added after the
|
||||
device is registered, then userspace won't get notified and userspace will
|
||||
not know about the new attributes.
|
||||
|
||||
This is important for device driver that need to publish additional
|
||||
attributes for a device at driver probe time. If the device driver simply
|
||||
calls device_create_file() on the device structure passed to it, then
|
||||
userspace will never be notified of the new attributes. Instead, it should
|
||||
probably use class_create() and class->dev_attrs to set up a list of
|
||||
desired attributes in the modules_init function, and then in the .probe()
|
||||
hook, and then use device_create() to create a new device as a child
|
||||
of the probed device. The new device will generate a new uevent and
|
||||
properly advertise the new attributes to userspace.
|
||||
|
||||
For example, if a driver wanted to add the following attributes:
|
||||
struct device_attribute mydriver_attribs[] = {
|
||||
__ATTR(port_count, 0444, port_count_show),
|
||||
__ATTR(serial_number, 0444, serial_number_show),
|
||||
NULL
|
||||
};
|
||||
|
||||
Then in the module init function is would do:
|
||||
mydriver_class = class_create(THIS_MODULE, "my_attrs");
|
||||
mydriver_class.dev_attr = mydriver_attribs;
|
||||
|
||||
And assuming 'dev' is the struct device passed into the probe hook, the driver
|
||||
probe function would do something like:
|
||||
create_device(&mydriver_class, dev, chrdev, &private_data, "my_name");
|
||||
|
@ -29,16 +29,16 @@ o debugfs entries
|
||||
fault-inject-debugfs kernel module provides some debugfs entries for runtime
|
||||
configuration of fault-injection capabilities.
|
||||
|
||||
- /debug/fail*/probability:
|
||||
- /sys/kernel/debug/fail*/probability:
|
||||
|
||||
likelihood of failure injection, in percent.
|
||||
Format: <percent>
|
||||
|
||||
Note that one-failure-per-hundred is a very high error rate
|
||||
for some testcases. Consider setting probability=100 and configure
|
||||
/debug/fail*/interval for such testcases.
|
||||
/sys/kernel/debug/fail*/interval for such testcases.
|
||||
|
||||
- /debug/fail*/interval:
|
||||
- /sys/kernel/debug/fail*/interval:
|
||||
|
||||
specifies the interval between failures, for calls to
|
||||
should_fail() that pass all the other tests.
|
||||
@ -46,18 +46,18 @@ configuration of fault-injection capabilities.
|
||||
Note that if you enable this, by setting interval>1, you will
|
||||
probably want to set probability=100.
|
||||
|
||||
- /debug/fail*/times:
|
||||
- /sys/kernel/debug/fail*/times:
|
||||
|
||||
specifies how many times failures may happen at most.
|
||||
A value of -1 means "no limit".
|
||||
|
||||
- /debug/fail*/space:
|
||||
- /sys/kernel/debug/fail*/space:
|
||||
|
||||
specifies an initial resource "budget", decremented by "size"
|
||||
on each call to should_fail(,size). Failure injection is
|
||||
suppressed until "space" reaches zero.
|
||||
|
||||
- /debug/fail*/verbose
|
||||
- /sys/kernel/debug/fail*/verbose
|
||||
|
||||
Format: { 0 | 1 | 2 }
|
||||
specifies the verbosity of the messages when failure is
|
||||
@ -65,17 +65,17 @@ configuration of fault-injection capabilities.
|
||||
log line per failure; '2' will print a call trace too -- useful
|
||||
to debug the problems revealed by fault injection.
|
||||
|
||||
- /debug/fail*/task-filter:
|
||||
- /sys/kernel/debug/fail*/task-filter:
|
||||
|
||||
Format: { 'Y' | 'N' }
|
||||
A value of 'N' disables filtering by process (default).
|
||||
Any positive value limits failures to only processes indicated by
|
||||
/proc/<pid>/make-it-fail==1.
|
||||
|
||||
- /debug/fail*/require-start:
|
||||
- /debug/fail*/require-end:
|
||||
- /debug/fail*/reject-start:
|
||||
- /debug/fail*/reject-end:
|
||||
- /sys/kernel/debug/fail*/require-start:
|
||||
- /sys/kernel/debug/fail*/require-end:
|
||||
- /sys/kernel/debug/fail*/reject-start:
|
||||
- /sys/kernel/debug/fail*/reject-end:
|
||||
|
||||
specifies the range of virtual addresses tested during
|
||||
stacktrace walking. Failure is injected only if some caller
|
||||
@ -84,26 +84,26 @@ configuration of fault-injection capabilities.
|
||||
Default required range is [0,ULONG_MAX) (whole of virtual address space).
|
||||
Default rejected range is [0,0).
|
||||
|
||||
- /debug/fail*/stacktrace-depth:
|
||||
- /sys/kernel/debug/fail*/stacktrace-depth:
|
||||
|
||||
specifies the maximum stacktrace depth walked during search
|
||||
for a caller within [require-start,require-end) OR
|
||||
[reject-start,reject-end).
|
||||
|
||||
- /debug/fail_page_alloc/ignore-gfp-highmem:
|
||||
- /sys/kernel/debug/fail_page_alloc/ignore-gfp-highmem:
|
||||
|
||||
Format: { 'Y' | 'N' }
|
||||
default is 'N', setting it to 'Y' won't inject failures into
|
||||
highmem/user allocations.
|
||||
|
||||
- /debug/failslab/ignore-gfp-wait:
|
||||
- /debug/fail_page_alloc/ignore-gfp-wait:
|
||||
- /sys/kernel/debug/failslab/ignore-gfp-wait:
|
||||
- /sys/kernel/debug/fail_page_alloc/ignore-gfp-wait:
|
||||
|
||||
Format: { 'Y' | 'N' }
|
||||
default is 'N', setting it to 'Y' will inject failures
|
||||
only into non-sleep allocations (GFP_ATOMIC allocations).
|
||||
|
||||
- /debug/fail_page_alloc/min-order:
|
||||
- /sys/kernel/debug/fail_page_alloc/min-order:
|
||||
|
||||
specifies the minimum page allocation order to be injected
|
||||
failures.
|
||||
@ -166,13 +166,13 @@ o Inject slab allocation failures into module init/exit code
|
||||
#!/bin/bash
|
||||
|
||||
FAILTYPE=failslab
|
||||
echo Y > /debug/$FAILTYPE/task-filter
|
||||
echo 10 > /debug/$FAILTYPE/probability
|
||||
echo 100 > /debug/$FAILTYPE/interval
|
||||
echo -1 > /debug/$FAILTYPE/times
|
||||
echo 0 > /debug/$FAILTYPE/space
|
||||
echo 2 > /debug/$FAILTYPE/verbose
|
||||
echo 1 > /debug/$FAILTYPE/ignore-gfp-wait
|
||||
echo Y > /sys/kernel/debug/$FAILTYPE/task-filter
|
||||
echo 10 > /sys/kernel/debug/$FAILTYPE/probability
|
||||
echo 100 > /sys/kernel/debug/$FAILTYPE/interval
|
||||
echo -1 > /sys/kernel/debug/$FAILTYPE/times
|
||||
echo 0 > /sys/kernel/debug/$FAILTYPE/space
|
||||
echo 2 > /sys/kernel/debug/$FAILTYPE/verbose
|
||||
echo 1 > /sys/kernel/debug/$FAILTYPE/ignore-gfp-wait
|
||||
|
||||
faulty_system()
|
||||
{
|
||||
@ -217,20 +217,20 @@ then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cat /sys/module/$module/sections/.text > /debug/$FAILTYPE/require-start
|
||||
cat /sys/module/$module/sections/.data > /debug/$FAILTYPE/require-end
|
||||
cat /sys/module/$module/sections/.text > /sys/kernel/debug/$FAILTYPE/require-start
|
||||
cat /sys/module/$module/sections/.data > /sys/kernel/debug/$FAILTYPE/require-end
|
||||
|
||||
echo N > /debug/$FAILTYPE/task-filter
|
||||
echo 10 > /debug/$FAILTYPE/probability
|
||||
echo 100 > /debug/$FAILTYPE/interval
|
||||
echo -1 > /debug/$FAILTYPE/times
|
||||
echo 0 > /debug/$FAILTYPE/space
|
||||
echo 2 > /debug/$FAILTYPE/verbose
|
||||
echo 1 > /debug/$FAILTYPE/ignore-gfp-wait
|
||||
echo 1 > /debug/$FAILTYPE/ignore-gfp-highmem
|
||||
echo 10 > /debug/$FAILTYPE/stacktrace-depth
|
||||
echo N > /sys/kernel/debug/$FAILTYPE/task-filter
|
||||
echo 10 > /sys/kernel/debug/$FAILTYPE/probability
|
||||
echo 100 > /sys/kernel/debug/$FAILTYPE/interval
|
||||
echo -1 > /sys/kernel/debug/$FAILTYPE/times
|
||||
echo 0 > /sys/kernel/debug/$FAILTYPE/space
|
||||
echo 2 > /sys/kernel/debug/$FAILTYPE/verbose
|
||||
echo 1 > /sys/kernel/debug/$FAILTYPE/ignore-gfp-wait
|
||||
echo 1 > /sys/kernel/debug/$FAILTYPE/ignore-gfp-highmem
|
||||
echo 10 > /sys/kernel/debug/$FAILTYPE/stacktrace-depth
|
||||
|
||||
trap "echo 0 > /debug/$FAILTYPE/probability" SIGINT SIGTERM EXIT
|
||||
trap "echo 0 > /sys/kernel/debug/$FAILTYPE/probability" SIGINT SIGTERM EXIT
|
||||
|
||||
echo "Injecting errors into the module $module... (interrupt to stop)"
|
||||
sleep 1000000
|
||||
|
@ -77,7 +77,8 @@
|
||||
seconds for the whole load operation.
|
||||
|
||||
- request_firmware_nowait() is also provided for convenience in
|
||||
non-user contexts.
|
||||
user contexts to request firmware asynchronously, but can't be called
|
||||
in atomic contexts.
|
||||
|
||||
|
||||
about in-kernel persistence:
|
||||
|
@ -507,9 +507,9 @@ http://www.linuxsymposium.org/2006/linuxsymposium_procv2.pdf (pages 101-115)
|
||||
Appendix A: The kprobes debugfs interface
|
||||
|
||||
With recent kernels (> 2.6.20) the list of registered kprobes is visible
|
||||
under the /debug/kprobes/ directory (assuming debugfs is mounted at /debug).
|
||||
under the /sys/kernel/debug/kprobes/ directory (assuming debugfs is mounted at //sys/kernel/debug).
|
||||
|
||||
/debug/kprobes/list: Lists all registered probes on the system
|
||||
/sys/kernel/debug/kprobes/list: Lists all registered probes on the system
|
||||
|
||||
c015d71a k vfs_read+0x0
|
||||
c011a316 j do_fork+0x0
|
||||
@ -525,7 +525,7 @@ virtual addresses that correspond to modules that've been unloaded),
|
||||
such probes are marked with [GONE]. If the probe is temporarily disabled,
|
||||
such probes are marked with [DISABLED].
|
||||
|
||||
/debug/kprobes/enabled: Turn kprobes ON/OFF forcibly.
|
||||
/sys/kernel/debug/kprobes/enabled: Turn kprobes ON/OFF forcibly.
|
||||
|
||||
Provides a knob to globally and forcibly turn registered kprobes ON or OFF.
|
||||
By default, all kprobes are enabled. By echoing "0" to this file, all
|
||||
|
@ -7,7 +7,6 @@ Copyright 2008 Red Hat Inc.
|
||||
(dual licensed under the GPL v2)
|
||||
Reviewers: Elias Oltmanns, Randy Dunlap, Andrew Morton,
|
||||
John Kacur, and David Teigland.
|
||||
|
||||
Written for: 2.6.28-rc2
|
||||
|
||||
Introduction
|
||||
@ -33,13 +32,26 @@ The File System
|
||||
Ftrace uses the debugfs file system to hold the control files as
|
||||
well as the files to display output.
|
||||
|
||||
To mount the debugfs system:
|
||||
When debugfs is configured into the kernel (which selecting any ftrace
|
||||
option will do) the directory /sys/kernel/debug will be created. To mount
|
||||
this directory, you can add to your /etc/fstab file:
|
||||
|
||||
# mkdir /debug
|
||||
# mount -t debugfs nodev /debug
|
||||
debugfs /sys/kernel/debug debugfs defaults 0 0
|
||||
|
||||
( Note: it is more common to mount at /sys/kernel/debug, but for
|
||||
simplicity this document will use /debug)
|
||||
Or you can mount it at run time with:
|
||||
|
||||
mount -t debugfs nodev /sys/kernel/debug
|
||||
|
||||
For quicker access to that directory you may want to make a soft link to
|
||||
it:
|
||||
|
||||
ln -s /sys/kernel/debug /debug
|
||||
|
||||
Any selected ftrace option will also create a directory called tracing
|
||||
within the debugfs. The rest of the document will assume that you are in
|
||||
the ftrace directory (cd /sys/kernel/debug/tracing) and will only concentrate
|
||||
on the files within that directory and not distract from the content with
|
||||
the extended "/sys/kernel/debug/tracing" path name.
|
||||
|
||||
That's it! (assuming that you have ftrace configured into your kernel)
|
||||
|
||||
@ -389,18 +401,18 @@ trace_options
|
||||
The trace_options file is used to control what gets printed in
|
||||
the trace output. To see what is available, simply cat the file:
|
||||
|
||||
cat /debug/tracing/trace_options
|
||||
cat trace_options
|
||||
print-parent nosym-offset nosym-addr noverbose noraw nohex nobin \
|
||||
noblock nostacktrace nosched-tree nouserstacktrace nosym-userobj
|
||||
|
||||
To disable one of the options, echo in the option prepended with
|
||||
"no".
|
||||
|
||||
echo noprint-parent > /debug/tracing/trace_options
|
||||
echo noprint-parent > trace_options
|
||||
|
||||
To enable an option, leave off the "no".
|
||||
|
||||
echo sym-offset > /debug/tracing/trace_options
|
||||
echo sym-offset > trace_options
|
||||
|
||||
Here are the available options:
|
||||
|
||||
@ -476,11 +488,11 @@ sched_switch
|
||||
This tracer simply records schedule switches. Here is an example
|
||||
of how to use it.
|
||||
|
||||
# echo sched_switch > /debug/tracing/current_tracer
|
||||
# echo 1 > /debug/tracing/tracing_enabled
|
||||
# echo sched_switch > current_tracer
|
||||
# echo 1 > tracing_enabled
|
||||
# sleep 1
|
||||
# echo 0 > /debug/tracing/tracing_enabled
|
||||
# cat /debug/tracing/trace
|
||||
# echo 0 > tracing_enabled
|
||||
# cat trace
|
||||
|
||||
# tracer: sched_switch
|
||||
#
|
||||
@ -583,13 +595,13 @@ new trace is saved.
|
||||
To reset the maximum, echo 0 into tracing_max_latency. Here is
|
||||
an example:
|
||||
|
||||
# echo irqsoff > /debug/tracing/current_tracer
|
||||
# echo 0 > /debug/tracing/tracing_max_latency
|
||||
# echo 1 > /debug/tracing/tracing_enabled
|
||||
# echo irqsoff > current_tracer
|
||||
# echo 0 > tracing_max_latency
|
||||
# echo 1 > tracing_enabled
|
||||
# ls -ltr
|
||||
[...]
|
||||
# echo 0 > /debug/tracing/tracing_enabled
|
||||
# cat /debug/tracing/latency_trace
|
||||
# echo 0 > tracing_enabled
|
||||
# cat latency_trace
|
||||
# tracer: irqsoff
|
||||
#
|
||||
irqsoff latency trace v1.1.5 on 2.6.26
|
||||
@ -690,13 +702,13 @@ Like the irqsoff tracer, it records the maximum latency for
|
||||
which preemption was disabled. The control of preemptoff tracer
|
||||
is much like the irqsoff tracer.
|
||||
|
||||
# echo preemptoff > /debug/tracing/current_tracer
|
||||
# echo 0 > /debug/tracing/tracing_max_latency
|
||||
# echo 1 > /debug/tracing/tracing_enabled
|
||||
# echo preemptoff > current_tracer
|
||||
# echo 0 > tracing_max_latency
|
||||
# echo 1 > tracing_enabled
|
||||
# ls -ltr
|
||||
[...]
|
||||
# echo 0 > /debug/tracing/tracing_enabled
|
||||
# cat /debug/tracing/latency_trace
|
||||
# echo 0 > tracing_enabled
|
||||
# cat latency_trace
|
||||
# tracer: preemptoff
|
||||
#
|
||||
preemptoff latency trace v1.1.5 on 2.6.26-rc8
|
||||
@ -837,13 +849,13 @@ tracer.
|
||||
Again, using this trace is much like the irqsoff and preemptoff
|
||||
tracers.
|
||||
|
||||
# echo preemptirqsoff > /debug/tracing/current_tracer
|
||||
# echo 0 > /debug/tracing/tracing_max_latency
|
||||
# echo 1 > /debug/tracing/tracing_enabled
|
||||
# echo preemptirqsoff > current_tracer
|
||||
# echo 0 > tracing_max_latency
|
||||
# echo 1 > tracing_enabled
|
||||
# ls -ltr
|
||||
[...]
|
||||
# echo 0 > /debug/tracing/tracing_enabled
|
||||
# cat /debug/tracing/latency_trace
|
||||
# echo 0 > tracing_enabled
|
||||
# cat latency_trace
|
||||
# tracer: preemptirqsoff
|
||||
#
|
||||
preemptirqsoff latency trace v1.1.5 on 2.6.26-rc8
|
||||
@ -999,12 +1011,12 @@ slightly differently than we did with the previous tracers.
|
||||
Instead of performing an 'ls', we will run 'sleep 1' under
|
||||
'chrt' which changes the priority of the task.
|
||||
|
||||
# echo wakeup > /debug/tracing/current_tracer
|
||||
# echo 0 > /debug/tracing/tracing_max_latency
|
||||
# echo 1 > /debug/tracing/tracing_enabled
|
||||
# echo wakeup > current_tracer
|
||||
# echo 0 > tracing_max_latency
|
||||
# echo 1 > tracing_enabled
|
||||
# chrt -f 5 sleep 1
|
||||
# echo 0 > /debug/tracing/tracing_enabled
|
||||
# cat /debug/tracing/latency_trace
|
||||
# echo 0 > tracing_enabled
|
||||
# cat latency_trace
|
||||
# tracer: wakeup
|
||||
#
|
||||
wakeup 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
|
||||
ftrace_enabled is set; otherwise this tracer is a nop.
|
||||
|
||||
# sysctl kernel.ftrace_enabled=1
|
||||
# echo function > /debug/tracing/current_tracer
|
||||
# echo 1 > /debug/tracing/tracing_enabled
|
||||
# echo function > current_tracer
|
||||
# echo 1 > tracing_enabled
|
||||
# usleep 1
|
||||
# echo 0 > /debug/tracing/tracing_enabled
|
||||
# cat /debug/tracing/trace
|
||||
# echo 0 > tracing_enabled
|
||||
# cat trace
|
||||
# tracer: function
|
||||
#
|
||||
# TASK-PID CPU# TIMESTAMP FUNCTION
|
||||
@ -1155,7 +1167,7 @@ int trace_fd;
|
||||
[...]
|
||||
int main(int argc, char *argv[]) {
|
||||
[...]
|
||||
trace_fd = open("/debug/tracing/tracing_enabled", O_WRONLY);
|
||||
trace_fd = open(tracing_file("tracing_enabled"), O_WRONLY);
|
||||
[...]
|
||||
if (condition_hit()) {
|
||||
write(trace_fd, "0", 1);
|
||||
@ -1163,26 +1175,20 @@ int main(int argc, char *argv[]) {
|
||||
[...]
|
||||
}
|
||||
|
||||
Note: Here we hard coded the path name. The debugfs mount is not
|
||||
guaranteed to be at /debug (and is more commonly at
|
||||
/sys/kernel/debug). For simple one time traces, the above is
|
||||
sufficent. For anything else, a search through /proc/mounts may
|
||||
be needed to find where the debugfs file-system is mounted.
|
||||
|
||||
|
||||
Single thread tracing
|
||||
---------------------
|
||||
|
||||
By writing into /debug/tracing/set_ftrace_pid you can trace a
|
||||
By writing into set_ftrace_pid you can trace a
|
||||
single thread. For example:
|
||||
|
||||
# cat /debug/tracing/set_ftrace_pid
|
||||
# cat set_ftrace_pid
|
||||
no pid
|
||||
# echo 3111 > /debug/tracing/set_ftrace_pid
|
||||
# cat /debug/tracing/set_ftrace_pid
|
||||
# echo 3111 > set_ftrace_pid
|
||||
# cat set_ftrace_pid
|
||||
3111
|
||||
# echo function > /debug/tracing/current_tracer
|
||||
# cat /debug/tracing/trace | head
|
||||
# echo function > current_tracer
|
||||
# cat trace | head
|
||||
# tracer: function
|
||||
#
|
||||
# TASK-PID CPU# TIMESTAMP FUNCTION
|
||||
@ -1193,8 +1199,8 @@ no pid
|
||||
yum-updatesd-3111 [003] 1637.254683: lock_hrtimer_base <-hrtimer_try_to_cancel
|
||||
yum-updatesd-3111 [003] 1637.254685: fget_light <-do_sys_poll
|
||||
yum-updatesd-3111 [003] 1637.254686: pipe_poll <-do_sys_poll
|
||||
# echo -1 > /debug/tracing/set_ftrace_pid
|
||||
# cat /debug/tracing/trace |head
|
||||
# echo -1 > set_ftrace_pid
|
||||
# cat trace |head
|
||||
# tracer: function
|
||||
#
|
||||
# TASK-PID CPU# TIMESTAMP FUNCTION
|
||||
@ -1216,6 +1222,51 @@ something like this simple program:
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#define _STR(x) #x
|
||||
#define STR(x) _STR(x)
|
||||
#define MAX_PATH 256
|
||||
|
||||
const char *find_debugfs(void)
|
||||
{
|
||||
static char debugfs[MAX_PATH+1];
|
||||
static int debugfs_found;
|
||||
char type[100];
|
||||
FILE *fp;
|
||||
|
||||
if (debugfs_found)
|
||||
return debugfs;
|
||||
|
||||
if ((fp = fopen("/proc/mounts","r")) == NULL) {
|
||||
perror("/proc/mounts");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
while (fscanf(fp, "%*s %"
|
||||
STR(MAX_PATH)
|
||||
"s %99s %*s %*d %*d\n",
|
||||
debugfs, type) == 2) {
|
||||
if (strcmp(type, "debugfs") == 0)
|
||||
break;
|
||||
}
|
||||
fclose(fp);
|
||||
|
||||
if (strcmp(type, "debugfs") != 0) {
|
||||
fprintf(stderr, "debugfs not mounted");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
debugfs_found = 1;
|
||||
|
||||
return debugfs;
|
||||
}
|
||||
|
||||
const char *tracing_file(const char *file_name)
|
||||
{
|
||||
static char trace_file[MAX_PATH+1];
|
||||
snprintf(trace_file, MAX_PATH, "%s/%s", find_debugfs(), file_name);
|
||||
return trace_file;
|
||||
}
|
||||
|
||||
int main (int argc, char **argv)
|
||||
{
|
||||
if (argc < 1)
|
||||
@ -1226,12 +1277,12 @@ int main (int argc, char **argv)
|
||||
char line[64];
|
||||
int s;
|
||||
|
||||
ffd = open("/debug/tracing/current_tracer", O_WRONLY);
|
||||
ffd = open(tracing_file("current_tracer"), O_WRONLY);
|
||||
if (ffd < 0)
|
||||
exit(-1);
|
||||
write(ffd, "nop", 3);
|
||||
|
||||
fd = open("/debug/tracing/set_ftrace_pid", O_WRONLY);
|
||||
fd = open(tracing_file("set_ftrace_pid"), O_WRONLY);
|
||||
s = sprintf(line, "%d\n", getpid());
|
||||
write(fd, line, s);
|
||||
|
||||
@ -1383,22 +1434,22 @@ want, depending on your needs.
|
||||
tracing_cpu_mask file) or you might sometimes see unordered
|
||||
function calls while cpu tracing switch.
|
||||
|
||||
hide: echo nofuncgraph-cpu > /debug/tracing/trace_options
|
||||
show: echo funcgraph-cpu > /debug/tracing/trace_options
|
||||
hide: echo nofuncgraph-cpu > trace_options
|
||||
show: echo funcgraph-cpu > trace_options
|
||||
|
||||
- The duration (function's time of execution) is displayed on
|
||||
the closing bracket line of a function or on the same line
|
||||
than the current function in case of a leaf one. It is default
|
||||
enabled.
|
||||
|
||||
hide: echo nofuncgraph-duration > /debug/tracing/trace_options
|
||||
show: echo funcgraph-duration > /debug/tracing/trace_options
|
||||
hide: echo nofuncgraph-duration > trace_options
|
||||
show: echo funcgraph-duration > trace_options
|
||||
|
||||
- The overhead field precedes the duration field in case of
|
||||
reached duration thresholds.
|
||||
|
||||
hide: echo nofuncgraph-overhead > /debug/tracing/trace_options
|
||||
show: echo funcgraph-overhead > /debug/tracing/trace_options
|
||||
hide: echo nofuncgraph-overhead > trace_options
|
||||
show: echo funcgraph-overhead > trace_options
|
||||
depends on: funcgraph-duration
|
||||
|
||||
ie:
|
||||
@ -1427,8 +1478,8 @@ want, depending on your needs.
|
||||
- The task/pid field displays the thread cmdline and pid which
|
||||
executed the function. It is default disabled.
|
||||
|
||||
hide: echo nofuncgraph-proc > /debug/tracing/trace_options
|
||||
show: echo funcgraph-proc > /debug/tracing/trace_options
|
||||
hide: echo nofuncgraph-proc > trace_options
|
||||
show: echo funcgraph-proc > trace_options
|
||||
|
||||
ie:
|
||||
|
||||
@ -1451,8 +1502,8 @@ want, depending on your needs.
|
||||
system clock since it started. A snapshot of this time is
|
||||
given on each entry/exit of functions
|
||||
|
||||
hide: echo nofuncgraph-abstime > /debug/tracing/trace_options
|
||||
show: echo funcgraph-abstime > /debug/tracing/trace_options
|
||||
hide: echo nofuncgraph-abstime > trace_options
|
||||
show: echo funcgraph-abstime > trace_options
|
||||
|
||||
ie:
|
||||
|
||||
@ -1549,7 +1600,7 @@ listed in:
|
||||
|
||||
available_filter_functions
|
||||
|
||||
# cat /debug/tracing/available_filter_functions
|
||||
# cat available_filter_functions
|
||||
put_prev_task_idle
|
||||
kmem_cache_create
|
||||
pick_next_task_rt
|
||||
@ -1561,12 +1612,12 @@ mutex_lock
|
||||
If I am only interested in sys_nanosleep and hrtimer_interrupt:
|
||||
|
||||
# echo sys_nanosleep hrtimer_interrupt \
|
||||
> /debug/tracing/set_ftrace_filter
|
||||
# echo ftrace > /debug/tracing/current_tracer
|
||||
# echo 1 > /debug/tracing/tracing_enabled
|
||||
> set_ftrace_filter
|
||||
# echo ftrace > current_tracer
|
||||
# echo 1 > tracing_enabled
|
||||
# usleep 1
|
||||
# echo 0 > /debug/tracing/tracing_enabled
|
||||
# cat /debug/tracing/trace
|
||||
# echo 0 > tracing_enabled
|
||||
# cat trace
|
||||
# tracer: ftrace
|
||||
#
|
||||
# TASK-PID CPU# TIMESTAMP FUNCTION
|
||||
@ -1577,7 +1628,7 @@ If I am only interested in sys_nanosleep and hrtimer_interrupt:
|
||||
|
||||
To see which functions are being traced, you can cat the file:
|
||||
|
||||
# cat /debug/tracing/set_ftrace_filter
|
||||
# cat set_ftrace_filter
|
||||
hrtimer_interrupt
|
||||
sys_nanosleep
|
||||
|
||||
@ -1597,7 +1648,7 @@ Note: It is better to use quotes to enclose the wild cards,
|
||||
otherwise the shell may expand the parameters into names
|
||||
of files in the local directory.
|
||||
|
||||
# echo 'hrtimer_*' > /debug/tracing/set_ftrace_filter
|
||||
# echo 'hrtimer_*' > set_ftrace_filter
|
||||
|
||||
Produces:
|
||||
|
||||
@ -1618,7 +1669,7 @@ Produces:
|
||||
|
||||
Notice that we lost the sys_nanosleep.
|
||||
|
||||
# cat /debug/tracing/set_ftrace_filter
|
||||
# cat set_ftrace_filter
|
||||
hrtimer_run_queues
|
||||
hrtimer_run_pending
|
||||
hrtimer_init
|
||||
@ -1644,17 +1695,17 @@ To append to the filters, use '>>'
|
||||
To clear out a filter so that all functions will be recorded
|
||||
again:
|
||||
|
||||
# echo > /debug/tracing/set_ftrace_filter
|
||||
# cat /debug/tracing/set_ftrace_filter
|
||||
# echo > set_ftrace_filter
|
||||
# cat set_ftrace_filter
|
||||
#
|
||||
|
||||
Again, now we want to append.
|
||||
|
||||
# echo sys_nanosleep > /debug/tracing/set_ftrace_filter
|
||||
# cat /debug/tracing/set_ftrace_filter
|
||||
# echo sys_nanosleep > set_ftrace_filter
|
||||
# cat set_ftrace_filter
|
||||
sys_nanosleep
|
||||
# echo 'hrtimer_*' >> /debug/tracing/set_ftrace_filter
|
||||
# cat /debug/tracing/set_ftrace_filter
|
||||
# echo 'hrtimer_*' >> set_ftrace_filter
|
||||
# cat set_ftrace_filter
|
||||
hrtimer_run_queues
|
||||
hrtimer_run_pending
|
||||
hrtimer_init
|
||||
@ -1677,7 +1728,7 @@ hrtimer_init_sleeper
|
||||
The set_ftrace_notrace prevents those functions from being
|
||||
traced.
|
||||
|
||||
# echo '*preempt*' '*lock*' > /debug/tracing/set_ftrace_notrace
|
||||
# echo '*preempt*' '*lock*' > set_ftrace_notrace
|
||||
|
||||
Produces:
|
||||
|
||||
@ -1767,13 +1818,13 @@ the effect on the tracing is different. Every read from
|
||||
trace_pipe is consumed. This means that subsequent reads will be
|
||||
different. The trace is live.
|
||||
|
||||
# echo function > /debug/tracing/current_tracer
|
||||
# cat /debug/tracing/trace_pipe > /tmp/trace.out &
|
||||
# echo function > current_tracer
|
||||
# cat trace_pipe > /tmp/trace.out &
|
||||
[1] 4153
|
||||
# echo 1 > /debug/tracing/tracing_enabled
|
||||
# echo 1 > tracing_enabled
|
||||
# usleep 1
|
||||
# echo 0 > /debug/tracing/tracing_enabled
|
||||
# cat /debug/tracing/trace
|
||||
# echo 0 > tracing_enabled
|
||||
# cat trace
|
||||
# tracer: function
|
||||
#
|
||||
# TASK-PID CPU# TIMESTAMP FUNCTION
|
||||
@ -1809,7 +1860,7 @@ number listed is the number of entries that can be recorded per
|
||||
CPU. To know the full size, multiply the number of possible CPUS
|
||||
with the number of entries.
|
||||
|
||||
# cat /debug/tracing/buffer_size_kb
|
||||
# cat buffer_size_kb
|
||||
1408 (units kilobytes)
|
||||
|
||||
Note, to modify this, you must have tracing completely disabled.
|
||||
@ -1817,18 +1868,18 @@ To do that, echo "nop" into the current_tracer. If the
|
||||
current_tracer is not set to "nop", an EINVAL error will be
|
||||
returned.
|
||||
|
||||
# echo nop > /debug/tracing/current_tracer
|
||||
# echo 10000 > /debug/tracing/buffer_size_kb
|
||||
# cat /debug/tracing/buffer_size_kb
|
||||
# echo nop > current_tracer
|
||||
# echo 10000 > buffer_size_kb
|
||||
# cat buffer_size_kb
|
||||
10000 (units kilobytes)
|
||||
|
||||
The number of pages which will be allocated is limited to a
|
||||
percentage of available memory. Allocating too much will produce
|
||||
an error.
|
||||
|
||||
# echo 1000000000000 > /debug/tracing/buffer_size_kb
|
||||
# echo 1000000000000 > buffer_size_kb
|
||||
-bash: echo: write error: Cannot allocate memory
|
||||
# cat /debug/tracing/buffer_size_kb
|
||||
# cat buffer_size_kb
|
||||
85
|
||||
|
||||
-----------
|
||||
|
@ -32,41 +32,41 @@ is no way to automatically detect if you are losing events due to CPUs racing.
|
||||
Usage Quick Reference
|
||||
---------------------
|
||||
|
||||
$ mount -t debugfs debugfs /debug
|
||||
$ echo mmiotrace > /debug/tracing/current_tracer
|
||||
$ cat /debug/tracing/trace_pipe > mydump.txt &
|
||||
$ mount -t debugfs debugfs /sys/kernel/debug
|
||||
$ echo mmiotrace > /sys/kernel/debug/tracing/current_tracer
|
||||
$ cat /sys/kernel/debug/tracing/trace_pipe > mydump.txt &
|
||||
Start X or whatever.
|
||||
$ echo "X is up" > /debug/tracing/trace_marker
|
||||
$ echo nop > /debug/tracing/current_tracer
|
||||
$ echo "X is up" > /sys/kernel/debug/tracing/trace_marker
|
||||
$ echo nop > /sys/kernel/debug/tracing/current_tracer
|
||||
Check for lost events.
|
||||
|
||||
|
||||
Usage
|
||||
-----
|
||||
|
||||
Make sure debugfs is mounted to /debug. If not, (requires root privileges)
|
||||
$ mount -t debugfs debugfs /debug
|
||||
Make sure debugfs is mounted to /sys/kernel/debug. If not, (requires root privileges)
|
||||
$ mount -t debugfs debugfs /sys/kernel/debug
|
||||
|
||||
Check that the driver you are about to trace is not loaded.
|
||||
|
||||
Activate mmiotrace (requires root privileges):
|
||||
$ echo mmiotrace > /debug/tracing/current_tracer
|
||||
$ echo mmiotrace > /sys/kernel/debug/tracing/current_tracer
|
||||
|
||||
Start storing the trace:
|
||||
$ cat /debug/tracing/trace_pipe > mydump.txt &
|
||||
$ cat /sys/kernel/debug/tracing/trace_pipe > mydump.txt &
|
||||
The 'cat' process should stay running (sleeping) in the background.
|
||||
|
||||
Load the driver you want to trace and use it. Mmiotrace will only catch MMIO
|
||||
accesses to areas that are ioremapped while mmiotrace is active.
|
||||
|
||||
During tracing you can place comments (markers) into the trace by
|
||||
$ echo "X is up" > /debug/tracing/trace_marker
|
||||
$ echo "X is up" > /sys/kernel/debug/tracing/trace_marker
|
||||
This makes it easier to see which part of the (huge) trace corresponds to
|
||||
which action. It is recommended to place descriptive markers about what you
|
||||
do.
|
||||
|
||||
Shut down mmiotrace (requires root privileges):
|
||||
$ echo nop > /debug/tracing/current_tracer
|
||||
$ echo nop > /sys/kernel/debug/tracing/current_tracer
|
||||
The 'cat' process exits. If it does not, kill it by issuing 'fg' command and
|
||||
pressing ctrl+c.
|
||||
|
||||
@ -78,10 +78,10 @@ to view your kernel log and look for "mmiotrace has lost events" warning. If
|
||||
events were lost, the trace is incomplete. You should enlarge the buffers and
|
||||
try again. Buffers are enlarged by first seeing how large the current buffers
|
||||
are:
|
||||
$ cat /debug/tracing/buffer_size_kb
|
||||
$ cat /sys/kernel/debug/tracing/buffer_size_kb
|
||||
gives you a number. Approximately double this number and write it back, for
|
||||
instance:
|
||||
$ echo 128000 > /debug/tracing/buffer_size_kb
|
||||
$ echo 128000 > /sys/kernel/debug/tracing/buffer_size_kb
|
||||
Then start again from the top.
|
||||
|
||||
If you are doing a trace for a driver project, e.g. Nouveau, you should also
|
||||
|
@ -38,7 +38,7 @@ int __init sni_eisa_root_init(void)
|
||||
if (!r)
|
||||
return r;
|
||||
|
||||
eisa_root_dev.dev.driver_data = &eisa_bus_root;
|
||||
dev_set_drvdata(&eisa_root_dev.dev, &eisa_bus_root);
|
||||
|
||||
if (eisa_root_register(&eisa_bus_root)) {
|
||||
/* A real bridge may have been registered before
|
||||
|
@ -360,7 +360,7 @@ static struct platform_driver uml_net_driver = {
|
||||
|
||||
static void net_device_release(struct device *dev)
|
||||
{
|
||||
struct uml_net *device = dev->driver_data;
|
||||
struct uml_net *device = dev_get_drvdata(dev);
|
||||
struct net_device *netdev = device->dev;
|
||||
struct uml_net_private *lp = netdev_priv(netdev);
|
||||
|
||||
@ -440,7 +440,7 @@ static void eth_configure(int n, void *init, char *mac,
|
||||
device->pdev.id = n;
|
||||
device->pdev.name = DRIVER_NAME;
|
||||
device->pdev.dev.release = net_device_release;
|
||||
device->pdev.dev.driver_data = device;
|
||||
dev_set_drvdata(&device->pdev.dev, device);
|
||||
if (platform_device_register(&device->pdev))
|
||||
goto out_free_netdev;
|
||||
SET_NETDEV_DEV(dev,&device->pdev.dev);
|
||||
|
@ -778,7 +778,7 @@ static int ubd_open_dev(struct ubd *ubd_dev)
|
||||
|
||||
static void ubd_device_release(struct device *dev)
|
||||
{
|
||||
struct ubd *ubd_dev = dev->driver_data;
|
||||
struct ubd *ubd_dev = dev_get_drvdata(dev);
|
||||
|
||||
blk_cleanup_queue(ubd_dev->queue);
|
||||
*ubd_dev = ((struct ubd) DEFAULT_UBD);
|
||||
@ -807,7 +807,7 @@ static int ubd_disk_register(int major, u64 size, int unit,
|
||||
ubd_devs[unit].pdev.id = unit;
|
||||
ubd_devs[unit].pdev.name = DRIVER_NAME;
|
||||
ubd_devs[unit].pdev.dev.release = ubd_device_release;
|
||||
ubd_devs[unit].pdev.dev.driver_data = &ubd_devs[unit];
|
||||
dev_set_drvdata(&ubd_devs[unit].pdev.dev, &ubd_devs[unit]);
|
||||
platform_device_register(&ubd_devs[unit].pdev);
|
||||
disk->driverfs_dev = &ubd_devs[unit].pdev.dev;
|
||||
}
|
||||
|
@ -182,6 +182,11 @@ static struct notifier_block __refdata cpuid_class_cpu_notifier =
|
||||
.notifier_call = cpuid_class_cpu_callback,
|
||||
};
|
||||
|
||||
static char *cpuid_nodename(struct device *dev)
|
||||
{
|
||||
return kasprintf(GFP_KERNEL, "cpu/%u/cpuid", MINOR(dev->devt));
|
||||
}
|
||||
|
||||
static int __init cpuid_init(void)
|
||||
{
|
||||
int i, err = 0;
|
||||
@ -198,6 +203,7 @@ static int __init cpuid_init(void)
|
||||
err = PTR_ERR(cpuid_class);
|
||||
goto out_chrdev;
|
||||
}
|
||||
cpuid_class->nodename = cpuid_nodename;
|
||||
for_each_online_cpu(i) {
|
||||
err = cpuid_device_create(i);
|
||||
if (err != 0)
|
||||
|
@ -236,6 +236,7 @@ static const struct file_operations microcode_fops = {
|
||||
static struct miscdevice microcode_dev = {
|
||||
.minor = MICROCODE_MINOR,
|
||||
.name = "microcode",
|
||||
.devnode = "cpu/microcode",
|
||||
.fops = µcode_fops,
|
||||
};
|
||||
|
||||
|
@ -196,6 +196,11 @@ static struct notifier_block __refdata msr_class_cpu_notifier = {
|
||||
.notifier_call = msr_class_cpu_callback,
|
||||
};
|
||||
|
||||
static char *msr_nodename(struct device *dev)
|
||||
{
|
||||
return kasprintf(GFP_KERNEL, "cpu/%u/msr", MINOR(dev->devt));
|
||||
}
|
||||
|
||||
static int __init msr_init(void)
|
||||
{
|
||||
int i, err = 0;
|
||||
@ -212,6 +217,7 @@ static int __init msr_init(void)
|
||||
err = PTR_ERR(msr_class);
|
||||
goto out_chrdev;
|
||||
}
|
||||
msr_class->nodename = msr_nodename;
|
||||
for_each_online_cpu(i) {
|
||||
err = msr_device_create(i);
|
||||
if (err != 0)
|
||||
|
@ -1065,6 +1065,11 @@ EXPORT_SYMBOL_GPL(bsg_register_queue);
|
||||
|
||||
static struct cdev bsg_cdev;
|
||||
|
||||
static char *bsg_nodename(struct device *dev)
|
||||
{
|
||||
return kasprintf(GFP_KERNEL, "bsg/%s", dev_name(dev));
|
||||
}
|
||||
|
||||
static int __init bsg_init(void)
|
||||
{
|
||||
int ret, i;
|
||||
@ -1085,6 +1090,7 @@ static int __init bsg_init(void)
|
||||
ret = PTR_ERR(bsg_class);
|
||||
goto destroy_kmemcache;
|
||||
}
|
||||
bsg_class->nodename = bsg_nodename;
|
||||
|
||||
ret = alloc_chrdev_region(&devid, 0, BSG_MAX_DEVS, "bsg");
|
||||
if (ret)
|
||||
|
@ -996,10 +996,20 @@ struct class block_class = {
|
||||
.name = "block",
|
||||
};
|
||||
|
||||
static char *block_nodename(struct device *dev)
|
||||
{
|
||||
struct gendisk *disk = dev_to_disk(dev);
|
||||
|
||||
if (disk->nodename)
|
||||
return disk->nodename(disk);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static struct device_type disk_type = {
|
||||
.name = "disk",
|
||||
.groups = disk_attr_groups,
|
||||
.release = disk_release,
|
||||
.nodename = block_nodename,
|
||||
};
|
||||
|
||||
#ifdef CONFIG_PROC_FS
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include <linux/kallsyms.h>
|
||||
#include <linux/semaphore.h>
|
||||
#include <linux/mutex.h>
|
||||
#include <linux/async.h>
|
||||
|
||||
#include "base.h"
|
||||
#include "power/power.h"
|
||||
@ -161,10 +162,18 @@ static int dev_uevent(struct kset *kset, struct kobject *kobj,
|
||||
struct device *dev = to_dev(kobj);
|
||||
int retval = 0;
|
||||
|
||||
/* add the major/minor if present */
|
||||
/* add device node properties if present */
|
||||
if (MAJOR(dev->devt)) {
|
||||
const char *tmp;
|
||||
const char *name;
|
||||
|
||||
add_uevent_var(env, "MAJOR=%u", MAJOR(dev->devt));
|
||||
add_uevent_var(env, "MINOR=%u", MINOR(dev->devt));
|
||||
name = device_get_nodename(dev, &tmp);
|
||||
if (name) {
|
||||
add_uevent_var(env, "DEVNAME=%s", name);
|
||||
kfree(tmp);
|
||||
}
|
||||
}
|
||||
|
||||
if (dev->type && dev->type->name)
|
||||
@ -874,7 +883,7 @@ int device_add(struct device *dev)
|
||||
* the name, and force the use of dev_name()
|
||||
*/
|
||||
if (dev->init_name) {
|
||||
dev_set_name(dev, dev->init_name);
|
||||
dev_set_name(dev, "%s", dev->init_name);
|
||||
dev->init_name = NULL;
|
||||
}
|
||||
|
||||
@ -1127,6 +1136,47 @@ static struct device *next_device(struct klist_iter *i)
|
||||
return dev;
|
||||
}
|
||||
|
||||
/**
|
||||
* device_get_nodename - path of device node file
|
||||
* @dev: device
|
||||
* @tmp: possibly allocated string
|
||||
*
|
||||
* Return the relative path of a possible device node.
|
||||
* Non-default names may need to allocate a memory to compose
|
||||
* a name. This memory is returned in tmp and needs to be
|
||||
* freed by the caller.
|
||||
*/
|
||||
const char *device_get_nodename(struct device *dev, const char **tmp)
|
||||
{
|
||||
char *s;
|
||||
|
||||
*tmp = NULL;
|
||||
|
||||
/* the device type may provide a specific name */
|
||||
if (dev->type && dev->type->nodename)
|
||||
*tmp = dev->type->nodename(dev);
|
||||
if (*tmp)
|
||||
return *tmp;
|
||||
|
||||
/* the class may provide a specific name */
|
||||
if (dev->class && dev->class->nodename)
|
||||
*tmp = dev->class->nodename(dev);
|
||||
if (*tmp)
|
||||
return *tmp;
|
||||
|
||||
/* return name without allocation, tmp == NULL */
|
||||
if (strchr(dev_name(dev), '!') == NULL)
|
||||
return dev_name(dev);
|
||||
|
||||
/* replace '!' in the name with '/' */
|
||||
*tmp = kstrdup(dev_name(dev), GFP_KERNEL);
|
||||
if (!*tmp)
|
||||
return NULL;
|
||||
while ((s = strchr(*tmp, '!')))
|
||||
s[0] = '/';
|
||||
return *tmp;
|
||||
}
|
||||
|
||||
/**
|
||||
* device_for_each_child - device child iterator.
|
||||
* @parent: parent struct device.
|
||||
@ -1271,7 +1321,7 @@ struct device *__root_device_register(const char *name, struct module *owner)
|
||||
if (!root)
|
||||
return ERR_PTR(err);
|
||||
|
||||
err = dev_set_name(&root->dev, name);
|
||||
err = dev_set_name(&root->dev, "%s", name);
|
||||
if (err) {
|
||||
kfree(root);
|
||||
return ERR_PTR(err);
|
||||
@ -1665,4 +1715,5 @@ void device_shutdown(void)
|
||||
kobject_put(sysfs_dev_char_kobj);
|
||||
kobject_put(sysfs_dev_block_kobj);
|
||||
kobject_put(dev_kobj);
|
||||
async_synchronize_full();
|
||||
}
|
||||
|
@ -226,7 +226,7 @@ static int __device_attach(struct device_driver *drv, void *data)
|
||||
* pair is found, break out and return.
|
||||
*
|
||||
* Returns 1 if the device was bound to a driver;
|
||||
* 0 if no matching device was found;
|
||||
* 0 if no matching driver was found;
|
||||
* -ENODEV if the device is not registered.
|
||||
*
|
||||
* When called for a USB interface, @dev->parent->sem must be held.
|
||||
@ -320,6 +320,10 @@ static void __device_release_driver(struct device *dev)
|
||||
devres_release_all(dev);
|
||||
dev->driver = NULL;
|
||||
klist_remove(&dev->p->knode_driver);
|
||||
if (dev->bus)
|
||||
blocking_notifier_call_chain(&dev->bus->p->bus_notifier,
|
||||
BUS_NOTIFY_UNBOUND_DRIVER,
|
||||
dev);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -40,7 +40,7 @@ static int loading_timeout = 60; /* In seconds */
|
||||
static DEFINE_MUTEX(fw_lock);
|
||||
|
||||
struct firmware_priv {
|
||||
char fw_id[FIRMWARE_NAME_MAX];
|
||||
char *fw_id;
|
||||
struct completion completion;
|
||||
struct bin_attribute attr_data;
|
||||
struct firmware *fw;
|
||||
@ -355,8 +355,9 @@ static void fw_dev_release(struct device *dev)
|
||||
for (i = 0; i < fw_priv->nr_pages; i++)
|
||||
__free_page(fw_priv->pages[i]);
|
||||
kfree(fw_priv->pages);
|
||||
kfree(fw_priv->fw_id);
|
||||
kfree(fw_priv);
|
||||
kfree(dev);
|
||||
put_device(dev);
|
||||
|
||||
module_put(THIS_MODULE);
|
||||
}
|
||||
@ -386,13 +387,19 @@ static int fw_register_device(struct device **dev_p, const char *fw_name,
|
||||
|
||||
init_completion(&fw_priv->completion);
|
||||
fw_priv->attr_data = firmware_attr_data_tmpl;
|
||||
strlcpy(fw_priv->fw_id, fw_name, FIRMWARE_NAME_MAX);
|
||||
fw_priv->fw_id = kstrdup(fw_name, GFP_KERNEL);
|
||||
if (!fw_priv->fw_id) {
|
||||
dev_err(device, "%s: Firmware name allocation failed\n",
|
||||
__func__);
|
||||
retval = -ENOMEM;
|
||||
goto error_kfree;
|
||||
}
|
||||
|
||||
fw_priv->timeout.function = firmware_class_timeout;
|
||||
fw_priv->timeout.data = (u_long) fw_priv;
|
||||
init_timer(&fw_priv->timeout);
|
||||
|
||||
dev_set_name(f_dev, dev_name(device));
|
||||
dev_set_name(f_dev, "%s", dev_name(device));
|
||||
f_dev->parent = device;
|
||||
f_dev->class = &firmware_class;
|
||||
dev_set_drvdata(f_dev, fw_priv);
|
||||
@ -400,14 +407,17 @@ static int fw_register_device(struct device **dev_p, const char *fw_name,
|
||||
retval = device_register(f_dev);
|
||||
if (retval) {
|
||||
dev_err(device, "%s: device_register failed\n", __func__);
|
||||
goto error_kfree;
|
||||
put_device(f_dev);
|
||||
goto error_kfree_fw_id;
|
||||
}
|
||||
*dev_p = f_dev;
|
||||
return 0;
|
||||
|
||||
error_kfree_fw_id:
|
||||
kfree(fw_priv->fw_id);
|
||||
error_kfree:
|
||||
kfree(fw_priv);
|
||||
kfree(f_dev);
|
||||
kfree(fw_priv);
|
||||
return retval;
|
||||
}
|
||||
|
||||
@ -615,8 +625,9 @@ request_firmware_work_func(void *arg)
|
||||
* @cont: function will be called asynchronously when the firmware
|
||||
* request is over.
|
||||
*
|
||||
* Asynchronous variant of request_firmware() for contexts where
|
||||
* it is not possible to sleep.
|
||||
* Asynchronous variant of request_firmware() for user contexts where
|
||||
* it is not possible to sleep for long time. It can't be called
|
||||
* in atomic contexts.
|
||||
**/
|
||||
int
|
||||
request_firmware_nowait(
|
||||
|
@ -69,7 +69,8 @@ EXPORT_SYMBOL_GPL(platform_get_irq);
|
||||
* @name: resource name
|
||||
*/
|
||||
struct resource *platform_get_resource_byname(struct platform_device *dev,
|
||||
unsigned int type, char *name)
|
||||
unsigned int type,
|
||||
const char *name)
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -88,7 +89,7 @@ EXPORT_SYMBOL_GPL(platform_get_resource_byname);
|
||||
* @dev: platform device
|
||||
* @name: IRQ name
|
||||
*/
|
||||
int platform_get_irq_byname(struct platform_device *dev, char *name)
|
||||
int platform_get_irq_byname(struct platform_device *dev, const char *name)
|
||||
{
|
||||
struct resource *r = platform_get_resource_byname(dev, IORESOURCE_IRQ,
|
||||
name);
|
||||
@ -244,7 +245,7 @@ int platform_device_add(struct platform_device *pdev)
|
||||
if (pdev->id != -1)
|
||||
dev_set_name(&pdev->dev, "%s.%d", pdev->name, pdev->id);
|
||||
else
|
||||
dev_set_name(&pdev->dev, pdev->name);
|
||||
dev_set_name(&pdev->dev, "%s", pdev->name);
|
||||
|
||||
for (i = 0; i < pdev->num_resources; i++) {
|
||||
struct resource *p, *r = &pdev->resource[i];
|
||||
|
@ -131,6 +131,8 @@ static struct kset *system_kset;
|
||||
|
||||
int sysdev_class_register(struct sysdev_class *cls)
|
||||
{
|
||||
int retval;
|
||||
|
||||
pr_debug("Registering sysdev class '%s'\n", cls->name);
|
||||
|
||||
INIT_LIST_HEAD(&cls->drivers);
|
||||
@ -138,7 +140,11 @@ int sysdev_class_register(struct sysdev_class *cls)
|
||||
cls->kset.kobj.parent = &system_kset->kobj;
|
||||
cls->kset.kobj.ktype = &ktype_sysdev_class;
|
||||
cls->kset.kobj.kset = system_kset;
|
||||
kobject_set_name(&cls->kset.kobj, cls->name);
|
||||
|
||||
retval = kobject_set_name(&cls->kset.kobj, "%s", cls->name);
|
||||
if (retval)
|
||||
return retval;
|
||||
|
||||
return kset_register(&cls->kset);
|
||||
}
|
||||
|
||||
|
@ -266,6 +266,11 @@ static const struct file_operations aoe_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
};
|
||||
|
||||
static char *aoe_nodename(struct device *dev)
|
||||
{
|
||||
return kasprintf(GFP_KERNEL, "etherd/%s", dev_name(dev));
|
||||
}
|
||||
|
||||
int __init
|
||||
aoechr_init(void)
|
||||
{
|
||||
@ -283,6 +288,8 @@ aoechr_init(void)
|
||||
unregister_chrdev(AOE_MAJOR, "aoechr");
|
||||
return PTR_ERR(aoe_class);
|
||||
}
|
||||
aoe_class->nodename = aoe_nodename;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(chardevs); ++i)
|
||||
device_create(aoe_class, NULL,
|
||||
MKDEV(AOE_MAJOR, chardevs[i].minor), NULL,
|
||||
|
@ -430,7 +430,7 @@ static void pkt_sysfs_cleanup(void)
|
||||
/********************************************************************
|
||||
entries in debugfs
|
||||
|
||||
/debugfs/pktcdvd[0-7]/
|
||||
/sys/kernel/debug/pktcdvd[0-7]/
|
||||
info
|
||||
|
||||
*******************************************************************/
|
||||
@ -2855,6 +2855,11 @@ static struct block_device_operations pktcdvd_ops = {
|
||||
.media_changed = pkt_media_changed,
|
||||
};
|
||||
|
||||
static char *pktcdvd_nodename(struct gendisk *gd)
|
||||
{
|
||||
return kasprintf(GFP_KERNEL, "pktcdvd/%s", gd->disk_name);
|
||||
}
|
||||
|
||||
/*
|
||||
* Set up mapping from pktcdvd device to CD-ROM device.
|
||||
*/
|
||||
@ -2907,6 +2912,7 @@ static int pkt_setup_dev(dev_t dev, dev_t* pkt_dev)
|
||||
disk->fops = &pktcdvd_ops;
|
||||
disk->flags = GENHD_FL_REMOVABLE;
|
||||
strcpy(disk->disk_name, pd->name);
|
||||
disk->nodename = pktcdvd_nodename;
|
||||
disk->private_data = pd;
|
||||
disk->queue = blk_alloc_queue(GFP_KERNEL);
|
||||
if (!disk->queue)
|
||||
@ -3062,6 +3068,7 @@ static const struct file_operations pkt_ctl_fops = {
|
||||
static struct miscdevice pkt_misc = {
|
||||
.minor = MISC_DYNAMIC_MINOR,
|
||||
.name = DRIVER_NAME,
|
||||
.name = "pktcdvd/control",
|
||||
.fops = &pkt_ctl_fops
|
||||
};
|
||||
|
||||
|
@ -753,12 +753,12 @@ static int blkfront_probe(struct xenbus_device *dev,
|
||||
|
||||
/* Front end dir is a number, which is used as the id. */
|
||||
info->handle = simple_strtoul(strrchr(dev->nodename, '/')+1, NULL, 0);
|
||||
dev->dev.driver_data = info;
|
||||
dev_set_drvdata(&dev->dev, info);
|
||||
|
||||
err = talk_to_backend(dev, info);
|
||||
if (err) {
|
||||
kfree(info);
|
||||
dev->dev.driver_data = NULL;
|
||||
dev_set_drvdata(&dev->dev, NULL);
|
||||
return err;
|
||||
}
|
||||
|
||||
@ -843,7 +843,7 @@ static int blkif_recover(struct blkfront_info *info)
|
||||
*/
|
||||
static int blkfront_resume(struct xenbus_device *dev)
|
||||
{
|
||||
struct blkfront_info *info = dev->dev.driver_data;
|
||||
struct blkfront_info *info = dev_get_drvdata(&dev->dev);
|
||||
int err;
|
||||
|
||||
dev_dbg(&dev->dev, "blkfront_resume: %s\n", dev->nodename);
|
||||
@ -922,7 +922,7 @@ static void blkfront_connect(struct blkfront_info *info)
|
||||
*/
|
||||
static void blkfront_closing(struct xenbus_device *dev)
|
||||
{
|
||||
struct blkfront_info *info = dev->dev.driver_data;
|
||||
struct blkfront_info *info = dev_get_drvdata(&dev->dev);
|
||||
unsigned long flags;
|
||||
|
||||
dev_dbg(&dev->dev, "blkfront_closing: %s removed\n", dev->nodename);
|
||||
@ -957,7 +957,7 @@ static void blkfront_closing(struct xenbus_device *dev)
|
||||
static void backend_changed(struct xenbus_device *dev,
|
||||
enum xenbus_state backend_state)
|
||||
{
|
||||
struct blkfront_info *info = dev->dev.driver_data;
|
||||
struct blkfront_info *info = dev_get_drvdata(&dev->dev);
|
||||
struct block_device *bd;
|
||||
|
||||
dev_dbg(&dev->dev, "blkfront:backend_changed.\n");
|
||||
@ -997,7 +997,7 @@ static void backend_changed(struct xenbus_device *dev,
|
||||
|
||||
static int blkfront_remove(struct xenbus_device *dev)
|
||||
{
|
||||
struct blkfront_info *info = dev->dev.driver_data;
|
||||
struct blkfront_info *info = dev_get_drvdata(&dev->dev);
|
||||
|
||||
dev_dbg(&dev->dev, "blkfront_remove: %s removed\n", dev->nodename);
|
||||
|
||||
@ -1010,7 +1010,7 @@ static int blkfront_remove(struct xenbus_device *dev)
|
||||
|
||||
static int blkfront_is_ready(struct xenbus_device *dev)
|
||||
{
|
||||
struct blkfront_info *info = dev->dev.driver_data;
|
||||
struct blkfront_info *info = dev_get_drvdata(&dev->dev);
|
||||
|
||||
return info->is_ready;
|
||||
}
|
||||
|
@ -347,7 +347,7 @@ static void __exit hvcs_module_exit(void);
|
||||
|
||||
static inline struct hvcs_struct *from_vio_dev(struct vio_dev *viod)
|
||||
{
|
||||
return viod->dev.driver_data;
|
||||
return dev_get_drvdata(&viod->dev);
|
||||
}
|
||||
/* The sysfs interface for the driver and devices */
|
||||
|
||||
@ -785,7 +785,7 @@ static int __devinit hvcs_probe(
|
||||
kref_init(&hvcsd->kref);
|
||||
|
||||
hvcsd->vdev = dev;
|
||||
dev->dev.driver_data = hvcsd;
|
||||
dev_set_drvdata(&dev->dev, hvcsd);
|
||||
|
||||
hvcsd->index = index;
|
||||
|
||||
@ -831,7 +831,7 @@ static int __devinit hvcs_probe(
|
||||
|
||||
static int __devexit hvcs_remove(struct vio_dev *dev)
|
||||
{
|
||||
struct hvcs_struct *hvcsd = dev->dev.driver_data;
|
||||
struct hvcs_struct *hvcsd = dev_get_drvdata(&dev->dev);
|
||||
unsigned long flags;
|
||||
struct tty_struct *tty;
|
||||
|
||||
|
@ -153,6 +153,7 @@ static const struct file_operations rng_chrdev_ops = {
|
||||
static struct miscdevice rng_miscdev = {
|
||||
.minor = RNG_MISCDEV_MINOR,
|
||||
.name = RNG_MODULE_NAME,
|
||||
.devnode = "hwrng",
|
||||
.fops = &rng_chrdev_ops,
|
||||
};
|
||||
|
||||
|
@ -2375,14 +2375,14 @@ static int __devinit ipmi_of_probe(struct of_device *dev,
|
||||
info->io.addr_data, info->io.regsize, info->io.regspacing,
|
||||
info->irq);
|
||||
|
||||
dev->dev.driver_data = (void *) info;
|
||||
dev_set_drvdata(&dev->dev, info);
|
||||
|
||||
return try_smi_init(info);
|
||||
}
|
||||
|
||||
static int __devexit ipmi_of_remove(struct of_device *dev)
|
||||
{
|
||||
cleanup_one_si(dev->dev.driver_data);
|
||||
cleanup_one_si(dev_get_drvdata(&dev->dev));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -168,7 +168,6 @@ static const struct file_operations misc_fops = {
|
||||
.open = misc_open,
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* misc_register - register a miscellaneous device
|
||||
* @misc: device structure
|
||||
@ -217,8 +216,8 @@ int misc_register(struct miscdevice * misc)
|
||||
misc_minors[misc->minor >> 3] |= 1 << (misc->minor & 7);
|
||||
dev = MKDEV(MISC_MAJOR, misc->minor);
|
||||
|
||||
misc->this_device = device_create(misc_class, misc->parent, dev, NULL,
|
||||
"%s", misc->name);
|
||||
misc->this_device = device_create(misc_class, misc->parent, dev,
|
||||
misc, "%s", misc->name);
|
||||
if (IS_ERR(misc->this_device)) {
|
||||
err = PTR_ERR(misc->this_device);
|
||||
goto out;
|
||||
@ -264,6 +263,15 @@ int misc_deregister(struct miscdevice *misc)
|
||||
EXPORT_SYMBOL(misc_register);
|
||||
EXPORT_SYMBOL(misc_deregister);
|
||||
|
||||
static char *misc_nodename(struct device *dev)
|
||||
{
|
||||
struct miscdevice *c = dev_get_drvdata(dev);
|
||||
|
||||
if (c->devnode)
|
||||
return kstrdup(c->devnode, GFP_KERNEL);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static int __init misc_init(void)
|
||||
{
|
||||
int err;
|
||||
@ -279,6 +287,7 @@ static int __init misc_init(void)
|
||||
err = -EIO;
|
||||
if (register_chrdev(MISC_MAJOR,"misc",&misc_fops))
|
||||
goto fail_printk;
|
||||
misc_class->nodename = misc_nodename;
|
||||
return 0;
|
||||
|
||||
fail_printk:
|
||||
|
@ -261,6 +261,11 @@ static const struct file_operations raw_ctl_fops = {
|
||||
|
||||
static struct cdev raw_cdev;
|
||||
|
||||
static char *raw_nodename(struct device *dev)
|
||||
{
|
||||
return kasprintf(GFP_KERNEL, "raw/%s", dev_name(dev));
|
||||
}
|
||||
|
||||
static int __init raw_init(void)
|
||||
{
|
||||
dev_t dev = MKDEV(RAW_MAJOR, 0);
|
||||
@ -284,6 +289,7 @@ static int __init raw_init(void)
|
||||
ret = PTR_ERR(raw_class);
|
||||
goto error_region;
|
||||
}
|
||||
raw_class->nodename = raw_nodename;
|
||||
device_create(raw_class, NULL, MKDEV(RAW_MAJOR, 0), NULL, "rawctl");
|
||||
|
||||
return 0;
|
||||
|
@ -31,11 +31,11 @@ static int __init pci_eisa_init(struct pci_dev *pdev,
|
||||
}
|
||||
|
||||
pci_eisa_root.dev = &pdev->dev;
|
||||
pci_eisa_root.dev->driver_data = &pci_eisa_root;
|
||||
pci_eisa_root.res = pdev->bus->resource[0];
|
||||
pci_eisa_root.bus_base_addr = pdev->bus->resource[0]->start;
|
||||
pci_eisa_root.slots = EISA_MAX_SLOTS;
|
||||
pci_eisa_root.dma_mask = pdev->dma_mask;
|
||||
dev_set_drvdata(pci_eisa_root.dev, &pci_eisa_root);
|
||||
|
||||
if (eisa_root_register (&pci_eisa_root)) {
|
||||
printk (KERN_ERR "pci_eisa : Could not register EISA root\n");
|
||||
|
@ -57,7 +57,7 @@ static int __init virtual_eisa_root_init (void)
|
||||
|
||||
eisa_bus_root.force_probe = force_probe;
|
||||
|
||||
eisa_root_dev.dev.driver_data = &eisa_bus_root;
|
||||
dev_set_drvdata(&eisa_root_dev.dev, &eisa_bus_root);
|
||||
|
||||
if (eisa_root_register (&eisa_bus_root)) {
|
||||
/* A real bridge may have been registered before
|
||||
|
@ -1125,7 +1125,7 @@ static int sbp2_probe(struct device *dev)
|
||||
return -ENOMEM;
|
||||
|
||||
tgt = (struct sbp2_target *)shost->hostdata;
|
||||
unit->device.driver_data = tgt;
|
||||
dev_set_drvdata(&unit->device, tgt);
|
||||
tgt->unit = unit;
|
||||
kref_init(&tgt->kref);
|
||||
INIT_LIST_HEAD(&tgt->lu_list);
|
||||
@ -1180,7 +1180,7 @@ static int sbp2_probe(struct device *dev)
|
||||
static int sbp2_remove(struct device *dev)
|
||||
{
|
||||
struct fw_unit *unit = fw_unit(dev);
|
||||
struct sbp2_target *tgt = unit->device.driver_data;
|
||||
struct sbp2_target *tgt = dev_get_drvdata(&unit->device);
|
||||
|
||||
sbp2_target_put(tgt);
|
||||
return 0;
|
||||
@ -1240,7 +1240,7 @@ static void sbp2_reconnect(struct work_struct *work)
|
||||
|
||||
static void sbp2_update(struct fw_unit *unit)
|
||||
{
|
||||
struct sbp2_target *tgt = unit->device.driver_data;
|
||||
struct sbp2_target *tgt = dev_get_drvdata(&unit->device);
|
||||
struct sbp2_logical_unit *lu;
|
||||
|
||||
fw_device_enable_phys_dma(fw_device(unit->device.parent));
|
||||
|
@ -105,7 +105,7 @@ int drm_debugfs_create_files(struct drm_info_list *files, int count,
|
||||
ent = debugfs_create_file(files[i].name, S_IFREG | S_IRUGO,
|
||||
root, tmp, &drm_debugfs_fops);
|
||||
if (!ent) {
|
||||
DRM_ERROR("Cannot create /debugfs/dri/%s/%s\n",
|
||||
DRM_ERROR("Cannot create /sys/kernel/debug/dri/%s/%s\n",
|
||||
name, files[i].name);
|
||||
drm_free(tmp, sizeof(struct drm_info_node),
|
||||
_DRM_DRIVER);
|
||||
@ -133,9 +133,9 @@ EXPORT_SYMBOL(drm_debugfs_create_files);
|
||||
* \param minor device minor number
|
||||
* \param root DRI debugfs dir entry.
|
||||
*
|
||||
* Create the DRI debugfs root entry "/debugfs/dri", the device debugfs root entry
|
||||
* "/debugfs/dri/%minor%/", and each entry in debugfs_list as
|
||||
* "/debugfs/dri/%minor%/%name%".
|
||||
* Create the DRI debugfs root entry "/sys/kernel/debug/dri", the device debugfs root entry
|
||||
* "/sys/kernel/debug/dri/%minor%/", and each entry in debugfs_list as
|
||||
* "/sys/kernel/debug/dri/%minor%/%name%".
|
||||
*/
|
||||
int drm_debugfs_init(struct drm_minor *minor, int minor_id,
|
||||
struct dentry *root)
|
||||
@ -148,7 +148,7 @@ int drm_debugfs_init(struct drm_minor *minor, int minor_id,
|
||||
sprintf(name, "%d", minor_id);
|
||||
minor->debugfs_root = debugfs_create_dir(name, root);
|
||||
if (!minor->debugfs_root) {
|
||||
DRM_ERROR("Cannot create /debugfs/dri/%s\n", name);
|
||||
DRM_ERROR("Cannot create /sys/kernel/debug/dri/%s\n", name);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -165,7 +165,7 @@ int drm_debugfs_init(struct drm_minor *minor, int minor_id,
|
||||
ret = dev->driver->debugfs_init(minor);
|
||||
if (ret) {
|
||||
DRM_ERROR("DRM: Driver failed to initialize "
|
||||
"/debugfs/dri.\n");
|
||||
"/sys/kernel/debug/dri.\n");
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
@ -339,7 +339,7 @@ static int __init drm_core_init(void)
|
||||
|
||||
drm_debugfs_root = debugfs_create_dir("dri", NULL);
|
||||
if (!drm_debugfs_root) {
|
||||
DRM_ERROR("Cannot create /debugfs/dri\n");
|
||||
DRM_ERROR("Cannot create /sys/kernel/debug/dri\n");
|
||||
ret = -1;
|
||||
goto err_p3;
|
||||
}
|
||||
|
@ -343,7 +343,7 @@ static int drm_get_minor(struct drm_device *dev, struct drm_minor **minor, int t
|
||||
#if defined(CONFIG_DEBUG_FS)
|
||||
ret = drm_debugfs_init(new_minor, minor_id, drm_debugfs_root);
|
||||
if (ret) {
|
||||
DRM_ERROR("DRM: Failed to initialize /debugfs/dri.\n");
|
||||
DRM_ERROR("DRM: Failed to initialize /sys/kernel/debug/dri.\n");
|
||||
goto err_g2;
|
||||
}
|
||||
#endif
|
||||
|
@ -70,6 +70,11 @@ static ssize_t version_show(struct class *dev, char *buf)
|
||||
CORE_MINOR, CORE_PATCHLEVEL, CORE_DATE);
|
||||
}
|
||||
|
||||
static char *drm_nodename(struct device *dev)
|
||||
{
|
||||
return kasprintf(GFP_KERNEL, "dri/%s", dev_name(dev));
|
||||
}
|
||||
|
||||
static CLASS_ATTR(version, S_IRUGO, version_show, NULL);
|
||||
|
||||
/**
|
||||
@ -101,6 +106,8 @@ struct class *drm_sysfs_create(struct module *owner, char *name)
|
||||
if (err)
|
||||
goto err_out_class;
|
||||
|
||||
class->nodename = drm_nodename;
|
||||
|
||||
return class;
|
||||
|
||||
err_out_class:
|
||||
|
@ -850,8 +850,14 @@ static const struct file_operations hiddev_fops = {
|
||||
#endif
|
||||
};
|
||||
|
||||
static char *hiddev_nodename(struct device *dev)
|
||||
{
|
||||
return kasprintf(GFP_KERNEL, "usb/%s", dev_name(dev));
|
||||
}
|
||||
|
||||
static struct usb_class_driver hiddev_class = {
|
||||
.name = "hiddev%d",
|
||||
.nodename = hiddev_nodename,
|
||||
.fops = &hiddev_fops,
|
||||
.minor_base = HIDDEV_MINOR_BASE,
|
||||
};
|
||||
@ -955,7 +961,6 @@ static int hiddev_usbd_probe(struct usb_interface *intf,
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
|
||||
static /* const */ struct usb_driver hiddev_driver = {
|
||||
.name = "hiddev",
|
||||
.probe = hiddev_usbd_probe,
|
||||
|
@ -3,7 +3,8 @@
|
||||
|
||||
int generic_ide_suspend(struct device *dev, pm_message_t mesg)
|
||||
{
|
||||
ide_drive_t *drive = dev->driver_data, *pair = ide_get_pair_dev(drive);
|
||||
ide_drive_t *drive = dev_get_drvdata(dev);
|
||||
ide_drive_t *pair = ide_get_pair_dev(drive);
|
||||
ide_hwif_t *hwif = drive->hwif;
|
||||
struct request *rq;
|
||||
struct request_pm_state rqpm;
|
||||
@ -34,7 +35,8 @@ int generic_ide_suspend(struct device *dev, pm_message_t mesg)
|
||||
|
||||
int generic_ide_resume(struct device *dev)
|
||||
{
|
||||
ide_drive_t *drive = dev->driver_data, *pair = ide_get_pair_dev(drive);
|
||||
ide_drive_t *drive = dev_get_drvdata(dev);
|
||||
ide_drive_t *pair = ide_get_pair_dev(drive);
|
||||
ide_hwif_t *hwif = drive->hwif;
|
||||
struct request *rq;
|
||||
struct request_pm_state rqpm;
|
||||
|
@ -535,7 +535,7 @@ static int ide_register_port(ide_hwif_t *hwif)
|
||||
|
||||
/* register with global device tree */
|
||||
dev_set_name(&hwif->gendev, hwif->name);
|
||||
hwif->gendev.driver_data = hwif;
|
||||
dev_set_drvdata(&hwif->gendev, hwif);
|
||||
if (hwif->gendev.parent == NULL)
|
||||
hwif->gendev.parent = hwif->dev;
|
||||
hwif->gendev.release = hwif_release_dev;
|
||||
@ -987,9 +987,9 @@ static void hwif_register_devices(ide_hwif_t *hwif)
|
||||
int ret;
|
||||
|
||||
dev_set_name(dev, "%u.%u", hwif->index, i);
|
||||
dev_set_drvdata(dev, drive);
|
||||
dev->parent = &hwif->gendev;
|
||||
dev->bus = &ide_bus_type;
|
||||
dev->driver_data = drive;
|
||||
dev->release = drive_release_dev;
|
||||
|
||||
ret = device_register(dev);
|
||||
|
@ -112,7 +112,7 @@ out:
|
||||
|
||||
static int __devexit plat_ide_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct ide_host *host = pdev->dev.driver_data;
|
||||
struct ide_host *host = dev_get_drvdata(&pdev->dev);
|
||||
|
||||
ide_host_remove(host);
|
||||
|
||||
|
@ -361,7 +361,7 @@ static int eth1394_new_node(struct eth1394_host_info *hi,
|
||||
node_info->pdg.sz = 0;
|
||||
node_info->fifo = CSR1212_INVALID_ADDR_SPACE;
|
||||
|
||||
ud->device.driver_data = node_info;
|
||||
dev_set_drvdata(&ud->device, node_info);
|
||||
new_node->ud = ud;
|
||||
|
||||
priv = netdev_priv(hi->dev);
|
||||
@ -406,7 +406,7 @@ static int eth1394_remove(struct device *dev)
|
||||
list_del(&old_node->list);
|
||||
kfree(old_node);
|
||||
|
||||
node_info = (struct eth1394_node_info*)ud->device.driver_data;
|
||||
node_info = dev_get_drvdata(&ud->device);
|
||||
|
||||
spin_lock_irqsave(&node_info->pdg.lock, flags);
|
||||
/* The partial datagram list should be empty, but we'll just
|
||||
@ -416,7 +416,7 @@ static int eth1394_remove(struct device *dev)
|
||||
spin_unlock_irqrestore(&node_info->pdg.lock, flags);
|
||||
|
||||
kfree(node_info);
|
||||
ud->device.driver_data = NULL;
|
||||
dev_set_drvdata(&ud->device, NULL);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -688,7 +688,7 @@ static void ether1394_host_reset(struct hpsb_host *host)
|
||||
ether1394_reset_priv(dev, 0);
|
||||
|
||||
list_for_each_entry(node, &priv->ip_node_list, list) {
|
||||
node_info = node->ud->device.driver_data;
|
||||
node_info = dev_get_drvdata(&node->ud->device);
|
||||
|
||||
spin_lock_irqsave(&node_info->pdg.lock, flags);
|
||||
|
||||
@ -872,8 +872,7 @@ static __be16 ether1394_parse_encap(struct sk_buff *skb, struct net_device *dev,
|
||||
if (!node)
|
||||
return cpu_to_be16(0);
|
||||
|
||||
node_info =
|
||||
(struct eth1394_node_info *)node->ud->device.driver_data;
|
||||
node_info = dev_get_drvdata(&node->ud->device);
|
||||
|
||||
/* Update our speed/payload/fifo_offset table */
|
||||
node_info->maxpayload = maxpayload;
|
||||
@ -1080,7 +1079,7 @@ static int ether1394_data_handler(struct net_device *dev, int srcid, int destid,
|
||||
priv->ud_list[NODEID_TO_NODE(srcid)] = ud;
|
||||
}
|
||||
|
||||
node_info = (struct eth1394_node_info *)ud->device.driver_data;
|
||||
node_info = dev_get_drvdata(&ud->device);
|
||||
|
||||
/* First, did we receive a fragmented or unfragmented datagram? */
|
||||
hdr->words.word1 = ntohs(hdr->words.word1);
|
||||
@ -1617,8 +1616,7 @@ static int ether1394_tx(struct sk_buff *skb, struct net_device *dev)
|
||||
if (!node)
|
||||
goto fail;
|
||||
|
||||
node_info =
|
||||
(struct eth1394_node_info *)node->ud->device.driver_data;
|
||||
node_info = dev_get_drvdata(&node->ud->device);
|
||||
if (node_info->fifo == CSR1212_INVALID_ADDR_SPACE)
|
||||
goto fail;
|
||||
|
||||
|
@ -718,7 +718,7 @@ static int sbp2_remove(struct device *dev)
|
||||
struct scsi_device *sdev;
|
||||
|
||||
ud = container_of(dev, struct unit_directory, device);
|
||||
lu = ud->device.driver_data;
|
||||
lu = dev_get_drvdata(&ud->device);
|
||||
if (!lu)
|
||||
return 0;
|
||||
|
||||
@ -746,7 +746,7 @@ static int sbp2_remove(struct device *dev)
|
||||
|
||||
static int sbp2_update(struct unit_directory *ud)
|
||||
{
|
||||
struct sbp2_lu *lu = ud->device.driver_data;
|
||||
struct sbp2_lu *lu = dev_get_drvdata(&ud->device);
|
||||
|
||||
if (sbp2_reconnect_device(lu) != 0) {
|
||||
/*
|
||||
@ -815,7 +815,7 @@ static struct sbp2_lu *sbp2_alloc_device(struct unit_directory *ud)
|
||||
atomic_set(&lu->state, SBP2LU_STATE_RUNNING);
|
||||
INIT_WORK(&lu->protocol_work, NULL);
|
||||
|
||||
ud->device.driver_data = lu;
|
||||
dev_set_drvdata(&ud->device, lu);
|
||||
|
||||
hi = hpsb_get_hostinfo(&sbp2_highlevel, ud->ne->host);
|
||||
if (!hi) {
|
||||
@ -1051,7 +1051,7 @@ static void sbp2_remove_device(struct sbp2_lu *lu)
|
||||
hpsb_unregister_addrspace(&sbp2_highlevel, hi->host,
|
||||
lu->status_fifo_addr);
|
||||
|
||||
lu->ud->device.driver_data = NULL;
|
||||
dev_set_drvdata(&lu->ud->device, NULL);
|
||||
|
||||
module_put(hi->host->driver->owner);
|
||||
no_hi:
|
||||
|
@ -760,9 +760,9 @@ int ib_device_register_sysfs(struct ib_device *device)
|
||||
int i;
|
||||
|
||||
class_dev->class = &ib_class;
|
||||
class_dev->driver_data = device;
|
||||
class_dev->parent = device->dma_device;
|
||||
dev_set_name(class_dev, device->name);
|
||||
dev_set_drvdata(class_dev, device);
|
||||
|
||||
INIT_LIST_HEAD(&device->port_list);
|
||||
|
||||
|
@ -636,7 +636,7 @@ static ssize_t ehca_show_##name(struct device *dev, \
|
||||
struct hipz_query_hca *rblock; \
|
||||
int data; \
|
||||
\
|
||||
shca = dev->driver_data; \
|
||||
shca = dev_get_drvdata(dev); \
|
||||
\
|
||||
rblock = ehca_alloc_fw_ctrlblock(GFP_KERNEL); \
|
||||
if (!rblock) { \
|
||||
@ -680,7 +680,7 @@ static ssize_t ehca_show_adapter_handle(struct device *dev,
|
||||
struct device_attribute *attr,
|
||||
char *buf)
|
||||
{
|
||||
struct ehca_shca *shca = dev->driver_data;
|
||||
struct ehca_shca *shca = dev_get_drvdata(dev);
|
||||
|
||||
return sprintf(buf, "%llx\n", shca->ipz_hca_handle.handle);
|
||||
|
||||
@ -749,7 +749,7 @@ static int __devinit ehca_probe(struct of_device *dev,
|
||||
|
||||
shca->ofdev = dev;
|
||||
shca->ipz_hca_handle.handle = *handle;
|
||||
dev->dev.driver_data = shca;
|
||||
dev_set_drvdata(&dev->dev, shca);
|
||||
|
||||
ret = ehca_sense_attributes(shca);
|
||||
if (ret < 0) {
|
||||
@ -878,7 +878,7 @@ probe1:
|
||||
|
||||
static int __devexit ehca_remove(struct of_device *dev)
|
||||
{
|
||||
struct ehca_shca *shca = dev->dev.driver_data;
|
||||
struct ehca_shca *shca = dev_get_drvdata(&dev->dev);
|
||||
unsigned long flags;
|
||||
int ret;
|
||||
|
||||
|
@ -1265,8 +1265,14 @@ static struct device_type input_dev_type = {
|
||||
.uevent = input_dev_uevent,
|
||||
};
|
||||
|
||||
static char *input_nodename(struct device *dev)
|
||||
{
|
||||
return kasprintf(GFP_KERNEL, "input/%s", dev_name(dev));
|
||||
}
|
||||
|
||||
struct class input_class = {
|
||||
.name = "input",
|
||||
.nodename = input_nodename,
|
||||
};
|
||||
EXPORT_SYMBOL_GPL(input_class);
|
||||
|
||||
|
@ -569,7 +569,7 @@ static int wm97xx_probe(struct device *dev)
|
||||
mutex_init(&wm->codec_mutex);
|
||||
|
||||
wm->dev = dev;
|
||||
dev->driver_data = wm;
|
||||
dev_set_drvdata(dev, wm);
|
||||
wm->ac97 = to_ac97_t(dev);
|
||||
|
||||
/* check that we have a supported codec */
|
||||
|
@ -114,7 +114,7 @@ static int __devinit xenkbd_probe(struct xenbus_device *dev,
|
||||
xenbus_dev_fatal(dev, -ENOMEM, "allocating info structure");
|
||||
return -ENOMEM;
|
||||
}
|
||||
dev->dev.driver_data = info;
|
||||
dev_set_drvdata(&dev->dev, info);
|
||||
info->xbdev = dev;
|
||||
info->irq = -1;
|
||||
snprintf(info->phys, sizeof(info->phys), "xenbus/%s", dev->nodename);
|
||||
@ -186,7 +186,7 @@ static int __devinit xenkbd_probe(struct xenbus_device *dev,
|
||||
|
||||
static int xenkbd_resume(struct xenbus_device *dev)
|
||||
{
|
||||
struct xenkbd_info *info = dev->dev.driver_data;
|
||||
struct xenkbd_info *info = dev_get_drvdata(&dev->dev);
|
||||
|
||||
xenkbd_disconnect_backend(info);
|
||||
memset(info->page, 0, PAGE_SIZE);
|
||||
@ -195,7 +195,7 @@ static int xenkbd_resume(struct xenbus_device *dev)
|
||||
|
||||
static int xenkbd_remove(struct xenbus_device *dev)
|
||||
{
|
||||
struct xenkbd_info *info = dev->dev.driver_data;
|
||||
struct xenkbd_info *info = dev_get_drvdata(&dev->dev);
|
||||
|
||||
xenkbd_disconnect_backend(info);
|
||||
if (info->kbd)
|
||||
@ -266,7 +266,7 @@ static void xenkbd_disconnect_backend(struct xenkbd_info *info)
|
||||
static void xenkbd_backend_changed(struct xenbus_device *dev,
|
||||
enum xenbus_state backend_state)
|
||||
{
|
||||
struct xenkbd_info *info = dev->dev.driver_data;
|
||||
struct xenkbd_info *info = dev_get_drvdata(&dev->dev);
|
||||
int ret, val;
|
||||
|
||||
switch (backend_state) {
|
||||
|
@ -1513,6 +1513,7 @@ static const struct file_operations _ctl_fops = {
|
||||
static struct miscdevice _dm_misc = {
|
||||
.minor = MISC_DYNAMIC_MINOR,
|
||||
.name = DM_NAME,
|
||||
.devnode = "mapper/control",
|
||||
.fops = &_ctl_fops
|
||||
};
|
||||
|
||||
|
@ -48,7 +48,7 @@ MODULE_PARM_DESC(audio_std,
|
||||
"NICAM/A\n"
|
||||
"NICAM/B\n");
|
||||
|
||||
static char firmware_name[FIRMWARE_NAME_MAX];
|
||||
static char firmware_name[30];
|
||||
module_param_string(firmware_name, firmware_name, sizeof(firmware_name), 0);
|
||||
MODULE_PARM_DESC(firmware_name, "Firmware file name. Allows overriding the "
|
||||
"default firmware name\n");
|
||||
|
@ -447,6 +447,15 @@ static int dvb_uevent(struct device *dev, struct kobj_uevent_env *env)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static char *dvb_nodename(struct device *dev)
|
||||
{
|
||||
struct dvb_device *dvbdev = dev_get_drvdata(dev);
|
||||
|
||||
return kasprintf(GFP_KERNEL, "dvb/adapter%d/%s%d",
|
||||
dvbdev->adapter->num, dnames[dvbdev->type], dvbdev->id);
|
||||
}
|
||||
|
||||
|
||||
static int __init init_dvbdev(void)
|
||||
{
|
||||
int retval;
|
||||
@ -469,6 +478,7 @@ static int __init init_dvbdev(void)
|
||||
goto error;
|
||||
}
|
||||
dvb_class->dev_uevent = dvb_uevent;
|
||||
dvb_class->nodename = dvb_nodename;
|
||||
return 0;
|
||||
|
||||
error:
|
||||
|
@ -196,7 +196,7 @@ struct dvb_usb_device_properties {
|
||||
#define CYPRESS_FX2 3
|
||||
int usb_ctrl;
|
||||
int (*download_firmware) (struct usb_device *, const struct firmware *);
|
||||
const char firmware[FIRMWARE_NAME_MAX];
|
||||
const char *firmware;
|
||||
int no_reconnect;
|
||||
|
||||
int size_of_priv;
|
||||
|
@ -225,7 +225,7 @@ fail_free:
|
||||
|
||||
static int node_remove(struct device *dev)
|
||||
{
|
||||
struct firedtv *fdtv = dev->driver_data;
|
||||
struct firedtv *fdtv = dev_get_drvdata(dev);
|
||||
|
||||
fdtv_dvb_unregister(fdtv);
|
||||
|
||||
@ -242,7 +242,7 @@ static int node_remove(struct device *dev)
|
||||
|
||||
static int node_update(struct unit_directory *ud)
|
||||
{
|
||||
struct firedtv *fdtv = ud->device.driver_data;
|
||||
struct firedtv *fdtv = dev_get_drvdata(&ud->device);
|
||||
|
||||
if (fdtv->isochannel >= 0)
|
||||
cmp_establish_pp_connection(fdtv, fdtv->subunit,
|
||||
|
@ -268,7 +268,7 @@ struct firedtv *fdtv_alloc(struct device *dev,
|
||||
if (!fdtv)
|
||||
return NULL;
|
||||
|
||||
dev->driver_data = fdtv;
|
||||
dev_set_drvdata(dev, fdtv);
|
||||
fdtv->device = dev;
|
||||
fdtv->isochannel = -1;
|
||||
fdtv->voltage = 0xff;
|
||||
|
@ -747,8 +747,14 @@ static const struct file_operations dabusb_fops =
|
||||
.release = dabusb_release,
|
||||
};
|
||||
|
||||
static char *dabusb_nodename(struct device *dev)
|
||||
{
|
||||
return kasprintf(GFP_KERNEL, "usb/%s", dev_name(dev));
|
||||
}
|
||||
|
||||
static struct usb_class_driver dabusb_class = {
|
||||
.name = "dabusb%d",
|
||||
.nodename = dabusb_nodename,
|
||||
.fops = &dabusb_fops,
|
||||
.minor_base = DABUSB_MINOR,
|
||||
};
|
||||
|
@ -539,7 +539,7 @@ static void class_dev_destroy(struct pvr2_sysfs *sfp)
|
||||
&sfp->attr_unit_number);
|
||||
}
|
||||
pvr2_sysfs_trace("Destroying class_dev id=%p",sfp->class_dev);
|
||||
sfp->class_dev->driver_data = NULL;
|
||||
dev_set_drvdata(sfp->class_dev, NULL);
|
||||
device_unregister(sfp->class_dev);
|
||||
sfp->class_dev = NULL;
|
||||
}
|
||||
@ -549,7 +549,7 @@ static ssize_t v4l_minor_number_show(struct device *class_dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
struct pvr2_sysfs *sfp;
|
||||
sfp = (struct pvr2_sysfs *)class_dev->driver_data;
|
||||
sfp = dev_get_drvdata(class_dev);
|
||||
if (!sfp) return -EINVAL;
|
||||
return scnprintf(buf,PAGE_SIZE,"%d\n",
|
||||
pvr2_hdw_v4l_get_minor_number(sfp->channel.hdw,
|
||||
@ -561,7 +561,7 @@ static ssize_t bus_info_show(struct device *class_dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
struct pvr2_sysfs *sfp;
|
||||
sfp = (struct pvr2_sysfs *)class_dev->driver_data;
|
||||
sfp = dev_get_drvdata(class_dev);
|
||||
if (!sfp) return -EINVAL;
|
||||
return scnprintf(buf,PAGE_SIZE,"%s\n",
|
||||
pvr2_hdw_get_bus_info(sfp->channel.hdw));
|
||||
@ -572,7 +572,7 @@ static ssize_t hdw_name_show(struct device *class_dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
struct pvr2_sysfs *sfp;
|
||||
sfp = (struct pvr2_sysfs *)class_dev->driver_data;
|
||||
sfp = dev_get_drvdata(class_dev);
|
||||
if (!sfp) return -EINVAL;
|
||||
return scnprintf(buf,PAGE_SIZE,"%s\n",
|
||||
pvr2_hdw_get_type(sfp->channel.hdw));
|
||||
@ -583,7 +583,7 @@ static ssize_t hdw_desc_show(struct device *class_dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
struct pvr2_sysfs *sfp;
|
||||
sfp = (struct pvr2_sysfs *)class_dev->driver_data;
|
||||
sfp = dev_get_drvdata(class_dev);
|
||||
if (!sfp) return -EINVAL;
|
||||
return scnprintf(buf,PAGE_SIZE,"%s\n",
|
||||
pvr2_hdw_get_desc(sfp->channel.hdw));
|
||||
@ -595,7 +595,7 @@ static ssize_t v4l_radio_minor_number_show(struct device *class_dev,
|
||||
char *buf)
|
||||
{
|
||||
struct pvr2_sysfs *sfp;
|
||||
sfp = (struct pvr2_sysfs *)class_dev->driver_data;
|
||||
sfp = dev_get_drvdata(class_dev);
|
||||
if (!sfp) return -EINVAL;
|
||||
return scnprintf(buf,PAGE_SIZE,"%d\n",
|
||||
pvr2_hdw_v4l_get_minor_number(sfp->channel.hdw,
|
||||
@ -607,7 +607,7 @@ static ssize_t unit_number_show(struct device *class_dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
struct pvr2_sysfs *sfp;
|
||||
sfp = (struct pvr2_sysfs *)class_dev->driver_data;
|
||||
sfp = dev_get_drvdata(class_dev);
|
||||
if (!sfp) return -EINVAL;
|
||||
return scnprintf(buf,PAGE_SIZE,"%d\n",
|
||||
pvr2_hdw_get_unit_number(sfp->channel.hdw));
|
||||
@ -635,7 +635,7 @@ static void class_dev_create(struct pvr2_sysfs *sfp,
|
||||
class_dev->parent = &usb_dev->dev;
|
||||
|
||||
sfp->class_dev = class_dev;
|
||||
class_dev->driver_data = sfp;
|
||||
dev_set_drvdata(class_dev, sfp);
|
||||
ret = device_register(class_dev);
|
||||
if (ret) {
|
||||
pvr2_trace(PVR2_TRACE_ERROR_LEGS,
|
||||
@ -792,7 +792,7 @@ static ssize_t debuginfo_show(struct device *class_dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
struct pvr2_sysfs *sfp;
|
||||
sfp = (struct pvr2_sysfs *)class_dev->driver_data;
|
||||
sfp = dev_get_drvdata(class_dev);
|
||||
if (!sfp) return -EINVAL;
|
||||
pvr2_hdw_trigger_module_log(sfp->channel.hdw);
|
||||
return pvr2_debugifc_print_info(sfp->channel.hdw,buf,PAGE_SIZE);
|
||||
@ -803,7 +803,7 @@ static ssize_t debugcmd_show(struct device *class_dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
struct pvr2_sysfs *sfp;
|
||||
sfp = (struct pvr2_sysfs *)class_dev->driver_data;
|
||||
sfp = dev_get_drvdata(class_dev);
|
||||
if (!sfp) return -EINVAL;
|
||||
return pvr2_debugifc_print_status(sfp->channel.hdw,buf,PAGE_SIZE);
|
||||
}
|
||||
@ -816,7 +816,7 @@ static ssize_t debugcmd_store(struct device *class_dev,
|
||||
struct pvr2_sysfs *sfp;
|
||||
int ret;
|
||||
|
||||
sfp = (struct pvr2_sysfs *)class_dev->driver_data;
|
||||
sfp = dev_get_drvdata(class_dev);
|
||||
if (!sfp) return -EINVAL;
|
||||
|
||||
ret = pvr2_debugifc_docmd(sfp->channel.hdw,buf,count);
|
||||
|
@ -35,7 +35,7 @@ struct pasic3_data {
|
||||
*/
|
||||
void pasic3_write_register(struct device *dev, u32 reg, u8 val)
|
||||
{
|
||||
struct pasic3_data *asic = dev->driver_data;
|
||||
struct pasic3_data *asic = dev_get_drvdata(dev);
|
||||
int bus_shift = asic->bus_shift;
|
||||
void __iomem *addr = asic->mapping + (REG_ADDR << bus_shift);
|
||||
void __iomem *data = asic->mapping + (REG_DATA << bus_shift);
|
||||
@ -50,7 +50,7 @@ EXPORT_SYMBOL(pasic3_write_register); /* for leds-pasic3 */
|
||||
*/
|
||||
u8 pasic3_read_register(struct device *dev, u32 reg)
|
||||
{
|
||||
struct pasic3_data *asic = dev->driver_data;
|
||||
struct pasic3_data *asic = dev_get_drvdata(dev);
|
||||
int bus_shift = asic->bus_shift;
|
||||
void __iomem *addr = asic->mapping + (REG_ADDR << bus_shift);
|
||||
void __iomem *data = asic->mapping + (REG_DATA << bus_shift);
|
||||
|
@ -618,7 +618,7 @@ static int __devinit pcf50633_probe(struct i2c_client *client,
|
||||
|
||||
pdev->dev.parent = pcf->dev;
|
||||
pdev->dev.platform_data = &pdata->reg_init_data[i];
|
||||
pdev->dev.driver_data = pcf;
|
||||
dev_set_drvdata(&pdev->dev, pcf);
|
||||
pcf->regulator_pdev[i] = pdev;
|
||||
|
||||
platform_device_add(pdev);
|
||||
|
@ -265,7 +265,7 @@ static int wm8400_init(struct wm8400 *wm8400,
|
||||
|
||||
mutex_init(&wm8400->io_lock);
|
||||
|
||||
wm8400->dev->driver_data = wm8400;
|
||||
dev_set_drvdata(wm8400->dev, wm8400);
|
||||
|
||||
/* Check that this is actually a WM8400 */
|
||||
ret = wm8400->read_dev(wm8400->io_data, WM8400_RESET_ID, 1, ®);
|
||||
|
@ -2206,7 +2206,7 @@ config SKGE_DEBUG
|
||||
depends on SKGE && DEBUG_FS
|
||||
help
|
||||
This option adds the ability to dump driver state for debugging.
|
||||
The file debugfs/skge/ethX displays the state of the internal
|
||||
The file /sys/kernel/debug/skge/ethX displays the state of the internal
|
||||
transmit and receive rings.
|
||||
|
||||
If unsure, say N.
|
||||
@ -2232,7 +2232,7 @@ config SKY2_DEBUG
|
||||
depends on SKY2 && DEBUG_FS
|
||||
help
|
||||
This option adds the ability to dump driver state for debugging.
|
||||
The file debugfs/sky2/ethX displays the state of the internal
|
||||
The file /sys/kernel/debug/sky2/ethX displays the state of the internal
|
||||
transmit and receive rings.
|
||||
|
||||
If unsure, say N.
|
||||
|
@ -1366,6 +1366,7 @@ static const struct file_operations tun_fops = {
|
||||
static struct miscdevice tun_miscdev = {
|
||||
.minor = TUN_MINOR,
|
||||
.name = "tun",
|
||||
.devnode = "net/tun",
|
||||
.fops = &tun_fops,
|
||||
};
|
||||
|
||||
|
@ -432,7 +432,7 @@ struct i2400m {
|
||||
unsigned ready:1; /* all probing steps done */
|
||||
unsigned rx_reorder:1; /* RX reorder is enabled */
|
||||
u8 trace_msg_from_user; /* echo rx msgs to 'trace' pipe */
|
||||
/* typed u8 so debugfs/u8 can tweak */
|
||||
/* typed u8 so /sys/kernel/debug/u8 can tweak */
|
||||
enum i2400m_system_state state;
|
||||
wait_queue_head_t state_wq; /* Woken up when on state updates */
|
||||
|
||||
|
@ -28,11 +28,10 @@ config ATH5K_DEBUG
|
||||
Say Y, if and you will get debug options for ath5k.
|
||||
To use this, you need to mount debugfs:
|
||||
|
||||
mkdir /debug/
|
||||
mount -t debugfs debug /debug/
|
||||
mount -t debugfs debug /sys/kernel/debug
|
||||
|
||||
You will get access to files under:
|
||||
/debug/ath5k/phy0/
|
||||
/sys/kernel/debug/ath5k/phy0/
|
||||
|
||||
To enable debug, pass the debug level to the debug module
|
||||
parameter. For example:
|
||||
|
@ -72,7 +72,7 @@ rdrf
|
||||
location that is to be read. This parameter must be specified in
|
||||
hexadecimal (its possible to preceed preceding the number with a "0x").
|
||||
|
||||
Path: /debugfs/libertas_wireless/ethX/registers/
|
||||
Path: /sys/kernel/debug/libertas_wireless/ethX/registers/
|
||||
|
||||
Usage:
|
||||
echo "0xa123" > rdmac ; cat rdmac
|
||||
@ -95,7 +95,7 @@ wrrf
|
||||
sleepparams
|
||||
This command is used to set the sleepclock configurations
|
||||
|
||||
Path: /debugfs/libertas_wireless/ethX/
|
||||
Path: /sys/kernel/debug/libertas_wireless/ethX/
|
||||
|
||||
Usage:
|
||||
cat sleepparams: reads the current sleepclock configuration
|
||||
@ -115,7 +115,7 @@ subscribed_events
|
||||
The subscribed_events directory contains the interface for the
|
||||
subscribed events API.
|
||||
|
||||
Path: /debugfs/libertas_wireless/ethX/subscribed_events/
|
||||
Path: /sys/kernel/debug/libertas_wireless/ethX/subscribed_events/
|
||||
|
||||
Each event is represented by a filename. Each filename consists of the
|
||||
following three fields:
|
||||
@ -165,7 +165,7 @@ subscribed_events
|
||||
extscan
|
||||
This command is used to do a specific scan.
|
||||
|
||||
Path: /debugfs/libertas_wireless/ethX/
|
||||
Path: /sys/kernel/debug/libertas_wireless/ethX/
|
||||
|
||||
Usage: echo "SSID" > extscan
|
||||
|
||||
@ -179,7 +179,7 @@ getscantable
|
||||
Display the current contents of the driver scan table (ie. get the
|
||||
scan results).
|
||||
|
||||
Path: /debugfs/libertas_wireless/ethX/
|
||||
Path: /sys/kernel/debug/libertas_wireless/ethX/
|
||||
|
||||
Usage:
|
||||
cat getscantable
|
||||
@ -188,7 +188,7 @@ setuserscan
|
||||
Initiate a customized scan and retrieve the results
|
||||
|
||||
|
||||
Path: /debugfs/libertas_wireless/ethX/
|
||||
Path: /sys/kernel/debug/libertas_wireless/ethX/
|
||||
|
||||
Usage:
|
||||
echo "[ARGS]" > setuserscan
|
||||
|
@ -43,8 +43,8 @@ struct if_spi_card {
|
||||
struct lbs_private *priv;
|
||||
struct libertas_spi_platform_data *pdata;
|
||||
|
||||
char helper_fw_name[FIRMWARE_NAME_MAX];
|
||||
char main_fw_name[FIRMWARE_NAME_MAX];
|
||||
char helper_fw_name[IF_SPI_FW_NAME_MAX];
|
||||
char main_fw_name[IF_SPI_FW_NAME_MAX];
|
||||
|
||||
/* The card ID and card revision, as reported by the hardware. */
|
||||
u16 card_id;
|
||||
@ -1019,9 +1019,9 @@ static int if_spi_calculate_fw_names(u16 card_id,
|
||||
lbs_pr_err("Unsupported chip_id: 0x%02x\n", card_id);
|
||||
return -EAFNOSUPPORT;
|
||||
}
|
||||
snprintf(helper_fw, FIRMWARE_NAME_MAX, "libertas/gspi%d_hlp.bin",
|
||||
snprintf(helper_fw, IF_SPI_FW_NAME_MAX, "libertas/gspi%d_hlp.bin",
|
||||
chip_id_to_device_name[i].name);
|
||||
snprintf(main_fw, FIRMWARE_NAME_MAX, "libertas/gspi%d.bin",
|
||||
snprintf(main_fw, IF_SPI_FW_NAME_MAX, "libertas/gspi%d.bin",
|
||||
chip_id_to_device_name[i].name);
|
||||
return 0;
|
||||
}
|
||||
|
@ -22,6 +22,9 @@
|
||||
#define IF_SPI_CMD_BUF_SIZE 2400
|
||||
|
||||
/***************** Firmware *****************/
|
||||
|
||||
#define IF_SPI_FW_NAME_MAX 30
|
||||
|
||||
struct chip_ident {
|
||||
u16 chip_id;
|
||||
u16 name;
|
||||
|
@ -61,11 +61,9 @@ static ssize_t if_usb_firmware_set(struct device *dev,
|
||||
{
|
||||
struct lbs_private *priv = to_net_dev(dev)->ml_priv;
|
||||
struct if_usb_card *cardp = priv->card;
|
||||
char fwname[FIRMWARE_NAME_MAX];
|
||||
int ret;
|
||||
|
||||
sscanf(buf, "%29s", fwname); /* FIRMWARE_NAME_MAX - 1 = 29 */
|
||||
ret = if_usb_prog_firmware(cardp, fwname, BOOT_CMD_UPDATE_FW);
|
||||
ret = if_usb_prog_firmware(cardp, buf, BOOT_CMD_UPDATE_FW);
|
||||
if (ret == 0)
|
||||
return count;
|
||||
|
||||
@ -88,11 +86,9 @@ static ssize_t if_usb_boot2_set(struct device *dev,
|
||||
{
|
||||
struct lbs_private *priv = to_net_dev(dev)->ml_priv;
|
||||
struct if_usb_card *cardp = priv->card;
|
||||
char fwname[FIRMWARE_NAME_MAX];
|
||||
int ret;
|
||||
|
||||
sscanf(buf, "%29s", fwname); /* FIRMWARE_NAME_MAX - 1 = 29 */
|
||||
ret = if_usb_prog_firmware(cardp, fwname, BOOT_CMD_UPDATE_BOOT2);
|
||||
ret = if_usb_prog_firmware(cardp, buf, BOOT_CMD_UPDATE_BOOT2);
|
||||
if (ret == 0)
|
||||
return count;
|
||||
|
||||
|
@ -1212,7 +1212,7 @@ static int __devinit netfront_probe(struct xenbus_device *dev,
|
||||
}
|
||||
|
||||
info = netdev_priv(netdev);
|
||||
dev->dev.driver_data = info;
|
||||
dev_set_drvdata(&dev->dev, info);
|
||||
|
||||
err = register_netdev(info->netdev);
|
||||
if (err) {
|
||||
@ -1233,7 +1233,7 @@ static int __devinit netfront_probe(struct xenbus_device *dev,
|
||||
|
||||
fail:
|
||||
free_netdev(netdev);
|
||||
dev->dev.driver_data = NULL;
|
||||
dev_set_drvdata(&dev->dev, NULL);
|
||||
return err;
|
||||
}
|
||||
|
||||
@ -1275,7 +1275,7 @@ static void xennet_disconnect_backend(struct netfront_info *info)
|
||||
*/
|
||||
static int netfront_resume(struct xenbus_device *dev)
|
||||
{
|
||||
struct netfront_info *info = dev->dev.driver_data;
|
||||
struct netfront_info *info = dev_get_drvdata(&dev->dev);
|
||||
|
||||
dev_dbg(&dev->dev, "%s\n", dev->nodename);
|
||||
|
||||
@ -1600,7 +1600,7 @@ static int xennet_connect(struct net_device *dev)
|
||||
static void backend_changed(struct xenbus_device *dev,
|
||||
enum xenbus_state backend_state)
|
||||
{
|
||||
struct netfront_info *np = dev->dev.driver_data;
|
||||
struct netfront_info *np = dev_get_drvdata(&dev->dev);
|
||||
struct net_device *netdev = np->netdev;
|
||||
|
||||
dev_dbg(&dev->dev, "%s\n", xenbus_strstate(backend_state));
|
||||
@ -1774,7 +1774,7 @@ static struct xenbus_device_id netfront_ids[] = {
|
||||
|
||||
static int __devexit xennet_remove(struct xenbus_device *dev)
|
||||
{
|
||||
struct netfront_info *info = dev->dev.driver_data;
|
||||
struct netfront_info *info = dev_get_drvdata(&dev->dev);
|
||||
|
||||
dev_dbg(&dev->dev, "%s\n", dev->nodename);
|
||||
|
||||
|
@ -373,7 +373,7 @@ static int __init eisa_probe(struct parisc_device *dev)
|
||||
if (result >= 0) {
|
||||
/* FIXME : Don't enumerate the bus twice. */
|
||||
eisa_dev.root.dev = &dev->dev;
|
||||
dev->dev.driver_data = &eisa_dev.root;
|
||||
dev_set_drvdata(&dev->dev, &eisa_dev.root);
|
||||
eisa_dev.root.bus_base_addr = 0;
|
||||
eisa_dev.root.res = &eisa_dev.hba.io_space;
|
||||
eisa_dev.root.slots = result;
|
||||
|
@ -2010,7 +2010,7 @@ void __init sba_init(void)
|
||||
void * sba_get_iommu(struct parisc_device *pci_hba)
|
||||
{
|
||||
struct parisc_device *sba_dev = parisc_parent(pci_hba);
|
||||
struct sba_device *sba = sba_dev->dev.driver_data;
|
||||
struct sba_device *sba = dev_get_drvdata(&sba_dev->dev);
|
||||
char t = sba_dev->id.hw_type;
|
||||
int iocnum = (pci_hba->hw_path >> 3); /* rope # */
|
||||
|
||||
@ -2031,7 +2031,7 @@ void * sba_get_iommu(struct parisc_device *pci_hba)
|
||||
void sba_directed_lmmio(struct parisc_device *pci_hba, struct resource *r)
|
||||
{
|
||||
struct parisc_device *sba_dev = parisc_parent(pci_hba);
|
||||
struct sba_device *sba = sba_dev->dev.driver_data;
|
||||
struct sba_device *sba = dev_get_drvdata(&sba_dev->dev);
|
||||
char t = sba_dev->id.hw_type;
|
||||
int i;
|
||||
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)
|
||||
void sba_distributed_lmmio(struct parisc_device *pci_hba, struct resource *r )
|
||||
{
|
||||
struct parisc_device *sba_dev = parisc_parent(pci_hba);
|
||||
struct sba_device *sba = sba_dev->dev.driver_data;
|
||||
struct sba_device *sba = dev_get_drvdata(&sba_dev->dev);
|
||||
char t = sba_dev->id.hw_type;
|
||||
int base, size;
|
||||
int rope = (pci_hba->hw_path & (ROPES_PER_IOC-1)); /* rope # */
|
||||
|
@ -376,14 +376,14 @@ static int __devinit parport_init_chip(struct parisc_device *dev)
|
||||
/* PARPORT_IRQ_NONE */ PARPORT_DMA_NONE, NULL);
|
||||
if (p)
|
||||
parport_count++;
|
||||
dev->dev.driver_data = p;
|
||||
dev_set_drvdata(&dev->dev, p);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int __devexit parport_remove_chip(struct parisc_device *dev)
|
||||
{
|
||||
struct parport *p = dev->dev.driver_data;
|
||||
struct parport *p = dev_get_drvdata(&dev->dev);
|
||||
if (p) {
|
||||
struct parport_gsc_private *priv = p->private_data;
|
||||
struct parport_operations *ops = p->ops;
|
||||
|
@ -275,7 +275,7 @@ static void pcie_device_init(struct pci_dev *parent, struct pcie_device *dev,
|
||||
memset(device, 0, sizeof(struct device));
|
||||
device->bus = &pcie_port_bus_type;
|
||||
device->driver = NULL;
|
||||
device->driver_data = NULL;
|
||||
dev_set_drvdata(device, NULL);
|
||||
device->release = release_pcie_device; /* callback to free pcie dev */
|
||||
dev_set_name(device, "%s:pcie%02x",
|
||||
pci_name(parent), get_descriptor_id(port_type, service_type));
|
||||
|
@ -394,7 +394,7 @@ static int pcmcia_device_probe(struct device * dev)
|
||||
p_drv = to_pcmcia_drv(dev->driver);
|
||||
s = p_dev->socket;
|
||||
|
||||
/* The PCMCIA code passes the match data in via dev->driver_data
|
||||
/* The PCMCIA code passes the match data in via dev_set_drvdata(dev)
|
||||
* which is an ugly hack. Once the driver probe is called it may
|
||||
* and often will overwrite the match data so we must save it first
|
||||
*
|
||||
@ -404,7 +404,7 @@ static int pcmcia_device_probe(struct device * dev)
|
||||
* call which will then check whether there are two
|
||||
* pseudo devices, and if not, add the second one.
|
||||
*/
|
||||
did = p_dev->dev.driver_data;
|
||||
did = dev_get_drvdata(&p_dev->dev);
|
||||
|
||||
ds_dev_dbg(1, dev, "trying to bind to %s\n", p_drv->drv.name);
|
||||
|
||||
@ -499,7 +499,7 @@ static int pcmcia_device_remove(struct device * dev)
|
||||
* pseudo multi-function card, we need to unbind
|
||||
* all devices
|
||||
*/
|
||||
did = p_dev->dev.driver_data;
|
||||
did = dev_get_drvdata(&p_dev->dev);
|
||||
if (did && (did->match_flags & PCMCIA_DEV_ID_MATCH_DEVICE_NO) &&
|
||||
(p_dev->socket->device_count != 0) &&
|
||||
(p_dev->device_no == 0))
|
||||
@ -828,7 +828,6 @@ static int pcmcia_load_firmware(struct pcmcia_device *dev, char * filename)
|
||||
{
|
||||
struct pcmcia_socket *s = dev->socket;
|
||||
const struct firmware *fw;
|
||||
char path[FIRMWARE_NAME_MAX];
|
||||
int ret = -ENOMEM;
|
||||
int no_funcs;
|
||||
int old_funcs;
|
||||
@ -839,16 +838,7 @@ static int pcmcia_load_firmware(struct pcmcia_device *dev, char * filename)
|
||||
|
||||
ds_dev_dbg(1, &dev->dev, "trying to load CIS file %s\n", filename);
|
||||
|
||||
if (strlen(filename) > (FIRMWARE_NAME_MAX - 1)) {
|
||||
dev_printk(KERN_WARNING, &dev->dev,
|
||||
"pcmcia: CIS filename is too long [%s]\n",
|
||||
filename);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
snprintf(path, sizeof(path), "%s", filename);
|
||||
|
||||
if (request_firmware(&fw, path, &dev->dev) == 0) {
|
||||
if (request_firmware(&fw, filename, &dev->dev) == 0) {
|
||||
if (fw->size >= CISTPL_MAX_CIS_SIZE) {
|
||||
ret = -EINVAL;
|
||||
dev_printk(KERN_ERR, &dev->dev,
|
||||
@ -988,7 +978,7 @@ static inline int pcmcia_devmatch(struct pcmcia_device *dev,
|
||||
return 0;
|
||||
}
|
||||
|
||||
dev->dev.driver_data = (void *) did;
|
||||
dev_set_drvdata(&dev->dev, did);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@ -364,7 +364,7 @@ static void raw3215_irq(struct ccw_device *cdev, unsigned long intparm,
|
||||
int cstat, dstat;
|
||||
int count;
|
||||
|
||||
raw = cdev->dev.driver_data;
|
||||
raw = dev_get_drvdata(&cdev->dev);
|
||||
req = (struct raw3215_req *) intparm;
|
||||
cstat = irb->scsw.cmd.cstat;
|
||||
dstat = irb->scsw.cmd.dstat;
|
||||
@ -652,7 +652,7 @@ static int raw3215_probe (struct ccw_device *cdev)
|
||||
int line;
|
||||
|
||||
/* Console is special. */
|
||||
if (raw3215[0] && (cdev->dev.driver_data == raw3215[0]))
|
||||
if (raw3215[0] && (raw3215[0] == dev_get_drvdata(&cdev->dev)))
|
||||
return 0;
|
||||
raw = kmalloc(sizeof(struct raw3215_info) +
|
||||
RAW3215_INBUF_SIZE, GFP_KERNEL|GFP_DMA);
|
||||
@ -686,7 +686,7 @@ static int raw3215_probe (struct ccw_device *cdev)
|
||||
}
|
||||
init_waitqueue_head(&raw->empty_wait);
|
||||
|
||||
cdev->dev.driver_data = raw;
|
||||
dev_set_drvdata(&cdev->dev, raw);
|
||||
cdev->handler = raw3215_irq;
|
||||
|
||||
return 0;
|
||||
@ -697,9 +697,9 @@ static void raw3215_remove (struct ccw_device *cdev)
|
||||
struct raw3215_info *raw;
|
||||
|
||||
ccw_device_set_offline(cdev);
|
||||
raw = cdev->dev.driver_data;
|
||||
raw = dev_get_drvdata(&cdev->dev);
|
||||
if (raw) {
|
||||
cdev->dev.driver_data = NULL;
|
||||
dev_set_drvdata(&cdev->dev, NULL);
|
||||
kfree(raw->buffer);
|
||||
kfree(raw);
|
||||
}
|
||||
@ -709,7 +709,7 @@ static int raw3215_set_online (struct ccw_device *cdev)
|
||||
{
|
||||
struct raw3215_info *raw;
|
||||
|
||||
raw = cdev->dev.driver_data;
|
||||
raw = dev_get_drvdata(&cdev->dev);
|
||||
if (!raw)
|
||||
return -ENODEV;
|
||||
|
||||
@ -720,7 +720,7 @@ static int raw3215_set_offline (struct ccw_device *cdev)
|
||||
{
|
||||
struct raw3215_info *raw;
|
||||
|
||||
raw = cdev->dev.driver_data;
|
||||
raw = dev_get_drvdata(&cdev->dev);
|
||||
if (!raw)
|
||||
return -ENODEV;
|
||||
|
||||
@ -898,7 +898,7 @@ static int __init con3215_init(void)
|
||||
raw->buffer = (char *) alloc_bootmem_low(RAW3215_BUFFER_SIZE);
|
||||
raw->inbuf = (char *) alloc_bootmem_low(RAW3215_INBUF_SIZE);
|
||||
raw->cdev = cdev;
|
||||
cdev->dev.driver_data = raw;
|
||||
dev_set_drvdata(&cdev->dev, raw);
|
||||
cdev->handler = raw3215_irq;
|
||||
|
||||
raw->flags |= RAW3215_FIXED;
|
||||
|
@ -357,7 +357,7 @@ raw3270_irq (struct ccw_device *cdev, unsigned long intparm, struct irb *irb)
|
||||
struct raw3270_request *rq;
|
||||
int rc;
|
||||
|
||||
rp = (struct raw3270 *) cdev->dev.driver_data;
|
||||
rp = dev_get_drvdata(&cdev->dev);
|
||||
if (!rp)
|
||||
return;
|
||||
rq = (struct raw3270_request *) intparm;
|
||||
@ -831,7 +831,7 @@ raw3270_setup_device(struct ccw_device *cdev, struct raw3270 *rp, char *ascebc)
|
||||
if (rp->minor == -1)
|
||||
return -EUSERS;
|
||||
rp->cdev = cdev;
|
||||
cdev->dev.driver_data = rp;
|
||||
dev_set_drvdata(&cdev->dev, rp);
|
||||
cdev->handler = raw3270_irq;
|
||||
return 0;
|
||||
}
|
||||
@ -1112,7 +1112,7 @@ raw3270_delete_device(struct raw3270 *rp)
|
||||
/* Disconnect from ccw_device. */
|
||||
cdev = rp->cdev;
|
||||
rp->cdev = NULL;
|
||||
cdev->dev.driver_data = NULL;
|
||||
dev_set_drvdata(&cdev->dev, NULL);
|
||||
cdev->handler = NULL;
|
||||
|
||||
/* Put ccw_device structure. */
|
||||
@ -1136,7 +1136,7 @@ static ssize_t
|
||||
raw3270_model_show(struct device *dev, struct device_attribute *attr, char *buf)
|
||||
{
|
||||
return snprintf(buf, PAGE_SIZE, "%i\n",
|
||||
((struct raw3270 *) dev->driver_data)->model);
|
||||
((struct raw3270 *) dev_get_drvdata(dev))->model);
|
||||
}
|
||||
static DEVICE_ATTR(model, 0444, raw3270_model_show, NULL);
|
||||
|
||||
@ -1144,7 +1144,7 @@ static ssize_t
|
||||
raw3270_rows_show(struct device *dev, struct device_attribute *attr, char *buf)
|
||||
{
|
||||
return snprintf(buf, PAGE_SIZE, "%i\n",
|
||||
((struct raw3270 *) dev->driver_data)->rows);
|
||||
((struct raw3270 *) dev_get_drvdata(dev))->rows);
|
||||
}
|
||||
static DEVICE_ATTR(rows, 0444, raw3270_rows_show, NULL);
|
||||
|
||||
@ -1152,7 +1152,7 @@ static ssize_t
|
||||
raw3270_columns_show(struct device *dev, struct device_attribute *attr, char *buf)
|
||||
{
|
||||
return snprintf(buf, PAGE_SIZE, "%i\n",
|
||||
((struct raw3270 *) dev->driver_data)->cols);
|
||||
((struct raw3270 *) dev_get_drvdata(dev))->cols);
|
||||
}
|
||||
static DEVICE_ATTR(columns, 0444, raw3270_columns_show, NULL);
|
||||
|
||||
@ -1289,7 +1289,7 @@ raw3270_remove (struct ccw_device *cdev)
|
||||
struct raw3270_view *v;
|
||||
struct raw3270_notifier *np;
|
||||
|
||||
rp = cdev->dev.driver_data;
|
||||
rp = dev_get_drvdata(&cdev->dev);
|
||||
/*
|
||||
* _remove is the opposite of _probe; it's probe that
|
||||
* should set up rp. raw3270_remove gets entered for
|
||||
@ -1337,7 +1337,7 @@ raw3270_set_offline (struct ccw_device *cdev)
|
||||
{
|
||||
struct raw3270 *rp;
|
||||
|
||||
rp = cdev->dev.driver_data;
|
||||
rp = dev_get_drvdata(&cdev->dev);
|
||||
if (test_bit(RAW3270_FLAGS_CONSOLE, &rp->flags))
|
||||
return -EBUSY;
|
||||
raw3270_remove(cdev);
|
||||
|
@ -1289,7 +1289,7 @@ static int
|
||||
tape_34xx_online(struct ccw_device *cdev)
|
||||
{
|
||||
return tape_generic_online(
|
||||
cdev->dev.driver_data,
|
||||
dev_get_drvdata(&cdev->dev),
|
||||
&tape_discipline_34xx
|
||||
);
|
||||
}
|
||||
|
@ -1703,7 +1703,7 @@ static struct ccw_device_id tape_3590_ids[] = {
|
||||
static int
|
||||
tape_3590_online(struct ccw_device *cdev)
|
||||
{
|
||||
return tape_generic_online(cdev->dev.driver_data,
|
||||
return tape_generic_online(dev_get_drvdata(&cdev->dev),
|
||||
&tape_discipline_3590);
|
||||
}
|
||||
|
||||
|
@ -92,7 +92,7 @@ tape_medium_state_show(struct device *dev, struct device_attribute *attr, char *
|
||||
{
|
||||
struct tape_device *tdev;
|
||||
|
||||
tdev = (struct tape_device *) dev->driver_data;
|
||||
tdev = dev_get_drvdata(dev);
|
||||
return scnprintf(buf, PAGE_SIZE, "%i\n", tdev->medium_state);
|
||||
}
|
||||
|
||||
@ -104,7 +104,7 @@ tape_first_minor_show(struct device *dev, struct device_attribute *attr, char *b
|
||||
{
|
||||
struct tape_device *tdev;
|
||||
|
||||
tdev = (struct tape_device *) dev->driver_data;
|
||||
tdev = dev_get_drvdata(dev);
|
||||
return scnprintf(buf, PAGE_SIZE, "%i\n", tdev->first_minor);
|
||||
}
|
||||
|
||||
@ -116,7 +116,7 @@ tape_state_show(struct device *dev, struct device_attribute *attr, char *buf)
|
||||
{
|
||||
struct tape_device *tdev;
|
||||
|
||||
tdev = (struct tape_device *) dev->driver_data;
|
||||
tdev = dev_get_drvdata(dev);
|
||||
return scnprintf(buf, PAGE_SIZE, "%s\n", (tdev->first_minor < 0) ?
|
||||
"OFFLINE" : tape_state_verbose[tdev->tape_state]);
|
||||
}
|
||||
@ -130,7 +130,7 @@ tape_operation_show(struct device *dev, struct device_attribute *attr, char *buf
|
||||
struct tape_device *tdev;
|
||||
ssize_t rc;
|
||||
|
||||
tdev = (struct tape_device *) dev->driver_data;
|
||||
tdev = dev_get_drvdata(dev);
|
||||
if (tdev->first_minor < 0)
|
||||
return scnprintf(buf, PAGE_SIZE, "N/A\n");
|
||||
|
||||
@ -156,7 +156,7 @@ tape_blocksize_show(struct device *dev, struct device_attribute *attr, char *buf
|
||||
{
|
||||
struct tape_device *tdev;
|
||||
|
||||
tdev = (struct tape_device *) dev->driver_data;
|
||||
tdev = dev_get_drvdata(dev);
|
||||
|
||||
return scnprintf(buf, PAGE_SIZE, "%i\n", tdev->char_data.block_size);
|
||||
}
|
||||
@ -440,7 +440,7 @@ tape_generic_offline(struct ccw_device *cdev)
|
||||
{
|
||||
struct tape_device *device;
|
||||
|
||||
device = cdev->dev.driver_data;
|
||||
device = dev_get_drvdata(&cdev->dev);
|
||||
if (!device) {
|
||||
return -ENODEV;
|
||||
}
|
||||
@ -583,7 +583,7 @@ tape_generic_probe(struct ccw_device *cdev)
|
||||
tape_put_device(device);
|
||||
return ret;
|
||||
}
|
||||
cdev->dev.driver_data = device;
|
||||
dev_set_drvdata(&cdev->dev, device);
|
||||
cdev->handler = __tape_do_irq;
|
||||
device->cdev = cdev;
|
||||
ccw_device_get_id(cdev, &dev_id);
|
||||
@ -622,7 +622,7 @@ tape_generic_remove(struct ccw_device *cdev)
|
||||
{
|
||||
struct tape_device * device;
|
||||
|
||||
device = cdev->dev.driver_data;
|
||||
device = dev_get_drvdata(&cdev->dev);
|
||||
if (!device) {
|
||||
return;
|
||||
}
|
||||
@ -662,9 +662,9 @@ tape_generic_remove(struct ccw_device *cdev)
|
||||
tape_cleanup_device(device);
|
||||
}
|
||||
|
||||
if (cdev->dev.driver_data != NULL) {
|
||||
if (!dev_get_drvdata(&cdev->dev)) {
|
||||
sysfs_remove_group(&cdev->dev.kobj, &tape_attr_group);
|
||||
cdev->dev.driver_data = tape_put_device(cdev->dev.driver_data);
|
||||
dev_set_drvdata(&cdev->dev, tape_put_device(dev_get_drvdata(&cdev->dev)));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1060,7 +1060,7 @@ __tape_do_irq (struct ccw_device *cdev, unsigned long intparm, struct irb *irb)
|
||||
struct tape_request *request;
|
||||
int rc;
|
||||
|
||||
device = (struct tape_device *) cdev->dev.driver_data;
|
||||
device = dev_get_drvdata(&cdev->dev);
|
||||
if (device == NULL) {
|
||||
return;
|
||||
}
|
||||
|
@ -504,7 +504,7 @@ static ssize_t vmlogrdr_autopurge_store(struct device * dev,
|
||||
struct device_attribute *attr,
|
||||
const char * buf, size_t count)
|
||||
{
|
||||
struct vmlogrdr_priv_t *priv = dev->driver_data;
|
||||
struct vmlogrdr_priv_t *priv = dev_get_drvdata(dev);
|
||||
ssize_t ret = count;
|
||||
|
||||
switch (buf[0]) {
|
||||
@ -525,7 +525,7 @@ static ssize_t vmlogrdr_autopurge_show(struct device *dev,
|
||||
struct device_attribute *attr,
|
||||
char *buf)
|
||||
{
|
||||
struct vmlogrdr_priv_t *priv = dev->driver_data;
|
||||
struct vmlogrdr_priv_t *priv = dev_get_drvdata(dev);
|
||||
return sprintf(buf, "%u\n", priv->autopurge);
|
||||
}
|
||||
|
||||
@ -541,7 +541,7 @@ static ssize_t vmlogrdr_purge_store(struct device * dev,
|
||||
|
||||
char cp_command[80];
|
||||
char cp_response[80];
|
||||
struct vmlogrdr_priv_t *priv = dev->driver_data;
|
||||
struct vmlogrdr_priv_t *priv = dev_get_drvdata(dev);
|
||||
|
||||
if (buf[0] != '1')
|
||||
return -EINVAL;
|
||||
@ -578,7 +578,7 @@ static ssize_t vmlogrdr_autorecording_store(struct device *dev,
|
||||
struct device_attribute *attr,
|
||||
const char *buf, size_t count)
|
||||
{
|
||||
struct vmlogrdr_priv_t *priv = dev->driver_data;
|
||||
struct vmlogrdr_priv_t *priv = dev_get_drvdata(dev);
|
||||
ssize_t ret = count;
|
||||
|
||||
switch (buf[0]) {
|
||||
@ -599,7 +599,7 @@ static ssize_t vmlogrdr_autorecording_show(struct device *dev,
|
||||
struct device_attribute *attr,
|
||||
char *buf)
|
||||
{
|
||||
struct vmlogrdr_priv_t *priv = dev->driver_data;
|
||||
struct vmlogrdr_priv_t *priv = dev_get_drvdata(dev);
|
||||
return sprintf(buf, "%u\n", priv->autorecording);
|
||||
}
|
||||
|
||||
@ -612,7 +612,7 @@ static ssize_t vmlogrdr_recording_store(struct device * dev,
|
||||
struct device_attribute *attr,
|
||||
const char * buf, size_t count)
|
||||
{
|
||||
struct vmlogrdr_priv_t *priv = dev->driver_data;
|
||||
struct vmlogrdr_priv_t *priv = dev_get_drvdata(dev);
|
||||
ssize_t ret;
|
||||
|
||||
switch (buf[0]) {
|
||||
|
@ -80,11 +80,11 @@ static DEFINE_MUTEX(vmur_mutex);
|
||||
*
|
||||
* Each ur device (urd) contains a reference to its corresponding ccw device
|
||||
* (cdev) using the urd->cdev pointer. Each ccw device has a reference to the
|
||||
* ur device using the cdev->dev.driver_data pointer.
|
||||
* ur device using dev_get_drvdata(&cdev->dev) pointer.
|
||||
*
|
||||
* urd references:
|
||||
* - ur_probe gets a urd reference, ur_remove drops the reference
|
||||
* (cdev->dev.driver_data)
|
||||
* dev_get_drvdata(&cdev->dev)
|
||||
* - ur_open gets a urd reference, ur_relase drops the reference
|
||||
* (urf->urd)
|
||||
*
|
||||
@ -92,7 +92,7 @@ static DEFINE_MUTEX(vmur_mutex);
|
||||
* - urdev_alloc get a cdev reference (urd->cdev)
|
||||
* - urdev_free drops the cdev reference (urd->cdev)
|
||||
*
|
||||
* Setting and clearing of cdev->dev.driver_data is protected by the ccwdev lock
|
||||
* Setting and clearing of dev_get_drvdata(&cdev->dev) is protected by the ccwdev lock
|
||||
*/
|
||||
static struct urdev *urdev_alloc(struct ccw_device *cdev)
|
||||
{
|
||||
@ -131,7 +131,7 @@ static struct urdev *urdev_get_from_cdev(struct ccw_device *cdev)
|
||||
unsigned long flags;
|
||||
|
||||
spin_lock_irqsave(get_ccwdev_lock(cdev), flags);
|
||||
urd = cdev->dev.driver_data;
|
||||
urd = dev_get_drvdata(&cdev->dev);
|
||||
if (urd)
|
||||
urdev_get(urd);
|
||||
spin_unlock_irqrestore(get_ccwdev_lock(cdev), flags);
|
||||
@ -310,7 +310,7 @@ static void ur_int_handler(struct ccw_device *cdev, unsigned long intparm,
|
||||
TRACE("ur_int_handler: unsolicited interrupt\n");
|
||||
return;
|
||||
}
|
||||
urd = cdev->dev.driver_data;
|
||||
urd = dev_get_drvdata(&cdev->dev);
|
||||
BUG_ON(!urd);
|
||||
/* On special conditions irb is an error pointer */
|
||||
if (IS_ERR(irb))
|
||||
@ -856,7 +856,7 @@ static int ur_probe(struct ccw_device *cdev)
|
||||
goto fail_remove_attr;
|
||||
}
|
||||
spin_lock_irq(get_ccwdev_lock(cdev));
|
||||
cdev->dev.driver_data = urd;
|
||||
dev_set_drvdata(&cdev->dev, urd);
|
||||
spin_unlock_irq(get_ccwdev_lock(cdev));
|
||||
|
||||
mutex_unlock(&vmur_mutex);
|
||||
@ -996,8 +996,8 @@ static void ur_remove(struct ccw_device *cdev)
|
||||
ur_remove_attributes(&cdev->dev);
|
||||
|
||||
spin_lock_irqsave(get_ccwdev_lock(cdev), flags);
|
||||
urdev_put(cdev->dev.driver_data);
|
||||
cdev->dev.driver_data = NULL;
|
||||
urdev_put(dev_get_drvdata(&cdev->dev));
|
||||
dev_set_drvdata(&cdev->dev, NULL);
|
||||
spin_unlock_irqrestore(get_ccwdev_lock(cdev), flags);
|
||||
|
||||
mutex_unlock(&vmur_mutex);
|
||||
|
@ -290,7 +290,7 @@ claw_probe(struct ccwgroup_device *cgdev)
|
||||
if (!get_device(&cgdev->dev))
|
||||
return -ENODEV;
|
||||
privptr = kzalloc(sizeof(struct claw_privbk), GFP_KERNEL);
|
||||
cgdev->dev.driver_data = privptr;
|
||||
dev_set_drvdata(&cgdev->dev, privptr);
|
||||
if (privptr == NULL) {
|
||||
probe_error(cgdev);
|
||||
put_device(&cgdev->dev);
|
||||
@ -597,14 +597,14 @@ claw_irq_handler(struct ccw_device *cdev,
|
||||
|
||||
CLAW_DBF_TEXT(4, trace, "clawirq");
|
||||
/* Bypass all 'unsolicited interrupts' */
|
||||
if (!cdev->dev.driver_data) {
|
||||
privptr = dev_get_drvdata(&cdev->dev);
|
||||
if (!privptr) {
|
||||
dev_warn(&cdev->dev, "An uninitialized CLAW device received an"
|
||||
" IRQ, c-%02x d-%02x\n",
|
||||
irb->scsw.cmd.cstat, irb->scsw.cmd.dstat);
|
||||
CLAW_DBF_TEXT(2, trace, "badirq");
|
||||
return;
|
||||
}
|
||||
privptr = (struct claw_privbk *)cdev->dev.driver_data;
|
||||
|
||||
/* Try to extract channel from driver data. */
|
||||
if (privptr->channel[READ].cdev == cdev)
|
||||
@ -1986,9 +1986,9 @@ probe_error( struct ccwgroup_device *cgdev)
|
||||
struct claw_privbk *privptr;
|
||||
|
||||
CLAW_DBF_TEXT(4, trace, "proberr");
|
||||
privptr = (struct claw_privbk *) cgdev->dev.driver_data;
|
||||
privptr = dev_get_drvdata(&cgdev->dev);
|
||||
if (privptr != NULL) {
|
||||
cgdev->dev.driver_data = NULL;
|
||||
dev_set_drvdata(&cgdev->dev, NULL);
|
||||
kfree(privptr->p_env);
|
||||
kfree(privptr->p_mtc_envelope);
|
||||
kfree(privptr);
|
||||
@ -2917,9 +2917,9 @@ claw_new_device(struct ccwgroup_device *cgdev)
|
||||
dev_info(&cgdev->dev, "add for %s\n",
|
||||
dev_name(&cgdev->cdev[READ]->dev));
|
||||
CLAW_DBF_TEXT(2, setup, "new_dev");
|
||||
privptr = cgdev->dev.driver_data;
|
||||
cgdev->cdev[READ]->dev.driver_data = privptr;
|
||||
cgdev->cdev[WRITE]->dev.driver_data = privptr;
|
||||
privptr = dev_get_drvdata(&cgdev->dev);
|
||||
dev_set_drvdata(&cgdev->cdev[READ]->dev, privptr);
|
||||
dev_set_drvdata(&cgdev->cdev[WRITE]->dev, privptr);
|
||||
if (!privptr)
|
||||
return -ENODEV;
|
||||
p_env = privptr->p_env;
|
||||
@ -2956,9 +2956,9 @@ claw_new_device(struct ccwgroup_device *cgdev)
|
||||
goto out;
|
||||
}
|
||||
dev->ml_priv = privptr;
|
||||
cgdev->dev.driver_data = privptr;
|
||||
cgdev->cdev[READ]->dev.driver_data = privptr;
|
||||
cgdev->cdev[WRITE]->dev.driver_data = privptr;
|
||||
dev_set_drvdata(&cgdev->dev, privptr);
|
||||
dev_set_drvdata(&cgdev->cdev[READ]->dev, privptr);
|
||||
dev_set_drvdata(&cgdev->cdev[WRITE]->dev, privptr);
|
||||
/* sysfs magic */
|
||||
SET_NETDEV_DEV(dev, &cgdev->dev);
|
||||
if (register_netdev(dev) != 0) {
|
||||
@ -3024,7 +3024,7 @@ claw_shutdown_device(struct ccwgroup_device *cgdev)
|
||||
int ret;
|
||||
|
||||
CLAW_DBF_TEXT_(2, setup, "%s", dev_name(&cgdev->dev));
|
||||
priv = cgdev->dev.driver_data;
|
||||
priv = dev_get_drvdata(&cgdev->dev);
|
||||
if (!priv)
|
||||
return -ENODEV;
|
||||
ndev = priv->channel[READ].ndev;
|
||||
@ -3054,7 +3054,7 @@ claw_remove_device(struct ccwgroup_device *cgdev)
|
||||
|
||||
BUG_ON(!cgdev);
|
||||
CLAW_DBF_TEXT_(2, setup, "%s", dev_name(&cgdev->dev));
|
||||
priv = cgdev->dev.driver_data;
|
||||
priv = dev_get_drvdata(&cgdev->dev);
|
||||
BUG_ON(!priv);
|
||||
dev_info(&cgdev->dev, " will be removed.\n");
|
||||
if (cgdev->state == CCWGROUP_ONLINE)
|
||||
@ -3069,9 +3069,9 @@ claw_remove_device(struct ccwgroup_device *cgdev)
|
||||
kfree(priv->channel[1].irb);
|
||||
priv->channel[1].irb=NULL;
|
||||
kfree(priv);
|
||||
cgdev->dev.driver_data=NULL;
|
||||
cgdev->cdev[READ]->dev.driver_data = NULL;
|
||||
cgdev->cdev[WRITE]->dev.driver_data = NULL;
|
||||
dev_set_drvdata(&cgdev->dev, NULL);
|
||||
dev_set_drvdata(&cgdev->cdev[READ]->dev, NULL);
|
||||
dev_set_drvdata(&cgdev->cdev[WRITE]->dev, NULL);
|
||||
put_device(&cgdev->dev);
|
||||
|
||||
return;
|
||||
@ -3087,7 +3087,7 @@ claw_hname_show(struct device *dev, struct device_attribute *attr, char *buf)
|
||||
struct claw_privbk *priv;
|
||||
struct claw_env * p_env;
|
||||
|
||||
priv = dev->driver_data;
|
||||
priv = dev_get_drvdata(dev);
|
||||
if (!priv)
|
||||
return -ENODEV;
|
||||
p_env = priv->p_env;
|
||||
@ -3101,7 +3101,7 @@ claw_hname_write(struct device *dev, struct device_attribute *attr,
|
||||
struct claw_privbk *priv;
|
||||
struct claw_env * p_env;
|
||||
|
||||
priv = dev->driver_data;
|
||||
priv = dev_get_drvdata(dev);
|
||||
if (!priv)
|
||||
return -ENODEV;
|
||||
p_env = priv->p_env;
|
||||
@ -3125,7 +3125,7 @@ claw_adname_show(struct device *dev, struct device_attribute *attr, char *buf)
|
||||
struct claw_privbk *priv;
|
||||
struct claw_env * p_env;
|
||||
|
||||
priv = dev->driver_data;
|
||||
priv = dev_get_drvdata(dev);
|
||||
if (!priv)
|
||||
return -ENODEV;
|
||||
p_env = priv->p_env;
|
||||
@ -3139,7 +3139,7 @@ claw_adname_write(struct device *dev, struct device_attribute *attr,
|
||||
struct claw_privbk *priv;
|
||||
struct claw_env * p_env;
|
||||
|
||||
priv = dev->driver_data;
|
||||
priv = dev_get_drvdata(dev);
|
||||
if (!priv)
|
||||
return -ENODEV;
|
||||
p_env = priv->p_env;
|
||||
@ -3163,7 +3163,7 @@ claw_apname_show(struct device *dev, struct device_attribute *attr, char *buf)
|
||||
struct claw_privbk *priv;
|
||||
struct claw_env * p_env;
|
||||
|
||||
priv = dev->driver_data;
|
||||
priv = dev_get_drvdata(dev);
|
||||
if (!priv)
|
||||
return -ENODEV;
|
||||
p_env = priv->p_env;
|
||||
@ -3178,7 +3178,7 @@ claw_apname_write(struct device *dev, struct device_attribute *attr,
|
||||
struct claw_privbk *priv;
|
||||
struct claw_env * p_env;
|
||||
|
||||
priv = dev->driver_data;
|
||||
priv = dev_get_drvdata(dev);
|
||||
if (!priv)
|
||||
return -ENODEV;
|
||||
p_env = priv->p_env;
|
||||
@ -3212,7 +3212,7 @@ claw_wbuff_show(struct device *dev, struct device_attribute *attr, char *buf)
|
||||
struct claw_privbk *priv;
|
||||
struct claw_env * p_env;
|
||||
|
||||
priv = dev->driver_data;
|
||||
priv = dev_get_drvdata(dev);
|
||||
if (!priv)
|
||||
return -ENODEV;
|
||||
p_env = priv->p_env;
|
||||
@ -3227,7 +3227,7 @@ claw_wbuff_write(struct device *dev, struct device_attribute *attr,
|
||||
struct claw_env * p_env;
|
||||
int nnn,max;
|
||||
|
||||
priv = dev->driver_data;
|
||||
priv = dev_get_drvdata(dev);
|
||||
if (!priv)
|
||||
return -ENODEV;
|
||||
p_env = priv->p_env;
|
||||
@ -3254,7 +3254,7 @@ claw_rbuff_show(struct device *dev, struct device_attribute *attr, char *buf)
|
||||
struct claw_privbk *priv;
|
||||
struct claw_env * p_env;
|
||||
|
||||
priv = dev->driver_data;
|
||||
priv = dev_get_drvdata(dev);
|
||||
if (!priv)
|
||||
return -ENODEV;
|
||||
p_env = priv->p_env;
|
||||
@ -3269,7 +3269,7 @@ claw_rbuff_write(struct device *dev, struct device_attribute *attr,
|
||||
struct claw_env *p_env;
|
||||
int nnn,max;
|
||||
|
||||
priv = dev->driver_data;
|
||||
priv = dev_get_drvdata(dev);
|
||||
if (!priv)
|
||||
return -ENODEV;
|
||||
p_env = priv->p_env;
|
||||
|
@ -1936,7 +1936,7 @@ lcs_portno_show (struct device *dev, struct device_attribute *attr, char *buf)
|
||||
{
|
||||
struct lcs_card *card;
|
||||
|
||||
card = (struct lcs_card *)dev->driver_data;
|
||||
card = dev_get_drvdata(dev);
|
||||
|
||||
if (!card)
|
||||
return 0;
|
||||
@ -1953,7 +1953,7 @@ lcs_portno_store (struct device *dev, struct device_attribute *attr, const char
|
||||
struct lcs_card *card;
|
||||
int value;
|
||||
|
||||
card = (struct lcs_card *)dev->driver_data;
|
||||
card = dev_get_drvdata(dev);
|
||||
|
||||
if (!card)
|
||||
return 0;
|
||||
@ -1987,7 +1987,7 @@ lcs_timeout_show(struct device *dev, struct device_attribute *attr, char *buf)
|
||||
{
|
||||
struct lcs_card *card;
|
||||
|
||||
card = (struct lcs_card *)dev->driver_data;
|
||||
card = dev_get_drvdata(dev);
|
||||
|
||||
return card ? sprintf(buf, "%u\n", card->lancmd_timeout) : 0;
|
||||
}
|
||||
@ -1998,7 +1998,7 @@ lcs_timeout_store (struct device *dev, struct device_attribute *attr, const char
|
||||
struct lcs_card *card;
|
||||
int value;
|
||||
|
||||
card = (struct lcs_card *)dev->driver_data;
|
||||
card = dev_get_drvdata(dev);
|
||||
|
||||
if (!card)
|
||||
return 0;
|
||||
@ -2017,7 +2017,7 @@ static ssize_t
|
||||
lcs_dev_recover_store(struct device *dev, struct device_attribute *attr,
|
||||
const char *buf, size_t count)
|
||||
{
|
||||
struct lcs_card *card = dev->driver_data;
|
||||
struct lcs_card *card = dev_get_drvdata(dev);
|
||||
char *tmp;
|
||||
int i;
|
||||
|
||||
@ -2070,7 +2070,7 @@ lcs_probe_device(struct ccwgroup_device *ccwgdev)
|
||||
put_device(&ccwgdev->dev);
|
||||
return ret;
|
||||
}
|
||||
ccwgdev->dev.driver_data = card;
|
||||
dev_set_drvdata(&ccwgdev->dev, card);
|
||||
ccwgdev->cdev[0]->handler = lcs_irq;
|
||||
ccwgdev->cdev[1]->handler = lcs_irq;
|
||||
card->gdev = ccwgdev;
|
||||
@ -2087,7 +2087,7 @@ lcs_register_netdev(struct ccwgroup_device *ccwgdev)
|
||||
struct lcs_card *card;
|
||||
|
||||
LCS_DBF_TEXT(2, setup, "regnetdv");
|
||||
card = (struct lcs_card *)ccwgdev->dev.driver_data;
|
||||
card = dev_get_drvdata(&ccwgdev->dev);
|
||||
if (card->dev->reg_state != NETREG_UNINITIALIZED)
|
||||
return 0;
|
||||
SET_NETDEV_DEV(card->dev, &ccwgdev->dev);
|
||||
@ -2120,7 +2120,7 @@ lcs_new_device(struct ccwgroup_device *ccwgdev)
|
||||
enum lcs_dev_states recover_state;
|
||||
int rc;
|
||||
|
||||
card = (struct lcs_card *)ccwgdev->dev.driver_data;
|
||||
card = dev_get_drvdata(&ccwgdev->dev);
|
||||
if (!card)
|
||||
return -ENODEV;
|
||||
|
||||
@ -2226,7 +2226,7 @@ __lcs_shutdown_device(struct ccwgroup_device *ccwgdev, int recovery_mode)
|
||||
int ret;
|
||||
|
||||
LCS_DBF_TEXT(3, setup, "shtdndev");
|
||||
card = (struct lcs_card *)ccwgdev->dev.driver_data;
|
||||
card = dev_get_drvdata(&ccwgdev->dev);
|
||||
if (!card)
|
||||
return -ENODEV;
|
||||
if (recovery_mode == 0) {
|
||||
@ -2293,7 +2293,7 @@ lcs_remove_device(struct ccwgroup_device *ccwgdev)
|
||||
{
|
||||
struct lcs_card *card;
|
||||
|
||||
card = (struct lcs_card *)ccwgdev->dev.driver_data;
|
||||
card = dev_get_drvdata(&ccwgdev->dev);
|
||||
if (!card)
|
||||
return;
|
||||
|
||||
|
@ -34,8 +34,8 @@ static inline int lcs_dbf_passes(debug_info_t *dbf_grp, int level)
|
||||
* sysfs related stuff
|
||||
*/
|
||||
#define CARD_FROM_DEV(cdev) \
|
||||
(struct lcs_card *) \
|
||||
((struct ccwgroup_device *)cdev->dev.driver_data)->dev.driver_data;
|
||||
(struct lcs_card *) dev_get_drvdata( \
|
||||
&((struct ccwgroup_device *)dev_get_drvdata(&cdev->dev))->dev);
|
||||
/**
|
||||
* CCW commands used in this driver
|
||||
*/
|
||||
|
@ -1452,7 +1452,7 @@ static int netiucv_change_mtu(struct net_device * dev, int new_mtu)
|
||||
static ssize_t user_show(struct device *dev, struct device_attribute *attr,
|
||||
char *buf)
|
||||
{
|
||||
struct netiucv_priv *priv = dev->driver_data;
|
||||
struct netiucv_priv *priv = dev_get_drvdata(dev);
|
||||
|
||||
IUCV_DBF_TEXT(trace, 5, __func__);
|
||||
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,
|
||||
static ssize_t user_write(struct device *dev, struct device_attribute *attr,
|
||||
const char *buf, size_t count)
|
||||
{
|
||||
struct netiucv_priv *priv = dev->driver_data;
|
||||
struct netiucv_priv *priv = dev_get_drvdata(dev);
|
||||
struct net_device *ndev = priv->conn->netdev;
|
||||
char *p;
|
||||
char *tmp;
|
||||
@ -1518,7 +1518,8 @@ static DEVICE_ATTR(user, 0644, user_show, user_write);
|
||||
|
||||
static ssize_t buffer_show (struct device *dev, struct device_attribute *attr,
|
||||
char *buf)
|
||||
{ struct netiucv_priv *priv = dev->driver_data;
|
||||
{
|
||||
struct netiucv_priv *priv = dev_get_drvdata(dev);
|
||||
|
||||
IUCV_DBF_TEXT(trace, 5, __func__);
|
||||
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,
|
||||
static ssize_t buffer_write (struct device *dev, struct device_attribute *attr,
|
||||
const char *buf, size_t count)
|
||||
{
|
||||
struct netiucv_priv *priv = dev->driver_data;
|
||||
struct netiucv_priv *priv = dev_get_drvdata(dev);
|
||||
struct net_device *ndev = priv->conn->netdev;
|
||||
char *e;
|
||||
int bs1;
|
||||
@ -1575,7 +1576,7 @@ static DEVICE_ATTR(buffer, 0644, buffer_show, buffer_write);
|
||||
static ssize_t dev_fsm_show (struct device *dev, struct device_attribute *attr,
|
||||
char *buf)
|
||||
{
|
||||
struct netiucv_priv *priv = dev->driver_data;
|
||||
struct netiucv_priv *priv = dev_get_drvdata(dev);
|
||||
|
||||
IUCV_DBF_TEXT(trace, 5, __func__);
|
||||
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);
|
||||
static ssize_t conn_fsm_show (struct device *dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
struct netiucv_priv *priv = dev->driver_data;
|
||||
struct netiucv_priv *priv = dev_get_drvdata(dev);
|
||||
|
||||
IUCV_DBF_TEXT(trace, 5, __func__);
|
||||
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);
|
||||
static ssize_t maxmulti_show (struct device *dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
struct netiucv_priv *priv = dev->driver_data;
|
||||
struct netiucv_priv *priv = dev_get_drvdata(dev);
|
||||
|
||||
IUCV_DBF_TEXT(trace, 5, __func__);
|
||||
return sprintf(buf, "%ld\n", priv->conn->prof.maxmulti);
|
||||
@ -1607,7 +1608,7 @@ static ssize_t maxmulti_write (struct device *dev,
|
||||
struct device_attribute *attr,
|
||||
const char *buf, size_t count)
|
||||
{
|
||||
struct netiucv_priv *priv = dev->driver_data;
|
||||
struct netiucv_priv *priv = dev_get_drvdata(dev);
|
||||
|
||||
IUCV_DBF_TEXT(trace, 4, __func__);
|
||||
priv->conn->prof.maxmulti = 0;
|
||||
@ -1619,7 +1620,7 @@ static DEVICE_ATTR(max_tx_buffer_used, 0644, maxmulti_show, maxmulti_write);
|
||||
static ssize_t maxcq_show (struct device *dev, struct device_attribute *attr,
|
||||
char *buf)
|
||||
{
|
||||
struct netiucv_priv *priv = dev->driver_data;
|
||||
struct netiucv_priv *priv = dev_get_drvdata(dev);
|
||||
|
||||
IUCV_DBF_TEXT(trace, 5, __func__);
|
||||
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,
|
||||
static ssize_t maxcq_write (struct device *dev, struct device_attribute *attr,
|
||||
const char *buf, size_t count)
|
||||
{
|
||||
struct netiucv_priv *priv = dev->driver_data;
|
||||
struct netiucv_priv *priv = dev_get_drvdata(dev);
|
||||
|
||||
IUCV_DBF_TEXT(trace, 4, __func__);
|
||||
priv->conn->prof.maxcqueue = 0;
|
||||
@ -1640,7 +1641,7 @@ static DEVICE_ATTR(max_chained_skbs, 0644, maxcq_show, maxcq_write);
|
||||
static ssize_t sdoio_show (struct device *dev, struct device_attribute *attr,
|
||||
char *buf)
|
||||
{
|
||||
struct netiucv_priv *priv = dev->driver_data;
|
||||
struct netiucv_priv *priv = dev_get_drvdata(dev);
|
||||
|
||||
IUCV_DBF_TEXT(trace, 5, __func__);
|
||||
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,
|
||||
static ssize_t sdoio_write (struct device *dev, struct device_attribute *attr,
|
||||
const char *buf, size_t count)
|
||||
{
|
||||
struct netiucv_priv *priv = dev->driver_data;
|
||||
struct netiucv_priv *priv = dev_get_drvdata(dev);
|
||||
|
||||
IUCV_DBF_TEXT(trace, 4, __func__);
|
||||
priv->conn->prof.doios_single = 0;
|
||||
@ -1661,7 +1662,7 @@ static DEVICE_ATTR(tx_single_write_ops, 0644, sdoio_show, sdoio_write);
|
||||
static ssize_t mdoio_show (struct device *dev, struct device_attribute *attr,
|
||||
char *buf)
|
||||
{
|
||||
struct netiucv_priv *priv = dev->driver_data;
|
||||
struct netiucv_priv *priv = dev_get_drvdata(dev);
|
||||
|
||||
IUCV_DBF_TEXT(trace, 5, __func__);
|
||||
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,
|
||||
static ssize_t mdoio_write (struct device *dev, struct device_attribute *attr,
|
||||
const char *buf, size_t count)
|
||||
{
|
||||
struct netiucv_priv *priv = dev->driver_data;
|
||||
struct netiucv_priv *priv = dev_get_drvdata(dev);
|
||||
|
||||
IUCV_DBF_TEXT(trace, 5, __func__);
|
||||
priv->conn->prof.doios_multi = 0;
|
||||
@ -1682,7 +1683,7 @@ static DEVICE_ATTR(tx_multi_write_ops, 0644, mdoio_show, mdoio_write);
|
||||
static ssize_t txlen_show (struct device *dev, struct device_attribute *attr,
|
||||
char *buf)
|
||||
{
|
||||
struct netiucv_priv *priv = dev->driver_data;
|
||||
struct netiucv_priv *priv = dev_get_drvdata(dev);
|
||||
|
||||
IUCV_DBF_TEXT(trace, 5, __func__);
|
||||
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,
|
||||
static ssize_t txlen_write (struct device *dev, struct device_attribute *attr,
|
||||
const char *buf, size_t count)
|
||||
{
|
||||
struct netiucv_priv *priv = dev->driver_data;
|
||||
struct netiucv_priv *priv = dev_get_drvdata(dev);
|
||||
|
||||
IUCV_DBF_TEXT(trace, 4, __func__);
|
||||
priv->conn->prof.txlen = 0;
|
||||
@ -1703,7 +1704,7 @@ static DEVICE_ATTR(netto_bytes, 0644, txlen_show, txlen_write);
|
||||
static ssize_t txtime_show (struct device *dev, struct device_attribute *attr,
|
||||
char *buf)
|
||||
{
|
||||
struct netiucv_priv *priv = dev->driver_data;
|
||||
struct netiucv_priv *priv = dev_get_drvdata(dev);
|
||||
|
||||
IUCV_DBF_TEXT(trace, 5, __func__);
|
||||
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,
|
||||
static ssize_t txtime_write (struct device *dev, struct device_attribute *attr,
|
||||
const char *buf, size_t count)
|
||||
{
|
||||
struct netiucv_priv *priv = dev->driver_data;
|
||||
struct netiucv_priv *priv = dev_get_drvdata(dev);
|
||||
|
||||
IUCV_DBF_TEXT(trace, 4, __func__);
|
||||
priv->conn->prof.tx_time = 0;
|
||||
@ -1724,7 +1725,7 @@ static DEVICE_ATTR(max_tx_io_time, 0644, txtime_show, txtime_write);
|
||||
static ssize_t txpend_show (struct device *dev, struct device_attribute *attr,
|
||||
char *buf)
|
||||
{
|
||||
struct netiucv_priv *priv = dev->driver_data;
|
||||
struct netiucv_priv *priv = dev_get_drvdata(dev);
|
||||
|
||||
IUCV_DBF_TEXT(trace, 5, __func__);
|
||||
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,
|
||||
static ssize_t txpend_write (struct device *dev, struct device_attribute *attr,
|
||||
const char *buf, size_t count)
|
||||
{
|
||||
struct netiucv_priv *priv = dev->driver_data;
|
||||
struct netiucv_priv *priv = dev_get_drvdata(dev);
|
||||
|
||||
IUCV_DBF_TEXT(trace, 4, __func__);
|
||||
priv->conn->prof.tx_pending = 0;
|
||||
@ -1745,7 +1746,7 @@ static DEVICE_ATTR(tx_pending, 0644, txpend_show, txpend_write);
|
||||
static ssize_t txmpnd_show (struct device *dev, struct device_attribute *attr,
|
||||
char *buf)
|
||||
{
|
||||
struct netiucv_priv *priv = dev->driver_data;
|
||||
struct netiucv_priv *priv = dev_get_drvdata(dev);
|
||||
|
||||
IUCV_DBF_TEXT(trace, 5, __func__);
|
||||
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,
|
||||
static ssize_t txmpnd_write (struct device *dev, struct device_attribute *attr,
|
||||
const char *buf, size_t count)
|
||||
{
|
||||
struct netiucv_priv *priv = dev->driver_data;
|
||||
struct netiucv_priv *priv = dev_get_drvdata(dev);
|
||||
|
||||
IUCV_DBF_TEXT(trace, 4, __func__);
|
||||
priv->conn->prof.tx_max_pending = 0;
|
||||
@ -1845,7 +1846,7 @@ static int netiucv_register_device(struct net_device *ndev)
|
||||
if (ret)
|
||||
goto out_unreg;
|
||||
priv->dev = dev;
|
||||
dev->driver_data = priv;
|
||||
dev_set_drvdata(dev, priv);
|
||||
return 0;
|
||||
|
||||
out_unreg:
|
||||
|
@ -646,7 +646,7 @@ static int aha1740_probe (struct device *dev)
|
||||
|
||||
static __devexit int aha1740_remove (struct device *dev)
|
||||
{
|
||||
struct Scsi_Host *shpnt = dev->driver_data;
|
||||
struct Scsi_Host *shpnt = dev_get_drvdata(dev);
|
||||
struct aha1740_hostdata *host = HOSTDATA (shpnt);
|
||||
|
||||
scsi_remove_host(shpnt);
|
||||
|
@ -1877,7 +1877,7 @@ static int ibmvscsi_probe(struct vio_dev *vdev, const struct vio_device_id *id)
|
||||
unsigned long wait_switch = 0;
|
||||
int rc;
|
||||
|
||||
vdev->dev.driver_data = NULL;
|
||||
dev_set_drvdata(&vdev->dev, NULL);
|
||||
|
||||
host = scsi_host_alloc(&driver_template, sizeof(*hostdata));
|
||||
if (!host) {
|
||||
@ -1949,7 +1949,7 @@ static int ibmvscsi_probe(struct vio_dev *vdev, const struct vio_device_id *id)
|
||||
scsi_scan_host(host);
|
||||
}
|
||||
|
||||
vdev->dev.driver_data = hostdata;
|
||||
dev_set_drvdata(&vdev->dev, hostdata);
|
||||
return 0;
|
||||
|
||||
add_srp_port_failed:
|
||||
@ -1968,7 +1968,7 @@ static int ibmvscsi_probe(struct vio_dev *vdev, const struct vio_device_id *id)
|
||||
|
||||
static int ibmvscsi_remove(struct vio_dev *vdev)
|
||||
{
|
||||
struct ibmvscsi_host_data *hostdata = vdev->dev.driver_data;
|
||||
struct ibmvscsi_host_data *hostdata = dev_get_drvdata(&vdev->dev);
|
||||
unmap_persist_bufs(hostdata);
|
||||
release_event_pool(&hostdata->pool, hostdata);
|
||||
ibmvscsi_ops->release_crq_queue(&hostdata->queue, hostdata,
|
||||
|
@ -892,7 +892,7 @@ free_vport:
|
||||
|
||||
static int ibmvstgt_remove(struct vio_dev *dev)
|
||||
{
|
||||
struct srp_target *target = (struct srp_target *) dev->dev.driver_data;
|
||||
struct srp_target *target = dev_get_drvdata(&dev->dev);
|
||||
struct Scsi_Host *shost = target->shost;
|
||||
struct vio_port *vport = target->ldata;
|
||||
|
||||
|
@ -135,7 +135,7 @@ int srp_target_alloc(struct srp_target *target, struct device *dev,
|
||||
INIT_LIST_HEAD(&target->cmd_queue);
|
||||
|
||||
target->dev = dev;
|
||||
target->dev->driver_data = target;
|
||||
dev_set_drvdata(target->dev, target);
|
||||
|
||||
target->srp_iu_size = iu_size;
|
||||
target->rx_ring_size = nr;
|
||||
|
@ -53,8 +53,7 @@
|
||||
* debugfs interface
|
||||
*
|
||||
* To access this interface the user should:
|
||||
* # mkdir /debug
|
||||
* # mount -t debugfs none /debug
|
||||
* # mount -t debugfs none /sys/kernel/debug
|
||||
*
|
||||
* The lpfc debugfs directory hierarchy is:
|
||||
* lpfc/lpfcX/vportY
|
||||
|
@ -122,7 +122,7 @@ static int __devinit of_platform_serial_probe(struct of_device *ofdev,
|
||||
|
||||
info->type = port_type;
|
||||
info->line = ret;
|
||||
ofdev->dev.driver_data = info;
|
||||
dev_set_drvdata(&ofdev->dev, info);
|
||||
return 0;
|
||||
out:
|
||||
kfree(info);
|
||||
@ -135,7 +135,7 @@ out:
|
||||
*/
|
||||
static int of_platform_serial_remove(struct of_device *ofdev)
|
||||
{
|
||||
struct of_serial_info *info = ofdev->dev.driver_data;
|
||||
struct of_serial_info *info = dev_get_drvdata(&ofdev->dev);
|
||||
switch (info->type) {
|
||||
#ifdef CONFIG_SERIAL_8250
|
||||
case PORT_8250 ... PORT_MAX_8250:
|
||||
|
@ -417,7 +417,7 @@ static LIST_HEAD(thermal_hwmon_list);
|
||||
static ssize_t
|
||||
name_show(struct device *dev, struct device_attribute *attr, char *buf)
|
||||
{
|
||||
struct thermal_hwmon_device *hwmon = dev->driver_data;
|
||||
struct thermal_hwmon_device *hwmon = dev_get_drvdata(dev);
|
||||
return sprintf(buf, "%s\n", hwmon->type);
|
||||
}
|
||||
static DEVICE_ATTR(name, 0444, name_show, NULL);
|
||||
@ -488,7 +488,7 @@ thermal_add_hwmon_sysfs(struct thermal_zone_device *tz)
|
||||
result = PTR_ERR(hwmon->device);
|
||||
goto free_mem;
|
||||
}
|
||||
hwmon->device->driver_data = hwmon;
|
||||
dev_set_drvdata(hwmon->device, hwmon);
|
||||
result = device_create_file(hwmon->device, &dev_attr_name);
|
||||
if (result)
|
||||
goto unregister_hwmon_device;
|
||||
|
@ -306,6 +306,7 @@ enum {
|
||||
#define FW_GET_BYTE(p) *((__u8 *) (p))
|
||||
|
||||
#define FW_DIR "ueagle-atm/"
|
||||
#define UEA_FW_NAME_MAX 30
|
||||
#define NB_MODEM 4
|
||||
|
||||
#define BULK_TIMEOUT 300
|
||||
@ -1564,9 +1565,9 @@ static void cmvs_file_name(struct uea_softc *sc, char *const cmv_name, int ver)
|
||||
file = cmv_file[sc->modem_index];
|
||||
|
||||
strcpy(cmv_name, FW_DIR);
|
||||
strlcat(cmv_name, file, FIRMWARE_NAME_MAX);
|
||||
strlcat(cmv_name, file, UEA_FW_NAME_MAX);
|
||||
if (ver == 2)
|
||||
strlcat(cmv_name, ".v2", FIRMWARE_NAME_MAX);
|
||||
strlcat(cmv_name, ".v2", UEA_FW_NAME_MAX);
|
||||
}
|
||||
|
||||
static int request_cmvs_old(struct uea_softc *sc,
|
||||
@ -1574,7 +1575,7 @@ static int request_cmvs_old(struct uea_softc *sc,
|
||||
{
|
||||
int ret, size;
|
||||
u8 *data;
|
||||
char cmv_name[FIRMWARE_NAME_MAX]; /* 30 bytes stack variable */
|
||||
char cmv_name[UEA_FW_NAME_MAX]; /* 30 bytes stack variable */
|
||||
|
||||
cmvs_file_name(sc, cmv_name, 1);
|
||||
ret = request_firmware(fw, cmv_name, &sc->usb_dev->dev);
|
||||
@ -1608,7 +1609,7 @@ static int request_cmvs(struct uea_softc *sc,
|
||||
int ret, size;
|
||||
u32 crc;
|
||||
u8 *data;
|
||||
char cmv_name[FIRMWARE_NAME_MAX]; /* 30 bytes stack variable */
|
||||
char cmv_name[UEA_FW_NAME_MAX]; /* 30 bytes stack variable */
|
||||
|
||||
cmvs_file_name(sc, cmv_name, 2);
|
||||
ret = request_firmware(fw, cmv_name, &sc->usb_dev->dev);
|
||||
|
@ -1057,8 +1057,14 @@ static const struct file_operations usblp_fops = {
|
||||
.release = usblp_release,
|
||||
};
|
||||
|
||||
static char *usblp_nodename(struct device *dev)
|
||||
{
|
||||
return kasprintf(GFP_KERNEL, "usb/%s", dev_name(dev));
|
||||
}
|
||||
|
||||
static struct usb_class_driver usblp_class = {
|
||||
.name = "lp%d",
|
||||
.nodename = usblp_nodename,
|
||||
.fops = &usblp_fops,
|
||||
.minor_base = USBLP_MINOR_BASE,
|
||||
};
|
||||
|
@ -67,6 +67,16 @@ static struct usb_class {
|
||||
struct class *class;
|
||||
} *usb_class;
|
||||
|
||||
static char *usb_nodename(struct device *dev)
|
||||
{
|
||||
struct usb_class_driver *drv;
|
||||
|
||||
drv = dev_get_drvdata(dev);
|
||||
if (!drv || !drv->nodename)
|
||||
return NULL;
|
||||
return drv->nodename(dev);
|
||||
}
|
||||
|
||||
static int init_usb_class(void)
|
||||
{
|
||||
int result = 0;
|
||||
@ -90,6 +100,7 @@ static int init_usb_class(void)
|
||||
kfree(usb_class);
|
||||
usb_class = NULL;
|
||||
}
|
||||
usb_class->class->nodename = usb_nodename;
|
||||
|
||||
exit:
|
||||
return result;
|
||||
@ -198,7 +209,7 @@ int usb_register_dev(struct usb_interface *intf,
|
||||
else
|
||||
temp = name;
|
||||
intf->usb_dev = device_create(usb_class->class, &intf->dev,
|
||||
MKDEV(USB_MAJOR, minor), NULL,
|
||||
MKDEV(USB_MAJOR, minor), class_driver,
|
||||
"%s", temp);
|
||||
if (IS_ERR(intf->usb_dev)) {
|
||||
down_write(&minor_rwsem);
|
||||
|
@ -305,10 +305,21 @@ static struct dev_pm_ops usb_device_pm_ops = {
|
||||
|
||||
#endif /* CONFIG_PM */
|
||||
|
||||
|
||||
static char *usb_nodename(struct device *dev)
|
||||
{
|
||||
struct usb_device *usb_dev;
|
||||
|
||||
usb_dev = to_usb_device(dev);
|
||||
return kasprintf(GFP_KERNEL, "bus/usb/%03d/%03d",
|
||||
usb_dev->bus->busnum, usb_dev->devnum);
|
||||
}
|
||||
|
||||
struct device_type usb_device_type = {
|
||||
.name = "usb_device",
|
||||
.release = usb_release_dev,
|
||||
.uevent = usb_dev_uevent,
|
||||
.nodename = usb_nodename,
|
||||
.pm = &usb_device_pm_ops,
|
||||
};
|
||||
|
||||
|
@ -1574,7 +1574,7 @@ int usb_gadget_register_driver (struct usb_gadget_driver *driver)
|
||||
|
||||
udc->driver = driver;
|
||||
udc->gadget.dev.driver = &driver->driver;
|
||||
udc->gadget.dev.driver_data = &driver->driver;
|
||||
dev_set_drvdata(&udc->gadget.dev, &driver->driver);
|
||||
udc->enabled = 1;
|
||||
udc->selfpowered = 1;
|
||||
|
||||
@ -1583,7 +1583,7 @@ int usb_gadget_register_driver (struct usb_gadget_driver *driver)
|
||||
DBG("driver->bind() returned %d\n", retval);
|
||||
udc->driver = NULL;
|
||||
udc->gadget.dev.driver = NULL;
|
||||
udc->gadget.dev.driver_data = NULL;
|
||||
dev_set_drvdata(&udc->gadget.dev, NULL);
|
||||
udc->enabled = 0;
|
||||
udc->selfpowered = 0;
|
||||
return retval;
|
||||
@ -1613,7 +1613,7 @@ int usb_gadget_unregister_driver (struct usb_gadget_driver *driver)
|
||||
|
||||
driver->unbind(&udc->gadget);
|
||||
udc->gadget.dev.driver = NULL;
|
||||
udc->gadget.dev.driver_data = NULL;
|
||||
dev_set_drvdata(&udc->gadget.dev, NULL);
|
||||
udc->driver = NULL;
|
||||
|
||||
DBG("unbound from %s\n", driver->driver.name);
|
||||
|
@ -726,12 +726,18 @@ static const struct file_operations iowarrior_fops = {
|
||||
.poll = iowarrior_poll,
|
||||
};
|
||||
|
||||
static char *iowarrior_nodename(struct device *dev)
|
||||
{
|
||||
return kasprintf(GFP_KERNEL, "usb/%s", dev_name(dev));
|
||||
}
|
||||
|
||||
/*
|
||||
* usb class driver info in order to get a minor number from the usb core,
|
||||
* and to have the device registered with devfs and the driver core
|
||||
*/
|
||||
static struct usb_class_driver iowarrior_class = {
|
||||
.name = "iowarrior%d",
|
||||
.nodename = iowarrior_nodename,
|
||||
.fops = &iowarrior_fops,
|
||||
.minor_base = IOWARRIOR_MINOR_BASE,
|
||||
};
|
||||
|
@ -266,12 +266,18 @@ static const struct file_operations tower_fops = {
|
||||
.llseek = tower_llseek,
|
||||
};
|
||||
|
||||
static char *legousbtower_nodename(struct device *dev)
|
||||
{
|
||||
return kasprintf(GFP_KERNEL, "usb/%s", dev_name(dev));
|
||||
}
|
||||
|
||||
/*
|
||||
* usb class driver info in order to get a minor number from the usb core,
|
||||
* and to have the device registered with the driver core
|
||||
*/
|
||||
static struct usb_class_driver tower_class = {
|
||||
.name = "legousbtower%d",
|
||||
.nodename = legousbtower_nodename,
|
||||
.fops = &tower_fops,
|
||||
.minor_base = LEGO_USB_TOWER_MINOR_BASE,
|
||||
};
|
||||
|
@ -384,7 +384,7 @@ static int __devinit xenfb_probe(struct xenbus_device *dev,
|
||||
fb_size = XENFB_DEFAULT_FB_LEN;
|
||||
}
|
||||
|
||||
dev->dev.driver_data = info;
|
||||
dev_set_drvdata(&dev->dev, info);
|
||||
info->xbdev = dev;
|
||||
info->irq = -1;
|
||||
info->x1 = info->y1 = INT_MAX;
|
||||
@ -503,7 +503,7 @@ xenfb_make_preferred_console(void)
|
||||
|
||||
static int xenfb_resume(struct xenbus_device *dev)
|
||||
{
|
||||
struct xenfb_info *info = dev->dev.driver_data;
|
||||
struct xenfb_info *info = dev_get_drvdata(&dev->dev);
|
||||
|
||||
xenfb_disconnect_backend(info);
|
||||
xenfb_init_shared_page(info, info->fb_info);
|
||||
@ -512,7 +512,7 @@ static int xenfb_resume(struct xenbus_device *dev)
|
||||
|
||||
static int xenfb_remove(struct xenbus_device *dev)
|
||||
{
|
||||
struct xenfb_info *info = dev->dev.driver_data;
|
||||
struct xenfb_info *info = dev_get_drvdata(&dev->dev);
|
||||
|
||||
xenfb_disconnect_backend(info);
|
||||
if (info->fb_info) {
|
||||
@ -621,7 +621,7 @@ static void xenfb_disconnect_backend(struct xenfb_info *info)
|
||||
static void xenfb_backend_changed(struct xenbus_device *dev,
|
||||
enum xenbus_state backend_state)
|
||||
{
|
||||
struct xenfb_info *info = dev->dev.driver_data;
|
||||
struct xenfb_info *info = dev_get_drvdata(&dev->dev);
|
||||
int val;
|
||||
|
||||
switch (backend_state) {
|
||||
|
@ -67,6 +67,8 @@ static int debugfs_u8_get(void *data, u64 *val)
|
||||
return 0;
|
||||
}
|
||||
DEFINE_SIMPLE_ATTRIBUTE(fops_u8, debugfs_u8_get, debugfs_u8_set, "%llu\n");
|
||||
DEFINE_SIMPLE_ATTRIBUTE(fops_u8_ro, debugfs_u8_get, NULL, "%llu\n");
|
||||
DEFINE_SIMPLE_ATTRIBUTE(fops_u8_wo, NULL, debugfs_u8_set, "%llu\n");
|
||||
|
||||
/**
|
||||
* 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");
|
||||
struct dentry *debugfs_create_u8(const char *name, mode_t mode,
|
||||
struct dentry *parent, u8 *value)
|
||||
{
|
||||
/* if there are no write bits set, make read only */
|
||||
if (!(mode & S_IWUGO))
|
||||
return debugfs_create_file(name, mode, parent, value, &fops_u8_ro);
|
||||
/* if there are no read bits set, make write only */
|
||||
if (!(mode & S_IRUGO))
|
||||
return debugfs_create_file(name, mode, parent, value, &fops_u8_wo);
|
||||
|
||||
return debugfs_create_file(name, mode, parent, value, &fops_u8);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(debugfs_create_u8);
|
||||
@ -110,6 +119,8 @@ static int debugfs_u16_get(void *data, u64 *val)
|
||||
return 0;
|
||||
}
|
||||
DEFINE_SIMPLE_ATTRIBUTE(fops_u16, debugfs_u16_get, debugfs_u16_set, "%llu\n");
|
||||
DEFINE_SIMPLE_ATTRIBUTE(fops_u16_ro, debugfs_u16_get, NULL, "%llu\n");
|
||||
DEFINE_SIMPLE_ATTRIBUTE(fops_u16_wo, NULL, debugfs_u16_set, "%llu\n");
|
||||
|
||||
/**
|
||||
* 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");
|
||||
struct dentry *debugfs_create_u16(const char *name, mode_t mode,
|
||||
struct dentry *parent, u16 *value)
|
||||
{
|
||||
/* if there are no write bits set, make read only */
|
||||
if (!(mode & S_IWUGO))
|
||||
return debugfs_create_file(name, mode, parent, value, &fops_u16_ro);
|
||||
/* if there are no read bits set, make write only */
|
||||
if (!(mode & S_IRUGO))
|
||||
return debugfs_create_file(name, mode, parent, value, &fops_u16_wo);
|
||||
|
||||
return debugfs_create_file(name, mode, parent, value, &fops_u16);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(debugfs_create_u16);
|
||||
@ -153,6 +171,8 @@ static int debugfs_u32_get(void *data, u64 *val)
|
||||
return 0;
|
||||
}
|
||||
DEFINE_SIMPLE_ATTRIBUTE(fops_u32, debugfs_u32_get, debugfs_u32_set, "%llu\n");
|
||||
DEFINE_SIMPLE_ATTRIBUTE(fops_u32_ro, debugfs_u32_get, NULL, "%llu\n");
|
||||
DEFINE_SIMPLE_ATTRIBUTE(fops_u32_wo, NULL, debugfs_u32_set, "%llu\n");
|
||||
|
||||
/**
|
||||
* 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");
|
||||
struct dentry *debugfs_create_u32(const char *name, mode_t mode,
|
||||
struct dentry *parent, u32 *value)
|
||||
{
|
||||
/* if there are no write bits set, make read only */
|
||||
if (!(mode & S_IWUGO))
|
||||
return debugfs_create_file(name, mode, parent, value, &fops_u32_ro);
|
||||
/* if there are no read bits set, make write only */
|
||||
if (!(mode & S_IRUGO))
|
||||
return debugfs_create_file(name, mode, parent, value, &fops_u32_wo);
|
||||
|
||||
return debugfs_create_file(name, mode, parent, value, &fops_u32);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(debugfs_create_u32);
|
||||
@ -197,6 +224,8 @@ static int debugfs_u64_get(void *data, u64 *val)
|
||||
return 0;
|
||||
}
|
||||
DEFINE_SIMPLE_ATTRIBUTE(fops_u64, debugfs_u64_get, debugfs_u64_set, "%llu\n");
|
||||
DEFINE_SIMPLE_ATTRIBUTE(fops_u64_ro, debugfs_u64_get, NULL, "%llu\n");
|
||||
DEFINE_SIMPLE_ATTRIBUTE(fops_u64_wo, NULL, debugfs_u64_set, "%llu\n");
|
||||
|
||||
/**
|
||||
* 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");
|
||||
struct dentry *debugfs_create_u64(const char *name, mode_t mode,
|
||||
struct dentry *parent, u64 *value)
|
||||
{
|
||||
/* if there are no write bits set, make read only */
|
||||
if (!(mode & S_IWUGO))
|
||||
return debugfs_create_file(name, mode, parent, value, &fops_u64_ro);
|
||||
/* if there are no read bits set, make write only */
|
||||
if (!(mode & S_IRUGO))
|
||||
return debugfs_create_file(name, mode, parent, value, &fops_u64_wo);
|
||||
|
||||
return debugfs_create_file(name, mode, parent, value, &fops_u64);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(debugfs_create_u64);
|
||||
|
||||
DEFINE_SIMPLE_ATTRIBUTE(fops_x8, debugfs_u8_get, debugfs_u8_set, "0x%02llx\n");
|
||||
DEFINE_SIMPLE_ATTRIBUTE(fops_x8_ro, debugfs_u8_get, NULL, "0x%02llx\n");
|
||||
DEFINE_SIMPLE_ATTRIBUTE(fops_x8_wo, NULL, debugfs_u8_set, "0x%02llx\n");
|
||||
|
||||
DEFINE_SIMPLE_ATTRIBUTE(fops_x16, debugfs_u16_get, debugfs_u16_set, "0x%04llx\n");
|
||||
DEFINE_SIMPLE_ATTRIBUTE(fops_x16_ro, debugfs_u16_get, NULL, "0x%04llx\n");
|
||||
DEFINE_SIMPLE_ATTRIBUTE(fops_x16_wo, NULL, debugfs_u16_set, "0x%04llx\n");
|
||||
|
||||
DEFINE_SIMPLE_ATTRIBUTE(fops_x32, debugfs_u32_get, debugfs_u32_set, "0x%08llx\n");
|
||||
DEFINE_SIMPLE_ATTRIBUTE(fops_x32_ro, debugfs_u32_get, NULL, "0x%08llx\n");
|
||||
DEFINE_SIMPLE_ATTRIBUTE(fops_x32_wo, NULL, debugfs_u32_set, "0x%08llx\n");
|
||||
|
||||
/*
|
||||
* 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"
|
||||
struct dentry *debugfs_create_x8(const char *name, mode_t mode,
|
||||
struct dentry *parent, u8 *value)
|
||||
{
|
||||
/* if there are no write bits set, make read only */
|
||||
if (!(mode & S_IWUGO))
|
||||
return debugfs_create_file(name, mode, parent, value, &fops_x8_ro);
|
||||
/* if there are no read bits set, make write only */
|
||||
if (!(mode & S_IRUGO))
|
||||
return debugfs_create_file(name, mode, parent, value, &fops_x8_wo);
|
||||
|
||||
return debugfs_create_file(name, mode, parent, value, &fops_x8);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(debugfs_create_x8);
|
||||
@ -273,6 +322,13 @@ EXPORT_SYMBOL_GPL(debugfs_create_x8);
|
||||
struct dentry *debugfs_create_x16(const char *name, mode_t mode,
|
||||
struct dentry *parent, u16 *value)
|
||||
{
|
||||
/* if there are no write bits set, make read only */
|
||||
if (!(mode & S_IWUGO))
|
||||
return debugfs_create_file(name, mode, parent, value, &fops_x16_ro);
|
||||
/* if there are no read bits set, make write only */
|
||||
if (!(mode & S_IRUGO))
|
||||
return debugfs_create_file(name, mode, parent, value, &fops_x16_wo);
|
||||
|
||||
return debugfs_create_file(name, mode, parent, value, &fops_x16);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(debugfs_create_x16);
|
||||
@ -290,6 +346,13 @@ EXPORT_SYMBOL_GPL(debugfs_create_x16);
|
||||
struct dentry *debugfs_create_x32(const char *name, mode_t mode,
|
||||
struct dentry *parent, u32 *value)
|
||||
{
|
||||
/* if there are no write bits set, make read only */
|
||||
if (!(mode & S_IWUGO))
|
||||
return debugfs_create_file(name, mode, parent, value, &fops_x32_ro);
|
||||
/* if there are no read bits set, make write only */
|
||||
if (!(mode & S_IRUGO))
|
||||
return debugfs_create_file(name, mode, parent, value, &fops_x32_wo);
|
||||
|
||||
return debugfs_create_file(name, mode, parent, value, &fops_x32);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(debugfs_create_x32);
|
||||
@ -419,7 +482,7 @@ static const struct file_operations fops_blob = {
|
||||
};
|
||||
|
||||
/**
|
||||
* debugfs_create_blob - create a debugfs file that is used to read and write a binary blob
|
||||
* debugfs_create_blob - create a debugfs file that is used to read a binary blob
|
||||
* @name: a pointer to a string containing the name of the file to create.
|
||||
* @mode: the permission that the file should have
|
||||
* @parent: a pointer to the parent dentry for this file. This should be a
|
||||
|
@ -403,6 +403,7 @@ void debugfs_remove_recursive(struct dentry *dentry)
|
||||
}
|
||||
child = list_entry(parent->d_subdirs.next, struct dentry,
|
||||
d_u.d_child);
|
||||
next_sibling:
|
||||
|
||||
/*
|
||||
* If "child" isn't empty, walk down the tree and
|
||||
@ -416,6 +417,16 @@ void debugfs_remove_recursive(struct dentry *dentry)
|
||||
}
|
||||
__debugfs_remove(child, parent);
|
||||
if (parent->d_subdirs.next == &child->d_u.d_child) {
|
||||
/*
|
||||
* Try the next sibling.
|
||||
*/
|
||||
if (child->d_u.d_child.next != &parent->d_subdirs) {
|
||||
child = list_entry(child->d_u.d_child.next,
|
||||
struct dentry,
|
||||
d_u.d_child);
|
||||
goto next_sibling;
|
||||
}
|
||||
|
||||
/*
|
||||
* Avoid infinite loop if we fail to remove
|
||||
* one dentry.
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user