From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1034675AbdEYHMn (ORCPT ); Thu, 25 May 2017 03:12:43 -0400 Received: from mga02.intel.com ([134.134.136.20]:25579 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932943AbdEYHMi (ORCPT ); Thu, 25 May 2017 03:12:38 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.38,390,1491289200"; d="scan'208";a="91579542" Date: Thu, 25 May 2017 10:10:20 +0300 From: Mika Westerberg To: Lukas Wunner Cc: Greg Kroah-Hartman , Andreas Noever , Michael Jamet , Yehezkel Bernat , Amir Levy , Andy Lutomirski , Mario.Limonciello@dell.com, Jared.Dominguez@dell.com, Andy Shevchenko , linux-kernel@vger.kernel.org Subject: Re: [PATCH 20/24] thunderbolt: Do not touch the hardware if the NHI is gone on resume Message-ID: <20170525071020.GI8541@lahna.fi.intel.com> References: <20170518143914.60902-1-mika.westerberg@linux.intel.com> <20170518143914.60902-21-mika.westerberg@linux.intel.com> <20170524144310.wxtcburhjxnuocge@wunner.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170524144310.wxtcburhjxnuocge@wunner.de> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo User-Agent: Mutt/1.7.1 (2016-10-04) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 24, 2017 at 04:43:10PM +0200, Lukas Wunner wrote: > On Thu, May 18, 2017 at 05:39:10PM +0300, Mika Westerberg wrote: > > @@ -655,6 +659,16 @@ static int nhi_resume_noirq(struct device *dev) > > { > > struct pci_dev *pdev = to_pci_dev(dev); > > struct tb *tb = pci_get_drvdata(pdev); > > + u32 vid; > > + > > + /* > > + * Check that the device is still there. It may be that the user > > + * unplugged last device which causes the host controller to go > > + * away on PCs. > > + */ > > + pci_read_config_dword(pdev, PCI_VENDOR_ID, &vid); > > + if (vid == ~0) > > + tb->nhi->going_away = true; > > if (!pci_device_is_present(pdev)) Sure.