[PATCH v2 1/2] misc: enclosure: remove get_active callback

From: Mariusz Tkaczyk
Date: Wed May 24 2023 - 07:13:25 EST


The callback is not used, remove it. Leave possibility to read cached
ecomp->active value.

Reviewed-by: Dan Williams <dan.j.williams@xxxxxxxxx>
Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@xxxxxxxxxxxxxxx>
---
drivers/misc/enclosure.c | 4 +---
include/linux/enclosure.h | 2 --
2 files changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/misc/enclosure.c b/drivers/misc/enclosure.c
index 1b010d9267c9..59704fdb962a 100644
--- a/drivers/misc/enclosure.c
+++ b/drivers/misc/enclosure.c
@@ -534,11 +534,9 @@ 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);
+ /* The value of ecomp->active may have been updated by edev->cb->set_active(). */
return sysfs_emit(buf, "%d\n", ecomp->active);
}

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);
--
2.26.2