# \[PATCH\] \[POWERPC\] Fix of\_i2c include for module compilation

- Subsystems: OPEN FIRMWARE AND FLATTENED DEVICE TREE, THE REST
- Maintainers: Rob Herring, Saravana Kannan, Linus Torvalds
- List: linuxppc-dev
- 3 messages, 2 authors
- Page: https://ratatoskr.run/linuxppc-dev/2008/05/1095142/t

## \[PATCH\] \[POWERPC\] Fix of\_i2c include for module compilation

- From: Jochen Friedrich \<jochen@scram.de\>
- Date: 2008-05-03 12:43:22 
- Message: https://ratatoskr.run/linuxppc-dev/2008/05/1095142.md

```text
Now that of_i2c may be compiled as module, the header must be
exported for module compilation, as well.

Signed-off-by: Jochen Friedrich <jochen@scram.de>
---
 include/linux/of_i2c.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/include/linux/of_i2c.h b/include/linux/of_i2c.h
index 2e5a967..dca6013 100644
--- a/include/linux/of_i2c.h
+++ b/include/linux/of_i2c.h
@@ -14,7 +14,7 @@
 
 #include <linux/i2c.h>
 
-#ifdef CONFIG_OF_I2C
+#if defined(CONFIG_OF_I2C) || defined(CONFIG_OF_I2C_MODULE)
 
 void of_register_i2c_devices(struct i2c_adapter *adap,
 			     struct device_node *adap_node);
-- 
1.5.5.1
```

## Re: \[PATCH\] \[POWERPC\] Fix of\_i2c include for module compilation

- From: Paul Mackerras \<hidden\>
- Date: 2008-05-05 04:24:53 
- Message: https://ratatoskr.run/linuxppc-dev/2008/05/1095708.md

```text
Jochen Friedrich writes:

> -#ifdef CONFIG_OF_I2C
> +#if defined(CONFIG_OF_I2C) || defined(CONFIG_OF_I2C_MODULE)
>  
>  void of_register_i2c_devices(struct i2c_adapter *adap,
>  			     struct device_node *adap_node);

Why do we have that ifdef there at all?  There's only that one
external declaration within it, so the #ifdef and #endif could just be
removed.  If the ifdef hadn't been there in the first place we
wouldn't have had this problem.

Paul.
```

## Re: \[PATCH\] \[POWERPC\] Fix of\_i2c include for module compilation

- From: Jochen Friedrich \<jochen@scram.de\>
- Date: 2008-05-06 18:39:58 
- Message: https://ratatoskr.run/linuxppc-dev/2008/05/1096716.md

```text
Hi Paul,

>> -#ifdef CONFIG_OF_I2C
>> +#if defined(CONFIG_OF_I2C) || defined(CONFIG_OF_I2C_MODULE)
>>  
>>  void of_register_i2c_devices(struct i2c_adapter *adap,
>>  			     struct device_node *adap_node);
> 
> Why do we have that ifdef there at all?  There's only that one
> external declaration within it, so the #ifdef and #endif could just be
> removed.  If the ifdef hadn't been there in the first place we
> wouldn't have had this problem.

You're right. I mainly copied from of_gpio.h without too much thinking :(.
I'll resend.

Thanks,
Jochen
```
