Skip to content

Commit 9a3d7fd

Browse files
committed
Merge tag 'driver-core-5.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core
Pull driver core updates from Greg KH: "Here is the "big" set of driver core patches for 5.5-rc1 There's a few minor cleanups and fixes in here, but the majority of the patches in here fall into two buckets: - debugfs api cleanups and fixes - driver core device link support for boot dependancy issues The debugfs api cleanups are working to slowly refactor the debugfs apis so that it is even harder to use incorrectly. That work has been happening for the past few kernel releases and will continue over time, it's a long-term project/goal The driver core device link support missed 5.4 by just a bit, so it's been sitting and baking for many months now. It's from Saravana Kannan to help resolve the problems that DT-based systems have at boot time with dependancy graphs and kernel modules. Turns out that no one has actually tried to build a generic arm64 kernel with loads of modules and have it "just work" for a variety of platforms (like a distro kernel). The big problem turned out to be a lack of dependency information between different areas of DT entries, and the work here resolves that problem and now allows devices to boot properly, and quicker than a monolith kernel. All of these patches have been in linux-next for a long time with no reported issues" * tag 'driver-core-5.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (68 commits) tracing: Remove unnecessary DEBUG_FS dependency of: property: Add device link support for interrupt-parent, dmas and -gpio(s) debugfs: Fix !DEBUG_FS debugfs_create_automount of: property: Add device link support for "iommu-map" of: property: Fix the semantics of of_is_ancestor_of() i2c: of: Populate fwnode in of_i2c_get_board_info() drivers: base: Fix Kconfig indentation firmware_loader: Fix labels with comma for builtin firmware driver core: Allow device link operations inside sync_state() driver core: platform: Declare ret variable only once cpu-topology: declare parse_acpi_topology in <linux/arch_topology.h> crypto: hisilicon: no need to check return value of debugfs_create functions driver core: platform: use the correct callback type for bus_find_device firmware_class: make firmware caching configurable driver core: Clarify documentation for fwnode_operations.add_links() mailbox: tegra: Fix superfluous IRQ error message net: caif: Fix debugfs on 64-bit platforms mac80211: Use debugfs_create_xul() helper media: c8sectpfe: no need to check return value of debugfs_create functions of: property: Add device link support for iommus, mboxes and io-channels ...
2 parents 0dd09bc + 0e4a459 commit 9a3d7fd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+1623
-826
lines changed

Documentation/admin-guide/kernel-parameters.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ parameter is applicable::
127127
NET Appropriate network support is enabled.
128128
NUMA NUMA support is enabled.
129129
NFS Appropriate NFS support is enabled.
130+
OF Devicetree is enabled.
130131
OSS OSS sound support is enabled.
131132
PV_OPS A paravirtualized kernel is enabled.
132133
PARIDE The ParIDE (parallel port IDE) subsystem is enabled.

Documentation/admin-guide/kernel-parameters.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3240,6 +3240,12 @@
32403240
This can be set from sysctl after boot.
32413241
See Documentation/admin-guide/sysctl/vm.rst for details.
32423242

3243+
of_devlink [OF, KNL] Create device links between consumer and
3244+
supplier devices by scanning the devictree to infer the
3245+
consumer/supplier relationships. A consumer device
3246+
will not be probed until all the supplier devices have
3247+
probed successfully.
3248+
32433249
ohci1394_dma=early [HW] enable debugging via the ohci1394 driver.
32443250
See Documentation/debugging-via-ohci1394.txt for more
32453251
info.

Documentation/driver-api/device_link.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,8 @@ State machine
281281
:c:func:`driver_bound()`.)
282282

283283
* Before a consumer device is probed, presence of supplier drivers is
284-
verified by checking that links to suppliers are in ``DL_STATE_AVAILABLE``
284+
verified by checking the consumer device is not in the wait_for_suppliers
285+
list and by checking that links to suppliers are in ``DL_STATE_AVAILABLE``
285286
state. The state of the links is updated to ``DL_STATE_CONSUMER_PROBE``.
286287
(Call to :c:func:`device_links_check_suppliers()` from
287288
:c:func:`really_probe()`.)

