<div>You're right. I rushed it to get it out the door, as I'm working on something else.</div><div><br></div><div>Leave it with me. I'll spend more time on the semantics before posting again.</div><br><div class="gmail_quote">
On 3 September 2012 12:07, Linus Walleij <span dir="ltr"><<a href="mailto:linus.walleij@linaro.org" target="_blank">linus.walleij@linaro.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">On Mon, Sep 3, 2012 at 12:07 PM, Lee Jones <<a href="mailto:lee.jones@linaro.org">lee.jones@linaro.org</a>> wrote:<br>
<br>
(...)<br>
</div><div class="im">> + if (np) {<br>
> + if (!pdata) {<br>
> + pdata = devm_kzalloc(&adev->dev, sizeof(*pdata), GFP_KERNEL);<br>
> + if (!pdata) {<br>
> + ret = -ENOMEM;<br>
> + goto err_no_mem;<br>
> + }<br>
> + }<br>
> + /* Provide the default configuration as a base. */<br>
> + memcpy(pdata, &u8500_i2c, sizeof(struct nmk_i2c_controller));<br>
<br>
</div>Here you blank out any pdata passed from say a board file or<br>
whatever if pdata != NULL.<br>
<div class="im"><br>
> +<br>
> + nmk_i2c_of_probe(np, pdata);<br>
> + }<br>
> +<br>
> if (!pdata)<br>
> /* No i2c configuration found, using the default. */<br>
> pdata = &u8500_i2c;<br>
<br>
</div>So this is still wrong, if pdata is passed to the driver it will<br>
not override the DT, you have the semantics the other way<br>
around, DT overrides pdata.<br>
<br>
Look at the switch statement in my previous comment,<br>
just add the allocations and a memcpy() and it still holds:<br>
<br>
if (!pdata) {<br>
if (np) {<br>
<div class="im"> pdata = devm_kzalloc(&adev->dev, sizeof(*pdata), GFP_KERNEL);<br>
</div> if (!pdata) {<br>
ret = -ENOMEM;<br>
goto err_no_mem;<br>
<div class="im"> }<br>
}<br>
/* Provide the default configuration as a base. */<br>
</div> memcpy(pdata, &u8500_i2c, sizeof(struct nmk_i2c_controller));<br>
nmk_i2c_of_probe(np, pdata);<br>
} else<br>
/* Just use the static pdata */<br>
pdata = &u8500_i2c;<br>
}<br>
<br>
Yours,<br>
Linus Walleij<br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>Lee Jones
<br>Linaro ST-Ericsson Landing Team Lead
<br>Linaro.org │ Open source software for ARM SoCs
<br>Follow Linaro: Facebook | Twitter | Blog <br>