Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1467008imm; Thu, 12 Jul 2018 02:20:32 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeE1TK3jYyEMKpiLBDwU12xgAV0RMbXXJ9fou4GALxsHATLXikmWX0W1RiGwOy+4nOf0Bdo X-Received: by 2002:a62:cd3:: with SMTP id 80-v6mr1557567pfm.184.1531387232571; Thu, 12 Jul 2018 02:20:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531387232; cv=none; d=google.com; s=arc-20160816; b=BLyFkeEkSc0TDi0YAjYHjln0sFImMpWAUsSNZX2LLXYs+I56g63CVeWwVrv7tsI/Do akxFhOBSmby0wobBoQSqeYDsTW/PisBbnYD1IBqmohuuCv8lkOv07WauoJbUCHaXekQ6 VG8LuHnjMD4M5Vv1mhI8zmxmNuLkYZkIaGM3bQGhslbrPEPKK5q1HoqTvU91GsvWGSfz 7s/QhJNg1OaPEfUpIJyzBJzxkc/yVMHAJgILanw25SjLUGJh1XzD8FIQ96bV/ELy87oP NCvfW2Ojz++WZCzvfSjX+k52EPTFSYHjDceaAujpcmEnLlZ8tDetHm6G5Bu1BKx61+Oo 9tLQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=8d2pqce4j5baClWobMhZqT/ca+p1xkkv1IBlL5vI47Y=; b=GsKR6auTdWlnY2JR3LSHSLbXmtLNkONbeohhqBluDSSE4cUCEefngYQ4NzazYHJ6ts HjkyRtLen45fcJWB+CcrI4cs9NdsRjHtgPlVoSGPfaB2mC+7xMKwzfUFx1+RsbPMeiFO h4KGgkQSSU8aiL3cegoQSw8wSsDyk0UIEMA9oLLi1JpPSti4q/K++CuyGNY/oFHlL6md i8SpKBDQQ75nv55upU9u4el1V0Lh8iXLwQHoSRT/bvIxF2IBllTVOyhR29b5WShMwbLa A7btfgWnfvyYZU2rhKmp88zAHg6290u4Mco2plBieYLkTRGwDXh/Ri8bLwKRqTrFpbTv Xtsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=k3vP+WzO; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o33-v6si20749802plb.432.2018.07.12.02.20.15; Thu, 12 Jul 2018 02:20:32 -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=@linaro.org header.s=google header.b=k3vP+WzO; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732340AbeGLJ1J (ORCPT + 99 others); Thu, 12 Jul 2018 05:27:09 -0400 Received: from mail-oi0-f66.google.com ([209.85.218.66]:33726 "EHLO mail-oi0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732250AbeGLJ1J (ORCPT ); Thu, 12 Jul 2018 05:27:09 -0400 Received: by mail-oi0-f66.google.com with SMTP id l10-v6so7822777oii.0 for ; Thu, 12 Jul 2018 02:18:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=8d2pqce4j5baClWobMhZqT/ca+p1xkkv1IBlL5vI47Y=; b=k3vP+WzOWe+NgH0Khiut0oGQxQ0KVt68UfkkJUSUfelAHwxZRsPYWMiBrvZI1QHlXe 7nAMLJJ9gjLQjylU+Yr/hfwsRrUORgNpXsiO87F85jSme1T4c46hgGWTS5qf4bjEqCIY smwGGnD5VzBzq2XV7WD48a0PCM+7F/aF/DXmY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=8d2pqce4j5baClWobMhZqT/ca+p1xkkv1IBlL5vI47Y=; b=o27nOPQPLaoZvU89jxnOu0TdnzuixLqVMg1o6sCEPRuGdUTw6VcunLylRunA37+x0p Z+0gmmMzM5cArzYnm6duyeGixDHPEsrlcsmty1mgWx/TWKaRR+XmhGyX3HrMlD6qMgXg iyAVi4PmUrG23OjCLTEDGRIy+HXtPyow794/73JKilaBdfYUj8Ll9KDQGmXvHSQHkl0g oEMFCjdQwf60ZyqrdLD8b3FRyL1SDi9CF83B5fZVIKWcPv5F4PBWc/BN7yRNkm3czr/n pU3zt9hnV62vesUmK4ZI5uA/OHZW2E053fQfKkSWUkK21AQHfotvOX6KVGuR73zFIMXL Nc1w== X-Gm-Message-State: AOUpUlFyZzQo7HSD8D14364m+MxFTknKbfMNOsYG8B0wQNbet2NjFqCo XtJpWC+vd+oKPLKOkxg/sEfDYU/XZ63ixHw/FiCG4w== X-Received: by 2002:aca:f401:: with SMTP id s1-v6mr1494193oih.269.1531387106583; Thu, 12 Jul 2018 02:18:26 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a9d:192d:0:0:0:0:0 with HTTP; Thu, 12 Jul 2018 02:18:26 -0700 (PDT) In-Reply-To: <20180712085501.GA25313@kroah.com> References: <20180712080623.21203-1-benjamin.gaignard@st.com> <20180712085501.GA25313@kroah.com> From: Benjamin Gaignard Date: Thu, 12 Jul 2018 11:18:26 +0200 Message-ID: Subject: Re: [PATCH] base: core: Remove WARN_ON from link dependencies check To: Greg KH Cc: "Rafael J. Wysocki" , Mark Brown , pascal paillet , Linux Kernel Mailing List , Marek Szyprowski , Benjamin Gaignard Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 2018-07-12 10:55 GMT+02:00 Greg KH : > On Thu, Jul 12, 2018 at 10:06:23AM +0200, Benjamin Gaignard wrote: >> In some cases the link between between customer and supplier >> already exist. Do not warn about already existing dependencies >> because device_link_add() take care of this case. > > Why would a link already exist that is asked to be created again? What > code path causes this? It could happen that the link exist because a device use it parent as supplier. That case has been describe by Marek in this thread (I forgot to add it in the commit message, sorry): https://lkml.org/lkml/2018/7/9/356 > >> >> Reported-by: Marek Szyprowski >> Signed-off-by: Benjamin Gaignard >> --- >> drivers/base/core.c | 4 ++-- >> 1 file changed, 2 insertions(+), 2 deletions(-) >> >> diff --git a/drivers/base/core.c b/drivers/base/core.c >> index df3e1a44707a..fcdc17f0f349 100644 >> --- a/drivers/base/core.c >> +++ b/drivers/base/core.c >> @@ -105,7 +105,7 @@ static int device_is_dependent(struct device *dev, void *target) >> struct device_link *link; >> int ret; >> >> - if (WARN_ON(dev == target)) >> + if (dev == target) >> return 1; >> >> ret = device_for_each_child(dev, target, device_is_dependent); >> @@ -113,7 +113,7 @@ static int device_is_dependent(struct device *dev, void *target) >> return ret; >> >> list_for_each_entry(link, &dev->links.consumers, s_node) { >> - if (WARN_ON(link->consumer == target)) >> + if (link->consumer == target) >> return 1; > > Both of these WARN_ON are for valid code? That feels really odd to me, > I need more explanation here please. The documentation of the function is clear about return values: "Check if @target depends on @dev or any device dependent on it (its child or ts consumer etc). Return 1 if that is the case or 0 otherwise." so, for me, not need to warn user about something that is expected. Benjamin > > thanks, > > greg k-h