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 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E5D8CC3DA4A for ; Mon, 19 Aug 2024 18:30:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=kNPMjnSnAOjWRD/u4H3rrTD24agTe1XqlaWf8NbxkgE=; b=bRp5EE6AqoTLhQXOakYlLgeSds kfQSQus+ji9BbbRvWIGx3QAS00a0N9gewJeZWlUDtvSntr2EfegCKegIdhmTGsgyylZ+Ex9YxWdAH LHcCvjJTvgj7DT+BetC+FgET7HW5/P8YVIiU/j7kw4b38Qc9MQ8bzWz4xUJDHZLCRVf2rrVjNUC1A hz6M2ACsP3dbOmqPhegdRlsWj8WUoRAI6K5aPMKMjJDr8NJzCMgJ94ZYK2L0pJIjx2WF+10ixxKLW NdLvHT0G/c8cru17lzWgY2jLVd9PrmhgPa3BugQnvCHQnyM2rA+FyxWERrt7mK5BMyErDzUBCWdRc uWa1WYsw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sg78d-00000002Zr0-0ujI; Mon, 19 Aug 2024 18:29:55 +0000 Received: from mgamail.intel.com ([198.175.65.19]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sg77h-00000002ZWy-1lPI for linux-arm-kernel@lists.infradead.org; Mon, 19 Aug 2024 18:28:59 +0000 X-CSE-ConnectionGUID: XK8Nj6W+QyCYmnxN16jkAA== X-CSE-MsgGUID: ADnHE4uJQLKcwVwYZvq9Qg== X-IronPort-AV: E=McAfee;i="6700,10204,11169"; a="22203770" X-IronPort-AV: E=Sophos;i="6.10,159,1719903600"; d="scan'208";a="22203770" Received: from orviesa007.jf.intel.com ([10.64.159.147]) by orvoesa111.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Aug 2024 11:28:56 -0700 X-CSE-ConnectionGUID: UAbUuDuoSZiYgbMBfvamlQ== X-CSE-MsgGUID: 2DCcbPAkTEGqJBxULC2sWw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.10,159,1719903600"; d="scan'208";a="61024672" Received: from smile.fi.intel.com ([10.237.72.54]) by orviesa007.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Aug 2024 11:28:47 -0700 Received: from andy by smile.fi.intel.com with local (Exim 4.98) (envelope-from ) id 1sg77S-0000000H2MX-2AEd; Mon, 19 Aug 2024 21:28:42 +0300 Date: Mon, 19 Aug 2024 21:28:42 +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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240819165148.58201-9-pstanner@redhat.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240819_112857_545804_9DBBED84 X-CRM114-Status: GOOD ( 16.12 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, Aug 19, 2024 at 06:51:47PM +0200, Philipp Stanner wrote: > stmicro uses PCI devres in the wrong way. Resources requested > through pcim_* functions don't need to be cleaned up manually in the > remove() callback or in the error unwind path of a probe() function. > > Moreover, there is an unnecessary loop which only requests and ioremaps > BAR 0, but iterates over all BARs nevertheless. > > Furthermore, pcim_iomap_regions() and pcim_iomap_table() have been > deprecated by the PCI subsystem in commit e354bb84a4c1 ("PCI: Deprecate > pcim_iomap_table(), pcim_iomap_regions_request_all()"). > > Replace these functions with pcim_iomap_region(). > > Remove the unnecessary manual pcim_* cleanup calls. > > Remove the unnecessary loop over all BARs. ... 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? > } ... loongson_dwmac_remove() > pci_disable_msi(pdev); > pci_disable_device(pdev); Not sure why we need these either... -- With Best Regards, Andy Shevchenko