.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* |
---|
2 | 3 | * Enclosure Services |
---|
3 | 4 | * |
---|
.. | .. |
---|
5 | 6 | * |
---|
6 | 7 | **----------------------------------------------------------------------------- |
---|
7 | 8 | ** |
---|
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. |
---|
20 | 9 | ** |
---|
21 | 10 | **----------------------------------------------------------------------------- |
---|
22 | 11 | */ |
---|
.. | .. |
---|
114 | 103 | * enclosure_register - register device as an enclosure |
---|
115 | 104 | * |
---|
116 | 105 | * @dev: device containing the enclosure |
---|
| 106 | + * @name: chosen device name |
---|
117 | 107 | * @components: number of components in the enclosure |
---|
| 108 | + * @cb: platform call-backs |
---|
118 | 109 | * |
---|
119 | 110 | * This sets up the device for being an enclosure. Note that @dev does |
---|
120 | 111 | * not have to be a dedicated enclosure device. It may be some other type |
---|
.. | .. |
---|
125 | 116 | struct enclosure_component_callbacks *cb) |
---|
126 | 117 | { |
---|
127 | 118 | 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); |
---|
131 | 120 | int err, i; |
---|
132 | 121 | |
---|
133 | 122 | BUG_ON(!cb); |
---|
.. | .. |
---|
279 | 268 | /** |
---|
280 | 269 | * enclosure_component_alloc - prepare a new enclosure component |
---|
281 | 270 | * @edev: the enclosure to add the component |
---|
282 | | - * @num: the device number |
---|
| 271 | + * @number: the device number |
---|
283 | 272 | * @type: the type of component being added |
---|
284 | 273 | * @name: an optional name to appear in sysfs (leave NULL if none) |
---|
285 | 274 | * |
---|
.. | .. |
---|
360 | 349 | /** |
---|
361 | 350 | * enclosure_add_device - add a device as being part of an enclosure |
---|
362 | 351 | * @edev: the enclosure device being added to. |
---|
363 | | - * @num: the number of the component |
---|
| 352 | + * @component: the number of the component |
---|
364 | 353 | * @dev: the device being added |
---|
365 | 354 | * |
---|
366 | 355 | * Declares a real device to reside in slot (or identifier) @num of an |
---|
.. | .. |
---|
402 | 391 | /** |
---|
403 | 392 | * enclosure_remove_device - remove a device from an enclosure |
---|
404 | 393 | * @edev: the enclosure device |
---|
405 | | - * @num: the number of the component to remove |
---|
| 394 | + * @dev: device to remove/put |
---|
406 | 395 | * |
---|
407 | 396 | * Returns zero on success or an error. |
---|
408 | 397 | * |
---|