[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CACRpkdb8owKBxawAv4LVVYx5kUgZ9cUSiQ=BV0f3Pf3bHtknuQ@mail.gmail.com>
Date: Mon, 3 Sep 2012 13:07:24 +0200
From: Linus Walleij <linus.walleij@...aro.org>
To: Lee Jones <lee.jones@...aro.org>
Cc: Wolfram Sang <w.sang@...gutronix.de>,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
STEricsson_nomadik_linux@...t.st.com, linus.walleij@...ricsson.com,
arnd@...db.de, linux-i2c@...r.kernel.org
Subject: Re: [PATCH 3/3] i2c: nomadik: Add Device Tree support to the Nomadik
I2C driver
On Mon, Sep 3, 2012 at 12:07 PM, Lee Jones <lee.jones@...aro.org> wrote:
(...)
> + if (np) {
> + if (!pdata) {
> + pdata = devm_kzalloc(&adev->dev, sizeof(*pdata), GFP_KERNEL);
> + if (!pdata) {
> + ret = -ENOMEM;
> + goto err_no_mem;
> + }
> + }
> + /* Provide the default configuration as a base. */
> + memcpy(pdata, &u8500_i2c, sizeof(struct nmk_i2c_controller));
Here you blank out any pdata passed from say a board file or
whatever if pdata != NULL.
> +
> + nmk_i2c_of_probe(np, pdata);
> + }
> +
> if (!pdata)
> /* No i2c configuration found, using the default. */
> pdata = &u8500_i2c;
So this is still wrong, if pdata is passed to the driver it will
not override the DT, you have the semantics the other way
around, DT overrides pdata.
Look at the switch statement in my previous comment,
just add the allocations and a memcpy() and it still holds:
if (!pdata) {
if (np) {
pdata = devm_kzalloc(&adev->dev, sizeof(*pdata), GFP_KERNEL);
if (!pdata) {
ret = -ENOMEM;
goto err_no_mem;
}
}
/* Provide the default configuration as a base. */
memcpy(pdata, &u8500_i2c, sizeof(struct nmk_i2c_controller));
nmk_i2c_of_probe(np, pdata);
} else
/* Just use the static pdata */
pdata = &u8500_i2c;
}
Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists