From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f46.google.com (mail-wm1-f46.google.com [209.85.128.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 00BFD2561AA for ; Fri, 30 Jan 2026 15:17:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.46 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769786279; cv=none; b=OdMRGXyboiNZVWBMqG/sddFsNA+BTmXhl+75RxuQt9KbnufWC5GmM6TXrbylB+sEpjO4GUZZAJHtK8gz0RDPeW9qc2q0I4mt1UcRfimAz31xOy1wJ4ptPHpiKuPFCqP+/7Zid6RC7lwl3fD9KJ7LuiwJ8eRtT073tfHdq0s4mpc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769786279; c=relaxed/simple; bh=GoQa+tlEfWAfVAkglf8uK+PhFJSjIddhRLSA78T0tVU=; h=Mime-Version:Content-Type:Date:Message-Id:From:To:Cc:Subject: References:In-Reply-To; b=r6KwMlGip2qdX8YMjVdzZjlD7AJULoZYL41KvpbNlwR61u3C4LPno++8D2oVQDY/AU8q/SXCjUEv900gD7LpOLaiL8gUbTPVrMNAF87IuQNzftoS7CMsNwbk+GH2OVHKOZQUF5EQosknq6GbQCv3AX14EGXDTbkyCHGtTkkce+E= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b=pqmYe+gd; arc=none smtp.client-ip=209.85.128.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b="pqmYe+gd" Received: by mail-wm1-f46.google.com with SMTP id 5b1f17b1804b1-480706554beso23633135e9.1 for ; Fri, 30 Jan 2026 07:17:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1769786275; x=1770391075; darn=vger.kernel.org; h=in-reply-to:references:subject:cc:to:from:message-id:date :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=xTbNqNAdxVbkf75Flp3Gl+O5ylhMpFnB8e4aBYS8DCA=; b=pqmYe+gdnvMM7kL1mVF+jrWl6PjeAihZEi5kqwWItgucA/+2DLmg+0piP5wmQka5uR 6ayPVevZvQp/0EZIxxYh+FB5dO/pxDNo34QoqCwSZ9N6zZQhc3MvUtK1BGB46fP2B+zy W963KDUjO0PTmqTeJIMel/42k/9c51vvcG74xKtBlVkS8R/HwhHOALvmSkf+fS3du1UP eiDQj+/SppH/KY7CBf/1NqewlKza9HQip9/Ap+YEbfB4yAsItm+Kclxd69T4USDd363K 0CtzvtzREqA4qvRP6mrxqVpFL7Ckk6Obbxl2/NXHr05Q03Iom7XwkxHaeyvvKpqIhK5Q gUew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769786275; x=1770391075; h=in-reply-to:references:subject:cc:to:from:message-id:date :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=xTbNqNAdxVbkf75Flp3Gl+O5ylhMpFnB8e4aBYS8DCA=; b=X9xUI/NRg06HkmXOzmDdWBFG5jLJtWN9IV8H5+Kv2rkzuLLYk600xRk1jVJp+qp+Yf Nzb+xSnbvm50f8YbFs7YdgErAoqZ9A2NCIJ8FspQcsQSfIUx6i1J1Mo11tM2Jzdjc7qd c/Wuj1QHuNPM+HQuuWn8V3Vdff8qCZDrfGdDM/93Tmp7wFxiU61a9Hlla6BSoaSfjwqA i4b+eXjC/VLMpVPelqHADKmLJfHUSzk+wHz6IJyf2FGBX4PxHloFQqntgy+rTMi9GkqT BLy8VFKJgGQblbihGnTW/Bl1QY/OumKO9a2lrZNC/Z14GyoOASSr+Od+kLwl/QOIhne2 hlrQ== X-Forwarded-Encrypted: i=1; AJvYcCUvzRfy3qx13zVh7RR5vyok41sn/LWZo4UBzSK5R4ZQQoEyh2icw5XQDcnyaKHDT/zy8kYzXCWvmH8T44c=@vger.kernel.org X-Gm-Message-State: AOJu0YwEXK6syittpOQSjt6aFHcG6GqgkEJwQiXcpGzeWPDHLI7aQWaJ 5KgJ5jMxcC8v0WEHfrQ83LwdaG3fuxhYxXsJKQPm5ex93QFInTbLQVdy2HJw12Jd6Oo= X-Gm-Gg: AZuq6aI1wZO9i3eC2Fkl0NaYrlIZa0gaSkd+20oQkvO+kI1+oxyomjosmAH4meKJkJe NKwVE17ib+IjfCZqY/C3X8KFvwfonQixWpu09BwKLlRiaPtkd+8595XKm+J/O1K74q8YkEOHybb omgcEsDH5Jj7A+4aEK9MkstKBGfWeR+gQOvVyfAs/xcCNFfBiSwlsfLFh0ecWVWyTz82oLdfesz iDkuKO8wHI/lRFijQWuSQS3X1ajn6bAKyAxzkJEWI7tRiQhGrFlfODcGHsAHdJxokFSfphx23Pt RJK546WHRZ70mXVk5cBg1kb6ugFJ4Y1Cfoz+C+7mx1B+oKwTkoPVKBRcwcWIAkIGQsBhm67itgZ gzVX6Z+2cEczXlxpxjDofPHy4hLElgvtGL9uISxZiVYyu/wuutGcK7bMnaebcJnsdlOLVMV4grE bV5HI= X-Received: by 2002:a05:600c:34cd:b0:480:1a3a:5ce6 with SMTP id 5b1f17b1804b1-482db46b665mr33097925e9.14.1769786275205; Fri, 30 Jan 2026 07:17:55 -0800 (PST) Received: from localhost ([195.52.31.202]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-482dbd4a5b8sm26098425e9.5.2026.01.30.07.17.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Jan 2026 07:17:54 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Type: multipart/signed; boundary=bd99f25f556941090fa298153896a99ecc2df16c80886f0a7bc98102e039; micalg=pgp-sha512; protocol="application/pgp-signature" Date: Fri, 30 Jan 2026 16:17:26 +0100 Message-Id: From: "Markus Schneider-Pargmann" To: "Daniel Lezcano" , "Markus Schneider-Pargmann (TI.com)" , "Thomas Gleixner" Cc: "Vishal Mahaveer" , "Kevin Hilman" , "Dhruva Gole" , "Sebin Francis" , "Kendall Willis" , "Akashdeep Kaur" , Subject: Re: [PATCH v2 2/3] clocksource/drivers/timer-ti-dm: Add clocksource support X-Mailer: aerc 0.21.0 References: <20251216-topic-ti-dm-clkevt-v6-16-v2-0-bfd7dd085c19@baylibre.com> <20251216-topic-ti-dm-clkevt-v6-16-v2-2-bfd7dd085c19@baylibre.com> <9563edd5-aa0c-4a43-9a42-15fd34e1c918@linaro.org> In-Reply-To: <9563edd5-aa0c-4a43-9a42-15fd34e1c918@linaro.org> --bd99f25f556941090fa298153896a99ecc2df16c80886f0a7bc98102e039 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Hi Daniel, On Tue Jan 20, 2026 at 4:04 PM CET, Daniel Lezcano wrote: > On 12/16/25 21:03, Markus Schneider-Pargmann (TI.com) wrote: >> Add support for using the TI Dual-Mode Timer as a clocksource. The >> driver automatically picks the first timer that is marked as always-on >> on with the "ti,timer-alwon" property to be the clocksource. >>=20 >> The timer can then be used for CPU independent time keeping. >>=20 >> Signed-off-by: Markus Schneider-Pargmann (TI.com) >> --- > > [ ... ] > >> +static int omap_dm_timer_setup_clocksource(struct dmtimer *timer) >> +{ >> + struct device *dev =3D &timer->pdev->dev; >> + struct dmtimer_clocksource *clksrc; >> + int err; >> + >> + __omap_dm_timer_init_regs(timer); >> + >> + timer->reserved =3D 1; >> + >> + clksrc =3D devm_kzalloc(dev, sizeof(*clksrc), GFP_KERNEL); >> + if (!clksrc) >> + return -ENOMEM; > > [ ... ] > >> + clksrc->timer =3D timer; >> + timer->clksrc =3D clksrc; > > This is a cyclic dependency which is not desired in general. > > I suggest to have struct dmtimer_clocksource containing struct dmtimer ti= mer Thank you! Not many timers will probably have the clocksource part setup, so I didn't like to embed struct dmtimer into dmtimer_clocksource. I could have used different allocation routines in probe to use either struct dmtimer_clocksource or struct dmtimer directly depending on the use of clocksource, but I wasn't convinced by that either. For the code here I am only having the timer->clksrc pointer to unregister the clocksource in cleanup. So I found devm_add_action_or_reset() which can call the clocksource_unregister and eliminate the need for the pointer. This is also already used in the timer-nxp-stm.c driver. So if you are happy with that, I would prefer that solution. Best Markus --bd99f25f556941090fa298153896a99ecc2df16c80886f0a7bc98102e039 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iKMEABYKAEsWIQSJYVVm/x+5xmOiprOFwVZpkBVKUwUCaXzLiBsUgAAAAAAEAA5t YW51MiwyLjUrMS4xMSwyLDIRHG1zcEBiYXlsaWJyZS5jb20ACgkQhcFWaZAVSlPG 0AEAuoTaiuuODfkyZPvAZ6n6l9FdK01jIyh3QOnjTk94n9YA/3DtW755PFO4aodl Un0Dofj9gtt7hFodtFNwQhj85+oP =hRSP -----END PGP SIGNATURE----- --bd99f25f556941090fa298153896a99ecc2df16c80886f0a7bc98102e039--