static int wf_max6690_attach(struct i2c_adapter *adapter) { struct device_node *busnode, *dev = NULL; struct pmac_i2c_bus *bus; const char *loc; bus = pmac_i2c_adapter_to_bus(adapter); if (bus == NULL) return -ENODEV; busnode = pmac_i2c_get_bus_node(bus); while ((dev = of_get_next_child(busnode, dev)) != NULL) { u8 addr; /* We must re-match the adapter in order to properly check * the channel on multibus setups */ if (!pmac_i2c_match_adapter(dev, adapter)) continue; if (!of_device_is_compatible(dev, "max6690")) continue; addr = pmac_i2c_get_dev_addr(dev); loc = of_get_property(dev, "hwsensor-location", NULL); if (loc == NULL || addr == 0) continue; ; wf_max6690_create(adapter, addr, loc); } return 0; }
static int wf_sat_attach(struct i2c_adapter *adapter) { struct device_node *busnode, *dev = NULL; struct pmac_i2c_bus *bus; bus = pmac_i2c_adapter_to_bus(adapter); if (bus == NULL) return -ENODEV; busnode = pmac_i2c_get_bus_node(bus); while ((dev = of_get_next_child(busnode, dev)) != NULL) if (of_device_is_compatible(dev, "smu-sat")) wf_sat_create(adapter, dev); return 0; }
static int wf_lm75_attach(struct i2c_adapter *adapter) { struct device_node *busnode, *dev; struct pmac_i2c_bus *bus; DBG("wf_lm75: adapter %s detected\n", adapter->name); bus = pmac_i2c_adapter_to_bus(adapter); if (bus == NULL) return -ENODEV; busnode = pmac_i2c_get_bus_node(bus); DBG("wf_lm75: bus found, looking for device...\n"); /* Now look for lm75(s) in there */ for (dev = NULL; (dev = of_get_next_child(busnode, dev)) != NULL;) { const char *loc = of_get_property(dev, "hwsensor-location", NULL); u8 addr; /* We must re-match the adapter in order to properly check * the channel on multibus setups */ if (!pmac_i2c_match_adapter(dev, adapter)) continue; addr = pmac_i2c_get_dev_addr(dev); if (loc == NULL || addr == 0) continue; /* real lm75 */ if (of_device_is_compatible(dev, "lm75")) wf_lm75_create(adapter, addr, 0, loc); /* ds1775 (compatible, better resolution */ else if (of_device_is_compatible(dev, "ds1775")) wf_lm75_create(adapter, addr, 1, loc); } return 0; }