From nobody Fri Apr 17 08:45:25 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 D0EC336D4F2 for ; Mon, 23 Feb 2026 19:34:59 +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=1771875301; cv=none; b=aZn6GPcTzh/hkEmkrI37tDCyCH+1O2G/cQcle+5qVW55YmWWl/7IdaxKtuQVj511Cs/afeEqoXYiPVixMaB+Mu+GHacHhk1IXVBEaiBI1hhbKpdvXjO3DXcWQHo45y9rwd2WepCnUkQatXJ5v4682bpGiYhhDJxgUyCrhH1i+OQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771875301; c=relaxed/simple; bh=6SkBT54jdGQQfxqV6Yrdqi3MUM9Fu93hXV9Cep9mVb4=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=NTfW25yWUTngruwSOPGFnDrSzgKa7LupA+NjzPEhzAa+TcANf40fFvqmXx9o/MRQ+GWx/VUHIaboFwLFNXRwOhRi0xfTLfZqHJQTLzhekNptpuavMYOt2rOGgiVVqPLge3qE8afcDJ9CQPFvhO/6QU2e96fYr5SQ6yLrdkpUW8A= 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=KvPbIilI; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=AKiX4czX; 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="KvPbIilI"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="AKiX4czX" 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 61NI79re544020 for ; Mon, 23 Feb 2026 19:34:53 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=xOe8cPoJ88byYsxtVowBQns9AoXPFIKBl/J 2eUuUHyU=; b=KvPbIilIM9VjCMlmNzz4z+rHgEpl/GetKDG4KtHLD5bMed9ynH1 bJ2HJ+uJA+BE0qY1TBxgXS/NrS/pJJ8N1O8FbHeplTFEOKmO94hG1gB5rdjMncV+ rhHOlmbP/YbFed/POZV6VwWLToytVUOt9ykyRhadbHbkl7WTC78nJdC+d5CZmf+5 GhJlPaHM70+tJulz6V1mIriphQ1QWDFYS6b7HWpfqPgh0CowmMUr9XqlMmaxVVwB C7TxoHRGorOW/bqRDx3Pcksap959iwEO7ZTblhADctMQUyXl004uqaiUePYwQmwd Sguf/ByRGE7VigDQyL1I/OtOCEV4pMt0Ftw== Received: from mail-qk1-f197.google.com (mail-qk1-f197.google.com [209.85.222.197]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4cgn7t9pnv-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Mon, 23 Feb 2026 19:34:53 +0000 (GMT) Received: by mail-qk1-f197.google.com with SMTP id af79cd13be357-8c882774f0dso4220616885a.2 for ; Mon, 23 Feb 2026 11:34:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1771875293; x=1772480093; 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=xOe8cPoJ88byYsxtVowBQns9AoXPFIKBl/J2eUuUHyU=; b=AKiX4czX+vNJQOA+V1yvIB6OLSWj6SssIkW1phu5dCkr4R4C8q5avIBq3dHrwTjnNv lxtimSC0ol1ihpsfYaVeqdRzRb6wrNzDoBd5/NL9w3XjFM6cjDSe2WempUkRPJmROLBQ CJaNxS+/s8TYyTwyjdloZg3PD44TjyhSA/BR9iB3iMO5xXj9Rqb+6fd/dUzlJYDeGykd EPDrTmN95m3C+MDYZwBHMrzN7fx+sgjccOdyQXQDx8EArUJyA/g2PLxtCv6TaC1B9H+k mzmd1JZFp90bp9fHoD6LCPd3nXHtEsIoNnJVDjuSDzj3d4R5eupAa6elHwuRpAJyORvk IEHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771875293; x=1772480093; 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=xOe8cPoJ88byYsxtVowBQns9AoXPFIKBl/J2eUuUHyU=; b=YB+TjpI9gKWyifcr8ujt/poioKWhPT0W3JZkk7z4zY2rRRQ/1u1JWJWlWlrD+9hlVY N3S4JKA6yhJGqmewoqPQBa6oV6QGnaEqbGdH+TAgHn31VdgbXQAuudnb7q6xn9teNkTd YIIXz7U5ReyGtUiCgGLO4Q0V9XXedxzjFYR+pOjw5G6PXvGx7WrW1Z3PIFzgdLmI2rkD Wc4N13ttYwNpHoeQc2XNi+uh2GhczN2mrUmIOSLEzSYoW5GHo0TJ7kl23sFr4Ris8hWu 0QFywTiJxJCxGKnEX2HkyU51q7vxMnjOlsa/4vF17z85bpMplXfhrdg+I1fJCFiu+UkW NL4Q== X-Forwarded-Encrypted: i=1; AJvYcCU7r9N5Uxga1sGahic4Df3uGZMmdEgrEYkpP9ttah4ULoe5TzcMNwUMbCVhgIgQXHfHvSI/FDJrUo0wugg=@vger.kernel.org X-Gm-Message-State: AOJu0Yxf3JhSd+YdbVjIjgDLq22Qm4ny4gZbeL17gmMcBIR+UkQ9qew/ SIIbYrrUaywJuhhQiLzs/fAeps5gdQbx/CksrFeMC2Ynn9gDd6FPJp3zX8vAdWKn9Q/KfYm+VdX wuKgN1tozLamQtO4IxHauBDxvuG/hOA5ivvzR+jwhsIMHvcpm9Blq6dtM1Tp2hUhhdBY= X-Gm-Gg: AZuq6aJUdSiN5cq5O/RdMTi1g2XALthlxO6lftMxFrBX05+/ZH3Kb3QgLnSDWmAulJr CIHrnOfP+Rfrk+F9Sq02V3hLRJvyVBPOFWoV6USspmSbe5LxSqwN/t3h2+cQRXdwMEBqoVCXFqn 3nIUoTIvEe3Tqg4Eg+ZJxtmh6rdLe4H0I4uUcmpnLjmTX2P0/2kXyTY4DZHH1w/Xtd6HCD5BEA6 Goku0QFL0lwSqjAph71DQK7pmdNw1/ZlLFlUyRiUvor2OFRf+nG4jTShRXok7OM9AEXBPTLD1E9 BRcNuyCkGedDKpc9yz8Qy23U4b/VW7FF2fTkEMxzh7fwxBYTTg9ZoQy5uxMEAxK3Fe6YQloGR9J pVNgAaz9s4TDUK3b9tWgSJ+VGjg3GnYNGBQI0Lw== X-Received: by 2002:a05:620a:1289:b0:8cb:9fd4:2ecb with SMTP id af79cd13be357-8cb9fd42ef1mr318779885a.54.1771875292312; Mon, 23 Feb 2026 11:34:52 -0800 (PST) X-Received: by 2002:a05:620a:1289:b0:8cb:9fd4:2ecb with SMTP id af79cd13be357-8cb9fd42ef1mr318775085a.54.1771875291372; Mon, 23 Feb 2026 11:34:51 -0800 (PST) Received: from quoll ([178.197.223.140]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-483a9caadedsm177232805e9.10.2026.02.23.11.34.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Feb 2026 11:34:50 -0800 (PST) From: Krzysztof Kozlowski To: Tudor Ambarus , Krzysztof Kozlowski , Alim Akhtar , linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Krzysztof Kozlowski , stable@vger.kernel.org Subject: [PATCH] firmware: exynos-acpm: Drop fake 'const' on handle pointer Date: Mon, 23 Feb 2026 20:34:17 +0100 Message-ID: <20260223193416.532231-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=11784; i=krzysztof.kozlowski@oss.qualcomm.com; h=from:subject; bh=6SkBT54jdGQQfxqV6Yrdqi3MUM9Fu93hXV9Cep9mVb4=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBpnKu4ZqTXIw/aEfbxxzj4Jyn3WtPAxb1HIV9YI Cfh6Wd3N0CJAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCaZyruAAKCRDBN2bmhouD 10VQD/9jd1L0tj+iLoj7aUstzcIdUp2A5wCz+3NJuUFmu+kN/cpTU2VYuV4vPTsfEUb28jCAtZW cdD7UHKlfh3Do1pjAPs3DVoDpW23l/Tb+AcsvIICYNeSaE7wbXxzzZcOvAyGt2POCwuIH+FqJ4F AY0Te6tAw9f+1cGxFMGWHz7e2K6ZWqnU29x18ko/EZxmMFPpyLvgB2fwnHswqKGelYPhvrXKsWH GJkTwdJvekwXQ7yajvmWlQ1rLt+43I9C72gjzWkHZRHXRXVvoQNhFyoiGSVelPSwCqWCAlU6w4v Vp38RbnJQVBVEQO0dXqgUgTO6jIAgbXhpztEeQWpNbZDWIkvtf8rggmjKU0hOSBGgNKK1uRH8KW MXtVbXFKMXfIqoWpbhKmlAS5fseKGH5j7EOrA1t26E/7kQ8c7Fu/dty9Ab5jeoW1IhgQg1ecIv6 npBPojujl24Yi/tcQPFSIQBZvYuDwQ6XVoSQe4Vx5f1LytPb2nAylP9/SjtHelC90SFRKznmZXG vA9gdy8YdhFy0epRSDwXzMXUY89hvlXN9dKxdQClNMljcDAGFjcdahG54gzmYELLfMDVGX5V+kB Qy3O4K3FOEl7/QNznL25IJxOBDkW3PZUROvSLLXzDvTZWU1CBdWoEKFRAreHtxH33Vs9fdglgqo 7XJtS3z2Fdp6HbA== 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=c5OmgB9l c=1 sm=1 tr=0 ts=699cabdd cx=c_pps a=50t2pK5VMbmlHzFWWp8p/g==: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=6hZ-4XOhd20wvc6P64wA:9 a=IoWCM6iH3mJn3m4BftBB:22 X-Proofpoint-GUID: 2gKojjsoB0p15rlPjweWLwH7ie-uPcF_ X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMjIzMDE3MCBTYWx0ZWRfX8Q4HmaGadmhu VWFHhtXjolhqJ0ATJSjdQgYjhVbxb7C/Vpq0GiQmvhQHZOMJvfMTBXrgk9EGkgpqYPjhzweSp+g KElPNCAGXYk8tIMvs2oPIaDf+itXuAHTy165/97geI09pEBwjT+2MhJz6YcrmHUN1gUH76x7gyu C9yDuqb4a+bWwygo8FgVAOWGIrNpiCAITmNH9w68MjTjyXZ0c6uKQKgDWGtBBL6yCNfykDBgYzB j8UujdPMLINyYH2zKxwYKQg2PBfM4YuNJ1PY94ndUjM+aLc31sMYwatheUd5TbtYlC0pqipz9Pz jrpbJ4dRNmF9Bi8Yks2cQ7n0N4DcGNGJxbvOWlt0b4q9oblMaUzLg8I58aZyGEatqYRg/zubVTx gcaQEoFqb9dJrxUTq+pwb/K57muLlq/xUrajvNBY2hOgcXQFmOAY0wCdjBVV94kRKj2aBOVieXJ E1DXw5PW6e73pOAFzAw== X-Proofpoint-ORIG-GUID: 2gKojjsoB0p15rlPjweWLwH7ie-uPcF_ 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-23_04,2026-02-23_03,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 impostorscore=0 malwarescore=0 lowpriorityscore=0 adultscore=0 clxscore=1015 bulkscore=0 spamscore=0 suspectscore=0 priorityscore=1501 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2602130000 definitions=main-2602230170 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. They could not work with handle being pointer to const. 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... --- 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 +- .../firmware/samsung/exynos-acpm-protocol.h | 40 ++++++++----------- 7 files changed, 41 insertions(+), 45 deletions(-) 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/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