From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 84E8EC433DB for ; Tue, 16 Mar 2021 17:06:00 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B315D6507D for ; Tue, 16 Mar 2021 17:05:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B315D6507D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:MIME-Version:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:References:In-Reply-To:Message-Id:Date:Subject:Cc:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=GdTaR3K5OlXhxBPNa3DQSd6qfdVl2ZrIwCfZe3hrKBU=; b=XFz8RxLXHCDYA7Wo6ngGUi49oa V3OJ73ZFZ7VGVJIiiULpkLi4mHDxs2DoJ3IupaJa6ka25aaf2WSxjAEGIpQg1X9yfmy1QYGpLofcL 1svF6kFP4aItM2rD/pokw81Z5RByZqCI+iWF631HP5N003fnOeUJjNdvCiWnjZpayX5r9j2+4UR44 Idvanf/L848AopYLpMnYC+XQFGsaRMknglnzJJyD3oG2iG18oMki2fLTCOuq8wjEnEs0wN1/vWQ8g 2C+4l5lQPSkRBxzsArt7ZLbBo5mz3UZ1xJdXg/fk27LmG85kamdInsp7F49OhA9ugo3QyczYiSLLJ XSpx+K4Q==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lMD76-001JxG-Gq; Tue, 16 Mar 2021 17:04:12 +0000 Received: from casper.infradead.org ([90.155.50.34]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lMD4L-001HDR-3i for linux-arm-kernel@desiato.infradead.org; Tue, 16 Mar 2021 17:01:21 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description; bh=vzlovrn73dK4BzREzDF3+IDNh8Q6EwOefCm7DcnrpGs=; b=v0PKsNhqDgXNycb3LOobechyop nM49NptkwDX+lGMirSDvXutRrRjRQb4I7gJgTIQ2DUvkapSuYop1kX8QJbaWa0qx0M4kywnwF6mym EmNM47uox80TQqfEwj5DpVgtAHCVPXjTpAOPIxdOBjt0aypsZ2KVlDRihsF5Hx0+SiZIJpJBOK2Ey ujlC9P55Bqh6oUXavclV8BPgIaZ8a0nSXtLEAmCrQzmgfIBZFVjydtHJpocoERwyvqbhmzKmcL520 5bg7Bd+5tx1p0qR3RGzHCwtAXjJchFyCZx2e77J0U9WZY6C1JvcfyWtk6p/A3QLVbQPz9FL6QaxZj ogOuzg9w==; Received: from foss.arm.com ([217.140.110.172]) by casper.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lM9Cu-0003zP-IV for linux-arm-kernel@lists.infradead.org; Tue, 16 Mar 2021 12:54:27 +0000 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 5EA6C153B; Tue, 16 Mar 2021 05:50:19 -0700 (PDT) Received: from e120937-lin.home (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 446AB3F792; Tue, 16 Mar 2021 05:50:17 -0700 (PDT) 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 v7 27/38] firmware: arm_scmi: port SystemPower protocol to new protocols interface Date: Tue, 16 Mar 2021 12:48:52 +0000 Message-Id: <20210316124903.35011-28-cristian.marussi@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210316124903.35011-1-cristian.marussi@arm.com> References: <20210316124903.35011-1-cristian.marussi@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210316_125406_817756_EF6B49B0 X-CRM114-Status: GOOD ( 12.84 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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 9d016dff4be5..ca6fb4698963 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, + .instance_init = &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 3ec0ac30fe60..17b82c76cf7a 100644 --- a/include/linux/scmi_protocol.h +++ b/include/linux/scmi_protocol.h @@ -629,7 +629,6 @@ struct scmi_handle { /* for protocol internal use */ void *voltage_priv; void *notify_priv; - void *system_priv; }; enum scmi_std_protocol { -- 2.17.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel