From mboxrd@z Thu Jan 1 00:00:00 1970 From: Richard Cochran Subject: Re: [PATCH v2 12/13] net: ethernet: ti: cpts: calc mult and shift from refclk freq Date: Tue, 29 Nov 2016 11:34:53 +0100 Message-ID: <20161129103453.GJ3110@localhost.localdomain> References: <20161128230337.6731-1-grygorii.strashko@ti.com> <20161128230337.6731-13-grygorii.strashko@ti.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: <20161128230337.6731-13-grygorii.strashko-l0cyMroinI0@public.gmane.org> Sender: devicetree-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Grygorii Strashko Cc: "David S. Miller" , netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Mugunthan V N , Sekhar Nori , linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Rob Herring , devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Murali Karicheri , Wingman Kwok , John Stultz , Thomas Gleixner List-Id: devicetree@vger.kernel.org On Mon, Nov 28, 2016 at 05:03:36PM -0600, Grygorii Strashko wrote: > +static void cpts_calc_mult_shift(struct cpts *cpts) > +{ > + u64 frac, maxsec, ns; > + u32 freq, mult, shift; > + > + freq = clk_get_rate(cpts->refclk); > + > + /* Calc the maximum number of seconds which we can run before > + * wrapping around. > + */ > + maxsec = cpts->cc.mask; > + do_div(maxsec, freq); > + if (maxsec > 600 && cpts->cc.mask > UINT_MAX) > + maxsec = 600; The reason for this test is not obvious. Why check cc.mask against UINT_MAX? Please use the comment to explain it. Thanks, Richard -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html