if (adc_val < ts_data->adc_start_val || adc_val > ts_data->adc_end_val)
return -ERANGE;
- *t = bg_ptr->conv_table[adc_val - ts_data->adc_start_val];
+ *t = bg_ptr->conf->conv_table[adc_val - ts_data->adc_start_val];
return 0;
}
int *adc)
{
struct temp_sensor_data *ts_data = bg_ptr->conf->sensors[i].ts_data;
+ const int *conv_table = bg_ptr->conf->conv_table;
int high, low, mid;
low = 0;
high = ts_data->adc_end_val - ts_data->adc_start_val;
mid = (high + low) / 2;
- if (temp < bg_ptr->conv_table[low] || temp > bg_ptr->conv_table[high])
+ if (temp < conv_table[low] || temp > conv_table[high])
return -EINVAL;
while (low < high) {
- if (temp < bg_ptr->conv_table[mid])
+ if (temp < conv_table[mid])
high = mid - 1;
else
low = mid + 1;
goto free_irqs;
}
- bg_ptr->conv_table = bg_ptr->conf->conv_table;
for (i = 0; i < bg_ptr->conf->sensor_count; i++) {
struct temp_sensor_registers *tsr;
u32 val;