History

coccinelle: misc: add secs_to_jiffies script

This script finds and suggests conversions of timeout patterns that result in seconds-denominated timeouts to use the new secs_to_jiffies() API in include/linux/jiffies.h for better readability.

Easwar Hariharan committed 1 year ago

Commit 551dbd11 parent e0835ba1 file · +22 −0Browse files

Showing the changes to scripts (1 of 1 file). Show all

Unified · Split

scripts/coccinelle/misc/secs_to_jiffies.cocci+22−0
@@ -0,0 +1,22 @@
1// SPDX-License-Identifier: GPL-2.0-only
2///
3/// Find usages of:
4/// - msecs_to_jiffies(value*1000)
5/// - msecs_to_jiffies(value*MSEC_PER_SEC)
6///
7// Confidence: High
8// Copyright: (C) 2024 Easwar Hariharan, Microsoft
9// Keywords: secs, seconds, jiffies
10//
11
12virtual patch
13
14@depends on patch@ constant C; @@
15
16- msecs_to_jiffies(C * 1000)
17+ secs_to_jiffies(C)
18
19@depends on patch@ constant C; @@
20
21- msecs_to_jiffies(C * MSEC_PER_SEC)
22+ secs_to_jiffies(C)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t