linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Guenter Roeck <groeck@google.com>
To: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Cc: Lee Jones <lee.jones@linaro.org>,
	Gwendal Grignou <gwendal@chromium.org>,
	Nicolas Boichat <drinkcat@chromium.org>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	Guenter Roeck <groeck@chromium.org>,
	kernel@collabora.com, Benson Leung <bleung@chromium.org>,
	Olof Johansson <olof@lixom.net>
Subject: Re: [PATCH v3 1/8] mfd / platform: cros_ec: use devm_mfd_add_devices.
Date: Thu, 29 Nov 2018 15:30:54 -0800	[thread overview]
Message-ID: <CABXOdTe0-0rVGcSc9pczkTVTQuZxbuG1hXOJXrXs1sfVgQ4W3A@mail.gmail.com> (raw)
In-Reply-To: <20181127121849.23975-2-enric.balletbo@collabora.com>

On Tue, Nov 27, 2018 at 4:18 AM Enric Balletbo i Serra
<enric.balletbo@collabora.com> wrote:
>
> 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>

> ---
>
> Changes in v3:
> - Removed cros_ec_remove from include file.
>
> Changes in v2:
> - Use devm only for the cros-ec core.
>
>  drivers/mfd/cros_ec.c                 | 14 +++-----------
>  drivers/mfd/cros_ec_dev.c             |  1 +
>  drivers/platform/chrome/cros_ec_i2c.c | 10 ----------
>  drivers/platform/chrome/cros_ec_lpc.c |  4 ----
>  drivers/platform/chrome/cros_ec_spi.c | 11 -----------
>  include/linux/mfd/cros_ec.h           | 10 ----------
>  6 files changed, 4 insertions(+), 46 deletions(-)
>
> diff --git a/drivers/mfd/cros_ec.c b/drivers/mfd/cros_ec.c
> index fe6f83766144..6acfe036d522 100644
> --- a/drivers/mfd/cros_ec.c
> +++ b/drivers/mfd/cros_ec.c
> @@ -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)
>  {
> diff --git a/drivers/mfd/cros_ec_dev.c b/drivers/mfd/cros_ec_dev.c
> index 8f9d6964173e..ff788d3e6d5f 100644
> --- a/drivers/mfd/cros_ec_dev.c
> +++ b/drivers/mfd/cros_ec_dev.c
> @@ -493,6 +493,7 @@ static int ec_device_remove(struct platform_device *pdev)
>
>         cros_ec_debugfs_remove(ec);
>
> +       mfd_remove_devices(ec->dev);
>         cdev_del(&ec->cdev);
>         device_unregister(&ec->class_dev);
>         return 0;
> diff --git a/drivers/platform/chrome/cros_ec_i2c.c b/drivers/platform/chrome/cros_ec_i2c.c
> index ef9b4763356f..9a009eaa4ada 100644
> --- a/drivers/platform/chrome/cros_ec_i2c.c
> +++ b/drivers/platform/chrome/cros_ec_i2c.c
> @@ -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,
>  };
>
> diff --git a/drivers/platform/chrome/cros_ec_lpc.c b/drivers/platform/chrome/cros_ec_lpc.c
> index e1b75775cd4a..14684a56e40f 100644
> --- a/drivers/platform/chrome/cros_ec_lpc.c
> +++ b/drivers/platform/chrome/cros_ec_lpc.c
> @@ -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;
>  }
>
> diff --git a/drivers/platform/chrome/cros_ec_spi.c b/drivers/platform/chrome/cros_ec_spi.c
> index 2060d1483043..6cfbc2835beb 100644
> --- a/drivers/platform/chrome/cros_ec_spi.c
> +++ b/drivers/platform/chrome/cros_ec_spi.c
> @@ -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,
>  };
>
> diff --git a/include/linux/mfd/cros_ec.h b/include/linux/mfd/cros_ec.h
> index e44e3ec8a9c7..706dd724de52 100644
> --- a/include/linux/mfd/cros_ec.h
> +++ b/include/linux/mfd/cros_ec.h
> @@ -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.
> --
> 2.19.1
>

  reply	other threads:[~2018-11-29 23:31 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-27 12:18 [PATCH v3 0/8] mfd / platform: cros_ec: move cros_ec sysfs attributes to its own drivers Enric Balletbo i Serra
2018-11-27 12:18 ` [PATCH v3 1/8] mfd / platform: cros_ec: use devm_mfd_add_devices Enric Balletbo i Serra
2018-11-29 23:30   ` Guenter Roeck [this message]
2018-12-03 10:32   ` Lee Jones
2018-12-03 22:13     ` Enric Balletbo i Serra
2018-12-04  9:22       ` Lee Jones
2018-11-27 12:18 ` [PATCH v3 2/8] mfd / platform: cros_ec: move lightbar attributes to its own driver Enric Balletbo i Serra
2018-11-29 23:34   ` Guenter Roeck
2018-12-03 10:36   ` Lee Jones
2018-12-03 22:21     ` Enric Balletbo i Serra
2018-12-04  9:21       ` Lee Jones
2018-12-04 11:52         ` Enric Balletbo i Serra
2018-12-04 16:57           ` Guenter Roeck
2018-12-05  8:09             ` Lee Jones
2018-12-05  7:25           ` Lee Jones
2018-11-27 12:18 ` [PATCH v3 3/8] mfd / platform: cros_ec: move vbc " Enric Balletbo i Serra
2018-11-29 23:36   ` Guenter Roeck
2018-12-03 10:42   ` Lee Jones
2018-11-27 12:18 ` [PATCH v3 4/8] mfd / platform: cros_ec: move debugfs " Enric Balletbo i Serra
2018-12-03 10:55   ` Lee Jones
2018-12-10 18:04   ` Guenter Roeck
2018-11-27 12:18 ` [PATCH v3 5/8] mfd / platform: cros_ec: move device sysfs " Enric Balletbo i Serra
2018-12-03 10:56   ` Lee Jones
2018-12-10 18:13   ` Guenter Roeck
2018-12-10 18:22     ` Enric Balletbo i Serra
2018-12-10 18:28       ` Guenter Roeck
2018-12-10 21:27         ` Enric Balletbo Serra
2018-12-10 21:50           ` Guenter Roeck
2018-12-10 22:11             ` Enric Balletbo Serra
2018-12-10 22:25               ` Guenter Roeck
2018-11-27 12:18 ` [PATCH v3 6/8] mfd / platform: cros_ec: instantiate only if th EC has a VBC NVRAM Enric Balletbo i Serra
2018-12-03 10:57   ` Lee Jones
2018-12-10 18:15   ` Guenter Roeck
2018-12-10 18:30     ` Guenter Roeck
2018-11-27 12:18 ` [PATCH v3 7/8] platform/chrome: cros_ec_lightbar: instantiate only if the EC has a lightbar Enric Balletbo i Serra
2018-12-10 18:20   ` Guenter Roeck
2018-12-11 11:18     ` Enric Balletbo i Serra
2018-11-27 12:18 ` [PATCH v3 8/8] mfd: cros_ec: add a dev_release empty method Enric Balletbo i Serra
2018-11-27 17:29   ` Guenter Roeck
2018-11-27 17:52     ` Greg Kroah-Hartman
2018-11-29  1:17       ` Guenter Roeck
2018-11-29  7:55         ` Greg Kroah-Hartman
2018-11-29 22:11           ` Enric Balletbo i Serra
2018-11-29 22:28             ` Guenter Roeck
2018-11-30  8:30             ` Greg Kroah-Hartman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CABXOdTe0-0rVGcSc9pczkTVTQuZxbuG1hXOJXrXs1sfVgQ4W3A@mail.gmail.com \
    --to=groeck@google.com \
    --cc=bleung@chromium.org \
    --cc=drinkcat@chromium.org \
    --cc=enric.balletbo@collabora.com \
    --cc=groeck@chromium.org \
    --cc=gwendal@chromium.org \
    --cc=kernel@collabora.com \
    --cc=lee.jones@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=olof@lixom.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).