Skip to content

Commit

Permalink
Merge tag 'driver-core-6.4-rc1' of git://git.kernel.org/pub/scm/linux…
Browse files Browse the repository at this point in the history
…/kernel/git/gregkh/driver-core

Pull driver core updates from Greg KH:
 "Here is the large set of driver core changes for 6.4-rc1.

  Once again, a busy development cycle, with lots of changes happening
  in the driver core in the quest to be able to move "struct bus" and
  "struct class" into read-only memory, a task now complete with these
  changes.

  This will make the future rust interactions with the driver core more
  "provably correct" as well as providing more obvious lifetime rules
  for all busses and classes in the kernel.

  The changes required for this did touch many individual classes and
  busses as many callbacks were changed to take const * parameters
  instead. All of these changes have been submitted to the various
  subsystem maintainers, giving them plenty of time to review, and most
  of them actually did so.

  Other than those changes, included in here are a small set of other
  things:

   - kobject logging improvements

   - cacheinfo improvements and updates

   - obligatory fw_devlink updates and fixes

   - documentation updates

   - device property cleanups and const * changes

   - firwmare loader dependency fixes.

  All of these have been in linux-next for a while with no reported
  problems"

* tag 'driver-core-6.4-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (120 commits)
  device property: make device_property functions take const device *
  driver core: update comments in device_rename()
  driver core: Don't require dynamic_debug for initcall_debug probe timing
  firmware_loader: rework crypto dependencies
  firmware_loader: Strip off \n from customized path
  zram: fix up permission for the hot_add sysfs file
  cacheinfo: Add use_arch[|_cache]_info field/function
  arch_topology: Remove early cacheinfo error message if -ENOENT
  cacheinfo: Check cache properties are present in DT
  cacheinfo: Check sib_leaf in cache_leaves_are_shared()
  cacheinfo: Allow early level detection when DT/ACPI info is missing/broken
  cacheinfo: Add arm64 early level initializer implementation
  cacheinfo: Add arch specific early level initializer
  tty: make tty_class a static const structure
  driver core: class: remove struct class_interface * from callbacks
  driver core: class: mark the struct class in struct class_interface constant
  driver core: class: make class_register() take a const *
  driver core: class: mark class_release() as taking a const *
  driver core: remove incorrect comment for device_create*
  MIPS: vpe-cmp: remove module owner pointer from struct class usage.
  ...
  • Loading branch information
torvalds committed Apr 27, 2023
2 parents 97b2ff2 + 046b6a1 commit 556eb8b
Show file tree
Hide file tree
Showing 297 changed files with 1,684 additions and 1,289 deletions.
5 changes: 5 additions & 0 deletions Documentation/ABI/testing/sysfs-devices-state_synced
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,9 @@ Description:
at the time the kernel starts are not affected or limited in
any way by sync_state() callbacks.

Writing "1" to this file will force a call to the device's
sync_state() function if it hasn't been called already. The
sync_state() call happens independent of the state of the
consumer devices.


23 changes: 14 additions & 9 deletions Documentation/admin-guide/kernel-parameters.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1602,6 +1602,20 @@
dependencies. This only applies for fw_devlink=on|rpm.
Format: <bool>

fw_devlink.sync_state =
[KNL] When all devices that could probe have finished
probing, this parameter controls what to do with
devices that haven't yet received their sync_state()
calls.
Format: { strict | timeout }
strict -- Default. Continue waiting on consumers to
probe successfully.
timeout -- Give up waiting on consumers and call
sync_state() on any devices that haven't yet
received their sync_state() calls after
deferred_probe_timeout has expired or by
late_initcall() if !CONFIG_MODULES.

gamecon.map[2|3]=
[HW,JOY] Multisystem joystick and NES/SNES/PSX pad
support via parallel port (up to 5 devices per port)
Expand Down Expand Up @@ -6150,15 +6164,6 @@
later by a loaded module cannot be set this way.
Example: sysctl.vm.swappiness=40

sysfs.deprecated=0|1 [KNL]
Enable/disable old style sysfs layout for old udev
on older distributions. When this option is enabled
very new udev will not work anymore. When this option
is disabled (or CONFIG_SYSFS_DEPRECATED not compiled)
in older udev will not work anymore.
Default depends on CONFIG_SYSFS_DEPRECATED_V2 set in
the kernel configuration.

sysrq_always_enabled
[KNL]
Ignore sysrq setting - this boot parameter will
Expand Down
4 changes: 2 additions & 2 deletions Documentation/driver-api/driver-model/bus.rst
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@ Exporting Attributes

