Backports Archive on lore.kernel.org
 help / color / Atom feed
From: Hauke Mehrtens <hauke@hauke-m.de>
To: backports@vger.kernel.org
Cc: johannes@sipsolutions.net, Hauke Mehrtens <hauke@hauke-m.de>
Subject: [PATCH 07/11] backports: io.h: Add __ioread32_copy()
Date: Thu,  3 Oct 2019 17:56:38 +0200
Message-ID: <20191003155642.14909-8-hauke@hauke-m.de> (raw)
In-Reply-To: <20191003155642.14909-1-hauke@hauke-m.de>

Add __ioread32_copy() from usptream Linux commit a9aec5881b9d
("lib/iomap_copy.c: add __ioread32_copy()") which is used by mt76
driver.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
 backport/backport-include/linux/io.h |  5 +++++
 backport/compat/backport-4.5.c       | 22 ++++++++++++++++++++++
 2 files changed, 27 insertions(+)

diff --git a/backport/backport-include/linux/io.h b/backport/backport-include/linux/io.h
index 78ae4650..f91085be 100644
--- a/backport/backport-include/linux/io.h
+++ b/backport/backport-include/linux/io.h
@@ -6,4 +6,9 @@
 #define IOMEM_ERR_PTR(err) (__force void __iomem *)ERR_PTR(err)
 #endif
 
+#if LINUX_VERSION_IS_LESS(4,5,0)
+#define __ioread32_copy LINUX_BACKPORT(__ioread32_copy)
+void __ioread32_copy(void *to, const void __iomem *from, size_t count);
+#endif
+
 #endif /* __BP_LINUX_IO_H */
diff --git a/backport/compat/backport-4.5.c b/backport/compat/backport-4.5.c
index 13764dc7..b4aae624 100644
--- a/backport/compat/backport-4.5.c
+++ b/backport/compat/backport-4.5.c
@@ -18,6 +18,7 @@
 #include <linux/slab.h>
 #include <linux/string.h>
 #include <asm/uaccess.h>
+#include <linux/io.h>
 
 #if LINUX_VERSION_IS_GEQ(3,19,0)
 int led_set_brightness_sync(struct led_classdev *led_cdev,
@@ -150,3 +151,24 @@ int devm_led_trigger_register(struct device *dev,
 	return rc;
 }
 EXPORT_SYMBOL_GPL(devm_led_trigger_register);
+
+/**
+ * __ioread32_copy - copy data from MMIO space, in 32-bit units
+ * @to: destination (must be 32-bit aligned)
+ * @from: source, in MMIO space (must be 32-bit aligned)
+ * @count: number of 32-bit quantities to copy
+ *
+ * Copy data from MMIO space to kernel space, in units of 32 bits at a
+ * time.  Order of access is not guaranteed, nor is a memory barrier
+ * performed afterwards.
+ */
+void __ioread32_copy(void *to, const void __iomem *from, size_t count)
+{
+	u32 *dst = to;
+	const u32 __iomem *src = from;
+	const u32 __iomem *end = src + count;
+
+	while (src < end)
+		*dst++ = __raw_readl(src++);
+}
+EXPORT_SYMBOL_GPL(__ioread32_copy);
-- 
2.20.1

--
To unsubscribe from this list: send the line "unsubscribe backports" in

  parent reply index

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-03 15:56 [PATCH 00/11] backports: Update to kernel 5.4-rc1 Hauke Mehrtens
2019-10-03 15:56 ` [PATCH 01/11] backports: patches: refresh against " Hauke Mehrtens
2019-10-03 15:56 ` [PATCH 02/11] backports: pci: include linux/pci-aspm.h Hauke Mehrtens
2019-10-03 15:56 ` [PATCH 03/11] backports: build_bug.h: Add static_assert() Hauke Mehrtens
2019-10-03 15:56 ` [PATCH 04/11] backports: platform_device.h: Add devm_platform_ioremap_resource() Hauke Mehrtens
2019-10-03 15:56 ` [PATCH 05/11] backports: skbuf.h: Add skb_frag_off() Hauke Mehrtens
2019-10-03 15:56 ` [PATCH 06/11] backports: skbuff.h: Add skb_mac_offset() Hauke Mehrtens
2019-10-03 15:56 ` Hauke Mehrtens [this message]
2019-10-03 15:56 ` [PATCH 08/11] backports: io: Add writel_relaxed() Hauke Mehrtens
2019-10-03 15:56 ` [PATCH 09/11] backports: dependencies: make ATH9K OWL depend on kernel 3.14 Hauke Mehrtens
2019-10-04  8:55   ` Johannes Berg
2019-10-04 19:34     ` Hauke Mehrtens
2019-10-03 15:56 ` [PATCH 10/11] backports: lib-arc4: Do not build when activated in kernel Hauke Mehrtens
2019-10-03 15:56 ` [PATCH 11/11] backports: ckmake: limit load to number of CPUs Hauke Mehrtens

Reply instructions:

You may reply publically to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191003155642.14909-8-hauke@hauke-m.de \
    --to=hauke@hauke-m.de \
    --cc=backports@vger.kernel.org \
    --cc=johannes@sipsolutions.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Backports Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/backports/0 backports/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 backports backports/ https://lore.kernel.org/backports \
		backports@vger.kernel.org
	public-inbox-index backports

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.backports


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git