aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/platforms/powermac
diff options
context:
space:
mode:
authorJean Delvare <khali@linux-fr.org>2009-12-06 11:06:19 -0500
committerJean Delvare <khali@linux-fr.org>2009-12-06 11:06:19 -0500
commit6dfa5ca3c9a35cb395ab1f51e0e500106c85dff4 (patch)
tree3ea208e88338d40fd9e4d0ea51f55cafecd64ff0 /arch/powerpc/platforms/powermac
parentd7d838a6ebbab6e786148133b6cf9617144603b4 (diff)
i2c-powermac: Include the i2c_adapter in struct pmac_i2c_bus
Include the i2c_adapter in struct pmac_i2c_bus. This avoids memory fragmentation and allows for several code cleanups. Signed-off-by: Jean Delvare <khali@linux-fr.org> Tested-by: Michel Daenzer <michel@daenzer.net> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/platforms/powermac')
-rw-r--r--arch/powerpc/platforms/powermac/low_i2c.c25
1 files changed, 5 insertions, 20 deletions
diff --git a/arch/powerpc/platforms/powermac/low_i2c.c b/arch/powerpc/platforms/powermac/low_i2c.c
index 414ca9849f23..345e2da56767 100644
--- a/arch/powerpc/platforms/powermac/low_i2c.c
+++ b/arch/powerpc/platforms/powermac/low_i2c.c
@@ -42,6 +42,7 @@
42#include <linux/interrupt.h> 42#include <linux/interrupt.h>
43#include <linux/timer.h> 43#include <linux/timer.h>
44#include <linux/mutex.h> 44#include <linux/mutex.h>
45#include <linux/i2c.h>
45#include <asm/keylargo.h> 46#include <asm/keylargo.h>
46#include <asm/uninorth.h> 47#include <asm/uninorth.h>
47#include <asm/io.h> 48#include <asm/io.h>
@@ -80,7 +81,7 @@ struct pmac_i2c_bus
80 struct device_node *busnode; 81 struct device_node *busnode;
81 int type; 82 int type;
82 int flags; 83 int flags;
83 struct i2c_adapter *adapter; 84 struct i2c_adapter adapter;
84 void *hostdata; 85 void *hostdata;
85 int channel; /* some hosts have multiple */ 86 int channel; /* some hosts have multiple */
86 int mode; /* current mode */ 87 int mode; /* current mode */
@@ -1014,25 +1015,9 @@ int pmac_i2c_get_channel(struct pmac_i2c_bus *bus)
1014EXPORT_SYMBOL_GPL(pmac_i2c_get_channel); 1015EXPORT_SYMBOL_GPL(pmac_i2c_get_channel);
1015 1016
1016 1017
1017void pmac_i2c_attach_adapter(struct pmac_i2c_bus *bus,
1018 struct i2c_adapter *adapter)
1019{
1020 WARN_ON(bus->adapter != NULL);
1021 bus->adapter = adapter;
1022}
1023EXPORT_SYMBOL_GPL(pmac_i2c_attach_adapter);
1024
1025void pmac_i2c_detach_adapter(struct pmac_i2c_bus *bus,
1026 struct i2c_adapter *adapter)
1027{
1028 WARN_ON(bus->adapter != adapter);
1029 bus->adapter = NULL;
1030}
1031EXPORT_SYMBOL_GPL(pmac_i2c_detach_adapter);
1032
1033struct i2c_adapter *pmac_i2c_get_adapter(struct pmac_i2c_bus *bus) 1018struct i2c_adapter *pmac_i2c_get_adapter(struct pmac_i2c_bus *bus)
1034{ 1019{
1035 return bus->adapter; 1020 return &bus->adapter;
1036} 1021}
1037EXPORT_SYMBOL_GPL(pmac_i2c_get_adapter); 1022EXPORT_SYMBOL_GPL(pmac_i2c_get_adapter);
1038 1023
@@ -1041,7 +1026,7 @@ struct pmac_i2c_bus *pmac_i2c_adapter_to_bus(struct i2c_adapter *adapter)
1041 struct pmac_i2c_bus *bus; 1026 struct pmac_i2c_bus *bus;
1042 1027
1043 list_for_each_entry(bus, &pmac_i2c_busses, link) 1028 list_for_each_entry(bus, &pmac_i2c_busses, link)
1044 if (bus->adapter == adapter) 1029 if (&bus->adapter == adapter)
1045 return bus; 1030 return bus;
1046 return NULL; 1031 return NULL;
1047} 1032}
@@ -1053,7 +1038,7 @@ int pmac_i2c_match_adapter(struct device_node *dev, struct i2c_adapter *adapter)
1053 1038
1054 if (bus == NULL) 1039 if (bus == NULL)
1055 return 0; 1040 return 0;
1056 return (bus->adapter == adapter); 1041 return (&bus->adapter == adapter);
1057} 1042}
1058EXPORT_SYMBOL_GPL(pmac_i2c_match_adapter); 1043EXPORT_SYMBOL_GPL(pmac_i2c_match_adapter);
1059 1044