linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] iio:adc:qcom-spmi-vadc : fix undefined __divdi3
@ 2016-12-30 18:25 Jonathan Cameron
  2016-12-30 18:25 ` [PATCH 2/2] iio:adc:qcom-spmi-vadc silence a long constant warning Jonathan Cameron
  2017-01-08 11:22 ` [PATCH 1/2] iio:adc:qcom-spmi-vadc : fix undefined __divdi3 Jonathan Cameron
  0 siblings, 2 replies; 5+ messages in thread
From: Jonathan Cameron @ 2016-12-30 18:25 UTC (permalink / raw)
  To: linux-iio; +Cc: Jonathan Cameron, Rama Krishna Phani A

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.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Cc: Rama Krishna Phani A <rphani@codeaurora.org>
---
 drivers/iio/adc/qcom-spmi-vadc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/adc/qcom-spmi-vadc.c b/drivers/iio/adc/qcom-spmi-vadc.c
index aaf4caf06505..9da3a8fb7514 100644
--- a/drivers/iio/adc/qcom-spmi-vadc.c
+++ b/drivers/iio/adc/qcom-spmi-vadc.c
@@ -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;
 	}
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] iio:adc:qcom-spmi-vadc silence a long constant warning.
  2016-12-30 18:25 [PATCH 1/2] iio:adc:qcom-spmi-vadc : fix undefined __divdi3 Jonathan Cameron
@ 2016-12-30 18:25 ` Jonathan Cameron
  2017-01-08 11:22   ` Jonathan Cameron
  2017-01-08 11:22 ` [PATCH 1/2] iio:adc:qcom-spmi-vadc : fix undefined __divdi3 Jonathan Cameron
  1 sibling, 1 reply; 5+ messages in thread
From: Jonathan Cameron @ 2016-12-30 18:25 UTC (permalink / raw)
  To: linux-iio; +Cc: Jonathan Cameron, Rama Krishna Phani A

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

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Cc: Rama Krishna Phani A <rphani@codeaurora.org>
---
 drivers/iio/adc/qcom-spmi-vadc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/adc/qcom-spmi-vadc.c b/drivers/iio/adc/qcom-spmi-vadc.c
index 9da3a8fb7514..244dbbd0d5e0 100644
--- a/drivers/iio/adc/qcom-spmi-vadc.c
+++ b/drivers/iio/adc/qcom-spmi-vadc.c
@@ -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
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] iio:adc:qcom-spmi-vadc : fix undefined __divdi3
  2016-12-30 18:25 [PATCH 1/2] iio:adc:qcom-spmi-vadc : fix undefined __divdi3 Jonathan Cameron
  2016-12-30 18:25 ` [PATCH 2/2] iio:adc:qcom-spmi-vadc silence a long constant warning Jonathan Cameron
@ 2017-01-08 11:22 ` Jonathan Cameron
  2017-01-08 15:15   ` Jonathan Cameron
  1 sibling, 1 reply; 5+ messages in thread
From: Jonathan Cameron @ 2017-01-08 11:22 UTC (permalink / raw)
  To: linux-iio; +Cc: Rama Krishna Phani A

On 30/12/16 18:25, Jonathan Cameron wrote:
> 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.
> 
> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
> Reported-by: kbuild test robot <fengguang.wu@intel.com>
> Cc: Rama Krishna Phani A <rphani@codeaurora.org>
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
> ---
>  drivers/iio/adc/qcom-spmi-vadc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/adc/qcom-spmi-vadc.c b/drivers/iio/adc/qcom-spmi-vadc.c
> index aaf4caf06505..9da3a8fb7514 100644
> --- a/drivers/iio/adc/qcom-spmi-vadc.c
> +++ b/drivers/iio/adc/qcom-spmi-vadc.c
> @@ -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;
>  	}
> 


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] iio:adc:qcom-spmi-vadc silence a long constant warning.
  2016-12-30 18:25 ` [PATCH 2/2] iio:adc:qcom-spmi-vadc silence a long constant warning Jonathan Cameron
@ 2017-01-08 11:22   ` Jonathan Cameron
  0 siblings, 0 replies; 5+ messages in thread
From: Jonathan Cameron @ 2017-01-08 11:22 UTC (permalink / raw)
  To: linux-iio; +Cc: Rama Krishna Phani A

On 30/12/16 18:25, Jonathan Cameron wrote:
> It is meant to be long and is only added to an s64.
> 
> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
> Cc: Rama Krishna Phani A <rphani@codeaurora.org>
Applied to the togreg branch of iio.git and pushed out as testing.

Thanks

Jonathan
> ---
>  drivers/iio/adc/qcom-spmi-vadc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/adc/qcom-spmi-vadc.c b/drivers/iio/adc/qcom-spmi-vadc.c
> index 9da3a8fb7514..244dbbd0d5e0 100644
> --- a/drivers/iio/adc/qcom-spmi-vadc.c
> +++ b/drivers/iio/adc/qcom-spmi-vadc.c
> @@ -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
> 


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] iio:adc:qcom-spmi-vadc : fix undefined __divdi3
  2017-01-08 11:22 ` [PATCH 1/2] iio:adc:qcom-spmi-vadc : fix undefined __divdi3 Jonathan Cameron
@ 2017-01-08 15:15   ` Jonathan Cameron
  0 siblings, 0 replies; 5+ messages in thread
From: Jonathan Cameron @ 2017-01-08 15:15 UTC (permalink / raw)
  To: linux-iio; +Cc: Rama Krishna Phani A

On 08/01/17 11:22, Jonathan Cameron wrote:
> On 30/12/16 18:25, Jonathan Cameron wrote:
>> 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.
>>
>> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
>> Reported-by: kbuild test robot <fengguang.wu@intel.com>
>> Cc: Rama Krishna Phani A <rphani@codeaurora.org>
> 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
> 
> Jonathan
>> ---
>>  drivers/iio/adc/qcom-spmi-vadc.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/iio/adc/qcom-spmi-vadc.c b/drivers/iio/adc/qcom-spmi-vadc.c
>> index aaf4caf06505..9da3a8fb7514 100644
>> --- a/drivers/iio/adc/qcom-spmi-vadc.c
>> +++ b/drivers/iio/adc/qcom-spmi-vadc.c
>> @@ -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 majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-01-08 15:15 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-30 18:25 [PATCH 1/2] iio:adc:qcom-spmi-vadc : fix undefined __divdi3 Jonathan Cameron
2016-12-30 18:25 ` [PATCH 2/2] iio:adc:qcom-spmi-vadc silence a long constant warning Jonathan Cameron
2017-01-08 11:22   ` Jonathan Cameron
2017-01-08 11:22 ` [PATCH 1/2] iio:adc:qcom-spmi-vadc : fix undefined __divdi3 Jonathan Cameron
2017-01-08 15:15   ` Jonathan Cameron

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).