On Tue, Jan 20, 2015 at 10:00 AM, Sonic Zhang <sonic.adi@xxxxxxxxx> wrote: > From: Sonic Zhang <sonic.zhang@xxxxxxxxxx> > > Signed-off-by: Sonic Zhang <sonic.zhang@xxxxxxxxxx> Tested-by: Antonio Fiol <antonio@xxxxxxx> > --- > drivers/gpio/gpio-mcp23s08.c | 17 ++++++++++------- > 1 file changed, 10 insertions(+), 7 deletions(-) > > diff --git a/drivers/gpio/gpio-mcp23s08.c b/drivers/gpio/gpio-mcp23s08.c > index da9c316..eea5d7e 100644 > --- a/drivers/gpio/gpio-mcp23s08.c > +++ b/drivers/gpio/gpio-mcp23s08.c > @@ -801,9 +801,11 @@ static int mcp230xx_probe(struct i2c_client *client, > client->irq = irq_of_parse_and_map(client->dev.of_node, 0); > } else { > pdata = dev_get_platdata(&client->dev); > - if (!pdata || !gpio_is_valid(pdata->base)) { > - dev_dbg(&client->dev, "invalid platform data\n"); > - return -EINVAL; > + if (!pdata) { > + pdata = devm_kzalloc(&client->dev, > + sizeof(struct mcp23s08_platform_data), > + GFP_KERNEL); > + pdata->base = -1; > } > } > > @@ -924,10 +926,11 @@ static int mcp23s08_probe(struct spi_device *spi) > } else { > type = spi_get_device_id(spi)->driver_data; > pdata = dev_get_platdata(&spi->dev); > - if (!pdata || !gpio_is_valid(pdata->base)) { > - dev_dbg(&spi->dev, > - "invalid or missing platform data\n"); > - return -EINVAL; > + if (!pdata) { > + pdata = devm_kzalloc(&spi->dev, > + sizeof(struct mcp23s08_platform_data), > + GFP_KERNEL); > + pdata->base = -1; > } > > for (addr = 0; addr < ARRAY_SIZE(pdata->chip); addr++) { > -- > 1.7.9.5 > Thank you Sonic for the patch, and Alexander for your patience, understanding and guidance. This patch is working in my scenario. It is assigning the same base as it was on the version before the patch that broke the behavior in the past. If you wish me to test in other scenarios (e.g. creating a device tree file, or using platform data), I'd appreciate pointers to learn the basics, or some help preparing the kernel tree to build with the needed definitions (if that's what needs to be done). I am saying this because seeing the commit logs it appears that effort is being put into the driver to work in scenarios that differ from mine, and I definitely do not want to break them. Kind regards, -- Antonio -- To unsubscribe from this list: send the line "unsubscribe linux-gpio" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html