Re: [PATCH] gpio: stmpe: Add DT support for stmpe gpio

From: Viresh Kumar
Date: Fri Nov 23 2012 - 05:43:18 EST


On 23 November 2012 16:04, Lee Jones <lee.jones@xxxxxxxxxx> wrote:
> On Fri, 23 Nov 2012, Viresh Kumar wrote:
>> diff --git a/drivers/gpio/gpio-stmpe.c b/drivers/gpio/gpio-stmpe.c

>> static int __devinit stmpe_gpio_probe(struct platform_device *pdev)
>> {

>> - stmpe_gpio->chip.base = pdata ? pdata->gpio_base : -1;
>
> Why have you deleted this?
>
>> +
>> + if (pdata) {
>> + stmpe_gpio->norequest_mask = pdata->norequest_mask;
>> + stmpe_gpio->chip.base = pdata->gpio_base;
>
> Then added this?
>
>> + } else {
>> + stmpe_gpio->chip.base = -1;
>
> And this?

To group all non-DT assignments in a single if block, instead of two.

> Just leave the top line in and it saves you lots of complecations.

Sorry, Couldn't get this one.

>> + if (np)
>> + of_property_read_u32(np, "st,norequest-mask",
>> + &pdata->norequest_mask);
>
> Can you explain to me what this does?

You mean pdata->norequest_mask? It marks few gpios as unusable.
Because these pads might be used by other blocks of stmpe.

>> diff --git a/drivers/mfd/stmpe.c b/drivers/mfd/stmpe.c

>> static struct mfd_cell stmpe_gpio_cell = {
>> .name = "stmpe-gpio",
>> + .of_compatible = "st,stmpe-gpio",
>
> There's no need for any of the STMPE to have their own compatible
> string, as they are MFD devices. They are registered as platform
> devices from the MFD subsystem.

This is required by mfd-core.c, mfd_add_device() isn't it?

if (parent->of_node && cell->of_compatible) {
for_each_child_of_node(parent->of_node, np) {
if (of_device_is_compatible(np, cell->of_compatible)) {
pdev->dev.of_node = np;
break;
}
}
}

--
viresh
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/