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.
Unified · Split
| @@ -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 | |||
| 12 | virtual 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) | ||