|
@@ -255,10 +255,6 @@ static int __devinit max7301_probe(struct spi_device *spi)
|
|
ts->chip.dev = &spi->dev;
|
|
ts->chip.dev = &spi->dev;
|
|
ts->chip.owner = THIS_MODULE;
|
|
ts->chip.owner = THIS_MODULE;
|
|
|
|
|
|
- ret = gpiochip_add(&ts->chip);
|
|
|
|
- if (ret)
|
|
|
|
- goto exit_destroy;
|
|
|
|
-
|
|
|
|
/*
|
|
/*
|
|
* tristate all pins in hardware and cache the
|
|
* tristate all pins in hardware and cache the
|
|
* register values for later use.
|
|
* register values for later use.
|
|
@@ -269,17 +265,19 @@ static int __devinit max7301_probe(struct spi_device *spi)
|
|
max7301_write(spi, 0x08 + i, 0xAA);
|
|
max7301_write(spi, 0x08 + i, 0xAA);
|
|
ts->port_config[i] = 0xAA;
|
|
ts->port_config[i] = 0xAA;
|
|
for (j = 0; j < 4; j++) {
|
|
for (j = 0; j < 4; j++) {
|
|
- int idx = ts->chip.base + (i - 1) * 4 + j;
|
|
|
|
- ret = gpio_direction_input(idx);
|
|
|
|
|
|
+ int offset = (i - 1) * 4 + j;
|
|
|
|
+ ret = max7301_direction_input(&ts->chip, offset);
|
|
if (ret)
|
|
if (ret)
|
|
- goto exit_remove;
|
|
|
|
- gpio_free(idx);
|
|
|
|
|
|
+ goto exit_destroy;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ ret = gpiochip_add(&ts->chip);
|
|
|
|
+ if (ret)
|
|
|
|
+ goto exit_destroy;
|
|
|
|
+
|
|
return ret;
|
|
return ret;
|
|
|
|
|
|
-exit_remove:
|
|
|
|
- gpiochip_remove(&ts->chip);
|
|
|
|
exit_destroy:
|
|
exit_destroy:
|
|
dev_set_drvdata(&spi->dev, NULL);
|
|
dev_set_drvdata(&spi->dev, NULL);
|
|
mutex_destroy(&ts->lock);
|
|
mutex_destroy(&ts->lock);
|