Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1104720pxu; Wed, 6 Jan 2021 12:22:58 -0800 (PST) X-Google-Smtp-Source: ABdhPJwfSEgBAHgmYvSodrnI5qKYV+hqOEpV0FIeBqD9ySWTxnmQTwFc7MB2YYd7SGj4EcFSE7SL X-Received: by 2002:a05:6402:7d7:: with SMTP id u23mr4936829edy.325.1609964578314; Wed, 06 Jan 2021 12:22:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609964578; cv=none; d=google.com; s=arc-20160816; b=aYkyLp3NcURTiYhsyIWHkAI+1aG6NmrYLjYtBUzN3wtcNaYbcPiuADotidAavqmjvi RMTjLmc8gWyiXyDgp4Ktbq4rBKuo3AI/1JLvrQWN5bcVvmWfTglQlB9AFTtbvilkWw2S AnLFScNat1q8KkZq1cpj1r9X3Z2WlRa4EHDOip5EEpHs2jgwNKu9D29vTJZmqnCoNpGJ n3KJD3lD/yyzHurIDRsj54zaO8+TyV0cgFz8ZEUkbAAguSDUq3y/Ynp/mZ1cPrGVD4a+ CEC1UpMtDij+XUuiKypD6dMfXBd17thXqgGVvx+DgXG6utn904scw/2Uk7V9FOiazbu3 ZfGw== 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=XnmDf3IJTU47GgEY8lSH1PMjvWqIyNz8x2C+uuZELII=; b=OVdjmpu9lyKUVLn9Al8OzV+TluQ515qo+IoDDFES+80dE7uZkX3RvwTThbhdsosG8S gNUuLbzoLMMyoy1bGpGYv7gDxfbAc7/OU3wnqDpykMcd0WcWrQ6fmC7QBkmt9bP2LlH1 EiD2AQ4GcQW0dPCNIFftx4M7ohKz/MUVkKTfkcszJDM6b1da/i9Hv6DdSOgPZ9+NJBQt zJywWU0217kY5eAwgK6kL/bH2ely/se6TfCBLj3zRxagK4z954raXX5wyCx9yo4n8lV6 LsQC1nN25C1SxFP89bZznt2u/rKKDW+KmZ+rr5fmPUz9VLRvvXcLH96kYMokS/zdwvky Rq9g== 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 l8si1307759edt.265.2021.01.06.12.22.34; Wed, 06 Jan 2021 12:22:58 -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 S1728033AbhAFUUP (ORCPT + 99 others); Wed, 6 Jan 2021 15:20:15 -0500 Received: from foss.arm.com ([217.140.110.172]:47210 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727824AbhAFUTQ (ORCPT ); Wed, 6 Jan 2021 15:19:16 -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 95077152B; Wed, 6 Jan 2021 12:18:02 -0800 (PST) Received: from e120937-lin.home (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id CCD223F719; Wed, 6 Jan 2021 12:17:59 -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 27/37] firmware: arm_scmi: port SystemPower protocol to new protocols interface Date: Wed, 6 Jan 2021 20:16:00 +0000 Message-Id: <20210106201610.26538-28-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 Convert internals of protocol implementation to use protocol handles and expose a new protocol operations interface for SCMI driver using the new get/put common operations. Remove handle->system_priv now unused. Signed-off-by: Cristian Marussi --- drivers/firmware/arm_scmi/system.c | 30 ++++++++++++++---------------- include/linux/scmi_protocol.h | 1 - 2 files changed, 14 insertions(+), 17 deletions(-) diff --git a/drivers/firmware/arm_scmi/system.c b/drivers/firmware/arm_scmi/system.c index 6690610c2c26..a23c1f505b56 100644 --- a/drivers/firmware/arm_scmi/system.c +++ b/drivers/firmware/arm_scmi/system.c @@ -32,40 +32,40 @@ struct scmi_system_info { u32 version; }; -static int scmi_system_request_notify(const struct scmi_handle *handle, +static int scmi_system_request_notify(const struct scmi_protocol_handle *ph, bool enable) { int ret; struct scmi_xfer *t; struct scmi_system_power_state_notify *notify; - ret = scmi_xfer_get_init(handle, SYSTEM_POWER_STATE_NOTIFY, - SCMI_PROTOCOL_SYSTEM, sizeof(*notify), 0, &t); + ret = ph->xops->xfer_get_init(ph, SYSTEM_POWER_STATE_NOTIFY, + sizeof(*notify), 0, &t); if (ret) return ret; notify = t->tx.buf; notify->notify_enable = enable ? cpu_to_le32(BIT(0)) : 0; - ret = scmi_do_xfer(handle, t); + ret = ph->xops->do_xfer(ph, t); - scmi_xfer_put(handle, t); + ph->xops->xfer_put(ph, t); return ret; } -static int scmi_system_set_notify_enabled(const void *handle, +static int scmi_system_set_notify_enabled(const void *ph, u8 evt_id, u32 src_id, bool enable) { int ret; - ret = scmi_system_request_notify(handle, enable); + ret = scmi_system_request_notify(ph, enable); if (ret) pr_debug("FAIL_ENABLE - evt[%X] - ret:%d\n", evt_id, ret); return ret; } -static void *scmi_system_fill_custom_report(const void *handle, +static void *scmi_system_fill_custom_report(const void *ph, u8 evt_id, ktime_t timestamp, const void *payld, size_t payld_sz, void *report, u32 *src_id) @@ -109,29 +109,27 @@ static const struct scmi_protocol_events system_protocol_events = { .num_sources = SCMI_SYSTEM_NUM_SOURCES, }; -static int scmi_system_protocol_init(struct scmi_handle *handle) +static int scmi_system_protocol_init(const struct scmi_protocol_handle *ph) { u32 version; struct scmi_system_info *pinfo; - scmi_version_get(handle, SCMI_PROTOCOL_SYSTEM, &version); + ph->xops->version_get(ph, &version); - dev_dbg(handle->dev, "System Power Version %d.%d\n", + dev_dbg(ph->dev, "System Power Version %d.%d\n", PROTOCOL_REV_MAJOR(version), PROTOCOL_REV_MINOR(version)); - pinfo = devm_kzalloc(handle->dev, sizeof(*pinfo), GFP_KERNEL); + pinfo = devm_kzalloc(ph->dev, sizeof(*pinfo), GFP_KERNEL); if (!pinfo) return -ENOMEM; pinfo->version = version; - handle->system_priv = pinfo; - - return 0; + return ph->set_priv(ph, pinfo); } static const struct scmi_protocol scmi_system = { .id = SCMI_PROTOCOL_SYSTEM, - .init = &scmi_system_protocol_init, + .init_instance = &scmi_system_protocol_init, .ops = NULL, .events = &system_protocol_events, }; diff --git a/include/linux/scmi_protocol.h b/include/linux/scmi_protocol.h index 9da9c866e02c..24972b798f79 100644 --- a/include/linux/scmi_protocol.h +++ b/include/linux/scmi_protocol.h @@ -634,7 +634,6 @@ struct scmi_handle { /* for protocol internal use */ void *voltage_priv; void *notify_priv; - void *system_priv; }; enum scmi_std_protocol { -- 2.17.1