Skip to contentSkip to conversation

scsi: Remove raid_component_add()

PATCH Applied Zhu Wang 3 participants 3 messages Aug 22, 2023 – Aug 25, 2023 SCSI

lore
Share & tools
lore

Zhu Wang

author
#0 lore raw

PATCH v2 1/1 scsi: Remove raid_component_add()

The raid_component_add() function was added to the kernel tree via patch "[SCSI] embryonic RAID class" (2005). Remove this function since it never has had any callers in the Linux kernel. And also raid_component_release is only used in raid_component_add(), so it is also removed.

---
 drivers/scsi/raid_class.c  | 48 --------------------------------------
 include/linux/raid_class.h |  4 ----
 2 files changed, 52 deletions(-)
drivers/scsi/raid_class.c +0 -48
index 711252e52d8e..95a86e0dfd77 100644
@@ -209,54 +209,6 @@ raid_attr_ro_state(level);
 raid_attr_ro_fn(resync);
 raid_attr_ro_state_fn(state);
 
-static void raid_component_release(struct device *dev)
-{
-	struct raid_component *rc =
-		container_of(dev, struct raid_component, dev);
-	dev_printk(KERN_ERR, rc->dev.parent, "COMPONENT RELEASE\n");
-	put_device(rc->dev.parent);
-	kfree(rc);
-}
-
-int raid_component_add(struct raid_template *r,struct device *raid_dev,
-		       struct device *component_dev)
-{
-	struct device *cdev =
-		attribute_container_find_class_device(&r->raid_attrs.ac,
-						      raid_dev);
-	struct raid_component *rc;
-	struct raid_data *rd = dev_get_drvdata(cdev);
-	int err;
-
-	rc = kzalloc(sizeof(*rc), GFP_KERNEL);
-	if (!rc)
-		return -ENOMEM;
-
-	INIT_LIST_HEAD(&rc->node);
-	device_initialize(&rc->dev);
-	rc->dev.release = raid_component_release;
-	rc->dev.parent = get_device(component_dev);
-	rc->num = rd->component_count++;
-
-	dev_set_name(&rc->dev, "component-%d", rc->num);
-	list_add_tail(&rc->node, &rd->component_list);
-	rc->dev.class = &raid_class.class;
-	err = device_add(&rc->dev);
-	if (err)
-		goto err_out;
-
-	return 0;
-
-err_out:
-	put_device(&rc->dev);
-	list_del(&rc->node);
-	rd->component_count--;
-	put_device(component_dev);
-	kfree(rc);
-	return err;
-}
-EXPORT_SYMBOL(raid_component_add);
-
 struct raid_template *
 raid_class_attach(struct raid_function_template *ft)
 {
include/linux/raid_class.h +0 -4
index 6a9b177d5c41..e50416ba9cd9 100644
@@ -77,7 +77,3 @@ DEFINE_RAID_ATTRIBUTE(enum raid_state, state)
 	
 struct raid_template *raid_class_attach(struct raid_function_template *);
 void raid_class_release(struct raid_template *);
-
-int __must_check raid_component_add(struct raid_template *, struct device *,
-				    struct device *);
-
Signature · 1 line
2.34.1
Reviewed-by on v2 1/1
#1 lore raw
Quoted 5 lines · Zhu Wang

The raid_component_add() function was added to the kernel tree via patch "[SCSI] embryonic RAID class" (2005). Remove this function since it never has had any callers in the Linux kernel. And also raid_component_release is only used in raid_component_add(), so it is also removed.

#2 lore raw
In reply to Zhu Wang
Quoted 8 lines · Zhu Wang

The raid_component_add() function was added to the kernel tree via patch "[SCSI] embryonic RAID class" (2005). Remove this function since it never has had any callers in the Linux kernel. And also raid_component_release is only used in raid_component_add(), so it is also removed.

[...]

Applied to 6.5/scsi-fixes, thanks!

[1/1] scsi: Remove raid_component_add()

      https://git.kernel.org/mkp/scsi/c/60c5fd2e8f3c
Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering