Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1104914pxu; Wed, 6 Jan 2021 12:23:17 -0800 (PST) X-Google-Smtp-Source: ABdhPJzXJuHxctDZGugr4U4roKQMcOonBofAOEyNalEJojeXPs2nkPtSzVAt9Xsqrh3SoEIwgKz0 X-Received: by 2002:a17:906:d81:: with SMTP id m1mr4115746eji.550.1609964597435; Wed, 06 Jan 2021 12:23:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609964597; cv=none; d=google.com; s=arc-20160816; b=Wgz8KtVG/nc1Ae+bbhygYzolXpDPR+JfOhF5DDHECn9ZaLZWgcQFo7mFpcfzaa2LqM OGAC+tQz65J+xAz05nFx/9vKB6Goca6VPhNkFHoj/7UYbCI0lRCg+kDp+8KbWK63XAN9 vlcsykm/UQdkG/fGBibf+rk1IHUnKGQC4IJkhhI16zKvni3zczD4DcP+411uDqaFJpE6 6y4/3Hx3W8Sc9Q45VTbHO69382/jWHCZmxR2OLkU+U+VfGnh3FXafmdft1B5pOTdMCkq NEyBDnD/xDzUA0Ed5x4Z11iu671Ln5hs2+DlP/ksc+xvG6dYJffp19jFkOsSApf3ZS4w 5YrQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from; bh=89QX9MwRCKtjD5ZC1+sHZC5tFAzoRfeqUhRp84+pD7w=; b=flK96EV8Z4aE91ZpfeyOX5LoX9kLw+I4JO+2spldRUfAUw0ZeKhJgWsJZ22Asg1+g9 GE2pNiu+8MznmDLkhk4Gjb6FBsZQH0GaqObJ7f+ghLXPnOUVBFhmVbAMND5n1K+bw9Va 9OpOUdpAABP2bucba1CubpJmsRONOk3ysKlSTHFjt20vtCGM4WnD+cLF/6ZqEGBU9RSm flihsNqdsq70DYNaEtqknElnFF5eLp/23fqCdeaUGp/R2CvqbU65cgW7RT1wxqr79sDk kUIHBq7TnCMNoYNVbgMQMYdJQZ8BsII5BYabMKV72q4hUVCYXbBuqiOSK2AiBfsbY0X2 QfNQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id lg10si1319402ejb.120.2021.01.06.12.22.53; Wed, 06 Jan 2021 12:23:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728091AbhAFUVP (ORCPT + 99 others); Wed, 6 Jan 2021 15:21:15 -0500 Received: from foss.arm.com ([217.140.110.172]:46944 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727677AbhAFUSq (ORCPT ); Wed, 6 Jan 2021 15:18:46 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 8A96212FC; Wed, 6 Jan 2021 12:17:48 -0800 (PST) Received: from e120937-lin.home (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id BC1043F719; Wed, 6 Jan 2021 12:17:45 -0800 (PST) From: Cristian Marussi To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: sudeep.holla@arm.com, lukasz.luba@arm.com, james.quinlan@broadcom.com, Jonathan.Cameron@Huawei.com, f.fainelli@gmail.com, etienne.carriere@linaro.org, thara.gopinath@linaro.org, vincent.guittot@linaro.org, souvik.chakravarty@arm.com, cristian.marussi@arm.com Subject: [PATCH v4 22/37] reset: reset-scmi: port driver to the new scmi_reset_proto_ops interface Date: Wed, 6 Jan 2021 20:15:55 +0000 Message-Id: <20210106201610.26538-23-cristian.marussi@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210106201610.26538-1-cristian.marussi@arm.com> References: <20210106201610.26538-1-cristian.marussi@arm.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Port driver to the new SCMI Reset interface based on protocol handles and common devm_get_ops(). Signed-off-by: Cristian Marussi --- drivers/reset/reset-scmi.c | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/drivers/reset/reset-scmi.c b/drivers/reset/reset-scmi.c index 8d3a858e3b19..ec77d40e64ad 100644 --- a/drivers/reset/reset-scmi.c +++ b/drivers/reset/reset-scmi.c @@ -2,7 +2,7 @@ /* * ARM System Control and Management Interface (ARM SCMI) reset driver * - * Copyright (C) 2019 ARM Ltd. + * Copyright (C) 2019-2020 ARM Ltd. */ #include @@ -11,18 +11,20 @@ #include #include +static const struct scmi_reset_proto_ops *reset_ops; + /** * struct scmi_reset_data - reset controller information structure * @rcdev: reset controller entity - * @handle: ARM SCMI handle used for communication with system controller + * @ph: ARM SCMI protocol handle used for communication with system controller */ struct scmi_reset_data { struct reset_controller_dev rcdev; - const struct scmi_handle *handle; + const struct scmi_protocol_handle *ph; }; #define to_scmi_reset_data(p) container_of((p), struct scmi_reset_data, rcdev) -#define to_scmi_handle(p) (to_scmi_reset_data(p)->handle) +#define to_scmi_handle(p) (to_scmi_reset_data(p)->ph) /** * scmi_reset_assert() - assert device reset @@ -37,9 +39,9 @@ struct scmi_reset_data { static int scmi_reset_assert(struct reset_controller_dev *rcdev, unsigned long id) { - const struct scmi_handle *handle = to_scmi_handle(rcdev); + const struct scmi_protocol_handle *ph = to_scmi_handle(rcdev); - return handle->reset_ops->assert(handle, id); + return reset_ops->assert(ph, id); } /** @@ -55,9 +57,9 @@ scmi_reset_assert(struct reset_controller_dev *rcdev, unsigned long id) static int scmi_reset_deassert(struct reset_controller_dev *rcdev, unsigned long id) { - const struct scmi_handle *handle = to_scmi_handle(rcdev); + const struct scmi_protocol_handle *ph = to_scmi_handle(rcdev); - return handle->reset_ops->deassert(handle, id); + return reset_ops->deassert(ph, id); } /** @@ -73,9 +75,9 @@ scmi_reset_deassert(struct reset_controller_dev *rcdev, unsigned long id) static int scmi_reset_reset(struct reset_controller_dev *rcdev, unsigned long id) { - const struct scmi_handle *handle = to_scmi_handle(rcdev); + const struct scmi_protocol_handle *ph = to_scmi_handle(rcdev); - return handle->reset_ops->reset(handle, id); + return reset_ops->reset(ph, id); } static const struct reset_control_ops scmi_reset_ops = { @@ -90,10 +92,15 @@ static int scmi_reset_probe(struct scmi_device *sdev) struct device *dev = &sdev->dev; struct device_node *np = dev->of_node; const struct scmi_handle *handle = sdev->handle; + struct scmi_protocol_handle *ph; - if (!handle || !handle->reset_ops) + if (!handle) return -ENODEV; + reset_ops = handle->devm_get_ops(sdev, SCMI_PROTOCOL_RESET, &ph); + if (IS_ERR(reset_ops)) + return PTR_ERR(reset_ops); + data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); if (!data) return -ENOMEM; @@ -101,8 +108,8 @@ static int scmi_reset_probe(struct scmi_device *sdev) data->rcdev.ops = &scmi_reset_ops; data->rcdev.owner = THIS_MODULE; data->rcdev.of_node = np; - data->rcdev.nr_resets = handle->reset_ops->num_domains_get(handle); - data->handle = handle; + data->rcdev.nr_resets = reset_ops->num_domains_get(ph); + data->ph = ph; return devm_reset_controller_register(dev, &data->rcdev); } -- 2.17.1