From patchwork Mon Jun 2 15:18:45 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 1635 Received: from mail-wr1-f44.google.com (mail-wr1-f44.google.com [209.85.221.44]) (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 8578422D4DC for ; Mon, 2 Jun 2025 15:19:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748877542; cv=none; b=PNFgZFVjfz4R3T3OWcc6+unOZYz8x9wexDLuPuZqhSAUoxULQyBioZEjXT1cDrdU1J3bz7gG5WR9XokLCdvPTKmeirSrAHu6pzOh/lW/T+o/jz79bwvl2zfP0a4F0ph7FyxxDi5v0ZaHTdLNcZYVEXyoDzLb867uiwqv5U3WDSk= 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=maAbWibD; arc=none smtp.client-ip=209.85.221.44 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="maAbWibD" Received: by mail-wr1-f44.google.com with SMTP id ffacd0b85a97d-3a4f379662cso3506713f8f.0 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=lists.linux.dev; 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=maAbWibDxQfW8utHjfdP5WuszymGad/yNwMqOb7PF9b29znvKn0oocwpGcQkYwI9X7 zHd3BBPTPlBotz0Nm3wk9B3XwEbqIn4djMmIVcTmxRbAlsbWJBcUfK2ZlEPyxDwP0tUV 63fep1XDIFkIsbSn1PVf6zDtVl+UMgQ5M6k3IPB7TBt2vl/e9WgTGI7qubViN57AgAzz NB3uV7YxiCkb3+RDVGQbiDqaBgDsg45n/U0pmwT9670THXRko6/puUmXgI/kUkahpPLO L1fFtPiw7Adyy/F+eUxS+s1b2gPvReL0MRVzUO+chhL5kq+ByXANjrMl8e0vAf4KL/Gw ++hg== 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=XIXBdtOUO3h3J6ChVaRkQgrBeeQ3cTeKePSkeWG3k+aKHn4Km+RAbPy/FH/jORElRF nBys92l6UMM7oxzfGnmm/rfME+okpfWF0w2ndHqmOmcpd6ANzDwG7zzjkpaaNTeZIj+6 KGAY6X4g/FOBdDAI/4vsU4qmynqptHNRqLslsNr9K3A4y8W3KI71g+bLB74Am8PAPZ3I Yp1uBPYsSLMLDCquj8gN4VCnznQ9oyDi9VeOfXmpTKAhIpcdnhzx2Fgby0EZL32Ra87U 9x7uFHpS7XSBCSz/5K+KX33vBci9ir0Jo5/fyYQDEpYhCRhrEqwWQPZnHQ73q+hnSvH+ tNlQ== X-Forwarded-Encrypted: i=1; AJvYcCU6ZZZsLNlekETDz4BpN4kPieM6IE4GKmcebPz8KM07sfQnRwjjOkZ+ktLvtW9+jhBN8lySyyZCUluprg==@lists.linux.dev X-Gm-Message-State: AOJu0YxB+xu1hH7sNr8DIx58stT2scTewg8RtvGsfK+ZyX/4sqcvsa0O 0FDqRQSIVrAYZtvbsMMg2WA5FKgEsEVkVYWOOJOc8NRHj5PBb/VMLBrq+5E5BSixHg8= X-Gm-Gg: ASbGncs/omeRSAqnw+YsEkG+IqTUTPRJC8N8nVk+5NZQr8jOOwTXNCN6FZI4prR10Oj /x9GPnlmWrm4jvsRg+Ag12Hk8RKBBT5LigJa6Qi9bLsu08nR2DCs0OBaK1g0hXhS2SU4PMV4VXw cg8eKBUWmgT6dB+C4UTlCM3t40/du4kETzmlI8DX0P4YdQc0YQKF4CwVhfuL8bx+p0rb9bHGEVP MQBFOtDVtVLqBcJewWxnq1jqJV3Mh8mC02bSfsWO9NZD/DjCUYvwnDGNfefr5sxtvRz4eWuSh8i 1e+Z7mkdjCQWZo5YK/+6CJRuxOjJHiRMC8JqZE+ZNeGBoN0/1LPAF2Kmg8/fYWXpN6BWQWY/Fuh k6AocvRG8WPQx 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-sunxi@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Status: O 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 --- 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 = { .mask = CLOCKSOURCE_MASK(32), .flags = CLOCK_SOURCE_IS_CONTINUOUS, /* mult, shift are set based on mhz27 flag */ + .owner = THIS_MODULE, }; static int __init init_hrt_clocksource(void) From patchwork Mon Jun 2 15:18:46 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 1633 Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54]) (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 C718622259F for ; Mon, 2 Jun 2025 15:19:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748877545; cv=none; b=JszzIEBb9LglNXIiskOtPsKM6XK/IlzGcDcvWtjvylxCkupmXcxE6H1UZPbWcnGCLJsRMgFRDzGntzn+VBIsnHFX3v1piBWenPbf3HMsXBaub7/maFOg3UiQE/iq+cc6gY1WKDGL2kusANdwWqm3UMKLgqED3vLzVcJmUA2sPfs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748877545; c=relaxed/simple; bh=2hHPT0ZatQTm44Z1t6wExkfhxFsepGpoQ7pDrN0NhyE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=gOx69Uw7NDXBDTM8M2oTZDjYBOeCBMiMFgOATveBKyyyDgJ0F1SmHNYCXhz0WQGDnHTS/8566Pk2DqwvhdcHGpbQAgrZmpopm6lSyYL0f27CF0CD5xmDZUu1fy04iwJa8rzGuCZtuwOswonJkI7BJYMGlFEmjZjSPHGs7Z79gEg= 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=F9hIZxIx; arc=none smtp.client-ip=209.85.128.54 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="F9hIZxIx" Received: by mail-wm1-f54.google.com with SMTP id 5b1f17b1804b1-450cfb790f7so33345635e9.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=lists.linux.dev; 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=F9hIZxIxU0lyhMGEi7izzdEQWq5g6m9O4SLE95o9xMR9m/G2SrCWKEjoy5iqNAfef4 GLwLPmccNHQc/k7stKax3jUVaO2fwFgKotR8cr9PZ+MFoqOpoJXlykPbSzYsPSWc7+ix on7YYsh8jXso/bMoa6pH9/n6dHpzbkEnw+4gsLZs0vNdSNchwmqxBcAFwo1dHZzXp9md 2wx6UbseAkkbeeJrjdS1ZJbT+9EnFLe6d6dpqsjGWB03vjuHkjZj3RDO1QstHdiD3cUx 6mFNg74kw4GQuJh94G013+4wzi9b0Uv1PykpY96p/WgMzV1MhSwFSWfX0o9eftke9sKG K3iw== 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=a+g6sEHtWiCsIl/REbmT8ARUtGS4PT3GNkq+1xXT5zRaJy74I/KELke/rhuSUsodv5 Gc6EqOxg7luiovCzqt1NULg5c5ex+c3slehFxO3NFMdHWkhdgN1Eki4DzrmxkcDnc5iy PZ/i7mc9H9ezZ0FhjazSMELmM6/QvLGMzrrV8d9I7zWPpL8qKBATqJ1s+q4J8gHreHQz lXbTTE4yX8h5zqkeMz4+KKXBopE6RQ+v6aEYNxrzLEK00YkYylpP7q1XV8E1dSDTNPgs 3mKT4e5/VHe4IhEdzd6ILy5TQnKK+nWRxZTjzogl0kH997YHmsgIZQKDVUoM/d80n6Ns O1BA== X-Forwarded-Encrypted: i=1; AJvYcCX3VKopCDwRWrzEPoMomgDdqAzkGkxwwHsBljAZgXdAPuo9keM7tVuxtRhPSPzkx51C3OlWOmOQHJSlWw==@lists.linux.dev X-Gm-Message-State: AOJu0YwYPYSTFnT+p/SV3VJ7Uql2gXAgN3AAFBnRHGZu4EXNLZjN7AP6 9+OnykBBlXcpGll4UkEgBwkTf4WcyKYB3jCUl1BSmXg8B3OPgmCp0/+/ALPWsAsW7A8= X-Gm-Gg: ASbGncsOvuv2LneJSYcyq4zNb5OhUyWz+lhaVrqJfWS3/Da3b2kqTYkN6pw6sdmzwPK kmJGoz+ZmjJaPCEUpXQT74czSySSM6Jl8Kz3pfHjLbkLZ/zyQR066nch2geReygiHNOTO5mQQyn uFRpwAJ7mTjsDAxtVVAsiFTVaHXQgmjZ+/mVBJf1Jr9zmmB/tQyV1I30x2ZLjFezXgRcNgv9Oma mAXvCCqQMQBBzoavDK+CY/lIDS2qH+fbG87PdqJuQ4qmCMU3+ftQb17R/+tnbKGgEwU6RrYOV/E BsIoZRlyCS9FAe37vzI8Hx3oZFC3+K2miYHcqVaPb1TzSLh/ktk3PiqVeKrlldZLqW3Jid2t28T 86I+9w2hiwJzW 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-sunxi@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Status: O 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 --- drivers/clocksource/timer-stm32-lp.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/clocksource/timer-stm32-lp.c b/drivers/clocksource/timer-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_private *priv, priv->clkevt.rating = STM32_LP_RATING; priv->clkevt.suspend = stm32_clkevent_lp_suspend; priv->clkevt.resume = stm32_clkevent_lp_resume; + priv->clkevt.owner = THIS_MODULE; clockevents_config_and_register(&priv->clkevt, rate, 0x1, STM32_LPTIM_MAX_ARR); From patchwork Mon Jun 2 15:18:47 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 1634 Received: from mail-wr1-f44.google.com (mail-wr1-f44.google.com [209.85.221.44]) (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 0B27922D9EA for ; Mon, 2 Jun 2025 15:19:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748877544; cv=none; b=PDtFdxlkskCofjdMFeMqqjYai/nM4Ts/yTpZeWyZH7SWA8tS9l5S/2jon0DalreZDKGHXCpvfyX494WsuBHG436PGtafHuqoORQg+WbR0RyGGPBLQYVqDmYBrkiMhwq8n2d9Hmyqf70Vi/N04H0ZpQJIc5am/PGdiIeYAZOSgI8= 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=GGmNufES; arc=none smtp.client-ip=209.85.221.44 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="GGmNufES" Received: by mail-wr1-f44.google.com with SMTP id ffacd0b85a97d-3a361b8a66cso2721154f8f.2 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=lists.linux.dev; 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=GGmNufESKoGOz64bcv7rCZUeHVpuKAN93Qg/MAcFXKUSf2Adx5Y9jr4KsHnZF1aLxR knGPp6GiZj87+qbqS2hn6t42bIM6FZNs6FBnNTf32+OaXU4cjLaJ5H4M7/WMdcPQfDC0 ozEan+iXCyHlq52BY2MAZpBOOPat2c2wtHbfGqbwEtsVVMBvSc/MgyFuCYS7PGMtz6Ph I/DBDYYf0BOnqQxjxqoTH36QC3HOe8rTkBrN+fF/N/YM7MlYTYGSs23FelIdLutBj7fq Y4zNUIK5o7iLx3PH5iTwWWbPZqsOIB/IiFQtZCL10WhVy8kDJWELUp7FhvNQla6njKqk 1DZA== 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=SKqrdBf5nylTr8oos3X98HQzU7bjqxteWJK783eSID2d9boB1g74DIXFnlYFE1+sS0 38NE3evo+ZngaBORGZRleFFgj5nH1+3W2BFRq9u3COmietVQt5LK9Ipvg533lb3QrnJO Ivwhs34Y1+E2cg1JbqFVVjltIM2wTxXvLTo8gosSee0Qqlp+/miWtWEcbUAi3RaNBVzX g5ATZesNznPUO+LKaNeFZD5jaYHSmPUuFGEXTpfaycRMlVUtsLHSQVBwZT1Huz5HXa8l xrNGTTxf1KY/Y1i3/INSwNzeP4R/+/ppolQsDUKCk4A0JJTkVd/4ldx3xOlqW1yaRV/T 3T+g== X-Forwarded-Encrypted: i=1; AJvYcCVekjQQzihnAHcgBznpIMQXxVYByGnZHKGSyehZz6+0APwbTAa1bGrRt0ad9Rqr8JKgBRShEFqUQxfqpg==@lists.linux.dev X-Gm-Message-State: AOJu0Yyn16ShS0a3zaP6Ne4P7qvUVFWLze1BxP4ARgBSsrW4zOOwhboX MhuQxsKHV8ChFjDgzS78eRSlimmmhi2Uz6Z2z5t9R23PX2EDIA2Yo9/JWXA1ytG46gs= X-Gm-Gg: ASbGncs/2Umjqj+huGEOES2x7jPFhNfagzOrwiwm1eICd1mumQyCs9cdyVaMIUVuSSo 1dq5ArybJizGLpxvhl3VX9qfEx6xNL3hqMBka6LkmQmpJz5qr+90RwfFutK0bkX6z29LempSH7U vtPW4n2csX5BD2ZcWaALWHb46q5LEwfAPvNAS+ImtjSf+PV/7e73csXGbuuEKdibFYtH6IqVl/0 anf6mz7eGc8ZskCEBxYuLDi70xSN7uAXgTN056MARs4R4EBolKzlSupxXgJ0ahqWYOi2hNhVag5 2HFJSrL+P8FtQO61OyvYWOKvmDoSFGerqtfMwDO/JaMAElaresjr/WpBdczvXqXWRt3ZyDPa8rS KP7bp9YX18evi 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-sunxi@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Status: O 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 --- 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_device *pdev, cs->clksrc.read = sun5i_clksrc_read; cs->clksrc.mask = CLOCKSOURCE_MASK(32); cs->clksrc.flags = CLOCK_SOURCE_IS_CONTINUOUS; + cs->clksrc.owner = THIS_MODULE; ret = clocksource_register_hz(&cs->clksrc, rate); if (ret) { @@ -214,6 +215,7 @@ static int sun5i_setup_clockevent(struct platform_device *pdev, ce->clkevt.rating = 340; ce->clkevt.irq = irq; ce->clkevt.cpumask = cpu_possible_mask; + ce->clkevt.owner = THIS_MODULE; /* Enable timer0 interrupt */ val = readl(base + TIMER_IRQ_EN_REG); From patchwork Mon Jun 2 15:18:48 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 1632 Received: from mail-wm1-f41.google.com (mail-wm1-f41.google.com [209.85.128.41]) (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 2B2D01D8DFB for ; Mon, 2 Jun 2025 15:19:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748877546; cv=none; b=Imhz34AmjpY2h2eu8QqCLEn3xjWTbNK/sC1zkKhGwhsim7KDjJ7c38kipbXZo7XcaOPiaHxGctylBgq9P+oqQQlHZMubFaHLqlEINii4AEx+AQkxxKcvbhaToR9gZyD5ZoqOpDaUR8gwSchLJ4UDe6Uf5k8UUOcDZUMCdcxt8M8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748877546; c=relaxed/simple; bh=06sqAxtbKKs7o6LiAk2AbUdTVmELzxncQQECi88QF6U=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fugm5+U1KHG3B/sgsLo8POiMAYlADv69164CXISP/SWLVrMd6tcUau4VkJcAssJliZZZinA7rk6ui7mnBVybDR3mo1QEKKLmitodlRNBHjxLrc11ga4VOOUdrnMoSVlE5kgJn52VRQO7h/o5XZ9pcDXj5cmEjoJxBt+5EZfTwSg= 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=bIMo4uue; arc=none smtp.client-ip=209.85.128.41 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="bIMo4uue" Received: by mail-wm1-f41.google.com with SMTP id 5b1f17b1804b1-450d37d4699so20543255e9.0 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=lists.linux.dev; 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=bIMo4uueHo+jgUW0tuMY+jnbrYPXSs08ZDSUO2aHa64vmFLIu43dUXT1iu38U2TfDo posjto4kKV43KhdDXX+YHhdasXCu139pkhmZgnSriT7AEfXiquuGCQDxbP9su+MKpfHc v8RvQWZ3AI3/e1ep5JomWIwuDiGVVrRcchLluC1+i4e45ZEje/N3BT94EaYh2WvVtChd Xmqv/bg2fNNV2aa8rrECMQj9veLhGKKS2yb0vKtFw5USE9egXIuDjS8Meljzg2sSQTep Wx1zahyXQ7ZH4Bh5WBL+vgZO+TmB+K2B2lnbMloKfvyfxHA4bBPNguaYAP5RQGNIPVR4 zNDg== 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=vrAooWO33sv2LutIEzEmpZR2zdKqk2mlpYwkzK7vj8VSh3uC5gmuIcWI+Po4LCQv1y AxnlaSDl0ubQGQ1dimBuA/N+0UITKMNcGmR/yctd8tYwlIm5DMhEByRp0fQfQ0iQoXiH dlln1vnGEkT5vSGOhJPU7oZAFkQLwlpMdC+hQwuZEUMCW/H+cXSWVv37Otx8yX1FwtWu USVkMl4gsrfExkwnfgM48vPFjOVou8k2G+WfbXe92904aHZWaPZzCHzYi7KTgrTFH6+L lkpnODRKlvlXC/2UhZY+lbZAqtSKtn9FuyD6rKgB8eO4KGFA20GidHv+r/gbRJdgdduw dNlg== X-Forwarded-Encrypted: i=1; AJvYcCUSTrZ4M2JznmJA6BR5L5sBFX/mPsYBnubfwgkDRmw2JiMDx9z9ooM/vO70dPIRuwlELIg8SddcJVNT0w==@lists.linux.dev X-Gm-Message-State: AOJu0YxeYWTENxVTfX+ySjByWzyxpdEkbEw5eN+XBBlom+sZrcCEkXG7 f/MxACOHf1plmdvcnn+hvz/HfKYaw7fNrybPepnZc163DgEIn00auLJcgXrLjpKnX28= X-Gm-Gg: ASbGnctYeORw5rYzYBummyB7EMJuWv3DHAT7Fn2mAKiQrngmNKenSdDMVwCV+tyCSGx dzjchgWSO/vHb6B6nQjnCGw8EP66/yzxu7k9PvO+ko29axHsUVjbuzwGiw8QSShcWA12GhX1IlF m2zclfYdJeGGpUOyVQI2MA7+oqCeO/GH/6IVsNQBHKzepYDNMw4+VWoqRlzZ8yTfFFwoEKNa/C9 1TjISLrK7PmpBXSdYxLnXp0wWuUR+u4ZiPHx5MW/s2/W3al4PgleQnMO1ex5dMfUDoarno/Ky7k vSqvQpSSBxUvvQtop8UmewKK0k+VwvmE3jVgVXRekWrkhG6w0hXdw4A/YP34EWHE6ZkHusUg2uJ octI2kFDkrtqH2LnSJ/mt6Y0= 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-sunxi@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Status: O 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 --- drivers/clocksource/timer-tegra186.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/clocksource/timer-tegra186.c b/drivers/clocksource/timer-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_timer *tegra) tegra->tsc.read = tegra186_timer_tsc_read; tegra->tsc.mask = CLOCKSOURCE_MASK(56); tegra->tsc.flags = CLOCK_SOURCE_IS_CONTINUOUS; + tegra->tsc.owner = THIS_MODULE; return clocksource_register_hz(&tegra->tsc, 31250000); } @@ -392,6 +393,7 @@ static int tegra186_timer_osc_init(struct tegra186_timer *tegra) tegra->osc.read = tegra186_timer_osc_read; tegra->osc.mask = CLOCKSOURCE_MASK(32); tegra->osc.flags = CLOCK_SOURCE_IS_CONTINUOUS; + tegra->osc.owner = THIS_MODULE; return clocksource_register_hz(&tegra->osc, 38400000); } @@ -411,6 +413,7 @@ static int tegra186_timer_usec_init(struct tegra186_timer *tegra) tegra->usec.read = tegra186_timer_usec_read; tegra->usec.mask = CLOCKSOURCE_MASK(32); tegra->usec.flags = CLOCK_SOURCE_IS_CONTINUOUS; + tegra->usec.owner = THIS_MODULE; return clocksource_register_hz(&tegra->usec, USEC_PER_SEC); } From patchwork Mon Jun 2 15:18:49 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 1629 Received: from mail-lf1-f54.google.com (mail-lf1-f54.google.com [209.85.167.54]) (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 66EB9230BD4 for ; Mon, 2 Jun 2025 15:19:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748877559; cv=none; b=msYzCDFSa2/cDFsEYKR2ewFDG6ruqfi+vG4aaKsRzINV4SvEjnQ+wrL21/Dca8j2gYNlQhNzGmj+GHuS0+qJ43sHn3lirOMm5PlLNuK/I7xW3kZ8EcDXGSS/5ZqI2dnAWBV6GRfwxsN+U/MD8cuMp8N3E41Uf6Fk/Wi8wA3dLOM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748877559; c=relaxed/simple; bh=qXg36nIEaSbraDl3K9/tt/qe1tR1XHyEOkFR1xkoAXI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=a5BwxriJ+8cNSx5cCQXe7yGSDFwc9I19Nfo90B9W3yEFL1eqUlj8wWRQYSR+aInVEHkQ61g+vHLPXgsq91psVPxPCevmtb9rRmRgyczAqVB151M7BeMszra9v8gNuV0FV4683sEX4LmzUzJBcAWoa8tGh6egQTvDHpaLs4LUy0M= 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=SmNi9BzG; arc=none smtp.client-ip=209.85.167.54 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="SmNi9BzG" Received: by mail-lf1-f54.google.com with SMTP id 2adb3069b0e04-54acc0cd458so5607902e87.0 for ; Mon, 02 Jun 2025 08:19:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1748877554; x=1749482354; darn=lists.linux.dev; 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=SmNi9BzGGhR4UUY97EvrAro/R6zfXhjl+tfv9maI03JP8mRTIW1LXrmAkA0eqL8HOM zupDlEpDp9D2Uofl8lLXqv9VV5ufiYQ3mSAhHVUTqAUDotuki19tgSBRBDk+INNxjz3j 2SpU4SsVOvEoiuH37X64cmZmhPlyxyTlmwX26ZmfquuXz7IR7sMfgGi+1HcIggI7YWBS 60+pc3TCcdcq/zH9xpmNW9YTtuppSo9rO7FP46aCQJI5MR4sVdjKVfyYcNEcTVHwmki2 HOpt4fD//cWRYNowaAB7Lgqw7VRbmFrasoko3V6Gw2RM2/WB4Lgmbv69/mASX2q13IyH RYRw== 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=W5P6PUV1s1mwcOMlqdaUGhB3he7XINTsRpaylsSrCqmTSjIBlZpfU9gqsOgDX2dO3e y1ULyBS9TRfxR0eVtpXEy5XuzPhgy/ZsNkQBOwFvLvJiwDuSYZl/+DMU1+ABIkHiuESO dEOx3Wmak3uGnv42sjGAAcxvu30AToTjP5SK0L/L/Gn0/o6ictVinhY2XiLMj/6HusVe usNqWfAm4lKB+8RqP/mSbIILppw9iCuDox35cO9s493asX+z0awsiRxwI+kIy3y5E5C4 QKW/NBL+56lhg1ZB7vFFLSscc9Cmv29ut6BdEut06oiWxVpJHoISPd+HRq8iUN96A7XW gVvA== X-Forwarded-Encrypted: i=1; AJvYcCWMbbcGmck1V5vRuqxpxGFLPP5mfakkB69EnHKfjvyC6rdX9gtZc/u529N2yi8fJFShW0ES8tVqv3m9AQ==@lists.linux.dev X-Gm-Message-State: AOJu0YylVmwv6S4C+68f6tVt66EBwiqC5FV7gzePYbzoqEm6g3A81oNF eXP/aAICAVOryGDEplx8D7XV8i6U7vTXIopFGbgJKucxfhqOPY6KA2YSuimKQx3d2QZ6Jejz2tr 3DEB5/wU= X-Gm-Gg: ASbGnct1Ay1nTLSaJezhtrQLBZpioxDNEUUAgqRKLjjZfSjWAHCaYE6+4TkeXRsfSqh SYpXWPkqOtZiLtTEMDXWi0ks9W5xu4ynvvwerGv7mXg1KaxZE4JznJ2SycVnIkAgAi4cqzDeF+W GsyjyBikG8ANbaeI465+G4C7ZXTWz4JYt41le+J7Dq/ft1JHT6Jkyscr7pnPn0TYdKSnW8UhYko jDXE2JswqbVVzePszqsT0u5Ephjno4IHhwswmCbvxuz/sDe3d441hfiMLFKTxq81/4BnNtAhr8j DyfAtvZ6aEGPrSCxRjnqSImXH7Rh/d1cWNHp7ySqW90HYPLt/oTC2jxdJwD7Izy0Y8XLTy0JKoe cSpxlwtMr4GT9 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-sunxi@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Status: O 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 --- drivers/clocksource/timer-nxp-stm.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/clocksource/timer-nxp-stm.c b/drivers/clocksource/timer-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 device *dev, struct stm_timer stm_timer->cs.resume = nxp_stm_clocksource_resume; stm_timer->cs.mask = CLOCKSOURCE_MASK(32); stm_timer->cs.flags = CLOCK_SOURCE_IS_CONTINUOUS; + stm_timer->cs.owner = THIS_MODULE; ret = clocksource_register_hz(&stm_timer->cs, stm_timer->rate); if (ret) @@ -314,6 +315,7 @@ static int __init nxp_stm_clockevent_per_cpu_init(struct device *dev, struct stm stm_timer->ced.cpumask = cpumask_of(cpu); stm_timer->ced.rating = 460; stm_timer->ced.irq = irq; + stm_timer->ced.owner = THIS_MODULE; per_cpu(stm_timers, cpu) = stm_timer; From patchwork Mon Jun 2 15:18:50 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 1631 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 B2573238D49 for ; Mon, 2 Jun 2025 15:19:06 +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=1748877548; cv=none; b=ULSzRcSrd/V5derBBSega9La1YgOw/INUWmXBgXMhvwkQIwgHNFvo1NpMlp++9fuX5SxWBN7q9GyNfEMXA1DDMdhziezP0X/Au05/hvy4lFc5ej1CorTVEVzxJO6FUyWYwQfeeRhMKbni2ZhkTpSg2lATxHfNyRb1issm/aeycQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748877548; c=relaxed/simple; bh=hUv0mIWbDZHw2AgsshB1b4pGaBwY9mA7lDi8KBrhZs8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=t0oDcotIXL+dUeYHFjhFEqidrlM0DSWBTxoe/KUVEOqFgpVqt//t2zX7QflMEDf5T10VrzSGXIQUZF7KqRsYH9rklCUid+Isne+vyWYV02kHbAVXSXJIXY+iUF5Tg2UJFnunzQEF4iOgFbC2qDdP2BmrPX3SBFmt9knpiji4pag= 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=KsOxDfYc; arc=none smtp.client-ip=209.85.128.46 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="KsOxDfYc" Received: by mail-wm1-f46.google.com with SMTP id 5b1f17b1804b1-442ea341570so31275415e9.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=lists.linux.dev; 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=KsOxDfYcc5FchR2m2BUjCBEoxYQV5Zwc+M8PLSSJt+RgJh/RC1TsCogYQ1lGekbZBT 4CUDrZoUcd++pjz6oZ5HJqHdqNytOBZPBMKFC6mdGk8hyW7KylN4zqGkgfStbo5PcQXM mwUg7m3gAMChTWkKgcKU5GlixGIZWee57etlfQi93D01iDIx9ulVog4AhEfev1czobbe nEdH0D4vTaF5lCYuexqSXmBE9HDr6c0Tl2vUnczkBi1NWNBE48Y6tfTdDRgkLD4nRnM5 l0Bhq6oZMLWxAiRvDEiaOjo86gSox5tkGQmExENIOk63U0cwLqLa60sU5A3nGzTnTZiw hvvQ== 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=tJB3IsxS+aG3POwm+rRedJQPMf+BBzyPPuIm5bvO0v+FbnX9SKVDVYD/zFVVb/Un9H ONUPeGZiHtohgQC4drmYBsweExmSZkOdY8R37NftF4KtcLf4MtFVNUYKl9Ogd7bekwAg xhiZY5x8kjzARuBQERyLSodAEGb+df2er1fH6M2WczoFrW/TDUnb/BWotAvk5/ueF0xi yB/iRsPb4ZOumdzMh980GKjRzZvqKhwumOwl0vVwZbyuEWynfwudFJEUp7moRt3JsNau SM3dXqNdAp3+2n8p5yh0lsa7E9FmBF6RtYFnyUME19bI6p2DOd3OcU+Qd06+8hmnpmV+ vGHg== X-Forwarded-Encrypted: i=1; AJvYcCUTA6TSVrsFkbU/T51fA64QnX+nv36DtSc/AjvOfA+fWndV2uNVxIYhBLfv5TGBQ0nQlVGdqk3EFO6jJw==@lists.linux.dev X-Gm-Message-State: AOJu0YzjAlKhmUQvbUaHYehNWpNdVkW0nIPtWFnLvU9LprJLAp1/76sy /4+HYc3BXR6KzsFTWAXGc5a2bsr1t65XHcOOKRpqSyTbtlmC/ut/Btt9e3GSSs7jTG4= X-Gm-Gg: ASbGnctiIFnxVYSi/CLxTzvnPFMPfZk3tEbpldJuoXGNE5FDFFu4YnpHFh7gmUKUoSy DSnI8k3yr6DaZ0Vy8HbdBInQUgxRiIT+LHuDzyJcLUr2ZsUE4q3BlpvvpPoKP+RFKPFAMl5u3RM xw92iSqmUgtjzYIgPnJ/aRKYNwWe8TALw0zKhVmPfgBJmTK/xAeQxsGOPUnLcFnUcagthH6nKK4 yoTwqlNwwP6D3qgbu92EjK1n8dUr3lKg/jhKq7J284U3tTL+jqh3Dj6KT37u0EZU6F29qdU/MQB SFfDrLd6MOMGlMNGObfgcajr3ITLIJkOzvJuifUTPteraN8sj7oqjZwCTov8BjsRCV4MUKws3TA TIZi24HAr3Qvd 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-sunxi@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Status: O 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 --- 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 = { .tick_resume = mfgpt_shutdown, .set_next_event = mfgpt_next_event, .rating = 250, + .owner = THIS_MODULE, }; static irqreturn_t mfgpt_tick(int irq, void *dev_id) From patchwork Mon Jun 2 15:18:51 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 1630 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 55E342397B0 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=1748877550; cv=none; b=V8L/H6SJ5/IAS+M5B7prw03mLUMYrwI+9kPW6cqYnMp9S6JpvvWwLdtHNqCXfz+hqEeHTipVuaXZxACUwwuPMj+1E/Vm2dkw1/GdSytuDVmc28ZXSp1l2+bxMUoaf9LDJWD7ryznt+hb2vvU8K+oiRUNCkb/RHFY6dq84nldbE0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748877550; c=relaxed/simple; bh=GxbSdL0PyZ8UlejUoxlDIdlFpATxnSdyF2KX6oHR03A=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=aCybeJryPzWkwXZf+ivc8XOrj6QJhVfFy5NHeEQ1yLdd0DIYq05w+96nxPQftS8omsBgPL2MDQw2TJQZynQPcGNiKMSR1PqbHu2daYyGgpcp4FogCIdRihRB1UUl+rpq326KXJtRadY9Bf+lIkDUW0tcoV4PwXG3AWZQv976yyQ= 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=fKqGqx54; 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="fKqGqx54" Received: by mail-wr1-f51.google.com with SMTP id ffacd0b85a97d-3a3771c0f8cso2775909f8f.3 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=lists.linux.dev; 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=fKqGqx540mMFOUAuTK7ZMX0Jvlp3c4I+6EhEF7JwGdflHZAfd97KPS3NGiujrAugKB Ddmgh6hyeGYISfvADa1oPCc4XHorINfq2CaA3Np+kRnD7ydSB1sPBGgEV3V0iw72VyUU ghLeSBU/0bs34sQAWGOPDCpd7Pe5HBN0ruW3X7JK4Yhgx3Fn4u2F6rZ5n8i4gm4kHBkf uMTGFKG9kVI3iCEzoQURNEikK0B9ZdB9zmrh9Gs1WVl+RVVlowuQdnL1dXtCEYLSQven WuWi6k7uB3vDRMoiYpXEvGWn/ZixsksGGS7bIiARnoedx5R/mJM1GXT5JDY3O+MJnGtv FUrw== 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=I0/2Kw4DpsTwaAAj6RhN3CoqpFxK6Xp4qCr7IuoYkhJvoW2PIbgLac1v73sfRjpXY8 HliXqzyuDqxkIDxex6Xs2GbIq7JIbxULyaa08gr8bChN7Db5AF4pgTFnHT/Qxb8NhOp3 cKRFq4UM1j74+PEbjDaeaNbr8beTFoNrhsS5bsVcYuhTmb4GdPFGqqrQmMM3AFTba5F/ PiLbqW5SN84K3V+YaYuWpTdbz2Ci+V3NySYws4NjXiKc92Dv7j61yJOyzOan5RdYV8D+ FY20zOfVxTJTOrVP0nO7ZEmnXnM40tgqjPLEVgn8BsQimm9OYU6twAL8he3Sv8xQc3Kp eKOQ== X-Forwarded-Encrypted: i=1; AJvYcCXYfIjiB8OsIQkTszaP4MjqgB2A2HexeAdlWYnMej0z9Ib/bpSEQza+Wp7h9drsrk5IChxUc24IClwo+Q==@lists.linux.dev X-Gm-Message-State: AOJu0YzUXeZ1jM+z/FlR05xGsn5aiJYMODHfpTJGVbBndFdtVU/mmRBK AIVReEdyVMXlIicaWuN32n3dJS7zrSA41ozDg11D85G4Xy2IUTMM2xrd937K/et/XNM= X-Gm-Gg: ASbGncsqio6xA8GdY47nyFEzLVo7N/03T5tB8a6n5G3jjY91FaYO/2EZMjmp6jlQB6q C5jGqdm+/p029KchNkm70OMfsFj84KDA5HHs26M2EUrdPQfwr+z2aHOX1qEtTQ2PySdip387Svk k8QhAuOXn0f0PsAIuuf77PPWtmytFVbSUoAKvPe94tynbAwJxL+KkX1BCV6yhZj/b71eija5k7Q EtwYshj2eP+jly3runBxBuhw74FW21f6QAgZ5P0p8ZR5IRKJaxQ0b4Qkh+YgL98T7oB6QVbUu9E qIifleI/A1hmJWjWpjJXoq07oPR9K4YapqgbIWUjEqjGOSHufIJdF0qjCGNdeB/oaMHNRfwE/fG ZXQ== 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-sunxi@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Status: O 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 --- 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 hrtimer *hrt) return HRTIMER_RESTART; } -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, unsigned long rate) pr_debug("Registered %pS as sched_clock source\n", read); } +EXPORT_SYMBOL_GPL(sched_clock_register); void __init generic_sched_clock_init(void) {