* [PATCH RFC] iio: dac: Fix build error when CONFIG_SPI_MASTER=y && CONFIG_I2C=m
@ 2013-05-08 8:36 Axel Lin
2013-05-08 8:52 ` Lars-Peter Clausen
2013-05-08 8:58 ` Axel Lin
0 siblings, 2 replies; 4+ messages in thread
From: Axel Lin @ 2013-05-08 8:36 UTC (permalink / raw)
To: Jonathan Cameron
Cc: Lars-Peter Clausen, Greg Kroah-Hartman, linux-iio, linux-kernel
This patch fixes below build error when CONFIG_SPI_MASTER=y && CONFIG_I2C=m:
drivers/built-in.o: In function `ad5064_i2c_write':
drivers/iio/dac/ad5064.c:608: undefined reference to `i2c_master_send'
drivers/built-in.o: In function `ad5064_i2c_register_driver':
drivers/iio/dac/ad5064.c:646: undefined reference to `i2c_register_driver'
drivers/built-in.o: In function `ad5064_i2c_unregister_driver':
drivers/iio/dac/ad5064.c:651: undefined reference to `i2c_del_driver'
make: *** [vmlinux] Error 1
Add config IIO_DAC_I2C_AND_SPI helper to handle such case:
When CONFIG_I2C=m, meaning we can't build the drivers in with I2C support.
Thus don't allow the drivers to be compiled as built-in.
Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
drivers/iio/dac/Kconfig | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/drivers/iio/dac/Kconfig b/drivers/iio/dac/Kconfig
index f4a6f08..34bc1d7 100644
--- a/drivers/iio/dac/Kconfig
+++ b/drivers/iio/dac/Kconfig
@@ -1,11 +1,22 @@
#
# DAC drivers
#
+
+# Helper to resolve issues with configs that have SPI enabled but I2C
+# modular, meaning we can't build the drivers in with I2C support.
+# We use an ordered list of conditional defaults to pick the appropriate
+# setting - SPI can't be modular so that case doesn't need to be covered.
+config IIO_DAC_I2C_AND_SPI
+ tristate
+ default m if I2C=m
+ default y if I2C=y
+ default y if SPI_MASTER=y
+
menu "Digital to analog converters"
config AD5064
tristate "Analog Devices AD5064 and similar multi-channel DAC driver"
- depends on (SPI_MASTER || I2C)
+ depends on IIO_DAC_I2C_AND_SPI
help
Say yes here to build support for Analog Devices AD5024, AD5025, AD5044,
AD5045, AD5064, AD5064-1, AD5065, AD5628, AD5629R, AD5648, AD5666, AD5668,
@@ -27,7 +38,7 @@ config AD5360
config AD5380
tristate "Analog Devices AD5380/81/82/83/84/90/91/92 DAC driver"
- depends on (SPI_MASTER || I2C)
+ depends on IIO_DAC_I2C_AND_SPI
select REGMAP_I2C if I2C
select REGMAP_SPI if SPI_MASTER
help
@@ -57,7 +68,7 @@ config AD5624R_SPI
config AD5446
tristate "Analog Devices AD5446 and similar single channel DACs driver"
- depends on (SPI_MASTER || I2C)
+ depends on IIO_DAC_I2C_AND_SPI
help
Say yes here to build support for Analog Devices AD5300, AD5301, AD5310,
AD5311, AD5320, AD5321, AD5444, AD5446, AD5450, AD5451, AD5452, AD5453,
--
1.8.1.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH RFC] iio: dac: Fix build error when CONFIG_SPI_MASTER=y && CONFIG_I2C=m
2013-05-08 8:36 [PATCH RFC] iio: dac: Fix build error when CONFIG_SPI_MASTER=y && CONFIG_I2C=m Axel Lin
@ 2013-05-08 8:52 ` Lars-Peter Clausen
2013-05-08 14:40 ` Axel Lin
2013-05-08 8:58 ` Axel Lin
1 sibling, 1 reply; 4+ messages in thread
From: Lars-Peter Clausen @ 2013-05-08 8:52 UTC (permalink / raw)
To: Axel Lin; +Cc: Jonathan Cameron, Greg Kroah-Hartman, linux-iio, linux-kernel
On 05/08/2013 10:36 AM, Axel Lin wrote:
> This patch fixes below build error when CONFIG_SPI_MASTER=y && CONFIG_I2C=m:
>
> drivers/built-in.o: In function `ad5064_i2c_write':
> drivers/iio/dac/ad5064.c:608: undefined reference to `i2c_master_send'
> drivers/built-in.o: In function `ad5064_i2c_register_driver':
> drivers/iio/dac/ad5064.c:646: undefined reference to `i2c_register_driver'
> drivers/built-in.o: In function `ad5064_i2c_unregister_driver':
> drivers/iio/dac/ad5064.c:651: undefined reference to `i2c_del_driver'
> make: *** [vmlinux] Error 1
>
> Add config IIO_DAC_I2C_AND_SPI helper to handle such case:
> When CONFIG_I2C=m, meaning we can't build the drivers in with I2C support.
> Thus don't allow the drivers to be compiled as built-in.
>
My plan was to do something like "depends on (SPI_MASTER && I2C!=m) || I2C",
but if this works as well I'm fine with it. The real fix though is to break
the driver apart into a SPI part, an I2S part and a common part. But that's
something for 3.11 while this is something for 3.10/stable.
> Signed-off-by: Axel Lin <axel.lin@ingics.com>
> ---
> drivers/iio/dac/Kconfig | 17 ++++++++++++++---
> 1 file changed, 14 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/iio/dac/Kconfig b/drivers/iio/dac/Kconfig
> index f4a6f08..34bc1d7 100644
> --- a/drivers/iio/dac/Kconfig
> +++ b/drivers/iio/dac/Kconfig
> @@ -1,11 +1,22 @@
> #
> # DAC drivers
> #
> +
> +# Helper to resolve issues with configs that have SPI enabled but I2C
> +# modular, meaning we can't build the drivers in with I2C support.
> +# We use an ordered list of conditional defaults to pick the appropriate
> +# setting - SPI can't be modular so that case doesn't need to be covered.
> +config IIO_DAC_I2C_AND_SPI
> + tristate
> + default m if I2C=m
> + default y if I2C=y
> + default y if SPI_MASTER=y
> +
> menu "Digital to analog converters"
>
> config AD5064
> tristate "Analog Devices AD5064 and similar multi-channel DAC driver"
> - depends on (SPI_MASTER || I2C)
> + depends on IIO_DAC_I2C_AND_SPI
> help
> Say yes here to build support for Analog Devices AD5024, AD5025, AD5044,
> AD5045, AD5064, AD5064-1, AD5065, AD5628, AD5629R, AD5648, AD5666, AD5668,
> @@ -27,7 +38,7 @@ config AD5360
>
> config AD5380
> tristate "Analog Devices AD5380/81/82/83/84/90/91/92 DAC driver"
> - depends on (SPI_MASTER || I2C)
> + depends on IIO_DAC_I2C_AND_SPI
> select REGMAP_I2C if I2C
> select REGMAP_SPI if SPI_MASTER
> help
> @@ -57,7 +68,7 @@ config AD5624R_SPI
>
> config AD5446
> tristate "Analog Devices AD5446 and similar single channel DACs driver"
> - depends on (SPI_MASTER || I2C)
> + depends on IIO_DAC_I2C_AND_SPI
> help
> Say yes here to build support for Analog Devices AD5300, AD5301, AD5310,
> AD5311, AD5320, AD5321, AD5444, AD5446, AD5450, AD5451, AD5452, AD5453,
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH RFC] iio: dac: Fix build error when CONFIG_SPI_MASTER=y && CONFIG_I2C=m
2013-05-08 8:36 [PATCH RFC] iio: dac: Fix build error when CONFIG_SPI_MASTER=y && CONFIG_I2C=m Axel Lin
2013-05-08 8:52 ` Lars-Peter Clausen
@ 2013-05-08 8:58 ` Axel Lin
1 sibling, 0 replies; 4+ messages in thread
From: Axel Lin @ 2013-05-08 8:58 UTC (permalink / raw)
To: Jonathan Cameron
Cc: Lars-Peter Clausen, Greg Kroah-Hartman, linux-iio, linux-kernel,
Wu Fengguang
於 三,2013-05-08 於 16:36 +0800,Axel Lin 提到:
> This patch fixes below build error when CONFIG_SPI_MASTER=y && CONFIG_I2C=m:
>
> drivers/built-in.o: In function `ad5064_i2c_write':
> drivers/iio/dac/ad5064.c:608: undefined reference to `i2c_master_send'
> drivers/built-in.o: In function `ad5064_i2c_register_driver':
> drivers/iio/dac/ad5064.c:646: undefined reference to `i2c_register_driver'
> drivers/built-in.o: In function `ad5064_i2c_unregister_driver':
> drivers/iio/dac/ad5064.c:651: undefined reference to `i2c_del_driver'
> make: *** [vmlinux] Error 1
>
> Add config IIO_DAC_I2C_AND_SPI helper to handle such case:
> When CONFIG_I2C=m, meaning we can't build the drivers in with I2C support.
> Thus don't allow the drivers to be compiled as built-in.
>
> Signed-off-by: Axel Lin <axel.lin@ingics.com>
I should add
Reported-by: Wu Fengguang <fengguang.wu@intel.com>
And also Cc Fengguang now.
I look into this issue because it is reported by Fengguang's kbuild test
robot.
> ---
> drivers/iio/dac/Kconfig | 17 ++++++++++++++---
> 1 file changed, 14 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/iio/dac/Kconfig b/drivers/iio/dac/Kconfig
> index f4a6f08..34bc1d7 100644
> --- a/drivers/iio/dac/Kconfig
> +++ b/drivers/iio/dac/Kconfig
> @@ -1,11 +1,22 @@
> #
> # DAC drivers
> #
> +
> +# Helper to resolve issues with configs that have SPI enabled but I2C
> +# modular, meaning we can't build the drivers in with I2C support.
> +# We use an ordered list of conditional defaults to pick the appropriate
> +# setting - SPI can't be modular so that case doesn't need to be covered.
> +config IIO_DAC_I2C_AND_SPI
> + tristate
> + default m if I2C=m
> + default y if I2C=y
> + default y if SPI_MASTER=y
> +
> menu "Digital to analog converters"
>
> config AD5064
> tristate "Analog Devices AD5064 and similar multi-channel DAC driver"
> - depends on (SPI_MASTER || I2C)
> + depends on IIO_DAC_I2C_AND_SPI
> help
> Say yes here to build support for Analog Devices AD5024, AD5025, AD5044,
> AD5045, AD5064, AD5064-1, AD5065, AD5628, AD5629R, AD5648, AD5666, AD5668,
> @@ -27,7 +38,7 @@ config AD5360
>
> config AD5380
> tristate "Analog Devices AD5380/81/82/83/84/90/91/92 DAC driver"
> - depends on (SPI_MASTER || I2C)
> + depends on IIO_DAC_I2C_AND_SPI
> select REGMAP_I2C if I2C
> select REGMAP_SPI if SPI_MASTER
> help
> @@ -57,7 +68,7 @@ config AD5624R_SPI
>
> config AD5446
> tristate "Analog Devices AD5446 and similar single channel DACs driver"
> - depends on (SPI_MASTER || I2C)
> + depends on IIO_DAC_I2C_AND_SPI
> help
> Say yes here to build support for Analog Devices AD5300, AD5301, AD5310,
> AD5311, AD5320, AD5321, AD5444, AD5446, AD5450, AD5451, AD5452, AD5453,
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH RFC] iio: dac: Fix build error when CONFIG_SPI_MASTER=y && CONFIG_I2C=m
2013-05-08 8:52 ` Lars-Peter Clausen
@ 2013-05-08 14:40 ` Axel Lin
0 siblings, 0 replies; 4+ messages in thread
From: Axel Lin @ 2013-05-08 14:40 UTC (permalink / raw)
To: Lars-Peter Clausen
Cc: Jonathan Cameron, Greg Kroah-Hartman, linux-iio,
linux-kernel@vger.kernel.org
2013/5/8 Lars-Peter Clausen <lars@metafoo.de>:
> On 05/08/2013 10:36 AM, Axel Lin wrote:
>> This patch fixes below build error when CONFIG_SPI_MASTER=y && CONFIG_I2C=m:
>>
>> drivers/built-in.o: In function `ad5064_i2c_write':
>> drivers/iio/dac/ad5064.c:608: undefined reference to `i2c_master_send'
>> drivers/built-in.o: In function `ad5064_i2c_register_driver':
>> drivers/iio/dac/ad5064.c:646: undefined reference to `i2c_register_driver'
>> drivers/built-in.o: In function `ad5064_i2c_unregister_driver':
>> drivers/iio/dac/ad5064.c:651: undefined reference to `i2c_del_driver'
>> make: *** [vmlinux] Error 1
>>
>> Add config IIO_DAC_I2C_AND_SPI helper to handle such case:
>> When CONFIG_I2C=m, meaning we can't build the drivers in with I2C support.
>> Thus don't allow the drivers to be compiled as built-in.
>>
>
> My plan was to do something like "depends on (SPI_MASTER && I2C!=m) || I2C",
This change seems simpler than this path.
Thus I'm going to send v2 for it.
Thanks,
Axel
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-05-08 14:40 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-08 8:36 [PATCH RFC] iio: dac: Fix build error when CONFIG_SPI_MASTER=y && CONFIG_I2C=m Axel Lin
2013-05-08 8:52 ` Lars-Peter Clausen
2013-05-08 14:40 ` Axel Lin
2013-05-08 8:58 ` Axel Lin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox