From e1f9a8285e12663764f7b74e21a394eb04613dc6 Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Sat, 11 May 2013 09:40:05 +0200 Subject: [PATCH 1/1] mic plugin: Remove the NUM_THERMS define. Also some coding style changes: Limit line length, move temporary variables to an innter scope, print the temperature name in an error message (rather than its ID). --- src/mic.c | 38 ++++++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/src/mic.c b/src/mic.c index 80a85c59..566b2166 100644 --- a/src/mic.c +++ b/src/mic.c @@ -35,9 +35,13 @@ static MicDeviceOnSystem mics[MAX_MICS]; static U32 num_mics = 0; static HANDLE mic_handle = NULL; -#define NUM_THERMS 7 -static const int therms[NUM_THERMS] = {eMicThermalDie,eMicThermalDevMem,eMicThermalFin,eMicThermalFout,eMicThermalVccp,eMicThermalVddg,eMicThermalVddq}; -static const char *therm_names[NUM_THERMS] = {"die","devmem","fin","fout","vccp","vddg","vddq"}; + +static int const therm_ids[] = { + eMicThermalDie, eMicThermalDevMem, eMicThermalFin, eMicThermalFout, + eMicThermalVccp, eMicThermalVddg, eMicThermalVddq }; +static char const * const therm_names[] = { + "die", "devmem", "fin", "fout", + "vccp", "vddg", "vddq" }; static const char *config_keys[] = { @@ -183,20 +187,26 @@ static void mic_submit_temp(int micnumber, const char *type, gauge_t val) /* Gather Temperature Information */ static int mic_read_temps(int mic) { - int j; - U32 ret; - U32 temp_buffer; - U32 buffer_size = (U32)sizeof(temp_buffer); + size_t num_therms = STATIC_ARRAY_SIZE(therm_ids); + size_t j; - for (j=0;j