get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 2220336,
    "url": "http://patchwork.ozlabs.org/api/1.1/patches/2220336/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/linux-arc/patch/20260406162231.v5.7.If839f6dde98979fce177f70c6c74689a1904ee76@changeid/",
    "project": {
        "id": 48,
        "url": "http://patchwork.ozlabs.org/api/1.1/projects/48/?format=api",
        "name": "Linux ARC development",
        "link_name": "linux-arc",
        "list_id": "linux-snps-arc.lists.infradead.org",
        "list_email": "linux-snps-arc@lists.infradead.org",
        "web_url": "",
        "scm_url": "",
        "webscm_url": ""
    },
    "msgid": "<20260406162231.v5.7.If839f6dde98979fce177f70c6c74689a1904ee76@changeid>",
    "date": "2026-04-06T23:23:00",
    "name": "[v5,7/9] driver core: Replace dev->dma_coherent with dev_dma_coherent()",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "a03d245e5ce2ec6d7b600126b7a5206e3c707bda",
    "submitter": {
        "id": 9763,
        "url": "http://patchwork.ozlabs.org/api/1.1/people/9763/?format=api",
        "name": "Douglas Anderson",
        "email": "dianders@chromium.org"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/linux-arc/patch/20260406162231.v5.7.If839f6dde98979fce177f70c6c74689a1904ee76@changeid/mbox/",
    "series": [
        {
            "id": 498904,
            "url": "http://patchwork.ozlabs.org/api/1.1/series/498904/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/linux-arc/list/?series=498904",
            "date": "2026-04-06T23:22:53",
            "name": "driver core: Fix some race conditions",
            "version": 5,
            "mbox": "http://patchwork.ozlabs.org/series/498904/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2220336/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2220336/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "\n <linux-snps-arc-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org>",
        "X-Original-To": "incoming@patchwork.ozlabs.org",
        "Delivered-To": "patchwork-incoming@legolas.ozlabs.org",
        "Authentication-Results": [
            "legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n secure) header.d=lists.infradead.org header.i=@lists.infradead.org\n header.a=rsa-sha256 header.s=bombadil.20210309 header.b=XMQRDo5I;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256\n header.s=google header.b=Wznt3Pyb;\n\tdkim-atps=neutral",
            "legolas.ozlabs.org;\n spf=none (no SPF record) smtp.mailfrom=lists.infradead.org\n (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org;\n envelope-from=linux-snps-arc-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org;\n receiver=patchwork.ozlabs.org)"
        ],
        "Received": [
            "from bombadil.infradead.org (bombadil.infradead.org\n [IPv6:2607:7c80:54:3::133])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fqQRv6YjSz1xtJ\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 07 Apr 2026 09:25:47 +1000 (AEST)",
            "from localhost ([::1] helo=bombadil.infradead.org)\n\tby bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux))\n\tid 1w9tKE-00000005c9e-3A3q;\n\tMon, 06 Apr 2026 23:25:46 +0000",
            "from mail-dl1-x122d.google.com ([2607:f8b0:4864:20::122d])\n\tby bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux))\n\tid 1w9tKC-00000005c7M-2DsT\n\tfor linux-snps-arc@lists.infradead.org;\n\tMon, 06 Apr 2026 23:25:45 +0000",
            "by mail-dl1-x122d.google.com with SMTP id\n a92af1059eb24-1274204434bso4238278c88.1\n        for <linux-snps-arc@lists.infradead.org>;\n Mon, 06 Apr 2026 16:25:44 -0700 (PDT)",
            "from dianders.sjc.corp.google.com\n ([2a00:79e0:2e7c:8:c071:3b78:5a5:824a])\n        by smtp.gmail.com with ESMTPSA id\n 5a478bee46e88-2ca760b0518sm14730975eec.0.2026.04.06.16.25.39\n        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n        Mon, 06 Apr 2026 16:25:41 -0700 (PDT)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;\n\td=lists.infradead.org; s=bombadil.20210309; h=Sender:\n\tContent-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post:\n\tList-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:\n\tMessage-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:\n\tResent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:\n\tList-Owner; bh=/M8Nwx0gRncDXZOShnYgHXXgTXr3xmAcZWnrTT9e7RI=; b=XMQRDo5IyHa/xS\n\tUCYXTyL6ZejAnfbP/9FBSqenw6BcQi5117Ye7YuUBJYyXTbTeVTnkLBYcDA5qSC2MnVgTSzUvCi+K\n\tGKYYf1G2YS9k5OUK5AbUoUs8ebSx1ZZPKHpacZSWu15pvBMcBPhPn5n3G5Tzs2dBxwiBzZGxvZA6G\n\tpw30GaKENOUciBIDTWkPfSZY/TeJyrS/6Kz0l7JfDYxDUmCBmrdv7hkzUDf25Hz3aaKc0VBZV/cE1\n\tsq5er1Xg44ibxDTjQFAUsXAwbArNsZHafPo3dKKOUbv9Uzh1Ai56DG63gy3MoYPZn+3cxV1/xddwx\n\teBpxEVPbwJED9tXeykhA==;",
            "v=1; a=rsa-sha256; c=relaxed/relaxed;\n        d=chromium.org; s=google; t=1775517943; x=1776122743;\n darn=lists.infradead.org;\n        h=content-transfer-encoding:mime-version:references:in-reply-to\n         :message-id:date:subject:cc:to:from:from:to:cc:subject:date\n         :message-id:reply-to;\n        bh=qFmDYcnnDgWKdH7Fx1pvQvOvhn076UMYFbFndXl8P/A=;\n        b=Wznt3Pyb3FomJP+A/Cq5/dG8+/yszC4mcutrEilc4rEbkgWgEWybPtDNH5Ri8oxONC\n         VzlAmzxjMWjc3Wexm96uhZnm6330VxR7ccN/pRq/Ix2RPzKo1byhtcS/E82zq27gCVyI\n         Z0Y3ScvZ3IDrSbC5B3lsgIFFnimwu0MRaTeTQ="
        ],
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n        d=1e100.net; s=20251104; t=1775517943; x=1776122743;\n        h=content-transfer-encoding:mime-version:references:in-reply-to\n         :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from\n         :to:cc:subject:date:message-id:reply-to;\n        bh=qFmDYcnnDgWKdH7Fx1pvQvOvhn076UMYFbFndXl8P/A=;\n        b=mFS2QY3fzW+91Q8XGEb81FOOEgo0GQU34Y7dCkBNcVQEOVrurjVczH8ZdZNfjSvCLJ\n         AZhOmDXEFAFnfUyh82yhTWrQoZjQ1yxFulAIT1b3/nGU+H1daxOCS+kjvHU68HmSa3+y\n         P2TVok9J1xM4jeA4R8A/0cKIAr8pVKrz6ZwcxjyBhXuML2dHguVd6EQgX0VNr5w7pzvx\n         kwz3H6AHFQGyHac/znPBkTqz8H1KwCRBRg3Get5WPRq9V7BmW0WYD2kVBKOeLR/ovZJN\n         7l+86he5iy2GraciY2cyyft37mvMkO/DjbMWtvHwcYcxp08k0xDHQzNueqjtEn4b++RW\n         hdqA==",
        "X-Forwarded-Encrypted": "i=1;\n AJvYcCVzfXgg2uX8c2sh4QxrTwf7zUTkvmSsg997dCdnckQxWSRsh4EhLYRoDLL9HAigRvowjNYYiXSLPpMQ0/P45Q==@lists.infradead.org",
        "X-Gm-Message-State": "AOJu0Yx0ci5p0Ih7GlcenYbuS4jKUxWlQhCgQbfv3LBHoce7apbFysxQ\n\twBU6BCbdFbQjuqd1niHZuYJHKq9XsI8PwCHwvj++Se4aQdwvQTVMKvSvfiiyOrQ8Rg==",
        "X-Gm-Gg": "AeBDievks5qfsvPrku7Fns8/Z2m2CGonlvkAhwRJaOhbhdcjCu2cX3mTwxaI85wkqSP\n\tpdI4jO7VtnnDyFX9q1XuhWnOGrrP58X2nuv2+Q7hwXlGQn9HXZy0IhcR8fxu8ya9P3nq0qGGA39\n\tHSusV1nuBha2XNgEvGlbXXKjXszZDRzvR7pEW+VB8+vl5lWwoiTCrYW8D0uo5OPmvWAopSvkWLo\n\tJPq3GP2fDYBJj3RZNiv1cgxVtHeaGPHzYE2Qw7rjAJJzpWB6WTy80kjVxLa6WZiPz1osOmCDodL\n\tVMdkXqSUt575DP/iH5pen5YeAiGC7EIz1DX1GFHUL0asHkpZMYVaKh49/OYl+rdThfRA+ANNrQA\n\t9jSnu34KQqKubYtd9xmAtOQuQRuV5JIK4vwo5lMS1mwdCn/nwRsDZrk9i4qjN+Um/nLTz4R+iVY\n\tRz1TP3lgsHdjAl8fUm0Cw+3ER4YtFKVXEwKVLTO/694a7YZjic1cBkz96GapewR6rTsA0IiJuUT\n\tF2Vwh2QWN0QTMSa1jbr",
        "X-Received": "by 2002:a05:693c:300c:b0:2be:acac:af7f with SMTP id\n 5a478bee46e88-2cad6ab1abfmr6524179eec.7.1775517943447;\n        Mon, 06 Apr 2026 16:25:43 -0700 (PDT)",
        "From": "Douglas Anderson <dianders@chromium.org>",
        "To": "Greg Kroah-Hartman <gregkh@linuxfoundation.org>,\n\t\"Rafael J . Wysocki\" <rafael@kernel.org>,\n\tDanilo Krummrich <dakr@kernel.org>,\n\tAlan Stern <stern@rowland.harvard.edu>",
        "Cc": "Alexey Kardashevskiy <aik@ozlabs.ru>,\n\tJohan Hovold <johan@kernel.org>,\n\tEric Dumazet <edumazet@google.com>,\n\tLeon Romanovsky <leon@kernel.org>,\n\tChristoph Hellwig <hch@lst.de>,\n\tRobin Murphy <robin.murphy@arm.com>,\n\tmaz@kernel.org,\n\tAlexander Lobakin <aleksander.lobakin@intel.com>,\n\tSaravana Kannan <saravanak@kernel.org>,\n\tDouglas Anderson <dianders@chromium.org>,\n\tVinod Koul <vkoul@kernel.org>,\n\tFrank.Li@kernel.org,\n\talex@ghiti.fr,\n\tandre.przywara@arm.com,\n\tandrew@lunn.ch,\n\taou@eecs.berkeley.edu,\n\tcatalin.marinas@arm.com,\n\tdmaengine@vger.kernel.org,\n\tdriver-core@lists.linux.dev,\n\tgregory.clement@bootlin.com,\n\tiommu@lists.linux.dev,\n\tjgg@ziepe.ca,\n\tkees@kernel.org,\n\tlinux-arm-kernel@lists.infradead.org,\n\tlinux-kernel@vger.kernel.org,\n\tlinux-mips@vger.kernel.org,\n\tlinux-riscv@lists.infradead.org,\n\tlinux-snps-arc@lists.infradead.org,\n\tlinux@armlinux.org.uk,\n\tm.szyprowski@samsung.com,\n\tpalmer@dabbelt.com,\n\tpeter.ujfalusi@gmail.com,\n\tpjw@kernel.org,\n\tsebastian.hesselbarth@gmail.com,\n\ttsbogend@alpha.franken.de,\n\tvgupta@kernel.org,\n\twill@kernel.org,\n\twilly@infradead.org",
        "Subject": "[PATCH v5 7/9] driver core: Replace dev->dma_coherent with\n dev_dma_coherent()",
        "Date": "Mon,  6 Apr 2026 16:23:00 -0700",
        "Message-ID": "\n <20260406162231.v5.7.If839f6dde98979fce177f70c6c74689a1904ee76@changeid>",
        "X-Mailer": "git-send-email 2.53.0.1213.gd9a14994de-goog",
        "In-Reply-To": "<20260406232444.3117516-1-dianders@chromium.org>",
        "References": "<20260406232444.3117516-1-dianders@chromium.org>",
        "MIME-Version": "1.0",
        "X-CRM114-Version": "20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 ",
        "X-CRM114-CacheID": "sfid-20260406_162544_584782_43785204 ",
        "X-CRM114-Status": "GOOD (  24.65  )",
        "X-Spam-Score": "-2.6 (--)",
        "X-Spam-Report": "Spam detection software,\n running on the system \"bombadil.infradead.org\",\n has NOT identified this incoming email as spam.  The original\n message has been attached to this so you can view it or label\n similar future email.  If you have any questions, see\n the administrator of that system for details.\n Content preview:  In C,\n bitfields are not necessarily safe to modify from multiple\n    threads without locking. Switch \"dma_coherent\" over to the \"flags\" field\n   so modifications are safe. Cc: Christoph Hellwig <hch@lst.de> Reviewed-by:\n    Rafael J. Wysocki (Intel) <rafael@kernel.org> Reviewed-by: Danilo\n Krummrich\n    <dakr@kernel.org> Acked-by: Vinod Koul <vkoul@kernel.org> Signed-off-by:\n   Dou [...]\n Content analysis details:   (-2.6 points, 5.0 required)\n  pts rule name              description\n ---- ----------------------\n --------------------------------------------------\n -0.0 RCVD_IN_DNSWL_NONE     RBL: Sender listed at https://www.dnswl.org/, no\n                             trust\n                             [2607:f8b0:4864:20:0:0:0:122d listed in]\n                             [list.dnswl.org]\n -0.0 SPF_PASS               SPF: sender matches SPF record\n  0.0 SPF_HELO_NONE          SPF: HELO does not publish an SPF Record\n -0.1 DKIM_VALID_EF          Message has a valid DKIM or DK signature from\n                             envelope-from domain\n  0.1 DKIM_SIGNED            Message has a DKIM or DK signature,\n not necessarily valid\n -0.1 DKIM_VALID_AU          Message has a valid DKIM or DK signature from\n author's\n                             domain\n -0.1 DKIM_VALID             Message has at least one valid DKIM or DK\n signature\n -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%\n                             [score: 0.0000]\n -0.5 DKIMWL_WL_HIGH         DKIMwl.org - High trust sender",
        "X-BeenThere": "linux-snps-arc@lists.infradead.org",
        "X-Mailman-Version": "2.1.34",
        "Precedence": "list",
        "List-Id": "Linux on Synopsys ARC Processors <linux-snps-arc.lists.infradead.org>",
        "List-Unsubscribe": "<http://lists.infradead.org/mailman/options/linux-snps-arc>,\n <mailto:linux-snps-arc-request@lists.infradead.org?subject=unsubscribe>",
        "List-Archive": "<http://lists.infradead.org/pipermail/linux-snps-arc/>",
        "List-Post": "<mailto:linux-snps-arc@lists.infradead.org>",
        "List-Help": "<mailto:linux-snps-arc-request@lists.infradead.org?subject=help>",
        "List-Subscribe": "<http://lists.infradead.org/mailman/listinfo/linux-snps-arc>,\n <mailto:linux-snps-arc-request@lists.infradead.org?subject=subscribe>",
        "Content-Type": "text/plain; charset=\"us-ascii\"",
        "Content-Transfer-Encoding": "7bit",
        "Sender": "\"linux-snps-arc\" <linux-snps-arc-bounces@lists.infradead.org>",
        "Errors-To": "\n linux-snps-arc-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org"
    },
    "content": "In C, bitfields are not necessarily safe to modify from multiple\nthreads without locking. Switch \"dma_coherent\" over to the \"flags\"\nfield so modifications are safe.\n\nCc: Christoph Hellwig <hch@lst.de>\nReviewed-by: Rafael J. Wysocki (Intel) <rafael@kernel.org>\nReviewed-by: Danilo Krummrich <dakr@kernel.org>\nAcked-by: Vinod Koul <vkoul@kernel.org>\nSigned-off-by: Douglas Anderson <dianders@chromium.org>\n---\nNot fixing any known bugs; problem is theoretical and found by code\ninspection. Change is done somewhat manually and only lightly tested\n(mostly compile-time tested).\n\nNOTE: even though previously we only took up a bit if\nCONFIG_ARCH_HAS_SYNC_DMA_FOR_DEVICE, CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU,\nor CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU_ALL, in this change I reserve the\nbit unconditionally.  While we could get the \"dynamic\" behavior by\nchanging the flags definition to be an unnumbered \"enum\", Greg has\nrequested that the numbers be stable.\n\n(no changes since v4)\n\nChanges in v4:\n- Use accessor functions for flags\n\nChanges in v3:\n- New\n\n arch/arc/mm/dma.c                 |  4 ++--\n arch/arm/mach-highbank/highbank.c |  2 +-\n arch/arm/mach-mvebu/coherency.c   |  2 +-\n arch/arm/mm/dma-mapping-nommu.c   |  4 ++--\n arch/arm/mm/dma-mapping.c         | 28 ++++++++++++++--------------\n arch/arm64/mm/dma-mapping.c       |  2 +-\n arch/mips/mm/dma-noncoherent.c    |  2 +-\n arch/riscv/mm/dma-noncoherent.c   |  2 +-\n drivers/base/core.c               |  2 +-\n drivers/dma/ti/k3-udma-glue.c     |  6 +++---\n drivers/dma/ti/k3-udma.c          |  6 +++---\n include/linux/device.h            | 11 ++++-------\n include/linux/dma-map-ops.h       |  2 +-\n 13 files changed, 35 insertions(+), 38 deletions(-)",
    "diff": "diff --git a/arch/arc/mm/dma.c b/arch/arc/mm/dma.c\nindex 6b85e94f3275..9b9adb02b4c5 100644\n--- a/arch/arc/mm/dma.c\n+++ b/arch/arc/mm/dma.c\n@@ -98,8 +98,8 @@ void arch_setup_dma_ops(struct device *dev, bool coherent)\n \t * DMA buffers.\n \t */\n \tif (is_isa_arcv2() && ioc_enable && coherent)\n-\t\tdev->dma_coherent = true;\n+\t\tdev_set_dma_coherent(dev);\n \n \tdev_info(dev, \"use %scoherent DMA ops\\n\",\n-\t\t dev->dma_coherent ? \"\" : \"non\");\n+\t\t dev_dma_coherent(dev) ? \"\" : \"non\");\n }\ndiff --git a/arch/arm/mach-highbank/highbank.c b/arch/arm/mach-highbank/highbank.c\nindex 47335c7dadf8..8b7d0929dac4 100644\n--- a/arch/arm/mach-highbank/highbank.c\n+++ b/arch/arm/mach-highbank/highbank.c\n@@ -98,7 +98,7 @@ static int highbank_platform_notifier(struct notifier_block *nb,\n \tif (of_property_read_bool(dev->of_node, \"dma-coherent\")) {\n \t\tval = readl(sregs_base + reg);\n \t\twritel(val | 0xff01, sregs_base + reg);\n-\t\tdev->dma_coherent = true;\n+\t\tdev_set_dma_coherent(dev);\n \t}\n \n \treturn NOTIFY_OK;\ndiff --git a/arch/arm/mach-mvebu/coherency.c b/arch/arm/mach-mvebu/coherency.c\nindex fa2c1e1aeb96..7234d487ff39 100644\n--- a/arch/arm/mach-mvebu/coherency.c\n+++ b/arch/arm/mach-mvebu/coherency.c\n@@ -95,7 +95,7 @@ static int mvebu_hwcc_notifier(struct notifier_block *nb,\n \n \tif (event != BUS_NOTIFY_ADD_DEVICE)\n \t\treturn NOTIFY_DONE;\n-\tdev->dma_coherent = true;\n+\tdev_set_dma_coherent(dev);\n \n \treturn NOTIFY_OK;\n }\ndiff --git a/arch/arm/mm/dma-mapping-nommu.c b/arch/arm/mm/dma-mapping-nommu.c\nindex fecac107fd0d..c6a70686507b 100644\n--- a/arch/arm/mm/dma-mapping-nommu.c\n+++ b/arch/arm/mm/dma-mapping-nommu.c\n@@ -42,11 +42,11 @@ void arch_setup_dma_ops(struct device *dev, bool coherent)\n \t\t * enough to check if MPU is in use or not since in absence of\n \t\t * MPU system memory map is used.\n \t\t */\n-\t\tdev->dma_coherent = cacheid ? coherent : true;\n+\t\tdev_assign_dma_coherent(dev, cacheid ? coherent : true);\n \t} else {\n \t\t/*\n \t\t * Assume coherent DMA in case MMU/MPU has not been set up.\n \t\t */\n-\t\tdev->dma_coherent = (get_cr() & CR_M) ? coherent : true;\n+\t\tdev_assign_dma_coherent(dev, (get_cr() & CR_M) ? coherent : true);\n \t}\n }\ndiff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c\nindex f304037d1c34..f9bc53b60f99 100644\n--- a/arch/arm/mm/dma-mapping.c\n+++ b/arch/arm/mm/dma-mapping.c\n@@ -1076,7 +1076,7 @@ static void *arm_iommu_alloc_attrs(struct device *dev, size_t size,\n \tpgprot_t prot = __get_dma_pgprot(attrs, PAGE_KERNEL);\n \tstruct page **pages;\n \tvoid *addr = NULL;\n-\tint coherent_flag = dev->dma_coherent ? COHERENT : NORMAL;\n+\tint coherent_flag = dev_dma_coherent(dev) ? COHERENT : NORMAL;\n \n \t*handle = DMA_MAPPING_ERROR;\n \tsize = PAGE_ALIGN(size);\n@@ -1124,7 +1124,7 @@ static int arm_iommu_mmap_attrs(struct device *dev, struct vm_area_struct *vma,\n \tif (vma->vm_pgoff >= nr_pages)\n \t\treturn -ENXIO;\n \n-\tif (!dev->dma_coherent)\n+\tif (!dev_dma_coherent(dev))\n \t\tvma->vm_page_prot = __get_dma_pgprot(attrs, vma->vm_page_prot);\n \n \terr = vm_map_pages(vma, pages, nr_pages);\n@@ -1141,7 +1141,7 @@ static int arm_iommu_mmap_attrs(struct device *dev, struct vm_area_struct *vma,\n static void arm_iommu_free_attrs(struct device *dev, size_t size, void *cpu_addr,\n \tdma_addr_t handle, unsigned long attrs)\n {\n-\tint coherent_flag = dev->dma_coherent ? COHERENT : NORMAL;\n+\tint coherent_flag = dev_dma_coherent(dev) ? COHERENT : NORMAL;\n \tstruct page **pages;\n \tsize = PAGE_ALIGN(size);\n \n@@ -1202,7 +1202,7 @@ static int __map_sg_chunk(struct device *dev, struct scatterlist *sg,\n \t\tphys_addr_t phys = page_to_phys(sg_page(s));\n \t\tunsigned int len = PAGE_ALIGN(s->offset + s->length);\n \n-\t\tif (!dev->dma_coherent && !(attrs & DMA_ATTR_SKIP_CPU_SYNC))\n+\t\tif (!dev_dma_coherent(dev) && !(attrs & DMA_ATTR_SKIP_CPU_SYNC))\n \t\t\tarch_sync_dma_for_device(sg_phys(s), s->length, dir);\n \n \t\tprot = __dma_info_to_prot(dir, attrs);\n@@ -1304,7 +1304,7 @@ static void arm_iommu_unmap_sg(struct device *dev,\n \t\tif (sg_dma_len(s))\n \t\t\t__iommu_remove_mapping(dev, sg_dma_address(s),\n \t\t\t\t\t       sg_dma_len(s));\n-\t\tif (!dev->dma_coherent && !(attrs & DMA_ATTR_SKIP_CPU_SYNC))\n+\t\tif (!dev_dma_coherent(dev) && !(attrs & DMA_ATTR_SKIP_CPU_SYNC))\n \t\t\tarch_sync_dma_for_cpu(sg_phys(s), s->length, dir);\n \t}\n }\n@@ -1323,7 +1323,7 @@ static void arm_iommu_sync_sg_for_cpu(struct device *dev,\n \tstruct scatterlist *s;\n \tint i;\n \n-\tif (dev->dma_coherent)\n+\tif (dev_dma_coherent(dev))\n \t\treturn;\n \n \tfor_each_sg(sg, s, nents, i)\n@@ -1345,7 +1345,7 @@ static void arm_iommu_sync_sg_for_device(struct device *dev,\n \tstruct scatterlist *s;\n \tint i;\n \n-\tif (dev->dma_coherent)\n+\tif (dev_dma_coherent(dev))\n \t\treturn;\n \n \tfor_each_sg(sg, s, nents, i)\n@@ -1371,7 +1371,7 @@ static dma_addr_t arm_iommu_map_phys(struct device *dev, phys_addr_t phys,\n \tdma_addr_t dma_addr;\n \tint ret, prot;\n \n-\tif (!dev->dma_coherent &&\n+\tif (!dev_dma_coherent(dev) &&\n \t    !(attrs & (DMA_ATTR_SKIP_CPU_SYNC | DMA_ATTR_MMIO)))\n \t\tarch_sync_dma_for_device(phys, size, dir);\n \n@@ -1412,7 +1412,7 @@ static void arm_iommu_unmap_phys(struct device *dev, dma_addr_t handle,\n \tif (!iova)\n \t\treturn;\n \n-\tif (!dev->dma_coherent &&\n+\tif (!dev_dma_coherent(dev) &&\n \t    !(attrs & (DMA_ATTR_SKIP_CPU_SYNC | DMA_ATTR_MMIO))) {\n \t\tphys_addr_t phys = iommu_iova_to_phys(mapping->domain, iova);\n \n@@ -1431,7 +1431,7 @@ static void arm_iommu_sync_single_for_cpu(struct device *dev,\n \tunsigned int offset = handle & ~PAGE_MASK;\n \tphys_addr_t phys;\n \n-\tif (dev->dma_coherent || !iova)\n+\tif (dev_dma_coherent(dev) || !iova)\n \t\treturn;\n \n \tphys = iommu_iova_to_phys(mapping->domain, iova);\n@@ -1446,7 +1446,7 @@ static void arm_iommu_sync_single_for_device(struct device *dev,\n \tunsigned int offset = handle & ~PAGE_MASK;\n \tphys_addr_t phys;\n \n-\tif (dev->dma_coherent || !iova)\n+\tif (dev_dma_coherent(dev) || !iova)\n \t\treturn;\n \n \tphys = iommu_iova_to_phys(mapping->domain, iova);\n@@ -1701,13 +1701,13 @@ static void arm_teardown_iommu_dma_ops(struct device *dev) { }\n void arch_setup_dma_ops(struct device *dev, bool coherent)\n {\n \t/*\n-\t * Due to legacy code that sets the ->dma_coherent flag from a bus\n-\t * notifier we can't just assign coherent to the ->dma_coherent flag\n+\t * Due to legacy code that sets the dma_coherent flag from a bus\n+\t * notifier we can't just assign coherent to the dma_coherent flag\n \t * here, but instead have to make sure we only set but never clear it\n \t * for now.\n \t */\n \tif (coherent)\n-\t\tdev->dma_coherent = true;\n+\t\tdev_set_dma_coherent(dev);\n \n \t/*\n \t * Don't override the dma_ops if they have already been set. Ideally\ndiff --git a/arch/arm64/mm/dma-mapping.c b/arch/arm64/mm/dma-mapping.c\nindex b2b5792b2caa..dc1fce939451 100644\n--- a/arch/arm64/mm/dma-mapping.c\n+++ b/arch/arm64/mm/dma-mapping.c\n@@ -48,7 +48,7 @@ void arch_setup_dma_ops(struct device *dev, bool coherent)\n \t\t   dev_driver_string(dev), dev_name(dev),\n \t\t   ARCH_DMA_MINALIGN, cls);\n \n-\tdev->dma_coherent = coherent;\n+\tdev_assign_dma_coherent(dev, coherent);\n \n \txen_setup_dma_ops(dev);\n }\ndiff --git a/arch/mips/mm/dma-noncoherent.c b/arch/mips/mm/dma-noncoherent.c\nindex ab4f2a75a7d0..30ef3e247eb7 100644\n--- a/arch/mips/mm/dma-noncoherent.c\n+++ b/arch/mips/mm/dma-noncoherent.c\n@@ -139,6 +139,6 @@ void arch_sync_dma_for_cpu(phys_addr_t paddr, size_t size,\n #ifdef CONFIG_ARCH_HAS_SETUP_DMA_OPS\n void arch_setup_dma_ops(struct device *dev, bool coherent)\n {\n-\tdev->dma_coherent = coherent;\n+\tdev_assign_dma_coherent(dev, coherent);\n }\n #endif\ndiff --git a/arch/riscv/mm/dma-noncoherent.c b/arch/riscv/mm/dma-noncoherent.c\nindex cb89d7e0ba88..a1ec2d71d1c9 100644\n--- a/arch/riscv/mm/dma-noncoherent.c\n+++ b/arch/riscv/mm/dma-noncoherent.c\n@@ -140,7 +140,7 @@ void arch_setup_dma_ops(struct device *dev, bool coherent)\n \t\t   \"%s %s: device non-coherent but no non-coherent operations supported\",\n \t\t   dev_driver_string(dev), dev_name(dev));\n \n-\tdev->dma_coherent = coherent;\n+\tdev_assign_dma_coherent(dev, coherent);\n }\n \n void riscv_noncoherent_supported(void)\ndiff --git a/drivers/base/core.c b/drivers/base/core.c\nindex e94749092345..8a83d7c93361 100644\n--- a/drivers/base/core.c\n+++ b/drivers/base/core.c\n@@ -3173,7 +3173,7 @@ void device_initialize(struct device *dev)\n #if defined(CONFIG_ARCH_HAS_SYNC_DMA_FOR_DEVICE) || \\\n     defined(CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU) || \\\n     defined(CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU_ALL)\n-\tdev->dma_coherent = dma_default_coherent;\n+\tdev_assign_dma_coherent(dev, dma_default_coherent);\n #endif\n \tswiotlb_dev_init(dev);\n }\ndiff --git a/drivers/dma/ti/k3-udma-glue.c b/drivers/dma/ti/k3-udma-glue.c\nindex f87d244cc2d6..686dc140293e 100644\n--- a/drivers/dma/ti/k3-udma-glue.c\n+++ b/drivers/dma/ti/k3-udma-glue.c\n@@ -312,7 +312,7 @@ k3_udma_glue_request_tx_chn_common(struct device *dev,\n \n \tif (xudma_is_pktdma(tx_chn->common.udmax)) {\n \t\t/* prepare the channel device as coherent */\n-\t\ttx_chn->common.chan_dev.dma_coherent = true;\n+\t\tdev_set_dma_coherent(&tx_chn->common.chan_dev);\n \t\tdma_coerce_mask_and_coherent(&tx_chn->common.chan_dev,\n \t\t\t\t\t     DMA_BIT_MASK(48));\n \t}\n@@ -1003,7 +1003,7 @@ k3_udma_glue_request_rx_chn_priv(struct device *dev, const char *name,\n \n \tif (xudma_is_pktdma(rx_chn->common.udmax)) {\n \t\t/* prepare the channel device as coherent */\n-\t\trx_chn->common.chan_dev.dma_coherent = true;\n+\t\tdev_set_dma_coherent(&rx_chn->common.chan_dev);\n \t\tdma_coerce_mask_and_coherent(&rx_chn->common.chan_dev,\n \t\t\t\t\t     DMA_BIT_MASK(48));\n \t}\n@@ -1104,7 +1104,7 @@ k3_udma_glue_request_remote_rx_chn_common(struct k3_udma_glue_rx_channel *rx_chn\n \n \tif (xudma_is_pktdma(rx_chn->common.udmax)) {\n \t\t/* prepare the channel device as coherent */\n-\t\trx_chn->common.chan_dev.dma_coherent = true;\n+\t\tdev_set_dma_coherent(&rx_chn->common.chan_dev);\n \t\tdma_coerce_mask_and_coherent(&rx_chn->common.chan_dev,\n \t\t\t\t\t     DMA_BIT_MASK(48));\n \t\trx_chn->single_fdq = false;\ndiff --git a/drivers/dma/ti/k3-udma.c b/drivers/dma/ti/k3-udma.c\nindex c964ebfcf3b6..1cf158eb7bdb 100644\n--- a/drivers/dma/ti/k3-udma.c\n+++ b/drivers/dma/ti/k3-udma.c\n@@ -428,18 +428,18 @@ static void k3_configure_chan_coherency(struct dma_chan *chan, u32 asel)\n \t\t/* No special handling for the channel */\n \t\tchan->dev->chan_dma_dev = false;\n \n-\t\tchan_dev->dma_coherent = false;\n+\t\tdev_clear_dma_coherent(chan_dev);\n \t\tchan_dev->dma_parms = NULL;\n \t} else if (asel == 14 || asel == 15) {\n \t\tchan->dev->chan_dma_dev = true;\n \n-\t\tchan_dev->dma_coherent = true;\n+\t\tdev_set_dma_coherent(chan_dev);\n \t\tdma_coerce_mask_and_coherent(chan_dev, DMA_BIT_MASK(48));\n \t\tchan_dev->dma_parms = chan_dev->parent->dma_parms;\n \t} else {\n \t\tdev_warn(chan->device->dev, \"Invalid ASEL value: %u\\n\", asel);\n \n-\t\tchan_dev->dma_coherent = false;\n+\t\tdev_clear_dma_coherent(chan_dev);\n \t\tchan_dev->dma_parms = NULL;\n \t}\n }\ndiff --git a/include/linux/device.h b/include/linux/device.h\nindex b7a8b902efb3..5b0fb6ad4c72 100644\n--- a/include/linux/device.h\n+++ b/include/linux/device.h\n@@ -481,6 +481,8 @@ struct device_physical_location {\n  * @DEV_FLAG_STATE_SYNCED: The hardware state of this device has been synced to\n  *\t\tmatch the software state of this device by calling the\n  *\t\tdriver/bus sync_state() callback.\n+ * @DEV_FLAG_DMA_COHERENT: This particular device is dma coherent, even if the\n+ *\t\tarchitecture supports non-coherent devices.\n  */\n enum struct_device_flags {\n \tDEV_FLAG_READY_TO_PROBE = 0,\n@@ -489,6 +491,7 @@ enum struct_device_flags {\n \tDEV_FLAG_DMA_SKIP_SYNC = 3,\n \tDEV_FLAG_DMA_OPS_BYPASS = 4,\n \tDEV_FLAG_STATE_SYNCED = 5,\n+\tDEV_FLAG_DMA_COHERENT = 6,\n \n \tDEV_FLAG_COUNT\n };\n@@ -572,8 +575,6 @@ enum struct_device_flags {\n  * @offline:\tSet after successful invocation of bus type's .offline().\n  * @of_node_reused: Set if the device-tree node is shared with an ancestor\n  *              device.\n- * @dma_coherent: this particular device is dma coherent, even if the\n- *\t\tarchitecture supports non-coherent devices.\n  * @flags:\tDEV_FLAG_XXX flags. Use atomic bitfield operations to modify.\n  *\n  * At the lowest level, every device in a Linux system is represented by an\n@@ -681,11 +682,6 @@ struct device {\n \tbool\t\t\toffline_disabled:1;\n \tbool\t\t\toffline:1;\n \tbool\t\t\tof_node_reused:1;\n-#if defined(CONFIG_ARCH_HAS_SYNC_DMA_FOR_DEVICE) || \\\n-    defined(CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU) || \\\n-    defined(CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU_ALL)\n-\tbool\t\t\tdma_coherent:1;\n-#endif\n \n \tDECLARE_BITMAP(flags, DEV_FLAG_COUNT);\n };\n@@ -718,6 +714,7 @@ __create_dev_flag_accessors(dma_iommu, DEV_FLAG_DMA_IOMMU);\n __create_dev_flag_accessors(dma_skip_sync, DEV_FLAG_DMA_SKIP_SYNC);\n __create_dev_flag_accessors(dma_ops_bypass, DEV_FLAG_DMA_OPS_BYPASS);\n __create_dev_flag_accessors(state_synced, DEV_FLAG_STATE_SYNCED);\n+__create_dev_flag_accessors(dma_coherent, DEV_FLAG_DMA_COHERENT);\n \n #undef __create_dev_flag_accessors\n \ndiff --git a/include/linux/dma-map-ops.h b/include/linux/dma-map-ops.h\nindex edd7de60a957..44dd9035b4fe 100644\n--- a/include/linux/dma-map-ops.h\n+++ b/include/linux/dma-map-ops.h\n@@ -230,7 +230,7 @@ int dma_direct_set_offset(struct device *dev, phys_addr_t cpu_start,\n extern bool dma_default_coherent;\n static inline bool dev_is_dma_coherent(struct device *dev)\n {\n-\treturn dev->dma_coherent;\n+\treturn dev_dma_coherent(dev);\n }\n #else\n #define dma_default_coherent true\n",
    "prefixes": [
        "v5",
        "7/9"
    ]
}