mirror of
https://github.com/torvalds/linux.git
synced 2026-04-18 06:44:00 -04:00
Merge tag 'driver-core-6.17-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/driver-core/driver-core
Pull driver core updates from Danilo Krummrich:
"debugfs:
- Remove unneeded debugfs_file_{get,put}() instances
- Remove last remnants of debugfs_real_fops()
- Allow storing non-const void * in struct debugfs_inode_info::aux
sysfs:
- Switch back to attribute_group::bin_attrs (treewide)
- Switch back to bin_attribute::read()/write() (treewide)
- Constify internal references to 'struct bin_attribute'
Support cache-ids for device-tree systems:
- Add arch hook arch_compact_of_hwid()
- Use arch_compact_of_hwid() to compact MPIDR values on arm64
Rust:
- Device:
- Introduce CoreInternal device context (for bus internal methods)
- Provide generic drvdata accessors for bus devices
- Provide Driver::unbind() callbacks
- Use the infrastructure above for auxiliary, PCI and platform
- Implement Device::as_bound()
- Rename Device::as_ref() to Device::from_raw() (treewide)
- Implement fwnode and device property abstractions
- Implement example usage in the Rust platform sample driver
- Devres:
- Remove the inner reference count (Arc) and use pin-init instead
- Replace Devres::new_foreign_owned() with devres::register()
- Require T to be Send in Devres<T>
- Initialize the data kept inside a Devres last
- Provide an accessor for the Devres associated Device
- Device ID:
- Add support for ACPI device IDs and driver match tables
- Split up generic device ID infrastructure
- Use generic device ID infrastructure in net::phy
- DMA:
- Implement the dma::Device trait
- Add DMA mask accessors to dma::Device
- Implement dma::Device for PCI and platform devices
- Use DMA masks from the DMA sample module
- I/O:
- Implement abstraction for resource regions (struct resource)
- Implement resource-based ioremap() abstractions
- Provide platform device accessors for I/O (remap) requests
- Misc:
- Support fallible PinInit types in Revocable
- Implement Wrapper<T> for Opaque<T>
- Merge pin-init blanket dependencies (for Devres)
Misc:
- Fix OF node leak in auxiliary_device_create()
- Use util macros in device property iterators
- Improve kobject sample code
- Add device_link_test() for testing device link flags
- Fix typo in Documentation/ABI/testing/sysfs-kernel-address_bits
- Hint to prefer container_of_const() over container_of()"
* tag 'driver-core-6.17-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/driver-core/driver-core: (84 commits)
rust: io: fix broken intra-doc links to `platform::Device`
rust: io: fix broken intra-doc link to missing `flags` module
rust: io: mem: enable IoRequest doc-tests
rust: platform: add resource accessors
rust: io: mem: add a generic iomem abstraction
rust: io: add resource abstraction
rust: samples: dma: set DMA mask
rust: platform: implement the `dma::Device` trait
rust: pci: implement the `dma::Device` trait
rust: dma: add DMA addressing capabilities
rust: dma: implement `dma::Device` trait
rust: net::phy Change module_phy_driver macro to use module_device_table macro
rust: net::phy represent DeviceId as transparent wrapper over mdio_device_id
rust: device_id: split out index support into a separate trait
device: rust: rename Device::as_ref() to Device::from_raw()
arm64: cacheinfo: Provide helper to compress MPIDR value into u32
cacheinfo: Add arch hook to compress CPU h/w id into 32 bits for cache-id
cacheinfo: Set cache 'id' based on DT data
container_of: Document container_of() is not to be used in new code
driver core: auxiliary bus: fix OF node leak
...
This commit is contained in:
@@ -47,29 +47,12 @@ const struct file_operations debugfs_noop_file_operations = {
|
||||
|
||||
#define F_DENTRY(filp) ((filp)->f_path.dentry)
|
||||
|
||||
const void *debugfs_get_aux(const struct file *file)
|
||||
void *debugfs_get_aux(const struct file *file)
|
||||
{
|
||||
return DEBUGFS_I(file_inode(file))->aux;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(debugfs_get_aux);
|
||||
|
||||
const struct file_operations *debugfs_real_fops(const struct file *filp)
|
||||
{
|
||||
struct debugfs_fsdata *fsd = F_DENTRY(filp)->d_fsdata;
|
||||
|
||||
if (!fsd) {
|
||||
/*
|
||||
* Urgh, we've been called w/o a protecting
|
||||
* debugfs_file_get().
|
||||
*/
|
||||
WARN_ON(1);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return fsd->real_fops;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(debugfs_real_fops);
|
||||
|
||||
enum dbgfs_get_mode {
|
||||
DBGFS_GET_ALREADY,
|
||||
DBGFS_GET_REGULAR,
|
||||
@@ -302,15 +285,13 @@ static int debugfs_locked_down(struct inode *inode,
|
||||
static int open_proxy_open(struct inode *inode, struct file *filp)
|
||||
{
|
||||
struct dentry *dentry = F_DENTRY(filp);
|
||||
const struct file_operations *real_fops = NULL;
|
||||
const struct file_operations *real_fops = DEBUGFS_I(inode)->real_fops;
|
||||
int r;
|
||||
|
||||
r = __debugfs_file_get(dentry, DBGFS_GET_REGULAR);
|
||||
if (r)
|
||||
return r == -EIO ? -ENOENT : r;
|
||||
|
||||
real_fops = debugfs_real_fops(filp);
|
||||
|
||||
r = debugfs_locked_down(inode, filp, real_fops);
|
||||
if (r)
|
||||
goto out;
|
||||
@@ -352,7 +333,6 @@ static ret_type full_proxy_ ## name(proto) \
|
||||
{ \
|
||||
struct dentry *dentry = F_DENTRY(filp); \
|
||||
struct debugfs_fsdata *fsd = dentry->d_fsdata; \
|
||||
const struct file_operations *real_fops; \
|
||||
ret_type r; \
|
||||
\
|
||||
if (!(fsd->methods & bit)) \
|
||||
@@ -360,14 +340,13 @@ static ret_type full_proxy_ ## name(proto) \
|
||||
r = debugfs_file_get(dentry); \
|
||||
if (unlikely(r)) \
|
||||
return r; \
|
||||
real_fops = debugfs_real_fops(filp); \
|
||||
r = real_fops->name(args); \
|
||||
r = fsd->real_fops->name(args); \
|
||||
debugfs_file_put(dentry); \
|
||||
return r; \
|
||||
}
|
||||
|
||||
#define FULL_PROXY_FUNC_BOTH(name, ret_type, filp, proto, args, bit, ret) \
|
||||
static ret_type full_proxy_ ## name(proto) \
|
||||
#define SHORT_PROXY_FUNC(name, ret_type, filp, proto, args, bit, ret) \
|
||||
static ret_type short_proxy_ ## name(proto) \
|
||||
{ \
|
||||
struct dentry *dentry = F_DENTRY(filp); \
|
||||
struct debugfs_fsdata *fsd = dentry->d_fsdata; \
|
||||
@@ -378,27 +357,38 @@ static ret_type full_proxy_ ## name(proto) \
|
||||
r = debugfs_file_get(dentry); \
|
||||
if (unlikely(r)) \
|
||||
return r; \
|
||||
if (fsd->real_fops) \
|
||||
r = fsd->real_fops->name(args); \
|
||||
else \
|
||||
r = fsd->short_fops->name(args); \
|
||||
r = fsd->short_fops->name(args); \
|
||||
debugfs_file_put(dentry); \
|
||||
return r; \
|
||||
}
|
||||
|
||||
FULL_PROXY_FUNC_BOTH(llseek, loff_t, filp,
|
||||
PROTO(struct file *filp, loff_t offset, int whence),
|
||||
ARGS(filp, offset, whence), HAS_LSEEK, -ESPIPE);
|
||||
SHORT_PROXY_FUNC(llseek, loff_t, filp,
|
||||
PROTO(struct file *filp, loff_t offset, int whence),
|
||||
ARGS(filp, offset, whence), HAS_LSEEK, -ESPIPE);
|
||||
|
||||
FULL_PROXY_FUNC_BOTH(read, ssize_t, filp,
|
||||
PROTO(struct file *filp, char __user *buf, size_t size,
|
||||
loff_t *ppos),
|
||||
ARGS(filp, buf, size, ppos), HAS_READ, -EINVAL);
|
||||
FULL_PROXY_FUNC(llseek, loff_t, filp,
|
||||
PROTO(struct file *filp, loff_t offset, int whence),
|
||||
ARGS(filp, offset, whence), HAS_LSEEK, -ESPIPE);
|
||||
|
||||
FULL_PROXY_FUNC_BOTH(write, ssize_t, filp,
|
||||
PROTO(struct file *filp, const char __user *buf,
|
||||
size_t size, loff_t *ppos),
|
||||
ARGS(filp, buf, size, ppos), HAS_WRITE, -EINVAL);
|
||||
SHORT_PROXY_FUNC(read, ssize_t, filp,
|
||||
PROTO(struct file *filp, char __user *buf, size_t size,
|
||||
loff_t *ppos),
|
||||
ARGS(filp, buf, size, ppos), HAS_READ, -EINVAL);
|
||||
|
||||
FULL_PROXY_FUNC(read, ssize_t, filp,
|
||||
PROTO(struct file *filp, char __user *buf, size_t size,
|
||||
loff_t *ppos),
|
||||
ARGS(filp, buf, size, ppos), HAS_READ, -EINVAL);
|
||||
|
||||
SHORT_PROXY_FUNC(write, ssize_t, filp,
|
||||
PROTO(struct file *filp, const char __user *buf,
|
||||
size_t size, loff_t *ppos),
|
||||
ARGS(filp, buf, size, ppos), HAS_WRITE, -EINVAL);
|
||||
|
||||
FULL_PROXY_FUNC(write, ssize_t, filp,
|
||||
PROTO(struct file *filp, const char __user *buf,
|
||||
size_t size, loff_t *ppos),
|
||||
ARGS(filp, buf, size, ppos), HAS_WRITE, -EINVAL);
|
||||
|
||||
FULL_PROXY_FUNC(unlocked_ioctl, long, filp,
|
||||
PROTO(struct file *filp, unsigned int cmd, unsigned long arg),
|
||||
@@ -410,22 +400,21 @@ static __poll_t full_proxy_poll(struct file *filp,
|
||||
struct dentry *dentry = F_DENTRY(filp);
|
||||
struct debugfs_fsdata *fsd = dentry->d_fsdata;
|
||||
__poll_t r = 0;
|
||||
const struct file_operations *real_fops;
|
||||
|
||||
if (!(fsd->methods & HAS_POLL))
|
||||
return DEFAULT_POLLMASK;
|
||||
if (debugfs_file_get(dentry))
|
||||
return EPOLLHUP;
|
||||
|
||||
real_fops = debugfs_real_fops(filp);
|
||||
r = real_fops->poll(filp, wait);
|
||||
r = fsd->real_fops->poll(filp, wait);
|
||||
debugfs_file_put(dentry);
|
||||
return r;
|
||||
}
|
||||
|
||||
static int full_proxy_release(struct inode *inode, struct file *filp)
|
||||
static int full_proxy_release(struct inode *inode, struct file *file)
|
||||
{
|
||||
const struct file_operations *real_fops = debugfs_real_fops(filp);
|
||||
struct debugfs_fsdata *fsd = F_DENTRY(file)->d_fsdata;
|
||||
const struct file_operations *real_fops = fsd->real_fops;
|
||||
int r = 0;
|
||||
|
||||
/*
|
||||
@@ -435,7 +424,7 @@ static int full_proxy_release(struct inode *inode, struct file *filp)
|
||||
* ->i_private is still being meaningful here.
|
||||
*/
|
||||
if (real_fops->release)
|
||||
r = real_fops->release(inode, filp);
|
||||
r = real_fops->release(inode, file);
|
||||
|
||||
fops_put(real_fops);
|
||||
return r;
|
||||
@@ -517,9 +506,9 @@ static int full_proxy_open_short(struct inode *inode, struct file *filp)
|
||||
|
||||
const struct file_operations debugfs_full_short_proxy_file_operations = {
|
||||
.open = full_proxy_open_short,
|
||||
.llseek = full_proxy_llseek,
|
||||
.read = full_proxy_read,
|
||||
.write = full_proxy_write,
|
||||
.llseek = short_proxy_llseek,
|
||||
.read = short_proxy_read,
|
||||
.write = short_proxy_write,
|
||||
};
|
||||
|
||||
ssize_t debugfs_attr_read(struct file *file, char __user *buf,
|
||||
|
||||
@@ -444,7 +444,7 @@ static struct dentry *__debugfs_create_file(const char *name, umode_t mode,
|
||||
proxy_fops = &debugfs_noop_file_operations;
|
||||
inode->i_fop = proxy_fops;
|
||||
DEBUGFS_I(inode)->raw = real_fops;
|
||||
DEBUGFS_I(inode)->aux = aux;
|
||||
DEBUGFS_I(inode)->aux = (void *)aux;
|
||||
|
||||
d_instantiate(dentry, inode);
|
||||
fsnotify_create(d_inode(dentry->d_parent), dentry);
|
||||
|
||||
@@ -19,7 +19,7 @@ struct debugfs_inode_info {
|
||||
const struct debugfs_short_fops *short_fops;
|
||||
debugfs_automount_t automount;
|
||||
};
|
||||
const void *aux;
|
||||
void *aux;
|
||||
};
|
||||
|
||||
static inline struct debugfs_inode_info *DEBUGFS_I(struct inode *inode)
|
||||
|
||||
Reference in New Issue
Block a user