From mboxrd@z Thu Jan 1 00:00:00 1970 From: kuninori.morimoto.gx-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org Subject: Question about i2c_xxx function on CONFIG_I2C Date: Mon, 27 Jun 2011 16:00:08 +0900 Message-ID: <87aad3bvyf.wl%kuninori.morimoto.gx@renesas.com> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Return-path: Sender: linux-i2c-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Linux-I2C List-Id: linux-i2c@vger.kernel.org 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