Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752947AbdHGLTI (ORCPT ); Mon, 7 Aug 2017 07:19:08 -0400 Received: from regular1.263xmail.com ([211.150.99.140]:60321 "EHLO regular1.263xmail.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752835AbdHGLTG (ORCPT ); Mon, 7 Aug 2017 07:19:06 -0400 X-263anti-spam: KSV:0; X-MAIL-GRAY: 0 X-MAIL-DELIVERY: 1 X-KSVirus-check: 0 X-ABS-CHECKED: 4 X-RL-SENDER: jeffy.chen@rock-chips.com X-FST-TO: bleung@chromium.org X-SENDER-IP: 103.29.142.67 X-LOGIN-NAME: jeffy.chen@rock-chips.com X-UNIQUE-TAG: X-ATTACHMENT-NUM: 0 X-DNS-TYPE: 0 From: Jeffy Chen To: bleung@chromium.org Cc: Jeffy Chen , Olof Johansson , linux-kernel@vger.kernel.org Subject: [PATCH] platform/chrome: cros_ec_dev - Use devm_mfd_add_devices Date: Mon, 7 Aug 2017 19:18:54 +0800 Message-Id: <1502104734-32459-1-git-send-email-jeffy.chen@rock-chips.com> X-Mailer: git-send-email 2.1.4 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1430 Lines: 41 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 --- drivers/platform/chrome/cros_ec_dev.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/platform/chrome/cros_ec_dev.c b/drivers/platform/chrome/cros_ec_dev.c index cf6c4f0..349ea60 100644 --- a/drivers/platform/chrome/cros_ec_dev.c +++ b/drivers/platform/chrome/cros_ec_dev.c @@ -376,8 +376,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.1.4