Received: by 10.213.65.68 with SMTP id h4csp1019135imn; Tue, 20 Mar 2018 23:58:22 -0700 (PDT) X-Google-Smtp-Source: AG47ELvxwnmlOwfab/uOVKyaKmdLYxBBGq3xrQVTka5ZPAVDHQOEb8wUoIgFyNwJVAKn6ngZJGaF X-Received: by 2002:a17:902:b183:: with SMTP id s3-v6mr19437300plr.108.1521615502435; Tue, 20 Mar 2018 23:58:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521615502; cv=none; d=google.com; s=arc-20160816; b=Qicmw1FBj6Q4ZG8MFfg1Sp/cNFa+c9DgkdPr3LwgOMveo/Eu6SRy3tn9DIYAD4Rc8K urG4S6yY7b8vdxmdShYSocDOKV7uOu+JUaO7BihjSudAWeXeqKITH792lfyNy3W2jut3 mjhC6CLEwTKhlcJgu8Eru5AkSeI/9qWSt3Kd3utzSaTkQ2/0EEC1k8Jh9hlv7CDktMs6 FXK8e8xhhyrQf8GIy/f2IglCEV9vYKXpdyFbul/cWYAR58aIeVlYBCqeNf/QKWxrbU9r LD4NQDNpdhEqKDBAfRu4+vW0Nd9+M5tamncXZeVi2XTJWERAkwO0e4Mw9QjsLz0tQmtO sJqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:spamdiagnosticmetadata :spamdiagnosticoutput:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature:arc-authentication-results; bh=7gTQp27VhQEorgvP76OLbB7MxPSdzM8+uND9L3ssi3I=; b=FIr609TmM0bqNwbfIDhxY8FKZv7kvKHxCDcsJtw3lwlXnipwxVL2Qrf4dPYLq9/myr ppowuhEg3sRmrhBJP/Ax3D6M/+QQm0e9xnIhrRMTQV7TU6iiim0wtqYm19qBG3FKUkB2 ed0CDKA6kWGszz3nDUBoN/+ch1TT5kUjlPrTZ5bSM9lW4zs7ZGzzKFa309PvrvRoGc3H uU+ohzAWGadX6bAxcl7UZgW9rnuJ17nIj5OPR8Khfsee2Y+DKBmvpBkLipHTfWm9HK8L YYV8DU80r3jO40uOJDySqRXUHm5i/AT0W1zhlGe4py78qeaPiDlL2yIaO8jmWD5kfKVP E6Kw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector1 header.b=vXHtFH6l; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t15si2093812pgu.114.2018.03.20.23.58.08; Tue, 20 Mar 2018 23:58:22 -0700 (PDT) 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; dkim=pass header.i=@nxp.com header.s=selector1 header.b=vXHtFH6l; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751484AbeCUG4b (ORCPT + 99 others); Wed, 21 Mar 2018 02:56:31 -0400 Received: from mail-ve1eur01on0051.outbound.protection.outlook.com ([104.47.1.51]:18743 "EHLO EUR01-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751753AbeCUG4Z (ORCPT ); Wed, 21 Mar 2018 02:56:25 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=7gTQp27VhQEorgvP76OLbB7MxPSdzM8+uND9L3ssi3I=; b=vXHtFH6lWCg2pzJGMsYZ3f5LwSHKyRMrjQxdETh0Icvd+NmZSgR/8omimjWJsSqVuBhguBO9s0UI7T48a8ElcJkhuHs72Y77mRpjdn1fZX4+gazKf5ud/d/w6wOxqqvrnGlGnYrvspMyFz55AQoCiQ71903becz0LmZnDA+2smU= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=nipun.gupta@nxp.com; Received: from b27504-OptiPlex-790.ap.freescale.net (14.142.187.166) by VI1PR0401MB2431.eurprd04.prod.outlook.com (2603:10a6:800:2a::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.588.14; Wed, 21 Mar 2018 06:56:13 +0000 From: Nipun Gupta To: robin.murphy@arm.com, hch@lst.de, linux@armlinux.org.uk, gregkh@linuxfoundation.org, m.szyprowski@samsung.com Cc: bhelgaas@google.com, zajec5@gmail.com, andy.gross@linaro.org, david.brown@linaro.org, dan.j.williams@intel.com, vinod.koul@intel.com, thierry.reding@gmail.com, robh+dt@kernel.org, frowand.list@gmail.com, jarkko.sakkinen@linux.intel.com, rafael.j.wysocki@intel.com, dmitry.torokhov@gmail.com, johan@kernel.org, msuchanek@suse.de, linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org, linux-wireless@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-soc@vger.kernel.org, dmaengine@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-tegra@vger.kernel.org, devicetree@vger.kernel.org, linux-pci@vger.kernel.org, bharat.bhushan@nxp.com, leoyang.li@nxp.com, Nipun Gupta Subject: [PATCH v2 2/2] drivers: remove force dma flag from buses Date: Wed, 21 Mar 2018 12:25:23 +0530 Message-Id: <1521615323-4752-2-git-send-email-nipun.gupta@nxp.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1521615323-4752-1-git-send-email-nipun.gupta@nxp.com> References: <1520868292-2479-1-git-send-email-nipun.gupta@nxp.com> <1521615323-4752-1-git-send-email-nipun.gupta@nxp.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [14.142.187.166] X-ClientProxiedBy: BM1PR01CA0090.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:1::30) To VI1PR0401MB2431.eurprd04.prod.outlook.com (2603:10a6:800:2a::24) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: ff77168e-31dd-4874-7e0b-08d58ef8d9ae X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(4534165)(7168020)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020);SRVR:VI1PR0401MB2431; X-Microsoft-Exchange-Diagnostics: 1;VI1PR0401MB2431;3:MWaCYzr9H/+fHV89eLRQi1UFbqagGJHw/Zu6kGsrXlmrO+0HD2MvI8Ex6j3IdrS099SfTEP89NPd6aBs/UMHtFbz4xgjMgXP8Hx0Scvx8P/ANo5vOhD45w0Z6BLF5UduYg4hNJ70neypRlxuHRlJP7ePCEaXSuG4eattZPZeXV8/4D5Zeawt2/4wXWwVbWrDxV0yigFsOxiFmhINn7OzXXhxtARbg+EvyQYx2b7kVsKj9ikR2mCdTjtem3UfJxtv;25:MMiUq+vaJhD8ZwQ3DfqJnRzrsaSqnEJDvnbwo5a2O/6Un5yUAZZdud5So1Jv3+oW6mFWGfQn3az4lJH00/arVK/uCt83Kfx1pJhJ8Y2qkp2Qd+DlPRK+1O/G61/J2MuZcbT3u+zFaKsuOnyMkqNP1wMTll70VT3yWoc9di2mPdehF9Un3JEJSiBu1dv8GwVYVcyO7t7VZmNQH8GK+WYeov8DAwmKz9H+aGDe7hwNjgdSHmC1vG+lqMaqGsCtsUJI4WOIayyuUilM/QVE0PgEfjmXQg+bNyLoWm1UMMGhzNH4jB4WXcHznyLo9SZaCUTrVPOpWx1yom0FRF1cL70PUA==;31:DKjS02ULAlR+VQ2g36MYWpNWxFKGXaN7OgqdhwDHHkqvl7/0McRm7CFm3akmmwo+vduhrMvzay/Oz3Qf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exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(10201501046)(93006095)(93001095)(3231221)(944501244)(52105095)(3002001)(6055026)(6041310)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123560045)(20161123562045)(6072148)(201708071742011);SRVR:VI1PR0401MB2431;BCL:0;PCL:0;RULEID:;SRVR:VI1PR0401MB2431; X-Forefront-PRVS: 0618E4E7E1 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(396003)(366004)(346002)(376002)(39380400002)(39860400002)(189003)(199004)(50226002)(2950100002)(575784001)(7736002)(4326008)(86362001)(36756003)(8676002)(81166006)(478600001)(6486002)(316002)(81156014)(66066001)(305945005)(47776003)(6666003)(2906002)(8936002)(5009440100003)(6116002)(97736004)(16586007)(3846002)(186003)(52116002)(51416003)(76176011)(105586002)(39060400002)(53936002)(106356001)(48376002)(59450400001)(6512007)(5660300001)(16526019)(25786009)(68736007)(386003)(55236004)(6506007)(26005)(7416002)(50466002)(110426004)(357404004);DIR:OUT;SFP:1101;SCL:1;SRVR:VI1PR0401MB2431;H:b27504-OptiPlex-790.ap.freescale.net;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; Received-SPF: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;VI1PR0401MB2431;23:dFOXCo+/7BRvjKxNzyUgDnGpZ1yJBDVXBjy14d+?= =?us-ascii?Q?qd7pTWLG8429IPvaSnNUNQEksx1Lv0glMvxMseO2l1XtV4YTthtImfqKA3Cm?= =?us-ascii?Q?PPch/+pm/zLRsczeptLqkzUl+FueJJ86VH3boKPOwccl4scz0BfuViFr2+yI?= =?us-ascii?Q?R2IPOxfIGibUviHLW8T42Chlj0+BPUJciqeOodTbXhVhfMhj8WP4JjKTvqod?= =?us-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n8fTEacWhphKwvvFGzndpC?= =?us-ascii?Q?LayXLHOr4W7QlFTH4+ZL0cV2Hi1isPVbZuPnsIg1+9wnyJjyg8Ruw2bkbe4l?= =?us-ascii?Q?UrNrojpfK+OX444eIZwglge2YTFYcIDdpKnjeJSqCYI+l9ItspgeNMKF33fL?= =?us-ascii?Q?8Pm8bfv/m/o8lzWv7J1/cPoqdJ+1anYSN4k/dZeXE?= X-Microsoft-Antispam-Message-Info: bI+KolipytNHdISI9fx45I4Dz0W/jErzQmot2AaV+jZrBWe+//MOCZeSdaE1YCLMBUUur0XnOv9dyoEYQVtEwoTPDVXt9JM6FlAh4RsTkL1+79bhCENd1afuh4YnlC1Fvtki1A4a2KLvKZ/RbCKChG1npfOfCOvvtzdLOZSpEsCHzsDSFRxDOUEvMsyeagxk X-Microsoft-Exchange-Diagnostics: 1;VI1PR0401MB2431;6:Kn02l5zuJbUurOOSVo4KnLCUBftJpOrIY844LEAFBIS2ZfNMe5E09KaDA4UF+9wReTlBo6AAP6960MLKVp3l5rRR70w000zXTyFvlV3TPafhd2TNyzl/46Yk0iLoFIG8IsKK/rzjyQkL07fRyHVftf4/DtlC8P5awP4iIXeNNLWXJt0pMQFuihd67CINELq1TI4xdqi4xF5gYYjBtZBefb1wSjcgFYU/QVn2ZxYjIejSI5bzbNxGapklshQOtj6B6sn+LxPZ8BXUGc88wBNzMPHo58bzl/BIEGc9O5n+8SmKB0I+lTp4beLVQNDUA+W+T/cqN8aKfjThbAtxBTohl3dmyTPaG7wJlmVfwWE/9LE=;5:zYEC1cWxOuZp839hQwchLf4KP/0VGrFDg3fu+tuK6qEoQ8Cu3aBEnKuqwsxtD2adiC049lUWX4tDLZqe5X5k2KAgj36DvdQG07jUJYwZRp4VbKRNIClmQvjrAmADZ7x3UeiRvkE4YEIidBWQ6vIzC/3uF+6LzNXQYg9D3qhS2qU=;24:hX3IP41pkQPJ3huy2ySlXkSjyAtTQecVx/VxoE0Czeo+nBdnNxqojptNB37UguAul8uCjM42tUAVBw4FXi39dTmpu9CO2kaGj9O+Ou9lY0U=;7:LobF48mogWvRQOwbgLooU0DZv/Le+bt2aU0TWyjLxklNQpKJWAAXbwpKKp5eBSBhxfmvSDv6CfR4/Qmi/mDZCinnKOOl2buiWh3lvM4GDFS4HZiRiOuf4SxdtF3bPblY05kWeWgkr7lySighq2+fq5WhuJIp+mdHr8ovN/zYWrTLTVxxJmA8h27ccjHT1rpr+WMQhUKutB3cBoNYM9LJj3bQXUJbGvofQWlQOgaPs/iAOn48xfrrbQ7pxG4puqYj SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Mar 2018 06:56:13.9324 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ff77168e-31dd-4874-7e0b-08d58ef8d9ae X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0401MB2431 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org With each bus implementing its own DMA configuration callback, there is no need for bus to explicitly have force_dma in its global structure. This patch modifies of_dma_configure API to accept an input parameter which specifies if implicit DMA configuration is required even when it is not described by the firmware. Signed-off-by: Nipun Gupta --- Changes in v2: - This is a new change suggested by Robin and Christoph and is added to the series. drivers/amba/bus.c | 3 +-- drivers/base/dma-mapping.c | 4 ++-- drivers/base/platform.c | 3 +-- drivers/bcma/main.c | 2 +- drivers/dma/qcom/hidma_mgmt.c | 2 +- drivers/gpu/host1x/bus.c | 5 ++--- drivers/of/device.c | 6 ++++-- drivers/of/of_reserved_mem.c | 2 +- drivers/pci/pci-driver.c | 3 +-- include/linux/device.h | 4 ---- include/linux/dma-mapping.h | 2 +- include/linux/of_device.h | 4 +++- 12 files changed, 18 insertions(+), 22 deletions(-) diff --git a/drivers/amba/bus.c b/drivers/amba/bus.c index 2fa1e8b..1d58348 100644 --- a/drivers/amba/bus.c +++ b/drivers/amba/bus.c @@ -174,7 +174,7 @@ static int amba_pm_runtime_resume(struct device *dev) static int amba_dma_configure(struct device *dev) { - return dma_common_configure(dev); + return dma_common_configure(dev, true); } static const struct dev_pm_ops amba_pm = { @@ -202,7 +202,6 @@ struct bus_type amba_bustype = { .uevent = amba_uevent, .dma_configure = amba_dma_configure, .pm = &amba_pm, - .force_dma = true, }; static int __init amba_init(void) diff --git a/drivers/base/dma-mapping.c b/drivers/base/dma-mapping.c index 48f9af0..03f8584 100644 --- a/drivers/base/dma-mapping.c +++ b/drivers/base/dma-mapping.c @@ -335,13 +335,13 @@ void dma_common_free_remap(void *cpu_addr, size_t size, unsigned long vm_flags) * A bus can use this function in its 'dma_configure' callback, if * suitable for the bus. */ -int dma_common_configure(struct device *dev) +int dma_common_configure(struct device *dev, bool force_dma) { enum dev_dma_attr attr; int ret = 0; if (dev->of_node) { - ret = of_dma_configure(dev, dev->of_node); + ret = of_dma_configure(dev, dev->of_node, force_dma); } else if (has_acpi_companion(dev)) { attr = acpi_get_dma_attr(to_acpi_device_node(dev->fwnode)); if (attr != DEV_DMA_NOT_SUPPORTED) diff --git a/drivers/base/platform.c b/drivers/base/platform.c index d2d5891..154707c 100644 --- a/drivers/base/platform.c +++ b/drivers/base/platform.c @@ -1132,7 +1132,7 @@ int platform_pm_restore(struct device *dev) static int platform_dma_configure(struct device *dev) { - return dma_common_configure(dev); + return dma_common_configure(dev, true); } static const struct dev_pm_ops platform_dev_pm_ops = { @@ -1148,7 +1148,6 @@ struct bus_type platform_bus_type = { .uevent = platform_uevent, .dma_configure = platform_dma_configure, .pm = &platform_dev_pm_ops, - .force_dma = true, }; EXPORT_SYMBOL_GPL(platform_bus_type); diff --git a/drivers/bcma/main.c b/drivers/bcma/main.c index e6986c7..fc1f4ac 100644 --- a/drivers/bcma/main.c +++ b/drivers/bcma/main.c @@ -207,7 +207,7 @@ static void bcma_of_fill_device(struct device *parent, core->irq = bcma_of_get_irq(parent, core, 0); - of_dma_configure(&core->dev, node); + of_dma_configure(&core->dev, node, false); } unsigned int bcma_core_irq(struct bcma_device *core, int num) diff --git a/drivers/dma/qcom/hidma_mgmt.c b/drivers/dma/qcom/hidma_mgmt.c index 000c7019..d64edeb 100644 --- a/drivers/dma/qcom/hidma_mgmt.c +++ b/drivers/dma/qcom/hidma_mgmt.c @@ -398,7 +398,7 @@ static int __init hidma_mgmt_of_populate_channels(struct device_node *np) } of_node_get(child); new_pdev->dev.of_node = child; - of_dma_configure(&new_pdev->dev, child); + of_dma_configure(&new_pdev->dev, child, true); /* * It is assumed that calling of_msi_configure is safe on * platforms with or without MSI support. diff --git a/drivers/gpu/host1x/bus.c b/drivers/gpu/host1x/bus.c index fa9896d..211eb6b 100644 --- a/drivers/gpu/host1x/bus.c +++ b/drivers/gpu/host1x/bus.c @@ -317,7 +317,7 @@ static int host1x_device_match(struct device *dev, struct device_driver *drv) static int host1x_dma_configure(struct device *dev) { if (dev->of_node) - return of_dma_configure(dev, dev->of_node); + return of_dma_configure(dev, dev->of_node, true); return 0; } @@ -336,7 +336,6 @@ struct bus_type host1x_bus_type = { .match = host1x_device_match, .dma_configure = host1x_dma_configure, .pm = &host1x_device_pm_ops, - .force_dma = true, }; static void __host1x_device_del(struct host1x_device *device) @@ -425,7 +424,7 @@ static int host1x_device_add(struct host1x *host1x, device->dev.bus = &host1x_bus_type; device->dev.parent = host1x->dev; - of_dma_configure(&device->dev, host1x->dev->of_node); + of_dma_configure(&device->dev, host1x->dev->of_node, true); err = host1x_device_parse_dt(device, driver); if (err < 0) { diff --git a/drivers/of/device.c b/drivers/of/device.c index 064c818..33d8551 100644 --- a/drivers/of/device.c +++ b/drivers/of/device.c @@ -76,6 +76,8 @@ int of_device_add(struct platform_device *ofdev) * of_dma_configure - Setup DMA configuration * @dev: Device to apply DMA configuration * @np: Pointer to OF node having DMA configuration + * @force_dma: Whether device is to be set up by of_dma_configure() even if + * DMA capability is not explicitly described by firmware. * * Try to get devices's DMA configuration from DT and update it * accordingly. @@ -84,7 +86,7 @@ int of_device_add(struct platform_device *ofdev) * can use a platform bus notifier and handle BUS_NOTIFY_ADD_DEVICE events * to fix up DMA configuration. */ -int of_dma_configure(struct device *dev, struct device_node *np) +int of_dma_configure(struct device *dev, struct device_node *np, bool force_dma) { u64 dma_addr, paddr, size = 0; int ret; @@ -100,7 +102,7 @@ int of_dma_configure(struct device *dev, struct device_node *np) * DMA configuration regardless of whether "dma-ranges" is * correctly specified or not. */ - if (!dev->bus->force_dma) + if (!force_dma) return ret == -ENODEV ? 0 : ret; dma_addr = offset = 0; diff --git a/drivers/of/of_reserved_mem.c b/drivers/of/of_reserved_mem.c index 9a4f4246..895c83e 100644 --- a/drivers/of/of_reserved_mem.c +++ b/drivers/of/of_reserved_mem.c @@ -353,7 +353,7 @@ int of_reserved_mem_device_init_by_idx(struct device *dev, /* ensure that dma_ops is set for virtual devices * using reserved memory */ - of_dma_configure(dev, np); + of_dma_configure(dev, np, true); dev_info(dev, "assigned reserved memory node %s\n", rmem->name); } else { diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c index b473a4c..b15637a 100644 --- a/drivers/pci/pci-driver.c +++ b/drivers/pci/pci-driver.c @@ -1541,7 +1541,7 @@ static int pci_dma_configure(struct device *dev) if (IS_ENABLED(CONFIG_OF) && bridge->parent && bridge->parent->of_node) { - ret = of_dma_configure(dev, bridge->parent->of_node); + ret = of_dma_configure(dev, bridge->parent->of_node, true); } else if (has_acpi_companion(bridge)) { attr = acpi_get_dma_attr(to_acpi_device_node(bridge->fwnode)); if (attr != DEV_DMA_NOT_SUPPORTED) @@ -1566,7 +1566,6 @@ struct bus_type pci_bus_type = { .pm = PCI_PM_OPS_PTR, .num_vf = pci_bus_num_vf, .dma_configure = pci_dma_configure, - .force_dma = true, }; EXPORT_SYMBOL(pci_bus_type); diff --git a/include/linux/device.h b/include/linux/device.h index 1832d90..92c530e 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -98,8 +98,6 @@ extern int __must_check bus_create_file(struct bus_type *, * @p: The private data of the driver core, only the driver core can * touch this. * @lock_key: Lock class key for use by the lock validator - * @force_dma: Assume devices on this bus should be set up by dma_configure() - * even if DMA capability is not explicitly described by firmware. * * A bus is a channel between the processor and one or more devices. For the * purposes of the device model, all devices are connected via a bus, even if @@ -140,8 +138,6 @@ struct bus_type { struct subsys_private *p; struct lock_class_key lock_key; - - bool force_dma; }; extern int __must_check bus_register(struct bus_type *bus); diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h index c15986b..3dba3e6 100644 --- a/include/linux/dma-mapping.h +++ b/include/linux/dma-mapping.h @@ -761,7 +761,7 @@ void *dma_mark_declared_memory_occupied(struct device *dev, } #endif /* CONFIG_HAVE_GENERIC_DMA_COHERENT */ -int dma_common_configure(struct device *dev); +int dma_common_configure(struct device *dev, bool force_dma); #ifdef CONFIG_HAS_DMA int dma_configure(struct device *dev); void dma_deconfigure(struct device *dev); diff --git a/include/linux/of_device.h b/include/linux/of_device.h index 8da5a1b..b0be3a5 100644 --- a/include/linux/of_device.h +++ b/include/linux/of_device.h @@ -55,7 +55,9 @@ static inline struct device_node *of_cpu_device_node_get(int cpu) return of_node_get(cpu_dev->of_node); } -int of_dma_configure(struct device *dev, struct device_node *np); +int of_dma_configure(struct device *dev, + struct device_node *np, + bool force_dma); void of_dma_deconfigure(struct device *dev); #else /* CONFIG_OF */ -- 1.9.1