Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2108454imu; Wed, 12 Dec 2018 09:36:23 -0800 (PST) X-Google-Smtp-Source: AFSGD/W2jHudS1Cd+BRfPSnLraj6B7vIZT0OtUH4zPEcvBN7t575NYmXtXAOJ5wb6ZdEDoL08/Ls X-Received: by 2002:a62:7c47:: with SMTP id x68mr21232525pfc.209.1544636183540; Wed, 12 Dec 2018 09:36:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544636183; cv=none; d=google.com; s=arc-20160816; b=k6IgHI7SecMhgi79UzLt3Db7FYPe79/WQCX9QpIiQ5UQKGNxL2zRxkf2ZygagSvTvO 31QY1zq2h39tJ57S/sTXXDvKT40YkVgymKQh9HAgefhnE6W2ekgYZeTOmV7NdiEKz6CL 7dHV/X1IsEEoKRwAP8Yt7MeLD6z6Qa1XoCJezNrWS7GmryHYrhICy42WtAeXFD1SJfMq 7hipBqC9jaAmIJGPX9INg9acpt84NYqzFISenJL4Fm1klgvOEnsoOzT/haCjkGiFG+BU 8JaumX/PJScFMEqO6WmXDm53v3/T1oKppv2relZCNIlmKpAxx0ULqpMws0i5LDMWqV05 RXdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=6uXYsHGey3CDDAqobGEGEoX2JSfQ7J34KpuOpqqqakM=; b=mtFbVEYONmWe+TRxGowNBndYGci/Aded4rpvdyfnraD2j9qoQ8qDJ8JPCWfB+/bHmJ hqVxS5u+5y90+pC7PxWgxWn7BAfpI5kxtw4srYauyh/ZK+uDQ5SS3uX6TD9BV8AxOPdD V6REfT1o0d5gn28Nf/GEMdvWVSogB/pFQx2xG0B9V8YGmOnLfzL1hXwedAcwMN/XZQ3F QpiIf2d1dY/Dq9cl5nuoVYdttlNrF2VCdbUk0EApUB/PVt7css1OJIlIaCR+zo0F6Wl9 OfieBeTQnnq3qGxr06NuEPvVE7F2k5IKoY5JWKM4MZ4UXzpbxOXHDTF8W2YEz8b8M/3x eZcA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w187si15087714pgb.552.2018.12.12.09.36.08; Wed, 12 Dec 2018 09:36:23 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727917AbeLLReM (ORCPT + 99 others); Wed, 12 Dec 2018 12:34:12 -0500 Received: from bhuna.collabora.co.uk ([46.235.227.227]:54280 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727748AbeLLReL (ORCPT ); Wed, 12 Dec 2018 12:34:11 -0500 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: eballetbo) with ESMTPSA id AEE2527D85B From: Enric Balletbo i Serra To: lee.jones@linaro.org Cc: gwendal@chromium.org, drinkcat@chromium.org, linux-kernel@vger.kernel.org, groeck@chromium.org, kernel@collabora.com, bleung@chromium.org Subject: [PATCH v5 1/7] mfd / platform: cros_ec: use devm_mfd_add_devices Date: Wed, 12 Dec 2018 18:33:56 +0100 Message-Id: <20181212173402.27086-2-enric.balletbo@collabora.com> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181212173402.27086-1-enric.balletbo@collabora.com> References: <20181212173402.27086-1-enric.balletbo@collabora.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Reviewed-by: Guenter Roeck --- Changes in v5: None Changes in v4: - Added Reviewed-by tags. - Moved mfd_remove_devices to another patch, it's already queued in Lee's tree. - Removed patch 8 from the series, was a fix and it's already applied in current mainline. 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/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 ---------- 5 files changed, 3 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/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 de8b588c8776..977ebaa78e99 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.2