From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f74.google.com (mail-wm1-f74.google.com [209.85.128.74]) (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 2519C32ED55 for ; Fri, 28 Nov 2025 14:14:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.74 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764339276; cv=none; b=jnncwlBkeainmvADtLcn+ggV0mFkjKsw/JPPQ81XalvPQYPtun8MwbRibH1vnqOV6WFuSr5MJ5/K1fYLpNcrfvcJBrlvq7/JF7awmGnjkY0vqNTQVIWtwvhi8LY9olF031leegsZLYdVC9bxFWM2xPPyhkSaHIqd00jMVCiomc8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764339276; c=relaxed/simple; bh=lZr2m+mQ4TpwozXWPOtl3qOpvh0GxfNQ2/kgcwntGLw=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=oWYbCelESxit2jaswsNiAujg41mceyCzD1dts+Fo7VN/AWKM/tfT9hcAIz+Luko+LOouxvTHJuzofgofhbnjJ07W8o44mlHCwAA6o2eoONAEz0cP0Xhekh4pEtRwAwa1suLMJPenwWaWrBvA4SB2nqqg57NheyRz1GF4PksEiSY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--aliceryhl.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=UvQPPNNM; arc=none smtp.client-ip=209.85.128.74 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--aliceryhl.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="UvQPPNNM" Received: by mail-wm1-f74.google.com with SMTP id 5b1f17b1804b1-4779393221aso11408075e9.2 for ; Fri, 28 Nov 2025 06:14:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1764339272; x=1764944072; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=lHrITmuzWJXdDupbiDV048x4k5m6cyc9L7Gnz7XV3lw=; b=UvQPPNNMRwR+RWoUW4jAn23eMqZXtlv+dzDxfmhsyVVyrogMz+S4ZiEGhcMUtJ/6iq D4kGk4g4Ts+lfQRcKuLUSyd2Oyo7dgvvtH6IeXzxIg+0qnWtOZ+NKN76YfUu4CmnjiXi 2v3JMpmTnKfBlPp0y23q3LYv7K4oT24HswFK5xAXTWbkbM9JVosApRddO9wduNJEAlh5 3LI56uy8un/F6tCSYnsl/EeDlqfxRvUDHNBIdmJQBA3ofjEQ5WVOUzj0E//yH+vSB6q8 wQ90ShkwCHApzBnvwlX/pveePK144ildh72io3r1VO9CzLIrR6t1Vful+oab0bHbq3TN 6lkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764339272; x=1764944072; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=lHrITmuzWJXdDupbiDV048x4k5m6cyc9L7Gnz7XV3lw=; b=c4FZgEvrOI6I/DT2O5rlsIPnbRphZxWH5nz04gWv7u00p5C8x0AO/uDHqrw2qd9pk4 ICJYsb5sYNv2MFCpcq5L5/kvBz/ks/4Mjka3DmP8YTSC/detFyeL06SOB/9oAubEbW3C /zR3+7DacJ8GGOtYvHEL30ECI6daAbBK+Xw6sCJPcJK+wkcI5N7K2ExXKdO4k1vX3mzN p+ZzbRe2j5i8zFJuFVXHCMVen3THo6YGduAQ87g9XigWzP/NJ3KciuFJy9gyhr6c6i/I hfvlcQqCdVW8YFKdRBM337F2pcaMZCH1UZJs2BmafqgDT5nQ2vKkT+RcZsa2yrtSPiTl mMFQ== X-Forwarded-Encrypted: i=1; AJvYcCUdNmnxqTMxiUv3Z7xXtuurNg2FIWB6VmKsfDcDfVpPH6J2OvQrV4jdlAAOh6+l8wRjD8ome8H1QQFZeAQOkw==@vger.kernel.org X-Gm-Message-State: AOJu0YycrK+36U3rr9PyV2E/i40Gt14SCpSheNbJU3XwrPCCeIPBLsU4 h50J3y71ksNz7G+wugYNHyU6z795I/p+58y9CNMayqs7qW9mIK4D75KCaisYWf/ZWEj+hnA8jN+ pVjCePH++p5TdpbJ3vg== X-Google-Smtp-Source: AGHT+IECdIY/9qERVbVkHVqKEZYtL5qsUp1NRe18CXbO6AbEkFwz27YZTq95W0cUq+5TnNigDeIpYGUpIZBNCto= X-Received: from wmfv21.prod.google.com ([2002:a05:600c:15d5:b0:477:93dd:bbb1]) (user=aliceryhl job=prod-delivery.src-stubby-dispatcher) by 2002:a05:600c:1994:b0:477:5aaa:57a6 with SMTP id 5b1f17b1804b1-477c016e402mr252259955e9.10.1764339272424; Fri, 28 Nov 2025 06:14:32 -0800 (PST) Date: Fri, 28 Nov 2025 14:14:17 +0000 In-Reply-To: <20251128-gpuvm-rust-v1-0-ebf66bf234e0@google.com> Precedence: bulk X-Mailing-List: rust-for-linux@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20251128-gpuvm-rust-v1-0-ebf66bf234e0@google.com> X-Developer-Key: i=aliceryhl@google.com; a=openpgp; fpr=49F6C1FAA74960F43A5B86A1EE7A392FDE96209F X-Developer-Signature: v=1; a=openpgp-sha256; l=2726; i=aliceryhl@google.com; h=from:subject:message-id; bh=lZr2m+mQ4TpwozXWPOtl3qOpvh0GxfNQ2/kgcwntGLw=; b=owEBbQKS/ZANAwAKAQRYvu5YxjlGAcsmYgBpKa5CqER6z4BX6lmNpQE1dtbBv6O4gMLCZQRm2 WIxSJ5CygqJAjMEAAEKAB0WIQSDkqKUTWQHCvFIvbIEWL7uWMY5RgUCaSmuQgAKCRAEWL7uWMY5 RoGHEACKyrVlHckRCicF0bWCsQj6fIzJXXP4G9d2IdRlfrGJTT9IHHZefQtZHYrRj4CuKEHPn78 vq/7/57MFjLU9h01oEVnydbK1d4b2Q61FBF2O1QHxZXg+jQ5Lpda/paKmnAE6lEW5D0TD6xiknJ 3pibIUf3+qLTJLpUBj63kogyRSrhLlKoIj9hnPt/Bv0onkMIdS5ci5JVncTYEY5gayTCb8Tilq+ DOeStdEObylbdRE9O35R/Ieif6/cs6he7iB2RxcU1TOdlUR7S7AOTpeUN5uQtEQKkAFE560gkEO 0I70691h8RJ+/z04Su3AU6JfvIi/aJRNT8vJnANVSczkAMg0qY/qK3owkrZzwEe+OkNs1TXqhMn 93h/68baGdXCW0p4qGl2nlOYbe7Pk2/r4PgOPTtl1JGuyoaGbrmyVNmTQtCaOgr2StrDFDmLqdY MKBVUVQk8BOid6B4nYOens1zzK/WfMOTtAPO4IFmS2cE76XkieTzgLSgdUcLCGZF2iG1RSqG6IQ jHN9uSXjLHA/tlhHvxmP4AQhYvAJthXJmdu6oBwXIosPV3odLP+8Y0QlMSw2kG0Xtxd7sOfZvBV +pOUdZ60pmFJKPnT8SU8Sfo1BjxArZnN7evYc7mDEU+AXJOMKjtx8wvu7I5+iw3DzxIpcAt9V2R DmXD6m+pLHlNvtA== X-Mailer: b4 0.14.2 Message-ID: <20251128-gpuvm-rust-v1-3-ebf66bf234e0@google.com> Subject: [PATCH 3/4] drm/gpuvm: use const for drm_gpuva_op_* ptrs From: Alice Ryhl To: Danilo Krummrich , Daniel Almeida Cc: Matthew Brost , "=?utf-8?q?Thomas_Hellstr=C3=B6m?=" , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Boris Brezillon , Steven Price , Liviu Dudau , Miguel Ojeda , Boqun Feng , Gary Guo , "=?utf-8?q?Bj=C3=B6rn_Roy_Baron?=" , Benno Lossin , Andreas Hindborg , Trevor Gross , Frank Binns , Matt Coster , Rob Clark , Dmitry Baryshkov , Abhinav Kumar , Jessica Zhang , Sean Paul , Marijn Suijten , Lyude Paul , Lucas De Marchi , Rodrigo Vivi , Sumit Semwal , "=?utf-8?q?Christian_K=C3=B6nig?=" , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org, nouveau@lists.freedesktop.org, intel-xe@lists.freedesktop.org, linux-media@vger.kernel.org, linaro-mm-sig@lists.linaro.org, Alice Ryhl Content-Type: text/plain; charset="utf-8" These methods just read the values stored in the op pointers without modifying them, so it is appropriate to use const ptrs here. This allows us to avoid const -> mut pointer casts in Rust. Signed-off-by: Alice Ryhl --- drivers/gpu/drm/drm_gpuvm.c | 6 +++--- include/drm/drm_gpuvm.h | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/drm_gpuvm.c b/drivers/gpu/drm/drm_gpuvm.c index 9cd06c7600dc32ceee0f0beb5e3daf31698a66b3..e06b58aabb8ea6ebd92c625583ae2852c9d2caf1 100644 --- a/drivers/gpu/drm/drm_gpuvm.c +++ b/drivers/gpu/drm/drm_gpuvm.c @@ -2283,7 +2283,7 @@ EXPORT_SYMBOL_GPL(drm_gpuvm_interval_empty); void drm_gpuva_map(struct drm_gpuvm *gpuvm, struct drm_gpuva *va, - struct drm_gpuva_op_map *op) + const struct drm_gpuva_op_map *op) { drm_gpuva_init_from_op(va, op); drm_gpuva_insert(gpuvm, va); @@ -2303,7 +2303,7 @@ EXPORT_SYMBOL_GPL(drm_gpuva_map); void drm_gpuva_remap(struct drm_gpuva *prev, struct drm_gpuva *next, - struct drm_gpuva_op_remap *op) + const struct drm_gpuva_op_remap *op) { struct drm_gpuva *va = op->unmap->va; struct drm_gpuvm *gpuvm = va->vm; @@ -2330,7 +2330,7 @@ EXPORT_SYMBOL_GPL(drm_gpuva_remap); * Removes the &drm_gpuva associated with the &drm_gpuva_op_unmap. */ void -drm_gpuva_unmap(struct drm_gpuva_op_unmap *op) +drm_gpuva_unmap(const struct drm_gpuva_op_unmap *op) { drm_gpuva_remove(op->va); } diff --git a/include/drm/drm_gpuvm.h b/include/drm/drm_gpuvm.h index 0d3fc1f6cac9966a42f3bc82b0b491bfefaf5b96..655bd9104ffb24170fca14dfa034ee79f5400930 100644 --- a/include/drm/drm_gpuvm.h +++ b/include/drm/drm_gpuvm.h @@ -1121,7 +1121,7 @@ void drm_gpuva_ops_free(struct drm_gpuvm *gpuvm, struct drm_gpuva_ops *ops); static inline void drm_gpuva_init_from_op(struct drm_gpuva *va, - struct drm_gpuva_op_map *op) + const struct drm_gpuva_op_map *op) { va->va.addr = op->va.addr; va->va.range = op->va.range; @@ -1265,13 +1265,13 @@ int drm_gpuvm_sm_unmap_exec_lock(struct drm_gpuvm *gpuvm, struct drm_exec *exec, void drm_gpuva_map(struct drm_gpuvm *gpuvm, struct drm_gpuva *va, - struct drm_gpuva_op_map *op); + const struct drm_gpuva_op_map *op); void drm_gpuva_remap(struct drm_gpuva *prev, struct drm_gpuva *next, - struct drm_gpuva_op_remap *op); + const struct drm_gpuva_op_remap *op); -void drm_gpuva_unmap(struct drm_gpuva_op_unmap *op); +void drm_gpuva_unmap(const struct drm_gpuva_op_unmap *op); /** * drm_gpuva_op_remap_to_unmap_range() - Helper to get the start and range of -- 2.52.0.487.g5c8c507ade-goog