Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp218524pxj; Wed, 26 May 2021 21:09:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJypP+afPirne+0bRzLgHbKqA3esltHBvxdPfIbJqynIiQ9SmcuyOLFOfLPHjEc3T7ZRCvrY X-Received: by 2002:a17:906:15c2:: with SMTP id l2mr1665774ejd.348.1622088567317; Wed, 26 May 2021 21:09:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622088567; cv=none; d=google.com; s=arc-20160816; b=elPj8i+bCiMSvIuwCJly3ZLhbDYcdhMlEAA7e4ryMFwX/OBrlS7enVRobFiqJs2aO3 piIIjV8ew/1TMRInMDOfU7MGnM843CxNVJE31AJob7uEQ/yXH3xgDMD2BCIyNU5MDOMq O1ZcElj6CfGVkLCTJ31BlXPkZ6QyW5IObaFIx6ZgOcVQIITdGqc8qBKoKiopnbdMpXep QMpW0Kxbk2d/I+GlZ1GHCU7h+YfAJYgFh8gWq+sYI8zG81dX/8eAzxrI95f5BQuM2A5K dFXVo/PUajbQTCnV5WUz6ccVKusfEBv4P1XhRbja2JxgcWhFsmAs5AiTu9w8DQ217f+Z qHEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=BspH1HZcZITcxF0rmbgmhpFuqnFljD02VxCFnbohkfI=; b=Uuie0rtn80OJw2ugcAbCiVmT/BIoQSMOPcm1m2GYLLgI0r/oCIztEAMLBJ6iM/m3nm +ycgMikxtBuX6h24lYl8x7UcCOtU5pbPndk1UxoYkgfVaMHK8HD1lDh+nVmvDJFzMjtU 8M9pCfLNAwmraUumK3aOst784ukFFW7uhL5SGuMe9z7j+KK3enajGf7BNOXl0OY00K3I Mez8dRJ7cbhf9fyVw+6BcNuWw63Di50ndN1bsSf9LlPnK8BLwCjrtO3VDSyrXgkNz0SH e96qtSC5tyzlO3nk3k1azq37PjkqOyr6hCBDvuQTC67PMkUy6FtSzec1DjYhqlHitNWD Umlw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=vY1zXogm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id yz3si1059109ejb.253.2021.05.26.21.08.54; Wed, 26 May 2021 21:09:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=vY1zXogm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234836AbhE0DyQ (ORCPT + 99 others); Wed, 26 May 2021 23:54:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44674 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233008AbhE0DyP (ORCPT ); Wed, 26 May 2021 23:54:15 -0400 Received: from mail-ej1-x630.google.com (mail-ej1-x630.google.com [IPv6:2a00:1450:4864:20::630]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CA524C061574; Wed, 26 May 2021 20:52:42 -0700 (PDT) Received: by mail-ej1-x630.google.com with SMTP id gb17so5771686ejc.8; Wed, 26 May 2021 20:52:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=BspH1HZcZITcxF0rmbgmhpFuqnFljD02VxCFnbohkfI=; b=vY1zXogmOP0GIzyh/iHbgLk/GxpMTSu+9llO/2m960FTS8sqW3bj713Mhd7P2a1bPU BxMufd7w4LdnLm9i00eMCb23g4j74KDyGIm0wc7ueJghhhNOYCmsMyPCT+Zd/0tsAL1j vSbfu6CxS4sMTEU4rBuefmNE7rIFSiDYDrPbemk8T4FWzuNoKRDVGozUaLaCPGl9v0SG k9atr42HXSgWVGxncZ7Mv2rMk152UvBxgJKeV0uTofuvBKXcabeWf8jO+ltP9qx48QjH UBqtbArSbSQDpN1cpjsitr2bIJmIIeDt7pLQ4M9I5Z73dfErXCXurCIMWTbnrz8q1WNS sS0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=BspH1HZcZITcxF0rmbgmhpFuqnFljD02VxCFnbohkfI=; b=A3pTFynxScBt6ngEPyDdYuPhKwYoBBU2sTp3QeN+gm7Ig596MrX8D3ydvKYGq8ZnYq rPusdHgpsQL7NC4GrepKF5ubWJqv2Lr3ScUZOM8unbOy01GDR5nMqz9hxPJPG/bBhOmo eXo3SCin6tCzQokBd1WekoPAwjRwL5ilAWz/FypTtGy/5uM6OYoq9IQDXmOADMmL+TGN SX+ZyhqWlXlHH227s/qN0BG62uuRtCcnRwL+JcVwtah0a/i+Um094QS9zN8gMb6ccxQc /18l3XOS0pTUp2aw1zMEulXUoOvDPN9L+cB/ItWHb9vCdgXhyoXHE4cUyrSB7u6FBfB6 OmnA== X-Gm-Message-State: AOAM530Lw7c50cG4Y92KwVPT9QvJjcpSbvZ6uHuOK03ZvvJslbBRIl9l yZRvv980qOFUPD3szMDU0PLt75xvC62AyKniTr0= X-Received: by 2002:a17:906:4714:: with SMTP id y20mr1659206ejq.235.1622087561499; Wed, 26 May 2021 20:52:41 -0700 (PDT) MIME-Version: 1.0 References: <20210525125925.112306-1-lambert.q.wang@gmail.com> <20210525132035.GA66609@rocinante.localdomain> <20210526181810.GA13052@wunner.de> In-Reply-To: <20210526181810.GA13052@wunner.de> From: Lambert Wang Date: Thu, 27 May 2021 11:52:30 +0800 Message-ID: Subject: Re: [PATCH] pci: add pci_dev_is_alive API To: Lukas Wunner Cc: "Krzysztof Wilczy??ski" , Bjorn Helgaas , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, May 27, 2021 at 2:18 AM Lukas Wunner wrote: > > On Wed, May 26, 2021 at 02:12:38PM +0800, Lambert Wang wrote: > > The user is our new PCI driver under development for WWAN devices . > > Surprise removal could happen under multiple circumstances. > > e.g. Exception, Link Failure, etc. > > > > We wanted this API to detect surprise removal or check device recovery > > when AER and Hotplug are disabled. > > You may want to take a look at pci_dev_is_disconnected(). > > Be aware of its limitations, which Bjorn has already pointed out > and which are discussed in more detail under the following link > in the "Surprise removal" section: > > https://lwn.net/Articles/767885/ > Thanks for the suggestion and the article. Currently I prefer pci_device_is_present() for my scenario. e.g. pci_dev_is_disconnected() seems to use a cached value. If the driver wants to check the device's absence after it *senses* something abnormal, pci_device_is_present() is more suitable. > Thanks, > > Lukas