public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
From: kuninori.morimoto.gx-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org
To: Linux-I2C <linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Question about i2c_xxx function on CONFIG_I2C
Date: Mon, 27 Jun 2011 16:00:08 +0900	[thread overview]
Message-ID: <87aad3bvyf.wl%kuninori.morimoto.gx@renesas.com> (raw)


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

             reply	other threads:[~2011-06-27  7:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-27  7:00 kuninori.morimoto.gx-zM6kxYcvzFBBDgjK7y7TUQ [this message]
     [not found] ` <87aad3bvyf.wl%kuninori.morimoto.gx-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
2011-06-27 11:30   ` Question about i2c_xxx function on CONFIG_I2C 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87aad3bvyf.wl%kuninori.morimoto.gx@renesas.com \
    --to=kuninori.morimoto.gx-zm6kxycvzfbbdgjk7y7tuq@public.gmane.org \
    --cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox