Skip to content

Commit 2ab002c

Browse files
committed
Merge tag 'driver-core-6.14-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 set of driver core and debugfs updates for 6.14-rc1. Included in here is a bunch of driver core, PCI, OF, and platform rust bindings (all acked by the different subsystem maintainers), hence the merge conflict with the rust tree, and some driver core api updates to mark things as const, which will also require some fixups due to new stuff coming in through other trees in this merge window. There are also a bunch of debugfs updates from Al, and there is at least one user that does have a regression with these, but Al is working on tracking down the fix for it. In my use (and everyone else's linux-next use), it does not seem like a big issue at the moment. Here's a short list of the things in here: - driver core rust bindings for PCI, platform, OF, and some i/o functions. We are almost at the "write a real driver in rust" stage now, depending on what you want to do. - misc device rust bindings and a sample driver to show how to use them - debugfs cleanups in the fs as well as the users of the fs api for places where drivers got it wrong or were unnecessarily doing things in complex ways. - driver core const work, making more of the api take const * for different parameters to make the rust bindings easier overall. - other small fixes and updates All of these have been in linux-next with all of the aforementioned merge conflicts, and the one debugfs issue, which looks to be resolved "soon"" * tag 'driver-core-6.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (95 commits) rust: device: Use as_char_ptr() to avoid explicit cast rust: device: Replace CString with CStr in property_present() devcoredump: Constify 'struct bin_attribute' devcoredump: Define 'struct bin_attribute' through macro rust: device: Add property_present() saner replacement for debugfs_rename() orangefs-debugfs: don't mess with ->d_name octeontx2: don't mess with ->d_parent or ->d_parent->d_name arm_scmi: don't mess with ->d_parent->d_name slub: don't mess with ->d_name sof-client-ipc-flood-test: don't mess with ->d_name qat: don't mess with ->d_name xhci: don't mess with ->d_iname mtu3: don't mess wiht ->d_iname greybus/camera - stop messing with ->d_iname mediatek: stop messing with ->d_iname netdevsim: don't embed file_operations into your structs b43legacy: make use of debugfs_get_aux() b43: stop embedding struct file_operations into their objects carl9170: stop embedding file_operations into their objects ...
2 parents f785692 + 01b3cb6 commit 2ab002c

File tree

121 files changed

+3259
-999
lines changed

Some content is hidden

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

121 files changed

+3259
-999
lines changed

Documentation/filesystems/debugfs.rst

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -211,18 +211,16 @@ seq_file content.
211211

212212
There are a couple of other directory-oriented helper functions::
213213

214-
struct dentry *debugfs_rename(struct dentry *old_dir,
215-
struct dentry *old_dentry,
216-
struct dentry *new_dir,
217-
const char *new_name);
214+
struct dentry *debugfs_change_name(struct dentry *dentry,
215+
const char *fmt, ...);
218216

219217
struct dentry *debugfs_create_symlink(const char *name,
220218
struct dentry *parent,
221219
const char *target);
222220

223-
A call to debugfs_rename() will give a new name to an existing debugfs
224-
file, possibly in a different directory. The new_name must not exist prior
225-
to the call; the return value is old_dentry with updated information.
221+
A call to debugfs_change_name() will give a new name to an existing debugfs
222+
file, always in the same directory. The new_name must not exist prior
223+
to the call; the return value is 0 on success and -E... on failuer.
226224
Symbolic links can be created with debugfs_create_symlink().
227225

228226
There is one important thing that all debugfs users must take into account:

Documentation/userspace-api/ioctl/ioctl-number.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,7 @@ Code Seq# Include File Comments
312312
313313
'z' 10-4F drivers/s390/crypto/zcrypt_api.h conflict!
314314
'|' 00-7F linux/media.h
315+
'|' 80-9F samples/ Any sample and example drivers
315316
0x80 00-1F linux/fb.h
316317
0x81 00-1F linux/vduse.h
317318
0x89 00-06 arch/x86/include/asm/sockios.h

