Message ID | 20221117163407.28472-2-mariusz.tkaczyk@linux.intel.com (mailing list archive) |
---|---|
State | Handled Elsewhere |
Delegated to: | Bjorn Helgaas |
Headers | show |
Series | Enclosure sysfs refactor | expand |
Mariusz Tkaczyk wrote:
> The callback is not used, remove it.
While the callback is not used, userspace might still be dependent upon
on the "active" attribute being readable. So I think the change would be
limited to:
diff --git a/drivers/misc/enclosure.c b/drivers/misc/enclosure.c
index 4ba966529458..0d7225dc5d45 100644
--- a/drivers/misc/enclosure.c
+++ b/drivers/misc/enclosure.c
@@ -534,11 +534,8 @@ static ssize_t set_component_status(struct device *cdev,
static ssize_t get_component_active(struct device *cdev,
struct device_attribute *attr, char *buf)
{
- struct enclosure_device *edev = to_enclosure_device(cdev->parent);
struct enclosure_component *ecomp = to_enclosure_component(cdev);
- if (edev->cb->get_active)
- edev->cb->get_active(edev, ecomp);
return sysfs_emit(buf, "%d\n", ecomp->active);
}
...unless you can prove that userspace never reads "active", but I
expect it is too late to make a breaking change like that.
diff --git a/drivers/misc/enclosure.c b/drivers/misc/enclosure.c index 1b010d9267c9..fd0707a8ed79 100644 --- a/drivers/misc/enclosure.c +++ b/drivers/misc/enclosure.c @@ -531,17 +531,6 @@ static ssize_t set_component_status(struct device *cdev, return -EINVAL; } -static ssize_t get_component_active(struct device *cdev, - struct device_attribute *attr, char *buf) -{ - struct enclosure_device *edev = to_enclosure_device(cdev->parent); - struct enclosure_component *ecomp = to_enclosure_component(cdev); - - if (edev->cb->get_active) - edev->cb->get_active(edev, ecomp); - return sysfs_emit(buf, "%d\n", ecomp->active); -} - static ssize_t set_component_active(struct device *cdev, struct device_attribute *attr, const char *buf, size_t count) @@ -645,8 +634,7 @@ static DEVICE_ATTR(fault, S_IRUGO | S_IWUSR, get_component_fault, set_component_fault); static DEVICE_ATTR(status, S_IRUGO | S_IWUSR, get_component_status, set_component_status); -static DEVICE_ATTR(active, S_IRUGO | S_IWUSR, get_component_active, - set_component_active); +static DEVICE_ATTR(active, S_IWUSR, NULL, set_component_active); static DEVICE_ATTR(locate, S_IRUGO | S_IWUSR, get_component_locate, set_component_locate); static DEVICE_ATTR(power_status, S_IRUGO | S_IWUSR, get_component_power_status, diff --git a/include/linux/enclosure.h b/include/linux/enclosure.h index 1c630e2c2756..8d09c6d07bf1 100644 --- a/include/linux/enclosure.h +++ b/include/linux/enclosure.h @@ -62,8 +62,6 @@ struct enclosure_component_callbacks { int (*set_fault)(struct enclosure_device *, struct enclosure_component *, enum enclosure_component_setting); - void (*get_active)(struct enclosure_device *, - struct enclosure_component *); int (*set_active)(struct enclosure_device *, struct enclosure_component *, enum enclosure_component_setting);
The callback is not used, remove it. Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com> --- drivers/misc/enclosure.c | 14 +------------- include/linux/enclosure.h | 2 -- 2 files changed, 1 insertion(+), 15 deletions(-)