Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1104437pxu; Wed, 6 Jan 2021 12:22:33 -0800 (PST) X-Google-Smtp-Source: ABdhPJxUOVUVKLRJ8CZetyJcK4iu+lqyI8fzsIdICIe/CVOTGK1Jt9LWkZ1u6k+zhbQmWfzk6WK2 X-Received: by 2002:a17:906:d93c:: with SMTP id rn28mr4009758ejb.50.1609964553273; Wed, 06 Jan 2021 12:22:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609964553; cv=none; d=google.com; s=arc-20160816; b=mDyrh47r7x2c8YB8F2W9BZ5ZQBcFdAvRleqYTN2ekWwM9n+kqAeOvUFZBO9a/cfUXH lykQUOb6clkzDtHLWK/D0EpWWP5Juxq+hbZ/djv+0/8fMYa//4R+PeatNu66Cq1VaEAg Cbd6GvZtFhGjTg98BEIdaAcyyLuX3kbrBPj9wlaEFuidPk912KY8yn6tWvE7ww3FXqBb ENJm4OglO7ij89KjPKUzUP6IsxO13XzQtTC831o2Jd05HP2w1VhDJf3x2hRpXLecmADs fkLCBmM5xPB25eT5gu4c5eLmMZi8kicKEfqoEWvAWFZdYe0QgGKHL58zjhsQhPXjLxIG NwhA== 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=nprEptLxVNqdloP1/Mk7TOCuqlk+AMunVb4b0FuqKSg=; b=DnG7M9Z6U2v8sWVdmhARFI7jVHJVx0LlrBTwFboSlEwiwFq7sJkiyg7U3/tohAs0h4 CCD5U83Sn1uUGfZchFyJGxjsf+eLegYSkaYmZp0ydqh4Xd8F7Cumwkd6NKTEtUHATvU0 p05NPQV1yN+vtMVpmiqOIldTNRlJMEcVEld6dpUXtFoFB7KU4XZnvGbXA3aZPzB8Hkbo LgqZsbKLH30+OGCWdG/KvPD7Jw03/Hv2uPiMPjMfAXU40gAyWPxRkBaUqVhyDq6kbk7t TqHnqpah84M23o2COtPlxStGcjOxz04PVY/6z2jhqD6rhI8yx/pkR/A77HGdG7Ip+x2s zxNw== 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 p23si1250460ejf.90.2021.01.06.12.22.09; Wed, 06 Jan 2021 12:22:33 -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 S1727870AbhAFUTU (ORCPT + 99 others); Wed, 6 Jan 2021 15:19:20 -0500 Received: from foss.arm.com ([217.140.110.172]:47214 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727861AbhAFUTS (ORCPT ); Wed, 6 Jan 2021 15:19:18 -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 508781576; Wed, 6 Jan 2021 12:18:12 -0800 (PST) Received: from e120937-lin.home (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 42CB63F719; Wed, 6 Jan 2021 12:18:10 -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 31/37] firmware: arm_scmi: make references to handle const Date: Wed, 6 Jan 2021 20:16:04 +0000 Message-Id: <20210106201610.26538-32-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 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 c16455cff6a9..6c05e8acafac 100644 --- a/include/linux/scmi_protocol.h +++ b/include/linux/scmi_protocol.h @@ -622,9 +622,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; -- 2.17.1