From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752470AbbJTM07 (ORCPT ); Tue, 20 Oct 2015 08:26:59 -0400 Received: from metis.ext.4.pengutronix.de ([92.198.50.35]:52059 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752408AbbJTM05 (ORCPT ); Tue, 20 Oct 2015 08:26:57 -0400 Date: Tue, 20 Oct 2015 14:26:55 +0200 From: Sascha Hauer To: Mark Brown Cc: linux-kernel@vger.kernel.org, Liam Girdwood , kernel@pengutronix.de, alkml@pengutronix.de Subject: Re: [PATCH 5/8] regulator: introduce regulator_get_voltage_floor Message-ID: <20151020122655.GR14476@pengutronix.de> References: <1444733131-26995-1-git-send-email-s.hauer@pengutronix.de> <1444733131-26995-6-git-send-email-s.hauer@pengutronix.de> <20151016165023.GT14956@sirena.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20151016165023.GT14956@sirena.org.uk> X-Sent-From: Pengutronix Hildesheim X-URL: http://www.pengutronix.de/ X-IRC: #ptxdist @freenode X-Accept-Language: de,en X-Accept-Content-Type: text/plain X-Uptime: 14:23:59 up 2 days, 21:02, 47 users, load average: 0.11, 0.05, 0.07 User-Agent: Mutt/1.5.23 (2014-03-12) X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::c0 X-SA-Exim-Mail-From: sha@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Oct 16, 2015 at 05:50:23PM +0100, Mark Brown wrote: > On Tue, Oct 13, 2015 at 12:45:28PM +0200, Sascha Hauer wrote: > > > + num_voltages = regulator_count_voltages(regulator); > > + if (num_voltages < 0) > > + return num_voltages; > > > + for (i = 0; i < num_voltages; i++) { > > + now = _regulator_list_voltage(regulator, i, 0); > > + if (now < 0) > > + continue; > > + if (now < best && now >= min_uV) > > + best = now; > > + } > > Why is this not a factoring out of existing code (indeed it is itself a > reimplementation of regulator_map_voltage_iterate())? This will also be > a substantial performance loss in cases where we have a known mapping > function - we should use a map_voltage() operation if one exists like we > do in _do_set_voltage(). That has logic to handle missing mapping > functions as a transition measure, now I look at it we should probably > remove that code and just require that the mapping function is set if > appropriate. I didn't realize the map_voltage functionality is exactly what I want to have. Turns out that I can factor out a regulator_map_voltage() function instead of creating a regulator_get_voltage_floor() function. Updated series follows shortly. 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 |