Documentation/driver-api/driver-model/devres.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,10 @@ IOMAP
316316
devm_ioremap_nocache()
317317
devm_ioremap_wc()
318318
devm_ioremap_resource() : checks resource, requests memory region, ioremaps
319+
devm_ioremap_resource_wc()
320+
devm_platform_ioremap_resource() : calls devm_ioremap_resource() for platform device
321+
devm_platform_ioremap_resource_wc()
322+
devm_platform_ioremap_resource_byname()
319323
devm_iounmap()
320324
pcim_iomap()
321325
pcim_iomap_regions() : do request_region() and iomap() on multiple BARs

Documentation/driver-api/driver-model/driver.rst

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,49 @@ A driver's probe() may return a negative errno value to indicate that
169169
the driver did not bind to this device, in which case it should have
170170
released all resources it allocated::
171171

172+
void (*sync_state)(struct device *dev);
173+
174+
sync_state is called only once for a device. It's called when all the consumer
175+
devices of the device have successfully probed. The list of consumers of the
176+
device is obtained by looking at the device links connecting that device to its
177+
consumer devices.
178+
179+
The first attempt to call sync_state() is made during late_initcall_sync() to
180+
give firmware and drivers time to link devices to each other. During the first
181+
attempt at calling sync_state(), if all the consumers of the device at that
182+
point in time have already probed successfully, sync_state() is called right
183+
away. If there are no consumers of the device during the first attempt, that
184+
too is considered as "all consumers of the device have probed" and sync_state()
185+
is called right away.
186+
187+
If during the first attempt at calling sync_state() for a device, there are
188+
still consumers that haven't probed successfully, the sync_state() call is
189+
postponed and reattempted in the future only when one or more consumers of the
190+
device probe successfully. If during the reattempt, the driver core finds that
191+
there are one or more consumers of the device that haven't probed yet, then
192+
sync_state() call is postponed again.
193+
194+
A typical use case for sync_state() is to have the kernel cleanly take over
195+
management of devices from the bootloader. For example, if a device is left on
196+
and at a particular hardware configuration by the bootloader, the device's
197+
driver might need to keep the device in the boot configuration until all the
198+
consumers of the device have probed. Once all the consumers of the device have
199+
probed, the device's driver can synchronize the hardware state of the device to
200+
match the aggregated software state requested by all the consumers. Hence the
201+
name sync_state().
202+
203+
While obvious examples of resources that can benefit from sync_state() include
204+
resources such as regulator, sync_state() can also be useful for complex
205+
resources like IOMMUs. For example, IOMMUs with multiple consumers (devices
206+
whose addresses are remapped by the IOMMU) might need to keep their mappings
207+
fixed at (or additive to) the boot configuration until all its consumers have
208+
probed.
209+
210+
While the typical use case for sync_state() is to have the kernel cleanly take
211+
over management of devices from the bootloader, the usage of sync_state() is
212+
not restricted to that. Use it whenever it makes sense to take an action after
213+
all the consumers of a device have probed.
214+
172215
int (*remove) (struct device *dev);
173216
174217
remove is called to unbind a driver from a device. This may be

Documentation/filesystems/debugfs.txt

Lines changed: 29 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -68,41 +68,49 @@ actually necessary; the debugfs code provides a number of helper functions
6868
for simple situations. Files containing a single integer value can be
6969
created with any of:
7070

71-
struct dentry *debugfs_create_u8(const char *name, umode_t mode,
72-
struct dentry *parent, u8 *value);
73-
struct dentry *debugfs_create_u16(const char *name, umode_t mode,
74-
struct dentry *parent, u16 *value);
71+
void debugfs_create_u8(const char *name, umode_t mode,
72+
struct dentry *parent, u8 *value);
73+
void debugfs_create_u16(const char *name, umode_t mode,
74+
struct dentry *parent, u16 *value);
7575
struct dentry *debugfs_create_u32(const char *name, umode_t mode,
7676
struct dentry *parent, u32 *value);
77-
struct dentry *debugfs_create_u64(const char *name, umode_t mode,
78-
struct dentry *parent, u64 *value);
77+
void debugfs_create_u64(const char *name, umode_t mode,
78+
struct dentry *parent, u64 *value);
7979

8080
These files support both reading and writing the given value; if a specific
8181
file should not be written to, simply set the mode bits accordingly. The
8282
values in these files are in decimal; if hexadecimal is more appropriate,
8383
the following functions can be used instead:
8484

