From patchwork Mon Jan 7 05:38:50 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Liu X-Patchwork-Id: 1939751 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 43A79DF230 for ; Mon, 7 Jan 2013 05:39:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750865Ab3AGFjo (ORCPT ); Mon, 7 Jan 2013 00:39:44 -0500 Received: from na3sys009aog118.obsmtp.com ([74.125.149.244]:52586 "EHLO na3sys009aog118.obsmtp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750776Ab3AGFjo (ORCPT ); Mon, 7 Jan 2013 00:39:44 -0500 Received: from MSI-MTA.marvell.com ([65.219.4.132]) (using TLSv1) by na3sys009aob118.postini.com ([74.125.148.12]) with SMTP ID DSNKUOpfjoMns7sH7k4QQVvSerGeoAoIdEf3@postini.com; Sun, 06 Jan 2013 21:39:43 PST Received: from maili.marvell.com ([10.68.76.210]) by MSI-MTA.marvell.com with Microsoft SMTPSVC(6.0.3790.4675); Sun, 6 Jan 2013 21:39:26 -0800 Received: from kliu5-desktop.marvell.com (unknown [10.38.36.240]) by maili.marvell.com (Postfix) with ESMTP id A6B574E510; Sun, 6 Jan 2013 21:39:24 -0800 (PST) From: Kevin Liu To: linux-pm@vger.kernel.org, Mark Brown , linux-mmc@vger.kernel.org, Chris Ball Cc: Marek Szyprowski , Rainer Kaluscha , Rainer Kaluscha , Philip Rakity , Zhangfei Gao , Haojian Zhuang , Chao Xie , Kevin Liu , Kevin Liu Subject: [PATCH 1/2] regulator: add regulator_is_dummy function Date: Mon, 7 Jan 2013 13:38:50 +0800 Message-Id: <1357537131-8000-1-git-send-email-kliu5@marvell.com> X-Mailer: git-send-email 1.7.9.5 X-OriginalArrivalTime: 07 Jan 2013 05:39:26.0509 (UTC) FILETIME=[5B0925D0:01CDEC99] Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Introduce a regulator_is_dummy function to check whether the regulator is dummy. Signed-off-by: Kevin Liu --- drivers/regulator/core.c | 17 +++++++++++++++++ include/linux/regulator/consumer.h | 6 ++++++ 2 files changed, 23 insertions(+) diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index e872c8b..d2a8bdb 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -1826,6 +1826,23 @@ int regulator_disable_regmap(struct regulator_dev *rdev) } EXPORT_SYMBOL_GPL(regulator_disable_regmap); +/** + * regulator_is_dummy - check if regulator is dummy + * @regulator: regulator source + * + * Returns positive if the regulator is dummy, zero if it's not. + */ +int regulator_is_dummy(struct regulator *regulator) +{ + struct regulator_dev *rdev = regulator->rdev; + + if (!strcmp(rdev_get_name(rdev), "regulator-dummy")) + return 1; + else + return 0; +} +EXPORT_SYMBOL_GPL(regulator_is_dummy); + static int _regulator_is_enabled(struct regulator_dev *rdev) { /* A GPIO control always takes precedence */ diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h index c43cd35..fe549d0 100644 --- a/include/linux/regulator/consumer.h +++ b/include/linux/regulator/consumer.h @@ -164,6 +164,7 @@ int regulator_count_voltages(struct regulator *regulator); int regulator_list_voltage(struct regulator *regulator, unsigned selector); int regulator_is_supported_voltage(struct regulator *regulator, int min_uV, int max_uV); +int regulator_is_dummy(struct regulator *regulator); int regulator_set_voltage(struct regulator *regulator, int min_uV, int max_uV); int regulator_set_voltage_time(struct regulator *regulator, int old_uV, int new_uV); @@ -249,6 +250,11 @@ static inline int regulator_is_enabled(struct regulator *regulator) return 1; } +static inline int regulator_is_dummy(struct regulator *regulator) +{ + return 0; +} + static inline int regulator_bulk_get(struct device *dev, int num_consumers, struct regulator_bulk_data *consumers)