Commit 9d230d50 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'driver-core-6.16-rc1' of...

Merge tag 'driver-core-6.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/driver-core/driver-core

Pull driver core updates from Greg KH:
 "Here are the driver core / kernfs changes for 6.16-rc1.

  Not a huge number of changes this development cycle, here's the
  summary of what is included in here:

   - kernfs locking tweaks, pushing some global locks down into a per-fs
     image lock

   - rust driver core and pci device bindings added for new features.

   - sysfs const work for bin_attributes.

     The final churn of switching away from and removing the
     transitional struct members, "read_new", "write_new" and
     "bin_attrs_new" will come after the merge window to avoid
     unnecesary merge conflicts.

   - auxbus device creation helpers added

   - fauxbus fix for creating sysfs files after the probe completed
     properly

   - other tiny updates for driver core things.

  All of these have been in linux-next for over a week with no reported
  issues"

* tag 'driver-core-6.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/driver-core/driver-core:
  kernfs: Relax constraint in draining guard
  Documentation: embargoed-hardware-issues.rst: Remove myself
  drivers: hv: fix up const issue with vmbus_chan_bin_attrs
  firmware_loader: use SHA-256 library API instead of crypto_shash API
  docs: debugfs: do not recommend debugfs_remove_recursive
  PM: wakeup: Do not expose 4 device wakeup source APIs
  kernfs: switch global kernfs_rename_lock to per-fs lock
  kernfs: switch global kernfs_idr_lock to per-fs lock
  driver core: auxiliary bus: Fix IS_ERR() vs NULL mixup in __devm_auxiliary_device_create()
  sysfs: constify attribute_group::bin_attrs
  sysfs: constify bin_attribute argument of bin_attribute::read/write()
  software node: Correct a OOB check in software_node_get_reference_args()
  devres: simplify devm_kstrdup() using devm_kmemdup()
  platform: replace magic number with macro PLATFORM_DEVID_NONE
  component: do not try to unbind unbound components
  driver core: auxiliary bus: add device creation helpers
  driver core: faux: Add sysfs groups after probing
parents bf373e4c 071d8e4c
Loading
Loading
Loading
Loading
+6 −13
Original line number Diff line number Diff line
@@ -229,22 +229,15 @@ module is unloaded without explicitly removing debugfs entries, the result
will be a lot of stale pointers and no end of highly antisocial behavior.
So all debugfs users - at least those which can be built as modules - must
be prepared to remove all files and directories they create there.  A file
can be removed with::
or directory can be removed with::

    void debugfs_remove(struct dentry *dentry);

The dentry value can be NULL or an error value, in which case nothing will
be removed.

Once upon a time, debugfs users were required to remember the dentry
pointer for every debugfs file they created so that all files could be
cleaned up.  We live in more civilized times now, though, and debugfs users
can call::

    void debugfs_remove_recursive(struct dentry *dentry);

If this function is passed a pointer for the dentry corresponding to the
top-level directory, the entire hierarchy below that directory will be
removed.
be removed.  Note that this function will recursively remove all files and
directories underneath it.  Previously, debugfs_remove_recursive() was used
to perform that task, but this function is now just an alias to
debugfs_remove().  debugfs_remove_recursive() should be considered
deprecated.

.. [1] http://lwn.net/Articles/309298/
+1 −1
Original line number Diff line number Diff line
@@ -155,7 +155,7 @@ The general idea is:
    ``my_variable``

- Clean up the directory when removing the device
  (``debugfs_remove_recursive(parent);``)
  (``debugfs_remove(parent);``)

For the full documentation see :doc:`/filesystems/debugfs`.

+0 −1
Original line number Diff line number Diff line
@@ -290,7 +290,6 @@ an involved disclosed party. The current ambassadors list:
  AMD		Tom Lendacky <thomas.lendacky@amd.com>
  Ampere	Darren Hart <darren@os.amperecomputing.com>
  ARM		Catalin Marinas <catalin.marinas@arm.com>
  IBM Power	Michael Ellerman <ellerman@au.ibm.com>
  IBM Z		Christian Borntraeger <borntraeger@de.ibm.com>
  Intel		Tony Luck <tony.luck@intel.com>
  Qualcomm	Trilok Soni <quic_tsoni@quicinc.com>
