summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drivers/i2c/busses/i2c-i801.c37
1 files changed, 4 insertions, 33 deletions
diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c
index bb1d7291cf21..37793156bd93 100644
--- a/drivers/i2c/busses/i2c-i801.c
+++ b/drivers/i2c/busses/i2c-i801.c
@@ -194,7 +194,6 @@ struct i801_priv {
#if defined CONFIG_I2C_MUX || defined CONFIG_I2C_MUX_MODULE
const struct i801_mux_config *mux_drvdata;
- unsigned mux_priv[2];
struct platform_device *mux_pdev;
#endif
};
@@ -1008,60 +1007,32 @@ static struct dmi_system_id __devinitdata mux_dmi_table[] = {
{ }
};
-static int __devinit match_gpio_chip_by_label(struct gpio_chip *chip,
- void *data)
-{
- return !strcmp(chip->label, data);
-}
-
/* Setup multiplexing if needed */
static int __devinit i801_add_mux(struct i801_priv *priv)
{
struct device *dev = &priv->adapter.dev;
const struct i801_mux_config *mux_config;
- struct gpio_chip *gpio;
struct i2c_mux_gpio_platform_data gpio_data;
- int i, err;
+ int err;
if (!priv->mux_drvdata)
return 0;
mux_config = priv->mux_drvdata;
- /* Find GPIO chip */
- gpio = gpiochip_find(mux_config->gpio_chip, match_gpio_chip_by_label);
- if (gpio) {
- dev_info(dev,
- "GPIO chip %s found, SMBus multiplexing enabled\n",
- mux_config->gpio_chip);
- } else {
- dev_err(dev,
- "GPIO chip %s not found, SMBus multiplexing disabled\n",
- mux_config->gpio_chip);
- return -ENODEV;
- }
-
- /* Find absolute GPIO pin numbers */
- if (ARRAY_SIZE(priv->mux_priv) < mux_config->n_gpios) {
- dev_err(dev, "i801_priv.mux_priv too small (%zu, need %d)\n",
- ARRAY_SIZE(priv->mux_priv), mux_config->n_gpios);
- return -ENODEV;
- }
- for (i = 0; i < mux_config->n_gpios; i++)
- priv->mux_priv[i] = gpio->base + mux_config->gpios[i];
-
/* Prepare the platform data */
memset(&gpio_data, 0, sizeof(struct i2c_mux_gpio_platform_data));
gpio_data.parent = priv->adapter.nr;
gpio_data.values = mux_config->values;
gpio_data.n_values = mux_config->n_values;
gpio_data.classes = mux_config->classes;
- gpio_data.gpios = priv->mux_priv;
+ gpio_data.gpio_chip = mux_config->gpio_chip;
+ gpio_data.gpios = mux_config->gpios;
gpio_data.n_gpios = mux_config->n_gpios;
gpio_data.idle = I2C_MUX_GPIO_NO_IDLE;
/* Register the mux device */
priv->mux_pdev = platform_device_register_data(dev, "i2c-mux-gpio",
- priv->mux_priv[0], &gpio_data,
+ PLATFORM_DEVID_AUTO, &gpio_data,
sizeof(struct i2c_mux_gpio_platform_data));
if (IS_ERR(priv->mux_pdev)) {
err = PTR_ERR(priv->mux_pdev);