Re: [Uclinux-dist-devel] [PATCH v2]add analog devices AD714Xcaptouch input driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tuesday 08 September 2009, Song, Barry wrote:
> I don't know what the exact meaning of "inlined NOP stubs", do you mean things like the following?
> #if (defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE))
> ...
> static struct i2c_driver ad714x_i2c_driver = {
>         ..
> };

You _should_ be able to always declare that and let GCC
optimize it away ...


> static inline int ad714x_i2c_add_driver(struct i2c_driver *i2c_drv)
> {
>         return i2c_add_driver(i2c_drv);
> }
> #else
> static inline int ad714x_i2c_add_driver(struct i2c_driver *i2c_drv)
> {
>         return 0;
> }

That'd be OK as a quick fix; ideally i2c_add_driver() itself
would be what the #ifdef covers (in <linux/i2c.h> and likewise
in <linux/spi/spi.h>).  And you'd need to cover driver remove
paths too.


> #define ad714x_i2c_driver NULL

Ditto: shouldn't need to #define that


> #endif
> 
> static int __init ad714x_init(void)
> {
>         ...
>         ad714x_i2c_add_driver(&ad714x_i2c_driver);

Yes; but do check the value!

>         ...
> }
> 
> Then ad714x_init can use a unified ad714x_i2c_add_driver,
> ad714x_spi_register_driver to avoid #ifdeffery used? 
> It seems that doesn't make the codes more pretty?

Way less #ifdeffery and *ONE* non-#ifdeffed chunk of
code in driver init/exit code.

- Dave


--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux