Skip to contentSkip to conversation

iio:adc:qcom-spmi-vadc : fix undefined __divdi3

PATCH In review Jonathan Cameron 1 participant 5 messages Dec 30, 2016 – Jan 8, 2017

Subsystems (2)
lore
Share & tools
lore

Jonathan Cameron

author maintainer
#0 lore raw

PATCH 1/2 iio:adc:qcom-spmi-vadc : fix undefined __divdi3

A simple do_div call works here as all the signed 64 bit is actually small and unsigned at this point, and the numerator is u32.

---
 drivers/iio/adc/qcom-spmi-vadc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/adc/qcom-spmi-vadc.c +1 -1
index aaf4caf06505..9da3a8fb7514 100644
@@ -664,7 +664,7 @@ static int vadc_scale_die_temp(struct vadc_priv *vadc,
 	if (voltage > 0) {
 		prescale = &vadc_prescale_ratios[prop->prescale];
 		voltage = voltage * prescale->den;
-		voltage /= (prescale->num * 2);
+		do_div(voltage, prescale->num * 2);
 	} else {
 		voltage = 0;
 	}
Signature · 1 line
2.11.0
author maintainer
#1 lore raw

PATCH 2/2 iio:adc:qcom-spmi-vadc silence a long constant warning.

It is meant to be long and is only added to an s64.

Cc Rama Krishna Phani A <[email protected]>
---
 drivers/iio/adc/qcom-spmi-vadc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/adc/qcom-spmi-vadc.c +1 -1
index 9da3a8fb7514..244dbbd0d5e0 100644
@@ -101,7 +101,7 @@
 #define KELVINMIL_CELSIUSMIL			273150
 
 #define PMI_CHG_SCALE_1				-138890
-#define PMI_CHG_SCALE_2				391750000000
+#define PMI_CHG_SCALE_2				391750000000LL
 
 #define VADC_CHAN_MIN			VADC_USBIN
 #define VADC_CHAN_MAX			VADC_LR_MUX3_BUF_PU1_PU2_XO_THERM
Signature · 1 line
2.11.0
author maintainer
#2 lore raw

Re: [PATCH 2/2] iio:adc:qcom-spmi-vadc silence a long constant warning.

Quoted 4 lines · Jonathan Cameron

It is meant to be long and is only added to an s64.

Cc Rama Krishna Phani A <[email protected]>

Applied to the togreg branch of iio.git and pushed out as testing.

Thanks

Jonathan

Quoted 18 lines
---
 drivers/iio/adc/qcom-spmi-vadc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/adc/qcom-spmi-vadc.c +1 -1
index 9da3a8fb7514..244dbbd0d5e0 100644
@@ -101,7 +101,7 @@
 #define KELVINMIL_CELSIUSMIL			273150
 
 #define PMI_CHG_SCALE_1				-138890
-#define PMI_CHG_SCALE_2				391750000000
+#define PMI_CHG_SCALE_2				391750000000LL
 
 #define VADC_CHAN_MIN			VADC_USBIN
 #define VADC_CHAN_MAX			VADC_LR_MUX3_BUF_PU1_PU2_XO_THERM
author maintainer
#3 lore raw
In reply to Jonathan Cameron
Quoted 7 lines · Jonathan Cameron

A simple do_div call works here as all the signed 64 bit is actually small and unsigned at this point, and the numerator is u32.

Hopefully this is fine. It's holding up my pull request so I'm going to apply this now.

Applied to the togreg branch of iio.git and pushed out as testing.

Jonathan

Quoted 18 lines
---
 drivers/iio/adc/qcom-spmi-vadc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/adc/qcom-spmi-vadc.c +1 -1
index aaf4caf06505..9da3a8fb7514 100644
@@ -664,7 +664,7 @@ static int vadc_scale_die_temp(struct vadc_priv *vadc,
 	if (voltage > 0) {
 		prescale = &vadc_prescale_ratios[prop->prescale];
 		voltage = voltage * prescale->den;
-		voltage /= (prescale->num * 2);
+		do_div(voltage, prescale->num * 2);
 	} else {
 		voltage = 0;
 	}
author maintainer
#4 lore raw
Quoted 5 lines · Jonathan Cameron
Quoted 4 lines · Jonathan Cameron

A simple do_div call works here as all the signed 64 bit is actually small and unsigned at this point, and the numerator is u32.

Quoted 7 lines
Quoted 3 lines

Hopefully this is fine. It's holding up my pull request so I'm going to apply this now.

Applied to the togreg branch of iio.git and pushed out as testing.

and... The autobuilder picked up the fact it was a s64 in the blackfin builds. It is small enough that this doesn't matter so I've added a temporary u64 to do this computation then convert it back again.

Rama, if you can possibly test that I haven't messed this up that would be great. I'll run my fix past the build bots again and if it works send out a pull request.

The only alternative would be to revert the original patch until this is fixed.

Jonathan

Quoted 26 lines

Jonathan

Quoted 10 lines
---
 drivers/iio/adc/qcom-spmi-vadc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/adc/qcom-spmi-vadc.c +0 -0
index aaf4caf06505..9da3a8fb7514 100644

drivers/iio/adc/qcom-spmi-vadc.c static int vadc_scale_die_temp(struct vadc_priv *vadc, · line 670

Quoted 8 lines
drivers/iio/adc/qcom-spmi-vadc.c +1 -1
@@ -664,7 +664,7 @@ static int vadc_scale_die_temp(struct vadc_priv *vadc,
 	if (voltage > 0) {
 		prescale = &vadc_prescale_ratios[prop->prescale];
 		voltage = voltage * prescale->den;
-		voltage /= (prescale->num * 2);
+		do_div(voltage, prescale->num * 2);
 	} else {
 		voltage = 0;
 	}

--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html