summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEduardo Valentin <eduardo.valentin@ti.com>2013-02-26 22:53:36 (GMT)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-03-11 16:48:53 (GMT)
commitc8a8f847cc3762f07851e377c7b9515634372bb2 (patch)
treef89fd7c7a5917d78b0667d1c796fc661aa3b94f9
parentefba11940a28eaf529af912f078087931e4dbaaa (diff)
downloadlinux-fsl-qoriq-c8a8f847cc3762f07851e377c7b9515634372bb2.tar.xz
staging: omap-thermal: Remove double conv_table reference
This patch removes from data structure the double reference of the conversion table. It keeps the reference coming from bandgap data definition. The patch also adapts the code accordingly. Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/staging/omap-thermal/omap-bandgap.c8
-rw-r--r--drivers/staging/omap-thermal/omap-bandgap.h1
2 files changed, 4 insertions, 5 deletions
diff --git a/drivers/staging/omap-thermal/omap-bandgap.c b/drivers/staging/omap-thermal/omap-bandgap.c
index 82ad5db..83f74f4 100644
--- a/drivers/staging/omap-thermal/omap-bandgap.c
+++ b/drivers/staging/omap-thermal/omap-bandgap.c
@@ -179,7 +179,7 @@ int adc_to_temp_conversion(struct omap_bandgap *bg_ptr, int id, int adc_val,
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;
}
@@ -188,17 +188,18 @@ static int temp_to_adc_conversion(long temp, struct omap_bandgap *bg_ptr, int i,
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;
@@ -911,7 +912,6 @@ int omap_bandgap_probe(struct platform_device *pdev)
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;
diff --git a/drivers/staging/omap-thermal/omap-bandgap.h b/drivers/staging/omap-thermal/omap-bandgap.h
index 59c9ba2..3e9072c 100644
--- a/drivers/staging/omap-thermal/omap-bandgap.h
+++ b/drivers/staging/omap-thermal/omap-bandgap.h
@@ -369,7 +369,6 @@ struct omap_bandgap {
struct omap_bandgap_data *conf;
struct clk *fclock;
struct clk *div_clk;
- const int *conv_table;
struct mutex bg_mutex; /* Mutex for irq and PM */
int irq;
int tshut_gpio;