lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <49f2bce487f56eb2a3ff572ea6d7de0a43560c0f.1729865232.git.namcao@linutronix.de>
Date: Mon, 28 Oct 2024 08:34:34 +0100
From: Nam Cao <namcao@...utronix.de>
To: Anna-Maria Behnsen <anna-maria@...utronix.de>,
	Frederic Weisbecker <frederic@...nel.org>,
	Thomas Gleixner <tglx@...utronix.de>,
	Andreas Hindborg <a.hindborg@...nel.org>,
	Alice Ryhl <aliceryhl@...gle.com>,
	Miguel Ojeda <ojeda@...nel.org>,
	Kees Cook <kees@...nel.org>,
	linux-kernel@...r.kernel.org
Cc: Nam Cao <namcao@...utronix.de>,
	Kalle Valo <kvalo@...nel.org>
Subject: [PATCH 21/24] wifi: rt2x00: Switch to use hrtimer_setup()

There is a new function hrtimer_setup() which will replace hrtimer_init()
and also set the timer callback function with additional sanity checks.

This driver calls hrtimer_init() in rt2x00dev.c, then set the hrtimer's
callback function in rt2800mmio.c and rt2800usb.c. Therefore, switching to
the new function is not a simple one-for-one replacement.

Because only usb/mmio variants of this driver use hrtimer, ideally all
hrtimer code should be moved in those specific parts. However, all usage of
hrtimer_cancel() should be moved as well, and that is not so obvious to do.

With the lack of hardware to verify any non-trivial changes, introduce a
dummy timer callback function and use hrtimer_setup() instead of
hrtimer_init().

Signed-off-by: Nam Cao <namcao@...utronix.de>
---
Cc: Kalle Valo <kvalo@...nel.org>
---
 drivers/net/wireless/ralink/rt2x00/rt2x00dev.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
index 9e7d9dbe954c..187701a8f8c8 100644
--- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
@@ -1362,6 +1362,11 @@ static unsigned int rt2x00dev_extra_tx_headroom(struct rt2x00_dev *rt2x00dev)
 	return rt2x00dev->tx[0].winfo_size;
 }
 
+static enum hrtimer_restart rt2x00lib_dummy_timeout(struct hrtimer *timer)
+{
+	return HRTIMER_NORESTART;
+}
+
 /*
  * driver allocation handlers.
  */
@@ -1391,8 +1396,8 @@ int rt2x00lib_probe_dev(struct rt2x00_dev *rt2x00dev)
 	mutex_init(&rt2x00dev->conf_mutex);
 	INIT_LIST_HEAD(&rt2x00dev->bar_list);
 	spin_lock_init(&rt2x00dev->bar_list_lock);
-	hrtimer_init(&rt2x00dev->txstatus_timer, CLOCK_MONOTONIC,
-		     HRTIMER_MODE_REL);
+	hrtimer_setup(&rt2x00dev->txstatus_timer, rt2x00lib_dummy_timeout, CLOCK_MONOTONIC,
+		      HRTIMER_MODE_REL);
 
 	set_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags);
 
-- 
2.39.5


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