From nobody Fri Apr 17 01:47:06 2026 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C45EC378D89 for ; Tue, 24 Feb 2026 10:42:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771929734; cv=none; b=uthk55pKz9SLZ3P3CO/4dZkH/CKpDXj6MiMi2kTXf98rn2DUkosmd8vfSFPMhShVkTUJw99Ny9/nPQczfTFoYbGDZgFf3SGIi9kpO8YEDAobHyMpa9OhsM+YUP9ufNsIw16oC4fnbSOkRqQUNTmZ7sBEDCfrfiov7kXD5dqliD0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771929734; c=relaxed/simple; bh=OkAqLih86eGhs+AlEKWaQ18KBTCIZs5r/UQDwG2RYzs=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=unYJRM3cL0QMxAhDiGJHR3muTgkqUnvIlgVb7ak7TEOO/PixlHKVR5blwTTpe1F9+aLGCkhb+QghDJpRlPeRf7rH+TWgZJQn+7i1ohtVUdjWOhj6PXrZkUR7XE3sBiIoTgQQsmez2cHWuqA+j6L+d144cPXIQ12+23Krz0NFke4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=NBAncbBI; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=CGdN/8eq; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="NBAncbBI"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="CGdN/8eq" Received: from pps.filterd (m0279872.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 61OAFVRm2560561 for ; Tue, 24 Feb 2026 10:42:12 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:date:from:message-id:mime-version :subject:to; s=qcppdkim1; bh=/GqP17qL1C56/w5WwjYrwodd+5ODSw5Cq1R Xmu3/4NI=; b=NBAncbBID0U7GdUe6W7U+YvYxrT2f1OnZIbLJH0vJBhVCPGD/y5 Mh92sJBbNLboWNq2SosudgPTsXITxbJwmeXULp+G6V5XKGOWdKvYMPIZMefHCcCr v1sqihd7jxZlg6vSza4tiwff4vQ2Q+IpD5YSInN4bKlkE6C4zEA6NQh56lzmVc5D KSE2UTZiQdJNYSJLVBr7zesxxk4F3wwTZRqJZpbFI5HzYB74wrku7X5/yj/A4KzD BdSpKrK29atIuoFQQIPmQhQq1U3sxo3cOjD3CfVODIbWX8aa0QKLbi7n6ADWzPMb gzUKBrl5GxKv6r/hhTh9tIMrVrv7DDvBzOw== Received: from mail-qk1-f198.google.com (mail-qk1-f198.google.com [209.85.222.198]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4ch4e393ru-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Tue, 24 Feb 2026 10:42:11 +0000 (GMT) Received: by mail-qk1-f198.google.com with SMTP id af79cd13be357-8c70ed6c849so4488516985a.1 for ; Tue, 24 Feb 2026 02:42:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1771929731; x=1772534531; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=/GqP17qL1C56/w5WwjYrwodd+5ODSw5Cq1RXmu3/4NI=; b=CGdN/8eq1scAn4AYApgniCHq5z/9uBeyqOEVeGhFqM3M0E+4QQmspHvpSksReieyyL gMGMInDJdKVqgsG6GM4SJVkW8ADDR2TSF9NzW0jUj5jKG+YMD5yTGUFXym1+bomFHyMc 2h0PqDNK8rawGZKAGi1cJuZwPtnYC1pz4PhSOBImq5Jo98JifMqVQPRXNiCwGF8fq8hg B8SUIyREcbArldZyPE53HlzM3egv9TqL6EorL/f73ILRU0dQy+YRwXxW8Tu0G9xIwlDR vZgGN4JX2b/p7m9HjuRJQls+nXiEQdskfIsnkBSOzyrF6feGKIKm/zDVQ3goyn1HIcJS 4H+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771929731; x=1772534531; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=/GqP17qL1C56/w5WwjYrwodd+5ODSw5Cq1RXmu3/4NI=; b=MV9uSpve7XLbHlb8DekDEg/lXmCiuw6G3sH7tlqLtIRI8Ke9a0+uBA0+EQb5RLxagi n5VTvfPYBhKGJ6M6amJoCvMhYxKf0CuCW7buIvV9Z5yfMjt26UkB15K9aGKopZ/gas5w 2f4yziKMtJZcIIK1L3nVXjYZ/D5GN5MoCwS6278uVPq4c/gu5fmqDX80WAjtTd9dnHmV RhQQe+iet48hN0N4osLFkaX7UHoiQFpWk9lJ05EwlrOQv5PCvYg2FfNeTNGZZevL3Ha6 n1arnpsjIgscm5SUbnnr3RwcxG7E0ZcYYSUmH8MmhzTVy52fxtO6DyEYVZRw/XvOfDnT cSPg== X-Forwarded-Encrypted: i=1; AJvYcCV1x31jXl0wT7343iHKLrIpgs+tnzwkIm9tz83+4oOAUeS8KQBkkUM/YbGejWTp7Axvf0x/yCwqcImgDw8=@vger.kernel.org X-Gm-Message-State: AOJu0Yx57zV3LZMVPHsS1QDQenWfjQ0CYPba1vHToI5qBsTuUEx44o5L BputDVU8CzUq9cAbxUeSBdmNkMfeezg3ZKvQH+J6ygrT4g6xltnhR1oII4d9mTuHj8qsb4+SsK7 c/PA8bgRuHCT2JJzhVP0UF06Tc9wsQciEqNlOuV+dGYmhCpLKAQVltk+p95VwhcWwYyw= X-Gm-Gg: AZuq6aI8gJkkj9vV0r92uS2PSSwKezfPF7ivJ3s2E9ZCxrRwylroVxq5k3syL7GeDVx 9WCzi2wNgtEMzyCKFIDX/jDHS/2Vud7rdvrodnMSmmSaV3hQ0/rzQzUF4mDPvIGAUkM+GsVwMya mePk3mWz0VqEmjSqVSmPrk87V+75WaEG0xOWpM3WfXy2dwxVPWNQ/1YcJEMrOwilz25FHRG2QjT FseRJ58BpmJjebzli5G//4a+NJEaNtXI94ZQv4kPGiZHAunQdcuNnvOlOH+soTrLC6H6cS7f0kH rNmHQ1U+I4+u3JOSTu3CjMLuankQjAgZolnR/6mk10dPQEX1zpM7xqOzQpFbH9nTlw5VNWLjtNy 8HMqJhl6w8KNjNrcL8199l3ODJVSdJa9cV2HzWw== X-Received: by 2002:a05:620a:28c3:b0:8b2:f2c5:e7f6 with SMTP id af79cd13be357-8cb8ca65f56mr1405654185a.37.1771929730839; Tue, 24 Feb 2026 02:42:10 -0800 (PST) X-Received: by 2002:a05:620a:28c3:b0:8b2:f2c5:e7f6 with SMTP id af79cd13be357-8cb8ca65f56mr1405651385a.37.1771929730265; Tue, 24 Feb 2026 02:42:10 -0800 (PST) Received: from quoll ([178.197.223.140]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-43970d40004sm25676184f8f.21.2026.02.24.02.42.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Feb 2026 02:42:09 -0800 (PST) From: Krzysztof Kozlowski To: Tudor Ambarus , Krzysztof Kozlowski , Sylwester Nawrocki , Chanwoo Choi , Alim Akhtar , Michael Turquette , Stephen Boyd , =?UTF-8?q?Andr=C3=A9=20Draszik?= , Lee Jones , linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Krzysztof Kozlowski , stable@vger.kernel.org Subject: [PATCH v2] firmware: exynos-acpm: Drop fake 'const' on handle pointer Date: Tue, 24 Feb 2026 11:42:04 +0100 Message-ID: <20260224104203.42950-2-krzysztof.kozlowski@oss.qualcomm.com> X-Mailer: git-send-email 2.51.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=14898; i=krzysztof.kozlowski@oss.qualcomm.com; h=from:subject; bh=OkAqLih86eGhs+AlEKWaQ18KBTCIZs5r/UQDwG2RYzs=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBpnYB7V7tGPImL9hJcV0yofAD0uRgNe5D6EZDcF /YkfFfbOiWJAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCaZ2AewAKCRDBN2bmhouD 11LZD/0Q9SfAdiqa9ATtkIPdMX3sAmI/Co/NoKAvh7VXkbqztu5lzMgrtVxmzmvWK5RpTBm2H+F mqIPaVyVJSI/emMri9SrcGFFGRAVfVONCOESZGqR4uSXQ1AS6hT+Pd/ss+dGAzs6Zkm10ayhdu5 Q96PMGxo+N+HXBR2MvLHYrJOZMDN/m39HZmVavLHNiUYkYvQ3FgBifWmBX/NBxp+yGRabtiZy3t eAvNfzRVcenWi0RQcAIZYao6sN/0OBfVzezPZ+1QkLX09YGs0ot/2r/oJB7doXxS/sLM8CjchjJ JczIhXuBPFZyY+b4tCb7kL2vNpA7foaYHtTJ19DsflmkN3iPgTJow6qfaLvdg8I2mtG0Ti8X6Ls W9AH7CnAcY0JouMR26kYFHMX37FNLTgFOq981za2tB1WOdhuo9OBQiXKZlO0sk3/10KAGc/TMCE v04bd5xPPPB2mHpNh13e93SgsbqUI4a8J46Ebuwhr6Gs2P3DLcYED08dlVw0R9+TjQI/6lMPl2F +/YfuHr360JrZzhWjg0CvFkuE8bT/FKeoLo1GztkNk5TCY8zCBMhIwh0ksCtUDQwZiS5P6gzQoy qY45G6+SR8kTq/uSc2MVnH2piFtMXMh6erSklnlWzJGR/+bZYzo9sD88DJDjj0vnpdxqVqJ/4c3 5TfOVsEbdTw90Bw== X-Developer-Key: i=krzysztof.kozlowski@oss.qualcomm.com; a=openpgp; fpr=9BD07E0E0C51F8D59677B7541B93437D3B41629B Content-Transfer-Encoding: quoted-printable X-Authority-Analysis: v=2.4 cv=UtFu9uwB c=1 sm=1 tr=0 ts=699d8083 cx=c_pps a=qKBjSQ1v91RyAK45QCPf5w==:117 a=6nO30s3o7FuWeffXwhKHTA==:17 a=HzLeVaNsDn8A:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=yx91gb_oNiZeI1HMLzn7:22 a=VwQbUJbxAAAA:8 a=EUspDBNiAAAA:8 a=IG_F2lY0Ax8mXwJdcBoA:9 a=NFOGd7dJGGMPyQGDc5-O:22 X-Proofpoint-GUID: MGWwKlH_WUEN4sSkwefy7MNyEu78TcFC X-Proofpoint-ORIG-GUID: MGWwKlH_WUEN4sSkwefy7MNyEu78TcFC X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMjI0MDA4NyBTYWx0ZWRfXxpTVAOaXp/En 4c116sXEOsvr5LMX8NnVa0PMlsZu/t4sWM37JYX2wvftg5AZCKFLZqh7RC2/FblST2LVgTonJ4K 8jGN2qfhnmohozUddAjyro6rLlrX67jwnB9TzBGc7hf/A53SHET/gyzHnv2Tb1qNB2ImJaPcLnq F2WWquLtab9d9kB2TtEzmUiLGUAqEvQe2RiwnUpd9fMkdfv2RP2YgPaxXvVKrG/3Ql9lQ/56Mqk 9BCdEeue4zafsfymSqEeTS+TASZRO7CtO/yAlvBiFmrG7qkcO2dEuSJWvHZSyAcYIYStnu6PkOA PPfw/JOsio3+dhDodfYcWVHQZfgB3dU2uSIbE1hxdgS4W+rGTuE9lu3LCTMcijWKFV3zbBPEmLg wI8un9broT48m8AQEGE30KmGwXxlgqZJNzRzdUhk+KsKiKFuC8bfvvDgUoBrX4+kzgI36fqelmu Jk2rzu+rpVAnF8/idOg== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-02-24_01,2026-02-23_03,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 impostorscore=0 spamscore=0 adultscore=0 malwarescore=0 suspectscore=0 phishscore=0 clxscore=1015 lowpriorityscore=0 bulkscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2602130000 definitions=main-2602240087 Content-Type: text/plain; charset="utf-8" All the functions operating on the 'handle' pointer are claiming it is a pointer to const thus they should not modify the handle. In fact that's a false statement, because first thing these functions do is drop the cast to const with container_of: struct acpm_info *acpm =3D handle_to_acpm_info(handle); And with such cast the handle is easily writable with simple: acpm->handle.ops.pmic_ops.read_reg =3D NULL; The code is not correct logically, either, because functions like acpm_get_by_node() and acpm_handle_put() are meant to modify the handle reference counting, thus they must modify the handle. Modification here happens anyway, even if the reference counting is stored in the container which the handle is part of. The code does not have actual visible bug, but incorrect 'const' annotations could lead to incorrect compiler decisions. Fixes: a88927b534ba ("firmware: add Exynos ACPM protocol driver") Cc: Signed-off-by: Krzysztof Kozlowski --- I will have more patches for more drivers like TI, ARM SCMI... Changes in v2: 1. Update also clk and mfd drivers, fixing build (do'h!) failure. With Lee's blessing I can take the patch via Samsung. --- drivers/clk/samsung/clk-acpm.c | 4 +- drivers/firmware/samsung/exynos-acpm-dvfs.c | 4 +- drivers/firmware/samsung/exynos-acpm-dvfs.h | 4 +- drivers/firmware/samsung/exynos-acpm-pmic.c | 10 ++--- drivers/firmware/samsung/exynos-acpm-pmic.h | 10 ++--- drivers/firmware/samsung/exynos-acpm.c | 16 ++++---- drivers/firmware/samsung/exynos-acpm.h | 2 +- drivers/mfd/sec-acpm.c | 10 ++--- .../firmware/samsung/exynos-acpm-protocol.h | 40 ++++++++----------- 9 files changed, 48 insertions(+), 52 deletions(-) diff --git a/drivers/clk/samsung/clk-acpm.c b/drivers/clk/samsung/clk-acpm.c index b90809ce3f88..d8944160793a 100644 --- a/drivers/clk/samsung/clk-acpm.c +++ b/drivers/clk/samsung/clk-acpm.c @@ -20,7 +20,7 @@ struct acpm_clk { u32 id; struct clk_hw hw; unsigned int mbox_chan_id; - const struct acpm_handle *handle; + struct acpm_handle *handle; }; =20 struct acpm_clk_variant { @@ -113,7 +113,7 @@ static int acpm_clk_register(struct device *dev, struct= acpm_clk *aclk, =20 static int acpm_clk_probe(struct platform_device *pdev) { - const struct acpm_handle *acpm_handle; + struct acpm_handle *acpm_handle; struct clk_hw_onecell_data *clk_data; struct clk_hw **hws; struct device *dev =3D &pdev->dev; diff --git a/drivers/firmware/samsung/exynos-acpm-dvfs.c b/drivers/firmware= /samsung/exynos-acpm-dvfs.c index 1c5b2b143bcc..66448c8037ac 100644 --- a/drivers/firmware/samsung/exynos-acpm-dvfs.c +++ b/drivers/firmware/samsung/exynos-acpm-dvfs.c @@ -42,7 +42,7 @@ static void acpm_dvfs_init_set_rate_cmd(u32 cmd[4], unsig= ned int clk_id, cmd[3] =3D ktime_to_ms(ktime_get()); } =20 -int acpm_dvfs_set_rate(const struct acpm_handle *handle, +int acpm_dvfs_set_rate(struct acpm_handle *handle, unsigned int acpm_chan_id, unsigned int clk_id, unsigned long rate) { @@ -62,7 +62,7 @@ static void acpm_dvfs_init_get_rate_cmd(u32 cmd[4], unsig= ned int clk_id) cmd[3] =3D ktime_to_ms(ktime_get()); } =20 -unsigned long acpm_dvfs_get_rate(const struct acpm_handle *handle, +unsigned long acpm_dvfs_get_rate(struct acpm_handle *handle, unsigned int acpm_chan_id, unsigned int clk_id) { struct acpm_xfer xfer; diff --git a/drivers/firmware/samsung/exynos-acpm-dvfs.h b/drivers/firmware= /samsung/exynos-acpm-dvfs.h index 9f2778e649c9..b37b15426102 100644 --- a/drivers/firmware/samsung/exynos-acpm-dvfs.h +++ b/drivers/firmware/samsung/exynos-acpm-dvfs.h @@ -11,10 +11,10 @@ =20 struct acpm_handle; =20 -int acpm_dvfs_set_rate(const struct acpm_handle *handle, +int acpm_dvfs_set_rate(struct acpm_handle *handle, unsigned int acpm_chan_id, unsigned int id, unsigned long rate); -unsigned long acpm_dvfs_get_rate(const struct acpm_handle *handle, +unsigned long acpm_dvfs_get_rate(struct acpm_handle *handle, unsigned int acpm_chan_id, unsigned int clk_id); =20 diff --git a/drivers/firmware/samsung/exynos-acpm-pmic.c b/drivers/firmware= /samsung/exynos-acpm-pmic.c index 961d7599e422..52e89d1b790f 100644 --- a/drivers/firmware/samsung/exynos-acpm-pmic.c +++ b/drivers/firmware/samsung/exynos-acpm-pmic.c @@ -77,7 +77,7 @@ static void acpm_pmic_init_read_cmd(u32 cmd[4], u8 type, = u8 reg, u8 chan) cmd[3] =3D ktime_to_ms(ktime_get()); } =20 -int acpm_pmic_read_reg(const struct acpm_handle *handle, +int acpm_pmic_read_reg(struct acpm_handle *handle, unsigned int acpm_chan_id, u8 type, u8 reg, u8 chan, u8 *buf) { @@ -107,7 +107,7 @@ static void acpm_pmic_init_bulk_read_cmd(u32 cmd[4], u8= type, u8 reg, u8 chan, FIELD_PREP(ACPM_PMIC_VALUE, count); } =20 -int acpm_pmic_bulk_read(const struct acpm_handle *handle, +int acpm_pmic_bulk_read(struct acpm_handle *handle, unsigned int acpm_chan_id, u8 type, u8 reg, u8 chan, u8 count, u8 *buf) { @@ -150,7 +150,7 @@ static void acpm_pmic_init_write_cmd(u32 cmd[4], u8 typ= e, u8 reg, u8 chan, cmd[3] =3D ktime_to_ms(ktime_get()); } =20 -int acpm_pmic_write_reg(const struct acpm_handle *handle, +int acpm_pmic_write_reg(struct acpm_handle *handle, unsigned int acpm_chan_id, u8 type, u8 reg, u8 chan, u8 value) { @@ -187,7 +187,7 @@ static void acpm_pmic_init_bulk_write_cmd(u32 cmd[4], u= 8 type, u8 reg, u8 chan, } } =20 -int acpm_pmic_bulk_write(const struct acpm_handle *handle, +int acpm_pmic_bulk_write(struct acpm_handle *handle, unsigned int acpm_chan_id, u8 type, u8 reg, u8 chan, u8 count, const u8 *buf) { @@ -220,7 +220,7 @@ static void acpm_pmic_init_update_cmd(u32 cmd[4], u8 ty= pe, u8 reg, u8 chan, cmd[3] =3D ktime_to_ms(ktime_get()); } =20 -int acpm_pmic_update_reg(const struct acpm_handle *handle, +int acpm_pmic_update_reg(struct acpm_handle *handle, unsigned int acpm_chan_id, u8 type, u8 reg, u8 chan, u8 value, u8 mask) { diff --git a/drivers/firmware/samsung/exynos-acpm-pmic.h b/drivers/firmware= /samsung/exynos-acpm-pmic.h index 078421888a14..88ae9aada2ae 100644 --- a/drivers/firmware/samsung/exynos-acpm-pmic.h +++ b/drivers/firmware/samsung/exynos-acpm-pmic.h @@ -11,19 +11,19 @@ =20 struct acpm_handle; =20 -int acpm_pmic_read_reg(const struct acpm_handle *handle, +int acpm_pmic_read_reg(struct acpm_handle *handle, unsigned int acpm_chan_id, u8 type, u8 reg, u8 chan, u8 *buf); -int acpm_pmic_bulk_read(const struct acpm_handle *handle, +int acpm_pmic_bulk_read(struct acpm_handle *handle, unsigned int acpm_chan_id, u8 type, u8 reg, u8 chan, u8 count, u8 *buf); -int acpm_pmic_write_reg(const struct acpm_handle *handle, +int acpm_pmic_write_reg(struct acpm_handle *handle, unsigned int acpm_chan_id, u8 type, u8 reg, u8 chan, u8 value); -int acpm_pmic_bulk_write(const struct acpm_handle *handle, +int acpm_pmic_bulk_write(struct acpm_handle *handle, unsigned int acpm_chan_id, u8 type, u8 reg, u8 chan, u8 count, const u8 *buf); -int acpm_pmic_update_reg(const struct acpm_handle *handle, +int acpm_pmic_update_reg(struct acpm_handle *handle, unsigned int acpm_chan_id, u8 type, u8 reg, u8 chan, u8 value, u8 mask); #endif /* __EXYNOS_ACPM_PMIC_H__ */ diff --git a/drivers/firmware/samsung/exynos-acpm.c b/drivers/firmware/sams= ung/exynos-acpm.c index 0cb269c70460..987b59778ffc 100644 --- a/drivers/firmware/samsung/exynos-acpm.c +++ b/drivers/firmware/samsung/exynos-acpm.c @@ -412,7 +412,7 @@ static int acpm_wait_for_message_response(struct acpm_c= han *achan, * * Return: 0 on success, -errno otherwise. */ -int acpm_do_xfer(const struct acpm_handle *handle, const struct acpm_xfer = *xfer) +int acpm_do_xfer(struct acpm_handle *handle, const struct acpm_xfer *xfer) { struct acpm_info *acpm =3D handle_to_acpm_info(handle); struct exynos_mbox_msg msg; @@ -674,7 +674,7 @@ static int acpm_probe(struct platform_device *pdev) * acpm_handle_put() - release the handle acquired by acpm_get_by_phandle. * @handle: Handle acquired by acpm_get_by_phandle. */ -static void acpm_handle_put(const struct acpm_handle *handle) +static void acpm_handle_put(struct acpm_handle *handle) { struct acpm_info *acpm =3D handle_to_acpm_info(handle); struct device *dev =3D acpm->dev; @@ -700,9 +700,11 @@ static void devm_acpm_release(struct device *dev, void= *res) * @np: ACPM device tree node. * * Return: pointer to handle on success, ERR_PTR(-errno) otherwise. + * + * Note: handle CANNOT be pointer to const */ -static const struct acpm_handle *acpm_get_by_node(struct device *dev, - struct device_node *np) +static struct acpm_handle *acpm_get_by_node(struct device *dev, + struct device_node *np) { struct platform_device *pdev; struct device_link *link; @@ -743,10 +745,10 @@ static const struct acpm_handle *acpm_get_by_node(str= uct device *dev, * * Return: pointer to handle on success, ERR_PTR(-errno) otherwise. */ -const struct acpm_handle *devm_acpm_get_by_node(struct device *dev, - struct device_node *np) +struct acpm_handle *devm_acpm_get_by_node(struct device *dev, + struct device_node *np) { - const struct acpm_handle **ptr, *handle; + struct acpm_handle **ptr, *handle; =20 ptr =3D devres_alloc(devm_acpm_release, sizeof(*ptr), GFP_KERNEL); if (!ptr) diff --git a/drivers/firmware/samsung/exynos-acpm.h b/drivers/firmware/sams= ung/exynos-acpm.h index 2d14cb58f98c..6417550f89aa 100644 --- a/drivers/firmware/samsung/exynos-acpm.h +++ b/drivers/firmware/samsung/exynos-acpm.h @@ -17,7 +17,7 @@ struct acpm_xfer { =20 struct acpm_handle; =20 -int acpm_do_xfer(const struct acpm_handle *handle, +int acpm_do_xfer(struct acpm_handle *handle, const struct acpm_xfer *xfer); =20 #endif /* __EXYNOS_ACPM_H__ */ diff --git a/drivers/mfd/sec-acpm.c b/drivers/mfd/sec-acpm.c index 537ea65685bf..0e23b9d9f7ee 100644 --- a/drivers/mfd/sec-acpm.c +++ b/drivers/mfd/sec-acpm.c @@ -367,7 +367,7 @@ static const struct regmap_config s2mpg11_regmap_config= _meter =3D { }; =20 struct sec_pmic_acpm_shared_bus_context { - const struct acpm_handle *acpm; + struct acpm_handle *acpm; unsigned int acpm_chan_id; u8 speedy_channel; }; @@ -390,7 +390,7 @@ static int sec_pmic_acpm_bus_write(void *context, const= void *data, size_t count) { struct sec_pmic_acpm_bus_context *ctx =3D context; - const struct acpm_handle *acpm =3D ctx->shared->acpm; + struct acpm_handle *acpm =3D ctx->shared->acpm; const struct acpm_pmic_ops *pmic_ops =3D &acpm->ops.pmic_ops; size_t val_count =3D count - BITS_TO_BYTES(ACPM_ADDR_BITS); const u8 *d =3D data; @@ -410,7 +410,7 @@ static int sec_pmic_acpm_bus_read(void *context, const = void *reg_buf, size_t reg void *val_buf, size_t val_size) { struct sec_pmic_acpm_bus_context *ctx =3D context; - const struct acpm_handle *acpm =3D ctx->shared->acpm; + struct acpm_handle *acpm =3D ctx->shared->acpm; const struct acpm_pmic_ops *pmic_ops =3D &acpm->ops.pmic_ops; const u8 *r =3D reg_buf; u8 reg; @@ -429,7 +429,7 @@ static int sec_pmic_acpm_bus_reg_update_bits(void *cont= ext, unsigned int reg, un unsigned int val) { struct sec_pmic_acpm_bus_context *ctx =3D context; - const struct acpm_handle *acpm =3D ctx->shared->acpm; + struct acpm_handle *acpm =3D ctx->shared->acpm; const struct acpm_pmic_ops *pmic_ops =3D &acpm->ops.pmic_ops; =20 return pmic_ops->update_reg(acpm, ctx->shared->acpm_chan_id, ctx->type, r= eg & 0xff, @@ -480,7 +480,7 @@ static int sec_pmic_acpm_probe(struct platform_device *= pdev) struct regmap *regmap_common, *regmap_pmic, *regmap; const struct sec_pmic_acpm_platform_data *pdata; struct sec_pmic_acpm_shared_bus_context *shared_ctx; - const struct acpm_handle *acpm; + struct acpm_handle *acpm; struct device *dev =3D &pdev->dev; int ret, irq; =20 diff --git a/include/linux/firmware/samsung/exynos-acpm-protocol.h b/includ= e/linux/firmware/samsung/exynos-acpm-protocol.h index 2091da965a5a..13f17dc4443b 100644 --- a/include/linux/firmware/samsung/exynos-acpm-protocol.h +++ b/include/linux/firmware/samsung/exynos-acpm-protocol.h @@ -14,30 +14,24 @@ struct acpm_handle; struct device_node; =20 struct acpm_dvfs_ops { - int (*set_rate)(const struct acpm_handle *handle, - unsigned int acpm_chan_id, unsigned int clk_id, - unsigned long rate); - unsigned long (*get_rate)(const struct acpm_handle *handle, + int (*set_rate)(struct acpm_handle *handle, unsigned int acpm_chan_id, + unsigned int clk_id, unsigned long rate); + unsigned long (*get_rate)(struct acpm_handle *handle, unsigned int acpm_chan_id, unsigned int clk_id); }; =20 struct acpm_pmic_ops { - int (*read_reg)(const struct acpm_handle *handle, - unsigned int acpm_chan_id, u8 type, u8 reg, u8 chan, - u8 *buf); - int (*bulk_read)(const struct acpm_handle *handle, - unsigned int acpm_chan_id, u8 type, u8 reg, u8 chan, - u8 count, u8 *buf); - int (*write_reg)(const struct acpm_handle *handle, - unsigned int acpm_chan_id, u8 type, u8 reg, u8 chan, - u8 value); - int (*bulk_write)(const struct acpm_handle *handle, - unsigned int acpm_chan_id, u8 type, u8 reg, u8 chan, - u8 count, const u8 *buf); - int (*update_reg)(const struct acpm_handle *handle, - unsigned int acpm_chan_id, u8 type, u8 reg, u8 chan, - u8 value, u8 mask); + int (*read_reg)(struct acpm_handle *handle, unsigned int acpm_chan_id, + u8 type, u8 reg, u8 chan, u8 *buf); + int (*bulk_read)(struct acpm_handle *handle, unsigned int acpm_chan_id, + u8 type, u8 reg, u8 chan, u8 count, u8 *buf); + int (*write_reg)(struct acpm_handle *handle, unsigned int acpm_chan_id, + u8 type, u8 reg, u8 chan, u8 value); + int (*bulk_write)(struct acpm_handle *handle, unsigned int acpm_chan_id, + u8 type, u8 reg, u8 chan, u8 count, const u8 *buf); + int (*update_reg)(struct acpm_handle *handle, unsigned int acpm_chan_id, + u8 type, u8 reg, u8 chan, u8 value, u8 mask); }; =20 struct acpm_ops { @@ -56,12 +50,12 @@ struct acpm_handle { struct device; =20 #if IS_ENABLED(CONFIG_EXYNOS_ACPM_PROTOCOL) -const struct acpm_handle *devm_acpm_get_by_node(struct device *dev, - struct device_node *np); +struct acpm_handle *devm_acpm_get_by_node(struct device *dev, + struct device_node *np); #else =20 -static inline const struct acpm_handle *devm_acpm_get_by_node(struct devic= e *dev, - struct device_node *np) +static inline struct acpm_handle *devm_acpm_get_by_node(struct device *dev, + struct device_node *np) { return NULL; } --=20 2.51.0