public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
* Question about i2c_xxx function on CONFIG_I2C
@ 2011-06-27  7:00 kuninori.morimoto.gx-zM6kxYcvzFBBDgjK7y7TUQ
       [not found] ` <87aad3bvyf.wl%kuninori.morimoto.gx-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: kuninori.morimoto.gx-zM6kxYcvzFBBDgjK7y7TUQ @ 2011-06-27  7:00 UTC (permalink / raw)
  To: Linux-I2C


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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-06-28  3:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-27  7:00 Question about i2c_xxx function on CONFIG_I2C kuninori.morimoto.gx-zM6kxYcvzFBBDgjK7y7TUQ
     [not found] ` <87aad3bvyf.wl%kuninori.morimoto.gx-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
2011-06-27 11:30   ` Jean Delvare
     [not found]     ` <20110627133056.1379854a-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org>
2011-06-28  3:37       ` kuninori.morimoto.gx-Re5JQEeQqe8AvxtiuMwx3w
2011-06-27 14:04   ` Zhang, Shijie

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox