From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7503CC432BE for ; Wed, 1 Sep 2021 06:24:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4D1E160F23 for ; Wed, 1 Sep 2021 06:24:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242066AbhIAGZa (ORCPT ); Wed, 1 Sep 2021 02:25:30 -0400 Received: from mail.kernel.org ([198.145.29.99]:34136 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231501AbhIAGZ2 (ORCPT ); Wed, 1 Sep 2021 02:25:28 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id B33A560FE6; Wed, 1 Sep 2021 06:24:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1630477472; bh=owYWeMNxRWHqiz4Ls+78+kJdlpX2ot1Aci5dyemJqEQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=vm7rX9XNGZJGt1FcOVRYNqEvPXHqOs52Ph0PA4oH8nLjNHpg6D8S6J5vlOsZCcQhf XmDTfrcGKtBmSYTpIUmSWUHtd6Znx4aLB90i0XbufniVREUT0xTSb7BD/flF2o7mPL +gS1vhbGjHOCgvbUmtVAEjlMo8lUZhwFJTSGwGn0= Date: Wed, 1 Sep 2021 08:24:29 +0200 From: Greg Kroah-Hartman To: Saravana Kannan Cc: "Rafael J. Wysocki" , Ulf Hansson , Marek Szyprowski , kernel-team@android.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH v1] driver core: fw_devlink: Don't create device links for devices not on a bus Message-ID: References: <20210831224510.703253-1-saravanak@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210831224510.703253-1-saravanak@google.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 31, 2021 at 03:45:10PM -0700, Saravana Kannan wrote: > Devices that are not on a bus will never have a driver bound to it. So, > fw_devlink should not create device links for it as it can cause probe > issues[1] or sync_state() call back issues[2]. > > [1] - https://lore.kernel.org/lkml/CAGETcx_xJCqOWtwZ9Ee2+0sPGNLM5=F=djtbdYENkAYZa0ynqQ@mail.gmail.com/ > [2] - https://lore.kernel.org/lkml/CAPDyKFo9Bxremkb1dDrr4OcXSpE0keVze94Cm=zrkOVxHHxBmQ@mail.gmail.com/ > Fixes: f9aa460672c9 ("driver core: Refactor fw_devlink feature") > Reported-by: Ulf Hansson > Reported-by: Marek Szyprowski > Signed-off-by: Saravana Kannan > --- > drivers/base/core.c | 16 ++++++++++++++++ > 1 file changed, 16 insertions(+) > > diff --git a/drivers/base/core.c b/drivers/base/core.c > index f6360490a4a3..304a06314656 100644 > --- a/drivers/base/core.c > +++ b/drivers/base/core.c > @@ -1719,8 +1719,24 @@ static int fw_devlink_create_devlink(struct device *con, > struct device *sup_dev; > int ret = 0; > > + /* > + * If a consumer device is not on a bus (i.e. a driver will never bind > + * to it), it doesn't make sense for fw_devlink to create device links > + * for it. > + */ > + if (con->bus == NULL) > + return -EINVAL; > + Why would a device not be on a bus that has to do with a driver needing it? What types of devices are these? thanks, greg k-h