Skip to content

Commit 2cd5769

Browse files
committed
Merge tag 'driver-core-6.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core
Pull driver core updatesk from Greg KH: "Here is the big set of driver core updates for 6.15-rc1. Lots of stuff happened this development cycle, including: - kernfs scaling changes to make it even faster thanks to rcu - bin_attribute constify work in many subsystems - faux bus minor tweaks for the rust bindings - rust binding updates for driver core, pci, and platform busses, making more functionaliy available to rust drivers. These are all due to people actually trying to use the bindings that were in 6.14. - make Rafael and Danilo full co-maintainers of the driver core codebase - other minor fixes and updates" * tag 'driver-core-6.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (52 commits) rust: platform: require Send for Driver trait implementers rust: pci: require Send for Driver trait implementers rust: platform: impl Send + Sync for platform::Device rust: pci: impl Send + Sync for pci::Device rust: platform: fix unrestricted &mut platform::Device rust: pci: fix unrestricted &mut pci::Device rust: device: implement device context marker rust: pci: use to_result() in enable_device_mem() MAINTAINERS: driver core: mark Rafael and Danilo as co-maintainers rust/kernel/faux: mark Registration methods inline driver core: faux: only create the device if probe() succeeds rust/faux: Add missing parent argument to Registration::new() rust/faux: Drop #[repr(transparent)] from faux::Registration rust: io: fix devres test with new io accessor functions rust: io: rename `io::Io` accessors kernfs: Move dput() outside of the RCU section. efi: rci2: mark bin_attribute as __ro_after_init rapidio: constify 'struct bin_attribute' firmware: qemu_fw_cfg: constify 'struct bin_attribute' powerpc/perf/hv-24x7: Constify 'struct bin_attribute' ...
2 parents d6b0219 + 51d0de7 commit 2cd5769

Some content is hidden

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

62 files changed

+742
-453
lines changed

MAINTAINERS

+4-2
Original file line numberDiff line numberDiff line change
@@ -7193,15 +7193,17 @@ F: include/linux/component.h
71937193

71947194
DRIVER CORE, KOBJECTS, DEBUGFS AND SYSFS
71957195
M: Greg Kroah-Hartman <[email protected]>
7196-
R: "Rafael J. Wysocki" <[email protected]>
7197-
R: Danilo Krummrich <[email protected]>
7196+
M: "Rafael J. Wysocki" <[email protected]>
7197+
M: Danilo Krummrich <[email protected]>
71987198
S: Supported
71997199
T: git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git
72007200
F: Documentation/core-api/kobject.rst
72017201
F: drivers/base/
72027202
F: fs/debugfs/
72037203
F: fs/sysfs/
7204+
F: include/linux/device/
72047205
F: include/linux/debugfs.h
7206+
F: include/linux/device.h
72057207
F: include/linux/fwnode.h
72067208
F: include/linux/kobj*
72077209
F: include/linux/property.h

arch/powerpc/kernel/secvar-sysfs.c

+12-12
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ static ssize_t size_show(struct kobject *kobj, struct kobj_attribute *attr,
5252
}
5353

