From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0704518A6BA for ; Tue, 20 Aug 2024 10:37:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.12 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724150264; cv=none; b=GkPBeJ3g/uOP3PF3EgPQWSaIZ9vKVszEcqDHH+7nJf0Xa7d3wqbmELedHABo5VzRd/WAavAmNS6h7zKIvsCSk3MNrPFDKBrR9jN/EAwk35e0v79juZeWr9TCHoEKuEgIK3r2CX6EJq3OEWqv1ccQOaDJxDGJaCxRr8q/bSkcDus= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724150264; c=relaxed/simple; bh=BiM4kMQSNEJETUXiJ+hSIuDZviDrLdvpvTm9Yc3dcAY=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=mFnqXOWIYI+ZLdRq4PmtdePSZ9ba3o75FekiJMnd9i/cSPR2ajwLAJ8//UkhS0c3Dq2f3iE2VpTksY65kk/3pXqrLdwaPr4ypxATvQKLGiJcbS+9Mos6G7QJk8SHtt4Nw5yRpbMUAfFPX6Z00or94h//lgxNuLuq9EdySZNge0c= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org; spf=fail smtp.mailfrom=kernel.org; arc=none smtp.client-ip=192.198.163.12 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=kernel.org X-CSE-ConnectionGUID: ngXySYSeSuS48sG24wRSig== X-CSE-MsgGUID: IMplDanlQP6Z/dTmTJSXhQ== X-IronPort-AV: E=McAfee;i="6700,10204,11169"; a="26307100" X-IronPort-AV: E=Sophos;i="6.10,161,1719903600"; d="scan'208";a="26307100" Received: from orviesa009.jf.intel.com ([10.64.159.149]) by fmvoesa106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Aug 2024 03:37:42 -0700 X-CSE-ConnectionGUID: nWFywAqfTeSsKI2HcF+BTA== X-CSE-MsgGUID: LFqzb9g/TbCg/PzI2I/nxA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.10,161,1719903600"; d="scan'208";a="60665629" Received: from smile.fi.intel.com ([10.237.72.54]) by orviesa009.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Aug 2024 03:37:33 -0700 Received: from andy by smile.fi.intel.com with local (Exim 4.98) (envelope-from ) id 1sgMEy-0000000HGXR-3q0A; Tue, 20 Aug 2024 13:37:28 +0300 Date: Tue, 20 Aug 2024 13:37:28 +0300 From: Andy Shevchenko To: Philipp Stanner Cc: onathan Corbet , Jens Axboe , Wu Hao , Tom Rix , Moritz Fischer , Xu Yilun , Linus Walleij , Bartosz Golaszewski , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Alexandre Torgue , Jose Abreu , Maxime Coquelin , Bjorn Helgaas , Alvaro Karsz , "Michael S. Tsirkin" , Jason Wang , Xuan Zhuo , Eugenio =?iso-8859-1?Q?P=E9rez?= , Richard Cochran , Mark Brown , David Lechner , Uwe =?iso-8859-1?Q?Kleine-K=F6nig?= , Jonathan Cameron , Hannes Reinecke , Damien Le Moal , Chaitanya Kulkarni , "Martin K. Petersen" , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, linux-fpga@vger.kernel.org, linux-gpio@vger.kernel.org, netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-pci@vger.kernel.org, virtualization@lists.linux.dev Subject: Re: [PATCH 7/9] ethernet: stmicro: Simplify PCI devres usage Message-ID: References: <20240819165148.58201-2-pstanner@redhat.com> <20240819165148.58201-9-pstanner@redhat.com> Precedence: bulk X-Mailing-List: virtualization@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo On Tue, Aug 20, 2024 at 09:52:40AM +0200, Philipp Stanner wrote: > On Mon, 2024-08-19 at 21:28 +0300, Andy Shevchenko wrote: > > On Mon, Aug 19, 2024 at 06:51:47PM +0200, Philipp Stanner wrote: ... > > loongson_dwmac_probe() > > > > > + memset(&res, 0, sizeof(res)); > > > + res.addr = pcim_iomap_region(pdev, 0, pci_name(pdev)); > > > + if (IS_ERR(res.addr)) { > > > + ret = PTR_ERR(res.addr); > > > + goto err_disable_device; > > > > It seems your series reveals issues in the error paths of .probe():s > > in many drivers... > > > > If we use pcim variant to enable device, why do we need to explicitly > > disable it? > > No. Can you elaborate? No issues being revealed, or no need to disable it explicitly, or...? > > >   } ... > > loongson_dwmac_remove() > > > > >   pci_disable_msi(pdev); > > >   pci_disable_device(pdev); > > > > Not sure why we need these either... > > It's complicated. > > The code uses pciM_enable_device(), but here in remove > pci_disable_device(). > > pcim_enable_device() sets up a disable callback which only calls > pci_disable_device() if pcim_pin_device() has not been called. > > This code doesn't seem to call pcim_pin_device(), so I think > pci_disable_device() could be removed. > > > I definitely would not feel confident touching pci_disable_msi(), > though. The AFAIK biggest problem remaining in PCI devres is that the > MSI code base implicitly calls into devres, see here [1] But isn't it a busyness of PCI core to call pci_disable_msi() at the right moment? Okay, I admit that there might be devices that require a special workflow WRT MSI, is this the case here? > [1] https://lore.kernel.org/all/ee44ea7ac760e73edad3f20b30b4d2fff66c1a85.camel@redhat.com/ -- With Best Regards, Andy Shevchenko