Driver core / debugfs fixes for 5.6-rc5
Here are 4 small driver core / debugfs patches for 5.6-rc3 They are: - debugfs api cleanup now that all callers for debugfs_create_regset32() have been fixed up. This was waiting until after the -rc1 merge as these fixes came in through different trees - driver core sync state fixes based on reports of minor issues found in the feature All of these have been in linux-next with no reported issues. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> -----BEGIN PGP SIGNATURE----- iG0EABECAC0WIQT0tgzFv3jCIUoxPcsxR9QN2y37KQUCXmS2Lg8cZ3JlZ0Brcm9h aC5jb20ACgkQMUfUDdst+ylvNgCfbnALILZh05QJPCfZv/seNFcFYLIAnRNAzxAU mTPqUqTp5+WMXSzGigMa =NyIX -----END PGP SIGNATURE----- Merge tag 'driver-core-5.6-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core Pull driver core and debugfs fixes from Greg KH: "Here are four small driver core / debugfs patches for 5.6-rc3: - debugfs api cleanup now that all debugfs_create_regset32() callers have been fixed up. This was waiting until after the -rc1 merge as these fixes came in through different trees - driver core sync state fixes based on reports of minor issues found in the feature All of these have been in linux-next with no reported issues" * tag 'driver-core-5.6-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: driver core: Skip unnecessary work when device doesn't have sync_state() driver core: Add dev_has_sync_state() driver core: Call sync_state() even if supplier has no consumers debugfs: remove return value of debugfs_create_regset32()
This commit is contained in:
commit
b34e5c1332
@ -164,9 +164,9 @@ file.
|
||||
void __iomem *base;
|
||||
};
|
||||
|
||||
struct dentry *debugfs_create_regset32(const char *name, umode_t mode,
|
||||
struct dentry *parent,
|
||||
struct debugfs_regset32 *regset);
|
||||
debugfs_create_regset32(const char *name, umode_t mode,
|
||||
struct dentry *parent,
|
||||
struct debugfs_regset32 *regset);
|
||||
|
||||
void debugfs_print_regs32(struct seq_file *s, struct debugfs_reg32 *regs,
|
||||
int nregs, void __iomem *base, char *prefix);
|
||||
|
@ -718,6 +718,8 @@ static void __device_links_queue_sync_state(struct device *dev,
|
||||
{
|
||||
struct device_link *link;
|
||||
|
||||
if (!dev_has_sync_state(dev))
|
||||
return;
|
||||
if (dev->state_synced)
|
||||
return;
|
||||
|
||||
@ -745,25 +747,31 @@ static void __device_links_queue_sync_state(struct device *dev,
|
||||
/**
|
||||
* device_links_flush_sync_list - Call sync_state() on a list of devices
|
||||
* @list: List of devices to call sync_state() on
|
||||
* @dont_lock_dev: Device for which lock is already held by the caller
|
||||
*
|
||||
* Calls sync_state() on all the devices that have been queued for it. This
|
||||
* function is used in conjunction with __device_links_queue_sync_state().
|
||||
* function is used in conjunction with __device_links_queue_sync_state(). The
|
||||
* @dont_lock_dev parameter is useful when this function is called from a
|
||||
* context where a device lock is already held.
|
||||
*/
|
||||
static void device_links_flush_sync_list(struct list_head *list)
|
||||
static void device_links_flush_sync_list(struct list_head *list,
|
||||
struct device *dont_lock_dev)
|
||||
{
|
||||
struct device *dev, *tmp;
|
||||
|
||||
list_for_each_entry_safe(dev, tmp, list, links.defer_sync) {
|
||||
list_del_init(&dev->links.defer_sync);
|
||||
|
||||
device_lock(dev);
|
||||
if (dev != dont_lock_dev)
|
||||
device_lock(dev);
|
||||
|
||||
if (dev->bus->sync_state)
|
||||
dev->bus->sync_state(dev);
|
||||
else if (dev->driver && dev->driver->sync_state)
|
||||
dev->driver->sync_state(dev);
|
||||
|
||||
device_unlock(dev);
|
||||
if (dev != dont_lock_dev)
|
||||
device_unlock(dev);
|
||||
|
||||
put_device(dev);
|
||||
}
|
||||
@ -801,7 +809,7 @@ void device_links_supplier_sync_state_resume(void)
|
||||
out:
|
||||
device_links_write_unlock();
|
||||
|
||||
device_links_flush_sync_list(&sync_list);
|
||||
device_links_flush_sync_list(&sync_list, NULL);
|
||||
}
|
||||
|
||||
static int sync_state_resume_initcall(void)
|
||||
@ -813,7 +821,7 @@ late_initcall(sync_state_resume_initcall);
|
||||
|
||||
static void __device_links_supplier_defer_sync(struct device *sup)
|
||||
{
|
||||
if (list_empty(&sup->links.defer_sync))
|
||||
if (list_empty(&sup->links.defer_sync) && dev_has_sync_state(sup))
|
||||
list_add_tail(&sup->links.defer_sync, &deferred_sync);
|
||||
}
|
||||
|
||||
@ -865,6 +873,11 @@ void device_links_driver_bound(struct device *dev)
|
||||
driver_deferred_probe_add(link->consumer);
|
||||
}
|
||||
|
||||
if (defer_sync_state_count)
|
||||
__device_links_supplier_defer_sync(dev);
|
||||
else
|
||||
__device_links_queue_sync_state(dev, &sync_list);
|
||||
|
||||
list_for_each_entry(link, &dev->links.suppliers, c_node) {
|
||||
if (!(link->flags & DL_FLAG_MANAGED))
|
||||
continue;
|
||||
@ -883,7 +896,7 @@ void device_links_driver_bound(struct device *dev)
|
||||
|
||||
device_links_write_unlock();
|
||||
|
||||
device_links_flush_sync_list(&sync_list);
|
||||
device_links_flush_sync_list(&sync_list, dev);
|
||||
}
|
||||
|
||||
static void device_link_drop_managed(struct device_link *link)
|
||||
|
@ -1090,21 +1090,12 @@ static const struct file_operations fops_regset32 = {
|
||||
* This function creates a file in debugfs with the given name that reports
|
||||
* the names and values of a set of 32-bit registers. If the @mode variable
|
||||
* is so set it can be read from. Writing is not supported.
|
||||
*
|
||||
* This function will return a pointer to a dentry if it succeeds. This
|
||||
* pointer must be passed to the debugfs_remove() function when the file is
|
||||
* to be removed (no automatic cleanup happens if your module is unloaded,
|
||||
* you are responsible here.) If an error occurs, ERR_PTR(-ERROR) will be
|
||||
* returned.
|
||||
*
|
||||
* If debugfs is not enabled in the kernel, the value ERR_PTR(-ENODEV) will
|
||||
* be returned.
|
||||
*/
|
||||
struct dentry *debugfs_create_regset32(const char *name, umode_t mode,
|
||||
struct dentry *parent,
|
||||
struct debugfs_regset32 *regset)
|
||||
void debugfs_create_regset32(const char *name, umode_t mode,
|
||||
struct dentry *parent,
|
||||
struct debugfs_regset32 *regset)
|
||||
{
|
||||
return debugfs_create_file(name, mode, parent, regset, &fops_regset32);
|
||||
debugfs_create_file(name, mode, parent, regset, &fops_regset32);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(debugfs_create_regset32);
|
||||
|
||||
|
@ -127,9 +127,9 @@ struct dentry *debugfs_create_blob(const char *name, umode_t mode,
|
||||
struct dentry *parent,
|
||||
struct debugfs_blob_wrapper *blob);
|
||||
|
||||
struct dentry *debugfs_create_regset32(const char *name, umode_t mode,
|
||||
struct dentry *parent,
|
||||
struct debugfs_regset32 *regset);
|
||||
void debugfs_create_regset32(const char *name, umode_t mode,
|
||||
struct dentry *parent,
|
||||
struct debugfs_regset32 *regset);
|
||||
|
||||
void debugfs_print_regs32(struct seq_file *s, const struct debugfs_reg32 *regs,
|
||||
int nregs, void __iomem *base, char *prefix);
|
||||
@ -304,11 +304,10 @@ static inline struct dentry *debugfs_create_blob(const char *name, umode_t mode,
|
||||
return ERR_PTR(-ENODEV);
|
||||
}
|
||||
|
||||
static inline struct dentry *debugfs_create_regset32(const char *name,
|
||||
umode_t mode, struct dentry *parent,
|
||||
struct debugfs_regset32 *regset)
|
||||
static inline void debugfs_create_regset32(const char *name, umode_t mode,
|
||||
struct dentry *parent,
|
||||
struct debugfs_regset32 *regset)
|
||||
{
|
||||
return ERR_PTR(-ENODEV);
|
||||
}
|
||||
|
||||
static inline void debugfs_print_regs32(struct seq_file *s, const struct debugfs_reg32 *regs,
|
||||
|
@ -798,6 +798,17 @@ static inline struct device_node *dev_of_node(struct device *dev)
|
||||
return dev->of_node;
|
||||
}
|
||||
|
||||
static inline bool dev_has_sync_state(struct device *dev)
|
||||
{
|
||||
if (!dev)
|
||||
return false;
|
||||
if (dev->driver && dev->driver->sync_state)
|
||||
return true;
|
||||
if (dev->bus && dev->bus->sync_state)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* High level routines for use by the bus drivers
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user