From: Erik Gilling Date: Mon, 2 Apr 2012 22:46:24 +0000 (-0700) Subject: switch: add timestamps to switch driver X-Git-Tag: firefly_0821_release~7613^2~147 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=499149639354dc2ca0ae0f45716511a5c3a8d533;p=firefly-linux-kernel-4.4.55.git switch: add timestamps to switch driver Change-Id: Iac5b5279f45fcc6e506d801cb5e9d6d2f6f6f9fa Signed-off-by: Erik Gilling --- diff --git a/drivers/switch/switch_class.c b/drivers/switch/switch_class.c index e05fc2591147..cd2456a3cbd8 100644 --- a/drivers/switch/switch_class.c +++ b/drivers/switch/switch_class.c @@ -22,6 +22,7 @@ #include #include #include +#include struct class *switch_class; static atomic_t device_count; @@ -61,8 +62,9 @@ void switch_set_state(struct switch_dev *sdev, int state) { char name_buf[120]; char state_buf[120]; + char timestamp_buf[120]; char *prop_buf; - char *envp[3]; + char *envp[4]; int env_offset = 0; int length; @@ -87,6 +89,9 @@ void switch_set_state(struct switch_dev *sdev, int state) "SWITCH_STATE=%s", prop_buf); envp[env_offset++] = state_buf; } + snprintf(timestamp_buf, sizeof(timestamp_buf), + "SWITCH_TIME=%llu", ktime_to_ns(ktime_get())); + envp[env_offset++] = timestamp_buf; envp[env_offset] = NULL; kobject_uevent_env(&sdev->dev->kobj, KOBJ_CHANGE, envp); free_page((unsigned long)prop_buf);