public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
From: David Brownell <david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
To: i2c-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org
Subject: [patch 2.6.25-rc2-git] make i2c_register_board_info() a NOP when CONFIG_I2C=n
Date: Fri, 22 Feb 2008 00:23:16 -0800	[thread overview]
Message-ID: <200802220023.16643.david-b@pacbell.net> (raw)

Don't require platform code to be #ifdeffed according to whether
I2C is enabled or not ... if it's not enabled, let GCC compile out
all I2C device declarations.  (Issue noted on an NSLU2 build that
didn't configure I2C.)

Signed-off-by: David Brownell <dbrownell-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>
---
 include/linux/i2c.h |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

--- at91.orig/include/linux/i2c.h	2008-02-21 22:58:53.000000000 -0800
+++ at91/include/linux/i2c.h	2008-02-21 23:02:57.000000000 -0800
@@ -271,9 +271,16 @@ extern void i2c_unregister_device(struct
  * This is done at arch_initcall time, before declaring any i2c adapters.
  * Modules for add-on boards must use other calls.
  */
+#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
 extern int
 i2c_register_board_info(int busnum, struct i2c_board_info const *info, unsigned n);
-
+#else
+static inline int
+i2c_register_board_info(int busnum, struct i2c_board_info const *info, unsigned n)
+{
+	return 0;
+}
+#endif
 
 /*
  * The following structs are for those who like to implement new bus drivers:

_______________________________________________
i2c mailing list
i2c-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org
http://lists.lm-sensors.org/mailman/listinfo/i2c

             reply	other threads:[~2008-02-22  8:23 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-22  8:23 David Brownell [this message]
     [not found] ` <200802220023.16643.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
2008-02-22  9:47   ` [patch 2.6.25-rc2-git] make i2c_register_board_info() a NOP when CONFIG_I2C=n Jean Delvare
     [not found]     ` <20080222104709.2c2a0845-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2008-02-22 10:22       ` David Brownell
     [not found]         ` <200802220222.18270.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
2008-02-22 11:04           ` Jean Delvare

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=200802220023.16643.david-b@pacbell.net \
    --to=david-b-ybekhbn/0ldr7s880joybq@public.gmane.org \
    --cc=i2c-GZX6beZjE8VD60Wz+7aTrA@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