From e2e72f99bf2e14f2aa428210550f4875641cf312 Mon Sep 17 00:00:00 2001 From: Jun Yan Date: Mon, 20 May 2013 17:35:50 -0700 Subject: hwmon: ina3221: ignore cpu notification when off When ina3221 is in suspend mode or off mode, ignore all cpu notifications Bug 1283995 Change-Id: I5c6bf66bfb401ce697b18828fbcb34ed916bfe3e Signed-off-by: Jun Yan Reviewed-on: http://git-master/r/230999 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Anshul Jain (SW) --- drivers/hwmon/ina3221.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/hwmon/ina3221.c b/drivers/hwmon/ina3221.c index e5d8b5c6c35a..dfeed39845bd 100644 --- a/drivers/hwmon/ina3221.c +++ b/drivers/hwmon/ina3221.c @@ -428,7 +428,7 @@ static int ina3221_cpufreq_notify(struct notifier_block *nb, struct i2c_client *client = data->client; if (event == CPUFREQ_POSTCHANGE) { mutex_lock(&data->mutex); - if (data->is_suspended) { + if (data->is_suspended || data->shutdown_complete) { mutex_unlock(&data->mutex); return 0; } @@ -461,6 +461,10 @@ static int ina3221_hotplug_notify(struct notifier_block *nb, int cpufreq = 0; if (event == CPU_ONLINE || event == CPU_DEAD) { mutex_lock(&data->mutex); + if (data->is_suspended || data->shutdown_complete) { + mutex_unlock(&data->mutex); + return 0; + } cpufreq = cpufreq_quick_get(0); cpus = num_online_cpus(); DEBUG_INA3221(("INA3221 hotplug notified cpufreq:%d cpus:%d\n", -- cgit v1.2.3