From patchwork Wed Dec 2 20:40:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cristian Marussi X-Patchwork-Id: 11947261 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=-18.2 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 55BA6C6369E for ; Wed, 2 Dec 2020 22:02:33 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 D1F7F221FD for ; Wed, 2 Dec 2020 22:02:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D1F7F221FD 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=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:MIME-Version:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:References:In-Reply-To:Message-Id:Date:Subject:To: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=/zywnn1O11o9pJ09HZ6GbSLXXyMY1OtoMx0b3UVEUWg=; b=CuqKBFjOLfCbweV0lRguf82r5/ pmk6M2X5FTbXkNLX7p4yDUjKGBcmIPucykZ8YyjEeaMBd30G8byjUeMk39kker5Y4LIyedW8UpGYp PuREhHrINa3Wco+vvWGElYHVVEHm968h84cYM220dmuE0i9m54dQTauokxYoFQnLXwDAwIbNec7k/ Nazwm3P9wu1v1FFjZ8nWHfProio3VYbm9pmB2UMMzPPGwhYa5KFy4f3Xacnpc9dFoC5BhEPDZ7oBR s6ApQX+czrKhpm+theuE4zchjs/p1i3T+HzFjwpxq9/8+guypf+Rms2HY0TyJ6896CsB+HaicDuEt +C39GRpg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kkaBs-00032R-Fo; Wed, 02 Dec 2020 22:01:36 +0000 Received: from foss.arm.com ([217.140.110.172]) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kkYwN-0002b4-5H for linux-arm-kernel@lists.infradead.org; Wed, 02 Dec 2020 20:41:35 +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 0E78A15AB; Wed, 2 Dec 2020 12:41:31 -0800 (PST) Received: from e120937-lin.home (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 495A83F575; Wed, 2 Dec 2020 12:41:29 -0800 (PST) From: Cristian Marussi To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v3 31/37] firmware: arm_scmi: make references to handle const Date: Wed, 2 Dec 2020 20:40:03 +0000 Message-Id: <20201202204009.32073-32-cristian.marussi@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201202204009.32073-1-cristian.marussi@arm.com> References: <20201202204009.32073-1-cristian.marussi@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201202_154132_276577_D2364059 X-CRM114-Status: GOOD ( 13.75 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: f.fainelli@gmail.com, vincent.guittot@linaro.org, sudeep.holla@arm.com, thara.gopinath@linaro.org, Cristian Marussi , james.quinlan@broadcom.com, Jonathan.Cameron@Huawei.com, souvik.chakravarty@arm.com, etienne.carriere@linaro.org, lukasz.luba@arm.com MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Now that all the protocol private variable data have been moved out of struct scmi_handle, mark all of its references as const. Signed-off-by: Cristian Marussi --- drivers/firmware/arm_scmi/common.h | 4 ++-- drivers/firmware/arm_scmi/driver.c | 12 ++++++------ include/linux/scmi_protocol.h | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/firmware/arm_scmi/common.h b/drivers/firmware/arm_scmi/common.h index c7b48f1e5fe0..45387a32d79e 100644 --- a/drivers/firmware/arm_scmi/common.h +++ b/drivers/firmware/arm_scmi/common.h @@ -274,8 +274,8 @@ void __exit scmi_##name##_unregister(void) \ const struct scmi_protocol *scmi_get_protocol(int protocol_id); -int scmi_acquire_protocol(struct scmi_handle *handle, u8 protocol_id); -void scmi_release_protocol(struct scmi_handle *handle, u8 protocol_id); +int scmi_acquire_protocol(const struct scmi_handle *handle, u8 protocol_id); +void scmi_release_protocol(const struct scmi_handle *handle, u8 protocol_id); /* SCMI Transport */ /** diff --git a/drivers/firmware/arm_scmi/driver.c b/drivers/firmware/arm_scmi/driver.c index b76c06b8bbc3..68a40d83325c 100644 --- a/drivers/firmware/arm_scmi/driver.c +++ b/drivers/firmware/arm_scmi/driver.c @@ -729,7 +729,7 @@ scmi_get_revision_area(const struct scmi_protocol_handle *ph) * Return: A reference to an initialized protocol instance or error on failure. */ static struct scmi_protocol_instance * __must_check -scmi_get_protocol_instance(struct scmi_handle *handle, u8 protocol_id) +scmi_get_protocol_instance(const struct scmi_handle *handle, u8 protocol_id) { int ret = -ENOMEM; void *gid; @@ -808,7 +808,7 @@ scmi_get_protocol_instance(struct scmi_handle *handle, u8 protocol_id) * * Return: 0 if protocol was acquired successfully. */ -int scmi_acquire_protocol(struct scmi_handle *handle, u8 protocol_id) +int scmi_acquire_protocol(const struct scmi_handle *handle, u8 protocol_id) { return PTR_ERR_OR_ZERO(scmi_get_protocol_instance(handle, protocol_id)); } @@ -821,7 +821,7 @@ int scmi_acquire_protocol(struct scmi_handle *handle, u8 protocol_id) * Remove one user for the specified protocol and triggers de-initialization * and resources de-allocation once the last user has gone. */ -void scmi_release_protocol(struct scmi_handle *handle, u8 protocol_id) +void scmi_release_protocol(const struct scmi_handle *handle, u8 protocol_id) { struct scmi_info *info = handle_to_scmi_info(handle); struct scmi_protocol_instance *pi; @@ -866,7 +866,7 @@ void scmi_release_protocol(struct scmi_handle *handle, u8 protocol_id) * Must be checked for errors by caller. */ static const void __must_check * -scmi_get_protocol_operations(struct scmi_handle *handle, u8 protocol_id, +scmi_get_protocol_operations(const struct scmi_handle *handle, u8 protocol_id, struct scmi_protocol_handle **ph) { struct scmi_protocol_instance *pi; @@ -908,7 +908,7 @@ scmi_is_protocol_implemented(const struct scmi_handle *handle, u8 prot_id) } struct scmi_protocol_devres { - struct scmi_handle *handle; + const struct scmi_handle *handle; u8 protocol_id; }; @@ -943,7 +943,7 @@ scmi_devm_get_protocol_ops(struct scmi_device *sdev, u8 protocol_id, { struct scmi_protocol_instance *pi; struct scmi_protocol_devres *dres; - struct scmi_handle *handle = sdev->handle; + const struct scmi_handle *handle = sdev->handle; if (!ph) return ERR_PTR(-EINVAL); diff --git a/include/linux/scmi_protocol.h b/include/linux/scmi_protocol.h index 2687778a8a1f..397af71bb07d 100644 --- a/include/linux/scmi_protocol.h +++ b/include/linux/scmi_protocol.h @@ -621,9 +621,9 @@ struct scmi_handle { void (*devm_put_ops)(struct scmi_device *sdev, u8 proto); const void __must_check * - (*get_ops)(struct scmi_handle *handle, u8 proto, + (*get_ops)(const struct scmi_handle *handle, u8 proto, struct scmi_protocol_handle **ph); - void (*put_ops)(struct scmi_handle *handle, u8 proto); + void (*put_ops)(const struct scmi_handle *handle, u8 proto); const struct scmi_notify_ops *notify_ops; void *notify_priv;