85-
struct dentry *debugfs_create_x8(const char *name, umode_t mode,
86-
struct dentry *parent, u8 *value);
87-
struct dentry *debugfs_create_x16(const char *name, umode_t mode,
88-
struct dentry *parent, u16 *value);
89-
struct dentry *debugfs_create_x32(const char *name, umode_t mode,
90-
struct dentry *parent, u32 *value);
91-
struct dentry *debugfs_create_x64(const char *name, umode_t mode,
92-
struct dentry *parent, u64 *value);
85+
void debugfs_create_x8(const char *name, umode_t mode,
86+
struct dentry *parent, u8 *value);
87+
void debugfs_create_x16(const char *name, umode_t mode,
88+
struct dentry *parent, u16 *value);
89+
void debugfs_create_x32(const char *name, umode_t mode,
90+
struct dentry *parent, u32 *value);
91+
void debugfs_create_x64(const char *name, umode_t mode,
92+
struct dentry *parent, u64 *value);
9393

9494
These functions are useful as long as the developer knows the size of the
9595
value to be exported. Some types can have different widths on different
96-
architectures, though, complicating the situation somewhat. There is a
97-
function meant to help out in one special case:
96+
architectures, though, complicating the situation somewhat. There are
97+
functions meant to help out in such special cases:
9898

99-
struct dentry *debugfs_create_size_t(const char *name, umode_t mode,
100-
struct dentry *parent,
101-
size_t *value);
99+
void debugfs_create_size_t(const char *name, umode_t mode,
100+
struct dentry *parent, size_t *value);
102101

103102
As might be expected, this function will create a debugfs file to represent
104103
a variable of type size_t.
105104

105+
Similarly, there are helpers for variables of type unsigned long, in decimal
106+
and hexadecimal:
107+
108+
struct dentry *debugfs_create_ulong(const char *name, umode_t mode,
109+
struct dentry *parent,
110+
unsigned long *value);
111+
void debugfs_create_xul(const char *name, umode_t mode,
112+
struct dentry *parent, unsigned long *value);
113+
106114
Boolean values can be placed in debugfs with:
107115

