From: Kevin Hilman <khilman-1D3HCaltpLuhEniVeURVKkEOCMrvLtNR@public.gmane.org>
To: vishwa <vishwanath.k-l0cyMroinI0@public.gmane.org>
Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
davinci-linux-open-source-VycZQUHpC/PFrsHnngEfi1aTQe2KTcn/@public.gmane.org
Subject: Re: [PATCH v2] davinci: I2C: Adding bus frequency as module parameter
Date: Wed, 11 Aug 2010 08:39:02 -0700 [thread overview]
Message-ID: <87aaot40rt.fsf@deeprootsystems.com> (raw)
In-Reply-To: <1281521313-4556-1-git-send-email-vishwanath.k-l0cyMroinI0@public.gmane.org> (vishwa's message of "Wed, 11 Aug 2010 15:38:33 +0530")
vishwa <vishwanath.k-l0cyMroinI0@public.gmane.org> writes:
> With current implementation, when I2C is used as a module,
> for slave devices which operate at different frequencies,
> the bus frequency needs to be modified in the board
> configuration file and kernel needs to be re-built.
>
> This patch addresses this issue by adding bus frequency as
> module parameter.
>
> Signed-off-by: vishwa <vishwanath.k-l0cyMroinI0@public.gmane.org>
> ---
> Since v1:
> a. added MODULE_PARAM_DESC.
> b. Moved module parameter definitions to the beginning of the file.
> c. 'pdata->bus_freq' is being set in i2c_davinci_init() function.
>
> drivers/i2c/busses/i2c-davinci.c | 7 +++++++
> 1 files changed, 7 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-davinci.c b/drivers/i2c/busses/i2c-davinci.c
> index 2222c87..8fbfaa2 100644
> --- a/drivers/i2c/busses/i2c-davinci.c
> +++ b/drivers/i2c/busses/i2c-davinci.c
> @@ -98,6 +98,10 @@
> #define DAVINCI_I2C_IMR_NACK BIT(1)
> #define DAVINCI_I2C_IMR_AL BIT(0)
>
> +static int i2c_davinci_busfreq;
> +module_param(i2c_davinci_busfreq, int, 0);
> +MODULE_PARM_DESC(i2c_davinci_busfreq, "bus frequency");
> +
> struct davinci_i2c_dev {
> struct device *dev;
> void __iomem *base;
> @@ -243,6 +247,9 @@ static int i2c_davinci_init(struct davinci_i2c_dev *dev)
> /* put I2C into reset */
> davinci_i2c_reset_ctrl(dev, 0);
>
> + if (i2c_davinci_busfreq != 0)
> + pdata->bus_freq = i2c_davinci_busfreq;
I don't really like using a module parameter to modify the contents of
struct platform_data, especially when this comes from a board file.
Intead this should look something like
if (!i2c_davinci_busfreq)
i2c_davinci_bus_freq = pdata->bus_freq;
and the code should use i2c_davinci_busfreq instead of pdata->bus_freq.
Kevin
prev parent reply other threads:[~2010-08-11 15:39 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-11 10:08 [PATCH v2] davinci: I2C: Adding bus frequency as module parameter vishwa
[not found] ` <1281521313-4556-1-git-send-email-vishwanath.k-l0cyMroinI0@public.gmane.org>
2010-08-11 15:39 ` Kevin Hilman [this message]
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=87aaot40rt.fsf@deeprootsystems.com \
--to=khilman-1d3hcaltpluheniveurvkkeocmrvltnr@public.gmane.org \
--cc=davinci-linux-open-source-VycZQUHpC/PFrsHnngEfi1aTQe2KTcn/@public.gmane.org \
--cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=vishwanath.k-l0cyMroinI0@public.gmane.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).