Skip to content

Commit c6e62d0

Browse files
committed
Merge tag 'driver-core-7.0-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/driver-core/driver-core
Pull driver core updates from Danilo Krummrich: "Bus: - Ensure bus->match() is consistently called with the device lock held - Improve type safety of bus_find_device_by_acpi_dev() Devtmpfs: - Parse 'devtmpfs.mount=' boot parameter with kstrtoint() instead of simple_strtoul() - Avoid sparse warning by making devtmpfs_context_ops static IOMMU: - Do not register the qcom_smmu_tbu_driver in arm_smmu_device_probe() MAINTAINERS: - Add the new driver-core mailing list (driver-core@lists.linux.dev) to all relevant entries - Add missing tree location for "FIRMWARE LOADER (request_firmware)" - Add driver-model documentation to the "DRIVER CORE" entry - Add missing driver-core maintainers to the "AUXILIARY BUS" entry Misc: - Change return type of attribute_container_register() to void; it has always been infallible - Do not export sysfs_change_owner(), sysfs_file_change_owner() and device_change_owner() - Move devres_for_each_res() from the public devres header to drivers/base/base.h - Do not use a static struct device for the faux bus; allocate it dynamically Revocable: - Patches for the revocable synchronization primitive have been scheduled for v7.0-rc1, but have been reverted as they need some more refinement Rust: - Device: - Support dev_printk on all device types, not just the core Device struct; remove now-redundant .as_ref() calls in dev_* print calls - Devres: - Introduce an internal reference count in Devres<T> to avoid a deadlock condition in case of (indirect) nesting - DMA: - Allow drivers to tune the maximum DMA segment size via dma_set_max_seg_size() - I/O: - Introduce the concept of generic I/O backends to handle different kinds of device shared memory through a common interface. This enables higher-level concepts such as register abstractions, I/O slices, and field projections to be built generically on top. In a first step, introduce the Io, IoCapable<T>, and IoKnownSize trait hierarchy for sharing a common interface supporting offset validation and bound-checking logic between I/O backends. - Refactor MMIO to use the common I/O backend infrastructure - Misc: - Add __rust_helper annotations to C helpers for inlining into Rust code - Use "kernel vertical" style for imports - Replace kernel::c_str! with C string literals - Update ARef imports to use sync::aref - Use pin_init::zeroed() for struct auxiliary_device_id and debugfs file_operations initialization - Use LKMM atomic types in debugfs doc-tests - Various minor comment and documentation fixes - PCI: - Implement PCI configuration space accessors using the common I/O backend infrastructure - Document pci::Bar device endianness assumptions - SoC: - Abstractions for struct soc_device and struct soc_device_attribute - Sample driver for soc::Device" * tag 'driver-core-7.0-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/driver-core/driver-core: (79 commits) rust: devres: fix race condition due to nesting rust: dma: add missing __rust_helper annotations samples: rust: pci: Remove some additional `.as_ref()` for `dev_*` print Revert "revocable: Revocable resource management" Revert "revocable: Add Kunit test cases" Revert "selftests: revocable: Add kselftest cases" driver core: remove device_change_owner() export sysfs: remove exports of sysfs_*change_owner() driver core: disable revocable code from build revocable: Add KUnit test for concurrent access revocable: fix SRCU index corruption by requiring caller-provided storage revocable: Add KUnit test for provider lifetime races revocable: Fix races in revocable_alloc() using RCU driver core: fix inverted "locked" suffix of driver_match_device() rust: io: move MIN_SIZE and io_addr_assert to IoKnownSize rust: pci: re-export ConfigSpace rust: dma: allow drivers to tune max segment size gpu: tyr: remove redundant `.as_ref()` for `dev_*` print rust: auxiliary: use `pin_init::zeroed()` for device ID rust: debugfs: use pin_init::zeroed() for file_operations ...
2 parents 1c2b4a4 + ba26851 commit c6e62d0

68 files changed

Lines changed: 1604 additions & 573 deletions

Some content is hidden

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

MAINTAINERS

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4191,9 +4191,12 @@ F: scripts/Makefile.autofdo
41914191