108116
struct dentry *debugfs_create_bool(const char *name, umode_t mode,
@@ -114,8 +122,8 @@ lower-case values, or 1 or 0. Any other input will be silently ignored.
114122

115123
Also, atomic_t values can be placed in debugfs with:
116124

117-
struct dentry *debugfs_create_atomic_t(const char *name, umode_t mode,
118-
struct dentry *parent, atomic_t *value)
125+
void debugfs_create_atomic_t(const char *name, umode_t mode,
126+
struct dentry *parent, atomic_t *value)
119127

120128
A read of this file will get atomic_t values, and a write of this file
121129
will set atomic_t values.

arch/powerpc/platforms/pseries/dtl.c

Lines changed: 6 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919

2020
struct dtl {
2121
struct dtl_entry *buf;
22-
struct dentry *file;
2322
int cpu;
2423
int buf_entries;
2524
u64 last_idx;
@@ -320,63 +319,38 @@ static const struct file_operations dtl_fops = {
320319

321320
static struct dentry *dtl_dir;
322321

323-
static int dtl_setup_file(struct dtl *dtl)
322+
static void dtl_setup_file(struct dtl *dtl)
324323
{
325324
char name[10];
326325

327326
sprintf(name, "cpu-%d", dtl->cpu);
328327

329-
dtl->file = debugfs_create_file(name, 0400, dtl_dir, dtl, &dtl_fops);
330-
if (!dtl->file)
331-
return -ENOMEM;
332-
333-
return 0;
328+
debugfs_create_file(name, 0400, dtl_dir, dtl, &dtl_fops);
334329
}
335330

336331
static int dtl_init(void)
337332
{
338-
struct dentry *event_mask_file, *buf_entries_file;
339-
int rc, i;
333+
int i;
340334

341335
if (!firmware_has_feature(FW_FEATURE_SPLPAR))
342336
return -ENODEV;
343337

344338
/* set up common debugfs structure */
345339

346-
rc = -ENOMEM;
347340
dtl_dir = debugfs_create_dir("dtl", powerpc_debugfs_root);
348-
if (!dtl_dir) {
349-
printk(KERN_WARNING "%s: can't create dtl root dir\n",
350-
__func__);
351-
goto err;
352-
}
353341

354-
event_mask_file = debugfs_create_x8("dtl_event_mask", 0600,
355-
dtl_dir, &dtl_event_mask);
356-
buf_entries_file = debugfs_create_u32("dtl_buf_entries", 0400,
357-
dtl_dir, &dtl_buf_entries);
358-
359-
if (!event_mask_file || !buf_entries_file) {
360-
printk(KERN_WARNING "%s: can't create dtl files\n", __func__);
361-
goto err_remove_dir;
362-
}
342+
debugfs_create_x8("dtl_event_mask", 0600, dtl_dir, &dtl_event_mask);
343+
debugfs_create_u32("dtl_buf_entries", 0400, dtl_dir, &dtl_buf_entries);
363344

364345
/* set up the per-cpu log structures */
365346
for_each_possible_cpu(i) {
366347
struct dtl *dtl = &per_cpu(cpu_dtl, i);
367348
spin_lock_init(&dtl->lock);
368349
dtl->cpu = i;
369350

370-
rc = dtl_setup_file(dtl);
371-
if (rc)
372-
goto err_remove_dir;
351+
dtl_setup_file(dtl);
373352
}
374353

375354
return 0;
376-
377-
err_remove_dir:
378-
debugfs_remove_recursive(dtl_dir);
379-
err:
380-
return rc;
381355
}
382356
machine_arch_initcall(pseries, dtl_init);

arch/powerpc/platforms/pseries/hvCall_inst.c

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,6 @@ static void probe_hcall_exit(void *ignored, unsigned long opcode, long retval,
129129
static int __init hcall_inst_init(void)
130130
{
131131
struct dentry *hcall_root;
132-
struct dentry *hcall_file;
133132
char cpu_name_buf[CPU_NAME_BUF_SIZE];
134133
int cpu;
135134

@@ -145,17 +144,12 @@ static int __init hcall_inst_init(void)
145144
}
146145

147146
hcall_root = debugfs_create_dir(HCALL_ROOT_DIR, NULL);
148-
if (!hcall_root)
149-
return -ENOMEM;
150147

151148
for_each_possible_cpu(cpu) {
152149
snprintf(cpu_name_buf, CPU_NAME_BUF_SIZE, "cpu%d", cpu);
153-
hcall_file = debugfs_create_file(cpu_name_buf, 0444,
154-
hcall_root,
155-
per_cpu(hcall_stats, cpu),
156-
&hcall_inst_seq_fops);
157-
if (!hcall_file)
158-
return -ENOMEM;
150+
debugfs_create_file(cpu_name_buf, 0444, hcall_root,
151+
per_cpu(hcall_stats, cpu),
152+
&hcall_inst_seq_fops);
159153
}
160154

161155
return 0;

arch/powerpc/platforms/pseries/lpar.c

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1998,24 +1998,11 @@ static int __init vpa_debugfs_init(void)
19981998
return 0;
19991999

20002000
vpa_dir = debugfs_create_dir("vpa", powerpc_debugfs_root);
2001-
if (!vpa_dir) {
2002-
pr_warn("%s: can't create vpa root dir\n", __func__);
2003-
return -ENOMEM;
2004-
}
20052001

20062002
/* set up the per-cpu vpa file*/
20072003
for_each_possible_cpu(i) {
2008-
struct dentry *d;
2009-
20102004
sprintf(name, "cpu-%ld", i);
2011-
2012-
d = debugfs_create_file(name, 0400, vpa_dir, (void *)i,
2013-
&vpa_fops);
2014-
if (!d) {
2015-
pr_warn("%s: can't create per-cpu vpa file\n",
2016-
__func__);
2017-
return -ENOMEM;
2018-
}
2005+
debugfs_create_file(name, 0400, vpa_dir, (void *)i, &vpa_fops);
20192006
}
20202007

20212008
return 0;

arch/sh/drivers/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Makefile for the Linux SuperH-specific device drivers.
44
#
55

6-
obj-y += dma/
6+
obj-y += dma/ platform_early.o
77

88
obj-$(CONFIG_PCI) += pci/
99
obj-$(CONFIG_SUPERHYWAY) += superhyway/

0 commit comments

Comments
 (0)