hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/drivers/misc/enclosure.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Enclosure Services
34 *
....@@ -5,18 +6,6 @@
56 *
67 **-----------------------------------------------------------------------------
78 **
8
-** This program is free software; you can redistribute it and/or
9
-** modify it under the terms of the GNU General Public License
10
-** version 2 as published by the Free Software Foundation.
11
-**
12
-** This program is distributed in the hope that it will be useful,
13
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
14
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
-** GNU General Public License for more details.
16
-**
17
-** You should have received a copy of the GNU General Public License
18
-** along with this program; if not, write to the Free Software
19
-** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
209 **
2110 **-----------------------------------------------------------------------------
2211 */
....@@ -114,7 +103,9 @@
114103 * enclosure_register - register device as an enclosure
115104 *
116105 * @dev: device containing the enclosure
106
+ * @name: chosen device name
117107 * @components: number of components in the enclosure
108
+ * @cb: platform call-backs
118109 *
119110 * This sets up the device for being an enclosure. Note that @dev does
120111 * not have to be a dedicated enclosure device. It may be some other type
....@@ -125,9 +116,7 @@
125116 struct enclosure_component_callbacks *cb)
126117 {
127118 struct enclosure_device *edev =
128
- kzalloc(sizeof(struct enclosure_device) +
129
- sizeof(struct enclosure_component)*components,
130
- GFP_KERNEL);
119
+ kzalloc(struct_size(edev, component, components), GFP_KERNEL);
131120 int err, i;
132121
133122 BUG_ON(!cb);
....@@ -279,7 +268,7 @@
279268 /**
280269 * enclosure_component_alloc - prepare a new enclosure component
281270 * @edev: the enclosure to add the component
282
- * @num: the device number
271
+ * @number: the device number
283272 * @type: the type of component being added
284273 * @name: an optional name to appear in sysfs (leave NULL if none)
285274 *
....@@ -360,7 +349,7 @@
360349 /**
361350 * enclosure_add_device - add a device as being part of an enclosure
362351 * @edev: the enclosure device being added to.
363
- * @num: the number of the component
352
+ * @component: the number of the component
364353 * @dev: the device being added
365354 *
366355 * Declares a real device to reside in slot (or identifier) @num of an
....@@ -402,7 +391,7 @@
402391 /**
403392 * enclosure_remove_device - remove a device from an enclosure
404393 * @edev: the enclosure device
405
- * @num: the number of the component to remove
394
+ * @dev: device to remove/put
406395 *
407396 * Returns zero on success or an error.
408397 *