History

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.

Enric Balletbo i Serra committed 7 years ago

Commit 4bc59c21 parent 49a57855 files · +3 −46Browse files

Unified · Split

5 files
  1. drivers/mfd/cros_ec.c +3 −11
  2. drivers/platform/chrome/cros_ec_i2c.c +0 −10
  3. drivers/platform/chrome/cros_ec_lpc.c +0 −4
  4. drivers/platform/chrome/cros_ec_spi.c +0 −11
  5. include/linux/mfd/cros_ec.h +0 −10
drivers/mfd/cros_ec.c+3−11
@@ -129,8 +129,8 @@ int cros_ec_register(struct cros_ec_device *ec_dev) · 128 unmodified lines
129129 }
130130 }
131131
132− err = mfd_add_devices(ec_dev->dev, PLATFORM_DEVID_AUTO, &ec_cell, 1,
133− NULL, ec_dev->irq, NULL);
132+ err = devm_mfd_add_devices(ec_dev->dev, PLATFORM_DEVID_AUTO, &ec_cell,
133+ 1, NULL, ec_dev->irq, NULL);
134134 if (err) {
135135 dev_err(dev,
136136 "Failed to register Embedded Controller subdevice %d\n",
@@ -147,7 +147,7 @@ int cros_ec_register(struct cros_ec_device *ec_dev) · 10 unmodified lines
147147 * - the EC is responsive at init time (it is not true for a
148148 * sensor hub.
149149 */
150− err = mfd_add_devices(ec_dev->dev, PLATFORM_DEVID_AUTO,
150+ err = devm_mfd_add_devices(ec_dev->dev, PLATFORM_DEVID_AUTO,
151151 &ec_pd_cell, 1, NULL, ec_dev->irq, NULL);
152152 if (err) {
153153 dev_err(dev,
@@ -181,14 +181,6 @@ int cros_ec_register(struct cros_ec_device *ec_dev) · 27 unmodified lines
181181 }
182182 EXPORT_SYMBOL(cros_ec_register);
183183
184−int cros_ec_remove(struct cros_ec_device *ec_dev)
185−{
186− mfd_remove_devices(ec_dev->dev);
187−
188− return 0;
189−}
190−EXPORT_SYMBOL(cros_ec_remove);
191−
192184 #ifdef CONFIG_PM_SLEEP
193185 int cros_ec_suspend(struct cros_ec_device *ec_dev)
194186 {
drivers/platform/chrome/cros_ec_i2c.c+0−10
@@ -317,15 +317,6 @@ static int cros_ec_i2c_probe(struct i2c_client *client, · 316 unmodified lines
317317 return 0;
318318 }
319319
320−static int cros_ec_i2c_remove(struct i2c_client *client)
321−{
322− struct cros_ec_device *ec_dev = i2c_get_clientdata(client);
323−
324− cros_ec_remove(ec_dev);
325−
326− return 0;
327−}
328−
329320 #ifdef CONFIG_PM_SLEEP
330321 static int cros_ec_i2c_suspend(struct device *dev)
331322 {
@@ -376,7 +367,6 @@ static struct i2c_driver cros_ec_driver = { · 44 unmodified lines
376367 .pm = &cros_ec_i2c_pm_ops,
377368 },
378369 .probe = cros_ec_i2c_probe,
379− .remove = cros_ec_i2c_remove,
380370 .id_table = cros_ec_i2c_id,
381371 };
382372
drivers/platform/chrome/cros_ec_lpc.c+0−4
@@ -327,7 +327,6 @@ static int cros_ec_lpc_probe(struct platform_device *pdev) · 326 unmodified lines
327327
328328 static int cros_ec_lpc_remove(struct platform_device *pdev)
329329 {
330− struct cros_ec_device *ec_dev;
331330 struct acpi_device *adev;
332331
333332 adev = ACPI_COMPANION(&pdev->dev);
@@ -335,9 +334,6 @@ static int cros_ec_lpc_remove(struct platform_device *pdev) · 1 unmodified line
335334 acpi_remove_notify_handler(adev->handle, ACPI_ALL_NOTIFY,
336335 cros_ec_lpc_acpi_notify);
337336
338− ec_dev = platform_get_drvdata(pdev);
339− cros_ec_remove(ec_dev);
340−
341337 return 0;
342338 }
343339
drivers/platform/chrome/cros_ec_spi.c+0−11
@@ -685,16 +685,6 @@ static int cros_ec_spi_probe(struct spi_device *spi) · 684 unmodified lines
685685 return 0;
686686 }
687687
688−static int cros_ec_spi_remove(struct spi_device *spi)
689−{
690− struct cros_ec_device *ec_dev;
691−
692− ec_dev = spi_get_drvdata(spi);
693− cros_ec_remove(ec_dev);
694−
695− return 0;
696−}
697−
698688 #ifdef CONFIG_PM_SLEEP
699689 static int cros_ec_spi_suspend(struct device *dev)
700690 {
@@ -733,7 +723,6 @@ static struct spi_driver cros_ec_driver_spi = { · 32 unmodified lines
733723 .pm = &cros_ec_spi_pm_ops,
734724 },
735725 .probe = cros_ec_spi_probe,
736− .remove = cros_ec_spi_remove,
737726 .id_table = cros_ec_spi_id,
738727 };
739728
include/linux/mfd/cros_ec.h+0−10
@@ -281,16 +281,6 @@ int cros_ec_cmd_xfer(struct cros_ec_device *ec_dev, · 280 unmodified lines
281281 int cros_ec_cmd_xfer_status(struct cros_ec_device *ec_dev,
282282 struct cros_ec_command *msg);
283283
284−/**
285− * cros_ec_remove() - Remove a ChromeOS EC.
286− * @ec_dev: Device to register.
287− *
288− * Call this to deregister a ChromeOS EC, then clean up any private data.
289− *
290− * Return: 0 on success or negative error code.
291− */
292−int cros_ec_remove(struct cros_ec_device *ec_dev);
293−
294284 /**
295285 * cros_ec_register() - Register a new ChromeOS EC, using the provided info.
296286 * @ec_dev: Device to register.

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t