From patchwork Fri Feb 16 14:40:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 773436 Received: from mail-ej1-f41.google.com (mail-ej1-f41.google.com [209.85.218.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DAE2912EBD7 for ; Fri, 16 Feb 2024 14:40:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708094436; cv=none; b=IOjfGiOH7od7Co4PK8Onu3brA9JZzvRb68D2ZIOQdDTPntc9Ylt8msAwm2IZmKo/8NPxzCSr0xjOkX45vEaVnTBkaF7gKa43BYIGAeGC4Fm/hKn9yyTgr1kjD4sCbz/MCwyrVvwJW0rNDsQnCh/pUQEuqH3ABz8EyYpzBnz1bS8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708094436; c=relaxed/simple; bh=VhhgxqgxNna3VDXzGb+u29de1zzuvgOHxd0eRr4Za/8=; h=From:To:Subject:Date:Message-Id:MIME-Version; b=KkGTjDoSTAyX8LCfydfGdTrKDTBysDHe3PDGGBw0gP494pXxFVgmavzPmaBs+oygalJRYW5uiDPLqhaMAAQvkUc+Z/mmw5UsJdTK9EqCCZ8mV5BfwmVeqpZ3uVdZFWd0whbFyUOoqrnXln8M/p43bIwYPFuDEKXsWZ5g4O2kOS4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=C6vRSD4J; arc=none smtp.client-ip=209.85.218.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="C6vRSD4J" Received: by mail-ej1-f41.google.com with SMTP id a640c23a62f3a-a3dfb2e03e7so39043966b.3 for ; Fri, 16 Feb 2024 06:40:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1708094432; x=1708699232; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=ZRC42YbuNYRdIwcaj+US8j1sKLD+6CzDw3sU7mb37/4=; b=C6vRSD4JJq5VeMpEP/qRigg9X6R76yWVZMsOrj+Tc1BoLlL99PJRhdXCL7JfIyG5GX jCqYQWrKDtOxbjTqzp6frBGY01m/xc0MIHJ5tsq7llV9AxClh/BJH1UexH15Fbrn6jj/ 1ta6q/qIsSOO8XZIMNWh3LjtVanF5H6mCeRsxOzxGNcxH3e7ydzkfp880eOUEdcqf/Zi 0DrgV7iwPy6YcfTijX46hkS8bSz5xioYPguXBptI40L1ZCfSNdNvbfBkvMuN/Y7Vzkkp nYTbWV4wGHkvdigTBChx/xitB18De9uMjTYTUWAgwfE3ZLMkJcLp7kbAfmc3JXapjIGO laUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708094432; x=1708699232; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ZRC42YbuNYRdIwcaj+US8j1sKLD+6CzDw3sU7mb37/4=; b=nWzcPCxsiMkVbsiffGzRRRjB46ltCzvqtPz0VT/+dN08sR2Z7Z/YA4lYr7quVmZ6Xm 1NA8IQeTW/R7FNzHeWimFLy0jilz/j00edZ7Tsjd4hSkiz9FHDYS7JzOkZNqOHNQjxzz Qpw57tnJRgynn7psRdS9Djb42dB6cqhU/r5gv9v7knf21p3ucIPmuE4kwUPbdlvYp3n3 GRhW2qrR81ze4Y4GgvM7Mv39juptJRv4h/e8APmOYk9oE0IfHvkOCJJmFX69zfRywi8/ SZ4HXidVMkeKI7iNY6Rwj/yqbsFQfYWFf5WpOAsGmXxW9sGwSjOwVFVTHJC76+Wm+wPm scUQ== X-Forwarded-Encrypted: i=1; AJvYcCXRaUXznte5jw7r6nN+hOCZc+ISeAo5+1RHyelavAvcmydfPtzO/TF8io2tYL1mKikXDvM0PLZDeFMygqKKMx3Lst79bQjcG26Q/4mO+A== X-Gm-Message-State: AOJu0YwwYci8zuoutdA7HapX5thWNVGYHMIUaFe3EtlevQMDU290Dvw9 W5aPZ281QbhoMG1Ng/UnH69UeGMbcnHUKhiINLCS99OnBGLTRWy36RC/F/kJ66o= X-Google-Smtp-Source: AGHT+IHf//9yt3eTnyw6VXgXdUG6tjNHVGPCN0at0VvNZn01LUmWCi7a4swsg2sOshpZkHrmmM9UNA== X-Received: by 2002:a17:906:185a:b0:a3d:994a:791d with SMTP id w26-20020a170906185a00b00a3d994a791dmr3667044eje.59.1708094432164; Fri, 16 Feb 2024 06:40:32 -0800 (PST) Received: from krzk-bin.. ([78.10.207.130]) by smtp.gmail.com with ESMTPSA id a8-20020a170906670800b00a3ce3c5b2a4sm1592942ejp.195.2024.02.16.06.40.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Feb 2024 06:40:31 -0800 (PST) From: Krzysztof Kozlowski To: Hector Martin , Sven Peter , Alyssa Rosenzweig , Joerg Roedel , Will Deacon , Robin Murphy , Rob Clark , Marek Szyprowski , Krzysztof Kozlowski , Alim Akhtar , Bjorn Andersson , Konrad Dybcio , Yong Wu , Matthias Brugger , AngeloGioacchino Del Regno , Heiko Stuebner , Orson Zhai , Baolin Wang , Chunyan Zhang , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Thierry Reding , Krishna Reddy , Jonathan Hunter , Jean-Philippe Brucker , asahi@lists.linux.dev, linux-arm-kernel@lists.infradead.org, iommu@lists.linux.dev, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-tegra@vger.kernel.org, virtualization@lists.linux.dev Subject: [PATCH 1/4] iommu: constify pointer to bus_type Date: Fri, 16 Feb 2024 15:40:24 +0100 Message-Id: <20240216144027.185959-1-krzysztof.kozlowski@linaro.org> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Make pointer to bus_type a pointer to const for code safety. Signed-off-by: Krzysztof Kozlowski Reviewed-by: Lu Baolu --- drivers/iommu/iommu-priv.h | 5 +++-- drivers/iommu/iommu.c | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/iommu/iommu-priv.h b/drivers/iommu/iommu-priv.h index 2024a2313348..5f731d994803 100644 --- a/drivers/iommu/iommu-priv.h +++ b/drivers/iommu/iommu-priv.h @@ -21,10 +21,11 @@ int iommu_group_replace_domain(struct iommu_group *group, struct iommu_domain *new_domain); int iommu_device_register_bus(struct iommu_device *iommu, - const struct iommu_ops *ops, struct bus_type *bus, + const struct iommu_ops *ops, + const struct bus_type *bus, struct notifier_block *nb); void iommu_device_unregister_bus(struct iommu_device *iommu, - struct bus_type *bus, + const struct bus_type *bus, struct notifier_block *nb); #endif /* __LINUX_IOMMU_PRIV_H */ diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c index d14413916f93..170329a085b8 100644 --- a/drivers/iommu/iommu.c +++ b/drivers/iommu/iommu.c @@ -291,7 +291,7 @@ EXPORT_SYMBOL_GPL(iommu_device_unregister); #if IS_ENABLED(CONFIG_IOMMUFD_TEST) void iommu_device_unregister_bus(struct iommu_device *iommu, - struct bus_type *bus, + const struct bus_type *bus, struct notifier_block *nb) { bus_unregister_notifier(bus, nb); @@ -305,7 +305,8 @@ EXPORT_SYMBOL_GPL(iommu_device_unregister_bus); * some memory to hold a notifier_block. */ int iommu_device_register_bus(struct iommu_device *iommu, - const struct iommu_ops *ops, struct bus_type *bus, + const struct iommu_ops *ops, + const struct bus_type *bus, struct notifier_block *nb) { int err; From patchwork Fri Feb 16 14:40:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 773435 Received: from mail-ed1-f46.google.com (mail-ed1-f46.google.com [209.85.208.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1385F12F367 for ; Fri, 16 Feb 2024 14:40:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708094441; cv=none; b=fxHk9xiZYiYJ9k1bgEKCJEJ8YL0kZVivQ5iNLoo0KvsCto0XMeGtNab5PzLc2sMfPCECWAcP+GKhYCHhqWgyMrRA0PurLUnyGH4+nFqZabvIyZ+OlECtc+3O2gxnSr9dh73RNcfSZ/1xxpRoV6bmzQWueOhlg+ro+5gCxRlnf30= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708094441; c=relaxed/simple; bh=JRNY0w7Ro2R0aulceus9kSJUlVFLy2lL65NJT4HL82U=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=s0Gf+95VR2LL1YbGG87P3jbcORyIPpGCKKiislB560BMP0DaCBooovPba7rwPJLSvFYTsLTgqfrNwsv+YYhpO7V0cgL9/pjZBs/t03KKziI6bbVi0W/q/Y/MspfFXjf/5WE3kK94/bhInVu64lKki+IXQnYbuC0HBVWTy1q2zmA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=HMBaU6me; arc=none smtp.client-ip=209.85.208.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="HMBaU6me" Received: by mail-ed1-f46.google.com with SMTP id 4fb4d7f45d1cf-562178003a1so1025857a12.1 for ; Fri, 16 Feb 2024 06:40:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1708094436; x=1708699236; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=asD3ev0Cb3OxFqrbvaOTmglMW6LCxeDZuldyNVrUzqM=; b=HMBaU6meM0zNFQx8a9qVCgBMTlIgdLdcpZA4R7rBTUt0icL5+6V4gr4mQxSwK/cJN9 Mbm6PDM2lU88SRDLKHL4Kop0MMe4om6ZsKAKJpHAQmczJJwxvtAZXsXQKYUUZe1Yyv/6 VKX/RWrR6gbEb0UKEjR5L/11s0GJaOpQTQ+JG/S0ZKuc6j5qJ6tq7DYngDXf+Uj4/r3b Wi4r/8GYa5d+T3WQW30x1uXOHwAECEdBeg6OzhKPTdATJTqaiQhIz+oLMtsiOI4d76gU 50/XwMAoSY7T+5as8AillwaOru1Dii7w5OAEcPdmtNoU0tMIn15dW6GfjkkzbmHvDtN2 w0yA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708094436; x=1708699236; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=asD3ev0Cb3OxFqrbvaOTmglMW6LCxeDZuldyNVrUzqM=; b=JXNM4243kB4by0Ig/kXT+Nz4xAvnkWDJK5qNwn07yWt9RVlGL7JIuwSXD6Zsfau6dx PY6f4td7eHHWJbkvXRP16+VTKlMfN+4HvP+Hs99baqAz/nG8pn1xwoyABSSOSRhvp8nq j4O93tR/lhyYDxeuU66wm9MTbaRAxcVz7XueBc0Co8/mE8soBxLj+gZj/xoWsNGLK6TG aYtRP+5VqZ6b//Zr0XcKOUSRFMIJVtAGdrAVwe0IY8xQ/VzysGLzW1+n/LLKNxZLGkDj oiNZ0dnuDId6H8dM1j94l8bVdSjWVdSc/uRNLLACxBRe0vhxCeiasxzSCx1ryEDbkd4O bwcQ== X-Forwarded-Encrypted: i=1; AJvYcCUybtOMEPFzPANl9EmKhvuGfd/Hphsx62D7Xw8FnIBGYcbcIChulCrFiFsQCbvfBGBQtQkMYCwX5gOPUIgtzZVV8Yt97RKATZZEBRsvxQ== X-Gm-Message-State: AOJu0YyuIE0/mLjm+d0tC4BjjmwBWDDSNYAYDt9MooC3BBHBBf+5lDQD 5YTgTLvzusCsD0e/V2gblTopo/RvVJyor20nnlcdoubWUIAmIZI9XrGPt0IYAoI= X-Google-Smtp-Source: AGHT+IGCyUGN+VLUaRlt1OZxHWuQFmwSgWLlGY6S3fHlEaQRS780PIZW2GJtYg2x+OIezg266xrJrQ== X-Received: by 2002:a17:906:7d86:b0:a3b:f054:92a2 with SMTP id v6-20020a1709067d8600b00a3bf05492a2mr3792983ejo.59.1708094436519; Fri, 16 Feb 2024 06:40:36 -0800 (PST) Received: from krzk-bin.. ([78.10.207.130]) by smtp.gmail.com with ESMTPSA id a8-20020a170906670800b00a3ce3c5b2a4sm1592942ejp.195.2024.02.16.06.40.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Feb 2024 06:40:36 -0800 (PST) From: Krzysztof Kozlowski To: Hector Martin , Sven Peter , Alyssa Rosenzweig , Joerg Roedel , Will Deacon , Robin Murphy , Rob Clark , Marek Szyprowski , Krzysztof Kozlowski , Alim Akhtar , Bjorn Andersson , Konrad Dybcio , Yong Wu , Matthias Brugger , AngeloGioacchino Del Regno , Heiko Stuebner , Orson Zhai , Baolin Wang , Chunyan Zhang , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Thierry Reding , Krishna Reddy , Jonathan Hunter , Jean-Philippe Brucker , asahi@lists.linux.dev, linux-arm-kernel@lists.infradead.org, iommu@lists.linux.dev, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-tegra@vger.kernel.org, virtualization@lists.linux.dev Subject: [PATCH 3/4] iommu: constify fwnode in iommu_ops_from_fwnode() Date: Fri, 16 Feb 2024 15:40:26 +0100 Message-Id: <20240216144027.185959-3-krzysztof.kozlowski@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240216144027.185959-1-krzysztof.kozlowski@linaro.org> References: <20240216144027.185959-1-krzysztof.kozlowski@linaro.org> Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Make pointer to fwnode_handle a pointer to const for code safety. Signed-off-by: Krzysztof Kozlowski --- drivers/iommu/iommu.c | 2 +- include/linux/iommu.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c index 26a31ba4f72d..a1f9bb8fa041 100644 --- a/drivers/iommu/iommu.c +++ b/drivers/iommu/iommu.c @@ -2987,7 +2987,7 @@ bool iommu_default_passthrough(void) } EXPORT_SYMBOL_GPL(iommu_default_passthrough); -const struct iommu_ops *iommu_ops_from_fwnode(struct fwnode_handle *fwnode) +const struct iommu_ops *iommu_ops_from_fwnode(const struct fwnode_handle *fwnode) { const struct iommu_ops *ops = NULL; struct iommu_device *iommu; diff --git a/include/linux/iommu.h b/include/linux/iommu.h index 600fc6e6f308..269ef0af7f20 100644 --- a/include/linux/iommu.h +++ b/include/linux/iommu.h @@ -903,7 +903,7 @@ int iommu_fwspec_init(struct device *dev, struct fwnode_handle *iommu_fwnode, const struct iommu_ops *ops); void iommu_fwspec_free(struct device *dev); int iommu_fwspec_add_ids(struct device *dev, const u32 *ids, int num_ids); -const struct iommu_ops *iommu_ops_from_fwnode(struct fwnode_handle *fwnode); +const struct iommu_ops *iommu_ops_from_fwnode(const struct fwnode_handle *fwnode); static inline struct iommu_fwspec *dev_iommu_fwspec_get(struct device *dev) { @@ -1253,7 +1253,7 @@ static inline int iommu_fwspec_add_ids(struct device *dev, u32 *ids, } static inline -const struct iommu_ops *iommu_ops_from_fwnode(struct fwnode_handle *fwnode) +const struct iommu_ops *iommu_ops_from_fwnode(const struct fwnode_handle *fwnode) { return NULL; }