5454
static ssize_t data_read(struct file *filep, struct kobject *kobj,
55-
struct bin_attribute *attr, char *buf, loff_t off,
55+
const struct bin_attribute *attr, char *buf, loff_t off,
5656
size_t count)
5757
{
5858
char *data;
@@ -85,7 +85,7 @@ static ssize_t data_read(struct file *filep, struct kobject *kobj,
8585
}
8686

8787
static ssize_t update_write(struct file *filep, struct kobject *kobj,
88-
struct bin_attribute *attr, char *buf, loff_t off,
88+
const struct bin_attribute *attr, char *buf, loff_t off,
8989
size_t count)
9090
{
9191
int rc;
@@ -104,11 +104,11 @@ static struct kobj_attribute format_attr = __ATTR_RO(format);
104104

105105
static struct kobj_attribute size_attr = __ATTR_RO(size);
106106

107-
static struct bin_attribute data_attr = __BIN_ATTR_RO(data, 0);
107+
static struct bin_attribute data_attr __ro_after_init = __BIN_ATTR_RO(data, 0);
108108

109-
static struct bin_attribute update_attr = __BIN_ATTR_WO(update, 0);
109+
static struct bin_attribute update_attr __ro_after_init = __BIN_ATTR_WO(update, 0);
110110

111-
static struct bin_attribute *secvar_bin_attrs[] = {
111+
static const struct bin_attribute *const secvar_bin_attrs[] = {
112112
&data_attr,
113113
&update_attr,
114114
NULL,
@@ -121,7 +121,7 @@ static struct attribute *secvar_attrs[] = {
121121

122122
static const struct attribute_group secvar_attr_group = {
123123
.attrs = secvar_attrs,
124-
.bin_attrs = secvar_bin_attrs,
124+
.bin_attrs_new = secvar_bin_attrs,
125125
};
126126
__ATTRIBUTE_GROUPS(secvar_attr);
127127

@@ -130,7 +130,7 @@ static const struct kobj_type secvar_ktype = {
130130
.default_groups = secvar_attr_groups,
131131
};
132132

133-
static int update_kobj_size(void)
133+
static __init int update_kobj_size(void)
134134
{
135135

136136
u64 varsize;
@@ -145,7 +145,7 @@ static int update_kobj_size(void)
145145
return 0;
146146
}
147147

148-
static int secvar_sysfs_config(struct kobject *kobj)
148+
static __init int secvar_sysfs_config(struct kobject *kobj)
149149
{
150150
struct attribute_group config_group = {
151151
.name = "config",
@@ -158,7 +158,7 @@ static int secvar_sysfs_config(struct kobject *kobj)
158158
return 0;
159159
}
160160

161-
static int add_var(const char *name)
161+
static __init int add_var(const char *name)
162162
{
163163
struct kobject *kobj;
164164
int rc;
@@ -181,7 +181,7 @@ static int add_var(const char *name)
181181
return 0;
182182
}
183183

184-
static int secvar_sysfs_load(void)
184+
static __init int secvar_sysfs_load(void)
185185
{
186186
u64 namesize = 0;
187187
char *name;
@@ -209,7 +209,7 @@ static int secvar_sysfs_load(void)
209209
return rc;
210210
}
211211

212-
static int secvar_sysfs_load_static(void)
212+
static __init int secvar_sysfs_load_static(void)
213213
{
214214
const char * const *name_ptr = secvar_ops->var_names;
215215
int rc;
@@ -224,7 +224,7 @@ static int secvar_sysfs_load_static(void)
224224
return 0;
225225
}
226226

227-
static int secvar_sysfs_init(void)
227+
static __init int secvar_sysfs_init(void)
228228
{
229229
u64 max_size;
230230
int rc;

arch/powerpc/perf/hv-24x7.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -998,7 +998,7 @@ static int create_events_from_catalog(struct attribute ***events_,
998998
}
999999

10001000
static ssize_t catalog_read(struct file *filp, struct kobject *kobj,
1001-
struct bin_attribute *bin_attr, char *buf,
1001+
const struct bin_attribute *bin_attr, char *buf,
10021002
loff_t offset, size_t count)
10031003
{
10041004
long hret;
@@ -1108,14 +1108,14 @@ PAGE_0_ATTR(catalog_version, "%lld\n",
11081108
(unsigned long long)be64_to_cpu(page_0->version));
11091109
PAGE_0_ATTR(catalog_len, "%lld\n",
11101110
(unsigned long long)be32_to_cpu(page_0->length) * 4096);
1111-
static BIN_ATTR_RO(catalog, 0/* real length varies */);
1111+
static const BIN_ATTR_RO(catalog, 0/* real length varies */);
11121112
static DEVICE_ATTR_RO(domains);
11131113
static DEVICE_ATTR_RO(sockets);
11141114
static DEVICE_ATTR_RO(chipspersocket);
11151115
static DEVICE_ATTR_RO(coresperchip);
11161116
static DEVICE_ATTR_RO(cpumask);
11171117

1118-
static struct bin_attribute *if_bin_attrs[] = {
1118+
static const struct bin_attribute *const if_bin_attrs[] = {
11191119
&bin_attr_catalog,
11201120
NULL,
11211121
};
@@ -1141,7 +1141,7 @@ static struct attribute *if_attrs[] = {
11411141

11421142
static const struct attribute_group if_group = {
11431143
.name = "interface",
1144-
.bin_attrs = if_bin_attrs,
1144+
.bin_attrs_new = if_bin_attrs,
11451145
.attrs = if_attrs,
11461146
};
11471147

arch/powerpc/platforms/powernv/opal-core.c

+5-5
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ static Elf64_Word *__init auxv_to_elf64_notes(Elf64_Word *buf,
159159
* Returns number of bytes read on success, -errno on failure.
160160
*/
161161
static ssize_t read_opalcore(struct file *file, struct kobject *kobj,
162-
struct bin_attribute *bin_attr, char *to,
162+
const struct bin_attribute *bin_attr, char *to,
163163
loff_t pos, size_t count)
164164
{
165165
struct opalcore *m;
@@ -206,9 +206,9 @@ static ssize_t read_opalcore(struct file *file, struct kobject *kobj,
206206
return (tpos - pos);
207207
}
208208

209-
static struct bin_attribute opal_core_attr = {
209+
static struct bin_attribute opal_core_attr __ro_after_init = {
210210
.attr = {.name = "core", .mode = 0400},
211-
.read = read_opalcore
211+
.read_new = read_opalcore
212212
};
213213

214214
/*
@@ -599,15 +599,15 @@ static struct attribute *mpipl_attr[] = {
599599
NULL,
600600
};
601601

602-
static struct bin_attribute *mpipl_bin_attr[] = {
602+
static const struct bin_attribute *const mpipl_bin_attr[] = {
603603
&opal_core_attr,
604604
NULL,
605605

606606
};
607607

608608
static const struct attribute_group mpipl_group = {
609609
.attrs = mpipl_attr,
610-
.bin_attrs = mpipl_bin_attr,
610+
.bin_attrs_new = mpipl_bin_attr,
611611
};
612612

613613
static int __init opalcore_init(void)

arch/powerpc/platforms/powernv/opal-dump.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ static int64_t dump_read_data(struct dump_obj *dump)
286286
}
287287

288288
static ssize_t dump_attr_read(struct file *filep, struct kobject *kobj,
289-
struct bin_attribute *bin_attr,
289+
const struct bin_attribute *bin_attr,
290290
char *buffer, loff_t pos, size_t count)
291291
{
292292
ssize_t rc;
@@ -342,7 +342,7 @@ static void create_dump_obj(uint32_t id, size_t size, uint32_t type)
342342
dump->dump_attr.attr.name = "dump";
343343
dump->dump_attr.attr.mode = 0400;
344344
dump->dump_attr.size = size;
345-
dump->dump_attr.read = dump_attr_read;
345+
dump->dump_attr.read_new = dump_attr_read;
346346

347347
dump->id = id;
348348
dump->size = size;

arch/powerpc/platforms/powernv/opal-elog.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ static const struct kobj_type elog_ktype = {
156156
#define OPAL_MAX_ERRLOG_SIZE 16384
157157

158158
static ssize_t raw_attr_read(struct file *filep, struct kobject *kobj,
159-
struct bin_attribute *bin_attr,
159+
const struct bin_attribute *bin_attr,
160160
char *buffer, loff_t pos, size_t count)
161161
{
162162
int opal_rc;
@@ -203,7 +203,7 @@ static void create_elog_obj(uint64_t id, size_t size, uint64_t type)
203203
elog->raw_attr.attr.name = "raw";
204204
elog->raw_attr.attr.mode = 0400;
205205
elog->raw_attr.size = size;
206-
elog->raw_attr.read = raw_attr_read;
206+
elog->raw_attr.read_new = raw_attr_read;
207207

208208
elog->id = id;
209209
elog->size = size;

arch/powerpc/platforms/powernv/opal-flash.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ static int alloc_image_buf(char *buffer, size_t count)
432432
* and pre-allocate required memory.
433433
*/
434434
static ssize_t image_data_write(struct file *filp, struct kobject *kobj,
435-
struct bin_attribute *bin_attr,
435+
const struct bin_attribute *bin_attr,
436436
char *buffer, loff_t pos, size_t count)
437437
{
438438
int rc;
@@ -493,7 +493,7 @@ static ssize_t image_data_write(struct file *filp, struct kobject *kobj,
493493
static const struct bin_attribute image_data_attr = {
494494
.attr = {.name = "image", .mode = 0200},
495495
.size = MAX_IMAGE_SIZE, /* Limit image size */
496-
.write = image_data_write,
496+
.write_new = image_data_write,
497497
};
498498

499499
static struct kobj_attribute validate_attribute =

arch/powerpc/platforms/powernv/opal-msglog.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -94,15 +94,15 @@ ssize_t opal_msglog_copy(char *to, loff_t pos, size_t count)
9494
}
9595

9696
static ssize_t opal_msglog_read(struct file *file, struct kobject *kobj,
97-
struct bin_attribute *bin_attr, char *to,
97+
const struct bin_attribute *bin_attr, char *to,
9898
loff_t pos, size_t count)
9999
{
100100
return opal_msglog_copy(to, pos, count);
101101
}
102102

103-
static struct bin_attribute opal_msglog_attr = {
103+
static struct bin_attribute opal_msglog_attr __ro_after_init = {
104104
.attr = {.name = "msglog", .mode = 0400},
105-
.read = opal_msglog_read
105+
.read_new = opal_msglog_read
106106
};
107107

108108
struct memcons *__init memcons_init(struct device_node *node, const char *mc_prop_name)

arch/powerpc/platforms/powernv/ultravisor.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,15 @@ int __init early_init_dt_scan_ultravisor(unsigned long node, const char *uname,
3232
static struct memcons *uv_memcons;
3333

3434
static ssize_t uv_msglog_read(struct file *file, struct kobject *kobj,
35-
struct bin_attribute *bin_attr, char *to,
35+
const struct bin_attribute *bin_attr, char *to,
3636
loff_t pos, size_t count)
3737
{
3838
return memcons_copy(uv_memcons, to, pos, count);
3939
}
4040

41-
static struct bin_attribute uv_msglog_attr = {
41+
static struct bin_attribute uv_msglog_attr __ro_after_init = {
4242
.attr = {.name = "msglog", .mode = 0400},
43-
.read = uv_msglog_read
43+
.read_new = uv_msglog_read
4444
};
4545

4646
static int __init uv_init(void)

arch/x86/kernel/cpu/resctrl/internal.h

+5
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,11 @@ static inline struct rdt_hw_resource *resctrl_to_arch_res(struct rdt_resource *r
403403

404404
extern struct mutex rdtgroup_mutex;
405405

406+
static inline const char *rdt_kn_name(const struct kernfs_node *kn)
407+
{
408+
return rcu_dereference_check(kn->name, lockdep_is_held(&rdtgroup_mutex));
409+
}
410+
406411
extern struct rdt_hw_resource rdt_resources_all[];
407412
extern struct rdtgroup rdtgroup_default;
408413
extern struct dentry *debugfs_resctrl;

arch/x86/kernel/cpu/resctrl/pseudo_lock.c

+10-4
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ static char *pseudo_lock_devnode(const struct device *dev, umode_t *mode)
5252
rdtgrp = dev_get_drvdata(dev);
5353
if (mode)
5454
*mode = 0600;
55-
return kasprintf(GFP_KERNEL, "pseudo_lock/%s", rdtgrp->kn->name);
55+
guard(mutex)(&rdtgroup_mutex);
56+
return kasprintf(GFP_KERNEL, "pseudo_lock/%s", rdt_kn_name(rdtgrp->kn));
5657
}
5758

5859
static const struct class pseudo_lock_class = {
@@ -1298,6 +1299,7 @@ int rdtgroup_pseudo_lock_create(struct rdtgroup *rdtgrp)
12981299
struct task_struct *thread;
12991300
unsigned int new_minor;
13001301
struct device *dev;
1302+
char *kn_name __free(kfree) = NULL;
13011303
int ret;
13021304

13031305
ret = pseudo_lock_region_alloc(plr);
@@ -1309,6 +1311,11 @@ int rdtgroup_pseudo_lock_create(struct rdtgroup *rdtgrp)
13091311
ret = -EINVAL;
13101312
goto out_region;
13111313
}
1314+
kn_name = kstrdup(rdt_kn_name(rdtgrp->kn), GFP_KERNEL);
1315+
if (!kn_name) {
1316+
ret = -ENOMEM;
1317+
goto out_cstates;
1318+
}
13121319

13131320
plr->thread_done = 0;
13141321

@@ -1353,8 +1360,7 @@ int rdtgroup_pseudo_lock_create(struct rdtgroup *rdtgrp)
13531360
mutex_unlock(&rdtgroup_mutex);
13541361

13551362
if (!IS_ERR_OR_NULL(debugfs_resctrl)) {
1356-
plr->debugfs_dir = debugfs_create_dir(rdtgrp->kn->name,
1357-
debugfs_resctrl);
1363+
plr->debugfs_dir = debugfs_create_dir(kn_name, debugfs_resctrl);
13581364
if (!IS_ERR_OR_NULL(plr->debugfs_dir))
13591365
debugfs_create_file("pseudo_lock_measure", 0200,
13601366
plr->debugfs_dir, rdtgrp,
@@ -1363,7 +1369,7 @@ int rdtgroup_pseudo_lock_create(struct rdtgroup *rdtgrp)
13631369

13641370
dev = device_create(&pseudo_lock_class, NULL,
13651371
MKDEV(pseudo_lock_major, new_minor),
1366-
rdtgrp, "%s", rdtgrp->kn->name);
1372+
rdtgrp, "%s", kn_name);
13671373

13681374
mutex_lock(&rdtgroup_mutex);
13691375

0 commit comments

Comments
 (0)