mirror of https://gitee.com/openkylin/linux.git
mfd / platform: cros_ec: Use devm_mfd_add_devices
Use devm_mfd_add_devices() for adding cros-ec core MFD child devices. This reduces the need of remove callback from platform/chrome for removing the MFD child devices. Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com> Reviewed-by: Guenter Roeck <groeck@chromium.org> Signed-off-by: Lee Jones <lee.jones@linaro.org>
This commit is contained in:
parent
49a57857ae
commit
4bc59c2f7e
|
@ -129,8 +129,8 @@ int cros_ec_register(struct cros_ec_device *ec_dev)
|
|||
}
|
||||
}
|
||||
|
||||
err = mfd_add_devices(ec_dev->dev, PLATFORM_DEVID_AUTO, &ec_cell, 1,
|
||||
NULL, ec_dev->irq, NULL);
|
||||
err = devm_mfd_add_devices(ec_dev->dev, PLATFORM_DEVID_AUTO, &ec_cell,
|
||||
1, NULL, ec_dev->irq, NULL);
|
||||
if (err) {
|
||||
dev_err(dev,
|
||||
"Failed to register Embedded Controller subdevice %d\n",
|
||||
|
@ -147,7 +147,7 @@ int cros_ec_register(struct cros_ec_device *ec_dev)
|
|||
* - the EC is responsive at init time (it is not true for a
|
||||
* sensor hub.
|
||||
*/
|
||||
err = mfd_add_devices(ec_dev->dev, PLATFORM_DEVID_AUTO,
|
||||
err = devm_mfd_add_devices(ec_dev->dev, PLATFORM_DEVID_AUTO,
|
||||
&ec_pd_cell, 1, NULL, ec_dev->irq, NULL);
|
||||
if (err) {
|
||||
dev_err(dev,
|
||||
|
@ -181,14 +181,6 @@ int cros_ec_register(struct cros_ec_device *ec_dev)
|
|||
}
|
||||
EXPORT_SYMBOL(cros_ec_register);
|
||||
|
||||
int cros_ec_remove(struct cros_ec_device *ec_dev)
|
||||
{
|
||||
mfd_remove_devices(ec_dev->dev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(cros_ec_remove);
|
||||
|
||||
#ifdef CONFIG_PM_SLEEP
|
||||
int cros_ec_suspend(struct cros_ec_device *ec_dev)
|
||||
{
|
||||
|
|
|
@ -317,15 +317,6 @@ static int cros_ec_i2c_probe(struct i2c_client *client,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int cros_ec_i2c_remove(struct i2c_client *client)
|
||||
{
|
||||
struct cros_ec_device *ec_dev = i2c_get_clientdata(client);
|
||||
|
||||
cros_ec_remove(ec_dev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PM_SLEEP
|
||||
static int cros_ec_i2c_suspend(struct device *dev)
|
||||
{
|
||||
|
@ -376,7 +367,6 @@ static struct i2c_driver cros_ec_driver = {
|
|||
.pm = &cros_ec_i2c_pm_ops,
|
||||
},
|
||||
.probe = cros_ec_i2c_probe,
|
||||
.remove = cros_ec_i2c_remove,
|
||||
.id_table = cros_ec_i2c_id,
|
||||
};
|
||||
|
||||
|
|
|
@ -327,7 +327,6 @@ static int cros_ec_lpc_probe(struct platform_device *pdev)
|
|||
|
||||
static int cros_ec_lpc_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct cros_ec_device *ec_dev;
|
||||
struct acpi_device *adev;
|
||||
|
||||
adev = ACPI_COMPANION(&pdev->dev);
|
||||
|
@ -335,9 +334,6 @@ static int cros_ec_lpc_remove(struct platform_device *pdev)
|
|||
acpi_remove_notify_handler(adev->handle, ACPI_ALL_NOTIFY,
|
||||
cros_ec_lpc_acpi_notify);
|
||||
|
||||
ec_dev = platform_get_drvdata(pdev);
|
||||
cros_ec_remove(ec_dev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -685,16 +685,6 @@ static int cros_ec_spi_probe(struct spi_device *spi)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int cros_ec_spi_remove(struct spi_device *spi)
|
||||
{
|
||||
struct cros_ec_device *ec_dev;
|
||||
|
||||
ec_dev = spi_get_drvdata(spi);
|
||||
cros_ec_remove(ec_dev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PM_SLEEP
|
||||
static int cros_ec_spi_suspend(struct device *dev)
|
||||
{
|
||||
|
@ -733,7 +723,6 @@ static struct spi_driver cros_ec_driver_spi = {
|
|||
.pm = &cros_ec_spi_pm_ops,
|
||||
},
|
||||
.probe = cros_ec_spi_probe,
|
||||
.remove = cros_ec_spi_remove,
|
||||
.id_table = cros_ec_spi_id,
|
||||
};
|
||||
|
||||
|
|
|
@ -281,16 +281,6 @@ int cros_ec_cmd_xfer(struct cros_ec_device *ec_dev,
|
|||
int cros_ec_cmd_xfer_status(struct cros_ec_device *ec_dev,
|
||||
struct cros_ec_command *msg);
|
||||
|
||||
/**
|
||||
* cros_ec_remove() - Remove a ChromeOS EC.
|
||||
* @ec_dev: Device to register.
|
||||
*
|
||||
* Call this to deregister a ChromeOS EC, then clean up any private data.
|
||||
*
|
||||
* Return: 0 on success or negative error code.
|
||||
*/
|
||||
int cros_ec_remove(struct cros_ec_device *ec_dev);
|
||||
|
||||
/**
|
||||
* cros_ec_register() - Register a new ChromeOS EC, using the provided info.
|
||||
* @ec_dev: Device to register.
|
||||
|
|
Loading…
Reference in New Issue