MAINTAINERS

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5366,6 +5366,7 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git
53665366
F: drivers/char/
53675367
F: drivers/misc/
53685368
F: include/linux/miscdevice.h
5369+
F: samples/rust/rust_misc_device.rs
53695370
X: drivers/char/agp/
53705371
X: drivers/char/hw_random/
53715372
X: drivers/char/ipmi/
@@ -7091,6 +7092,7 @@ F: include/linux/component.h
70917092
DRIVER CORE, KOBJECTS, DEBUGFS AND SYSFS
70927093
M: Greg Kroah-Hartman <[email protected]>
70937094
R: "Rafael J. Wysocki" <[email protected]>
7095+
R: Danilo Krummrich <[email protected]>
70947096
S: Supported
70957097
T: git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git
70967098
F: Documentation/core-api/kobject.rst
@@ -7101,8 +7103,14 @@ F: include/linux/debugfs.h
71017103
F: include/linux/fwnode.h
71027104
F: include/linux/kobj*
71037105
F: include/linux/property.h
7106+
F: include/linux/sysfs.h
71047107
F: lib/kobj*
71057108
F: rust/kernel/device.rs
7109+
F: rust/kernel/device_id.rs
7110+
F: rust/kernel/devres.rs
7111+
F: rust/kernel/driver.rs
7112+
F: rust/kernel/platform.rs
7113+
F: samples/rust/rust_driver_platform.rs
71067114

71077115
DRIVERS FOR OMAP ADAPTIVE VOLTAGE SCALING (AVS)
71087116
M: Nishanth Menon <[email protected]>
@@ -17632,6 +17640,7 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git
1763217640
F: Documentation/ABI/testing/sysfs-firmware-ofw
1763317641
F: drivers/of/
1763417642
F: include/linux/of*.h
17643+
F: rust/kernel/of.rs
1763517644
F: scripts/dtc/
1763617645
F: tools/testing/selftests/dt/
1763717646
K: of_overlay_notifier_
@@ -18232,6 +18241,8 @@ F: include/asm-generic/pci*
1823218241
F: include/linux/of_pci.h
1823318242
F: include/linux/pci*
1823418243
F: include/uapi/linux/pci*
18244+
F: rust/kernel/pci.rs
18245+
F: samples/rust/rust_driver_pci.rs
1823518246

1823618247
PCIE BANDWIDTH CONTROLLER
1823718248
M: Ilpo Järvinen <[email protected]>
@@ -19830,6 +19841,7 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/rcu/linux.git rcu/dev
1983019841
F: Documentation/RCU/
1983119842
F: include/linux/rcu*
1983219843
F: kernel/rcu/
19844+
F: rust/kernel/sync/rcu.rs
1983319845
X: Documentation/RCU/torture.rst
1983419846
X: include/linux/srcu*.h
1983519847
X: kernel/rcu/srcu*.c

arch/arm/include/asm/ecard.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ void __iomem *ecardm_iomap(struct expansion_card *ec, unsigned int res,
195195
unsigned long offset, unsigned long maxsize);
196196
#define ecardm_iounmap(__ec, __addr) devm_iounmap(&(__ec)->dev, __addr)
197197

198-
extern struct bus_type ecard_bus_type;
198+
extern const struct bus_type ecard_bus_type;
199199

200200
#define ECARD_DEV(_d) container_of((_d), struct expansion_card, dev)
201201

arch/arm/mach-rpc/ecard.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1124,7 +1124,7 @@ static int ecard_match(struct device *_dev, const struct device_driver *_drv)
11241124
return ret;
11251125
}
11261126

