From patchwork Fri Apr 5 04:21:47 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nishanth Menon X-Patchwork-Id: 2396571 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 E8FD0DF2E5 for ; Fri, 5 Apr 2013 04:22:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1161116Ab3DEEWE (ORCPT ); Fri, 5 Apr 2013 00:22:04 -0400 Received: from bear.ext.ti.com ([192.94.94.41]:44824 "EHLO bear.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1765499Ab3DEEWB (ORCPT ); Fri, 5 Apr 2013 00:22:01 -0400 Received: from dlelxv30.itg.ti.com ([172.17.2.17]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id r354Lt9x028891; Thu, 4 Apr 2013 23:21:55 -0500 Received: from DFLE73.ent.ti.com (dfle73.ent.ti.com [128.247.5.110]) by dlelxv30.itg.ti.com (8.13.8/8.13.8) with ESMTP id r354Lsv1008564; Thu, 4 Apr 2013 23:21:55 -0500 Received: from dlelxv22.itg.ti.com (172.17.1.197) by DFLE73.ent.ti.com (128.247.5.110) with Microsoft SMTP Server id 14.2.342.3; Thu, 4 Apr 2013 23:21:54 -0500 Received: from localhost (kahuna.am.dhcp.ti.com [128.247.75.12]) by dlelxv22.itg.ti.com (8.13.8/8.13.8) with ESMTP id r354Lsn4008072; Thu, 4 Apr 2013 23:21:54 -0500 From: Nishanth Menon To: , , CC: Liam Girdwood , Mark Brown , "Rafael J. Wysocki" , Viresh Kumar , Shawn Guo , Nishanth Menon Subject: [PATCH 1/2] regulator: core: return err value for regulator_get if there is no DT binding Date: Thu, 4 Apr 2013 23:21:47 -0500 Message-ID: <1365135708-23886-2-git-send-email-nm@ti.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1365135708-23886-1-git-send-email-nm@ti.com> References: <1365135708-23886-1-git-send-email-nm@ti.com> MIME-Version: 1.0 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org commit 6d191a5fc7a969d972f1681e1c23781aecb06a61 (regulator: core: Don't defer probe if there's no DT binding for a supply) Attempted to differentiate between regulator_get() with an actual DT binding for the supply and when there is none to avoid unnecessary deferal. In cases where a driver, such as cpufreq driver, need to handle (based on platform) DT nodes which may or may not have regulator supply binding, it is necessary to differentiate the return value. When there is regulator supply node, defering the probe is beneficial as sequence of dependent regulator probe may not be predictable. However, where is no regulator supply binding, it can operate without the same as needed. So, to provide an appropriate return result, when we cannot find an regulator in regulator_dev_lookup and we run out of options, use the regulator_dev_lookup result. This helps the caller to help make informed decision. Cc: Liam Girdwood Cc: Mark Brown Signed-off-by: Nishanth Menon --- drivers/regulator/core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index e3661c2..139d86a 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -1229,7 +1229,7 @@ static struct regulator *_regulator_get(struct device *dev, const char *id, struct regulator_dev *rdev; struct regulator *regulator = ERR_PTR(-EPROBE_DEFER); const char *devname = NULL; - int ret; + int ret = 0; if (id == NULL) { pr_err("get() with no identifier\n"); @@ -1266,7 +1266,7 @@ static struct regulator *_regulator_get(struct device *dev, const char *id, #endif mutex_unlock(®ulator_list_mutex); - return regulator; + return ret ? ERR_PTR(ret) : regulator; found: if (rdev->exclusive) {