Question about i2c_xxx function on CONFIG_I2C

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

 



Dear all

I'm using i2c_xxx function on some board.
And sometimes I need very small kernel which doesn't need CONFIG_I2C.

But then (.config doesn't have CONFIG_I2C), the compile will fail.
like this

error: implicit declaration of function 'i2c_get_adapter'
error: implicit declaration of function 'i2c_transfer'

In this case, should I use #ifdef CONFIG_I2C in my code to solve this compile issue ?
Or is below #else in i2c.h good idea ?

--- i2c.h ---------
#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
...
extern struct i2c_adapter *i2c_get_adapter(int nr);
...
#else
...
#define i2c_get_adapter(nr) NULL
...
#endif


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


[Index of Archives]     [Linux GPIO]     [Linux SPI]     [Linux Hardward Monitoring]     [LM Sensors]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux