From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.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 0A26847B41D for ; Wed, 6 May 2026 13:53:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778075591; cv=none; b=PT2uOtrT3Lcl352m/bnlMymcQlIQJrLeKXpcJ+tve3QwWWWKxplIB+153nAgovb9H4s/gNqUvkxH2ExLzKRhZ6mEhBJy2XtJi/3ins3zrjBmv9KDBqFMXrQ9xmCcUaPepGmQWbWMbdSaWxb9Qb21Xd3EAAtov8xv0TgmJP0gm4k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778075591; c=relaxed/simple; bh=WAhgKH+qePHM5SpExGupJ8TlgBRx735/DFS1k1mLqiU=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=m4CYiKZQ5J7V/ncfKUYyjDOTmYyGhMlhfhw1ae69WE0nnbvJS9khtqHjqGTJcNAjBZbfZpyWwvayC2i5Y6/2O/UYmxJ/U/Yj7JItWooJ47CM4QUmVOoPGRhOA03jVkKqJs8R8voWs+AHPUySRka/w9nwTsZ1pqxfcQG517b/ZMI= 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=KTUVfcb9; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=ekeWC3Tr; arc=none smtp.client-ip=205.220.168.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="KTUVfcb9"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="ekeWC3Tr" Received: from pps.filterd (m0279867.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 646A3Vew1953122 for ; Wed, 6 May 2026 13:53:07 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=3RWqSyd18x4c3XFp3FDISw6kl2HFq05OZTf 2V4KJ9/c=; b=KTUVfcb9xoHOtO+xNglp/5XDK3IWVVHmOwTBVRq0J139bzcvAlT Yk4Hx4gbK7Eks4FCMvNqEnp8KwsC18ZV9/1KQVOtEKpiPYOs/NvoCxZcMyNiLYp1 E7PRZv4+0kTiXDFwXycrFUv/hfAYrd/m3AlfmXfYyU4fLuNtCCkPmtJoqFoOkzqF N6fgG4jnqQvi5KFvE09Qg+ug4EhhNLjerePr8HcKsHqDS5BusWcCuS9YgHS0yf5t QcNwIDaeCAZfVtB/FMw1djfYOq2d7wAd0AJMj+bDmFSzsPBc6Vq+C2oZvZzqlk2q kvjuaJWWeqpYmq4xuJE8UpsIKpQgv5+xMCQ== Received: from mail-qt1-f199.google.com (mail-qt1-f199.google.com [209.85.160.199]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4e03jc0r7y-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Wed, 06 May 2026 13:53:07 +0000 (GMT) Received: by mail-qt1-f199.google.com with SMTP id d75a77b69052e-5147078691fso3790231cf.3 for ; Wed, 06 May 2026 06:53:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1778075587; x=1778680387; 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=3RWqSyd18x4c3XFp3FDISw6kl2HFq05OZTf2V4KJ9/c=; b=ekeWC3TrWwvOjkrYdKVm4AsfdmRPBdUMMeXcI31021eoiCAtgljnsWeFQMCBaRxwcO XRb+K+ZxWAQXnheOXyYhLYYb2kftjrZ3XrSmQMcr76IAN+RucLkwBfh/9kWBPbsmmJIn 4OoZxSvSGAYbNIR0nmOLskF905H7JQmHm6qanYsKGc1q1IS3OJqV2MwSIMCGYkCGY+DN HwMVAlsTx6KdtxC39Hlka1eG207Au5853A9U+MkfU6J/+V7MrdLV9l+1w61NEmHd9oa6 S0O+S3fd4OuZtvRqTf73Cv80Z083zI1TBK/rVw704s7qu1ilFOKRWJ1rlJyCSMoaPnZa KVCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778075587; x=1778680387; 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=3RWqSyd18x4c3XFp3FDISw6kl2HFq05OZTf2V4KJ9/c=; b=DBucGtWpUjvbLuUB1qH4oB7aYvfb1cKcbDN8zxZN90Azw/vO7a9Ga4iTCJvOXAWz6t oHaKiHEabsna5URESpuEjvYfwQ4TY4WrHWPvw3OOriQxT9iJ3td9iMbIkmaZfXQFfKcs sVbhn3VWs3sFlvmVtRaOaPg+t10/Ax/KyvMDQ8MmS9+rT2BlRVCBI4qKQLfX/n7SWfv2 uBHk9l5GOiLNz1wn3yxAK0acudMiv4gW8WgMI+crQaDPuGi4Y9KJVZ9+JZpaHpCo2jAZ olHxwp0cf1wUr8mmRr1EVwoz67qYKUBvyPbK+qZh3pBY7cG/VJNRGZTz8fqhZ2Zc2G8j qdzg== X-Gm-Message-State: AOJu0YwvXc3ZkJMWRTR76plA1ns04nn4vUOZlT9WcetdiVvWPd0jJv1S H+hgw8HeZJfQQAinCvQeCVxWpzWU1O7omSRcCI5KeYJddxYf0bjR4z+CClBJdpCNP8o9/cXR7+h sYMAF5lEMBYhRUC2ambNNGcwedc7l4gl0dg+deA01ntdBGS+EE57WfTCChN89TEiGH+EAfEUdp1 xEHA== X-Gm-Gg: AeBDieulaoiCZwa7+Ev2i/3sgn9vefqE74rGVL04KHKWItUiQUJrxUerscsSqTtrmHq UaaEjxNr3Y598jnlqwM883zUuBKziGxsz9qD8aChcXOgyS7vquy7TvV8T4q/B0MTX0zLg/wHA/i EAbu8ctnenOvtbf0xctUBap0q0rS6OGRXJDRSCVPbud1LKenZVBg0yTObHTsre1MRJnzXxGT6ab rzJgsSz9UItI+Mm2bx5H/Cip9EnPZWzzvng9ynRxVsZSh7Q6JO0DYOuh+SWESJS5L9Ope4xOV9N NB3HzdGmeTayUdBuqr85pGPo/FigJYBLpH+0dLVi8EjzloWs15Y6/ap/0mHUbaO/82rxcdIMsOo lcggiLOFwDTGn+1WcyPyRO5CH2EtgwLOYlCBaqiv3ZSjV+/A84IBu8qN1vCRh X-Received: by 2002:a05:622a:551b:b0:50e:631c:c390 with SMTP id d75a77b69052e-51461fc4e4fmr47006421cf.44.1778075586612; Wed, 06 May 2026 06:53:06 -0700 (PDT) X-Received: by 2002:a05:622a:551b:b0:50e:631c:c390 with SMTP id d75a77b69052e-51461fc4e4fmr47005901cf.44.1778075586083; Wed, 06 May 2026 06:53:06 -0700 (PDT) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:41ef:7b80:b3e8:2c1a]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48e538a5486sm52091945e9.6.2026.05.06.06.53.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 May 2026 06:53:05 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@oss.qualcomm.com, gregkh@linuxfoundation.org, tglx@kernel.org Cc: linux-kernel@vger.kernel.org, Hans de Goede , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= , Bryan O'Donoghue , Rob Herring Subject: [RFC PATCH 0/1] Timer module support pre-requisite Date: Wed, 6 May 2026 15:52:41 +0200 Message-ID: <20260506135242.4191560-1-daniel.lezcano@oss.qualcomm.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNTA2MDEzNiBTYWx0ZWRfX5mQTjQRsfajP qmf7gs+7RptJtnEuE5Q7iJmzR8WcK5lQnjhbqhX6vX0fcTus9V9dP+1jpBVzJxv6wMGxrtGQRLK W+N+50UjVsawCkq66nwUIGwa/v6Xrih8CgHDPnXZ0wBvms8myrfQjM/p90+Dc2LG0y2A017+KoE gYHAkvNbQ3iwq6V2A/1wpcxxwk+p0PZgmp/JM+ezKC/fuelWBhpIdlSvD5e/D0+AHB2//prXR3h j1QApPCSwbtOmcNUWedveKawYL8QbKzaKLqHtajkfNdyrozkvtuI3u9STLdNl7LKSKevuRZNzFq WeuUQkY0+KqsBWnnp7jpIJOM6T8Ob5nmqt7Vqhh/gnRd4KtSMFmaGlYTGj1gogomt5LnrY4RM5h t+M5OvQ526jZOQPOR4OfJRweGPZEobQefb80ZWom+ajHtROPeyZW/4uzVR8+sMZepE0mrVZ2z2O a7N9e7nsCOVLjJX2f3g== X-Proofpoint-ORIG-GUID: J597UCf5rEqFKsOgs3p5vWUZuESd0jWO X-Proofpoint-GUID: J597UCf5rEqFKsOgs3p5vWUZuESd0jWO X-Authority-Analysis: v=2.4 cv=EpHiaycA c=1 sm=1 tr=0 ts=69fb47c3 cx=c_pps a=WeENfcodrlLV9YRTxbY/uA==:117 a=xqWC_Br6kY4A:10 a=NGcC8JguVDcA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=eoimf2acIAo5FJnRuUoq:22 a=qRvSKwfzJsVpO--2pjcA:9 a=kacYvNCVWA4VmyqE58fU:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-05-05_03,2026-05-06_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 bulkscore=0 priorityscore=1501 malwarescore=0 adultscore=0 impostorscore=0 phishscore=0 lowpriorityscore=0 clxscore=1015 spamscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2604200000 definitions=main-2605060136 Converting the timer driver modules requires a particular care because, depending on the platform, that may be not supported. A previous study showed we are safe regarding how the module refcount is held and if THIS_MODULE is set for the clockevent and the clocksource when they are registered. It won't be possible to unload a module if a clockevent is registered. It will be possible to unload a module if only a clocksource is registered and it is not the current one. However platforms without architected timers may need the timer driver to be initialized very early while others can be initialized later. The former can not be a module and the init function receives a device_node pointer, there is no device associated and devres is not used. That results in a lot of rollbacking code where usually it is where we find bug and resource leaks. The latter can be converted to a module and uses a module_platform_driver(), thus the init function is a probe function receiving a struct platform_device pointer parameter. We end up with two approaches and duplicate code for the init functions. This is not optimal (and ugly). Finally, we have the driver having to be initialized very early on some platforms and be built as a module on other platforms, resulting on having two init functions co-existing in the same driver. The proposed change provides what is needed to move to the same probe function for early init, builtin and module timers. Daniel Lezcano (1): clocksource/drivers/timer-probe: Create a platform_device before the framework is initialized drivers/clocksource/timer-probe.c | 63 ++++++++++++++++++++++++++++++- include/asm-generic/vmlinux.lds.h | 10 +++++ include/linux/clocksource.h | 21 +++++++++++ 3 files changed, 93 insertions(+), 1 deletion(-) -- 2.43.0