hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/drivers/scsi/raid_class.c
....@@ -1,9 +1,8 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * raid_class.c - implementation of a simple raid visualisation class
34 *
45 * Copyright (c) 2005 - James Bottomley <James.Bottomley@steeleye.com>
5
- *
6
- * This file is licensed under GPLv2
76 *
87 * This class is designed to allow raid attributes to be visualised and
98 * manipulated in a form independent of the underlying raid. Ultimately this
....@@ -209,53 +208,6 @@
209208 raid_attr_ro_state(level);
210209 raid_attr_ro_fn(resync);
211210 raid_attr_ro_state_fn(state);
212
-
213
-static void raid_component_release(struct device *dev)
214
-{
215
- struct raid_component *rc =
216
- container_of(dev, struct raid_component, dev);
217
- dev_printk(KERN_ERR, rc->dev.parent, "COMPONENT RELEASE\n");
218
- put_device(rc->dev.parent);
219
- kfree(rc);
220
-}
221
-
222
-int raid_component_add(struct raid_template *r,struct device *raid_dev,
223
- struct device *component_dev)
224
-{
225
- struct device *cdev =
226
- attribute_container_find_class_device(&r->raid_attrs.ac,
227
- raid_dev);
228
- struct raid_component *rc;
229
- struct raid_data *rd = dev_get_drvdata(cdev);
230
- int err;
231
-
232
- rc = kzalloc(sizeof(*rc), GFP_KERNEL);
233
- if (!rc)
234
- return -ENOMEM;
235
-
236
- INIT_LIST_HEAD(&rc->node);
237
- device_initialize(&rc->dev);
238
- rc->dev.release = raid_component_release;
239
- rc->dev.parent = get_device(component_dev);
240
- rc->num = rd->component_count++;
241
-
242
- dev_set_name(&rc->dev, "component-%d", rc->num);
243
- list_add_tail(&rc->node, &rd->component_list);
244
- rc->dev.class = &raid_class.class;
245
- err = device_add(&rc->dev);
246
- if (err)
247
- goto err_out;
248
-
249
- return 0;
250
-
251
-err_out:
252
- list_del(&rc->node);
253
- rd->component_count--;
254
- put_device(component_dev);
255
- kfree(rc);
256
- return err;
257
-}
258
-EXPORT_SYMBOL(raid_component_add);
259211
260212 struct raid_template *
261213 raid_class_attach(struct raid_function_template *ft)