41924192
AUXILIARY BUS DRIVER
41934193
M: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4194+
M: "Rafael J. Wysocki" <rafael@kernel.org>
4195+
M: Danilo Krummrich <dakr@kernel.org>
41944196
R: Dave Ertman <david.m.ertman@intel.com>
41954197
R: Ira Weiny <ira.weiny@intel.com>
41964198
R: Leon Romanovsky <leon@kernel.org>
4199+
L: driver-core@lists.linux.dev
41974200
S: Supported
41984201
T: git git://git.kernel.org/pub/scm/linux/kernel/git/driver-core/driver-core.git
41994202
F: Documentation/driver-api/auxiliary_bus.rst
@@ -7286,7 +7289,7 @@ DEVICE I/O & IRQ [RUST]
72867289
M: Danilo Krummrich <dakr@kernel.org>
72877290
M: Alice Ryhl <aliceryhl@google.com>
72887291
M: Daniel Almeida <daniel.almeida@collabora.com>
7289-
L: rust-for-linux@vger.kernel.org
7292+
L: driver-core@lists.linux.dev
72907293
S: Supported
72917294
W: https://rust-for-linux.com
72927295
B: https://github.com/Rust-for-Linux/linux/issues
@@ -7537,7 +7540,7 @@ R: Abdiel Janulgue <abdiel.janulgue@gmail.com>
75377540
R: Daniel Almeida <daniel.almeida@collabora.com>
75387541
R: Robin Murphy <robin.murphy@arm.com>
75397542
R: Andreas Hindborg <a.hindborg@kernel.org>
7540-
L: rust-for-linux@vger.kernel.org
7543+
L: driver-core@lists.linux.dev
75417544
S: Supported
75427545
W: https://rust-for-linux.com
75437546
T: git git://git.kernel.org/pub/scm/linux/kernel/git/driver-core/driver-core.git
@@ -7751,9 +7754,11 @@ DRIVER CORE, KOBJECTS, DEBUGFS AND SYSFS
77517754
M: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
77527755
M: "Rafael J. Wysocki" <rafael@kernel.org>
77537756
M: Danilo Krummrich <dakr@kernel.org>
7757+
L: driver-core@lists.linux.dev
77547758
S: Supported
77557759
T: git git://git.kernel.org/pub/scm/linux/kernel/git/driver-core/driver-core.git
77567760
F: Documentation/core-api/kobject.rst
7761+
F: Documentation/driver-api/driver-model/
77577762
F: drivers/base/
77587763
F: fs/debugfs/
77597764
F: fs/sysfs/
@@ -7774,10 +7779,12 @@ F: rust/kernel/devres.rs
77747779
F: rust/kernel/driver.rs
77757780
F: rust/kernel/faux.rs
77767781
F: rust/kernel/platform.rs
7782+
F: rust/kernel/soc.rs
77777783
F: samples/rust/rust_debugfs.rs
77787784
F: samples/rust/rust_debugfs_scoped.rs
77797785
F: samples/rust/rust_driver_platform.rs
77807786
F: samples/rust/rust_driver_faux.rs
7787+
F: samples/rust/rust_soc.rs
77817788

77827789
DRIVERS FOR OMAP ADAPTIVE VOLTAGE SCALING (AVS)
77837790
M: Nishanth Menon <nm@ti.com>
@@ -9902,8 +9909,9 @@ FIRMWARE LOADER (request_firmware)
99029909
M: Luis Chamberlain <mcgrof@kernel.org>
99039910
M: Russ Weight <russ.weight@linux.dev>
99049911
M: Danilo Krummrich <dakr@kernel.org>
9905-
L: linux-kernel@vger.kernel.org
9912+
L: driver-core@lists.linux.dev
99069913
S: Maintained
9914+
T: git git://git.kernel.org/pub/scm/linux/kernel/git/driver-core/driver-core.git
99079915
F: Documentation/firmware_class/
99089916
F: drivers/base/firmware_loader/
99099917
F: rust/kernel/firmware.rs
@@ -14050,6 +14058,7 @@ F: tools/testing/selftests/kvm/x86/
1405014058
KERNFS
1405114059
M: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1405214060
M: Tejun Heo <tj@kernel.org>
14061+
L: driver-core@lists.linux.dev
1405314062
S: Supported
1405414063
T: git git://git.kernel.org/pub/scm/linux/kernel/git/driver-core/driver-core.git
1405514064
F: fs/kernfs/

