Received: by 10.213.65.68 with SMTP id h4csp838064imn; Wed, 14 Mar 2018 01:18:49 -0700 (PDT) X-Google-Smtp-Source: AG47ELshoaS9xWq4iuXtJCn4k8PqBxFp34HbzrYofg50bIN91cSlLJXTHy47CkaxuxnlIGGXcWhS X-Received: by 10.99.160.67 with SMTP id u3mr2867069pgn.389.1521015529262; Wed, 14 Mar 2018 01:18:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521015529; cv=none; d=google.com; s=arc-20160816; b=P56+st200DUu3cEcOg/pRLHO8uNL/zwjp3Cdopqgt9FAPC+0zYH6A3hYIvcGr3zZHB hVt45zf7QT2DNAJnikccvdZlDkKqDaiTC11sbniZQ7vkcFBqaQemeWK1Y9b/UQq66YpM d3jv7SkrSYxPrCBm4N4cRE5pqY4S3qPNPFOymHx8x5B80GOg+OqLRwt8QpfnaKsrcImn 5CbaJuYp3fPSnGzppYYvK4PE/Qv5eD5yNwtgaXUSG9OsVX2kTfLeedpmNQMGw6YkVZF1 s8thBCDWFZbqJNh0B/63ECYx2xCFquP3LGTwx86hkYPdvbfop0aBJzqy3QN+tYhtu5BU S9zQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dmarc-filter:dkim-signature:dkim-signature :arc-authentication-results; bh=WQQhrEkCFK5SHmrPcbivXwpvGku7c2x6HG+Kmz2fnyA=; b=MSyxiw7LFDoXGYJf3WBuRvVjE7ICqzfTSdbehNrNZaoZu2uwnxNmiOQqZ6VWLbF0Xe IPGo30vrNsodKX4G+jfXfu2Jt9fzKUM9AQNDJ+Wlo46mM3p0UsGVhcmkZ9IhQ/IOxZXn w7Tvs2b26Ro/28oe3ZTrnRKIijijvgw0s/8RGyzP9ghhVNsBF+gejLLSEKOqNi1dPSJE 74FPLwLlcct6JEH6Nm9J56wBeCbmUK8o1LLnMJP+VfNBT/fYuurED1gvVaBKkX0dducx 55D4qPnTyV6LR7t7nvTc4Sc9feqF9pyV8dCU/e0B7nST8TafC0hRac4Pe7prgLiknLli HNvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=lcQjhQ92; dkim=pass header.i=@codeaurora.org header.s=default header.b=oD965LhM; 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 e16si1466630pgq.596.2018.03.14.01.18.34; Wed, 14 Mar 2018 01:18:49 -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=pass header.i=@codeaurora.org header.s=default header.b=lcQjhQ92; dkim=pass header.i=@codeaurora.org header.s=default header.b=oD965LhM; 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 S1753609AbeCNIQu (ORCPT + 99 others); Wed, 14 Mar 2018 04:16:50 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:60830 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752594AbeCNIO7 (ORCPT ); Wed, 14 Mar 2018 04:14:59 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 7AD1360851; Wed, 14 Mar 2018 08:14:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1521015298; bh=sk5Pnj+Bibytm9zhc1hok6XG+O/7hZH9vHIAVKIjWHs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lcQjhQ925AH7bYgwlGfsgWJtAYaJ4BrSRVEYp7G6guGT+XxfbmZUHJgISFg9H3eP3 L3pCDARmLDjGKaSkoZq4NJ/k4IBvdx/EyZKPY6rn2+RZTA1kn84gfvLZLuQ2t3kNIa jSponr8Teasw/0QTDz1ZyRayZNgsMS3k6i9LFOwg= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0 Received: from blr-ubuntu-41.ap.qualcomm.com (blr-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.18.19]) (using TLSv1.1 with cipher ECDHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: vivek.gautam@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 787C960592; Wed, 14 Mar 2018 08:14:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1521015296; bh=sk5Pnj+Bibytm9zhc1hok6XG+O/7hZH9vHIAVKIjWHs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oD965LhMWmGpTolWtuGQHMnq4J5gNHEapfL3jPugt+3O/ap9lbdVS7nZGZYRxU6PH DR/sSCiU0FFiJQ/5y7LwUShdwVLeFq1R5U/XKdyu79p490iJ7nSYtJMSjdwMWWHgFn 66bdCLmqBEb8bZOx4gUqd1z/NJH/hDwRJus2DtBo= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 787C960592 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=vivek.gautam@codeaurora.org From: Vivek Gautam To: joro@8bytes.org, robh+dt@kernel.org, rafael.j.wysocki@intel.com, robin.murphy@arm.com, iommu@lists.linux-foundation.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Cc: mark.rutland@arm.com, will.deacon@arm.com, robdclark@gmail.com, tfiga@chromium.org, sricharan@codeaurora.org, m.szyprowski@samsung.com, architt@codeaurora.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, vivek.gautam@codeaurora.org, "Rafael J . Wysocki" , Greg Kroah-Hartman Subject: [PATCH v10 1/5] driver core: Delete the link between two given devices Date: Wed, 14 Mar 2018 13:44:30 +0530 Message-Id: <20180314081434.30875-2-vivek.gautam@codeaurora.org> X-Mailer: git-send-email 2.16.1.72.g5be1f00a9a70 In-Reply-To: <20180314081434.30875-1-vivek.gautam@codeaurora.org> References: <20180314081434.30875-1-vivek.gautam@codeaurora.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Given the consumer and supplier devices, add an API to delete the link between them. Suggested-by: Tomasz Figa Signed-off-by: Vivek Gautam Cc: Rafael J. Wysocki Cc: Greg Kroah-Hartman --- - This patch replaces an earlier patch [1] that was adding device_link_find() API. [1] https://patchwork.kernel.org/patch/10277975/ drivers/base/core.c | 31 +++++++++++++++++++++++++++++++ include/linux/device.h | 1 + 2 files changed, 32 insertions(+) diff --git a/drivers/base/core.c b/drivers/base/core.c index 5847364f25d9..e13d904e1e12 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -336,6 +336,37 @@ void device_link_del(struct device_link *link) } EXPORT_SYMBOL_GPL(device_link_del); +/** + * device_link_del_dev - Delete a link between two given 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_del_dev(struct device *consumer, struct device *supplier) +{ + struct device_link *link; + + if (!consumer || !supplier) + return; + + device_links_write_lock(); + device_pm_lock(); + + list_for_each_entry(link, &supplier->links.consumers, s_node) { + if (link->consumer == consumer) { + __device_link_del(link); + /* just one link between the devices */ + break; + } + } + + device_pm_unlock(); + device_links_write_unlock(); +} +EXPORT_SYMBOL_GPL(device_link_del_dev); + 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 b093405ed525..14508d843f67 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -1278,6 +1278,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_del_dev(struct device *consumer, struct device *supplier); #ifdef CONFIG_PRINTK -- QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation