linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: s.hauer@pengutronix.de (Sascha Hauer)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCHv3] cpufreq for freescale mx51
Date: Tue, 19 Oct 2010 12:07:06 +0200	[thread overview]
Message-ID: <20101019100706.GR28242@pengutronix.de> (raw)
In-Reply-To: <AANLkTik=UWF0PpAUKGE3KwmJbZNgxUj-8o6ouD+LYcSx@mail.gmail.com>

On Tue, Oct 19, 2010 at 05:28:51PM +0800, Yong Shen wrote:
> >
> >
> >
> > > +#include <linux/kernel.h>
> > > +
> > > +static struct cpu_op mx51_cpu_op[] = {
> > > +     {
> > > +     .cpu_rate = 160000000,},
> > > +     {
> > > +     .cpu_rate = 800000000,},
> > > +};
> >
> > Why did you remove the values between 800MHz and 160MHz? 400MHz and
> > 200Mhz should work also, no?
> >
> > It proved that those operating points don't work well.

ok

> > > +static struct cpu_op *cpu_op_tbl;
> > > +
> > > +static int set_cpu_freq(int freq)
> > > +{
> > > +     int ret = 0;
> > > +     int org_cpu_rate;
> > > +
> > > +     org_cpu_rate = clk_get_rate(cpu_clk);
> > > +     if (org_cpu_rate == freq)
> > > +             return ret;
> >
> > You already checked this in mxc_set_target. Once is enough.
> >
> 
> Well, this fucntion is not only used in mxc_set_target, so it is safer to
> still keep checking here.

Then you can skip the check in the calling function.

> > > +
> > > +static int __init mxc_cpufreq_init(struct cpufreq_policy *policy)
> > > +{
> > > +     int ret;
> > > +     int i;
> > > +
> > > +     printk(KERN_INFO "i.MXC CPU frequency driver\n");
> > > +
> > > +     if (policy->cpu != 0)
> > > +             return -EINVAL;
> > > +
> > > +     cpu_clk = clk_get(NULL, "cpu_clk");
> > > +     if (IS_ERR(cpu_clk)) {
> > > +             printk(KERN_ERR "%s: failed to get cpu clock\n", __func__);
> > > +             return PTR_ERR(cpu_clk);
> > > +     }
> > > +
> > > +     cpu_op_tbl = get_cpu_op(&cpu_op_nr);
> >
> > This will crash every board except the babbage board which happens to
> > set this function pointer.
> >
> Add a checking here should avoid that.

indeed

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

  reply	other threads:[~2010-10-19 10:07 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-18  8:21 [PATCHv3] cpufreq for freescale mx51 yong.shen at linaro.org
2010-10-18 10:02 ` Amit Kucheria
2010-10-19  7:39   ` Yong Shen
2010-10-18 10:13 ` Sascha Hauer
2010-10-19  9:28   ` Yong Shen
2010-10-19 10:07     ` Sascha Hauer [this message]
     [not found] ` <AANLkTinRoomFr5B=yendY01iiaFOmoz-UBy2aO-+Dcpp@mail.gmail.com>
2010-10-19  9:38   ` Yong Shen

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=20101019100706.GR28242@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.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).