Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1257819ybl; Fri, 23 Aug 2019 16:20:59 -0700 (PDT) X-Google-Smtp-Source: APXvYqxf5lfOyUXszHARI+F+nO+1uQwTTj+e0C8E03Os2+J0H5qcUBuWGOmTZjCYxCFmQVDgRuDr X-Received: by 2002:a63:2807:: with SMTP id o7mr6137173pgo.131.1566602458885; Fri, 23 Aug 2019 16:20:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566602458; cv=none; d=google.com; s=arc-20160816; b=RuwafO7w4Mes2y4uKPc3weH+kLwsytPN53MT7Sxgk7xJsd8Cihy8M3/soOfKIsGNb/ k2ug1l1bfzG+MX7MolwuYbOgKgggQlYsTwyg3xkWBagJNqNtK4sfowbfLTiKShFM+qLH B/cPPU8vlzYh4Jt3W/j3yOOdrT7I0roCw55QqcPY/+8sk1gVf1DeAsQlkk6d77+MZgvO ihVpVKlDW2YgNbw2pStHM307e71BO9FKjwNIc1Fq2uQFf6oyP1rxZgETifW5FWbznyAh KhOcBs5icLu70dGefR2+o4DBMgfFJtoX3G1R5vdPLvkqsN5k13CZkb57R44/ICBwS0JS WgRA== 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=ceYBWFZBS+Z4ehKfKt9pvPp5ZWsjrjDjJQWGVc3atak=; b=sinzrHVniJJhxo5x41t7DIQNyIzAp5o3YDAnXEdkg1MSGzlyfQ7dnulcdhGOy7Dy2X O00HERBrB47BZQW9uw1tVKk1aPu61guMyYHCAZWcOXKxVDIk3LN4+k3H15XFHisfqu69 A+wVv2Nk+TsMzwvaU1/vqU6jB8FZvvzEYiMzgO7qc2PkC19BdPTACTKeVsfjZiJmf56t lH3fMAa+FY/lJ00x5Oz3UJCmbCfPBHlutAr1QlGF7sFJ5e8XS584bsG4vlHdNZBT0rpX uUsEej+iHJY9bEODrJm+C/cZ6Ci/xik3a6p7nRhx8wAd7WXlqiDytrisWP8/SA671KOA Bk8w== 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 v14si3258185pjn.5.2019.08.23.16.20.43; Fri, 23 Aug 2019 16:20:58 -0700 (PDT) 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 S2394953AbfHWMyi (ORCPT + 99 others); Fri, 23 Aug 2019 08:54:38 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:46460 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727894AbfHWMyi (ORCPT ); Fri, 23 Aug 2019 08:54:38 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: eballetbo) with ESMTPSA id A01E626A028 From: Enric Balletbo i Serra To: linux-kernel@vger.kernel.org Cc: Jonathan Corbet , Krzysztof Kozlowski , Will Deacon , MyungJoo Ham , Chanwoo Choi , Benson Leung , Guenter Roeck , Jonathan Cameron , Dmitry Torokhov , Mauro Carvalho Chehab , Lee Jones , Sebastian Reichel , Thierry Reding , Alexandre Belloni , Liam Girdwood , Mark Brown , Neil Armstrong , Greg Kroah-Hartman , Collabora kernel ML , Gwendal Grignou Subject: [PATCH v6 10/11] mfd: cros_ec: Use mfd_add_hotplug_devices() helper Date: Fri, 23 Aug 2019 14:53:30 +0200 Message-Id: <20190823125331.5070-11-enric.balletbo@collabora.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190823125331.5070-1-enric.balletbo@collabora.com> References: <20190823125331.5070-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 mfd_add_hotplug_devices() helper to register the subdevices. The helper allows us to reduce the boiler plate and also registers the subdevices in the same way as used in other functions used in this files. Signed-off-by: Enric Balletbo i Serra Reviewed-by: Gwendal Grignou Tested-by: Gwendal Grignou --- Changes in v6: - Improve patch description stating the reason of the change (Lee Jones) Changes in v5: None Changes in v4: None Changes in v3: - Add a new patch to use mfd_add_hoplug_devices to register subdevices Changes in v2: None drivers/mfd/cros_ec_dev.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/drivers/mfd/cros_ec_dev.c b/drivers/mfd/cros_ec_dev.c index 90eb02c56b77..6e6dfd6c1871 100644 --- a/drivers/mfd/cros_ec_dev.c +++ b/drivers/mfd/cros_ec_dev.c @@ -329,10 +329,8 @@ static void cros_ec_accel_legacy_register(struct cros_ec_dev *ec) * Register 2 accelerometers, we will fail in the IIO driver if there * are no sensors. */ - ret = mfd_add_devices(ec->dev, PLATFORM_DEVID_AUTO, - cros_ec_accel_legacy_cells, - ARRAY_SIZE(cros_ec_accel_legacy_cells), - NULL, 0, NULL); + ret = mfd_add_hotplug_devices(ec->dev, cros_ec_accel_legacy_cells, + ARRAY_SIZE(cros_ec_accel_legacy_cells)); if (ret) dev_err(ec_dev->dev, "failed to add EC sensors\n"); } @@ -419,10 +417,8 @@ static int ec_device_probe(struct platform_device *pdev) * The following subdevices cannot be detected by sending the * EC_FEATURE_GET_CMD to the Embedded Controller device. */ - retval = mfd_add_devices(ec->dev, PLATFORM_DEVID_AUTO, - cros_ec_platform_cells, - ARRAY_SIZE(cros_ec_platform_cells), - NULL, 0, NULL); + retval = mfd_add_hotplug_devices(ec->dev, cros_ec_platform_cells, + ARRAY_SIZE(cros_ec_platform_cells)); if (retval) dev_warn(ec->dev, "failed to add cros-ec platform devices: %d\n", @@ -431,10 +427,8 @@ static int ec_device_probe(struct platform_device *pdev) /* Check whether this EC instance has a VBC NVRAM */ node = ec->ec_dev->dev->of_node; if (of_property_read_bool(node, "google,has-vbc-nvram")) { - retval = mfd_add_devices(ec->dev, PLATFORM_DEVID_AUTO, - cros_ec_vbc_cells, - ARRAY_SIZE(cros_ec_vbc_cells), - NULL, 0, NULL); + retval = mfd_add_hotplug_devices(ec->dev, cros_ec_vbc_cells, + ARRAY_SIZE(cros_ec_vbc_cells)); if (retval) dev_warn(ec->dev, "failed to add VBC devices: %d\n", retval); -- 2.20.1