linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Benson Leung <bleung@chromium.org>
To: jeffy.chen@rock-chips.com, lee.jones@linaro.org,
	linux-kernel@vger.kernel.org
Cc: bleung@chromium.org, bleung@google.com
Subject: [PATCH] mfd: cros_ec_dev - Use devm_mfd_add_devices
Date: Sat, 16 Dec 2017 00:21:31 -0800	[thread overview]
Message-ID: <20171216082131.2581-1-bleung@chromium.org> (raw)

From: Jeffy Chen <jeffy.chen@rock-chips.com>

Currently we are calling mfd_add_devices to add devices without matched
mfd_remove_devices to remove them.

That would cause warning when re-binding cros_ec_dev:

[  123.536192] sysfs: cannot create duplicate filename '/bus/platform/devices/cros-
ec-accel.0'
[  123.536210] ------------[ cut here ]------------
[  123.536223] WARNING: CPU: 3 PID: 156 at fs/sysfs/dir.c:31 sysfs_warn_dup+0x68/0x
84
[  123.536226] Modules linked in:
[  123.536236] CPU: 3 PID: 156 Comm: bash Not tainted 4.13.0-rc3-next-20170731 #216
[  123.536238] Hardware name: Google Kevin (DT)
[  123.536242] task: ffffffc0f28bab80 task.stack: ffffffc0f1b30000
[  123.536247] PC is at sysfs_warn_dup+0x68/0x84
[  123.536251] LR is at sysfs_warn_dup+0x68/0x84

Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
[bleung: resending this patch after the move to mfd from platform/chrome]
Signed-off-by: Benson Leung <bleung@chromium.org>
---
 drivers/mfd/cros_ec_dev.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mfd/cros_ec_dev.c b/drivers/mfd/cros_ec_dev.c
index e4fafdd96e5e..0597a2dca024 100644
--- a/drivers/mfd/cros_ec_dev.c
+++ b/drivers/mfd/cros_ec_dev.c
@@ -377,8 +377,8 @@ static void cros_ec_sensors_register(struct cros_ec_dev *ec)
 		id++;
 	}
 
-	ret = mfd_add_devices(ec->dev, 0, sensor_cells, id,
-			      NULL, 0, NULL);
+	ret = devm_mfd_add_devices(ec->dev, 0, sensor_cells, id,
+				   NULL, 0, NULL);
 	if (ret)
 		dev_err(ec->dev, "failed to add EC sensors\n");
 
-- 
2.15.1.504.g5279b80103-goog

                 reply	other threads:[~2017-12-16  8:21 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20171216082131.2581-1-bleung@chromium.org \
    --to=bleung@chromium.org \
    --cc=bleung@google.com \
    --cc=jeffy.chen@rock-chips.com \
    --cc=lee.jones@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    /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).