get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/806275/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 806275,
    "url": "http://patchwork.ozlabs.org/api/patches/806275/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/linuxppc-dev/patch/20170827161032.22772-13-hch@lst.de/",
    "project": {
        "id": 2,
        "url": "http://patchwork.ozlabs.org/api/projects/2/?format=api",
        "name": "Linux PPC development",
        "link_name": "linuxppc-dev",
        "list_id": "linuxppc-dev.lists.ozlabs.org",
        "list_email": "linuxppc-dev@lists.ozlabs.org",
        "web_url": "https://github.com/linuxppc/wiki/wiki",
        "scm_url": "https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git",
        "webscm_url": "https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git/",
        "list_archive_url": "https://lore.kernel.org/linuxppc-dev/",
        "list_archive_url_format": "https://lore.kernel.org/linuxppc-dev/{}/",
        "commit_url_format": "https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git/commit/?id={}"
    },
    "msgid": "<20170827161032.22772-13-hch@lst.de>",
    "list_archive_url": "https://lore.kernel.org/linuxppc-dev/20170827161032.22772-13-hch@lst.de/",
    "date": "2017-08-27T16:10:32",
    "name": "[12/12] dma-mapping: turn dma_cache_sync into a dma_map_ops method",
    "commit_ref": null,
    "pull_url": null,
    "state": "not-applicable",
    "archived": false,
    "hash": "229d4dcb7474219019bd612d18c2cb6c7adb9ca4",
    "submitter": {
        "id": 82,
        "url": "http://patchwork.ozlabs.org/api/people/82/?format=api",
        "name": "Christoph Hellwig",
        "email": "hch@lst.de"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/linuxppc-dev/patch/20170827161032.22772-13-hch@lst.de/mbox/",
    "series": [
        {
            "id": 29,
            "url": "http://patchwork.ozlabs.org/api/series/29/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/linuxppc-dev/list/?series=29",
            "date": "2017-08-27T16:10:24",
            "name": "[01/12] floppy: consolidate the dummy fd_cacheflush definition",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/29/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/806275/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/806275/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org>",
        "X-Original-To": [
            "patchwork-incoming@ozlabs.org",
            "linuxppc-dev@lists.ozlabs.org"
        ],
        "Delivered-To": [
            "patchwork-incoming@ozlabs.org",
            "linuxppc-dev@lists.ozlabs.org"
        ],
        "Received": [
            "from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3])\n\t(using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xgL8k3dNHz9sD9\n\tfor <patchwork-incoming@ozlabs.org>;\n\tMon, 28 Aug 2017 02:34:46 +1000 (AEST)",
            "from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 3xgL8k2N5fzDqM1\n\tfor <patchwork-incoming@ozlabs.org>;\n\tMon, 28 Aug 2017 02:34:46 +1000 (AEST)",
            "from bombadil.infradead.org (bombadil.infradead.org\n\t[65.50.211.133])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby lists.ozlabs.org (Postfix) with ESMTPS id 3xgKdc1hTPzDqgP\n\tfor <linuxppc-dev@lists.ozlabs.org>;\n\tMon, 28 Aug 2017 02:11:16 +1000 (AEST)",
            "from clnet-p099-196.ikbnet.co.at ([83.175.99.196] helo=localhost)\n\tby bombadil.infradead.org with esmtpsa (Exim 4.87 #1 (Red Hat\n\tLinux)) id 1dm09T-0006v0-HH; Sun, 27 Aug 2017 16:11:07 +0000"
        ],
        "Authentication-Results": [
            "ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=infradead.org header.i=@infradead.org\n\theader.b=\"RT3UlEbq\"; dkim-atps=neutral",
            "lists.ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=infradead.org header.i=@infradead.org\n\theader.b=\"RT3UlEbq\"; dkim-atps=neutral",
            "lists.ozlabs.org; dkim=pass (2048-bit key;\n\tunprotected) header.d=infradead.org header.i=@infradead.org\n\theader.b=\"RT3UlEbq\"; dkim-atps=neutral"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;\n\td=infradead.org; s=bombadil.20170209;\n\th=References:In-Reply-To:Message-Id:\n\tDate:Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type:\n\tContent-Transfer-Encoding:Content-ID:Content-Description:Resent-Date:\n\tResent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:\n\tList-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive;\n\tbh=A6rVdJc79RFX3Nn1zYvkhb1EbACMTbYd+8B2L9Uf2XM=;\n\tb=RT3UlEbqPe8MB7b+BTuHt2VZv\n\t6b++/ifKE+n+LGr+2BIosU/ARSGP2g5kxRc1Rk0tsrYyX6nvY2NLeZ6HNiNMywJgKb/R4wiiTw9M1\n\tU9pReulwbj5F/BInZVnB34ZcIoCaVn4zkeE8iO400H1r0lTXsosvTpeseVhvYHSwqTW8mX/fyTfLQ\n\ta2oaC27VTIyw9k0yF1FsGAeospQijEmaXqxxlkbOpwWbcmKOaByooPzuafsRhaRQ5Soffp88TpVrk\n\tGn45ZbxlByY4cI7sRAbKFd7mwZzF5zUBQO1H2nDbqCYNtlcFk4vPx3DL5EFnjjj5op+YeUfyVq9Y+\n\tEnbIFJULw==;",
        "From": "Christoph Hellwig <hch@lst.de>",
        "To": "iommu@lists.linux-foundation.org",
        "Subject": "[PATCH 12/12] dma-mapping: turn dma_cache_sync into a dma_map_ops\n\tmethod",
        "Date": "Sun, 27 Aug 2017 18:10:32 +0200",
        "Message-Id": "<20170827161032.22772-13-hch@lst.de>",
        "X-Mailer": "git-send-email 2.11.0",
        "In-Reply-To": "<20170827161032.22772-1-hch@lst.de>",
        "References": "<20170827161032.22772-1-hch@lst.de>",
        "X-SRS-Rewrite": "SMTP reverse-path rewritten from <hch@infradead.org> by\n\tbombadil.infradead.org. See http://www.infradead.org/rpr.html",
        "X-BeenThere": "linuxppc-dev@lists.ozlabs.org",
        "X-Mailman-Version": "2.1.23",
        "Precedence": "list",
        "List-Id": "Linux on PowerPC Developers Mail List\n\t<linuxppc-dev.lists.ozlabs.org>",
        "List-Unsubscribe": "<https://lists.ozlabs.org/options/linuxppc-dev>,\n\t<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=unsubscribe>",
        "List-Archive": "<http://lists.ozlabs.org/pipermail/linuxppc-dev/>",
        "List-Post": "<mailto:linuxppc-dev@lists.ozlabs.org>",
        "List-Help": "<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=help>",
        "List-Subscribe": "<https://lists.ozlabs.org/listinfo/linuxppc-dev>,\n\t<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=subscribe>",
        "Cc": "Chris Zankel <chris@zankel.net>, Michal Simek <monstr@monstr.eu>,\n\tlinux-ia64@vger.kernel.org, linux-mips@linux-mips.org,\n\tlinux-sh@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,\n\tlinux-xtensa@linux-xtensa.org, x86@kernel.org,\n\tlinux-kernel@vger.kernel.org, \n\tDavid Howells <dhowells@redhat.com>, Max Filippov <jcmvbkbc@gmail.com>,\n\tGuan Xuetao <gxt@mprc.pku.edu.cn>, Robin Murphy <robin.murphy@arm.com>,\n\tMarek Szyprowski <m.szyprowski@samsung.com>",
        "Errors-To": "linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org",
        "Sender": "\"Linuxppc-dev\"\n\t<linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org>"
    },
    "content": "After we removed all the dead wood it turns out only two architectures\nactually implement dma_cache_sync as a no-op: mips and parisc.  Add\na cache_sync method to struct dma_map_ops and implement it for the\nmips defualt DMA ops, and the parisc pa11 ops.\n\nNote that arm, arc and openrisc support DMA_ATTR_NON_CONSISTENT, but\nnever provided a functional dma_cache_sync implementations, which\nseems somewhat odd.\n\nSigned-off-by: Christoph Hellwig <hch@lst.de>\n---\n arch/alpha/include/asm/dma-mapping.h      |  2 --\n arch/cris/include/asm/dma-mapping.h       |  6 ------\n arch/frv/include/asm/dma-mapping.h        |  6 ------\n arch/hexagon/include/asm/dma-mapping.h    |  3 ---\n arch/ia64/include/asm/dma-mapping.h       |  6 ------\n arch/m32r/include/asm/dma-mapping.h       |  5 -----\n arch/m68k/include/asm/dma-mapping.h       |  6 ------\n arch/metag/include/asm/dma-mapping.h      | 10 ----------\n arch/microblaze/include/asm/dma-mapping.h |  5 -----\n arch/mips/include/asm/dma-mapping.h       |  3 ---\n arch/mips/mm/dma-default.c                |  7 +++----\n arch/mn10300/include/asm/dma-mapping.h    |  6 ------\n arch/nios2/include/asm/dma-mapping.h      |  9 ---------\n arch/parisc/include/asm/dma-mapping.h     |  8 --------\n arch/parisc/kernel/pci-dma.c              |  8 ++++++++\n arch/powerpc/include/asm/dma-mapping.h    |  5 -----\n arch/s390/include/asm/dma-mapping.h       |  5 -----\n arch/sh/include/asm/dma-mapping.h         |  6 ------\n arch/sparc/include/asm/dma-mapping.h      |  8 --------\n arch/tile/include/asm/dma-mapping.h       |  9 ---------\n arch/unicore32/include/asm/dma-mapping.h  |  5 -----\n arch/x86/include/asm/dma-mapping.h        |  6 ------\n arch/xtensa/include/asm/dma-mapping.h     |  5 -----\n include/linux/dma-mapping.h               | 13 +++++++++++++\n 24 files changed, 24 insertions(+), 128 deletions(-)",
    "diff": "diff --git a/arch/alpha/include/asm/dma-mapping.h b/arch/alpha/include/asm/dma-mapping.h\nindex 5d53666935e6..399a4f49355e 100644\n--- a/arch/alpha/include/asm/dma-mapping.h\n+++ b/arch/alpha/include/asm/dma-mapping.h\n@@ -8,6 +8,4 @@ static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)\n \treturn dma_ops;\n }\n \n-#define dma_cache_sync(dev, va, size, dir)\t\t  ((void)0)\n-\n #endif\t/* _ALPHA_DMA_MAPPING_H */\ndiff --git a/arch/cris/include/asm/dma-mapping.h b/arch/cris/include/asm/dma-mapping.h\nindex 256169de3743..e30adde42beb 100644\n--- a/arch/cris/include/asm/dma-mapping.h\n+++ b/arch/cris/include/asm/dma-mapping.h\n@@ -16,10 +16,4 @@ static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)\n }\n #endif\n \n-static inline void\n-dma_cache_sync(struct device *dev, void *vaddr, size_t size,\n-\t       enum dma_data_direction direction)\n-{\n-}\n-\n #endif\ndiff --git a/arch/frv/include/asm/dma-mapping.h b/arch/frv/include/asm/dma-mapping.h\nindex da0e5c9744c4..da24ae943f02 100644\n--- a/arch/frv/include/asm/dma-mapping.h\n+++ b/arch/frv/include/asm/dma-mapping.h\n@@ -14,10 +14,4 @@ static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)\n \treturn &frv_dma_ops;\n }\n \n-static inline\n-void dma_cache_sync(struct device *dev, void *vaddr, size_t size,\n-\t\t    enum dma_data_direction direction)\n-{\n-}\n-\n #endif  /* _ASM_DMA_MAPPING_H */\ndiff --git a/arch/hexagon/include/asm/dma-mapping.h b/arch/hexagon/include/asm/dma-mapping.h\nindex 463dbc18f853..5208de242e79 100644\n--- a/arch/hexagon/include/asm/dma-mapping.h\n+++ b/arch/hexagon/include/asm/dma-mapping.h\n@@ -37,9 +37,6 @@ static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)\n \treturn dma_ops;\n }\n \n-extern void dma_cache_sync(struct device *dev, void *vaddr, size_t size,\n-\t\t\t   enum dma_data_direction direction);\n-\n static inline bool dma_capable(struct device *dev, dma_addr_t addr, size_t size)\n {\n \tif (!dev->dma_mask)\ndiff --git a/arch/ia64/include/asm/dma-mapping.h b/arch/ia64/include/asm/dma-mapping.h\nindex 99dfc1aa9d3c..9e5b5df76ff8 100644\n--- a/arch/ia64/include/asm/dma-mapping.h\n+++ b/arch/ia64/include/asm/dma-mapping.h\n@@ -44,10 +44,4 @@ static inline phys_addr_t dma_to_phys(struct device *dev, dma_addr_t daddr)\n \treturn daddr;\n }\n \n-static inline void\n-dma_cache_sync (struct device *dev, void *vaddr, size_t size,\n-\tenum dma_data_direction dir)\n-{\n-}\n-\n #endif /* _ASM_IA64_DMA_MAPPING_H */\ndiff --git a/arch/m32r/include/asm/dma-mapping.h b/arch/m32r/include/asm/dma-mapping.h\nindex aff3ae8b62f7..9e993daed7a0 100644\n--- a/arch/m32r/include/asm/dma-mapping.h\n+++ b/arch/m32r/include/asm/dma-mapping.h\n@@ -13,11 +13,6 @@ static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)\n \treturn &dma_noop_ops;\n }\n \n-static inline void dma_cache_sync(struct device *dev, void *vaddr, size_t size,\n-\t\t\t\t  enum dma_data_direction direction)\n-{\n-}\n-\n static inline bool dma_capable(struct device *dev, dma_addr_t addr, size_t size)\n {\n \tif (!dev->dma_mask)\ndiff --git a/arch/m68k/include/asm/dma-mapping.h b/arch/m68k/include/asm/dma-mapping.h\nindex 9210e470771b..9a0d559fcc13 100644\n--- a/arch/m68k/include/asm/dma-mapping.h\n+++ b/arch/m68k/include/asm/dma-mapping.h\n@@ -8,10 +8,4 @@ static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)\n         return &m68k_dma_ops;\n }\n \n-static inline void dma_cache_sync(struct device *dev, void *vaddr, size_t size,\n-\t\t\t\t  enum dma_data_direction dir)\n-{\n-\t/* we use coherent allocation, so not much to do here. */\n-}\n-\n #endif  /* _M68K_DMA_MAPPING_H */\ndiff --git a/arch/metag/include/asm/dma-mapping.h b/arch/metag/include/asm/dma-mapping.h\nindex ea573be2b6d0..340265dcf839 100644\n--- a/arch/metag/include/asm/dma-mapping.h\n+++ b/arch/metag/include/asm/dma-mapping.h\n@@ -8,14 +8,4 @@ static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)\n \treturn &metag_dma_ops;\n }\n \n-/*\n- * dma_alloc_attrs() always returns non-cacheable memory, so there's no need to\n- * do any flushing here.\n- */\n-static inline void\n-dma_cache_sync(struct device *dev, void *vaddr, size_t size,\n-\t       enum dma_data_direction direction)\n-{\n-}\n-\n #endif\ndiff --git a/arch/microblaze/include/asm/dma-mapping.h b/arch/microblaze/include/asm/dma-mapping.h\nindex ad448e4aedb6..6b9ea39405b8 100644\n--- a/arch/microblaze/include/asm/dma-mapping.h\n+++ b/arch/microblaze/include/asm/dma-mapping.h\n@@ -25,9 +25,4 @@ static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)\n \treturn &dma_direct_ops;\n }\n \n-static inline void dma_cache_sync(struct device *dev, void *vaddr, size_t size,\n-\t\tenum dma_data_direction direction)\n-{\n-}\n-\n #endif\t/* _ASM_MICROBLAZE_DMA_MAPPING_H */\ndiff --git a/arch/mips/include/asm/dma-mapping.h b/arch/mips/include/asm/dma-mapping.h\nindex aba71385f9d1..6ea1439430a2 100644\n--- a/arch/mips/include/asm/dma-mapping.h\n+++ b/arch/mips/include/asm/dma-mapping.h\n@@ -26,9 +26,6 @@ static inline bool dma_capable(struct device *dev, dma_addr_t addr, size_t size)\n \n static inline void dma_mark_clean(void *addr, size_t size) {}\n \n-extern void dma_cache_sync(struct device *dev, void *vaddr, size_t size,\n-\t       enum dma_data_direction direction);\n-\n #define arch_setup_dma_ops arch_setup_dma_ops\n static inline void arch_setup_dma_ops(struct device *dev, u64 dma_base,\n \t\t\t\t      u64 size, const struct iommu_ops *iommu,\ndiff --git a/arch/mips/mm/dma-default.c b/arch/mips/mm/dma-default.c\nindex 8e78251eccc2..e69073f32a71 100644\n--- a/arch/mips/mm/dma-default.c\n+++ b/arch/mips/mm/dma-default.c\n@@ -419,7 +419,7 @@ int mips_dma_supported(struct device *dev, u64 mask)\n \treturn plat_dma_supported(dev, mask);\n }\n \n-void dma_cache_sync(struct device *dev, void *vaddr, size_t size,\n+static void mips_dma_cache_sync(struct device *dev, void *vaddr, size_t size,\n \t\t\t enum dma_data_direction direction)\n {\n \tBUG_ON(direction == DMA_NONE);\n@@ -428,8 +428,6 @@ void dma_cache_sync(struct device *dev, void *vaddr, size_t size,\n \t\t__dma_sync_virtual(vaddr, size, direction);\n }\n \n-EXPORT_SYMBOL(dma_cache_sync);\n-\n static const struct dma_map_ops mips_default_dma_map_ops = {\n \t.alloc = mips_dma_alloc_coherent,\n \t.free = mips_dma_free_coherent,\n@@ -443,7 +441,8 @@ static const struct dma_map_ops mips_default_dma_map_ops = {\n \t.sync_sg_for_cpu = mips_dma_sync_sg_for_cpu,\n \t.sync_sg_for_device = mips_dma_sync_sg_for_device,\n \t.mapping_error = mips_dma_mapping_error,\n-\t.dma_supported = mips_dma_supported\n+\t.dma_supported = mips_dma_supported,\n+\t.cache_sync = mips_dma_cache_sync,\n };\n \n const struct dma_map_ops *mips_dma_map_ops = &mips_default_dma_map_ops;\ndiff --git a/arch/mn10300/include/asm/dma-mapping.h b/arch/mn10300/include/asm/dma-mapping.h\nindex dc24163b190f..439e474ed6d7 100644\n--- a/arch/mn10300/include/asm/dma-mapping.h\n+++ b/arch/mn10300/include/asm/dma-mapping.h\n@@ -18,10 +18,4 @@ static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)\n \treturn &mn10300_dma_ops;\n }\n \n-static inline\n-void dma_cache_sync(void *vaddr, size_t size,\n-\t\t    enum dma_data_direction direction)\n-{\n-}\n-\n #endif\ndiff --git a/arch/nios2/include/asm/dma-mapping.h b/arch/nios2/include/asm/dma-mapping.h\nindex f8dc62222741..6ceb92251da0 100644\n--- a/arch/nios2/include/asm/dma-mapping.h\n+++ b/arch/nios2/include/asm/dma-mapping.h\n@@ -17,13 +17,4 @@ static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)\n \treturn &nios2_dma_ops;\n }\n \n-/*\n- * dma_alloc_attrs() always returns non-cacheable memory, so there's no need to\n- * do any flushing here.\n- */\n-static inline void dma_cache_sync(struct device *dev, void *vaddr, size_t size,\n-\t\t\t\t  enum dma_data_direction direction)\n-{\n-}\n-\n #endif /* _ASM_NIOS2_DMA_MAPPING_H */\ndiff --git a/arch/parisc/include/asm/dma-mapping.h b/arch/parisc/include/asm/dma-mapping.h\nindex 2b16282add69..cb26bbd71d8a 100644\n--- a/arch/parisc/include/asm/dma-mapping.h\n+++ b/arch/parisc/include/asm/dma-mapping.h\n@@ -32,14 +32,6 @@ static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)\n \treturn hppa_dma_ops;\n }\n \n-static inline void\n-dma_cache_sync(struct device *dev, void *vaddr, size_t size,\n-\t       enum dma_data_direction direction)\n-{\n-\tif (hppa_dma_ops->sync_single_for_cpu)\n-\t\tflush_kernel_dcache_range((unsigned long)vaddr, size);\n-}\n-\n static inline void *\n parisc_walk_tree(struct device *dev)\n {\ndiff --git a/arch/parisc/kernel/pci-dma.c b/arch/parisc/kernel/pci-dma.c\nindex 5f0067a62738..ee43e9f73ad3 100644\n--- a/arch/parisc/kernel/pci-dma.c\n+++ b/arch/parisc/kernel/pci-dma.c\n@@ -572,6 +572,12 @@ static void pa11_dma_sync_sg_for_device(struct device *dev, struct scatterlist *\n \t\tflush_kernel_vmap_range(sg_virt(sg), sg->length);\n }\n \n+static void pa11_dma_cache_sync(struct device *dev, void *vaddr, size_t size,\n+\t       enum dma_data_direction direction)\n+{\n+\tflush_kernel_dcache_range((unsigned long)vaddr, size);\n+}\n+\n const struct dma_map_ops pcxl_dma_ops = {\n \t.dma_supported =\tpa11_dma_supported,\n \t.alloc =\t\tpa11_dma_alloc,\n@@ -584,6 +590,7 @@ const struct dma_map_ops pcxl_dma_ops = {\n \t.sync_single_for_device = pa11_dma_sync_single_for_device,\n \t.sync_sg_for_cpu =\tpa11_dma_sync_sg_for_cpu,\n \t.sync_sg_for_device =\tpa11_dma_sync_sg_for_device,\n+\t.cache_sync =\t\tpa11_dma_cache_sync,\n };\n \n static void *pcx_dma_alloc(struct device *dev, size_t size,\n@@ -620,4 +627,5 @@ const struct dma_map_ops pcx_dma_ops = {\n \t.sync_single_for_device = pa11_dma_sync_single_for_device,\n \t.sync_sg_for_cpu =\tpa11_dma_sync_sg_for_cpu,\n \t.sync_sg_for_device =\tpa11_dma_sync_sg_for_device,\n+\t.cache_sync =\t\tpa11_dma_cache_sync,\n };\ndiff --git a/arch/powerpc/include/asm/dma-mapping.h b/arch/powerpc/include/asm/dma-mapping.h\nindex 320846442bfb..2e43c2ef7632 100644\n--- a/arch/powerpc/include/asm/dma-mapping.h\n+++ b/arch/powerpc/include/asm/dma-mapping.h\n@@ -141,10 +141,5 @@ static inline phys_addr_t dma_to_phys(struct device *dev, dma_addr_t daddr)\n \n #define ARCH_HAS_DMA_MMAP_COHERENT\n \n-static inline void dma_cache_sync(struct device *dev, void *vaddr, size_t size,\n-\t\tenum dma_data_direction direction)\n-{\n-}\n-\n #endif /* __KERNEL__ */\n #endif\t/* _ASM_DMA_MAPPING_H */\ndiff --git a/arch/s390/include/asm/dma-mapping.h b/arch/s390/include/asm/dma-mapping.h\nindex 512ad0eaa11a..b17304b13de5 100644\n--- a/arch/s390/include/asm/dma-mapping.h\n+++ b/arch/s390/include/asm/dma-mapping.h\n@@ -15,11 +15,6 @@ static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)\n \treturn &dma_noop_ops;\n }\n \n-static inline void dma_cache_sync(struct device *dev, void *vaddr, size_t size,\n-\t\t\t\t  enum dma_data_direction direction)\n-{\n-}\n-\n static inline bool dma_capable(struct device *dev, dma_addr_t addr, size_t size)\n {\n \tif (!dev->dma_mask)\ndiff --git a/arch/sh/include/asm/dma-mapping.h b/arch/sh/include/asm/dma-mapping.h\nindex b46194ecef17..e89df111c017 100644\n--- a/arch/sh/include/asm/dma-mapping.h\n+++ b/arch/sh/include/asm/dma-mapping.h\n@@ -9,12 +9,6 @@ static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)\n \treturn dma_ops;\n }\n \n-static inline void dma_cache_sync(struct device *dev, void *vaddr, size_t size,\n-\t\t    enum dma_data_direction dir)\n-{\n-}\n-\n-/* arch/sh/mm/consistent.c */\n extern void *dma_generic_alloc_coherent(struct device *dev, size_t size,\n \t\t\t\t\tdma_addr_t *dma_addr, gfp_t flag,\n \t\t\t\t\tunsigned long attrs);\ndiff --git a/arch/sparc/include/asm/dma-mapping.h b/arch/sparc/include/asm/dma-mapping.h\nindex 60bf1633d554..b298ed45cb23 100644\n--- a/arch/sparc/include/asm/dma-mapping.h\n+++ b/arch/sparc/include/asm/dma-mapping.h\n@@ -5,14 +5,6 @@\n #include <linux/mm.h>\n #include <linux/dma-debug.h>\n \n-static inline void dma_cache_sync(struct device *dev, void *vaddr, size_t size,\n-\t\t\t\t  enum dma_data_direction dir)\n-{\n-\t/* Since dma_{alloc,free}_noncoherent() allocated coherent memory, this\n-\t * routine can be a nop.\n-\t */\n-}\n-\n extern const struct dma_map_ops *dma_ops;\n extern const struct dma_map_ops pci32_dma_ops;\n \ndiff --git a/arch/tile/include/asm/dma-mapping.h b/arch/tile/include/asm/dma-mapping.h\nindex 7061dc8af43a..97ad62878290 100644\n--- a/arch/tile/include/asm/dma-mapping.h\n+++ b/arch/tile/include/asm/dma-mapping.h\n@@ -67,13 +67,4 @@ static inline bool dma_capable(struct device *dev, dma_addr_t addr, size_t size)\n #define HAVE_ARCH_DMA_SET_MASK 1\n int dma_set_mask(struct device *dev, u64 mask);\n \n-/*\n- * dma_alloc_attrs() always returns non-cacheable memory, so there's no need to\n- * do any flushing here.\n- */\n-static inline void dma_cache_sync(struct device *dev, void *vaddr, size_t size,\n-\t\t\t\t  enum dma_data_direction direction)\n-{\n-}\n-\n #endif /* _ASM_TILE_DMA_MAPPING_H */\ndiff --git a/arch/unicore32/include/asm/dma-mapping.h b/arch/unicore32/include/asm/dma-mapping.h\nindex e949855bb794..ac608c2f6af6 100644\n--- a/arch/unicore32/include/asm/dma-mapping.h\n+++ b/arch/unicore32/include/asm/dma-mapping.h\n@@ -45,10 +45,5 @@ static inline phys_addr_t dma_to_phys(struct device *dev, dma_addr_t daddr)\n \n static inline void dma_mark_clean(void *addr, size_t size) {}\n \n-static inline void dma_cache_sync(struct device *dev, void *vaddr,\n-\t\tsize_t size, enum dma_data_direction direction)\n-{\n-}\n-\n #endif /* __KERNEL__ */\n #endif\ndiff --git a/arch/x86/include/asm/dma-mapping.h b/arch/x86/include/asm/dma-mapping.h\nindex 04877267ad18..cdc1ab17eb62 100644\n--- a/arch/x86/include/asm/dma-mapping.h\n+++ b/arch/x86/include/asm/dma-mapping.h\n@@ -66,12 +66,6 @@ static inline phys_addr_t dma_to_phys(struct device *dev, dma_addr_t daddr)\n }\n #endif /* CONFIG_X86_DMA_REMAP */\n \n-static inline void\n-dma_cache_sync(struct device *dev, void *vaddr, size_t size,\n-\tenum dma_data_direction dir)\n-{\n-}\n-\n static inline unsigned long dma_alloc_coherent_mask(struct device *dev,\n \t\t\t\t\t\t    gfp_t gfp)\n {\ndiff --git a/arch/xtensa/include/asm/dma-mapping.h b/arch/xtensa/include/asm/dma-mapping.h\nindex 353e0314d6ba..153bf2370988 100644\n--- a/arch/xtensa/include/asm/dma-mapping.h\n+++ b/arch/xtensa/include/asm/dma-mapping.h\n@@ -23,11 +23,6 @@ static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)\n \treturn &xtensa_dma_map_ops;\n }\n \n-static inline void dma_cache_sync(struct device *dev, void *vaddr, size_t size,\n-\t\t    enum dma_data_direction direction)\n-{\n-}\n-\n static inline dma_addr_t phys_to_dma(struct device *dev, phys_addr_t paddr)\n {\n \treturn (dma_addr_t)paddr;\ndiff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h\nindex 4c98cc96971f..ca73ba27ae79 100644\n--- a/include/linux/dma-mapping.h\n+++ b/include/linux/dma-mapping.h\n@@ -125,6 +125,8 @@ struct dma_map_ops {\n \tvoid (*sync_sg_for_device)(struct device *dev,\n \t\t\t\t   struct scatterlist *sg, int nents,\n \t\t\t\t   enum dma_data_direction dir);\n+\tvoid (*cache_sync)(struct device *dev, void *vaddr, size_t size,\n+\t\t\tenum dma_data_direction direction);\n \tint (*mapping_error)(struct device *dev, dma_addr_t dma_addr);\n \tint (*dma_supported)(struct device *dev, u64 mask);\n #ifdef ARCH_HAS_DMA_GET_REQUIRED_MASK\n@@ -435,6 +437,17 @@ dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg,\n #define dma_map_page(d, p, o, s, r) dma_map_page_attrs(d, p, o, s, r, 0)\n #define dma_unmap_page(d, a, s, r) dma_unmap_page_attrs(d, a, s, r, 0)\n \n+static inline void\n+dma_cache_sync(struct device *dev, void *vaddr, size_t size,\n+\t\tenum dma_data_direction dir)\n+{\n+\tconst struct dma_map_ops *ops = get_dma_ops(dev);\n+\n+\tBUG_ON(!valid_dma_direction(dir));\n+\tif (ops->cache_sync)\n+\t\tops->cache_sync(dev, vaddr, size, dir);\n+}\n+\n extern int dma_common_mmap(struct device *dev, struct vm_area_struct *vma,\n \t\t\t   void *cpu_addr, dma_addr_t dma_addr, size_t size);\n \n",
    "prefixes": [
        "12/12"
    ]
}