Furquan Shaikh (furquan@google.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/17857
-gerrit
commit 20f722f4a9ace367fca4417ab7ecb4a75050f7ef Author: Furquan Shaikh furquan@chromium.org Date: Tue Dec 13 21:50:32 2016 -0800
drivers/i2c: Pass in i2c_generic_config into i2c_generic_fill_ssdt
Remove any assumptions required for the drivers using i2c_generic to have drivers_i2c_generic_config structure at the start of the driver config. Instead pass in a pointer to drivers_i2c_generic_config from the calling driver.
Change-Id: I51dc4cad1c1f246b51891abf7115a7120e87b098 Signed-off-by: Furquan Shaikh furquan@chromium.org --- src/drivers/i2c/alps/alps.c | 3 ++- src/drivers/i2c/generic/chip.h | 10 ++++++---- src/drivers/i2c/generic/generic.c | 6 +++--- src/drivers/i2c/wacom/wacom.c | 3 ++- 4 files changed, 13 insertions(+), 9 deletions(-)
diff --git a/src/drivers/i2c/alps/alps.c b/src/drivers/i2c/alps/alps.c index 2686f6c..f0ccd6c 100644 --- a/src/drivers/i2c/alps/alps.c +++ b/src/drivers/i2c/alps/alps.c @@ -30,7 +30,8 @@ static void i2c_alps_fill_dsm(struct device *dev)
static void i2c_alps_fill_ssdt_generator(struct device *dev) { - i2c_generic_fill_ssdt(dev, &i2c_alps_fill_dsm); + struct drivers_i2c_alps_config *config = dev->chip_info; + i2c_generic_fill_ssdt(dev, &i2c_alps_fill_dsm, &config->generic); }
static const char *i2c_alps_acpi_name(struct device *dev) diff --git a/src/drivers/i2c/generic/chip.h b/src/drivers/i2c/generic/chip.h index 736de51..b1fc8e5 100644 --- a/src/drivers/i2c/generic/chip.h +++ b/src/drivers/i2c/generic/chip.h @@ -57,11 +57,13 @@ struct drivers_i2c_generic_config { * properties. Callback can be provided to fill in any * device-specific information in SSDT. * - * Drivers calling into this function to generate should place - * drivers_i2c_generic_config structure at the beginning of their device config - * structure. + * Parameters: + * dev: Device requesting i2c generic information to be filled + * callback: Callback to fill in device-specific information + * config: Pointer to drivers_i2c_generic_config structure */ void i2c_generic_fill_ssdt(struct device *dev, - void (*callback)(struct device *dev)); + void (*callback)(struct device *dev), + struct drivers_i2c_generic_config *config);
#endif /* __I2C_GENERIC_CHIP_H__ */ diff --git a/src/drivers/i2c/generic/generic.c b/src/drivers/i2c/generic/generic.c index b8e5d86..50f60bb 100644 --- a/src/drivers/i2c/generic/generic.c +++ b/src/drivers/i2c/generic/generic.c @@ -66,9 +66,9 @@ static void i2c_generic_add_power_res(struct drivers_i2c_generic_config *config) }
void i2c_generic_fill_ssdt(struct device *dev, - void (*callback)(struct device *dev)) + void (*callback)(struct device *dev), + struct drivers_i2c_generic_config *config) { - struct drivers_i2c_generic_config *config = dev->chip_info; const char *scope = acpi_device_scope(dev); struct acpi_i2c i2c = { .address = dev->path.i2c.device, @@ -131,7 +131,7 @@ void i2c_generic_fill_ssdt(struct device *dev,
static void i2c_generic_fill_ssdt_generator(struct device *dev) { - i2c_generic_fill_ssdt(dev, NULL); + i2c_generic_fill_ssdt(dev, NULL, dev->chip_info); }
/* Use name specified in config or build one from I2C address */ diff --git a/src/drivers/i2c/wacom/wacom.c b/src/drivers/i2c/wacom/wacom.c index c54194f..e6d1277 100644 --- a/src/drivers/i2c/wacom/wacom.c +++ b/src/drivers/i2c/wacom/wacom.c @@ -30,7 +30,8 @@ static void i2c_wacom_fill_dsm(struct device *dev)
static void i2c_wacom_fill_ssdt_generator(struct device *dev) { - i2c_generic_fill_ssdt(dev, &i2c_wacom_fill_dsm); + struct drivers_i2c_wacom_config *config = dev->chip_info; + i2c_generic_fill_ssdt(dev, &i2c_wacom_fill_dsm, &config->generic); }
static const char *i2c_wacom_acpi_name(struct device *dev)