Skip to content

Commit 8713b4a

Browse files
Wer-Wolfgroeck
authored andcommitted
hwmon: (dell-smm) Rework SMM function debugging
Drop #ifdef DEBUG and use ktime_us_delta() for improved precision. Signed-off-by: Armin Wolf <[email protected]> Reviewed-by: Pali Rohár <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Guenter Roeck <[email protected]>
1 parent 782a99c commit 8713b4a

File tree

1 file changed

+6
-15
lines changed

1 file changed

+6
-15
lines changed

drivers/hwmon/dell-smm-hwmon.c

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -158,17 +158,12 @@ static inline const char __init *i8k_get_dmi_data(int field)
158158
*/
159159
static int i8k_smm_func(void *par)
160160
{
161-
int rc;
161+
ktime_t calltime = ktime_get();
162162
struct smm_regs *regs = par;
163163
int eax = regs->eax;
164-
165-
#ifdef DEBUG
166164
int ebx = regs->ebx;
167-
unsigned long duration;
168-
ktime_t calltime, delta, rettime;
169-
170-
calltime = ktime_get();
171-
#endif
165+
long long duration;
166+
int rc;
172167

173168
/* SMM requires CPU 0 */
174169
if (smp_processor_id() != 0)
@@ -230,13 +225,9 @@ static int i8k_smm_func(void *par)
230225
if (rc != 0 || (regs->eax & 0xffff) == 0xffff || regs->eax == eax)
231226
rc = -EINVAL;
232227

233-
#ifdef DEBUG
234-
rettime = ktime_get();
235-
delta = ktime_sub(rettime, calltime);
236-
duration = ktime_to_ns(delta) >> 10;
237-
pr_debug("smm(0x%.4x 0x%.4x) = 0x%.4x (took %7lu usecs)\n", eax, ebx,
238-
(rc ? 0xffff : regs->eax & 0xffff), duration);
239-
#endif
228+
duration = ktime_us_delta(ktime_get(), calltime);
229+
pr_debug("smm(0x%.4x 0x%.4x) = 0x%.4x (took %7lld usecs)\n", eax, ebx,
230+
(rc ? 0xffff : regs->eax & 0xffff), duration);
240231

241232
return rc;
242233
}

0 commit comments

Comments
 (0)