From nobody Thu Dec 18 14:10:52 2025 Received: from mail-wr1-f49.google.com (mail-wr1-f49.google.com [209.85.221.49]) (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 8D3D022D4F2 for ; Mon, 2 Jun 2025 15:19:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748877542; cv=none; b=FZ14njqE2AOWGcm4zxU4n6DpfqJkMdgQauv2lrUctuHCDJ8Bwga3anirl5AcV3AHYhwYVOk+2NlOuQWNXRGwZ7d+fmuzFNca58jTzCH+uuXOJQbol3XJDC0mN9PE3rLJrVxnusjXDBsCXerVHkYZEFNkeJrJ4zrVw83TkxYoM5s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748877542; c=relaxed/simple; bh=e1Jb8L4233LQhQU2TG7JzzCgR61N68NgK8m31ehsPJk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=FOVjMyFHh0yqb9D4bC4uqLZR4u1KcZgmoxcSv0J8VSR0rU/uJTs+9UC1TILVEfLbMh8VY3SdtyE9Ko4ZJGfyZe4XoYbnd2yfSx5nZiSGGF94gVbfxU2ykIR3YyvrG4LyLC5B97ZR+pOo4MGbzDejK2EQXMyrbEoZNVmTc/kKO3U= 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=qJfiOSAn; arc=none smtp.client-ip=209.85.221.49 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="qJfiOSAn" Received: by mail-wr1-f49.google.com with SMTP id ffacd0b85a97d-3a0ac853894so4339818f8f.3 for ; Mon, 02 Jun 2025 08:19:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1748877539; x=1749482339; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=yYI0Df/Q5zXhStAf9TQ+dtCVBtZRyAW6V2IwV5wSjV8=; b=qJfiOSAnKdobH/LAGLrhqRq+uoIqkUauZZ3Z53pXpgxg83HFmehv9TGx5SA8eDN2DD gDxb1CTS0DjLO7cU4cVt3bkVvWdJ54ENbNHO7n2DULAtpn+FnmFYhsN9d0M/L62RZpxC UJf6RijOtUHxqrbgjoDUxlXIu5H+t5ukVqF+mxP3jtrAYIzSdQSIEYfP8sWW5BAPAHiX G/4+I+pwPvUExPQpwsbSGqx5SnbyZpq4LQ/RcvYeybmMrYShz97Da0A3bFhBRXqfEGJU 9jwI0NKX9S6+f+6wFnJne4Z3M82Rxq7aQF4LxmUD15Scg2YLNRl/WMj2B3bAeXu4P9Kx dgug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1748877539; x=1749482339; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=yYI0Df/Q5zXhStAf9TQ+dtCVBtZRyAW6V2IwV5wSjV8=; b=micFkFznGhvtwMYGtQxa19z9pfkXD6cHujOzXVbuKyph2dfuLZ3+QLDs5E2WjTZGQ/ Ez9iD6sEbWDXYc7WITbxQy17IMuJpAgzDRcFpqXbUZx7JhrpbDHa/Az10C+bAYBJEfI0 l/846SK3TWvSKNFz78xp5ypz7odQRBRV8dUn1b8UVHW7Wpp3JAL5/O5ztrVraMAgzuZU wIsmOq4KrHQ6O0Ay5Y0rnD8dmb+GP4JNmq5KwzdnPkwrDZ6fBO0ZjyxOGjOlwYsKQFZv +zhlGJEal5eo86jqq2Yo5zdtWFYh7iGDtOwhZj2FoYQA2bjmvE4AxUBM6tT/j6R5W6T7 EqTA== X-Forwarded-Encrypted: i=1; AJvYcCWffxA2bED+GFhhiQtLn0lrWU5H+JhuEGqMoJKSQmC7PxiS1Umh9xF3xITOIr8qu1j2Zb5dkKpQz1FRljE=@vger.kernel.org X-Gm-Message-State: AOJu0Yw7SztQDzyRYPcniFFSOnE6IUCCXgJyEroMSfACWDYdntsDsHb6 WYl/h6SzLDFpwHwb6NNK0U+NXoYRhWMagAUzy6gCqNBpkzu79b84bJRHLm6KRsOpr94= X-Gm-Gg: ASbGncvTHJKgwQtn2SL71cPmjO4hHi/4qbSJXyT7m0MlO7m1HakYbAsVNQHu1PCMJXH pa6StRnkbl2C0UFRk14Txkn4FeSZeNS7JnBWTHuTZ2S48u09VEWHgaNDizKeTSX8oHaIXCwdptl O33KLCClJs2MdI6kTEol9lAbSx8pA7I+lfJMdoAcE2kRharPEiIEsQRHYQeuJqQ2mJephZQc2zP lHGeqE/HSuRyiQVxR8M2lM+XcMXmYxrr/z8G8lja7qo7/h/0jfLd/GAVsbhU72sVamzRZl19nzu UV9NLp4PtYayojCFQV/8vV374KWX0d5TaqXgtcTcCKM0zbfqsJ0cbBgkBcUfOr6UIdIy5ZyzV4H yY0gimBtDwRv3 X-Google-Smtp-Source: AGHT+IG1GHyy8b8GYVbfzlnN8+J2RSq7hqEKi6/Yl/QaRXVbKZmvYaubZ7QAl5jOTOJVDXQoWBizUA== X-Received: by 2002:a05:6000:381:b0:3a4:f893:3eff with SMTP id ffacd0b85a97d-3a4fe39a982mr7159013f8f.57.1748877538797; Mon, 02 Jun 2025 08:18:58 -0700 (PDT) Received: from mai.. (146725694.box.freepro.com. [130.180.211.218]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3a4efe74111sm15619844f8f.56.2025.06.02.08.18.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Jun 2025 08:18:58 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, tglx@linutronix.de Cc: Jim Cromie , Maxime Coquelin , Alexandre Torgue , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Thierry Reding , Jonathan Hunter , "Peter Zijlstra (Intel)" , Marco Elver , Nam Cao , linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-tegra@vger.kernel.org, John Stulz , Will McVicker , Peter Griffin , Saravan Kanna Subject: [PATCH v1 1/7] clocksource/drivers/scx200: Add module owner Date: Mon, 2 Jun 2025 17:18:45 +0200 Message-ID: <20250602151853.1942521-2-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250602151853.1942521-1-daniel.lezcano@linaro.org> References: <20250602151853.1942521-1-daniel.lezcano@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The conversion to modules requires a correct handling of the module refcount in order to prevent to unload it if it is in use. That is especially true with the clockevents where there is no function to unregister them. The core time framework correctly handles the module refcount with the different clocksource and clockevents if the module owner is set. Add the module owner to make sure the core framework will prevent stupid things happening when the driver will be converted into a module. Signed-off-by: Daniel Lezcano Reviewed-by: Will McVicker --- drivers/clocksource/scx200_hrt.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/clocksource/scx200_hrt.c b/drivers/clocksource/scx200_= hrt.c index c3536fffbe9a..5a99801a1657 100644 --- a/drivers/clocksource/scx200_hrt.c +++ b/drivers/clocksource/scx200_hrt.c @@ -52,6 +52,7 @@ static struct clocksource cs_hrt =3D { .mask =3D CLOCKSOURCE_MASK(32), .flags =3D CLOCK_SOURCE_IS_CONTINUOUS, /* mult, shift are set based on mhz27 flag */ + .owner =3D THIS_MODULE, }; =20 static int __init init_hrt_clocksource(void) --=20 2.43.0 From nobody Thu Dec 18 14:10:52 2025 Received: from mail-wr1-f45.google.com (mail-wr1-f45.google.com [209.85.221.45]) (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 DE08022C339 for ; Mon, 2 Jun 2025 15:19:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748877543; cv=none; b=WDNWyw8V+g2FgysWQYyD+yEs9AJ6WFu7c2FeshmXuGLCzjJ7gu19RkvyAuAqC2Mf61B9xQ0rTrFDc+aojyjEa++7iT8LHeEHj+FvbU0HiF+0APWZSWemb6Bk1/3PnwP77Fj15jCLSA8ZdO/W203ubqMgM2Q+cls8Uwk4PXdnTYo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748877543; c=relaxed/simple; bh=2hHPT0ZatQTm44Z1t6wExkfhxFsepGpoQ7pDrN0NhyE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=l5UdSVc56nlQGICQvXmqVjQmh7l4qxZW6ZWYCdHnU3jHeYyzyTWDW7kZ3Lcj6zRKc7YW9KkSnHDobb3g8XqobLnhEDPUwOYGHSToJtYCzQY7xljhkDGkZfNGO7089tqoI0baI7rHvrWA29BGYQEUTR/MWHHY7REbK8YG8WT/lM4= 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=Qb5y5AB2; arc=none smtp.client-ip=209.85.221.45 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="Qb5y5AB2" Received: by mail-wr1-f45.google.com with SMTP id ffacd0b85a97d-3a36efcadb8so3975629f8f.0 for ; Mon, 02 Jun 2025 08:19:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1748877540; x=1749482340; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=4yhV1VS1sZnr/B/j9eDazI/vJTndFmPooDhpyVC7xA4=; b=Qb5y5AB2UShSbakIMXSN+0+5vBOLXH6pHqvbwCquWt6nG/3PweqsOqc3OZCudupF+d tgdvf5Bh4QfEm0SoNvsppi4O69edpfq3A+JkVMi6IEJ7lS8S5+LAsoyASzzzMhaH40we Dx4Y34n0nnmBFwRjpWX8V2kd17eNbIV/yyRyU2MbCscmSgCx425hClZxZIupE2hD1FQh 3d/qIh2D8aasyMNomFQvF8aRFZqfTtn6zDWmQIx9biOSzyRoPG4ANNGa7Kxe0+lZyCIb MWITk5JviQGDESOfLXYu7KNv8WiKp1DWe6ox63zbcD5eWjg3+9vBo3RK9tOYsbQjPLC+ WGAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1748877540; x=1749482340; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=4yhV1VS1sZnr/B/j9eDazI/vJTndFmPooDhpyVC7xA4=; b=d+qY0J3Rn55VtDcSfaZd7l2IrJtuQK+P30tQjQ7d/ZwvnGNn39d5ffhs9TNSU2I94D X3SL+HXLeaLNqVUC9+yGggsHyvKefdXLNbXc5lZeXBD8X51XKu4Xtd86dUXU8iLBuqn0 Wzywx62DFcB+Mz5XPgAGAQpb9Zfu1Ao1GpvbaX5mBI3wwSCW81yBnx55oX1g8/8FmyP8 fqHDPZYj62ZgvYW00oaHY0dFDBOpdhNuGM35T7fvMB/nrCjj4Ptnf4pB1K2oy8BGM53b dFJqS/mJrqZDoH0F4Cg3Df3DsOCtQBo+aAiJPnk0HNSJ788HA8h1KHeKW3aFRzW4oKPO Vv6A== X-Forwarded-Encrypted: i=1; AJvYcCXrXoEuL0AKCeuA1kyrbRtI1x34O4G6fCLzDipsGGWgKTQfrQPN5T/mYRrFXikXCGDV0yo7jGDRl2aw528=@vger.kernel.org X-Gm-Message-State: AOJu0YwI9aqFg5irfjYOGfAsTHxbjjVwD7r1N6pPNrWhJs5kI8yfWWv1 H3ZpPKknI0/1hOjKfpP/59e+GKyBrnJP+WFMSUKr0ijWQ8q5BaQdwWEhTbw+KCihhaI= X-Gm-Gg: ASbGncvVXHg05pqsyljDeOC8kIY+/8aSH17DI0D0PTUMSxA8tQHYXz6R6Gkb8Tc5/hU ABElMkpQZW8XBMIc869iqzCpjLrHIT8EvF0BQDiP1hMBfcoXr3Ojh00niEsn+9q4OfYLxhqyAlN pb37aQEXs2VyfligUiN2/FPawbttDOQRFWje6vS3CfFBSX/MG4tgy7VzdLTKtzkSItX7PtVh35x MWD6BmQM2hsM36owOC/sBHV+lgT3gkKUdryZS5JqHhEEyfZYgSnrLF64JcGCgwXMimzOvEiAOmJ iSrcXT6sVgfDm212p3JTE569Rrs+S1DIXd3GaA3REA3EueO4kti0snUh6Pe6vl03yjU0apY3jvs pqny3jnvh+LPS X-Google-Smtp-Source: AGHT+IFyISAqwMHhCGLRj9aCfOACSARamwm5CChRIpOs6jPFxpI1R1pUgcUMERHo5kjL0SIXDlP4UA== X-Received: by 2002:a05:6000:18ab:b0:3a4:fb33:85ce with SMTP id ffacd0b85a97d-3a4fb3388bbmr9485326f8f.46.1748877540038; Mon, 02 Jun 2025 08:19:00 -0700 (PDT) Received: from mai.. (146725694.box.freepro.com. [130.180.211.218]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3a4efe74111sm15619844f8f.56.2025.06.02.08.18.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Jun 2025 08:18:59 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, tglx@linutronix.de Cc: Jim Cromie , Maxime Coquelin , Alexandre Torgue , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Thierry Reding , Jonathan Hunter , "Peter Zijlstra (Intel)" , Marco Elver , Nam Cao , linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-tegra@vger.kernel.org, John Stulz , Will McVicker , Peter Griffin , Saravan Kanna Subject: [PATCH v1 2/7] clocksource/drivers/stm32-lp: Add module owner Date: Mon, 2 Jun 2025 17:18:46 +0200 Message-ID: <20250602151853.1942521-3-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250602151853.1942521-1-daniel.lezcano@linaro.org> References: <20250602151853.1942521-1-daniel.lezcano@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The conversion to modules requires a correct handling of the module refcount in order to prevent to unload it if it is in use. That is especially true with the clockevents where there is no function to unregister them. The core time framework correctly handles the module refcount with the different clocksource and clockevents if the module owner is set. Add the module owner to make sure the core framework will prevent stupid things happening when the driver will be converted into a module. Signed-off-by: Daniel Lezcano Reviewed-by: Will McVicker --- drivers/clocksource/timer-stm32-lp.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/clocksource/timer-stm32-lp.c b/drivers/clocksource/tim= er-stm32-lp.c index 928da2f6de69..cf1423ca00d0 100644 --- a/drivers/clocksource/timer-stm32-lp.c +++ b/drivers/clocksource/timer-stm32-lp.c @@ -159,6 +159,7 @@ static void stm32_clkevent_lp_init(struct stm32_lp_priv= ate *priv, priv->clkevt.rating =3D STM32_LP_RATING; priv->clkevt.suspend =3D stm32_clkevent_lp_suspend; priv->clkevt.resume =3D stm32_clkevent_lp_resume; + priv->clkevt.owner =3D THIS_MODULE; =20 clockevents_config_and_register(&priv->clkevt, rate, 0x1, STM32_LPTIM_MAX_ARR); --=20 2.43.0 From nobody Thu Dec 18 14:10:53 2025 Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com [209.85.128.52]) (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 DFD3022D9E6 for ; Mon, 2 Jun 2025 15:19:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748877544; cv=none; b=C2+Z4Mgo+wFeBNKiOfmz/JvNSeTNgP0Bk9mUASc/kxZIFZ0fEPuhcpPFUeqPAJCDy7lrsbYsLJTrrQ1HIyp+Q4+bVcy1V6GZOg/mjSz9LnkerQ1h6u4wkGH8p4a+Hggf12qdSYo1XVXJfq6pnjjBHWq6zAMzyko+g/QSqA+yV0M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748877544; c=relaxed/simple; bh=fAaZ3L9vEbtazUSHdMUtxxloxioTW1ggL5LaUshczj8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=B8bwZPtjgwwTrttj3uCcaop6zbrai4VNVy2dy+hMXls8e7qNm/ReXYVGqANnqonnK5kPOgiRduqqQt+6XUddLMFV7TLrWBbJUEKhskD7c9UjIsvM+eMVXYKxGYdZizXpn/4jSbpgarLvdr1gIYvxHjMCtA12wMdEj/7vIyouRVw= 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=F91URjb/; arc=none smtp.client-ip=209.85.128.52 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="F91URjb/" Received: by mail-wm1-f52.google.com with SMTP id 5b1f17b1804b1-450ce671a08so28506605e9.3 for ; Mon, 02 Jun 2025 08:19:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1748877541; x=1749482341; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=j2bXZElBrRwneMKewEI3S9wHUbgph+s2MD8uEMc202U=; b=F91URjb/WGSoAqAcBC8zFjUfDp1lz/YszN3KYCr6bGO0Tp8Rga+s+biUpF0AE/DMqQ 7KAny3x/t60b65aHrC1KflTYMQG6Dh+ECjxWv4dNSQDeuz6WRSdEoFbsWdgY8BuASXrm FrSg82I2BQyGnCx6i29qgDNZA/9AquaSKRlR4AHcNndnd3iasRf3G49QgWunnFqN63h0 q8RA0zbRyPQPtau6MCMrSxJ2znqryoKBFe5n8y1aPh5WN8Q6QH5WGfNcHdZoZYJMDUS7 CAcMEVGskAO3EnDB1GEtLzbGMlHGH3BRfhPWxuXtEaLgork/ASe0y1fUIg9ndRzzbvit Vwwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1748877541; x=1749482341; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=j2bXZElBrRwneMKewEI3S9wHUbgph+s2MD8uEMc202U=; b=n2ha29ImNUpRwCYV++xjK6IBdptdlP0D5Wbd1uE9ApplNR91WMLZfkbF1jmW6XeSJa 9kcO48M/OEcARgSdpQvA8P+U7sUlF6E9qEiB5GJHNpmegWQ0vfSKTDzk3jZkS0xzogqC XSXI5eMdSOIsp3W3FwXPYskLhP8XGWZ4Fp/aWW5tfkjMoLfGqExuA2iroVUj7w4jp2X1 BX4njKvGKfymEkOs1ag+0FvaEX6xvJotdURAZQqWZAKyXfLlgIhcMXfBcg+RCkNf7b1g wcZT/D0QHT3ahtJ1I1e+hsNVJbtZMaYBeyOs6tj5aCX1F2jMpFzulGBy/IiVOR2twazg rhvw== X-Forwarded-Encrypted: i=1; AJvYcCXLyrU+rsAqtgnwVLT/XUb/TvpcTyccZPpKm8c8Nb5d9xPU/PE8TCufDfhfDBqo5anqQ74a33s+NoLdYuo=@vger.kernel.org X-Gm-Message-State: AOJu0YyT0fFTDXlmqcq/FZ43jUd4s+P9CPGYfdoyI0kkyYv0tc7+jhHS i5wA6UHtxIn/DykKrrwKQPRbrW4nf68vAzyaZOPeioIxR94m9WQMTpQdTsPEfb6T60w= X-Gm-Gg: ASbGncujQzHDQue90oFrxpZLODVJtols1/jFpxz7PodrSelYBTTDnqDVGDKupICLuXl 0k/DC7DEGm+RxsYRCpzE0v35ULSzw0SHO5eQN19+LlsCLOmaCHTGRMKw6MmZQhuFILE+JP2x3Ww tK4Oebf/OyBLUL5iHpBkHToL0jcvUCly2Xt8ZQmIieX4LZ9U4D2ZUkaIyNL6ZDy7XZHQIkWbDMr 0cdDZXLGdZoFbSK/vPi9HvzsnlTM4XfkIOGa19JQqmLiZinss6cOkxOrLbCrU844ymtO0aS3T16 ChsceLL95VHltSG6JGbtT6Xp9LXzD3RjZfHwhTGFzwPjChg3WNDY94cpXQ1lViFMTsfQi85B/I2 Y7KOZc0vE0QvS X-Google-Smtp-Source: AGHT+IGm8o6nqRRjiZlM8OEtcH7Giz5iqVqvOKIqNhMfKW6+DVKKTld7vkKIltD7iNqNITzYzwGGxA== X-Received: by 2002:a5d:5c84:0:b0:3a3:7ba5:960e with SMTP id ffacd0b85a97d-3a4fe3a8214mr6931603f8f.59.1748877541180; Mon, 02 Jun 2025 08:19:01 -0700 (PDT) Received: from mai.. (146725694.box.freepro.com. [130.180.211.218]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3a4efe74111sm15619844f8f.56.2025.06.02.08.19.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Jun 2025 08:19:00 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, tglx@linutronix.de Cc: Jim Cromie , Maxime Coquelin , Alexandre Torgue , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Thierry Reding , Jonathan Hunter , "Peter Zijlstra (Intel)" , Marco Elver , Nam Cao , linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-tegra@vger.kernel.org, John Stulz , Will McVicker , Peter Griffin , Saravan Kanna Subject: [PATCH v1 3/7] clocksource/drivers/sun5i: Add module owner Date: Mon, 2 Jun 2025 17:18:47 +0200 Message-ID: <20250602151853.1942521-4-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250602151853.1942521-1-daniel.lezcano@linaro.org> References: <20250602151853.1942521-1-daniel.lezcano@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The conversion to modules requires a correct handling of the module refcount in order to prevent to unload it if it is in use. That is especially true with the clockevents where there is no function to unregister them. The core time framework correctly handles the module refcount with the different clocksource and clockevents if the module owner is set. Add the module owner to make sure the core framework will prevent stupid things happening when the driver will be converted into a module. Signed-off-by: Daniel Lezcano Acked-by: Chen-Yu Tsai Reviewed-by: Will McVicker --- drivers/clocksource/timer-sun5i.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/clocksource/timer-sun5i.c b/drivers/clocksource/timer-= sun5i.c index 6b48a9006444..f827d3f98f60 100644 --- a/drivers/clocksource/timer-sun5i.c +++ b/drivers/clocksource/timer-sun5i.c @@ -185,6 +185,7 @@ static int sun5i_setup_clocksource(struct platform_devi= ce *pdev, cs->clksrc.read =3D sun5i_clksrc_read; cs->clksrc.mask =3D CLOCKSOURCE_MASK(32); cs->clksrc.flags =3D CLOCK_SOURCE_IS_CONTINUOUS; + cs->clksrc.owner =3D THIS_MODULE; =20 ret =3D clocksource_register_hz(&cs->clksrc, rate); if (ret) { @@ -214,6 +215,7 @@ static int sun5i_setup_clockevent(struct platform_devic= e *pdev, ce->clkevt.rating =3D 340; ce->clkevt.irq =3D irq; ce->clkevt.cpumask =3D cpu_possible_mask; + ce->clkevt.owner =3D THIS_MODULE; =20 /* Enable timer0 interrupt */ val =3D readl(base + TIMER_IRQ_EN_REG); --=20 2.43.0 From nobody Thu Dec 18 14:10:53 2025 Received: from mail-wr1-f48.google.com (mail-wr1-f48.google.com [209.85.221.48]) (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 246DC22CBD9 for ; Mon, 2 Jun 2025 15:19:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748877545; cv=none; b=Bk9wiHvUJa300IRkrwTORhlzzH4JYjSDI2SZyr7FAZRLIMnX+aER+I588dF3s6E76wzwWj3eIwCtD6RXHdu0wDqqtoxH+2IJUY3nTVbwZ+5foRbSRbZnHDD4mWcVdeo9tK1O9gFo5ohrKorYOKmozhm3a5LyOWWznmN4q3mzrGE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748877545; c=relaxed/simple; bh=06sqAxtbKKs7o6LiAk2AbUdTVmELzxncQQECi88QF6U=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fsVAlLPpYPyFRg3GiISKW3+iZZy6T3zsThlDqMsvLIeJvglt06eUjWm3Ex7D1TA9BYcCNM2Mu92Xup/wPcIyMXnFUP3SR0cmADWXDR89wIAzneh37Vzt1oNbqgFwX7s9paJw5UgxGk0nvN9f3UZD88BFwC3l3HSDN5wZinBuOnI= 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=qCwPtLrM; arc=none smtp.client-ip=209.85.221.48 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="qCwPtLrM" Received: by mail-wr1-f48.google.com with SMTP id ffacd0b85a97d-3a36e090102so2601615f8f.2 for ; Mon, 02 Jun 2025 08:19:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1748877542; x=1749482342; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=c3ov+Lh/6++7opN5JtzuefcSmMhE81eYS7f93OD6TWo=; b=qCwPtLrMEa9XfIe28rpNV8P/HEmu1A37O8hO7Hd01kAMcadJp7ZKZwhLGkWJr4zaUX y6Kxo/6/Ra0Xn2JQUmXI5Oh8FF50vCmgAK+lM2ItUUNqDJwsPnAWkeSZCzSmufUDWm+P QAn/8FDu+3EbiluQPa17SfT5d2z7dwyV8ceb3k17Te0EO+E477mt/Y8Zl5LODjxB7LeA Z6MThAB55xSVYl+JSk754nE593kradugbtqeeab9nctLwSGII/zcsY1jx2Q7byyLmNiZ jk5oAVpY2H5QhrZZz8/nJKlk8wrqNXeSiXfdUlgSa51nsqUfP17AoIYRbGBKUiivsVor fjlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1748877542; x=1749482342; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=c3ov+Lh/6++7opN5JtzuefcSmMhE81eYS7f93OD6TWo=; b=ok7Pv+Srz6TKq8PpIJT7qCAgLYf9P1pr2r/pIU8W1e5pEMZMj7nUJeDZAqdgRwJmSC sNPk/FOHXmTHlqgzEaD8EA14QcOlmhRin7FjUgtOxJm/IySzILEDJe36bAyYTPsBHxa7 sFp3jGNmTVnsehDYQAmghF3Omukl84CShX/3nE+cdxsK5l4aO8mFoTiPW0sK2D5/kyGR fKSvr39BCkkUGyucB2R1zj5ptDT3tTi73fzyn8lEVV2lbxlMfxtJK/Xpo5uxCbLH6TAe a3GLhCC5H8JJ+eHqGfVeb18PEcemDIA7Rgh7Ay5UvvilapoVGpzXy7YAzCazTRG26Z3k I9nw== X-Forwarded-Encrypted: i=1; AJvYcCXjEQ82yztsw9XhOcrddQ/wfjT967GYv7DIYL0pfbWeWG2re94tY3hUK+3vr1Bhw3Rfh+TVpqNNN1KZtkk=@vger.kernel.org X-Gm-Message-State: AOJu0YxRvgg2jz2tIomwwNznOKXgHBvjjMOFhoMA5eifXDaZWklWLePU qfA2QY8aOs302WMDob0T6b27DCP36Svs+23++h82tFNOh9j761Agmi9UE88f7Hm1NEs= X-Gm-Gg: ASbGnctp2A3uYQ9cJVq9+gobxIrFY59BMT+iCd3J1b0BgRfCZYAnCrwvtc8rq3Ii2Qi ODDWxy7gHkCcJj2qmIMzcsYwgKulFTdL1WBsDhe0GkrlGt25jTEIzLrGDPDUtFP9F/hgMsy5wj6 xHTc07qRtoQhNvgC+kU77bYXg8cbGiH8B5Buuzzn65A64w3YwSFGz3ll8Wfl+N2PJaIiVq7ahzi C3XzTOd4nQEF5bV5L2BRKs0wNUyy4wa54hAXbdCYEwh2wDj/m5oPfm8RxFqgpMeNqoQBumL6n/B pdhD5dneonMeRiMNTjsRarYedMe+RruAniTFHtQL0OZEwk+qgQ4Ox5LF4ny5t8+Jio9BszFhsYL cOcHi08Yi02OxAVOll9DjTd4= X-Google-Smtp-Source: AGHT+IHj81bY8BwahqqDfoqRAaq8f0rnARhmXR6p0QX+Wj5JW6k3OiLTjugCeEjr1Ne+gZ4EEgbmkg== X-Received: by 2002:a05:6000:2906:b0:3a4:e2f4:a86b with SMTP id ffacd0b85a97d-3a4f7a6d22emr10375633f8f.37.1748877542385; Mon, 02 Jun 2025 08:19:02 -0700 (PDT) Received: from mai.. (146725694.box.freepro.com. [130.180.211.218]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3a4efe74111sm15619844f8f.56.2025.06.02.08.19.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Jun 2025 08:19:02 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, tglx@linutronix.de Cc: Jim Cromie , Maxime Coquelin , Alexandre Torgue , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Thierry Reding , Jonathan Hunter , "Peter Zijlstra (Intel)" , Marco Elver , Nam Cao , linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-tegra@vger.kernel.org, John Stulz , Will McVicker , Peter Griffin , Saravan Kanna Subject: [PATCH v1 4/7] clocksource/drivers/tegra186: Add module owner Date: Mon, 2 Jun 2025 17:18:48 +0200 Message-ID: <20250602151853.1942521-5-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250602151853.1942521-1-daniel.lezcano@linaro.org> References: <20250602151853.1942521-1-daniel.lezcano@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The conversion to modules requires a correct handling of the module refcount in order to prevent to unload it if it is in use. That is especially true with the clockevents where there is no function to unregister them. The core time framework correctly handles the module refcount with the different clocksource and clockevents if the module owner is set. Add the module owner to make sure the core framework will prevent stupid things happening when the driver will be converted into a module. Signed-off-by: Daniel Lezcano Reviewed-by: Will McVicker --- drivers/clocksource/timer-tegra186.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/clocksource/timer-tegra186.c b/drivers/clocksource/tim= er-tegra186.c index e5394f98a02e..56a5342bcf78 100644 --- a/drivers/clocksource/timer-tegra186.c +++ b/drivers/clocksource/timer-tegra186.c @@ -373,6 +373,7 @@ static int tegra186_timer_tsc_init(struct tegra186_time= r *tegra) tegra->tsc.read =3D tegra186_timer_tsc_read; tegra->tsc.mask =3D CLOCKSOURCE_MASK(56); tegra->tsc.flags =3D CLOCK_SOURCE_IS_CONTINUOUS; + tegra->tsc.owner =3D THIS_MODULE; =20 return clocksource_register_hz(&tegra->tsc, 31250000); } @@ -392,6 +393,7 @@ static int tegra186_timer_osc_init(struct tegra186_time= r *tegra) tegra->osc.read =3D tegra186_timer_osc_read; tegra->osc.mask =3D CLOCKSOURCE_MASK(32); tegra->osc.flags =3D CLOCK_SOURCE_IS_CONTINUOUS; + tegra->osc.owner =3D THIS_MODULE; =20 return clocksource_register_hz(&tegra->osc, 38400000); } @@ -411,6 +413,7 @@ static int tegra186_timer_usec_init(struct tegra186_tim= er *tegra) tegra->usec.read =3D tegra186_timer_usec_read; tegra->usec.mask =3D CLOCKSOURCE_MASK(32); tegra->usec.flags =3D CLOCK_SOURCE_IS_CONTINUOUS; + tegra->usec.owner =3D THIS_MODULE; =20 return clocksource_register_hz(&tegra->usec, USEC_PER_SEC); } --=20 2.43.0 From nobody Thu Dec 18 14:10:53 2025 Received: from mail-lj1-f181.google.com (mail-lj1-f181.google.com [209.85.208.181]) (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 E1C59221F00 for ; Mon, 2 Jun 2025 15:19:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748877557; cv=none; b=FizRy0hmSlG3ih7yfpm53IM7tAKuc4VGn6FaO62w2UfR2tkn+c8emdBXCeO9aiLIm74/0XDNXkOzkwNtrP0Mo1tS4C3sDN0Xu9TMbhJAmxVP7SOda8qVcKJNX6U5y4AMFKR4WhdYD0wNOhIvjFdzlv0s+smvgWsS/gdmAP8aN68= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748877557; c=relaxed/simple; bh=qXg36nIEaSbraDl3K9/tt/qe1tR1XHyEOkFR1xkoAXI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Nlzs3+cReDETpOnQ/MPuAFdEoOt2+IsX6rCYasZu6eSM6KWa0/DZBOe1ow72QrAkT1A+mJDEXAf9aG+BryrSFi4cY8UvElaYl0XTieaHjWDRhKPT8iLFBsETogGd6tR/JvjEve2OoF9DwdgDQvUFl+jmhFjZWONTqIFlk1OjmMc= 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=wzIbW7uq; arc=none smtp.client-ip=209.85.208.181 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="wzIbW7uq" Received: by mail-lj1-f181.google.com with SMTP id 38308e7fff4ca-32a7256ba04so22582061fa.1 for ; Mon, 02 Jun 2025 08:19:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1748877554; x=1749482354; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=S7FRnrLBkBYHmFUuH4KGx1nHshhZCeSgrXIZ5dzYfvU=; b=wzIbW7uqxUZcfsXCm9lwIDZ9sQuUYxhnkZ60Ketzv9pRHflF5dgidGZ0Kb0lYeAPAh x3zLeHlel0RzVIM7Oi3awlGDk0kBx/XVh5ZI6L46AEsYSYHh/NChzq3kkI7mS16uizeH NBrcGokad/Jd36vsOLDiyK/Guga/b2ms4L1AQ0o7XoLl9ZuUnaxDAH6ILRd0j74Wc5XQ jSh4Or5Zjf1nbaJ1THS/7R7vwDOfXklAAmCVfyrGViuxtCFBgfACgViUqeCI0VAvjw+D Q8O9KOa8qU+lBqw/sn1s0dZVPOfrVdQ48oQJrsxPiqIK92hmg95P0hHgklMgtO/YSjFc wuQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1748877554; x=1749482354; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=S7FRnrLBkBYHmFUuH4KGx1nHshhZCeSgrXIZ5dzYfvU=; b=Mk2hvEFs3FlJu8agyzfY0/uTf5RnhejLFMnmaaWrcPyn9GqddqYlOZ+BjC2gB9sG1p VkwToCp6qaop3tboqGY/G2rgLHkZCIygNRQ59tv52kfDiQZCulR3vKRHR92DZhoe36ma P1gME2gYV/9uTQ7ewdujnxMPoQvSZg+aG8O7FuirZmP1idev9Uty6ertBg1Hsl3fDunH tRyUtgtfM3VMwe15Nso1phI7skRuz4T4g0j8CEgfnv7K0FOrdfRe2V1vOWX4jL7UVyc7 oN2lMyDouVemlrXcopJbr7IEfuxoSLQprvnhtzla+Olw8vachTWwKwl/NRrNtgvuSwtH KjMw== X-Forwarded-Encrypted: i=1; AJvYcCVjCGTqG7wa8sCEiIpTjZ5RnXTS/Kr2AZnLY1tcj9xPesNFPYTlwAUHTcdrOVrvELp+DnTDMd2z3mKmhNM=@vger.kernel.org X-Gm-Message-State: AOJu0Ywg1sg6IbzejfejyA81bJx1gVW16CSAhZBdg+IObMuI//vfRGFo 2KS/Y6TVIdizpS4jRiyum0QlzmAS+KZxFXjQcQ+4qmp83HgoQ9OL8LFZPkO1FYzRdUfQ5Q2KibT m7HziFQQ= X-Gm-Gg: ASbGnct1vmeYCaPHUR4llS3X6G8fRXeSkWzSQ7uPVeLEtEsL7pxBRsTt5AEAhtZlsKj cZgIvZ39LAARi2S12v+I2T9jlWEvyw+l6RjhFvl/4TYkUjeqvGOr+LuX+J9WL2YMZv+H/tBuNju ToKOUaUjglpT4itfZhEprhHjUq2gf67ZNgZyYCuM29OY5yxS8Aq23YLE31gfyId8PRi6ctvab7R 5ehWAXN2Hvffvz03oAJdSz9kIezcY694JamwXZVZ9KB8O6dzWOwI5nE73dCKr+j3qpX8znkcKrI zFj/x5nPl/edZsIJRz2hci13kKM4nzup1Q0xOjsU1aIURN3fz4SFIClno4S4gkgCJO39QF7HDzU 8Rw== X-Google-Smtp-Source: AGHT+IE+SpRjISuBJ+0qyPRe6UZcsVpz/N5qpzBFRSza5rkSFVM1NCoj9ElY/SVHO3bb6cTtRiaJ4w== X-Received: by 2002:a05:6000:26ca:b0:3a4:f787:9b58 with SMTP id ffacd0b85a97d-3a4f7ab515fmr11075338f8f.58.1748877543609; Mon, 02 Jun 2025 08:19:03 -0700 (PDT) Received: from mai.. (146725694.box.freepro.com. [130.180.211.218]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3a4efe74111sm15619844f8f.56.2025.06.02.08.19.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Jun 2025 08:19:03 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, tglx@linutronix.de Cc: Jim Cromie , Maxime Coquelin , Alexandre Torgue , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Thierry Reding , Jonathan Hunter , "Peter Zijlstra (Intel)" , Marco Elver , Nam Cao , linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-tegra@vger.kernel.org, John Stulz , Will McVicker , Peter Griffin , Saravan Kanna Subject: [PATCH v1 5/7] clocksource/drivers/stm: Add module owner Date: Mon, 2 Jun 2025 17:18:49 +0200 Message-ID: <20250602151853.1942521-6-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250602151853.1942521-1-daniel.lezcano@linaro.org> References: <20250602151853.1942521-1-daniel.lezcano@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The conversion to modules requires a correct handling of the module refcount in order to prevent to unload it if it is in use. That is especially true with the clockevents where there is no function to unregister them. The core time framework correctly handles the module refcount with the different clocksource and clockevents if the module owner is set. Add the module owner to make sure the core framework will prevent stupid things happening when the driver will be converted into a module. Signed-off-by: Daniel Lezcano Reviewed-by: Will McVicker --- drivers/clocksource/timer-nxp-stm.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/clocksource/timer-nxp-stm.c b/drivers/clocksource/time= r-nxp-stm.c index d7ccf9001729..bbc40623728f 100644 --- a/drivers/clocksource/timer-nxp-stm.c +++ b/drivers/clocksource/timer-nxp-stm.c @@ -201,6 +201,7 @@ static int __init nxp_stm_clocksource_init(struct devic= e *dev, struct stm_timer stm_timer->cs.resume =3D nxp_stm_clocksource_resume; stm_timer->cs.mask =3D CLOCKSOURCE_MASK(32); stm_timer->cs.flags =3D CLOCK_SOURCE_IS_CONTINUOUS; + stm_timer->cs.owner =3D THIS_MODULE; =20 ret =3D clocksource_register_hz(&stm_timer->cs, stm_timer->rate); if (ret) @@ -314,6 +315,7 @@ static int __init nxp_stm_clockevent_per_cpu_init(struc= t device *dev, struct stm stm_timer->ced.cpumask =3D cpumask_of(cpu); stm_timer->ced.rating =3D 460; stm_timer->ced.irq =3D irq; + stm_timer->ced.owner =3D THIS_MODULE; =20 per_cpu(stm_timers, cpu) =3D stm_timer; =20 --=20 2.43.0 From nobody Thu Dec 18 14:10:53 2025 Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) (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 92C6D238C3B for ; Mon, 2 Jun 2025 15:19:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748877549; cv=none; b=nfBlwdmJTBssxDZdjEisRDTFl/aHjHNJQMFZljo7UGVTYoTRkDaZU2QwzjeRYzntulVRqGJcCwwKSZW/3wnuj667KV1berucvNCF8UaYAaBxvsMLUfPyKAlmpsv24knAMNKbD1Hdjo1VJRxbXtIeay9GAU+Rf4BEzqta8Trjg8w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748877549; c=relaxed/simple; bh=hUv0mIWbDZHw2AgsshB1b4pGaBwY9mA7lDi8KBrhZs8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=HtkOONS+dyXdaASUqzXVLWJluS6Qcazqh391zN2W1GzYF7PdVGYTjYiBkapMSAvSqS1XtwcLJK/jmYUWxIrQLxl8Q/ir8yoHhq8MpE5hSFrIc07fk/2qHIpjxaOtTRVl2mEhOn3PKFfdVGDZOaleMC6Ui7oCQzFZ/sXfNz4DStE= 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=xlHCu4gS; arc=none smtp.client-ip=209.85.128.45 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="xlHCu4gS" Received: by mail-wm1-f45.google.com with SMTP id 5b1f17b1804b1-442ea341570so31275395e9.1 for ; Mon, 02 Jun 2025 08:19:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1748877545; x=1749482345; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Tl3s+9qrNZSInC+4si9W3B7aYz8t+YyXNiXQyckQzoI=; b=xlHCu4gSX4z0tHQl7keEFb/t24BH/inIQkllmmdJ4csexUC0wZS0+DZ3e1WdURxazF PF8OAuoFN8QHv1WmHiBCPXyKsRJZ3D7WOHweDjLMhOR0XmCW28zkfTowyoDao+FrMlK7 8FxhuZ2o+YFmueQon8I6Kxv91DPQ62kssG7FBV4WnTEperdju6D1BaeXarqbwNMjLMJV fX7ergrDJ5HNya9tEzP4pbcr9tAAooG6aSM2P8JVQhxvAmn45ES7277PVAkIKm0XHUOU plqdkWAQe4+AErD/kEJnU2R85ZRqQw6ygn8Tg/454ZAvULStjx8FnsleQG7e1Sw56Vyc m+6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1748877545; x=1749482345; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Tl3s+9qrNZSInC+4si9W3B7aYz8t+YyXNiXQyckQzoI=; b=pOQzHLKj2+qy5ipLHtHO0SaH/aez4t4nefnefxqEATFwqKVPcu71Xey1Gx97wcfpnC ljKHXRjqRWRZ10Y9P63FEWQKFjJ/V+vplIzpT5Qy15c9fb5evLeTKqUS6DHtqOXbyfga Djyz9tD/Ui9Ax/26YTiF+N22ihQ4gh+yLgC6+jqwEovGBQPT6J6tME1a4IQJrYdXS/uz NLSaHqpK2RK1j1nfT0nu96Ppt+u+VXnXZN8/WbHg3+OwBwR40J8kv2q33uLK3RNcZVkJ 9wk2bmZ1urECA7gCfjbRmWYCg1EgVoIeh6ocju7jpVADfLCK8wQS8NDLgpgpqB1V/n8F VflQ== X-Forwarded-Encrypted: i=1; AJvYcCUispCLg72jIq8k50g9iixFrUCTJWCum+HvpFSjMcuWkSytrydEZUzYJwgsdXdvJnbaS90dCciW65wtark=@vger.kernel.org X-Gm-Message-State: AOJu0Yw6omSdhMb55ANXVEERNlxVN0Yvgu2DC/oJsYhuynsiasD9erTz aBoWqDtuVWmB0Cz/bTNfMn3dAz8uaQ3ZXsJcJ5MJWViRDexLITz7fZU7DES3f5LDh40= X-Gm-Gg: ASbGncvX2W8VzkAPN7VjSS+auLEUOcOTd613bdRXqrLJ202rAiDpEg2bqYS3vG0TIGl hL0VLLbJqYhiY1hEoy1c0MBkB5bzPB2zRzhjI9fDpFrGCqSjQCwEJktiYB8If/WQ0jmJdjSuNuv +rtXVCzJH4IJAgcB3JY/WLJ9EybpHrgu+QbyzlTx7g9pF5omnsAo+yXPEi/CFn9Bwl3fm5dQx7l nqWAQFUcP+5bqjKd2jkpdXdDgtb32wopGWzbCYDlI21Ud6DDkwb8aWGJz3d26ajScMUuKUhHQ7X /sfGnV7jL3dEcOiHtGu6DrVCl0M8qm3q/sm323oQUxvJfYNMgMDNEgGsXS96ZRQ5DyWQ2Uz8o0Z nhSH1RcWmUiWr X-Google-Smtp-Source: AGHT+IGtDDtI7FhuuIjfq30FaLggo6siUgKsnVHXy0In7YrLSlYbl67D9UVPet7StdoKw8HT/BY3WA== X-Received: by 2002:a05:600c:3e06:b0:43d:b3:f95 with SMTP id 5b1f17b1804b1-450d888b0femr83074465e9.28.1748877544845; Mon, 02 Jun 2025 08:19:04 -0700 (PDT) Received: from mai.. (146725694.box.freepro.com. [130.180.211.218]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3a4efe74111sm15619844f8f.56.2025.06.02.08.19.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Jun 2025 08:19:04 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, tglx@linutronix.de Cc: Jim Cromie , Maxime Coquelin , Alexandre Torgue , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Thierry Reding , Jonathan Hunter , "Peter Zijlstra (Intel)" , Marco Elver , Nam Cao , linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-tegra@vger.kernel.org, John Stulz , Will McVicker , Peter Griffin , Saravan Kanna Subject: [PATCH v1 6/7] clocksource/drivers/cs5535: Add module owner Date: Mon, 2 Jun 2025 17:18:50 +0200 Message-ID: <20250602151853.1942521-7-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250602151853.1942521-1-daniel.lezcano@linaro.org> References: <20250602151853.1942521-1-daniel.lezcano@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The conversion to modules requires a correct handling of the module refcount in order to prevent to unload it if it is in use. That is especially true with the clockevents where there is no function to unregister them. The core time framework correctly handles the module refcount with the different clocksource and clockevents if the module owner is set. Add the module owner to make sure the core framework will prevent stupid things happening when the driver will be converted into a module. Signed-off-by: Daniel Lezcano Reviewed-by: Will McVicker --- drivers/clocksource/timer-cs5535.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/clocksource/timer-cs5535.c b/drivers/clocksource/timer= -cs5535.c index d47acfe848ae..8af666c39890 100644 --- a/drivers/clocksource/timer-cs5535.c +++ b/drivers/clocksource/timer-cs5535.c @@ -101,6 +101,7 @@ static struct clock_event_device cs5535_clockevent =3D { .tick_resume =3D mfgpt_shutdown, .set_next_event =3D mfgpt_next_event, .rating =3D 250, + .owner =3D THIS_MODULE, }; =20 static irqreturn_t mfgpt_tick(int irq, void *dev_id) --=20 2.43.0 From nobody Thu Dec 18 14:10:53 2025 Received: from mail-wr1-f51.google.com (mail-wr1-f51.google.com [209.85.221.51]) (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 77ED4239E67 for ; Mon, 2 Jun 2025 15:19:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748877551; cv=none; b=sOhC/kiIRgOrnPeGH1/sQn9D8gAzJVFVU97gIFy8BtZOXO8CjywhupuzOJ+HYpG+xKlPVeu2jxPzQHMHI67EjMsF+6Aoc9/vL4XNEW+AsOcQg9/fk2EHIQ00yOG/Pwg407BzGaCJOyJPnPC0MHbrYxQ5RZejLtttMZuF+w8AbpI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748877551; c=relaxed/simple; bh=GxbSdL0PyZ8UlejUoxlDIdlFpATxnSdyF2KX6oHR03A=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Zavgx0wHZYEy+XruQhq73KeVq5nZ2U8zud2xSEtjIdaFO61t6VMpk0KKuKRXeP4ZYiwOjeAqk+WYeUCZbjXmjjcSdDL8zjhA1QAZ3pDqTEfX5zJ2cCVzcRRughjoIqgA6RRTsUK5G/8+MeUzaL70P5+HDQUOK/vkjOTlWfkzJpg= 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=q1Ht0zWV; arc=none smtp.client-ip=209.85.221.51 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="q1Ht0zWV" Received: by mail-wr1-f51.google.com with SMTP id ffacd0b85a97d-3a5123c1533so127927f8f.2 for ; Mon, 02 Jun 2025 08:19:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1748877546; x=1749482346; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=h4kATdXtYuRJowbluuoUfq4iaqlYfYT07dwMRu/eijw=; b=q1Ht0zWVmXyQXOxoXmReB/1O6jeMdlz5oaNDqn+KKfsTcemeYF/cWZff6Jucji0rZx L9BuslqtLxJHpy2EaXOX3uNx5u9qZmdYMW1FJFkgdVLTI3W+g02DIhsj45UGQL8uFgKj QVE2LMVrATzGalVID2OybgjblihUuI0LoOUALUaI0YjjmmutX5rv5vgK1YNuSB/HRn15 p83eNbwJeY4LPD6KZqGewBAcNaluhiDxtec1at/zWZZz2CPHsz+uyLaVShpJk2oIAZNZ HMDE0QHiJ22gy15jTq07FOrXi0icJltEKeYAh1/qh+eY4i2aiLtwz9f6uK5h2C/1F23X mUWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1748877546; x=1749482346; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=h4kATdXtYuRJowbluuoUfq4iaqlYfYT07dwMRu/eijw=; b=tZkNt8xc7anfegb4DVvy0esr76GvBbOPEqILcgKaGbWQ1jaZQzuZiSYfYg2r7CosN/ 1VkAJcCWBxGe1ERq8OUNemB6nl6/QNzgAcvN/HNwzHTmVtplEHD76RbfbDkF88JTSBGp W5n32ahqIIFEHgbsXbkB14BLnWGB8gD4D7sAIUOf67XXWOz9PnGqBnhfF7/tGNglMyMb regllcwMhWUhWxrAZeX1AxTgqZgvlCq2F/GVLRyn1P/YhJOlHJZ1wCFqRc6UX0wckaVj z+7CcXDYVDZKKwzkP+nTAulYMB1jvHR6UwwuJcQbahXuyX/OCK8O6f/0WCM5FMXgJLt5 OfFA== X-Forwarded-Encrypted: i=1; AJvYcCUF7CEOfMGw9FciVd6XS6HWEPr48x460X4UUKPMINxorvZJjDrTUO80KiJ9t+apqHTLc85L1/CpCoe/u/E=@vger.kernel.org X-Gm-Message-State: AOJu0YwdgWVZR9v5tHfSANqIUtRD+wI/uMEWSoK0ULrCJCiJqrnoQSU9 BWoMt67+kepAS3F1KiaAfGxawi97SOs9VvDQT+yATqnRBUe7jLSXTWWwPZAZXDkJm0A= X-Gm-Gg: ASbGncvNOH/hmROYaFG1WzgE4gaF5XfvMp/6mm8BoEgyJM6lM/dqG9UP6IhfF3QXidG zBV2rrOtKa/SC7I+ZcyHZpoBCnSe8z49W8J4WDLDTlV7V77ybDGmsPSRv8k7ctym4howW6mJLsT vVtsjp9ulV/ugRRqZjCkihkZFKESFT1B9+K5tkOOkaYQVkOuluH1vCuws58bMuyZJCW/jNIQJcQ X/tnJVDkGUx+8l/8zR6DhX7lonHq2Jt64sHnq/D/v8+AubrfShrOJbAUXr14wwdIL6p6dB5XTHj 7TF1UmfTxTM/j6Y5UkQmHdkN0ViJTR7RPh2GJ4tVpgSlUvq59Rjegtnypy+qnmPLIG5Y07uwDCT dgQ== X-Google-Smtp-Source: AGHT+IGo3+b4mB4bJZk3jsrIr83JxAnU/93JoVte/2RVs9090BDS0xWFY0i+YN16EfaKcepr/Do0FQ== X-Received: by 2002:a5d:588f:0:b0:3a4:de13:2a25 with SMTP id ffacd0b85a97d-3a4f89dcb7cmr10264360f8f.45.1748877546552; Mon, 02 Jun 2025 08:19:06 -0700 (PDT) Received: from mai.. (146725694.box.freepro.com. [130.180.211.218]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3a4efe74111sm15619844f8f.56.2025.06.02.08.19.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Jun 2025 08:19:06 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, tglx@linutronix.de Cc: Jim Cromie , Maxime Coquelin , Alexandre Torgue , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Thierry Reding , Jonathan Hunter , "Peter Zijlstra (Intel)" , Marco Elver , Nam Cao , linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-tegra@vger.kernel.org, John Stulz , Will McVicker , Peter Griffin , Saravan Kanna Subject: [PATCH v1 7/7] time: Export symbol for sched_clock register function Date: Mon, 2 Jun 2025 17:18:51 +0200 Message-ID: <20250602151853.1942521-8-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250602151853.1942521-1-daniel.lezcano@linaro.org> References: <20250602151853.1942521-1-daniel.lezcano@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The timer drivers could be converted into modules. The different functions to register the clocksource or the clockevent are already exporting their symbols for modules but the sched_clock_register() function is missing. Export the symbols so the drivers using this function can be converted into modules. Signed-off-by: Daniel Lezcano Acked-by: John Stultz Reviewed-by: Thomas Gleixner Reviewed-by: Will McVicker --- kernel/time/sched_clock.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/time/sched_clock.c b/kernel/time/sched_clock.c index cc15fe293719..cc1afec306b3 100644 --- a/kernel/time/sched_clock.c +++ b/kernel/time/sched_clock.c @@ -174,8 +174,7 @@ static enum hrtimer_restart sched_clock_poll(struct hrt= imer *hrt) return HRTIMER_RESTART; } =20 -void __init -sched_clock_register(u64 (*read)(void), int bits, unsigned long rate) +void sched_clock_register(u64 (*read)(void), int bits, unsigned long rate) { u64 res, wrap, new_mask, new_epoch, cyc, ns; u32 new_mult, new_shift; @@ -247,6 +246,7 @@ sched_clock_register(u64 (*read)(void), int bits, unsig= ned long rate) =20 pr_debug("Registered %pS as sched_clock source\n", read); } +EXPORT_SYMBOL_GPL(sched_clock_register); =20 void __init generic_sched_clock_init(void) { --=20 2.43.0