mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-12-28 00:35:01 +00:00
Driver core changes for 6.13-rc1
Here is a small set of driver core changes for 6.13-rc1. Nothing major for this merge cycle, except for the 2 simple merge conflicts are here just to make life interesting. Included in here are: - sysfs core changes and preparations for more sysfs api cleanups that can come through all driver trees after -rc1 is out - fw_devlink fixes based on many reports and debugging sessions - list_for_each_reverse() removal, no one was using it! - last-minute seq_printf() format string bug found and fixed in many drivers all at once. - minor bugfixes and changes full details in the shortlog As mentioned above, there is 2 merge conflicts with your tree, one is where the file is removed (easy enough to resolve), the second is a build time error, that has been found in linux-next and the fix can be seen here: https://lore.kernel.org/r/20241107212645.41252436@canb.auug.org.au Other than that, the changes here have been in linux-next with no other reported issues. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> -----BEGIN PGP SIGNATURE----- iG0EABECAC0WIQT0tgzFv3jCIUoxPcsxR9QN2y37KQUCZ0lEog8cZ3JlZ0Brcm9h aC5jb20ACgkQMUfUDdst+ym+0ACgw6wN+LkLVIHWhxTq5DYHQ0QCxY8AoJrRIcKe 78h0+OU3OXhOy8JGz62W =oI5S -----END PGP SIGNATURE----- Merge tag 'driver-core-6.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core Pull driver core updates from Greg KH: "Here is a small set of driver core changes for 6.13-rc1. Nothing major for this merge cycle, except for the two simple merge conflicts are here just to make life interesting. Included in here are: - sysfs core changes and preparations for more sysfs api cleanups that can come through all driver trees after -rc1 is out - fw_devlink fixes based on many reports and debugging sessions - list_for_each_reverse() removal, no one was using it! - last-minute seq_printf() format string bug found and fixed in many drivers all at once. - minor bugfixes and changes full details in the shortlog" * tag 'driver-core-6.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (35 commits) Fix a potential abuse of seq_printf() format string in drivers cpu: Remove spurious NULL in attribute_group definition s390/con3215: Remove spurious NULL in attribute_group definition perf: arm-ni: Remove spurious NULL in attribute_group definition driver core: Constify bin_attribute definitions sysfs: attribute_group: allow registration of const bin_attribute firmware_loader: Fix possible resource leak in fw_log_firmware_info() drivers: core: fw_devlink: Fix excess parameter description in docstring driver core: class: Correct WARN() message in APIs class_(for_each|find)_device() cacheinfo: Use of_property_present() for non-boolean properties cdx: Fix cdx_mmap_resource() after constifying attr in ->mmap() drivers: core: fw_devlink: Make the error message a bit more useful phy: tegra: xusb: Set fwnode for xusb port devices drm: display: Set fwnode for aux bus devices driver core: fw_devlink: Stop trying to optimize cycle detection logic driver core: Constify attribute arguments of binary attributes sysfs: bin_attribute: add const read/write callback variants sysfs: implement all BIN_ATTR_* macros in terms of __BIN_ATTR() sysfs: treewide: constify attribute callback of bin_attribute::llseek() sysfs: treewide: constify attribute callback of bin_attribute::mmap() ...
This commit is contained in:
commit
55cb93fd24
@ -24,7 +24,6 @@ Auxiliary Device Creation
|
||||
|
||||
.. kernel-doc:: drivers/base/auxiliary.c
|
||||
:identifiers: auxiliary_device_init __auxiliary_device_add
|
||||
auxiliary_find_device
|
||||
|
||||
Auxiliary Device Memory Model and Lifespan
|
||||
------------------------------------------
|
||||
|
@ -64,7 +64,7 @@ static int __pci_mmap_fits(struct pci_dev *pdev, int num,
|
||||
* Return: %0 on success, negative error code otherwise
|
||||
*/
|
||||
static int pci_mmap_resource(struct kobject *kobj,
|
||||
struct bin_attribute *attr,
|
||||
const struct bin_attribute *attr,
|
||||
struct vm_area_struct *vma, int sparse)
|
||||
{
|
||||
struct pci_dev *pdev = to_pci_dev(kobj_to_dev(kobj));
|
||||
@ -93,14 +93,14 @@ static int pci_mmap_resource(struct kobject *kobj,
|
||||
}
|
||||
|
||||
static int pci_mmap_resource_sparse(struct file *filp, struct kobject *kobj,
|
||||
struct bin_attribute *attr,
|
||||
const struct bin_attribute *attr,
|
||||
struct vm_area_struct *vma)
|
||||
{
|
||||
return pci_mmap_resource(kobj, attr, vma, 1);
|
||||
}
|
||||
|
||||
static int pci_mmap_resource_dense(struct file *filp, struct kobject *kobj,
|
||||
struct bin_attribute *attr,
|
||||
const struct bin_attribute *attr,
|
||||
struct vm_area_struct *vma)
|
||||
{
|
||||
return pci_mmap_resource(kobj, attr, vma, 0);
|
||||
|
@ -92,7 +92,7 @@
|
||||
* Auxiliary devices are created and registered by a subsystem-level core
|
||||
* device that needs to break up its functionality into smaller fragments. One
|
||||
* way to extend the scope of an auxiliary_device is to encapsulate it within a
|
||||
* domain- pecific structure defined by the parent device. This structure
|
||||
* domain-specific structure defined by the parent device. This structure
|
||||
* contains the auxiliary_device and any associated shared data/callbacks
|
||||
* needed to establish the connection with the parent.
|
||||
*
|
||||
@ -335,35 +335,6 @@ int __auxiliary_device_add(struct auxiliary_device *auxdev, const char *modname)
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(__auxiliary_device_add);
|
||||
|
||||
/**
|
||||
* auxiliary_find_device - auxiliary device iterator for locating a particular device.
|
||||
* @start: Device to begin with
|
||||
* @data: Data to pass to match function
|
||||
* @match: Callback function to check device
|
||||
*
|
||||
* This function returns a reference to a device that is 'found'
|
||||
* for later use, as determined by the @match callback.
|
||||
*
|
||||
* The reference returned should be released with put_device().
|
||||
*
|
||||
* The callback should return 0 if the device doesn't match and non-zero
|
||||
* if it does. If the callback returns non-zero, this function will
|
||||
* return to the caller and not iterate over any more devices.
|
||||
*/
|
||||
struct auxiliary_device *auxiliary_find_device(struct device *start,
|
||||
const void *data,
|
||||
device_match_t match)
|
||||
{
|
||||
struct device *dev;
|
||||
|
||||
dev = bus_find_device(&auxiliary_bus_type, start, data, match);
|
||||
if (!dev)
|
||||
return NULL;
|
||||
|
||||
return to_auxiliary_dev(dev);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(auxiliary_find_device);
|
||||
|
||||
/**
|
||||
* __auxiliary_driver_register - register a driver for auxiliary bus devices
|
||||
* @auxdrv: auxiliary_driver structure
|
||||
|
@ -254,11 +254,11 @@ static int of_count_cache_leaves(struct device_node *np)
|
||||
{
|
||||
unsigned int leaves = 0;
|
||||
|
||||
if (of_property_read_bool(np, "cache-size"))
|
||||
if (of_property_present(np, "cache-size"))
|
||||
++leaves;
|
||||
if (of_property_read_bool(np, "i-cache-size"))
|
||||
if (of_property_present(np, "i-cache-size"))
|
||||
++leaves;
|
||||
if (of_property_read_bool(np, "d-cache-size"))
|
||||
if (of_property_present(np, "d-cache-size"))
|
||||
++leaves;
|
||||
|
||||
if (!leaves) {
|
||||
@ -367,9 +367,7 @@ static int cache_shared_cpu_map_setup(unsigned int cpu)
|
||||
|
||||
cpumask_set_cpu(cpu, &this_leaf->shared_cpu_map);
|
||||
for_each_online_cpu(i) {
|
||||
struct cpu_cacheinfo *sib_cpu_ci = get_cpu_cacheinfo(i);
|
||||
|
||||
if (i == cpu || !sib_cpu_ci->info_list)
|
||||
if (i == cpu || !per_cpu_cacheinfo(i))
|
||||
continue;/* skip if itself or no cacheinfo */
|
||||
for (sib_index = 0; sib_index < cache_leaves(i); sib_index++) {
|
||||
sib_leaf = per_cpu_cacheinfo_idx(i, sib_index);
|
||||
@ -409,10 +407,7 @@ static void cache_shared_cpu_map_remove(unsigned int cpu)
|
||||
for (index = 0; index < cache_leaves(cpu); index++) {
|
||||
this_leaf = per_cpu_cacheinfo_idx(cpu, index);
|
||||
for_each_cpu(sibling, &this_leaf->shared_cpu_map) {
|
||||
struct cpu_cacheinfo *sib_cpu_ci =
|
||||
get_cpu_cacheinfo(sibling);
|
||||
|
||||
if (sibling == cpu || !sib_cpu_ci->info_list)
|
||||
if (sibling == cpu || !per_cpu_cacheinfo(sibling))
|
||||
continue;/* skip if itself or no cacheinfo */
|
||||
|
||||
for (sib_index = 0; sib_index < cache_leaves(sibling); sib_index++) {
|
||||
|
@ -405,7 +405,7 @@ int class_for_each_device(const struct class *class, const struct device *start,
|
||||
if (!class)
|
||||
return -EINVAL;
|
||||
if (!sp) {
|
||||
WARN(1, "%s called for class '%s' before it was initialized",
|
||||
WARN(1, "%s called for class '%s' before it was registered",
|
||||
__func__, class->name);
|
||||
return -EINVAL;
|
||||
}
|
||||
@ -453,7 +453,7 @@ struct device *class_find_device(const struct class *class, const struct device
|
||||
if (!class)
|
||||
return NULL;
|
||||
if (!sp) {
|
||||
WARN(1, "%s called for class '%s' before it was initialized",
|
||||
WARN(1, "%s called for class '%s' before it was registered",
|
||||
__func__, class->name);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -552,7 +552,7 @@ void device_link_wait_removal(void)
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(device_link_wait_removal);
|
||||
|
||||
static struct class devlink_class = {
|
||||
static const struct class devlink_class = {
|
||||
.name = "devlink",
|
||||
.dev_groups = devlink_groups,
|
||||
.dev_release = devlink_dev_release,
|
||||
@ -1971,7 +1971,7 @@ static struct device *fwnode_get_next_parent_dev(const struct fwnode_handle *fwn
|
||||
|
||||
/**
|
||||
* __fw_devlink_relax_cycles - Relax and mark dependency cycles.
|
||||
* @con: Potential consumer device.
|
||||
* @con_handle: Potential consumer device fwnode.
|
||||
* @sup_handle: Potential supplier's fwnode.
|
||||
*
|
||||
* Needs to be called with fwnode_lock and device link lock held.
|
||||
@ -1989,10 +1989,10 @@ static struct device *fwnode_get_next_parent_dev(const struct fwnode_handle *fwn
|
||||
*
|
||||
* Return true if one or more cycles were found. Otherwise, return false.
|
||||
*/
|
||||
static bool __fw_devlink_relax_cycles(struct device *con,
|
||||
static bool __fw_devlink_relax_cycles(struct fwnode_handle *con_handle,
|
||||
struct fwnode_handle *sup_handle)
|
||||
{
|
||||
struct device *sup_dev = NULL, *par_dev = NULL;
|
||||
struct device *sup_dev = NULL, *par_dev = NULL, *con_dev = NULL;
|
||||
struct fwnode_link *link;
|
||||
struct device_link *dev_link;
|
||||
bool ret = false;
|
||||
@ -2009,22 +2009,22 @@ static bool __fw_devlink_relax_cycles(struct device *con,
|
||||
|
||||
sup_handle->flags |= FWNODE_FLAG_VISITED;
|
||||
|
||||
sup_dev = get_dev_from_fwnode(sup_handle);
|
||||
|
||||
/* Termination condition. */
|
||||
if (sup_dev == con) {
|
||||
if (sup_handle == con_handle) {
|
||||
pr_debug("----- cycle: start -----\n");
|
||||
ret = true;
|
||||
goto out;
|
||||
}
|
||||
|
||||
sup_dev = get_dev_from_fwnode(sup_handle);
|
||||
con_dev = get_dev_from_fwnode(con_handle);
|
||||
/*
|
||||
* If sup_dev is bound to a driver and @con hasn't started binding to a
|
||||
* driver, sup_dev can't be a consumer of @con. So, no need to check
|
||||
* further.
|
||||
*/
|
||||
if (sup_dev && sup_dev->links.status == DL_DEV_DRIVER_BOUND &&
|
||||
con->links.status == DL_DEV_NO_DRIVER) {
|
||||
con_dev && con_dev->links.status == DL_DEV_NO_DRIVER) {
|
||||
ret = false;
|
||||
goto out;
|
||||
}
|
||||
@ -2033,7 +2033,7 @@ static bool __fw_devlink_relax_cycles(struct device *con,
|
||||
if (link->flags & FWLINK_FLAG_IGNORE)
|
||||
continue;
|
||||
|
||||
if (__fw_devlink_relax_cycles(con, link->supplier)) {
|
||||
if (__fw_devlink_relax_cycles(con_handle, link->supplier)) {
|
||||
__fwnode_link_cycle(link);
|
||||
ret = true;
|
||||
}
|
||||
@ -2048,7 +2048,7 @@ static bool __fw_devlink_relax_cycles(struct device *con,
|
||||
else
|
||||
par_dev = fwnode_get_next_parent_dev(sup_handle);
|
||||
|
||||
if (par_dev && __fw_devlink_relax_cycles(con, par_dev->fwnode)) {
|
||||
if (par_dev && __fw_devlink_relax_cycles(con_handle, par_dev->fwnode)) {
|
||||
pr_debug("%pfwf: cycle: child of %pfwf\n", sup_handle,
|
||||
par_dev->fwnode);
|
||||
ret = true;
|
||||
@ -2066,7 +2066,7 @@ static bool __fw_devlink_relax_cycles(struct device *con,
|
||||
!(dev_link->flags & DL_FLAG_CYCLE))
|
||||
continue;
|
||||
|
||||
if (__fw_devlink_relax_cycles(con,
|
||||
if (__fw_devlink_relax_cycles(con_handle,
|
||||
dev_link->supplier->fwnode)) {
|
||||
pr_debug("%pfwf: cycle: depends on %pfwf\n", sup_handle,
|
||||
dev_link->supplier->fwnode);
|
||||
@ -2114,11 +2114,6 @@ static int fw_devlink_create_devlink(struct device *con,
|
||||
if (link->flags & FWLINK_FLAG_IGNORE)
|
||||
return 0;
|
||||
|
||||
if (con->fwnode == link->consumer)
|
||||
flags = fw_devlink_get_flags(link->flags);
|
||||
else
|
||||
flags = FW_DEVLINK_FLAGS_PERMISSIVE;
|
||||
|
||||
/*
|
||||
* In some cases, a device P might also be a supplier to its child node
|
||||
* C. However, this would defer the probe of C until the probe of P
|
||||
@ -2139,25 +2134,23 @@ static int fw_devlink_create_devlink(struct device *con,
|
||||
return -EINVAL;
|
||||
|
||||
/*
|
||||
* SYNC_STATE_ONLY device links don't block probing and supports cycles.
|
||||
* So, one might expect that cycle detection isn't necessary for them.
|
||||
* However, if the device link was marked as SYNC_STATE_ONLY because
|
||||
* it's part of a cycle, then we still need to do cycle detection. This
|
||||
* is because the consumer and supplier might be part of multiple cycles
|
||||
* and we need to detect all those cycles.
|
||||
* Don't try to optimize by not calling the cycle detection logic under
|
||||
* certain conditions. There's always some corner case that won't get
|
||||
* detected.
|
||||
*/
|
||||
if (!device_link_flag_is_sync_state_only(flags) ||
|
||||
flags & DL_FLAG_CYCLE) {
|
||||
device_links_write_lock();
|
||||
if (__fw_devlink_relax_cycles(con, sup_handle)) {
|
||||
__fwnode_link_cycle(link);
|
||||
flags = fw_devlink_get_flags(link->flags);
|
||||
pr_debug("----- cycle: end -----\n");
|
||||
dev_info(con, "Fixed dependency cycle(s) with %pfwf\n",
|
||||
sup_handle);
|
||||
}
|
||||
device_links_write_unlock();
|
||||
device_links_write_lock();
|
||||
if (__fw_devlink_relax_cycles(link->consumer, sup_handle)) {
|
||||
__fwnode_link_cycle(link);
|
||||
pr_debug("----- cycle: end -----\n");
|
||||
pr_info("%pfwf: Fixed dependency cycle(s) with %pfwf\n",
|
||||
link->consumer, sup_handle);
|
||||
}
|
||||
device_links_write_unlock();
|
||||
|
||||
if (con->fwnode == link->consumer)
|
||||
flags = fw_devlink_get_flags(link->flags);
|
||||
else
|
||||
flags = FW_DEVLINK_FLAGS_PERMISSIVE;
|
||||
|
||||
if (sup_handle->flags & FWNODE_FLAG_NOT_DEVICE)
|
||||
sup_dev = fwnode_get_next_parent_dev(sup_handle);
|
||||
@ -2180,8 +2173,8 @@ static int fw_devlink_create_devlink(struct device *con,
|
||||
}
|
||||
|
||||
if (con != sup_dev && !device_link_add(con, sup_dev, flags)) {
|
||||
dev_err(con, "Failed to create device link (0x%x) with %s\n",
|
||||
flags, dev_name(sup_dev));
|
||||
dev_err(con, "Failed to create device link (0x%x) with supplier %s for %pfwf\n",
|
||||
flags, dev_name(sup_dev), link->consumer);
|
||||
ret = -EINVAL;
|
||||
}
|
||||
|
||||
|
@ -829,19 +829,18 @@ static void fw_log_firmware_info(const struct firmware *fw, const char *name, st
|
||||
shash->tfm = alg;
|
||||
|
||||
if (crypto_shash_digest(shash, fw->data, fw->size, sha256buf) < 0)
|
||||
goto out_shash;
|
||||
goto out_free;
|
||||
|
||||
for (int i = 0; i < SHA256_DIGEST_SIZE; i++)
|
||||
sprintf(&outbuf[i * 2], "%02x", sha256buf[i]);
|
||||
outbuf[SHA256_BLOCK_SIZE] = 0;
|
||||
dev_dbg(device, "Loaded FW: %s, sha256: %s\n", name, outbuf);
|
||||
|
||||
out_shash:
|
||||
crypto_free_shash(alg);
|
||||
out_free:
|
||||
kfree(shash);
|
||||
kfree(outbuf);
|
||||
kfree(sha256buf);
|
||||
crypto_free_shash(alg);
|
||||
}
|
||||
#else
|
||||
static void fw_log_firmware_info(const struct firmware *fw, const char *name,
|
||||
@ -1075,8 +1074,8 @@ EXPORT_SYMBOL_GPL(firmware_request_platform);
|
||||
|
||||
/**
|
||||
* firmware_request_cache() - cache firmware for suspend so resume can use it
|
||||
* @name: name of firmware file
|
||||
* @device: device for which firmware should be cached for
|
||||
* @name: name of firmware file
|
||||
*
|
||||
* There are some devices with an optimization that enables the device to not
|
||||
* require loading firmware on system reboot. This optimization may still
|
||||
|
@ -27,7 +27,7 @@ static const struct bus_type node_subsys = {
|
||||
};
|
||||
|
||||
static inline ssize_t cpumap_read(struct file *file, struct kobject *kobj,
|
||||
struct bin_attribute *attr, char *buf,
|
||||
const struct bin_attribute *attr, char *buf,
|
||||
loff_t off, size_t count)
|
||||
{
|
||||
struct device *dev = kobj_to_dev(kobj);
|
||||
@ -45,10 +45,10 @@ static inline ssize_t cpumap_read(struct file *file, struct kobject *kobj,
|
||||
return n;
|
||||
}
|
||||
|
||||
static BIN_ATTR_RO(cpumap, CPUMAP_FILE_MAX_BYTES);
|
||||
static const BIN_ATTR_RO(cpumap, CPUMAP_FILE_MAX_BYTES);
|
||||
|
||||
static inline ssize_t cpulist_read(struct file *file, struct kobject *kobj,
|
||||
struct bin_attribute *attr, char *buf,
|
||||
const struct bin_attribute *attr, char *buf,
|
||||
loff_t off, size_t count)
|
||||
{
|
||||
struct device *dev = kobj_to_dev(kobj);
|
||||
@ -66,7 +66,7 @@ static inline ssize_t cpulist_read(struct file *file, struct kobject *kobj,
|
||||
return n;
|
||||
}
|
||||
|
||||
static BIN_ATTR_RO(cpulist, CPULIST_FILE_MAX_BYTES);
|
||||
static const BIN_ATTR_RO(cpulist, CPULIST_FILE_MAX_BYTES);
|
||||
|
||||
/**
|
||||
* struct node_access_nodes - Access class device to hold user visible
|
||||
@ -578,7 +578,7 @@ static struct attribute *node_dev_attrs[] = {
|
||||
NULL
|
||||
};
|
||||
|
||||
static struct bin_attribute *node_dev_bin_attrs[] = {
|
||||
static const struct bin_attribute *node_dev_bin_attrs[] = {
|
||||
&bin_attr_cpumap,
|
||||
&bin_attr_cpulist,
|
||||
NULL
|
||||
@ -586,7 +586,7 @@ static struct bin_attribute *node_dev_bin_attrs[] = {
|
||||
|
||||
static const struct attribute_group node_dev_group = {
|
||||
.attrs = node_dev_attrs,
|
||||
.bin_attrs = node_dev_bin_attrs
|
||||
.bin_attrs_new = node_dev_bin_attrs,
|
||||
};
|
||||
|
||||
static const struct attribute_group *node_dev_groups[] = {
|
||||
|
@ -509,14 +509,6 @@ static ssize_t wakeup_last_time_ms_show(struct device *dev,
|
||||
return sysfs_emit(buf, "%lld\n", msec);
|
||||
}
|
||||
|
||||
static inline int dpm_sysfs_wakeup_change_owner(struct device *dev, kuid_t kuid,
|
||||
kgid_t kgid)
|
||||
{
|
||||
if (dev->power.wakeup && dev->power.wakeup->dev)
|
||||
return device_change_owner(dev->power.wakeup->dev, kuid, kgid);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static DEVICE_ATTR_RO(wakeup_last_time_ms);
|
||||
|
||||
#ifdef CONFIG_PM_AUTOSLEEP
|
||||
@ -541,6 +533,15 @@ static ssize_t wakeup_prevent_sleep_time_ms_show(struct device *dev,
|
||||
|
||||
static DEVICE_ATTR_RO(wakeup_prevent_sleep_time_ms);
|
||||
#endif /* CONFIG_PM_AUTOSLEEP */
|
||||
|
||||
static inline int dpm_sysfs_wakeup_change_owner(struct device *dev, kuid_t kuid,
|
||||
kgid_t kgid)
|
||||
{
|
||||
if (dev->power.wakeup && dev->power.wakeup->dev)
|
||||
return device_change_owner(dev->power.wakeup->dev, kuid, kgid);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else /* CONFIG_PM_SLEEP */
|
||||
static inline int dpm_sysfs_wakeup_change_owner(struct device *dev, kuid_t kuid,
|
||||
kgid_t kgid)
|
||||
|
@ -23,7 +23,7 @@ static ssize_t name##_show(struct device *dev, \
|
||||
|
||||
#define define_siblings_read_func(name, mask) \
|
||||
static ssize_t name##_read(struct file *file, struct kobject *kobj, \
|
||||
struct bin_attribute *attr, char *buf, \
|
||||
const struct bin_attribute *attr, char *buf, \
|
||||
loff_t off, size_t count) \
|
||||
{ \
|
||||
struct device *dev = kobj_to_dev(kobj); \
|
||||
@ -33,7 +33,7 @@ static ssize_t name##_read(struct file *file, struct kobject *kobj, \
|
||||
} \
|
||||
\
|
||||
static ssize_t name##_list_read(struct file *file, struct kobject *kobj, \
|
||||
struct bin_attribute *attr, char *buf, \
|
||||
const struct bin_attribute *attr, char *buf, \
|
||||
loff_t off, size_t count) \
|
||||
{ \
|
||||
struct device *dev = kobj_to_dev(kobj); \
|
||||
@ -62,50 +62,50 @@ define_id_show_func(ppin, "0x%llx");
|
||||
static DEVICE_ATTR_ADMIN_RO(ppin);
|
||||
|
||||
define_siblings_read_func(thread_siblings, sibling_cpumask);
|
||||
static BIN_ATTR_RO(thread_siblings, CPUMAP_FILE_MAX_BYTES);
|
||||
static BIN_ATTR_RO(thread_siblings_list, CPULIST_FILE_MAX_BYTES);
|
||||
static const BIN_ATTR_RO(thread_siblings, CPUMAP_FILE_MAX_BYTES);
|
||||
static const BIN_ATTR_RO(thread_siblings_list, CPULIST_FILE_MAX_BYTES);
|
||||
|
||||
define_siblings_read_func(core_cpus, sibling_cpumask);
|
||||
static BIN_ATTR_RO(core_cpus, CPUMAP_FILE_MAX_BYTES);
|
||||
static BIN_ATTR_RO(core_cpus_list, CPULIST_FILE_MAX_BYTES);
|
||||
static const BIN_ATTR_RO(core_cpus, CPUMAP_FILE_MAX_BYTES);
|
||||
static const BIN_ATTR_RO(core_cpus_list, CPULIST_FILE_MAX_BYTES);
|
||||
|
||||
define_siblings_read_func(core_siblings, core_cpumask);
|
||||
static BIN_ATTR_RO(core_siblings, CPUMAP_FILE_MAX_BYTES);
|
||||
static BIN_ATTR_RO(core_siblings_list, CPULIST_FILE_MAX_BYTES);
|
||||
static const BIN_ATTR_RO(core_siblings, CPUMAP_FILE_MAX_BYTES);
|
||||
static const BIN_ATTR_RO(core_siblings_list, CPULIST_FILE_MAX_BYTES);
|
||||
|
||||
#ifdef TOPOLOGY_CLUSTER_SYSFS
|
||||
define_siblings_read_func(cluster_cpus, cluster_cpumask);
|
||||
static BIN_ATTR_RO(cluster_cpus, CPUMAP_FILE_MAX_BYTES);
|
||||
static BIN_ATTR_RO(cluster_cpus_list, CPULIST_FILE_MAX_BYTES);
|
||||
static const BIN_ATTR_RO(cluster_cpus, CPUMAP_FILE_MAX_BYTES);
|
||||
static const BIN_ATTR_RO(cluster_cpus_list, CPULIST_FILE_MAX_BYTES);
|
||||
#endif
|
||||
|
||||
#ifdef TOPOLOGY_DIE_SYSFS
|
||||
define_siblings_read_func(die_cpus, die_cpumask);
|
||||
static BIN_ATTR_RO(die_cpus, CPUMAP_FILE_MAX_BYTES);
|
||||
static BIN_ATTR_RO(die_cpus_list, CPULIST_FILE_MAX_BYTES);
|
||||
static const BIN_ATTR_RO(die_cpus, CPUMAP_FILE_MAX_BYTES);
|
||||
static const BIN_ATTR_RO(die_cpus_list, CPULIST_FILE_MAX_BYTES);
|
||||
#endif
|
||||
|
||||
define_siblings_read_func(package_cpus, core_cpumask);
|
||||
static BIN_ATTR_RO(package_cpus, CPUMAP_FILE_MAX_BYTES);
|
||||
static BIN_ATTR_RO(package_cpus_list, CPULIST_FILE_MAX_BYTES);
|
||||
static const BIN_ATTR_RO(package_cpus, CPUMAP_FILE_MAX_BYTES);
|
||||
static const BIN_ATTR_RO(package_cpus_list, CPULIST_FILE_MAX_BYTES);
|
||||
|
||||
#ifdef TOPOLOGY_BOOK_SYSFS
|
||||
define_id_show_func(book_id, "%d");
|
||||
static DEVICE_ATTR_RO(book_id);
|
||||
define_siblings_read_func(book_siblings, book_cpumask);
|
||||
static BIN_ATTR_RO(book_siblings, CPUMAP_FILE_MAX_BYTES);
|
||||
static BIN_ATTR_RO(book_siblings_list, CPULIST_FILE_MAX_BYTES);
|
||||
static const BIN_ATTR_RO(book_siblings, CPUMAP_FILE_MAX_BYTES);
|
||||
static const BIN_ATTR_RO(book_siblings_list, CPULIST_FILE_MAX_BYTES);
|
||||
#endif
|
||||
|
||||
#ifdef TOPOLOGY_DRAWER_SYSFS
|
||||
define_id_show_func(drawer_id, "%d");
|
||||
static DEVICE_ATTR_RO(drawer_id);
|
||||
define_siblings_read_func(drawer_siblings, drawer_cpumask);
|
||||
static BIN_ATTR_RO(drawer_siblings, CPUMAP_FILE_MAX_BYTES);
|
||||
static BIN_ATTR_RO(drawer_siblings_list, CPULIST_FILE_MAX_BYTES);
|
||||
static const BIN_ATTR_RO(drawer_siblings, CPUMAP_FILE_MAX_BYTES);
|
||||
static const BIN_ATTR_RO(drawer_siblings_list, CPULIST_FILE_MAX_BYTES);
|
||||
#endif
|
||||
|
||||
static struct bin_attribute *bin_attrs[] = {
|
||||
static const struct bin_attribute *const bin_attrs[] = {
|
||||
&bin_attr_core_cpus,
|
||||
&bin_attr_core_cpus_list,
|
||||
&bin_attr_thread_siblings,
|
||||
@ -163,7 +163,7 @@ static umode_t topology_is_visible(struct kobject *kobj,
|
||||
|
||||
static const struct attribute_group topology_attr_group = {
|
||||
.attrs = default_attrs,
|
||||
.bin_attrs = bin_attrs,
|
||||
.bin_attrs_new = bin_attrs,
|
||||
.is_visible = topology_is_visible,
|
||||
.name = "topology"
|
||||
};
|
||||
|
@ -24,18 +24,18 @@ DECLARE_EVENT_CLASS(devres,
|
||||
__field(struct device *, dev)
|
||||
__field(const char *, op)
|
||||
__field(void *, node)
|
||||
__field(const char *, name)
|
||||
__string(name, name)
|
||||
__field(size_t, size)
|
||||
),
|
||||
TP_fast_assign(
|
||||
__assign_str(devname);
|
||||
__entry->op = op;
|
||||
__entry->node = node;
|
||||
__entry->name = name;
|
||||
__assign_str(name);
|
||||
__entry->size = size;
|
||||
),
|
||||
TP_printk("%s %3s %p %s (%zu bytes)", __get_str(devname),
|
||||
__entry->op, __entry->node, __entry->name, __entry->size)
|
||||
__entry->op, __entry->node, __get_str(name), __entry->size)
|
||||
);
|
||||
|
||||
DEFINE_EVENT(devres, devres_log,
|
||||
|
@ -707,7 +707,7 @@ static const struct vm_operations_struct cdx_phys_vm_ops = {
|
||||
* Return: true on success, false otherwise.
|
||||
*/
|
||||
static int cdx_mmap_resource(struct file *fp, struct kobject *kobj,
|
||||
struct bin_attribute *attr,
|
||||
const struct bin_attribute *attr,
|
||||
struct vm_area_struct *vma)
|
||||
{
|
||||
struct cdx_device *cdx_dev = to_cdx_device(kobj_to_dev(kobj));
|
||||
|
@ -173,7 +173,7 @@ static ssize_t CDAT_read(struct file *filp, struct kobject *kobj,
|
||||
static BIN_ATTR_ADMIN_RO(CDAT, 0);
|
||||
|
||||
static umode_t cxl_port_bin_attr_is_visible(struct kobject *kobj,
|
||||
struct bin_attribute *attr, int i)
|
||||
const struct bin_attribute *attr, int i)
|
||||
{
|
||||
struct device *dev = kobj_to_dev(kobj);
|
||||
struct cxl_port *port = to_cxl_port(dev);
|
||||
|
@ -420,7 +420,7 @@ static void aspeed_sgpio_irq_print_chip(struct irq_data *d, struct seq_file *p)
|
||||
int offset;
|
||||
|
||||
irqd_to_aspeed_sgpio_data(d, &gpio, &bank, &bit, &offset);
|
||||
seq_printf(p, dev_name(gpio->dev));
|
||||
seq_puts(p, dev_name(gpio->dev));
|
||||
}
|
||||
|
||||
static const struct irq_chip aspeed_sgpio_irq_chip = {
|
||||
|
@ -1049,7 +1049,7 @@ static void aspeed_gpio_irq_print_chip(struct irq_data *d, struct seq_file *p)
|
||||
if (rc)
|
||||
return;
|
||||
|
||||
seq_printf(p, dev_name(gpio->dev));
|
||||
seq_puts(p, dev_name(gpio->dev));
|
||||
}
|
||||
|
||||
static const struct irq_chip aspeed_gpio_irq_chip = {
|
||||
|
@ -249,7 +249,7 @@ static void ep93xx_irq_print_chip(struct irq_data *data, struct seq_file *p)
|
||||
{
|
||||
struct gpio_chip *gc = irq_data_get_irq_chip_data(data);
|
||||
|
||||
seq_printf(p, dev_name(gc->parent));
|
||||
seq_puts(p, dev_name(gc->parent));
|
||||
}
|
||||
|
||||
static const struct irq_chip gpio_eic_irq_chip = {
|
||||
|
@ -210,7 +210,7 @@ static void hlwd_gpio_irq_print_chip(struct irq_data *data, struct seq_file *p)
|
||||
struct hlwd_gpio *hlwd =
|
||||
gpiochip_get_data(irq_data_get_irq_chip_data(data));
|
||||
|
||||
seq_printf(p, dev_name(hlwd->dev));
|
||||
seq_puts(p, dev_name(hlwd->dev));
|
||||
}
|
||||
|
||||
static const struct irq_chip hlwd_gpio_irq_chip = {
|
||||
|
@ -331,7 +331,7 @@ static void mlxbf2_gpio_irq_print_chip(struct irq_data *irqd,
|
||||
struct gpio_chip *gc = irq_data_get_irq_chip_data(irqd);
|
||||
struct mlxbf2_gpio_context *gs = gpiochip_get_data(gc);
|
||||
|
||||
seq_printf(p, dev_name(gs->dev));
|
||||
seq_puts(p, dev_name(gs->dev));
|
||||
}
|
||||
|
||||
static const struct irq_chip mlxbf2_gpio_irq_chip = {
|
||||
|
@ -715,7 +715,7 @@ static void omap_gpio_irq_print_chip(struct irq_data *d, struct seq_file *p)
|
||||
{
|
||||
struct gpio_bank *bank = omap_irq_data_get_bank(d);
|
||||
|
||||
seq_printf(p, dev_name(bank->dev));
|
||||
seq_puts(p, dev_name(bank->dev));
|
||||
}
|
||||
|
||||
static const struct irq_chip omap_gpio_irq_chip = {
|
||||
|
@ -815,7 +815,7 @@ static void pca953x_irq_print_chip(struct irq_data *data, struct seq_file *p)
|
||||
{
|
||||
struct gpio_chip *gc = irq_data_get_irq_chip_data(data);
|
||||
|
||||
seq_printf(p, dev_name(gc->parent));
|
||||
seq_puts(p, dev_name(gc->parent));
|
||||
}
|
||||
|
||||
static const struct irq_chip pca953x_irq_chip = {
|
||||
|
@ -291,7 +291,7 @@ static void pl061_irq_print_chip(struct irq_data *data, struct seq_file *p)
|
||||
{
|
||||
struct gpio_chip *gc = irq_data_get_irq_chip_data(data);
|
||||
|
||||
seq_printf(p, dev_name(gc->parent));
|
||||
seq_puts(p, dev_name(gc->parent));
|
||||
}
|
||||
|
||||
static const struct irq_chip pl061_irq_chip = {
|
||||
|
@ -600,7 +600,7 @@ static void tegra_gpio_irq_print_chip(struct irq_data *d, struct seq_file *s)
|
||||
{
|
||||
struct gpio_chip *chip = irq_data_get_irq_chip_data(d);
|
||||
|
||||
seq_printf(s, dev_name(chip->parent));
|
||||
seq_puts(s, dev_name(chip->parent));
|
||||
}
|
||||
|
||||
static const struct irq_chip tegra_gpio_irq_chip = {
|
||||
|
@ -610,7 +610,7 @@ static void tegra186_irq_print_chip(struct irq_data *data, struct seq_file *p)
|
||||
{
|
||||
struct gpio_chip *gc = irq_data_get_irq_chip_data(data);
|
||||
|
||||
seq_printf(p, dev_name(gc->parent));
|
||||
seq_puts(p, dev_name(gc->parent));
|
||||
}
|
||||
|
||||
static const struct irq_chip tegra186_gpio_irq_chip = {
|
||||
|
@ -275,7 +275,7 @@ static void tqmx86_gpio_irq_print_chip(struct irq_data *d, struct seq_file *p)
|
||||
{
|
||||
struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
|
||||
|
||||
seq_printf(p, gc->label);
|
||||
seq_puts(p, gc->label);
|
||||
}
|
||||
|
||||
static const struct irq_chip tqmx86_gpio_irq_chip = {
|
||||
|
@ -142,7 +142,7 @@ static void visconti_gpio_irq_print_chip(struct irq_data *d, struct seq_file *p)
|
||||
struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
|
||||
struct visconti_gpio *priv = gpiochip_get_data(gc);
|
||||
|
||||
seq_printf(p, dev_name(priv->dev));
|
||||
seq_puts(p, dev_name(priv->dev));
|
||||
}
|
||||
|
||||
static const struct irq_chip visconti_gpio_irq_chip = {
|
||||
|
@ -198,7 +198,7 @@ static void iproc_gpio_irq_print_chip(struct irq_data *d, struct seq_file *p)
|
||||
struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
|
||||
struct iproc_gpio_chip *chip = to_iproc_gpio(gc);
|
||||
|
||||
seq_printf(p, dev_name(chip->dev));
|
||||
seq_puts(p, dev_name(chip->dev));
|
||||
}
|
||||
|
||||
static const struct irq_chip iproc_gpio_irq_chip = {
|
||||
|
@ -4112,7 +4112,7 @@ static umode_t amdgpu_flash_attr_is_visible(struct kobject *kobj, struct attribu
|
||||
}
|
||||
|
||||
static umode_t amdgpu_bin_flash_attr_is_visible(struct kobject *kobj,
|
||||
struct bin_attribute *attr,
|
||||
const struct bin_attribute *attr,
|
||||
int idx)
|
||||
{
|
||||
struct device *dev = kobj_to_dev(kobj);
|
||||
|
@ -292,7 +292,7 @@ int of_dp_aux_populate_bus(struct drm_dp_aux *aux,
|
||||
aux_ep->dev.parent = aux->dev;
|
||||
aux_ep->dev.bus = &dp_aux_bus_type;
|
||||
aux_ep->dev.type = &dp_aux_device_type_type;
|
||||
aux_ep->dev.of_node = of_node_get(np);
|
||||
device_set_node(&aux_ep->dev, of_fwnode_handle(of_node_get(np)));
|
||||
dev_set_name(&aux_ep->dev, "aux-%s", dev_name(aux->dev));
|
||||
|
||||
ret = device_register(&aux_ep->dev);
|
||||
|
@ -283,7 +283,7 @@ static struct bin_attribute *port_ccmgta_attributes[] = {
|
||||
};
|
||||
|
||||
static umode_t qib_ccmgta_is_bin_visible(struct kobject *kobj,
|
||||
struct bin_attribute *attr, int n)
|
||||
const struct bin_attribute *attr, int n)
|
||||
{
|
||||
struct qib_pportdata *ppd = qib_get_pportdata_kobj(kobj);
|
||||
|
||||
|
@ -400,7 +400,7 @@ static void gic_irq_print_chip(struct irq_data *d, struct seq_file *p)
|
||||
struct gic_chip_data *gic = irq_data_get_irq_chip_data(d);
|
||||
|
||||
if (gic->domain->pm_dev)
|
||||
seq_printf(p, gic->domain->pm_dev->of_node->name);
|
||||
seq_puts(p, gic->domain->pm_dev->of_node->name);
|
||||
else
|
||||
seq_printf(p, "GIC-%d", (int)(gic - &gic_data[0]));
|
||||
}
|
||||
|
@ -71,7 +71,7 @@ static void mvebu_pic_print_chip(struct irq_data *d, struct seq_file *p)
|
||||
{
|
||||
struct mvebu_pic *pic = irq_data_get_irq_chip_data(d);
|
||||
|
||||
seq_printf(p, dev_name(&pic->pdev->dev));
|
||||
seq_puts(p, dev_name(&pic->pdev->dev));
|
||||
}
|
||||
|
||||
static const struct irq_chip mvebu_pic_chip = {
|
||||
|
@ -69,7 +69,7 @@ static void fpga_irq_print_chip(struct irq_data *d, struct seq_file *p)
|
||||
{
|
||||
struct fpga_irq_data *f = irq_data_get_irq_chip_data(d);
|
||||
|
||||
seq_printf(p, irq_domain_get_of_node(f->domain)->name);
|
||||
seq_puts(p, irq_domain_get_of_node(f->domain)->name);
|
||||
}
|
||||
|
||||
static const struct irq_chip fpga_chip = {
|
||||
|
@ -125,7 +125,7 @@ static const struct vm_operations_struct global_mmio_vmops = {
|
||||
};
|
||||
|
||||
static int global_mmio_mmap(struct file *filp, struct kobject *kobj,
|
||||
struct bin_attribute *bin_attr,
|
||||
const struct bin_attribute *bin_attr,
|
||||
struct vm_area_struct *vma)
|
||||
{
|
||||
struct ocxl_afu *afu = to_afu(kobj_to_dev(kobj));
|
||||
|
@ -87,7 +87,7 @@ static umode_t spi_nor_sysfs_is_visible(struct kobject *kobj,
|
||||
}
|
||||
|
||||
static umode_t spi_nor_sysfs_is_bin_visible(struct kobject *kobj,
|
||||
struct bin_attribute *attr, int n)
|
||||
const struct bin_attribute *attr, int n)
|
||||
{
|
||||
struct spi_device *spi = to_spi_device(kobj_to_dev(kobj));
|
||||
struct spi_mem *spimem = spi_get_drvdata(spi);
|
||||
|
@ -298,16 +298,25 @@ static umode_t nvmem_bin_attr_get_umode(struct nvmem_device *nvmem)
|
||||
}
|
||||
|
||||
static umode_t nvmem_bin_attr_is_visible(struct kobject *kobj,
|
||||
struct bin_attribute *attr, int i)
|
||||
const struct bin_attribute *attr,
|
||||
int i)
|
||||
{
|
||||
struct device *dev = kobj_to_dev(kobj);
|
||||
struct nvmem_device *nvmem = to_nvmem_device(dev);
|
||||
|
||||
attr->size = nvmem->size;
|
||||
|
||||
return nvmem_bin_attr_get_umode(nvmem);
|
||||
}
|
||||
|
||||
static size_t nvmem_bin_attr_size(struct kobject *kobj,
|
||||
const struct bin_attribute *attr,
|
||||
int i)
|
||||
{
|
||||
struct device *dev = kobj_to_dev(kobj);
|
||||
struct nvmem_device *nvmem = to_nvmem_device(dev);
|
||||
|
||||
return nvmem->size;
|
||||
}
|
||||
|
||||
static umode_t nvmem_attr_is_visible(struct kobject *kobj,
|
||||
struct attribute *attr, int i)
|
||||
{
|
||||
@ -383,6 +392,7 @@ static const struct attribute_group nvmem_bin_group = {
|
||||
.bin_attrs = nvmem_bin_attributes,
|
||||
.attrs = nvmem_attrs,
|
||||
.is_bin_visible = nvmem_bin_attr_is_visible,
|
||||
.bin_size = nvmem_bin_attr_size,
|
||||
.is_visible = nvmem_attr_is_visible,
|
||||
};
|
||||
|
||||
|
@ -90,7 +90,7 @@ static ssize_t published_show(struct device *dev, struct device_attribute *attr,
|
||||
static DEVICE_ATTR_RO(published);
|
||||
|
||||
static int p2pmem_alloc_mmap(struct file *filp, struct kobject *kobj,
|
||||
struct bin_attribute *attr, struct vm_area_struct *vma)
|
||||
const struct bin_attribute *attr, struct vm_area_struct *vma)
|
||||
{
|
||||
struct pci_dev *pdev = to_pci_dev(kobj_to_dev(kobj));
|
||||
size_t len = vma->vm_end - vma->vm_start;
|
||||
|
@ -844,21 +844,20 @@ static struct bin_attribute *pci_dev_config_attrs[] = {
|
||||
NULL,
|
||||
};
|
||||
|
||||
static umode_t pci_dev_config_attr_is_visible(struct kobject *kobj,
|
||||
struct bin_attribute *a, int n)
|
||||
static size_t pci_dev_config_attr_bin_size(struct kobject *kobj,
|
||||
const struct bin_attribute *a,
|
||||
int n)
|
||||
{
|
||||
struct pci_dev *pdev = to_pci_dev(kobj_to_dev(kobj));
|
||||
|
||||
a->size = PCI_CFG_SPACE_SIZE;
|
||||
if (pdev->cfg_size > PCI_CFG_SPACE_SIZE)
|
||||
a->size = PCI_CFG_SPACE_EXP_SIZE;
|
||||
|
||||
return a->attr.mode;
|
||||
return PCI_CFG_SPACE_EXP_SIZE;
|
||||
return PCI_CFG_SPACE_SIZE;
|
||||
}
|
||||
|
||||
static const struct attribute_group pci_dev_config_attr_group = {
|
||||
.bin_attrs = pci_dev_config_attrs,
|
||||
.is_bin_visible = pci_dev_config_attr_is_visible,
|
||||
.bin_size = pci_dev_config_attr_bin_size,
|
||||
};
|
||||
|
||||
/*
|
||||
@ -868,7 +867,7 @@ static const struct attribute_group pci_dev_config_attr_group = {
|
||||
static __maybe_unused loff_t
|
||||
pci_llseek_resource(struct file *filep,
|
||||
struct kobject *kobj __always_unused,
|
||||
struct bin_attribute *attr,
|
||||
const struct bin_attribute *attr,
|
||||
loff_t offset, int whence)
|
||||
{
|
||||
return fixed_size_llseek(filep, offset, whence, attr->size);
|
||||
@ -937,7 +936,7 @@ static ssize_t pci_write_legacy_io(struct file *filp, struct kobject *kobj,
|
||||
* memory space.
|
||||
*/
|
||||
static int pci_mmap_legacy_mem(struct file *filp, struct kobject *kobj,
|
||||
struct bin_attribute *attr,
|
||||
const struct bin_attribute *attr,
|
||||
struct vm_area_struct *vma)
|
||||
{
|
||||
struct pci_bus *bus = to_pci_bus(kobj_to_dev(kobj));
|
||||
@ -957,7 +956,7 @@ static int pci_mmap_legacy_mem(struct file *filp, struct kobject *kobj,
|
||||
* memory space. Returns -ENOSYS if the operation isn't supported
|
||||
*/
|
||||
static int pci_mmap_legacy_io(struct file *filp, struct kobject *kobj,
|
||||
struct bin_attribute *attr,
|
||||
const struct bin_attribute *attr,
|
||||
struct vm_area_struct *vma)
|
||||
{
|
||||
struct pci_bus *bus = to_pci_bus(kobj_to_dev(kobj));
|
||||
@ -1061,7 +1060,7 @@ void pci_remove_legacy_files(struct pci_bus *b)
|
||||
*
|
||||
* Use the regular PCI mapping routines to map a PCI resource into userspace.
|
||||
*/
|
||||
static int pci_mmap_resource(struct kobject *kobj, struct bin_attribute *attr,
|
||||
static int pci_mmap_resource(struct kobject *kobj, const struct bin_attribute *attr,
|
||||
struct vm_area_struct *vma, int write_combine)
|
||||
{
|
||||
struct pci_dev *pdev = to_pci_dev(kobj_to_dev(kobj));
|
||||
@ -1086,14 +1085,14 @@ static int pci_mmap_resource(struct kobject *kobj, struct bin_attribute *attr,
|
||||
}
|
||||
|
||||
static int pci_mmap_resource_uc(struct file *filp, struct kobject *kobj,
|
||||
struct bin_attribute *attr,
|
||||
const struct bin_attribute *attr,
|
||||
struct vm_area_struct *vma)
|
||||
{
|
||||
return pci_mmap_resource(kobj, attr, vma, 0);
|
||||
}
|
||||
|
||||
static int pci_mmap_resource_wc(struct file *filp, struct kobject *kobj,
|
||||
struct bin_attribute *attr,
|
||||
const struct bin_attribute *attr,
|
||||
struct vm_area_struct *vma)
|
||||
{
|
||||
return pci_mmap_resource(kobj, attr, vma, 1);
|
||||
@ -1353,24 +1352,29 @@ static struct bin_attribute *pci_dev_rom_attrs[] = {
|
||||
};
|
||||
|
||||
static umode_t pci_dev_rom_attr_is_visible(struct kobject *kobj,
|
||||
struct bin_attribute *a, int n)
|
||||
const struct bin_attribute *a, int n)
|
||||
{
|
||||
struct pci_dev *pdev = to_pci_dev(kobj_to_dev(kobj));
|
||||
size_t rom_size;
|
||||
|
||||
/* If the device has a ROM, try to expose it in sysfs. */
|
||||
rom_size = pci_resource_len(pdev, PCI_ROM_RESOURCE);
|
||||
if (!rom_size)
|
||||
if (!pci_resource_end(pdev, PCI_ROM_RESOURCE))
|
||||
return 0;
|
||||
|
||||
a->size = rom_size;
|
||||
|
||||
return a->attr.mode;
|
||||
}
|
||||
|
||||
static size_t pci_dev_rom_attr_bin_size(struct kobject *kobj,
|
||||
const struct bin_attribute *a, int n)
|
||||
{
|
||||
struct pci_dev *pdev = to_pci_dev(kobj_to_dev(kobj));
|
||||
|
||||
return pci_resource_len(pdev, PCI_ROM_RESOURCE);
|
||||
}
|
||||
|
||||
static const struct attribute_group pci_dev_rom_attr_group = {
|
||||
.bin_attrs = pci_dev_rom_attrs,
|
||||
.is_bin_visible = pci_dev_rom_attr_is_visible,
|
||||
.bin_size = pci_dev_rom_attr_bin_size,
|
||||
};
|
||||
|
||||
static ssize_t reset_store(struct device *dev, struct device_attribute *attr,
|
||||
|
@ -325,7 +325,7 @@ static struct bin_attribute *vpd_attrs[] = {
|
||||
};
|
||||
|
||||
static umode_t vpd_attr_is_visible(struct kobject *kobj,
|
||||
struct bin_attribute *a, int n)
|
||||
const struct bin_attribute *a, int n)
|
||||
{
|
||||
struct pci_dev *pdev = to_pci_dev(kobj_to_dev(kobj));
|
||||
|
||||
|
@ -247,7 +247,6 @@ static struct attribute *arm_ni_other_attrs[] = {
|
||||
|
||||
static const struct attribute_group arm_ni_other_attr_group = {
|
||||
.attrs = arm_ni_other_attrs,
|
||||
NULL
|
||||
};
|
||||
|
||||
static const struct attribute_group *arm_ni_attr_groups[] = {
|
||||
|
@ -543,7 +543,7 @@ static int tegra_xusb_port_init(struct tegra_xusb_port *port,
|
||||
|
||||
device_initialize(&port->dev);
|
||||
port->dev.type = &tegra_xusb_port_type;
|
||||
port->dev.of_node = of_node_get(np);
|
||||
device_set_node(&port->dev, of_fwnode_handle(of_node_get(np)));
|
||||
port->dev.parent = padctl->dev;
|
||||
|
||||
err = dev_set_name(&port->dev, "%s-%u", name, index);
|
||||
|
@ -309,7 +309,7 @@ static void iproc_gpio_irq_print_chip(struct irq_data *d, struct seq_file *p)
|
||||
struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
|
||||
struct iproc_gpio *chip = gpiochip_get_data(gc);
|
||||
|
||||
seq_printf(p, dev_name(chip->dev));
|
||||
seq_puts(p, dev_name(chip->dev));
|
||||
}
|
||||
|
||||
static const struct irq_chip iproc_gpio_irq_chip = {
|
||||
|
@ -734,7 +734,7 @@ static void armada_37xx_irq_print_chip(struct irq_data *d, struct seq_file *p)
|
||||
struct gpio_chip *chip = irq_data_get_irq_chip_data(d);
|
||||
struct armada_37xx_pinctrl *info = gpiochip_get_data(chip);
|
||||
|
||||
seq_printf(p, info->data->name);
|
||||
seq_puts(p, info->data->name);
|
||||
}
|
||||
|
||||
static const struct irq_chip armada_37xx_irqchip = {
|
||||
|
@ -569,7 +569,7 @@ static void mcp23s08_irq_print_chip(struct irq_data *d, struct seq_file *p)
|
||||
struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
|
||||
struct mcp23s08 *mcp = gpiochip_get_data(gc);
|
||||
|
||||
seq_printf(p, dev_name(mcp->dev));
|
||||
seq_puts(p, dev_name(mcp->dev));
|
||||
}
|
||||
|
||||
static const struct irq_chip mcp23s08_irq_chip = {
|
||||
|
@ -599,7 +599,7 @@ static void stmfx_pinctrl_irq_print_chip(struct irq_data *d, struct seq_file *p)
|
||||
struct gpio_chip *gpio_chip = irq_data_get_irq_chip_data(d);
|
||||
struct stmfx_pinctrl *pctl = gpiochip_get_data(gpio_chip);
|
||||
|
||||
seq_printf(p, dev_name(pctl->dev));
|
||||
seq_puts(p, dev_name(pctl->dev));
|
||||
}
|
||||
|
||||
static const struct irq_chip stmfx_pinctrl_irq_chip = {
|
||||
|
@ -584,7 +584,7 @@ static void sx150x_irq_print_chip(struct irq_data *d, struct seq_file *p)
|
||||
struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
|
||||
struct sx150x_pinctrl *pctl = gpiochip_get_data(gc);
|
||||
|
||||
seq_printf(p, pctl->client->name);
|
||||
seq_puts(p, pctl->client->name);
|
||||
}
|
||||
|
||||
static const struct irq_chip sx150x_irq_chip = {
|
||||
|
@ -2332,7 +2332,7 @@ static void rzg2l_gpio_irq_print_chip(struct irq_data *data, struct seq_file *p)
|
||||
{
|
||||
struct gpio_chip *gc = irq_data_get_irq_chip_data(data);
|
||||
|
||||
seq_printf(p, dev_name(gc->parent));
|
||||
seq_puts(p, dev_name(gc->parent));
|
||||
}
|
||||
|
||||
static int rzg2l_gpio_irq_set_wake(struct irq_data *data, unsigned int on)
|
||||
|
@ -236,7 +236,7 @@ static ssize_t hsmp_metric_tbl_acpi_read(struct file *filp, struct kobject *kobj
|
||||
}
|
||||
|
||||
static umode_t hsmp_is_sock_attr_visible(struct kobject *kobj,
|
||||
struct bin_attribute *battr, int id)
|
||||
const struct bin_attribute *battr, int id)
|
||||
{
|
||||
if (hsmp_pdev->proto_ver == HSMP_PROTO_VER6)
|
||||
return battr->attr.mode;
|
||||
|
@ -75,7 +75,7 @@ static ssize_t hsmp_metric_tbl_plat_read(struct file *filp, struct kobject *kobj
|
||||
}
|
||||
|
||||
static umode_t hsmp_is_sock_attr_visible(struct kobject *kobj,
|
||||
struct bin_attribute *battr, int id)
|
||||
const struct bin_attribute *battr, int id)
|
||||
{
|
||||
u16 sock_ind;
|
||||
|
||||
|
@ -105,7 +105,7 @@ intel_pmt_read(struct file *filp, struct kobject *kobj,
|
||||
|
||||
static int
|
||||
intel_pmt_mmap(struct file *filp, struct kobject *kobj,
|
||||
struct bin_attribute *attr, struct vm_area_struct *vma)
|
||||
const struct bin_attribute *attr, struct vm_area_struct *vma)
|
||||
{
|
||||
struct intel_pmt_entry *entry = container_of(attr,
|
||||
struct intel_pmt_entry,
|
||||
|
@ -541,7 +541,7 @@ static struct bin_attribute *sdsi_bin_attrs[] = {
|
||||
};
|
||||
|
||||
static umode_t
|
||||
sdsi_battr_is_visible(struct kobject *kobj, struct bin_attribute *attr, int n)
|
||||
sdsi_battr_is_visible(struct kobject *kobj, const struct bin_attribute *attr, int n)
|
||||
{
|
||||
struct device *dev = kobj_to_dev(kobj);
|
||||
struct sdsi_priv *priv = dev_get_drvdata(dev);
|
||||
|
@ -803,7 +803,6 @@ static struct attribute *con3215_drv_attrs[] = {
|
||||
|
||||
static struct attribute_group con3215_drv_attr_group = {
|
||||
.attrs = con3215_drv_attrs,
|
||||
NULL,
|
||||
};
|
||||
|
||||
static const struct attribute_group *con3215_drv_attr_groups[] = {
|
||||
|
@ -1274,7 +1274,7 @@ static umode_t scsi_sdev_attr_is_visible(struct kobject *kobj,
|
||||
}
|
||||
|
||||
static umode_t scsi_sdev_bin_attr_is_visible(struct kobject *kobj,
|
||||
struct bin_attribute *attr, int i)
|
||||
const struct bin_attribute *attr, int i)
|
||||
{
|
||||
struct device *dev = kobj_to_dev(kobj);
|
||||
struct scsi_device *sdev = to_scsi_device(dev);
|
||||
|
@ -135,7 +135,7 @@ static void hv_uio_rescind(struct vmbus_channel *channel)
|
||||
* The ring buffer is allocated as contiguous memory by vmbus_open
|
||||
*/
|
||||
static int hv_uio_ring_mmap(struct file *filp, struct kobject *kobj,
|
||||
struct bin_attribute *attr,
|
||||
const struct bin_attribute *attr,
|
||||
struct vm_area_struct *vma)
|
||||
{
|
||||
struct vmbus_channel *channel
|
||||
|
@ -925,7 +925,7 @@ static struct bin_attribute *dev_bin_attrs[] = {
|
||||
};
|
||||
|
||||
static umode_t dev_bin_attrs_are_visible(struct kobject *kobj,
|
||||
struct bin_attribute *a, int n)
|
||||
const struct bin_attribute *a, int n)
|
||||
{
|
||||
struct device *dev = kobj_to_dev(kobj);
|
||||
struct usb_device *udev = to_usb_device(dev);
|
||||
|
@ -91,9 +91,12 @@ static ssize_t sysfs_kf_bin_read(struct kernfs_open_file *of, char *buf,
|
||||
count = size - pos;
|
||||
}
|
||||
|
||||
if (!battr->read)
|
||||
if (!battr->read && !battr->read_new)
|
||||
return -EIO;
|
||||
|
||||
if (battr->read_new)
|
||||
return battr->read_new(of->file, kobj, battr, buf, pos, count);
|
||||
|
||||
return battr->read(of->file, kobj, battr, buf, pos, count);
|
||||
}
|
||||
|
||||
@ -152,9 +155,12 @@ static ssize_t sysfs_kf_bin_write(struct kernfs_open_file *of, char *buf,
|
||||
if (!count)
|
||||
return 0;
|
||||
|
||||
if (!battr->write)
|
||||
if (!battr->write && !battr->write_new)
|
||||
return -EIO;
|
||||
|
||||
if (battr->write_new)
|
||||
return battr->write_new(of->file, kobj, battr, buf, pos, count);
|
||||
|
||||
return battr->write(of->file, kobj, battr, buf, pos, count);
|
||||
}
|
||||
|
||||
@ -315,7 +321,7 @@ int sysfs_add_file_mode_ns(struct kernfs_node *parent,
|
||||
}
|
||||
|
||||
int sysfs_add_bin_file_mode_ns(struct kernfs_node *parent,
|
||||
const struct bin_attribute *battr, umode_t mode,
|
||||
const struct bin_attribute *battr, umode_t mode, size_t size,
|
||||
kuid_t uid, kgid_t gid, const void *ns)
|
||||
{
|
||||
const struct attribute *attr = &battr->attr;
|
||||
@ -323,13 +329,19 @@ int sysfs_add_bin_file_mode_ns(struct kernfs_node *parent,
|
||||
const struct kernfs_ops *ops;
|
||||
struct kernfs_node *kn;
|
||||
|
||||
if (battr->read && battr->read_new)
|
||||
return -EINVAL;
|
||||
|
||||
if (battr->write && battr->write_new)
|
||||
return -EINVAL;
|
||||
|
||||
if (battr->mmap)
|
||||
ops = &sysfs_bin_kfops_mmap;
|
||||
else if (battr->read && battr->write)
|
||||
else if ((battr->read || battr->read_new) && (battr->write || battr->write_new))
|
||||
ops = &sysfs_bin_kfops_rw;
|
||||
else if (battr->read)
|
||||
else if (battr->read || battr->read_new)
|
||||
ops = &sysfs_bin_kfops_ro;
|
||||
else if (battr->write)
|
||||
else if (battr->write || battr->write_new)
|
||||
ops = &sysfs_bin_kfops_wo;
|
||||
else
|
||||
ops = &sysfs_file_kfops_empty;
|
||||
@ -340,7 +352,7 @@ int sysfs_add_bin_file_mode_ns(struct kernfs_node *parent,
|
||||
#endif
|
||||
|
||||
kn = __kernfs_create_file(parent, attr->name, mode & 0777, uid, gid,
|
||||
battr->size, ops, (void *)attr, ns, key);
|
||||
size, ops, (void *)attr, ns, key);
|
||||
if (IS_ERR(kn)) {
|
||||
if (PTR_ERR(kn) == -EEXIST)
|
||||
sysfs_warn_dup(parent, attr->name);
|
||||
@ -580,8 +592,8 @@ int sysfs_create_bin_file(struct kobject *kobj,
|
||||
return -EINVAL;
|
||||
|
||||
kobject_get_ownership(kobj, &uid, &gid);
|
||||
return sysfs_add_bin_file_mode_ns(kobj->sd, attr, attr->attr.mode, uid,
|
||||
gid, NULL);
|
||||
return sysfs_add_bin_file_mode_ns(kobj->sd, attr, attr->attr.mode,
|
||||
attr->size, uid, gid, NULL);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(sysfs_create_bin_file);
|
||||
|
||||
|
@ -87,6 +87,7 @@ static int create_files(struct kernfs_node *parent, struct kobject *kobj,
|
||||
if (grp->bin_attrs) {
|
||||
for (i = 0, bin_attr = grp->bin_attrs; *bin_attr; i++, bin_attr++) {
|
||||
umode_t mode = (*bin_attr)->attr.mode;
|
||||
size_t size = (*bin_attr)->size;
|
||||
|
||||
if (update)
|
||||
kernfs_remove_by_name(parent,
|
||||
@ -97,6 +98,8 @@ static int create_files(struct kernfs_node *parent, struct kobject *kobj,
|
||||
if (!mode)
|
||||
continue;
|
||||
}
|
||||
if (grp->bin_size)
|
||||
size = grp->bin_size(kobj, *bin_attr, i);
|
||||
|
||||
WARN(mode & ~(SYSFS_PREALLOC | 0664),
|
||||
"Attribute %s: Invalid permissions 0%o\n",
|
||||
@ -104,7 +107,7 @@ static int create_files(struct kernfs_node *parent, struct kobject *kobj,
|
||||
|
||||
mode &= SYSFS_PREALLOC | 0664;
|
||||
error = sysfs_add_bin_file_mode_ns(parent, *bin_attr,
|
||||
mode, uid, gid,
|
||||
mode, size, uid, gid,
|
||||
NULL);
|
||||
if (error)
|
||||
break;
|
||||
|
@ -31,7 +31,7 @@ int sysfs_add_file_mode_ns(struct kernfs_node *parent,
|
||||
const struct attribute *attr, umode_t amode, kuid_t uid,
|
||||
kgid_t gid, const void *ns);
|
||||
int sysfs_add_bin_file_mode_ns(struct kernfs_node *parent,
|
||||
const struct bin_attribute *battr, umode_t mode,
|
||||
const struct bin_attribute *battr, umode_t mode, size_t size,
|
||||
kuid_t uid, kgid_t gid, const void *ns);
|
||||
|
||||
/*
|
||||
|
@ -269,8 +269,4 @@ void auxiliary_driver_unregister(struct auxiliary_driver *auxdrv);
|
||||
#define module_auxiliary_driver(__auxiliary_driver) \
|
||||
module_driver(__auxiliary_driver, auxiliary_driver_register, auxiliary_driver_unregister)
|
||||
|
||||
struct auxiliary_device *auxiliary_find_device(struct device *start,
|
||||
const void *data,
|
||||
device_match_t match);
|
||||
|
||||
#endif /* _AUXILIARY_BUS_H_ */
|
||||
|
@ -686,14 +686,6 @@ static inline void list_splice_tail_init(struct list_head *list,
|
||||
#define list_for_each(pos, head) \
|
||||
for (pos = (head)->next; !list_is_head(pos, (head)); pos = pos->next)
|
||||
|
||||
/**
|
||||
* list_for_each_reverse - iterate backwards over a list
|
||||
* @pos: the &struct list_head to use as a loop cursor.
|
||||
* @head: the head for your list.
|
||||
*/
|
||||
#define list_for_each_reverse(pos, head) \
|
||||
for (pos = (head)->prev; pos != (head); pos = pos->prev)
|
||||
|
||||
/**
|
||||
* list_for_each_rcu - Iterate over a list in an RCU-safe fashion
|
||||
* @pos: the &struct list_head to use as a loop cursor.
|
||||
|
@ -87,6 +87,11 @@ do { \
|
||||
* SYSFS_GROUP_VISIBLE() when assigning this callback to
|
||||
* specify separate _group_visible() and _attr_visible()
|
||||
* handlers.
|
||||
* @bin_size:
|
||||
* Optional: Function to return the size of a binary attribute
|
||||
* of the group. Will be called repeatedly for each binary
|
||||
* attribute in the group. Overwrites the size field embedded
|
||||
* inside the attribute itself.
|
||||
* @attrs: Pointer to NULL terminated list of attributes.
|
||||
* @bin_attrs: Pointer to NULL terminated list of binary attributes.
|
||||
* Either attrs or bin_attrs or both must be provided.
|
||||
@ -96,9 +101,15 @@ struct attribute_group {
|
||||
umode_t (*is_visible)(struct kobject *,
|
||||
struct attribute *, int);
|
||||
umode_t (*is_bin_visible)(struct kobject *,
|
||||
struct bin_attribute *, int);
|
||||
const struct bin_attribute *, int);
|
||||
size_t (*bin_size)(struct kobject *,
|
||||
const struct bin_attribute *,
|
||||
int);
|
||||
struct attribute **attrs;
|
||||
struct bin_attribute **bin_attrs;
|
||||
union {
|
||||
struct bin_attribute **bin_attrs;
|
||||
const struct bin_attribute *const *bin_attrs_new;
|
||||
};
|
||||
};
|
||||
|
||||
#define SYSFS_PREALLOC 010000
|
||||
@ -191,22 +202,22 @@ struct attribute_group {
|
||||
* attributes, the group visibility is determined by the function
|
||||
* specified to is_visible() not is_bin_visible()
|
||||
*/
|
||||
#define DEFINE_SYSFS_BIN_GROUP_VISIBLE(name) \
|
||||
static inline umode_t sysfs_group_visible_##name( \
|
||||
struct kobject *kobj, struct bin_attribute *attr, int n) \
|
||||
{ \
|
||||
if (n == 0 && !name##_group_visible(kobj)) \
|
||||
return SYSFS_GROUP_INVISIBLE; \
|
||||
return name##_attr_visible(kobj, attr, n); \
|
||||
#define DEFINE_SYSFS_BIN_GROUP_VISIBLE(name) \
|
||||
static inline umode_t sysfs_group_visible_##name( \
|
||||
struct kobject *kobj, const struct bin_attribute *attr, int n) \
|
||||
{ \
|
||||
if (n == 0 && !name##_group_visible(kobj)) \
|
||||
return SYSFS_GROUP_INVISIBLE; \
|
||||
return name##_attr_visible(kobj, attr, n); \
|
||||
}
|
||||
|
||||
#define DEFINE_SIMPLE_SYSFS_BIN_GROUP_VISIBLE(name) \
|
||||
static inline umode_t sysfs_group_visible_##name( \
|
||||
struct kobject *kobj, struct bin_attribute *a, int n) \
|
||||
{ \
|
||||
if (n == 0 && !name##_group_visible(kobj)) \
|
||||
return SYSFS_GROUP_INVISIBLE; \
|
||||
return a->mode; \
|
||||
#define DEFINE_SIMPLE_SYSFS_BIN_GROUP_VISIBLE(name) \
|
||||
static inline umode_t sysfs_group_visible_##name( \
|
||||
struct kobject *kobj, const struct bin_attribute *a, int n) \
|
||||
{ \
|
||||
if (n == 0 && !name##_group_visible(kobj)) \
|
||||
return SYSFS_GROUP_INVISIBLE; \
|
||||
return a->mode; \
|
||||
}
|
||||
|
||||
#define SYSFS_GROUP_VISIBLE(fn) sysfs_group_visible_##fn
|
||||
@ -297,11 +308,15 @@ struct bin_attribute {
|
||||
struct address_space *(*f_mapping)(void);
|
||||
ssize_t (*read)(struct file *, struct kobject *, struct bin_attribute *,
|
||||
char *, loff_t, size_t);
|
||||
ssize_t (*read_new)(struct file *, struct kobject *, const struct bin_attribute *,
|
||||
char *, loff_t, size_t);
|
||||
ssize_t (*write)(struct file *, struct kobject *, struct bin_attribute *,
|
||||
char *, loff_t, size_t);
|
||||
loff_t (*llseek)(struct file *, struct kobject *, struct bin_attribute *,
|
||||
ssize_t (*write_new)(struct file *, struct kobject *,
|
||||
const struct bin_attribute *, char *, loff_t, size_t);
|
||||
loff_t (*llseek)(struct file *, struct kobject *, const struct bin_attribute *,
|
||||
loff_t, int);
|
||||
int (*mmap)(struct file *, struct kobject *, struct bin_attribute *attr,
|
||||
int (*mmap)(struct file *, struct kobject *, const struct bin_attribute *attr,
|
||||
struct vm_area_struct *vma);
|
||||
};
|
||||
|
||||
@ -317,25 +332,36 @@ struct bin_attribute {
|
||||
*/
|
||||
#define sysfs_bin_attr_init(bin_attr) sysfs_attr_init(&(bin_attr)->attr)
|
||||
|
||||
typedef ssize_t __sysfs_bin_rw_handler_new(struct file *, struct kobject *,
|
||||
const struct bin_attribute *, char *, loff_t, size_t);
|
||||
|
||||
/* macros to create static binary attributes easier */
|
||||
#define __BIN_ATTR(_name, _mode, _read, _write, _size) { \
|
||||
.attr = { .name = __stringify(_name), .mode = _mode }, \
|
||||
.read = _read, \
|
||||
.write = _write, \
|
||||
.read = _Generic(_read, \
|
||||
__sysfs_bin_rw_handler_new * : NULL, \
|
||||
default : _read \
|
||||
), \
|
||||
.read_new = _Generic(_read, \
|
||||
__sysfs_bin_rw_handler_new * : _read, \
|
||||
default : NULL \
|
||||
), \
|
||||
.write = _Generic(_write, \
|
||||
__sysfs_bin_rw_handler_new * : NULL, \
|
||||
default : _write \
|
||||
), \
|
||||
.write_new = _Generic(_write, \
|
||||
__sysfs_bin_rw_handler_new * : _write, \
|
||||
default : NULL \
|
||||
), \
|
||||
.size = _size, \
|
||||
}
|
||||
|
||||
#define __BIN_ATTR_RO(_name, _size) { \
|
||||
.attr = { .name = __stringify(_name), .mode = 0444 }, \
|
||||
.read = _name##_read, \
|
||||
.size = _size, \
|
||||
}
|
||||
#define __BIN_ATTR_RO(_name, _size) \
|
||||
__BIN_ATTR(_name, 0444, _name##_read, NULL, _size)
|
||||
|
||||
#define __BIN_ATTR_WO(_name, _size) { \
|
||||
.attr = { .name = __stringify(_name), .mode = 0200 }, \
|
||||
.write = _name##_write, \
|
||||
.size = _size, \
|
||||
}
|
||||
#define __BIN_ATTR_WO(_name, _size) \
|
||||
__BIN_ATTR(_name, 0200, NULL, _name##_write, _size)
|
||||
|
||||
#define __BIN_ATTR_RW(_name, _size) \
|
||||
__BIN_ATTR(_name, 0644, _name##_read, _name##_write, _size)
|
||||
@ -356,11 +382,8 @@ struct bin_attribute bin_attr_##_name = __BIN_ATTR_WO(_name, _size)
|
||||
struct bin_attribute bin_attr_##_name = __BIN_ATTR_RW(_name, _size)
|
||||
|
||||
|
||||
#define __BIN_ATTR_ADMIN_RO(_name, _size) { \
|
||||
.attr = { .name = __stringify(_name), .mode = 0400 }, \
|
||||
.read = _name##_read, \
|
||||
.size = _size, \
|
||||
}
|
||||
#define __BIN_ATTR_ADMIN_RO(_name, _size) \
|
||||
__BIN_ATTR(_name, 0400, _name##_read, NULL, _size)
|
||||
|
||||
#define __BIN_ATTR_ADMIN_RW(_name, _size) \
|
||||
__BIN_ATTR(_name, 0600, _name##_read, _name##_write, _size)
|
||||
@ -371,10 +394,8 @@ struct bin_attribute bin_attr_##_name = __BIN_ATTR_ADMIN_RO(_name, _size)
|
||||
#define BIN_ATTR_ADMIN_RW(_name, _size) \
|
||||
struct bin_attribute bin_attr_##_name = __BIN_ATTR_ADMIN_RW(_name, _size)
|
||||
|
||||
#define __BIN_ATTR_SIMPLE_RO(_name, _mode) { \
|
||||
.attr = { .name = __stringify(_name), .mode = _mode }, \
|
||||
.read = sysfs_bin_attr_simple_read, \
|
||||
}
|
||||
#define __BIN_ATTR_SIMPLE_RO(_name, _mode) \
|
||||
__BIN_ATTR(_name, _mode, sysfs_bin_attr_simple_read, NULL, 0)
|
||||
|
||||
#define BIN_ATTR_SIMPLE_RO(_name) \
|
||||
struct bin_attribute bin_attr_##_name = __BIN_ATTR_SIMPLE_RO(_name, 0444)
|
||||
|
@ -2866,7 +2866,6 @@ static struct attribute *cpuhp_cpu_attrs[] = {
|
||||
static const struct attribute_group cpuhp_cpu_attr_group = {
|
||||
.attrs = cpuhp_cpu_attrs,
|
||||
.name = "hotplug",
|
||||
NULL
|
||||
};
|
||||
|
||||
static ssize_t states_show(struct device *dev,
|
||||
@ -2898,7 +2897,6 @@ static struct attribute *cpuhp_cpu_root_attrs[] = {
|
||||
static const struct attribute_group cpuhp_cpu_root_attr_group = {
|
||||
.attrs = cpuhp_cpu_root_attrs,
|
||||
.name = "hotplug",
|
||||
NULL
|
||||
};
|
||||
|
||||
#ifdef CONFIG_HOTPLUG_SMT
|
||||
@ -3020,7 +3018,6 @@ static struct attribute *cpuhp_smt_attrs[] = {
|
||||
static const struct attribute_group cpuhp_smt_attr_group = {
|
||||
.attrs = cpuhp_smt_attrs,
|
||||
.name = "smt",
|
||||
NULL
|
||||
};
|
||||
|
||||
static int __init cpu_smt_sysfs_init(void)
|
||||
|
@ -115,9 +115,8 @@ EXPORT_SYMBOL(devm_ioremap_wc);
|
||||
*/
|
||||
void devm_iounmap(struct device *dev, void __iomem *addr)
|
||||
{
|
||||
WARN_ON(devres_destroy(dev, devm_ioremap_release, devm_ioremap_match,
|
||||
WARN_ON(devres_release(dev, devm_ioremap_release, devm_ioremap_match,
|
||||
(__force void *)addr));
|
||||
iounmap(addr);
|
||||
}
|
||||
EXPORT_SYMBOL(devm_iounmap);
|
||||
|
||||
@ -308,8 +307,7 @@ EXPORT_SYMBOL(devm_ioport_map);
|
||||
*/
|
||||
void devm_ioport_unmap(struct device *dev, void __iomem *addr)
|
||||
{
|
||||
ioport_unmap(addr);
|
||||
WARN_ON(devres_destroy(dev, devm_ioport_map_release,
|
||||
WARN_ON(devres_release(dev, devm_ioport_map_release,
|
||||
devm_ioport_map_match, (__force void *)addr));
|
||||
}
|
||||
EXPORT_SYMBOL(devm_ioport_unmap);
|
||||
|
Loading…
Reference in New Issue
Block a user