lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAMuHMdUZ+-7-N7znngJ0Gk9-TX3-dQxDsYc2NjWut426rKjF9Q@mail.gmail.com>
Date:	Mon, 14 Sep 2015 12:13:38 +0200
From:	Geert Uytterhoeven <geert@...ux-m68k.org>
To:	Kuninori Morimoto <kuninori.morimoto.gx@...esas.com>
Cc:	Stephen Boyd <sboyd@...eaurora.org>, Simon <horms@...ge.net.au>,
	Michael Turquette <mturquette@...libre.com>,
	Magnus <magnus.damm@...il.com>,
	Linux-SH <linux-sh@...r.kernel.org>,
	Linux-Kernel <linux-kernel@...r.kernel.org>,
	linux-clk <linux-clk@...r.kernel.org>
Subject: Re: [PATCH v2] clk: add CS2000 Fractional-N driver

On Mon, Sep 14, 2015 at 11:47 AM, Kuninori Morimoto
<kuninori.morimoto.gx@...esas.com> wrote:
> +static int cs2000_ratio_set(struct i2c_client *client,
> +                           int ch, u32 rate_in, u32 rate_out)
> +{
> +       u64 val;
> +       unsigned int i;
> +       int ret;
> +
> +       if (CH_SIZE_ERR(ch))
> +               return -EINVAL;
> +
> +       /*
> +        * ratio = rate_out / rate_in * 2^20
> +        *
> +        * To avoid over flow, rate_out is u64
> +        * The result should be u32
> +        */
> +
> +       val = rate_out;
> +       val *= (1 << 20);

val <<= 20

Or

    val = (u64)rate_out << 20;

> +       do_div(val, rate_in);

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@...ux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