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] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 5 Feb 2015 22:24:42 +0300
From:	Max Filippov <jcmvbkbc@...il.com>
To:	Wolfram Sang <wsa@...-dreams.de>
Cc:	Peter Korsgaard <jacmet@...site.dk>, linux-i2c@...r.kernel.org,
	LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2 2/2] i2c: i2c-ocores: add common clock support

On Thu, Feb 5, 2015 at 10:15 PM, Wolfram Sang <wsa@...-dreams.de> wrote:
>
> > -     if (of_property_read_u32(np, "opencores,ip-clock-frequency", &val)) {
> > +#ifdef CONFIG_HAVE_CLK
> > +     i2c->clk = devm_clk_get(&pdev->dev, NULL);
> > +
> > +     if (!IS_ERR(i2c->clk)) {
> > +             int ret = clk_prepare_enable(i2c->clk);
> > +
> > +             if (ret) {
> > +                     dev_err(&pdev->dev,
> > +                             "clk_prepare_enable failed: %d\n", ret);
> > +                     return ret;
> > +             }
> > +             i2c->ip_clock_khz = clk_get_rate(i2c->clk) / 1000;
> > +             if (clock_frequency_present)
> > +                     i2c->bus_clock_khz = clock_frequency / 1000;
> > +     } else
> > +#endif
> > +             if (of_property_read_u32(np, "opencores,ip-clock-frequency",
> > +                                      &val)) {
>
> This is not very readable (wrong indentation) and fragile. I'd suggest
> to leave out #ifdeffery, the compiler will remove the code for !HAVE_CLK
> because of the empty dummy functions[1]. Then, you can write properly
> formatted code again.
>
> [1] Well, it should if there wasn't a bug in that: https://lkml.org/lkml/2015/2/5/544

Ok, will fix.

> > +#ifdef CONFIG_HAVE_CLK
> > +     if (!IS_ERR(i2c->clk)) {
> > +             int ret = clk_prepare_enable(i2c->clk);
> > +
> > +             if (ret) {
> > +                     dev_err(&pdev->dev,
> > +                             "clk_prepare_enable failed: %d\n", ret);
> > +                     return ret;
> > +             }
> > +             i2c->ip_clock_khz = clk_get_rate(i2c->clk) / 1000;
> > +     }
> > +#endif
>
> Ahem, there is a build error in here :(

Ooops, looks like I don't have CONFIG_PM_SLEEP in my test config.
Will fix. Sorry about that.

-- 
Thanks.
-- Max
--
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