struct pass_resource *res = user_data;
struct pass_thermal *thermal = &res->thermal;;
struct resmon_result_src_thermal *thermal_result;
+ struct device_notifier_thermal_data thermal_data;
int ret;
/* Get thermal_result raw data by monitoring */
if (ret < 0)
return ret;
+ thermal_data.name = res->config_data.res_thermal_name;
+ thermal_data.scenario =
+ thermal->scenarios[thermal->curr_scenario_idx].name;
+
/*
* Send notification with thermal scenario name according to
* measured temperature of each h/w resource.
*/
- device_notify(DEVICE_NOTIFIER_THERMAL,
- (void *)thermal->scenarios[thermal->curr_scenario_idx].name);
+ device_notify(DEVICE_NOTIFIER_THERMAL, (void *)&thermal_data);
return 0;
}
*/
static int thermal_notifier_cb(void *data, void *user_data)
{
+ struct device_notifier_thermal_data *thermal_data = data;
GVariant *gvar;
+ const char *scenario;
int ret;
int i;
return 0;
}
- if (!data)
+ if (!thermal_data)
return -EINVAL;
+ scenario = thermal_data->scenario;
+
/* Find the available thermal scenario */
for (i = 0; i < g_thermal->num; i++) {
if (!g_thermal->list[i].support)
continue;
- if (!strncmp(g_thermal->list[i].name, data, strlen(data)))
+ if (!strncmp(g_thermal->list[i].name, scenario, strlen(scenario)))
break;
}
/* If there is no available thermal scenario, just return */
if (i >= g_thermal->num) {
- _I("Not supported \'%s\' scenario", (char*)data);
+ _I("Not supported \'%s\' scenario", scenario);
return 0;
}
g_thermal->cur_scenario_idx = i;
/* If there is available thermal scenario, send the broadcast signal */
- gvar = g_variant_new("(s)", data);
+ gvar = g_variant_new("(s)", scenario);
ret = pass_gdbus_send_broadcast_signal(PASS_DBUS_THERMAL,
DBUS_THERMAL_PATH,
DBUS_THERMAL_INTERFACE,