From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Fri, 27 Nov 2015 21:10:08 +0100 From: Andrew Lunn To: Russell King Cc: Gregory Clement , Jason Cooper , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, Michael Turquette , Stephen Boyd Subject: Re: [PATCH 2/3] clk: add Dove PLL divider support for GPU, VMeta and AXI clocks Message-ID: <20151127201008.GD14645@lunn.ch> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii In-Reply-To: List-ID: Hi Russell > +static int dove_calc_divider(const struct dove_clk *dc, unsigned long rate, > + unsigned long parent_rate, bool set) > +{ > + unsigned int divider, max; > + > + divider = DIV_ROUND_CLOSEST(parent_rate, rate); > + > + if (dc->divider_table) { > + unsigned int i; > + > + for (i = 0; dc->divider_table[i]; i++) > + if (divider == dc->divider_table[i]) { > + divider = i; > + break; > + } > + > + if (dc->divider_table[i]) > + return -EINVAL; Is this condition correct? If we have reached the 0 at the end of the table, -EINVAL makes sense. But that would need a ! Andrew From mboxrd@z Thu Jan 1 00:00:00 1970 From: andrew@lunn.ch (Andrew Lunn) Date: Fri, 27 Nov 2015 21:10:08 +0100 Subject: [PATCH 2/3] clk: add Dove PLL divider support for GPU, VMeta and AXI clocks In-Reply-To: References: Message-ID: <20151127201008.GD14645@lunn.ch> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org Hi Russell > +static int dove_calc_divider(const struct dove_clk *dc, unsigned long rate, > + unsigned long parent_rate, bool set) > +{ > + unsigned int divider, max; > + > + divider = DIV_ROUND_CLOSEST(parent_rate, rate); > + > + if (dc->divider_table) { > + unsigned int i; > + > + for (i = 0; dc->divider_table[i]; i++) > + if (divider == dc->divider_table[i]) { > + divider = i; > + break; > + } > + > + if (dc->divider_table[i]) > + return -EINVAL; Is this condition correct? If we have reached the 0 at the end of the table, -EINVAL makes sense. But that would need a ! Andrew From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Lunn Subject: Re: [PATCH 2/3] clk: add Dove PLL divider support for GPU, VMeta and AXI clocks Date: Fri, 27 Nov 2015 21:10:08 +0100 Message-ID: <20151127201008.GD14645@lunn.ch> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: Sender: devicetree-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Russell King Cc: Gregory Clement , Jason Cooper , devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org, linux-clk-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Michael Turquette , Stephen Boyd List-Id: devicetree@vger.kernel.org Hi Russell > +static int dove_calc_divider(const struct dove_clk *dc, unsigned long rate, > + unsigned long parent_rate, bool set) > +{ > + unsigned int divider, max; > + > + divider = DIV_ROUND_CLOSEST(parent_rate, rate); > + > + if (dc->divider_table) { > + unsigned int i; > + > + for (i = 0; dc->divider_table[i]; i++) > + if (divider == dc->divider_table[i]) { > + divider = i; > + break; > + } > + > + if (dc->divider_table[i]) > + return -EINVAL; Is this condition correct? If we have reached the 0 at the end of the table, -EINVAL makes sense. But that would need a ! Andrew -- 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