fix one typo spotted by Debian's lintian tool
[collectd.git] / src / mic.c
index da58b35..3e31889 100644 (file)
--- a/src/mic.c
+++ b/src/mic.c
@@ -20,6 +20,7 @@
  **/
 
 #include "collectd.h"
+
 #include "plugin.h"
 #include "common.h"
 #include "utils_ignorelist.h"
@@ -53,8 +54,8 @@ static const char *config_keys[] =
        "Temperature",
        "IgnoreSelectedTemperature",
        "ShowPower",
-       "PowerSensor",
-       "IgnorePowerSelected"
+       "Power",
+       "IgnoreSelectedPower"
 };
 static int config_keys_num = STATIC_ARRAY_SIZE (config_keys);
 
@@ -131,11 +132,11 @@ static int mic_config (const char *key, const char *value) {
                        invert = 0;
                ignorelist_set_invert(temp_ignore,invert);
        }
-       else if (strcasecmp("PowerSensor",key) == 0)
+       else if (strcasecmp("Power",key) == 0)
        {
                ignorelist_add(power_ignore,value);
        }
-       else if (strcasecmp("IgnorePowerSelected",key) == 0)
+       else if (strcasecmp("IgnoreSelectedPower",key) == 0)
        {
                int invert = 1;
                if (IS_TRUE(value))
@@ -213,9 +214,8 @@ static void mic_submit_temp(int micnumber, const char *type, gauge_t val)
 static int mic_read_temps(int mic)
 {
        size_t num_therms = STATIC_ARRAY_SIZE(therm_ids);
-       size_t j;
 
-       for (j = 0; j < num_therms; j++) {
+       for (size_t j = 0; j < num_therms; j++) {
                U32 status;
                U32 temp_buffer;
                U32 buffer_size = (U32)sizeof(temp_buffer);
@@ -286,8 +286,7 @@ static int mic_read_cpu(int mic)
        }
 
        if (show_cpu_cores) {
-               int j;
-               for (j = 0; j < core_util.core; j++) {
+               for (int j = 0; j < core_util.core; j++) {
                        mic_submit_cpu(mic, "user", j, core_jiffs[j].user);
                        mic_submit_cpu(mic, "sys", j, core_jiffs[j].sys);
                        mic_submit_cpu(mic, "nice", j, core_jiffs[j].nice);
@@ -335,9 +334,9 @@ static int mic_read_power(int mic)
                mic_submit_power(mic,"power",#name,(gauge_t)power_use.name.prr*0.000001); \
        } while(0)
        #define SUB_VOLTS(name) do { if (ignorelist_match(power_ignore,#name)==0) {\
-               mic_submit_power(mic,"power",#name "-pwr",(gauge_t)(power_use.name.pwr*0.000001)); \
-               mic_submit_power(mic,"current",#name "-cur",(gauge_t)(power_use.name.cur*0.001)); \
-               mic_submit_power(mic,"voltage",#name "-volt",(gauge_t)(power_use.name.volt*0.000001)); \
+               mic_submit_power(mic,"power",#name,(gauge_t)(power_use.name.pwr*0.000001)); \
+               mic_submit_power(mic,"current",#name,(gauge_t)(power_use.name.cur*0.001)); \
+               mic_submit_power(mic,"voltage",#name,(gauge_t)(power_use.name.volt*0.000001)); \
        }} while(0)
 
        SUB_POWER(total0);
@@ -356,12 +355,11 @@ static int mic_read_power(int mic)
 
 static int mic_read (void)
 {
-       int i;
        U32 ret;
        int error;
 
        error=0;
-       for (i=0;i<num_mics;i++) {
+       for (int i=0;i<num_mics;i++) {
                ret = MicInitAdapter(&mic_handle,&mics[i]);
                if (ret != MIC_ACCESS_API_SUCCESS) {
                        ERROR("mic plugin: Problem initializing MicAdapter: %s",
@@ -398,7 +396,9 @@ static int mic_read (void)
 static int mic_shutdown (void)
 {
        if (mic_handle)
-       MicCloseAPI(&mic_handle);
+               MicCloseAPI(&mic_handle);
+       mic_handle = NULL;
+
        return (0);
 }