1127-
struct bus_type ecard_bus_type = {
1127+
const struct bus_type ecard_bus_type = {
11281128
.name = "ecard",
11291129
.dev_groups = ecard_dev_groups,
11301130
.match = ecard_match,

arch/powerpc/platforms/powernv/opal.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -815,7 +815,7 @@ static int opal_add_one_export(struct kobject *parent, const char *export_name,
815815
sysfs_bin_attr_init(attr);
816816
attr->attr.name = name;
817817
attr->attr.mode = 0400;
818-
attr->read = sysfs_bin_attr_simple_read;
818+
attr->read_new = sysfs_bin_attr_simple_read;
819819
attr->private = __va(vals[0]);
820820
attr->size = vals[1];
821821

arch/sparc/kernel/vio.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -419,13 +419,13 @@ struct vio_remove_node_data {
419419
u64 node;
420420
};
421421

422-
static int vio_md_node_match(struct device *dev, void *arg)
422+
static int vio_md_node_match(struct device *dev, const void *arg)
423423
{
424424
struct vio_dev *vdev = to_vio_dev(dev);
425-
struct vio_remove_node_data *node_data;
425+
const struct vio_remove_node_data *node_data;
426426
u64 node;
427427

428-
node_data = (struct vio_remove_node_data *)arg;
428+
node_data = (const struct vio_remove_node_data *)arg;
429429

430430
node = vio_vdev_node(node_data->hp, vdev);
431431

block/blk-cgroup.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1138,6 +1138,7 @@ static void blkcg_fill_root_iostats(void)
11381138
blkg_iostat_set(&blkg->iostat.cur, &tmp);
11391139
u64_stats_update_end_irqrestore(&blkg->iostat.sync, flags);
11401140
}
1141+
class_dev_iter_exit(&iter);
11411142
}
11421143

11431144
static void blkcg_print_one_stat(struct blkcg_gq *blkg, struct seq_file *s)

drivers/base/bus.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ static struct device *next_device(struct klist_iter *i)
354354
* count in the supplied callback.
355355
*/
356356
int bus_for_each_dev(const struct bus_type *bus, struct device *start,
357-
void *data, int (*fn)(struct device *, void *))
357+
void *data, device_iter_t fn)
358358
{
359359
struct subsys_private *sp = bus_to_subsys(bus);
360360
struct klist_iter i;
@@ -402,9 +402,12 @@ struct device *bus_find_device(const struct bus_type *bus,
402402

403403
klist_iter_init_node(&sp->klist_devices, &i,
404404
(start ? &start->p->knode_bus : NULL));
405-
while ((dev = next_device(&i)))
406-
if (match(dev, data) && get_device(dev))
405+
while ((dev = next_device(&i))) {
406+
if (match(dev, data)) {
407+
get_device(dev);
407408
break;
409+
}
410+
}
408411
klist_iter_exit(&i);
409412
subsys_put(sp);
410413
return dev;

drivers/base/class.c

Lines changed: 12 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -323,8 +323,12 @@ void class_dev_iter_init(struct class_dev_iter *iter, const struct class *class,
323323
struct subsys_private *sp = class_to_subsys(class);
324324
struct klist_node *start_knode = NULL;
325325

326-
if (!sp)
326+
memset(iter, 0, sizeof(*iter));
327+
if (!sp) {
328+
pr_crit("%s: class %p was not registered yet\n",
329+
__func__, class);
327330
return;
331+
}
328332

329333
if (start)
330334
start_knode = &start->p->knode_class;
@@ -351,6 +355,9 @@ struct device *class_dev_iter_next(struct class_dev_iter *iter)
351355
struct klist_node *knode;
352356
struct device *dev;
353357

358+
if (!iter->sp)
359+
return NULL;
360+
354361
while (1) {
355362
knode = klist_next(&iter->ki);
356363
if (!knode)
@@ -395,7 +402,7 @@ EXPORT_SYMBOL_GPL(class_dev_iter_exit);
395402
* code. There's no locking restriction.
396403
*/
397404
int class_for_each_device(const struct class *class, const struct device *start,
398-
void *data, int (*fn)(struct device *, void *))
405+
void *data, device_iter_t fn)
399406
{
400407
struct subsys_private *sp = class_to_subsys(class);
401408
struct class_dev_iter iter;
@@ -594,30 +601,10 @@ EXPORT_SYMBOL_GPL(class_compat_unregister);
594601
* a bus device
595602
* @cls: the compatibility class
596603
* @dev: the target bus device
597-
* @device_link: an optional device to which a "device" link should be created
598604
*/
599-
int class_compat_create_link(struct class_compat *cls, struct device *dev,
600-
struct device *device_link)
605+
int class_compat_create_link(struct class_compat *cls, struct device *dev)
601606
{
602-
int error;
603-
604-
error = sysfs_create_link(cls->kobj, &dev->kobj, dev_name(dev));
605-
if (error)
606-
return error;
607-
608-
/*
609-
* Optionally add a "device" link (typically to the parent), as a
610-
* class device would have one and we want to provide as much
611-
* backwards compatibility as possible.
612-
*/
613-
if (device_link) {
614-
error = sysfs_create_link(&dev->kobj, &device_link->kobj,
615-
"device");
616-
if (error)
617-
sysfs_remove_link(cls->kobj, dev_name(dev));
618-
}
619-
620-
return error;
607+
return sysfs_create_link(cls->kobj, &dev->kobj, dev_name(dev));
621608
}
622609
EXPORT_SYMBOL_GPL(class_compat_create_link);
623610

@@ -626,14 +613,9 @@ EXPORT_SYMBOL_GPL(class_compat_create_link);
626613
* a bus device
627614
* @cls: the compatibility class
628615
* @dev: the target bus device
629-
* @device_link: an optional device to which a "device" link was previously
630-
* created
631616
*/
632-
void class_compat_remove_link(struct class_compat *cls, struct device *dev,
633-
struct device *device_link)
617+
void class_compat_remove_link(struct class_compat *cls, struct device *dev)
634618
{
635-
if (device_link)
636-
sysfs_remove_link(&dev->kobj, "device");
637619
sysfs_remove_link(cls->kobj, dev_name(dev));
638620
}
639621
EXPORT_SYMBOL_GPL(class_compat_remove_link);

0 commit comments

Comments
 (0)