Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <enric.balletbo@collabora.com>
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
Tested-by: Gwendal Grignou <gwendal@chromium.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>

authored by

Enric Balletbo i Serra and committed by
Lee Jones
28e6fcc8 832a636f

+6 -12
+6 -12
drivers/mfd/cros_ec_dev.c
··· 329 329 * Register 2 accelerometers, we will fail in the IIO driver if there 330 330 * are no sensors. 331 331 */ 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)); 336 334 if (ret) 337 335 dev_err(ec_dev->dev, "failed to add EC sensors\n"); 338 336 } ··· 417 419 * The following subdevices cannot be detected by sending the 418 420 * EC_FEATURE_GET_CMD to the Embedded Controller device. 419 421 */ 420 - retval = mfd_add_devices(ec->dev, PLATFORM_DEVID_AUTO, 421 - cros_ec_platform_cells, 422 - ARRAY_SIZE(cros_ec_platform_cells), 423 - NULL, 0, NULL); 422 + retval = mfd_add_hotplug_devices(ec->dev, cros_ec_platform_cells, 423 + ARRAY_SIZE(cros_ec_platform_cells)); 424 424 if (retval) 425 425 dev_warn(ec->dev, 426 426 "failed to add cros-ec platform devices: %d\n", ··· 427 431 /* Check whether this EC instance has a VBC NVRAM */ 428 432 node = ec->ec_dev->dev->of_node; 429 433 if (of_property_read_bool(node, "google,has-vbc-nvram")) { 430 - retval = mfd_add_devices(ec->dev, PLATFORM_DEVID_AUTO, 431 - cros_ec_vbc_cells, 432 - ARRAY_SIZE(cros_ec_vbc_cells), 433 - NULL, 0, NULL); 434 + retval = mfd_add_hotplug_devices(ec->dev, cros_ec_vbc_cells, 435 + ARRAY_SIZE(cros_ec_vbc_cells)); 434 436 if (retval) 435 437 dev_warn(ec->dev, "failed to add VBC devices: %d\n", 436 438 retval);