From: Bartosz Golaszewski <bartosz.golaszewski@xxxxxxxxxx> Make to_ext_attr() available to code that wants to reuse struct dev_ext_attribute. While at it: make it into a static inline function. Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@xxxxxxxxxx> --- drivers/base/core.c | 2 -- include/linux/device.h | 6 ++++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/base/core.c b/drivers/base/core.c index 131d96c6090b..d51e7f05d15a 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -2459,8 +2459,6 @@ static const struct sysfs_ops dev_sysfs_ops = { .store = dev_attr_store, }; -#define to_ext_attr(x) container_of(x, struct dev_ext_attribute, attr) - ssize_t device_store_ulong(struct device *dev, struct device_attribute *attr, const char *buf, size_t size) diff --git a/include/linux/device.h b/include/linux/device.h index fc3bd7116ab9..f7957ec918a3 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -120,6 +120,12 @@ struct dev_ext_attribute { void *var; }; +static inline struct dev_ext_attribute * +to_ext_attr(struct device_attribute *attr) +{ + return container_of(attr, struct dev_ext_attribute, attr); +} + ssize_t device_show_ulong(struct device *dev, struct device_attribute *attr, char *buf); ssize_t device_store_ulong(struct device *dev, struct device_attribute *attr, -- 2.43.0