switch: add timestamps to switch driver

Change-Id: Iac5b5279f45fcc6e506d801cb5e9d6d2f6f6f9fa
Signed-off-by: Erik Gilling <konkers@android.com>
This commit is contained in:
Erik Gilling 2012-04-02 15:46:24 -07:00
parent 1dd49da642
commit 4991496393

View File

@ -22,6 +22,7 @@
#include <linux/fs.h>
#include <linux/err.h>
#include <linux/switch.h>
#include <linux/hrtimer.h>
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);