From: Grant Likely <grant.likely@secretlab.ca>
To: Thomas Abraham <thomas.abraham@linaro.org>
Cc: devicetree-discuss@lists.ozlabs.org, linux-i2c@vger.kernel.org,
ben-linux@fluff.org, linux-samsung-soc@vger.kernel.org
Subject: Re: [PATCH v2 1/3] i2c: s3c2410: Keep a copy of platform data and use it.
Date: Sat, 30 Jul 2011 21:51:05 -0600 [thread overview]
Message-ID: <20110731035105.GG24334@ponder.secretlab.ca> (raw)
In-Reply-To: <1311329918-8105-2-git-send-email-thomas.abraham@linaro.org>
On Fri, Jul 22, 2011 at 03:48:36PM +0530, Thomas Abraham wrote:
> The platform data is copied into driver's private data and the copy is
> used for all access to the platform data. This simpifies the addition
> of device tree support for the i2c-s3c2410 driver.
>
> Signed-off-by: Thomas Abraham <thomas.abraham@linaro.org>
> ---
> drivers/i2c/busses/i2c-s3c2410.c | 7 +++++--
> 1 files changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c
> index 6c00c10..e132168 100644
> --- a/drivers/i2c/busses/i2c-s3c2410.c
> +++ b/drivers/i2c/busses/i2c-s3c2410.c
> @@ -78,6 +78,7 @@ struct s3c24xx_i2c {
> struct resource *ioarea;
> struct i2c_adapter adap;
>
> + struct s3c2410_platform_i2c pdata;
After looking at a bunch of patches, there is another way do do this
I think. Instead of copying pdata into the private data structure, it
can remain as a pointer if the DT code uses devm_kzmalloc to allocate
a s3c2410_platform_i2c structure when needed.
I leave it up to you (and Ben) though as to which you prefer. I'm
okay either way, and you can add:
Acked-by: Grant Likely <grant.likely@secretlab.ca>
> #ifdef CONFIG_CPU_FREQ
> struct notifier_block freq_transition;
> #endif
> @@ -626,7 +627,7 @@ static int s3c24xx_i2c_calcdivisor(unsigned long clkin, unsigned int wanted,
>
> static int s3c24xx_i2c_clockrate(struct s3c24xx_i2c *i2c, unsigned int *got)
> {
> - struct s3c2410_platform_i2c *pdata = i2c->dev->platform_data;
> + struct s3c2410_platform_i2c *pdata = &i2c->pdata;
> unsigned long clkin = clk_get_rate(i2c->clk);
> unsigned int divs, div1;
> unsigned long target_frequency;
> @@ -755,7 +756,7 @@ static int s3c24xx_i2c_init(struct s3c24xx_i2c *i2c)
>
> /* get the plafrom data */
>
> - pdata = i2c->dev->platform_data;
> + pdata = &i2c->pdata;
>
> /* inititalise the gpio */
>
> @@ -810,6 +811,8 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev)
> return -ENOMEM;
> }
>
> + memcpy(&i2c->pdata, pdata, sizeof(*pdata));
> +
> strlcpy(i2c->adap.name, "s3c2410-i2c", sizeof(i2c->adap.name));
> i2c->adap.owner = THIS_MODULE;
> i2c->adap.algo = &s3c24xx_i2c_algorithm;
> --
> 1.6.6.rc2
>
next prev parent reply other threads:[~2011-07-31 3:51 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-22 10:18 [PATCH v2 0/3] Add device tree support for Samsung's I2C driver Thomas Abraham
[not found] ` <1311329918-8105-1-git-send-email-thomas.abraham-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2011-07-22 10:18 ` [PATCH v2 1/3] i2c: s3c2410: Keep a copy of platform data and use it Thomas Abraham
2011-07-22 10:18 ` [PATCH v2 2/3] i2c: s3c2410: Add device tree support Thomas Abraham
2011-07-22 10:18 ` [PATCH v2 3/3] arm: dt: Add device tree support for i2c instance 0 and 1 on exynos4 dt machine Thomas Abraham
2011-07-31 3:55 ` Grant Likely
[not found] ` <20110731035536.GI24334-e0URQFbLeQY2iJbIjFUEsiwD8/FfD2ys@public.gmane.org>
2011-07-31 21:02 ` Thomas Abraham
2011-07-31 3:53 ` [PATCH v2 2/3] i2c: s3c2410: Add device tree support Grant Likely
2011-07-31 20:50 ` Thomas Abraham
2011-07-31 3:51 ` Grant Likely [this message]
2011-07-31 20:33 ` [PATCH v2 1/3] i2c: s3c2410: Keep a copy of platform data and use it Thomas Abraham
2011-07-27 22:06 ` [PATCH v2 0/3] Add device tree support for Samsung's I2C driver Ben Dooks
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20110731035105.GG24334@ponder.secretlab.ca \
--to=grant.likely@secretlab.ca \
--cc=ben-linux@fluff.org \
--cc=devicetree-discuss@lists.ozlabs.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=thomas.abraham@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).