struct bus_attribute {
struct attribute attr;
ssize_t (*show)(struct bus_type *, char * buf);
ssize_t (*store)(struct bus_type *, const char * buf, size_t count);
ssize_t (*show)(const struct bus_type *, char * buf);
ssize_t (*store)(const struct bus_type *, const char * buf, size_t count);
};

Bus drivers can export attributes using the BUS_ATTR_RW macro that works
Expand Down
3 changes: 2 additions & 1 deletion Documentation/driver-api/firmware/fw_upload.rst
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ function calls firmware_upload_unregister() such as::
len = (truncate) ? truncate - fw_name : strlen(fw_name);
sec->fw_name = kmemdup_nul(fw_name, len, GFP_KERNEL);

fwl = firmware_upload_register(sec->dev, sec->fw_name, &m10bmc_ops, sec);
fwl = firmware_upload_register(THIS_MODULE, sec->dev, sec->fw_name,
&m10bmc_ops, sec);
if (IS_ERR(fwl)) {
dev_err(sec->dev, "Firmware Upload driver failed to start\n");
kfree(sec->fw_name);
Expand Down
4 changes: 2 additions & 2 deletions Documentation/filesystems/sysfs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -373,8 +373,8 @@ Structure::

struct bus_attribute {
struct attribute attr;
ssize_t (*show)(struct bus_type *, char * buf);
ssize_t (*store)(struct bus_type *, const char * buf, size_t count);
ssize_t (*show)(const struct bus_type *, char * buf);
ssize_t (*store)(const struct bus_type *, const char * buf, size_t count);
};

Declaring::
Expand Down
4 changes: 2 additions & 2 deletions Documentation/translations/zh_CN/filesystems/sysfs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -329,8 +329,8 @@ void device_remove_file(struct device *dev, const struct device_attribute * attr

struct bus_attribute {
struct attribute attr;
ssize_t (*show)(struct bus_type *, char * buf);
ssize_t (*store)(struct bus_type *, const char * buf, size_t count);
ssize_t (*show)(const struct bus_type *, char * buf);
ssize_t (*store)(const struct bus_type *, const char * buf, size_t count);
};

声明:
Expand Down
4 changes: 2 additions & 2 deletions Documentation/translations/zh_TW/filesystems/sysfs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -332,8 +332,8 @@ void device_remove_file(struct device *dev, const struct device_attribute * attr

struct bus_attribute {
struct attribute attr;
ssize_t (*show)(struct bus_type *, char * buf);
ssize_t (*store)(struct bus_type *, const char * buf, size_t count);
ssize_t (*show)(const struct bus_type *, char * buf);
ssize_t (*store)(const struct bus_type *, const char * buf, size_t count);
};

聲明:
Expand Down
2 changes: 2 additions & 0 deletions MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -6333,7 +6333,9 @@ F: drivers/base/
F: fs/debugfs/
F: fs/sysfs/
F: include/linux/debugfs.h
F: include/linux/fwnode.h
F: include/linux/kobj*
F: include/linux/property.h
F: lib/kobj*

DRIVERS FOR OMAP ADAPTIVE VOLTAGE SCALING (AVS)
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/include/asm/dma-iommu.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ struct dma_iommu_mapping {
};

struct dma_iommu_mapping *
arm_iommu_create_mapping(struct bus_type *bus, dma_addr_t base, u64 size);
arm_iommu_create_mapping(const struct bus_type *bus, dma_addr_t base, u64 size);

void arm_iommu_release_mapping(struct dma_iommu_mapping *mapping);

Expand Down
2 changes: 1 addition & 1 deletion arch/arm/mm/dma-mapping.c
Original file line number Diff line number Diff line change
Expand Up @@ -1543,7 +1543,7 @@ static const struct dma_map_ops iommu_ops = {
* arm_iommu_attach_device function.
*/
struct dma_iommu_mapping *
arm_iommu_create_mapping(struct bus_type *bus, dma_addr_t base, u64 size)
arm_iommu_create_mapping(const struct bus_type *bus, dma_addr_t base, u64 size)
{
unsigned int bits = size >> PAGE_SHIFT;
unsigned int bitmap_size = BITS_TO_LONGS(bits) * sizeof(long);
Expand Down
25 changes: 22 additions & 3 deletions arch/arm64/kernel/cacheinfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,9 @@ static void ci_leaf_init(struct cacheinfo *this_leaf,
this_leaf->type = type;
}

int init_cache_level(unsigned int cpu)
static void detect_cache_level(unsigned int *level_p, unsigned int *leaves_p)
{
unsigned int ctype, level, leaves;
int fw_level, ret;
struct cpu_cacheinfo *this_cpu_ci = get_cpu_cacheinfo(cpu);

for (level = 1, leaves = 0; level <= MAX_CACHE_LEVEL; level++) {
ctype = get_cache_type(level);
Expand All @@ -54,6 +52,27 @@ int init_cache_level(unsigned int cpu)
leaves += (ctype == CACHE_TYPE_SEPARATE) ? 2 : 1;
}

*level_p = level;
*leaves_p = leaves;
}

int early_cache_level(unsigned int cpu)
{
struct cpu_cacheinfo *this_cpu_ci = get_cpu_cacheinfo(cpu);

detect_cache_level(&this_cpu_ci->num_levels, &this_cpu_ci->num_leaves);

return 0;
}

int init_cache_level(unsigned int cpu)
{
unsigned int level, leaves;
int fw_level, ret;
struct cpu_cacheinfo *this_cpu_ci = get_cpu_cacheinfo(cpu);

detect_cache_level(&level, &leaves);

if (acpi_disabled) {
fw_level = of_find_last_cache_level(cpu);
} else {
Expand Down
10 changes: 9 additions & 1 deletion arch/arm64/kernel/cpufeature.c
Original file line number Diff line number Diff line change
Expand Up @@ -1497,10 +1497,18 @@ static const DEVICE_ATTR_RO(aarch32_el0);

static int __init aarch32_el0_sysfs_init(void)
{
struct device *dev_root;
int ret = 0;

if (!allow_mismatched_32bit_el0)
return 0;

return device_create_file(cpu_subsys.dev_root, &dev_attr_aarch32_el0);
dev_root = bus_get_dev_root(&cpu_subsys);
if (dev_root) {
ret = device_create_file(dev_root, &dev_attr_aarch32_el0);
put_device(dev_root);
}
return ret;
}
device_initcall(aarch32_el0_sysfs_init);

Expand Down
2 changes: 1 addition & 1 deletion arch/mips/kernel/mips-mt.c
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ static int __init mips_mt_init(void)
{
struct class *mtc;

mtc = class_create(THIS_MODULE, "mt");
mtc = class_create("mt");
if (IS_ERR(mtc))
return PTR_ERR(mtc);

Expand Down
1 change: 0 additions & 1 deletion arch/mips/kernel/vpe-cmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ static void vpe_device_release(struct device *cd)

static struct class vpe_class = {
.name = "vpe",
.owner = THIS_MODULE,
.dev_release = vpe_device_release,
.dev_groups = vpe_groups,
};
Expand Down
1 change: 0 additions & 1 deletion arch/mips/kernel/vpe-mt.c
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,6 @@ static void vpe_device_release(struct device *cd)

static struct class vpe_class = {
.name = "vpe",
.owner = THIS_MODULE,
.dev_release = vpe_device_release,
.dev_groups = vpe_groups,
};
Expand Down
2 changes: 1 addition & 1 deletion arch/mips/sibyte/common/sb_tbprof.c
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@ static int __init sbprof_tb_init(void)
return -EIO;
}

tbc = class_create(THIS_MODULE, "sb_tracebuffer");
tbc = class_create("sb_tracebuffer");
if (IS_ERR(tbc)) {
err = PTR_ERR(tbc);
goto out_chrdev;
Expand Down
14 changes: 12 additions & 2 deletions arch/powerpc/kernel/sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -217,13 +217,18 @@ static DEVICE_ATTR(dscr_default, 0600,
static void __init sysfs_create_dscr_default(void)
{
if (cpu_has_feature(CPU_FTR_DSCR)) {
struct device *dev_root;
int cpu;

dscr_default = spr_default_dscr;
for_each_possible_cpu(cpu)
paca_ptrs[cpu]->dscr_default = dscr_default;

device_create_file(cpu_subsys.dev_root, &dev_attr_dscr_default);
dev_root = bus_get_dev_root(&cpu_subsys);
if (dev_root) {
device_create_file(dev_root, &dev_attr_dscr_default);
put_device(dev_root);
}
}
}
#endif /* CONFIG_PPC64 */
Expand Down Expand Up @@ -746,7 +751,12 @@ static DEVICE_ATTR(svm, 0444, show_svm, NULL);

static void __init create_svm_file(void)
{
device_create_file(cpu_subsys.dev_root, &dev_attr_svm);
struct device *dev_root = bus_get_dev_root(&cpu_subsys);

if (dev_root) {
device_create_file(dev_root, &dev_attr_svm);
put_device(dev_root);
}
}
#else
static void __init create_svm_file(void)
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/platforms/book3s/vas-api.c
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ int vas_register_coproc_api(struct module *mod, enum vas_cop_type cop_type,
pr_devel("%s device allocated, dev [%i,%i]\n", name,
MAJOR(coproc_device.devt), MINOR(coproc_device.devt));

coproc_device.class = class_create(mod, name);
coproc_device.class = class_create(name);
if (IS_ERR(coproc_device.class)) {
rc = PTR_ERR(coproc_device.class);
pr_err("Unable to create %s class %d\n", name, rc);
Expand Down
9 changes: 7 additions & 2 deletions arch/powerpc/platforms/powernv/idle.c
Original file line number Diff line number Diff line change
Expand Up @@ -1464,14 +1464,19 @@ static int __init pnv_init_idle_states(void)
power7_fastsleep_workaround_entry = false;
power7_fastsleep_workaround_exit = false;
} else {
struct device *dev_root;
/*
* OPAL_PM_SLEEP_ENABLED_ER1 is set. It indicates that
* workaround is needed to use fastsleep. Provide sysfs
* control to choose how this workaround has to be
* applied.
*/
device_create_file(cpu_subsys.dev_root,
&dev_attr_fastsleep_workaround_applyonce);
dev_root = bus_get_dev_root(&cpu_subsys);
if (dev_root) {
device_create_file(dev_root,
&dev_attr_fastsleep_workaround_applyonce);
put_device(dev_root);
}
}

update_subcore_sibling_mask();
Expand Down
10 changes: 8 additions & 2 deletions arch/powerpc/platforms/powernv/subcore.c
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,9 @@ static DEVICE_ATTR(subcores_per_core, 0644,

static int subcore_init(void)
{
struct device *dev_root;
unsigned pvr_ver;
int rc = 0;

pvr_ver = PVR_VER(mfspr(SPRN_PVR));

Expand All @@ -435,7 +437,11 @@ static int subcore_init(void)

set_subcores_per_core(1);

return device_create_file(cpu_subsys.dev_root,
&dev_attr_subcores_per_core);
dev_root = bus_get_dev_root(&cpu_subsys);
if (dev_root) {
rc = device_create_file(dev_root, &dev_attr_subcores_per_core);
put_device(dev_root);
}
return rc;
}
machine_device_initcall(powernv, subcore_init);
4 changes: 2 additions & 2 deletions arch/powerpc/platforms/pseries/dlpar.c
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@ static int dlpar_parse_id_type(char **cmd, struct pseries_hp_errorlog *hp_elog)
return 0;
}

static ssize_t dlpar_store(struct class *class, struct class_attribute *attr,
static ssize_t dlpar_store(const struct class *class, const struct class_attribute *attr,
const char *buf, size_t count)
{
struct pseries_hp_errorlog hp_elog;
Expand Down Expand Up @@ -551,7 +551,7 @@ static ssize_t dlpar_store(struct class *class, struct class_attribute *attr,
return rc ? rc : count;
}

static ssize_t dlpar_show(struct class *class, struct class_attribute *attr,
static ssize_t dlpar_show(const struct class *class, const struct class_attribute *attr,
char *buf)
{
return sprintf(buf, "%s\n", "memory,cpu");
Expand Down
4 changes: 2 additions & 2 deletions arch/powerpc/platforms/pseries/ibmebus.c
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ static char *ibmebus_chomp(const char *in, size_t count)
return out;
}

static ssize_t probe_store(struct bus_type *bus, const char *buf, size_t count)
static ssize_t probe_store(const struct bus_type *bus, const char *buf, size_t count)
{
struct device_node *dn = NULL;
struct device *dev;
Expand Down Expand Up @@ -305,7 +305,7 @@ static ssize_t probe_store(struct bus_type *bus, const char *buf, size_t count)
}
static BUS_ATTR_WO(probe);

static ssize_t remove_store(struct bus_type *bus, const char *buf, size_t count)
static ssize_t remove_store(const struct bus_type *bus, const char *buf, size_t count)
{
struct device *dev;
char *path;
Expand Down
4 changes: 2 additions & 2 deletions arch/powerpc/platforms/pseries/mobility.c
Original file line number Diff line number Diff line change
Expand Up @@ -787,8 +787,8 @@ int rtas_syscall_dispatch_ibm_suspend_me(u64 handle)
return pseries_migrate_partition(handle);
}

static ssize_t migration_store(struct class *class,
struct class_attribute *attr, const char *buf,
static ssize_t migration_store(const struct class *class,
const struct class_attribute *attr, const char *buf,
size_t count)
{
u64 streamid;
Expand Down
Loading

0 comments on commit 556eb8b

Please sign in to comment.