Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp389167ybe; Mon, 2 Sep 2019 03:19:37 -0700 (PDT) X-Google-Smtp-Source: APXvYqypyOr0GKLUdL6sSsJCrGNreeW8oMiHXKoqf/hKsxPdxo2r/2pOwvYKHooyLZ+bWNaw6tY7 X-Received: by 2002:a65:4841:: with SMTP id i1mr3666297pgs.316.1567419577009; Mon, 02 Sep 2019 03:19:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567419577; cv=none; d=google.com; s=arc-20160816; b=Ei3QFRDLW+cxsK65Sp5TJcDWVi6k5aNUu+fIBfMW8k1cWYefXP0XV2OFfMT61iYtzU bZhaId2h7zNnzI+c8prFsOnnTfq5o9wuVRT0c7bYN9VnuJ+1RQtzL1J5UyZstCZuPKQp rLWE8K/jppaqS2D9NVdGPPY6ygr3O1RgNs8Btb0jsxpFwsz3aMBRA5+Ug7DieUWcLllo 30uFL+k6Tu4Yii+0WatoMfqQmb2qtYNN1TcWiRkz6PBy+4xkpXkgAPKRNlhs47xP69Sw hc5VfuW/NTSirspaCxOa2NdiTtHM33Dsg7VdXOm4bcaZGHx0F8dvlcGcuuVmnVtNN2xA jW3A== 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=qreyzgVZLe0AcU2ZEkN/fv+rUDE9iyKlv36CzQG4wH8=; b=EWwnMobFpFJJcRYj3nLPQGURN0q4NWd+33PGauFjJIh+KVxbaLSYlHv0wFicDrvH4N yA8d7nTpOMaUuXXj8GBQvJoigDMNCn61sqwt2SZF1qvXWtdc43lsnOAhv6yKQpZzwcAP LSzkHMOlYyePuotuAH1Wcqcov5KGzCOEMAzyq9wG8TO5nozPIFp8nXO9mC1fMcAs8CKr jyJbNJNcCFA7R1/h99UsyWaVOioOT/H//pBc+KgBMWIu61Hw8ve9o2P4jLssP+ljzFwD +UmozOQIKXYgo3EXTmbm0EbzUjRcu3PR1wLqf5HloHBo9o4GzObWmzeaGQK+ISP+rRnO 0Q/A== 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 a123si14250671pfd.114.2019.09.02.03.19.21; Mon, 02 Sep 2019 03:19:36 -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 S1731410AbfIBJxj (ORCPT + 99 others); Mon, 2 Sep 2019 05:53:39 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:46878 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731397AbfIBJxg (ORCPT ); Mon, 2 Sep 2019 05:53:36 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: eballetbo) with ESMTPSA id 634B128CB74 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 , arnd@arndb.de, Gwendal Grignou Subject: [PATCH v7 10/10] mfd: cros_ec: Use mfd_add_hotplug_devices() helper Date: Mon, 2 Sep 2019 11:53:09 +0200 Message-Id: <20190902095309.18574-11-enric.balletbo@collabora.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190902095309.18574-1-enric.balletbo@collabora.com> References: <20190902095309.18574-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 Acked-for-MFD-by: Lee Jones --- Changes in v7: None 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