diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2019-07-12 15:24:03 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2019-07-12 15:24:03 -0400 |
commit | f632a8170a6b667ee4e3f552087588f0fe13c4bb (patch) | |
tree | 9fbdd3505f1471364265727dea1bc9d034cbed8f | |
parent | ef8f3d48afd6a17a0dae8c277c2f539c2f19fd16 (diff) | |
parent | c33d442328f556460b79aba6058adb37bb555389 (diff) |
Merge tag 'driver-core-5.3-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core
Pull driver core and debugfs updates from Greg KH:
"Here is the "big" driver core and debugfs changes for 5.3-rc1
It's a lot of different patches, all across the tree due to some api
changes and lots of debugfs cleanups.
Other than the debugfs cleanups, in this set of changes we have:
- bus iteration function cleanups
- scripts/get_abi.pl tool to display and parse Documentation/ABI
entries in a simple way
- cleanups to Documenatation/ABI/ entries to make them parse easier
due to typos and other minor things
- default_attrs use for some ktype users
- driver model documentation file conversions to .rst
- compressed firmware file loading
- deferred probe fixes
All of these have been in linux-next for a while, with a bunch of
merge issues that Stephen has been patient with me for"
* tag 'driver-core-5.3-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (102 commits)
debugfs: make error message a bit more verbose
orangefs: fix build warning from debugfs cleanup patch
ubifs: fix build warning after debugfs cleanup patch
driver: core: Allow subsystems to continue deferring probe
drivers: base: cacheinfo: Ensure cpu hotplug work is done before Intel RDT
arch_topology: Remove error messages on out-of-memory conditions
lib: notifier-error-inject: no need to check return value of debugfs_create functions
swiotlb: no need to check return value of debugfs_create functions
ceph: no need to check return value of debugfs_create functions
sunrpc: no need to check return value of debugfs_create functions
ubifs: no need to check return value of debugfs_create functions
orangefs: no need to check return value of debugfs_create functions
nfsd: no need to check return value of debugfs_create functions
lib: 842: no need to check return value of debugfs_create functions
debugfs: provide pr_fmt() macro
debugfs: log errors when something goes wrong
drivers: s390/cio: Fix compilation warning about const qualifiers
drivers: Add generic helper to match by of_node
driver_find_device: Unify the match function with class_find_device()
bus_find_device: Unify the match callback with class_find_device
...
201 files changed, 1939 insertions, 2114 deletions
diff --git a/Documentation/ABI/obsolete/sysfs-driver-hid-roccat-pyra b/Documentation/ABI/obsolete/sysfs-driver-hid-roccat-pyra index 16020b31ae64..5d41ebadf15e 100644 --- a/Documentation/ABI/obsolete/sysfs-driver-hid-roccat-pyra +++ b/Documentation/ABI/obsolete/sysfs-driver-hid-roccat-pyra | |||
@@ -5,7 +5,7 @@ Description: It is possible to switch the cpi setting of the mouse with the | |||
5 | press of a button. | 5 | press of a button. |
6 | When read, this file returns the raw number of the actual cpi | 6 | When read, this file returns the raw number of the actual cpi |
7 | setting reported by the mouse. This number has to be further | 7 | setting reported by the mouse. This number has to be further |
8 | processed to receive the real dpi value. | 8 | processed to receive the real dpi value: |
9 | 9 | ||
10 | VALUE DPI | 10 | VALUE DPI |
11 | 1 400 | 11 | 1 400 |
diff --git a/Documentation/ABI/stable/sysfs-driver-mlxreg-io b/Documentation/ABI/stable/sysfs-driver-mlxreg-io index 156319fc5b80..3544968f43cc 100644 --- a/Documentation/ABI/stable/sysfs-driver-mlxreg-io +++ b/Documentation/ABI/stable/sysfs-driver-mlxreg-io | |||
@@ -1,5 +1,4 @@ | |||
1 | What: /sys/devices/platform/mlxplat/mlxreg-io/hwmon/hwmon*/ | 1 | What: /sys/devices/platform/mlxplat/mlxreg-io/hwmon/hwmon*/asic_health |
2 | asic_health | ||
3 | 2 | ||
4 | Date: June 2018 | 3 | Date: June 2018 |
5 | KernelVersion: 4.19 | 4 | KernelVersion: 4.19 |
@@ -9,9 +8,8 @@ Description: This file shows ASIC health status. The possible values are: | |||
9 | 8 | ||
10 | The files are read only. | 9 | The files are read only. |
11 | 10 | ||
12 | What: /sys/devices/platform/mlxplat/mlxreg-io/hwmon/hwmon*/ | 11 | What: /sys/devices/platform/mlxplat/mlxreg-io/hwmon/hwmon*/cpld1_version |
13 | cpld1_version | 12 | What: /sys/devices/platform/mlxplat/mlxreg-io/hwmon/hwmon*/cpld2_version |
14 | cpld2_version | ||
15 | Date: June 2018 | 13 | Date: June 2018 |
16 | KernelVersion: 4.19 | 14 | KernelVersion: 4.19 |
17 | Contact: Vadim Pasternak <vadimpmellanox.com> | 15 | Contact: Vadim Pasternak <vadimpmellanox.com> |
@@ -20,8 +18,7 @@ Description: These files show with which CPLD versions have been burned | |||
20 | 18 | ||
21 | The files are read only. | 19 | The files are read only. |
22 | 20 | ||
23 | What: /sys/devices/platform/mlxplat/mlxreg-io/hwmon/hwmon*/ | 21 | What: /sys/devices/platform/mlxplat/mlxreg-io/hwmon/hwmon*/fan_dir |
24 | fan_dir | ||
25 | 22 | ||
26 | Date: December 2018 | 23 | Date: December 2018 |
27 | KernelVersion: 5.0 | 24 | KernelVersion: 5.0 |
@@ -32,8 +29,7 @@ Description: This file shows the system fans direction: | |||
32 | 29 | ||
33 | The files are read only. | 30 | The files are read only. |
34 | 31 | ||
35 | What: /sys/devices/platform/mlxplat/mlxreg-io/hwmon/hwmon*/ | 32 | What: /sys/devices/platform/mlxplat/mlxreg-io/hwmon/hwmon*/jtag_enable |
36 | jtag_enable | ||
37 | 33 | ||
38 | Date: November 2018 | 34 | Date: November 2018 |
39 | KernelVersion: 5.0 | 35 | KernelVersion: 5.0 |
@@ -43,8 +39,7 @@ Description: These files show with which CPLD versions have been burned | |||
43 | 39 | ||
44 | The files are read only. | 40 | The files are read only. |
45 | 41 | ||
46 | What: /sys/devices/platform/mlxplat/mlxreg-io/hwmon/hwmon*/ | 42 | What: /sys/devices/platform/mlxplat/mlxreg-io/hwmon/hwmon*/jtag_enable |
47 | jtag_enable | ||
48 | 43 | ||
49 | Date: November 2018 | 44 | Date: November 2018 |
50 | KernelVersion: 5.0 | 45 | KernelVersion: 5.0 |
@@ -87,16 +82,15 @@ Description: These files allow asserting system power cycling, switching | |||
87 | 82 | ||
88 | The files are write only. | 83 | The files are write only. |
89 | 84 | ||
90 | What: /sys/devices/platform/mlxplat/mlxreg-io/hwmon/hwmon*/ | 85 | What: /sys/devices/platform/mlxplat/mlxreg-io/hwmon/hwmon*/reset_aux_pwr_or_ref |
91 | reset_aux_pwr_or_ref | 86 | What: /sys/devices/platform/mlxplat/mlxreg-io/hwmon/hwmon*/reset_asic_thermal |
92 | reset_asic_thermal | 87 | What: /sys/devices/platform/mlxplat/mlxreg-io/hwmon/hwmon*/reset_hotswap_or_halt |
93 | reset_hotswap_or_halt | 88 | What: /sys/devices/platform/mlxplat/mlxreg-io/hwmon/hwmon*/reset_hotswap_or_wd |
94 | reset_hotswap_or_wd | 89 | What: /sys/devices/platform/mlxplat/mlxreg-io/hwmon/hwmon*/reset_fw_reset |
95 | reset_fw_reset | 90 | What: /sys/devices/platform/mlxplat/mlxreg-io/hwmon/hwmon*/reset_long_pb |
96 | reset_long_pb | 91 | What: /sys/devices/platform/mlxplat/mlxreg-io/hwmon/hwmon*/reset_main_pwr_fail |
97 | reset_main_pwr_fail | 92 | What: /sys/devices/platform/mlxplat/mlxreg-io/hwmon/hwmon*/reset_short_pb |
98 | reset_short_pb | 93 | What: /sys/devices/platform/mlxplat/mlxreg-io/hwmon/hwmon*/reset_sw_reset |
99 | reset_sw_reset | ||
100 | Date: June 2018 | 94 | Date: June 2018 |
101 | KernelVersion: 4.19 | 95 | KernelVersion: 4.19 |
102 | Contact: Vadim Pasternak <vadimpmellanox.com> | 96 | Contact: Vadim Pasternak <vadimpmellanox.com> |
@@ -110,11 +104,10 @@ Description: These files show the system reset cause, as following: power | |||
110 | 104 | ||
111 | The files are read only. | 105 | The files are read only. |
112 | 106 | ||
113 | What: /sys/devices/platform/mlxplat/mlxreg-io/hwmon/hwmon*/ | 107 | What: /sys/devices/platform/mlxplat/mlxreg-io/hwmon/hwmon*/reset_comex_pwr_fail |
114 | reset_comex_pwr_fail | 108 | What: /sys/devices/platform/mlxplat/mlxreg-io/hwmon/hwmon*/reset_from_comex |
115 | reset_from_comex | 109 | What: /sys/devices/platform/mlxplat/mlxreg-io/hwmon/hwmon*/reset_system |
116 | reset_system | 110 | What: /sys/devices/platform/mlxplat/mlxreg-io/hwmon/hwmon*/reset_voltmon_upgrade_fail |
117 | reset_voltmon_upgrade_fail | ||
118 | 111 | ||
119 | Date: November 2018 | 112 | Date: November 2018 |
120 | KernelVersion: 5.0 | 113 | KernelVersion: 5.0 |
diff --git a/Documentation/ABI/testing/pstore b/Documentation/ABI/testing/pstore index 5fca9f5e10a3..d45209abdb1b 100644 --- a/Documentation/ABI/testing/pstore +++ b/Documentation/ABI/testing/pstore | |||
@@ -1,6 +1,6 @@ | |||
1 | Where: /sys/fs/pstore/... (or /dev/pstore/...) | 1 | What: /sys/fs/pstore/... (or /dev/pstore/...) |
2 | Date: March 2011 | 2 | Date: March 2011 |
3 | Kernel Version: 2.6.39 | 3 | KernelVersion: 2.6.39 |
4 | Contact: tony.luck@intel.com | 4 | Contact: tony.luck@intel.com |
5 | Description: Generic interface to platform dependent persistent storage. | 5 | Description: Generic interface to platform dependent persistent storage. |
6 | 6 | ||
diff --git a/Documentation/ABI/testing/sysfs-bus-event_source-devices-format b/Documentation/ABI/testing/sysfs-bus-event_source-devices-format index 77f47ff5ee02..5bb793ec926c 100644 --- a/Documentation/ABI/testing/sysfs-bus-event_source-devices-format +++ b/Documentation/ABI/testing/sysfs-bus-event_source-devices-format | |||
@@ -1,6 +1,6 @@ | |||
1 | Where: /sys/bus/event_source/devices/<dev>/format | 1 | What: /sys/bus/event_source/devices/<dev>/format |
2 | Date: January 2012 | 2 | Date: January 2012 |
3 | Kernel Version: 3.3 | 3 | KernelVersion: 3.3 |
4 | Contact: Jiri Olsa <jolsa@redhat.com> | 4 | Contact: Jiri Olsa <jolsa@redhat.com> |
5 | Description: | 5 | Description: |
6 | Attribute group to describe the magic bits that go into | 6 | Attribute group to describe the magic bits that go into |
diff --git a/Documentation/ABI/testing/sysfs-bus-i2c-devices-hm6352 b/Documentation/ABI/testing/sysfs-bus-i2c-devices-hm6352 index feb2e4a87075..4a251b7f11e4 100644 --- a/Documentation/ABI/testing/sysfs-bus-i2c-devices-hm6352 +++ b/Documentation/ABI/testing/sysfs-bus-i2c-devices-hm6352 | |||
@@ -1,20 +1,20 @@ | |||
1 | Where: /sys/bus/i2c/devices/.../heading0_input | 1 | What: /sys/bus/i2c/devices/.../heading0_input |
2 | Date: April 2010 | 2 | Date: April 2010 |
3 | Kernel Version: 2.6.36? | 3 | KernelVersion: 2.6.36? |
4 | Contact: alan.cox@intel.com | 4 | Contact: alan.cox@intel.com |
5 | Description: Reports the current heading from the compass as a floating | 5 | Description: Reports the current heading from the compass as a floating |
6 | point value in degrees. | 6 | point value in degrees. |
7 | 7 | ||
8 | Where: /sys/bus/i2c/devices/.../power_state | 8 | What: /sys/bus/i2c/devices/.../power_state |
9 | Date: April 2010 | 9 | Date: April 2010 |
10 | Kernel Version: 2.6.36? | 10 | KernelVersion: 2.6.36? |
11 | Contact: alan.cox@intel.com | 11 | Contact: alan.cox@intel.com |
12 | Description: Sets the power state of the device. 0 sets the device into | 12 | Description: Sets the power state of the device. 0 sets the device into |
13 | sleep mode, 1 wakes it up. | 13 | sleep mode, 1 wakes it up. |
14 | 14 | ||
15 | Where: /sys/bus/i2c/devices/.../calibration | 15 | What: /sys/bus/i2c/devices/.../calibration |
16 | Date: April 2010 | 16 | Date: April 2010 |
17 | Kernel Version: 2.6.36? | 17 | KernelVersion: 2.6.36? |
18 | Contact: alan.cox@intel.com | 18 | Contact: alan.cox@intel.com |
19 | Description: Sets the calibration on or off (1 = on, 0 = off). See the | 19 | Description: Sets the calibration on or off (1 = on, 0 = off). See the |
20 | chip data sheet. | 20 | chip data sheet. |
diff --git a/Documentation/ABI/testing/sysfs-bus-iio-distance-srf08 b/Documentation/ABI/testing/sysfs-bus-iio-distance-srf08 index 0a1ca1487fa9..a133fd8d081a 100644 --- a/Documentation/ABI/testing/sysfs-bus-iio-distance-srf08 +++ b/Documentation/ABI/testing/sysfs-bus-iio-distance-srf08 | |||
@@ -1,4 +1,4 @@ | |||
1 | What /sys/bus/iio/devices/iio:deviceX/sensor_sensitivity | 1 | What: /sys/bus/iio/devices/iio:deviceX/sensor_sensitivity |
2 | Date: January 2017 | 2 | Date: January 2017 |
3 | KernelVersion: 4.11 | 3 | KernelVersion: 4.11 |
4 | Contact: linux-iio@vger.kernel.org | 4 | Contact: linux-iio@vger.kernel.org |
@@ -6,7 +6,7 @@ Description: | |||
6 | Show or set the gain boost of the amp, from 0-31 range. | 6 | Show or set the gain boost of the amp, from 0-31 range. |
7 | default 31 | 7 | default 31 |
8 | 8 | ||
9 | What /sys/bus/iio/devices/iio:deviceX/sensor_max_range | 9 | What: /sys/bus/iio/devices/iio:deviceX/sensor_max_range |
10 | Date: January 2017 | 10 | Date: January 2017 |
11 | KernelVersion: 4.11 | 11 | KernelVersion: 4.11 |
12 | Contact: linux-iio@vger.kernel.org | 12 | Contact: linux-iio@vger.kernel.org |
diff --git a/Documentation/ABI/testing/sysfs-bus-iio-proximity-as3935 b/Documentation/ABI/testing/sysfs-bus-iio-proximity-as3935 index 9a17ab5036a4..c59d95346341 100644 --- a/Documentation/ABI/testing/sysfs-bus-iio-proximity-as3935 +++ b/Documentation/ABI/testing/sysfs-bus-iio-proximity-as3935 | |||
@@ -1,4 +1,4 @@ | |||
1 | What /sys/bus/iio/devices/iio:deviceX/in_proximity_input | 1 | What: /sys/bus/iio/devices/iio:deviceX/in_proximity_input |
2 | Date: March 2014 | 2 | Date: March 2014 |
3 | KernelVersion: 3.15 | 3 | KernelVersion: 3.15 |
4 | Contact: Matt Ranostay <matt.ranostay@konsulko.com> | 4 | Contact: Matt Ranostay <matt.ranostay@konsulko.com> |
@@ -6,7 +6,7 @@ Description: | |||
6 | Get the current distance in meters of storm (1km steps) | 6 | Get the current distance in meters of storm (1km steps) |
7 | 1000-40000 = distance in meters | 7 | 1000-40000 = distance in meters |
8 | 8 | ||
9 | What /sys/bus/iio/devices/iio:deviceX/sensor_sensitivity | 9 | What: /sys/bus/iio/devices/iio:deviceX/sensor_sensitivity |
10 | Date: March 2014 | 10 | Date: March 2014 |
11 | KernelVersion: 3.15 | 11 | KernelVersion: 3.15 |
12 | Contact: Matt Ranostay <matt.ranostay@konsulko.com> | 12 | Contact: Matt Ranostay <matt.ranostay@konsulko.com> |
diff --git a/Documentation/ABI/testing/sysfs-bus-pci-devices-aer_stats b/Documentation/ABI/testing/sysfs-bus-pci-devices-aer_stats index 4b0318c99507..3c9a8c4a25eb 100644 --- a/Documentation/ABI/testing/sysfs-bus-pci-devices-aer_stats +++ b/Documentation/ABI/testing/sysfs-bus-pci-devices-aer_stats | |||
@@ -9,9 +9,9 @@ errors may be "seen" / reported by the link partner and not the | |||
9 | problematic endpoint itself (which may report all counters as 0 as it never | 9 | problematic endpoint itself (which may report all counters as 0 as it never |
10 | saw any problems). | 10 | saw any problems). |
11 | 11 | ||
12 | Where: /sys/bus/pci/devices/<dev>/aer_dev_correctable | 12 | What: /sys/bus/pci/devices/<dev>/aer_dev_correctable |
13 | Date: July 2018 | 13 | Date: July 2018 |
14 | Kernel Version: 4.19.0 | 14 | KernelVersion: 4.19.0 |
15 | Contact: linux-pci@vger.kernel.org, rajatja@google.com | 15 | Contact: linux-pci@vger.kernel.org, rajatja@google.com |
16 | Description: List of correctable errors seen and reported by this | 16 | Description: List of correctable errors seen and reported by this |
17 | PCI device using ERR_COR. Note that since multiple errors may | 17 | PCI device using ERR_COR. Note that since multiple errors may |
@@ -31,9 +31,9 @@ Header Log Overflow 0 | |||
31 | TOTAL_ERR_COR 2 | 31 | TOTAL_ERR_COR 2 |
32 | ------------------------------------------------------------------------- | 32 | ------------------------------------------------------------------------- |
33 | 33 | ||
34 | Where: /sys/bus/pci/devices/<dev>/aer_dev_fatal | 34 | What: /sys/bus/pci/devices/<dev>/aer_dev_fatal |
35 | Date: July 2018 | 35 | Date: July 2018 |
36 | Kernel Version: 4.19.0 | 36 | KernelVersion: 4.19.0 |
37 | Contact: linux-pci@vger.kernel.org, rajatja@google.com | 37 | Contact: linux-pci@vger.kernel.org, rajatja@google.com |
38 | Description: List of uncorrectable fatal errors seen and reported by this | 38 | Description: List of uncorrectable fatal errors seen and reported by this |
39 | PCI device using ERR_FATAL. Note that since multiple errors may | 39 | PCI device using ERR_FATAL. Note that since multiple errors may |
@@ -62,9 +62,9 @@ TLP Prefix Blocked Error 0 | |||
62 | TOTAL_ERR_FATAL 0 | 62 | TOTAL_ERR_FATAL 0 |
63 | ------------------------------------------------------------------------- | 63 | ------------------------------------------------------------------------- |
64 | 64 | ||
65 | Where: /sys/bus/pci/devices/<dev>/aer_dev_nonfatal | 65 | What: /sys/bus/pci/devices/<dev>/aer_dev_nonfatal |
66 | Date: July 2018 | 66 | Date: July 2018 |
67 | Kernel Version: 4.19.0 | 67 | KernelVersion: 4.19.0 |
68 | Contact: linux-pci@vger.kernel.org, rajatja@google.com | 68 | Contact: linux-pci@vger.kernel.org, rajatja@google.com |
69 | Description: List of uncorrectable nonfatal errors seen and reported by this | 69 | Description: List of uncorrectable nonfatal errors seen and reported by this |
70 | PCI device using ERR_NONFATAL. Note that since multiple errors | 70 | PCI device using ERR_NONFATAL. Note that since multiple errors |
@@ -103,20 +103,20 @@ collectors) that are AER capable. These indicate the number of error messages as | |||
103 | device, so these counters include them and are thus cumulative of all the error | 103 | device, so these counters include them and are thus cumulative of all the error |
104 | messages on the PCI hierarchy originating at that root port. | 104 | messages on the PCI hierarchy originating at that root port. |
105 | 105 | ||
106 | Where: /sys/bus/pci/devices/<dev>/aer_stats/aer_rootport_total_err_cor | 106 | What: /sys/bus/pci/devices/<dev>/aer_stats/aer_rootport_total_err_cor |
107 | Date: July 2018 | 107 | Date: July 2018 |
108 | Kernel Version: 4.19.0 | 108 | KernelVersion: 4.19.0 |
109 | Contact: linux-pci@vger.kernel.org, rajatja@google.com | 109 | Contact: linux-pci@vger.kernel.org, rajatja@google.com |
110 | Description: Total number of ERR_COR messages reported to rootport. | 110 | Description: Total number of ERR_COR messages reported to rootport. |
111 | 111 | ||
112 | Where: /sys/bus/pci/devices/<dev>/aer_stats/aer_rootport_total_err_fatal | 112 | What: /sys/bus/pci/devices/<dev>/aer_stats/aer_rootport_total_err_fatal |
113 | Date: July 2018 | 113 | Date: July 2018 |
114 | Kernel Version: 4.19.0 | 114 | KernelVersion: 4.19.0 |
115 | Contact: linux-pci@vger.kernel.org, rajatja@google.com | 115 | Contact: linux-pci@vger.kernel.org, rajatja@google.com |
116 | Description: Total number of ERR_FATAL messages reported to rootport. | 116 | Description: Total number of ERR_FATAL messages reported to rootport. |
117 | 117 | ||
118 | Where: /sys/bus/pci/devices/<dev>/aer_stats/aer_rootport_total_err_nonfatal | 118 | What: /sys/bus/pci/devices/<dev>/aer_stats/aer_rootport_total_err_nonfatal |
119 | Date: July 2018 | 119 | Date: July 2018 |
120 | Kernel Version: 4.19.0 | 120 | KernelVersion: 4.19.0 |
121 | Contact: linux-pci@vger.kernel.org, rajatja@google.com | 121 | Contact: linux-pci@vger.kernel.org, rajatja@google.com |
122 | Description: Total number of ERR_NONFATAL messages reported to rootport. | 122 | Description: Total number of ERR_NONFATAL messages reported to rootport. |
diff --git a/Documentation/ABI/testing/sysfs-bus-pci-devices-cciss b/Documentation/ABI/testing/sysfs-bus-pci-devices-cciss index 53d99edd1d75..92a94e1068c2 100644 --- a/Documentation/ABI/testing/sysfs-bus-pci-devices-cciss +++ b/Documentation/ABI/testing/sysfs-bus-pci-devices-cciss | |||
@@ -1,68 +1,68 @@ | |||
1 | Where: /sys/bus/pci/devices/<dev>/ccissX/cXdY/model | 1 | What: /sys/bus/pci/devices/<dev>/ccissX/cXdY/model |
2 | Date: March 2009 | 2 | Date: March 2009 |
3 | Kernel Version: 2.6.30 | 3 | KernelVersion: 2.6.30 |
4 | Contact: iss_storagedev@hp.com | 4 | Contact: iss_storagedev@hp.com |
5 | Description: Displays the SCSI INQUIRY page 0 model for logical drive | 5 | Description: Displays the SCSI INQUIRY page 0 model for logical drive |
6 | Y of controller X. | 6 | Y of controller X. |
7 | 7 | ||
8 | Where: /sys/bus/pci/devices/<dev>/ccissX/cXdY/rev | 8 | What: /sys/bus/pci/devices/<dev>/ccissX/cXdY/rev |
9 | Date: March 2009 | 9 | Date: March 2009 |
10 | Kernel Version: 2.6.30 | 10 | KernelVersion: 2.6.30 |
11 | Contact: iss_storagedev@hp.com | 11 | Contact: iss_storagedev@hp.com |
12 | Description: Displays the SCSI INQUIRY page 0 revision for logical | 12 | Description: Displays the SCSI INQUIRY page 0 revision for logical |
13 | drive Y of controller X. | 13 | drive Y of controller X. |
14 | 14 | ||
15 | Where: /sys/bus/pci/devices/<dev>/ccissX/cXdY/unique_id | 15 | What: /sys/bus/pci/devices/<dev>/ccissX/cXdY/unique_id |
16 | Date: March 2009 | 16 | Date: March 2009 |
17 | Kernel Version: 2.6.30 | 17 | KernelVersion: 2.6.30 |
18 | Contact: iss_storagedev@hp.com | 18 | Contact: iss_storagedev@hp.com |
19 | Description: Displays the SCSI INQUIRY page 83 serial number for logical | 19 | Description: Displays the SCSI INQUIRY page 83 serial number for logical |
20 | drive Y of controller X. | 20 | drive Y of controller X. |
21 | 21 | ||
22 | Where: /sys/bus/pci/devices/<dev>/ccissX/cXdY/vendor | 22 | What: /sys/bus/pci/devices/<dev>/ccissX/cXdY/vendor |
23 | Date: March 2009 | 23 | Date: March 2009 |
24 | Kernel Version: 2.6.30 | 24 | KernelVersion: 2.6.30 |
25 | Contact: iss_storagedev@hp.com | 25 | Contact: iss_storagedev@hp.com |
26 | Description: Displays the SCSI INQUIRY page 0 vendor for logical drive | 26 | Description: Displays the SCSI INQUIRY page 0 vendor for logical drive |
27 | Y of controller X. | 27 | Y of controller X. |
28 | 28 | ||
29 | Where: /sys/bus/pci/devices/<dev>/ccissX/cXdY/block:cciss!cXdY | 29 | What: /sys/bus/pci/devices/<dev>/ccissX/cXdY/block:cciss!cXdY |
30 | Date: March 2009 | 30 | Date: March 2009 |
31 | Kernel Version: 2.6.30 | 31 | KernelVersion: 2.6.30 |
32 | Contact: iss_storagedev@hp.com | 32 | Contact: iss_storagedev@hp.com |
33 | Description: A symbolic link to /sys/block/cciss!cXdY | 33 | Description: A symbolic link to /sys/block/cciss!cXdY |
34 | 34 | ||
35 | Where: /sys/bus/pci/devices/<dev>/ccissX/rescan | 35 | What: /sys/bus/pci/devices/<dev>/ccissX/rescan |
36 | Date: August 2009 | 36 | Date: August 2009 |
37 | Kernel Version: 2.6.31 | 37 | KernelVersion: 2.6.31 |
38 | Contact: iss_storagedev@hp.com | 38 | Contact: iss_storagedev@hp.com |
39 | Description: Kicks of a rescan of the controller to discover logical | 39 | Description: Kicks of a rescan of the controller to discover logical |
40 | drive topology changes. | 40 | drive topology changes. |
41 | 41 | ||
42 | Where: /sys/bus/pci/devices/<dev>/ccissX/cXdY/lunid | 42 | What: /sys/bus/pci/devices/<dev>/ccissX/cXdY/lunid |
43 | Date: August 2009 | 43 | Date: August 2009 |
44 | Kernel Version: 2.6.31 | 44 | KernelVersion: 2.6.31 |
45 | Contact: iss_storagedev@hp.com | 45 | Contact: iss_storagedev@hp.com |
46 | Description: Displays the 8-byte LUN ID used to address logical | 46 | Description: Displays the 8-byte LUN ID used to address logical |
47 | drive Y of controller X. | 47 | drive Y of controller X. |
48 | 48 | ||
49 | Where: /sys/bus/pci/devices/<dev>/ccissX/cXdY/raid_level | 49 | What: /sys/bus/pci/devices/<dev>/ccissX/cXdY/raid_level |
50 | Date: August 2009 | 50 | Date: August 2009 |
51 | Kernel Version: 2.6.31 | 51 | KernelVersion: 2.6.31 |
52 | Contact: iss_storagedev@hp.com | 52 | Contact: iss_storagedev@hp.com |
53 | Description: Displays the RAID level of logical drive Y of | 53 | Description: Displays the RAID level of logical drive Y of |
54 | controller X. | 54 | controller X. |
55 | 55 | ||
56 | Where: /sys/bus/pci/devices/<dev>/ccissX/cXdY/usage_count | 56 | What: /sys/bus/pci/devices/<dev>/ccissX/cXdY/usage_count |
57 | Date: August 2009 | 57 | Date: August 2009 |
58 | Kernel Version: 2.6.31 | 58 | KernelVersion: 2.6.31 |
59 | Contact: iss_storagedev@hp.com | 59 | Contact: iss_storagedev@hp.com |
60 | Description: Displays the usage count (number of opens) of logical drive Y | 60 | Description: Displays the usage count (number of opens) of logical drive Y |
61 | of controller X. | 61 | of controller X. |
62 | 62 | ||
63 | Where: /sys/bus/pci/devices/<dev>/ccissX/resettable | 63 | What: /sys/bus/pci/devices/<dev>/ccissX/resettable |
64 | Date: February 2011 | 64 | Date: February 2011 |
65 | Kernel Version: 2.6.38 | 65 | KernelVersion: 2.6.38 |
66 | Contact: iss_storagedev@hp.com | 66 | Contact: iss_storagedev@hp.com |
67 | Description: Value of 1 indicates the controller can honor the reset_devices | 67 | Description: Value of 1 indicates the controller can honor the reset_devices |
68 | kernel parameter. Value of 0 indicates reset_devices cannot be | 68 | kernel parameter. Value of 0 indicates reset_devices cannot be |
@@ -71,9 +71,9 @@ Description: Value of 1 indicates the controller can honor the reset_devices | |||
71 | a dump device, as kdump requires resetting the device in order | 71 | a dump device, as kdump requires resetting the device in order |
72 | to work reliably. | 72 | to work reliably. |
73 | 73 | ||
74 | Where: /sys/bus/pci/devices/<dev>/ccissX/transport_mode | 74 | What: /sys/bus/pci/devices/<dev>/ccissX/transport_mode |
75 | Date: July 2011 | 75 | Date: July 2011 |
76 | Kernel Version: 3.0 | 76 | KernelVersion: 3.0 |
77 | Contact: iss_storagedev@hp.com | 77 | Contact: iss_storagedev@hp.com |
78 | Description: Value of "simple" indicates that the controller has been placed | 78 | Description: Value of "simple" indicates that the controller has been placed |
79 | in "simple mode". Value of "performant" indicates that the | 79 | in "simple mode". Value of "performant" indicates that the |
diff --git a/Documentation/ABI/testing/sysfs-bus-usb-devices-usbsevseg b/Documentation/ABI/testing/sysfs-bus-usb-devices-usbsevseg index 70d00dfa443d..9ade80f81f96 100644 --- a/Documentation/ABI/testing/sysfs-bus-usb-devices-usbsevseg +++ b/Documentation/ABI/testing/sysfs-bus-usb-devices-usbsevseg | |||
@@ -1,14 +1,14 @@ | |||
1 | Where: /sys/bus/usb/.../powered | 1 | What: /sys/bus/usb/.../powered |
2 | Date: August 2008 | 2 | Date: August 2008 |
3 | Kernel Version: 2.6.26 | 3 | KernelVersion: 2.6.26 |
4 | Contact: Harrison Metzger <harrisonmetz@gmail.com> | 4 | Contact: Harrison Metzger <harrisonmetz@gmail.com> |
5 | Description: Controls whether the device's display will powered. | 5 | Description: Controls whether the device's display will powered. |
6 | A value of 0 is off and a non-zero value is on. | 6 | A value of 0 is off and a non-zero value is on. |
7 | 7 | ||
8 | Where: /sys/bus/usb/.../mode_msb | 8 | What: /sys/bus/usb/.../mode_msb |
9 | Where: /sys/bus/usb/.../mode_lsb | 9 | What: /sys/bus/usb/.../mode_lsb |
10 | Date: August 2008 | 10 | Date: August 2008 |
11 | Kernel Version: 2.6.26 | 11 | KernelVersion: 2.6.26 |
12 | Contact: Harrison Metzger <harrisonmetz@gmail.com> | 12 | Contact: Harrison Metzger <harrisonmetz@gmail.com> |
13 | Description: Controls the devices display mode. | 13 | Description: Controls the devices display mode. |
14 | For a 6 character display the values are | 14 | For a 6 character display the values are |
@@ -16,24 +16,24 @@ Description: Controls the devices display mode. | |||
16 | for an 8 character display the values are | 16 | for an 8 character display the values are |
17 | MSB 0x08; LSB 0xFF. | 17 | MSB 0x08; LSB 0xFF. |
18 | 18 | ||
19 | Where: /sys/bus/usb/.../textmode | 19 | What: /sys/bus/usb/.../textmode |
20 | Date: August 2008 | 20 | Date: August 2008 |
21 | Kernel Version: 2.6.26 | 21 | KernelVersion: 2.6.26 |
22 | Contact: Harrison Metzger <harrisonmetz@gmail.com> | 22 | Contact: Harrison Metzger <harrisonmetz@gmail.com> |
23 | Description: Controls the way the device interprets its text buffer. | 23 | Description: Controls the way the device interprets its text buffer. |
24 | raw: each character controls its segment manually | 24 | raw: each character controls its segment manually |
25 | hex: each character is between 0-15 | 25 | hex: each character is between 0-15 |
26 | ascii: each character is between '0'-'9' and 'A'-'F'. | 26 | ascii: each character is between '0'-'9' and 'A'-'F'. |
27 | 27 | ||
28 | Where: /sys/bus/usb/.../text | 28 | What: /sys/bus/usb/.../text |
29 | Date: August 2008 | 29 | Date: August 2008 |
30 | Kernel Version: 2.6.26 | 30 | KernelVersion: 2.6.26 |
31 | Contact: Harrison Metzger <harrisonmetz@gmail.com> | 31 | Contact: Harrison Metzger <harrisonmetz@gmail.com> |
32 | Description: The text (or data) for the device to display | 32 | Description: The text (or data) for the device to display |
33 | 33 | ||
34 | Where: /sys/bus/usb/.../decimals | 34 | What: /sys/bus/usb/.../decimals |
35 | Date: August 2008 | 35 | Date: August 2008 |
36 | Kernel Version: 2.6.26 | 36 | KernelVersion: 2.6.26 |
37 | Contact: Harrison Metzger <harrisonmetz@gmail.com> | 37 | Contact: Harrison Metzger <harrisonmetz@gmail.com> |
38 | Description: Controls the decimal places on the device. | 38 | Description: Controls the decimal places on the device. |
39 | To set the nth decimal place, give this field | 39 | To set the nth decimal place, give this field |
diff --git a/Documentation/ABI/testing/sysfs-class-backlight-driver-lm3533 b/Documentation/ABI/testing/sysfs-class-backlight-driver-lm3533 index 77cf7ac949af..c0e0a9ae7b3d 100644 --- a/Documentation/ABI/testing/sysfs-class-backlight-driver-lm3533 +++ b/Documentation/ABI/testing/sysfs-class-backlight-driver-lm3533 | |||
@@ -4,7 +4,7 @@ KernelVersion: 3.5 | |||
4 | Contact: Johan Hovold <jhovold@gmail.com> | 4 | Contact: Johan Hovold <jhovold@gmail.com> |
5 | Description: | 5 | Description: |
6 | Get the ALS output channel used as input in | 6 | Get the ALS output channel used as input in |
7 | ALS-current-control mode (0, 1), where | 7 | ALS-current-control mode (0, 1), where: |
8 | 8 | ||
9 | 0 - out_current0 (backlight 0) | 9 | 0 - out_current0 (backlight 0) |
10 | 1 - out_current1 (backlight 1) | 10 | 1 - out_current1 (backlight 1) |
@@ -28,7 +28,7 @@ Date: April 2012 | |||
28 | KernelVersion: 3.5 | 28 | KernelVersion: 3.5 |
29 | Contact: Johan Hovold <jhovold@gmail.com> | 29 | Contact: Johan Hovold <jhovold@gmail.com> |
30 | Description: | 30 | Description: |
31 | Set the brightness-mapping mode (0, 1), where | 31 | Set the brightness-mapping mode (0, 1), where: |
32 | 32 | ||
33 | 0 - exponential mode | 33 | 0 - exponential mode |
34 | 1 - linear mode | 34 | 1 - linear mode |
@@ -38,7 +38,7 @@ Date: April 2012 | |||
38 | KernelVersion: 3.5 | 38 | KernelVersion: 3.5 |
39 | Contact: Johan Hovold <jhovold@gmail.com> | 39 | Contact: Johan Hovold <jhovold@gmail.com> |
40 | Description: | 40 | Description: |
41 | Set the PWM-input control mask (5 bits), where | 41 | Set the PWM-input control mask (5 bits), where: |
42 | 42 | ||
43 | bit 5 - PWM-input enabled in Zone 4 | 43 | bit 5 - PWM-input enabled in Zone 4 |
44 | bit 4 - PWM-input enabled in Zone 3 | 44 | bit 4 - PWM-input enabled in Zone 3 |
diff --git a/Documentation/ABI/testing/sysfs-class-cxl b/Documentation/ABI/testing/sysfs-class-cxl index bbbabffc682a..7970e3713e70 100644 --- a/Documentation/ABI/testing/sysfs-class-cxl +++ b/Documentation/ABI/testing/sysfs-class-cxl | |||
@@ -1,6 +1,6 @@ | |||
1 | Note: Attributes that are shared between devices are stored in the directory | 1 | Please note that attributes that are shared between devices are stored in |
2 | pointed to by the symlink device/. | 2 | the directory pointed to by the symlink device/. |
3 | Example: The real path of the attribute /sys/class/cxl/afu0.0s/irqs_max is | 3 | For example, the real path of the attribute /sys/class/cxl/afu0.0s/irqs_max is |
4 | /sys/class/cxl/afu0.0s/device/irqs_max, i.e. /sys/class/cxl/afu0.0/irqs_max. | 4 | /sys/class/cxl/afu0.0s/device/irqs_max, i.e. /sys/class/cxl/afu0.0/irqs_max. |
5 | 5 | ||
6 | 6 | ||
diff --git a/Documentation/ABI/testing/sysfs-class-devfreq b/Documentation/ABI/testing/sysfs-class-devfreq index ee39acacf6f8..01196e19afca 100644 --- a/Documentation/ABI/testing/sysfs-class-devfreq +++ b/Documentation/ABI/testing/sysfs-class-devfreq | |||
@@ -47,7 +47,7 @@ Description: | |||
47 | What: /sys/class/devfreq/.../trans_stat | 47 | What: /sys/class/devfreq/.../trans_stat |
48 | Date: October 2012 | 48 | Date: October 2012 |
49 | Contact: MyungJoo Ham <myungjoo.ham@samsung.com> | 49 | Contact: MyungJoo Ham <myungjoo.ham@samsung.com> |
50 | Descrtiption: | 50 | Description: |
51 | This ABI shows the statistics of devfreq behavior on a | 51 | This ABI shows the statistics of devfreq behavior on a |
52 | specific device. It shows the time spent in each state and | 52 | specific device. It shows the time spent in each state and |
53 | the number of transitions between states. | 53 | the number of transitions between states. |
diff --git a/Documentation/ABI/testing/sysfs-class-led-driver-lm3533 b/Documentation/ABI/testing/sysfs-class-led-driver-lm3533 index 620ebb3b9baa..e4c89b261546 100644 --- a/Documentation/ABI/testing/sysfs-class-led-driver-lm3533 +++ b/Documentation/ABI/testing/sysfs-class-led-driver-lm3533 | |||
@@ -4,7 +4,7 @@ KernelVersion: 3.5 | |||
4 | Contact: Johan Hovold <jhovold@gmail.com> | 4 | Contact: Johan Hovold <jhovold@gmail.com> |
5 | Description: | 5 | Description: |
6 | Set the ALS output channel to use as input in | 6 | Set the ALS output channel to use as input in |
7 | ALS-current-control mode (1, 2), where | 7 | ALS-current-control mode (1, 2), where: |
8 | 8 | ||
9 | 1 - out_current1 | 9 | 1 - out_current1 |
10 | 2 - out_current2 | 10 | 2 - out_current2 |
@@ -22,7 +22,7 @@ Date: April 2012 | |||
22 | KernelVersion: 3.5 | 22 | KernelVersion: 3.5 |
23 | Contact: Johan Hovold <jhovold@gmail.com> | 23 | Contact: Johan Hovold <jhovold@gmail.com> |
24 | Description: | 24 | Description: |
25 | Set the pattern generator fall and rise times (0..7), where | 25 | Set the pattern generator fall and rise times (0..7), where: |
26 | 26 | ||
27 | 0 - 2048 us | 27 | 0 - 2048 us |
28 | 1 - 262 ms | 28 | 1 - 262 ms |
@@ -45,7 +45,7 @@ Date: April 2012 | |||
45 | KernelVersion: 3.5 | 45 | KernelVersion: 3.5 |
46 | Contact: Johan Hovold <jhovold@gmail.com> | 46 | Contact: Johan Hovold <jhovold@gmail.com> |
47 | Description: | 47 | Description: |
48 | Set the brightness-mapping mode (0, 1), where | 48 | Set the brightness-mapping mode (0, 1), where: |
49 | 49 | ||
50 | 0 - exponential mode | 50 | 0 - exponential mode |
51 | 1 - linear mode | 51 | 1 - linear mode |
@@ -55,7 +55,7 @@ Date: April 2012 | |||
55 | KernelVersion: 3.5 | 55 | KernelVersion: 3.5 |
56 | Contact: Johan Hovold <jhovold@gmail.com> | 56 | Contact: Johan Hovold <jhovold@gmail.com> |
57 | Description: | 57 | Description: |
58 | Set the PWM-input control mask (5 bits), where | 58 | Set the PWM-input control mask (5 bits), where: |
59 | 59 | ||
60 | bit 5 - PWM-input enabled in Zone 4 | 60 | bit 5 - PWM-input enabled in Zone 4 |
61 | bit 4 - PWM-input enabled in Zone 3 | 61 | bit 4 - PWM-input enabled in Zone 3 |
diff --git a/Documentation/ABI/testing/sysfs-class-leds-gt683r b/Documentation/ABI/testing/sysfs-class-leds-gt683r index e4fae6026e79..6adab27f646e 100644 --- a/Documentation/ABI/testing/sysfs-class-leds-gt683r +++ b/Documentation/ABI/testing/sysfs-class-leds-gt683r | |||
@@ -5,7 +5,7 @@ Contact: Janne Kanniainen <janne.kanniainen@gmail.com> | |||
5 | Description: | 5 | Description: |
6 | Set the mode of LEDs. You should notice that changing the mode | 6 | Set the mode of LEDs. You should notice that changing the mode |
7 | of one LED will update the mode of its two sibling devices as | 7 | of one LED will update the mode of its two sibling devices as |
8 | well. | 8 | well. Possible values are: |
9 | 9 | ||
10 | 0 - normal | 10 | 0 - normal |
11 | 1 - audio | 11 | 1 - audio |
@@ -13,4 +13,4 @@ Description: | |||
13 | 13 | ||
14 | Normal: LEDs are fully on when enabled | 14 | Normal: LEDs are fully on when enabled |
15 | Audio: LEDs brightness depends on sound level | 15 | Audio: LEDs brightness depends on sound level |
16 | Breathing: LEDs brightness varies at human breathing rate \ No newline at end of file | 16 | Breathing: LEDs brightness varies at human breathing rate |
diff --git a/Documentation/ABI/testing/sysfs-class-powercap b/Documentation/ABI/testing/sysfs-class-powercap index db3b3ff70d84..f333a0ccc29b 100644 --- a/Documentation/ABI/testing/sysfs-class-powercap +++ b/Documentation/ABI/testing/sysfs-class-powercap | |||
@@ -147,6 +147,6 @@ What: /sys/class/powercap/.../<power zone>/enabled | |||
147 | Date: September 2013 | 147 | Date: September 2013 |
148 | KernelVersion: 3.13 | 148 | KernelVersion: 3.13 |
149 | Contact: linux-pm@vger.kernel.org | 149 | Contact: linux-pm@vger.kernel.org |
150 | Description | 150 | Description: |
151 | This allows to enable/disable power capping at power zone level. | 151 | This allows to enable/disable power capping at power zone level. |
152 | This applies to current power zone and its children. | 152 | This applies to current power zone and its children. |
diff --git a/Documentation/ABI/testing/sysfs-class-uwb_rc b/Documentation/ABI/testing/sysfs-class-uwb_rc index 85f4875d16ac..a0578751c1e3 100644 --- a/Documentation/ABI/testing/sysfs-class-uwb_rc +++ b/Documentation/ABI/testing/sysfs-class-uwb_rc | |||
@@ -125,12 +125,6 @@ Description: | |||
125 | The EUI-48 of this device in colon separated hex | 125 | The EUI-48 of this device in colon separated hex |
126 | octets. | 126 | octets. |
127 | 127 | ||
128 | What: /sys/class/uwb_rc/uwbN/<EUI-48>/BPST | ||
129 | Date: July 2008 | ||
130 | KernelVersion: 2.6.27 | ||
131 | Contact: linux-usb@vger.kernel.org | ||
132 | Description: | ||
133 | |||
134 | What: /sys/class/uwb_rc/uwbN/<EUI-48>/IEs | 128 | What: /sys/class/uwb_rc/uwbN/<EUI-48>/IEs |
135 | Date: July 2008 | 129 | Date: July 2008 |
136 | KernelVersion: 2.6.27 | 130 | KernelVersion: 2.6.27 |
diff --git a/Documentation/ABI/testing/sysfs-driver-altera-cvp b/Documentation/ABI/testing/sysfs-driver-altera-cvp index 8cde64a71edb..fbd8078fd7ad 100644 --- a/Documentation/ABI/testing/sysfs-driver-altera-cvp +++ b/Documentation/ABI/testing/sysfs-driver-altera-cvp | |||
@@ -1,6 +1,6 @@ | |||
1 | What: /sys/bus/pci/drivers/altera-cvp/chkcfg | 1 | What: /sys/bus/pci/drivers/altera-cvp/chkcfg |
2 | Date: May 2017 | 2 | Date: May 2017 |
3 | Kernel Version: 4.13 | 3 | KernelVersion: 4.13 |
4 | Contact: Anatolij Gustschin <agust@denx.de> | 4 | Contact: Anatolij Gustschin <agust@denx.de> |
5 | Description: | 5 | Description: |
6 | Contains either 1 or 0 and controls if configuration | 6 | Contains either 1 or 0 and controls if configuration |
diff --git a/Documentation/ABI/testing/sysfs-driver-hid b/Documentation/ABI/testing/sysfs-driver-hid index 48942cacb0bf..a59533410871 100644 --- a/Documentation/ABI/testing/sysfs-driver-hid +++ b/Documentation/ABI/testing/sysfs-driver-hid | |||
@@ -1,6 +1,6 @@ | |||
1 | What: For USB devices : /sys/bus/usb/devices/<busnum>-<devnum>:<config num>.<interface num>/<hid-bus>:<vendor-id>:<product-id>.<num>/report_descriptor | 1 | What: /sys/bus/usb/devices/<busnum>-<devnum>:<config num>.<interface num>/<hid-bus>:<vendor-id>:<product-id>.<num>/report_descriptor |
2 | For BT devices : /sys/class/bluetooth/hci<addr>/<hid-bus>:<vendor-id>:<product-id>.<num>/report_descriptor | 2 | What: /sys/class/bluetooth/hci<addr>/<hid-bus>:<vendor-id>:<product-id>.<num>/report_descriptor |
3 | Symlink : /sys/class/hidraw/hidraw<num>/device/report_descriptor | 3 | What: /sys/class/hidraw/hidraw<num>/device/report_descriptor |
4 | Date: Jan 2011 | 4 | Date: Jan 2011 |
5 | KernelVersion: 2.0.39 | 5 | KernelVersion: 2.0.39 |
6 | Contact: Alan Ott <alan@signal11.us> | 6 | Contact: Alan Ott <alan@signal11.us> |
@@ -9,9 +9,9 @@ Description: When read, this file returns the device's raw binary HID | |||
9 | This file cannot be written. | 9 | This file cannot be written. |
10 | Users: HIDAPI library (http://www.signal11.us/oss/hidapi) | 10 | Users: HIDAPI library (http://www.signal11.us/oss/hidapi) |
11 | 11 | ||
12 | What: For USB devices : /sys/bus/usb/devices/<busnum>-<devnum>:<config num>.<interface num>/<hid-bus>:<vendor-id>:<product-id>.<num>/country | 12 | What: /sys/bus/usb/devices/<busnum>-<devnum>:<config num>.<interface num>/<hid-bus>:<vendor-id>:<product-id>.<num>/country |
13 | For BT devices : /sys/class/bluetooth/hci<addr>/<hid-bus>:<vendor-id>:<product-id>.<num>/country | 13 | What: /sys/class/bluetooth/hci<addr>/<hid-bus>:<vendor-id>:<product-id>.<num>/country |
14 | Symlink : /sys/class/hidraw/hidraw<num>/device/country | 14 | What: /sys/class/hidraw/hidraw<num>/device/country |
15 | Date: February 2015 | 15 | Date: February 2015 |
16 | KernelVersion: 3.19 | 16 | KernelVersion: 3.19 |
17 | Contact: Olivier Gay <ogay@logitech.com> | 17 | Contact: Olivier Gay <ogay@logitech.com> |
diff --git a/Documentation/ABI/testing/sysfs-driver-hid-roccat-kone b/Documentation/ABI/testing/sysfs-driver-hid-roccat-kone index 3ca3971109bf..8f7982c70d72 100644 --- a/Documentation/ABI/testing/sysfs-driver-hid-roccat-kone +++ b/Documentation/ABI/testing/sysfs-driver-hid-roccat-kone | |||
@@ -5,7 +5,7 @@ Description: It is possible to switch the dpi setting of the mouse with the | |||
5 | press of a button. | 5 | press of a button. |
6 | When read, this file returns the raw number of the actual dpi | 6 | When read, this file returns the raw number of the actual dpi |
7 | setting reported by the mouse. This number has to be further | 7 | setting reported by the mouse. This number has to be further |
8 | processed to receive the real dpi value. | 8 | processed to receive the real dpi value: |
9 | 9 | ||
10 | VALUE DPI | 10 | VALUE DPI |
11 | 1 800 | 11 | 1 800 |
diff --git a/Documentation/ABI/testing/sysfs-driver-ppi b/Documentation/ABI/testing/sysfs-driver-ppi index 9921ef285899..1a56fc507689 100644 --- a/Documentation/ABI/testing/sysfs-driver-ppi +++ b/Documentation/ABI/testing/sysfs-driver-ppi | |||
@@ -1,6 +1,6 @@ | |||
1 | What: /sys/class/tpm/tpmX/ppi/ | 1 | What: /sys/class/tpm/tpmX/ppi/ |
2 | Date: August 2012 | 2 | Date: August 2012 |
3 | Kernel Version: 3.6 | 3 | KernelVersion: 3.6 |
4 | Contact: xiaoyan.zhang@intel.com | 4 | Contact: xiaoyan.zhang@intel.com |
5 | Description: | 5 | Description: |
6 | This folder includes the attributes related with PPI (Physical | 6 | This folder includes the attributes related with PPI (Physical |
diff --git a/Documentation/ABI/testing/sysfs-driver-st b/Documentation/ABI/testing/sysfs-driver-st index ba5d77008a85..88cab66fd77f 100644 --- a/Documentation/ABI/testing/sysfs-driver-st +++ b/Documentation/ABI/testing/sysfs-driver-st | |||
@@ -1,6 +1,6 @@ | |||
1 | What: /sys/bus/scsi/drivers/st/debug_flag | 1 | What: /sys/bus/scsi/drivers/st/debug_flag |
2 | Date: October 2015 | 2 | Date: October 2015 |
3 | Kernel Version: ?.? | 3 | KernelVersion: ?.? |
4 | Contact: shane.seymour@hpe.com | 4 | Contact: shane.seymour@hpe.com |
5 | Description: | 5 | Description: |
6 | This file allows you to turn debug output from the st driver | 6 | This file allows you to turn debug output from the st driver |
diff --git a/Documentation/ABI/testing/sysfs-driver-wacom b/Documentation/ABI/testing/sysfs-driver-wacom index 2aa5503ee200..afc48fc163b5 100644 --- a/Documentation/ABI/testing/sysfs-driver-wacom +++ b/Documentation/ABI/testing/sysfs-driver-wacom | |||
@@ -1,6 +1,6 @@ | |||
1 | What: /sys/bus/hid/devices/<bus>:<vid>:<pid>.<n>/speed | 1 | What: /sys/bus/hid/devices/<bus>:<vid>:<pid>.<n>/speed |
2 | Date: April 2010 | 2 | Date: April 2010 |
3 | Kernel Version: 2.6.35 | 3 | KernelVersion: 2.6.35 |
4 | Contact: linux-bluetooth@vger.kernel.org | 4 | Contact: linux-bluetooth@vger.kernel.org |
5 | Description: | 5 | Description: |
6 | The /sys/bus/hid/devices/<bus>:<vid>:<pid>.<n>/speed file | 6 | The /sys/bus/hid/devices/<bus>:<vid>:<pid>.<n>/speed file |
diff --git a/Documentation/ABI/testing/sysfs-kernel-fscaps b/Documentation/ABI/testing/sysfs-kernel-fscaps index 50a3033b5e15..bcff34665192 100644 --- a/Documentation/ABI/testing/sysfs-kernel-fscaps +++ b/Documentation/ABI/testing/sysfs-kernel-fscaps | |||
@@ -2,7 +2,7 @@ What: /sys/kernel/fscaps | |||
2 | Date: February 2011 | 2 | Date: February 2011 |
3 | KernelVersion: 2.6.38 | 3 | KernelVersion: 2.6.38 |
4 | Contact: Ludwig Nussel <ludwig.nussel@suse.de> | 4 | Contact: Ludwig Nussel <ludwig.nussel@suse.de> |
5 | Description | 5 | Description: |
6 | Shows whether file system capabilities are honored | 6 | Shows whether file system capabilities are honored |
7 | when executing a binary | 7 | when executing a binary |
8 | 8 | ||
diff --git a/Documentation/ABI/testing/sysfs-kernel-vmcoreinfo b/Documentation/ABI/testing/sysfs-kernel-vmcoreinfo index 7bd81168e063..1f1087a5f075 100644 --- a/Documentation/ABI/testing/sysfs-kernel-vmcoreinfo +++ b/Documentation/ABI/testing/sysfs-kernel-vmcoreinfo | |||
@@ -4,7 +4,7 @@ KernelVersion: 2.6.24 | |||
4 | Contact: Ken'ichi Ohmichi <oomichi@mxs.nes.nec.co.jp> | 4 | Contact: Ken'ichi Ohmichi <oomichi@mxs.nes.nec.co.jp> |
5 | Kexec Mailing List <kexec@lists.infradead.org> | 5 | Kexec Mailing List <kexec@lists.infradead.org> |
6 | Vivek Goyal <vgoyal@redhat.com> | 6 | Vivek Goyal <vgoyal@redhat.com> |
7 | Description | 7 | Description: |
8 | Shows physical address and size of vmcoreinfo ELF note. | 8 | Shows physical address and size of vmcoreinfo ELF note. |
9 | First value contains physical address of note in hex and | 9 | First value contains physical address of note in hex and |
10 | second value contains the size of note in hex. This ELF | 10 | second value contains the size of note in hex. This ELF |
diff --git a/Documentation/driver-api/gpio/driver.rst b/Documentation/driver-api/gpio/driver.rst index 4af9aae724f0..349f2dc33029 100644 --- a/Documentation/driver-api/gpio/driver.rst +++ b/Documentation/driver-api/gpio/driver.rst | |||
@@ -399,7 +399,7 @@ symbol: | |||
399 | will pass the struct gpio_chip* for the chip to all IRQ callbacks, so the | 399 | will pass the struct gpio_chip* for the chip to all IRQ callbacks, so the |
400 | callbacks need to embed the gpio_chip in its state container and obtain a | 400 | callbacks need to embed the gpio_chip in its state container and obtain a |
401 | pointer to the container using container_of(). | 401 | pointer to the container using container_of(). |
402 | (See Documentation/driver-model/design-patterns.txt) | 402 | (See Documentation/driver-model/design-patterns.rst) |
403 | 403 | ||
404 | - gpiochip_irqchip_add_nested(): adds a nested cascaded irqchip to a gpiochip, | 404 | - gpiochip_irqchip_add_nested(): adds a nested cascaded irqchip to a gpiochip, |
405 | as discussed above regarding different types of cascaded irqchips. The | 405 | as discussed above regarding different types of cascaded irqchips. The |
diff --git a/Documentation/driver-model/binding.txt b/Documentation/driver-model/binding.rst index abfc8e290d53..7ea1d7a41e1d 100644 --- a/Documentation/driver-model/binding.txt +++ b/Documentation/driver-model/binding.rst | |||
@@ -1,5 +1,6 @@ | |||
1 | 1 | ============== | |
2 | Driver Binding | 2 | Driver Binding |
3 | ============== | ||
3 | 4 | ||
4 | Driver binding is the process of associating a device with a device | 5 | Driver binding is the process of associating a device with a device |
5 | driver that can control it. Bus drivers have typically handled this | 6 | driver that can control it. Bus drivers have typically handled this |
@@ -25,7 +26,7 @@ device_register | |||
25 | When a new device is added, the bus's list of drivers is iterated over | 26 | When a new device is added, the bus's list of drivers is iterated over |
26 | to find one that supports it. In order to determine that, the device | 27 | to find one that supports it. In order to determine that, the device |
27 | ID of the device must match one of the device IDs that the driver | 28 | ID of the device must match one of the device IDs that the driver |
28 | supports. The format and semantics for comparing IDs is bus-specific. | 29 | supports. The format and semantics for comparing IDs is bus-specific. |
29 | Instead of trying to derive a complex state machine and matching | 30 | Instead of trying to derive a complex state machine and matching |
30 | algorithm, it is up to the bus driver to provide a callback to compare | 31 | algorithm, it is up to the bus driver to provide a callback to compare |
31 | a device against the IDs of a driver. The bus returns 1 if a match was | 32 | a device against the IDs of a driver. The bus returns 1 if a match was |
@@ -36,14 +37,14 @@ int match(struct device * dev, struct device_driver * drv); | |||
36 | If a match is found, the device's driver field is set to the driver | 37 | If a match is found, the device's driver field is set to the driver |
37 | and the driver's probe callback is called. This gives the driver a | 38 | and the driver's probe callback is called. This gives the driver a |
38 | chance to verify that it really does support the hardware, and that | 39 | chance to verify that it really does support the hardware, and that |
39 | it's in a working state. | 40 | it's in a working state. |
40 | 41 | ||
41 | Device Class | 42 | Device Class |
42 | ~~~~~~~~~~~~ | 43 | ~~~~~~~~~~~~ |
43 | 44 | ||
44 | Upon the successful completion of probe, the device is registered with | 45 | Upon the successful completion of probe, the device is registered with |
45 | the class to which it belongs. Device drivers belong to one and only one | 46 | the class to which it belongs. Device drivers belong to one and only one |
46 | class, and that is set in the driver's devclass field. | 47 | class, and that is set in the driver's devclass field. |
47 | devclass_add_device is called to enumerate the device within the class | 48 | devclass_add_device is called to enumerate the device within the class |
48 | and actually register it with the class, which happens with the | 49 | and actually register it with the class, which happens with the |
49 | class's register_dev callback. | 50 | class's register_dev callback. |
@@ -53,7 +54,7 @@ Driver | |||
53 | ~~~~~~ | 54 | ~~~~~~ |
54 | 55 | ||
55 | When a driver is attached to a device, the device is inserted into the | 56 | When a driver is attached to a device, the device is inserted into the |
56 | driver's list of devices. | 57 | driver's list of devices. |
57 | 58 | ||
58 | 59 | ||
59 | sysfs | 60 | sysfs |
@@ -67,18 +68,18 @@ to the device's directory in the physical hierarchy. | |||
67 | 68 | ||
68 | A directory for the device is created in the class's directory. A | 69 | A directory for the device is created in the class's directory. A |
69 | symlink is created in that directory that points to the device's | 70 | symlink is created in that directory that points to the device's |
70 | physical location in the sysfs tree. | 71 | physical location in the sysfs tree. |
71 | 72 | ||
72 | A symlink can be created (though this isn't done yet) in the device's | 73 | A symlink can be created (though this isn't done yet) in the device's |
73 | physical directory to either its class directory, or the class's | 74 | physical directory to either its class directory, or the class's |
74 | top-level directory. One can also be created to point to its driver's | 75 | top-level directory. One can also be created to point to its driver's |
75 | directory also. | 76 | directory also. |
76 | 77 | ||
77 | 78 | ||
78 | driver_register | 79 | driver_register |
79 | ~~~~~~~~~~~~~~~ | 80 | ~~~~~~~~~~~~~~~ |
80 | 81 | ||
81 | The process is almost identical for when a new driver is added. | 82 | The process is almost identical for when a new driver is added. |
82 | The bus's list of devices is iterated over to find a match. Devices | 83 | The bus's list of devices is iterated over to find a match. Devices |
83 | that already have a driver are skipped. All the devices are iterated | 84 | that already have a driver are skipped. All the devices are iterated |
84 | over, to bind as many devices as possible to the driver. | 85 | over, to bind as many devices as possible to the driver. |
@@ -94,5 +95,4 @@ of the driver is decremented. All symlinks between the two are removed. | |||
94 | 95 | ||
95 | When a driver is removed, the list of devices that it supports is | 96 | When a driver is removed, the list of devices that it supports is |
96 | iterated over, and the driver's remove callback is called for each | 97 | iterated over, and the driver's remove callback is called for each |
97 | one. The device is removed from that list and the symlinks removed. | 98 | one. The device is removed from that list and the symlinks removed. |
98 | |||
diff --git a/Documentation/driver-model/bus.txt b/Documentation/driver-model/bus.rst index c247b488a567..016b15a6e8ea 100644 --- a/Documentation/driver-model/bus.txt +++ b/Documentation/driver-model/bus.rst | |||
@@ -1,5 +1,6 @@ | |||
1 | 1 | ========= | |
2 | Bus Types | 2 | Bus Types |
3 | ========= | ||
3 | 4 | ||
4 | Definition | 5 | Definition |
5 | ~~~~~~~~~~ | 6 | ~~~~~~~~~~ |
@@ -13,12 +14,12 @@ Declaration | |||
13 | 14 | ||
14 | Each bus type in the kernel (PCI, USB, etc) should declare one static | 15 | Each bus type in the kernel (PCI, USB, etc) should declare one static |
15 | object of this type. They must initialize the name field, and may | 16 | object of this type. They must initialize the name field, and may |
16 | optionally initialize the match callback. | 17 | optionally initialize the match callback:: |
17 | 18 | ||
18 | struct bus_type pci_bus_type = { | 19 | struct bus_type pci_bus_type = { |
19 | .name = "pci", | 20 | .name = "pci", |
20 | .match = pci_bus_match, | 21 | .match = pci_bus_match, |
21 | }; | 22 | }; |
22 | 23 | ||
23 | The structure should be exported to drivers in a header file: | 24 | The structure should be exported to drivers in a header file: |
24 | 25 | ||
@@ -30,8 +31,8 @@ Registration | |||
30 | 31 | ||
31 | When a bus driver is initialized, it calls bus_register. This | 32 | When a bus driver is initialized, it calls bus_register. This |
32 | initializes the rest of the fields in the bus object and inserts it | 33 | initializes the rest of the fields in the bus object and inserts it |
33 | into a global list of bus types. Once the bus object is registered, | 34 | into a global list of bus types. Once the bus object is registered, |
34 | the fields in it are usable by the bus driver. | 35 | the fields in it are usable by the bus driver. |
35 | 36 | ||
36 | 37 | ||
37 | Callbacks | 38 | Callbacks |
@@ -43,17 +44,17 @@ match(): Attaching Drivers to Devices | |||
43 | The format of device ID structures and the semantics for comparing | 44 | The format of device ID structures and the semantics for comparing |
44 | them are inherently bus-specific. Drivers typically declare an array | 45 | them are inherently bus-specific. Drivers typically declare an array |
45 | of device IDs of devices they support that reside in a bus-specific | 46 | of device IDs of devices they support that reside in a bus-specific |
46 | driver structure. | 47 | driver structure. |
47 | 48 | ||
48 | The purpose of the match callback is to give the bus an opportunity to | 49 | The purpose of the match callback is to give the bus an opportunity to |
49 | determine if a particular driver supports a particular device by | 50 | determine if a particular driver supports a particular device by |
50 | comparing the device IDs the driver supports with the device ID of a | 51 | comparing the device IDs the driver supports with the device ID of a |
51 | particular device, without sacrificing bus-specific functionality or | 52 | particular device, without sacrificing bus-specific functionality or |
52 | type-safety. | 53 | type-safety. |
53 | 54 | ||
54 | When a driver is registered with the bus, the bus's list of devices is | 55 | When a driver is registered with the bus, the bus's list of devices is |
55 | iterated over, and the match callback is called for each device that | 56 | iterated over, and the match callback is called for each device that |
56 | does not have a driver associated with it. | 57 | does not have a driver associated with it. |
57 | 58 | ||
58 | 59 | ||
59 | 60 | ||
@@ -64,22 +65,23 @@ The lists of devices and drivers are intended to replace the local | |||
64 | lists that many buses keep. They are lists of struct devices and | 65 | lists that many buses keep. They are lists of struct devices and |
65 | struct device_drivers, respectively. Bus drivers are free to use the | 66 | struct device_drivers, respectively. Bus drivers are free to use the |
66 | lists as they please, but conversion to the bus-specific type may be | 67 | lists as they please, but conversion to the bus-specific type may be |
67 | necessary. | 68 | necessary. |
68 | 69 | ||
69 | The LDM core provides helper functions for iterating over each list. | 70 | The LDM core provides helper functions for iterating over each list:: |
70 | 71 | ||
71 | int bus_for_each_dev(struct bus_type * bus, struct device * start, void * data, | 72 | int bus_for_each_dev(struct bus_type * bus, struct device * start, |
72 | int (*fn)(struct device *, void *)); | 73 | void * data, |
74 | int (*fn)(struct device *, void *)); | ||
73 | 75 | ||
74 | int bus_for_each_drv(struct bus_type * bus, struct device_driver * start, | 76 | int bus_for_each_drv(struct bus_type * bus, struct device_driver * start, |
75 | void * data, int (*fn)(struct device_driver *, void *)); | 77 | void * data, int (*fn)(struct device_driver *, void *)); |
76 | 78 | ||
77 | These helpers iterate over the respective list, and call the callback | 79 | These helpers iterate over the respective list, and call the callback |
78 | for each device or driver in the list. All list accesses are | 80 | for each device or driver in the list. All list accesses are |
79 | synchronized by taking the bus's lock (read currently). The reference | 81 | synchronized by taking the bus's lock (read currently). The reference |
80 | count on each object in the list is incremented before the callback is | 82 | count on each object in the list is incremented before the callback is |
81 | called; it is decremented after the next object has been obtained. The | 83 | called; it is decremented after the next object has been obtained. The |
82 | lock is not held when calling the callback. | 84 | lock is not held when calling the callback. |
83 | 85 | ||
84 | 86 | ||
85 | sysfs | 87 | sysfs |
@@ -87,14 +89,14 @@ sysfs | |||
87 | There is a top-level directory named 'bus'. | 89 | There is a top-level directory named 'bus'. |
88 | 90 | ||
89 | Each bus gets a directory in the bus directory, along with two default | 91 | Each bus gets a directory in the bus directory, along with two default |
90 | directories: | 92 | directories:: |
91 | 93 | ||
92 | /sys/bus/pci/ | 94 | /sys/bus/pci/ |
93 | |-- devices | 95 | |-- devices |
94 | `-- drivers | 96 | `-- drivers |
95 | 97 | ||
96 | Drivers registered with the bus get a directory in the bus's drivers | 98 | Drivers registered with the bus get a directory in the bus's drivers |
97 | directory: | 99 | directory:: |
98 | 100 | ||
99 | /sys/bus/pci/ | 101 | /sys/bus/pci/ |
100 | |-- devices | 102 | |-- devices |
@@ -106,7 +108,7 @@ directory: | |||
106 | 108 | ||
107 | Each device that is discovered on a bus of that type gets a symlink in | 109 | Each device that is discovered on a bus of that type gets a symlink in |
108 | the bus's devices directory to the device's directory in the physical | 110 | the bus's devices directory to the device's directory in the physical |
109 | hierarchy: | 111 | hierarchy:: |
110 | 112 | ||
111 | /sys/bus/pci/ | 113 | /sys/bus/pci/ |
112 | |-- devices | 114 | |-- devices |
@@ -118,26 +120,27 @@ hierarchy: | |||
118 | 120 | ||
119 | Exporting Attributes | 121 | Exporting Attributes |
120 | ~~~~~~~~~~~~~~~~~~~~ | 122 | ~~~~~~~~~~~~~~~~~~~~ |
121 | struct bus_attribute { | 123 | |
124 | :: | ||
125 | |||
126 | struct bus_attribute { | ||
122 | struct attribute attr; | 127 | struct attribute attr; |
123 | ssize_t (*show)(struct bus_type *, char * buf); | 128 | ssize_t (*show)(struct bus_type *, char * buf); |
124 | ssize_t (*store)(struct bus_type *, const char * buf, size_t count); | 129 | ssize_t (*store)(struct bus_type *, const char * buf, size_t count); |
125 | }; | 130 | }; |
126 | 131 | ||
127 | Bus drivers can export attributes using the BUS_ATTR_RW macro that works | 132 | Bus drivers can export attributes using the BUS_ATTR_RW macro that works |
128 | similarly to the DEVICE_ATTR_RW macro for devices. For example, a | 133 | similarly to the DEVICE_ATTR_RW macro for devices. For example, a |
129 | definition like this: | 134 | definition like this:: |
130 | 135 | ||
131 | static BUS_ATTR_RW(debug); | 136 | static BUS_ATTR_RW(debug); |
132 | 137 | ||
133 | is equivalent to declaring: | 138 | is equivalent to declaring:: |
134 | 139 | ||
135 | static bus_attribute bus_attr_debug; | 140 | static bus_attribute bus_attr_debug; |
136 | 141 | ||
137 | This can then be used to add and remove the attribute from the bus's | 142 | This can then be used to add and remove the attribute from the bus's |
138 | sysfs directory using: | 143 | sysfs directory using:: |
139 | |||
140 | int bus_create_file(struct bus_type *, struct bus_attribute *); | ||
141 | void bus_remove_file(struct bus_type *, struct bus_attribute *); | ||
142 | |||
143 | 144 | ||
145 | int bus_create_file(struct bus_type *, struct bus_attribute *); | ||
146 | void bus_remove_file(struct bus_type *, struct bus_attribute *); | ||
diff --git a/Documentation/driver-model/class.txt b/Documentation/driver-model/class.rst index 1fefc480a80b..fff55b80e86a 100644 --- a/Documentation/driver-model/class.txt +++ b/Documentation/driver-model/class.rst | |||
@@ -1,6 +1,6 @@ | |||
1 | 1 | ============== | |
2 | Device Classes | 2 | Device Classes |
3 | 3 | ============== | |
4 | 4 | ||
5 | Introduction | 5 | Introduction |
6 | ~~~~~~~~~~~~ | 6 | ~~~~~~~~~~~~ |
@@ -13,37 +13,37 @@ device. The following device classes have been identified: | |||
13 | Each device class defines a set of semantics and a programming interface | 13 | Each device class defines a set of semantics and a programming interface |
14 | that devices of that class adhere to. Device drivers are the | 14 | that devices of that class adhere to. Device drivers are the |
15 | implementation of that programming interface for a particular device on | 15 | implementation of that programming interface for a particular device on |
16 | a particular bus. | 16 | a particular bus. |
17 | 17 | ||
18 | Device classes are agnostic with respect to what bus a device resides | 18 | Device classes are agnostic with respect to what bus a device resides |
19 | on. | 19 | on. |
20 | 20 | ||
21 | 21 | ||
22 | Programming Interface | 22 | Programming Interface |
23 | ~~~~~~~~~~~~~~~~~~~~~ | 23 | ~~~~~~~~~~~~~~~~~~~~~ |
24 | The device class structure looks like: | 24 | The device class structure looks like:: |
25 | 25 | ||
26 | 26 | ||
27 | typedef int (*devclass_add)(struct device *); | 27 | typedef int (*devclass_add)(struct device *); |
28 | typedef void (*devclass_remove)(struct device *); | 28 | typedef void (*devclass_remove)(struct device *); |
29 | 29 | ||
30 | See the kerneldoc for the struct class. | 30 | See the kerneldoc for the struct class. |
31 | 31 | ||
32 | A typical device class definition would look like: | 32 | A typical device class definition would look like:: |
33 | 33 | ||
34 | struct device_class input_devclass = { | 34 | struct device_class input_devclass = { |
35 | .name = "input", | 35 | .name = "input", |
36 | .add_device = input_add_device, | 36 | .add_device = input_add_device, |
37 | .remove_device = input_remove_device, | 37 | .remove_device = input_remove_device, |
38 | }; | 38 | }; |
39 | 39 | ||
40 | Each device class structure should be exported in a header file so it | 40 | Each device class structure should be exported in a header file so it |
41 | can be used by drivers, extensions and interfaces. | 41 | can be used by drivers, extensions and interfaces. |
42 | 42 | ||
43 | Device classes are registered and unregistered with the core using: | 43 | Device classes are registered and unregistered with the core using:: |
44 | 44 | ||
45 | int devclass_register(struct device_class * cls); | 45 | int devclass_register(struct device_class * cls); |
46 | void devclass_unregister(struct device_class * cls); | 46 | void devclass_unregister(struct device_class * cls); |
47 | 47 | ||
48 | 48 | ||
49 | Devices | 49 | Devices |
@@ -52,16 +52,16 @@ As devices are bound to drivers, they are added to the device class | |||
52 | that the driver belongs to. Before the driver model core, this would | 52 | that the driver belongs to. Before the driver model core, this would |
53 | typically happen during the driver's probe() callback, once the device | 53 | typically happen during the driver's probe() callback, once the device |
54 | has been initialized. It now happens after the probe() callback | 54 | has been initialized. It now happens after the probe() callback |
55 | finishes from the core. | 55 | finishes from the core. |
56 | 56 | ||
57 | The device is enumerated in the class. Each time a device is added to | 57 | The device is enumerated in the class. Each time a device is added to |
58 | the class, the class's devnum field is incremented and assigned to the | 58 | the class, the class's devnum field is incremented and assigned to the |
59 | device. The field is never decremented, so if the device is removed | 59 | device. The field is never decremented, so if the device is removed |
60 | from the class and re-added, it will receive a different enumerated | 60 | from the class and re-added, it will receive a different enumerated |
61 | value. | 61 | value. |
62 | 62 | ||
63 | The class is allowed to create a class-specific structure for the | 63 | The class is allowed to create a class-specific structure for the |
64 | device and store it in the device's class_data pointer. | 64 | device and store it in the device's class_data pointer. |
65 | 65 | ||
66 | There is no list of devices in the device class. Each driver has a | 66 | There is no list of devices in the device class. Each driver has a |
67 | list of devices that it supports. The device class has a list of | 67 | list of devices that it supports. The device class has a list of |
@@ -73,15 +73,15 @@ Device Drivers | |||
73 | ~~~~~~~~~~~~~~ | 73 | ~~~~~~~~~~~~~~ |
74 | Device drivers are added to device classes when they are registered | 74 | Device drivers are added to device classes when they are registered |
75 | with the core. A driver specifies the class it belongs to by setting | 75 | with the core. A driver specifies the class it belongs to by setting |
76 | the struct device_driver::devclass field. | 76 | the struct device_driver::devclass field. |
77 | 77 | ||
78 | 78 | ||
79 | sysfs directory structure | 79 | sysfs directory structure |
80 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | 80 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
81 | There is a top-level sysfs directory named 'class'. | 81 | There is a top-level sysfs directory named 'class'. |
82 | 82 | ||
83 | Each class gets a directory in the class directory, along with two | 83 | Each class gets a directory in the class directory, along with two |
84 | default subdirectories: | 84 | default subdirectories:: |
85 | 85 | ||
86 | class/ | 86 | class/ |
87 | `-- input | 87 | `-- input |
@@ -89,8 +89,8 @@ default subdirectories: | |||
89 | `-- drivers | 89 | `-- drivers |
90 | 90 | ||
91 | 91 | ||
92 | Drivers registered with the class get a symlink in the drivers/ directory | 92 | Drivers registered with the class get a symlink in the drivers/ directory |
93 | that points to the driver's directory (under its bus directory): | 93 | that points to the driver's directory (under its bus directory):: |
94 | 94 | ||
95 | class/ | 95 | class/ |
96 | `-- input | 96 | `-- input |
@@ -99,8 +99,8 @@ that points to the driver's directory (under its bus directory): | |||
99 | `-- usb:usb_mouse -> ../../../bus/drivers/usb_mouse/ | 99 | `-- usb:usb_mouse -> ../../../bus/drivers/usb_mouse/ |
100 | 100 | ||
101 | 101 | ||
102 | Each device gets a symlink in the devices/ directory that points to the | 102 | Each device gets a symlink in the devices/ directory that points to the |
103 | device's directory in the physical hierarchy: | 103 | device's directory in the physical hierarchy:: |
104 | 104 | ||
105 | class/ | 105 | class/ |
106 | `-- input | 106 | `-- input |
@@ -111,37 +111,39 @@ device's directory in the physical hierarchy: | |||
111 | 111 | ||
112 | Exporting Attributes | 112 | Exporting Attributes |
113 | ~~~~~~~~~~~~~~~~~~~~ | 113 | ~~~~~~~~~~~~~~~~~~~~ |
114 | struct devclass_attribute { | 114 | |
115 | :: | ||
116 | |||
117 | struct devclass_attribute { | ||
115 | struct attribute attr; | 118 | struct attribute attr; |
116 | ssize_t (*show)(struct device_class *, char * buf, size_t count, loff_t off); | 119 | ssize_t (*show)(struct device_class *, char * buf, size_t count, loff_t off); |
117 | ssize_t (*store)(struct device_class *, const char * buf, size_t count, loff_t off); | 120 | ssize_t (*store)(struct device_class *, const char * buf, size_t count, loff_t off); |
118 | }; | 121 | }; |
119 | 122 | ||
120 | Class drivers can export attributes using the DEVCLASS_ATTR macro that works | 123 | Class drivers can export attributes using the DEVCLASS_ATTR macro that works |
121 | similarly to the DEVICE_ATTR macro for devices. For example, a definition | 124 | similarly to the DEVICE_ATTR macro for devices. For example, a definition |
122 | like this: | 125 | like this:: |
123 | 126 | ||
124 | static DEVCLASS_ATTR(debug,0644,show_debug,store_debug); | 127 | static DEVCLASS_ATTR(debug,0644,show_debug,store_debug); |
125 | 128 | ||
126 | is equivalent to declaring: | 129 | is equivalent to declaring:: |
127 | 130 | ||
128 | static devclass_attribute devclass_attr_debug; | 131 | static devclass_attribute devclass_attr_debug; |
129 | 132 | ||
130 | The bus driver can add and remove the attribute from the class's | 133 | The bus driver can add and remove the attribute from the class's |
131 | sysfs directory using: | 134 | sysfs directory using:: |
132 | 135 | ||
133 | int devclass_create_file(struct device_class *, struct devclass_attribute *); | 136 | int devclass_create_file(struct device_class *, struct devclass_attribute *); |
134 | void devclass_remove_file(struct device_class *, struct devclass_attribute *); | 137 | void devclass_remove_file(struct device_class *, struct devclass_attribute *); |
135 | 138 | ||
136 | In the example above, the file will be named 'debug' in placed in the | 139 | In the example above, the file will be named 'debug' in placed in the |
137 | class's directory in sysfs. | 140 | class's directory in sysfs. |
138 | 141 | ||
139 | 142 | ||
140 | Interfaces | 143 | Interfaces |
141 | ~~~~~~~~~~ | 144 | ~~~~~~~~~~ |
142 | There may exist multiple mechanisms for accessing the same device of a | 145 | There may exist multiple mechanisms for accessing the same device of a |
143 | particular class type. Device interfaces describe these mechanisms. | 146 | particular class type. Device interfaces describe these mechanisms. |
144 | 147 | ||
145 | When a device is added to a device class, the core attempts to add it | 148 | When a device is added to a device class, the core attempts to add it |
146 | to every interface that is registered with the device class. | 149 | to every interface that is registered with the device class. |
147 | |||
diff --git a/Documentation/driver-model/design-patterns.txt b/Documentation/driver-model/design-patterns.rst index ba7b2df64904..41eb8f41f7dd 100644 --- a/Documentation/driver-model/design-patterns.txt +++ b/Documentation/driver-model/design-patterns.rst | |||
@@ -1,6 +1,6 @@ | |||
1 | 1 | ============================= | |
2 | Device Driver Design Patterns | 2 | Device Driver Design Patterns |
3 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | 3 | ============================= |
4 | 4 | ||
5 | This document describes a few common design patterns found in device drivers. | 5 | This document describes a few common design patterns found in device drivers. |
6 | It is likely that subsystem maintainers will ask driver developers to | 6 | It is likely that subsystem maintainers will ask driver developers to |
@@ -19,23 +19,23 @@ that the device the driver binds to will appear in several instances. This | |||
19 | means that the probe() function and all callbacks need to be reentrant. | 19 | means that the probe() function and all callbacks need to be reentrant. |
20 | 20 | ||
21 | The most common way to achieve this is to use the state container design | 21 | The most common way to achieve this is to use the state container design |
22 | pattern. It usually has this form: | 22 | pattern. It usually has this form:: |
23 | 23 | ||
24 | struct foo { | 24 | struct foo { |
25 | spinlock_t lock; /* Example member */ | 25 | spinlock_t lock; /* Example member */ |
26 | (...) | 26 | (...) |
27 | }; | 27 | }; |
28 | 28 | ||
29 | static int foo_probe(...) | 29 | static int foo_probe(...) |
30 | { | 30 | { |
31 | struct foo *foo; | 31 | struct foo *foo; |
32 | 32 | ||
33 | foo = devm_kzalloc(dev, sizeof(*foo), GFP_KERNEL); | 33 | foo = devm_kzalloc(dev, sizeof(*foo), GFP_KERNEL); |
34 | if (!foo) | 34 | if (!foo) |
35 | return -ENOMEM; | 35 | return -ENOMEM; |
36 | spin_lock_init(&foo->lock); | 36 | spin_lock_init(&foo->lock); |
37 | (...) | 37 | (...) |
38 | } | 38 | } |
39 | 39 | ||
40 | This will create an instance of struct foo in memory every time probe() is | 40 | This will create an instance of struct foo in memory every time probe() is |
41 | called. This is our state container for this instance of the device driver. | 41 | called. This is our state container for this instance of the device driver. |
@@ -43,21 +43,21 @@ Of course it is then necessary to always pass this instance of the | |||
43 | state around to all functions that need access to the state and its members. | 43 | state around to all functions that need access to the state and its members. |
44 | 44 | ||
45 | For example, if the driver is registering an interrupt handler, you would | 45 | For example, if the driver is registering an interrupt handler, you would |
46 | pass around a pointer to struct foo like this: | 46 | pass around a pointer to struct foo like this:: |
47 | 47 | ||
48 | static irqreturn_t foo_handler(int irq, void *arg) | 48 | static irqreturn_t foo_handler(int irq, void *arg) |
49 | { | 49 | { |
50 | struct foo *foo = arg; | 50 | struct foo *foo = arg; |
51 | (...) | 51 | (...) |
52 | } | 52 | } |
53 | 53 | ||
54 | static int foo_probe(...) | 54 | static int foo_probe(...) |
55 | { | 55 | { |
56 | struct foo *foo; | 56 | struct foo *foo; |
57 | 57 | ||
58 | (...) | 58 | (...) |
59 | ret = request_irq(irq, foo_handler, 0, "foo", foo); | 59 | ret = request_irq(irq, foo_handler, 0, "foo", foo); |
60 | } | 60 | } |
61 | 61 | ||
62 | This way you always get a pointer back to the correct instance of foo in | 62 | This way you always get a pointer back to the correct instance of foo in |
63 | your interrupt handler. | 63 | your interrupt handler. |
@@ -66,38 +66,38 @@ your interrupt handler. | |||
66 | 2. container_of() | 66 | 2. container_of() |
67 | ~~~~~~~~~~~~~~~~~ | 67 | ~~~~~~~~~~~~~~~~~ |
68 | 68 | ||
69 | Continuing on the above example we add an offloaded work: | 69 | Continuing on the above example we add an offloaded work:: |
70 | 70 | ||
71 | struct foo { | 71 | struct foo { |
72 | spinlock_t lock; | 72 | spinlock_t lock; |
73 | struct workqueue_struct *wq; | 73 | struct workqueue_struct *wq; |
74 | struct work_struct offload; | 74 | struct work_struct offload; |
75 | (...) | 75 | (...) |
76 | }; | 76 | }; |
77 | 77 | ||
78 | static void foo_work(struct work_struct *work) | 78 | static void foo_work(struct work_struct *work) |
79 | { | 79 | { |
80 | struct foo *foo = container_of(work, struct foo, offload); | 80 | struct foo *foo = container_of(work, struct foo, offload); |
81 | 81 | ||
82 | (...) | 82 | (...) |
83 | } | 83 | } |
84 | 84 | ||
85 | static irqreturn_t foo_handler(int irq, void *arg) | 85 | static irqreturn_t foo_handler(int irq, void *arg) |
86 | { | 86 | { |
87 | struct foo *foo = arg; | 87 | struct foo *foo = arg; |
88 | 88 | ||
89 | queue_work(foo->wq, &foo->offload); | 89 | queue_work(foo->wq, &foo->offload); |
90 | (...) | 90 | (...) |
91 | } | 91 | } |
92 | 92 | ||
93 | static int foo_probe(...) | 93 | static int foo_probe(...) |
94 | { | 94 | { |
95 | struct foo *foo; | 95 | struct foo *foo; |
96 | 96 | ||
97 | foo->wq = create_singlethread_workqueue("foo-wq"); | 97 | foo->wq = create_singlethread_workqueue("foo-wq"); |
98 | INIT_WORK(&foo->offload, foo_work); | 98 | INIT_WORK(&foo->offload, foo_work); |
99 | (...) | 99 | (...) |
100 | } | 100 | } |
101 | 101 | ||
102 | The design pattern is the same for an hrtimer or something similar that will | 102 | The design pattern is the same for an hrtimer or something similar that will |
103 | return a single argument which is a pointer to a struct member in the | 103 | return a single argument which is a pointer to a struct member in the |
diff --git a/Documentation/driver-model/device.txt b/Documentation/driver-model/device.rst index 2403eb856187..2b868d49d349 100644 --- a/Documentation/driver-model/device.txt +++ b/Documentation/driver-model/device.rst | |||
@@ -1,6 +1,6 @@ | |||
1 | 1 | ========================== | |
2 | The Basic Device Structure | 2 | The Basic Device Structure |
3 | ~~~~~~~~~~~~~~~~~~~~~~~~~~ | 3 | ========================== |
4 | 4 | ||
5 | See the kerneldoc for the struct device. | 5 | See the kerneldoc for the struct device. |
6 | 6 | ||
@@ -8,9 +8,9 @@ See the kerneldoc for the struct device. | |||
8 | Programming Interface | 8 | Programming Interface |
9 | ~~~~~~~~~~~~~~~~~~~~~ | 9 | ~~~~~~~~~~~~~~~~~~~~~ |
10 | The bus driver that discovers the device uses this to register the | 10 | The bus driver that discovers the device uses this to register the |
11 | device with the core: | 11 | device with the core:: |
12 | 12 | ||
13 | int device_register(struct device * dev); | 13 | int device_register(struct device * dev); |
14 | 14 | ||
15 | The bus should initialize the following fields: | 15 | The bus should initialize the following fields: |
16 | 16 | ||
@@ -20,30 +20,33 @@ The bus should initialize the following fields: | |||
20 | - bus | 20 | - bus |
21 | 21 | ||
22 | A device is removed from the core when its reference count goes to | 22 | A device is removed from the core when its reference count goes to |
23 | 0. The reference count can be adjusted using: | 23 | 0. The reference count can be adjusted using:: |
24 | 24 | ||
25 | struct device * get_device(struct device * dev); | 25 | struct device * get_device(struct device * dev); |
26 | void put_device(struct device * dev); | 26 | void put_device(struct device * dev); |
27 | 27 | ||
28 | get_device() will return a pointer to the struct device passed to it | 28 | get_device() will return a pointer to the struct device passed to it |
29 | if the reference is not already 0 (if it's in the process of being | 29 | if the reference is not already 0 (if it's in the process of being |
30 | removed already). | 30 | removed already). |
31 | 31 | ||
32 | A driver can access the lock in the device structure using: | 32 | A driver can access the lock in the device structure using:: |
33 | 33 | ||
34 | void lock_device(struct device * dev); | 34 | void lock_device(struct device * dev); |
35 | void unlock_device(struct device * dev); | 35 | void unlock_device(struct device * dev); |
36 | 36 | ||
37 | 37 | ||
38 | Attributes | 38 | Attributes |
39 | ~~~~~~~~~~ | 39 | ~~~~~~~~~~ |
40 | struct device_attribute { | 40 | |
41 | :: | ||
42 | |||
43 | struct device_attribute { | ||
41 | struct attribute attr; | 44 | struct attribute attr; |
42 | ssize_t (*show)(struct device *dev, struct device_attribute *attr, | 45 | ssize_t (*show)(struct device *dev, struct device_attribute *attr, |
43 | char *buf); | 46 | char *buf); |
44 | ssize_t (*store)(struct device *dev, struct device_attribute *attr, | 47 | ssize_t (*store)(struct device *dev, struct device_attribute *attr, |
45 | const char *buf, size_t count); | 48 | const char *buf, size_t count); |
46 | }; | 49 | }; |
47 | 50 | ||
48 | Attributes of devices can be exported by a device driver through sysfs. | 51 | Attributes of devices can be exported by a device driver through sysfs. |
49 | 52 | ||
@@ -54,39 +57,39 @@ As explained in Documentation/kobject.txt, device attributes must be | |||
54 | created before the KOBJ_ADD uevent is generated. The only way to realize | 57 | created before the KOBJ_ADD uevent is generated. The only way to realize |
55 | that is by defining an attribute group. | 58 | that is by defining an attribute group. |
56 | 59 | ||
57 | Attributes are declared using a macro called DEVICE_ATTR: | 60 | Attributes are declared using a macro called DEVICE_ATTR:: |
58 | 61 | ||
59 | #define DEVICE_ATTR(name,mode,show,store) | 62 | #define DEVICE_ATTR(name,mode,show,store) |
60 | 63 | ||
61 | Example: | 64 | Example::: |
62 | 65 | ||
63 | static DEVICE_ATTR(type, 0444, show_type, NULL); | 66 | static DEVICE_ATTR(type, 0444, show_type, NULL); |
64 | static DEVICE_ATTR(power, 0644, show_power, store_power); | 67 | static DEVICE_ATTR(power, 0644, show_power, store_power); |
65 | 68 | ||
66 | This declares two structures of type struct device_attribute with respective | 69 | This declares two structures of type struct device_attribute with respective |
67 | names 'dev_attr_type' and 'dev_attr_power'. These two attributes can be | 70 | names 'dev_attr_type' and 'dev_attr_power'. These two attributes can be |
68 | organized as follows into a group: | 71 | organized as follows into a group:: |
69 | 72 | ||
70 | static struct attribute *dev_attrs[] = { | 73 | static struct attribute *dev_attrs[] = { |
71 | &dev_attr_type.attr, | 74 | &dev_attr_type.attr, |
72 | &dev_attr_power.attr, | 75 | &dev_attr_power.attr, |
73 | NULL, | 76 | NULL, |
74 | }; | 77 | }; |
75 | 78 | ||
76 | static struct attribute_group dev_attr_group = { | 79 | static struct attribute_group dev_attr_group = { |
77 | .attrs = dev_attrs, | 80 | .attrs = dev_attrs, |
78 | }; | 81 | }; |
79 | 82 | ||
80 | static const struct attribute_group *dev_attr_groups[] = { | 83 | static const struct attribute_group *dev_attr_groups[] = { |
81 | &dev_attr_group, | 84 | &dev_attr_group, |
82 | NULL, | 85 | NULL, |
83 | }; | 86 | }; |
84 | 87 | ||
85 | This array of groups can then be associated with a device by setting the | 88 | This array of groups can then be associated with a device by setting the |
86 | group pointer in struct device before device_register() is invoked: | 89 | group pointer in struct device before device_register() is invoked:: |
87 | 90 | ||
88 | dev->groups = dev_attr_groups; | 91 | dev->groups = dev_attr_groups; |
89 | device_register(dev); | 92 | device_register(dev); |
90 | 93 | ||
91 | The device_register() function will use the 'groups' pointer to create the | 94 | The device_register() function will use the 'groups' pointer to create the |
92 | device attributes and the device_unregister() function will use this pointer | 95 | device attributes and the device_unregister() function will use this pointer |
diff --git a/Documentation/driver-model/devres.txt b/Documentation/driver-model/devres.rst index 69c7fa7f616c..4ac99122b5f1 100644 --- a/Documentation/driver-model/devres.txt +++ b/Documentation/driver-model/devres.rst | |||
@@ -1,3 +1,4 @@ | |||
1 | ================================ | ||
1 | Devres - Managed Device Resource | 2 | Devres - Managed Device Resource |
2 | ================================ | 3 | ================================ |
3 | 4 | ||
@@ -5,17 +6,18 @@ Tejun Heo <teheo@suse.de> | |||
5 | 6 | ||
6 | First draft 10 January 2007 | 7 | First draft 10 January 2007 |
7 | 8 | ||
9 | .. contents | ||
8 | 10 | ||
9 | 1. Intro : Huh? Devres? | 11 | 1. Intro : Huh? Devres? |
10 | 2. Devres : Devres in a nutshell | 12 | 2. Devres : Devres in a nutshell |
11 | 3. Devres Group : Group devres'es and release them together | 13 | 3. Devres Group : Group devres'es and release them together |
12 | 4. Details : Life time rules, calling context, ... | 14 | 4. Details : Life time rules, calling context, ... |
13 | 5. Overhead : How much do we have to pay for this? | 15 | 5. Overhead : How much do we have to pay for this? |
14 | 6. List of managed interfaces : Currently implemented managed interfaces | 16 | 6. List of managed interfaces: Currently implemented managed interfaces |
15 | 17 | ||
16 | 18 | ||
17 | 1. Intro | 19 | 1. Intro |
18 | -------- | 20 | -------- |
19 | 21 | ||
20 | devres came up while trying to convert libata to use iomap. Each | 22 | devres came up while trying to convert libata to use iomap. Each |
21 | iomapped address should be kept and unmapped on driver detach. For | 23 | iomapped address should be kept and unmapped on driver detach. For |
@@ -42,8 +44,8 @@ would leak resources or even cause oops when failure occurs. iomap | |||
42 | adds more to this mix. So do msi and msix. | 44 | adds more to this mix. So do msi and msix. |
43 | 45 | ||
44 | 46 | ||
45 | 2. Devres | 47 | 2. Devres |
46 | --------- | 48 | --------- |
47 | 49 | ||
48 | devres is basically linked list of arbitrarily sized memory areas | 50 | devres is basically linked list of arbitrarily sized memory areas |
49 | associated with a struct device. Each devres entry is associated with | 51 | associated with a struct device. Each devres entry is associated with |
@@ -58,7 +60,7 @@ using dma_alloc_coherent(). The managed version is called | |||
58 | dmam_alloc_coherent(). It is identical to dma_alloc_coherent() except | 60 | dmam_alloc_coherent(). It is identical to dma_alloc_coherent() except |
59 | for the DMA memory allocated using it is managed and will be | 61 | for the DMA memory allocated using it is managed and will be |
60 | automatically released on driver detach. Implementation looks like | 62 | automatically released on driver detach. Implementation looks like |
61 | the following. | 63 | the following:: |
62 | 64 | ||
63 | struct dma_devres { | 65 | struct dma_devres { |
64 | size_t size; | 66 | size_t size; |
@@ -98,7 +100,7 @@ If a driver uses dmam_alloc_coherent(), the area is guaranteed to be | |||
98 | freed whether initialization fails half-way or the device gets | 100 | freed whether initialization fails half-way or the device gets |
99 | detached. If most resources are acquired using managed interface, a | 101 | detached. If most resources are acquired using managed interface, a |
100 | driver can have much simpler init and exit code. Init path basically | 102 | driver can have much simpler init and exit code. Init path basically |
101 | looks like the following. | 103 | looks like the following:: |
102 | 104 | ||
103 | my_init_one() | 105 | my_init_one() |
104 | { | 106 | { |
@@ -119,7 +121,7 @@ looks like the following. | |||
119 | return register_to_upper_layer(d); | 121 | return register_to_upper_layer(d); |
120 | } | 122 | } |
121 | 123 | ||
122 | And exit path, | 124 | And exit path:: |
123 | 125 | ||
124 | my_remove_one() | 126 | my_remove_one() |
125 | { | 127 | { |
@@ -140,13 +142,13 @@ on you. In some cases this may mean introducing checks that were not | |||
140 | necessary before moving to the managed devm_* calls. | 142 | necessary before moving to the managed devm_* calls. |
141 | 143 | ||
142 | 144 | ||
143 | 3. Devres group | 145 | 3. Devres group |
144 | --------------- | 146 | --------------- |
145 | 147 | ||
146 | Devres entries can be grouped using devres group. When a group is | 148 | Devres entries can be grouped using devres group. When a group is |
147 | released, all contained normal devres entries and properly nested | 149 | released, all contained normal devres entries and properly nested |
148 | groups are released. One usage is to rollback series of acquired | 150 | groups are released. One usage is to rollback series of acquired |
149 | resources on failure. For example, | 151 | resources on failure. For example:: |
150 | 152 | ||
151 | if (!devres_open_group(dev, NULL, GFP_KERNEL)) | 153 | if (!devres_open_group(dev, NULL, GFP_KERNEL)) |
152 | return -ENOMEM; | 154 | return -ENOMEM; |
@@ -172,7 +174,7 @@ like above are usually useful in midlayer driver (e.g. libata core | |||
172 | layer) where interface function shouldn't have side effect on failure. | 174 | layer) where interface function shouldn't have side effect on failure. |
173 | For LLDs, just returning error code suffices in most cases. | 175 | For LLDs, just returning error code suffices in most cases. |
174 | 176 | ||
175 | Each group is identified by void *id. It can either be explicitly | 177 | Each group is identified by `void *id`. It can either be explicitly |
176 | specified by @id argument to devres_open_group() or automatically | 178 | specified by @id argument to devres_open_group() or automatically |
177 | created by passing NULL as @id as in the above example. In both | 179 | created by passing NULL as @id as in the above example. In both |
178 | cases, devres_open_group() returns the group's id. The returned id | 180 | cases, devres_open_group() returns the group's id. The returned id |
@@ -180,7 +182,7 @@ can be passed to other devres functions to select the target group. | |||
180 | If NULL is given to those functions, the latest open group is | 182 | If NULL is given to those functions, the latest open group is |
181 | selected. | 183 | selected. |
182 | 184 | ||
183 | For example, you can do something like the following. | 185 | For example, you can do something like the following:: |
184 | 186 | ||
185 | int my_midlayer_create_something() | 187 | int my_midlayer_create_something() |
186 | { | 188 | { |
@@ -199,8 +201,8 @@ For example, you can do something like the following. | |||
199 | } | 201 | } |
200 | 202 | ||
201 | 203 | ||
202 | 4. Details | 204 | 4. Details |
203 | ---------- | 205 | ---------- |
204 | 206 | ||
205 | Lifetime of a devres entry begins on devres allocation and finishes | 207 | Lifetime of a devres entry begins on devres allocation and finishes |
206 | when it is released or destroyed (removed and freed) - no reference | 208 | when it is released or destroyed (removed and freed) - no reference |
@@ -220,8 +222,8 @@ All devres interface functions can be called without context if the | |||
220 | right gfp mask is given. | 222 | right gfp mask is given. |
221 | 223 | ||
222 | 224 | ||
223 | 5. Overhead | 225 | 5. Overhead |
224 | ----------- | 226 | ----------- |
225 | 227 | ||
226 | Each devres bookkeeping info is allocated together with requested data | 228 | Each devres bookkeeping info is allocated together with requested data |
227 | area. With debug option turned off, bookkeeping info occupies 16 | 229 | area. With debug option turned off, bookkeeping info occupies 16 |
@@ -237,8 +239,8 @@ and 400 bytes on 32bit machine after naive conversion (we can | |||
237 | certainly invest a bit more effort into libata core layer). | 239 | certainly invest a bit more effort into libata core layer). |
238 | 240 | ||
239 | 241 | ||
240 | 6. List of managed interfaces | 242 | 6. List of managed interfaces |
241 | ----------------------------- | 243 | ----------------------------- |
242 | 244 | ||
243 | CLOCK | 245 | CLOCK |
244 | devm_clk_get() | 246 | devm_clk_get() |
diff --git a/Documentation/driver-model/driver.txt b/Documentation/driver-model/driver.rst index d661e6f7e6a0..11d281506a04 100644 --- a/Documentation/driver-model/driver.txt +++ b/Documentation/driver-model/driver.rst | |||
@@ -1,5 +1,6 @@ | |||
1 | 1 | ============== | |
2 | Device Drivers | 2 | Device Drivers |
3 | ============== | ||
3 | 4 | ||
4 | See the kerneldoc for the struct device_driver. | 5 | See the kerneldoc for the struct device_driver. |
5 | 6 | ||
@@ -26,50 +27,50 @@ Declaration | |||
26 | As stated above, struct device_driver objects are statically | 27 | As stated above, struct device_driver objects are statically |
27 | allocated. Below is an example declaration of the eepro100 | 28 | allocated. Below is an example declaration of the eepro100 |
28 | driver. This declaration is hypothetical only; it relies on the driver | 29 | driver. This declaration is hypothetical only; it relies on the driver |
29 | being converted completely to the new model. | 30 | being converted completely to the new model:: |
30 | 31 | ||
31 | static struct device_driver eepro100_driver = { | 32 | static struct device_driver eepro100_driver = { |
32 | .name = "eepro100", | 33 | .name = "eepro100", |
33 | .bus = &pci_bus_type, | 34 | .bus = &pci_bus_type, |
34 | 35 | ||
35 | .probe = eepro100_probe, | 36 | .probe = eepro100_probe, |
36 | .remove = eepro100_remove, | 37 | .remove = eepro100_remove, |
37 | .suspend = eepro100_suspend, | 38 | .suspend = eepro100_suspend, |
38 | .resume = eepro100_resume, | 39 | .resume = eepro100_resume, |
39 | }; | 40 | }; |
40 | 41 | ||
41 | Most drivers will not be able to be converted completely to the new | 42 | Most drivers will not be able to be converted completely to the new |
42 | model because the bus they belong to has a bus-specific structure with | 43 | model because the bus they belong to has a bus-specific structure with |
43 | bus-specific fields that cannot be generalized. | 44 | bus-specific fields that cannot be generalized. |
44 | 45 | ||
45 | The most common example of this are device ID structures. A driver | 46 | The most common example of this are device ID structures. A driver |
46 | typically defines an array of device IDs that it supports. The format | 47 | typically defines an array of device IDs that it supports. The format |
47 | of these structures and the semantics for comparing device IDs are | 48 | of these structures and the semantics for comparing device IDs are |
48 | completely bus-specific. Defining them as bus-specific entities would | 49 | completely bus-specific. Defining them as bus-specific entities would |
49 | sacrifice type-safety, so we keep bus-specific structures around. | 50 | sacrifice type-safety, so we keep bus-specific structures around. |
50 | 51 | ||
51 | Bus-specific drivers should include a generic struct device_driver in | 52 | Bus-specific drivers should include a generic struct device_driver in |
52 | the definition of the bus-specific driver. Like this: | 53 | the definition of the bus-specific driver. Like this:: |
53 | 54 | ||
54 | struct pci_driver { | 55 | struct pci_driver { |
55 | const struct pci_device_id *id_table; | 56 | const struct pci_device_id *id_table; |
56 | struct device_driver driver; | 57 | struct device_driver driver; |
57 | }; | 58 | }; |
58 | 59 | ||
59 | A definition that included bus-specific fields would look like | 60 | A definition that included bus-specific fields would look like |
60 | (using the eepro100 driver again): | 61 | (using the eepro100 driver again):: |
61 | 62 | ||
62 | static struct pci_driver eepro100_driver = { | 63 | static struct pci_driver eepro100_driver = { |
63 | .id_table = eepro100_pci_tbl, | 64 | .id_table = eepro100_pci_tbl, |
64 | .driver = { | 65 | .driver = { |
65 | .name = "eepro100", | 66 | .name = "eepro100", |
66 | .bus = &pci_bus_type, | 67 | .bus = &pci_bus_type, |
67 | .probe = eepro100_probe, | 68 | .probe = eepro100_probe, |
68 | .remove = eepro100_remove, | 69 | .remove = eepro100_remove, |
69 | .suspend = eepro100_suspend, | 70 | .suspend = eepro100_suspend, |
70 | .resume = eepro100_resume, | 71 | .resume = eepro100_resume, |
71 | }, | 72 | }, |
72 | }; | 73 | }; |
73 | 74 | ||
74 | Some may find the syntax of embedded struct initialization awkward or | 75 | Some may find the syntax of embedded struct initialization awkward or |
75 | even a bit ugly. So far, it's the best way we've found to do what we want... | 76 | even a bit ugly. So far, it's the best way we've found to do what we want... |
@@ -77,12 +78,14 @@ even a bit ugly. So far, it's the best way we've found to do what we want... | |||
77 | Registration | 78 | Registration |
78 | ~~~~~~~~~~~~ | 79 | ~~~~~~~~~~~~ |
79 | 80 | ||
80 | int driver_register(struct device_driver * drv); | 81 | :: |
82 | |||
83 | int driver_register(struct device_driver *drv); | ||
81 | 84 | ||
82 | The driver registers the structure on startup. For drivers that have | 85 | The driver registers the structure on startup. For drivers that have |
83 | no bus-specific fields (i.e. don't have a bus-specific driver | 86 | no bus-specific fields (i.e. don't have a bus-specific driver |
84 | structure), they would use driver_register and pass a pointer to their | 87 | structure), they would use driver_register and pass a pointer to their |
85 | struct device_driver object. | 88 | struct device_driver object. |
86 | 89 | ||
87 | Most drivers, however, will have a bus-specific structure and will | 90 | Most drivers, however, will have a bus-specific structure and will |
88 | need to register with the bus using something like pci_driver_register. | 91 | need to register with the bus using something like pci_driver_register. |
@@ -101,7 +104,7 @@ By defining wrapper functions, the transition to the new model can be | |||
101 | made easier. Drivers can ignore the generic structure altogether and | 104 | made easier. Drivers can ignore the generic structure altogether and |
102 | let the bus wrapper fill in the fields. For the callbacks, the bus can | 105 | let the bus wrapper fill in the fields. For the callbacks, the bus can |
103 | define generic callbacks that forward the call to the bus-specific | 106 | define generic callbacks that forward the call to the bus-specific |
104 | callbacks of the drivers. | 107 | callbacks of the drivers. |
105 | 108 | ||
106 | This solution is intended to be only temporary. In order to get class | 109 | This solution is intended to be only temporary. In order to get class |
107 | information in the driver, the drivers must be modified anyway. Since | 110 | information in the driver, the drivers must be modified anyway. Since |
@@ -113,16 +116,16 @@ Access | |||
113 | ~~~~~~ | 116 | ~~~~~~ |
114 | 117 | ||
115 | Once the object has been registered, it may access the common fields of | 118 | Once the object has been registered, it may access the common fields of |
116 | the object, like the lock and the list of devices. | 119 | the object, like the lock and the list of devices:: |
117 | 120 | ||
118 | int driver_for_each_dev(struct device_driver * drv, void * data, | 121 | int driver_for_each_dev(struct device_driver *drv, void *data, |
119 | int (*callback)(struct device * dev, void * data)); | 122 | int (*callback)(struct device *dev, void *data)); |
120 | 123 | ||
121 | The devices field is a list of all the devices that have been bound to | 124 | The devices field is a list of all the devices that have been bound to |
122 | the driver. The LDM core provides a helper function to operate on all | 125 | the driver. The LDM core provides a helper function to operate on all |
123 | the devices a driver controls. This helper locks the driver on each | 126 | the devices a driver controls. This helper locks the driver on each |
124 | node access, and does proper reference counting on each device as it | 127 | node access, and does proper reference counting on each device as it |
125 | accesses it. | 128 | accesses it. |
126 | 129 | ||
127 | 130 | ||
128 | sysfs | 131 | sysfs |
@@ -142,7 +145,9 @@ supports. | |||
142 | Callbacks | 145 | Callbacks |
143 | ~~~~~~~~~ | 146 | ~~~~~~~~~ |
144 | 147 | ||
145 | int (*probe) (struct device * dev); | 148 | :: |
149 | |||
150 | int (*probe) (struct device *dev); | ||
146 | 151 | ||
147 | The probe() entry is called in task context, with the bus's rwsem locked | 152 | The probe() entry is called in task context, with the bus's rwsem locked |
148 | and the driver partially bound to the device. Drivers commonly use | 153 | and the driver partially bound to the device. Drivers commonly use |
@@ -162,9 +167,9 @@ the driver to that device. | |||
162 | 167 | ||
163 | A driver's probe() may return a negative errno value to indicate that | 168 | A driver's probe() may return a negative errno value to indicate that |
164 | the driver did not bind to this device, in which case it should have | 169 | the driver did not bind to this device, in which case it should have |
165 | released all resources it allocated. | 170 | released all resources it allocated:: |
166 | 171 | ||
167 | int (*remove) (struct device * dev); | 172 | int (*remove) (struct device *dev); |
168 | 173 | ||
169 | remove is called to unbind a driver from a device. This may be | 174 | remove is called to unbind a driver from a device. This may be |
170 | called if a device is physically removed from the system, if the | 175 | called if a device is physically removed from the system, if the |
@@ -173,43 +178,46 @@ in other cases. | |||
173 | 178 | ||
174 | It is up to the driver to determine if the device is present or | 179 | It is up to the driver to determine if the device is present or |
175 | not. It should free any resources allocated specifically for the | 180 | not. It should free any resources allocated specifically for the |
176 | device; i.e. anything in the device's driver_data field. | 181 | device; i.e. anything in the device's driver_data field. |
177 | 182 | ||
178 | If the device is still present, it should quiesce the device and place | 183 | If the device is still present, it should quiesce the device and place |
179 | it into a supported low-power state. | 184 | it into a supported low-power state:: |
180 | 185 | ||
181 | int (*suspend) (struct device * dev, pm_message_t state); | 186 | int (*suspend) (struct device *dev, pm_message_t state); |
182 | 187 | ||
183 | suspend is called to put the device in a low power state. | 188 | suspend is called to put the device in a low power state:: |
184 | 189 | ||
185 | int (*resume) (struct device * dev); | 190 | int (*resume) (struct device *dev); |
186 | 191 | ||
187 | Resume is used to bring a device back from a low power state. | 192 | Resume is used to bring a device back from a low power state. |
188 | 193 | ||
189 | 194 | ||
190 | Attributes | 195 | Attributes |
191 | ~~~~~~~~~~ | 196 | ~~~~~~~~~~ |
192 | struct driver_attribute { | ||
193 | struct attribute attr; | ||
194 | ssize_t (*show)(struct device_driver *driver, char *buf); | ||
195 | ssize_t (*store)(struct device_driver *, const char * buf, size_t count); | ||
196 | }; | ||
197 | 197 | ||
198 | Device drivers can export attributes via their sysfs directories. | 198 | :: |
199 | |||
200 | struct driver_attribute { | ||
201 | struct attribute attr; | ||
202 | ssize_t (*show)(struct device_driver *driver, char *buf); | ||
203 | ssize_t (*store)(struct device_driver *, const char *buf, size_t count); | ||
204 | }; | ||
205 | |||
206 | Device drivers can export attributes via their sysfs directories. | ||
199 | Drivers can declare attributes using a DRIVER_ATTR_RW and DRIVER_ATTR_RO | 207 | Drivers can declare attributes using a DRIVER_ATTR_RW and DRIVER_ATTR_RO |
200 | macro that works identically to the DEVICE_ATTR_RW and DEVICE_ATTR_RO | 208 | macro that works identically to the DEVICE_ATTR_RW and DEVICE_ATTR_RO |
201 | macros. | 209 | macros. |
202 | 210 | ||
203 | Example: | 211 | Example:: |
204 | 212 | ||
205 | DRIVER_ATTR_RW(debug); | 213 | DRIVER_ATTR_RW(debug); |
206 | 214 | ||
207 | This is equivalent to declaring: | 215 | This is equivalent to declaring:: |
208 | 216 | ||
209 | struct driver_attribute driver_attr_debug; | 217 | struct driver_attribute driver_attr_debug; |
210 | 218 | ||
211 | This can then be used to add and remove the attribute from the | 219 | This can then be used to add and remove the attribute from the |
212 | driver's directory using: | 220 | driver's directory using:: |
213 | 221 | ||
214 | int driver_create_file(struct device_driver *, const struct driver_attribute *); | 222 | int driver_create_file(struct device_driver *, const struct driver_attribute *); |
215 | void driver_remove_file(struct device_driver *, const struct driver_attribute *); | 223 | void driver_remove_file(struct device_driver *, const struct driver_attribute *); |
diff --git a/Documentation/driver-model/index.rst b/Documentation/driver-model/index.rst new file mode 100644 index 000000000000..9f85d579ce56 --- /dev/null +++ b/Documentation/driver-model/index.rst | |||
@@ -0,0 +1,26 @@ | |||
1 | :orphan: | ||
2 | |||
3 | ============ | ||
4 | Driver Model | ||
5 | ============ | ||
6 | |||
7 | .. toctree:: | ||
8 | :maxdepth: 1 | ||
9 | |||
10 | binding | ||
11 | bus | ||
12 | class | ||
13 | design-patterns | ||
14 | device | ||
15 | devres | ||
16 | driver | ||
17 | overview | ||
18 | platform | ||
19 | porting | ||
20 | |||
21 | .. only:: subproject and html | ||
22 | |||
23 | Indices | ||
24 | ======= | ||
25 | |||
26 | * :ref:`genindex` | ||
diff --git a/Documentation/driver-model/overview.txt b/Documentation/driver-model/overview.rst index 6a8f9a8075d8..d4d1e9b40e0c 100644 --- a/Documentation/driver-model/overview.txt +++ b/Documentation/driver-model/overview.rst | |||
@@ -1,4 +1,6 @@ | |||
1 | ============================= | ||
1 | The Linux Kernel Device Model | 2 | The Linux Kernel Device Model |
3 | ============================= | ||
2 | 4 | ||
3 | Patrick Mochel <mochel@digitalimplant.org> | 5 | Patrick Mochel <mochel@digitalimplant.org> |
4 | 6 | ||
@@ -41,14 +43,14 @@ data structure. These fields must still be accessed by the bus layers, | |||
41 | and sometimes by the device-specific drivers. | 43 | and sometimes by the device-specific drivers. |
42 | 44 | ||
43 | Other bus layers are encouraged to do what has been done for the PCI layer. | 45 | Other bus layers are encouraged to do what has been done for the PCI layer. |
44 | struct pci_dev now looks like this: | 46 | struct pci_dev now looks like this:: |
45 | 47 | ||
46 | struct pci_dev { | 48 | struct pci_dev { |
47 | ... | 49 | ... |
48 | 50 | ||
49 | struct device dev; /* Generic device interface */ | 51 | struct device dev; /* Generic device interface */ |
50 | ... | 52 | ... |
51 | }; | 53 | }; |
52 | 54 | ||
53 | Note first that the struct device dev within the struct pci_dev is | 55 | Note first that the struct device dev within the struct pci_dev is |
54 | statically allocated. This means only one allocation on device discovery. | 56 | statically allocated. This means only one allocation on device discovery. |
@@ -80,26 +82,26 @@ easy. This has been accomplished by implementing a special purpose virtual | |||
80 | file system named sysfs. | 82 | file system named sysfs. |
81 | 83 | ||
82 | Almost all mainstream Linux distros mount this filesystem automatically; you | 84 | Almost all mainstream Linux distros mount this filesystem automatically; you |
83 | can see some variation of the following in the output of the "mount" command: | 85 | can see some variation of the following in the output of the "mount" command:: |
84 | 86 | ||
85 | $ mount | 87 | $ mount |
86 | ... | 88 | ... |
87 | none on /sys type sysfs (rw,noexec,nosuid,nodev) | 89 | none on /sys type sysfs (rw,noexec,nosuid,nodev) |
88 | ... | 90 | ... |
89 | $ | 91 | $ |
90 | 92 | ||
91 | The auto-mounting of sysfs is typically accomplished by an entry similar to | 93 | The auto-mounting of sysfs is typically accomplished by an entry similar to |
92 | the following in the /etc/fstab file: | 94 | the following in the /etc/fstab file:: |
93 | 95 | ||
94 | none /sys sysfs defaults 0 0 | 96 | none /sys sysfs defaults 0 0 |
95 | 97 | ||
96 | or something similar in the /lib/init/fstab file on Debian-based systems: | 98 | or something similar in the /lib/init/fstab file on Debian-based systems:: |
97 | 99 | ||
98 | none /sys sysfs nodev,noexec,nosuid 0 0 | 100 | none /sys sysfs nodev,noexec,nosuid 0 0 |
99 | 101 | ||
100 | If sysfs is not automatically mounted, you can always do it manually with: | 102 | If sysfs is not automatically mounted, you can always do it manually with:: |
101 | 103 | ||
102 | # mount -t sysfs sysfs /sys | 104 | # mount -t sysfs sysfs /sys |
103 | 105 | ||
104 | Whenever a device is inserted into the tree, a directory is created for it. | 106 | Whenever a device is inserted into the tree, a directory is created for it. |
105 | This directory may be populated at each layer of discovery - the global layer, | 107 | This directory may be populated at each layer of discovery - the global layer, |
@@ -108,7 +110,7 @@ the bus layer, or the device layer. | |||
108 | The global layer currently creates two files - 'name' and 'power'. The | 110 | The global layer currently creates two files - 'name' and 'power'. The |
109 | former only reports the name of the device. The latter reports the | 111 | former only reports the name of the device. The latter reports the |
110 | current power state of the device. It will also be used to set the current | 112 | current power state of the device. It will also be used to set the current |
111 | power state. | 113 | power state. |
112 | 114 | ||
113 | The bus layer may also create files for the devices it finds while probing the | 115 | The bus layer may also create files for the devices it finds while probing the |
114 | bus. For example, the PCI layer currently creates 'irq' and 'resource' files | 116 | bus. For example, the PCI layer currently creates 'irq' and 'resource' files |
@@ -118,6 +120,5 @@ A device-specific driver may also export files in its directory to expose | |||
118 | device-specific data or tunable interfaces. | 120 | device-specific data or tunable interfaces. |
119 | 121 | ||
120 | More information about the sysfs directory layout can be found in | 122 | More information about the sysfs directory layout can be found in |
121 | the other documents in this directory and in the file | 123 | the other documents in this directory and in the file |
122 | Documentation/filesystems/sysfs.txt. | 124 | Documentation/filesystems/sysfs.txt. |
123 | |||
diff --git a/Documentation/driver-model/platform.txt b/Documentation/driver-model/platform.rst index 9d9e47dfc013..334dd4071ae4 100644 --- a/Documentation/driver-model/platform.txt +++ b/Documentation/driver-model/platform.rst | |||
@@ -1,5 +1,7 @@ | |||
1 | ============================ | ||
1 | Platform Devices and Drivers | 2 | Platform Devices and Drivers |
2 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | 3 | ============================ |
4 | |||
3 | See <linux/platform_device.h> for the driver model interface to the | 5 | See <linux/platform_device.h> for the driver model interface to the |
4 | platform bus: platform_device, and platform_driver. This pseudo-bus | 6 | platform bus: platform_device, and platform_driver. This pseudo-bus |
5 | is used to connect devices on busses with minimal infrastructure, | 7 | is used to connect devices on busses with minimal infrastructure, |
@@ -19,15 +21,15 @@ be connected through a segment of some other kind of bus; but its | |||
19 | registers will still be directly addressable. | 21 | registers will still be directly addressable. |
20 | 22 | ||
21 | Platform devices are given a name, used in driver binding, and a | 23 | Platform devices are given a name, used in driver binding, and a |
22 | list of resources such as addresses and IRQs. | 24 | list of resources such as addresses and IRQs:: |
23 | 25 | ||
24 | struct platform_device { | 26 | struct platform_device { |
25 | const char *name; | 27 | const char *name; |
26 | u32 id; | 28 | u32 id; |
27 | struct device dev; | 29 | struct device dev; |
28 | u32 num_resources; | 30 | u32 num_resources; |
29 | struct resource *resource; | 31 | struct resource *resource; |
30 | }; | 32 | }; |
31 | 33 | ||
32 | 34 | ||
33 | Platform drivers | 35 | Platform drivers |
@@ -35,9 +37,9 @@ Platform drivers | |||
35 | Platform drivers follow the standard driver model convention, where | 37 | Platform drivers follow the standard driver model convention, where |
36 | discovery/enumeration is handled outside the drivers, and drivers | 38 | discovery/enumeration is handled outside the drivers, and drivers |
37 | provide probe() and remove() methods. They support power management | 39 | provide probe() and remove() methods. They support power management |
38 | and shutdown notifications using the standard conventions. | 40 | and shutdown notifications using the standard conventions:: |
39 | 41 | ||
40 | struct platform_driver { | 42 | struct platform_driver { |
41 | int (*probe)(struct platform_device *); | 43 | int (*probe)(struct platform_device *); |
42 | int (*remove)(struct platform_device *); | 44 | int (*remove)(struct platform_device *); |
43 | void (*shutdown)(struct platform_device *); | 45 | void (*shutdown)(struct platform_device *); |
@@ -46,25 +48,25 @@ struct platform_driver { | |||
46 | int (*resume_early)(struct platform_device *); | 48 | int (*resume_early)(struct platform_device *); |
47 | int (*resume)(struct platform_device *); | 49 | int (*resume)(struct platform_device *); |
48 | struct device_driver driver; | 50 | struct device_driver driver; |
49 | }; | 51 | }; |
50 | 52 | ||
51 | Note that probe() should in general verify that the specified device hardware | 53 | Note that probe() should in general verify that the specified device hardware |
52 | actually exists; sometimes platform setup code can't be sure. The probing | 54 | actually exists; sometimes platform setup code can't be sure. The probing |
53 | can use device resources, including clocks, and device platform_data. | 55 | can use device resources, including clocks, and device platform_data. |
54 | 56 | ||
55 | Platform drivers register themselves the normal way: | 57 | Platform drivers register themselves the normal way:: |
56 | 58 | ||
57 | int platform_driver_register(struct platform_driver *drv); | 59 | int platform_driver_register(struct platform_driver *drv); |
58 | 60 | ||
59 | Or, in common situations where the device is known not to be hot-pluggable, | 61 | Or, in common situations where the device is known not to be hot-pluggable, |
60 | the probe() routine can live in an init section to reduce the driver's | 62 | the probe() routine can live in an init section to reduce the driver's |
61 | runtime memory footprint: | 63 | runtime memory footprint:: |
62 | 64 | ||
63 | int platform_driver_probe(struct platform_driver *drv, | 65 | int platform_driver_probe(struct platform_driver *drv, |
64 | int (*probe)(struct platform_device *)) | 66 | int (*probe)(struct platform_device *)) |
65 | 67 | ||
66 | Kernel modules can be composed of several platform drivers. The platform core | 68 | Kernel modules can be composed of several platform drivers. The platform core |
67 | provides helpers to register and unregister an array of drivers: | 69 | provides helpers to register and unregister an array of drivers:: |
68 | 70 | ||
69 | int __platform_register_drivers(struct platform_driver * const *drivers, | 71 | int __platform_register_drivers(struct platform_driver * const *drivers, |
70 | unsigned int count, struct module *owner); | 72 | unsigned int count, struct module *owner); |
@@ -73,7 +75,7 @@ provides helpers to register and unregister an array of drivers: | |||
73 | 75 | ||
74 | If one of the drivers fails to register, all drivers registered up to that | 76 | If one of the drivers fails to register, all drivers registered up to that |
75 | point will be unregistered in reverse order. Note that there is a convenience | 77 | point will be unregistered in reverse order. Note that there is a convenience |
76 | macro that passes THIS_MODULE as owner parameter: | 78 | macro that passes THIS_MODULE as owner parameter:: |
77 | 79 | ||
78 | #define platform_register_drivers(drivers, count) | 80 | #define platform_register_drivers(drivers, count) |
79 | 81 | ||
@@ -81,7 +83,7 @@ macro that passes THIS_MODULE as owner parameter: | |||
81 | Device Enumeration | 83 | Device Enumeration |
82 | ~~~~~~~~~~~~~~~~~~ | 84 | ~~~~~~~~~~~~~~~~~~ |
83 | As a rule, platform specific (and often board-specific) setup code will | 85 | As a rule, platform specific (and often board-specific) setup code will |
84 | register platform devices: | 86 | register platform devices:: |
85 | 87 | ||
86 | int platform_device_register(struct platform_device *pdev); | 88 | int platform_device_register(struct platform_device *pdev); |
87 | 89 | ||
@@ -133,14 +135,14 @@ tend to already have "normal" modes, such as ones using device nodes that | |||
133 | were created by PNP or by platform device setup. | 135 | were created by PNP or by platform device setup. |
134 | 136 | ||
135 | None the less, there are some APIs to support such legacy drivers. Avoid | 137 | None the less, there are some APIs to support such legacy drivers. Avoid |
136 | using these calls except with such hotplug-deficient drivers. | 138 | using these calls except with such hotplug-deficient drivers:: |
137 | 139 | ||
138 | struct platform_device *platform_device_alloc( | 140 | struct platform_device *platform_device_alloc( |
139 | const char *name, int id); | 141 | const char *name, int id); |
140 | 142 | ||
141 | You can use platform_device_alloc() to dynamically allocate a device, which | 143 | You can use platform_device_alloc() to dynamically allocate a device, which |
142 | you will then initialize with resources and platform_device_register(). | 144 | you will then initialize with resources and platform_device_register(). |
143 | A better solution is usually: | 145 | A better solution is usually:: |
144 | 146 | ||
145 | struct platform_device *platform_device_register_simple( | 147 | struct platform_device *platform_device_register_simple( |
146 | const char *name, int id, | 148 | const char *name, int id, |
diff --git a/Documentation/driver-model/porting.txt b/Documentation/driver-model/porting.rst index 453053f1661f..ae4bf843c1d6 100644 --- a/Documentation/driver-model/porting.txt +++ b/Documentation/driver-model/porting.rst | |||
@@ -1,5 +1,6 @@ | |||
1 | 1 | ======================================= | |
2 | Porting Drivers to the New Driver Model | 2 | Porting Drivers to the New Driver Model |
3 | ======================================= | ||
3 | 4 | ||
4 | Patrick Mochel | 5 | Patrick Mochel |
5 | 6 | ||
@@ -8,8 +9,8 @@ Patrick Mochel | |||
8 | 9 | ||
9 | Overview | 10 | Overview |
10 | 11 | ||
11 | Please refer to Documentation/driver-model/*.txt for definitions of | 12 | Please refer to `Documentation/driver-model/*.rst` for definitions of |
12 | various driver types and concepts. | 13 | various driver types and concepts. |
13 | 14 | ||
14 | Most of the work of porting devices drivers to the new model happens | 15 | Most of the work of porting devices drivers to the new model happens |
15 | at the bus driver layer. This was intentional, to minimize the | 16 | at the bus driver layer. This was intentional, to minimize the |
@@ -18,11 +19,11 @@ of bus drivers. | |||
18 | 19 | ||
19 | In a nutshell, the driver model consists of a set of objects that can | 20 | In a nutshell, the driver model consists of a set of objects that can |
20 | be embedded in larger, bus-specific objects. Fields in these generic | 21 | be embedded in larger, bus-specific objects. Fields in these generic |
21 | objects can replace fields in the bus-specific objects. | 22 | objects can replace fields in the bus-specific objects. |
22 | 23 | ||
23 | The generic objects must be registered with the driver model core. By | 24 | The generic objects must be registered with the driver model core. By |
24 | doing so, they will exported via the sysfs filesystem. sysfs can be | 25 | doing so, they will exported via the sysfs filesystem. sysfs can be |
25 | mounted by doing | 26 | mounted by doing:: |
26 | 27 | ||
27 | # mount -t sysfs sysfs /sys | 28 | # mount -t sysfs sysfs /sys |
28 | 29 | ||
@@ -30,108 +31,109 @@ mounted by doing | |||
30 | 31 | ||
31 | The Process | 32 | The Process |
32 | 33 | ||
33 | Step 0: Read include/linux/device.h for object and function definitions. | 34 | Step 0: Read include/linux/device.h for object and function definitions. |
34 | 35 | ||
35 | Step 1: Registering the bus driver. | 36 | Step 1: Registering the bus driver. |
36 | 37 | ||
37 | 38 | ||
38 | - Define a struct bus_type for the bus driver. | 39 | - Define a struct bus_type for the bus driver:: |
39 | 40 | ||
40 | struct bus_type pci_bus_type = { | 41 | struct bus_type pci_bus_type = { |
41 | .name = "pci", | 42 | .name = "pci", |
42 | }; | 43 | }; |
43 | 44 | ||
44 | 45 | ||
45 | - Register the bus type. | 46 | - Register the bus type. |
47 | |||
46 | This should be done in the initialization function for the bus type, | 48 | This should be done in the initialization function for the bus type, |
47 | which is usually the module_init(), or equivalent, function. | 49 | which is usually the module_init(), or equivalent, function:: |
48 | 50 | ||
49 | static int __init pci_driver_init(void) | 51 | static int __init pci_driver_init(void) |
50 | { | 52 | { |
51 | return bus_register(&pci_bus_type); | 53 | return bus_register(&pci_bus_type); |
52 | } | 54 | } |
53 | 55 | ||
54 | subsys_initcall(pci_driver_init); | 56 | subsys_initcall(pci_driver_init); |
55 | 57 | ||
56 | 58 | ||
57 | The bus type may be unregistered (if the bus driver may be compiled | 59 | The bus type may be unregistered (if the bus driver may be compiled |
58 | as a module) by doing: | 60 | as a module) by doing:: |
59 | 61 | ||
60 | bus_unregister(&pci_bus_type); | 62 | bus_unregister(&pci_bus_type); |
61 | 63 | ||
62 | 64 | ||
63 | - Export the bus type for others to use. | 65 | - Export the bus type for others to use. |
64 | 66 | ||
65 | Other code may wish to reference the bus type, so declare it in a | 67 | Other code may wish to reference the bus type, so declare it in a |
66 | shared header file and export the symbol. | 68 | shared header file and export the symbol. |
67 | 69 | ||
68 | From include/linux/pci.h: | 70 | From include/linux/pci.h:: |
69 | 71 | ||
70 | extern struct bus_type pci_bus_type; | 72 | extern struct bus_type pci_bus_type; |
71 | 73 | ||
72 | 74 | ||
73 | From file the above code appears in: | 75 | From file the above code appears in:: |
74 | 76 | ||
75 | EXPORT_SYMBOL(pci_bus_type); | 77 | EXPORT_SYMBOL(pci_bus_type); |
76 | 78 | ||
77 | 79 | ||
78 | 80 | ||
79 | - This will cause the bus to show up in /sys/bus/pci/ with two | 81 | - This will cause the bus to show up in /sys/bus/pci/ with two |
80 | subdirectories: 'devices' and 'drivers'. | 82 | subdirectories: 'devices' and 'drivers':: |
81 | 83 | ||
82 | # tree -d /sys/bus/pci/ | 84 | # tree -d /sys/bus/pci/ |
83 | /sys/bus/pci/ | 85 | /sys/bus/pci/ |
84 | |-- devices | 86 | |-- devices |
85 | `-- drivers | 87 | `-- drivers |
86 | 88 | ||
87 | 89 | ||
88 | 90 | ||
89 | Step 2: Registering Devices. | 91 | Step 2: Registering Devices. |
90 | 92 | ||
91 | struct device represents a single device. It mainly contains metadata | 93 | struct device represents a single device. It mainly contains metadata |
92 | describing the relationship the device has to other entities. | 94 | describing the relationship the device has to other entities. |
93 | 95 | ||
94 | 96 | ||
95 | - Embed a struct device in the bus-specific device type. | 97 | - Embed a struct device in the bus-specific device type:: |
96 | 98 | ||
97 | 99 | ||
98 | struct pci_dev { | 100 | struct pci_dev { |
99 | ... | 101 | ... |
100 | struct device dev; /* Generic device interface */ | 102 | struct device dev; /* Generic device interface */ |
101 | ... | 103 | ... |
102 | }; | 104 | }; |
103 | 105 | ||
104 | It is recommended that the generic device not be the first item in | 106 | It is recommended that the generic device not be the first item in |
105 | the struct to discourage programmers from doing mindless casts | 107 | the struct to discourage programmers from doing mindless casts |
106 | between the object types. Instead macros, or inline functions, | 108 | between the object types. Instead macros, or inline functions, |
107 | should be created to convert from the generic object type. | 109 | should be created to convert from the generic object type:: |
108 | 110 | ||
109 | 111 | ||
110 | #define to_pci_dev(n) container_of(n, struct pci_dev, dev) | 112 | #define to_pci_dev(n) container_of(n, struct pci_dev, dev) |
111 | 113 | ||
112 | or | 114 | or |
113 | 115 | ||
114 | static inline struct pci_dev * to_pci_dev(struct kobject * kobj) | 116 | static inline struct pci_dev * to_pci_dev(struct kobject * kobj) |
115 | { | 117 | { |
116 | return container_of(n, struct pci_dev, dev); | 118 | return container_of(n, struct pci_dev, dev); |
117 | } | 119 | } |
118 | 120 | ||
119 | This allows the compiler to verify type-safety of the operations | 121 | This allows the compiler to verify type-safety of the operations |
120 | that are performed (which is Good). | 122 | that are performed (which is Good). |
121 | 123 | ||
122 | 124 | ||
123 | - Initialize the device on registration. | 125 | - Initialize the device on registration. |
124 | 126 | ||
125 | When devices are discovered or registered with the bus type, the | 127 | When devices are discovered or registered with the bus type, the |
126 | bus driver should initialize the generic device. The most important | 128 | bus driver should initialize the generic device. The most important |
127 | things to initialize are the bus_id, parent, and bus fields. | 129 | things to initialize are the bus_id, parent, and bus fields. |
128 | 130 | ||
129 | The bus_id is an ASCII string that contains the device's address on | 131 | The bus_id is an ASCII string that contains the device's address on |
130 | the bus. The format of this string is bus-specific. This is | 132 | the bus. The format of this string is bus-specific. This is |
131 | necessary for representing devices in sysfs. | 133 | necessary for representing devices in sysfs. |
132 | 134 | ||
133 | parent is the physical parent of the device. It is important that | 135 | parent is the physical parent of the device. It is important that |
134 | the bus driver sets this field correctly. | 136 | the bus driver sets this field correctly. |
135 | 137 | ||
136 | The driver model maintains an ordered list of devices that it uses | 138 | The driver model maintains an ordered list of devices that it uses |
137 | for power management. This list must be in order to guarantee that | 139 | for power management. This list must be in order to guarantee that |
@@ -140,13 +142,13 @@ static inline struct pci_dev * to_pci_dev(struct kobject * kobj) | |||
140 | devices. | 142 | devices. |
141 | 143 | ||
142 | Also, the location of the device's sysfs directory depends on a | 144 | Also, the location of the device's sysfs directory depends on a |
143 | device's parent. sysfs exports a directory structure that mirrors | 145 | device's parent. sysfs exports a directory structure that mirrors |
144 | the device hierarchy. Accurately setting the parent guarantees that | 146 | the device hierarchy. Accurately setting the parent guarantees that |
145 | sysfs will accurately represent the hierarchy. | 147 | sysfs will accurately represent the hierarchy. |
146 | 148 | ||
147 | The device's bus field is a pointer to the bus type the device | 149 | The device's bus field is a pointer to the bus type the device |
148 | belongs to. This should be set to the bus_type that was declared | 150 | belongs to. This should be set to the bus_type that was declared |
149 | and initialized before. | 151 | and initialized before. |
150 | 152 | ||
151 | Optionally, the bus driver may set the device's name and release | 153 | Optionally, the bus driver may set the device's name and release |
152 | fields. | 154 | fields. |
@@ -155,107 +157,107 @@ static inline struct pci_dev * to_pci_dev(struct kobject * kobj) | |||
155 | 157 | ||
156 | "ATI Technologies Inc Radeon QD" | 158 | "ATI Technologies Inc Radeon QD" |
157 | 159 | ||
158 | The release field is a callback that the driver model core calls | 160 | The release field is a callback that the driver model core calls |
159 | when the device has been removed, and all references to it have | 161 | when the device has been removed, and all references to it have |
160 | been released. More on this in a moment. | 162 | been released. More on this in a moment. |
161 | 163 | ||
162 | 164 | ||
163 | - Register the device. | 165 | - Register the device. |
164 | 166 | ||
165 | Once the generic device has been initialized, it can be registered | 167 | Once the generic device has been initialized, it can be registered |
166 | with the driver model core by doing: | 168 | with the driver model core by doing:: |
167 | 169 | ||
168 | device_register(&dev->dev); | 170 | device_register(&dev->dev); |
169 | 171 | ||
170 | It can later be unregistered by doing: | 172 | It can later be unregistered by doing:: |
171 | 173 | ||
172 | device_unregister(&dev->dev); | 174 | device_unregister(&dev->dev); |
173 | 175 | ||
174 | This should happen on buses that support hotpluggable devices. | 176 | This should happen on buses that support hotpluggable devices. |
175 | If a bus driver unregisters a device, it should not immediately free | 177 | If a bus driver unregisters a device, it should not immediately free |
176 | it. It should instead wait for the driver model core to call the | 178 | it. It should instead wait for the driver model core to call the |
177 | device's release method, then free the bus-specific object. | 179 | device's release method, then free the bus-specific object. |
178 | (There may be other code that is currently referencing the device | 180 | (There may be other code that is currently referencing the device |
179 | structure, and it would be rude to free the device while that is | 181 | structure, and it would be rude to free the device while that is |
180 | happening). | 182 | happening). |
181 | 183 | ||
182 | 184 | ||
183 | When the device is registered, a directory in sysfs is created. | 185 | When the device is registered, a directory in sysfs is created. |
184 | The PCI tree in sysfs looks like: | 186 | The PCI tree in sysfs looks like:: |
185 | 187 | ||
186 | /sys/devices/pci0/ | 188 | /sys/devices/pci0/ |
187 | |-- 00:00.0 | 189 | |-- 00:00.0 |
188 | |-- 00:01.0 | 190 | |-- 00:01.0 |
189 | | `-- 01:00.0 | 191 | | `-- 01:00.0 |
190 | |-- 00:02.0 | 192 | |-- 00:02.0 |
191 | | `-- 02:1f.0 | 193 | | `-- 02:1f.0 |
192 | | `-- 03:00.0 | 194 | | `-- 03:00.0 |
193 | |-- 00:1e.0 | 195 | |-- 00:1e.0 |
194 | | `-- 04:04.0 | 196 | | `-- 04:04.0 |
195 | |-- 00:1f.0 | 197 | |-- 00:1f.0 |
196 | |-- 00:1f.1 | 198 | |-- 00:1f.1 |
197 | | |-- ide0 | 199 | | |-- ide0 |
198 | | | |-- 0.0 | 200 | | | |-- 0.0 |
199 | | | `-- 0.1 | 201 | | | `-- 0.1 |
200 | | `-- ide1 | 202 | | `-- ide1 |
201 | | `-- 1.0 | 203 | | `-- 1.0 |
202 | |-- 00:1f.2 | 204 | |-- 00:1f.2 |
203 | |-- 00:1f.3 | 205 | |-- 00:1f.3 |
204 | `-- 00:1f.5 | 206 | `-- 00:1f.5 |
205 | 207 | ||
206 | Also, symlinks are created in the bus's 'devices' directory | 208 | Also, symlinks are created in the bus's 'devices' directory |
207 | that point to the device's directory in the physical hierarchy. | 209 | that point to the device's directory in the physical hierarchy:: |
208 | 210 | ||
209 | /sys/bus/pci/devices/ | 211 | /sys/bus/pci/devices/ |
210 | |-- 00:00.0 -> ../../../devices/pci0/00:00.0 | 212 | |-- 00:00.0 -> ../../../devices/pci0/00:00.0 |
211 | |-- 00:01.0 -> ../../../devices/pci0/00:01.0 | 213 | |-- 00:01.0 -> ../../../devices/pci0/00:01.0 |
212 | |-- 00:02.0 -> ../../../devices/pci0/00:02.0 | 214 | |-- 00:02.0 -> ../../../devices/pci0/00:02.0 |
213 | |-- 00:1e.0 -> ../../../devices/pci0/00:1e.0 | 215 | |-- 00:1e.0 -> ../../../devices/pci0/00:1e.0 |
214 | |-- 00:1f.0 -> ../../../devices/pci0/00:1f.0 | 216 | |-- 00:1f.0 -> ../../../devices/pci0/00:1f.0 |
215 | |-- 00:1f.1 -> ../../../devices/pci0/00:1f.1 | 217 | |-- 00:1f.1 -> ../../../devices/pci0/00:1f.1 |
216 | |-- 00:1f.2 -> ../../../devices/pci0/00:1f.2 | 218 | |-- 00:1f.2 -> ../../../devices/pci0/00:1f.2 |
217 | |-- 00:1f.3 -> ../../../devices/pci0/00:1f.3 | 219 | |-- 00:1f.3 -> ../../../devices/pci0/00:1f.3 |
218 | |-- 00:1f.5 -> ../../../devices/pci0/00:1f.5 | 220 | |-- 00:1f.5 -> ../../../devices/pci0/00:1f.5 |
219 | |-- 01:00.0 -> ../../../devices/pci0/00:01.0/01:00.0 | 221 | |-- 01:00.0 -> ../../../devices/pci0/00:01.0/01:00.0 |
220 | |-- 02:1f.0 -> ../../../devices/pci0/00:02.0/02:1f.0 | 222 | |-- 02:1f.0 -> ../../../devices/pci0/00:02.0/02:1f.0 |
221 | |-- 03:00.0 -> ../../../devices/pci0/00:02.0/02:1f.0/03:00.0 | 223 | |-- 03:00.0 -> ../../../devices/pci0/00:02.0/02:1f.0/03:00.0 |
222 | `-- 04:04.0 -> ../../../devices/pci0/00:1e.0/04:04.0 | 224 | `-- 04:04.0 -> ../../../devices/pci0/00:1e.0/04:04.0 |
223 | 225 | ||
224 | 226 | ||
225 | 227 | ||
226 | Step 3: Registering Drivers. | 228 | Step 3: Registering Drivers. |
227 | 229 | ||
228 | struct device_driver is a simple driver structure that contains a set | 230 | struct device_driver is a simple driver structure that contains a set |
229 | of operations that the driver model core may call. | 231 | of operations that the driver model core may call. |
230 | 232 | ||
231 | 233 | ||
232 | - Embed a struct device_driver in the bus-specific driver. | 234 | - Embed a struct device_driver in the bus-specific driver. |
233 | 235 | ||
234 | Just like with devices, do something like: | 236 | Just like with devices, do something like:: |
235 | 237 | ||
236 | struct pci_driver { | 238 | struct pci_driver { |
237 | ... | 239 | ... |
238 | struct device_driver driver; | 240 | struct device_driver driver; |
239 | }; | 241 | }; |
240 | 242 | ||
241 | 243 | ||
242 | - Initialize the generic driver structure. | 244 | - Initialize the generic driver structure. |
243 | 245 | ||
244 | When the driver registers with the bus (e.g. doing pci_register_driver()), | 246 | When the driver registers with the bus (e.g. doing pci_register_driver()), |
245 | initialize the necessary fields of the driver: the name and bus | 247 | initialize the necessary fields of the driver: the name and bus |
246 | fields. | 248 | fields. |
247 | 249 | ||
248 | 250 | ||
249 | - Register the driver. | 251 | - Register the driver. |
250 | 252 | ||
251 | After the generic driver has been initialized, call | 253 | After the generic driver has been initialized, call:: |
252 | 254 | ||
253 | driver_register(&drv->driver); | 255 | driver_register(&drv->driver); |
254 | 256 | ||
255 | to register the driver with the core. | 257 | to register the driver with the core. |
256 | 258 | ||
257 | When the driver is unregistered from the bus, unregister it from the | 259 | When the driver is unregistered from the bus, unregister it from the |
258 | core by doing: | 260 | core by doing:: |
259 | 261 | ||
260 | driver_unregister(&drv->driver); | 262 | driver_unregister(&drv->driver); |
261 | 263 | ||
@@ -265,15 +267,15 @@ struct pci_driver { | |||
265 | 267 | ||
266 | - Sysfs representation. | 268 | - Sysfs representation. |
267 | 269 | ||
268 | Drivers are exported via sysfs in their bus's 'driver's directory. | 270 | Drivers are exported via sysfs in their bus's 'driver's directory. |
269 | For example: | 271 | For example:: |
270 | 272 | ||
271 | /sys/bus/pci/drivers/ | 273 | /sys/bus/pci/drivers/ |
272 | |-- 3c59x | 274 | |-- 3c59x |
273 | |-- Ensoniq AudioPCI | 275 | |-- Ensoniq AudioPCI |
274 | |-- agpgart-amdk7 | 276 | |-- agpgart-amdk7 |
275 | |-- e100 | 277 | |-- e100 |
276 | `-- serial | 278 | `-- serial |
277 | 279 | ||
278 | 280 | ||
279 | Step 4: Define Generic Methods for Drivers. | 281 | Step 4: Define Generic Methods for Drivers. |
@@ -281,30 +283,30 @@ Step 4: Define Generic Methods for Drivers. | |||
281 | struct device_driver defines a set of operations that the driver model | 283 | struct device_driver defines a set of operations that the driver model |
282 | core calls. Most of these operations are probably similar to | 284 | core calls. Most of these operations are probably similar to |
283 | operations the bus already defines for drivers, but taking different | 285 | operations the bus already defines for drivers, but taking different |
284 | parameters. | 286 | parameters. |
285 | 287 | ||
286 | It would be difficult and tedious to force every driver on a bus to | 288 | It would be difficult and tedious to force every driver on a bus to |
287 | simultaneously convert their drivers to generic format. Instead, the | 289 | simultaneously convert their drivers to generic format. Instead, the |
288 | bus driver should define single instances of the generic methods that | 290 | bus driver should define single instances of the generic methods that |
289 | forward call to the bus-specific drivers. For instance: | 291 | forward call to the bus-specific drivers. For instance:: |
290 | 292 | ||
291 | 293 | ||
292 | static int pci_device_remove(struct device * dev) | 294 | static int pci_device_remove(struct device * dev) |
293 | { | 295 | { |
294 | struct pci_dev * pci_dev = to_pci_dev(dev); | 296 | struct pci_dev * pci_dev = to_pci_dev(dev); |
295 | struct pci_driver * drv = pci_dev->driver; | 297 | struct pci_driver * drv = pci_dev->driver; |
296 | 298 | ||
297 | if (drv) { | 299 | if (drv) { |
298 | if (drv->remove) | 300 | if (drv->remove) |
299 | drv->remove(pci_dev); | 301 | drv->remove(pci_dev); |
300 | pci_dev->driver = NULL; | 302 | pci_dev->driver = NULL; |
301 | } | 303 | } |
302 | return 0; | 304 | return 0; |
303 | } | 305 | } |
304 | 306 | ||
305 | 307 | ||
306 | The generic driver should be initialized with these methods before it | 308 | The generic driver should be initialized with these methods before it |
307 | is registered. | 309 | is registered:: |
308 | 310 | ||
309 | /* initialize common driver fields */ | 311 | /* initialize common driver fields */ |
310 | drv->driver.name = drv->name; | 312 | drv->driver.name = drv->name; |
@@ -320,23 +322,23 @@ is registered. | |||
320 | 322 | ||
321 | Ideally, the bus should only initialize the fields if they are not | 323 | Ideally, the bus should only initialize the fields if they are not |
322 | already set. This allows the drivers to implement their own generic | 324 | already set. This allows the drivers to implement their own generic |
323 | methods. | 325 | methods. |
324 | 326 | ||
325 | 327 | ||
326 | Step 5: Support generic driver binding. | 328 | Step 5: Support generic driver binding. |
327 | 329 | ||
328 | The model assumes that a device or driver can be dynamically | 330 | The model assumes that a device or driver can be dynamically |
329 | registered with the bus at any time. When registration happens, | 331 | registered with the bus at any time. When registration happens, |
330 | devices must be bound to a driver, or drivers must be bound to all | 332 | devices must be bound to a driver, or drivers must be bound to all |
331 | devices that it supports. | 333 | devices that it supports. |
332 | 334 | ||
333 | A driver typically contains a list of device IDs that it supports. The | 335 | A driver typically contains a list of device IDs that it supports. The |
334 | bus driver compares these IDs to the IDs of devices registered with it. | 336 | bus driver compares these IDs to the IDs of devices registered with it. |
335 | The format of the device IDs, and the semantics for comparing them are | 337 | The format of the device IDs, and the semantics for comparing them are |
336 | bus-specific, so the generic model does attempt to generalize them. | 338 | bus-specific, so the generic model does attempt to generalize them. |
337 | 339 | ||
338 | Instead, a bus may supply a method in struct bus_type that does the | 340 | Instead, a bus may supply a method in struct bus_type that does the |
339 | comparison: | 341 | comparison:: |
340 | 342 | ||
341 | int (*match)(struct device * dev, struct device_driver * drv); | 343 | int (*match)(struct device * dev, struct device_driver * drv); |
342 | 344 | ||
@@ -346,59 +348,59 @@ and zero otherwise. It may also return error code (for example | |||
346 | not possible. | 348 | not possible. |
347 | 349 | ||
348 | When a device is registered, the bus's list of drivers is iterated | 350 | When a device is registered, the bus's list of drivers is iterated |
349 | over. bus->match() is called for each one until a match is found. | 351 | over. bus->match() is called for each one until a match is found. |
350 | 352 | ||
351 | When a driver is registered, the bus's list of devices is iterated | 353 | When a driver is registered, the bus's list of devices is iterated |
352 | over. bus->match() is called for each device that is not already | 354 | over. bus->match() is called for each device that is not already |
353 | claimed by a driver. | 355 | claimed by a driver. |
354 | 356 | ||
355 | When a device is successfully bound to a driver, device->driver is | 357 | When a device is successfully bound to a driver, device->driver is |
356 | set, the device is added to a per-driver list of devices, and a | 358 | set, the device is added to a per-driver list of devices, and a |
357 | symlink is created in the driver's sysfs directory that points to the | 359 | symlink is created in the driver's sysfs directory that points to the |
358 | device's physical directory: | 360 | device's physical directory:: |
359 | 361 | ||
360 | /sys/bus/pci/drivers/ | 362 | /sys/bus/pci/drivers/ |
361 | |-- 3c59x | 363 | |-- 3c59x |
362 | | `-- 00:0b.0 -> ../../../../devices/pci0/00:0b.0 | 364 | | `-- 00:0b.0 -> ../../../../devices/pci0/00:0b.0 |
363 | |-- Ensoniq AudioPCI | 365 | |-- Ensoniq AudioPCI |
364 | |-- agpgart-amdk7 | 366 | |-- agpgart-amdk7 |
365 | | `-- 00:00.0 -> ../../../../devices/pci0/00:00.0 | 367 | | `-- 00:00.0 -> ../../../../devices/pci0/00:00.0 |
366 | |-- e100 | 368 | |-- e100 |
367 | | `-- 00:0c.0 -> ../../../../devices/pci0/00:0c.0 | 369 | | `-- 00:0c.0 -> ../../../../devices/pci0/00:0c.0 |
368 | `-- serial | 370 | `-- serial |
369 | 371 | ||
370 | 372 | ||
371 | This driver binding should replace the existing driver binding | 373 | This driver binding should replace the existing driver binding |
372 | mechanism the bus currently uses. | 374 | mechanism the bus currently uses. |
373 | 375 | ||
374 | 376 | ||
375 | Step 6: Supply a hotplug callback. | 377 | Step 6: Supply a hotplug callback. |
376 | 378 | ||
377 | Whenever a device is registered with the driver model core, the | 379 | Whenever a device is registered with the driver model core, the |
378 | userspace program /sbin/hotplug is called to notify userspace. | 380 | userspace program /sbin/hotplug is called to notify userspace. |
379 | Users can define actions to perform when a device is inserted or | 381 | Users can define actions to perform when a device is inserted or |
380 | removed. | 382 | removed. |
381 | 383 | ||
382 | The driver model core passes several arguments to userspace via | 384 | The driver model core passes several arguments to userspace via |
383 | environment variables, including | 385 | environment variables, including |
384 | 386 | ||
385 | - ACTION: set to 'add' or 'remove' | 387 | - ACTION: set to 'add' or 'remove' |
386 | - DEVPATH: set to the device's physical path in sysfs. | 388 | - DEVPATH: set to the device's physical path in sysfs. |
387 | 389 | ||
388 | A bus driver may also supply additional parameters for userspace to | 390 | A bus driver may also supply additional parameters for userspace to |
389 | consume. To do this, a bus must implement the 'hotplug' method in | 391 | consume. To do this, a bus must implement the 'hotplug' method in |
390 | struct bus_type: | 392 | struct bus_type:: |
391 | 393 | ||
392 | int (*hotplug) (struct device *dev, char **envp, | 394 | int (*hotplug) (struct device *dev, char **envp, |
393 | int num_envp, char *buffer, int buffer_size); | 395 | int num_envp, char *buffer, int buffer_size); |
394 | 396 | ||
395 | This is called immediately before /sbin/hotplug is executed. | 397 | This is called immediately before /sbin/hotplug is executed. |
396 | 398 | ||
397 | 399 | ||
398 | Step 7: Cleaning up the bus driver. | 400 | Step 7: Cleaning up the bus driver. |
399 | 401 | ||
400 | The generic bus, device, and driver structures provide several fields | 402 | The generic bus, device, and driver structures provide several fields |
401 | that can replace those defined privately to the bus driver. | 403 | that can replace those defined privately to the bus driver. |
402 | 404 | ||
403 | - Device list. | 405 | - Device list. |
404 | 406 | ||
@@ -407,36 +409,36 @@ type. This includes all devices on all instances of that bus type. | |||
407 | An internal list that the bus uses may be removed, in favor of using | 409 | An internal list that the bus uses may be removed, in favor of using |
408 | this one. | 410 | this one. |
409 | 411 | ||
410 | The core provides an iterator to access these devices. | 412 | The core provides an iterator to access these devices:: |
411 | 413 | ||
412 | int bus_for_each_dev(struct bus_type * bus, struct device * start, | 414 | int bus_for_each_dev(struct bus_type * bus, struct device * start, |
413 | void * data, int (*fn)(struct device *, void *)); | 415 | void * data, int (*fn)(struct device *, void *)); |
414 | 416 | ||
415 | 417 | ||
416 | - Driver list. | 418 | - Driver list. |
417 | 419 | ||
418 | struct bus_type also contains a list of all drivers registered with | 420 | struct bus_type also contains a list of all drivers registered with |
419 | it. An internal list of drivers that the bus driver maintains may | 421 | it. An internal list of drivers that the bus driver maintains may |
420 | be removed in favor of using the generic one. | 422 | be removed in favor of using the generic one. |
421 | 423 | ||
422 | The drivers may be iterated over, like devices: | 424 | The drivers may be iterated over, like devices:: |
423 | 425 | ||
424 | int bus_for_each_drv(struct bus_type * bus, struct device_driver * start, | 426 | int bus_for_each_drv(struct bus_type * bus, struct device_driver * start, |
425 | void * data, int (*fn)(struct device_driver *, void *)); | 427 | void * data, int (*fn)(struct device_driver *, void *)); |
426 | 428 | ||
427 | 429 | ||
428 | Please see drivers/base/bus.c for more information. | 430 | Please see drivers/base/bus.c for more information. |
429 | 431 | ||
430 | 432 | ||
431 | - rwsem | 433 | - rwsem |
432 | 434 | ||
433 | struct bus_type contains an rwsem that protects all core accesses to | 435 | struct bus_type contains an rwsem that protects all core accesses to |
434 | the device and driver lists. This can be used by the bus driver | 436 | the device and driver lists. This can be used by the bus driver |
435 | internally, and should be used when accessing the device or driver | 437 | internally, and should be used when accessing the device or driver |
436 | lists the bus maintains. | 438 | lists the bus maintains. |
437 | 439 | ||
438 | 440 | ||
439 | - Device and driver fields. | 441 | - Device and driver fields. |
440 | 442 | ||
441 | Some of the fields in struct device and struct device_driver duplicate | 443 | Some of the fields in struct device and struct device_driver duplicate |
442 | fields in the bus-specific representations of these objects. Feel free | 444 | fields in the bus-specific representations of these objects. Feel free |
@@ -444,4 +446,3 @@ to remove the bus-specific ones and favor the generic ones. Note | |||
444 | though, that this will likely mean fixing up all the drivers that | 446 | though, that this will likely mean fixing up all the drivers that |
445 | reference the bus-specific fields (though those should all be 1-line | 447 | reference the bus-specific fields (though those should all be 1-line |
446 | changes). | 448 | changes). |
447 | |||
diff --git a/Documentation/eisa.txt b/Documentation/eisa.txt index 2806e5544e43..f388545a85a7 100644 --- a/Documentation/eisa.txt +++ b/Documentation/eisa.txt | |||
@@ -103,7 +103,7 @@ id_table an array of NULL terminated EISA id strings, | |||
103 | (driver_data). | 103 | (driver_data). |
104 | 104 | ||
105 | driver a generic driver, such as described in | 105 | driver a generic driver, such as described in |
106 | Documentation/driver-model/driver.txt. Only .name, | 106 | Documentation/driver-model/driver.rst. Only .name, |
107 | .probe and .remove members are mandatory. | 107 | .probe and .remove members are mandatory. |
108 | =============== ==================================================== | 108 | =============== ==================================================== |
109 | 109 | ||
@@ -152,7 +152,7 @@ state set of flags indicating the state of the device. Current | |||
152 | flags are EISA_CONFIG_ENABLED and EISA_CONFIG_FORCED. | 152 | flags are EISA_CONFIG_ENABLED and EISA_CONFIG_FORCED. |
153 | res set of four 256 bytes I/O regions allocated to this device | 153 | res set of four 256 bytes I/O regions allocated to this device |
154 | dma_mask DMA mask set from the parent device. | 154 | dma_mask DMA mask set from the parent device. |
155 | dev generic device (see Documentation/driver-model/device.txt) | 155 | dev generic device (see Documentation/driver-model/device.rst) |
156 | ======== ============================================================ | 156 | ======== ============================================================ |
157 | 157 | ||
158 | You can get the 'struct eisa_device' from 'struct device' using the | 158 | You can get the 'struct eisa_device' from 'struct device' using the |
diff --git a/Documentation/filesystems/debugfs.txt b/Documentation/filesystems/debugfs.txt index 4a0a9c3f4af6..9e27c843d00e 100644 --- a/Documentation/filesystems/debugfs.txt +++ b/Documentation/filesystems/debugfs.txt | |||
@@ -169,7 +169,7 @@ byte offsets over a base for the register block. | |||
169 | 169 | ||
170 | If you want to dump an u32 array in debugfs, you can create file with: | 170 | If you want to dump an u32 array in debugfs, you can create file with: |
171 | 171 | ||
172 | struct dentry *debugfs_create_u32_array(const char *name, umode_t mode, | 172 | void debugfs_create_u32_array(const char *name, umode_t mode, |
173 | struct dentry *parent, | 173 | struct dentry *parent, |
174 | u32 *array, u32 elements); | 174 | u32 *array, u32 elements); |
175 | 175 | ||
diff --git a/Documentation/hwmon/submitting-patches.rst b/Documentation/hwmon/submitting-patches.rst index f9796b9d9db6..d5b05d3e54ba 100644 --- a/Documentation/hwmon/submitting-patches.rst +++ b/Documentation/hwmon/submitting-patches.rst | |||
@@ -89,7 +89,7 @@ increase the chances of your change being accepted. | |||
89 | console. Excessive logging can seriously affect system performance. | 89 | console. Excessive logging can seriously affect system performance. |
90 | 90 | ||
91 | * Use devres functions whenever possible to allocate resources. For rationale | 91 | * Use devres functions whenever possible to allocate resources. For rationale |
92 | and supported functions, please see Documentation/driver-model/devres.txt. | 92 | and supported functions, please see Documentation/driver-model/devres.rst. |
93 | If a function is not supported by devres, consider using devm_add_action(). | 93 | If a function is not supported by devres, consider using devm_add_action(). |
94 | 94 | ||
95 | * If the driver has a detect function, make sure it is silent. Debug messages | 95 | * If the driver has a detect function, make sure it is silent. Debug messages |
diff --git a/arch/arm/include/asm/ptdump.h b/arch/arm/include/asm/ptdump.h index 3ebf9718288d..0c2d3d0d4cc6 100644 --- a/arch/arm/include/asm/ptdump.h +++ b/arch/arm/include/asm/ptdump.h | |||
@@ -21,13 +21,10 @@ struct ptdump_info { | |||
21 | 21 | ||
22 | void ptdump_walk_pgd(struct seq_file *s, struct ptdump_info *info); | 22 | void ptdump_walk_pgd(struct seq_file *s, struct ptdump_info *info); |
23 | #ifdef CONFIG_ARM_PTDUMP_DEBUGFS | 23 | #ifdef CONFIG_ARM_PTDUMP_DEBUGFS |
24 | int ptdump_debugfs_register(struct ptdump_info *info, const char *name); | 24 | void ptdump_debugfs_register(struct ptdump_info *info, const char *name); |
25 | #else | 25 | #else |
26 | static inline int ptdump_debugfs_register(struct ptdump_info *info, | 26 | static inline void ptdump_debugfs_register(struct ptdump_info *info, |
27 | const char *name) | 27 | const char *name) { } |
28 | { | ||
29 | return 0; | ||
30 | } | ||
31 | #endif /* CONFIG_ARM_PTDUMP_DEBUGFS */ | 28 | #endif /* CONFIG_ARM_PTDUMP_DEBUGFS */ |
32 | 29 | ||
33 | void ptdump_check_wx(void); | 30 | void ptdump_check_wx(void); |
diff --git a/arch/arm/mach-omap1/clock.c b/arch/arm/mach-omap1/clock.c index 406fd2a9a88f..bd5be82101f3 100644 --- a/arch/arm/mach-omap1/clock.c +++ b/arch/arm/mach-omap1/clock.c | |||
@@ -987,84 +987,44 @@ static int debug_clock_show(struct seq_file *s, void *unused) | |||
987 | 987 | ||
988 | DEFINE_SHOW_ATTRIBUTE(debug_clock); | 988 | DEFINE_SHOW_ATTRIBUTE(debug_clock); |
989 | 989 | ||
990 | static int clk_debugfs_register_one(struct clk *c) | 990 | static void clk_debugfs_register_one(struct clk *c) |
991 | { | 991 | { |
992 | int err; | ||
993 | struct dentry *d; | 992 | struct dentry *d; |
994 | struct clk *pa = c->parent; | 993 | struct clk *pa = c->parent; |
995 | 994 | ||
996 | d = debugfs_create_dir(c->name, pa ? pa->dent : clk_debugfs_root); | 995 | d = debugfs_create_dir(c->name, pa ? pa->dent : clk_debugfs_root); |
997 | if (!d) | ||
998 | return -ENOMEM; | ||
999 | c->dent = d; | 996 | c->dent = d; |
1000 | 997 | ||
1001 | d = debugfs_create_u8("usecount", S_IRUGO, c->dent, &c->usecount); | 998 | debugfs_create_u8("usecount", S_IRUGO, c->dent, &c->usecount); |
1002 | if (!d) { | 999 | debugfs_create_ulong("rate", S_IRUGO, c->dent, &c->rate); |
1003 | err = -ENOMEM; | 1000 | debugfs_create_x8("flags", S_IRUGO, c->dent, &c->flags); |
1004 | goto err_out; | ||
1005 | } | ||
1006 | d = debugfs_create_ulong("rate", S_IRUGO, c->dent, &c->rate); | ||
1007 | if (!d) { | ||
1008 | err = -ENOMEM; | ||
1009 | goto err_out; | ||
1010 | } | ||
1011 | d = debugfs_create_x8("flags", S_IRUGO, c->dent, &c->flags); | ||
1012 | if (!d) { | ||
1013 | err = -ENOMEM; | ||
1014 | goto err_out; | ||
1015 | } | ||
1016 | return 0; | ||
1017 | |||
1018 | err_out: | ||
1019 | debugfs_remove_recursive(c->dent); | ||
1020 | return err; | ||
1021 | } | 1001 | } |
1022 | 1002 | ||
1023 | static int clk_debugfs_register(struct clk *c) | 1003 | static void clk_debugfs_register(struct clk *c) |
1024 | { | 1004 | { |
1025 | int err; | ||
1026 | struct clk *pa = c->parent; | 1005 | struct clk *pa = c->parent; |
1027 | 1006 | ||
1028 | if (pa && !pa->dent) { | 1007 | if (pa && !pa->dent) |
1029 | err = clk_debugfs_register(pa); | 1008 | clk_debugfs_register(pa); |
1030 | if (err) | ||
1031 | return err; | ||
1032 | } | ||
1033 | 1009 | ||
1034 | if (!c->dent) { | 1010 | if (!c->dent) |
1035 | err = clk_debugfs_register_one(c); | 1011 | clk_debugfs_register_one(c); |
1036 | if (err) | ||
1037 | return err; | ||
1038 | } | ||
1039 | return 0; | ||
1040 | } | 1012 | } |
1041 | 1013 | ||
1042 | static int __init clk_debugfs_init(void) | 1014 | static int __init clk_debugfs_init(void) |
1043 | { | 1015 | { |
1044 | struct clk *c; | 1016 | struct clk *c; |
1045 | struct dentry *d; | 1017 | struct dentry *d; |
1046 | int err; | ||
1047 | 1018 | ||
1048 | d = debugfs_create_dir("clock", NULL); | 1019 | d = debugfs_create_dir("clock", NULL); |
1049 | if (!d) | ||
1050 | return -ENOMEM; | ||
1051 | clk_debugfs_root = d; | 1020 | clk_debugfs_root = d; |
1052 | 1021 | ||
1053 | list_for_each_entry(c, &clocks, node) { | 1022 | list_for_each_entry(c, &clocks, node) |
1054 | err = clk_debugfs_register(c); | 1023 | clk_debugfs_register(c); |
1055 | if (err) | ||
1056 | goto err_out; | ||
1057 | } | ||
1058 | 1024 | ||
1059 | d = debugfs_create_file("summary", S_IRUGO, | 1025 | debugfs_create_file("summary", S_IRUGO, d, NULL, &debug_clock_fops); |
1060 | d, NULL, &debug_clock_fops); | ||
1061 | if (!d) | ||
1062 | return -ENOMEM; | ||
1063 | 1026 | ||
1064 | return 0; | 1027 | return 0; |
1065 | err_out: | ||
1066 | debugfs_remove_recursive(clk_debugfs_root); | ||
1067 | return err; | ||
1068 | } | 1028 | } |
1069 | late_initcall(clk_debugfs_init); | 1029 | late_initcall(clk_debugfs_init); |
1070 | 1030 | ||
diff --git a/arch/arm/mach-omap1/pm.c b/arch/arm/mach-omap1/pm.c index 998075d3ef86..d068958d6f8a 100644 --- a/arch/arm/mach-omap1/pm.c +++ b/arch/arm/mach-omap1/pm.c | |||
@@ -539,11 +539,8 @@ static void omap_pm_init_debugfs(void) | |||
539 | struct dentry *d; | 539 | struct dentry *d; |
540 | 540 | ||
541 | d = debugfs_create_dir("pm_debug", NULL); | 541 | d = debugfs_create_dir("pm_debug", NULL); |
542 | if (!d) | 542 | debugfs_create_file("omap_pm", S_IWUSR | S_IRUGO, d, NULL, |
543 | return; | 543 | &omap_pm_debug_fops); |
544 | |||
545 | (void) debugfs_create_file("omap_pm", S_IWUSR | S_IRUGO, | ||
546 | d, NULL, &omap_pm_debug_fops); | ||
547 | } | 544 | } |
548 | 545 | ||
549 | #endif /* CONFIG_DEBUG_FS */ | 546 | #endif /* CONFIG_DEBUG_FS */ |
diff --git a/arch/arm/mach-omap2/pm-debug.c b/arch/arm/mach-omap2/pm-debug.c index fe6ec9b580b9..fceb1e525d26 100644 --- a/arch/arm/mach-omap2/pm-debug.c +++ b/arch/arm/mach-omap2/pm-debug.c | |||
@@ -190,9 +190,8 @@ static int __init pwrdms_setup(struct powerdomain *pwrdm, void *dir) | |||
190 | return 0; | 190 | return 0; |
191 | 191 | ||
192 | d = debugfs_create_dir(pwrdm->name, (struct dentry *)dir); | 192 | d = debugfs_create_dir(pwrdm->name, (struct dentry *)dir); |
193 | if (d) | 193 | debugfs_create_file("suspend", S_IRUGO|S_IWUSR, d, pwrdm, |
194 | (void) debugfs_create_file("suspend", S_IRUGO|S_IWUSR, d, | 194 | &pwrdm_suspend_fops); |
195 | (void *)pwrdm, &pwrdm_suspend_fops); | ||
196 | 195 | ||
197 | return 0; | 196 | return 0; |
198 | } | 197 | } |
@@ -230,16 +229,14 @@ static int __init pm_dbg_init(void) | |||
230 | return 0; | 229 | return 0; |
231 | 230 | ||
232 | d = debugfs_create_dir("pm_debug", NULL); | 231 | d = debugfs_create_dir("pm_debug", NULL); |
233 | if (!d) | ||
234 | return -EINVAL; | ||
235 | 232 | ||
236 | (void) debugfs_create_file("count", 0444, d, NULL, &pm_dbg_counters_fops); | 233 | debugfs_create_file("count", 0444, d, NULL, &pm_dbg_counters_fops); |
237 | (void) debugfs_create_file("time", 0444, d, NULL, &pm_dbg_timers_fops); | 234 | debugfs_create_file("time", 0444, d, NULL, &pm_dbg_timers_fops); |
238 | 235 | ||
239 | pwrdm_for_each(pwrdms_setup, (void *)d); | 236 | pwrdm_for_each(pwrdms_setup, (void *)d); |
240 | 237 | ||
241 | (void) debugfs_create_file("enable_off_mode", S_IRUGO | S_IWUSR, d, | 238 | debugfs_create_file("enable_off_mode", S_IRUGO | S_IWUSR, d, |
242 | &enable_off_mode, &pm_dbg_option_fops); | 239 | &enable_off_mode, &pm_dbg_option_fops); |
243 | pm_dbg_init_done = 1; | 240 | pm_dbg_init_done = 1; |
244 | 241 | ||
245 | return 0; | 242 | return 0; |
diff --git a/arch/arm/mm/dump.c b/arch/arm/mm/dump.c index 006d27ee4fc6..7d6291f23251 100644 --- a/arch/arm/mm/dump.c +++ b/arch/arm/mm/dump.c | |||
@@ -446,7 +446,7 @@ void ptdump_check_wx(void) | |||
446 | static int ptdump_init(void) | 446 | static int ptdump_init(void) |
447 | { | 447 | { |
448 | ptdump_initialize(); | 448 | ptdump_initialize(); |
449 | return ptdump_debugfs_register(&kernel_ptdump_info, | 449 | ptdump_debugfs_register(&kernel_ptdump_info, "kernel_page_tables"); |
450 | "kernel_page_tables"); | 450 | return 0; |
451 | } | 451 | } |
452 | __initcall(ptdump_init); | 452 | __initcall(ptdump_init); |
diff --git a/arch/arm/mm/ptdump_debugfs.c b/arch/arm/mm/ptdump_debugfs.c index be8d87be4b93..598b636615a2 100644 --- a/arch/arm/mm/ptdump_debugfs.c +++ b/arch/arm/mm/ptdump_debugfs.c | |||
@@ -24,11 +24,7 @@ static const struct file_operations ptdump_fops = { | |||
24 | .release = single_release, | 24 | .release = single_release, |
25 | }; | 25 | }; |
26 | 26 | ||
27 | int ptdump_debugfs_register(struct ptdump_info *info, const char *name) | 27 | void ptdump_debugfs_register(struct ptdump_info *info, const char *name) |
28 | { | 28 | { |
29 | struct dentry *pe; | 29 | debugfs_create_file(name, 0400, NULL, info, &ptdump_fops); |
30 | |||
31 | pe = debugfs_create_file(name, 0400, NULL, info, &ptdump_fops); | ||
32 | return pe ? 0 : -ENOMEM; | ||
33 | |||
34 | } | 30 | } |
diff --git a/arch/powerpc/platforms/pseries/ibmebus.c b/arch/powerpc/platforms/pseries/ibmebus.c index 84e8ec4011ba..b91eb0929ed1 100644 --- a/arch/powerpc/platforms/pseries/ibmebus.c +++ b/arch/powerpc/platforms/pseries/ibmebus.c | |||
@@ -147,13 +147,13 @@ static const struct dma_map_ops ibmebus_dma_ops = { | |||
147 | .unmap_page = ibmebus_unmap_page, | 147 | .unmap_page = ibmebus_unmap_page, |
148 | }; | 148 | }; |
149 | 149 | ||
150 | static int ibmebus_match_path(struct device *dev, void *data) | 150 | static int ibmebus_match_path(struct device *dev, const void *data) |
151 | { | 151 | { |
152 | struct device_node *dn = to_platform_device(dev)->dev.of_node; | 152 | struct device_node *dn = to_platform_device(dev)->dev.of_node; |
153 | return (of_find_node_by_path(data) == dn); | 153 | return (of_find_node_by_path(data) == dn); |
154 | } | 154 | } |
155 | 155 | ||
156 | static int ibmebus_match_node(struct device *dev, void *data) | 156 | static int ibmebus_match_node(struct device *dev, const void *data) |
157 | { | 157 | { |
158 | return to_platform_device(dev)->dev.of_node == data; | 158 | return to_platform_device(dev)->dev.of_node == data; |
159 | } | 159 | } |
diff --git a/arch/sh/kernel/kdebugfs.c b/arch/sh/kernel/kdebugfs.c index 95428e05d212..8b505e1556a5 100644 --- a/arch/sh/kernel/kdebugfs.c +++ b/arch/sh/kernel/kdebugfs.c | |||
@@ -9,9 +9,6 @@ EXPORT_SYMBOL(arch_debugfs_dir); | |||
9 | static int __init arch_kdebugfs_init(void) | 9 | static int __init arch_kdebugfs_init(void) |
10 | { | 10 | { |
11 | arch_debugfs_dir = debugfs_create_dir("sh", NULL); | 11 | arch_debugfs_dir = debugfs_create_dir("sh", NULL); |
12 | if (!arch_debugfs_dir) | ||
13 | return -ENOMEM; | ||
14 | |||
15 | return 0; | 12 | return 0; |
16 | } | 13 | } |
17 | arch_initcall(arch_kdebugfs_init); | 14 | arch_initcall(arch_kdebugfs_init); |
diff --git a/arch/sh/mm/asids-debugfs.c b/arch/sh/mm/asids-debugfs.c index e5539e0f8e3b..4c1ca197e9c5 100644 --- a/arch/sh/mm/asids-debugfs.c +++ b/arch/sh/mm/asids-debugfs.c | |||
@@ -63,13 +63,8 @@ static const struct file_operations asids_debugfs_fops = { | |||
63 | 63 | ||
64 | static int __init asids_debugfs_init(void) | 64 | static int __init asids_debugfs_init(void) |
65 | { | 65 | { |
66 | struct dentry *asids_dentry; | 66 | debugfs_create_file("asids", S_IRUSR, arch_debugfs_dir, NULL, |
67 | 67 | &asids_debugfs_fops); | |
68 | asids_dentry = debugfs_create_file("asids", S_IRUSR, arch_debugfs_dir, | 68 | return 0; |
69 | NULL, &asids_debugfs_fops); | ||
70 | if (!asids_dentry) | ||
71 | return -ENOMEM; | ||
72 | |||
73 | return PTR_ERR_OR_ZERO(asids_dentry); | ||
74 | } | 69 | } |
75 | device_initcall(asids_debugfs_init); | 70 | device_initcall(asids_debugfs_init); |
diff --git a/arch/sh/mm/cache-debugfs.c b/arch/sh/mm/cache-debugfs.c index 4eb9d43578b4..17d780794497 100644 --- a/arch/sh/mm/cache-debugfs.c +++ b/arch/sh/mm/cache-debugfs.c | |||
@@ -109,22 +109,10 @@ static const struct file_operations cache_debugfs_fops = { | |||
109 | 109 | ||
110 | static int __init cache_debugfs_init(void) | 110 | static int __init cache_debugfs_init(void) |
111 | { | 111 | { |
112 | struct dentry *dcache_dentry, *icache_dentry; | 112 | debugfs_create_file("dcache", S_IRUSR, arch_debugfs_dir, |
113 | 113 | (void *)CACHE_TYPE_DCACHE, &cache_debugfs_fops); | |
114 | dcache_dentry = debugfs_create_file("dcache", S_IRUSR, arch_debugfs_dir, | 114 | debugfs_create_file("icache", S_IRUSR, arch_debugfs_dir, |
115 | (unsigned int *)CACHE_TYPE_DCACHE, | 115 | (void *)CACHE_TYPE_ICACHE, &cache_debugfs_fops); |
116 | &cache_debugfs_fops); | ||
117 | if (!dcache_dentry) | ||
118 | return -ENOMEM; | ||
119 | |||
120 | icache_dentry = debugfs_create_file("icache", S_IRUSR, arch_debugfs_dir, | ||
121 | (unsigned int *)CACHE_TYPE_ICACHE, | ||
122 | &cache_debugfs_fops); | ||
123 | if (!icache_dentry) { | ||
124 | debugfs_remove(dcache_dentry); | ||
125 | return -ENOMEM; | ||
126 | } | ||
127 | |||
128 | return 0; | 116 | return 0; |
129 | } | 117 | } |
130 | module_init(cache_debugfs_init); | 118 | module_init(cache_debugfs_init); |
diff --git a/arch/sh/mm/pmb.c b/arch/sh/mm/pmb.c index a53a040d0054..b59bad86b31e 100644 --- a/arch/sh/mm/pmb.c +++ b/arch/sh/mm/pmb.c | |||
@@ -861,13 +861,8 @@ static const struct file_operations pmb_debugfs_fops = { | |||
861 | 861 | ||
862 | static int __init pmb_debugfs_init(void) | 862 | static int __init pmb_debugfs_init(void) |
863 | { | 863 | { |
864 | struct dentry *dentry; | 864 | debugfs_create_file("pmb", S_IFREG | S_IRUGO, arch_debugfs_dir, NULL, |
865 | 865 | &pmb_debugfs_fops); | |
866 | dentry = debugfs_create_file("pmb", S_IFREG | S_IRUGO, | ||
867 | arch_debugfs_dir, NULL, &pmb_debugfs_fops); | ||
868 | if (!dentry) | ||
869 | return -ENOMEM; | ||
870 | |||
871 | return 0; | 866 | return 0; |
872 | } | 867 | } |
873 | subsys_initcall(pmb_debugfs_init); | 868 | subsys_initcall(pmb_debugfs_init); |
diff --git a/arch/sh/mm/tlb-debugfs.c b/arch/sh/mm/tlb-debugfs.c index dea637a09246..11c6148283f3 100644 --- a/arch/sh/mm/tlb-debugfs.c +++ b/arch/sh/mm/tlb-debugfs.c | |||
@@ -149,22 +149,10 @@ static const struct file_operations tlb_debugfs_fops = { | |||
149 | 149 | ||
150 | static int __init tlb_debugfs_init(void) | 150 | static int __init tlb_debugfs_init(void) |
151 | { | 151 | { |
152 | struct dentry *itlb, *utlb; | 152 | debugfs_create_file("itlb", S_IRUSR, arch_debugfs_dir, |
153 | 153 | (void *)TLB_TYPE_ITLB, &tlb_debugfs_fops); | |
154 | itlb = debugfs_create_file("itlb", S_IRUSR, arch_debugfs_dir, | 154 | debugfs_create_file("utlb", S_IRUSR, arch_debugfs_dir, |
155 | (unsigned int *)TLB_TYPE_ITLB, | 155 | (void *)TLB_TYPE_UTLB, &tlb_debugfs_fops); |
156 | &tlb_debugfs_fops); | ||
157 | if (unlikely(!itlb)) | ||
158 | return -ENOMEM; | ||
159 | |||
160 | utlb = debugfs_create_file("utlb", S_IRUSR, arch_debugfs_dir, | ||
161 | (unsigned int *)TLB_TYPE_UTLB, | ||
162 | &tlb_debugfs_fops); | ||
163 | if (unlikely(!utlb)) { | ||
164 | debugfs_remove(itlb); | ||
165 | return -ENOMEM; | ||
166 | } | ||
167 | |||
168 | return 0; | 156 | return 0; |
169 | } | 157 | } |
170 | module_init(tlb_debugfs_init); | 158 | module_init(tlb_debugfs_init); |
diff --git a/arch/x86/kernel/kdebugfs.c b/arch/x86/kernel/kdebugfs.c index 7670ac2bda3a..edaa30b20841 100644 --- a/arch/x86/kernel/kdebugfs.c +++ b/arch/x86/kernel/kdebugfs.c | |||
@@ -67,33 +67,18 @@ static const struct file_operations fops_setup_data = { | |||
67 | .llseek = default_llseek, | 67 | .llseek = default_llseek, |
68 | }; | 68 | }; |
69 | 69 | ||
70 | static int __init | 70 | static void __init |
71 | create_setup_data_node(struct dentry *parent, int no, | 71 | create_setup_data_node(struct dentry *parent, int no, |
72 | struct setup_data_node *node) | 72 | struct setup_data_node *node) |
73 | { | 73 | { |
74 | struct dentry *d, *type, *data; | 74 | struct dentry *d; |
75 | char buf[16]; | 75 | char buf[16]; |
76 | 76 | ||
77 | sprintf(buf, "%d", no); | 77 | sprintf(buf, "%d", no); |
78 | d = debugfs_create_dir(buf, parent); | 78 | d = debugfs_create_dir(buf, parent); |
79 | if (!d) | ||
80 | return -ENOMEM; | ||
81 | |||
82 | type = debugfs_create_x32("type", S_IRUGO, d, &node->type); | ||
83 | if (!type) | ||
84 | goto err_dir; | ||
85 | |||
86 | data = debugfs_create_file("data", S_IRUGO, d, node, &fops_setup_data); | ||
87 | if (!data) | ||
88 | goto err_type; | ||
89 | 79 | ||
90 | return 0; | 80 | debugfs_create_x32("type", S_IRUGO, d, &node->type); |
91 | 81 | debugfs_create_file("data", S_IRUGO, d, node, &fops_setup_data); | |
92 | err_type: | ||
93 | debugfs_remove(type); | ||
94 | err_dir: | ||
95 | debugfs_remove(d); | ||
96 | return -ENOMEM; | ||
97 | } | 82 | } |
98 | 83 | ||
99 | static int __init create_setup_data_nodes(struct dentry *parent) | 84 | static int __init create_setup_data_nodes(struct dentry *parent) |
@@ -106,8 +91,6 @@ static int __init create_setup_data_nodes(struct dentry *parent) | |||
106 | int no = 0; | 91 | int no = 0; |
107 | 92 | ||
108 | d = debugfs_create_dir("setup_data", parent); | 93 | d = debugfs_create_dir("setup_data", parent); |
109 | if (!d) | ||
110 | return -ENOMEM; | ||
111 | 94 | ||
112 | pa_data = boot_params.hdr.setup_data; | 95 | pa_data = boot_params.hdr.setup_data; |
113 | 96 | ||
@@ -128,19 +111,17 @@ static int __init create_setup_data_nodes(struct dentry *parent) | |||
128 | node->paddr = pa_data; | 111 | node->paddr = pa_data; |
129 | node->type = data->type; | 112 | node->type = data->type; |
130 | node->len = data->len; | 113 | node->len = data->len; |
131 | error = create_setup_data_node(d, no, node); | 114 | create_setup_data_node(d, no, node); |
132 | pa_data = data->next; | 115 | pa_data = data->next; |
133 | 116 | ||
134 | memunmap(data); | 117 | memunmap(data); |
135 | if (error) | ||
136 | goto err_dir; | ||
137 | no++; | 118 | no++; |
138 | } | 119 | } |
139 | 120 | ||
140 | return 0; | 121 | return 0; |
141 | 122 | ||
142 | err_dir: | 123 | err_dir: |
143 | debugfs_remove(d); | 124 | debugfs_remove_recursive(d); |
144 | return error; | 125 | return error; |
145 | } | 126 | } |
146 | 127 | ||
@@ -151,35 +132,18 @@ static struct debugfs_blob_wrapper boot_params_blob = { | |||
151 | 132 | ||
152 | static int __init boot_params_kdebugfs_init(void) | 133 | static int __init boot_params_kdebugfs_init(void) |
153 | { | 134 | { |
154 | struct dentry *dbp, *version, *data; | 135 | struct dentry *dbp; |
155 | int error = -ENOMEM; | 136 | int error; |
156 | 137 | ||
157 | dbp = debugfs_create_dir("boot_params", arch_debugfs_dir); | 138 | dbp = debugfs_create_dir("boot_params", arch_debugfs_dir); |
158 | if (!dbp) | ||
159 | return -ENOMEM; | ||
160 | |||
161 | version = debugfs_create_x16("version", S_IRUGO, dbp, | ||
162 | &boot_params.hdr.version); | ||
163 | if (!version) | ||
164 | goto err_dir; | ||
165 | 139 | ||
166 | data = debugfs_create_blob("data", S_IRUGO, dbp, | 140 | debugfs_create_x16("version", S_IRUGO, dbp, &boot_params.hdr.version); |
167 | &boot_params_blob); | 141 | debugfs_create_blob("data", S_IRUGO, dbp, &boot_params_blob); |
168 | if (!data) | ||
169 | goto err_version; | ||
170 | 142 | ||
171 | error = create_setup_data_nodes(dbp); | 143 | error = create_setup_data_nodes(dbp); |
172 | if (error) | 144 | if (error) |
173 | goto err_data; | 145 | debugfs_remove_recursive(dbp); |
174 | 146 | ||
175 | return 0; | ||
176 | |||
177 | err_data: | ||
178 | debugfs_remove(data); | ||
179 | err_version: | ||
180 | debugfs_remove(version); | ||
181 | err_dir: | ||
182 | debugfs_remove(dbp); | ||
183 | return error; | 147 | return error; |
184 | } | 148 | } |
185 | #endif /* CONFIG_DEBUG_BOOT_PARAMS */ | 149 | #endif /* CONFIG_DEBUG_BOOT_PARAMS */ |
@@ -189,8 +153,6 @@ static int __init arch_kdebugfs_init(void) | |||
189 | int error = 0; | 153 | int error = 0; |
190 | 154 | ||
191 | arch_debugfs_dir = debugfs_create_dir("x86", NULL); | 155 | arch_debugfs_dir = debugfs_create_dir("x86", NULL); |
192 | if (!arch_debugfs_dir) | ||
193 | return -ENOMEM; | ||
194 | 156 | ||
195 | #ifdef CONFIG_DEBUG_BOOT_PARAMS | 157 | #ifdef CONFIG_DEBUG_BOOT_PARAMS |
196 | error = boot_params_kdebugfs_init(); | 158 | error = boot_params_kdebugfs_init(); |
diff --git a/arch/x86/mm/debug_pagetables.c b/arch/x86/mm/debug_pagetables.c index c6f4982d5401..39001a401eff 100644 --- a/arch/x86/mm/debug_pagetables.c +++ b/arch/x86/mm/debug_pagetables.c | |||
@@ -26,8 +26,6 @@ static int ptdump_curknl_show(struct seq_file *m, void *v) | |||
26 | DEFINE_SHOW_ATTRIBUTE(ptdump_curknl); | 26 | DEFINE_SHOW_ATTRIBUTE(ptdump_curknl); |
27 | 27 | ||
28 | #ifdef CONFIG_PAGE_TABLE_ISOLATION | 28 | #ifdef CONFIG_PAGE_TABLE_ISOLATION |
29 | static struct dentry *pe_curusr; | ||
30 | |||
31 | static int ptdump_curusr_show(struct seq_file *m, void *v) | 29 | static int ptdump_curusr_show(struct seq_file *m, void *v) |
32 | { | 30 | { |
33 | if (current->mm->pgd) { | 31 | if (current->mm->pgd) { |
@@ -42,8 +40,6 @@ DEFINE_SHOW_ATTRIBUTE(ptdump_curusr); | |||
42 | #endif | 40 | #endif |
43 | 41 | ||
44 | #if defined(CONFIG_EFI) && defined(CONFIG_X86_64) | 42 | #if defined(CONFIG_EFI) && defined(CONFIG_X86_64) |
45 | static struct dentry *pe_efi; | ||
46 | |||
47 | static int ptdump_efi_show(struct seq_file *m, void *v) | 43 | static int ptdump_efi_show(struct seq_file *m, void *v) |
48 | { | 44 | { |
49 | if (efi_mm.pgd) | 45 | if (efi_mm.pgd) |
@@ -54,41 +50,24 @@ static int ptdump_efi_show(struct seq_file *m, void *v) | |||
54 | DEFINE_SHOW_ATTRIBUTE(ptdump_efi); | 50 | DEFINE_SHOW_ATTRIBUTE(ptdump_efi); |
55 | #endif | 51 | #endif |
56 | 52 | ||
57 | static struct dentry *dir, *pe_knl, *pe_curknl; | 53 | static struct dentry *dir; |
58 | 54 | ||
59 | static int __init pt_dump_debug_init(void) | 55 | static int __init pt_dump_debug_init(void) |
60 | { | 56 | { |
61 | dir = debugfs_create_dir("page_tables", NULL); | 57 | dir = debugfs_create_dir("page_tables", NULL); |
62 | if (!dir) | ||
63 | return -ENOMEM; | ||
64 | |||
65 | pe_knl = debugfs_create_file("kernel", 0400, dir, NULL, | ||
66 | &ptdump_fops); | ||
67 | if (!pe_knl) | ||
68 | goto err; | ||
69 | 58 | ||
70 | pe_curknl = debugfs_create_file("current_kernel", 0400, | 59 | debugfs_create_file("kernel", 0400, dir, NULL, &ptdump_fops); |
71 | dir, NULL, &ptdump_curknl_fops); | 60 | debugfs_create_file("current_kernel", 0400, dir, NULL, |
72 | if (!pe_curknl) | 61 | &ptdump_curknl_fops); |
73 | goto err; | ||
74 | 62 | ||
75 | #ifdef CONFIG_PAGE_TABLE_ISOLATION | 63 | #ifdef CONFIG_PAGE_TABLE_ISOLATION |
76 | pe_curusr = debugfs_create_file("current_user", 0400, | 64 | debugfs_create_file("current_user", 0400, dir, NULL, |
77 | dir, NULL, &ptdump_curusr_fops); | 65 | &ptdump_curusr_fops); |
78 | if (!pe_curusr) | ||
79 | goto err; | ||
80 | #endif | 66 | #endif |
81 | |||
82 | #if defined(CONFIG_EFI) && defined(CONFIG_X86_64) | 67 | #if defined(CONFIG_EFI) && defined(CONFIG_X86_64) |
83 | pe_efi = debugfs_create_file("efi", 0400, dir, NULL, &ptdump_efi_fops); | 68 | debugfs_create_file("efi", 0400, dir, NULL, &ptdump_efi_fops); |
84 | if (!pe_efi) | ||
85 | goto err; | ||
86 | #endif | 69 | #endif |
87 | |||
88 | return 0; | 70 | return 0; |
89 | err: | ||
90 | debugfs_remove_recursive(dir); | ||
91 | return -ENOMEM; | ||
92 | } | 71 | } |
93 | 72 | ||
94 | static void __exit pt_dump_debug_exit(void) | 73 | static void __exit pt_dump_debug_exit(void) |
diff --git a/arch/x86/platform/atom/punit_atom_debug.c b/arch/x86/platform/atom/punit_atom_debug.c index 17185d73d649..ee6b0780bea1 100644 --- a/arch/x86/platform/atom/punit_atom_debug.c +++ b/arch/x86/platform/atom/punit_atom_debug.c | |||
@@ -104,24 +104,12 @@ DEFINE_SHOW_ATTRIBUTE(punit_dev_state); | |||
104 | 104 | ||
105 | static struct dentry *punit_dbg_file; | 105 | static struct dentry *punit_dbg_file; |
106 | 106 | ||
107 | static int punit_dbgfs_register(struct punit_device *punit_device) | 107 | static void punit_dbgfs_register(struct punit_device *punit_device) |
108 | { | 108 | { |
109 | struct dentry *dev_state; | ||
110 | |||
111 | punit_dbg_file = debugfs_create_dir("punit_atom", NULL); | 109 | punit_dbg_file = debugfs_create_dir("punit_atom", NULL); |
112 | if (!punit_dbg_file) | ||
113 | return -ENXIO; | ||
114 | |||
115 | dev_state = debugfs_create_file("dev_power_state", 0444, | ||
116 | punit_dbg_file, punit_device, | ||
117 | &punit_dev_state_fops); | ||
118 | if (!dev_state) { | ||
119 | pr_err("punit_dev_state register failed\n"); | ||
120 | debugfs_remove(punit_dbg_file); | ||
121 | return -ENXIO; | ||
122 | } | ||
123 | 110 | ||
124 | return 0; | 111 | debugfs_create_file("dev_power_state", 0444, punit_dbg_file, |
112 | punit_device, &punit_dev_state_fops); | ||
125 | } | 113 | } |
126 | 114 | ||
127 | static void punit_dbgfs_unregister(void) | 115 | static void punit_dbgfs_unregister(void) |
@@ -145,15 +133,12 @@ MODULE_DEVICE_TABLE(x86cpu, intel_punit_cpu_ids); | |||
145 | static int __init punit_atom_debug_init(void) | 133 | static int __init punit_atom_debug_init(void) |
146 | { | 134 | { |
147 | const struct x86_cpu_id *id; | 135 | const struct x86_cpu_id *id; |
148 | int ret; | ||
149 | 136 | ||
150 | id = x86_match_cpu(intel_punit_cpu_ids); | 137 | id = x86_match_cpu(intel_punit_cpu_ids); |
151 | if (!id) | 138 | if (!id) |
152 | return -ENODEV; | 139 | return -ENODEV; |
153 | 140 | ||
154 | ret = punit_dbgfs_register((struct punit_device *)id->driver_data); | 141 | punit_dbgfs_register((struct punit_device *)id->driver_data); |
155 | if (ret < 0) | ||
156 | return ret; | ||
157 | 142 | ||
158 | return 0; | 143 | return 0; |
159 | } | 144 | } |
diff --git a/arch/x86/platform/intel-quark/imr.c b/arch/x86/platform/intel-quark/imr.c index b5420371d32d..6dd25dc5f027 100644 --- a/arch/x86/platform/intel-quark/imr.c +++ b/arch/x86/platform/intel-quark/imr.c | |||
@@ -35,7 +35,6 @@ | |||
35 | #include <linux/types.h> | 35 | #include <linux/types.h> |
36 | 36 | ||
37 | struct imr_device { | 37 | struct imr_device { |
38 | struct dentry *file; | ||
39 | bool init; | 38 | bool init; |
40 | struct mutex lock; | 39 | struct mutex lock; |
41 | int max_imr; | 40 | int max_imr; |
@@ -231,13 +230,11 @@ DEFINE_SHOW_ATTRIBUTE(imr_dbgfs_state); | |||
231 | * imr_debugfs_register - register debugfs hooks. | 230 | * imr_debugfs_register - register debugfs hooks. |
232 | * | 231 | * |
233 | * @idev: pointer to imr_device structure. | 232 | * @idev: pointer to imr_device structure. |
234 | * @return: 0 on success - errno on failure. | ||
235 | */ | 233 | */ |
236 | static int imr_debugfs_register(struct imr_device *idev) | 234 | static void imr_debugfs_register(struct imr_device *idev) |
237 | { | 235 | { |
238 | idev->file = debugfs_create_file("imr_state", 0444, NULL, idev, | 236 | debugfs_create_file("imr_state", 0444, NULL, idev, |
239 | &imr_dbgfs_state_fops); | 237 | &imr_dbgfs_state_fops); |
240 | return PTR_ERR_OR_ZERO(idev->file); | ||
241 | } | 238 | } |
242 | 239 | ||
243 | /** | 240 | /** |
@@ -582,7 +579,6 @@ static const struct x86_cpu_id imr_ids[] __initconst = { | |||
582 | static int __init imr_init(void) | 579 | static int __init imr_init(void) |
583 | { | 580 | { |
584 | struct imr_device *idev = &imr_dev; | 581 | struct imr_device *idev = &imr_dev; |
585 | int ret; | ||
586 | 582 | ||
587 | if (!x86_match_cpu(imr_ids) || !iosf_mbi_available()) | 583 | if (!x86_match_cpu(imr_ids) || !iosf_mbi_available()) |
588 | return -ENODEV; | 584 | return -ENODEV; |
@@ -592,9 +588,7 @@ static int __init imr_init(void) | |||
592 | idev->init = true; | 588 | idev->init = true; |
593 | 589 | ||
594 | mutex_init(&idev->lock); | 590 | mutex_init(&idev->lock); |
595 | ret = imr_debugfs_register(idev); | 591 | imr_debugfs_register(idev); |
596 | if (ret != 0) | ||
597 | pr_warn("debugfs register failed!\n"); | ||
598 | imr_fixup_memmap(idev); | 592 | imr_fixup_memmap(idev); |
599 | return 0; | 593 | return 0; |
600 | } | 594 | } |
diff --git a/arch/x86/platform/intel/iosf_mbi.c b/arch/x86/platform/intel/iosf_mbi.c index b393eaa798ef..2e796b54cbde 100644 --- a/arch/x86/platform/intel/iosf_mbi.c +++ b/arch/x86/platform/intel/iosf_mbi.c | |||
@@ -461,31 +461,16 @@ static struct dentry *iosf_dbg; | |||
461 | 461 | ||
462 | static void iosf_sideband_debug_init(void) | 462 | static void iosf_sideband_debug_init(void) |
463 | { | 463 | { |
464 | struct dentry *d; | ||
465 | |||
466 | iosf_dbg = debugfs_create_dir("iosf_sb", NULL); | 464 | iosf_dbg = debugfs_create_dir("iosf_sb", NULL); |
467 | if (IS_ERR_OR_NULL(iosf_dbg)) | ||
468 | return; | ||
469 | 465 | ||
470 | /* mdr */ | 466 | /* mdr */ |
471 | d = debugfs_create_x32("mdr", 0660, iosf_dbg, &dbg_mdr); | 467 | debugfs_create_x32("mdr", 0660, iosf_dbg, &dbg_mdr); |
472 | if (!d) | ||
473 | goto cleanup; | ||
474 | 468 | ||
475 | /* mcrx */ | 469 | /* mcrx */ |
476 | d = debugfs_create_x32("mcrx", 0660, iosf_dbg, &dbg_mcrx); | 470 | debugfs_create_x32("mcrx", 0660, iosf_dbg, &dbg_mcrx); |
477 | if (!d) | ||
478 | goto cleanup; | ||
479 | 471 | ||
480 | /* mcr - initiates mailbox tranaction */ | 472 | /* mcr - initiates mailbox tranaction */ |
481 | d = debugfs_create_file("mcr", 0660, iosf_dbg, &dbg_mcr, &iosf_mcr_fops); | 473 | debugfs_create_file("mcr", 0660, iosf_dbg, &dbg_mcr, &iosf_mcr_fops); |
482 | if (!d) | ||
483 | goto cleanup; | ||
484 | |||
485 | return; | ||
486 | |||
487 | cleanup: | ||
488 | debugfs_remove_recursive(d); | ||
489 | } | 474 | } |
490 | 475 | ||
491 | static void iosf_debugfs_init(void) | 476 | static void iosf_debugfs_init(void) |
diff --git a/arch/x86/platform/uv/tlb_uv.c b/arch/x86/platform/uv/tlb_uv.c index 0c7dfec4acac..20c389a91b80 100644 --- a/arch/x86/platform/uv/tlb_uv.c +++ b/arch/x86/platform/uv/tlb_uv.c | |||
@@ -66,7 +66,6 @@ static struct tunables tunables[] = { | |||
66 | }; | 66 | }; |
67 | 67 | ||
68 | static struct dentry *tunables_dir; | 68 | static struct dentry *tunables_dir; |
69 | static struct dentry *tunables_file; | ||
70 | 69 | ||
71 | /* these correspond to the statistics printed by ptc_seq_show() */ | 70 | /* these correspond to the statistics printed by ptc_seq_show() */ |
72 | static char *stat_description[] = { | 71 | static char *stat_description[] = { |
@@ -1700,18 +1699,8 @@ static int __init uv_ptc_init(void) | |||
1700 | } | 1699 | } |
1701 | 1700 | ||
1702 | tunables_dir = debugfs_create_dir(UV_BAU_TUNABLES_DIR, NULL); | 1701 | tunables_dir = debugfs_create_dir(UV_BAU_TUNABLES_DIR, NULL); |
1703 | if (!tunables_dir) { | 1702 | debugfs_create_file(UV_BAU_TUNABLES_FILE, 0600, tunables_dir, NULL, |
1704 | pr_err("unable to create debugfs directory %s\n", | 1703 | &tunables_fops); |
1705 | UV_BAU_TUNABLES_DIR); | ||
1706 | return -EINVAL; | ||
1707 | } | ||
1708 | tunables_file = debugfs_create_file(UV_BAU_TUNABLES_FILE, 0600, | ||
1709 | tunables_dir, NULL, &tunables_fops); | ||
1710 | if (!tunables_file) { | ||
1711 | pr_err("unable to create debugfs file %s\n", | ||
1712 | UV_BAU_TUNABLES_FILE); | ||
1713 | return -EINVAL; | ||
1714 | } | ||
1715 | return 0; | 1704 | return 0; |
1716 | } | 1705 | } |
1717 | 1706 | ||
diff --git a/arch/x86/xen/debugfs.c b/arch/x86/xen/debugfs.c index 13da87918b4f..532410998684 100644 --- a/arch/x86/xen/debugfs.c +++ b/arch/x86/xen/debugfs.c | |||
@@ -9,13 +9,8 @@ static struct dentry *d_xen_debug; | |||
9 | 9 | ||
10 | struct dentry * __init xen_init_debugfs(void) | 10 | struct dentry * __init xen_init_debugfs(void) |
11 | { | 11 | { |
12 | if (!d_xen_debug) { | 12 | if (!d_xen_debug) |
13 | d_xen_debug = debugfs_create_dir("xen", NULL); | 13 | d_xen_debug = debugfs_create_dir("xen", NULL); |
14 | |||
15 | if (!d_xen_debug) | ||
16 | pr_warning("Could not create 'xen' debugfs directory\n"); | ||
17 | } | ||
18 | |||
19 | return d_xen_debug; | 14 | return d_xen_debug; |
20 | } | 15 | } |
21 | 16 | ||
diff --git a/arch/x86/xen/p2m.c b/arch/x86/xen/p2m.c index 95ce9b5be411..0acba2c712ab 100644 --- a/arch/x86/xen/p2m.c +++ b/arch/x86/xen/p2m.c | |||
@@ -817,9 +817,6 @@ static int __init xen_p2m_debugfs(void) | |||
817 | { | 817 | { |
818 | struct dentry *d_xen = xen_init_debugfs(); | 818 | struct dentry *d_xen = xen_init_debugfs(); |
819 | 819 | ||
820 | if (d_xen == NULL) | ||
821 | return -ENOMEM; | ||
822 | |||
823 | d_mmu_debug = debugfs_create_dir("mmu", d_xen); | 820 | d_mmu_debug = debugfs_create_dir("mmu", d_xen); |
824 | 821 | ||
825 | debugfs_create_file("p2m", 0600, d_mmu_debug, NULL, &p2m_dump_fops); | 822 | debugfs_create_file("p2m", 0600, d_mmu_debug, NULL, &p2m_dump_fops); |
diff --git a/drivers/acpi/acpi_lpss.c b/drivers/acpi/acpi_lpss.c index 398451839178..d696f165a50e 100644 --- a/drivers/acpi/acpi_lpss.c +++ b/drivers/acpi/acpi_lpss.c | |||
@@ -508,10 +508,10 @@ struct hid_uid { | |||
508 | const char *uid; | 508 | const char *uid; |
509 | }; | 509 | }; |
510 | 510 | ||
511 | static int match_hid_uid(struct device *dev, void *data) | 511 | static int match_hid_uid(struct device *dev, const void *data) |
512 | { | 512 | { |
513 | struct acpi_device *adev = ACPI_COMPANION(dev); | 513 | struct acpi_device *adev = ACPI_COMPANION(dev); |
514 | struct hid_uid *id = data; | 514 | const struct hid_uid *id = data; |
515 | 515 | ||
516 | if (!adev) | 516 | if (!adev) |
517 | return 0; | 517 | return 0; |
diff --git a/drivers/acpi/utils.c b/drivers/acpi/utils.c index 7def63ab00c0..e3974a8f8fd4 100644 --- a/drivers/acpi/utils.c +++ b/drivers/acpi/utils.c | |||
@@ -725,17 +725,15 @@ bool acpi_dev_found(const char *hid) | |||
725 | EXPORT_SYMBOL(acpi_dev_found); | 725 | EXPORT_SYMBOL(acpi_dev_found); |
726 | 726 | ||
727 | struct acpi_dev_match_info { | 727 | struct acpi_dev_match_info { |
728 | const char *dev_name; | ||
729 | struct acpi_device *adev; | ||
730 | struct acpi_device_id hid[2]; | 728 | struct acpi_device_id hid[2]; |
731 | const char *uid; | 729 | const char *uid; |
732 | s64 hrv; | 730 | s64 hrv; |
733 | }; | 731 | }; |
734 | 732 | ||
735 | static int acpi_dev_match_cb(struct device *dev, void *data) | 733 | static int acpi_dev_match_cb(struct device *dev, const void *data) |
736 | { | 734 | { |
737 | struct acpi_device *adev = to_acpi_device(dev); | 735 | struct acpi_device *adev = to_acpi_device(dev); |
738 | struct acpi_dev_match_info *match = data; | 736 | const struct acpi_dev_match_info *match = data; |
739 | unsigned long long hrv; | 737 | unsigned long long hrv; |
740 | acpi_status status; | 738 | acpi_status status; |
741 | 739 | ||
@@ -746,9 +744,6 @@ static int acpi_dev_match_cb(struct device *dev, void *data) | |||
746 | strcmp(adev->pnp.unique_id, match->uid))) | 744 | strcmp(adev->pnp.unique_id, match->uid))) |
747 | return 0; | 745 | return 0; |
748 | 746 | ||
749 | match->dev_name = acpi_dev_name(adev); | ||
750 | match->adev = adev; | ||
751 | |||
752 | if (match->hrv == -1) | 747 | if (match->hrv == -1) |
753 | return 1; | 748 | return 1; |
754 | 749 | ||
@@ -818,7 +813,7 @@ acpi_dev_get_first_match_dev(const char *hid, const char *uid, s64 hrv) | |||
818 | match.hrv = hrv; | 813 | match.hrv = hrv; |
819 | 814 | ||
820 | dev = bus_find_device(&acpi_bus_type, NULL, &match, acpi_dev_match_cb); | 815 | dev = bus_find_device(&acpi_bus_type, NULL, &match, acpi_dev_match_cb); |
821 | return dev ? match.adev : NULL; | 816 | return dev ? to_acpi_device(dev) : NULL; |
822 | } | 817 | } |
823 | EXPORT_SYMBOL(acpi_dev_get_first_match_dev); | 818 | EXPORT_SYMBOL(acpi_dev_get_first_match_dev); |
824 | 819 | ||
diff --git a/drivers/amba/tegra-ahb.c b/drivers/amba/tegra-ahb.c index 3eaa459ae057..aa64eece77a6 100644 --- a/drivers/amba/tegra-ahb.c +++ b/drivers/amba/tegra-ahb.c | |||
@@ -134,10 +134,10 @@ static inline void gizmo_writel(struct tegra_ahb *ahb, u32 value, u32 offset) | |||
134 | } | 134 | } |
135 | 135 | ||
136 | #ifdef CONFIG_TEGRA_IOMMU_SMMU | 136 | #ifdef CONFIG_TEGRA_IOMMU_SMMU |
137 | static int tegra_ahb_match_by_smmu(struct device *dev, void *data) | 137 | static int tegra_ahb_match_by_smmu(struct device *dev, const void *data) |
138 | { | 138 | { |
139 | struct tegra_ahb *ahb = dev_get_drvdata(dev); | 139 | struct tegra_ahb *ahb = dev_get_drvdata(dev); |
140 | struct device_node *dn = data; | 140 | const struct device_node *dn = data; |
141 | 141 | ||
142 | return (ahb->dev->of_node == dn) ? 1 : 0; | 142 | return (ahb->dev->of_node == dn) ? 1 : 0; |
143 | } | 143 | } |
diff --git a/drivers/base/arch_topology.c b/drivers/base/arch_topology.c index 9b09e31ae82f..63c1e76739f1 100644 --- a/drivers/base/arch_topology.c +++ b/drivers/base/arch_topology.c | |||
@@ -137,7 +137,6 @@ bool __init topology_parse_cpu_capacity(struct device_node *cpu_node, int cpu) | |||
137 | sizeof(*raw_capacity), | 137 | sizeof(*raw_capacity), |
138 | GFP_KERNEL); | 138 | GFP_KERNEL); |
139 | if (!raw_capacity) { | 139 | if (!raw_capacity) { |
140 | pr_err("cpu_capacity: failed to allocate memory for raw capacities\n"); | ||
141 | cap_parsing_failed = true; | 140 | cap_parsing_failed = true; |
142 | return false; | 141 | return false; |
143 | } | 142 | } |
@@ -217,10 +216,8 @@ static int __init register_cpufreq_notifier(void) | |||
217 | if (!acpi_disabled || !raw_capacity) | 216 | if (!acpi_disabled || !raw_capacity) |
218 | return -EINVAL; | 217 | return -EINVAL; |
219 | 218 | ||
220 | if (!alloc_cpumask_var(&cpus_to_visit, GFP_KERNEL)) { | 219 | if (!alloc_cpumask_var(&cpus_to_visit, GFP_KERNEL)) |
221 | pr_err("cpu_capacity: failed to allocate memory for cpus_to_visit\n"); | ||
222 | return -ENOMEM; | 220 | return -ENOMEM; |
223 | } | ||
224 | 221 | ||
225 | cpumask_copy(cpus_to_visit, cpu_possible_mask); | 222 | cpumask_copy(cpus_to_visit, cpu_possible_mask); |
226 | 223 | ||
diff --git a/drivers/base/bus.c b/drivers/base/bus.c index 0a58e969f8b7..df3cac739813 100644 --- a/drivers/base/bus.c +++ b/drivers/base/bus.c | |||
@@ -323,8 +323,8 @@ EXPORT_SYMBOL_GPL(bus_for_each_dev); | |||
323 | * return to the caller and not iterate over any more devices. | 323 | * return to the caller and not iterate over any more devices. |
324 | */ | 324 | */ |
325 | struct device *bus_find_device(struct bus_type *bus, | 325 | struct device *bus_find_device(struct bus_type *bus, |
326 | struct device *start, void *data, | 326 | struct device *start, const void *data, |
327 | int (*match)(struct device *dev, void *data)) | 327 | int (*match)(struct device *dev, const void *data)) |
328 | { | 328 | { |
329 | struct klist_iter i; | 329 | struct klist_iter i; |
330 | struct device *dev; | 330 | struct device *dev; |
@@ -342,7 +342,7 @@ struct device *bus_find_device(struct bus_type *bus, | |||
342 | } | 342 | } |
343 | EXPORT_SYMBOL_GPL(bus_find_device); | 343 | EXPORT_SYMBOL_GPL(bus_find_device); |
344 | 344 | ||
345 | static int match_name(struct device *dev, void *data) | 345 | static int match_name(struct device *dev, const void *data) |
346 | { | 346 | { |
347 | const char *name = data; | 347 | const char *name = data; |
348 | 348 | ||
diff --git a/drivers/base/cacheinfo.c b/drivers/base/cacheinfo.c index 8827c60f51e2..8d553c92cd32 100644 --- a/drivers/base/cacheinfo.c +++ b/drivers/base/cacheinfo.c | |||
@@ -660,7 +660,8 @@ static int cacheinfo_cpu_pre_down(unsigned int cpu) | |||
660 | 660 | ||
661 | static int __init cacheinfo_sysfs_init(void) | 661 | static int __init cacheinfo_sysfs_init(void) |
662 | { | 662 | { |
663 | return cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "base/cacheinfo:online", | 663 | return cpuhp_setup_state(CPUHP_AP_BASE_CACHEINFO_ONLINE, |
664 | "base/cacheinfo:online", | ||
664 | cacheinfo_cpu_online, cacheinfo_cpu_pre_down); | 665 | cacheinfo_cpu_online, cacheinfo_cpu_pre_down); |
665 | } | 666 | } |
666 | device_initcall(cacheinfo_sysfs_init); | 667 | device_initcall(cacheinfo_sysfs_init); |
diff --git a/drivers/base/core.c b/drivers/base/core.c index b4c64528f13c..da84a73f2ba6 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c | |||
@@ -3356,3 +3356,9 @@ void device_set_of_node_from_dev(struct device *dev, const struct device *dev2) | |||
3356 | dev->of_node_reused = true; | 3356 | dev->of_node_reused = true; |
3357 | } | 3357 | } |
3358 | EXPORT_SYMBOL_GPL(device_set_of_node_from_dev); | 3358 | EXPORT_SYMBOL_GPL(device_set_of_node_from_dev); |
3359 | |||
3360 | int device_match_of_node(struct device *dev, const void *np) | ||
3361 | { | ||
3362 | return dev->of_node == np; | ||
3363 | } | ||
3364 | EXPORT_SYMBOL_GPL(device_match_of_node); | ||
diff --git a/drivers/base/dd.c b/drivers/base/dd.c index 0df9b4461766..994a90747420 100644 --- a/drivers/base/dd.c +++ b/drivers/base/dd.c | |||
@@ -235,6 +235,19 @@ static int __init deferred_probe_timeout_setup(char *str) | |||
235 | } | 235 | } |
236 | __setup("deferred_probe_timeout=", deferred_probe_timeout_setup); | 236 | __setup("deferred_probe_timeout=", deferred_probe_timeout_setup); |
237 | 237 | ||
238 | static int __driver_deferred_probe_check_state(struct device *dev) | ||
239 | { | ||
240 | if (!initcalls_done) | ||
241 | return -EPROBE_DEFER; | ||
242 | |||
243 | if (!deferred_probe_timeout) { | ||
244 | dev_WARN(dev, "deferred probe timeout, ignoring dependency"); | ||
245 | return -ETIMEDOUT; | ||
246 | } | ||
247 | |||
248 | return 0; | ||
249 | } | ||
250 | |||
238 | /** | 251 | /** |
239 | * driver_deferred_probe_check_state() - Check deferred probe state | 252 | * driver_deferred_probe_check_state() - Check deferred probe state |
240 | * @dev: device to check | 253 | * @dev: device to check |
@@ -248,14 +261,40 @@ __setup("deferred_probe_timeout=", deferred_probe_timeout_setup); | |||
248 | */ | 261 | */ |
249 | int driver_deferred_probe_check_state(struct device *dev) | 262 | int driver_deferred_probe_check_state(struct device *dev) |
250 | { | 263 | { |
251 | if (initcalls_done) { | 264 | int ret; |
252 | if (!deferred_probe_timeout) { | 265 | |
253 | dev_WARN(dev, "deferred probe timeout, ignoring dependency"); | 266 | ret = __driver_deferred_probe_check_state(dev); |
254 | return -ETIMEDOUT; | 267 | if (ret < 0) |
255 | } | 268 | return ret; |
256 | dev_warn(dev, "ignoring dependency for device, assuming no driver"); | 269 | |
257 | return -ENODEV; | 270 | dev_warn(dev, "ignoring dependency for device, assuming no driver"); |
258 | } | 271 | |
272 | return -ENODEV; | ||
273 | } | ||
274 | |||
275 | /** | ||
276 | * driver_deferred_probe_check_state_continue() - check deferred probe state | ||
277 | * @dev: device to check | ||
278 | * | ||
279 | * Returns -ETIMEDOUT if deferred probe debug timeout has expired, or | ||
280 | * -EPROBE_DEFER otherwise. | ||
281 | * | ||
282 | * Drivers or subsystems can opt-in to calling this function instead of | ||
283 | * directly returning -EPROBE_DEFER. | ||
284 | * | ||
285 | * This is similar to driver_deferred_probe_check_state(), but it allows the | ||
286 | * subsystem to keep deferring probe after built-in drivers have had a chance | ||
287 | * to probe. One scenario where that is useful is if built-in drivers rely on | ||
288 | * resources that are provided by modular drivers. | ||
289 | */ | ||
290 | int driver_deferred_probe_check_state_continue(struct device *dev) | ||
291 | { | ||
292 | int ret; | ||
293 | |||
294 | ret = __driver_deferred_probe_check_state(dev); | ||
295 | if (ret < 0) | ||
296 | return ret; | ||
297 | |||
259 | return -EPROBE_DEFER; | 298 | return -EPROBE_DEFER; |
260 | } | 299 | } |
261 | 300 | ||
diff --git a/drivers/base/devcon.c b/drivers/base/devcon.c index f7035fc12b92..09f28479b243 100644 --- a/drivers/base/devcon.c +++ b/drivers/base/devcon.c | |||
@@ -133,7 +133,7 @@ static struct bus_type *generic_match_buses[] = { | |||
133 | NULL, | 133 | NULL, |
134 | }; | 134 | }; |
135 | 135 | ||
136 | static int device_fwnode_match(struct device *dev, void *fwnode) | 136 | static int device_fwnode_match(struct device *dev, const void *fwnode) |
137 | { | 137 | { |
138 | return dev_fwnode(dev) == fwnode; | 138 | return dev_fwnode(dev) == fwnode; |
139 | } | 139 | } |
diff --git a/drivers/base/driver.c b/drivers/base/driver.c index 857c8f1b876e..4e5ca632f35e 100644 --- a/drivers/base/driver.c +++ b/drivers/base/driver.c | |||
@@ -73,8 +73,8 @@ EXPORT_SYMBOL_GPL(driver_for_each_device); | |||
73 | * return to the caller and not iterate over any more devices. | 73 | * return to the caller and not iterate over any more devices. |
74 | */ | 74 | */ |
75 | struct device *driver_find_device(struct device_driver *drv, | 75 | struct device *driver_find_device(struct device_driver *drv, |
76 | struct device *start, void *data, | 76 | struct device *start, const void *data, |
77 | int (*match)(struct device *dev, void *data)) | 77 | int (*match)(struct device *dev, const void *data)) |
78 | { | 78 | { |
79 | struct klist_iter i; | 79 | struct klist_iter i; |
80 | struct device *dev; | 80 | struct device *dev; |
diff --git a/drivers/base/firmware_loader/Kconfig b/drivers/base/firmware_loader/Kconfig index 38f2da6f5c2b..3f9e274e2ed3 100644 --- a/drivers/base/firmware_loader/Kconfig +++ b/drivers/base/firmware_loader/Kconfig | |||
@@ -26,6 +26,9 @@ config FW_LOADER | |||
26 | 26 | ||
27 | if FW_LOADER | 27 | if FW_LOADER |
28 | 28 | ||
29 | config FW_LOADER_PAGED_BUF | ||
30 | bool | ||
31 | |||
29 | config EXTRA_FIRMWARE | 32 | config EXTRA_FIRMWARE |
30 | string "Build named firmware blobs into the kernel binary" | 33 | string "Build named firmware blobs into the kernel binary" |
31 | help | 34 | help |
@@ -67,6 +70,7 @@ config EXTRA_FIRMWARE_DIR | |||
67 | 70 | ||
68 | config FW_LOADER_USER_HELPER | 71 | config FW_LOADER_USER_HELPER |
69 | bool "Enable the firmware sysfs fallback mechanism" | 72 | bool "Enable the firmware sysfs fallback mechanism" |
73 | select FW_LOADER_PAGED_BUF | ||
70 | help | 74 | help |
71 | This option enables a sysfs loading facility to enable firmware | 75 | This option enables a sysfs loading facility to enable firmware |
72 | loading to the kernel through userspace as a fallback mechanism | 76 | loading to the kernel through userspace as a fallback mechanism |
@@ -151,5 +155,19 @@ config FW_LOADER_USER_HELPER_FALLBACK | |||
151 | 155 | ||
152 | If you are unsure about this, say N here. | 156 | If you are unsure about this, say N here. |
153 | 157 | ||
158 | config FW_LOADER_COMPRESS | ||
159 | bool "Enable compressed firmware support" | ||
160 | select FW_LOADER_PAGED_BUF | ||
161 | select XZ_DEC | ||
162 | help | ||
163 | This option enables the support for loading compressed firmware | ||
164 | files. The caller of firmware API receives the decompressed file | ||
165 | content. The compressed file is loaded as a fallback, only after | ||
166 | loading the raw file failed at first. | ||
167 | |||
168 | Currently only XZ-compressed files are supported, and they have to | ||
169 | be compressed with either none or crc32 integrity check type (pass | ||
170 | "-C crc32" option to xz command). | ||
171 | |||
154 | endif # FW_LOADER | 172 | endif # FW_LOADER |
155 | endmenu | 173 | endmenu |
diff --git a/drivers/base/firmware_loader/fallback.c b/drivers/base/firmware_loader/fallback.c index f962488546b6..62ee90b4db56 100644 --- a/drivers/base/firmware_loader/fallback.c +++ b/drivers/base/firmware_loader/fallback.c | |||
@@ -219,20 +219,6 @@ static ssize_t firmware_loading_show(struct device *dev, | |||
219 | return sprintf(buf, "%d\n", loading); | 219 | return sprintf(buf, "%d\n", loading); |
220 | } | 220 | } |
221 | 221 | ||
222 | /* one pages buffer should be mapped/unmapped only once */ | ||
223 | static int map_fw_priv_pages(struct fw_priv *fw_priv) | ||
224 | { | ||
225 | if (!fw_priv->is_paged_buf) | ||
226 | return 0; | ||
227 | |||
228 | vunmap(fw_priv->data); | ||
229 | fw_priv->data = vmap(fw_priv->pages, fw_priv->nr_pages, 0, | ||
230 | PAGE_KERNEL_RO); | ||
231 | if (!fw_priv->data) | ||
232 | return -ENOMEM; | ||
233 | return 0; | ||
234 | } | ||
235 | |||
236 | /** | 222 | /** |
237 | * firmware_loading_store() - set value in the 'loading' control file | 223 | * firmware_loading_store() - set value in the 'loading' control file |
238 | * @dev: device pointer | 224 | * @dev: device pointer |
@@ -254,7 +240,6 @@ static ssize_t firmware_loading_store(struct device *dev, | |||
254 | struct fw_priv *fw_priv; | 240 | struct fw_priv *fw_priv; |
255 | ssize_t written = count; | 241 | ssize_t written = count; |
256 | int loading = simple_strtol(buf, NULL, 10); | 242 | int loading = simple_strtol(buf, NULL, 10); |
257 | int i; | ||
258 | 243 | ||
259 | mutex_lock(&fw_lock); | 244 | mutex_lock(&fw_lock); |
260 | fw_priv = fw_sysfs->fw_priv; | 245 | fw_priv = fw_sysfs->fw_priv; |
@@ -265,12 +250,7 @@ static ssize_t firmware_loading_store(struct device *dev, | |||
265 | case 1: | 250 | case 1: |
266 | /* discarding any previous partial load */ | 251 | /* discarding any previous partial load */ |
267 | if (!fw_sysfs_done(fw_priv)) { | 252 | if (!fw_sysfs_done(fw_priv)) { |
268 | for (i = 0; i < fw_priv->nr_pages; i++) | 253 | fw_free_paged_buf(fw_priv); |
269 | __free_page(fw_priv->pages[i]); | ||
270 | vfree(fw_priv->pages); | ||
271 | fw_priv->pages = NULL; | ||
272 | fw_priv->page_array_size = 0; | ||
273 | fw_priv->nr_pages = 0; | ||
274 | fw_state_start(fw_priv); | 254 | fw_state_start(fw_priv); |
275 | } | 255 | } |
276 | break; | 256 | break; |
@@ -284,7 +264,7 @@ static ssize_t firmware_loading_store(struct device *dev, | |||
284 | * see the mapped 'buf->data' once the loading | 264 | * see the mapped 'buf->data' once the loading |
285 | * is completed. | 265 | * is completed. |
286 | * */ | 266 | * */ |
287 | rc = map_fw_priv_pages(fw_priv); | 267 | rc = fw_map_paged_buf(fw_priv); |
288 | if (rc) | 268 | if (rc) |
289 | dev_err(dev, "%s: map pages failed\n", | 269 | dev_err(dev, "%s: map pages failed\n", |
290 | __func__); | 270 | __func__); |
@@ -389,40 +369,13 @@ out: | |||
389 | 369 | ||
390 | static int fw_realloc_pages(struct fw_sysfs *fw_sysfs, int min_size) | 370 | static int fw_realloc_pages(struct fw_sysfs *fw_sysfs, int min_size) |
391 | { | 371 | { |
392 | struct fw_priv *fw_priv= fw_sysfs->fw_priv; | 372 | int err; |
393 | int pages_needed = PAGE_ALIGN(min_size) >> PAGE_SHIFT; | ||
394 | |||
395 | /* If the array of pages is too small, grow it... */ | ||
396 | if (fw_priv->page_array_size < pages_needed) { | ||
397 | int new_array_size = max(pages_needed, | ||
398 | fw_priv->page_array_size * 2); | ||
399 | struct page **new_pages; | ||
400 | 373 | ||
401 | new_pages = vmalloc(array_size(new_array_size, sizeof(void *))); | 374 | err = fw_grow_paged_buf(fw_sysfs->fw_priv, |
402 | if (!new_pages) { | 375 | PAGE_ALIGN(min_size) >> PAGE_SHIFT); |
403 | fw_load_abort(fw_sysfs); | 376 | if (err) |
404 | return -ENOMEM; | 377 | fw_load_abort(fw_sysfs); |
405 | } | 378 | return err; |
406 | memcpy(new_pages, fw_priv->pages, | ||
407 | fw_priv->page_array_size * sizeof(void *)); | ||
408 | memset(&new_pages[fw_priv->page_array_size], 0, sizeof(void *) * | ||
409 | (new_array_size - fw_priv->page_array_size)); | ||
410 | vfree(fw_priv->pages); | ||
411 | fw_priv->pages = new_pages; | ||
412 | fw_priv->page_array_size = new_array_size; | ||
413 | } | ||
414 | |||
415 | while (fw_priv->nr_pages < pages_needed) { | ||
416 | fw_priv->pages[fw_priv->nr_pages] = | ||
417 | alloc_page(GFP_KERNEL | __GFP_HIGHMEM); | ||
418 | |||
419 | if (!fw_priv->pages[fw_priv->nr_pages]) { | ||
420 | fw_load_abort(fw_sysfs); | ||
421 | return -ENOMEM; | ||
422 | } | ||
423 | fw_priv->nr_pages++; | ||
424 | } | ||
425 | return 0; | ||
426 | } | 379 | } |
427 | 380 | ||
428 | /** | 381 | /** |
@@ -659,7 +612,7 @@ static bool fw_run_sysfs_fallback(enum fw_opt opt_flags) | |||
659 | /* Also permit LSMs and IMA to fail firmware sysfs fallback */ | 612 | /* Also permit LSMs and IMA to fail firmware sysfs fallback */ |
660 | ret = security_kernel_load_data(LOADING_FIRMWARE); | 613 | ret = security_kernel_load_data(LOADING_FIRMWARE); |
661 | if (ret < 0) | 614 | if (ret < 0) |
662 | return ret; | 615 | return false; |
663 | 616 | ||
664 | return fw_force_sysfs_fallback(opt_flags); | 617 | return fw_force_sysfs_fallback(opt_flags); |
665 | } | 618 | } |
diff --git a/drivers/base/firmware_loader/firmware.h b/drivers/base/firmware_loader/firmware.h index 4c1395f8e7ed..7048a41973ed 100644 --- a/drivers/base/firmware_loader/firmware.h +++ b/drivers/base/firmware_loader/firmware.h | |||
@@ -64,12 +64,14 @@ struct fw_priv { | |||
64 | void *data; | 64 | void *data; |
65 | size_t size; | 65 | size_t size; |
66 | size_t allocated_size; | 66 | size_t allocated_size; |
67 | #ifdef CONFIG_FW_LOADER_USER_HELPER | 67 | #ifdef CONFIG_FW_LOADER_PAGED_BUF |
68 | bool is_paged_buf; | 68 | bool is_paged_buf; |
69 | bool need_uevent; | ||
70 | struct page **pages; | 69 | struct page **pages; |
71 | int nr_pages; | 70 | int nr_pages; |
72 | int page_array_size; | 71 | int page_array_size; |
72 | #endif | ||
73 | #ifdef CONFIG_FW_LOADER_USER_HELPER | ||
74 | bool need_uevent; | ||
73 | struct list_head pending_list; | 75 | struct list_head pending_list; |
74 | #endif | 76 | #endif |
75 | const char *fw_name; | 77 | const char *fw_name; |
@@ -133,4 +135,14 @@ static inline void fw_state_done(struct fw_priv *fw_priv) | |||
133 | int assign_fw(struct firmware *fw, struct device *device, | 135 | int assign_fw(struct firmware *fw, struct device *device, |
134 | enum fw_opt opt_flags); | 136 | enum fw_opt opt_flags); |
135 | 137 | ||
138 | #ifdef CONFIG_FW_LOADER_PAGED_BUF | ||
139 | void fw_free_paged_buf(struct fw_priv *fw_priv); | ||
140 | int fw_grow_paged_buf(struct fw_priv *fw_priv, int pages_needed); | ||
141 | int fw_map_paged_buf(struct fw_priv *fw_priv); | ||
142 | #else | ||
143 | static inline void fw_free_paged_buf(struct fw_priv *fw_priv) {} | ||
144 | int fw_grow_paged_buf(struct fw_priv *fw_priv, int pages_needed) { return -ENXIO; } | ||
145 | int fw_map_paged_buf(struct fw_priv *fw_priv) { return -ENXIO; } | ||
146 | #endif | ||
147 | |||
136 | #endif /* __FIRMWARE_LOADER_H */ | 148 | #endif /* __FIRMWARE_LOADER_H */ |
diff --git a/drivers/base/firmware_loader/main.c b/drivers/base/firmware_loader/main.c index 7eaaf5ee5ba6..bf44c79beae9 100644 --- a/drivers/base/firmware_loader/main.c +++ b/drivers/base/firmware_loader/main.c | |||
@@ -33,6 +33,7 @@ | |||
33 | #include <linux/syscore_ops.h> | 33 | #include <linux/syscore_ops.h> |
34 | #include <linux/reboot.h> | 34 | #include <linux/reboot.h> |
35 | #include <linux/security.h> | 35 | #include <linux/security.h> |
36 | #include <linux/xz.h> | ||
36 | 37 | ||
37 | #include <generated/utsrelease.h> | 38 | #include <generated/utsrelease.h> |
38 | 39 | ||
@@ -251,15 +252,7 @@ static void __free_fw_priv(struct kref *ref) | |||
251 | list_del(&fw_priv->list); | 252 | list_del(&fw_priv->list); |
252 | spin_unlock(&fwc->lock); | 253 | spin_unlock(&fwc->lock); |
253 | 254 | ||
254 | #ifdef CONFIG_FW_LOADER_USER_HELPER | 255 | fw_free_paged_buf(fw_priv); /* free leftover pages */ |
255 | if (fw_priv->is_paged_buf) { | ||
256 | int i; | ||
257 | vunmap(fw_priv->data); | ||
258 | for (i = 0; i < fw_priv->nr_pages; i++) | ||
259 | __free_page(fw_priv->pages[i]); | ||
260 | vfree(fw_priv->pages); | ||
261 | } else | ||
262 | #endif | ||
263 | if (!fw_priv->allocated_size) | 256 | if (!fw_priv->allocated_size) |
264 | vfree(fw_priv->data); | 257 | vfree(fw_priv->data); |
265 | kfree_const(fw_priv->fw_name); | 258 | kfree_const(fw_priv->fw_name); |
@@ -274,6 +267,174 @@ static void free_fw_priv(struct fw_priv *fw_priv) | |||
274 | spin_unlock(&fwc->lock); | 267 | spin_unlock(&fwc->lock); |
275 | } | 268 | } |
276 | 269 | ||
270 | #ifdef CONFIG_FW_LOADER_PAGED_BUF | ||
271 | void fw_free_paged_buf(struct fw_priv *fw_priv) | ||
272 | { | ||
273 | int i; | ||
274 | |||
275 | if (!fw_priv->pages) | ||
276 | return; | ||
277 | |||
278 | for (i = 0; i < fw_priv->nr_pages; i++) | ||
279 | __free_page(fw_priv->pages[i]); | ||
280 | kvfree(fw_priv->pages); | ||
281 | fw_priv->pages = NULL; | ||
282 | fw_priv->page_array_size = 0; | ||
283 | fw_priv->nr_pages = 0; | ||
284 | } | ||
285 | |||
286 | int fw_grow_paged_buf(struct fw_priv *fw_priv, int pages_needed) | ||
287 | { | ||
288 | /* If the array of pages is too small, grow it */ | ||
289 | if (fw_priv->page_array_size < pages_needed) { | ||
290 | int new_array_size = max(pages_needed, | ||
291 | fw_priv->page_array_size * 2); | ||
292 | struct page **new_pages; | ||
293 | |||
294 | new_pages = kvmalloc_array(new_array_size, sizeof(void *), | ||
295 | GFP_KERNEL); | ||
296 | if (!new_pages) | ||
297 | return -ENOMEM; | ||
298 | memcpy(new_pages, fw_priv->pages, | ||
299 | fw_priv->page_array_size * sizeof(void *)); | ||
300 | memset(&new_pages[fw_priv->page_array_size], 0, sizeof(void *) * | ||
301 | (new_array_size - fw_priv->page_array_size)); | ||
302 | kvfree(fw_priv->pages); | ||
303 | fw_priv->pages = new_pages; | ||
304 | fw_priv->page_array_size = new_array_size; | ||
305 | } | ||
306 | |||
307 | while (fw_priv->nr_pages < pages_needed) { | ||
308 | fw_priv->pages[fw_priv->nr_pages] = | ||
309 | alloc_page(GFP_KERNEL | __GFP_HIGHMEM); | ||
310 | |||
311 | if (!fw_priv->pages[fw_priv->nr_pages]) | ||
312 | return -ENOMEM; | ||
313 | fw_priv->nr_pages++; | ||
314 | } | ||
315 | |||
316 | return 0; | ||
317 | } | ||
318 | |||
319 | int fw_map_paged_buf(struct fw_priv *fw_priv) | ||
320 | { | ||
321 | /* one pages buffer should be mapped/unmapped only once */ | ||
322 | if (!fw_priv->pages) | ||
323 | return 0; | ||
324 | |||
325 | vunmap(fw_priv->data); | ||
326 | fw_priv->data = vmap(fw_priv->pages, fw_priv->nr_pages, 0, | ||
327 | PAGE_KERNEL_RO); | ||
328 | if (!fw_priv->data) | ||
329 | return -ENOMEM; | ||
330 | |||
331 | /* page table is no longer needed after mapping, let's free */ | ||
332 | kvfree(fw_priv->pages); | ||
333 | fw_priv->pages = NULL; | ||
334 | |||
335 | return 0; | ||
336 | } | ||
337 | #endif | ||
338 | |||
339 | /* | ||
340 | * XZ-compressed firmware support | ||
341 | */ | ||
342 | #ifdef CONFIG_FW_LOADER_COMPRESS | ||
343 | /* show an error and return the standard error code */ | ||
344 | static int fw_decompress_xz_error(struct device *dev, enum xz_ret xz_ret) | ||
345 | { | ||
346 | if (xz_ret != XZ_STREAM_END) { | ||
347 | dev_warn(dev, "xz decompression failed (xz_ret=%d)\n", xz_ret); | ||
348 | return xz_ret == XZ_MEM_ERROR ? -ENOMEM : -EINVAL; | ||
349 | } | ||
350 | return 0; | ||
351 | } | ||
352 | |||
353 | /* single-shot decompression onto the pre-allocated buffer */ | ||
354 | static int fw_decompress_xz_single(struct device *dev, struct fw_priv *fw_priv, | ||
355 | size_t in_size, const void *in_buffer) | ||
356 | { | ||
357 | struct xz_dec *xz_dec; | ||
358 | struct xz_buf xz_buf; | ||
359 | enum xz_ret xz_ret; | ||
360 | |||
361 | xz_dec = xz_dec_init(XZ_SINGLE, (u32)-1); | ||
362 | if (!xz_dec) | ||
363 | return -ENOMEM; | ||
364 | |||
365 | xz_buf.in_size = in_size; | ||
366 | xz_buf.in = in_buffer; | ||
367 | xz_buf.in_pos = 0; | ||
368 | xz_buf.out_size = fw_priv->allocated_size; | ||
369 | xz_buf.out = fw_priv->data; | ||
370 | xz_buf.out_pos = 0; | ||
371 | |||
372 | xz_ret = xz_dec_run(xz_dec, &xz_buf); | ||
373 | xz_dec_end(xz_dec); | ||
374 | |||
375 | fw_priv->size = xz_buf.out_pos; | ||
376 | return fw_decompress_xz_error(dev, xz_ret); | ||
377 | } | ||
378 | |||
379 | /* decompression on paged buffer and map it */ | ||
380 | static int fw_decompress_xz_pages(struct device *dev, struct fw_priv *fw_priv, | ||
381 | size_t in_size, const void *in_buffer) | ||
382 | { | ||
383 | struct xz_dec *xz_dec; | ||
384 | struct xz_buf xz_buf; | ||
385 | enum xz_ret xz_ret; | ||
386 | struct page *page; | ||
387 | int err = 0; | ||
388 | |||
389 | xz_dec = xz_dec_init(XZ_DYNALLOC, (u32)-1); | ||
390 | if (!xz_dec) | ||
391 | return -ENOMEM; | ||
392 | |||
393 | xz_buf.in_size = in_size; | ||
394 | xz_buf.in = in_buffer; | ||
395 | xz_buf.in_pos = 0; | ||
396 | |||
397 | fw_priv->is_paged_buf = true; | ||
398 | fw_priv->size = 0; | ||
399 | do { | ||
400 | if (fw_grow_paged_buf(fw_priv, fw_priv->nr_pages + 1)) { | ||
401 | err = -ENOMEM; | ||
402 | goto out; | ||
403 | } | ||
404 | |||
405 | /* decompress onto the new allocated page */ | ||
406 | page = fw_priv->pages[fw_priv->nr_pages - 1]; | ||
407 | xz_buf.out = kmap(page); | ||
408 | xz_buf.out_pos = 0; | ||
409 | xz_buf.out_size = PAGE_SIZE; | ||
410 | xz_ret = xz_dec_run(xz_dec, &xz_buf); | ||
411 | kunmap(page); | ||
412 | fw_priv->size += xz_buf.out_pos; | ||
413 | /* partial decompression means either end or error */ | ||
414 | if (xz_buf.out_pos != PAGE_SIZE) | ||
415 | break; | ||
416 | } while (xz_ret == XZ_OK); | ||
417 | |||
418 | err = fw_decompress_xz_error(dev, xz_ret); | ||
419 | if (!err) | ||
420 | err = fw_map_paged_buf(fw_priv); | ||
421 | |||
422 | out: | ||
423 | xz_dec_end(xz_dec); | ||
424 | return err; | ||
425 | } | ||
426 | |||
427 | static int fw_decompress_xz(struct device *dev, struct fw_priv *fw_priv, | ||
428 | size_t in_size, const void *in_buffer) | ||
429 | { | ||
430 | /* if the buffer is pre-allocated, we can perform in single-shot mode */ | ||
431 | if (fw_priv->data) | ||
432 | return fw_decompress_xz_single(dev, fw_priv, in_size, in_buffer); | ||
433 | else | ||
434 | return fw_decompress_xz_pages(dev, fw_priv, in_size, in_buffer); | ||
435 | } | ||
436 | #endif /* CONFIG_FW_LOADER_COMPRESS */ | ||
437 | |||
277 | /* direct firmware loading support */ | 438 | /* direct firmware loading support */ |
278 | static char fw_path_para[256]; | 439 | static char fw_path_para[256]; |
279 | static const char * const fw_path[] = { | 440 | static const char * const fw_path[] = { |
@@ -293,7 +454,12 @@ module_param_string(path, fw_path_para, sizeof(fw_path_para), 0644); | |||
293 | MODULE_PARM_DESC(path, "customized firmware image search path with a higher priority than default path"); | 454 | MODULE_PARM_DESC(path, "customized firmware image search path with a higher priority than default path"); |
294 | 455 | ||
295 | static int | 456 | static int |
296 | fw_get_filesystem_firmware(struct device *device, struct fw_priv *fw_priv) | 457 | fw_get_filesystem_firmware(struct device *device, struct fw_priv *fw_priv, |
458 | const char *suffix, | ||
459 | int (*decompress)(struct device *dev, | ||
460 | struct fw_priv *fw_priv, | ||
461 | size_t in_size, | ||
462 | const void *in_buffer)) | ||
297 | { | 463 | { |
298 | loff_t size; | 464 | loff_t size; |
299 | int i, len; | 465 | int i, len; |
@@ -301,9 +467,11 @@ fw_get_filesystem_firmware(struct device *device, struct fw_priv *fw_priv) | |||
301 | char *path; | 467 | char *path; |
302 | enum kernel_read_file_id id = READING_FIRMWARE; | 468 | enum kernel_read_file_id id = READING_FIRMWARE; |
303 | size_t msize = INT_MAX; | 469 | size_t msize = INT_MAX; |
470 | void *buffer = NULL; | ||
304 | 471 | ||
305 | /* Already populated data member means we're loading into a buffer */ | 472 | /* Already populated data member means we're loading into a buffer */ |
306 | if (fw_priv->data) { | 473 | if (!decompress && fw_priv->data) { |
474 | buffer = fw_priv->data; | ||
307 | id = READING_FIRMWARE_PREALLOC_BUFFER; | 475 | id = READING_FIRMWARE_PREALLOC_BUFFER; |
308 | msize = fw_priv->allocated_size; | 476 | msize = fw_priv->allocated_size; |
309 | } | 477 | } |
@@ -317,15 +485,15 @@ fw_get_filesystem_firmware(struct device *device, struct fw_priv *fw_priv) | |||
317 | if (!fw_path[i][0]) | 485 | if (!fw_path[i][0]) |
318 | continue; | 486 | continue; |
319 | 487 | ||
320 | len = snprintf(path, PATH_MAX, "%s/%s", | 488 | len = snprintf(path, PATH_MAX, "%s/%s%s", |
321 | fw_path[i], fw_priv->fw_name); | 489 | fw_path[i], fw_priv->fw_name, suffix); |
322 | if (len >= PATH_MAX) { | 490 | if (len >= PATH_MAX) { |
323 | rc = -ENAMETOOLONG; | 491 | rc = -ENAMETOOLONG; |
324 | break; | 492 | break; |
325 | } | 493 | } |
326 | 494 | ||
327 | fw_priv->size = 0; | 495 | fw_priv->size = 0; |
328 | rc = kernel_read_file_from_path(path, &fw_priv->data, &size, | 496 | rc = kernel_read_file_from_path(path, &buffer, &size, |
329 | msize, id); | 497 | msize, id); |
330 | if (rc) { | 498 | if (rc) { |
331 | if (rc != -ENOENT) | 499 | if (rc != -ENOENT) |
@@ -336,8 +504,24 @@ fw_get_filesystem_firmware(struct device *device, struct fw_priv *fw_priv) | |||
336 | path); | 504 | path); |
337 | continue; | 505 | continue; |
338 | } | 506 | } |
339 | dev_dbg(device, "direct-loading %s\n", fw_priv->fw_name); | 507 | if (decompress) { |
340 | fw_priv->size = size; | 508 | dev_dbg(device, "f/w decompressing %s\n", |
509 | fw_priv->fw_name); | ||
510 | rc = decompress(device, fw_priv, size, buffer); | ||
511 | /* discard the superfluous original content */ | ||
512 | vfree(buffer); | ||
513 | buffer = NULL; | ||
514 | if (rc) { | ||
515 | fw_free_paged_buf(fw_priv); | ||
516 | continue; | ||
517 | } | ||
518 | } else { | ||
519 | dev_dbg(device, "direct-loading %s\n", | ||
520 | fw_priv->fw_name); | ||
521 | if (!fw_priv->data) | ||
522 | fw_priv->data = buffer; | ||
523 | fw_priv->size = size; | ||
524 | } | ||
341 | fw_state_done(fw_priv); | 525 | fw_state_done(fw_priv); |
342 | break; | 526 | break; |
343 | } | 527 | } |
@@ -584,7 +768,13 @@ _request_firmware(const struct firmware **firmware_p, const char *name, | |||
584 | if (ret <= 0) /* error or already assigned */ | 768 | if (ret <= 0) /* error or already assigned */ |
585 | goto out; | 769 | goto out; |
586 | 770 | ||
587 | ret = fw_get_filesystem_firmware(device, fw->priv); | 771 | ret = fw_get_filesystem_firmware(device, fw->priv, "", NULL); |
772 | #ifdef CONFIG_FW_LOADER_COMPRESS | ||
773 | if (ret == -ENOENT) | ||
774 | ret = fw_get_filesystem_firmware(device, fw->priv, ".xz", | ||
775 | fw_decompress_xz); | ||
776 | #endif | ||
777 | |||
588 | if (ret) { | 778 | if (ret) { |
589 | if (!(opt_flags & FW_OPT_NO_WARN)) | 779 | if (!(opt_flags & FW_OPT_NO_WARN)) |
590 | dev_warn(device, | 780 | dev_warn(device, |
diff --git a/drivers/base/node.c b/drivers/base/node.c index 8598fcbd2a17..aa878fbcf705 100644 --- a/drivers/base/node.c +++ b/drivers/base/node.c | |||
@@ -66,6 +66,7 @@ static DEVICE_ATTR(cpulist, S_IRUGO, node_read_cpulist, NULL); | |||
66 | * @dev: Device for this memory access class | 66 | * @dev: Device for this memory access class |
67 | * @list_node: List element in the node's access list | 67 | * @list_node: List element in the node's access list |
68 | * @access: The access class rank | 68 | * @access: The access class rank |
69 | * @hmem_attrs: Heterogeneous memory performance attributes | ||
69 | */ | 70 | */ |
70 | struct node_access_nodes { | 71 | struct node_access_nodes { |
71 | struct device dev; | 72 | struct device dev; |
@@ -673,8 +674,8 @@ int register_cpu_under_node(unsigned int cpu, unsigned int nid) | |||
673 | /** | 674 | /** |
674 | * register_memory_node_under_compute_node - link memory node to its compute | 675 | * register_memory_node_under_compute_node - link memory node to its compute |
675 | * node for a given access class. | 676 | * node for a given access class. |
676 | * @mem_node: Memory node number | 677 | * @mem_nid: Memory node number |
677 | * @cpu_node: Cpu node number | 678 | * @cpu_nid: Cpu node number |
678 | * @access: Access class to register | 679 | * @access: Access class to register |
679 | * | 680 | * |
680 | * Description: | 681 | * Description: |
diff --git a/drivers/base/platform.c b/drivers/base/platform.c index 4d1729853d1a..713903290385 100644 --- a/drivers/base/platform.c +++ b/drivers/base/platform.c | |||
@@ -5,7 +5,7 @@ | |||
5 | * Copyright (c) 2002-3 Patrick Mochel | 5 | * Copyright (c) 2002-3 Patrick Mochel |
6 | * Copyright (c) 2002-3 Open Source Development Labs | 6 | * Copyright (c) 2002-3 Open Source Development Labs |
7 | * | 7 | * |
8 | * Please see Documentation/driver-model/platform.txt for more | 8 | * Please see Documentation/driver-model/platform.rst for more |
9 | * information. | 9 | * information. |
10 | */ | 10 | */ |
11 | 11 | ||
diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c index 1dc10740fc0f..6707659cffd6 100644 --- a/drivers/char/ipmi/ipmi_msghandler.c +++ b/drivers/char/ipmi/ipmi_msghandler.c | |||
@@ -2819,9 +2819,9 @@ static const struct device_type bmc_device_type = { | |||
2819 | .groups = bmc_dev_attr_groups, | 2819 | .groups = bmc_dev_attr_groups, |
2820 | }; | 2820 | }; |
2821 | 2821 | ||
2822 | static int __find_bmc_guid(struct device *dev, void *data) | 2822 | static int __find_bmc_guid(struct device *dev, const void *data) |
2823 | { | 2823 | { |
2824 | guid_t *guid = data; | 2824 | const guid_t *guid = data; |
2825 | struct bmc_device *bmc; | 2825 | struct bmc_device *bmc; |
2826 | int rv; | 2826 | int rv; |
2827 | 2827 | ||
@@ -2857,9 +2857,9 @@ struct prod_dev_id { | |||
2857 | unsigned char device_id; | 2857 | unsigned char device_id; |
2858 | }; | 2858 | }; |
2859 | 2859 | ||
2860 | static int __find_bmc_prod_dev_id(struct device *dev, void *data) | 2860 | static int __find_bmc_prod_dev_id(struct device *dev, const void *data) |
2861 | { | 2861 | { |
2862 | struct prod_dev_id *cid = data; | 2862 | const struct prod_dev_id *cid = data; |
2863 | struct bmc_device *bmc; | 2863 | struct bmc_device *bmc; |
2864 | int rv; | 2864 | int rv; |
2865 | 2865 | ||
diff --git a/drivers/char/ipmi/ipmi_si_platform.c b/drivers/char/ipmi/ipmi_si_platform.c index f2a91c4d8cab..fd94c4238449 100644 --- a/drivers/char/ipmi/ipmi_si_platform.c +++ b/drivers/char/ipmi/ipmi_si_platform.c | |||
@@ -426,7 +426,7 @@ static int ipmi_remove(struct platform_device *pdev) | |||
426 | return ipmi_si_remove_by_dev(&pdev->dev); | 426 | return ipmi_si_remove_by_dev(&pdev->dev); |
427 | } | 427 | } |
428 | 428 | ||
429 | static int pdev_match_name(struct device *dev, void *data) | 429 | static int pdev_match_name(struct device *dev, const void *data) |
430 | { | 430 | { |
431 | struct platform_device *pdev = to_platform_device(dev); | 431 | struct platform_device *pdev = to_platform_device(dev); |
432 | const char *name = data; | 432 | const char *name = data; |
diff --git a/drivers/firmware/arm_scmi/common.h b/drivers/firmware/arm_scmi/common.h index 937a930ce87d..44fd4f9404a9 100644 --- a/drivers/firmware/arm_scmi/common.h +++ b/drivers/firmware/arm_scmi/common.h | |||
@@ -1,4 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
2 | /* | 2 | /* |
3 | * System Control and Management Interface (SCMI) Message Protocol | 3 | * System Control and Management Interface (SCMI) Message Protocol |
4 | * driver common header file containing some definitions, structures | 4 | * driver common header file containing some definitions, structures |
diff --git a/drivers/firmware/efi/dev-path-parser.c b/drivers/firmware/efi/dev-path-parser.c index 85ec99f97841..20123384271c 100644 --- a/drivers/firmware/efi/dev-path-parser.c +++ b/drivers/firmware/efi/dev-path-parser.c | |||
@@ -17,9 +17,9 @@ struct acpi_hid_uid { | |||
17 | char uid[11]; /* UINT_MAX + null byte */ | 17 | char uid[11]; /* UINT_MAX + null byte */ |
18 | }; | 18 | }; |
19 | 19 | ||
20 | static int __init match_acpi_dev(struct device *dev, void *data) | 20 | static int __init match_acpi_dev(struct device *dev, const void *data) |
21 | { | 21 | { |
22 | struct acpi_hid_uid hid_uid = *(struct acpi_hid_uid *)data; | 22 | struct acpi_hid_uid hid_uid = *(const struct acpi_hid_uid *)data; |
23 | struct acpi_device *adev = to_acpi_device(dev); | 23 | struct acpi_device *adev = to_acpi_device(dev); |
24 | 24 | ||
25 | if (acpi_match_device_ids(adev, hid_uid.hid)) | 25 | if (acpi_match_device_ids(adev, hid_uid.hid)) |
diff --git a/drivers/firmware/ti_sci.h b/drivers/firmware/ti_sci.h index 4983827151bf..adbeeefaca92 100644 --- a/drivers/firmware/ti_sci.h +++ b/drivers/firmware/ti_sci.h | |||
@@ -1,4 +1,4 @@ | |||
1 | // SPDX-License-Identifier: BSD-3-Clause | 1 | /* SPDX-License-Identifier: BSD-3-Clause */ |
2 | /* | 2 | /* |
3 | * Texas Instruments System Control Interface (TISCI) Protocol | 3 | * Texas Instruments System Control Interface (TISCI) Protocol |
4 | * | 4 | * |
diff --git a/drivers/fpga/of-fpga-region.c b/drivers/fpga/of-fpga-region.c index 75f64abf9c81..e405309baadc 100644 --- a/drivers/fpga/of-fpga-region.c +++ b/drivers/fpga/of-fpga-region.c | |||
@@ -22,11 +22,6 @@ static const struct of_device_id fpga_region_of_match[] = { | |||
22 | }; | 22 | }; |
23 | MODULE_DEVICE_TABLE(of, fpga_region_of_match); | 23 | MODULE_DEVICE_TABLE(of, fpga_region_of_match); |
24 | 24 | ||
25 | static int fpga_region_of_node_match(struct device *dev, const void *data) | ||
26 | { | ||
27 | return dev->of_node == data; | ||
28 | } | ||
29 | |||
30 | /** | 25 | /** |
31 | * of_fpga_region_find - find FPGA region | 26 | * of_fpga_region_find - find FPGA region |
32 | * @np: device node of FPGA Region | 27 | * @np: device node of FPGA Region |
@@ -37,7 +32,7 @@ static int fpga_region_of_node_match(struct device *dev, const void *data) | |||
37 | */ | 32 | */ |
38 | static struct fpga_region *of_fpga_region_find(struct device_node *np) | 33 | static struct fpga_region *of_fpga_region_find(struct device_node *np) |
39 | { | 34 | { |
40 | return fpga_region_class_find(NULL, np, fpga_region_of_node_match); | 35 | return fpga_region_class_find(NULL, np, device_match_of_node); |
41 | } | 36 | } |
42 | 37 | ||
43 | /** | 38 | /** |
diff --git a/drivers/gpio/gpio-cs5535.c b/drivers/gpio/gpio-cs5535.c index 6314225dbed0..3611a0571667 100644 --- a/drivers/gpio/gpio-cs5535.c +++ b/drivers/gpio/gpio-cs5535.c | |||
@@ -41,7 +41,7 @@ MODULE_PARM_DESC(mask, "GPIO channel mask."); | |||
41 | 41 | ||
42 | /* | 42 | /* |
43 | * FIXME: convert this singleton driver to use the state container | 43 | * FIXME: convert this singleton driver to use the state container |
44 | * design pattern, see Documentation/driver-model/design-patterns.txt | 44 | * design pattern, see Documentation/driver-model/design-patterns.rst |
45 | */ | 45 | */ |
46 | static struct cs5535_gpio_chip { | 46 | static struct cs5535_gpio_chip { |
47 | struct gpio_chip chip; | 47 | struct gpio_chip chip; |
diff --git a/drivers/gpu/drm/drm_mipi_dsi.c b/drivers/gpu/drm/drm_mipi_dsi.c index 80b75501f5c6..ad19df0686c9 100644 --- a/drivers/gpu/drm/drm_mipi_dsi.c +++ b/drivers/gpu/drm/drm_mipi_dsi.c | |||
@@ -93,7 +93,7 @@ static struct bus_type mipi_dsi_bus_type = { | |||
93 | .pm = &mipi_dsi_device_pm_ops, | 93 | .pm = &mipi_dsi_device_pm_ops, |
94 | }; | 94 | }; |
95 | 95 | ||
96 | static int of_device_match(struct device *dev, void *data) | 96 | static int of_device_match(struct device *dev, const void *data) |
97 | { | 97 | { |
98 | return dev->of_node == data; | 98 | return dev->of_node == data; |
99 | } | 99 | } |
diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c index 826b3f047c0c..cf25f183c4a7 100644 --- a/drivers/gpu/drm/tegra/dc.c +++ b/drivers/gpu/drm/tegra/dc.c | |||
@@ -2372,10 +2372,10 @@ static int tegra_dc_parse_dt(struct tegra_dc *dc) | |||
2372 | return 0; | 2372 | return 0; |
2373 | } | 2373 | } |
2374 | 2374 | ||
2375 | static int tegra_dc_match_by_pipe(struct device *dev, void *data) | 2375 | static int tegra_dc_match_by_pipe(struct device *dev, const void *data) |
2376 | { | 2376 | { |
2377 | struct tegra_dc *dc = dev_get_drvdata(dev); | 2377 | struct tegra_dc *dc = dev_get_drvdata(dev); |
2378 | unsigned int pipe = (unsigned long)data; | 2378 | unsigned int pipe = (unsigned long)(void *)data; |
2379 | 2379 | ||
2380 | return dc->pipe == pipe; | 2380 | return dc->pipe == pipe; |
2381 | } | 2381 | } |
diff --git a/drivers/hwtracing/coresight/coresight-cpu-debug.c b/drivers/hwtracing/coresight/coresight-cpu-debug.c index 58bfd6319f65..2463aa7ab4f6 100644 --- a/drivers/hwtracing/coresight/coresight-cpu-debug.c +++ b/drivers/hwtracing/coresight/coresight-cpu-debug.c | |||
@@ -525,23 +525,12 @@ static const struct file_operations debug_func_knob_fops = { | |||
525 | 525 | ||
526 | static int debug_func_init(void) | 526 | static int debug_func_init(void) |
527 | { | 527 | { |
528 | struct dentry *file; | ||
529 | int ret; | 528 | int ret; |
530 | 529 | ||
531 | /* Create debugfs node */ | 530 | /* Create debugfs node */ |
532 | debug_debugfs_dir = debugfs_create_dir("coresight_cpu_debug", NULL); | 531 | debug_debugfs_dir = debugfs_create_dir("coresight_cpu_debug", NULL); |
533 | if (!debug_debugfs_dir) { | 532 | debugfs_create_file("enable", 0644, debug_debugfs_dir, NULL, |
534 | pr_err("%s: unable to create debugfs directory\n", __func__); | 533 | &debug_func_knob_fops); |
535 | return -ENOMEM; | ||
536 | } | ||
537 | |||
538 | file = debugfs_create_file("enable", 0644, debug_debugfs_dir, NULL, | ||
539 | &debug_func_knob_fops); | ||
540 | if (!file) { | ||
541 | pr_err("%s: unable to create enable knob file\n", __func__); | ||
542 | ret = -ENOMEM; | ||
543 | goto err; | ||
544 | } | ||
545 | 534 | ||
546 | /* Register function to be called for panic */ | 535 | /* Register function to be called for panic */ |
547 | ret = atomic_notifier_chain_register(&panic_notifier_list, | 536 | ret = atomic_notifier_chain_register(&panic_notifier_list, |
diff --git a/drivers/hwtracing/coresight/coresight-platform.c b/drivers/hwtracing/coresight/coresight-platform.c index cf580ffbc27c..dad7d96c5943 100644 --- a/drivers/hwtracing/coresight/coresight-platform.c +++ b/drivers/hwtracing/coresight/coresight-platform.c | |||
@@ -37,7 +37,7 @@ static int coresight_alloc_conns(struct device *dev, | |||
37 | return 0; | 37 | return 0; |
38 | } | 38 | } |
39 | 39 | ||
40 | int coresight_device_fwnode_match(struct device *dev, void *fwnode) | 40 | int coresight_device_fwnode_match(struct device *dev, const void *fwnode) |
41 | { | 41 | { |
42 | return dev_fwnode(dev) == fwnode; | 42 | return dev_fwnode(dev) == fwnode; |
43 | } | 43 | } |
diff --git a/drivers/hwtracing/coresight/coresight.c b/drivers/hwtracing/coresight/coresight.c index 86d1fc2c1bd4..55db77f6410b 100644 --- a/drivers/hwtracing/coresight/coresight.c +++ b/drivers/hwtracing/coresight/coresight.c | |||
@@ -498,9 +498,9 @@ struct coresight_device *coresight_get_sink(struct list_head *path) | |||
498 | return csdev; | 498 | return csdev; |
499 | } | 499 | } |
500 | 500 | ||
501 | static int coresight_enabled_sink(struct device *dev, void *data) | 501 | static int coresight_enabled_sink(struct device *dev, const void *data) |
502 | { | 502 | { |
503 | bool *reset = data; | 503 | const bool *reset = data; |
504 | struct coresight_device *csdev = to_coresight_device(dev); | 504 | struct coresight_device *csdev = to_coresight_device(dev); |
505 | 505 | ||
506 | if ((csdev->type == CORESIGHT_DEV_TYPE_SINK || | 506 | if ((csdev->type == CORESIGHT_DEV_TYPE_SINK || |
@@ -544,7 +544,7 @@ struct coresight_device *coresight_get_enabled_sink(bool deactivate) | |||
544 | return dev ? to_coresight_device(dev) : NULL; | 544 | return dev ? to_coresight_device(dev) : NULL; |
545 | } | 545 | } |
546 | 546 | ||
547 | static int coresight_sink_by_id(struct device *dev, void *data) | 547 | static int coresight_sink_by_id(struct device *dev, const void *data) |
548 | { | 548 | { |
549 | struct coresight_device *csdev = to_coresight_device(dev); | 549 | struct coresight_device *csdev = to_coresight_device(dev); |
550 | unsigned long hash; | 550 | unsigned long hash; |
diff --git a/drivers/hwtracing/intel_th/core.c b/drivers/hwtracing/intel_th/core.c index 033dce563c99..55922896d862 100644 --- a/drivers/hwtracing/intel_th/core.c +++ b/drivers/hwtracing/intel_th/core.c | |||
@@ -789,10 +789,9 @@ static int intel_th_populate(struct intel_th *th) | |||
789 | return 0; | 789 | return 0; |
790 | } | 790 | } |
791 | 791 | ||
792 | static int match_devt(struct device *dev, void *data) | 792 | static int match_devt(struct device *dev, const void *data) |
793 | { | 793 | { |
794 | dev_t devt = (dev_t)(unsigned long)data; | 794 | dev_t devt = (dev_t)(unsigned long)(void *)data; |
795 | |||
796 | return dev->devt == devt; | 795 | return dev->devt == devt; |
797 | } | 796 | } |
798 | 797 | ||
diff --git a/drivers/i2c/busses/i2c-amd-mp2-pci.c b/drivers/i2c/busses/i2c-amd-mp2-pci.c index 455e1f36a2a3..c7fe3b44a860 100644 --- a/drivers/i2c/busses/i2c-amd-mp2-pci.c +++ b/drivers/i2c/busses/i2c-amd-mp2-pci.c | |||
@@ -457,7 +457,7 @@ static struct pci_driver amd_mp2_pci_driver = { | |||
457 | }; | 457 | }; |
458 | module_pci_driver(amd_mp2_pci_driver); | 458 | module_pci_driver(amd_mp2_pci_driver); |
459 | 459 | ||
460 | static int amd_mp2_device_match(struct device *dev, void *data) | 460 | static int amd_mp2_device_match(struct device *dev, const void *data) |
461 | { | 461 | { |
462 | return 1; | 462 | return 1; |
463 | } | 463 | } |
diff --git a/drivers/i2c/i2c-core-acpi.c b/drivers/i2c/i2c-core-acpi.c index 1969bfdfe6a4..428a82c3a35f 100644 --- a/drivers/i2c/i2c-core-acpi.c +++ b/drivers/i2c/i2c-core-acpi.c | |||
@@ -320,7 +320,7 @@ u32 i2c_acpi_find_bus_speed(struct device *dev) | |||
320 | } | 320 | } |
321 | EXPORT_SYMBOL_GPL(i2c_acpi_find_bus_speed); | 321 | EXPORT_SYMBOL_GPL(i2c_acpi_find_bus_speed); |
322 | 322 | ||
323 | static int i2c_acpi_find_match_adapter(struct device *dev, void *data) | 323 | static int i2c_acpi_find_match_adapter(struct device *dev, const void *data) |
324 | { | 324 | { |
325 | struct i2c_adapter *adapter = i2c_verify_adapter(dev); | 325 | struct i2c_adapter *adapter = i2c_verify_adapter(dev); |
326 | 326 | ||
@@ -330,7 +330,7 @@ static int i2c_acpi_find_match_adapter(struct device *dev, void *data) | |||
330 | return ACPI_HANDLE(dev) == (acpi_handle)data; | 330 | return ACPI_HANDLE(dev) == (acpi_handle)data; |
331 | } | 331 | } |
332 | 332 | ||
333 | static int i2c_acpi_find_match_device(struct device *dev, void *data) | 333 | static int i2c_acpi_find_match_device(struct device *dev, const void *data) |
334 | { | 334 | { |
335 | return ACPI_COMPANION(dev) == data; | 335 | return ACPI_COMPANION(dev) == data; |
336 | } | 336 | } |
diff --git a/drivers/i2c/i2c-core-of.c b/drivers/i2c/i2c-core-of.c index 406e5f695a7e..2eb59a260ad4 100644 --- a/drivers/i2c/i2c-core-of.c +++ b/drivers/i2c/i2c-core-of.c | |||
@@ -112,12 +112,12 @@ void of_i2c_register_devices(struct i2c_adapter *adap) | |||
112 | of_node_put(bus); | 112 | of_node_put(bus); |
113 | } | 113 | } |
114 | 114 | ||
115 | static int of_dev_node_match(struct device *dev, void *data) | 115 | static int of_dev_node_match(struct device *dev, const void *data) |
116 | { | 116 | { |
117 | return dev->of_node == data; | 117 | return dev->of_node == data; |
118 | } | 118 | } |
119 | 119 | ||
120 | static int of_dev_or_parent_node_match(struct device *dev, void *data) | 120 | static int of_dev_or_parent_node_match(struct device *dev, const void *data) |
121 | { | 121 | { |
122 | if (dev->of_node == data) | 122 | if (dev->of_node == data) |
123 | return 1; | 123 | return 1; |
diff --git a/drivers/iio/inkern.c b/drivers/iio/inkern.c index 2fb2314548e9..5a8351c9a426 100644 --- a/drivers/iio/inkern.c +++ b/drivers/iio/inkern.c | |||
@@ -90,7 +90,7 @@ static const struct iio_chan_spec | |||
90 | 90 | ||
91 | #ifdef CONFIG_OF | 91 | #ifdef CONFIG_OF |
92 | 92 | ||
93 | static int iio_dev_node_match(struct device *dev, void *data) | 93 | static int iio_dev_node_match(struct device *dev, const void *data) |
94 | { | 94 | { |
95 | return dev->of_node == data && dev->type == &iio_device_type; | 95 | return dev->of_node == data && dev->type == &iio_device_type; |
96 | } | 96 | } |
diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v1.c b/drivers/infiniband/hw/hns/hns_roce_hw_v1.c index e068a02122f5..3afd3e9330e7 100644 --- a/drivers/infiniband/hw/hns/hns_roce_hw_v1.c +++ b/drivers/infiniband/hw/hns/hns_roce_hw_v1.c | |||
@@ -4498,7 +4498,7 @@ static const struct acpi_device_id hns_roce_acpi_match[] = { | |||
4498 | }; | 4498 | }; |
4499 | MODULE_DEVICE_TABLE(acpi, hns_roce_acpi_match); | 4499 | MODULE_DEVICE_TABLE(acpi, hns_roce_acpi_match); |
4500 | 4500 | ||
4501 | static int hns_roce_node_match(struct device *dev, void *fwnode) | 4501 | static int hns_roce_node_match(struct device *dev, const void *fwnode) |
4502 | { | 4502 | { |
4503 | return dev->fwnode == fwnode; | 4503 | return dev->fwnode == fwnode; |
4504 | } | 4504 | } |
diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c index 2d96cf0023dd..a9a9fabd3968 100644 --- a/drivers/iommu/arm-smmu-v3.c +++ b/drivers/iommu/arm-smmu-v3.c | |||
@@ -2034,7 +2034,7 @@ arm_smmu_iova_to_phys(struct iommu_domain *domain, dma_addr_t iova) | |||
2034 | 2034 | ||
2035 | static struct platform_driver arm_smmu_driver; | 2035 | static struct platform_driver arm_smmu_driver; |
2036 | 2036 | ||
2037 | static int arm_smmu_match_node(struct device *dev, void *data) | 2037 | static int arm_smmu_match_node(struct device *dev, const void *data) |
2038 | { | 2038 | { |
2039 | return dev->fwnode == data; | 2039 | return dev->fwnode == data; |
2040 | } | 2040 | } |
diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c index 653b6b3dcafb..64977c131ee6 100644 --- a/drivers/iommu/arm-smmu.c +++ b/drivers/iommu/arm-smmu.c | |||
@@ -1426,7 +1426,7 @@ static bool arm_smmu_capable(enum iommu_cap cap) | |||
1426 | } | 1426 | } |
1427 | } | 1427 | } |
1428 | 1428 | ||
1429 | static int arm_smmu_match_node(struct device *dev, void *data) | 1429 | static int arm_smmu_match_node(struct device *dev, const void *data) |
1430 | { | 1430 | { |
1431 | return dev->fwnode == data; | 1431 | return dev->fwnode == data; |
1432 | } | 1432 | } |
diff --git a/drivers/mailbox/bcm-flexrm-mailbox.c b/drivers/mailbox/bcm-flexrm-mailbox.c index a64116586b4c..43b336316fde 100644 --- a/drivers/mailbox/bcm-flexrm-mailbox.c +++ b/drivers/mailbox/bcm-flexrm-mailbox.c | |||
@@ -296,8 +296,6 @@ struct flexrm_mbox { | |||
296 | struct dma_pool *bd_pool; | 296 | struct dma_pool *bd_pool; |
297 | struct dma_pool *cmpl_pool; | 297 | struct dma_pool *cmpl_pool; |
298 | struct dentry *root; | 298 | struct dentry *root; |
299 | struct dentry *config; | ||
300 | struct dentry *stats; | ||
301 | struct mbox_controller controller; | 299 | struct mbox_controller controller; |
302 | }; | 300 | }; |
303 | 301 | ||
@@ -1603,7 +1601,6 @@ static int flexrm_mbox_probe(struct platform_device *pdev) | |||
1603 | 1 << RING_CMPL_ALIGN_ORDER, 0); | 1601 | 1 << RING_CMPL_ALIGN_ORDER, 0); |
1604 | if (!mbox->cmpl_pool) { | 1602 | if (!mbox->cmpl_pool) { |
1605 | ret = -ENOMEM; | 1603 | ret = -ENOMEM; |
1606 | goto fail_destroy_bd_pool; | ||
1607 | } | 1604 | } |
1608 | 1605 | ||
1609 | /* Allocate platform MSIs for each ring */ | 1606 | /* Allocate platform MSIs for each ring */ |
@@ -1624,28 +1621,15 @@ static int flexrm_mbox_probe(struct platform_device *pdev) | |||
1624 | 1621 | ||
1625 | /* Create debugfs root entry */ | 1622 | /* Create debugfs root entry */ |
1626 | mbox->root = debugfs_create_dir(dev_name(mbox->dev), NULL); | 1623 | mbox->root = debugfs_create_dir(dev_name(mbox->dev), NULL); |
1627 | if (IS_ERR_OR_NULL(mbox->root)) { | ||
1628 | ret = PTR_ERR_OR_ZERO(mbox->root); | ||
1629 | goto fail_free_msis; | ||
1630 | } | ||
1631 | 1624 | ||
1632 | /* Create debugfs config entry */ | 1625 | /* Create debugfs config entry */ |
1633 | mbox->config = debugfs_create_devm_seqfile(mbox->dev, | 1626 | debugfs_create_devm_seqfile(mbox->dev, "config", mbox->root, |
1634 | "config", mbox->root, | 1627 | flexrm_debugfs_conf_show); |
1635 | flexrm_debugfs_conf_show); | ||
1636 | if (IS_ERR_OR_NULL(mbox->config)) { | ||
1637 | ret = PTR_ERR_OR_ZERO(mbox->config); | ||
1638 | goto fail_free_debugfs_root; | ||
1639 | } | ||
1640 | 1628 | ||
1641 | /* Create debugfs stats entry */ | 1629 | /* Create debugfs stats entry */ |
1642 | mbox->stats = debugfs_create_devm_seqfile(mbox->dev, | 1630 | debugfs_create_devm_seqfile(mbox->dev, "stats", mbox->root, |
1643 | "stats", mbox->root, | 1631 | flexrm_debugfs_stats_show); |
1644 | flexrm_debugfs_stats_show); | 1632 | |
1645 | if (IS_ERR_OR_NULL(mbox->stats)) { | ||
1646 | ret = PTR_ERR_OR_ZERO(mbox->stats); | ||
1647 | goto fail_free_debugfs_root; | ||
1648 | } | ||
1649 | skip_debugfs: | 1633 | skip_debugfs: |
1650 | 1634 | ||
1651 | /* Initialize mailbox controller */ | 1635 | /* Initialize mailbox controller */ |
@@ -1676,11 +1660,9 @@ skip_debugfs: | |||
1676 | 1660 | ||
1677 | fail_free_debugfs_root: | 1661 | fail_free_debugfs_root: |
1678 | debugfs_remove_recursive(mbox->root); | 1662 | debugfs_remove_recursive(mbox->root); |
1679 | fail_free_msis: | ||
1680 | platform_msi_domain_free_irqs(dev); | 1663 | platform_msi_domain_free_irqs(dev); |
1681 | fail_destroy_cmpl_pool: | 1664 | fail_destroy_cmpl_pool: |
1682 | dma_pool_destroy(mbox->cmpl_pool); | 1665 | dma_pool_destroy(mbox->cmpl_pool); |
1683 | fail_destroy_bd_pool: | ||
1684 | dma_pool_destroy(mbox->bd_pool); | 1666 | dma_pool_destroy(mbox->bd_pool); |
1685 | fail: | 1667 | fail: |
1686 | return ret; | 1668 | return ret; |
diff --git a/drivers/mailbox/bcm-pdc-mailbox.c b/drivers/mailbox/bcm-pdc-mailbox.c index 8513c42f7091..fcb3b18a0678 100644 --- a/drivers/mailbox/bcm-pdc-mailbox.c +++ b/drivers/mailbox/bcm-pdc-mailbox.c | |||
@@ -395,8 +395,6 @@ struct pdc_state { | |||
395 | */ | 395 | */ |
396 | struct scatterlist *src_sg[PDC_RING_ENTRIES]; | 396 | struct scatterlist *src_sg[PDC_RING_ENTRIES]; |
397 | 397 | ||
398 | struct dentry *debugfs_stats; /* debug FS stats file for this PDC */ | ||
399 | |||
400 | /* counters */ | 398 | /* counters */ |
401 | u32 pdc_requests; /* number of request messages submitted */ | 399 | u32 pdc_requests; /* number of request messages submitted */ |
402 | u32 pdc_replies; /* number of reply messages received */ | 400 | u32 pdc_replies; /* number of reply messages received */ |
@@ -501,9 +499,8 @@ static void pdc_setup_debugfs(struct pdc_state *pdcs) | |||
501 | debugfs_dir = debugfs_create_dir(KBUILD_MODNAME, NULL); | 499 | debugfs_dir = debugfs_create_dir(KBUILD_MODNAME, NULL); |
502 | 500 | ||
503 | /* S_IRUSR == 0400 */ | 501 | /* S_IRUSR == 0400 */ |
504 | pdcs->debugfs_stats = debugfs_create_file(spu_stats_name, 0400, | 502 | debugfs_create_file(spu_stats_name, 0400, debugfs_dir, pdcs, |
505 | debugfs_dir, pdcs, | 503 | &pdc_debugfs_stats); |
506 | &pdc_debugfs_stats); | ||
507 | } | 504 | } |
508 | 505 | ||
509 | static void pdc_free_debugfs(void) | 506 | static void pdc_free_debugfs(void) |
@@ -1603,7 +1600,6 @@ static int pdc_probe(struct platform_device *pdev) | |||
1603 | if (err) | 1600 | if (err) |
1604 | goto cleanup_buf_pool; | 1601 | goto cleanup_buf_pool; |
1605 | 1602 | ||
1606 | pdcs->debugfs_stats = NULL; | ||
1607 | pdc_setup_debugfs(pdcs); | 1603 | pdc_setup_debugfs(pdcs); |
1608 | 1604 | ||
1609 | dev_dbg(dev, "pdc_probe() successful"); | 1605 | dev_dbg(dev, "pdc_probe() successful"); |
diff --git a/drivers/mfd/altera-sysmgr.c b/drivers/mfd/altera-sysmgr.c index 8976f82785bb..2ee14d8a6d31 100644 --- a/drivers/mfd/altera-sysmgr.c +++ b/drivers/mfd/altera-sysmgr.c | |||
@@ -92,9 +92,9 @@ static struct regmap_config altr_sysmgr_regmap_cfg = { | |||
92 | * Matching function used by driver_find_device(). | 92 | * Matching function used by driver_find_device(). |
93 | * Return: True if match is found, otherwise false. | 93 | * Return: True if match is found, otherwise false. |
94 | */ | 94 | */ |
95 | static int sysmgr_match_phandle(struct device *dev, void *data) | 95 | static int sysmgr_match_phandle(struct device *dev, const void *data) |
96 | { | 96 | { |
97 | return dev->of_node == (struct device_node *)data; | 97 | return dev->of_node == (const struct device_node *)data; |
98 | } | 98 | } |
99 | 99 | ||
100 | /** | 100 | /** |
diff --git a/drivers/mfd/syscon.c b/drivers/mfd/syscon.c index 8ce1e41d632c..b65e585fc8c6 100644 --- a/drivers/mfd/syscon.c +++ b/drivers/mfd/syscon.c | |||
@@ -190,27 +190,6 @@ struct regmap *syscon_regmap_lookup_by_compatible(const char *s) | |||
190 | } | 190 | } |
191 | EXPORT_SYMBOL_GPL(syscon_regmap_lookup_by_compatible); | 191 | EXPORT_SYMBOL_GPL(syscon_regmap_lookup_by_compatible); |
192 | 192 | ||
193 | static int syscon_match_pdevname(struct device *dev, void *data) | ||
194 | { | ||
195 | return !strcmp(dev_name(dev), (const char *)data); | ||
196 | } | ||
197 | |||
198 | struct regmap *syscon_regmap_lookup_by_pdevname(const char *s) | ||
199 | { | ||
200 | struct device *dev; | ||
201 | struct syscon *syscon; | ||
202 | |||
203 | dev = driver_find_device(&syscon_driver.driver, NULL, (void *)s, | ||
204 | syscon_match_pdevname); | ||
205 | if (!dev) | ||
206 | return ERR_PTR(-EPROBE_DEFER); | ||
207 | |||
208 | syscon = dev_get_drvdata(dev); | ||
209 | |||
210 | return syscon->regmap; | ||
211 | } | ||
212 | EXPORT_SYMBOL_GPL(syscon_regmap_lookup_by_pdevname); | ||
213 | |||
214 | struct regmap *syscon_regmap_lookup_by_phandle(struct device_node *np, | 193 | struct regmap *syscon_regmap_lookup_by_phandle(struct device_node *np, |
215 | const char *property) | 194 | const char *property) |
216 | { | 195 | { |
diff --git a/drivers/misc/cxl/cxl.h b/drivers/misc/cxl/cxl.h index a73c9e669d78..5dc0f6093f9d 100644 --- a/drivers/misc/cxl/cxl.h +++ b/drivers/misc/cxl/cxl.h | |||
@@ -908,11 +908,11 @@ void cxl_update_dedicated_ivtes_psl8(struct cxl_context *ctx); | |||
908 | 908 | ||
909 | #ifdef CONFIG_DEBUG_FS | 909 | #ifdef CONFIG_DEBUG_FS |
910 | 910 | ||
911 | int cxl_debugfs_init(void); | 911 | void cxl_debugfs_init(void); |
912 | void cxl_debugfs_exit(void); | 912 | void cxl_debugfs_exit(void); |
913 | int cxl_debugfs_adapter_add(struct cxl *adapter); | 913 | void cxl_debugfs_adapter_add(struct cxl *adapter); |
914 | void cxl_debugfs_adapter_remove(struct cxl *adapter); | 914 | void cxl_debugfs_adapter_remove(struct cxl *adapter); |
915 | int cxl_debugfs_afu_add(struct cxl_afu *afu); | 915 | void cxl_debugfs_afu_add(struct cxl_afu *afu); |
916 | void cxl_debugfs_afu_remove(struct cxl_afu *afu); | 916 | void cxl_debugfs_afu_remove(struct cxl_afu *afu); |
917 | void cxl_debugfs_add_adapter_regs_psl9(struct cxl *adapter, struct dentry *dir); | 917 | void cxl_debugfs_add_adapter_regs_psl9(struct cxl *adapter, struct dentry *dir); |
918 | void cxl_debugfs_add_adapter_regs_psl8(struct cxl *adapter, struct dentry *dir); | 918 | void cxl_debugfs_add_adapter_regs_psl8(struct cxl *adapter, struct dentry *dir); |
@@ -921,27 +921,24 @@ void cxl_debugfs_add_afu_regs_psl8(struct cxl_afu *afu, struct dentry *dir); | |||
921 | 921 | ||
922 | #else /* CONFIG_DEBUG_FS */ | 922 | #else /* CONFIG_DEBUG_FS */ |
923 | 923 | ||
924 | static inline int __init cxl_debugfs_init(void) | 924 | static inline void __init cxl_debugfs_init(void) |
925 | { | 925 | { |
926 | return 0; | ||
927 | } | 926 | } |
928 | 927 | ||
929 | static inline void cxl_debugfs_exit(void) | 928 | static inline void cxl_debugfs_exit(void) |
930 | { | 929 | { |
931 | } | 930 | } |
932 | 931 | ||
933 | static inline int cxl_debugfs_adapter_add(struct cxl *adapter) | 932 | static inline void cxl_debugfs_adapter_add(struct cxl *adapter) |
934 | { | 933 | { |
935 | return 0; | ||
936 | } | 934 | } |
937 | 935 | ||
938 | static inline void cxl_debugfs_adapter_remove(struct cxl *adapter) | 936 | static inline void cxl_debugfs_adapter_remove(struct cxl *adapter) |
939 | { | 937 | { |
940 | } | 938 | } |
941 | 939 | ||
942 | static inline int cxl_debugfs_afu_add(struct cxl_afu *afu) | 940 | static inline void cxl_debugfs_afu_add(struct cxl_afu *afu) |
943 | { | 941 | { |
944 | return 0; | ||
945 | } | 942 | } |
946 | 943 | ||
947 | static inline void cxl_debugfs_afu_remove(struct cxl_afu *afu) | 944 | static inline void cxl_debugfs_afu_remove(struct cxl_afu *afu) |
diff --git a/drivers/misc/cxl/debugfs.c b/drivers/misc/cxl/debugfs.c index 1fda22c24c93..7b987bf498b5 100644 --- a/drivers/misc/cxl/debugfs.c +++ b/drivers/misc/cxl/debugfs.c | |||
@@ -26,11 +26,11 @@ static int debugfs_io_u64_set(void *data, u64 val) | |||
26 | DEFINE_DEBUGFS_ATTRIBUTE(fops_io_x64, debugfs_io_u64_get, debugfs_io_u64_set, | 26 | DEFINE_DEBUGFS_ATTRIBUTE(fops_io_x64, debugfs_io_u64_get, debugfs_io_u64_set, |
27 | "0x%016llx\n"); | 27 | "0x%016llx\n"); |
28 | 28 | ||
29 | static struct dentry *debugfs_create_io_x64(const char *name, umode_t mode, | 29 | static void debugfs_create_io_x64(const char *name, umode_t mode, |
30 | struct dentry *parent, u64 __iomem *value) | 30 | struct dentry *parent, u64 __iomem *value) |
31 | { | 31 | { |
32 | return debugfs_create_file_unsafe(name, mode, parent, | 32 | debugfs_create_file_unsafe(name, mode, parent, (void __force *)value, |
33 | (void __force *)value, &fops_io_x64); | 33 | &fops_io_x64); |
34 | } | 34 | } |
35 | 35 | ||
36 | void cxl_debugfs_add_adapter_regs_psl9(struct cxl *adapter, struct dentry *dir) | 36 | void cxl_debugfs_add_adapter_regs_psl9(struct cxl *adapter, struct dentry *dir) |
@@ -54,25 +54,22 @@ void cxl_debugfs_add_adapter_regs_psl8(struct cxl *adapter, struct dentry *dir) | |||
54 | debugfs_create_io_x64("trace", S_IRUSR | S_IWUSR, dir, _cxl_p1_addr(adapter, CXL_PSL_TRACE)); | 54 | debugfs_create_io_x64("trace", S_IRUSR | S_IWUSR, dir, _cxl_p1_addr(adapter, CXL_PSL_TRACE)); |
55 | } | 55 | } |
56 | 56 | ||
57 | int cxl_debugfs_adapter_add(struct cxl *adapter) | 57 | void cxl_debugfs_adapter_add(struct cxl *adapter) |
58 | { | 58 | { |
59 | struct dentry *dir; | 59 | struct dentry *dir; |
60 | char buf[32]; | 60 | char buf[32]; |
61 | 61 | ||
62 | if (!cxl_debugfs) | 62 | if (!cxl_debugfs) |
63 | return -ENODEV; | 63 | return; |
64 | 64 | ||
65 | snprintf(buf, 32, "card%i", adapter->adapter_num); | 65 | snprintf(buf, 32, "card%i", adapter->adapter_num); |
66 | dir = debugfs_create_dir(buf, cxl_debugfs); | 66 | dir = debugfs_create_dir(buf, cxl_debugfs); |
67 | if (IS_ERR(dir)) | ||
68 | return PTR_ERR(dir); | ||
69 | adapter->debugfs = dir; | 67 | adapter->debugfs = dir; |
70 | 68 | ||
71 | debugfs_create_io_x64("err_ivte", S_IRUSR, dir, _cxl_p1_addr(adapter, CXL_PSL_ErrIVTE)); | 69 | debugfs_create_io_x64("err_ivte", S_IRUSR, dir, _cxl_p1_addr(adapter, CXL_PSL_ErrIVTE)); |
72 | 70 | ||
73 | if (adapter->native->sl_ops->debugfs_add_adapter_regs) | 71 | if (adapter->native->sl_ops->debugfs_add_adapter_regs) |
74 | adapter->native->sl_ops->debugfs_add_adapter_regs(adapter, dir); | 72 | adapter->native->sl_ops->debugfs_add_adapter_regs(adapter, dir); |
75 | return 0; | ||
76 | } | 73 | } |
77 | 74 | ||
78 | void cxl_debugfs_adapter_remove(struct cxl *adapter) | 75 | void cxl_debugfs_adapter_remove(struct cxl *adapter) |
@@ -96,18 +93,16 @@ void cxl_debugfs_add_afu_regs_psl8(struct cxl_afu *afu, struct dentry *dir) | |||
96 | debugfs_create_io_x64("trace", S_IRUSR | S_IWUSR, dir, _cxl_p1n_addr(afu, CXL_PSL_SLICE_TRACE)); | 93 | debugfs_create_io_x64("trace", S_IRUSR | S_IWUSR, dir, _cxl_p1n_addr(afu, CXL_PSL_SLICE_TRACE)); |
97 | } | 94 | } |
98 | 95 | ||
99 | int cxl_debugfs_afu_add(struct cxl_afu *afu) | 96 | void cxl_debugfs_afu_add(struct cxl_afu *afu) |
100 | { | 97 | { |
101 | struct dentry *dir; | 98 | struct dentry *dir; |
102 | char buf[32]; | 99 | char buf[32]; |
103 | 100 | ||
104 | if (!afu->adapter->debugfs) | 101 | if (!afu->adapter->debugfs) |
105 | return -ENODEV; | 102 | return; |
106 | 103 | ||
107 | snprintf(buf, 32, "psl%i.%i", afu->adapter->adapter_num, afu->slice); | 104 | snprintf(buf, 32, "psl%i.%i", afu->adapter->adapter_num, afu->slice); |
108 | dir = debugfs_create_dir(buf, afu->adapter->debugfs); | 105 | dir = debugfs_create_dir(buf, afu->adapter->debugfs); |
109 | if (IS_ERR(dir)) | ||
110 | return PTR_ERR(dir); | ||
111 | afu->debugfs = dir; | 106 | afu->debugfs = dir; |
112 | 107 | ||
113 | debugfs_create_io_x64("sr", S_IRUSR, dir, _cxl_p1n_addr(afu, CXL_PSL_SR_An)); | 108 | debugfs_create_io_x64("sr", S_IRUSR, dir, _cxl_p1n_addr(afu, CXL_PSL_SR_An)); |
@@ -118,8 +113,6 @@ int cxl_debugfs_afu_add(struct cxl_afu *afu) | |||
118 | 113 | ||
119 | if (afu->adapter->native->sl_ops->debugfs_add_afu_regs) | 114 | if (afu->adapter->native->sl_ops->debugfs_add_afu_regs) |
120 | afu->adapter->native->sl_ops->debugfs_add_afu_regs(afu, dir); | 115 | afu->adapter->native->sl_ops->debugfs_add_afu_regs(afu, dir); |
121 | |||
122 | return 0; | ||
123 | } | 116 | } |
124 | 117 | ||
125 | void cxl_debugfs_afu_remove(struct cxl_afu *afu) | 118 | void cxl_debugfs_afu_remove(struct cxl_afu *afu) |
@@ -127,19 +120,12 @@ void cxl_debugfs_afu_remove(struct cxl_afu *afu) | |||
127 | debugfs_remove_recursive(afu->debugfs); | 120 | debugfs_remove_recursive(afu->debugfs); |
128 | } | 121 | } |
129 | 122 | ||
130 | int __init cxl_debugfs_init(void) | 123 | void __init cxl_debugfs_init(void) |
131 | { | 124 | { |
132 | struct dentry *ent; | ||
133 | |||
134 | if (!cpu_has_feature(CPU_FTR_HVMODE)) | 125 | if (!cpu_has_feature(CPU_FTR_HVMODE)) |
135 | return 0; | 126 | return; |
136 | |||
137 | ent = debugfs_create_dir("cxl", NULL); | ||
138 | if (IS_ERR(ent)) | ||
139 | return PTR_ERR(ent); | ||
140 | cxl_debugfs = ent; | ||
141 | 127 | ||
142 | return 0; | 128 | cxl_debugfs = debugfs_create_dir("cxl", NULL); |
143 | } | 129 | } |
144 | 130 | ||
145 | void cxl_debugfs_exit(void) | 131 | void cxl_debugfs_exit(void) |
diff --git a/drivers/misc/genwqe/card_base.c b/drivers/misc/genwqe/card_base.c index ab7f2cd21c93..1dc6c7c5cbce 100644 --- a/drivers/misc/genwqe/card_base.c +++ b/drivers/misc/genwqe/card_base.c | |||
@@ -1369,10 +1369,6 @@ static int __init genwqe_init_module(void) | |||
1369 | class_genwqe->devnode = genwqe_devnode; | 1369 | class_genwqe->devnode = genwqe_devnode; |
1370 | 1370 | ||
1371 | debugfs_genwqe = debugfs_create_dir(GENWQE_DEVNAME, NULL); | 1371 | debugfs_genwqe = debugfs_create_dir(GENWQE_DEVNAME, NULL); |
1372 | if (!debugfs_genwqe) { | ||
1373 | rc = -ENOMEM; | ||
1374 | goto err_out; | ||
1375 | } | ||
1376 | 1372 | ||
1377 | rc = pci_register_driver(&genwqe_driver); | 1373 | rc = pci_register_driver(&genwqe_driver); |
1378 | if (rc != 0) { | 1374 | if (rc != 0) { |
@@ -1384,7 +1380,6 @@ static int __init genwqe_init_module(void) | |||
1384 | 1380 | ||
1385 | err_out0: | 1381 | err_out0: |
1386 | debugfs_remove(debugfs_genwqe); | 1382 | debugfs_remove(debugfs_genwqe); |
1387 | err_out: | ||
1388 | class_destroy(class_genwqe); | 1383 | class_destroy(class_genwqe); |
1389 | return rc; | 1384 | return rc; |
1390 | } | 1385 | } |
diff --git a/drivers/misc/genwqe/card_base.h b/drivers/misc/genwqe/card_base.h index 2f6dd2f37942..0e902977d35f 100644 --- a/drivers/misc/genwqe/card_base.h +++ b/drivers/misc/genwqe/card_base.h | |||
@@ -437,7 +437,7 @@ int genwqe_device_create(struct genwqe_dev *cd); | |||
437 | int genwqe_device_remove(struct genwqe_dev *cd); | 437 | int genwqe_device_remove(struct genwqe_dev *cd); |
438 | 438 | ||
439 | /* debugfs */ | 439 | /* debugfs */ |
440 | int genwqe_init_debugfs(struct genwqe_dev *cd); | 440 | void genwqe_init_debugfs(struct genwqe_dev *cd); |
441 | void genqwe_exit_debugfs(struct genwqe_dev *cd); | 441 | void genqwe_exit_debugfs(struct genwqe_dev *cd); |
442 | 442 | ||
443 | int genwqe_read_softreset(struct genwqe_dev *cd); | 443 | int genwqe_read_softreset(struct genwqe_dev *cd); |
diff --git a/drivers/misc/genwqe/card_debugfs.c b/drivers/misc/genwqe/card_debugfs.c index 49c945d0c488..1b5b82e65268 100644 --- a/drivers/misc/genwqe/card_debugfs.c +++ b/drivers/misc/genwqe/card_debugfs.c | |||
@@ -316,11 +316,9 @@ static int info_show(struct seq_file *s, void *unused) | |||
316 | 316 | ||
317 | DEFINE_SHOW_ATTRIBUTE(info); | 317 | DEFINE_SHOW_ATTRIBUTE(info); |
318 | 318 | ||
319 | int genwqe_init_debugfs(struct genwqe_dev *cd) | 319 | void genwqe_init_debugfs(struct genwqe_dev *cd) |
320 | { | 320 | { |
321 | struct dentry *root; | 321 | struct dentry *root; |
322 | struct dentry *file; | ||
323 | int ret; | ||
324 | char card_name[64]; | 322 | char card_name[64]; |
325 | char name[64]; | 323 | char name[64]; |
326 | unsigned int i; | 324 | unsigned int i; |
@@ -328,153 +326,50 @@ int genwqe_init_debugfs(struct genwqe_dev *cd) | |||
328 | sprintf(card_name, "%s%d_card", GENWQE_DEVNAME, cd->card_idx); | 326 | sprintf(card_name, "%s%d_card", GENWQE_DEVNAME, cd->card_idx); |
329 | 327 | ||
330 | root = debugfs_create_dir(card_name, cd->debugfs_genwqe); | 328 | root = debugfs_create_dir(card_name, cd->debugfs_genwqe); |
331 | if (!root) { | ||
332 | ret = -ENOMEM; | ||
333 | goto err0; | ||
334 | } | ||
335 | 329 | ||
336 | /* non privileged interfaces are done here */ | 330 | /* non privileged interfaces are done here */ |
337 | file = debugfs_create_file("ddcb_info", S_IRUGO, root, cd, | 331 | debugfs_create_file("ddcb_info", S_IRUGO, root, cd, &ddcb_info_fops); |
338 | &ddcb_info_fops); | 332 | debugfs_create_file("info", S_IRUGO, root, cd, &info_fops); |
339 | if (!file) { | 333 | debugfs_create_x64("err_inject", 0666, root, &cd->err_inject); |
340 | ret = -ENOMEM; | 334 | debugfs_create_u32("ddcb_software_timeout", 0666, root, |
341 | goto err1; | 335 | &cd->ddcb_software_timeout); |
342 | } | 336 | debugfs_create_u32("kill_timeout", 0666, root, &cd->kill_timeout); |
343 | |||
344 | file = debugfs_create_file("info", S_IRUGO, root, cd, | ||
345 | &info_fops); | ||
346 | if (!file) { | ||
347 | ret = -ENOMEM; | ||
348 | goto err1; | ||
349 | } | ||
350 | |||
351 | file = debugfs_create_x64("err_inject", 0666, root, &cd->err_inject); | ||
352 | if (!file) { | ||
353 | ret = -ENOMEM; | ||
354 | goto err1; | ||
355 | } | ||
356 | |||
357 | file = debugfs_create_u32("ddcb_software_timeout", 0666, root, | ||
358 | &cd->ddcb_software_timeout); | ||
359 | if (!file) { | ||
360 | ret = -ENOMEM; | ||
361 | goto err1; | ||
362 | } | ||
363 | |||
364 | file = debugfs_create_u32("kill_timeout", 0666, root, | ||
365 | &cd->kill_timeout); | ||
366 | if (!file) { | ||
367 | ret = -ENOMEM; | ||
368 | goto err1; | ||
369 | } | ||
370 | 337 | ||
371 | /* privileged interfaces follow here */ | 338 | /* privileged interfaces follow here */ |
372 | if (!genwqe_is_privileged(cd)) { | 339 | if (!genwqe_is_privileged(cd)) { |
373 | cd->debugfs_root = root; | 340 | cd->debugfs_root = root; |
374 | return 0; | 341 | return; |
375 | } | 342 | } |
376 | 343 | ||
377 | file = debugfs_create_file("curr_regs", S_IRUGO, root, cd, | 344 | debugfs_create_file("curr_regs", S_IRUGO, root, cd, &curr_regs_fops); |
378 | &curr_regs_fops); | 345 | debugfs_create_file("curr_dbg_uid0", S_IRUGO, root, cd, |
379 | if (!file) { | 346 | &curr_dbg_uid0_fops); |
380 | ret = -ENOMEM; | 347 | debugfs_create_file("curr_dbg_uid1", S_IRUGO, root, cd, |
381 | goto err1; | 348 | &curr_dbg_uid1_fops); |
382 | } | 349 | debugfs_create_file("curr_dbg_uid2", S_IRUGO, root, cd, |
383 | 350 | &curr_dbg_uid2_fops); | |
384 | file = debugfs_create_file("curr_dbg_uid0", S_IRUGO, root, cd, | 351 | debugfs_create_file("prev_regs", S_IRUGO, root, cd, &prev_regs_fops); |
385 | &curr_dbg_uid0_fops); | 352 | debugfs_create_file("prev_dbg_uid0", S_IRUGO, root, cd, |
386 | if (!file) { | 353 | &prev_dbg_uid0_fops); |
387 | ret = -ENOMEM; | 354 | debugfs_create_file("prev_dbg_uid1", S_IRUGO, root, cd, |
388 | goto err1; | 355 | &prev_dbg_uid1_fops); |
389 | } | 356 | debugfs_create_file("prev_dbg_uid2", S_IRUGO, root, cd, |
390 | 357 | &prev_dbg_uid2_fops); | |
391 | file = debugfs_create_file("curr_dbg_uid1", S_IRUGO, root, cd, | ||
392 | &curr_dbg_uid1_fops); | ||
393 | if (!file) { | ||
394 | ret = -ENOMEM; | ||
395 | goto err1; | ||
396 | } | ||
397 | |||
398 | file = debugfs_create_file("curr_dbg_uid2", S_IRUGO, root, cd, | ||
399 | &curr_dbg_uid2_fops); | ||
400 | if (!file) { | ||
401 | ret = -ENOMEM; | ||
402 | goto err1; | ||
403 | } | ||
404 | |||
405 | file = debugfs_create_file("prev_regs", S_IRUGO, root, cd, | ||
406 | &prev_regs_fops); | ||
407 | if (!file) { | ||
408 | ret = -ENOMEM; | ||
409 | goto err1; | ||
410 | } | ||
411 | |||
412 | file = debugfs_create_file("prev_dbg_uid0", S_IRUGO, root, cd, | ||
413 | &prev_dbg_uid0_fops); | ||
414 | if (!file) { | ||
415 | ret = -ENOMEM; | ||
416 | goto err1; | ||
417 | } | ||
418 | |||
419 | file = debugfs_create_file("prev_dbg_uid1", S_IRUGO, root, cd, | ||
420 | &prev_dbg_uid1_fops); | ||
421 | if (!file) { | ||
422 | ret = -ENOMEM; | ||
423 | goto err1; | ||
424 | } | ||
425 | |||
426 | file = debugfs_create_file("prev_dbg_uid2", S_IRUGO, root, cd, | ||
427 | &prev_dbg_uid2_fops); | ||
428 | if (!file) { | ||
429 | ret = -ENOMEM; | ||
430 | goto err1; | ||
431 | } | ||
432 | 358 | ||
433 | for (i = 0; i < GENWQE_MAX_VFS; i++) { | 359 | for (i = 0; i < GENWQE_MAX_VFS; i++) { |
434 | sprintf(name, "vf%u_jobtimeout_msec", i); | 360 | sprintf(name, "vf%u_jobtimeout_msec", i); |
435 | 361 | debugfs_create_u32(name, 0666, root, | |
436 | file = debugfs_create_u32(name, 0666, root, | 362 | &cd->vf_jobtimeout_msec[i]); |
437 | &cd->vf_jobtimeout_msec[i]); | ||
438 | if (!file) { | ||
439 | ret = -ENOMEM; | ||
440 | goto err1; | ||
441 | } | ||
442 | } | 363 | } |
443 | 364 | ||
444 | file = debugfs_create_file("jobtimer", S_IRUGO, root, cd, | 365 | debugfs_create_file("jobtimer", S_IRUGO, root, cd, &jtimer_fops); |
445 | &jtimer_fops); | 366 | debugfs_create_file("queue_working_time", S_IRUGO, root, cd, |
446 | if (!file) { | 367 | &queue_working_time_fops); |
447 | ret = -ENOMEM; | 368 | debugfs_create_u32("skip_recovery", 0666, root, &cd->skip_recovery); |
448 | goto err1; | 369 | debugfs_create_u32("use_platform_recovery", 0666, root, |
449 | } | 370 | &cd->use_platform_recovery); |
450 | |||
451 | file = debugfs_create_file("queue_working_time", S_IRUGO, root, cd, | ||
452 | &queue_working_time_fops); | ||
453 | if (!file) { | ||
454 | ret = -ENOMEM; | ||
455 | goto err1; | ||
456 | } | ||
457 | |||
458 | file = debugfs_create_u32("skip_recovery", 0666, root, | ||
459 | &cd->skip_recovery); | ||
460 | if (!file) { | ||
461 | ret = -ENOMEM; | ||
462 | goto err1; | ||
463 | } | ||
464 | |||
465 | file = debugfs_create_u32("use_platform_recovery", 0666, root, | ||
466 | &cd->use_platform_recovery); | ||
467 | if (!file) { | ||
468 | ret = -ENOMEM; | ||
469 | goto err1; | ||
470 | } | ||
471 | 371 | ||
472 | cd->debugfs_root = root; | 372 | cd->debugfs_root = root; |
473 | return 0; | ||
474 | err1: | ||
475 | debugfs_remove_recursive(root); | ||
476 | err0: | ||
477 | return ret; | ||
478 | } | 373 | } |
479 | 374 | ||
480 | void genqwe_exit_debugfs(struct genwqe_dev *cd) | 375 | void genqwe_exit_debugfs(struct genwqe_dev *cd) |
diff --git a/drivers/misc/genwqe/card_dev.c b/drivers/misc/genwqe/card_dev.c index 3bc51f19c734..0e34c0568fed 100644 --- a/drivers/misc/genwqe/card_dev.c +++ b/drivers/misc/genwqe/card_dev.c | |||
@@ -1301,14 +1301,10 @@ int genwqe_device_create(struct genwqe_dev *cd) | |||
1301 | goto err_cdev; | 1301 | goto err_cdev; |
1302 | } | 1302 | } |
1303 | 1303 | ||
1304 | rc = genwqe_init_debugfs(cd); | 1304 | genwqe_init_debugfs(cd); |
1305 | if (rc != 0) | ||
1306 | goto err_debugfs; | ||
1307 | 1305 | ||
1308 | return 0; | 1306 | return 0; |
1309 | 1307 | ||
1310 | err_debugfs: | ||
1311 | device_destroy(cd->class_genwqe, cd->devnum_genwqe); | ||
1312 | err_cdev: | 1308 | err_cdev: |
1313 | cdev_del(&cd->cdev_genwqe); | 1309 | cdev_del(&cd->cdev_genwqe); |
1314 | err_add: | 1310 | err_add: |
diff --git a/drivers/misc/lkdtm/core.c b/drivers/misc/lkdtm/core.c index e9767bdcdb44..66ae6b2a6950 100644 --- a/drivers/misc/lkdtm/core.c +++ b/drivers/misc/lkdtm/core.c | |||
@@ -391,7 +391,7 @@ static int __init lkdtm_module_init(void) | |||
391 | { | 391 | { |
392 | struct crashpoint *crashpoint = NULL; | 392 | struct crashpoint *crashpoint = NULL; |
393 | const struct crashtype *crashtype = NULL; | 393 | const struct crashtype *crashtype = NULL; |
394 | int ret = -EINVAL; | 394 | int ret; |
395 | int i; | 395 | int i; |
396 | 396 | ||
397 | /* Neither or both of these need to be set */ | 397 | /* Neither or both of these need to be set */ |
@@ -434,22 +434,13 @@ static int __init lkdtm_module_init(void) | |||
434 | 434 | ||
435 | /* Register debugfs interface */ | 435 | /* Register debugfs interface */ |
436 | lkdtm_debugfs_root = debugfs_create_dir("provoke-crash", NULL); | 436 | lkdtm_debugfs_root = debugfs_create_dir("provoke-crash", NULL); |
437 | if (!lkdtm_debugfs_root) { | ||
438 | pr_err("creating root dir failed\n"); | ||
439 | return -ENODEV; | ||
440 | } | ||
441 | 437 | ||
442 | /* Install debugfs trigger files. */ | 438 | /* Install debugfs trigger files. */ |
443 | for (i = 0; i < ARRAY_SIZE(crashpoints); i++) { | 439 | for (i = 0; i < ARRAY_SIZE(crashpoints); i++) { |
444 | struct crashpoint *cur = &crashpoints[i]; | 440 | struct crashpoint *cur = &crashpoints[i]; |
445 | struct dentry *de; | ||
446 | 441 | ||
447 | de = debugfs_create_file(cur->name, 0644, lkdtm_debugfs_root, | 442 | debugfs_create_file(cur->name, 0644, lkdtm_debugfs_root, cur, |
448 | cur, &cur->fops); | 443 | &cur->fops); |
449 | if (de == NULL) { | ||
450 | pr_err("could not create crashpoint %s\n", cur->name); | ||
451 | goto out_err; | ||
452 | } | ||
453 | } | 444 | } |
454 | 445 | ||
455 | /* Install crashpoint if one was selected. */ | 446 | /* Install crashpoint if one was selected. */ |
diff --git a/drivers/misc/mei/debugfs.c b/drivers/misc/mei/debugfs.c index 47cfd5005e1b..a26c716c61a1 100644 --- a/drivers/misc/mei/debugfs.c +++ b/drivers/misc/mei/debugfs.c | |||
@@ -154,46 +154,21 @@ void mei_dbgfs_deregister(struct mei_device *dev) | |||
154 | * | 154 | * |
155 | * @dev: the mei device structure | 155 | * @dev: the mei device structure |
156 | * @name: the mei device name | 156 | * @name: the mei device name |
157 | * | ||
158 | * Return: 0 on success, <0 on failure. | ||
159 | */ | 157 | */ |
160 | int mei_dbgfs_register(struct mei_device *dev, const char *name) | 158 | void mei_dbgfs_register(struct mei_device *dev, const char *name) |
161 | { | 159 | { |
162 | struct dentry *dir, *f; | 160 | struct dentry *dir; |
163 | 161 | ||
164 | dir = debugfs_create_dir(name, NULL); | 162 | dir = debugfs_create_dir(name, NULL); |
165 | if (!dir) | ||
166 | return -ENOMEM; | ||
167 | |||
168 | dev->dbgfs_dir = dir; | 163 | dev->dbgfs_dir = dir; |
169 | 164 | ||
170 | f = debugfs_create_file("meclients", S_IRUSR, dir, | 165 | debugfs_create_file("meclients", S_IRUSR, dir, dev, |
171 | dev, &mei_dbgfs_meclients_fops); | 166 | &mei_dbgfs_meclients_fops); |
172 | if (!f) { | 167 | debugfs_create_file("active", S_IRUSR, dir, dev, |
173 | dev_err(dev->dev, "meclients: registration failed\n"); | 168 | &mei_dbgfs_active_fops); |
174 | goto err; | 169 | debugfs_create_file("devstate", S_IRUSR, dir, dev, |
175 | } | 170 | &mei_dbgfs_devstate_fops); |
176 | f = debugfs_create_file("active", S_IRUSR, dir, | 171 | debugfs_create_file("allow_fixed_address", S_IRUSR | S_IWUSR, dir, |
177 | dev, &mei_dbgfs_active_fops); | 172 | &dev->allow_fixed_address, |
178 | if (!f) { | 173 | &mei_dbgfs_allow_fa_fops); |
179 | dev_err(dev->dev, "active: registration failed\n"); | ||
180 | goto err; | ||
181 | } | ||
182 | f = debugfs_create_file("devstate", S_IRUSR, dir, | ||
183 | dev, &mei_dbgfs_devstate_fops); | ||
184 | if (!f) { | ||
185 | dev_err(dev->dev, "devstate: registration failed\n"); | ||
186 | goto err; | ||
187 | } | ||
188 | f = debugfs_create_file("allow_fixed_address", S_IRUSR | S_IWUSR, dir, | ||
189 | &dev->allow_fixed_address, | ||
190 | &mei_dbgfs_allow_fa_fops); | ||
191 | if (!f) { | ||
192 | dev_err(dev->dev, "allow_fixed_address: registration failed\n"); | ||
193 | goto err; | ||
194 | } | ||
195 | return 0; | ||
196 | err: | ||
197 | mei_dbgfs_deregister(dev); | ||
198 | return -ENODEV; | ||
199 | } | 174 | } |
diff --git a/drivers/misc/mei/main.c b/drivers/misc/mei/main.c index ad02097d7fee..f894d1f8a53e 100644 --- a/drivers/misc/mei/main.c +++ b/drivers/misc/mei/main.c | |||
@@ -984,16 +984,10 @@ int mei_register(struct mei_device *dev, struct device *parent) | |||
984 | goto err_dev_create; | 984 | goto err_dev_create; |
985 | } | 985 | } |
986 | 986 | ||
987 | ret = mei_dbgfs_register(dev, dev_name(clsdev)); | 987 | mei_dbgfs_register(dev, dev_name(clsdev)); |
988 | if (ret) { | ||
989 | dev_err(clsdev, "cannot register debugfs ret = %d\n", ret); | ||
990 | goto err_dev_dbgfs; | ||
991 | } | ||
992 | 988 | ||
993 | return 0; | 989 | return 0; |
994 | 990 | ||
995 | err_dev_dbgfs: | ||
996 | device_destroy(mei_class, devno); | ||
997 | err_dev_create: | 991 | err_dev_create: |
998 | cdev_del(&dev->cdev); | 992 | cdev_del(&dev->cdev); |
999 | err_dev_add: | 993 | err_dev_add: |
diff --git a/drivers/misc/mei/mei_dev.h b/drivers/misc/mei/mei_dev.h index fca832fcac57..f71a023aed3c 100644 --- a/drivers/misc/mei/mei_dev.h +++ b/drivers/misc/mei/mei_dev.h | |||
@@ -718,13 +718,10 @@ bool mei_hbuf_acquire(struct mei_device *dev); | |||
718 | bool mei_write_is_idle(struct mei_device *dev); | 718 | bool mei_write_is_idle(struct mei_device *dev); |
719 | 719 | ||
720 | #if IS_ENABLED(CONFIG_DEBUG_FS) | 720 | #if IS_ENABLED(CONFIG_DEBUG_FS) |
721 | int mei_dbgfs_register(struct mei_device *dev, const char *name); | 721 | void mei_dbgfs_register(struct mei_device *dev, const char *name); |
722 | void mei_dbgfs_deregister(struct mei_device *dev); | 722 | void mei_dbgfs_deregister(struct mei_device *dev); |
723 | #else | 723 | #else |
724 | static inline int mei_dbgfs_register(struct mei_device *dev, const char *name) | 724 | static inline void mei_dbgfs_register(struct mei_device *dev, const char *name) {} |
725 | { | ||
726 | return 0; | ||
727 | } | ||
728 | static inline void mei_dbgfs_deregister(struct mei_device *dev) {} | 725 | static inline void mei_dbgfs_deregister(struct mei_device *dev) {} |
729 | #endif /* CONFIG_DEBUG_FS */ | 726 | #endif /* CONFIG_DEBUG_FS */ |
730 | 727 | ||
diff --git a/drivers/misc/mic/card/mic_debugfs.c b/drivers/misc/mic/card/mic_debugfs.c index bf7a60ccc66c..3ee3d2402634 100644 --- a/drivers/misc/mic/card/mic_debugfs.c +++ b/drivers/misc/mic/card/mic_debugfs.c | |||
@@ -51,25 +51,13 @@ DEFINE_SHOW_ATTRIBUTE(mic_intr); | |||
51 | */ | 51 | */ |
52 | void __init mic_create_card_debug_dir(struct mic_driver *mdrv) | 52 | void __init mic_create_card_debug_dir(struct mic_driver *mdrv) |
53 | { | 53 | { |
54 | struct dentry *d; | ||
55 | |||
56 | if (!mic_dbg) | 54 | if (!mic_dbg) |
57 | return; | 55 | return; |
58 | 56 | ||
59 | mdrv->dbg_dir = debugfs_create_dir(mdrv->name, mic_dbg); | 57 | mdrv->dbg_dir = debugfs_create_dir(mdrv->name, mic_dbg); |
60 | if (!mdrv->dbg_dir) { | ||
61 | dev_err(mdrv->dev, "Cant create dbg_dir %s\n", mdrv->name); | ||
62 | return; | ||
63 | } | ||
64 | |||
65 | d = debugfs_create_file("intr_test", 0444, mdrv->dbg_dir, | ||
66 | mdrv, &mic_intr_fops); | ||
67 | 58 | ||
68 | if (!d) { | 59 | debugfs_create_file("intr_test", 0444, mdrv->dbg_dir, mdrv, |
69 | dev_err(mdrv->dev, | 60 | &mic_intr_fops); |
70 | "Cant create dbg intr_test %s\n", mdrv->name); | ||
71 | return; | ||
72 | } | ||
73 | } | 61 | } |
74 | 62 | ||
75 | /** | 63 | /** |
@@ -89,8 +77,6 @@ void mic_delete_card_debug_dir(struct mic_driver *mdrv) | |||
89 | void __init mic_init_card_debugfs(void) | 77 | void __init mic_init_card_debugfs(void) |
90 | { | 78 | { |
91 | mic_dbg = debugfs_create_dir(KBUILD_MODNAME, NULL); | 79 | mic_dbg = debugfs_create_dir(KBUILD_MODNAME, NULL); |
92 | if (!mic_dbg) | ||
93 | pr_err("can't create debugfs dir\n"); | ||
94 | } | 80 | } |
95 | 81 | ||
96 | /** | 82 | /** |
diff --git a/drivers/misc/mic/cosm/cosm_debugfs.c b/drivers/misc/mic/cosm/cosm_debugfs.c index 8e3f4589f16d..2fc9f4bf7001 100644 --- a/drivers/misc/mic/cosm/cosm_debugfs.c +++ b/drivers/misc/mic/cosm/cosm_debugfs.c | |||
@@ -93,8 +93,6 @@ void cosm_create_debug_dir(struct cosm_device *cdev) | |||
93 | 93 | ||
94 | scnprintf(name, sizeof(name), "mic%d", cdev->index); | 94 | scnprintf(name, sizeof(name), "mic%d", cdev->index); |
95 | cdev->dbg_dir = debugfs_create_dir(name, cosm_dbg); | 95 | cdev->dbg_dir = debugfs_create_dir(name, cosm_dbg); |
96 | if (!cdev->dbg_dir) | ||
97 | return; | ||
98 | 96 | ||
99 | debugfs_create_file("log_buf", 0444, cdev->dbg_dir, cdev, | 97 | debugfs_create_file("log_buf", 0444, cdev->dbg_dir, cdev, |
100 | &log_buf_fops); | 98 | &log_buf_fops); |
@@ -113,8 +111,6 @@ void cosm_delete_debug_dir(struct cosm_device *cdev) | |||
113 | void cosm_init_debugfs(void) | 111 | void cosm_init_debugfs(void) |
114 | { | 112 | { |
115 | cosm_dbg = debugfs_create_dir(KBUILD_MODNAME, NULL); | 113 | cosm_dbg = debugfs_create_dir(KBUILD_MODNAME, NULL); |
116 | if (!cosm_dbg) | ||
117 | pr_err("can't create debugfs dir\n"); | ||
118 | } | 114 | } |
119 | 115 | ||
120 | void cosm_exit_debugfs(void) | 116 | void cosm_exit_debugfs(void) |
diff --git a/drivers/misc/mic/host/mic_debugfs.c b/drivers/misc/mic/host/mic_debugfs.c index 7ef8efe9552f..8a8e41677501 100644 --- a/drivers/misc/mic/host/mic_debugfs.c +++ b/drivers/misc/mic/host/mic_debugfs.c | |||
@@ -113,8 +113,6 @@ void mic_create_debug_dir(struct mic_device *mdev) | |||
113 | 113 | ||
114 | scnprintf(name, sizeof(name), "mic%d", mdev->id); | 114 | scnprintf(name, sizeof(name), "mic%d", mdev->id); |
115 | mdev->dbg_dir = debugfs_create_dir(name, mic_dbg); | 115 | mdev->dbg_dir = debugfs_create_dir(name, mic_dbg); |
116 | if (!mdev->dbg_dir) | ||
117 | return; | ||
118 | 116 | ||
119 | debugfs_create_file("smpt", 0444, mdev->dbg_dir, mdev, | 117 | debugfs_create_file("smpt", 0444, mdev->dbg_dir, mdev, |
120 | &mic_smpt_fops); | 118 | &mic_smpt_fops); |
@@ -143,8 +141,6 @@ void mic_delete_debug_dir(struct mic_device *mdev) | |||
143 | void __init mic_init_debugfs(void) | 141 | void __init mic_init_debugfs(void) |
144 | { | 142 | { |
145 | mic_dbg = debugfs_create_dir(KBUILD_MODNAME, NULL); | 143 | mic_dbg = debugfs_create_dir(KBUILD_MODNAME, NULL); |
146 | if (!mic_dbg) | ||
147 | pr_err("can't create debugfs dir\n"); | ||
148 | } | 144 | } |
149 | 145 | ||
150 | /** | 146 | /** |
diff --git a/drivers/misc/mic/scif/scif_debugfs.c b/drivers/misc/mic/scif/scif_debugfs.c index a6820480105a..8fe38e7ca6e6 100644 --- a/drivers/misc/mic/scif/scif_debugfs.c +++ b/drivers/misc/mic/scif/scif_debugfs.c | |||
@@ -103,11 +103,6 @@ DEFINE_SHOW_ATTRIBUTE(scif_rma); | |||
103 | void __init scif_init_debugfs(void) | 103 | void __init scif_init_debugfs(void) |
104 | { | 104 | { |
105 | scif_dbg = debugfs_create_dir(KBUILD_MODNAME, NULL); | 105 | scif_dbg = debugfs_create_dir(KBUILD_MODNAME, NULL); |
106 | if (!scif_dbg) { | ||
107 | dev_err(scif_info.mdev.this_device, | ||
108 | "can't create debugfs dir scif\n"); | ||
109 | return; | ||
110 | } | ||
111 | 106 | ||
112 | debugfs_create_file("scif_dev", 0444, scif_dbg, NULL, &scif_dev_fops); | 107 | debugfs_create_file("scif_dev", 0444, scif_dbg, NULL, &scif_dev_fops); |
113 | debugfs_create_file("scif_rma", 0444, scif_dbg, NULL, &scif_rma_fops); | 108 | debugfs_create_file("scif_rma", 0444, scif_dbg, NULL, &scif_rma_fops); |
diff --git a/drivers/misc/mic/vop/vop_debugfs.c b/drivers/misc/mic/vop/vop_debugfs.c index ed59cd75e182..9d4f175f4dd1 100644 --- a/drivers/misc/mic/vop/vop_debugfs.c +++ b/drivers/misc/mic/vop/vop_debugfs.c | |||
@@ -174,10 +174,6 @@ void vop_init_debugfs(struct vop_info *vi) | |||
174 | 174 | ||
175 | snprintf(name, sizeof(name), "%s%d", KBUILD_MODNAME, vi->vpdev->dnode); | 175 | snprintf(name, sizeof(name), "%s%d", KBUILD_MODNAME, vi->vpdev->dnode); |
176 | vi->dbg = debugfs_create_dir(name, NULL); | 176 | vi->dbg = debugfs_create_dir(name, NULL); |
177 | if (!vi->dbg) { | ||
178 | pr_err("can't create debugfs dir vop\n"); | ||
179 | return; | ||
180 | } | ||
181 | debugfs_create_file("dp", 0444, vi->dbg, vi, &vop_dp_fops); | 177 | debugfs_create_file("dp", 0444, vi->dbg, vi, &vop_dp_fops); |
182 | debugfs_create_file("vdev_info", 0444, vi->dbg, vi, &vop_vdev_info_fops); | 178 | debugfs_create_file("vdev_info", 0444, vi->dbg, vi, &vop_vdev_info_fops); |
183 | } | 179 | } |
diff --git a/drivers/misc/ti-st/st_kim.c b/drivers/misc/ti-st/st_kim.c index 18ca938b86e6..a36ed1ff5967 100644 --- a/drivers/misc/ti-st/st_kim.c +++ b/drivers/misc/ti-st/st_kim.c | |||
@@ -748,10 +748,6 @@ static int kim_probe(struct platform_device *pdev) | |||
748 | pr_info("sysfs entries created\n"); | 748 | pr_info("sysfs entries created\n"); |
749 | 749 | ||
750 | kim_debugfs_dir = debugfs_create_dir("ti-st", NULL); | 750 | kim_debugfs_dir = debugfs_create_dir("ti-st", NULL); |
751 | if (!kim_debugfs_dir) { | ||
752 | pr_err(" debugfs entries creation failed "); | ||
753 | return 0; | ||
754 | } | ||
755 | 751 | ||
756 | debugfs_create_file("version", S_IRUGO, kim_debugfs_dir, | 752 | debugfs_create_file("version", S_IRUGO, kim_debugfs_dir, |
757 | kim_gdata, &version_fops); | 753 | kim_gdata, &version_fops); |
diff --git a/drivers/misc/vmw_balloon.c b/drivers/misc/vmw_balloon.c index 043eed845246..97b58e7ad901 100644 --- a/drivers/misc/vmw_balloon.c +++ b/drivers/misc/vmw_balloon.c | |||
@@ -1699,19 +1699,10 @@ static int vmballoon_debug_show(struct seq_file *f, void *offset) | |||
1699 | 1699 | ||
1700 | DEFINE_SHOW_ATTRIBUTE(vmballoon_debug); | 1700 | DEFINE_SHOW_ATTRIBUTE(vmballoon_debug); |
1701 | 1701 | ||
1702 | static int __init vmballoon_debugfs_init(struct vmballoon *b) | 1702 | static void __init vmballoon_debugfs_init(struct vmballoon *b) |
1703 | { | 1703 | { |
1704 | int error; | ||
1705 | |||
1706 | b->dbg_entry = debugfs_create_file("vmmemctl", S_IRUGO, NULL, b, | 1704 | b->dbg_entry = debugfs_create_file("vmmemctl", S_IRUGO, NULL, b, |
1707 | &vmballoon_debug_fops); | 1705 | &vmballoon_debug_fops); |
1708 | if (IS_ERR(b->dbg_entry)) { | ||
1709 | error = PTR_ERR(b->dbg_entry); | ||
1710 | pr_err("failed to create debugfs entry, error: %d\n", error); | ||
1711 | return error; | ||
1712 | } | ||
1713 | |||
1714 | return 0; | ||
1715 | } | 1706 | } |
1716 | 1707 | ||
1717 | static void __exit vmballoon_debugfs_exit(struct vmballoon *b) | 1708 | static void __exit vmballoon_debugfs_exit(struct vmballoon *b) |
@@ -1724,9 +1715,8 @@ static void __exit vmballoon_debugfs_exit(struct vmballoon *b) | |||
1724 | 1715 | ||
1725 | #else | 1716 | #else |
1726 | 1717 | ||
1727 | static inline int vmballoon_debugfs_init(struct vmballoon *b) | 1718 | static inline void vmballoon_debugfs_init(struct vmballoon *b) |
1728 | { | 1719 | { |
1729 | return 0; | ||
1730 | } | 1720 | } |
1731 | 1721 | ||
1732 | static inline void vmballoon_debugfs_exit(struct vmballoon *b) | 1722 | static inline void vmballoon_debugfs_exit(struct vmballoon *b) |
@@ -1948,10 +1938,6 @@ static int __init vmballoon_init(void) | |||
1948 | if (error) | 1938 | if (error) |
1949 | goto fail; | 1939 | goto fail; |
1950 | 1940 | ||
1951 | error = vmballoon_debugfs_init(&balloon); | ||
1952 | if (error) | ||
1953 | goto fail; | ||
1954 | |||
1955 | /* | 1941 | /* |
1956 | * Initialization of compaction must be done after the call to | 1942 | * Initialization of compaction must be done after the call to |
1957 | * balloon_devinfo_init() . | 1943 | * balloon_devinfo_init() . |
@@ -1971,6 +1957,8 @@ static int __init vmballoon_init(void) | |||
1971 | 1957 | ||
1972 | queue_delayed_work(system_freezable_wq, &balloon.dwork, 0); | 1958 | queue_delayed_work(system_freezable_wq, &balloon.dwork, 0); |
1973 | 1959 | ||
1960 | vmballoon_debugfs_init(&balloon); | ||
1961 | |||
1974 | return 0; | 1962 | return 0; |
1975 | fail: | 1963 | fail: |
1976 | vmballoon_unregister_shrinker(&balloon); | 1964 | vmballoon_unregister_shrinker(&balloon); |
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_misc.c b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_misc.c index 09c16d88172e..bb6586d0e5af 100644 --- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_misc.c +++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_misc.c | |||
@@ -754,7 +754,7 @@ struct dsaf_misc_op *hns_misc_op_get(struct dsaf_device *dsaf_dev) | |||
754 | return (void *)misc_op; | 754 | return (void *)misc_op; |
755 | } | 755 | } |
756 | 756 | ||
757 | static int hns_dsaf_dev_match(struct device *dev, void *fwnode) | 757 | static int hns_dsaf_dev_match(struct device *dev, const void *fwnode) |
758 | { | 758 | { |
759 | return dev->fwnode == fwnode; | 759 | return dev->fwnode == fwnode; |
760 | } | 760 | } |
diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c index 28ec0d57941d..41c90f2ddb31 100644 --- a/drivers/net/ethernet/intel/ice/ice_main.c +++ b/drivers/net/ethernet/intel/ice/ice_main.c | |||
@@ -2286,7 +2286,7 @@ ice_probe(struct pci_dev *pdev, const struct pci_device_id __always_unused *ent) | |||
2286 | struct ice_hw *hw; | 2286 | struct ice_hw *hw; |
2287 | int err; | 2287 | int err; |
2288 | 2288 | ||
2289 | /* this driver uses devres, see Documentation/driver-model/devres.txt */ | 2289 | /* this driver uses devres, see Documentation/driver-model/devres.rst */ |
2290 | err = pcim_enable_device(pdev); | 2290 | err = pcim_enable_device(pdev); |
2291 | if (err) | 2291 | if (err) |
2292 | return err; | 2292 | return err; |
diff --git a/drivers/net/ethernet/ti/cpsw-phy-sel.c b/drivers/net/ethernet/ti/cpsw-phy-sel.c index 48e0924259f5..4e184eecc8e1 100644 --- a/drivers/net/ethernet/ti/cpsw-phy-sel.c +++ b/drivers/net/ethernet/ti/cpsw-phy-sel.c | |||
@@ -151,9 +151,9 @@ static void cpsw_gmii_sel_dra7xx(struct cpsw_phy_sel_priv *priv, | |||
151 | } | 151 | } |
152 | 152 | ||
153 | static struct platform_driver cpsw_phy_sel_driver; | 153 | static struct platform_driver cpsw_phy_sel_driver; |
154 | static int match(struct device *dev, void *data) | 154 | static int match(struct device *dev, const void *data) |
155 | { | 155 | { |
156 | struct device_node *node = (struct device_node *)data; | 156 | const struct device_node *node = (const struct device_node *)data; |
157 | return dev->of_node == node && | 157 | return dev->of_node == node && |
158 | dev->driver == &cpsw_phy_sel_driver.driver; | 158 | dev->driver == &cpsw_phy_sel_driver.driver; |
159 | } | 159 | } |
diff --git a/drivers/net/ethernet/ti/davinci_emac.c b/drivers/net/ethernet/ti/davinci_emac.c index 5f4ece0d5a73..ae27be85e363 100644 --- a/drivers/net/ethernet/ti/davinci_emac.c +++ b/drivers/net/ethernet/ti/davinci_emac.c | |||
@@ -1371,7 +1371,7 @@ static int emac_devioctl(struct net_device *ndev, struct ifreq *ifrq, int cmd) | |||
1371 | return -EOPNOTSUPP; | 1371 | return -EOPNOTSUPP; |
1372 | } | 1372 | } |
1373 | 1373 | ||
1374 | static int match_first_device(struct device *dev, void *data) | 1374 | static int match_first_device(struct device *dev, const void *data) |
1375 | { | 1375 | { |
1376 | if (dev->parent && dev->parent->of_node) | 1376 | if (dev->parent && dev->parent->of_node) |
1377 | return of_device_is_compatible(dev->parent->of_node, | 1377 | return of_device_is_compatible(dev->parent->of_node, |
diff --git a/drivers/net/ethernet/toshiba/tc35815.c b/drivers/net/ethernet/toshiba/tc35815.c index c50a9772f4af..8479a440527b 100644 --- a/drivers/net/ethernet/toshiba/tc35815.c +++ b/drivers/net/ethernet/toshiba/tc35815.c | |||
@@ -694,10 +694,10 @@ err_out: | |||
694 | * should provide a "tc35815-mac" device with a MAC address in its | 694 | * should provide a "tc35815-mac" device with a MAC address in its |
695 | * platform_data. | 695 | * platform_data. |
696 | */ | 696 | */ |
697 | static int tc35815_mac_match(struct device *dev, void *data) | 697 | static int tc35815_mac_match(struct device *dev, const void *data) |
698 | { | 698 | { |
699 | struct platform_device *plat_dev = to_platform_device(dev); | 699 | struct platform_device *plat_dev = to_platform_device(dev); |
700 | struct pci_dev *pci_dev = data; | 700 | const struct pci_dev *pci_dev = data; |
701 | unsigned int id = pci_dev->irq; | 701 | unsigned int id = pci_dev->irq; |
702 | return !strcmp(plat_dev->name, "tc35815-mac") && plat_dev->id == id; | 702 | return !strcmp(plat_dev->name, "tc35815-mac") && plat_dev->id == id; |
703 | } | 703 | } |
diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index c7892c3da91f..ac5d945be88a 100644 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c | |||
@@ -76,7 +76,7 @@ static struct bus_type nvmem_bus_type = { | |||
76 | .name = "nvmem", | 76 | .name = "nvmem", |
77 | }; | 77 | }; |
78 | 78 | ||
79 | static int of_nvmem_match(struct device *dev, void *nvmem_np) | 79 | static int of_nvmem_match(struct device *dev, const void *nvmem_np) |
80 | { | 80 | { |
81 | return dev->of_node == nvmem_np; | 81 | return dev->of_node == nvmem_np; |
82 | } | 82 | } |
diff --git a/drivers/of/of_mdio.c b/drivers/of/of_mdio.c index 3b67896d9d74..44f53496cab1 100644 --- a/drivers/of/of_mdio.c +++ b/drivers/of/of_mdio.c | |||
@@ -281,7 +281,7 @@ unregister: | |||
281 | EXPORT_SYMBOL(of_mdiobus_register); | 281 | EXPORT_SYMBOL(of_mdiobus_register); |
282 | 282 | ||
283 | /* Helper function for of_phy_find_device */ | 283 | /* Helper function for of_phy_find_device */ |
284 | static int of_phy_match(struct device *dev, void *phy_np) | 284 | static int of_phy_match(struct device *dev, const void *phy_np) |
285 | { | 285 | { |
286 | return dev->of_node == phy_np; | 286 | return dev->of_node == phy_np; |
287 | } | 287 | } |
diff --git a/drivers/of/platform.c b/drivers/of/platform.c index efbff44581b3..7801e25e6895 100644 --- a/drivers/of/platform.c +++ b/drivers/of/platform.c | |||
@@ -37,7 +37,7 @@ static const struct of_device_id of_skipped_node_table[] = { | |||
37 | {} /* Empty terminated list */ | 37 | {} /* Empty terminated list */ |
38 | }; | 38 | }; |
39 | 39 | ||
40 | static int of_dev_node_match(struct device *dev, void *data) | 40 | static int of_dev_node_match(struct device *dev, const void *data) |
41 | { | 41 | { |
42 | return dev->of_node == data; | 42 | return dev->of_node == data; |
43 | } | 43 | } |
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index 0e8e2c186f50..f9ef7ad3f75d 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c | |||
@@ -64,7 +64,7 @@ static struct resource *get_pci_domain_busn_res(int domain_nr) | |||
64 | return &r->res; | 64 | return &r->res; |
65 | } | 65 | } |
66 | 66 | ||
67 | static int find_anything(struct device *dev, void *data) | 67 | static int find_anything(struct device *dev, const void *data) |
68 | { | 68 | { |
69 | return 1; | 69 | return 1; |
70 | } | 70 | } |
diff --git a/drivers/pci/search.c b/drivers/pci/search.c index 5c7922612733..7f4e65872b8d 100644 --- a/drivers/pci/search.c +++ b/drivers/pci/search.c | |||
@@ -236,10 +236,10 @@ struct pci_dev *pci_get_domain_bus_and_slot(int domain, unsigned int bus, | |||
236 | } | 236 | } |
237 | EXPORT_SYMBOL(pci_get_domain_bus_and_slot); | 237 | EXPORT_SYMBOL(pci_get_domain_bus_and_slot); |
238 | 238 | ||
239 | static int match_pci_dev_by_id(struct device *dev, void *data) | 239 | static int match_pci_dev_by_id(struct device *dev, const void *data) |
240 | { | 240 | { |
241 | struct pci_dev *pdev = to_pci_dev(dev); | 241 | struct pci_dev *pdev = to_pci_dev(dev); |
242 | struct pci_device_id *id = data; | 242 | const struct pci_device_id *id = data; |
243 | 243 | ||
244 | if (pci_match_one_device(id, pdev)) | 244 | if (pci_match_one_device(id, pdev)) |
245 | return 1; | 245 | return 1; |
diff --git a/drivers/pinctrl/devicetree.c b/drivers/pinctrl/devicetree.c index f7e354f85518..88ddbb2e30de 100644 --- a/drivers/pinctrl/devicetree.c +++ b/drivers/pinctrl/devicetree.c | |||
@@ -112,12 +112,11 @@ static int dt_to_map_one_config(struct pinctrl *p, | |||
112 | np_pctldev = of_get_next_parent(np_pctldev); | 112 | np_pctldev = of_get_next_parent(np_pctldev); |
113 | if (!np_pctldev || of_node_is_root(np_pctldev)) { | 113 | if (!np_pctldev || of_node_is_root(np_pctldev)) { |
114 | of_node_put(np_pctldev); | 114 | of_node_put(np_pctldev); |
115 | ret = driver_deferred_probe_check_state(p->dev); | ||
116 | /* keep deferring if modules are enabled unless we've timed out */ | 115 | /* keep deferring if modules are enabled unless we've timed out */ |
117 | if (IS_ENABLED(CONFIG_MODULES) && !allow_default && ret == -ENODEV) | 116 | if (IS_ENABLED(CONFIG_MODULES) && !allow_default) |
118 | ret = -EPROBE_DEFER; | 117 | return driver_deferred_probe_check_state_continue(p->dev); |
119 | 118 | ||
120 | return ret; | 119 | return driver_deferred_probe_check_state(p->dev); |
121 | } | 120 | } |
122 | /* If we're creating a hog we can use the passed pctldev */ | 121 | /* If we're creating a hog we can use the passed pctldev */ |
123 | if (hog_pctldev && (np_pctldev == p->dev->of_node)) { | 122 | if (hog_pctldev && (np_pctldev == p->dev->of_node)) { |
diff --git a/drivers/s390/cio/ccwgroup.c b/drivers/s390/cio/ccwgroup.c index 4ebf6d4fc66c..c522e9313c50 100644 --- a/drivers/s390/cio/ccwgroup.c +++ b/drivers/s390/cio/ccwgroup.c | |||
@@ -581,7 +581,7 @@ int ccwgroup_driver_register(struct ccwgroup_driver *cdriver) | |||
581 | } | 581 | } |
582 | EXPORT_SYMBOL(ccwgroup_driver_register); | 582 | EXPORT_SYMBOL(ccwgroup_driver_register); |
583 | 583 | ||
584 | static int __ccwgroup_match_all(struct device *dev, void *data) | 584 | static int __ccwgroup_match_all(struct device *dev, const void *data) |
585 | { | 585 | { |
586 | return 1; | 586 | return 1; |
587 | } | 587 | } |
@@ -608,9 +608,9 @@ void ccwgroup_driver_unregister(struct ccwgroup_driver *cdriver) | |||
608 | } | 608 | } |
609 | EXPORT_SYMBOL(ccwgroup_driver_unregister); | 609 | EXPORT_SYMBOL(ccwgroup_driver_unregister); |
610 | 610 | ||
611 | static int __ccwgroupdev_check_busid(struct device *dev, void *id) | 611 | static int __ccwgroupdev_check_busid(struct device *dev, const void *id) |
612 | { | 612 | { |
613 | char *bus_id = id; | 613 | const char *bus_id = id; |
614 | 614 | ||
615 | return (strcmp(bus_id, dev_name(dev)) == 0); | 615 | return (strcmp(bus_id, dev_name(dev)) == 0); |
616 | } | 616 | } |
diff --git a/drivers/s390/cio/chsc_sch.c b/drivers/s390/cio/chsc_sch.c index 8d9f36625ba5..8f080d3fd380 100644 --- a/drivers/s390/cio/chsc_sch.c +++ b/drivers/s390/cio/chsc_sch.c | |||
@@ -203,7 +203,7 @@ static void chsc_cleanup_sch_driver(void) | |||
203 | 203 | ||
204 | static DEFINE_SPINLOCK(chsc_lock); | 204 | static DEFINE_SPINLOCK(chsc_lock); |
205 | 205 | ||
206 | static int chsc_subchannel_match_next_free(struct device *dev, void *data) | 206 | static int chsc_subchannel_match_next_free(struct device *dev, const void *data) |
207 | { | 207 | { |
208 | struct subchannel *sch = to_subchannel(dev); | 208 | struct subchannel *sch = to_subchannel(dev); |
209 | 209 | ||
diff --git a/drivers/s390/cio/css.c b/drivers/s390/cio/css.c index e1f2d0eed544..22c55816100b 100644 --- a/drivers/s390/cio/css.c +++ b/drivers/s390/cio/css.c | |||
@@ -491,10 +491,10 @@ static int css_probe_device(struct subchannel_id schid, struct schib *schib) | |||
491 | } | 491 | } |
492 | 492 | ||
493 | static int | 493 | static int |
494 | check_subchannel(struct device * dev, void * data) | 494 | check_subchannel(struct device *dev, const void *data) |
495 | { | 495 | { |
496 | struct subchannel *sch; | 496 | struct subchannel *sch; |
497 | struct subchannel_id *schid = data; | 497 | struct subchannel_id *schid = (void *)data; |
498 | 498 | ||
499 | sch = to_subchannel(dev); | 499 | sch = to_subchannel(dev); |
500 | return schid_equal(&sch->schid, schid); | 500 | return schid_equal(&sch->schid, schid); |
diff --git a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c index 9985b7484a6b..c421899be20f 100644 --- a/drivers/s390/cio/device.c +++ b/drivers/s390/cio/device.c | |||
@@ -643,10 +643,10 @@ static int ccw_device_add(struct ccw_device *cdev) | |||
643 | return device_add(dev); | 643 | return device_add(dev); |
644 | } | 644 | } |
645 | 645 | ||
646 | static int match_dev_id(struct device *dev, void *data) | 646 | static int match_dev_id(struct device *dev, const void *data) |
647 | { | 647 | { |
648 | struct ccw_device *cdev = to_ccwdev(dev); | 648 | struct ccw_device *cdev = to_ccwdev(dev); |
649 | struct ccw_dev_id *dev_id = data; | 649 | struct ccw_dev_id *dev_id = (void *)data; |
650 | 650 | ||
651 | return ccw_dev_id_is_equal(&cdev->private->dev_id, dev_id); | 651 | return ccw_dev_id_is_equal(&cdev->private->dev_id, dev_id); |
652 | } | 652 | } |
@@ -1699,11 +1699,9 @@ EXPORT_SYMBOL_GPL(ccw_device_force_console); | |||
1699 | * get ccw_device matching the busid, but only if owned by cdrv | 1699 | * get ccw_device matching the busid, but only if owned by cdrv |
1700 | */ | 1700 | */ |
1701 | static int | 1701 | static int |
1702 | __ccwdev_check_busid(struct device *dev, void *id) | 1702 | __ccwdev_check_busid(struct device *dev, const void *id) |
1703 | { | 1703 | { |
1704 | char *bus_id; | 1704 | const char *bus_id = id; |
1705 | |||
1706 | bus_id = id; | ||
1707 | 1705 | ||
1708 | return (strcmp(bus_id, dev_name(dev)) == 0); | 1706 | return (strcmp(bus_id, dev_name(dev)) == 0); |
1709 | } | 1707 | } |
diff --git a/drivers/s390/cio/scm.c b/drivers/s390/cio/scm.c index 6bca1d5455d4..9f26d4310bb3 100644 --- a/drivers/s390/cio/scm.c +++ b/drivers/s390/cio/scm.c | |||
@@ -174,10 +174,10 @@ out: | |||
174 | kobject_uevent(&scmdev->dev.kobj, KOBJ_CHANGE); | 174 | kobject_uevent(&scmdev->dev.kobj, KOBJ_CHANGE); |
175 | } | 175 | } |
176 | 176 | ||
177 | static int check_address(struct device *dev, void *data) | 177 | static int check_address(struct device *dev, const void *data) |
178 | { | 178 | { |
179 | struct scm_device *scmdev = to_scm_dev(dev); | 179 | struct scm_device *scmdev = to_scm_dev(dev); |
180 | struct sale *sale = data; | 180 | const struct sale *sale = data; |
181 | 181 | ||
182 | return scmdev->address == sale->sa; | 182 | return scmdev->address == sale->sa; |
183 | } | 183 | } |
diff --git a/drivers/s390/crypto/ap_bus.c b/drivers/s390/crypto/ap_bus.c index b9fc502c58c2..b7902b643ec8 100644 --- a/drivers/s390/crypto/ap_bus.c +++ b/drivers/s390/crypto/ap_bus.c | |||
@@ -1356,16 +1356,16 @@ static int ap_get_compatible_type(ap_qid_t qid, int rawtype, unsigned int func) | |||
1356 | * Helper function to be used with bus_find_dev | 1356 | * Helper function to be used with bus_find_dev |
1357 | * matches for the card device with the given id | 1357 | * matches for the card device with the given id |
1358 | */ | 1358 | */ |
1359 | static int __match_card_device_with_id(struct device *dev, void *data) | 1359 | static int __match_card_device_with_id(struct device *dev, const void *data) |
1360 | { | 1360 | { |
1361 | return is_card_dev(dev) && to_ap_card(dev)->id == (int)(long) data; | 1361 | return is_card_dev(dev) && to_ap_card(dev)->id == (int)(long)(void *) data; |
1362 | } | 1362 | } |
1363 | 1363 | ||
1364 | /* | 1364 | /* |
1365 | * Helper function to be used with bus_find_dev | 1365 | * Helper function to be used with bus_find_dev |
1366 | * matches for the queue device with a given qid | 1366 | * matches for the queue device with a given qid |
1367 | */ | 1367 | */ |
1368 | static int __match_queue_device_with_qid(struct device *dev, void *data) | 1368 | static int __match_queue_device_with_qid(struct device *dev, const void *data) |
1369 | { | 1369 | { |
1370 | return is_queue_dev(dev) && to_ap_queue(dev)->qid == (int)(long) data; | 1370 | return is_queue_dev(dev) && to_ap_queue(dev)->qid == (int)(long) data; |
1371 | } | 1371 | } |
@@ -1374,7 +1374,7 @@ static int __match_queue_device_with_qid(struct device *dev, void *data) | |||
1374 | * Helper function to be used with bus_find_dev | 1374 | * Helper function to be used with bus_find_dev |
1375 | * matches any queue device with given queue id | 1375 | * matches any queue device with given queue id |
1376 | */ | 1376 | */ |
1377 | static int __match_queue_device_with_queue_id(struct device *dev, void *data) | 1377 | static int __match_queue_device_with_queue_id(struct device *dev, const void *data) |
1378 | { | 1378 | { |
1379 | return is_queue_dev(dev) | 1379 | return is_queue_dev(dev) |
1380 | && AP_QID_QUEUE(to_ap_queue(dev)->qid) == (int)(long) data; | 1380 | && AP_QID_QUEUE(to_ap_queue(dev)->qid) == (int)(long) data; |
diff --git a/drivers/s390/crypto/vfio_ap_ops.c b/drivers/s390/crypto/vfio_ap_ops.c index 2c9fb1423a39..7e85ba7c6ef0 100644 --- a/drivers/s390/crypto/vfio_ap_ops.c +++ b/drivers/s390/crypto/vfio_ap_ops.c | |||
@@ -26,7 +26,7 @@ | |||
26 | 26 | ||
27 | static int vfio_ap_mdev_reset_queues(struct mdev_device *mdev); | 27 | static int vfio_ap_mdev_reset_queues(struct mdev_device *mdev); |
28 | 28 | ||
29 | static int match_apqn(struct device *dev, void *data) | 29 | static int match_apqn(struct device *dev, const void *data) |
30 | { | 30 | { |
31 | struct vfio_ap_queue *q = dev_get_drvdata(dev); | 31 | struct vfio_ap_queue *q = dev_get_drvdata(dev); |
32 | 32 | ||
diff --git a/drivers/scsi/scsi_proc.c b/drivers/scsi/scsi_proc.c index 7f0ceb65c3f3..c074631086a4 100644 --- a/drivers/scsi/scsi_proc.c +++ b/drivers/scsi/scsi_proc.c | |||
@@ -372,7 +372,7 @@ static ssize_t proc_scsi_write(struct file *file, const char __user *buf, | |||
372 | return err; | 372 | return err; |
373 | } | 373 | } |
374 | 374 | ||
375 | static int always_match(struct device *dev, void *data) | 375 | static int always_match(struct device *dev, const void *data) |
376 | { | 376 | { |
377 | return 1; | 377 | return 1; |
378 | } | 378 | } |
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 91673351bcf3..75ac046cae52 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c | |||
@@ -3652,7 +3652,7 @@ EXPORT_SYMBOL_GPL(spi_write_then_read); | |||
3652 | /*-------------------------------------------------------------------------*/ | 3652 | /*-------------------------------------------------------------------------*/ |
3653 | 3653 | ||
3654 | #if IS_ENABLED(CONFIG_OF) | 3654 | #if IS_ENABLED(CONFIG_OF) |
3655 | static int __spi_of_device_match(struct device *dev, void *data) | 3655 | static int __spi_of_device_match(struct device *dev, const void *data) |
3656 | { | 3656 | { |
3657 | return dev->of_node == data; | 3657 | return dev->of_node == data; |
3658 | } | 3658 | } |
@@ -3753,7 +3753,7 @@ static int spi_acpi_controller_match(struct device *dev, const void *data) | |||
3753 | return ACPI_COMPANION(dev->parent) == data; | 3753 | return ACPI_COMPANION(dev->parent) == data; |
3754 | } | 3754 | } |
3755 | 3755 | ||
3756 | static int spi_acpi_device_match(struct device *dev, void *data) | 3756 | static int spi_acpi_device_match(struct device *dev, const void *data) |
3757 | { | 3757 | { |
3758 | return ACPI_COMPANION(dev) == data; | 3758 | return ACPI_COMPANION(dev) == data; |
3759 | } | 3759 | } |
diff --git a/drivers/staging/most/core.c b/drivers/staging/most/core.c index 86a8545c8d97..b9841adb7181 100644 --- a/drivers/staging/most/core.c +++ b/drivers/staging/most/core.c | |||
@@ -561,13 +561,6 @@ static int split_string(char *buf, char **a, char **b, char **c, char **d) | |||
561 | return 0; | 561 | return 0; |
562 | } | 562 | } |
563 | 563 | ||
564 | static int match_bus_dev(struct device *dev, void *data) | ||
565 | { | ||
566 | char *mdev_name = data; | ||
567 | |||
568 | return !strcmp(dev_name(dev), mdev_name); | ||
569 | } | ||
570 | |||
571 | /** | 564 | /** |
572 | * get_channel - get pointer to channel | 565 | * get_channel - get pointer to channel |
573 | * @mdev: name of the device interface | 566 | * @mdev: name of the device interface |
@@ -579,7 +572,7 @@ static struct most_channel *get_channel(char *mdev, char *mdev_ch) | |||
579 | struct most_interface *iface; | 572 | struct most_interface *iface; |
580 | struct most_channel *c, *tmp; | 573 | struct most_channel *c, *tmp; |
581 | 574 | ||
582 | dev = bus_find_device(&mc.bus, NULL, mdev, match_bus_dev); | 575 | dev = bus_find_device_by_name(&mc.bus, NULL, mdev); |
583 | if (!dev) | 576 | if (!dev) |
584 | return NULL; | 577 | return NULL; |
585 | iface = to_most_interface(dev); | 578 | iface = to_most_interface(dev); |
diff --git a/drivers/thermal/broadcom/bcm2835_thermal.c b/drivers/thermal/broadcom/bcm2835_thermal.c index ba39647a690c..3199977f1e73 100644 --- a/drivers/thermal/broadcom/bcm2835_thermal.c +++ b/drivers/thermal/broadcom/bcm2835_thermal.c | |||
@@ -123,8 +123,6 @@ static void bcm2835_thermal_debugfs(struct platform_device *pdev) | |||
123 | struct debugfs_regset32 *regset; | 123 | struct debugfs_regset32 *regset; |
124 | 124 | ||
125 | data->debugfsdir = debugfs_create_dir("bcm2835_thermal", NULL); | 125 | data->debugfsdir = debugfs_create_dir("bcm2835_thermal", NULL); |
126 | if (!data->debugfsdir) | ||
127 | return; | ||
128 | 126 | ||
129 | regset = devm_kzalloc(&pdev->dev, sizeof(*regset), GFP_KERNEL); | 127 | regset = devm_kzalloc(&pdev->dev, sizeof(*regset), GFP_KERNEL); |
130 | if (!regset) | 128 | if (!regset) |
diff --git a/drivers/thermal/intel/intel_powerclamp.c b/drivers/thermal/intel/intel_powerclamp.c index 79d214b7291c..5149a817456b 100644 --- a/drivers/thermal/intel/intel_powerclamp.c +++ b/drivers/thermal/intel/intel_powerclamp.c | |||
@@ -698,17 +698,9 @@ DEFINE_SHOW_ATTRIBUTE(powerclamp_debug); | |||
698 | static inline void powerclamp_create_debug_files(void) | 698 | static inline void powerclamp_create_debug_files(void) |
699 | { | 699 | { |
700 | debug_dir = debugfs_create_dir("intel_powerclamp", NULL); | 700 | debug_dir = debugfs_create_dir("intel_powerclamp", NULL); |
701 | if (!debug_dir) | ||
702 | return; | ||
703 | |||
704 | if (!debugfs_create_file("powerclamp_calib", S_IRUGO, debug_dir, | ||
705 | cal_data, &powerclamp_debug_fops)) | ||
706 | goto file_error; | ||
707 | 701 | ||
708 | return; | 702 | debugfs_create_file("powerclamp_calib", S_IRUGO, debug_dir, cal_data, |
709 | 703 | &powerclamp_debug_fops); | |
710 | file_error: | ||
711 | debugfs_remove_recursive(debug_dir); | ||
712 | } | 704 | } |
713 | 705 | ||
714 | static enum cpuhp_state hp_state; | 706 | static enum cpuhp_state hp_state; |
diff --git a/drivers/thermal/intel/x86_pkg_temp_thermal.c b/drivers/thermal/intel/x86_pkg_temp_thermal.c index e85d54d1cdf3..ddb4a973c698 100644 --- a/drivers/thermal/intel/x86_pkg_temp_thermal.c +++ b/drivers/thermal/intel/x86_pkg_temp_thermal.c | |||
@@ -75,29 +75,14 @@ static struct dentry *debugfs; | |||
75 | static unsigned int pkg_interrupt_cnt; | 75 | static unsigned int pkg_interrupt_cnt; |
76 | static unsigned int pkg_work_cnt; | 76 | static unsigned int pkg_work_cnt; |
77 | 77 | ||
78 | static int pkg_temp_debugfs_init(void) | 78 | static void pkg_temp_debugfs_init(void) |
79 | { | 79 | { |
80 | struct dentry *d; | ||
81 | |||
82 | debugfs = debugfs_create_dir("pkg_temp_thermal", NULL); | 80 | debugfs = debugfs_create_dir("pkg_temp_thermal", NULL); |
83 | if (!debugfs) | ||
84 | return -ENOENT; | ||
85 | |||
86 | d = debugfs_create_u32("pkg_thres_interrupt", S_IRUGO, debugfs, | ||
87 | &pkg_interrupt_cnt); | ||
88 | if (!d) | ||
89 | goto err_out; | ||
90 | |||
91 | d = debugfs_create_u32("pkg_thres_work", S_IRUGO, debugfs, | ||
92 | &pkg_work_cnt); | ||
93 | if (!d) | ||
94 | goto err_out; | ||
95 | 81 | ||
96 | return 0; | 82 | debugfs_create_u32("pkg_thres_interrupt", S_IRUGO, debugfs, |
97 | 83 | &pkg_interrupt_cnt); | |
98 | err_out: | 84 | debugfs_create_u32("pkg_thres_work", S_IRUGO, debugfs, |
99 | debugfs_remove_recursive(debugfs); | 85 | &pkg_work_cnt); |
100 | return -ENOENT; | ||
101 | } | 86 | } |
102 | 87 | ||
103 | /* | 88 | /* |
diff --git a/drivers/thermal/tegra/soctherm.c b/drivers/thermal/tegra/soctherm.c index fcf70a3728b6..43941eb734eb 100644 --- a/drivers/thermal/tegra/soctherm.c +++ b/drivers/thermal/tegra/soctherm.c | |||
@@ -1485,23 +1485,13 @@ DEFINE_SHOW_ATTRIBUTE(regs); | |||
1485 | static void soctherm_debug_init(struct platform_device *pdev) | 1485 | static void soctherm_debug_init(struct platform_device *pdev) |
1486 | { | 1486 | { |
1487 | struct tegra_soctherm *tegra = platform_get_drvdata(pdev); | 1487 | struct tegra_soctherm *tegra = platform_get_drvdata(pdev); |
1488 | struct dentry *root, *file; | 1488 | struct dentry *root; |
1489 | 1489 | ||
1490 | root = debugfs_create_dir("soctherm", NULL); | 1490 | root = debugfs_create_dir("soctherm", NULL); |
1491 | if (!root) { | ||
1492 | dev_err(&pdev->dev, "failed to create debugfs directory\n"); | ||
1493 | return; | ||
1494 | } | ||
1495 | 1491 | ||
1496 | tegra->debugfs_dir = root; | 1492 | tegra->debugfs_dir = root; |
1497 | 1493 | ||
1498 | file = debugfs_create_file("reg_contents", 0644, root, | 1494 | debugfs_create_file("reg_contents", 0644, root, pdev, ®s_fops); |
1499 | pdev, ®s_fops); | ||
1500 | if (!file) { | ||
1501 | dev_err(&pdev->dev, "failed to create debugfs file\n"); | ||
1502 | debugfs_remove_recursive(tegra->debugfs_dir); | ||
1503 | tegra->debugfs_dir = NULL; | ||
1504 | } | ||
1505 | } | 1495 | } |
1506 | #else | 1496 | #else |
1507 | static inline void soctherm_debug_init(struct platform_device *pdev) {} | 1497 | static inline void soctherm_debug_init(struct platform_device *pdev) {} |
diff --git a/drivers/thunderbolt/switch.c b/drivers/thunderbolt/switch.c index 10b56c66fec3..5668a44e0653 100644 --- a/drivers/thunderbolt/switch.c +++ b/drivers/thunderbolt/switch.c | |||
@@ -1967,10 +1967,10 @@ struct tb_sw_lookup { | |||
1967 | u64 route; | 1967 | u64 route; |
1968 | }; | 1968 | }; |
1969 | 1969 | ||
1970 | static int tb_switch_match(struct device *dev, void *data) | 1970 | static int tb_switch_match(struct device *dev, const void *data) |
1971 | { | 1971 | { |
1972 | struct tb_switch *sw = tb_to_switch(dev); | 1972 | struct tb_switch *sw = tb_to_switch(dev); |
1973 | struct tb_sw_lookup *lookup = data; | 1973 | const struct tb_sw_lookup *lookup = data; |
1974 | 1974 | ||
1975 | if (!sw) | 1975 | if (!sw) |
1976 | return 0; | 1976 | return 0; |
diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c index e2f316ac8b01..b265ab5405f9 100644 --- a/drivers/usb/core/devio.c +++ b/drivers/usb/core/devio.c | |||
@@ -942,9 +942,9 @@ error: | |||
942 | return ret; | 942 | return ret; |
943 | } | 943 | } |
944 | 944 | ||
945 | static int match_devt(struct device *dev, void *data) | 945 | static int match_devt(struct device *dev, const void *data) |
946 | { | 946 | { |
947 | return dev->devt == (dev_t) (unsigned long) data; | 947 | return dev->devt == (dev_t)(unsigned long)(void *)data; |
948 | } | 948 | } |
949 | 949 | ||
950 | static struct usb_device *usbdev_lookup_by_devt(dev_t devt) | 950 | static struct usb_device *usbdev_lookup_by_devt(dev_t devt) |
diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c index 5a0df527a8ca..0ab8738047da 100644 --- a/drivers/usb/core/usb.c +++ b/drivers/usb/core/usb.c | |||
@@ -325,9 +325,9 @@ struct find_interface_arg { | |||
325 | struct device_driver *drv; | 325 | struct device_driver *drv; |
326 | }; | 326 | }; |
327 | 327 | ||
328 | static int __find_interface(struct device *dev, void *data) | 328 | static int __find_interface(struct device *dev, const void *data) |
329 | { | 329 | { |
330 | struct find_interface_arg *arg = data; | 330 | const struct find_interface_arg *arg = data; |
331 | struct usb_interface *intf; | 331 | struct usb_interface *intf; |
332 | 332 | ||
333 | if (!is_usb_interface(dev)) | 333 | if (!is_usb_interface(dev)) |
diff --git a/drivers/usb/phy/phy-am335x-control.c b/drivers/usb/phy/phy-am335x-control.c index a3cb25cb74f8..d16dfc320faa 100644 --- a/drivers/usb/phy/phy-am335x-control.c +++ b/drivers/usb/phy/phy-am335x-control.c | |||
@@ -118,9 +118,9 @@ static const struct of_device_id omap_control_usb_id_table[] = { | |||
118 | MODULE_DEVICE_TABLE(of, omap_control_usb_id_table); | 118 | MODULE_DEVICE_TABLE(of, omap_control_usb_id_table); |
119 | 119 | ||
120 | static struct platform_driver am335x_control_driver; | 120 | static struct platform_driver am335x_control_driver; |
121 | static int match(struct device *dev, void *data) | 121 | static int match(struct device *dev, const void *data) |
122 | { | 122 | { |
123 | struct device_node *node = (struct device_node *)data; | 123 | const struct device_node *node = (const struct device_node *)data; |
124 | return dev->of_node == node && | 124 | return dev->of_node == node && |
125 | dev->driver == &am335x_control_driver.driver; | 125 | dev->driver == &am335x_control_driver.driver; |
126 | } | 126 | } |
diff --git a/drivers/usb/phy/phy-isp1301.c b/drivers/usb/phy/phy-isp1301.c index 93b7d6a30aad..6cf6fbd39237 100644 --- a/drivers/usb/phy/phy-isp1301.c +++ b/drivers/usb/phy/phy-isp1301.c | |||
@@ -142,9 +142,9 @@ static struct i2c_driver isp1301_driver = { | |||
142 | 142 | ||
143 | module_i2c_driver(isp1301_driver); | 143 | module_i2c_driver(isp1301_driver); |
144 | 144 | ||
145 | static int match(struct device *dev, void *data) | 145 | static int match(struct device *dev, const void *data) |
146 | { | 146 | { |
147 | struct device_node *node = (struct device_node *)data; | 147 | const struct device_node *node = (const struct device_node *)data; |
148 | return (dev->of_node == node) && | 148 | return (dev->of_node == node) && |
149 | (dev->driver == &isp1301_driver.driver); | 149 | (dev->driver == &isp1301_driver.driver); |
150 | } | 150 | } |
diff --git a/drivers/visorbus/visorbus_main.c b/drivers/visorbus/visorbus_main.c index 0b2434cc4ecd..152fd29f04f2 100644 --- a/drivers/visorbus/visorbus_main.c +++ b/drivers/visorbus/visorbus_main.c | |||
@@ -171,10 +171,10 @@ struct visor_busdev { | |||
171 | u32 dev_no; | 171 | u32 dev_no; |
172 | }; | 172 | }; |
173 | 173 | ||
174 | static int match_visorbus_dev_by_id(struct device *dev, void *data) | 174 | static int match_visorbus_dev_by_id(struct device *dev, const void *data) |
175 | { | 175 | { |
176 | struct visor_device *vdev = to_visor_device(dev); | 176 | struct visor_device *vdev = to_visor_device(dev); |
177 | struct visor_busdev *id = data; | 177 | const struct visor_busdev *id = data; |
178 | 178 | ||
179 | if (vdev->chipset_bus_no == id->bus_no && | 179 | if (vdev->chipset_bus_no == id->bus_no && |
180 | vdev->chipset_dev_no == id->dev_no) | 180 | vdev->chipset_dev_no == id->dev_no) |
diff --git a/drivers/watchdog/bcm_kona_wdt.c b/drivers/watchdog/bcm_kona_wdt.c index e2ad44816359..921291025680 100644 --- a/drivers/watchdog/bcm_kona_wdt.c +++ b/drivers/watchdog/bcm_kona_wdt.c | |||
@@ -143,24 +143,18 @@ static void bcm_kona_wdt_debug_init(struct platform_device *pdev) | |||
143 | wdt->debugfs = NULL; | 143 | wdt->debugfs = NULL; |
144 | 144 | ||
145 | dir = debugfs_create_dir(BCM_KONA_WDT_NAME, NULL); | 145 | dir = debugfs_create_dir(BCM_KONA_WDT_NAME, NULL); |
146 | if (IS_ERR_OR_NULL(dir)) | ||
147 | return; | ||
148 | 146 | ||
149 | if (debugfs_create_file("info", S_IFREG | S_IRUGO, dir, wdt, | 147 | debugfs_create_file("info", S_IFREG | S_IRUGO, dir, wdt, |
150 | &bcm_kona_fops)) | 148 | &bcm_kona_fops); |
151 | wdt->debugfs = dir; | 149 | wdt->debugfs = dir; |
152 | else | ||
153 | debugfs_remove_recursive(dir); | ||
154 | } | 150 | } |
155 | 151 | ||
156 | static void bcm_kona_wdt_debug_exit(struct platform_device *pdev) | 152 | static void bcm_kona_wdt_debug_exit(struct platform_device *pdev) |
157 | { | 153 | { |
158 | struct bcm_kona_wdt *wdt = platform_get_drvdata(pdev); | 154 | struct bcm_kona_wdt *wdt = platform_get_drvdata(pdev); |
159 | 155 | ||
160 | if (wdt && wdt->debugfs) { | 156 | if (wdt) |
161 | debugfs_remove_recursive(wdt->debugfs); | 157 | debugfs_remove_recursive(wdt->debugfs); |
162 | wdt->debugfs = NULL; | ||
163 | } | ||
164 | } | 158 | } |
165 | 159 | ||
166 | #else | 160 | #else |
diff --git a/drivers/watchdog/mei_wdt.c b/drivers/watchdog/mei_wdt.c index 8023cf28657a..96a770938ff0 100644 --- a/drivers/watchdog/mei_wdt.c +++ b/drivers/watchdog/mei_wdt.c | |||
@@ -539,38 +539,23 @@ static void dbgfs_unregister(struct mei_wdt *wdt) | |||
539 | wdt->dbgfs_dir = NULL; | 539 | wdt->dbgfs_dir = NULL; |
540 | } | 540 | } |
541 | 541 | ||
542 | static int dbgfs_register(struct mei_wdt *wdt) | 542 | static void dbgfs_register(struct mei_wdt *wdt) |
543 | { | 543 | { |
544 | struct dentry *dir, *f; | 544 | struct dentry *dir; |
545 | 545 | ||
546 | dir = debugfs_create_dir(KBUILD_MODNAME, NULL); | 546 | dir = debugfs_create_dir(KBUILD_MODNAME, NULL); |
547 | if (!dir) | ||
548 | return -ENOMEM; | ||
549 | |||
550 | wdt->dbgfs_dir = dir; | 547 | wdt->dbgfs_dir = dir; |
551 | f = debugfs_create_file("state", S_IRUSR, dir, wdt, &dbgfs_fops_state); | ||
552 | if (!f) | ||
553 | goto err; | ||
554 | 548 | ||
555 | f = debugfs_create_file("activation", S_IRUSR, | 549 | debugfs_create_file("state", S_IRUSR, dir, wdt, &dbgfs_fops_state); |
556 | dir, wdt, &dbgfs_fops_activation); | ||
557 | if (!f) | ||
558 | goto err; | ||
559 | 550 | ||
560 | return 0; | 551 | debugfs_create_file("activation", S_IRUSR, dir, wdt, |
561 | err: | 552 | &dbgfs_fops_activation); |
562 | dbgfs_unregister(wdt); | ||
563 | return -ENODEV; | ||
564 | } | 553 | } |
565 | 554 | ||
566 | #else | 555 | #else |
567 | 556 | ||
568 | static inline void dbgfs_unregister(struct mei_wdt *wdt) {} | 557 | static inline void dbgfs_unregister(struct mei_wdt *wdt) {} |
569 | 558 | static inline void dbgfs_register(struct mei_wdt *wdt) {} | |
570 | static inline int dbgfs_register(struct mei_wdt *wdt) | ||
571 | { | ||
572 | return 0; | ||
573 | } | ||
574 | #endif /* CONFIG_DEBUG_FS */ | 559 | #endif /* CONFIG_DEBUG_FS */ |
575 | 560 | ||
576 | static int mei_wdt_probe(struct mei_cl_device *cldev, | 561 | static int mei_wdt_probe(struct mei_cl_device *cldev, |
@@ -623,8 +608,7 @@ static int mei_wdt_probe(struct mei_cl_device *cldev, | |||
623 | if (ret) | 608 | if (ret) |
624 | goto err_disable; | 609 | goto err_disable; |
625 | 610 | ||
626 | if (dbgfs_register(wdt)) | 611 | dbgfs_register(wdt); |
627 | dev_warn(&cldev->dev, "cannot register debugfs\n"); | ||
628 | 612 | ||
629 | return 0; | 613 | return 0; |
630 | 614 | ||
diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c index 2f078b77fe14..c1dfc97893ba 100644 --- a/fs/btrfs/sysfs.c +++ b/fs/btrfs/sysfs.c | |||
@@ -303,11 +303,12 @@ static ssize_t raid_bytes_show(struct kobject *kobj, | |||
303 | return snprintf(buf, PAGE_SIZE, "%llu\n", val); | 303 | return snprintf(buf, PAGE_SIZE, "%llu\n", val); |
304 | } | 304 | } |
305 | 305 | ||
306 | static struct attribute *raid_attributes[] = { | 306 | static struct attribute *raid_attrs[] = { |
307 | BTRFS_ATTR_PTR(raid, total_bytes), | 307 | BTRFS_ATTR_PTR(raid, total_bytes), |
308 | BTRFS_ATTR_PTR(raid, used_bytes), | 308 | BTRFS_ATTR_PTR(raid, used_bytes), |
309 | NULL | 309 | NULL |
310 | }; | 310 | }; |
311 | ATTRIBUTE_GROUPS(raid); | ||
311 | 312 | ||
312 | static void release_raid_kobj(struct kobject *kobj) | 313 | static void release_raid_kobj(struct kobject *kobj) |
313 | { | 314 | { |
@@ -317,7 +318,7 @@ static void release_raid_kobj(struct kobject *kobj) | |||
317 | struct kobj_type btrfs_raid_ktype = { | 318 | struct kobj_type btrfs_raid_ktype = { |
318 | .sysfs_ops = &kobj_sysfs_ops, | 319 | .sysfs_ops = &kobj_sysfs_ops, |
319 | .release = release_raid_kobj, | 320 | .release = release_raid_kobj, |
320 | .default_attrs = raid_attributes, | 321 | .default_groups = raid_groups, |
321 | }; | 322 | }; |
322 | 323 | ||
323 | #define SPACE_INFO_ATTR(field) \ | 324 | #define SPACE_INFO_ATTR(field) \ |
@@ -364,6 +365,7 @@ static struct attribute *space_info_attrs[] = { | |||
364 | BTRFS_ATTR_PTR(space_info, total_bytes_pinned), | 365 | BTRFS_ATTR_PTR(space_info, total_bytes_pinned), |
365 | NULL, | 366 | NULL, |
366 | }; | 367 | }; |
368 | ATTRIBUTE_GROUPS(space_info); | ||
367 | 369 | ||
368 | static void space_info_release(struct kobject *kobj) | 370 | static void space_info_release(struct kobject *kobj) |
369 | { | 371 | { |
@@ -375,7 +377,7 @@ static void space_info_release(struct kobject *kobj) | |||
375 | struct kobj_type space_info_ktype = { | 377 | struct kobj_type space_info_ktype = { |
376 | .sysfs_ops = &kobj_sysfs_ops, | 378 | .sysfs_ops = &kobj_sysfs_ops, |
377 | .release = space_info_release, | 379 | .release = space_info_release, |
378 | .default_attrs = space_info_attrs, | 380 | .default_groups = space_info_groups, |
379 | }; | 381 | }; |
380 | 382 | ||
381 | static const struct attribute *allocation_attrs[] = { | 383 | static const struct attribute *allocation_attrs[] = { |
@@ -910,12 +912,10 @@ void btrfs_sysfs_feature_update(struct btrfs_fs_info *fs_info, | |||
910 | ret = sysfs_create_group(fsid_kobj, &btrfs_feature_attr_group); | 912 | ret = sysfs_create_group(fsid_kobj, &btrfs_feature_attr_group); |
911 | } | 913 | } |
912 | 914 | ||
913 | static int btrfs_init_debugfs(void) | 915 | static void btrfs_init_debugfs(void) |
914 | { | 916 | { |
915 | #ifdef CONFIG_DEBUG_FS | 917 | #ifdef CONFIG_DEBUG_FS |
916 | btrfs_debugfs_root_dentry = debugfs_create_dir("btrfs", NULL); | 918 | btrfs_debugfs_root_dentry = debugfs_create_dir("btrfs", NULL); |
917 | if (!btrfs_debugfs_root_dentry) | ||
918 | return -ENOMEM; | ||
919 | 919 | ||
920 | /* | 920 | /* |
921 | * Example code, how to export data through debugfs. | 921 | * Example code, how to export data through debugfs. |
@@ -929,7 +929,6 @@ static int btrfs_init_debugfs(void) | |||
929 | #endif | 929 | #endif |
930 | 930 | ||
931 | #endif | 931 | #endif |
932 | return 0; | ||
933 | } | 932 | } |
934 | 933 | ||
935 | int __init btrfs_init_sysfs(void) | 934 | int __init btrfs_init_sysfs(void) |
@@ -940,9 +939,7 @@ int __init btrfs_init_sysfs(void) | |||
940 | if (!btrfs_kset) | 939 | if (!btrfs_kset) |
941 | return -ENOMEM; | 940 | return -ENOMEM; |
942 | 941 | ||
943 | ret = btrfs_init_debugfs(); | 942 | btrfs_init_debugfs(); |
944 | if (ret) | ||
945 | goto out1; | ||
946 | 943 | ||
947 | init_feature_attrs(); | 944 | init_feature_attrs(); |
948 | ret = sysfs_create_group(&btrfs_kset->kobj, &btrfs_feature_attr_group); | 945 | ret = sysfs_create_group(&btrfs_kset->kobj, &btrfs_feature_attr_group); |
@@ -959,7 +956,6 @@ out_remove_group: | |||
959 | sysfs_remove_group(&btrfs_kset->kobj, &btrfs_feature_attr_group); | 956 | sysfs_remove_group(&btrfs_kset->kobj, &btrfs_feature_attr_group); |
960 | out2: | 957 | out2: |
961 | debugfs_remove_recursive(btrfs_debugfs_root_dentry); | 958 | debugfs_remove_recursive(btrfs_debugfs_root_dentry); |
962 | out1: | ||
963 | kset_unregister(btrfs_kset); | 959 | kset_unregister(btrfs_kset); |
964 | 960 | ||
965 | return ret; | 961 | return ret; |
diff --git a/fs/ceph/debugfs.c b/fs/ceph/debugfs.c index b3fc5fe26a1a..83cd41fa2b01 100644 --- a/fs/ceph/debugfs.c +++ b/fs/ceph/debugfs.c | |||
@@ -245,21 +245,17 @@ void ceph_fs_debugfs_cleanup(struct ceph_fs_client *fsc) | |||
245 | debugfs_remove(fsc->debugfs_mdsc); | 245 | debugfs_remove(fsc->debugfs_mdsc); |
246 | } | 246 | } |
247 | 247 | ||
248 | int ceph_fs_debugfs_init(struct ceph_fs_client *fsc) | 248 | void ceph_fs_debugfs_init(struct ceph_fs_client *fsc) |
249 | { | 249 | { |
250 | char name[100]; | 250 | char name[100]; |
251 | int err = -ENOMEM; | ||
252 | 251 | ||
253 | dout("ceph_fs_debugfs_init\n"); | 252 | dout("ceph_fs_debugfs_init\n"); |
254 | BUG_ON(!fsc->client->debugfs_dir); | ||
255 | fsc->debugfs_congestion_kb = | 253 | fsc->debugfs_congestion_kb = |
256 | debugfs_create_file("writeback_congestion_kb", | 254 | debugfs_create_file("writeback_congestion_kb", |
257 | 0600, | 255 | 0600, |
258 | fsc->client->debugfs_dir, | 256 | fsc->client->debugfs_dir, |
259 | fsc, | 257 | fsc, |
260 | &congestion_kb_fops); | 258 | &congestion_kb_fops); |
261 | if (!fsc->debugfs_congestion_kb) | ||
262 | goto out; | ||
263 | 259 | ||
264 | snprintf(name, sizeof(name), "../../bdi/%s", | 260 | snprintf(name, sizeof(name), "../../bdi/%s", |
265 | dev_name(fsc->sb->s_bdi->dev)); | 261 | dev_name(fsc->sb->s_bdi->dev)); |
@@ -267,52 +263,36 @@ int ceph_fs_debugfs_init(struct ceph_fs_client *fsc) | |||
267 | debugfs_create_symlink("bdi", | 263 | debugfs_create_symlink("bdi", |
268 | fsc->client->debugfs_dir, | 264 | fsc->client->debugfs_dir, |
269 | name); | 265 | name); |
270 | if (!fsc->debugfs_bdi) | ||
271 | goto out; | ||
272 | 266 | ||
273 | fsc->debugfs_mdsmap = debugfs_create_file("mdsmap", | 267 | fsc->debugfs_mdsmap = debugfs_create_file("mdsmap", |
274 | 0400, | 268 | 0400, |
275 | fsc->client->debugfs_dir, | 269 | fsc->client->debugfs_dir, |
276 | fsc, | 270 | fsc, |
277 | &mdsmap_show_fops); | 271 | &mdsmap_show_fops); |
278 | if (!fsc->debugfs_mdsmap) | ||
279 | goto out; | ||
280 | 272 | ||
281 | fsc->debugfs_mds_sessions = debugfs_create_file("mds_sessions", | 273 | fsc->debugfs_mds_sessions = debugfs_create_file("mds_sessions", |
282 | 0400, | 274 | 0400, |
283 | fsc->client->debugfs_dir, | 275 | fsc->client->debugfs_dir, |
284 | fsc, | 276 | fsc, |
285 | &mds_sessions_show_fops); | 277 | &mds_sessions_show_fops); |
286 | if (!fsc->debugfs_mds_sessions) | ||
287 | goto out; | ||
288 | 278 | ||
289 | fsc->debugfs_mdsc = debugfs_create_file("mdsc", | 279 | fsc->debugfs_mdsc = debugfs_create_file("mdsc", |
290 | 0400, | 280 | 0400, |
291 | fsc->client->debugfs_dir, | 281 | fsc->client->debugfs_dir, |
292 | fsc, | 282 | fsc, |
293 | &mdsc_show_fops); | 283 | &mdsc_show_fops); |
294 | if (!fsc->debugfs_mdsc) | ||
295 | goto out; | ||
296 | 284 | ||
297 | fsc->debugfs_caps = debugfs_create_file("caps", | 285 | fsc->debugfs_caps = debugfs_create_file("caps", |
298 | 0400, | 286 | 0400, |
299 | fsc->client->debugfs_dir, | 287 | fsc->client->debugfs_dir, |
300 | fsc, | 288 | fsc, |
301 | &caps_show_fops); | 289 | &caps_show_fops); |
302 | if (!fsc->debugfs_caps) | ||
303 | goto out; | ||
304 | |||
305 | return 0; | ||
306 | |||
307 | out: | ||
308 | ceph_fs_debugfs_cleanup(fsc); | ||
309 | return err; | ||
310 | } | 290 | } |
311 | 291 | ||
312 | 292 | ||
313 | #else /* CONFIG_DEBUG_FS */ | 293 | #else /* CONFIG_DEBUG_FS */ |
314 | 294 | ||
315 | int ceph_fs_debugfs_init(struct ceph_fs_client *fsc) | 295 | void ceph_fs_debugfs_init(struct ceph_fs_client *fsc) |
316 | { | 296 | { |
317 | return 0; | 297 | return 0; |
318 | } | 298 | } |
diff --git a/fs/ceph/super.c b/fs/ceph/super.c index d57fa60dcd43..ed1b65a6c2c3 100644 --- a/fs/ceph/super.c +++ b/fs/ceph/super.c | |||
@@ -937,9 +937,7 @@ static struct dentry *ceph_real_mount(struct ceph_fs_client *fsc) | |||
937 | dout("mount opening path %s\n", path); | 937 | dout("mount opening path %s\n", path); |
938 | } | 938 | } |
939 | 939 | ||
940 | err = ceph_fs_debugfs_init(fsc); | 940 | ceph_fs_debugfs_init(fsc); |
941 | if (err < 0) | ||
942 | goto out; | ||
943 | 941 | ||
944 | root = open_root_dentry(fsc, path, started); | 942 | root = open_root_dentry(fsc, path, started); |
945 | if (IS_ERR(root)) { | 943 | if (IS_ERR(root)) { |
diff --git a/fs/ceph/super.h b/fs/ceph/super.h index 5f27e1f7f2d6..fbe6869a3f95 100644 --- a/fs/ceph/super.h +++ b/fs/ceph/super.h | |||
@@ -1102,7 +1102,7 @@ extern int ceph_locks_to_pagelist(struct ceph_filelock *flocks, | |||
1102 | int num_fcntl_locks, int num_flock_locks); | 1102 | int num_fcntl_locks, int num_flock_locks); |
1103 | 1103 | ||
1104 | /* debugfs.c */ | 1104 | /* debugfs.c */ |
1105 | extern int ceph_fs_debugfs_init(struct ceph_fs_client *client); | 1105 | extern void ceph_fs_debugfs_init(struct ceph_fs_client *client); |
1106 | extern void ceph_fs_debugfs_cleanup(struct ceph_fs_client *client); | 1106 | extern void ceph_fs_debugfs_cleanup(struct ceph_fs_client *client); |
1107 | 1107 | ||
1108 | /* quota.c */ | 1108 | /* quota.c */ |
diff --git a/fs/debugfs/file.c b/fs/debugfs/file.c index ddd708b09fa1..93e4ca6b2ad7 100644 --- a/fs/debugfs/file.c +++ b/fs/debugfs/file.c | |||
@@ -997,25 +997,19 @@ static const struct file_operations u32_array_fops = { | |||
997 | * @array as data. If the @mode variable is so set it can be read from. | 997 | * @array as data. If the @mode variable is so set it can be read from. |
998 | * Writing is not supported. Seek within the file is also not supported. | 998 | * Writing is not supported. Seek within the file is also not supported. |
999 | * Once array is created its size can not be changed. | 999 | * Once array is created its size can not be changed. |
1000 | * | ||
1001 | * The function returns a pointer to dentry on success. If an error occurs, | ||
1002 | * %ERR_PTR(-ERROR) or NULL will be returned. If debugfs is not enabled in | ||
1003 | * the kernel, the value %ERR_PTR(-ENODEV) will be returned. | ||
1004 | */ | 1000 | */ |
1005 | struct dentry *debugfs_create_u32_array(const char *name, umode_t mode, | 1001 | void debugfs_create_u32_array(const char *name, umode_t mode, |
1006 | struct dentry *parent, | 1002 | struct dentry *parent, u32 *array, u32 elements) |
1007 | u32 *array, u32 elements) | ||
1008 | { | 1003 | { |
1009 | struct array_data *data = kmalloc(sizeof(*data), GFP_KERNEL); | 1004 | struct array_data *data = kmalloc(sizeof(*data), GFP_KERNEL); |
1010 | 1005 | ||
1011 | if (data == NULL) | 1006 | if (data == NULL) |
1012 | return NULL; | 1007 | return; |
1013 | 1008 | ||
1014 | data->array = array; | 1009 | data->array = array; |
1015 | data->elements = elements; | 1010 | data->elements = elements; |
1016 | 1011 | ||
1017 | return debugfs_create_file_unsafe(name, mode, parent, data, | 1012 | debugfs_create_file_unsafe(name, mode, parent, data, &u32_array_fops); |
1018 | &u32_array_fops); | ||
1019 | } | 1013 | } |
1020 | EXPORT_SYMBOL_GPL(debugfs_create_u32_array); | 1014 | EXPORT_SYMBOL_GPL(debugfs_create_u32_array); |
1021 | 1015 | ||
diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c index 1e444fe1f778..042b688ed124 100644 --- a/fs/debugfs/inode.c +++ b/fs/debugfs/inode.c | |||
@@ -2,13 +2,16 @@ | |||
2 | /* | 2 | /* |
3 | * inode.c - part of debugfs, a tiny little debug file system | 3 | * inode.c - part of debugfs, a tiny little debug file system |
4 | * | 4 | * |
5 | * Copyright (C) 2004 Greg Kroah-Hartman <greg@kroah.com> | 5 | * Copyright (C) 2004,2019 Greg Kroah-Hartman <greg@kroah.com> |
6 | * Copyright (C) 2004 IBM Inc. | 6 | * Copyright (C) 2004 IBM Inc. |
7 | * Copyright (C) 2019 Linux Foundation <gregkh@linuxfoundation.org> | ||
7 | * | 8 | * |
8 | * debugfs is for people to use instead of /proc or /sys. | 9 | * debugfs is for people to use instead of /proc or /sys. |
9 | * See ./Documentation/core-api/kernel-api.rst for more details. | 10 | * See ./Documentation/core-api/kernel-api.rst for more details. |
10 | */ | 11 | */ |
11 | 12 | ||
13 | #define pr_fmt(fmt) "debugfs: " fmt | ||
14 | |||
12 | #include <linux/module.h> | 15 | #include <linux/module.h> |
13 | #include <linux/fs.h> | 16 | #include <linux/fs.h> |
14 | #include <linux/mount.h> | 17 | #include <linux/mount.h> |
@@ -285,15 +288,17 @@ static struct dentry *start_creating(const char *name, struct dentry *parent) | |||
285 | struct dentry *dentry; | 288 | struct dentry *dentry; |
286 | int error; | 289 | int error; |
287 | 290 | ||
288 | pr_debug("debugfs: creating file '%s'\n",name); | 291 | pr_debug("creating file '%s'\n", name); |
289 | 292 | ||
290 | if (IS_ERR(parent)) | 293 | if (IS_ERR(parent)) |
291 | return parent; | 294 | return parent; |
292 | 295 | ||
293 | error = simple_pin_fs(&debug_fs_type, &debugfs_mount, | 296 | error = simple_pin_fs(&debug_fs_type, &debugfs_mount, |
294 | &debugfs_mount_count); | 297 | &debugfs_mount_count); |
295 | if (error) | 298 | if (error) { |
299 | pr_err("Unable to pin filesystem for file '%s'\n", name); | ||
296 | return ERR_PTR(error); | 300 | return ERR_PTR(error); |
301 | } | ||
297 | 302 | ||
298 | /* If the parent is not specified, we create it in the root. | 303 | /* If the parent is not specified, we create it in the root. |
299 | * We need the root dentry to do this, which is in the super | 304 | * We need the root dentry to do this, which is in the super |
@@ -306,6 +311,12 @@ static struct dentry *start_creating(const char *name, struct dentry *parent) | |||
306 | inode_lock(d_inode(parent)); | 311 | inode_lock(d_inode(parent)); |
307 | dentry = lookup_one_len(name, parent, strlen(name)); | 312 | dentry = lookup_one_len(name, parent, strlen(name)); |
308 | if (!IS_ERR(dentry) && d_really_is_positive(dentry)) { | 313 | if (!IS_ERR(dentry) && d_really_is_positive(dentry)) { |
314 | if (d_is_dir(dentry)) | ||
315 | pr_err("Directory '%s' with parent '%s' already present!\n", | ||
316 | name, parent->d_name.name); | ||
317 | else | ||
318 | pr_err("File '%s' in directory '%s' already present!\n", | ||
319 | name, parent->d_name.name); | ||
309 | dput(dentry); | 320 | dput(dentry); |
310 | dentry = ERR_PTR(-EEXIST); | 321 | dentry = ERR_PTR(-EEXIST); |
311 | } | 322 | } |
@@ -349,8 +360,11 @@ static struct dentry *__debugfs_create_file(const char *name, umode_t mode, | |||
349 | return dentry; | 360 | return dentry; |
350 | 361 | ||
351 | inode = debugfs_get_inode(dentry->d_sb); | 362 | inode = debugfs_get_inode(dentry->d_sb); |
352 | if (unlikely(!inode)) | 363 | if (unlikely(!inode)) { |
364 | pr_err("out of free dentries, can not create file '%s'\n", | ||
365 | name); | ||
353 | return failed_creating(dentry); | 366 | return failed_creating(dentry); |
367 | } | ||
354 | 368 | ||
355 | inode->i_mode = mode; | 369 | inode->i_mode = mode; |
356 | inode->i_private = data; | 370 | inode->i_private = data; |
@@ -511,8 +525,11 @@ struct dentry *debugfs_create_dir(const char *name, struct dentry *parent) | |||
511 | return dentry; | 525 | return dentry; |
512 | 526 | ||
513 | inode = debugfs_get_inode(dentry->d_sb); | 527 | inode = debugfs_get_inode(dentry->d_sb); |
514 | if (unlikely(!inode)) | 528 | if (unlikely(!inode)) { |
529 | pr_err("out of free dentries, can not create directory '%s'\n", | ||
530 | name); | ||
515 | return failed_creating(dentry); | 531 | return failed_creating(dentry); |
532 | } | ||
516 | 533 | ||
517 | inode->i_mode = S_IFDIR | S_IRWXU | S_IRUGO | S_IXUGO; | 534 | inode->i_mode = S_IFDIR | S_IRWXU | S_IRUGO | S_IXUGO; |
518 | inode->i_op = &simple_dir_inode_operations; | 535 | inode->i_op = &simple_dir_inode_operations; |
@@ -550,8 +567,11 @@ struct dentry *debugfs_create_automount(const char *name, | |||
550 | return dentry; | 567 | return dentry; |
551 | 568 | ||
552 | inode = debugfs_get_inode(dentry->d_sb); | 569 | inode = debugfs_get_inode(dentry->d_sb); |
553 | if (unlikely(!inode)) | 570 | if (unlikely(!inode)) { |
571 | pr_err("out of free dentries, can not create automount '%s'\n", | ||
572 | name); | ||
554 | return failed_creating(dentry); | 573 | return failed_creating(dentry); |
574 | } | ||
555 | 575 | ||
556 | make_empty_dir_inode(inode); | 576 | make_empty_dir_inode(inode); |
557 | inode->i_flags |= S_AUTOMOUNT; | 577 | inode->i_flags |= S_AUTOMOUNT; |
@@ -606,6 +626,8 @@ struct dentry *debugfs_create_symlink(const char *name, struct dentry *parent, | |||
606 | 626 | ||
607 | inode = debugfs_get_inode(dentry->d_sb); | 627 | inode = debugfs_get_inode(dentry->d_sb); |
608 | if (unlikely(!inode)) { | 628 | if (unlikely(!inode)) { |
629 | pr_err("out of free dentries, can not create symlink '%s'\n", | ||
630 | name); | ||
609 | kfree(link); | 631 | kfree(link); |
610 | return failed_creating(dentry); | 632 | return failed_creating(dentry); |
611 | } | 633 | } |
diff --git a/fs/dlm/lockspace.c b/fs/dlm/lockspace.c index 4c2c85a223ac..afb8340918b8 100644 --- a/fs/dlm/lockspace.c +++ b/fs/dlm/lockspace.c | |||
@@ -158,6 +158,7 @@ static struct attribute *dlm_attrs[] = { | |||
158 | &dlm_attr_recover_nodeid.attr, | 158 | &dlm_attr_recover_nodeid.attr, |
159 | NULL, | 159 | NULL, |
160 | }; | 160 | }; |
161 | ATTRIBUTE_GROUPS(dlm); | ||
161 | 162 | ||
162 | static ssize_t dlm_attr_show(struct kobject *kobj, struct attribute *attr, | 163 | static ssize_t dlm_attr_show(struct kobject *kobj, struct attribute *attr, |
163 | char *buf) | 164 | char *buf) |
@@ -187,7 +188,7 @@ static const struct sysfs_ops dlm_attr_ops = { | |||
187 | }; | 188 | }; |
188 | 189 | ||
189 | static struct kobj_type dlm_ktype = { | 190 | static struct kobj_type dlm_ktype = { |
190 | .default_attrs = dlm_attrs, | 191 | .default_groups = dlm_groups, |
191 | .sysfs_ops = &dlm_attr_ops, | 192 | .sysfs_ops = &dlm_attr_ops, |
192 | .release = lockspace_kobj_release, | 193 | .release = lockspace_kobj_release, |
193 | }; | 194 | }; |
diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c index 729f46a3c9ee..5c85166677d4 100644 --- a/fs/f2fs/sysfs.c +++ b/fs/f2fs/sysfs.c | |||
@@ -501,6 +501,7 @@ static struct attribute *f2fs_attrs[] = { | |||
501 | ATTR_LIST(current_reserved_blocks), | 501 | ATTR_LIST(current_reserved_blocks), |
502 | NULL, | 502 | NULL, |
503 | }; | 503 | }; |
504 | ATTRIBUTE_GROUPS(f2fs); | ||
504 | 505 | ||
505 | static struct attribute *f2fs_feat_attrs[] = { | 506 | static struct attribute *f2fs_feat_attrs[] = { |
506 | #ifdef CONFIG_FS_ENCRYPTION | 507 | #ifdef CONFIG_FS_ENCRYPTION |
@@ -520,6 +521,7 @@ static struct attribute *f2fs_feat_attrs[] = { | |||
520 | ATTR_LIST(sb_checksum), | 521 | ATTR_LIST(sb_checksum), |
521 | NULL, | 522 | NULL, |
522 | }; | 523 | }; |
524 | ATTRIBUTE_GROUPS(f2fs_feat); | ||
523 | 525 | ||
524 | static const struct sysfs_ops f2fs_attr_ops = { | 526 | static const struct sysfs_ops f2fs_attr_ops = { |
525 | .show = f2fs_attr_show, | 527 | .show = f2fs_attr_show, |
@@ -527,7 +529,7 @@ static const struct sysfs_ops f2fs_attr_ops = { | |||
527 | }; | 529 | }; |
528 | 530 | ||
529 | static struct kobj_type f2fs_sb_ktype = { | 531 | static struct kobj_type f2fs_sb_ktype = { |
530 | .default_attrs = f2fs_attrs, | 532 | .default_groups = f2fs_groups, |
531 | .sysfs_ops = &f2fs_attr_ops, | 533 | .sysfs_ops = &f2fs_attr_ops, |
532 | .release = f2fs_sb_release, | 534 | .release = f2fs_sb_release, |
533 | }; | 535 | }; |
@@ -541,7 +543,7 @@ static struct kset f2fs_kset = { | |||
541 | }; | 543 | }; |
542 | 544 | ||
543 | static struct kobj_type f2fs_feat_ktype = { | 545 | static struct kobj_type f2fs_feat_ktype = { |
544 | .default_attrs = f2fs_feat_attrs, | 546 | .default_groups = f2fs_feat_groups, |
545 | .sysfs_ops = &f2fs_attr_ops, | 547 | .sysfs_ops = &f2fs_attr_ops, |
546 | }; | 548 | }; |
547 | 549 | ||
diff --git a/fs/gfs2/sys.c b/fs/gfs2/sys.c index 289328831e24..dd15b8e4af2c 100644 --- a/fs/gfs2/sys.c +++ b/fs/gfs2/sys.c | |||
@@ -296,6 +296,7 @@ static struct attribute *gfs2_attrs[] = { | |||
296 | &gfs2_attr_demote_rq.attr, | 296 | &gfs2_attr_demote_rq.attr, |
297 | NULL, | 297 | NULL, |
298 | }; | 298 | }; |
299 | ATTRIBUTE_GROUPS(gfs2); | ||
299 | 300 | ||
300 | static void gfs2_sbd_release(struct kobject *kobj) | 301 | static void gfs2_sbd_release(struct kobject *kobj) |
301 | { | 302 | { |
@@ -306,7 +307,7 @@ static void gfs2_sbd_release(struct kobject *kobj) | |||
306 | 307 | ||
307 | static struct kobj_type gfs2_ktype = { | 308 | static struct kobj_type gfs2_ktype = { |
308 | .release = gfs2_sbd_release, | 309 | .release = gfs2_sbd_release, |
309 | .default_attrs = gfs2_attrs, | 310 | .default_groups = gfs2_groups, |
310 | .sysfs_ops = &gfs2_attr_ops, | 311 | .sysfs_ops = &gfs2_attr_ops, |
311 | }; | 312 | }; |
312 | 313 | ||
diff --git a/fs/nfsd/fault_inject.c b/fs/nfsd/fault_inject.c index 84831253203d..76bee0a0d308 100644 --- a/fs/nfsd/fault_inject.c +++ b/fs/nfsd/fault_inject.c | |||
@@ -127,24 +127,16 @@ static struct nfsd_fault_inject_op inject_ops[] = { | |||
127 | }, | 127 | }, |
128 | }; | 128 | }; |
129 | 129 | ||
130 | int nfsd_fault_inject_init(void) | 130 | void nfsd_fault_inject_init(void) |
131 | { | 131 | { |
132 | unsigned int i; | 132 | unsigned int i; |
133 | struct nfsd_fault_inject_op *op; | 133 | struct nfsd_fault_inject_op *op; |
134 | umode_t mode = S_IFREG | S_IRUSR | S_IWUSR; | 134 | umode_t mode = S_IFREG | S_IRUSR | S_IWUSR; |
135 | 135 | ||
136 | debug_dir = debugfs_create_dir("nfsd", NULL); | 136 | debug_dir = debugfs_create_dir("nfsd", NULL); |
137 | if (!debug_dir) | ||
138 | goto fail; | ||
139 | 137 | ||
140 | for (i = 0; i < ARRAY_SIZE(inject_ops); i++) { | 138 | for (i = 0; i < ARRAY_SIZE(inject_ops); i++) { |
141 | op = &inject_ops[i]; | 139 | op = &inject_ops[i]; |
142 | if (!debugfs_create_file(op->file, mode, debug_dir, op, &fops_nfsd)) | 140 | debugfs_create_file(op->file, mode, debug_dir, op, &fops_nfsd); |
143 | goto fail; | ||
144 | } | 141 | } |
145 | return 0; | ||
146 | |||
147 | fail: | ||
148 | nfsd_fault_inject_cleanup(); | ||
149 | return -ENOMEM; | ||
150 | } | 142 | } |
diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c index 72fad54fc7e5..0a9a49ded546 100644 --- a/fs/nfsd/nfsctl.c +++ b/fs/nfsd/nfsctl.c | |||
@@ -1514,9 +1514,7 @@ static int __init init_nfsd(void) | |||
1514 | retval = nfsd4_init_pnfs(); | 1514 | retval = nfsd4_init_pnfs(); |
1515 | if (retval) | 1515 | if (retval) |
1516 | goto out_free_slabs; | 1516 | goto out_free_slabs; |
1517 | retval = nfsd_fault_inject_init(); /* nfsd fault injection controls */ | 1517 | nfsd_fault_inject_init(); /* nfsd fault injection controls */ |
1518 | if (retval) | ||
1519 | goto out_exit_pnfs; | ||
1520 | nfsd_stat_init(); /* Statistics */ | 1518 | nfsd_stat_init(); /* Statistics */ |
1521 | nfsd_lockd_init(); /* lockd->nfsd callbacks */ | 1519 | nfsd_lockd_init(); /* lockd->nfsd callbacks */ |
1522 | retval = create_proc_exports_entry(); | 1520 | retval = create_proc_exports_entry(); |
@@ -1533,7 +1531,6 @@ out_free_lockd: | |||
1533 | nfsd_lockd_shutdown(); | 1531 | nfsd_lockd_shutdown(); |
1534 | nfsd_stat_shutdown(); | 1532 | nfsd_stat_shutdown(); |
1535 | nfsd_fault_inject_cleanup(); | 1533 | nfsd_fault_inject_cleanup(); |
1536 | out_exit_pnfs: | ||
1537 | nfsd4_exit_pnfs(); | 1534 | nfsd4_exit_pnfs(); |
1538 | out_free_slabs: | 1535 | out_free_slabs: |
1539 | nfsd4_free_slabs(); | 1536 | nfsd4_free_slabs(); |
diff --git a/fs/nfsd/state.h b/fs/nfsd/state.h index 8cb20cab012b..5dbd16946e8e 100644 --- a/fs/nfsd/state.h +++ b/fs/nfsd/state.h | |||
@@ -672,7 +672,7 @@ extern void nfsd4_record_grace_done(struct nfsd_net *nn); | |||
672 | 672 | ||
673 | /* nfs fault injection functions */ | 673 | /* nfs fault injection functions */ |
674 | #ifdef CONFIG_NFSD_FAULT_INJECTION | 674 | #ifdef CONFIG_NFSD_FAULT_INJECTION |
675 | int nfsd_fault_inject_init(void); | 675 | void nfsd_fault_inject_init(void); |
676 | void nfsd_fault_inject_cleanup(void); | 676 | void nfsd_fault_inject_cleanup(void); |
677 | 677 | ||
678 | u64 nfsd_inject_print_clients(void); | 678 | u64 nfsd_inject_print_clients(void); |
@@ -693,7 +693,7 @@ u64 nfsd_inject_forget_delegations(u64); | |||
693 | u64 nfsd_inject_recall_client_delegations(struct sockaddr_storage *, size_t); | 693 | u64 nfsd_inject_recall_client_delegations(struct sockaddr_storage *, size_t); |
694 | u64 nfsd_inject_recall_delegations(u64); | 694 | u64 nfsd_inject_recall_delegations(u64); |
695 | #else /* CONFIG_NFSD_FAULT_INJECTION */ | 695 | #else /* CONFIG_NFSD_FAULT_INJECTION */ |
696 | static inline int nfsd_fault_inject_init(void) { return 0; } | 696 | static inline void nfsd_fault_inject_init(void) {} |
697 | static inline void nfsd_fault_inject_cleanup(void) {} | 697 | static inline void nfsd_fault_inject_cleanup(void) {} |
698 | #endif /* CONFIG_NFSD_FAULT_INJECTION */ | 698 | #endif /* CONFIG_NFSD_FAULT_INJECTION */ |
699 | 699 | ||
diff --git a/fs/orangefs/orangefs-debugfs.c b/fs/orangefs/orangefs-debugfs.c index 87b1a6fce628..25543a966c48 100644 --- a/fs/orangefs/orangefs-debugfs.c +++ b/fs/orangefs/orangefs-debugfs.c | |||
@@ -64,7 +64,7 @@ struct client_debug_mask { | |||
64 | __u64 mask2; | 64 | __u64 mask2; |
65 | }; | 65 | }; |
66 | 66 | ||
67 | static int orangefs_kernel_debug_init(void); | 67 | static void orangefs_kernel_debug_init(void); |
68 | 68 | ||
69 | static int orangefs_debug_help_open(struct inode *, struct file *); | 69 | static int orangefs_debug_help_open(struct inode *, struct file *); |
70 | static void *help_start(struct seq_file *, loff_t *); | 70 | static void *help_start(struct seq_file *, loff_t *); |
@@ -99,7 +99,6 @@ static char *debug_help_string; | |||
99 | static char client_debug_string[ORANGEFS_MAX_DEBUG_STRING_LEN]; | 99 | static char client_debug_string[ORANGEFS_MAX_DEBUG_STRING_LEN]; |
100 | static char client_debug_array_string[ORANGEFS_MAX_DEBUG_STRING_LEN]; | 100 | static char client_debug_array_string[ORANGEFS_MAX_DEBUG_STRING_LEN]; |
101 | 101 | ||
102 | static struct dentry *help_file_dentry; | ||
103 | static struct dentry *client_debug_dentry; | 102 | static struct dentry *client_debug_dentry; |
104 | static struct dentry *debug_dir; | 103 | static struct dentry *debug_dir; |
105 | 104 | ||
@@ -151,10 +150,8 @@ static DEFINE_MUTEX(orangefs_help_file_lock); | |||
151 | * initialize kmod debug operations, create orangefs debugfs dir and | 150 | * initialize kmod debug operations, create orangefs debugfs dir and |
152 | * ORANGEFS_KMOD_DEBUG_HELP_FILE. | 151 | * ORANGEFS_KMOD_DEBUG_HELP_FILE. |
153 | */ | 152 | */ |
154 | int orangefs_debugfs_init(int debug_mask) | 153 | void orangefs_debugfs_init(int debug_mask) |
155 | { | 154 | { |
156 | int rc = -ENOMEM; | ||
157 | |||
158 | /* convert input debug mask to a 64-bit unsigned integer */ | 155 | /* convert input debug mask to a 64-bit unsigned integer */ |
159 | orangefs_gossip_debug_mask = (unsigned long long)debug_mask; | 156 | orangefs_gossip_debug_mask = (unsigned long long)debug_mask; |
160 | 157 | ||
@@ -183,37 +180,21 @@ int orangefs_debugfs_init(int debug_mask) | |||
183 | (unsigned long long)orangefs_gossip_debug_mask); | 180 | (unsigned long long)orangefs_gossip_debug_mask); |
184 | 181 | ||
185 | debug_dir = debugfs_create_dir("orangefs", NULL); | 182 | debug_dir = debugfs_create_dir("orangefs", NULL); |
186 | if (!debug_dir) { | ||
187 | pr_info("%s: debugfs_create_dir failed.\n", __func__); | ||
188 | goto out; | ||
189 | } | ||
190 | 183 | ||
191 | help_file_dentry = debugfs_create_file(ORANGEFS_KMOD_DEBUG_HELP_FILE, | 184 | debugfs_create_file(ORANGEFS_KMOD_DEBUG_HELP_FILE, 0444, debug_dir, |
192 | 0444, | 185 | debug_help_string, &debug_help_fops); |
193 | debug_dir, | ||
194 | debug_help_string, | ||
195 | &debug_help_fops); | ||
196 | if (!help_file_dentry) { | ||
197 | pr_info("%s: debugfs_create_file failed.\n", __func__); | ||
198 | goto out; | ||
199 | } | ||
200 | 186 | ||
201 | orangefs_debug_disabled = 0; | 187 | orangefs_debug_disabled = 0; |
202 | 188 | ||
203 | rc = orangefs_kernel_debug_init(); | 189 | orangefs_kernel_debug_init(); |
204 | |||
205 | out: | ||
206 | |||
207 | return rc; | ||
208 | } | 190 | } |
209 | 191 | ||
210 | /* | 192 | /* |
211 | * initialize the kernel-debug file. | 193 | * initialize the kernel-debug file. |
212 | */ | 194 | */ |
213 | static int orangefs_kernel_debug_init(void) | 195 | static void orangefs_kernel_debug_init(void) |
214 | { | 196 | { |
215 | int rc = -ENOMEM; | 197 | int rc = -ENOMEM; |
216 | struct dentry *ret; | ||
217 | char *k_buffer = NULL; | 198 | char *k_buffer = NULL; |
218 | 199 | ||
219 | gossip_debug(GOSSIP_DEBUGFS_DEBUG, "%s: start\n", __func__); | 200 | gossip_debug(GOSSIP_DEBUGFS_DEBUG, "%s: start\n", __func__); |
@@ -230,24 +211,11 @@ static int orangefs_kernel_debug_init(void) | |||
230 | pr_info("%s: overflow 1!\n", __func__); | 211 | pr_info("%s: overflow 1!\n", __func__); |
231 | } | 212 | } |
232 | 213 | ||
233 | ret = debugfs_create_file(ORANGEFS_KMOD_DEBUG_FILE, | 214 | debugfs_create_file(ORANGEFS_KMOD_DEBUG_FILE, 0444, debug_dir, k_buffer, |
234 | 0444, | 215 | &kernel_debug_fops); |
235 | debug_dir, | ||
236 | k_buffer, | ||
237 | &kernel_debug_fops); | ||
238 | if (!ret) { | ||
239 | pr_info("%s: failed to create %s.\n", | ||
240 | __func__, | ||
241 | ORANGEFS_KMOD_DEBUG_FILE); | ||
242 | goto out; | ||
243 | } | ||
244 | |||
245 | rc = 0; | ||
246 | 216 | ||
247 | out: | 217 | out: |
248 | |||
249 | gossip_debug(GOSSIP_DEBUGFS_DEBUG, "%s: rc:%d:\n", __func__, rc); | 218 | gossip_debug(GOSSIP_DEBUGFS_DEBUG, "%s: rc:%d:\n", __func__, rc); |
250 | return rc; | ||
251 | } | 219 | } |
252 | 220 | ||
253 | 221 | ||
@@ -353,12 +321,6 @@ static int orangefs_client_debug_init(void) | |||
353 | debug_dir, | 321 | debug_dir, |
354 | c_buffer, | 322 | c_buffer, |
355 | &kernel_debug_fops); | 323 | &kernel_debug_fops); |
356 | if (!client_debug_dentry) { | ||
357 | pr_info("%s: failed to create updated %s.\n", | ||
358 | __func__, | ||
359 | ORANGEFS_CLIENT_DEBUG_FILE); | ||
360 | goto out; | ||
361 | } | ||
362 | 324 | ||
363 | rc = 0; | 325 | rc = 0; |
364 | 326 | ||
diff --git a/fs/orangefs/orangefs-debugfs.h b/fs/orangefs/orangefs-debugfs.h index 51147f9ce3d6..502f6dedccde 100644 --- a/fs/orangefs/orangefs-debugfs.h +++ b/fs/orangefs/orangefs-debugfs.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
2 | int orangefs_debugfs_init(int); | 2 | void orangefs_debugfs_init(int); |
3 | void orangefs_debugfs_cleanup(void); | 3 | void orangefs_debugfs_cleanup(void); |
4 | int orangefs_prepare_debugfs_help_string(int); | 4 | int orangefs_prepare_debugfs_help_string(int); |
5 | int orangefs_debugfs_new_client_mask(void __user *); | 5 | int orangefs_debugfs_new_client_mask(void __user *); |
diff --git a/fs/orangefs/orangefs-mod.c b/fs/orangefs/orangefs-mod.c index 4f2d7ee0d2d1..c010c1fddafc 100644 --- a/fs/orangefs/orangefs-mod.c +++ b/fs/orangefs/orangefs-mod.c | |||
@@ -129,9 +129,7 @@ static int __init orangefs_init(void) | |||
129 | if (ret) | 129 | if (ret) |
130 | goto cleanup_key_table; | 130 | goto cleanup_key_table; |
131 | 131 | ||
132 | ret = orangefs_debugfs_init(module_parm_debug_mask); | 132 | orangefs_debugfs_init(module_parm_debug_mask); |
133 | if (ret) | ||
134 | goto debugfs_init_failed; | ||
135 | 133 | ||
136 | ret = orangefs_sysfs_init(); | 134 | ret = orangefs_sysfs_init(); |
137 | if (ret) | 135 | if (ret) |
@@ -161,8 +159,6 @@ cleanup_device: | |||
161 | orangefs_dev_cleanup(); | 159 | orangefs_dev_cleanup(); |
162 | 160 | ||
163 | sysfs_init_failed: | 161 | sysfs_init_failed: |
164 | |||
165 | debugfs_init_failed: | ||
166 | orangefs_debugfs_cleanup(); | 162 | orangefs_debugfs_cleanup(); |
167 | 163 | ||
168 | cleanup_key_table: | 164 | cleanup_key_table: |
diff --git a/fs/ubifs/debug.c b/fs/ubifs/debug.c index 138c5b07d803..a5f10d79e0dd 100644 --- a/fs/ubifs/debug.c +++ b/fs/ubifs/debug.c | |||
@@ -2800,115 +2800,69 @@ static const struct file_operations dfs_fops = { | |||
2800 | * dbg_debugfs_init_fs - initialize debugfs for UBIFS instance. | 2800 | * dbg_debugfs_init_fs - initialize debugfs for UBIFS instance. |
2801 | * @c: UBIFS file-system description object | 2801 | * @c: UBIFS file-system description object |
2802 | * | 2802 | * |
2803 | * This function creates all debugfs files for this instance of UBIFS. Returns | 2803 | * This function creates all debugfs files for this instance of UBIFS. |
2804 | * zero in case of success and a negative error code in case of failure. | ||
2805 | * | 2804 | * |
2806 | * Note, the only reason we have not merged this function with the | 2805 | * Note, the only reason we have not merged this function with the |
2807 | * 'ubifs_debugging_init()' function is because it is better to initialize | 2806 | * 'ubifs_debugging_init()' function is because it is better to initialize |
2808 | * debugfs interfaces at the very end of the mount process, and remove them at | 2807 | * debugfs interfaces at the very end of the mount process, and remove them at |
2809 | * the very beginning of the mount process. | 2808 | * the very beginning of the mount process. |
2810 | */ | 2809 | */ |
2811 | int dbg_debugfs_init_fs(struct ubifs_info *c) | 2810 | void dbg_debugfs_init_fs(struct ubifs_info *c) |
2812 | { | 2811 | { |
2813 | int err, n; | 2812 | int n; |
2814 | const char *fname; | 2813 | const char *fname; |
2815 | struct dentry *dent; | ||
2816 | struct ubifs_debug_info *d = c->dbg; | 2814 | struct ubifs_debug_info *d = c->dbg; |
2817 | 2815 | ||
2818 | if (!IS_ENABLED(CONFIG_DEBUG_FS)) | ||
2819 | return 0; | ||
2820 | |||
2821 | n = snprintf(d->dfs_dir_name, UBIFS_DFS_DIR_LEN + 1, UBIFS_DFS_DIR_NAME, | 2816 | n = snprintf(d->dfs_dir_name, UBIFS_DFS_DIR_LEN + 1, UBIFS_DFS_DIR_NAME, |
2822 | c->vi.ubi_num, c->vi.vol_id); | 2817 | c->vi.ubi_num, c->vi.vol_id); |
2823 | if (n == UBIFS_DFS_DIR_LEN) { | 2818 | if (n == UBIFS_DFS_DIR_LEN) { |
2824 | /* The array size is too small */ | 2819 | /* The array size is too small */ |
2825 | fname = UBIFS_DFS_DIR_NAME; | 2820 | fname = UBIFS_DFS_DIR_NAME; |
2826 | dent = ERR_PTR(-EINVAL); | 2821 | return; |
2827 | goto out; | ||
2828 | } | 2822 | } |
2829 | 2823 | ||
2830 | fname = d->dfs_dir_name; | 2824 | fname = d->dfs_dir_name; |
2831 | dent = debugfs_create_dir(fname, dfs_rootdir); | 2825 | d->dfs_dir = debugfs_create_dir(fname, dfs_rootdir); |
2832 | if (IS_ERR_OR_NULL(dent)) | ||
2833 | goto out; | ||
2834 | d->dfs_dir = dent; | ||
2835 | 2826 | ||
2836 | fname = "dump_lprops"; | 2827 | fname = "dump_lprops"; |
2837 | dent = debugfs_create_file(fname, S_IWUSR, d->dfs_dir, c, &dfs_fops); | 2828 | d->dfs_dump_lprops = debugfs_create_file(fname, S_IWUSR, d->dfs_dir, c, |
2838 | if (IS_ERR_OR_NULL(dent)) | 2829 | &dfs_fops); |
2839 | goto out_remove; | ||
2840 | d->dfs_dump_lprops = dent; | ||
2841 | 2830 | ||
2842 | fname = "dump_budg"; | 2831 | fname = "dump_budg"; |
2843 | dent = debugfs_create_file(fname, S_IWUSR, d->dfs_dir, c, &dfs_fops); | 2832 | d->dfs_dump_budg = debugfs_create_file(fname, S_IWUSR, d->dfs_dir, c, |
2844 | if (IS_ERR_OR_NULL(dent)) | 2833 | &dfs_fops); |
2845 | goto out_remove; | ||
2846 | d->dfs_dump_budg = dent; | ||
2847 | 2834 | ||
2848 | fname = "dump_tnc"; | 2835 | fname = "dump_tnc"; |
2849 | dent = debugfs_create_file(fname, S_IWUSR, d->dfs_dir, c, &dfs_fops); | 2836 | d->dfs_dump_tnc = debugfs_create_file(fname, S_IWUSR, d->dfs_dir, c, |
2850 | if (IS_ERR_OR_NULL(dent)) | 2837 | &dfs_fops); |
2851 | goto out_remove; | ||
2852 | d->dfs_dump_tnc = dent; | ||
2853 | 2838 | ||
2854 | fname = "chk_general"; | 2839 | fname = "chk_general"; |
2855 | dent = debugfs_create_file(fname, S_IRUSR | S_IWUSR, d->dfs_dir, c, | 2840 | d->dfs_chk_gen = debugfs_create_file(fname, S_IRUSR | S_IWUSR, |
2856 | &dfs_fops); | 2841 | d->dfs_dir, c, &dfs_fops); |
2857 | if (IS_ERR_OR_NULL(dent)) | ||
2858 | goto out_remove; | ||
2859 | d->dfs_chk_gen = dent; | ||
2860 | 2842 | ||
2861 | fname = "chk_index"; | 2843 | fname = "chk_index"; |
2862 | dent = debugfs_create_file(fname, S_IRUSR | S_IWUSR, d->dfs_dir, c, | 2844 | d->dfs_chk_index = debugfs_create_file(fname, S_IRUSR | S_IWUSR, |
2863 | &dfs_fops); | 2845 | d->dfs_dir, c, &dfs_fops); |
2864 | if (IS_ERR_OR_NULL(dent)) | ||
2865 | goto out_remove; | ||
2866 | d->dfs_chk_index = dent; | ||
2867 | 2846 | ||
2868 | fname = "chk_orphans"; | 2847 | fname = "chk_orphans"; |
2869 | dent = debugfs_create_file(fname, S_IRUSR | S_IWUSR, d->dfs_dir, c, | 2848 | d->dfs_chk_orph = debugfs_create_file(fname, S_IRUSR | S_IWUSR, |
2870 | &dfs_fops); | 2849 | d->dfs_dir, c, &dfs_fops); |
2871 | if (IS_ERR_OR_NULL(dent)) | ||
2872 | goto out_remove; | ||
2873 | d->dfs_chk_orph = dent; | ||
2874 | 2850 | ||
2875 | fname = "chk_lprops"; | 2851 | fname = "chk_lprops"; |
2876 | dent = debugfs_create_file(fname, S_IRUSR | S_IWUSR, d->dfs_dir, c, | 2852 | d->dfs_chk_lprops = debugfs_create_file(fname, S_IRUSR | S_IWUSR, |
2877 | &dfs_fops); | 2853 | d->dfs_dir, c, &dfs_fops); |
2878 | if (IS_ERR_OR_NULL(dent)) | ||
2879 | goto out_remove; | ||
2880 | d->dfs_chk_lprops = dent; | ||
2881 | 2854 | ||
2882 | fname = "chk_fs"; | 2855 | fname = "chk_fs"; |
2883 | dent = debugfs_create_file(fname, S_IRUSR | S_IWUSR, d->dfs_dir, c, | 2856 | d->dfs_chk_fs = debugfs_create_file(fname, S_IRUSR | S_IWUSR, |
2884 | &dfs_fops); | 2857 | d->dfs_dir, c, &dfs_fops); |
2885 | if (IS_ERR_OR_NULL(dent)) | ||
2886 | goto out_remove; | ||
2887 | d->dfs_chk_fs = dent; | ||
2888 | 2858 | ||
2889 | fname = "tst_recovery"; | 2859 | fname = "tst_recovery"; |
2890 | dent = debugfs_create_file(fname, S_IRUSR | S_IWUSR, d->dfs_dir, c, | 2860 | d->dfs_tst_rcvry = debugfs_create_file(fname, S_IRUSR | S_IWUSR, |
2891 | &dfs_fops); | 2861 | d->dfs_dir, c, &dfs_fops); |
2892 | if (IS_ERR_OR_NULL(dent)) | ||
2893 | goto out_remove; | ||
2894 | d->dfs_tst_rcvry = dent; | ||
2895 | 2862 | ||
2896 | fname = "ro_error"; | 2863 | fname = "ro_error"; |
2897 | dent = debugfs_create_file(fname, S_IRUSR | S_IWUSR, d->dfs_dir, c, | 2864 | d->dfs_ro_error = debugfs_create_file(fname, S_IRUSR | S_IWUSR, |
2898 | &dfs_fops); | 2865 | d->dfs_dir, c, &dfs_fops); |
2899 | if (IS_ERR_OR_NULL(dent)) | ||
2900 | goto out_remove; | ||
2901 | d->dfs_ro_error = dent; | ||
2902 | |||
2903 | return 0; | ||
2904 | |||
2905 | out_remove: | ||
2906 | debugfs_remove_recursive(d->dfs_dir); | ||
2907 | out: | ||
2908 | err = dent ? PTR_ERR(dent) : -ENODEV; | ||
2909 | ubifs_err(c, "cannot create \"%s\" debugfs file or directory, error %d\n", | ||
2910 | fname, err); | ||
2911 | return err; | ||
2912 | } | 2866 | } |
2913 | 2867 | ||
2914 | /** | 2868 | /** |
@@ -2917,8 +2871,7 @@ out: | |||
2917 | */ | 2871 | */ |
2918 | void dbg_debugfs_exit_fs(struct ubifs_info *c) | 2872 | void dbg_debugfs_exit_fs(struct ubifs_info *c) |
2919 | { | 2873 | { |
2920 | if (IS_ENABLED(CONFIG_DEBUG_FS)) | 2874 | debugfs_remove_recursive(c->dbg->dfs_dir); |
2921 | debugfs_remove_recursive(c->dbg->dfs_dir); | ||
2922 | } | 2875 | } |
2923 | 2876 | ||
2924 | struct ubifs_global_debug_info ubifs_dbg; | 2877 | struct ubifs_global_debug_info ubifs_dbg; |
@@ -2994,75 +2947,38 @@ static const struct file_operations dfs_global_fops = { | |||
2994 | * | 2947 | * |
2995 | * UBIFS uses debugfs file-system to expose various debugging knobs to | 2948 | * UBIFS uses debugfs file-system to expose various debugging knobs to |
2996 | * user-space. This function creates "ubifs" directory in the debugfs | 2949 | * user-space. This function creates "ubifs" directory in the debugfs |
2997 | * file-system. Returns zero in case of success and a negative error code in | 2950 | * file-system. |
2998 | * case of failure. | ||
2999 | */ | 2951 | */ |
3000 | int dbg_debugfs_init(void) | 2952 | void dbg_debugfs_init(void) |
3001 | { | 2953 | { |
3002 | int err; | ||
3003 | const char *fname; | 2954 | const char *fname; |
3004 | struct dentry *dent; | ||
3005 | |||
3006 | if (!IS_ENABLED(CONFIG_DEBUG_FS)) | ||
3007 | return 0; | ||
3008 | 2955 | ||
3009 | fname = "ubifs"; | 2956 | fname = "ubifs"; |
3010 | dent = debugfs_create_dir(fname, NULL); | 2957 | dfs_rootdir = debugfs_create_dir(fname, NULL); |
3011 | if (IS_ERR_OR_NULL(dent)) | ||
3012 | goto out; | ||
3013 | dfs_rootdir = dent; | ||
3014 | 2958 | ||
3015 | fname = "chk_general"; | 2959 | fname = "chk_general"; |
3016 | dent = debugfs_create_file(fname, S_IRUSR | S_IWUSR, dfs_rootdir, NULL, | 2960 | dfs_chk_gen = debugfs_create_file(fname, S_IRUSR | S_IWUSR, dfs_rootdir, |
3017 | &dfs_global_fops); | 2961 | NULL, &dfs_global_fops); |
3018 | if (IS_ERR_OR_NULL(dent)) | ||
3019 | goto out_remove; | ||
3020 | dfs_chk_gen = dent; | ||
3021 | 2962 | ||
3022 | fname = "chk_index"; | 2963 | fname = "chk_index"; |
3023 | dent = debugfs_create_file(fname, S_IRUSR | S_IWUSR, dfs_rootdir, NULL, | 2964 | dfs_chk_index = debugfs_create_file(fname, S_IRUSR | S_IWUSR, |
3024 | &dfs_global_fops); | 2965 | dfs_rootdir, NULL, &dfs_global_fops); |
3025 | if (IS_ERR_OR_NULL(dent)) | ||
3026 | goto out_remove; | ||
3027 | dfs_chk_index = dent; | ||
3028 | 2966 | ||
3029 | fname = "chk_orphans"; | 2967 | fname = "chk_orphans"; |
3030 | dent = debugfs_create_file(fname, S_IRUSR | S_IWUSR, dfs_rootdir, NULL, | 2968 | dfs_chk_orph = debugfs_create_file(fname, S_IRUSR | S_IWUSR, |
3031 | &dfs_global_fops); | 2969 | dfs_rootdir, NULL, &dfs_global_fops); |
3032 | if (IS_ERR_OR_NULL(dent)) | ||
3033 | goto out_remove; | ||
3034 | dfs_chk_orph = dent; | ||
3035 | 2970 | ||
3036 | fname = "chk_lprops"; | 2971 | fname = "chk_lprops"; |
3037 | dent = debugfs_create_file(fname, S_IRUSR | S_IWUSR, dfs_rootdir, NULL, | 2972 | dfs_chk_lprops = debugfs_create_file(fname, S_IRUSR | S_IWUSR, |
3038 | &dfs_global_fops); | 2973 | dfs_rootdir, NULL, &dfs_global_fops); |
3039 | if (IS_ERR_OR_NULL(dent)) | ||
3040 | goto out_remove; | ||
3041 | dfs_chk_lprops = dent; | ||
3042 | 2974 | ||
3043 | fname = "chk_fs"; | 2975 | fname = "chk_fs"; |
3044 | dent = debugfs_create_file(fname, S_IRUSR | S_IWUSR, dfs_rootdir, NULL, | 2976 | dfs_chk_fs = debugfs_create_file(fname, S_IRUSR | S_IWUSR, dfs_rootdir, |
3045 | &dfs_global_fops); | 2977 | NULL, &dfs_global_fops); |
3046 | if (IS_ERR_OR_NULL(dent)) | ||
3047 | goto out_remove; | ||
3048 | dfs_chk_fs = dent; | ||
3049 | 2978 | ||
3050 | fname = "tst_recovery"; | 2979 | fname = "tst_recovery"; |
3051 | dent = debugfs_create_file(fname, S_IRUSR | S_IWUSR, dfs_rootdir, NULL, | 2980 | dfs_tst_rcvry = debugfs_create_file(fname, S_IRUSR | S_IWUSR, |
3052 | &dfs_global_fops); | 2981 | dfs_rootdir, NULL, &dfs_global_fops); |
3053 | if (IS_ERR_OR_NULL(dent)) | ||
3054 | goto out_remove; | ||
3055 | dfs_tst_rcvry = dent; | ||
3056 | |||
3057 | return 0; | ||
3058 | |||
3059 | out_remove: | ||
3060 | debugfs_remove_recursive(dfs_rootdir); | ||
3061 | out: | ||
3062 | err = dent ? PTR_ERR(dent) : -ENODEV; | ||
3063 | pr_err("UBIFS error (pid %d): cannot create \"%s\" debugfs file or directory, error %d\n", | ||
3064 | current->pid, fname, err); | ||
3065 | return err; | ||
3066 | } | 2982 | } |
3067 | 2983 | ||
3068 | /** | 2984 | /** |
@@ -3070,8 +2986,7 @@ out: | |||
3070 | */ | 2986 | */ |
3071 | void dbg_debugfs_exit(void) | 2987 | void dbg_debugfs_exit(void) |
3072 | { | 2988 | { |
3073 | if (IS_ENABLED(CONFIG_DEBUG_FS)) | 2989 | debugfs_remove_recursive(dfs_rootdir); |
3074 | debugfs_remove_recursive(dfs_rootdir); | ||
3075 | } | 2990 | } |
3076 | 2991 | ||
3077 | void ubifs_assert_failed(struct ubifs_info *c, const char *expr, | 2992 | void ubifs_assert_failed(struct ubifs_info *c, const char *expr, |
diff --git a/fs/ubifs/debug.h b/fs/ubifs/debug.h index eb26097b6f70..7763639a426b 100644 --- a/fs/ubifs/debug.h +++ b/fs/ubifs/debug.h | |||
@@ -297,9 +297,9 @@ int dbg_leb_unmap(struct ubifs_info *c, int lnum); | |||
297 | int dbg_leb_map(struct ubifs_info *c, int lnum); | 297 | int dbg_leb_map(struct ubifs_info *c, int lnum); |
298 | 298 | ||
299 | /* Debugfs-related stuff */ | 299 | /* Debugfs-related stuff */ |
300 | int dbg_debugfs_init(void); | 300 | void dbg_debugfs_init(void); |
301 | void dbg_debugfs_exit(void); | 301 | void dbg_debugfs_exit(void); |
302 | int dbg_debugfs_init_fs(struct ubifs_info *c); | 302 | void dbg_debugfs_init_fs(struct ubifs_info *c); |
303 | void dbg_debugfs_exit_fs(struct ubifs_info *c); | 303 | void dbg_debugfs_exit_fs(struct ubifs_info *c); |
304 | 304 | ||
305 | #endif /* !__UBIFS_DEBUG_H__ */ | 305 | #endif /* !__UBIFS_DEBUG_H__ */ |
diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c index 6cfc494050be..fd1977b568f0 100644 --- a/fs/ubifs/super.c +++ b/fs/ubifs/super.c | |||
@@ -1465,9 +1465,7 @@ static int mount_ubifs(struct ubifs_info *c) | |||
1465 | if (err) | 1465 | if (err) |
1466 | goto out_infos; | 1466 | goto out_infos; |
1467 | 1467 | ||
1468 | err = dbg_debugfs_init_fs(c); | 1468 | dbg_debugfs_init_fs(c); |
1469 | if (err) | ||
1470 | goto out_infos; | ||
1471 | 1469 | ||
1472 | c->mounting = 0; | 1470 | c->mounting = 0; |
1473 | 1471 | ||
@@ -2352,9 +2350,7 @@ static int __init ubifs_init(void) | |||
2352 | if (err) | 2350 | if (err) |
2353 | goto out_shrinker; | 2351 | goto out_shrinker; |
2354 | 2352 | ||
2355 | err = dbg_debugfs_init(); | 2353 | dbg_debugfs_init(); |
2356 | if (err) | ||
2357 | goto out_compr; | ||
2358 | 2354 | ||
2359 | err = register_filesystem(&ubifs_fs_type); | 2355 | err = register_filesystem(&ubifs_fs_type); |
2360 | if (err) { | 2356 | if (err) { |
@@ -2366,7 +2362,6 @@ static int __init ubifs_init(void) | |||
2366 | 2362 | ||
2367 | out_dbg: | 2363 | out_dbg: |
2368 | dbg_debugfs_exit(); | 2364 | dbg_debugfs_exit(); |
2369 | out_compr: | ||
2370 | ubifs_compressors_exit(); | 2365 | ubifs_compressors_exit(); |
2371 | out_shrinker: | 2366 | out_shrinker: |
2372 | unregister_shrinker(&ubifs_shrinker_info); | 2367 | unregister_shrinker(&ubifs_shrinker_info); |
diff --git a/include/linux/backing-dev-defs.h b/include/linux/backing-dev-defs.h index 07e02d6df5ad..6a1a8a314d85 100644 --- a/include/linux/backing-dev-defs.h +++ b/include/linux/backing-dev-defs.h | |||
@@ -203,7 +203,6 @@ struct backing_dev_info { | |||
203 | 203 | ||
204 | #ifdef CONFIG_DEBUG_FS | 204 | #ifdef CONFIG_DEBUG_FS |
205 | struct dentry *debug_dir; | 205 | struct dentry *debug_dir; |
206 | struct dentry *debug_stats; | ||
207 | #endif | 206 | #endif |
208 | }; | 207 | }; |
209 | 208 | ||
diff --git a/include/linux/ceph/debugfs.h b/include/linux/ceph/debugfs.h index fa5f9b7f5dbb..cf5e840eec71 100644 --- a/include/linux/ceph/debugfs.h +++ b/include/linux/ceph/debugfs.h | |||
@@ -19,9 +19,9 @@ static const struct file_operations name##_fops = { \ | |||
19 | }; | 19 | }; |
20 | 20 | ||
21 | /* debugfs.c */ | 21 | /* debugfs.c */ |
22 | extern int ceph_debugfs_init(void); | 22 | extern void ceph_debugfs_init(void); |
23 | extern void ceph_debugfs_cleanup(void); | 23 | extern void ceph_debugfs_cleanup(void); |
24 | extern int ceph_debugfs_client_init(struct ceph_client *client); | 24 | extern void ceph_debugfs_client_init(struct ceph_client *client); |
25 | extern void ceph_debugfs_client_cleanup(struct ceph_client *client); | 25 | extern void ceph_debugfs_client_cleanup(struct ceph_client *client); |
26 | 26 | ||
27 | #endif | 27 | #endif |
diff --git a/include/linux/cpuhotplug.h b/include/linux/cpuhotplug.h index 87c211adf49e..068793a619ca 100644 --- a/include/linux/cpuhotplug.h +++ b/include/linux/cpuhotplug.h | |||
@@ -176,6 +176,7 @@ enum cpuhp_state { | |||
176 | CPUHP_AP_WATCHDOG_ONLINE, | 176 | CPUHP_AP_WATCHDOG_ONLINE, |
177 | CPUHP_AP_WORKQUEUE_ONLINE, | 177 | CPUHP_AP_WORKQUEUE_ONLINE, |
178 | CPUHP_AP_RCUTREE_ONLINE, | 178 | CPUHP_AP_RCUTREE_ONLINE, |
179 | CPUHP_AP_BASE_CACHEINFO_ONLINE, | ||
179 | CPUHP_AP_ONLINE_DYN, | 180 | CPUHP_AP_ONLINE_DYN, |
180 | CPUHP_AP_ONLINE_DYN_END = CPUHP_AP_ONLINE_DYN + 30, | 181 | CPUHP_AP_ONLINE_DYN_END = CPUHP_AP_ONLINE_DYN + 30, |
181 | CPUHP_AP_X86_HPET_ONLINE, | 182 | CPUHP_AP_X86_HPET_ONLINE, |
diff --git a/include/linux/debugfs.h b/include/linux/debugfs.h index 3b0ba54cc4d5..58424eb3b329 100644 --- a/include/linux/debugfs.h +++ b/include/linux/debugfs.h | |||
@@ -133,9 +133,8 @@ struct dentry *debugfs_create_regset32(const char *name, umode_t mode, | |||
133 | void debugfs_print_regs32(struct seq_file *s, const struct debugfs_reg32 *regs, | 133 | void debugfs_print_regs32(struct seq_file *s, const struct debugfs_reg32 *regs, |
134 | int nregs, void __iomem *base, char *prefix); | 134 | int nregs, void __iomem *base, char *prefix); |
135 | 135 | ||
136 | struct dentry *debugfs_create_u32_array(const char *name, umode_t mode, | 136 | void debugfs_create_u32_array(const char *name, umode_t mode, |
137 | struct dentry *parent, | 137 | struct dentry *parent, u32 *array, u32 elements); |
138 | u32 *array, u32 elements); | ||
139 | 138 | ||
140 | struct dentry *debugfs_create_devm_seqfile(struct device *dev, const char *name, | 139 | struct dentry *debugfs_create_devm_seqfile(struct device *dev, const char *name, |
141 | struct dentry *parent, | 140 | struct dentry *parent, |
@@ -353,11 +352,10 @@ static inline bool debugfs_initialized(void) | |||
353 | return false; | 352 | return false; |
354 | } | 353 | } |
355 | 354 | ||
356 | static inline struct dentry *debugfs_create_u32_array(const char *name, umode_t mode, | 355 | static inline void debugfs_create_u32_array(const char *name, umode_t mode, |
357 | struct dentry *parent, | 356 | struct dentry *parent, u32 *array, |
358 | u32 *array, u32 elements) | 357 | u32 elements) |
359 | { | 358 | { |
360 | return ERR_PTR(-ENODEV); | ||
361 | } | 359 | } |
362 | 360 | ||
363 | static inline struct dentry *debugfs_create_devm_seqfile(struct device *dev, | 361 | static inline struct dentry *debugfs_create_devm_seqfile(struct device *dev, |
diff --git a/include/linux/device.h b/include/linux/device.h index adfcabcba8a1..5eabfa0c4dee 100644 --- a/include/linux/device.h +++ b/include/linux/device.h | |||
@@ -164,11 +164,13 @@ void subsys_dev_iter_init(struct subsys_dev_iter *iter, | |||
164 | struct device *subsys_dev_iter_next(struct subsys_dev_iter *iter); | 164 | struct device *subsys_dev_iter_next(struct subsys_dev_iter *iter); |
165 | void subsys_dev_iter_exit(struct subsys_dev_iter *iter); | 165 | void subsys_dev_iter_exit(struct subsys_dev_iter *iter); |
166 | 166 | ||
167 | int device_match_of_node(struct device *dev, const void *np); | ||
168 | |||
167 | int bus_for_each_dev(struct bus_type *bus, struct device *start, void *data, | 169 | int bus_for_each_dev(struct bus_type *bus, struct device *start, void *data, |
168 | int (*fn)(struct device *dev, void *data)); | 170 | int (*fn)(struct device *dev, void *data)); |
169 | struct device *bus_find_device(struct bus_type *bus, struct device *start, | 171 | struct device *bus_find_device(struct bus_type *bus, struct device *start, |
170 | void *data, | 172 | const void *data, |
171 | int (*match)(struct device *dev, void *data)); | 173 | int (*match)(struct device *dev, const void *data)); |
172 | struct device *bus_find_device_by_name(struct bus_type *bus, | 174 | struct device *bus_find_device_by_name(struct bus_type *bus, |
173 | struct device *start, | 175 | struct device *start, |
174 | const char *name); | 176 | const char *name); |
@@ -337,11 +339,12 @@ extern int __must_check driver_for_each_device(struct device_driver *drv, | |||
337 | int (*fn)(struct device *dev, | 339 | int (*fn)(struct device *dev, |
338 | void *)); | 340 | void *)); |
339 | struct device *driver_find_device(struct device_driver *drv, | 341 | struct device *driver_find_device(struct device_driver *drv, |
340 | struct device *start, void *data, | 342 | struct device *start, const void *data, |
341 | int (*match)(struct device *dev, void *data)); | 343 | int (*match)(struct device *dev, const void *data)); |
342 | 344 | ||
343 | void driver_deferred_probe_add(struct device *dev); | 345 | void driver_deferred_probe_add(struct device *dev); |
344 | int driver_deferred_probe_check_state(struct device *dev); | 346 | int driver_deferred_probe_check_state(struct device *dev); |
347 | int driver_deferred_probe_check_state_continue(struct device *dev); | ||
345 | 348 | ||
346 | /** | 349 | /** |
347 | * struct subsys_interface - interfaces to device functions | 350 | * struct subsys_interface - interfaces to device functions |
diff --git a/include/linux/mfd/syscon.h b/include/linux/mfd/syscon.h index f0273c9e972b..8cfda0554381 100644 --- a/include/linux/mfd/syscon.h +++ b/include/linux/mfd/syscon.h | |||
@@ -19,7 +19,6 @@ struct device_node; | |||
19 | #ifdef CONFIG_MFD_SYSCON | 19 | #ifdef CONFIG_MFD_SYSCON |
20 | extern struct regmap *syscon_node_to_regmap(struct device_node *np); | 20 | extern struct regmap *syscon_node_to_regmap(struct device_node *np); |
21 | extern struct regmap *syscon_regmap_lookup_by_compatible(const char *s); | 21 | extern struct regmap *syscon_regmap_lookup_by_compatible(const char *s); |
22 | extern struct regmap *syscon_regmap_lookup_by_pdevname(const char *s); | ||
23 | extern struct regmap *syscon_regmap_lookup_by_phandle( | 22 | extern struct regmap *syscon_regmap_lookup_by_phandle( |
24 | struct device_node *np, | 23 | struct device_node *np, |
25 | const char *property); | 24 | const char *property); |
@@ -34,11 +33,6 @@ static inline struct regmap *syscon_regmap_lookup_by_compatible(const char *s) | |||
34 | return ERR_PTR(-ENOTSUPP); | 33 | return ERR_PTR(-ENOTSUPP); |
35 | } | 34 | } |
36 | 35 | ||
37 | static inline struct regmap *syscon_regmap_lookup_by_pdevname(const char *s) | ||
38 | { | ||
39 | return ERR_PTR(-ENOTSUPP); | ||
40 | } | ||
41 | |||
42 | static inline struct regmap *syscon_regmap_lookup_by_phandle( | 36 | static inline struct regmap *syscon_regmap_lookup_by_phandle( |
43 | struct device_node *np, | 37 | struct device_node *np, |
44 | const char *property) | 38 | const char *property) |
diff --git a/kernel/dma/swiotlb.c b/kernel/dma/swiotlb.c index 13f0cb080a4d..62fa5a82a065 100644 --- a/kernel/dma/swiotlb.c +++ b/kernel/dma/swiotlb.c | |||
@@ -696,29 +696,12 @@ bool is_swiotlb_active(void) | |||
696 | 696 | ||
697 | static int __init swiotlb_create_debugfs(void) | 697 | static int __init swiotlb_create_debugfs(void) |
698 | { | 698 | { |
699 | struct dentry *d_swiotlb_usage; | 699 | struct dentry *root; |
700 | struct dentry *ent; | ||
701 | |||
702 | d_swiotlb_usage = debugfs_create_dir("swiotlb", NULL); | ||
703 | |||
704 | if (!d_swiotlb_usage) | ||
705 | return -ENOMEM; | ||
706 | |||
707 | ent = debugfs_create_ulong("io_tlb_nslabs", 0400, | ||
708 | d_swiotlb_usage, &io_tlb_nslabs); | ||
709 | if (!ent) | ||
710 | goto fail; | ||
711 | |||
712 | ent = debugfs_create_ulong("io_tlb_used", 0400, | ||
713 | d_swiotlb_usage, &io_tlb_used); | ||
714 | if (!ent) | ||
715 | goto fail; | ||
716 | 700 | ||
701 | root = debugfs_create_dir("swiotlb", NULL); | ||
702 | debugfs_create_ulong("io_tlb_nslabs", 0400, root, &io_tlb_nslabs); | ||
703 | debugfs_create_ulong("io_tlb_used", 0400, root, &io_tlb_used); | ||
717 | return 0; | 704 | return 0; |
718 | |||
719 | fail: | ||
720 | debugfs_remove_recursive(d_swiotlb_usage); | ||
721 | return -ENOMEM; | ||
722 | } | 705 | } |
723 | 706 | ||
724 | late_initcall(swiotlb_create_debugfs); | 707 | late_initcall(swiotlb_create_debugfs); |
diff --git a/kernel/fail_function.c b/kernel/fail_function.c index feb80712b913..63b349168da7 100644 --- a/kernel/fail_function.c +++ b/kernel/fail_function.c | |||
@@ -152,20 +152,13 @@ static int fei_retval_get(void *data, u64 *val) | |||
152 | DEFINE_DEBUGFS_ATTRIBUTE(fei_retval_ops, fei_retval_get, fei_retval_set, | 152 | DEFINE_DEBUGFS_ATTRIBUTE(fei_retval_ops, fei_retval_get, fei_retval_set, |
153 | "%llx\n"); | 153 | "%llx\n"); |
154 | 154 | ||
155 | static int fei_debugfs_add_attr(struct fei_attr *attr) | 155 | static void fei_debugfs_add_attr(struct fei_attr *attr) |
156 | { | 156 | { |
157 | struct dentry *dir; | 157 | struct dentry *dir; |
158 | 158 | ||
159 | dir = debugfs_create_dir(attr->kp.symbol_name, fei_debugfs_dir); | 159 | dir = debugfs_create_dir(attr->kp.symbol_name, fei_debugfs_dir); |
160 | if (!dir) | ||
161 | return -ENOMEM; | ||
162 | |||
163 | if (!debugfs_create_file("retval", 0600, dir, attr, &fei_retval_ops)) { | ||
164 | debugfs_remove_recursive(dir); | ||
165 | return -ENOMEM; | ||
166 | } | ||
167 | 160 | ||
168 | return 0; | 161 | debugfs_create_file("retval", 0600, dir, attr, &fei_retval_ops); |
169 | } | 162 | } |
170 | 163 | ||
171 | static void fei_debugfs_remove_attr(struct fei_attr *attr) | 164 | static void fei_debugfs_remove_attr(struct fei_attr *attr) |
@@ -306,7 +299,7 @@ static ssize_t fei_write(struct file *file, const char __user *buffer, | |||
306 | 299 | ||
307 | ret = register_kprobe(&attr->kp); | 300 | ret = register_kprobe(&attr->kp); |
308 | if (!ret) | 301 | if (!ret) |
309 | ret = fei_debugfs_add_attr(attr); | 302 | fei_debugfs_add_attr(attr); |
310 | if (ret < 0) | 303 | if (ret < 0) |
311 | fei_attr_remove(attr); | 304 | fei_attr_remove(attr); |
312 | else { | 305 | else { |
@@ -337,19 +330,13 @@ static int __init fei_debugfs_init(void) | |||
337 | return PTR_ERR(dir); | 330 | return PTR_ERR(dir); |
338 | 331 | ||
339 | /* injectable attribute is just a symlink of error_inject/list */ | 332 | /* injectable attribute is just a symlink of error_inject/list */ |
340 | if (!debugfs_create_symlink("injectable", dir, | 333 | debugfs_create_symlink("injectable", dir, "../error_injection/list"); |
341 | "../error_injection/list")) | ||
342 | goto error; | ||
343 | 334 | ||
344 | if (!debugfs_create_file("inject", 0600, dir, NULL, &fei_ops)) | 335 | debugfs_create_file("inject", 0600, dir, NULL, &fei_ops); |
345 | goto error; | ||
346 | 336 | ||
347 | fei_debugfs_dir = dir; | 337 | fei_debugfs_dir = dir; |
348 | 338 | ||
349 | return 0; | 339 | return 0; |
350 | error: | ||
351 | debugfs_remove_recursive(dir); | ||
352 | return -ENOMEM; | ||
353 | } | 340 | } |
354 | 341 | ||
355 | late_initcall(fei_debugfs_init); | 342 | late_initcall(fei_debugfs_init); |
diff --git a/kernel/gcov/fs.c b/kernel/gcov/fs.c index 6e40ff6be083..e5eb5ea7ea59 100644 --- a/kernel/gcov/fs.c +++ b/kernel/gcov/fs.c | |||
@@ -64,7 +64,6 @@ struct gcov_node { | |||
64 | static const char objtree[] = OBJTREE; | 64 | static const char objtree[] = OBJTREE; |
65 | static const char srctree[] = SRCTREE; | 65 | static const char srctree[] = SRCTREE; |
66 | static struct gcov_node root_node; | 66 | static struct gcov_node root_node; |
67 | static struct dentry *reset_dentry; | ||
68 | static LIST_HEAD(all_head); | 67 | static LIST_HEAD(all_head); |
69 | static DEFINE_MUTEX(node_lock); | 68 | static DEFINE_MUTEX(node_lock); |
70 | 69 | ||
@@ -387,8 +386,6 @@ static void add_links(struct gcov_node *node, struct dentry *parent) | |||
387 | goto out_err; | 386 | goto out_err; |
388 | node->links[i] = debugfs_create_symlink(deskew(basename), | 387 | node->links[i] = debugfs_create_symlink(deskew(basename), |
389 | parent, target); | 388 | parent, target); |
390 | if (!node->links[i]) | ||
391 | goto out_err; | ||
392 | kfree(target); | 389 | kfree(target); |
393 | } | 390 | } |
394 | 391 | ||
@@ -450,11 +447,6 @@ static struct gcov_node *new_node(struct gcov_node *parent, | |||
450 | parent->dentry, node, &gcov_data_fops); | 447 | parent->dentry, node, &gcov_data_fops); |
451 | } else | 448 | } else |
452 | node->dentry = debugfs_create_dir(node->name, parent->dentry); | 449 | node->dentry = debugfs_create_dir(node->name, parent->dentry); |
453 | if (!node->dentry) { | ||
454 | pr_warn("could not create file\n"); | ||
455 | kfree(node); | ||
456 | return NULL; | ||
457 | } | ||
458 | if (info) | 450 | if (info) |
459 | add_links(node, parent->dentry); | 451 | add_links(node, parent->dentry); |
460 | list_add(&node->list, &parent->children); | 452 | list_add(&node->list, &parent->children); |
@@ -761,32 +753,20 @@ void gcov_event(enum gcov_action action, struct gcov_info *info) | |||
761 | /* Create debugfs entries. */ | 753 | /* Create debugfs entries. */ |
762 | static __init int gcov_fs_init(void) | 754 | static __init int gcov_fs_init(void) |
763 | { | 755 | { |
764 | int rc = -EIO; | ||
765 | |||
766 | init_node(&root_node, NULL, NULL, NULL); | 756 | init_node(&root_node, NULL, NULL, NULL); |
767 | /* | 757 | /* |
768 | * /sys/kernel/debug/gcov will be parent for the reset control file | 758 | * /sys/kernel/debug/gcov will be parent for the reset control file |
769 | * and all profiling files. | 759 | * and all profiling files. |
770 | */ | 760 | */ |
771 | root_node.dentry = debugfs_create_dir("gcov", NULL); | 761 | root_node.dentry = debugfs_create_dir("gcov", NULL); |
772 | if (!root_node.dentry) | ||
773 | goto err_remove; | ||
774 | /* | 762 | /* |
775 | * Create reset file which resets all profiling counts when written | 763 | * Create reset file which resets all profiling counts when written |
776 | * to. | 764 | * to. |
777 | */ | 765 | */ |
778 | reset_dentry = debugfs_create_file("reset", 0600, root_node.dentry, | 766 | debugfs_create_file("reset", 0600, root_node.dentry, NULL, |
779 | NULL, &gcov_reset_fops); | 767 | &gcov_reset_fops); |
780 | if (!reset_dentry) | ||
781 | goto err_remove; | ||
782 | /* Replay previous events to get our fs hierarchy up-to-date. */ | 768 | /* Replay previous events to get our fs hierarchy up-to-date. */ |
783 | gcov_enable_events(); | 769 | gcov_enable_events(); |
784 | return 0; | 770 | return 0; |
785 | |||
786 | err_remove: | ||
787 | pr_err("init failed\n"); | ||
788 | debugfs_remove(root_node.dentry); | ||
789 | |||
790 | return rc; | ||
791 | } | 771 | } |
792 | device_initcall(gcov_fs_init); | 772 | device_initcall(gcov_fs_init); |
diff --git a/kernel/kprobes.c b/kernel/kprobes.c index 445337c107e0..9f5433a52488 100644 --- a/kernel/kprobes.c +++ b/kernel/kprobes.c | |||
@@ -2570,33 +2570,20 @@ static const struct file_operations fops_kp = { | |||
2570 | 2570 | ||
2571 | static int __init debugfs_kprobe_init(void) | 2571 | static int __init debugfs_kprobe_init(void) |
2572 | { | 2572 | { |
2573 | struct dentry *dir, *file; | 2573 | struct dentry *dir; |
2574 | unsigned int value = 1; | 2574 | unsigned int value = 1; |
2575 | 2575 | ||
2576 | dir = debugfs_create_dir("kprobes", NULL); | 2576 | dir = debugfs_create_dir("kprobes", NULL); |
2577 | if (!dir) | ||
2578 | return -ENOMEM; | ||
2579 | 2577 | ||
2580 | file = debugfs_create_file("list", 0400, dir, NULL, | 2578 | debugfs_create_file("list", 0400, dir, NULL, |
2581 | &debugfs_kprobes_operations); | 2579 | &debugfs_kprobes_operations); |
2582 | if (!file) | ||
2583 | goto error; | ||
2584 | 2580 | ||
2585 | file = debugfs_create_file("enabled", 0600, dir, | 2581 | debugfs_create_file("enabled", 0600, dir, &value, &fops_kp); |
2586 | &value, &fops_kp); | ||
2587 | if (!file) | ||
2588 | goto error; | ||
2589 | 2582 | ||
2590 | file = debugfs_create_file("blacklist", 0400, dir, NULL, | 2583 | debugfs_create_file("blacklist", 0400, dir, NULL, |
2591 | &debugfs_kprobe_blacklist_ops); | 2584 | &debugfs_kprobe_blacklist_ops); |
2592 | if (!file) | ||
2593 | goto error; | ||
2594 | 2585 | ||
2595 | return 0; | 2586 | return 0; |
2596 | |||
2597 | error: | ||
2598 | debugfs_remove(dir); | ||
2599 | return -ENOMEM; | ||
2600 | } | 2587 | } |
2601 | 2588 | ||
2602 | late_initcall(debugfs_kprobe_init); | 2589 | late_initcall(debugfs_kprobe_init); |
diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c index e1c6d79fb4cc..2d6e93ab0478 100644 --- a/kernel/trace/blktrace.c +++ b/kernel/trace/blktrace.c | |||
@@ -512,8 +512,6 @@ static int do_blk_trace_setup(struct request_queue *q, char *name, dev_t dev, | |||
512 | dir = debugfs_lookup(buts->name, blk_debugfs_root); | 512 | dir = debugfs_lookup(buts->name, blk_debugfs_root); |
513 | if (!dir) | 513 | if (!dir) |
514 | bt->dir = dir = debugfs_create_dir(buts->name, blk_debugfs_root); | 514 | bt->dir = dir = debugfs_create_dir(buts->name, blk_debugfs_root); |
515 | if (!dir) | ||
516 | goto err; | ||
517 | 515 | ||
518 | bt->dev = dev; | 516 | bt->dev = dev; |
519 | atomic_set(&bt->dropped, 0); | 517 | atomic_set(&bt->dropped, 0); |
@@ -522,12 +520,8 @@ static int do_blk_trace_setup(struct request_queue *q, char *name, dev_t dev, | |||
522 | ret = -EIO; | 520 | ret = -EIO; |
523 | bt->dropped_file = debugfs_create_file("dropped", 0444, dir, bt, | 521 | bt->dropped_file = debugfs_create_file("dropped", 0444, dir, bt, |
524 | &blk_dropped_fops); | 522 | &blk_dropped_fops); |
525 | if (!bt->dropped_file) | ||
526 | goto err; | ||
527 | 523 | ||
528 | bt->msg_file = debugfs_create_file("msg", 0222, dir, bt, &blk_msg_fops); | 524 | bt->msg_file = debugfs_create_file("msg", 0222, dir, bt, &blk_msg_fops); |
529 | if (!bt->msg_file) | ||
530 | goto err; | ||
531 | 525 | ||
532 | bt->rchan = relay_open("trace", dir, buts->buf_size, | 526 | bt->rchan = relay_open("trace", dir, buts->buf_size, |
533 | buts->buf_nr, &blk_relay_callbacks, bt); | 527 | buts->buf_nr, &blk_relay_callbacks, bt); |
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index c3aabb576fe5..c90c687cf950 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c | |||
@@ -8618,10 +8618,6 @@ struct dentry *tracing_init_dentry(void) | |||
8618 | */ | 8618 | */ |
8619 | tr->dir = debugfs_create_automount("tracing", NULL, | 8619 | tr->dir = debugfs_create_automount("tracing", NULL, |
8620 | trace_automount, NULL); | 8620 | trace_automount, NULL); |
8621 | if (!tr->dir) { | ||
8622 | pr_warn_once("Could not create debugfs directory 'tracing'\n"); | ||
8623 | return ERR_PTR(-ENOMEM); | ||
8624 | } | ||
8625 | 8621 | ||
8626 | return NULL; | 8622 | return NULL; |
8627 | } | 8623 | } |
diff --git a/lib/842/842_debugfs.h b/lib/842/842_debugfs.h index 277e403e8701..4469407c3e0d 100644 --- a/lib/842/842_debugfs.h +++ b/lib/842/842_debugfs.h | |||
@@ -22,8 +22,6 @@ static int __init sw842_debugfs_create(void) | |||
22 | return -ENODEV; | 22 | return -ENODEV; |
23 | 23 | ||
24 | sw842_debugfs_root = debugfs_create_dir(MODULE_NAME, NULL); | 24 | sw842_debugfs_root = debugfs_create_dir(MODULE_NAME, NULL); |
25 | if (IS_ERR(sw842_debugfs_root)) | ||
26 | return PTR_ERR(sw842_debugfs_root); | ||
27 | 25 | ||
28 | for (i = 0; i < ARRAY_SIZE(template_count); i++) { | 26 | for (i = 0; i < ARRAY_SIZE(template_count); i++) { |
29 | char name[32]; | 27 | char name[32]; |
@@ -46,8 +44,7 @@ static int __init sw842_debugfs_create(void) | |||
46 | 44 | ||
47 | static void __exit sw842_debugfs_remove(void) | 45 | static void __exit sw842_debugfs_remove(void) |
48 | { | 46 | { |
49 | if (sw842_debugfs_root && !IS_ERR(sw842_debugfs_root)) | 47 | debugfs_remove_recursive(sw842_debugfs_root); |
50 | debugfs_remove_recursive(sw842_debugfs_root); | ||
51 | } | 48 | } |
52 | 49 | ||
53 | #endif | 50 | #endif |
diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index 8a16c2d498e9..c60409138e13 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c | |||
@@ -993,20 +993,14 @@ static __initdata int ddebug_init_success; | |||
993 | 993 | ||
994 | static int __init dynamic_debug_init_debugfs(void) | 994 | static int __init dynamic_debug_init_debugfs(void) |
995 | { | 995 | { |
996 | struct dentry *dir, *file; | 996 | struct dentry *dir; |
997 | 997 | ||
998 | if (!ddebug_init_success) | 998 | if (!ddebug_init_success) |
999 | return -ENODEV; | 999 | return -ENODEV; |
1000 | 1000 | ||
1001 | dir = debugfs_create_dir("dynamic_debug", NULL); | 1001 | dir = debugfs_create_dir("dynamic_debug", NULL); |
1002 | if (!dir) | 1002 | debugfs_create_file("control", 0644, dir, NULL, &ddebug_proc_fops); |
1003 | return -ENOMEM; | 1003 | |
1004 | file = debugfs_create_file("control", 0644, dir, NULL, | ||
1005 | &ddebug_proc_fops); | ||
1006 | if (!file) { | ||
1007 | debugfs_remove(dir); | ||
1008 | return -ENOMEM; | ||
1009 | } | ||
1010 | return 0; | 1004 | return 0; |
1011 | } | 1005 | } |
1012 | 1006 | ||
diff --git a/lib/fault-inject.c b/lib/fault-inject.c index 3cb21b2bf088..8186ca84910b 100644 --- a/lib/fault-inject.c +++ b/lib/fault-inject.c | |||
@@ -166,10 +166,10 @@ static int debugfs_ul_get(void *data, u64 *val) | |||
166 | 166 | ||
167 | DEFINE_SIMPLE_ATTRIBUTE(fops_ul, debugfs_ul_get, debugfs_ul_set, "%llu\n"); | 167 | DEFINE_SIMPLE_ATTRIBUTE(fops_ul, debugfs_ul_get, debugfs_ul_set, "%llu\n"); |
168 | 168 | ||
169 | static struct dentry *debugfs_create_ul(const char *name, umode_t mode, | 169 | static void debugfs_create_ul(const char *name, umode_t mode, |
170 | struct dentry *parent, unsigned long *value) | 170 | struct dentry *parent, unsigned long *value) |
171 | { | 171 | { |
172 | return debugfs_create_file(name, mode, parent, value, &fops_ul); | 172 | debugfs_create_file(name, mode, parent, value, &fops_ul); |
173 | } | 173 | } |
174 | 174 | ||
175 | #ifdef CONFIG_FAULT_INJECTION_STACKTRACE_FILTER | 175 | #ifdef CONFIG_FAULT_INJECTION_STACKTRACE_FILTER |
@@ -185,12 +185,11 @@ static int debugfs_stacktrace_depth_set(void *data, u64 val) | |||
185 | DEFINE_SIMPLE_ATTRIBUTE(fops_stacktrace_depth, debugfs_ul_get, | 185 | DEFINE_SIMPLE_ATTRIBUTE(fops_stacktrace_depth, debugfs_ul_get, |
186 | debugfs_stacktrace_depth_set, "%llu\n"); | 186 | debugfs_stacktrace_depth_set, "%llu\n"); |
187 | 187 | ||
188 | static struct dentry *debugfs_create_stacktrace_depth( | 188 | static void debugfs_create_stacktrace_depth(const char *name, umode_t mode, |
189 | const char *name, umode_t mode, | 189 | struct dentry *parent, |
190 | struct dentry *parent, unsigned long *value) | 190 | unsigned long *value) |
191 | { | 191 | { |
192 | return debugfs_create_file(name, mode, parent, value, | 192 | debugfs_create_file(name, mode, parent, value, &fops_stacktrace_depth); |
193 | &fops_stacktrace_depth); | ||
194 | } | 193 | } |
195 | 194 | ||
196 | #endif /* CONFIG_FAULT_INJECTION_STACKTRACE_FILTER */ | 195 | #endif /* CONFIG_FAULT_INJECTION_STACKTRACE_FILTER */ |
@@ -202,51 +201,31 @@ struct dentry *fault_create_debugfs_attr(const char *name, | |||
202 | struct dentry *dir; | 201 | struct dentry *dir; |
203 | 202 | ||
204 | dir = debugfs_create_dir(name, parent); | 203 | dir = debugfs_create_dir(name, parent); |
205 | if (!dir) | 204 | if (IS_ERR(dir)) |
206 | return ERR_PTR(-ENOMEM); | 205 | return dir; |
207 | 206 | ||
208 | if (!debugfs_create_ul("probability", mode, dir, &attr->probability)) | 207 | debugfs_create_ul("probability", mode, dir, &attr->probability); |
209 | goto fail; | 208 | debugfs_create_ul("interval", mode, dir, &attr->interval); |
210 | if (!debugfs_create_ul("interval", mode, dir, &attr->interval)) | 209 | debugfs_create_atomic_t("times", mode, dir, &attr->times); |
211 | goto fail; | 210 | debugfs_create_atomic_t("space", mode, dir, &attr->space); |
212 | if (!debugfs_create_atomic_t("times", mode, dir, &attr->times)) | 211 | debugfs_create_ul("verbose", mode, dir, &attr->verbose); |
213 | goto fail; | 212 | debugfs_create_u32("verbose_ratelimit_interval_ms", mode, dir, |
214 | if (!debugfs_create_atomic_t("space", mode, dir, &attr->space)) | 213 | &attr->ratelimit_state.interval); |
215 | goto fail; | 214 | debugfs_create_u32("verbose_ratelimit_burst", mode, dir, |
216 | if (!debugfs_create_ul("verbose", mode, dir, &attr->verbose)) | 215 | &attr->ratelimit_state.burst); |
217 | goto fail; | 216 | debugfs_create_bool("task-filter", mode, dir, &attr->task_filter); |
218 | if (!debugfs_create_u32("verbose_ratelimit_interval_ms", mode, dir, | ||
219 | &attr->ratelimit_state.interval)) | ||
220 | goto fail; | ||
221 | if (!debugfs_create_u32("verbose_ratelimit_burst", mode, dir, | ||
222 | &attr->ratelimit_state.burst)) | ||
223 | goto fail; | ||
224 | if (!debugfs_create_bool("task-filter", mode, dir, &attr->task_filter)) | ||
225 | goto fail; | ||
226 | 217 | ||
227 | #ifdef CONFIG_FAULT_INJECTION_STACKTRACE_FILTER | 218 | #ifdef CONFIG_FAULT_INJECTION_STACKTRACE_FILTER |
228 | 219 | debugfs_create_stacktrace_depth("stacktrace-depth", mode, dir, | |
229 | if (!debugfs_create_stacktrace_depth("stacktrace-depth", mode, dir, | 220 | &attr->stacktrace_depth); |
230 | &attr->stacktrace_depth)) | 221 | debugfs_create_ul("require-start", mode, dir, &attr->require_start); |
231 | goto fail; | 222 | debugfs_create_ul("require-end", mode, dir, &attr->require_end); |
232 | if (!debugfs_create_ul("require-start", mode, dir, | 223 | debugfs_create_ul("reject-start", mode, dir, &attr->reject_start); |
233 | &attr->require_start)) | 224 | debugfs_create_ul("reject-end", mode, dir, &attr->reject_end); |
234 | goto fail; | ||
235 | if (!debugfs_create_ul("require-end", mode, dir, &attr->require_end)) | ||
236 | goto fail; | ||
237 | if (!debugfs_create_ul("reject-start", mode, dir, &attr->reject_start)) | ||
238 | goto fail; | ||
239 | if (!debugfs_create_ul("reject-end", mode, dir, &attr->reject_end)) | ||
240 | goto fail; | ||
241 | |||
242 | #endif /* CONFIG_FAULT_INJECTION_STACKTRACE_FILTER */ | 225 | #endif /* CONFIG_FAULT_INJECTION_STACKTRACE_FILTER */ |
243 | 226 | ||
244 | attr->dname = dget(dir); | 227 | attr->dname = dget(dir); |
245 | return dir; | 228 | return dir; |
246 | fail: | ||
247 | debugfs_remove_recursive(dir); | ||
248 | |||
249 | return ERR_PTR(-ENOMEM); | ||
250 | } | 229 | } |
251 | EXPORT_SYMBOL_GPL(fault_create_debugfs_attr); | 230 | EXPORT_SYMBOL_GPL(fault_create_debugfs_attr); |
252 | 231 | ||
diff --git a/lib/kobject.c b/lib/kobject.c index f2ccdbac8ed9..83198cb37d8d 100644 --- a/lib/kobject.c +++ b/lib/kobject.c | |||
@@ -498,8 +498,10 @@ int kobject_rename(struct kobject *kobj, const char *new_name) | |||
498 | kobj = kobject_get(kobj); | 498 | kobj = kobject_get(kobj); |
499 | if (!kobj) | 499 | if (!kobj) |
500 | return -EINVAL; | 500 | return -EINVAL; |
501 | if (!kobj->parent) | 501 | if (!kobj->parent) { |
502 | kobject_put(kobj); | ||
502 | return -EINVAL; | 503 | return -EINVAL; |
504 | } | ||
503 | 505 | ||
504 | devpath = kobject_get_path(kobj, GFP_KERNEL); | 506 | devpath = kobject_get_path(kobj, GFP_KERNEL); |
505 | if (!devpath) { | 507 | if (!devpath) { |
diff --git a/lib/notifier-error-inject.c b/lib/notifier-error-inject.c index 3d2ba7cf83f4..21016b32d313 100644 --- a/lib/notifier-error-inject.c +++ b/lib/notifier-error-inject.c | |||
@@ -59,33 +59,22 @@ struct dentry *notifier_err_inject_init(const char *name, struct dentry *parent, | |||
59 | err_inject->nb.priority = priority; | 59 | err_inject->nb.priority = priority; |
60 | 60 | ||
61 | dir = debugfs_create_dir(name, parent); | 61 | dir = debugfs_create_dir(name, parent); |
62 | if (!dir) | ||
63 | return ERR_PTR(-ENOMEM); | ||
64 | 62 | ||
65 | actions_dir = debugfs_create_dir("actions", dir); | 63 | actions_dir = debugfs_create_dir("actions", dir); |
66 | if (!actions_dir) | ||
67 | goto fail; | ||
68 | 64 | ||
69 | for (action = err_inject->actions; action->name; action++) { | 65 | for (action = err_inject->actions; action->name; action++) { |
70 | struct dentry *action_dir; | 66 | struct dentry *action_dir; |
71 | 67 | ||
72 | action_dir = debugfs_create_dir(action->name, actions_dir); | 68 | action_dir = debugfs_create_dir(action->name, actions_dir); |
73 | if (!action_dir) | ||
74 | goto fail; | ||
75 | 69 | ||
76 | /* | 70 | /* |
77 | * Create debugfs r/w file containing action->error. If | 71 | * Create debugfs r/w file containing action->error. If |
78 | * notifier call chain is called with action->val, it will | 72 | * notifier call chain is called with action->val, it will |
79 | * fail with the error code | 73 | * fail with the error code |
80 | */ | 74 | */ |
81 | if (!debugfs_create_errno("error", mode, action_dir, | 75 | debugfs_create_errno("error", mode, action_dir, &action->error); |
82 | &action->error)) | ||
83 | goto fail; | ||
84 | } | 76 | } |
85 | return dir; | 77 | return dir; |
86 | fail: | ||
87 | debugfs_remove_recursive(dir); | ||
88 | return ERR_PTR(-ENOMEM); | ||
89 | } | 78 | } |
90 | EXPORT_SYMBOL_GPL(notifier_err_inject_init); | 79 | EXPORT_SYMBOL_GPL(notifier_err_inject_init); |
91 | 80 | ||
diff --git a/mm/backing-dev.c b/mm/backing-dev.c index 909dae445ea7..e8e89158adec 100644 --- a/mm/backing-dev.c +++ b/mm/backing-dev.c | |||
@@ -103,39 +103,25 @@ static int bdi_debug_stats_show(struct seq_file *m, void *v) | |||
103 | } | 103 | } |
104 | DEFINE_SHOW_ATTRIBUTE(bdi_debug_stats); | 104 | DEFINE_SHOW_ATTRIBUTE(bdi_debug_stats); |
105 | 105 | ||
106 | static int bdi_debug_register(struct backing_dev_info *bdi, const char *name) | 106 | static void bdi_debug_register(struct backing_dev_info *bdi, const char *name) |
107 | { | 107 | { |
108 | if (!bdi_debug_root) | ||
109 | return -ENOMEM; | ||
110 | |||
111 | bdi->debug_dir = debugfs_create_dir(name, bdi_debug_root); | 108 | bdi->debug_dir = debugfs_create_dir(name, bdi_debug_root); |
112 | if (!bdi->debug_dir) | ||
113 | return -ENOMEM; | ||
114 | |||
115 | bdi->debug_stats = debugfs_create_file("stats", 0444, bdi->debug_dir, | ||
116 | bdi, &bdi_debug_stats_fops); | ||
117 | if (!bdi->debug_stats) { | ||
118 | debugfs_remove(bdi->debug_dir); | ||
119 | bdi->debug_dir = NULL; | ||
120 | return -ENOMEM; | ||
121 | } | ||
122 | 109 | ||
123 | return 0; | 110 | debugfs_create_file("stats", 0444, bdi->debug_dir, bdi, |
111 | &bdi_debug_stats_fops); | ||
124 | } | 112 | } |
125 | 113 | ||
126 | static void bdi_debug_unregister(struct backing_dev_info *bdi) | 114 | static void bdi_debug_unregister(struct backing_dev_info *bdi) |
127 | { | 115 | { |
128 | debugfs_remove(bdi->debug_stats); | 116 | debugfs_remove_recursive(bdi->debug_dir); |
129 | debugfs_remove(bdi->debug_dir); | ||
130 | } | 117 | } |
131 | #else | 118 | #else |
132 | static inline void bdi_debug_init(void) | 119 | static inline void bdi_debug_init(void) |
133 | { | 120 | { |
134 | } | 121 | } |
135 | static inline int bdi_debug_register(struct backing_dev_info *bdi, | 122 | static inline void bdi_debug_register(struct backing_dev_info *bdi, |
136 | const char *name) | 123 | const char *name) |
137 | { | 124 | { |
138 | return 0; | ||
139 | } | 125 | } |
140 | static inline void bdi_debug_unregister(struct backing_dev_info *bdi) | 126 | static inline void bdi_debug_unregister(struct backing_dev_info *bdi) |
141 | { | 127 | { |
diff --git a/mm/cleancache.c b/mm/cleancache.c index 2397f7c36cc7..db7eee9c0886 100644 --- a/mm/cleancache.c +++ b/mm/cleancache.c | |||
@@ -304,8 +304,7 @@ static int __init init_cleancache(void) | |||
304 | { | 304 | { |
305 | #ifdef CONFIG_DEBUG_FS | 305 | #ifdef CONFIG_DEBUG_FS |
306 | struct dentry *root = debugfs_create_dir("cleancache", NULL); | 306 | struct dentry *root = debugfs_create_dir("cleancache", NULL); |
307 | if (root == NULL) | 307 | |
308 | return -ENXIO; | ||
309 | debugfs_create_u64("succ_gets", 0444, root, &cleancache_succ_gets); | 308 | debugfs_create_u64("succ_gets", 0444, root, &cleancache_succ_gets); |
310 | debugfs_create_u64("failed_gets", 0444, root, &cleancache_failed_gets); | 309 | debugfs_create_u64("failed_gets", 0444, root, &cleancache_failed_gets); |
311 | debugfs_create_u64("puts", 0444, root, &cleancache_puts); | 310 | debugfs_create_u64("puts", 0444, root, &cleancache_puts); |
diff --git a/mm/hwpoison-inject.c b/mm/hwpoison-inject.c index 1a7497d015b2..5b7430bd83a6 100644 --- a/mm/hwpoison-inject.c +++ b/mm/hwpoison-inject.c | |||
@@ -77,63 +77,40 @@ static void pfn_inject_exit(void) | |||
77 | 77 | ||
78 | static int pfn_inject_init(void) | 78 | static int pfn_inject_init(void) |
79 | { | 79 | { |
80 | struct dentry *dentry; | ||
81 | |||
82 | hwpoison_dir = debugfs_create_dir("hwpoison", NULL); | 80 | hwpoison_dir = debugfs_create_dir("hwpoison", NULL); |
83 | if (hwpoison_dir == NULL) | ||
84 | return -ENOMEM; | ||
85 | 81 | ||
86 | /* | 82 | /* |
87 | * Note that the below poison/unpoison interfaces do not involve | 83 | * Note that the below poison/unpoison interfaces do not involve |
88 | * hardware status change, hence do not require hardware support. | 84 | * hardware status change, hence do not require hardware support. |
89 | * They are mainly for testing hwpoison in software level. | 85 | * They are mainly for testing hwpoison in software level. |
90 | */ | 86 | */ |
91 | dentry = debugfs_create_file("corrupt-pfn", 0200, hwpoison_dir, | 87 | debugfs_create_file("corrupt-pfn", 0200, hwpoison_dir, NULL, |
92 | NULL, &hwpoison_fops); | 88 | &hwpoison_fops); |
93 | if (!dentry) | 89 | |
94 | goto fail; | 90 | debugfs_create_file("unpoison-pfn", 0200, hwpoison_dir, NULL, |
95 | 91 | &unpoison_fops); | |
96 | dentry = debugfs_create_file("unpoison-pfn", 0200, hwpoison_dir, | 92 | |
97 | NULL, &unpoison_fops); | 93 | debugfs_create_u32("corrupt-filter-enable", 0600, hwpoison_dir, |
98 | if (!dentry) | 94 | &hwpoison_filter_enable); |
99 | goto fail; | 95 | |
100 | 96 | debugfs_create_u32("corrupt-filter-dev-major", 0600, hwpoison_dir, | |
101 | dentry = debugfs_create_u32("corrupt-filter-enable", 0600, | 97 | &hwpoison_filter_dev_major); |
102 | hwpoison_dir, &hwpoison_filter_enable); | 98 | |
103 | if (!dentry) | 99 | debugfs_create_u32("corrupt-filter-dev-minor", 0600, hwpoison_dir, |
104 | goto fail; | 100 | &hwpoison_filter_dev_minor); |
105 | 101 | ||
106 | dentry = debugfs_create_u32("corrupt-filter-dev-major", 0600, | 102 | debugfs_create_u64("corrupt-filter-flags-mask", 0600, hwpoison_dir, |
107 | hwpoison_dir, &hwpoison_filter_dev_major); | 103 | &hwpoison_filter_flags_mask); |
108 | if (!dentry) | 104 | |
109 | goto fail; | 105 | debugfs_create_u64("corrupt-filter-flags-value", 0600, hwpoison_dir, |
110 | 106 | &hwpoison_filter_flags_value); | |
111 | dentry = debugfs_create_u32("corrupt-filter-dev-minor", 0600, | ||
112 | hwpoison_dir, &hwpoison_filter_dev_minor); | ||
113 | if (!dentry) | ||
114 | goto fail; | ||
115 | |||
116 | dentry = debugfs_create_u64("corrupt-filter-flags-mask", 0600, | ||
117 | hwpoison_dir, &hwpoison_filter_flags_mask); | ||
118 | if (!dentry) | ||
119 | goto fail; | ||
120 | |||
121 | dentry = debugfs_create_u64("corrupt-filter-flags-value", 0600, | ||
122 | hwpoison_dir, &hwpoison_filter_flags_value); | ||
123 | if (!dentry) | ||
124 | goto fail; | ||
125 | 107 | ||
126 | #ifdef CONFIG_MEMCG | 108 | #ifdef CONFIG_MEMCG |
127 | dentry = debugfs_create_u64("corrupt-filter-memcg", 0600, | 109 | debugfs_create_u64("corrupt-filter-memcg", 0600, hwpoison_dir, |
128 | hwpoison_dir, &hwpoison_filter_memcg); | 110 | &hwpoison_filter_memcg); |
129 | if (!dentry) | ||
130 | goto fail; | ||
131 | #endif | 111 | #endif |
132 | 112 | ||
133 | return 0; | 113 | return 0; |
134 | fail: | ||
135 | pfn_inject_exit(); | ||
136 | return -ENOMEM; | ||
137 | } | 114 | } |
138 | 115 | ||
139 | module_init(pfn_inject_init); | 116 | module_init(pfn_inject_init); |
diff --git a/mm/kmemleak.c b/mm/kmemleak.c index aa8f4fa93ca3..dbbd518fb6b3 100644 --- a/mm/kmemleak.c +++ b/mm/kmemleak.c | |||
@@ -2105,14 +2105,9 @@ void __init kmemleak_init(void) | |||
2105 | */ | 2105 | */ |
2106 | static int __init kmemleak_late_init(void) | 2106 | static int __init kmemleak_late_init(void) |
2107 | { | 2107 | { |
2108 | struct dentry *dentry; | ||
2109 | |||
2110 | kmemleak_initialized = 1; | 2108 | kmemleak_initialized = 1; |
2111 | 2109 | ||
2112 | dentry = debugfs_create_file("kmemleak", 0644, NULL, NULL, | 2110 | debugfs_create_file("kmemleak", 0644, NULL, NULL, &kmemleak_fops); |
2113 | &kmemleak_fops); | ||
2114 | if (!dentry) | ||
2115 | pr_warn("Failed to create the debugfs kmemleak file\n"); | ||
2116 | 2111 | ||
2117 | if (kmemleak_error) { | 2112 | if (kmemleak_error) { |
2118 | /* | 2113 | /* |
diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c index 0787d33b80d8..db09eb3669c5 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c | |||
@@ -575,8 +575,6 @@ static void __init zs_stat_init(void) | |||
575 | } | 575 | } |
576 | 576 | ||
577 | zs_stat_root = debugfs_create_dir("zsmalloc", NULL); | 577 | zs_stat_root = debugfs_create_dir("zsmalloc", NULL); |
578 | if (!zs_stat_root) | ||
579 | pr_warn("debugfs 'zsmalloc' stat dir creation failed\n"); | ||
580 | } | 578 | } |
581 | 579 | ||
582 | static void __exit zs_stat_exit(void) | 580 | static void __exit zs_stat_exit(void) |
@@ -647,29 +645,15 @@ DEFINE_SHOW_ATTRIBUTE(zs_stats_size); | |||
647 | 645 | ||
648 | static void zs_pool_stat_create(struct zs_pool *pool, const char *name) | 646 | static void zs_pool_stat_create(struct zs_pool *pool, const char *name) |
649 | { | 647 | { |
650 | struct dentry *entry; | ||
651 | |||
652 | if (!zs_stat_root) { | 648 | if (!zs_stat_root) { |
653 | pr_warn("no root stat dir, not creating <%s> stat dir\n", name); | 649 | pr_warn("no root stat dir, not creating <%s> stat dir\n", name); |
654 | return; | 650 | return; |
655 | } | 651 | } |
656 | 652 | ||
657 | entry = debugfs_create_dir(name, zs_stat_root); | 653 | pool->stat_dentry = debugfs_create_dir(name, zs_stat_root); |
658 | if (!entry) { | 654 | |
659 | pr_warn("debugfs dir <%s> creation failed\n", name); | 655 | debugfs_create_file("classes", S_IFREG | 0444, pool->stat_dentry, pool, |
660 | return; | 656 | &zs_stats_size_fops); |
661 | } | ||
662 | pool->stat_dentry = entry; | ||
663 | |||
664 | entry = debugfs_create_file("classes", S_IFREG | 0444, | ||
665 | pool->stat_dentry, pool, | ||
666 | &zs_stats_size_fops); | ||
667 | if (!entry) { | ||
668 | pr_warn("%s: debugfs file entry <%s> creation failed\n", | ||
669 | name, "classes"); | ||
670 | debugfs_remove_recursive(pool->stat_dentry); | ||
671 | pool->stat_dentry = NULL; | ||
672 | } | ||
673 | } | 657 | } |
674 | 658 | ||
675 | static void zs_pool_stat_destroy(struct zs_pool *pool) | 659 | static void zs_pool_stat_destroy(struct zs_pool *pool) |
diff --git a/mm/zswap.c b/mm/zswap.c index 2412042f5550..0e22744a76cb 100644 --- a/mm/zswap.c +++ b/mm/zswap.c | |||
@@ -1253,8 +1253,6 @@ static int __init zswap_debugfs_init(void) | |||
1253 | return -ENODEV; | 1253 | return -ENODEV; |
1254 | 1254 | ||
1255 | zswap_debugfs_root = debugfs_create_dir("zswap", NULL); | 1255 | zswap_debugfs_root = debugfs_create_dir("zswap", NULL); |
1256 | if (!zswap_debugfs_root) | ||
1257 | return -ENOMEM; | ||
1258 | 1256 | ||
1259 | debugfs_create_u64("pool_limit_hit", 0444, | 1257 | debugfs_create_u64("pool_limit_hit", 0444, |
1260 | zswap_debugfs_root, &zswap_pool_limit_hit); | 1258 | zswap_debugfs_root, &zswap_pool_limit_hit); |
diff --git a/net/ceph/ceph_common.c b/net/ceph/ceph_common.c index 1c811c74bfc0..4eeea4d5c3ef 100644 --- a/net/ceph/ceph_common.c +++ b/net/ceph/ceph_common.c | |||
@@ -776,9 +776,7 @@ static int __init init_ceph_lib(void) | |||
776 | { | 776 | { |
777 | int ret = 0; | 777 | int ret = 0; |
778 | 778 | ||
779 | ret = ceph_debugfs_init(); | 779 | ceph_debugfs_init(); |
780 | if (ret < 0) | ||
781 | goto out; | ||
782 | 780 | ||
783 | ret = ceph_crypto_init(); | 781 | ret = ceph_crypto_init(); |
784 | if (ret < 0) | 782 | if (ret < 0) |
@@ -803,7 +801,6 @@ out_crypto: | |||
803 | ceph_crypto_shutdown(); | 801 | ceph_crypto_shutdown(); |
804 | out_debugfs: | 802 | out_debugfs: |
805 | ceph_debugfs_cleanup(); | 803 | ceph_debugfs_cleanup(); |
806 | out: | ||
807 | return ret; | 804 | return ret; |
808 | } | 805 | } |
809 | 806 | ||
diff --git a/net/ceph/debugfs.c b/net/ceph/debugfs.c index 63aef9915f75..7cb992e55475 100644 --- a/net/ceph/debugfs.c +++ b/net/ceph/debugfs.c | |||
@@ -389,12 +389,9 @@ CEPH_DEFINE_SHOW_FUNC(monc_show) | |||
389 | CEPH_DEFINE_SHOW_FUNC(osdc_show) | 389 | CEPH_DEFINE_SHOW_FUNC(osdc_show) |
390 | CEPH_DEFINE_SHOW_FUNC(client_options_show) | 390 | CEPH_DEFINE_SHOW_FUNC(client_options_show) |
391 | 391 | ||
392 | int __init ceph_debugfs_init(void) | 392 | void __init ceph_debugfs_init(void) |
393 | { | 393 | { |
394 | ceph_debugfs_dir = debugfs_create_dir("ceph", NULL); | 394 | ceph_debugfs_dir = debugfs_create_dir("ceph", NULL); |
395 | if (!ceph_debugfs_dir) | ||
396 | return -ENOMEM; | ||
397 | return 0; | ||
398 | } | 395 | } |
399 | 396 | ||
400 | void ceph_debugfs_cleanup(void) | 397 | void ceph_debugfs_cleanup(void) |
@@ -402,9 +399,8 @@ void ceph_debugfs_cleanup(void) | |||
402 | debugfs_remove(ceph_debugfs_dir); | 399 | debugfs_remove(ceph_debugfs_dir); |
403 | } | 400 | } |
404 | 401 | ||
405 | int ceph_debugfs_client_init(struct ceph_client *client) | 402 | void ceph_debugfs_client_init(struct ceph_client *client) |
406 | { | 403 | { |
407 | int ret = -ENOMEM; | ||
408 | char name[80]; | 404 | char name[80]; |
409 | 405 | ||
410 | snprintf(name, sizeof(name), "%pU.client%lld", &client->fsid, | 406 | snprintf(name, sizeof(name), "%pU.client%lld", &client->fsid, |
@@ -412,56 +408,37 @@ int ceph_debugfs_client_init(struct ceph_client *client) | |||
412 | 408 | ||
413 | dout("ceph_debugfs_client_init %p %s\n", client, name); | 409 | dout("ceph_debugfs_client_init %p %s\n", client, name); |
414 | 410 | ||
415 | BUG_ON(client->debugfs_dir); | ||
416 | client->debugfs_dir = debugfs_create_dir(name, ceph_debugfs_dir); | 411 | client->debugfs_dir = debugfs_create_dir(name, ceph_debugfs_dir); |
417 | if (!client->debugfs_dir) | ||
418 | goto out; | ||
419 | 412 | ||
420 | client->monc.debugfs_file = debugfs_create_file("monc", | 413 | client->monc.debugfs_file = debugfs_create_file("monc", |
421 | 0400, | 414 | 0400, |
422 | client->debugfs_dir, | 415 | client->debugfs_dir, |
423 | client, | 416 | client, |
424 | &monc_show_fops); | 417 | &monc_show_fops); |
425 | if (!client->monc.debugfs_file) | ||
426 | goto out; | ||
427 | 418 | ||
428 | client->osdc.debugfs_file = debugfs_create_file("osdc", | 419 | client->osdc.debugfs_file = debugfs_create_file("osdc", |
429 | 0400, | 420 | 0400, |
430 | client->debugfs_dir, | 421 | client->debugfs_dir, |
431 | client, | 422 | client, |
432 | &osdc_show_fops); | 423 | &osdc_show_fops); |
433 | if (!client->osdc.debugfs_file) | ||
434 | goto out; | ||
435 | 424 | ||
436 | client->debugfs_monmap = debugfs_create_file("monmap", | 425 | client->debugfs_monmap = debugfs_create_file("monmap", |
437 | 0400, | 426 | 0400, |
438 | client->debugfs_dir, | 427 | client->debugfs_dir, |
439 | client, | 428 | client, |
440 | &monmap_show_fops); | 429 | &monmap_show_fops); |
441 | if (!client->debugfs_monmap) | ||
442 | goto out; | ||
443 | 430 | ||
444 | client->debugfs_osdmap = debugfs_create_file("osdmap", | 431 | client->debugfs_osdmap = debugfs_create_file("osdmap", |
445 | 0400, | 432 | 0400, |
446 | client->debugfs_dir, | 433 | client->debugfs_dir, |
447 | client, | 434 | client, |
448 | &osdmap_show_fops); | 435 | &osdmap_show_fops); |
449 | if (!client->debugfs_osdmap) | ||
450 | goto out; | ||
451 | 436 | ||
452 | client->debugfs_options = debugfs_create_file("client_options", | 437 | client->debugfs_options = debugfs_create_file("client_options", |
453 | 0400, | 438 | 0400, |
454 | client->debugfs_dir, | 439 | client->debugfs_dir, |
455 | client, | 440 | client, |
456 | &client_options_show_fops); | 441 | &client_options_show_fops); |
457 | if (!client->debugfs_options) | ||
458 | goto out; | ||
459 | |||
460 | return 0; | ||
461 | |||
462 | out: | ||
463 | ceph_debugfs_client_cleanup(client); | ||
464 | return ret; | ||
465 | } | 442 | } |
466 | 443 | ||
467 | void ceph_debugfs_client_cleanup(struct ceph_client *client) | 444 | void ceph_debugfs_client_cleanup(struct ceph_client *client) |
@@ -477,18 +454,16 @@ void ceph_debugfs_client_cleanup(struct ceph_client *client) | |||
477 | 454 | ||
478 | #else /* CONFIG_DEBUG_FS */ | 455 | #else /* CONFIG_DEBUG_FS */ |
479 | 456 | ||
480 | int __init ceph_debugfs_init(void) | 457 | void __init ceph_debugfs_init(void) |
481 | { | 458 | { |
482 | return 0; | ||
483 | } | 459 | } |
484 | 460 | ||
485 | void ceph_debugfs_cleanup(void) | 461 | void ceph_debugfs_cleanup(void) |
486 | { | 462 | { |
487 | } | 463 | } |
488 | 464 | ||
489 | int ceph_debugfs_client_init(struct ceph_client *client) | 465 | void ceph_debugfs_client_init(struct ceph_client *client) |
490 | { | 466 | { |
491 | return 0; | ||
492 | } | 467 | } |
493 | 468 | ||
494 | void ceph_debugfs_client_cleanup(struct ceph_client *client) | 469 | void ceph_debugfs_client_cleanup(struct ceph_client *client) |
diff --git a/net/sunrpc/debugfs.c b/net/sunrpc/debugfs.c index 95ebd76b132d..707d7aab1546 100644 --- a/net/sunrpc/debugfs.c +++ b/net/sunrpc/debugfs.c | |||
@@ -11,7 +11,6 @@ | |||
11 | #include "netns.h" | 11 | #include "netns.h" |
12 | 12 | ||
13 | static struct dentry *topdir; | 13 | static struct dentry *topdir; |
14 | static struct dentry *rpc_fault_dir; | ||
15 | static struct dentry *rpc_clnt_dir; | 14 | static struct dentry *rpc_clnt_dir; |
16 | static struct dentry *rpc_xprt_dir; | 15 | static struct dentry *rpc_xprt_dir; |
17 | 16 | ||
@@ -125,23 +124,16 @@ rpc_clnt_debugfs_register(struct rpc_clnt *clnt) | |||
125 | char name[24]; /* enough for "../../rpc_xprt/ + 8 hex digits + NULL */ | 124 | char name[24]; /* enough for "../../rpc_xprt/ + 8 hex digits + NULL */ |
126 | struct rpc_xprt *xprt; | 125 | struct rpc_xprt *xprt; |
127 | 126 | ||
128 | /* Already registered? */ | ||
129 | if (clnt->cl_debugfs || !rpc_clnt_dir) | ||
130 | return; | ||
131 | |||
132 | len = snprintf(name, sizeof(name), "%x", clnt->cl_clid); | 127 | len = snprintf(name, sizeof(name), "%x", clnt->cl_clid); |
133 | if (len >= sizeof(name)) | 128 | if (len >= sizeof(name)) |
134 | return; | 129 | return; |
135 | 130 | ||
136 | /* make the per-client dir */ | 131 | /* make the per-client dir */ |
137 | clnt->cl_debugfs = debugfs_create_dir(name, rpc_clnt_dir); | 132 | clnt->cl_debugfs = debugfs_create_dir(name, rpc_clnt_dir); |
138 | if (!clnt->cl_debugfs) | ||
139 | return; | ||
140 | 133 | ||
141 | /* make tasks file */ | 134 | /* make tasks file */ |
142 | if (!debugfs_create_file("tasks", S_IFREG | 0400, clnt->cl_debugfs, | 135 | debugfs_create_file("tasks", S_IFREG | 0400, clnt->cl_debugfs, clnt, |
143 | clnt, &tasks_fops)) | 136 | &tasks_fops); |
144 | goto out_err; | ||
145 | 137 | ||
146 | rcu_read_lock(); | 138 | rcu_read_lock(); |
147 | xprt = rcu_dereference(clnt->cl_xprt); | 139 | xprt = rcu_dereference(clnt->cl_xprt); |
@@ -157,8 +149,7 @@ rpc_clnt_debugfs_register(struct rpc_clnt *clnt) | |||
157 | if (len >= sizeof(name)) | 149 | if (len >= sizeof(name)) |
158 | goto out_err; | 150 | goto out_err; |
159 | 151 | ||
160 | if (!debugfs_create_symlink("xprt", clnt->cl_debugfs, name)) | 152 | debugfs_create_symlink("xprt", clnt->cl_debugfs, name); |
161 | goto out_err; | ||
162 | 153 | ||
163 | return; | 154 | return; |
164 | out_err: | 155 | out_err: |
@@ -226,9 +217,6 @@ rpc_xprt_debugfs_register(struct rpc_xprt *xprt) | |||
226 | static atomic_t cur_id; | 217 | static atomic_t cur_id; |
227 | char name[9]; /* 8 hex digits + NULL term */ | 218 | char name[9]; /* 8 hex digits + NULL term */ |
228 | 219 | ||
229 | if (!rpc_xprt_dir) | ||
230 | return; | ||
231 | |||
232 | id = (unsigned int)atomic_inc_return(&cur_id); | 220 | id = (unsigned int)atomic_inc_return(&cur_id); |
233 | 221 | ||
234 | len = snprintf(name, sizeof(name), "%x", id); | 222 | len = snprintf(name, sizeof(name), "%x", id); |
@@ -237,15 +225,10 @@ rpc_xprt_debugfs_register(struct rpc_xprt *xprt) | |||
237 | 225 | ||
238 | /* make the per-client dir */ | 226 | /* make the per-client dir */ |
239 | xprt->debugfs = debugfs_create_dir(name, rpc_xprt_dir); | 227 | xprt->debugfs = debugfs_create_dir(name, rpc_xprt_dir); |
240 | if (!xprt->debugfs) | ||
241 | return; | ||
242 | 228 | ||
243 | /* make tasks file */ | 229 | /* make tasks file */ |
244 | if (!debugfs_create_file("info", S_IFREG | 0400, xprt->debugfs, | 230 | debugfs_create_file("info", S_IFREG | 0400, xprt->debugfs, xprt, |
245 | xprt, &xprt_info_fops)) { | 231 | &xprt_info_fops); |
246 | debugfs_remove_recursive(xprt->debugfs); | ||
247 | xprt->debugfs = NULL; | ||
248 | } | ||
249 | 232 | ||
250 | atomic_set(&xprt->inject_disconnect, rpc_inject_disconnect); | 233 | atomic_set(&xprt->inject_disconnect, rpc_inject_disconnect); |
251 | } | 234 | } |
@@ -308,28 +291,11 @@ static const struct file_operations fault_disconnect_fops = { | |||
308 | .release = fault_release, | 291 | .release = fault_release, |
309 | }; | 292 | }; |
310 | 293 | ||
311 | static struct dentry * | ||
312 | inject_fault_dir(struct dentry *topdir) | ||
313 | { | ||
314 | struct dentry *faultdir; | ||
315 | |||
316 | faultdir = debugfs_create_dir("inject_fault", topdir); | ||
317 | if (!faultdir) | ||
318 | return NULL; | ||
319 | |||
320 | if (!debugfs_create_file("disconnect", S_IFREG | 0400, faultdir, | ||
321 | NULL, &fault_disconnect_fops)) | ||
322 | return NULL; | ||
323 | |||
324 | return faultdir; | ||
325 | } | ||
326 | |||
327 | void __exit | 294 | void __exit |
328 | sunrpc_debugfs_exit(void) | 295 | sunrpc_debugfs_exit(void) |
329 | { | 296 | { |
330 | debugfs_remove_recursive(topdir); | 297 | debugfs_remove_recursive(topdir); |
331 | topdir = NULL; | 298 | topdir = NULL; |
332 | rpc_fault_dir = NULL; | ||
333 | rpc_clnt_dir = NULL; | 299 | rpc_clnt_dir = NULL; |
334 | rpc_xprt_dir = NULL; | 300 | rpc_xprt_dir = NULL; |
335 | } | 301 | } |
@@ -337,26 +303,16 @@ sunrpc_debugfs_exit(void) | |||
337 | void __init | 303 | void __init |
338 | sunrpc_debugfs_init(void) | 304 | sunrpc_debugfs_init(void) |
339 | { | 305 | { |
340 | topdir = debugfs_create_dir("sunrpc", NULL); | 306 | struct dentry *rpc_fault_dir; |
341 | if (!topdir) | ||
342 | return; | ||
343 | 307 | ||
344 | rpc_fault_dir = inject_fault_dir(topdir); | 308 | topdir = debugfs_create_dir("sunrpc", NULL); |
345 | if (!rpc_fault_dir) | ||
346 | goto out_remove; | ||
347 | 309 | ||
348 | rpc_clnt_dir = debugfs_create_dir("rpc_clnt", topdir); | 310 | rpc_clnt_dir = debugfs_create_dir("rpc_clnt", topdir); |
349 | if (!rpc_clnt_dir) | ||
350 | goto out_remove; | ||
351 | 311 | ||
352 | rpc_xprt_dir = debugfs_create_dir("rpc_xprt", topdir); | 312 | rpc_xprt_dir = debugfs_create_dir("rpc_xprt", topdir); |
353 | if (!rpc_xprt_dir) | ||
354 | goto out_remove; | ||
355 | 313 | ||
356 | return; | 314 | rpc_fault_dir = debugfs_create_dir("inject_fault", topdir); |
357 | out_remove: | 315 | |
358 | debugfs_remove_recursive(topdir); | 316 | debugfs_create_file("disconnect", S_IFREG | 0400, rpc_fault_dir, NULL, |
359 | topdir = NULL; | 317 | &fault_disconnect_fops); |
360 | rpc_fault_dir = NULL; | ||
361 | rpc_clnt_dir = NULL; | ||
362 | } | 318 | } |
diff --git a/scripts/coccinelle/free/devm_free.cocci b/scripts/coccinelle/free/devm_free.cocci index a5af9e335190..fefd0331a2de 100644 --- a/scripts/coccinelle/free/devm_free.cocci +++ b/scripts/coccinelle/free/devm_free.cocci | |||
@@ -3,7 +3,7 @@ | |||
3 | /// functions. Values allocated using the devm_functions are freed when | 3 | /// functions. Values allocated using the devm_functions are freed when |
4 | /// the device is detached, and thus the use of the standard freeing | 4 | /// the device is detached, and thus the use of the standard freeing |
5 | /// function would cause a double free. | 5 | /// function would cause a double free. |
6 | /// See Documentation/driver-model/devres.txt for more information. | 6 | /// See Documentation/driver-model/devres.rst for more information. |
7 | /// | 7 | /// |
8 | /// A difficulty of detecting this problem is that the standard freeing | 8 | /// A difficulty of detecting this problem is that the standard freeing |
9 | /// function might be called from a different function than the one | 9 | /// function might be called from a different function than the one |
diff --git a/scripts/get_abi.pl b/scripts/get_abi.pl new file mode 100755 index 000000000000..c738cb795514 --- /dev/null +++ b/scripts/get_abi.pl | |||
@@ -0,0 +1,468 @@ | |||
1 | #!/usr/bin/perl | ||
2 | # SPDX-License-Identifier: GPL-2.0 | ||
3 | |||
4 | use strict; | ||
5 | use Pod::Usage; | ||
6 | use Getopt::Long; | ||
7 | use File::Find; | ||
8 | use Fcntl ':mode'; | ||
9 | |||
10 | my $help; | ||
11 | my $man; | ||
12 | my $debug; | ||
13 | my $prefix="Documentation/ABI"; | ||
14 | |||
15 | GetOptions( | ||
16 | "debug|d+" => \$debug, | ||
17 | "dir=s" => \$prefix, | ||
18 | 'help|?' => \$help, | ||
19 | man => \$man | ||
20 | ) or pod2usage(2); | ||
21 | |||
22 | pod2usage(1) if $help; | ||
23 | pod2usage(-exitstatus => 0, -verbose => 2) if $man; | ||
24 | |||
25 | pod2usage(2) if (scalar @ARGV < 1 || @ARGV > 2); | ||
26 | |||
27 | my ($cmd, $arg) = @ARGV; | ||
28 | |||
29 | pod2usage(2) if ($cmd ne "search" && $cmd ne "rest" && $cmd ne "validate"); | ||
30 | pod2usage(2) if ($cmd eq "search" && !$arg); | ||
31 | |||
32 | require Data::Dumper if ($debug); | ||
33 | |||
34 | my %data; | ||
35 | |||
36 | # | ||
37 | # Displays an error message, printing file name and line | ||
38 | # | ||
39 | sub parse_error($$$$) { | ||
40 | my ($file, $ln, $msg, $data) = @_; | ||
41 | |||
42 | print STDERR "file $file#$ln: $msg at\n\t$data"; | ||
43 | } | ||
44 | |||
45 | # | ||
46 | # Parse an ABI file, storing its contents at %data | ||
47 | # | ||
48 | sub parse_abi { | ||
49 | my $file = $File::Find::name; | ||
50 | |||
51 | my $mode = (stat($file))[2]; | ||
52 | return if ($mode & S_IFDIR); | ||
53 | return if ($file =~ m,/README,); | ||
54 | |||
55 | my $name = $file; | ||
56 | $name =~ s,.*/,,; | ||
57 | |||
58 | my $nametag = "File $name"; | ||
59 | $data{$nametag}->{what} = "File $name"; | ||
60 | $data{$nametag}->{type} = "File"; | ||
61 | $data{$nametag}->{file} = $name; | ||
62 | $data{$nametag}->{filepath} = $file; | ||
63 | $data{$nametag}->{is_file} = 1; | ||
64 | |||
65 | my $type = $file; | ||
66 | $type =~ s,.*/(.*)/.*,$1,; | ||
67 | |||
68 | my $what; | ||
69 | my $new_what; | ||
70 | my $tag; | ||
71 | my $ln; | ||
72 | my $xrefs; | ||
73 | my $space; | ||
74 | my @labels; | ||
75 | my $label; | ||
76 | |||
77 | print STDERR "Opening $file\n" if ($debug > 1); | ||
78 | open IN, $file; | ||
79 | while(<IN>) { | ||
80 | $ln++; | ||
81 | if (m/^(\S+)(:\s*)(.*)/i) { | ||
82 | my $new_tag = lc($1); | ||
83 | my $sep = $2; | ||
84 | my $content = $3; | ||
85 | |||
86 | if (!($new_tag =~ m/(what|where|date|kernelversion|contact|description|users)/)) { | ||
87 | if ($tag eq "description") { | ||
88 | # New "tag" is actually part of | ||
89 | # description. Don't consider it a tag | ||
90 | $new_tag = ""; | ||
91 | } elsif ($tag ne "") { | ||
92 | parse_error($file, $ln, "tag '$tag' is invalid", $_); | ||
93 | } | ||
94 | } | ||
95 | |||
96 | # Invalid, but it is a common mistake | ||
97 | if ($new_tag eq "where") { | ||
98 | parse_error($file, $ln, "tag 'Where' is invalid. Should be 'What:' instead", $_); | ||
99 | $new_tag = "what"; | ||
100 | } | ||
101 | |||
102 | if ($new_tag =~ m/what/) { | ||
103 | $space = ""; | ||
104 | if ($tag =~ m/what/) { | ||
105 | $what .= ", " . $content; | ||
106 | } else { | ||
107 | parse_error($file, $ln, "What '$what' doesn't have a description", "") if ($what && !$data{$what}->{description}); | ||
108 | |||
109 | $what = $content; | ||
110 | $label = $content; | ||
111 | $new_what = 1; | ||
112 | } | ||
113 | push @labels, [($content, $label)]; | ||
114 | $tag = $new_tag; | ||
115 | |||
116 | push @{$data{$nametag}->{xrefs}}, [($content, $label)] if ($data{$nametag}->{what}); | ||
117 | next; | ||
118 | } | ||
119 | |||
120 | if ($tag ne "" && $new_tag) { | ||
121 | $tag = $new_tag; | ||
122 | |||
123 | if ($new_what) { | ||
124 | @{$data{$what}->{label}} = @labels if ($data{$nametag}->{what}); | ||
125 | @labels = (); | ||
126 | $label = ""; | ||
127 | $new_what = 0; | ||
128 | |||
129 | $data{$what}->{type} = $type; | ||
130 | $data{$what}->{file} = $name; | ||
131 | $data{$what}->{filepath} = $file; | ||
132 | print STDERR "\twhat: $what\n" if ($debug > 1); | ||
133 | } | ||
134 | |||
135 | if (!$what) { | ||
136 | parse_error($file, $ln, "'What:' should come first:", $_); | ||
137 | next; | ||
138 | } | ||
139 | if ($tag eq "description") { | ||
140 | next if ($content =~ m/^\s*$/); | ||
141 | if ($content =~ m/^(\s*)(.*)/) { | ||
142 | my $new_content = $2; | ||
143 | $space = $new_tag . $sep . $1; | ||
144 | while ($space =~ s/\t+/' ' x (length($&) * 8 - length($`) % 8)/e) {} | ||
145 | $space =~ s/./ /g; | ||
146 | $data{$what}->{$tag} .= "$new_content\n"; | ||
147 | } | ||
148 | } else { | ||
149 | $data{$what}->{$tag} = $content; | ||
150 | } | ||
151 | next; | ||
152 | } | ||
153 | } | ||
154 | |||
155 | # Store any contents before tags at the database | ||
156 | if (!$tag && $data{$nametag}->{what}) { | ||
157 | $data{$nametag}->{description} .= $_; | ||
158 | next; | ||
159 | } | ||
160 | |||
161 | if ($tag eq "description") { | ||
162 | if (!$data{$what}->{description}) { | ||
163 | next if (m/^\s*\n/); | ||
164 | if (m/^(\s*)(.*)/) { | ||
165 | $space = $1; | ||
166 | while ($space =~ s/\t+/' ' x (length($&) * 8 - length($`) % 8)/e) {} | ||
167 | $data{$what}->{$tag} .= "$2\n"; | ||
168 | } | ||
169 | } else { | ||
170 | my $content = $_; | ||
171 | if (m/^\s*\n/) { | ||
172 | $data{$what}->{$tag} .= $content; | ||
173 | next; | ||
174 | } | ||
175 | |||
176 | while ($content =~ s/\t+/' ' x (length($&) * 8 - length($`) % 8)/e) {} | ||
177 | $space = "" if (!($content =~ s/^($space)//)); | ||
178 | |||
179 | # Compress spaces with tabs | ||
180 | $content =~ s<^ {8}> <\t>; | ||
181 | $content =~ s<^ {1,7}\t> <\t>; | ||
182 | $content =~ s< {1,7}\t> <\t>; | ||
183 | $data{$what}->{$tag} .= $content; | ||
184 | } | ||
185 | next; | ||
186 | } | ||
187 | if (m/^\s*(.*)/) { | ||
188 | $data{$what}->{$tag} .= "\n$1"; | ||
189 | $data{$what}->{$tag} =~ s/\n+$//; | ||
190 | next; | ||
191 | } | ||
192 | |||
193 | # Everything else is error | ||
194 | parse_error($file, $ln, "Unexpected line:", $_); | ||
195 | } | ||
196 | $data{$nametag}->{description} =~ s/^\n+//; | ||
197 | close IN; | ||
198 | } | ||
199 | |||
200 | # | ||
201 | # Outputs the book on ReST format | ||
202 | # | ||
203 | |||
204 | my %labels; | ||
205 | |||
206 | sub output_rest { | ||
207 | foreach my $what (sort { | ||
208 | ($data{$a}->{type} eq "File") cmp ($data{$b}->{type} eq "File") || | ||
209 | $a cmp $b | ||
210 | } keys %data) { | ||
211 | my $type = $data{$what}->{type}; | ||
212 | my $file = $data{$what}->{file}; | ||
213 | my $filepath = $data{$what}->{filepath}; | ||
214 | |||
215 | my $w = $what; | ||
216 | $w =~ s/([\(\)\_\-\*\=\^\~\\])/\\$1/g; | ||
217 | |||
218 | |||
219 | foreach my $p (@{$data{$what}->{label}}) { | ||
220 | my ($content, $label) = @{$p}; | ||
221 | $label = "abi_" . $label . " "; | ||
222 | $label =~ tr/A-Z/a-z/; | ||
223 | |||
224 | # Convert special chars to "_" | ||
225 | $label =~s/([\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xff])/_/g; | ||
226 | $label =~ s,_+,_,g; | ||
227 | $label =~ s,_$,,; | ||
228 | |||
229 | # Avoid duplicated labels | ||
230 | while (defined($labels{$label})) { | ||
231 | my @chars = ("A".."Z", "a".."z"); | ||
232 | $label .= $chars[rand @chars]; | ||
233 | } | ||
234 | $labels{$label} = 1; | ||
235 | |||
236 | $data{$what}->{label} .= $label; | ||
237 | |||
238 | printf ".. _%s:\n\n", $label; | ||
239 | |||
240 | # only one label is enough | ||
241 | last; | ||
242 | } | ||
243 | |||
244 | |||
245 | $filepath =~ s,.*/(.*/.*),\1,;; | ||
246 | $filepath =~ s,[/\-],_,g;; | ||
247 | my $fileref = "abi_file_".$filepath; | ||
248 | |||
249 | if ($type eq "File") { | ||
250 | my $bar = $w; | ||
251 | $bar =~ s/./-/g; | ||
252 | |||
253 | print ".. _$fileref:\n\n"; | ||
254 | print "$w\n$bar\n\n"; | ||
255 | } else { | ||
256 | my @names = split /\s*,\s*/,$w; | ||
257 | |||
258 | my $len = 0; | ||
259 | |||
260 | foreach my $name (@names) { | ||
261 | $len = length($name) if (length($name) > $len); | ||
262 | } | ||
263 | |||
264 | print "What:\n\n"; | ||
265 | |||
266 | print "+-" . "-" x $len . "-+\n"; | ||
267 | foreach my $name (@names) { | ||
268 | printf "| %s", $name . " " x ($len - length($name)) . " |\n"; | ||
269 | print "+-" . "-" x $len . "-+\n"; | ||
270 | } | ||
271 | print "\n"; | ||
272 | } | ||
273 | |||
274 | print "Defined on file :ref:`$file <$fileref>`\n\n" if ($type ne "File"); | ||
275 | |||
276 | my $desc = $data{$what}->{description}; | ||
277 | $desc =~ s/^\s+//; | ||
278 | |||
279 | # Remove title markups from the description, as they won't work | ||
280 | $desc =~ s/\n[\-\*\=\^\~]+\n/\n/g; | ||
281 | |||
282 | if (!($desc =~ /^\s*$/)) { | ||
283 | if ($desc =~ m/\:\n/ || $desc =~ m/\n[\t ]+/ || $desc =~ m/[\x00-\x08\x0b-\x1f\x7b-\xff]/) { | ||
284 | # put everything inside a code block | ||
285 | $desc =~ s/\n/\n /g; | ||
286 | |||
287 | print "::\n\n"; | ||
288 | print " $desc\n\n"; | ||
289 | } else { | ||
290 | # Escape any special chars from description | ||
291 | $desc =~s/([\x00-\x08\x0b-\x1f\x21-\x2a\x2d\x2f\x3c-\x40\x5c\x5e-\x60\x7b-\xff])/\\$1/g; | ||
292 | |||
293 | print "$desc\n\n"; | ||
294 | } | ||
295 | } else { | ||
296 | print "DESCRIPTION MISSING for $what\n\n" if (!$data{$what}->{is_file}); | ||
297 | } | ||
298 | |||
299 | if ($data{$what}->{xrefs}) { | ||
300 | printf "Has the following ABI:\n\n"; | ||
301 | |||
302 | foreach my $p(@{$data{$what}->{xrefs}}) { | ||
303 | my ($content, $label) = @{$p}; | ||
304 | $label = "abi_" . $label . " "; | ||
305 | $label =~ tr/A-Z/a-z/; | ||
306 | |||
307 | # Convert special chars to "_" | ||
308 | $label =~s/([\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xff])/_/g; | ||
309 | $label =~ s,_+,_,g; | ||
310 | $label =~ s,_$,,; | ||
311 | |||
312 | # Escape special chars from content | ||
313 | $content =~s/([\x00-\x1f\x21-\x2f\x3a-\x40\x7b-\xff])/\\$1/g; | ||
314 | |||
315 | print "- :ref:`$content <$label>`\n\n"; | ||
316 | } | ||
317 | } | ||
318 | } | ||
319 | } | ||
320 | |||
321 | # | ||
322 | # Searches for ABI symbols | ||
323 | # | ||
324 | sub search_symbols { | ||
325 | foreach my $what (sort keys %data) { | ||
326 | next if (!($what =~ m/($arg)/)); | ||
327 | |||
328 | my $type = $data{$what}->{type}; | ||
329 | next if ($type eq "File"); | ||
330 | |||
331 | my $file = $data{$what}->{filepath}; | ||
332 | |||
333 | my $bar = $what; | ||
334 | $bar =~ s/./-/g; | ||
335 | |||
336 | print "\n$what\n$bar\n\n"; | ||
337 | |||
338 | my $kernelversion = $data{$what}->{kernelversion}; | ||
339 | my $contact = $data{$what}->{contact}; | ||
340 | my $users = $data{$what}->{users}; | ||
341 | my $date = $data{$what}->{date}; | ||
342 | my $desc = $data{$what}->{description}; | ||
343 | $kernelversion =~ s/^\s+//; | ||
344 | $contact =~ s/^\s+//; | ||
345 | $users =~ s/^\s+//; | ||
346 | $users =~ s/\n//g; | ||
347 | $date =~ s/^\s+//; | ||
348 | $desc =~ s/^\s+//; | ||
349 | |||
350 | printf "Kernel version:\t\t%s\n", $kernelversion if ($kernelversion); | ||
351 | printf "Date:\t\t\t%s\n", $date if ($date); | ||
352 | printf "Contact:\t\t%s\n", $contact if ($contact); | ||
353 | printf "Users:\t\t\t%s\n", $users if ($users); | ||
354 | print "Defined on file:\t$file\n\n"; | ||
355 | print "Description:\n\n$desc"; | ||
356 | } | ||
357 | } | ||
358 | |||
359 | |||
360 | # | ||
361 | # Parses all ABI files located at $prefix dir | ||
362 | # | ||
363 | find({wanted =>\&parse_abi, no_chdir => 1}, $prefix); | ||
364 | |||
365 | print STDERR Data::Dumper->Dump([\%data], [qw(*data)]) if ($debug); | ||
366 | |||
367 | # | ||
368 | # Handles the command | ||
369 | # | ||
370 | if ($cmd eq "rest") { | ||
371 | output_rest; | ||
372 | } elsif ($cmd eq "search") { | ||
373 | search_symbols; | ||
374 | } | ||
375 | |||
376 | |||
377 | __END__ | ||
378 | |||
379 | =head1 NAME | ||
380 | |||
381 | abi_book.pl - parse the Linux ABI files and produce a ReST book. | ||
382 | |||
383 | =head1 SYNOPSIS | ||
384 | |||
385 | B<abi_book.pl> [--debug] [--man] [--help] [--dir=<dir>] <COMAND> [<ARGUMENT>] | ||
386 | |||
387 | Where <COMMAND> can be: | ||
388 | |||
389 | =over 8 | ||
390 | |||
391 | B<search> [SEARCH_REGEX] - search for [SEARCH_REGEX] inside ABI | ||
392 | |||
393 | B<rest> - output the ABI in ReST markup language | ||
394 | |||
395 | B<validate> - validate the ABI contents | ||
396 | |||
397 | =back | ||
398 | |||
399 | =head1 OPTIONS | ||
400 | |||
401 | =over 8 | ||
402 | |||
403 | =item B<--dir> | ||
404 | |||
405 | Changes the location of the ABI search. By default, it uses | ||
406 | the Documentation/ABI directory. | ||
407 | |||
408 | =item B<--debug> | ||
409 | |||
410 | Put the script in verbose mode, useful for debugging. Can be called multiple | ||
411 | times, to increase verbosity. | ||
412 | |||
413 | =item B<--help> | ||
414 | |||
415 | Prints a brief help message and exits. | ||
416 | |||
417 | =item B<--man> | ||
418 | |||
419 | Prints the manual page and exits. | ||
420 | |||
421 | =back | ||
422 | |||
423 | =head1 DESCRIPTION | ||
424 | |||
425 | Parse the Linux ABI files from ABI DIR (usually located at Documentation/ABI), | ||
426 | allowing to search for ABI symbols or to produce a ReST book containing | ||
427 | the Linux ABI documentation. | ||
428 | |||
429 | =head1 EXAMPLES | ||
430 | |||
431 | Search for all stable symbols with the word "usb": | ||
432 | |||
433 | =over 8 | ||
434 | |||
435 | $ scripts/get_abi.pl search usb --dir Documentation/ABI/stable | ||
436 | |||
437 | =back | ||
438 | |||
439 | Search for all symbols that match the regex expression "usb.*cap": | ||
440 | |||
441 | =over 8 | ||
442 | |||
443 | $ scripts/get_abi.pl search usb.*cap | ||
444 | |||
445 | =back | ||
446 | |||
447 | Output all obsoleted symbols in ReST format | ||
448 | |||
449 | =over 8 | ||
450 | |||
451 | $ scripts/get_abi.pl rest --dir Documentation/ABI/obsolete | ||
452 | |||
453 | =back | ||
454 | |||
455 | =head1 BUGS | ||
456 | |||
457 | Report bugs to Mauro Carvalho Chehab <mchehab+samsung@kernel.org> | ||
458 | |||
459 | =head1 COPYRIGHT | ||
460 | |||
461 | Copyright (c) 2016-2019 by Mauro Carvalho Chehab <mchehab+samsung@kernel.org>. | ||
462 | |||
463 | License GPLv2: GNU GPL version 2 <http://gnu.org/licenses/gpl.html>. | ||
464 | |||
465 | This is free software: you are free to change and redistribute it. | ||
466 | There is NO WARRANTY, to the extent permitted by law. | ||
467 | |||
468 | =cut | ||
diff --git a/sound/soc/rockchip/rk3399_gru_sound.c b/sound/soc/rockchip/rk3399_gru_sound.c index 7a3e138594c1..c16b0ffe8cfc 100644 --- a/sound/soc/rockchip/rk3399_gru_sound.c +++ b/sound/soc/rockchip/rk3399_gru_sound.c | |||
@@ -422,7 +422,7 @@ static const struct dailink_match_data dailink_match[] = { | |||
422 | }, | 422 | }, |
423 | }; | 423 | }; |
424 | 424 | ||
425 | static int of_dev_node_match(struct device *dev, void *data) | 425 | static int of_dev_node_match(struct device *dev, const void *data) |
426 | { | 426 | { |
427 | return dev->of_node == data; | 427 | return dev->of_node == data; |
428 | } | 428 | } |
diff --git a/tools/firmware/Makefile b/tools/firmware/Makefile index d329825aa31b..cfb297e6ef5a 100644 --- a/tools/firmware/Makefile +++ b/tools/firmware/Makefile | |||
@@ -10,4 +10,4 @@ all: ihex2fw | |||
10 | clean: | 10 | clean: |
11 | $(RM) ihex2fw | 11 | $(RM) ihex2fw |
12 | 12 | ||
13 | .PHONY: all clean \ No newline at end of file | 13 | .PHONY: all clean |
diff --git a/tools/testing/selftests/firmware/fw_filesystem.sh b/tools/testing/selftests/firmware/fw_filesystem.sh index a4320c4b44dc..f901076aa2ea 100755 --- a/tools/testing/selftests/firmware/fw_filesystem.sh +++ b/tools/testing/selftests/firmware/fw_filesystem.sh | |||
@@ -153,13 +153,18 @@ config_set_read_fw_idx() | |||
153 | 153 | ||
154 | read_firmwares() | 154 | read_firmwares() |
155 | { | 155 | { |
156 | if [ "$1" = "xzonly" ]; then | ||
157 | fwfile="${FW}-orig" | ||
158 | else | ||
159 | fwfile="$FW" | ||
160 | fi | ||
156 | for i in $(seq 0 3); do | 161 | for i in $(seq 0 3); do |
157 | config_set_read_fw_idx $i | 162 | config_set_read_fw_idx $i |
158 | # Verify the contents are what we expect. | 163 | # Verify the contents are what we expect. |
159 | # -Z required for now -- check for yourself, md5sum | 164 | # -Z required for now -- check for yourself, md5sum |
160 | # on $FW and DIR/read_firmware will yield the same. Even | 165 | # on $FW and DIR/read_firmware will yield the same. Even |
161 | # cmp agrees, so something is off. | 166 | # cmp agrees, so something is off. |
162 | if ! diff -q -Z "$FW" $DIR/read_firmware 2>/dev/null ; then | 167 | if ! diff -q -Z "$fwfile" $DIR/read_firmware 2>/dev/null ; then |
163 | echo "request #$i: firmware was not loaded" >&2 | 168 | echo "request #$i: firmware was not loaded" >&2 |
164 | exit 1 | 169 | exit 1 |
165 | fi | 170 | fi |
@@ -246,17 +251,17 @@ test_request_firmware_nowait_custom_nofile() | |||
246 | 251 | ||
247 | test_batched_request_firmware() | 252 | test_batched_request_firmware() |
248 | { | 253 | { |
249 | echo -n "Batched request_firmware() try #$1: " | 254 | echo -n "Batched request_firmware() $2 try #$1: " |
250 | config_reset | 255 | config_reset |
251 | config_trigger_sync | 256 | config_trigger_sync |
252 | read_firmwares | 257 | read_firmwares $2 |
253 | release_all_firmware | 258 | release_all_firmware |
254 | echo "OK" | 259 | echo "OK" |
255 | } | 260 | } |
256 | 261 | ||
257 | test_batched_request_firmware_direct() | 262 | test_batched_request_firmware_direct() |
258 | { | 263 | { |
259 | echo -n "Batched request_firmware_direct() try #$1: " | 264 | echo -n "Batched request_firmware_direct() $2 try #$1: " |
260 | config_reset | 265 | config_reset |
261 | config_set_sync_direct | 266 | config_set_sync_direct |
262 | config_trigger_sync | 267 | config_trigger_sync |
@@ -266,7 +271,7 @@ test_batched_request_firmware_direct() | |||
266 | 271 | ||
267 | test_request_firmware_nowait_uevent() | 272 | test_request_firmware_nowait_uevent() |
268 | { | 273 | { |
269 | echo -n "Batched request_firmware_nowait(uevent=true) try #$1: " | 274 | echo -n "Batched request_firmware_nowait(uevent=true) $2 try #$1: " |
270 | config_reset | 275 | config_reset |
271 | config_trigger_async | 276 | config_trigger_async |
272 | release_all_firmware | 277 | release_all_firmware |
@@ -275,11 +280,16 @@ test_request_firmware_nowait_uevent() | |||
275 | 280 | ||
276 | test_request_firmware_nowait_custom() | 281 | test_request_firmware_nowait_custom() |
277 | { | 282 | { |
278 | echo -n "Batched request_firmware_nowait(uevent=false) try #$1: " | 283 | echo -n "Batched request_firmware_nowait(uevent=false) $2 try #$1: " |
279 | config_reset | 284 | config_reset |
280 | config_unset_uevent | 285 | config_unset_uevent |
281 | RANDOM_FILE_PATH=$(setup_random_file) | 286 | RANDOM_FILE_PATH=$(setup_random_file) |
282 | RANDOM_FILE="$(basename $RANDOM_FILE_PATH)" | 287 | RANDOM_FILE="$(basename $RANDOM_FILE_PATH)" |
288 | if [ "$2" = "both" ]; then | ||
289 | xz -9 -C crc32 -k $RANDOM_FILE_PATH | ||
290 | elif [ "$2" = "xzonly" ]; then | ||
291 | xz -9 -C crc32 $RANDOM_FILE_PATH | ||
292 | fi | ||
283 | config_set_name $RANDOM_FILE | 293 | config_set_name $RANDOM_FILE |
284 | config_trigger_async | 294 | config_trigger_async |
285 | release_all_firmware | 295 | release_all_firmware |
@@ -294,19 +304,19 @@ test_config_present | |||
294 | echo | 304 | echo |
295 | echo "Testing with the file present..." | 305 | echo "Testing with the file present..." |
296 | for i in $(seq 1 5); do | 306 | for i in $(seq 1 5); do |
297 | test_batched_request_firmware $i | 307 | test_batched_request_firmware $i normal |
298 | done | 308 | done |
299 | 309 | ||
300 | for i in $(seq 1 5); do | 310 | for i in $(seq 1 5); do |
301 | test_batched_request_firmware_direct $i | 311 | test_batched_request_firmware_direct $i normal |
302 | done | 312 | done |
303 | 313 | ||
304 | for i in $(seq 1 5); do | 314 | for i in $(seq 1 5); do |
305 | test_request_firmware_nowait_uevent $i | 315 | test_request_firmware_nowait_uevent $i normal |
306 | done | 316 | done |
307 | 317 | ||
308 | for i in $(seq 1 5); do | 318 | for i in $(seq 1 5); do |
309 | test_request_firmware_nowait_custom $i | 319 | test_request_firmware_nowait_custom $i normal |
310 | done | 320 | done |
311 | 321 | ||
312 | # Test for file not found, errors are expected, the failure would be | 322 | # Test for file not found, errors are expected, the failure would be |
@@ -329,4 +339,47 @@ for i in $(seq 1 5); do | |||
329 | test_request_firmware_nowait_custom_nofile $i | 339 | test_request_firmware_nowait_custom_nofile $i |
330 | done | 340 | done |
331 | 341 | ||
342 | test "$HAS_FW_LOADER_COMPRESS" != "yes" && exit 0 | ||
343 | |||
344 | # test with both files present | ||
345 | xz -9 -C crc32 -k $FW | ||
346 | config_set_name $NAME | ||
347 | echo | ||
348 | echo "Testing with both plain and xz files present..." | ||
349 | for i in $(seq 1 5); do | ||
350 | test_batched_request_firmware $i both | ||
351 | done | ||
352 | |||
353 | for i in $(seq 1 5); do | ||
354 | test_batched_request_firmware_direct $i both | ||
355 | done | ||
356 | |||
357 | for i in $(seq 1 5); do | ||
358 | test_request_firmware_nowait_uevent $i both | ||
359 | done | ||
360 | |||
361 | for i in $(seq 1 5); do | ||
362 | test_request_firmware_nowait_custom $i both | ||
363 | done | ||
364 | |||
365 | # test with only xz file present | ||
366 | mv "$FW" "${FW}-orig" | ||
367 | echo | ||
368 | echo "Testing with only xz file present..." | ||
369 | for i in $(seq 1 5); do | ||
370 | test_batched_request_firmware $i xzonly | ||
371 | done | ||
372 | |||
373 | for i in $(seq 1 5); do | ||
374 | test_batched_request_firmware_direct $i xzonly | ||
375 | done | ||
376 | |||
377 | for i in $(seq 1 5); do | ||
378 | test_request_firmware_nowait_uevent $i xzonly | ||
379 | done | ||
380 | |||
381 | for i in $(seq 1 5); do | ||
382 | test_request_firmware_nowait_custom $i xzonly | ||
383 | done | ||
384 | |||
332 | exit 0 | 385 | exit 0 |
diff --git a/tools/testing/selftests/firmware/fw_lib.sh b/tools/testing/selftests/firmware/fw_lib.sh index 1cbb12e284a6..f236cc295450 100755 --- a/tools/testing/selftests/firmware/fw_lib.sh +++ b/tools/testing/selftests/firmware/fw_lib.sh | |||
@@ -50,6 +50,7 @@ check_setup() | |||
50 | { | 50 | { |
51 | HAS_FW_LOADER_USER_HELPER="$(kconfig_has CONFIG_FW_LOADER_USER_HELPER=y)" | 51 | HAS_FW_LOADER_USER_HELPER="$(kconfig_has CONFIG_FW_LOADER_USER_HELPER=y)" |
52 | HAS_FW_LOADER_USER_HELPER_FALLBACK="$(kconfig_has CONFIG_FW_LOADER_USER_HELPER_FALLBACK=y)" | 52 | HAS_FW_LOADER_USER_HELPER_FALLBACK="$(kconfig_has CONFIG_FW_LOADER_USER_HELPER_FALLBACK=y)" |
53 | HAS_FW_LOADER_COMPRESS="$(kconfig_has CONFIG_FW_LOADER_COMPRESS=y)" | ||
53 | PROC_FW_IGNORE_SYSFS_FALLBACK="0" | 54 | PROC_FW_IGNORE_SYSFS_FALLBACK="0" |
54 | PROC_FW_FORCE_SYSFS_FALLBACK="0" | 55 | PROC_FW_FORCE_SYSFS_FALLBACK="0" |
55 | 56 | ||
@@ -84,6 +85,12 @@ check_setup() | |||
84 | fi | 85 | fi |
85 | 86 | ||
86 | OLD_FWPATH="$(cat /sys/module/firmware_class/parameters/path)" | 87 | OLD_FWPATH="$(cat /sys/module/firmware_class/parameters/path)" |
88 | |||
89 | if [ "$HAS_FW_LOADER_COMPRESS" = "yes" ]; then | ||
90 | if ! which xz 2> /dev/null > /dev/null; then | ||
91 | HAS_FW_LOADER_COMPRESS="" | ||
92 | fi | ||
93 | fi | ||
87 | } | 94 | } |
88 | 95 | ||
89 | verify_reqs() | 96 | verify_reqs() |
diff --git a/tools/testing/selftests/firmware/fw_run_tests.sh b/tools/testing/selftests/firmware/fw_run_tests.sh index cffdd4eb0a57..8e14d555c197 100755 --- a/tools/testing/selftests/firmware/fw_run_tests.sh +++ b/tools/testing/selftests/firmware/fw_run_tests.sh | |||
@@ -11,6 +11,7 @@ source $TEST_DIR/fw_lib.sh | |||
11 | 11 | ||
12 | export HAS_FW_LOADER_USER_HELPER="" | 12 | export HAS_FW_LOADER_USER_HELPER="" |
13 | export HAS_FW_LOADER_USER_HELPER_FALLBACK="" | 13 | export HAS_FW_LOADER_USER_HELPER_FALLBACK="" |
14 | export HAS_FW_LOADER_COMPRESS="" | ||
14 | 15 | ||
15 | run_tests() | 16 | run_tests() |
16 | { | 17 | { |