Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752119AbdFLPQn (ORCPT ); Mon, 12 Jun 2017 11:16:43 -0400 Received: from mx0a-001ae601.pphosted.com ([67.231.149.25]:58126 "EHLO mx0b-001ae601.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751331AbdFLPQm (ORCPT ); Mon, 12 Jun 2017 11:16:42 -0400 Authentication-Results: ppops.net; spf=none smtp.mailfrom=ckeepax@opensource.wolfsonmicro.com From: Charles Keepax To: CC: , , Subject: [PATCH] regulator: core: Prioritise consumer mappings over regulator name Date: Mon, 12 Jun 2017 16:17:52 +0100 Message-ID: <1497280672-24011-1-git-send-email-ckeepax@opensource.wolfsonmicro.com> X-Mailer: git-send-email 2.1.4 MIME-Version: 1.0 Content-Type: text/plain X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1703280000 definitions=main-1706120264 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1126 Lines: 31 Currently, when looking up a regulator supply, the regulator name takes priority over the consumer mappings. As there are a lot of regulator names that are in fairly common use (VDD, MICVDD, etc.) this can easily lead to obtaining the wrong supply, when a system contains two regulators that share a name. The explicit consumer mappings contain much less ambiguity as they specify both a name and a consumer device. As such prioritise those if one exists and only fall back to the regulator name if there are no matching explicit mappings. Signed-off-by: Charles Keepax --- drivers/regulator/core.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index 919b7f1..d257952 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -1490,8 +1490,6 @@ static struct regulator_dev *regulator_dev_lookup(struct device *dev, devname = dev_name(dev); r = regulator_lookup_by_name(supply); - if (r) - return r; mutex_lock(®ulator_list_mutex); list_for_each_entry(map, ®ulator_map_list, list) { -- 2.1.4