[openwrt/openwrt] generic: v6.6: update fitblk driver to work with Linux 6.6
LEDE Commits
lede-commits at lists.infradead.org
Mon Mar 11 12:17:50 PDT 2024
robimarko pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/d356fb33c311a8f37d676aac5bb554715d1d19d2
commit d356fb33c311a8f37d676aac5bb554715d1d19d2
Author: Daniel Golle <daniel at makrotopia.org>
AuthorDate: Fri Mar 1 00:08:35 2024 +0000
generic: v6.6: update fitblk driver to work with Linux 6.6
Update fitblk driver which has previously been backported to Linux 6.1
so it can build and work with Linux 6.6.
Signed-off-by: Daniel Golle <daniel at makrotopia.org>
---
...lock-add-uImage.FIT-subimage-block-driver.patch | 37 ++++++++++++++++++----
1 file changed, 30 insertions(+), 7 deletions(-)
diff --git a/target/linux/generic/pending-6.6/510-block-add-uImage.FIT-subimage-block-driver.patch b/target/linux/generic/pending-6.6/510-block-add-uImage.FIT-subimage-block-driver.patch
index c565350dc0..117edbcef2 100644
--- a/target/linux/generic/pending-6.6/510-block-add-uImage.FIT-subimage-block-driver.patch
+++ b/target/linux/generic/pending-6.6/510-block-add-uImage.FIT-subimage-block-driver.patch
@@ -81,7 +81,7 @@ Signed-off-by: Daniel Golle <daniel at makrotopia.org>
swim_mod-y := swim.o swim_asm.o
--- /dev/null
+++ b/drivers/block/fitblk.c
-@@ -0,0 +1,636 @@
+@@ -0,0 +1,659 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * uImage.FIT virtual block device driver.
@@ -199,9 +199,9 @@ Signed-off-by: Daniel Golle <daniel at makrotopia.org>
+ bool dead;
+};
+
-+static int fitblk_open(struct block_device *bdev, fmode_t mode)
++static int fitblk_open(struct gendisk *disk, fmode_t mode)
+{
-+ struct fitblk *fitblk = bdev->bd_disk->private_data;
++ struct fitblk *fitblk = disk->private_data;
+
+ if (fitblk->dead)
+ return -ENOENT;
@@ -209,7 +209,7 @@ Signed-off-by: Daniel Golle <daniel at makrotopia.org>
+ return 0;
+}
+
-+static void fitblk_release(struct gendisk *disk, fmode_t mode)
++static void fitblk_release(struct gendisk *disk)
+{
+ return;
+}
@@ -283,7 +283,7 @@ Signed-off-by: Daniel Golle <daniel at makrotopia.org>
+
+ if (refcount_dec_if_one(&num_devs)) {
+ sysfs_remove_link(&pdev->dev.kobj, "lower_dev");
-+ blkdev_put(fitblk->lower_bdev, FMODE_READ | FMODE_EXCL);
++ blkdev_put(fitblk->lower_bdev, &_fitblk_claim_ptr);
+ }
+
+ kfree(fitblk);
@@ -373,6 +373,29 @@ Signed-off-by: Daniel Golle <daniel at makrotopia.org>
+ return err;
+}
+
++static void fitblk_mark_dead(struct block_device *bdev, bool surprise)
++{
++ struct list_head *n, *tmp;
++ struct fitblk *fitblk;
++
++ mutex_lock(&devices_mutex);
++ list_for_each_safe(n, tmp, &fitblk_devices) {
++ fitblk = list_entry(n, struct fitblk, list);
++ if (fitblk->lower_bdev != bdev)
++ continue;
++
++ fitblk->dead = true;
++ list_del(&fitblk->list);
++ /* removal needs to be deferred to avoid deadlock */
++ schedule_work(&fitblk->remove_work);
++ }
++ mutex_unlock(&devices_mutex);
++}
++
++static const struct blk_holder_ops fitblk_hops = {
++ .mark_dead = fitblk_mark_dead,
++};
++
+static int parse_fit_on_dev(struct device *dev)
+{
+ struct block_device *bdev;
@@ -401,7 +424,7 @@ Signed-off-by: Daniel Golle <daniel at makrotopia.org>
+ unsigned int slot = 0;
+
+ /* Exclusive open the block device to receive holder notifications */
-+ bdev = blkdev_get_by_dev(dev->devt, FMODE_READ | FMODE_EXCL, &_fitblk_claim_ptr);
++ bdev = blkdev_get_by_dev(dev->devt, BLK_OPEN_READ, &_fitblk_claim_ptr, &fitblk_hops);
+ if (!bdev)
+ return -ENODEV;
+
@@ -653,7 +676,7 @@ Signed-off-by: Daniel Golle <daniel at makrotopia.org>
+ kfree(fit);
+out_blkdev:
+ if (!found || ret)
-+ blkdev_put(bdev, FMODE_READ | FMODE_EXCL);
++ blkdev_put(bdev, &_fitblk_claim_ptr);
+
+ return ret;
+}
More information about the lede-commits
mailing list