drivers/base/attribute_container.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ static DEFINE_MUTEX(attribute_container_mutex);
6969
* @cont: The container to register. This must be allocated by the
7070
* callee and should also be zeroed by it.
7171
*/
72-
int
72+
void
7373
attribute_container_register(struct attribute_container *cont)
7474
{
7575
INIT_LIST_HEAD(&cont->node);
@@ -79,8 +79,6 @@ attribute_container_register(struct attribute_container *cont)
7979
mutex_lock(&attribute_container_mutex);
8080
list_add_tail(&cont->node, &attribute_container_list);
8181
mutex_unlock(&attribute_container_mutex);
82-
83-
return 0;
8482
}
8583
EXPORT_SYMBOL_GPL(attribute_container_register);
8684

drivers/base/base.h

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,10 +179,19 @@ void device_release_driver_internal(struct device *dev, const struct device_driv
179179
void driver_detach(const struct device_driver *drv);
180180
void driver_deferred_probe_del(struct device *dev);
181181
void device_set_deferred_probe_reason(const struct device *dev, struct va_format *vaf);
182+
static inline int driver_match_device_locked(const struct device_driver *drv,
183+
struct device *dev)
184+
{
185+
device_lock_assert(dev);
186+
187+
return drv->bus->match ? drv->bus->match(dev, drv) : 1;
188+
}
189+
182190
static inline int driver_match_device(const struct device_driver *drv,
183191
struct device *dev)
184192
{
185-
return drv->bus->match ? drv->bus->match(dev, drv) : 1;
193+
guard(device)(dev);
194+
return driver_match_device_locked(drv, dev);
186195
}
187196

188197
static inline void dev_sync_state(struct device *dev)
@@ -213,6 +222,10 @@ static inline void device_set_driver(struct device *dev, const struct device_dri
213222
WRITE_ONCE(dev->driver, (struct device_driver *)drv);
214223
}
215224

225+
void devres_for_each_res(struct device *dev, dr_release_t release,
226+
dr_match_t match, void *match_data,
227+
void (*fn)(struct device *, void *, void *),
228+
void *data);
216229
int devres_release_all(struct device *dev);
217230
void device_block_probing(void);
218231
void device_unblock_probing(void);

drivers/base/core.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4781,7 +4781,6 @@ int device_change_owner(struct device *dev, kuid_t kuid, kgid_t kgid)
47814781
put_device(dev);
47824782
return error;
47834783
}
4784-
EXPORT_SYMBOL_GPL(device_change_owner);
47854784

47864785
/**
47874786
* device_shutdown - call ->shutdown() on each device to shutdown.

drivers/base/dd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -928,7 +928,7 @@ static int __device_attach_driver(struct device_driver *drv, void *_data)
928928
bool async_allowed;
929929
int ret;
930930

931-
ret = driver_match_device(drv, dev);
931+
ret = driver_match_device_locked(drv, dev);
932932
if (ret == 0) {
933933
/* no match */
934934
return 0;

drivers/base/devtmpfs.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,7 @@ static struct req {
5656

5757
static int __init mount_param(char *str)
5858
{
59-
mount_dev = simple_strtoul(str, NULL, 0);
60-
return 1;
59+
return kstrtoint(str, 0, &mount_dev) == 0;
6160
}
6261
__setup("devtmpfs.mount=", mount_param);
6362

@@ -85,7 +84,7 @@ static int devtmpfs_get_tree(struct fs_context *fc)
8584
}
8685

8786
/* Ops are filled in during init depending on underlying shmem or ramfs type */
88-
struct fs_context_operations devtmpfs_context_ops = {};
87+
static struct fs_context_operations devtmpfs_context_ops = {};
8988

9089
/* Call the underlying initialization and set to our ops */
9190
static int devtmpfs_init_fs_context(struct fs_context *fc)

