From patchwork Tue Nov 13 08:48:52 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 1732831 Return-Path: X-Original-To: patchwork-linux-mmc@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id E73F43FC8A for ; Tue, 13 Nov 2012 08:50:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750811Ab2KMItX (ORCPT ); Tue, 13 Nov 2012 03:49:23 -0500 Received: from mailout3.samsung.com ([203.254.224.33]:59638 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754583Ab2KMItV (ORCPT ); Tue, 13 Nov 2012 03:49:21 -0500 Received: from epcpsbgm2.samsung.com (epcpsbgm2 [203.254.230.27]) by mailout3.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MDF00GPM4HM9P20@mailout3.samsung.com>; Tue, 13 Nov 2012 17:49:20 +0900 (KST) X-AuditID: cbfee61b-b7f616d00000319b-86-50a2099024ce Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 34.F7.12699.09902A05; Tue, 13 Nov 2012 17:49:20 +0900 (KST) Received: from localhost.localdomain ([106.116.147.30]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MDF00J6B4HJLKA0@mmp2.samsung.com>; Tue, 13 Nov 2012 17:49:20 +0900 (KST) From: Marek Szyprowski To: linux-kernel@vger.kernel.org, linux-mmc@vger.kernel.org Cc: Marek Szyprowski , Kyungmin Park , Mark Brown , Liam Girdwood , Chris Ball Subject: [PATCH 2/3] regulator: threat regulators with constant volatage as fixed Date: Tue, 13 Nov 2012 09:48:52 +0100 Message-id: <1352796533-12350-3-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1352796533-12350-1-git-send-email-m.szyprowski@samsung.com> References: <1352796533-12350-1-git-send-email-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrMJMWRmVeSWpSXmKPExsVy+t9jQd0JnIsCDFr3Slpc3jWHzeLI/35G ByaPz5vkAhijuGxSUnMyy1KL9O0SuDJ2/ZrDXPCRreL9z8wGxqesXYwcHBICJhKv/up2MXIC mWISF+6tZ+ti5OIQEpjOKNH4cT8rhNPOJNG/5gMTSBWbgKFE19suNpBmEQFrib0LfUFqmAVO M0pMmrWdDaRGWCBY4sPnf+wgNSwCqhLfZrCChHkFPCSOLjnHCLFXQWLOJBuQMKeAp8Sq/kvM ILYQUMm65a+ZJjDyLmBkWMUomlqQXFCclJ5rpFecmFtcmpeul5yfu4kR7PVn0jsYVzVYHGIU 4GBU4uFVtFwYIMSaWFZcmXuIUYKDWUmE17weKMSbklhZlVqUH19UmpNafIhRmoNFSZy32SMl QEggPbEkNTs1tSC1CCbLxMEp1cDozZwu3BTInn+24/oDW9X5+nNeS4Yad/OcZnIJdetk+FF1 onhKBhvnUsa1W+Xfxy3K2GDlcvNCzHNZOb6OdTlLjMX2nF7Bct6xuP7Bgj1WB/+brJ1h7Ngm t3Zun2JD4+Fpu/oDzjRkc97aXjlN11NHa1uI+LPsN72Vx+ImsnNIPJrx5lL5tklKLMUZiYZa zEXFiQCcSRKy9gEAAA== Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org Some drivers has additional logic for fixed regulators. Let regulator core to threat regulators which cannot change their voltage due to applied constraints as fixed. Signed-off-by: Marek Szyprowski --- drivers/regulator/core.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index 042c1ff..271182e 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -1872,7 +1872,10 @@ int regulator_count_voltages(struct regulator *regulator) { struct regulator_dev *rdev = regulator->rdev; - return rdev->desc->n_voltages ? : -EINVAL; + if (rdev->constraints->valid_ops_mask & REGULATOR_CHANGE_VOLTAGE) + return rdev->desc->n_voltages ? : -EINVAL; + else + return 1; } EXPORT_SYMBOL_GPL(regulator_count_voltages);