Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3770807imu; Tue, 18 Dec 2018 04:01:48 -0800 (PST) X-Google-Smtp-Source: AFSGD/XmUdtJmRhHJH3dNOUl9wfBKw1ppQHyXmoBScnM28CcaTNDsxlbV74t7mpPkSoGW/0rfnJ9 X-Received: by 2002:a17:902:66e6:: with SMTP id e93mr15761388plk.92.1545134508090; Tue, 18 Dec 2018 04:01:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545134508; cv=none; d=google.com; s=arc-20160816; b=uu+gpItYuDWVJnClJYx96GvsW6+U8wuamjH+eCInCIf/vtdm2/duCPfbOAjy8BAXyJ XblGrHgVeKl/Oulnh69xtrRS93svyWNdBBCW95x1AlZ0496jAoWjirMTh/F//YEus7G5 eXBkcdrALelJPrXDVz6iqycrNbGtG9jKifAVk8Jx5NUKqlVKgRyTBxylHMx4uaVm0Vgz F/d2kr7EF+UQGfNKwSmZs2PyF7X0L9522vo+wsONIDAEF733lPWncXTXAB0GhpoOXmQ0 wEQGEFfw4Rz6XAErEOB/g1dwUjiHYKJoqueqpLdgP1AoUHeBnv8c7SZa/g/DoWpnWoDx GDiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=3yWZq8tFwZkjKiV1KB90JUi25iE1bJf/eWHZX++sg2A=; b=0CVeucsX+VkrDG734U/JFmWsS6V6AB1YayLGJ+NUlgBzgofrGovK+vxm5oX/wNfHqR cK/sXQ3N0zmeWfWNwQkisWHSY8pumieTzf/eGfBLmFr6npAkmBkvtivciGesEksVsQZ0 k4/WjnXNA2gDucD7YMRCa3nriB/DbJazF4QABK8sX2lPm89n9OfQPJL1iE6yqef1hxnk N5hip9Y/HfQXR9p8H5v7CyAxQCwpKV6mzvF/Kt0Cuy0cuFq2n7RVCEO4dK2PmK2sAT1W 0VRId6o92ef6dBLDY6ZRi7lm20UHqS4mcGceEu0oQMEIC3VWYLnTQJ5v5H/atLQx4Ecj yDTw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v2si12774388plz.53.2018.12.18.04.01.31; Tue, 18 Dec 2018 04:01:48 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726769AbeLRMA0 (ORCPT + 99 others); Tue, 18 Dec 2018 07:00:26 -0500 Received: from foss.arm.com ([217.140.101.70]:44300 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726728AbeLRMAS (ORCPT ); Tue, 18 Dec 2018 07:00:18 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id EBA7980D; Tue, 18 Dec 2018 04:00:17 -0800 (PST) Received: from e107981-ln.cambridge.arm.com (e107981-ln.cambridge.arm.com [10.1.197.40]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 91B373F5C0; Tue, 18 Dec 2018 04:00:16 -0800 (PST) Date: Tue, 18 Dec 2018 12:00:07 +0000 From: Lorenzo Pieralisi To: Sinan Kaya Cc: linux-acpi@vger.kernel.org, Hanjun Guo , Sudeep Holla , "Rafael J. Wysocki" , Len Brown , open list Subject: Re: [PATCH v11 6/7] ACPI/IORT: Stub out ACS functions when CONFIG_PCI is not set Message-ID: <20181218115959.GA9090@e107981-ln.cambridge.arm.com> References: <20181218025606.32668-1-okaya@kernel.org> <20181218025606.32668-7-okaya@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181218025606.32668-7-okaya@kernel.org> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Dec 18, 2018 at 02:56:05AM +0000, Sinan Kaya wrote: > Remove PCI dependent code out of iort.c when CONFIG_PCI is not defined. > A quick search reveals the following functions: > 1. pci_request_acs() > 2. pci_domain_nr() > 3. pci_is_root_bus() > 4. to_pci_dev() > > Both pci_domain_nr() and pci_is_root_bus() are defined in linux/pci.h. > pci_domain_nr() is a stub function when CONFIG_PCI is not set and > pci_is_root_bus() just returns a reference to a structure member which > is still valid without CONFIG_PCI set. > > to_pci_dev() is a macro that expands to container_of. > > pci_request_acs() is the only code that gets pulled in from drivers/pci/*.c I am not a big fan of these assumptions but we can stub all code relying on those behind the CONFIG_PCI guard later, which would result in cleaner code too. > > Signed-off-by: Sinan Kaya > --- > drivers/acpi/arm64/iort.c | 21 ++++++++++++++------- > 1 file changed, 14 insertions(+), 7 deletions(-) > > diff --git a/drivers/acpi/arm64/iort.c b/drivers/acpi/arm64/iort.c > index 70f4e80b9246..beb7e4c05bf5 100644 > --- a/drivers/acpi/arm64/iort.c > +++ b/drivers/acpi/arm64/iort.c > @@ -1435,8 +1435,14 @@ static int __init iort_add_platform_device(struct acpi_iort_node *node, > return ret; > } > > -static bool __init iort_enable_acs(struct acpi_iort_node *iort_node) > +#ifdef CONFIG_PCI > +static void __init iort_enable_acs(struct acpi_iort_node *iort_node) > { > + static bool acs_enabled __initdata; > + > + if (acs_enabled) > + return; > + > if (iort_node->type == ACPI_IORT_NODE_PCI_ROOT_COMPLEX) { > struct acpi_iort_node *parent; > struct acpi_iort_id_mapping *map; > @@ -1458,13 +1464,16 @@ static bool __init iort_enable_acs(struct acpi_iort_node *iort_node) > if ((parent->type == ACPI_IORT_NODE_SMMU) || > (parent->type == ACPI_IORT_NODE_SMMU_V3)) { > pci_request_acs(); > - return true; > + acs_enabled = true; > + return; > } > } > } > - > - return false; > + return; Remove this return; With that updated: Acked-by: Lorenzo Pieralisi > } > +#else > +static inline void iort_enable_acs(struct acpi_iort_node *iort_node) { } > +#endif > > static void __init iort_init_platform_devices(void) > { > @@ -1472,7 +1481,6 @@ static void __init iort_init_platform_devices(void) > struct acpi_table_iort *iort; > struct fwnode_handle *fwnode; > int i, ret; > - bool acs_enabled = false; > const struct iort_dev_config *ops; > > /* > @@ -1493,8 +1501,7 @@ static void __init iort_init_platform_devices(void) > return; > } > > - if (!acs_enabled) > - acs_enabled = iort_enable_acs(iort_node); > + iort_enable_acs(iort_node); > > ops = iort_get_dev_cfg(iort_node); > if (ops) { > -- > 2.19.0 >