Skip to content

Commit 28e6fcc

Browse files
Enric Balletbo i SerraLee Jones
authored andcommitted
mfd: cros_ec: Use mfd_add_hotplug_devices() helper
Use mfd_add_hotplug_devices() helper to register the subdevices. The helper allows us to reduce the boiler plate and also registers the subdevices in the same way as used in other functions used in this files. Signed-off-by: Enric Balletbo i Serra <[email protected]> Reviewed-by: Gwendal Grignou <[email protected]> Tested-by: Gwendal Grignou <[email protected]> Signed-off-by: Lee Jones <[email protected]>
1 parent 832a636 commit 28e6fcc

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

drivers/mfd/cros_ec_dev.c

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -329,10 +329,8 @@ static void cros_ec_accel_legacy_register(struct cros_ec_dev *ec)
329329
* Register 2 accelerometers, we will fail in the IIO driver if there
330330
* are no sensors.
331331
*/
332-
ret = mfd_add_devices(ec->dev, PLATFORM_DEVID_AUTO,
333-
cros_ec_accel_legacy_cells,
334-
ARRAY_SIZE(cros_ec_accel_legacy_cells),
335-
NULL, 0, NULL);
332+
ret = mfd_add_hotplug_devices(ec->dev, cros_ec_accel_legacy_cells,
333+
ARRAY_SIZE(cros_ec_accel_legacy_cells));
336334
if (ret)
337335
dev_err(ec_dev->dev, "failed to add EC sensors\n");
338336
}
@@ -419,10 +417,8 @@ static int ec_device_probe(struct platform_device *pdev)
419417
* The following subdevices cannot be detected by sending the
420418
* EC_FEATURE_GET_CMD to the Embedded Controller device.
421419
*/
422-
retval = mfd_add_devices(ec->dev, PLATFORM_DEVID_AUTO,
423-
cros_ec_platform_cells,
424-
ARRAY_SIZE(cros_ec_platform_cells),
425-
NULL, 0, NULL);
420+
retval = mfd_add_hotplug_devices(ec->dev, cros_ec_platform_cells,
421+
ARRAY_SIZE(cros_ec_platform_cells));
426422
if (retval)
427423
dev_warn(ec->dev,
428424
"failed to add cros-ec platform devices: %d\n",
@@ -431,10 +427,8 @@ static int ec_device_probe(struct platform_device *pdev)
431427
/* Check whether this EC instance has a VBC NVRAM */
432428
node = ec->ec_dev->dev->of_node;
433429
if (of_property_read_bool(node, "google,has-vbc-nvram")) {
434-
retval = mfd_add_devices(ec->dev, PLATFORM_DEVID_AUTO,
435-
cros_ec_vbc_cells,
436-
ARRAY_SIZE(cros_ec_vbc_cells),
437-
NULL, 0, NULL);
430+
retval = mfd_add_hotplug_devices(ec->dev, cros_ec_vbc_cells,
431+
ARRAY_SIZE(cros_ec_vbc_cells));
438432
if (retval)
439433
dev_warn(ec->dev, "failed to add VBC devices: %d\n",
440434
retval);

0 commit comments

Comments
 (0)