From patchwork Fri Jun 14 10:06:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ilpo_J=C3=A4rvinen?= X-Patchwork-Id: 13698496 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 A4596C27C6E for ; Fri, 14 Jun 2024 10:06:37 +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:Content-Transfer-Encoding: Content-Type:MIME-Version:Message-Id:Date:Subject:Cc:To:From:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=3hnFWxFGO9/vUsfGVd83BNqf2/y7gESamSeU05d1Hss=; b=km9PlB/48G1Oe05Aacy4KBhpzf azjeHirD9zYiJAKn6/WxsYFPEPbu0z32iQ4LHublKOgj/hM9BeIZr0EaFmiirwcthYgeuUM7GEauy oam4DHbXPOSHe3YC/UlGnyFLghj4mF6W/L1Pn5TZeozQmdVeSl4JLTyvvv8yzQG3e+Lfp6FbsjLV1 EB++Jp7SUnO/eIFj4j2nlijEdS14X+FIk171PYY7qDHfvT8sAXEK7S/zM5qsSyu5AJ/Ljw8rAFCOs rYlbbea/oDhuRr79oavtyuYFgJjfzpdVaI2AjpCz9sX78uPySRbsvbB0pcvZCrNxaA6z/4S9I32Oz xOdLgzLQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sI3p8-00000002LGf-2iCZ; Fri, 14 Jun 2024 10:06:22 +0000 Received: from mgamail.intel.com ([198.175.65.10]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sI3p6-00000002LFM-0dRY for linux-arm-kernel@lists.infradead.org; Fri, 14 Jun 2024 10:06:21 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1718359580; x=1749895580; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=M+wudfRew0zZ0o2jEhGKUvusyJLRH89lvhLCPTPKDJc=; b=iayTsd348RioBTVogaMcGVtwRvwKQ6zbb5ZY0+VfC4yUFROfPVnN4oB7 NlSVfMUQFkCUTu9DHcDfUXjAgYeXx9TXgHgIK5EEzUE1tq9hbcEeqUkqr vGBGvMPdF+unkysdNgZ4Iu4XAYfBeMOlNbF0mlfu6qk8SqmSdw2hSUq7J 6dsSOhdX9034V8Z0nCELKCrM4K8gMsMtPG2xBuzrbTWak3Sb3uJazWIF3 AIrg4qtD2GDGpz8YhPAuG8cwRTLyawoJKl8jnbJh+0WjJ1NS+vOH3BPDR sTlA/46g3p9URsyeIYSmwOf/yf5pXQyXW7l1etj6PQbflCPoDFNQ2ZxAS g==; X-CSE-ConnectionGUID: RHKWwZ9BQkCKLnAqo3HufA== X-CSE-MsgGUID: NFzlZi13TdyeISAjt15IAA== X-IronPort-AV: E=McAfee;i="6700,10204,11102"; a="32715809" X-IronPort-AV: E=Sophos;i="6.08,237,1712646000"; d="scan'208";a="32715809" Received: from orviesa004.jf.intel.com ([10.64.159.144]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Jun 2024 03:06:19 -0700 X-CSE-ConnectionGUID: Swo5ctbJQEaxpmynKRoqug== X-CSE-MsgGUID: GnEecZIsRhGB7Xm97YsUMA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,237,1712646000"; d="scan'208";a="45575859" Received: from ijarvine-desk1.ger.corp.intel.com (HELO localhost) ([10.245.247.222]) by orviesa004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Jun 2024 03:06:14 -0700 From: =?utf-8?q?Ilpo_J=C3=A4rvinen?= To: linux-pci@vger.kernel.org, Bjorn Helgaas , Jonathan Cameron , Philipp Stanner , Lorenzo Pieralisi , Rob Herring , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= Cc: linux-kernel@vger.kernel.org, Jonathan Hunter , linux-arm-kernel@lists.infradead.org, linux-tegra@vger.kernel.org, Robert Richter , Thierry Reding , =?utf-8?q?Ilpo_J=C3=A4rvinen?= Subject: [PATCH v2 0/4] PCI: Resource helper improvements Date: Fri, 14 Jun 2024 13:06:02 +0300 Message-Id: <20240614100606.15830-1-ilpo.jarvinen@linux.intel.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240614_030620_287539_E48D084E X-CRM114-Status: UNSURE ( 7.76 ) X-CRM114-Notice: Please train this message. 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 This series introduces resource_set_{range,size}() helpers to replace often repeated code fragments to set resource start and end addresses. The last two patches clean up nearby code. For now, this series only converts PCI subsystem. There are plenty of resource start/end setting code elsewhere in the kernel but those can be converted once the helpers reach Linus' tree. --- v2: - Improved commit message - Added patch to introduce ALIGN_DOWN_IF_NONZERO() Ilpo Järvinen (4): resource: Add resource set range and size helpers PCI: Use resource_set_{range,size}() helpers PCI: Use align and resource helpers, and SZ_* in quirk_s3_64M() PCI: Introduce ALIGN_DOWN_IF_NONZERO() helper locally drivers/pci/controller/pci-tegra.c | 2 +- drivers/pci/controller/pci-thunder-pem.c | 4 +-- drivers/pci/ecam.c | 2 +- drivers/pci/iov.c | 6 ++-- drivers/pci/pci.c | 3 +- drivers/pci/quirks.c | 23 +++++++--------- drivers/pci/setup-bus.c | 35 ++++++++++-------------- drivers/pci/setup-res.c | 7 ++--- include/linux/ioport.h | 32 ++++++++++++++++++++++ 9 files changed, 68 insertions(+), 46 deletions(-)