Skip to content

Commit 2c89940

Browse files
Hongbo Zhangenomsg
authored andcommitted
ab8500_{bmdata,fg}: Add const attributes to some data arrays
This patch adds const attributes to AB8500 power and temperature related read-only data arrays. Signed-off-by: Hongbo Zhang <hongbo.zhang@linaro.org> Signed-off-by: Anton Vorontsov <anton@enomsg.org>
1 parent 6c1f8e0 commit 2c89940

3 files changed

Lines changed: 15 additions & 15 deletions

File tree

‎drivers/power/ab8500_bmdata.c‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* Note that the res_to_temp table must be strictly sorted by falling resistance
1212
* values to work.
1313
*/
14-
static struct abx500_res_to_temp temp_tbl_a_thermistor[] = {
14+
static const struct abx500_res_to_temp temp_tbl_a_thermistor[] = {
1515
{-5, 53407},
1616
{ 0, 48594},
1717
{ 5, 43804},
@@ -29,7 +29,7 @@ static struct abx500_res_to_temp temp_tbl_a_thermistor[] = {
2929
{65, 12500},
3030
};
3131

32-
static struct abx500_res_to_temp temp_tbl_b_thermistor[] = {
32+
static const struct abx500_res_to_temp temp_tbl_b_thermistor[] = {
3333
{-5, 200000},
3434
{ 0, 159024},
3535
{ 5, 151921},
@@ -47,7 +47,7 @@ static struct abx500_res_to_temp temp_tbl_b_thermistor[] = {
4747
{65, 82869},
4848
};
4949

50-
static struct abx500_v_to_cap cap_tbl_a_thermistor[] = {
50+
static const struct abx500_v_to_cap cap_tbl_a_thermistor[] = {
5151
{4171, 100},
5252
{4114, 95},
5353
{4009, 83},
@@ -70,7 +70,7 @@ static struct abx500_v_to_cap cap_tbl_a_thermistor[] = {
7070
{3247, 0},
7171
};
7272

73-
static struct abx500_v_to_cap cap_tbl_b_thermistor[] = {
73+
static const struct abx500_v_to_cap cap_tbl_b_thermistor[] = {
7474
{4161, 100},
7575
{4124, 98},
7676
{4044, 90},
@@ -93,7 +93,7 @@ static struct abx500_v_to_cap cap_tbl_b_thermistor[] = {
9393
{3250, 0},
9494
};
9595

96-
static struct abx500_v_to_cap cap_tbl[] = {
96+
static const struct abx500_v_to_cap cap_tbl[] = {
9797
{4186, 100},
9898
{4163, 99},
9999
{4114, 95},
@@ -124,7 +124,7 @@ static struct abx500_v_to_cap cap_tbl[] = {
124124
* Note that the res_to_temp table must be strictly sorted by falling
125125
* resistance values to work.
126126
*/
127-
static struct abx500_res_to_temp temp_tbl[] = {
127+
static const struct abx500_res_to_temp temp_tbl[] = {
128128
{-5, 214834},
129129
{ 0, 162943},
130130
{ 5, 124820},
@@ -146,7 +146,7 @@ static struct abx500_res_to_temp temp_tbl[] = {
146146
* Note that the batres_vs_temp table must be strictly sorted by falling
147147
* temperature values to work.
148148
*/
149-
static struct batres_vs_temp temp_to_batres_tbl_thermistor[] = {
149+
static const struct batres_vs_temp temp_to_batres_tbl_thermistor[] = {
150150
{ 40, 120},
151151
{ 30, 135},
152152
{ 20, 165},
@@ -160,7 +160,7 @@ static struct batres_vs_temp temp_to_batres_tbl_thermistor[] = {
160160
* Note that the batres_vs_temp table must be strictly sorted by falling
161161
* temperature values to work.
162162
*/
163-
static struct batres_vs_temp temp_to_batres_tbl_ext_thermistor[] = {
163+
static const struct batres_vs_temp temp_to_batres_tbl_ext_thermistor[] = {
164164
{ 60, 300},
165165
{ 30, 300},
166166
{ 20, 300},
@@ -171,7 +171,7 @@ static struct batres_vs_temp temp_to_batres_tbl_ext_thermistor[] = {
171171
};
172172

173173
/* battery resistance table for LI ION 9100 battery */
174-
static struct batres_vs_temp temp_to_batres_tbl_9100[] = {
174+
static const struct batres_vs_temp temp_to_batres_tbl_9100[] = {
175175
{ 60, 180},
176176
{ 30, 180},
177177
{ 20, 180},
@@ -547,7 +547,7 @@ int ab8500_bm_of_probe(struct device *dev,
547547
struct device_node *np,
548548
struct abx500_bm_data *bm)
549549
{
550-
struct batres_vs_temp *tmp_batres_tbl;
550+
const struct batres_vs_temp *tmp_batres_tbl;
551551
struct device_node *battery_node;
552552
const char *btech;
553553
int i;

‎drivers/power/ab8500_fg.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -863,7 +863,7 @@ static int ab8500_fg_bat_voltage(struct ab8500_fg *di)
863863
static int ab8500_fg_volt_to_capacity(struct ab8500_fg *di, int voltage)
864864
{
865865
int i, tbl_size;
866-
struct abx500_v_to_cap *tbl;
866+
const struct abx500_v_to_cap *tbl;
867867
int cap = 0;
868868

869869
tbl = di->bm->bat_type[di->bm->batt_id].v_to_cap_tbl,
@@ -915,7 +915,7 @@ static int ab8500_fg_uncomp_volt_to_capacity(struct ab8500_fg *di)
915915
static int ab8500_fg_battery_resistance(struct ab8500_fg *di)
916916
{
917917
int i, tbl_size;
918-
struct batres_vs_temp *tbl;
918+
const struct batres_vs_temp *tbl;
919919
int resist = 0;
920920

921921
tbl = di->bm->bat_type[di->bm->batt_id].batres_tbl;

‎include/linux/mfd/abx500.h‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -183,11 +183,11 @@ struct abx500_battery_type {
183183
int low_high_vol_lvl;
184184
int battery_resistance;
185185
int n_temp_tbl_elements;
186-
struct abx500_res_to_temp *r_to_t_tbl;
186+
const struct abx500_res_to_temp *r_to_t_tbl;
187187
int n_v_cap_tbl_elements;
188-
struct abx500_v_to_cap *v_to_cap_tbl;
188+
const struct abx500_v_to_cap *v_to_cap_tbl;
189189
int n_batres_tbl_elements;
190-
struct batres_vs_temp *batres_tbl;
190+
const struct batres_vs_temp *batres_tbl;
191191
};
192192

193193
/**

0 commit comments

Comments
 (0)