Skip to content

Commit

Permalink
Merge branch 'driver-core-next' of git://git.kernel.org/pub/scm/linux…
Browse files Browse the repository at this point in the history
…/kernel/git/gregkh/driver-core.git
  • Loading branch information
sfrothwell committed Mar 7, 2025
2 parents 516810d + 21b0dc5 commit 6c60220
Show file tree
Hide file tree
Showing 55 changed files with 528 additions and 352 deletions.
2 changes: 2 additions & 0 deletions MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -7141,7 +7141,9 @@ F: Documentation/core-api/kobject.rst
F: drivers/base/
F: fs/debugfs/
F: fs/sysfs/
F: include/linux/device/
F: include/linux/debugfs.h
F: include/linux/device.h
F: include/linux/fwnode.h
F: include/linux/kobj*
F: include/linux/property.h
Expand Down
24 changes: 12 additions & 12 deletions arch/powerpc/kernel/secvar-sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ static ssize_t size_show(struct kobject *kobj, struct kobj_attribute *attr,
}

static ssize_t data_read(struct file *filep, struct kobject *kobj,
struct bin_attribute *attr, char *buf, loff_t off,
const struct bin_attribute *attr, char *buf, loff_t off,
size_t count)
{
char *data;
Expand Down Expand Up @@ -85,7 +85,7 @@ static ssize_t data_read(struct file *filep, struct kobject *kobj,
}

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

static struct kobj_attribute size_attr = __ATTR_RO(size);

static struct bin_attribute data_attr = __BIN_ATTR_RO(data, 0);
static struct bin_attribute data_attr __ro_after_init = __BIN_ATTR_RO(data, 0);

static struct bin_attribute update_attr = __BIN_ATTR_WO(update, 0);
static struct bin_attribute update_attr __ro_after_init = __BIN_ATTR_WO(update, 0);

static struct bin_attribute *secvar_bin_attrs[] = {
static const struct bin_attribute *const secvar_bin_attrs[] = {
&data_attr,
&update_attr,
NULL,
Expand All @@ -121,7 +121,7 @@ static struct attribute *secvar_attrs[] = {

static const struct attribute_group secvar_attr_group = {
.attrs = secvar_attrs,
.bin_attrs = secvar_bin_attrs,
.bin_attrs_new = secvar_bin_attrs,
};
__ATTRIBUTE_GROUPS(secvar_attr);

Expand All @@ -130,7 +130,7 @@ static const struct kobj_type secvar_ktype = {
.default_groups = secvar_attr_groups,
};

static int update_kobj_size(void)
static __init int update_kobj_size(void)
{

u64 varsize;
Expand All @@ -145,7 +145,7 @@ static int update_kobj_size(void)
return 0;
}

static int secvar_sysfs_config(struct kobject *kobj)
static __init int secvar_sysfs_config(struct kobject *kobj)
{
struct attribute_group config_group = {
.name = "config",
Expand All @@ -158,7 +158,7 @@ static int secvar_sysfs_config(struct kobject *kobj)
return 0;
}

static int add_var(const char *name)
static __init int add_var(const char *name)
{
struct kobject *kobj;
int rc;
Expand All @@ -181,7 +181,7 @@ static int add_var(const char *name)
return 0;
}

static int secvar_sysfs_load(void)
static __init int secvar_sysfs_load(void)
{
u64 namesize = 0;
char *name;
Expand Down Expand Up @@ -209,7 +209,7 @@ static int secvar_sysfs_load(void)
return rc;
}

static int secvar_sysfs_load_static(void)
static __init int secvar_sysfs_load_static(void)
{
const char * const *name_ptr = secvar_ops->var_names;
int rc;
Expand All @@ -224,7 +224,7 @@ static int secvar_sysfs_load_static(void)
return 0;
}

static int secvar_sysfs_init(void)
static __init int secvar_sysfs_init(void)
{
u64 max_size;
int rc;
Expand Down
8 changes: 4 additions & 4 deletions arch/powerpc/perf/hv-24x7.c
Original file line number Diff line number Diff line change
Expand Up @@ -998,7 +998,7 @@ static int create_events_from_catalog(struct attribute ***events_,
}

static ssize_t catalog_read(struct file *filp, struct kobject *kobj,
struct bin_attribute *bin_attr, char *buf,
const struct bin_attribute *bin_attr, char *buf,
loff_t offset, size_t count)
{
long hret;
Expand Down Expand Up @@ -1108,14 +1108,14 @@ PAGE_0_ATTR(catalog_version, "%lld\n",
(unsigned long long)be64_to_cpu(page_0->version));
PAGE_0_ATTR(catalog_len, "%lld\n",
(unsigned long long)be32_to_cpu(page_0->length) * 4096);
static BIN_ATTR_RO(catalog, 0/* real length varies */);
static const BIN_ATTR_RO(catalog, 0/* real length varies */);
static DEVICE_ATTR_RO(domains);
static DEVICE_ATTR_RO(sockets);
static DEVICE_ATTR_RO(chipspersocket);
static DEVICE_ATTR_RO(coresperchip);
static DEVICE_ATTR_RO(cpumask);

static struct bin_attribute *if_bin_attrs[] = {
static const struct bin_attribute *const if_bin_attrs[] = {
&bin_attr_catalog,
NULL,
};
Expand All @@ -1141,7 +1141,7 @@ static struct attribute *if_attrs[] = {

static const struct attribute_group if_group = {
.name = "interface",
.bin_attrs = if_bin_attrs,
.bin_attrs_new = if_bin_attrs,
.attrs = if_attrs,
};

Expand Down
10 changes: 5 additions & 5 deletions arch/powerpc/platforms/powernv/opal-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ static Elf64_Word *__init auxv_to_elf64_notes(Elf64_Word *buf,
* Returns number of bytes read on success, -errno on failure.
*/
static ssize_t read_opalcore(struct file *file, struct kobject *kobj,
struct bin_attribute *bin_attr, char *to,
const struct bin_attribute *bin_attr, char *to,
loff_t pos, size_t count)
{
struct opalcore *m;
Expand Down Expand Up @@ -206,9 +206,9 @@ static ssize_t read_opalcore(struct file *file, struct kobject *kobj,
return (tpos - pos);
}

static struct bin_attribute opal_core_attr = {
static struct bin_attribute opal_core_attr __ro_after_init = {
.attr = {.name = "core", .mode = 0400},
.read = read_opalcore
.read_new = read_opalcore
};

/*
Expand Down Expand Up @@ -599,15 +599,15 @@ static struct attribute *mpipl_attr[] = {
NULL,
};

static struct bin_attribute *mpipl_bin_attr[] = {
static const struct bin_attribute *const mpipl_bin_attr[] = {
&opal_core_attr,
NULL,

};

static const struct attribute_group mpipl_group = {
.attrs = mpipl_attr,
.bin_attrs = mpipl_bin_attr,
.bin_attrs_new = mpipl_bin_attr,
};

static int __init opalcore_init(void)
Expand Down
4 changes: 2 additions & 2 deletions arch/powerpc/platforms/powernv/opal-dump.c
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ static int64_t dump_read_data(struct dump_obj *dump)
}

static ssize_t dump_attr_read(struct file *filep, struct kobject *kobj,
struct bin_attribute *bin_attr,
const struct bin_attribute *bin_attr,
char *buffer, loff_t pos, size_t count)
{
ssize_t rc;
Expand Down Expand Up @@ -342,7 +342,7 @@ static void create_dump_obj(uint32_t id, size_t size, uint32_t type)
dump->dump_attr.attr.name = "dump";
dump->dump_attr.attr.mode = 0400;
dump->dump_attr.size = size;
dump->dump_attr.read = dump_attr_read;
dump->dump_attr.read_new = dump_attr_read;

dump->id = id;
dump->size = size;
Expand Down
4 changes: 2 additions & 2 deletions arch/powerpc/platforms/powernv/opal-elog.c
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ static const struct kobj_type elog_ktype = {
#define OPAL_MAX_ERRLOG_SIZE 16384

static ssize_t raw_attr_read(struct file *filep, struct kobject *kobj,
struct bin_attribute *bin_attr,
const struct bin_attribute *bin_attr,
char *buffer, loff_t pos, size_t count)
{
int opal_rc;
Expand Down Expand Up @@ -203,7 +203,7 @@ static void create_elog_obj(uint64_t id, size_t size, uint64_t type)
elog->raw_attr.attr.name = "raw";
elog->raw_attr.attr.mode = 0400;
elog->raw_attr.size = size;
elog->raw_attr.read = raw_attr_read;
elog->raw_attr.read_new = raw_attr_read;

elog->id = id;
elog->size = size;
Expand Down
4 changes: 2 additions & 2 deletions arch/powerpc/platforms/powernv/opal-flash.c
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ static int alloc_image_buf(char *buffer, size_t count)
* and pre-allocate required memory.
*/
static ssize_t image_data_write(struct file *filp, struct kobject *kobj,
struct bin_attribute *bin_attr,
const struct bin_attribute *bin_attr,
char *buffer, loff_t pos, size_t count)
{
int rc;
Expand Down Expand Up @@ -493,7 +493,7 @@ static ssize_t image_data_write(struct file *filp, struct kobject *kobj,
static const struct bin_attribute image_data_attr = {
.attr = {.name = "image", .mode = 0200},
.size = MAX_IMAGE_SIZE, /* Limit image size */
.write = image_data_write,
.write_new = image_data_write,
};

static struct kobj_attribute validate_attribute =
Expand Down
6 changes: 3 additions & 3 deletions arch/powerpc/platforms/powernv/opal-msglog.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,15 +94,15 @@ ssize_t opal_msglog_copy(char *to, loff_t pos, size_t count)
}

static ssize_t opal_msglog_read(struct file *file, struct kobject *kobj,
struct bin_attribute *bin_attr, char *to,
const struct bin_attribute *bin_attr, char *to,
loff_t pos, size_t count)
{
return opal_msglog_copy(to, pos, count);
}

static struct bin_attribute opal_msglog_attr = {
static struct bin_attribute opal_msglog_attr __ro_after_init = {
.attr = {.name = "msglog", .mode = 0400},
.read = opal_msglog_read
.read_new = opal_msglog_read
};

struct memcons *__init memcons_init(struct device_node *node, const char *mc_prop_name)
Expand Down
6 changes: 3 additions & 3 deletions arch/powerpc/platforms/powernv/ultravisor.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ int __init early_init_dt_scan_ultravisor(unsigned long node, const char *uname,
static struct memcons *uv_memcons;

static ssize_t uv_msglog_read(struct file *file, struct kobject *kobj,
struct bin_attribute *bin_attr, char *to,
const struct bin_attribute *bin_attr, char *to,
loff_t pos, size_t count)
{
return memcons_copy(uv_memcons, to, pos, count);
}

static struct bin_attribute uv_msglog_attr = {
static struct bin_attribute uv_msglog_attr __ro_after_init = {
.attr = {.name = "msglog", .mode = 0400},
.read = uv_msglog_read
.read_new = uv_msglog_read
};

static int __init uv_init(void)
Expand Down
5 changes: 5 additions & 0 deletions arch/x86/kernel/cpu/resctrl/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,11 @@ int parse_bw(struct rdt_parse_data *data, struct resctrl_schema *s,

extern struct mutex rdtgroup_mutex;

static inline const char *rdt_kn_name(const struct kernfs_node *kn)
{
return rcu_dereference_check(kn->name, lockdep_is_held(&rdtgroup_mutex));
}

extern struct rdt_hw_resource rdt_resources_all[];
extern struct rdtgroup rdtgroup_default;
extern struct dentry *debugfs_resctrl;
Expand Down
14 changes: 10 additions & 4 deletions arch/x86/kernel/cpu/resctrl/pseudo_lock.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ static char *pseudo_lock_devnode(const struct device *dev, umode_t *mode)
rdtgrp = dev_get_drvdata(dev);
if (mode)
*mode = 0600;
return kasprintf(GFP_KERNEL, "pseudo_lock/%s", rdtgrp->kn->name);
guard(mutex)(&rdtgroup_mutex);
return kasprintf(GFP_KERNEL, "pseudo_lock/%s", rdt_kn_name(rdtgrp->kn));
}

static const struct class pseudo_lock_class = {
Expand Down Expand Up @@ -1293,6 +1294,7 @@ int rdtgroup_pseudo_lock_create(struct rdtgroup *rdtgrp)
struct task_struct *thread;
unsigned int new_minor;
struct device *dev;
char *kn_name __free(kfree) = NULL;
int ret;

ret = pseudo_lock_region_alloc(plr);
Expand All @@ -1304,6 +1306,11 @@ int rdtgroup_pseudo_lock_create(struct rdtgroup *rdtgrp)
ret = -EINVAL;
goto out_region;
}
kn_name = kstrdup(rdt_kn_name(rdtgrp->kn), GFP_KERNEL);
if (!kn_name) {
ret = -ENOMEM;
goto out_cstates;
}

plr->thread_done = 0;

Expand Down Expand Up @@ -1348,8 +1355,7 @@ int rdtgroup_pseudo_lock_create(struct rdtgroup *rdtgrp)
mutex_unlock(&rdtgroup_mutex);

if (!IS_ERR_OR_NULL(debugfs_resctrl)) {
plr->debugfs_dir = debugfs_create_dir(rdtgrp->kn->name,
debugfs_resctrl);
plr->debugfs_dir = debugfs_create_dir(kn_name, debugfs_resctrl);
if (!IS_ERR_OR_NULL(plr->debugfs_dir))
debugfs_create_file("pseudo_lock_measure", 0200,
plr->debugfs_dir, rdtgrp,
Expand All @@ -1358,7 +1364,7 @@ int rdtgroup_pseudo_lock_create(struct rdtgroup *rdtgrp)

dev = device_create(&pseudo_lock_class, NULL,
MKDEV(pseudo_lock_major, new_minor),
rdtgrp, "%s", rdtgrp->kn->name);
rdtgrp, "%s", kn_name);

mutex_lock(&rdtgroup_mutex);

Expand Down
Loading

0 comments on commit 6c60220

Please sign in to comment.