On Fri, Sep 11, 2009 at 10:13 PM, Hennerich, Michael
<[email protected]> wrote:
> Barry,
>
> I think there are more problems.
> Assuming SPI driver is statically built into the kernel while the I2C
> driver is MODULE.
> This will screw up the tristate kernel config logic.
>
> drivers/built-in.o: In function `ad714x_i2c_write':
>
> drivers/input/misc/ad714x.c:1512: undefined reference to
> `i2c_master_send'
> drivers/built-in.o: In function `ad714x_i2c_read':
>
> drivers/input/misc/ad714x.c:1533: undefined reference to
> `i2c_master_send'
> drivers/input/misc/ad714x.c:1539: undefined reference to
> `i2c_master_recv'
> drivers/built-in.o: In function `adxl34x_i2c_smbus_write':
>
Michael,
Maybe not since I2C related codes are actually limited by CONFIG_I2C
|| CONFIG_I2C_MODULE. Can you check whether you have make I2C modules
right before that?
Thanks
Barry

> drivers/input/misc/adxl34x.c:994: undefined reference to
> `i2c_smbus_write_byte_data'
> drivers/built-in.o: In function `adxl34x_i2c_smbus_read':
The problem should not exist since i2c related codes are covered by CONFIG_I2
>
> drivers/input/misc/adxl34x.c:987: undefined reference to
> `i2c_smbus_read_byte_data'
> drivers/built-in.o: In function `adxl34x_i2c_master_read_block_data':
>
> drivers/input/misc/adxl34x.c:1013: undefined reference to
> `i2c_master_send'
> drivers/input/misc/adxl34x.c:1016: undefined reference to
> `i2c_master_recv'
> drivers/built-in.o: In function `adxl34x_i2c_smbus_read_block_data':
>
> drivers/input/misc/adxl34x.c:1002: undefined reference to
> `i2c_smbus_read_i2c_block_data'
> drivers/built-in.o: In function `i2c_add_driver':
>
> include/linux/i2c.h:429: undefined reference to `i2c_register_driver'
>
> drivers/built-in.o: In function `ad714x_i2c_exit':
>
> drivers/input/misc/ad714x.c:1618: undefined reference to
> `i2c_del_driver'
> drivers/built-in.o: In function `i2c_add_driver':
>
> include/linux/i2c.h:429: undefined reference to `i2c_register_driver'
>
> drivers/built-in.o: In function `adxl34x_i2c_exit':
>
> drivers/input/misc/adxl34x.c:1126: undefined reference to
> `i2c_del_driver'
> make: *** [.tmp_vmlinux1] Error 1
>
> -Michael
>
>
> -----Original Message-----
> From: Hennerich, Michael
> Sent: Friday, September 11, 2009 3:28 PM
> To: Hennerich, Michael; Barry Song; [email protected]
> Cc: David Brownell; [email protected];
> [email protected]
> Subject: RE: [Uclinux-dist-devel] [PATCH v3] add analog devices
> AD714Xcaptouchinput driver
>
>
> On Friday 11 September 2009, Hennerich, Michael wrote:
>>On Friday 11 September 2009, Song, Barry wrote:
>>+static int __init ad714x_init(void)
>>+{
>>+
>>+      int ret = 0;
>>+      ret = ad714x_spi_register_driver(&ad714x_spi_driver);
>>+      if (ret)
>>+              goto err;
>>+      ret = ad714x_i2c_add_driver(&ad714x_i2c_driver);
>>+      if (ret)
>>+              ad714x_spi_unregister_driver(&ad714x_spi_driver);
>>+err:
>>+      return ret;
>>+}
>>+
>>+static void __exit ad714x_exit(void)
>>+{
>>+      ad714x_spi_unregister_driver(&ad714x_spi_driver);
>>+      ad714x_i2c_del_driver(&ad714x_i2c_driver);
>>+}
>>
>>This doesn't make much sense!
>>Assuming we have two AD714x in a system. One connected by SPI the other
>>by I2C.
>>Why would I remove the SPI one in case the other I2C fails, or not even
>>try the SPI one if the I2C fails?
>>
>>Who says that a driver can't have two module_init()?
>>
>>Use two entry points and let them individually return its status.
>>
>>Signed-off-by: Michael Hennerich <[email protected]>
>>
>>Index: drivers/input/misc/ad714x.c
>>
>>===================================================================
>>
>>--- drivers/input/misc/ad714x.c (revision 7296)
>>
>>+++ drivers/input/misc/ad714x.c (working copy)
>>
>>@@ -1479,19 +1479,18 @@
>>
>>        .resume         = ad714x_spi_resume,
>>
>> };
>>
>>
>>
>>-static inline int ad714x_spi_register_driver(struct spi_driver
>>*spi_drv)
>>+static inline int ad714x_spi_init(struct spi_driver *spi_drv)
>>
>> {
>>
>>        return spi_register_driver(spi_drv);
>>
>> }
>>
>>
>>
>>-static inline void ad714x_spi_unregister_driver(struct spi_driver
>>*spi_drv)
>>+static inline void ad714x_spi_exit(struct spi_driver *spi_drv)
>>
>> {
>>
>>        spi_unregister_driver(spi_drv);
>>
>> }
>>
>>
>>
>>-#else
>>
>>-#define ad714x_spi_register_driver(p) 0
>>
>>-#define ad714x_spi_unregister_driver(p)
>>
>>+module_init(ad714x_spi_init);
>>
>>+module_exit(ad714x_spi_exit);
>>
>> #endif
>>
>>
>>
>> #if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
>>
>>@@ -1609,44 +1608,20 @@
>>
>>        .id_table = ad714x_id,
>>
>> };
>>
>>
>>
>>-static inline int ad714x_i2c_add_driver(struct i2c_driver *i2c_drv)
>>
>>+static __init int ad714x_i2c_init(struct i2c_driver *i2c_drv)
>>
>> {
>>
>>        return i2c_add_driver(i2c_drv);
>> }
>>
>>-static inline void ad714x_i2c_del_driver(struct i2c_driver *i2c_drv)
>>+static __init void ad714x_i2c_exit(struct i2c_driver *i2c_drv)
>> {
>>        i2c_del_driver(i2c_drv);
>> }
>>
>>-#else
>>-#define ad714x_i2c_add_driver(p) 0
>>-#define ad714x_i2c_del_driver(p)
>>+module_init(ad714x_i2c_init);
>>+module_exit(ad714x_i2c_exit);
>> #endif
>>
>>-static int __init ad714x_init(void)
>>-{
>>-
>>-       int ret = 0;
>>-       ret = ad714x_spi_register_driver(&ad714x_spi_driver);
>>-       if (ret)
>>-               goto err;
>>-       ret = ad714x_i2c_add_driver(&ad714x_i2c_driver);
>>-       if (ret)
>>-               ad714x_spi_unregister_driver(&ad714x_spi_driver);
>>-err:
>>-       return ret;
>>-}
>>-
>>-static void __exit ad714x_exit(void)
>>-{
>>-       ad714x_spi_unregister_driver(&ad714x_spi_driver);
>>-       ad714x_i2c_del_driver(&ad714x_i2c_driver);
>>-}
>>-
>>-module_init(ad714x_init);
>>-module_exit(ad714x_exit);
>>-
>> MODULE_DESCRIPTION("Analog Devices AD714X Capacitance Touch Sensor
>>Driver");
>> MODULE_AUTHOR("Barry Song <[email protected]>");
>> MODULE_LICENSE("GPL");
>
> Sorry for the noise - wrong patch attached.
> This one should work better...
>
> Index: drivers/input/misc/ad714x.c
>
> ===================================================================
>
> --- drivers/input/misc/ad714x.c (revision 7296)
>
> +++ drivers/input/misc/ad714x.c (working copy)
>
> @@ -1479,19 +1479,18 @@
>
>        .resume         = ad714x_spi_resume,
>
>  };
>
>
>
> -static inline int ad714x_spi_register_driver(struct spi_driver
> *spi_drv)
> +static __init int ad714x_spi_init(void)
>
>  {
>
> -       return spi_register_driver(spi_drv);
>
> +       return spi_register_driver(&ad714x_spi_driver);
>
>  }
>
>
>
> -static inline void ad714x_spi_unregister_driver(struct spi_driver
> *spi_drv)
> +static __init void ad714x_spi_exit(void)
>
>  {
>
> -       spi_unregister_driver(spi_drv);
>
> +       spi_unregister_driver(&ad714x_spi_driver);
>
>  }
>
>
>
> -#else
>
> -#define ad714x_spi_register_driver(p) 0
>
> -#define ad714x_spi_unregister_driver(p)
>
> +module_init(ad714x_spi_init);
>
> +module_exit(ad714x_spi_exit);
>
>  #endif
>
>
>
>  #if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
>
> @@ -1609,44 +1608,20 @@
>
>        .id_table = ad714x_id,
>
>  };
>
>
>
> -static inline int ad714x_i2c_add_driver(struct i2c_driver *i2c_drv)
>
> +static __init int ad714x_i2c_init(void)
>
>  {
>
> -       return i2c_add_driver(i2c_drv);
>
> +       return i2c_add_driver(&ad714x_i2c_driver);
>
>  }
>
> -static inline void ad714x_i2c_del_driver(struct i2c_driver *i2c_drv)
> +static __init void ad714x_i2c_exit(void)
>  {
> -       i2c_del_driver(i2c_drv);
> +       i2c_del_driver(&ad714x_i2c_driver);
>  }
>
> -#else
> -#define ad714x_i2c_add_driver(p) 0
> -#define ad714x_i2c_del_driver(p)
> +module_init(ad714x_i2c_init);
> +module_exit(ad714x_i2c_exit);
>  #endif
>
> -static int __init ad714x_init(void)
> -{
> -
> -       int ret = 0;
> -       ret = ad714x_spi_register_driver(&ad714x_spi_driver);
> -       if (ret)
> -               goto err;
> -       ret = ad714x_i2c_add_driver(&ad714x_i2c_driver);
> -       if (ret)
> -               ad714x_spi_unregister_driver(&ad714x_spi_driver);
> -err:
> -       return ret;
> -}
> -
> -static void __exit ad714x_exit(void)
> -{
> -       ad714x_spi_unregister_driver(&ad714x_spi_driver);
> -       ad714x_i2c_del_driver(&ad714x_i2c_driver);
> -}
> -
> -module_init(ad714x_init);
> -module_exit(ad714x_exit);
> -
>  MODULE_DESCRIPTION("Analog Devices AD714X Capacitance Touch Sensor
> Driver");
>  MODULE_AUTHOR("Barry Song <[email protected]>");
>  MODULE_LICENSE("GPL");
>
> _______________________________________________
> Uclinux-dist-devel mailing list
> [email protected]
> https://blackfin.uclinux.org/mailman/listinfo/uclinux-dist-devel
>
_______________________________________________
Uclinux-dist-devel mailing list
[email protected]
https://blackfin.uclinux.org/mailman/listinfo/uclinux-dist-devel

Reply via email to