summaryrefslogtreecommitdiff
path: root/drivers/hwmon
diff options
context:
space:
mode:
authorArmin Wolf <W_Armin@gmx.de>2021-08-14 21:05:16 +0200
committerGuenter Roeck <linux@roeck-us.net>2021-08-17 14:54:27 -0700
commit8713b4a49c8a9acc1fe25e6b98a9bbd0e9b3a680 (patch)
treecd25ad1f56d223b237d51015e51329cc9fa7a3ae /drivers/hwmon
parent782a99c146ffe9d0e06f139daea0e56d866eabc8 (diff)
hwmon: (dell-smm) Rework SMM function debugging
Drop #ifdef DEBUG and use ktime_us_delta() for improved precision. Signed-off-by: Armin Wolf <W_Armin@gmx.de> Reviewed-by: Pali Rohár <pali@kernel.org> Link: https://lore.kernel.org/r/20210814190516.26718-1-W_Armin@gmx.de Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers/hwmon')
-rw-r--r--drivers/hwmon/dell-smm-hwmon.c21
1 files changed, 6 insertions, 15 deletions
diff --git a/drivers/hwmon/dell-smm-hwmon.c b/drivers/hwmon/dell-smm-hwmon.c
index f93baf1035cc..774c1b0715d9 100644
--- a/drivers/hwmon/dell-smm-hwmon.c
+++ b/drivers/hwmon/dell-smm-hwmon.c
@@ -158,17 +158,12 @@ static inline const char __init *i8k_get_dmi_data(int field)
*/
static int i8k_smm_func(void *par)
{
- int rc;
+ ktime_t calltime = ktime_get();
struct smm_regs *regs = par;
int eax = regs->eax;
-
-#ifdef DEBUG
int ebx = regs->ebx;
- unsigned long duration;
- ktime_t calltime, delta, rettime;
-
- calltime = ktime_get();
-#endif
+ long long duration;
+ int rc;
/* SMM requires CPU 0 */
if (smp_processor_id() != 0)
@@ -230,13 +225,9 @@ static int i8k_smm_func(void *par)
if (rc != 0 || (regs->eax & 0xffff) == 0xffff || regs->eax == eax)
rc = -EINVAL;
-#ifdef DEBUG
- rettime = ktime_get();
- delta = ktime_sub(rettime, calltime);
- duration = ktime_to_ns(delta) >> 10;
- pr_debug("smm(0x%.4x 0x%.4x) = 0x%.4x (took %7lu usecs)\n", eax, ebx,
- (rc ? 0xffff : regs->eax & 0xffff), duration);
-#endif
+ duration = ktime_us_delta(ktime_get(), calltime);
+ pr_debug("smm(0x%.4x 0x%.4x) = 0x%.4x (took %7lld usecs)\n", eax, ebx,
+ (rc ? 0xffff : regs->eax & 0xffff), duration);
return rc;
}