+108 −0
Original line number Diff line number Diff line
@@ -395,6 +395,114 @@ void auxiliary_driver_unregister(struct auxiliary_driver *auxdrv)
}
EXPORT_SYMBOL_GPL(auxiliary_driver_unregister);

static void auxiliary_device_release(struct device *dev)
{
	struct auxiliary_device *auxdev = to_auxiliary_dev(dev);

	kfree(auxdev);
}

/**
 * auxiliary_device_create - create a device on the auxiliary bus
 * @dev: parent device
 * @modname: module name used to create the auxiliary driver name.
 * @devname: auxiliary bus device name
 * @platform_data: auxiliary bus device platform data
 * @id: auxiliary bus device id
 *
 * Helper to create an auxiliary bus device.
 * The device created matches driver 'modname.devname' on the auxiliary bus.
 */
struct auxiliary_device *auxiliary_device_create(struct device *dev,
						 const char *modname,
						 const char *devname,
						 void *platform_data,
						 int id)
{
	struct auxiliary_device *auxdev;
	int ret;

	auxdev = kzalloc(sizeof(*auxdev), GFP_KERNEL);
	if (!auxdev)
		return NULL;

	auxdev->id = id;
	auxdev->name = devname;
	auxdev->dev.parent = dev;
	auxdev->dev.platform_data = platform_data;
	auxdev->dev.release = auxiliary_device_release;
	device_set_of_node_from_dev(&auxdev->dev, dev);

	ret = auxiliary_device_init(auxdev);
	if (ret) {
		kfree(auxdev);
		return NULL;
	}

	ret = __auxiliary_device_add(auxdev, modname);
	if (ret) {
		/*
		 * It may look odd but auxdev should not be freed here.
		 * auxiliary_device_uninit() calls device_put() which call
		 * the device release function, freeing auxdev.
		 */
		auxiliary_device_uninit(auxdev);
		return NULL;
	}

	return auxdev;
}
EXPORT_SYMBOL_GPL(auxiliary_device_create);

/**
 * auxiliary_device_destroy - remove an auxiliary device
 * @auxdev: pointer to the auxdev to be removed
 *
 * Helper to remove an auxiliary device created with
 * auxiliary_device_create()
 */
void auxiliary_device_destroy(void *auxdev)
{
	struct auxiliary_device *_auxdev = auxdev;

	auxiliary_device_delete(_auxdev);
	auxiliary_device_uninit(_auxdev);
}
EXPORT_SYMBOL_GPL(auxiliary_device_destroy);

/**
 * __devm_auxiliary_device_create - create a managed device on the auxiliary bus
 * @dev: parent device
 * @modname: module name used to create the auxiliary driver name.
 * @devname: auxiliary bus device name
 * @platform_data: auxiliary bus device platform data
 * @id: auxiliary bus device id
 *
 * Device managed helper to create an auxiliary bus device.
 * The device created matches driver 'modname.devname' on the auxiliary bus.
 */
struct auxiliary_device *__devm_auxiliary_device_create(struct device *dev,
							const char *modname,
							const char *devname,
							void *platform_data,
							int id)
{
	struct auxiliary_device *auxdev;
	int ret;

	auxdev = auxiliary_device_create(dev, modname, devname, platform_data, id);
	if (!auxdev)
		return NULL;

	ret = devm_add_action_or_reset(dev, auxiliary_device_destroy,
				       auxdev);
	if (ret)
		return NULL;

	return auxdev;
}
EXPORT_SYMBOL_GPL(__devm_auxiliary_device_create);

void __init auxiliary_bus_init(void)
{
	WARN_ON(bus_register(&auxiliary_bus_type));
+2 −1
Original line number Diff line number Diff line
@@ -586,7 +586,8 @@ EXPORT_SYMBOL_GPL(component_master_is_bound);
static void component_unbind(struct component *component,
	struct aggregate_device *adev, void *data)
{
	WARN_ON(!component->bound);
	if (WARN_ON(!component->bound))
		return;

	dev_dbg(adev->parent, "unbinding %s component %p (ops %ps)\n",
		dev_name(component->dev), component, component->ops);
Loading