Skip to contentSkip to conversation

staging:iio:spear_adc: Remove unused variable

PATCH Applied Lars-Peter Clausen 3 participants 7 messages Oct 7, 2013 – Oct 12, 2013

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 staging:iio:spear_adc: Remove unused variable

Remove the scale_mv variable from the read_raw() callback. Fixes the following warning:
drivers/staging/iio/adc/spear_adc.c: In function 'spear_read_raw':
drivers/staging/iio/adc/spear_adc.c:149:6: warning: unused variable 'scale_mv'

---
 drivers/staging/iio/adc/spear_adc.c | 1 -
 1 file changed, 1 deletion(-)
drivers/staging/iio/adc/spear_adc.c +0 -1
index 657e01b..fc99598 100644
@@ -146,7 +146,6 @@ static int spear_read_raw(struct iio_dev *indio_dev,
 			  long mask)
 {
 	struct spear_adc_info *info = iio_priv(indio_dev);
-	u32 scale_mv;
 	u32 status;
 
 	switch (mask) {
Signature · 1 line
1.8.0
#1 lore raw

PATCH 2/2 staging:iio: Allow to build SoC specific drivers when COMPILE_TEST is set

None of the SPEAr, LPC32XX or MXS ADC drivers have a compile time dependency on their respective platform. So make it possible to build the drivers when CONFIG_COMPILE_TEST is set. This makes it easier to compile test changes.

Cc Stefan Roese <[email protected]>
Cc Marek Vasut <[email protected]
Cc Roland Stigge <[email protected]>
---
 drivers/staging/iio/adc/Kconfig | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/staging/iio/adc/Kconfig +3 -3
index cabc7a3..58af3ae 100644
@@ -102,7 +102,7 @@ config AD7280
 
 config LPC32XX_ADC
 	tristate "NXP LPC32XX ADC"
-	depends on ARCH_LPC32XX
+	depends on ARCH_LPC32XX || COMPILE_TEST
 	help
 	  Say yes here to build support for the integrated ADC inside the
 	  LPC32XX SoC. Note that this feature uses the same hardware as the
@@ -113,7 +113,7 @@ config LPC32XX_ADC
 
 config MXS_LRADC
 	tristate "Freescale i.MX23/i.MX28 LRADC"
-	depends on ARCH_MXS
+	depends on ARCH_MXS || COMPILE_TEST
 	select IIO_BUFFER
 	select IIO_TRIGGERED_BUFFER
 	help
@@ -125,7 +125,7 @@ config MXS_LRADC
 
 config SPEAR_ADC
 	tristate "ST SPEAr ADC"
-	depends on PLAT_SPEAR
+	depends on PLAT_SPEAR || COMPILE_TEST
 	help
 	  Say yes here to build support for the integrated ADC inside the
 	  ST SPEAr SoC. Provides direct access via sysfs.
Signature · 1 line
1.8.0
#2 lore raw

Re: [PATCH 2/2] staging:iio: Allow to build SoC specific drivers when COMPILE_TEST is set

Quoted 7 lines · Lars-Peter Clausen

None of the SPEAr, LPC32XX or MXS ADC drivers have a compile time dependency on their respective platform. So make it possible to build the drivers when CONFIG_COMPILE_TEST is set. This makes it easier to compile test changes.

Missing > here, added Marek to Cc manually

Quoted 37 lines
Cc Roland Stigge <[email protected]>
---
 drivers/staging/iio/adc/Kconfig | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/staging/iio/adc/Kconfig +3 -3
index cabc7a3..58af3ae 100644
@@ -102,7 +102,7 @@ config AD7280
 
 config LPC32XX_ADC
 	tristate "NXP LPC32XX ADC"
-	depends on ARCH_LPC32XX
+	depends on ARCH_LPC32XX || COMPILE_TEST
 	help
 	  Say yes here to build support for the integrated ADC inside the
 	  LPC32XX SoC. Note that this feature uses the same hardware as the
@@ -113,7 +113,7 @@ config LPC32XX_ADC
 
 config MXS_LRADC
 	tristate "Freescale i.MX23/i.MX28 LRADC"
-	depends on ARCH_MXS
+	depends on ARCH_MXS || COMPILE_TEST
 	select IIO_BUFFER
 	select IIO_TRIGGERED_BUFFER
 	help
@@ -125,7 +125,7 @@ config MXS_LRADC
 
 config SPEAR_ADC
 	tristate "ST SPEAr ADC"
-	depends on PLAT_SPEAR
+	depends on PLAT_SPEAR || COMPILE_TEST
 	help
 	  Say yes here to build support for the integrated ADC inside the
 	  ST SPEAr SoC. Provides direct access via sysfs.
Reviewed-by
#3 lore raw

Re: [PATCH 2/2] staging:iio: Allow to build SoC specific drivers when COMPILE_TEST is set

Dear Lars-Peter Clausen,

Quoted 11 lines · Lars-Peter Clausen
Quoted 8 lines

None of the SPEAr, LPC32XX or MXS ADC drivers have a compile time dependency on their respective platform. So make it possible to build the drivers when CONFIG_COMPILE_TEST is set. This makes it easier to compile test changes.

Missing > here, added Marek to Cc manually

Thanks. Makes sense to me

Best regards,
Marek Vasut

maintainer
#4 lore raw

Re: [PATCH 2/2] staging:iio: Allow to build SoC specific drivers when COMPILE_TEST is set

Quoted 8 lines · Marek Vasut

Dear Lars-Peter Clausen,

Quoted 6 lines · Lars-Peter Clausen
Quoted 5 lines

None of the SPEAr, LPC32XX or MXS ADC drivers have a compile time dependency on their respective platform. So make it possible to build the drivers when CONFIG_COMPILE_TEST is set. This makes it easier to compile test changes.

I'm getting a ERROR: "stmp_reset_block" [drivers/staging/iio/adc/mxs-lradc.ko] undefined!

Also for reference also the following warnings from a build with sparse enabled.

CHECK drivers/staging/iio/adc/mxs-lradc.c

drivers/staging/iio/adc/mxs-lradc.c:1298:25: warning: incorrect type in argument 1 (different address spaces)
drivers/staging/iio/adc/mxs-lradc.c:1298:25: expected void const *ptr
drivers/staging/iio/adc/mxs-lradc.c:1298:25: got void [noderef] <asn:2>*base
drivers/staging/iio/adc/mxs-lradc.c:1299:37: warning: incorrect type in argument 1 (different address spaces)
drivers/staging/iio/adc/mxs-lradc.c:1299:37: expected void const *ptr
drivers/staging/iio/adc/mxs-lradc.c:1299:37: got void [noderef] <asn:2>*base
CC [M] drivers/staging/iio/adc/mxs-lradc.o
CHECK drivers/staging/iio/adc/spear_adc.c
drivers/staging/iio/adc/spear_adc.c:321:18: warning: cast removes address space of expression drivers/staging/iio/adc/spear_adc.c:320:33: warning: incorrect type in assignment (different address spaces)
drivers/staging/iio/adc/spear_adc.c:320:33: expected struct adc_regs_spear3xx [noderef] <asn:2>*adc_base_spear3xx
drivers/staging/iio/adc/spear_adc.c:320:33: got struct adc_regs_spear3xx *<noident>

I haven't even glanced at what caused these as yet.

Quoted 13 lines
Quoted 5 lines
Quoted 3 lines

Missing > here, added Marek to Cc manually

Thanks. Makes sense to me

Best regards,
Marek Vasut

#5 lore raw

Re: [PATCH 2/2] staging:iio: Allow to build SoC specific drivers when COMPILE_TEST is set

Quoted 11 lines · Jonathan Cameron
Quoted 8 lines · Marek Vasut

Dear Lars-Peter Clausen,

Quoted 6 lines · Lars-Peter Clausen
Quoted 5 lines

None of the SPEAr, LPC32XX or MXS ADC drivers have a compile time dependency on their respective platform. So make it possible to build the drivers when CONFIG_COMPILE_TEST is set. This makes it easier to compile test changes.

I'm getting a ERROR: "stmp_reset_block" [drivers/staging/iio/adc/mxs-lradc.ko] undefined!

It's called CONFIG_COMPILE_TEST for a reason and not CONFIG_LINK_TEST ;) Ok, I guess I should have not been lazy and actually also link tested. It looks as if the driver needs to select the STMP_DEVICE symbol in it's Kconfig entry. It is automatically selected by ARCH_MXS, so we didn't see the error before, but other drivers using that function also select the Kconfig symbol, so I think it is the right thing to do. I'll add a patch which adds the select and then resend the series.

Quoted 11 lines

Also for reference also the following warnings from a build with sparse enabled.

CHECK drivers/staging/iio/adc/mxs-lradc.c

drivers/staging/iio/adc/mxs-lradc.c:1298:25: warning: incorrect type in argument 1 (different address spaces)
drivers/staging/iio/adc/mxs-lradc.c:1298:25: expected void const *ptr
drivers/staging/iio/adc/mxs-lradc.c:1298:25: got void [noderef] <asn:2>*base
drivers/staging/iio/adc/mxs-lradc.c:1299:37: warning: incorrect type in argument 1 (different address spaces)
drivers/staging/iio/adc/mxs-lradc.c:1299:37: expected void const *ptr
drivers/staging/iio/adc/mxs-lradc.c:1299:37: got void [noderef] <asn:2>*base

The one above will be gone after you updated your sparse installation to the latest version.

Quoted 7 lines

CC [M] drivers/staging/iio/adc/mxs-lradc.o
CHECK drivers/staging/iio/adc/spear_adc.c
drivers/staging/iio/adc/spear_adc.c:321:18: warning: cast removes address space of expression drivers/staging/iio/adc/spear_adc.c:320:33: warning: incorrect type in assignment (different address spaces)
drivers/staging/iio/adc/spear_adc.c:320:33: expected struct adc_regs_spear3xx [noderef] <asn:2>*adc_base_spear3xx
drivers/staging/iio/adc/spear_adc.c:320:33: got struct adc_regs_spear3xx *<noident>

This one is a bit ugly as it used a struct to access io mapped registers. The sparse warning can be eliminated though by annotating the struct pointer with __iomem.

- Lars

maintainer Applied
#6 lore raw
In reply to Lars-Peter Clausen
Quoted 7 lines · Lars-Peter Clausen

Remove the scale_mv variable from the read_raw() callback. Fixes the following warning:
drivers/staging/iio/adc/spear_adc.c: In function 'spear_read_raw':
drivers/staging/iio/adc/spear_adc.c:149:6: warning: unused variable 'scale_mv'

Applied to the togreg branch of iio.git

Thanks.

Quoted 17 lines
---
 drivers/staging/iio/adc/spear_adc.c | 1 -
 1 file changed, 1 deletion(-)
drivers/staging/iio/adc/spear_adc.c +0 -1
index 657e01b..fc99598 100644
@@ -146,7 +146,6 @@ static int spear_read_raw(struct iio_dev *indio_dev,
 			  long mask)
 {
 	struct spear_adc_info *info = iio_priv(indio_dev);
-	u32 scale_mv;
 	u32 status;
 
 	switch (mask) {