Received: by 10.213.65.68 with SMTP id h4csp1383613imn; Thu, 29 Mar 2018 03:52:31 -0700 (PDT) X-Google-Smtp-Source: AIpwx486rQextrAQMWXFHsub42DpH5NrriMnZEQFjmGDKltPJK3mje+NusboMlYdm8J1DSLMfd/1 X-Received: by 2002:a17:902:b602:: with SMTP id b2-v6mr7895622pls.11.1522320751365; Thu, 29 Mar 2018 03:52:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522320751; cv=none; d=google.com; s=arc-20160816; b=Jpej6IxQzZwFcbLaAORU2Xv+kIDZ9CyemlUtgMcpk0ANCAS7Avq/HpTeIt9K7zEvBr B23/tkiOuVxoP3S0b8dTS52QRi/1LUSAVZuNQ80p7wtF+Mz2zeoaMjcQjzfyajKEMGQu 7O7hLPuPu8a2QOm1ImZAHTSqBHZ5nPUk/GuDwmW0fnny9gnzO7u6l83t6LJT06Oy06Uo drpTCMznFQrulbE2VwEDaxd4NgozP7qyS56gTf80Y1G5DxFvt6ptaEyF+6mMuFW+VMn5 9BNzOUS9vE1teUoIcLUiGfNOcznV2cgfXbTfL5r9JTwyqe1oI3unlz+8rAlee2JTQlgt jDuA== 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=8ktPXAmyxzECf1Kd6X4azAUwyZAx0I32nGYgXYq6/pc=; b=b7hpQqD/cSj1kHY0ADnPnA/Wr3A5Yy0+NxvJQRZiO6EXdZy+F8GCznherbWubJuGwr G3dBm0zANMiuhGwV4k8//2d7oPSNlxbR4IL+/bsd9lX1auBaA6irhhMwLO5P0hRytYJ6 9EwzZTBXk+gnHhOU7gmhCk+oX5gATFkAdLKuYM/Fdt3Ii0h4wdAhTvYS34vG8cgYRged AvLWquUy84BYO1/+ybLq35JcOM3MAKKPxCYX4odmoaEfll2ETbCVkm1HAJYkmthMAaT4 Hyb1UgxNOGO4q/3i3UaF6UCpvroX5pQKWp/m8XGG0siaZEsRZa1mz5TNmRZS8HAOpsEQ KGRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=Bh4FAapt; 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 j63si3843691pgc.474.2018.03.29.03.52.17; Thu, 29 Mar 2018 03:52:31 -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=@gmail.com header.s=20161025 header.b=Bh4FAapt; 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 S1752267AbeC2KvY (ORCPT + 99 others); Thu, 29 Mar 2018 06:51:24 -0400 Received: from mail-ot0-f195.google.com ([74.125.82.195]:37767 "EHLO mail-ot0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750799AbeC2KvW (ORCPT ); Thu, 29 Mar 2018 06:51:22 -0400 Received: by mail-ot0-f195.google.com with SMTP id y46-v6so5967330otd.4; Thu, 29 Mar 2018 03:51:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=8ktPXAmyxzECf1Kd6X4azAUwyZAx0I32nGYgXYq6/pc=; b=Bh4FAaptyFavtKnp/zUuBR759UbJvozSo7tCvJuvt4CThvAYddXzxk9uTWfdkr0wnO FIYV2jHHTbCVj4DKViaiOIKEWIddX9la1WVQqIh98lQrKLOE/EWt9IAFeQdm9d+Mrngm /n1BBK74AIcqvWkydKodJWHPg6iAynxKRU3cnkP+HzUaGiiHytSb15BggSozfFmdMWwk Oazi2CAqtURcJmgMP2+QNDyh78fXRK1p951w4rFOlFRjsLVrdIaaUxn1tBSsGUfss7Sm lHhQ3HLVlYv2+2JHyNHXKbNQzOkOZ2FwsDiJHkXnAs/JzUBglsLpgkANgxfHtbl37w+V Lhig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=8ktPXAmyxzECf1Kd6X4azAUwyZAx0I32nGYgXYq6/pc=; b=RYXQGFX7Uk/LaKfbLgFQW+hNEcYU0kV99xHWFyBmZgUlmG/RJi7W0E4y+To8jCR0wo cPnBMuSOq9wn4ns8CU20Ee+FP93KeXTU56UMXzI1vxDymhRviYTVMzqSTi30qWk0Xlnm j/vLLgXWFQjZ4iAGGvGOHrvKCEIN1qF7bu0o3+xLsWQXRq8Y19bYO5M7vwvcQf3E/YAQ b2Y0r1/ZHdxzQP9dmCLWkjXgw72daP5gg1cO/U0LHXZcGKqBWxMIRACJc2h3KVETmOJe o5GIEsMTtAQa+3+gjcVII72ef5Wiqdkzimfs9SZD8P7yo8siiKbe+/krPfCjppRlTUji cGGA== X-Gm-Message-State: AElRT7HfDf3JjTpgYnaZ6LWHjpjMft1kwg+Jhdk1iwxn2l8J6RZl6KZJ QJV7e4U/4hQyVkJvNOChaw1Tux7GH4VLKPmLYDo= X-Received: by 2002:a9d:5f0e:: with SMTP id f14-v6mr1863237oti.370.1522320681689; Thu, 29 Mar 2018 03:51:21 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a9d:9f7:0:0:0:0:0 with HTTP; Thu, 29 Mar 2018 03:51:21 -0700 (PDT) In-Reply-To: <1522317660-11080-2-git-send-email-dongsheng.wang@hxt-semitech.com> References: <1522317660-11080-1-git-send-email-dongsheng.wang@hxt-semitech.com> <1522317660-11080-2-git-send-email-dongsheng.wang@hxt-semitech.com> From: "Rafael J. Wysocki" Date: Thu, 29 Mar 2018 12:51:21 +0200 X-Google-Sender-Auth: XW7H5SsMY-41y5Zx1KyIH0VQuVw Message-ID: Subject: Re: [RFC PATCH 1/2] driver core: add new dl device status DL_DEV_PROBE_FAILED To: Wang Dongsheng Cc: "Rafael J. Wysocki" , Lorenzo Pieralisi , Greg Kroah-Hartman , Hanjun Guo , Sudeep Holla , yu.zheng@hxt-semitech.com, ACPI Devel Maling List , Linux Kernel Mailing List 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 On Thu, Mar 29, 2018 at 12:00 PM, Wang Dongsheng wrote: > Currently the initialization state of device is DL_DEV_NO_DRIVER. > The problem is, after probe failure the state will also be set to > DL_DEV_NO_DRIVER as well. And the device is not linked, it has no > supplier or consumer. Thus adding a new state to distinguish > probe failure and not-probed-yet. > > Signed-off-by: Wang Dongsheng I guess what you want is a cleanup after a failing probe, but after that the state really is "no driver" again, isn't it? > --- > Documentation/driver-api/device_link.rst | 2 +- > drivers/base/base.h | 2 +- > drivers/base/core.c | 22 ++++++++++++++++++++-- > drivers/base/dd.c | 2 +- > include/linux/device.h | 1 + > 5 files changed, 24 insertions(+), 5 deletions(-) > > diff --git a/Documentation/driver-api/device_link.rst b/Documentation/driver-api/device_link.rst > index 70e328e..9054403 100644 > --- a/Documentation/driver-api/device_link.rst > +++ b/Documentation/driver-api/device_link.rst > @@ -247,7 +247,7 @@ State machine > :c:func:`device_links_unbind_consumers()`.) > > * If the probe fails, links to suppliers revert back to ``DL_STATE_AVAILABLE``. > - (Call to :c:func:`device_links_no_driver()` from :c:func:`really_probe()`.) > + (Call to :c:func:`device_links_probe_failed()` from :c:func:`really_probe()`.) > > * If the probe succeeds, links to suppliers progress to ``DL_STATE_ACTIVE``. > (Call to :c:func:`device_links_driver_bound()` from :c:func:`driver_bound()`.) > diff --git a/drivers/base/base.h b/drivers/base/base.h > index d800de6..f9931d9 100644 > --- a/drivers/base/base.h > +++ b/drivers/base/base.h > @@ -158,6 +158,6 @@ extern void device_links_read_unlock(int idx); > extern int device_links_check_suppliers(struct device *dev); > extern void device_links_driver_bound(struct device *dev); > extern void device_links_driver_cleanup(struct device *dev); > -extern void device_links_no_driver(struct device *dev); > +extern void device_links_probe_failed(struct device *dev); > extern bool device_links_busy(struct device *dev); > extern void device_links_unbind_consumers(struct device *dev); > diff --git a/drivers/base/core.c b/drivers/base/core.c > index 5847364..31d4f68 100644 > --- a/drivers/base/core.c > +++ b/drivers/base/core.c > @@ -452,10 +452,28 @@ static void __device_links_no_driver(struct device *dev) > dev->links.status = DL_DEV_NO_DRIVER; > } > > -void device_links_no_driver(struct device *dev) > +static void __device_links_probe_failed(struct device *dev) > +{ > + struct device_link *link, *ln; > + > + list_for_each_entry_safe_reverse(link, ln, &dev->links.suppliers, > + c_node) { > + if (link->flags & DL_FLAG_STATELESS) > + continue; > + > + if (link->flags & DL_FLAG_AUTOREMOVE) > + __device_link_del(link); > + else if (link->status != DL_STATE_SUPPLIER_UNBIND) > + WRITE_ONCE(link->status, DL_STATE_AVAILABLE); > + } > + > + dev->links.status = DL_DEV_PROBE_FAILED; > +} > + > +void device_links_probe_failed(struct device *dev) > { > device_links_write_lock(); > - __device_links_no_driver(dev); > + __device_links_probe_failed(dev); > device_links_write_unlock(); > } > > diff --git a/drivers/base/dd.c b/drivers/base/dd.c > index de6fd09..90d57e0 100644 > --- a/drivers/base/dd.c > +++ b/drivers/base/dd.c > @@ -492,7 +492,7 @@ static int really_probe(struct device *dev, struct device_driver *drv) > blocking_notifier_call_chain(&dev->bus->p->bus_notifier, > BUS_NOTIFY_DRIVER_NOT_BOUND, dev); > pinctrl_bind_failed: > - device_links_no_driver(dev); > + device_links_probe_failed(dev); > devres_release_all(dev); > driver_sysfs_remove(dev); > dev->driver = NULL; > diff --git a/include/linux/device.h b/include/linux/device.h > index b093405..bf9630a 100644 > --- a/include/linux/device.h > +++ b/include/linux/device.h > @@ -794,6 +794,7 @@ struct device_link { > enum dl_dev_state { > DL_DEV_NO_DRIVER = 0, > DL_DEV_PROBING, > + DL_DEV_PROBE_FAILED, > DL_DEV_DRIVER_BOUND, > DL_DEV_UNBINDING, > }; > -- > 2.7.4 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-acpi" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html