Received: by 2002:ac0:a591:0:0:0:0:0 with SMTP id m17-v6csp903879imm; Thu, 5 Jul 2018 10:57:24 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdwdBwQOFGfUbMUa3l4fFCpGue2L0XlRjmTi9l1NCYJe0ebSdXRFk+x8oKr7OjXikeJD/i/ X-Received: by 2002:a63:943:: with SMTP id 64-v6mr6429543pgj.368.1530813444559; Thu, 05 Jul 2018 10:57:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530813444; cv=none; d=google.com; s=arc-20160816; b=jlqpQE9Dtws4NABXsvY60UaYpdgLDJnFdF5Zg6DDhgekxO+UTubccTtsPNMC7ZmJsL 8XyP/hZ6uD43GqqarDIOJDZBzDmRhm0zMhTKfET/FGHjjF0du4e+GksSBqI8zEU1k9R2 xXmgPgyeqtmD7iFsV466RenxngUHlmIsxXQvHlrD4cDZb+zb2E4c9YC8w30iNOG+hOdc Yzv4eTroohLY0pbj8cUhFTTMn1DrPNXL+WBloRzTh+o/XjESrXfUlrKmeMe4jPoiSTji WfakiJZQ3RF+xJni633gbI9gUhldwNNnFYbGMRG/qx3bjOeH6N696HpWPXPBPqXGsOI/ x1aA== 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=bhrgxEVFKj6TQwBDaJNt9819/R+HTLCKfLNY4s4oVLA=; b=gd6LY9NwSz8uS9WbvrJ0dqKzcC8+Kwcmmb8G7r8qQ0O2SMEJ6PDu4mGQEUg16F/KAo qw9yAHCMVW45jbolgmwA+17MSEnS0pPokT9AIvxEUFsxjsPJK0D9aOUh2+a0MugpJHNB kzcaz30OKXmGvDk3ZWl2ok9JgWGZBPlRzHa44HgrTLePBW0Rdvd0ivknXLdeJLV4KwZD kCNmyk2/bR4LHSRPTjXUuM1Fj6QdpqdJk4tQA6Zlm1N1tdZeGL/ZweTih+aNj+Rl2eb9 6RL174DQWzZzD2CuGNYW9Dza1tXh4I0AETYvIBBCcQQKMdofB8UQhLh+udeZ2IUacCqe DUNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=QF1OGan1; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 69-v6si6356441pla.288.2018.07.05.10.57.10; Thu, 05 Jul 2018 10:57:24 -0700 (PDT) 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=QF1OGan1; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753839AbeGER4c (ORCPT + 99 others); Thu, 5 Jul 2018 13:56:32 -0400 Received: from heliosphere.sirena.org.uk ([172.104.155.198]:55892 "EHLO heliosphere.sirena.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753451AbeGERzo (ORCPT ); Thu, 5 Jul 2018 13:55:44 -0400 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=bhrgxEVFKj6TQwBDaJNt9819/R+HTLCKfLNY4s4oVLA=; b=QF1OGan1uvWm cxzTfSqems6WGadg/o2ZD7Z2MkO8DyHdFEuZ9gBfKnzWgxDR9m6TstbHuKi6ZdifVPRMvDHDWUVVC 9hhqfKUo/1GyIUjAufYlbbn1EkseB8ZPVXCkkumngQatC2cH18CskL7yh+r6sMRAEknf7qWrCLNTK XuN+M=; 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 1fb8Tl-00012K-DP; Thu, 05 Jul 2018 17:55:41 +0000 Received: from broonie by debutante with local (Exim 4.91) (envelope-from ) id 1fb8Tk-00027d-W7; Thu, 05 Jul 2018 18:55:41 +0100 From: Mark Brown To: pascal paillet Cc: Greg Kroah-Hartman , Mark Brown , "gregkh@linuxfoundation.org" , "lgirdwood@gmail.com" , "broonie@kernel.org" , "linux-kernel@vger.kernel.org" , "benjamin.gaignard@linaro.org" , Pascal PAILLET-LME , linux-kernel@vger.kernel.org Subject: Applied "driver core: Add device_link_remove function" to the regulator tree In-Reply-To: <1530800748-7300-2-git-send-email-p.paillet@st.com> Message-Id: Date: Thu, 05 Jul 2018 18:55:40 +0100 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The patch driver core: Add device_link_remove function 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 d8842211b6f63d3f069df973d137de0a85964965 Mon Sep 17 00:00:00 2001 From: pascal paillet Date: Thu, 5 Jul 2018 14:25:56 +0000 Subject: [PATCH] driver core: Add device_link_remove function Device_link_remove uses the same arguments than device_link_add. The Goal is to avoid storing the link pointer. Signed-off-by: pascal paillet Acked-by: Greg Kroah-Hartman Signed-off-by: Mark Brown --- drivers/base/core.c | 30 ++++++++++++++++++++++++++++++ include/linux/device.h | 1 + 2 files changed, 31 insertions(+) diff --git a/drivers/base/core.c b/drivers/base/core.c index 36622b52e419..3b380b1f2768 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -365,6 +365,36 @@ void device_link_del(struct device_link *link) } EXPORT_SYMBOL_GPL(device_link_del); +/** + * device_link_remove - remove a link between two devices. + * @consumer: Consumer end of the link. + * @supplier: Supplier end of the link. + * + * The caller must ensure proper synchronization of this function with runtime + * PM. + */ +void device_link_remove(void *consumer, struct device *supplier) +{ + struct device_link *link; + + if (WARN_ON(consumer == supplier)) + return; + + device_links_write_lock(); + device_pm_lock(); + + list_for_each_entry(link, &supplier->links.consumers, s_node) { + if (link->consumer == consumer) { + kref_put(&link->kref, __device_link_del); + break; + } + } + + device_pm_unlock(); + device_links_write_unlock(); +} +EXPORT_SYMBOL_GPL(device_link_remove); + static void device_links_missing_supplier(struct device *dev) { struct device_link *link; diff --git a/include/linux/device.h b/include/linux/device.h index 055a69dbcd18..9c1c3b1d5e11 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -1316,6 +1316,7 @@ extern const char *dev_driver_string(const struct device *dev); struct device_link *device_link_add(struct device *consumer, struct device *supplier, u32 flags); void device_link_del(struct device_link *link); +void device_link_remove(void *consumer, struct device *supplier); #ifdef CONFIG_PRINTK -- 2.18.0.rc2