/* Function Description: Initialize monitor channel with channel desc, * decoding tables, monitor type, optional properties. * Return: None. */ static void envctrl_init_adc(struct i2c_child_t *pchild, struct device_node *dp) { int i = 0, len; const char *pos; const unsigned int *pval; /* Firmware describe channels into a stream separated by a '\0'. */ pos = of_get_property(dp, "channels-description", &len); while (len > 0) { int l = strlen(pos) + 1; envctrl_set_mon(pchild, pos, i++); len -= l; pos += l; } /* Get optional properties. */ pval = of_get_property(dp, "warning-temp", NULL); if (pval) warning_temperature = *pval; pval = of_get_property(dp, "shutdown-temp", NULL); if (pval) shutdown_temperature = *pval; }
/* Function Description: Initialize monitor channel with channel desc, * decoding tables, monitor type, optional properties. * Return: None. */ static void envctrl_init_adc(struct i2c_child_t *pchild, int node) { char chnls_desc[CHANNEL_DESC_SZ]; int i, len, j = 0; char *ptr; /* Firmware describe channels into a stream separated by a '\0'. * Replace all '\0' with a space. */ len = prom_getproperty(node, "channels-description", chnls_desc, CHANNEL_DESC_SZ); for (i = 0; i < len; i++) { if (chnls_desc[i] == '\0') chnls_desc[i] = ' '; } ptr = strtok(chnls_desc, " "); while (ptr != NULL) { envctrl_set_mon(pchild, ptr, j); ptr = strtok(NULL, " "); j++; } /* Get optional properties. */ len = prom_getproperty(node, "warning-temp", (char *)&warning_temperature, sizeof(warning_temperature)); len = prom_getproperty(node, "shutdown-temp", (char *)&shutdown_temperature, sizeof(shutdown_temperature)); }
/* Function Description: Initialize monitor channel with channel desc, * decoding tables, monitor type, optional properties. * Return: None. */ static void envctrl_init_adc(struct i2c_child_t *pchild, int node) { char chnls_desc[CHANNEL_DESC_SZ]; int i = 0, len; char *pos = chnls_desc; /* Firmware describe channels into a stream separated by a '\0'. */ len = prom_getproperty(node, "channels-description", chnls_desc, CHANNEL_DESC_SZ); chnls_desc[CHANNEL_DESC_SZ - 1] = '\0'; while (len > 0) { int l = strlen(pos) + 1; envctrl_set_mon(pchild, pos, i++); len -= l; pos += l; } /* Get optional properties. */ len = prom_getproperty(node, "warning-temp", (char *)&warning_temperature, sizeof(warning_temperature)); len = prom_getproperty(node, "shutdown-temp", (char *)&shutdown_temperature, sizeof(shutdown_temperature)); }