Received: by 10.223.176.46 with SMTP id f43csp966040wra; Fri, 26 Jan 2018 09:37:18 -0800 (PST) X-Google-Smtp-Source: AH8x224x6h+VYR5CiTw1h4e4oXT4xcd0OIPAk6ha9zgKt3mr3dXEAC2P9nXO93DOKZQgSh/zpsrs X-Received: by 10.101.97.209 with SMTP id j17mr13660358pgv.266.1516988238774; Fri, 26 Jan 2018 09:37:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516988238; cv=none; d=google.com; s=arc-20160816; b=Uq34bxOFlexp2+dQc4g0CPW5zu/bi+dvPo+SduJPk2TW9fuI2tUra1t6XS9W4GpbLb 91Jfba8ekk1tszs6ixY3v+EVJKFWz8RtWtYMVq/87H0zcU7NVgwinZTG409QJoHN4b3l 0WtwMX4hSS6kyrxPWjCFM1A/NdMbQei4eDb8ejlLIvtMC6j6uZh5/xrLoBkdmSIvu2D0 ZSJiGyQQmWAcGyFDwLhDn3/kpNWY1r/Gmbx8esYFOg5FkN/rRP1ZxBZwf/zS9LriPeBe 0kv5XHggI+2y8yjTK99K1F1lfnDIiEKec3DIronXU7EtTu8Gf9S2/IqtJpoibh40h8vU sPQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:message-id:in-reply-to:subject:cc:to :from:dkim-signature:arc-authentication-results; bh=HDQELDcaFQPdzGPqtQb6OG/5OEsQHGoujKaWpCoS9ak=; b=xAHqLUlGJat/rC6UbchWFjjLhqlkoiuubdQZX7vNVQ7G6yxYe0FMXE8yie+jsaO3va iWw6+onmJhbkESlVnXXCNYMIgac2QCZx9TXLmF6vxJX31Q+3VpVR6gC2j+j1/UzWB/uQ nYBfC2mV8jqKdmkXSzILJ7AV40viYGC7g9AJxZCDrmEnCMpMmG44SzpTfcwW7IL7rtn4 UdraJ3csPgY6FNbJDy+ouPYrKAjn41TayuVQ9szTK1fks+kMK0mAPZsgd48d4p/hQTA7 QrILS2Icoz4w9pw617EE/+/dF3I7hC4pdDsd33CDqFL6nnBnsCH03jMiOEMjeGMO0Xu/ QYVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=LbRisbwE; 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 x10-v6si4011518pln.30.2018.01.26.09.37.04; Fri, 26 Jan 2018 09:37:18 -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=fail header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=LbRisbwE; 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 S1752215AbeAZRf6 (ORCPT + 99 others); Fri, 26 Jan 2018 12:35:58 -0500 Received: from heliosphere.sirena.org.uk ([172.104.155.198]:59156 "EHLO heliosphere.sirena.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751746AbeAZRfw (ORCPT ); Fri, 26 Jan 2018 12:35:52 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sirena.org.uk; s=20170815-heliosphere; h=Date:Message-Id:In-Reply-To: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:References: List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner: List-Archive; bh=HDQELDcaFQPdzGPqtQb6OG/5OEsQHGoujKaWpCoS9ak=; b=LbRisbwEf6eC 1ZSMlcN6EdLh7mqxRPa/paeQU4g09DoBWH3jo2DlARcfbFaALTBmAdnf1uemY58wRqDwTSdXsK3/W 0JA8t4bgynA6NAOjIWr8eGwe3zYXYF5BKaQmzk27g7985c7DdCBQVSyU9SAg7QWjhWSrHhADUiB57 XEnJY=; Received: from debutante.sirena.org.uk ([2001:470:1f1d:6b5::3] helo=debutante) by heliosphere.sirena.org.uk with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1ef7um-0007Qg-PR; Fri, 26 Jan 2018 17:35:48 +0000 Received: from broonie by debutante with local (Exim 4.90) (envelope-from ) id 1ef7um-0002dM-Ah; Fri, 26 Jan 2018 17:35:48 +0000 From: Mark Brown To: Maciej Purski Cc: Mark Brown , Mark Brown , linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Liam Girdwood , Rob Herring , Mark Rutland , Marek Szyprowski , Bartlomiej Zolnierkiewicz , linux-kernel@vger.kernel.org Subject: Applied "regulator: core: Move of_find_regulator_by_node() to of_regulator.c" to the regulator tree In-Reply-To: <1512639975-22241-2-git-send-email-m.purski@samsung.com> Message-Id: Date: Fri, 26 Jan 2018 17:35:48 +0000 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The patch regulator: core: Move of_find_regulator_by_node() to of_regulator.c has been applied to the regulator tree at https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted. You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed. If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced. Please add any relevant lists and maintainers to the CCs when replying to this mail. Thanks, Mark From 148096af0bf381c78afe253c07ef1c77778f0e68 Mon Sep 17 00:00:00 2001 From: Maciej Purski Date: Mon, 22 Jan 2018 15:30:06 +0100 Subject: [PATCH] regulator: core: Move of_find_regulator_by_node() to of_regulator.c As of_find_regulator_by_node() is an of function it should be moved from core.c to of_regulator.c. It provides better separation of device tree functions from the core and allows other of_functions in of_regulator.c to resolve device_node to regulator_dev. This will be useful for implementation of parsing coupled regulators properties. Declare of_find_regulator_by_node() function in internal.h as well as regulator_class and dev_to_rdev(), as they are needed by of_find_regulator_by_node(). Signed-off-by: Maciej Purski Signed-off-by: Mark Brown --- drivers/regulator/core.c | 23 +---------------------- drivers/regulator/internal.h | 9 +++++++++ drivers/regulator/of_regulator.c | 14 ++++++++++++++ 3 files changed, 24 insertions(+), 22 deletions(-) diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index 365b32e3f505..5f7678292cef 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -58,8 +58,6 @@ static bool has_full_constraints; static struct dentry *debugfs_root; -static struct class regulator_class; - /* * struct regulator_map * @@ -112,11 +110,6 @@ static struct regulator *create_regulator(struct regulator_dev *rdev, const char *supply_name); static void _regulator_put(struct regulator *regulator); -static struct regulator_dev *dev_to_rdev(struct device *dev) -{ - return container_of(dev, struct regulator_dev, dev); -} - static const char *rdev_get_name(struct regulator_dev *rdev) { if (rdev->constraints && rdev->constraints->name) @@ -1417,20 +1410,6 @@ static void regulator_supply_alias(struct device **dev, const char **supply) } } -static int of_node_match(struct device *dev, const void *data) -{ - return dev->of_node == data; -} - -static struct regulator_dev *of_find_regulator_by_node(struct device_node *np) -{ - struct device *dev; - - dev = class_find_device(®ulator_class, NULL, np, of_node_match); - - return dev ? dev_to_rdev(dev) : NULL; -} - static int regulator_match(struct device *dev, const void *data) { struct regulator_dev *r = dev_to_rdev(dev); @@ -3918,7 +3897,7 @@ static void regulator_dev_release(struct device *dev) kfree(rdev); } -static struct class regulator_class = { +struct class regulator_class = { .name = "regulator", .dev_release = regulator_dev_release, .dev_groups = regulator_dev_groups, diff --git a/drivers/regulator/internal.h b/drivers/regulator/internal.h index 66a8ea0c8386..2f3218be5b8d 100644 --- a/drivers/regulator/internal.h +++ b/drivers/regulator/internal.h @@ -35,6 +35,15 @@ struct regulator { struct dentry *debugfs; }; +extern struct class regulator_class; + +static inline struct regulator_dev *dev_to_rdev(struct device *dev) +{ + return container_of(dev, struct regulator_dev, dev); +} + +struct regulator_dev *of_find_regulator_by_node(struct device_node *np); + #ifdef CONFIG_OF struct regulator_init_data *regulator_of_get_init_data(struct device *dev, const struct regulator_desc *desc, diff --git a/drivers/regulator/of_regulator.c b/drivers/regulator/of_regulator.c index 14637a01ba2d..54e810ae93d6 100644 --- a/drivers/regulator/of_regulator.c +++ b/drivers/regulator/of_regulator.c @@ -376,3 +376,17 @@ struct regulator_init_data *regulator_of_get_init_data(struct device *dev, return init_data; } + +static int of_node_match(struct device *dev, const void *data) +{ + return dev->of_node == data; +} + +struct regulator_dev *of_find_regulator_by_node(struct device_node *np) +{ + struct device *dev; + + dev = class_find_device(®ulator_class, NULL, np, of_node_match); + + return dev ? dev_to_rdev(dev) : NULL; +} -- 2.15.1