drivers/base/faux.c

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,7 @@ struct faux_object {
2929
};
3030
#define to_faux_object(dev) container_of_const(dev, struct faux_object, faux_dev.dev)
3131

32-
static struct device faux_bus_root = {
33-
.init_name = "faux",
34-
};
32+
static struct device *faux_bus_root;
3533

3634
static int faux_match(struct device *dev, const struct device_driver *drv)
3735
{
@@ -152,7 +150,7 @@ struct faux_device *faux_device_create_with_groups(const char *name,
152150
if (parent)
153151
dev->parent = parent;
154152
else
155-
dev->parent = &faux_bus_root;
153+
dev->parent = faux_bus_root;
156154
dev->bus = &faux_bus_type;
157155
dev_set_name(dev, "%s", name);
158156
device_set_pm_not_required(dev);
@@ -236,9 +234,15 @@ int __init faux_bus_init(void)
236234
{
237235
int ret;
238236

239-
ret = device_register(&faux_bus_root);
237+
faux_bus_root = kzalloc(sizeof(*faux_bus_root), GFP_KERNEL);
238+
if (!faux_bus_root)
239+
return -ENOMEM;
240+
241+
dev_set_name(faux_bus_root, "faux");
242+
243+
ret = device_register(faux_bus_root);
240244
if (ret) {
241-
put_device(&faux_bus_root);
245+
put_device(faux_bus_root);
242246
return ret;
243247
}
244248

@@ -256,6 +260,6 @@ int __init faux_bus_init(void)
256260
bus_unregister(&faux_bus_type);
257261

258262
error_bus:
259-
device_unregister(&faux_bus_root);
263+
device_unregister(faux_bus_root);
260264
return ret;
261265
}

drivers/base/transport_class.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -88,17 +88,13 @@ static int anon_transport_dummy_function(struct transport_container *tc,
8888
* events. Use prezero and then use DECLARE_ANON_TRANSPORT_CLASS() to
8989
* initialise the anon transport class storage.
9090
*/
91-
int anon_transport_class_register(struct anon_transport_class *atc)
91+
void anon_transport_class_register(struct anon_transport_class *atc)
9292
{
93-
int error;
9493
atc->container.class = &atc->tclass.class;
9594
attribute_container_set_no_classdevs(&atc->container);
96-
error = attribute_container_register(&atc->container);
97-
if (error)
98-
return error;
95+
attribute_container_register(&atc->container);
9996
atc->tclass.setup = anon_transport_dummy_function;
10097
atc->tclass.remove = anon_transport_dummy_function;
101-
return 0;
10298
}
10399
EXPORT_SYMBOL_GPL(anon_transport_class_register);
104100

drivers/gpu/drm/tyr/driver.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ impl platform::Driver for TyrDriver {
140140

141141
// We need this to be dev_info!() because dev_dbg!() does not work at
142142
// all in Rust for now, and we need to see whether probe succeeded.
143-
dev_info!(pdev.as_ref(), "Tyr initialized correctly.\n");
143+
dev_info!(pdev, "Tyr initialized correctly.\n");
144144
Ok(driver)
145145
}
146146
}

drivers/gpu/drm/tyr/gpu.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ impl GpuInfo {
9898
};
9999

100100
dev_info!(
101-
pdev.as_ref(),
101+
pdev,
102102
"mali-{} id 0x{:x} major 0x{:x} minor 0x{:x} status 0x{:x}",
103103
model_name,
104104
self.gpu_id >> 16,
@@ -108,7 +108,7 @@ impl GpuInfo {
108108
);
109109

110110
dev_info!(
111-
pdev.as_ref(),
111+
pdev,
112112
"Features: L2:{:#x} Tiler:{:#x} Mem:{:#x} MMU:{:#x} AS:{:#x}",
113113
self.l2_features,
114114
self.tiler_features,
@@ -118,7 +118,7 @@ impl GpuInfo {
118118
);
119119

120120
dev_info!(
121-
pdev.as_ref(),
121+
pdev,
122122
"shader_present=0x{:016x} l2_present=0x{:016x} tiler_present=0x{:016x}",
123123
self.shader_present,
124124
self.l2_present,

0 commit comments

Comments
 (0)