From patchwork Thu Dec 18 13:27:40 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alice Ryhl X-Patchwork-Id: 2175572 X-Patchwork-Delegate: michalw628@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20230601 header.b=o2bThxjz; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2600:3c0a:e001:db::12fc:5321; helo=sea.lore.kernel.org; envelope-from=linux-pwm+bounces-7810-incoming=patchwork.ozlabs.org@vger.kernel.org; receiver=patchwork.ozlabs.org) Received: from sea.lore.kernel.org (sea.lore.kernel.org [IPv6:2600:3c0a:e001:db::12fc:5321]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4dXBP62qbhz1y2F for ; Fri, 19 Dec 2025 00:30:18 +1100 (AEDT) Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.90.174.1]) by sea.lore.kernel.org (Postfix) with ESMTP id A707030C1297 for ; Thu, 18 Dec 2025 13:27:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 846DF33F8D7; Thu, 18 Dec 2025 13:27:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="o2bThxjz" X-Original-To: linux-pwm@vger.kernel.org Received: from mail-wm1-f73.google.com (mail-wm1-f73.google.com [209.85.128.73]) (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 D46B433FE00 for ; Thu, 18 Dec 2025 13:27:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.73 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766064474; cv=none; b=PWwdTtuTN2ORAO6CMSUBQGw+r8JGLMiu3hdP+iZSSavAd5J/rHYQLZDYhgoEEzmV49Kz6oBEEgG2j0Ny2pyjaMuTsqD1Yvia7ASeAENfGisyYCIHZQV4z2RUIL+NjTNoyaNZT8w5EOCAGtbGJEF8PhJuI9ASk0AQAYYiRNgxd6g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766064474; c=relaxed/simple; bh=GfyAuLsrs0QXvlLECZS+Ag8ZW62Fz2Y2rspmoop5J3s=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=SckD2d+8pyhvEJPM/zlct1JYgzkn7qvYgOyKPKzWXMA30K8u2rIjM4jh0l8w1d37qq8UM6f7dfOQaYPEGvqgxIh72/7F7G8ribUl+4v/qeVOcXdhqSU+5NOm6nZZbxpfXPcRbTm+IB6KE1nhSf5Rt8a6pylvz+gMGO96l/ZlYlI= 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=o2bThxjz; arc=none smtp.client-ip=209.85.128.73 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 Received: by mail-wm1-f73.google.com with SMTP id 5b1f17b1804b1-477cf25ceccso6923585e9.0 for ; Thu, 18 Dec 2025 05:27:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1766064470; x=1766669270; 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=jK28JFeXstDuyy0FEYnFWM4ECthU7/SRvZ+Uc2K8TMM=; b=o2bThxjzPnLXU9L9oDeGhOZkES3GeRTi1zL3NrEGaNdq5jkqWT6YufCyA5opuTtGEv 02oZOcKKVPzPb46XSEH/6HgYmoFn7eNtH7QHv7VUaAbf6JphZnkBv2nWSls+eo8D9fiZ 0phoA9jebLIq1vz0AeUAgYhIrIL28aBA7b3L4U0/HKp8Pm+b5ofzMi0xjqMk+5RE8QIT UYvW76TLJ8tiMGG0gZDR6yG0Xf0xK2pTrzeV82VfHuE5IYEQD4K0cW/YQS9P/BwNi5k9 /AmJ/4K1dD20yGEL71Z9pOKA4bvSpm5v8dlk5+WWJrgD9bB+LDB5oe6tXmjgVOyhxHwU vS6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766064470; x=1766669270; 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=jK28JFeXstDuyy0FEYnFWM4ECthU7/SRvZ+Uc2K8TMM=; b=OqOlctC5OLRqmC9SkyDUedUcVfQPXX69Hmj5G70QeiFs5tyZRIQI7a6bl8coPx1ug4 f11SLAa2QC/zatMmbyXnAIsBpuXWhiWsql3gyXZwc0bwui8sNfWflkPdKy18V/n/4udh BNVeEBeFtf6x+krMekKS3AXPIEDzNGcO/81i6POngSr6Wply/mMQLYD5ZJoD1UL084ZL qkG4qk1oLW0gfvcFKMz9dv300fef7K272P12mMivtqie6OKrO0Y/e2RXl/4a+Nh1vaMI LBUbPwEIuT0GvDtciTA5E5aCTWyP9k56K2buPpSUwO32WUW9E/fl6r8SmsjFHDjz0YpR 89lQ== X-Forwarded-Encrypted: i=1; AJvYcCVSrn90G48dcbwllKF0tYp2mj3fmH7Gap5paPQ3DKUWmgsT8dQur6gx4RHLNpsEekgrRFol4DJ0e9U=@vger.kernel.org X-Gm-Message-State: AOJu0YzFT9FD0D0k0O0yvfQ3hJAT0fIW7hP3J2OgbPBu/RxTib7R3Xmn FfPJjwAC38IgDCCSioUDAMnuhiwRHjQ0ofacXopThvhzJujicU57/Kp7bgIBethll7pGXFxahPk D/mSdRLiAAh7lZ17L0A== X-Google-Smtp-Source: AGHT+IE3mV0hHlOMpYVWIjAwdmvo5jE0L9sBOpWL6XsbMzQezjxagjqpMFllYAiylsVjD8lLgu0n6vRFRAWYICM= X-Received: from wmgp21.prod.google.com ([2002:a05:600c:2055:b0:477:afa:d217]) (user=aliceryhl job=prod-delivery.src-stubby-dispatcher) by 2002:a05:600c:3104:b0:477:fcb:2256 with SMTP id 5b1f17b1804b1-47a8f906dd3mr228600355e9.17.1766064470141; Thu, 18 Dec 2025 05:27:50 -0800 (PST) Date: Thu, 18 Dec 2025 13:27:40 +0000 In-Reply-To: <20251218-clk-send-sync-v3-0-e48b2e2f1eac@google.com> Precedence: bulk X-Mailing-List: linux-pwm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20251218-clk-send-sync-v3-0-e48b2e2f1eac@google.com> X-Developer-Key: i=aliceryhl@google.com; a=openpgp; fpr=49F6C1FAA74960F43A5B86A1EE7A392FDE96209F X-Developer-Signature: v=1; a=openpgp-sha256; l=1327; i=aliceryhl@google.com; h=from:subject:message-id; bh=GfyAuLsrs0QXvlLECZS+Ag8ZW62Fz2Y2rspmoop5J3s=; b=owEBbQKS/ZANAwAKAQRYvu5YxjlGAcsmYgBpRAFSGE9hInQJ93qtSDZ6USDztanUVRXYt7zuZ u/M3OKN66SJAjMEAAEKAB0WIQSDkqKUTWQHCvFIvbIEWL7uWMY5RgUCaUQBUgAKCRAEWL7uWMY5 RpjnEACSGceY2rPEdAJ9IM0nAQ/WAryJFpSfxt+WLrj3iN4p5BmgrDdLtUBRaFYTYqcli8hAS05 YJwMVlfRAd6iFo4DaO3eqnrvZQRPSaBmxegr8FhHpfv8XSaez94scQlMk6FrcSlvrA6Ee4Gtlwp l+ilXpbYOyAubw6GpjlWswSHxKOg0QwnWCzW2KwjpbXJnfLQ5fH4lcncuzMfaAkPvCFV4t1y2KV kaWXQIWrkEvVGzZJssbmxCb1PvSE6oyjcy3TzBBSM/E1t9jJSdXBS+NfHM5gMDUErPaSO224COW ei9hJ+Rb2IfKuZtQ9gud09brWgGvjaOVaiC9LM5c3bNNygut/rL2sqBDf0eUnTjZZ4hl4T7zj9w q/VO+QeTNdEDV8AfXeYCZs11q9X+mpJK3MYCF7ZLQsBZFOiaSgTwrF5Q7PSXXxL860gZaGED9so hqtSPCzOrli9/mHqIoHfLoSPuUaf2bxTBaNboLD+d8kdD2+h9FLLvMhgGVhXYhEUmOsBKZC9MlN DwpN5R2dUuDE7iXXAi9r6a3YRd7J5IHGfhXALODtLYLu7bdkcna8Ggb35wgjrid9IfeQf9eEdVQ 9zkYMJevx5Tf5DKTw7VxZGkTJHxKfsL+G8+CcVjptxDvHWl4UkCa+/HLohudluaxij+Yf/xnesA vfDaSFT0gn04/pQ== X-Mailer: b4 0.14.2 Message-ID: <20251218-clk-send-sync-v3-1-e48b2e2f1eac@google.com> Subject: [PATCH v3 1/3] rust: clk: implement Send and Sync From: Alice Ryhl To: Michael Turquette , Stephen Boyd , Maarten Lankhorst , Maxime Ripard , Drew Fustini , Guo Ren , Fu Wei , " =?utf-8?q?Uwe_Kle?= =?utf-8?q?ine-K=C3=B6nig?= " , Michal Wilczynski Cc: Viresh Kumar , Miguel Ojeda , Boqun Feng , Gary Guo , " =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= " , Benno Lossin , Andreas Hindborg , Trevor Gross , Danilo Krummrich , Daniel Almeida , linux-clk@vger.kernel.org, rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-riscv@lists.infradead.org, linux-pwm@vger.kernel.org, Alice Ryhl These traits are required for drivers to embed the Clk type in their own data structures because driver data structures are usually required to be Send. Since the Clk type is thread-safe, implement the relevant traits. Reviewed-by: Daniel Almeida Reviewed-by: Danilo Krummrich Acked-by: Viresh Kumar Reviewed-by: Boqun Feng Signed-off-by: Alice Ryhl --- rust/kernel/clk.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/rust/kernel/clk.rs b/rust/kernel/clk.rs index c1cfaeaa36a22be2e3180b1e9142bb608ab276ea..d192fbd97861212d738d24510eebcd99c9177f2c 100644 --- a/rust/kernel/clk.rs +++ b/rust/kernel/clk.rs @@ -129,6 +129,13 @@ mod common_clk { #[repr(transparent)] pub struct Clk(*mut bindings::clk); + // SAFETY: It is safe to call `clk_put` on another thread than where `clk_get` was called. + unsafe impl Send for Clk {} + + // SAFETY: It is safe to call any combination of the `&self` methods in parallel, as the + // methods are synchronized internally. + unsafe impl Sync for Clk {} + impl Clk { /// Gets [`Clk`] corresponding to a [`Device`] and a connection id. /// From patchwork Thu Dec 18 13:27:41 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alice Ryhl X-Patchwork-Id: 2175573 X-Patchwork-Delegate: michalw628@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20230601 header.b=rTX3urqp; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2600:3c0a:e001:db::12fc:5321; helo=sea.lore.kernel.org; envelope-from=linux-pwm+bounces-7811-incoming=patchwork.ozlabs.org@vger.kernel.org; receiver=patchwork.ozlabs.org) Received: from sea.lore.kernel.org (sea.lore.kernel.org [IPv6:2600:3c0a:e001:db::12fc:5321]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4dXBPX5TYyz1y2F for ; Fri, 19 Dec 2025 00:30:40 +1100 (AEDT) Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.90.174.1]) by sea.lore.kernel.org (Postfix) with ESMTP id E0EA8304ACB1 for ; Thu, 18 Dec 2025 13:27:56 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2BD3833FE05; Thu, 18 Dec 2025 13:27:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="rTX3urqp" X-Original-To: linux-pwm@vger.kernel.org Received: from mail-ed1-f74.google.com (mail-ed1-f74.google.com [209.85.208.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 ED7C233F8BD for ; Thu, 18 Dec 2025 13:27:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.74 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766064476; cv=none; b=UbVVZ4oKfFcIvFSTQpBRIoO/dweiWZHfLZ/7jJkVmco3C3lXG5tcGPpIdPiSF+36h2HIphRx0beRSbSkaoNY5s3OsdgiZtTEZ7Y4rdVwWbNg1WcT8uylNlfuQMC26VNlljNTZ3Iz+K/wZxAa3x/5xZonsbwdGfFJ5agMvXBdbIE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766064476; c=relaxed/simple; bh=F1lcAFNww32YALWPOxbeZmA3ejiotHsR5mfwB5toNyY=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=JZZ5xG82Jjc3WvemqBS2CM96yiMZFW7YNGX2XtfKfYqsqqtl34I596WFxrgxJLo/zsskDwnxuEt8jQw5bn5LdNII4KWPR0kMqr2XkC0utFO0vwbLV639024vhwtFUb7dQs9EVIYFALq/GjbeRABBmN+g93MJuywVki/Z3R4AApY= 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=rTX3urqp; arc=none smtp.client-ip=209.85.208.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 Received: by mail-ed1-f74.google.com with SMTP id 4fb4d7f45d1cf-64537824851so633522a12.1 for ; Thu, 18 Dec 2025 05:27:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1766064472; x=1766669272; 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=uPptdLMQzSRoeYj6Hrjl7dIAj/bZbKtg9ZgsU3qRcP4=; b=rTX3urqpBK9qP2PTRcf1RL/jXbbwNTuDxREnG4sVr2/pZ9M8WHReJlhZdbYxdCuV3D jso+sO2FDEqV7YO1l5+LmwMDCyv5Ykow4UhZjFybH+jC2WIxPF3PCQJMYV8xP4HiczFH Cf0dObKqmUPRT7ZWpzICyX7PEMa3V+UvmWJj3m7DLtPOVk/aeSX6SqyCVJN7iavG38lG Zk8jujUq6cYVI7cQbTYyke1EgN5e7ahJISUx3LfBoKcaapwk0ZGpq0ZfJ9NBpDG6hgz9 NbljBh3JOxpZPhWSdw7dAbYu6yAH6nADpRrj2z+CLYKHxDJuYZoY80JzPpK+6ayg7q+N 5HDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766064472; x=1766669272; 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=uPptdLMQzSRoeYj6Hrjl7dIAj/bZbKtg9ZgsU3qRcP4=; b=iDTqaFZexLmPC9CBsFeQEQP+oPlSrmRjZ8MEHRuflA1FSVqBZMwCxt6gjMVt9s7394 5XAgtGqlewpcFn/bqqSw/kmbPBddjEXk3KdQQk9QP3u8ipImJowvNZeYW322JdYvtbGx 3Tm7StarTJmj72tYwIyvy2qQfBhrx4UOy695VYRTozPMUCbRyLtbwMNzbYIRqalM5u5M +qR5E9tVpUl1irONiW9P4qVbmfSN8m50u2d/j+ZyOhRsvo8Nq+c3M6fJ73/rpow+IRWo 4QHAkG8T6NJd0sWcXdGxDqKMUWU1obPM/vDdXr9zKOs6Tfr0/E9zM8jcRfVcNuQy+Vu3 6tjg== X-Forwarded-Encrypted: i=1; AJvYcCU6pR4Urtv1VhjVPfoTlAzHoGIZSVQ5+AJx/vzs2MNS1S5C04zOoSt0t4Jw4tWB9dG1IXAmS/NyvDI=@vger.kernel.org X-Gm-Message-State: AOJu0Yxt+wq1UG/LNzpq32gM6lF9+Lu3FTB6h2QuNwmtr5p5vh3NnXfv CSnKEJkRy8HHHTwY/NPBKOmih+i949KEIdwdiGfRp4FSj2JpS8DdXvssrSpGU3lRzH30kaqeJnx fHV0UA9HnUDzIJJmlPw== X-Google-Smtp-Source: AGHT+IEqPOft361pJTlpzbo4r1Az15cTuwMQEfh5KrGil6c5DKT9dTPisXdo2WdHWgmo3QB8gCSt51uaXvkVnKs= X-Received: from edtb2.prod.google.com ([2002:aa7:c902:0:b0:64b:3f32:3786]) (user=aliceryhl job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6402:510c:b0:649:aa2b:d34e with SMTP id 4fb4d7f45d1cf-649aa2bd4d5mr19796028a12.34.1766064472249; Thu, 18 Dec 2025 05:27:52 -0800 (PST) Date: Thu, 18 Dec 2025 13:27:41 +0000 In-Reply-To: <20251218-clk-send-sync-v3-0-e48b2e2f1eac@google.com> Precedence: bulk X-Mailing-List: linux-pwm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20251218-clk-send-sync-v3-0-e48b2e2f1eac@google.com> X-Developer-Key: i=aliceryhl@google.com; a=openpgp; fpr=49F6C1FAA74960F43A5B86A1EE7A392FDE96209F X-Developer-Signature: v=1; a=openpgp-sha256; l=1600; i=aliceryhl@google.com; h=from:subject:message-id; bh=F1lcAFNww32YALWPOxbeZmA3ejiotHsR5mfwB5toNyY=; b=owEBbQKS/ZANAwAKAQRYvu5YxjlGAcsmYgBpRAFSWSny77iwIsGzKsSzrxHbWYGRidi4wKUj+ ky0LI75Ss2JAjMEAAEKAB0WIQSDkqKUTWQHCvFIvbIEWL7uWMY5RgUCaUQBUgAKCRAEWL7uWMY5 RvgbD/0e4oYtNdP81rAHg3z94FA3jXour1f/plwNgEk/ZamK57EcpX33mAyVLYHcizYsBAXobj8 am8MyWvLYn6vpr7tx2LS7NZKRpaDdKtU8hLtv4kiTrUqlXTHc2gdDX+4bUPvbHaucO/SaM0cwhH YmdiCosFbFZKnHVwGbfbiOK0e/NfqRfDUckj/cxh4YB5cCtDV8FFyJ3kkDdAxM0dGs4OLipgI4h i5CMx4B1rrv2P9G/QlL/fSDjJ43XH4475E9YOsLEvPEhAYlLIYUzo/rE/Kaeu6PICY8hh1yy6Fv STETnhmW/mMc1h/YSnBddXnFklCoCMHGWZzwUNVhbINFR9wXTZ9dORQQEC/kQKrz3HB9mCUHavC AKTMK8M518WNFW/KmcpCQuCUV/QMzh53S1dqxnOGrFXOkyTT1J8DV7ILO1B1djcUFyYWghNR8Ip ghgLFaoKreKay09TC/pz6aQe6oegcfGdVHZeCwrF783LbaefHkCwnQxgq93CoWD4SaDxVdptyiU c3VFdxgQUkPGbHHH9zk5ct26cnzGalmVDInhx915An/XkyBHna1HZl1I7dkY5je4cJxn8iXJi9n ezwBfnj1zNVzI053FQL7sgbp13dOehoXQV30MffCZQ21N9huXxaq2USl3CSpqC1SP89Y7AVazfB RhbcohkXt0oVDGw== X-Mailer: b4 0.14.2 Message-ID: <20251218-clk-send-sync-v3-2-e48b2e2f1eac@google.com> Subject: [PATCH v3 2/3] tyr: remove impl Send/Sync for TyrData From: Alice Ryhl To: Michael Turquette , Stephen Boyd , Maarten Lankhorst , Maxime Ripard , Drew Fustini , Guo Ren , Fu Wei , " =?utf-8?q?Uwe_Kle?= =?utf-8?q?ine-K=C3=B6nig?= " , Michal Wilczynski Cc: Viresh Kumar , Miguel Ojeda , Boqun Feng , Gary Guo , " =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= " , Benno Lossin , Andreas Hindborg , Trevor Gross , Danilo Krummrich , Daniel Almeida , linux-clk@vger.kernel.org, rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-riscv@lists.infradead.org, linux-pwm@vger.kernel.org, Alice Ryhl Now that clk implements Send and Sync, we no longer need to manually implement these traits for TyrData. Thus remove the implementations. The comment also mentions the regulator. However, the regulator had the traits added in commit 9a200cbdb543 ("rust: regulator: implement Send and Sync for Regulator"), which is already in mainline. Reviewed-by: Danilo Krummrich Reviewed-by: Boqun Feng Signed-off-by: Alice Ryhl --- drivers/gpu/drm/tyr/driver.rs | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/drivers/gpu/drm/tyr/driver.rs b/drivers/gpu/drm/tyr/driver.rs index 0389c558c0367522471ea78fcf72a6b58c4a3650..09711fb7fe0b1c83b72bffba06f5a76c53244f4d 100644 --- a/drivers/gpu/drm/tyr/driver.rs +++ b/drivers/gpu/drm/tyr/driver.rs @@ -53,18 +53,6 @@ pub(crate) struct TyrData { pub(crate) gpu_info: GpuInfo, } -// Both `Clk` and `Regulator` do not implement `Send` or `Sync`, but they -// should. There are patches on the mailing list to address this, but they have -// not landed yet. -// -// For now, add this workaround so that this patch compiles with the promise -// that it will be removed in a future patch. -// -// SAFETY: This will be removed in a future patch. -unsafe impl Send for TyrData {} -// SAFETY: This will be removed in a future patch. -unsafe impl Sync for TyrData {} - fn issue_soft_reset(dev: &Device, iomem: &Devres) -> Result { regs::GPU_CMD.write(dev, iomem, regs::GPU_CMD_SOFT_RESET)?; From patchwork Thu Dec 18 13:27:42 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alice Ryhl X-Patchwork-Id: 2175574 X-Patchwork-Delegate: michalw628@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20230601 header.b=TV8A1nRc; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2600:3c0a:e001:db::12fc:5321; helo=sea.lore.kernel.org; envelope-from=linux-pwm+bounces-7812-incoming=patchwork.ozlabs.org@vger.kernel.org; receiver=patchwork.ozlabs.org) Received: from sea.lore.kernel.org (sea.lore.kernel.org [IPv6:2600:3c0a:e001:db::12fc:5321]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4dXBQ704HWz1y2F for ; Fri, 19 Dec 2025 00:31:11 +1100 (AEDT) Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.90.174.1]) by sea.lore.kernel.org (Postfix) with ESMTP id 8CD7C30E3612 for ; Thu, 18 Dec 2025 13:28:00 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B86A1340A72; Thu, 18 Dec 2025 13:27:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="TV8A1nRc" X-Original-To: linux-pwm@vger.kernel.org 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 764BF30C37A for ; Thu, 18 Dec 2025 13:27:55 +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=1766064477; cv=none; b=J+8V38DaDH3n80L1PZEVR6S1/mJ9m0LUN7zqTrnnh421V1i8beXOTT7VOGnZjZWbUM2oc5KAP2f539ealo0tsUXKhdNL+QY90x0FDFT6mGKde/NEQpEIKcGLhOa4GXWPsFF3QxA8PBxXubNz8OSMxzYLpZZLavnEk3EKq2dqLFk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766064477; c=relaxed/simple; bh=hJ1r8AWFe6vjamRRbSdgVoDTTorMAE8/5j325qhqRPo=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=hVE0bWlcZPAxTTo1UTLB+AnnaEnTRqKwS/C6LF3CgIqiog+Jx7ShczCn4Oue5MaP9vGHPWRDFPod+R0HnT6KkNII9OAaDwu+MgqeSXnvz7x3wsJJROBJzNIaxMzgiRa5dUpHrw51AW7cvU+mFaLbe7Ul6IHpKTUtdJoEL+zLw8c= 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=TV8A1nRc; 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 Received: by mail-wm1-f74.google.com with SMTP id 5b1f17b1804b1-47904cdb9bbso14593525e9.1 for ; Thu, 18 Dec 2025 05:27:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1766064474; x=1766669274; 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=qz+Ave0Rr+pYsqesYd5D1VozD7cgPG0dKKZRCf4yYNk=; b=TV8A1nRcz/oC96zAeVzo+zhJTtGBd9/2eCnDphSgBveSFMm9fszeVyRBUtQ3ntEzod hnNKJVDK2bJ+3uPAL+oNrVrJbiMFzoDTkgec+Lf5yo4bJ0a5XmWOY9T4+yJQITL+trR1 LIOn/XzrrMQ9+fric3Fs1oFgu2azoq2iv65g76q2Li/uVZuWAP/6nmZwyHhx4Z6YKoyk Bue13NiY9/5IVUXhXmnowqryEJ+gtk3W6Z98vCrbXDe63ttS9oHRmLJjnQHQ+YvUi5MJ NVt1pxjsPgNyQ2mXlfdd8oJnv3LCxv40X5w8qhmHjn2ND08tzqxHv6Bs3sjH+mxnVtbP BDrA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766064474; x=1766669274; 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=qz+Ave0Rr+pYsqesYd5D1VozD7cgPG0dKKZRCf4yYNk=; b=EkMtBf4MfMl69NV965CMFioVXSU3grMZS7PO01iDttlEMaw1XAgqYd5L3fTv/DUPXE n//LR5RCOmC6GgB8Zn8Ya9nZUCNwT2l/VFBFXzEYqKllR784EEjePqTwx3+7TesVAvow 5e99TKBeGth3A/Lt0pm/ZKCfsNrv8kIFMhwfdxOg3swJ7rp9r0B5mODlu+1ZLjNGRpMs iHd7MYaRCorTIuy6BoMrgvhpvnLttjInCXpp/emiH9IKZcqzG9WBCFuEf+wWOYXJVDpU 6SPxRHKtZTpLO6+IraqXsrE2Q0WTtmLAPZpto6b65KRmVq70HVOMt/gqe2uKe5SWYVNr AhHg== X-Forwarded-Encrypted: i=1; AJvYcCXTJMg7PH7Jn/bm9jyOhbRO1WbjpSxRBdYKwDhEnpvv9UfMEzVJ9oXvQWjxTVCfzogeRD6i51cFl/c=@vger.kernel.org X-Gm-Message-State: AOJu0Yy6gef7ht+COl0XmrGxRrgUSL34hG9B9BLUrzSZYNq8Cbi9za7z 1OYCNk1TKtfCti4lCfMQStULcgUfjiLM2ZuwvHQMNgXH4PHpa4T4ZkeAdt7Fd7ZBb0s+awD6qjt cedkdgeTQ3DEZjOZ7UQ== X-Google-Smtp-Source: AGHT+IGlOhSMahMSUEguAwn167F6Fbjkcu8ZrI+51vEqMqCJE+3S5hQDbdF4w5Iw7QzwlTk2wDuRew3DnOxTRuQ= X-Received: from wmpc42.prod.google.com ([2002:a05:600c:4a2a:b0:477:40c1:3e61]) (user=aliceryhl job=prod-delivery.src-stubby-dispatcher) by 2002:a05:600c:45cd:b0:46e:2815:8568 with SMTP id 5b1f17b1804b1-47be29c60fdmr30005265e9.10.1766064473619; Thu, 18 Dec 2025 05:27:53 -0800 (PST) Date: Thu, 18 Dec 2025 13:27:42 +0000 In-Reply-To: <20251218-clk-send-sync-v3-0-e48b2e2f1eac@google.com> Precedence: bulk X-Mailing-List: linux-pwm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20251218-clk-send-sync-v3-0-e48b2e2f1eac@google.com> X-Developer-Key: i=aliceryhl@google.com; a=openpgp; fpr=49F6C1FAA74960F43A5B86A1EE7A392FDE96209F X-Developer-Signature: v=1; a=openpgp-sha256; l=1620; i=aliceryhl@google.com; h=from:subject:message-id; bh=hJ1r8AWFe6vjamRRbSdgVoDTTorMAE8/5j325qhqRPo=; b=owEBbQKS/ZANAwAKAQRYvu5YxjlGAcsmYgBpRAFSiykIxnKvVV7ampJwe+hiZPH4dlKVVfNC2 bRMusCRGIiJAjMEAAEKAB0WIQSDkqKUTWQHCvFIvbIEWL7uWMY5RgUCaUQBUgAKCRAEWL7uWMY5 Rs5ND/9lBcHvvP1F2jrlMF7zlcbzolVf/Ik/QcXkh9CEtamti0oWtsfXPKvcrmdowiTh3qqTeOG d1pcYkv8At0D62DBbQJID40ZEj2jC53yyQTl+JbIxQgkPKYKW/7tiZ/YZ5l4Be6z2ypAJGa6jlu 7P+IO8CGeyODkeDgL0U2tMGXuoKl6vJ9s93DzDVlYt3L2Dx6cpR55jWVWkBfziIoGS9Eei+zk7Z 4ylYtbeoBKVsKs4Ix3y89qYWygDe/wXz0aRIGoDHBiJpBl2ppjbCEhP0PWGQra7A3KUayfL2KYF zmZLGvVKljUBMKcuQTuQUJN31zFt6WU2+ASxRD7tU+8u2vwrGOoiHDCS5fwLhJ12/F3DBE2H4eL vVgQ+jd6O8L4xD7oC1Z77SciJgITmTJCFM/W1W4jBGkk9AFU6+XIyzMnWryfADATfwgdGytDQIu F8KCpPdYrWW3vo38v9f5rhole5bvAC9Eh3vo2PyGcGLpjIqimDbqTsLCSvJmm/yQa0TbMqIXp5a ya9OwwArkL66kUK/YcdhJDrrJZXsHnkTxjYNekN0UfUNnAkWUl7AO9hiAu/V0GLq7YAfVjeSoGl 4Gq54cB6CKjvPxv7GEqVbzEqyOnzjEJ8wCcU96VlVrvDrX57llCh1ppRHSozowXpxgScpJ/166f Mej0UG+6YnuMTlQ== X-Mailer: b4 0.14.2 Message-ID: <20251218-clk-send-sync-v3-3-e48b2e2f1eac@google.com> Subject: [PATCH v3 3/3] pwm: th1520: remove impl Send/Sync for Th1520PwmDriverData From: Alice Ryhl To: Michael Turquette , Stephen Boyd , Maarten Lankhorst , Maxime Ripard , Drew Fustini , Guo Ren , Fu Wei , " =?utf-8?q?Uwe_Kle?= =?utf-8?q?ine-K=C3=B6nig?= " , Michal Wilczynski Cc: Viresh Kumar , Miguel Ojeda , Boqun Feng , Gary Guo , " =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= " , Benno Lossin , Andreas Hindborg , Trevor Gross , Danilo Krummrich , Daniel Almeida , linux-clk@vger.kernel.org, rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-riscv@lists.infradead.org, linux-pwm@vger.kernel.org, Alice Ryhl Now that clk implements Send and Sync, we no longer need to manually implement these traits for Th1520PwmDriverData. Thus remove the implementations. Signed-off-by: Alice Ryhl --- drivers/pwm/pwm_th1520.rs | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/drivers/pwm/pwm_th1520.rs b/drivers/pwm/pwm_th1520.rs index e3b7e77356fc2492077c519073e861beb3e44df9..043dc4dbc6232020195c7b73fad302bbb69652df 100644 --- a/drivers/pwm/pwm_th1520.rs +++ b/drivers/pwm/pwm_th1520.rs @@ -97,21 +97,6 @@ struct Th1520PwmDriverData { clk: Clk, } -// This `unsafe` implementation is a temporary necessity because the underlying `kernel::clk::Clk` -// type does not yet expose `Send` and `Sync` implementations. This block should be removed -// as soon as the clock abstraction provides these guarantees directly. -// TODO: Remove those unsafe impl's when Clk will support them itself. - -// SAFETY: The `devres` framework requires the driver's private data to be `Send` and `Sync`. -// We can guarantee this because the PWM core synchronizes all callbacks, preventing concurrent -// access to the contained `iomem` and `clk` resources. -unsafe impl Send for Th1520PwmDriverData {} - -// SAFETY: The same reasoning applies as for `Send`. The PWM core's synchronization -// guarantees that it is safe for multiple threads to have shared access (`&self`) -// to the driver data during callbacks. -unsafe impl Sync for Th1520PwmDriverData {} - impl pwm::PwmOps for Th1520PwmDriverData { type WfHw = Th1520WfHw;