Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp3692411ybv; Mon, 10 Feb 2020 04:48:56 -0800 (PST) X-Google-Smtp-Source: APXvYqyEl4bpTZ/TcwAkt7PYfA39urlAn9n2t7IW6BbsjPzALb+OOLMRjswR7C5ObCsWghZxDssm X-Received: by 2002:a9d:7f12:: with SMTP id j18mr973736otq.17.1581338936648; Mon, 10 Feb 2020 04:48:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581338936; cv=none; d=google.com; s=arc-20160816; b=Zlmi0eadejCN0zCDrs1P0g/DC2vt8fB1kRxdm1O2LyZogtRuxcaTwP3JdkF/nT14AF /MUGrdDGAkc+zMDQFW9xnG5G+6q6AK9nH+vFKhdW5hclm4N0E3emARlzUjuENfAU66FQ JA8huuaqg4jJYbMuBKBcRTA9zb/C1irr1aUY3X0P/61F6I+orACdNz13WN5RxMqFbPY4 cLUliTeYCOL6DSTNw0QAewwOSIJJfQG3MEKTbUaQANk8YDY2lBizXvFZ/4PyeeiBwICH QaRSxQK+VLEpLbIIRDv6+IF1pIuvqXOC+LFl109LPIWHgzWl76yBXDA5DtLk+LQExxnV iyxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=CSBO3Kq3lEFjot6PjE1d0povHGeYo6w3eVPsPzfCSK0=; b=YxnEKl8HDxOzfjqijeI2qy72Em9u9W3fPzve/oy1K5+80xOjZR6ndg6XZkSG2yEd4X JUAuGg+lPdNa1jbfnQEkgBTPe+bVnsRbzY6nlIzp2XWPVY2j0Iv8bJFS7V3NXqMS3ggG lDeU8qt3vdK+4gLYQDGszHyfgegbHhTlDfVq+DFq4NTcLR9E8pHWEtsUCkxIE0QSLiCQ ohU6oNin4gyVLAus8RqnWgoa/gtHB9M8tjmWzb8ACHZuPCfvhEvhcOj6c58rgQ72swkF /k8xxwDuIVAe9eWajZ3BLof3Tz8q6SYTT1gDCyUgBd4yM8he9G9g6DNlphsb0acZ0GIL 9iKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=H7OqyRsR; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s22si158791otq.100.2020.02.10.04.48.45; Mon, 10 Feb 2020 04:48:56 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=H7OqyRsR; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730886AbgBJMqm (ORCPT + 99 others); Mon, 10 Feb 2020 07:46:42 -0500 Received: from mail.kernel.org ([198.145.29.99]:44720 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730063AbgBJMlq (ORCPT ); Mon, 10 Feb 2020 07:41:46 -0500 Received: from localhost (unknown [209.37.97.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A6EC62080C; Mon, 10 Feb 2020 12:41:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1581338505; bh=kIFTEBfA3dx7yd2p+vy1SVGpsCsAblpfc3uwi/4hlZU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=H7OqyRsRM9t6/mzuGBp2lHZdxnd5sXHdWjkAXY1mCWoWv/x/TRPYlUR8enMB3TJYK paHE0KvsXU0ILlYBAjioVm/oCJfgfImZ3KJWuNwmWafXTcvwrJNjsoTmRaeR1d182Z CD7wYRUD17MJvmKKbVnmbijNcIezQQ+tLdkpGuXo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marek Vasut , Fabio Estevam , Igor Opaniuk , Liam Girdwood , Marcel Ziswiler , Mark Brown , Oleksandr Suvorov Subject: [PATCH 5.5 306/367] regulator: core: Add regulator_is_equal() helper Date: Mon, 10 Feb 2020 04:33:39 -0800 Message-Id: <20200210122451.675961231@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200210122423.695146547@linuxfoundation.org> References: <20200210122423.695146547@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Marek Vasut commit b059b7e0ec3208ff1e17cff6387d75a9fbab4e02 upstream. Add regulator_is_equal() helper to compare whether two regulators are the same. This is useful for checking whether two separate regulators in a driver are actually the same supply. Signed-off-by: Marek Vasut Cc: Fabio Estevam Cc: Igor Opaniuk Cc: Liam Girdwood Cc: Marcel Ziswiler Cc: Mark Brown Cc: Oleksandr Suvorov Link: https://lore.kernel.org/r/20191220164450.1395038-1-marex@denx.de Signed-off-by: Mark Brown Signed-off-by: Greg Kroah-Hartman --- drivers/regulator/helpers.c | 14 ++++++++++++++ include/linux/regulator/consumer.h | 7 +++++++ 2 files changed, 21 insertions(+) --- a/drivers/regulator/helpers.c +++ b/drivers/regulator/helpers.c @@ -13,6 +13,8 @@ #include #include +#include "internal.h" + /** * regulator_is_enabled_regmap - standard is_enabled() for regmap users * @@ -881,3 +883,15 @@ void regulator_bulk_set_supply_names(str consumers[i].supply = supply_names[i]; } EXPORT_SYMBOL_GPL(regulator_bulk_set_supply_names); + +/** + * regulator_is_equal - test whether two regulators are the same + * + * @reg1: first regulator to operate on + * @reg2: second regulator to operate on + */ +bool regulator_is_equal(struct regulator *reg1, struct regulator *reg2) +{ + return reg1->rdev == reg2->rdev; +} +EXPORT_SYMBOL_GPL(regulator_is_equal); --- a/include/linux/regulator/consumer.h +++ b/include/linux/regulator/consumer.h @@ -287,6 +287,8 @@ void regulator_bulk_set_supply_names(str const char *const *supply_names, unsigned int num_supplies); +bool regulator_is_equal(struct regulator *reg1, struct regulator *reg2); + #else /* @@ -593,6 +595,11 @@ regulator_bulk_set_supply_names(struct r { } +static inline bool +regulator_is_equal(struct regulator *reg1, struct regulator *reg2); +{ + return false; +} #endif static inline int regulator_set_voltage_triplet(struct regulator *regulator,