+++ /dev/null
-From 448882aff59adf56490282387c8f02bc4a2b5097 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Wed, 12 Apr 2023 14:06:46 -1000
-Subject: blkcg: Drop unnecessary RCU read [un]locks from
- blkg_conf_prep/finish()
-
-From: Tejun Heo <tj@kernel.org>
-
-[ Upstream commit 83462a6c971cdc550475b672cf29bd3b53bedf84 ]
-
-Now that all RCU flavors have been combined either holding a spin lock,
-disabling irq or disabling preemption implies RCU read lock, so there's no
-need to use rcu_read_[un]lock() explicitly while holding queue_lock. This
-shouldn't cause any behavior changes.
-
-v2: Description updated. Leave __acquires/release on queue_lock alone.
-
-Signed-off-by: Tejun Heo <tj@kernel.org>
-Reviewed-by: Christoph Hellwig <hch@lst.de>
-Link: https://lore.kernel.org/r/20230413000649.115785-2-tj@kernel.org
-Signed-off-by: Jens Axboe <axboe@kernel.dk>
-Stable-dep-of: a13bd91be223 ("block/rq_qos: protect rq_qos apis with a new lock")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- block/blk-cgroup.c | 13 ++++---------
- 1 file changed, 4 insertions(+), 9 deletions(-)
-
-diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c
-index 581aa08e34a8e..b2bdf76ec931d 100644
---- a/block/blk-cgroup.c
-+++ b/block/blk-cgroup.c
-@@ -716,12 +716,12 @@ struct block_device *blkcg_conf_open_bdev(char **inputp)
- *
- * Parse per-blkg config update from @input and initialize @ctx with the
- * result. @ctx->blkg points to the blkg to be updated and @ctx->body the
-- * part of @input following MAJ:MIN. This function returns with RCU read
-- * lock and queue lock held and must be paired with blkg_conf_finish().
-+ * part of @input following MAJ:MIN. This function returns with queue lock
-+ * held and must be paired with blkg_conf_finish().
- */
- int blkg_conf_prep(struct blkcg *blkcg, const struct blkcg_policy *pol,
- char *input, struct blkg_conf_ctx *ctx)
-- __acquires(rcu) __acquires(&bdev->bd_queue->queue_lock)
-+ __acquires(&bdev->bd_queue->queue_lock)
- {
- struct block_device *bdev;
- struct gendisk *disk;
-@@ -743,7 +743,6 @@ int blkg_conf_prep(struct blkcg *blkcg, const struct blkcg_policy *pol,
- if (ret)
- goto fail;
-
-- rcu_read_lock();
- spin_lock_irq(&q->queue_lock);
-
- if (!blkcg_policy_enabled(q, pol)) {
-@@ -772,7 +771,6 @@ int blkg_conf_prep(struct blkcg *blkcg, const struct blkcg_policy *pol,
-
- /* Drop locks to do new blkg allocation with GFP_KERNEL. */
- spin_unlock_irq(&q->queue_lock);
-- rcu_read_unlock();
-
- new_blkg = blkg_alloc(pos, disk, GFP_KERNEL);
- if (unlikely(!new_blkg)) {
-@@ -786,7 +784,6 @@ int blkg_conf_prep(struct blkcg *blkcg, const struct blkcg_policy *pol,
- goto fail_exit_queue;
- }
-
-- rcu_read_lock();
- spin_lock_irq(&q->queue_lock);
-
- if (!blkcg_policy_enabled(q, pol)) {
-@@ -822,7 +819,6 @@ int blkg_conf_prep(struct blkcg *blkcg, const struct blkcg_policy *pol,
- radix_tree_preload_end();
- fail_unlock:
- spin_unlock_irq(&q->queue_lock);
-- rcu_read_unlock();
- fail_exit_queue:
- blk_queue_exit(q);
- fail:
-@@ -849,10 +845,9 @@ EXPORT_SYMBOL_GPL(blkg_conf_prep);
- * with blkg_conf_prep().
- */
- void blkg_conf_finish(struct blkg_conf_ctx *ctx)
-- __releases(&ctx->bdev->bd_queue->queue_lock) __releases(rcu)
-+ __releases(&ctx->bdev->bd_queue->queue_lock)
- {
- spin_unlock_irq(&bdev_get_queue(ctx->bdev)->queue_lock);
-- rcu_read_unlock();
- blkdev_put_no_open(ctx->bdev);
- }
- EXPORT_SYMBOL_GPL(blkg_conf_finish);
---
-2.39.2
-
+++ /dev/null
-From fea7599e8ae67d2b97701b84eff819c150b392b2 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Wed, 12 Apr 2023 14:06:47 -1000
-Subject: blkcg: Restructure blkg_conf_prep() and friends
-
-From: Tejun Heo <tj@kernel.org>
-
-[ Upstream commit faffaab2895914a803e011600164683bf747fee3 ]
-
-We want to support lazy init of rq-qos policies so that iolatency is enabled
-lazily on configuration instead of gendisk initialization. The way blkg
-config helpers are structured now is a bit awkward for that. Let's
-restructure:
-
-* blkcg_conf_open_bdev() is renamed to blkg_conf_open_bdev(). The blkcg_
- prefix was used because the bdev opening step is blkg-independent.
- However, the distinction is too subtle and confuses more than helps. Let's
- switch to blkg prefix so that it's consistent with the type and other
- helper names.
-
-* struct blkg_conf_ctx now remembers the original input string and is always
- initialized by the new blkg_conf_init().
-
-* blkg_conf_open_bdev() is updated to take a pointer to blkg_conf_ctx like
- blkg_conf_prep() and can be called multiple times safely. Instead of
- modifying the double pointer to input string directly,
- blkg_conf_open_bdev() now sets blkg_conf_ctx->body.
-
-* blkg_conf_finish() is renamed to blkg_conf_exit() for symmetry and now
- must be called on all blkg_conf_ctx's which were initialized with
- blkg_conf_init().
-
-Combined, this allows the users to either open the bdev first or do it
-altogether with blkg_conf_prep() which will help implementing lazy init of
-rq-qos policies.
-
-blkg_conf_init/exit() will also be used implement synchronization against
-device removal. This is necessary because iolat / iocost are configured
-through cgroupfs instead of one of the files under /sys/block/DEVICE. As
-cgroupfs operations aren't synchronized with block layer, the lazy init and
-other configuration operations may race against device removal. This patch
-makes blkg_conf_init/exit() used consistently for all cgroup-orginating
-configurations making them a good place to implement explicit
-synchronization.
-
-Users are updated accordingly. No behavior change is intended by this patch.
-
-v2: bfq wasn't updated in v1 causing a build error. Fixed.
-
-v3: Update the description to include future use of blkg_conf_init/exit() as
- synchronization points.
-
-Signed-off-by: Tejun Heo <tj@kernel.org>
-Cc: Josef Bacik <josef@toxicpanda.com>
-Cc: Christoph Hellwig <hch@lst.de>
-Cc: Yu Kuai <yukuai1@huaweicloud.com>
-Reviewed-by: Christoph Hellwig <hch@lst.de>
-Link: https://lore.kernel.org/r/20230413000649.115785-3-tj@kernel.org
-Signed-off-by: Jens Axboe <axboe@kernel.dk>
-Stable-dep-of: a13bd91be223 ("block/rq_qos: protect rq_qos apis with a new lock")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- block/bfq-cgroup.c | 8 ++--
- block/blk-cgroup.c | 105 +++++++++++++++++++++++++++---------------
- block/blk-cgroup.h | 10 ++--
- block/blk-iocost.c | 58 +++++++++++++----------
- block/blk-iolatency.c | 8 ++--
- block/blk-throttle.c | 16 ++++---
- 6 files changed, 127 insertions(+), 78 deletions(-)
-
-diff --git a/block/bfq-cgroup.c b/block/bfq-cgroup.c
-index 89ffb3aa992c1..05e57b467bd97 100644
---- a/block/bfq-cgroup.c
-+++ b/block/bfq-cgroup.c
-@@ -1111,9 +1111,11 @@ static ssize_t bfq_io_set_device_weight(struct kernfs_open_file *of,
- struct bfq_group *bfqg;
- u64 v;
-
-- ret = blkg_conf_prep(blkcg, &blkcg_policy_bfq, buf, &ctx);
-+ blkg_conf_init(&ctx, buf);
-+
-+ ret = blkg_conf_prep(blkcg, &blkcg_policy_bfq, &ctx);
- if (ret)
-- return ret;
-+ goto out;
-
- if (sscanf(ctx.body, "%llu", &v) == 1) {
- /* require "default" on dfl */
-@@ -1135,7 +1137,7 @@ static ssize_t bfq_io_set_device_weight(struct kernfs_open_file *of,
- ret = 0;
- }
- out:
-- blkg_conf_finish(&ctx);
-+ blkg_conf_exit(&ctx);
- return ret ?: nbytes;
- }
-
-diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c
-index b2bdf76ec931d..0399b6e644b28 100644
---- a/block/blk-cgroup.c
-+++ b/block/blk-cgroup.c
-@@ -670,69 +670,93 @@ u64 __blkg_prfill_u64(struct seq_file *sf, struct blkg_policy_data *pd, u64 v)
- EXPORT_SYMBOL_GPL(__blkg_prfill_u64);
-
- /**
-- * blkcg_conf_open_bdev - parse and open bdev for per-blkg config update
-- * @inputp: input string pointer
-+ * blkg_conf_init - initialize a blkg_conf_ctx
-+ * @ctx: blkg_conf_ctx to initialize
-+ * @input: input string
- *
-- * Parse the device node prefix part, MAJ:MIN, of per-blkg config update
-- * from @input and get and return the matching bdev. *@inputp is
-- * updated to point past the device node prefix. Returns an ERR_PTR()
-- * value on error.
-+ * Initialize @ctx which can be used to parse blkg config input string @input.
-+ * Once initialized, @ctx can be used with blkg_conf_open_bdev() and
-+ * blkg_conf_prep(), and must be cleaned up with blkg_conf_exit().
-+ */
-+void blkg_conf_init(struct blkg_conf_ctx *ctx, char *input)
-+{
-+ *ctx = (struct blkg_conf_ctx){ .input = input };
-+}
-+EXPORT_SYMBOL_GPL(blkg_conf_init);
-+
-+/**
-+ * blkg_conf_open_bdev - parse and open bdev for per-blkg config update
-+ * @ctx: blkg_conf_ctx initialized with blkg_conf_init()
- *
-- * Use this function iff blkg_conf_prep() can't be used for some reason.
-+ * Parse the device node prefix part, MAJ:MIN, of per-blkg config update from
-+ * @ctx->input and get and store the matching bdev in @ctx->bdev. @ctx->body is
-+ * set to point past the device node prefix.
-+ *
-+ * This function may be called multiple times on @ctx and the extra calls become
-+ * NOOPs. blkg_conf_prep() implicitly calls this function. Use this function
-+ * explicitly if bdev access is needed without resolving the blkcg / policy part
-+ * of @ctx->input. Returns -errno on error.
- */
--struct block_device *blkcg_conf_open_bdev(char **inputp)
-+int blkg_conf_open_bdev(struct blkg_conf_ctx *ctx)
- {
-- char *input = *inputp;
-+ char *input = ctx->input;
- unsigned int major, minor;
- struct block_device *bdev;
- int key_len;
-
-+ if (ctx->bdev)
-+ return 0;
-+
- if (sscanf(input, "%u:%u%n", &major, &minor, &key_len) != 2)
-- return ERR_PTR(-EINVAL);
-+ return -EINVAL;
-
- input += key_len;
- if (!isspace(*input))
-- return ERR_PTR(-EINVAL);
-+ return -EINVAL;
- input = skip_spaces(input);
-
- bdev = blkdev_get_no_open(MKDEV(major, minor));
- if (!bdev)
-- return ERR_PTR(-ENODEV);
-+ return -ENODEV;
- if (bdev_is_partition(bdev)) {
- blkdev_put_no_open(bdev);
-- return ERR_PTR(-ENODEV);
-+ return -ENODEV;
- }
-
-- *inputp = input;
-- return bdev;
-+ ctx->body = input;
-+ ctx->bdev = bdev;
-+ return 0;
- }
-
- /**
- * blkg_conf_prep - parse and prepare for per-blkg config update
- * @blkcg: target block cgroup
- * @pol: target policy
-- * @input: input string
-- * @ctx: blkg_conf_ctx to be filled
-+ * @ctx: blkg_conf_ctx initialized with blkg_conf_init()
-+ *
-+ * Parse per-blkg config update from @ctx->input and initialize @ctx
-+ * accordingly. On success, @ctx->body points to the part of @ctx->input
-+ * following MAJ:MIN, @ctx->bdev points to the target block device and
-+ * @ctx->blkg to the blkg being configured.
- *
-- * Parse per-blkg config update from @input and initialize @ctx with the
-- * result. @ctx->blkg points to the blkg to be updated and @ctx->body the
-- * part of @input following MAJ:MIN. This function returns with queue lock
-- * held and must be paired with blkg_conf_finish().
-+ * blkg_conf_open_bdev() may be called on @ctx beforehand. On success, this
-+ * function returns with queue lock held and must be followed by
-+ * blkg_conf_exit().
- */
- int blkg_conf_prep(struct blkcg *blkcg, const struct blkcg_policy *pol,
-- char *input, struct blkg_conf_ctx *ctx)
-+ struct blkg_conf_ctx *ctx)
- __acquires(&bdev->bd_queue->queue_lock)
- {
-- struct block_device *bdev;
- struct gendisk *disk;
- struct request_queue *q;
- struct blkcg_gq *blkg;
- int ret;
-
-- bdev = blkcg_conf_open_bdev(&input);
-- if (IS_ERR(bdev))
-- return PTR_ERR(bdev);
-- disk = bdev->bd_disk;
-+ ret = blkg_conf_open_bdev(ctx);
-+ if (ret)
-+ return ret;
-+
-+ disk = ctx->bdev->bd_disk;
- q = disk->queue;
-
- /*
-@@ -810,9 +834,7 @@ int blkg_conf_prep(struct blkcg *blkcg, const struct blkcg_policy *pol,
- }
- success:
- blk_queue_exit(q);
-- ctx->bdev = bdev;
- ctx->blkg = blkg;
-- ctx->body = input;
- return 0;
-
- fail_preloaded:
-@@ -822,7 +844,6 @@ int blkg_conf_prep(struct blkcg *blkcg, const struct blkcg_policy *pol,
- fail_exit_queue:
- blk_queue_exit(q);
- fail:
-- blkdev_put_no_open(bdev);
- /*
- * If queue was bypassing, we should retry. Do so after a
- * short msleep(). It isn't strictly necessary but queue
-@@ -838,19 +859,27 @@ int blkg_conf_prep(struct blkcg *blkcg, const struct blkcg_policy *pol,
- EXPORT_SYMBOL_GPL(blkg_conf_prep);
-
- /**
-- * blkg_conf_finish - finish up per-blkg config update
-- * @ctx: blkg_conf_ctx initialized by blkg_conf_prep()
-+ * blkg_conf_exit - clean up per-blkg config update
-+ * @ctx: blkg_conf_ctx initialized with blkg_conf_init()
- *
-- * Finish up after per-blkg config update. This function must be paired
-- * with blkg_conf_prep().
-+ * Clean up after per-blkg config update. This function must be called on all
-+ * blkg_conf_ctx's initialized with blkg_conf_init().
- */
--void blkg_conf_finish(struct blkg_conf_ctx *ctx)
-+void blkg_conf_exit(struct blkg_conf_ctx *ctx)
- __releases(&ctx->bdev->bd_queue->queue_lock)
- {
-- spin_unlock_irq(&bdev_get_queue(ctx->bdev)->queue_lock);
-- blkdev_put_no_open(ctx->bdev);
-+ if (ctx->blkg) {
-+ spin_unlock_irq(&bdev_get_queue(ctx->bdev)->queue_lock);
-+ ctx->blkg = NULL;
-+ }
-+
-+ if (ctx->bdev) {
-+ blkdev_put_no_open(ctx->bdev);
-+ ctx->body = NULL;
-+ ctx->bdev = NULL;
-+ }
- }
--EXPORT_SYMBOL_GPL(blkg_conf_finish);
-+EXPORT_SYMBOL_GPL(blkg_conf_exit);
-
- static void blkg_iostat_set(struct blkg_iostat *dst, struct blkg_iostat *src)
- {
-diff --git a/block/blk-cgroup.h b/block/blk-cgroup.h
-index 9c5078755e5e1..39b07ef6a3d9a 100644
---- a/block/blk-cgroup.h
-+++ b/block/blk-cgroup.h
-@@ -208,15 +208,17 @@ void blkcg_print_blkgs(struct seq_file *sf, struct blkcg *blkcg,
- u64 __blkg_prfill_u64(struct seq_file *sf, struct blkg_policy_data *pd, u64 v);
-
- struct blkg_conf_ctx {
-+ char *input;
-+ char *body;
- struct block_device *bdev;
- struct blkcg_gq *blkg;
-- char *body;
- };
-
--struct block_device *blkcg_conf_open_bdev(char **inputp);
-+void blkg_conf_init(struct blkg_conf_ctx *ctx, char *input);
-+int blkg_conf_open_bdev(struct blkg_conf_ctx *ctx);
- int blkg_conf_prep(struct blkcg *blkcg, const struct blkcg_policy *pol,
-- char *input, struct blkg_conf_ctx *ctx);
--void blkg_conf_finish(struct blkg_conf_ctx *ctx);
-+ struct blkg_conf_ctx *ctx);
-+void blkg_conf_exit(struct blkg_conf_ctx *ctx);
-
- /**
- * bio_issue_as_root_blkg - see if this bio needs to be issued as root blkg
-diff --git a/block/blk-iocost.c b/block/blk-iocost.c
-index 4442c7a851125..285ced3467abb 100644
---- a/block/blk-iocost.c
-+++ b/block/blk-iocost.c
-@@ -3106,9 +3106,11 @@ static ssize_t ioc_weight_write(struct kernfs_open_file *of, char *buf,
- return nbytes;
- }
-
-- ret = blkg_conf_prep(blkcg, &blkcg_policy_iocost, buf, &ctx);
-+ blkg_conf_init(&ctx, buf);
-+
-+ ret = blkg_conf_prep(blkcg, &blkcg_policy_iocost, &ctx);
- if (ret)
-- return ret;
-+ goto err;
-
- iocg = blkg_to_iocg(ctx.blkg);
-
-@@ -3127,12 +3129,14 @@ static ssize_t ioc_weight_write(struct kernfs_open_file *of, char *buf,
- weight_updated(iocg, &now);
- spin_unlock(&iocg->ioc->lock);
-
-- blkg_conf_finish(&ctx);
-+ blkg_conf_exit(&ctx);
- return nbytes;
-
- einval:
-- blkg_conf_finish(&ctx);
-- return -EINVAL;
-+ ret = -EINVAL;
-+err:
-+ blkg_conf_exit(&ctx);
-+ return ret;
- }
-
- static u64 ioc_qos_prfill(struct seq_file *sf, struct blkg_policy_data *pd,
-@@ -3189,19 +3193,22 @@ static const match_table_t qos_tokens = {
- static ssize_t ioc_qos_write(struct kernfs_open_file *of, char *input,
- size_t nbytes, loff_t off)
- {
-- struct block_device *bdev;
-+ struct blkg_conf_ctx ctx;
- struct gendisk *disk;
- struct ioc *ioc;
- u32 qos[NR_QOS_PARAMS];
- bool enable, user;
-- char *p;
-+ char *body, *p;
- int ret;
-
-- bdev = blkcg_conf_open_bdev(&input);
-- if (IS_ERR(bdev))
-- return PTR_ERR(bdev);
-+ blkg_conf_init(&ctx, input);
-
-- disk = bdev->bd_disk;
-+ ret = blkg_conf_open_bdev(&ctx);
-+ if (ret)
-+ goto err;
-+
-+ body = ctx.body;
-+ disk = ctx.bdev->bd_disk;
- if (!queue_is_mq(disk->queue)) {
- ret = -EOPNOTSUPP;
- goto err;
-@@ -3223,7 +3230,7 @@ static ssize_t ioc_qos_write(struct kernfs_open_file *of, char *input,
- enable = ioc->enabled;
- user = ioc->user_qos_params;
-
-- while ((p = strsep(&input, " \t\n"))) {
-+ while ((p = strsep(&body, " \t\n"))) {
- substring_t args[MAX_OPT_ARGS];
- char buf[32];
- int tok;
-@@ -3313,7 +3320,7 @@ static ssize_t ioc_qos_write(struct kernfs_open_file *of, char *input,
- blk_mq_unquiesce_queue(disk->queue);
- blk_mq_unfreeze_queue(disk->queue);
-
-- blkdev_put_no_open(bdev);
-+ blkg_conf_exit(&ctx);
- return nbytes;
- einval:
- spin_unlock_irq(&ioc->lock);
-@@ -3323,7 +3330,7 @@ static ssize_t ioc_qos_write(struct kernfs_open_file *of, char *input,
-
- ret = -EINVAL;
- err:
-- blkdev_put_no_open(bdev);
-+ blkg_conf_exit(&ctx);
- return ret;
- }
-
-@@ -3376,19 +3383,22 @@ static const match_table_t i_lcoef_tokens = {
- static ssize_t ioc_cost_model_write(struct kernfs_open_file *of, char *input,
- size_t nbytes, loff_t off)
- {
-- struct block_device *bdev;
-+ struct blkg_conf_ctx ctx;
- struct request_queue *q;
- struct ioc *ioc;
- u64 u[NR_I_LCOEFS];
- bool user;
-- char *p;
-+ char *body, *p;
- int ret;
-
-- bdev = blkcg_conf_open_bdev(&input);
-- if (IS_ERR(bdev))
-- return PTR_ERR(bdev);
-+ blkg_conf_init(&ctx, input);
-+
-+ ret = blkg_conf_open_bdev(&ctx);
-+ if (ret)
-+ goto err;
-
-- q = bdev_get_queue(bdev);
-+ body = ctx.body;
-+ q = bdev_get_queue(ctx.bdev);
- if (!queue_is_mq(q)) {
- ret = -EOPNOTSUPP;
- goto err;
-@@ -3396,7 +3406,7 @@ static ssize_t ioc_cost_model_write(struct kernfs_open_file *of, char *input,
-
- ioc = q_to_ioc(q);
- if (!ioc) {
-- ret = blk_iocost_init(bdev->bd_disk);
-+ ret = blk_iocost_init(ctx.bdev->bd_disk);
- if (ret)
- goto err;
- ioc = q_to_ioc(q);
-@@ -3409,7 +3419,7 @@ static ssize_t ioc_cost_model_write(struct kernfs_open_file *of, char *input,
- memcpy(u, ioc->params.i_lcoefs, sizeof(u));
- user = ioc->user_cost_model;
-
-- while ((p = strsep(&input, " \t\n"))) {
-+ while ((p = strsep(&body, " \t\n"))) {
- substring_t args[MAX_OPT_ARGS];
- char buf[32];
- int tok;
-@@ -3456,7 +3466,7 @@ static ssize_t ioc_cost_model_write(struct kernfs_open_file *of, char *input,
- blk_mq_unquiesce_queue(q);
- blk_mq_unfreeze_queue(q);
-
-- blkdev_put_no_open(bdev);
-+ blkg_conf_exit(&ctx);
- return nbytes;
-
- einval:
-@@ -3467,7 +3477,7 @@ static ssize_t ioc_cost_model_write(struct kernfs_open_file *of, char *input,
-
- ret = -EINVAL;
- err:
-- blkdev_put_no_open(bdev);
-+ blkg_conf_exit(&ctx);
- return ret;
- }
-
-diff --git a/block/blk-iolatency.c b/block/blk-iolatency.c
-index 0dc910568b314..6707164c37f1e 100644
---- a/block/blk-iolatency.c
-+++ b/block/blk-iolatency.c
-@@ -836,9 +836,11 @@ static ssize_t iolatency_set_limit(struct kernfs_open_file *of, char *buf,
- u64 oldval;
- int ret;
-
-- ret = blkg_conf_prep(blkcg, &blkcg_policy_iolatency, buf, &ctx);
-+ blkg_conf_init(&ctx, buf);
-+
-+ ret = blkg_conf_prep(blkcg, &blkcg_policy_iolatency, &ctx);
- if (ret)
-- return ret;
-+ goto out;
-
- iolat = blkg_to_lat(ctx.blkg);
- p = ctx.body;
-@@ -874,7 +876,7 @@ static ssize_t iolatency_set_limit(struct kernfs_open_file *of, char *buf,
- iolatency_clear_scaling(blkg);
- ret = 0;
- out:
-- blkg_conf_finish(&ctx);
-+ blkg_conf_exit(&ctx);
- return ret ?: nbytes;
- }
-
-diff --git a/block/blk-throttle.c b/block/blk-throttle.c
-index 47e9d8be68f30..9bac95343ba02 100644
---- a/block/blk-throttle.c
-+++ b/block/blk-throttle.c
-@@ -1368,9 +1368,11 @@ static ssize_t tg_set_conf(struct kernfs_open_file *of,
- int ret;
- u64 v;
-
-- ret = blkg_conf_prep(blkcg, &blkcg_policy_throtl, buf, &ctx);
-+ blkg_conf_init(&ctx, buf);
-+
-+ ret = blkg_conf_prep(blkcg, &blkcg_policy_throtl, &ctx);
- if (ret)
-- return ret;
-+ goto out_finish;
-
- ret = -EINVAL;
- if (sscanf(ctx.body, "%llu", &v) != 1)
-@@ -1389,7 +1391,7 @@ static ssize_t tg_set_conf(struct kernfs_open_file *of,
- tg_conf_updated(tg, false);
- ret = 0;
- out_finish:
-- blkg_conf_finish(&ctx);
-+ blkg_conf_exit(&ctx);
- return ret ?: nbytes;
- }
-
-@@ -1561,9 +1563,11 @@ static ssize_t tg_set_limit(struct kernfs_open_file *of,
- int ret;
- int index = of_cft(of)->private;
-
-- ret = blkg_conf_prep(blkcg, &blkcg_policy_throtl, buf, &ctx);
-+ blkg_conf_init(&ctx, buf);
-+
-+ ret = blkg_conf_prep(blkcg, &blkcg_policy_throtl, &ctx);
- if (ret)
-- return ret;
-+ goto out_finish;
-
- tg = blkg_to_tg(ctx.blkg);
- tg_update_carryover(tg);
-@@ -1662,7 +1666,7 @@ static ssize_t tg_set_limit(struct kernfs_open_file *of,
- tg->td->limit_valid[LIMIT_LOW]);
- ret = 0;
- out_finish:
-- blkg_conf_finish(&ctx);
-+ blkg_conf_exit(&ctx);
- return ret ?: nbytes;
- }
-
---
-2.39.2
-
+++ /dev/null
-From c2881f89038161eb2aa8189e93d3cd6114f7fde8 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Fri, 14 Apr 2023 16:40:08 +0800
-Subject: block/rq_qos: protect rq_qos apis with a new lock
-
-From: Yu Kuai <yukuai3@huawei.com>
-
-[ Upstream commit a13bd91be22318768d55470cbc0b0f4488ef9edf ]
-
-commit 50e34d78815e ("block: disable the elevator int del_gendisk")
-move rq_qos_exit() from disk_release() to del_gendisk(), this will
-introduce some problems:
-
-1) If rq_qos_add() is triggered by enabling iocost/iolatency through
- cgroupfs, then it can concurrent with del_gendisk(), it's not safe to
- write 'q->rq_qos' concurrently.
-
-2) Activate cgroup policy that is relied on rq_qos will call
- rq_qos_add() and blkcg_activate_policy(), and if rq_qos_exit() is
- called in the middle, null-ptr-dereference will be triggered in
- blkcg_activate_policy().
-
-3) blkg_conf_open_bdev() can call blkdev_get_no_open() first to find the
- disk, then if rq_qos_exit() from del_gendisk() is done before
- rq_qos_add(), then memory will be leaked.
-
-This patch add a new disk level mutex 'rq_qos_mutex':
-
-1) The lock will protect rq_qos_exit() directly.
-
-2) For wbt that doesn't relied on blk-cgroup, rq_qos_add() can only be
- called from disk initialization for now because wbt can't be
- destructed until rq_qos_exit(), so it's safe not to protect wbt for
- now. Hoever, in case that rq_qos dynamically destruction is supported
- in the furture, this patch also protect rq_qos_add() from wbt_init()
- directly, this is enough because blk-sysfs already synchronize
- writers with disk removal.
-
-3) For iocost and iolatency, in order to synchronize disk removal and
- cgroup configuration, the lock is held after blkdev_get_no_open()
- from blkg_conf_open_bdev(), and is released in blkg_conf_exit().
- In order to fix the above memory leak, disk_live() is checked after
- holding the new lock.
-
-Fixes: 50e34d78815e ("block: disable the elevator int del_gendisk")
-Signed-off-by: Yu Kuai <yukuai3@huawei.com>
-Acked-by: Tejun Heo <tj@kernel.org>
-Link: https://lore.kernel.org/r/20230414084008.2085155-1-yukuai1@huaweicloud.com
-Signed-off-by: Jens Axboe <axboe@kernel.dk>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- block/blk-cgroup.c | 9 +++++++++
- block/blk-core.c | 1 +
- block/blk-rq-qos.c | 20 ++++++--------------
- block/blk-wbt.c | 2 ++
- include/linux/blkdev.h | 1 +
- 5 files changed, 19 insertions(+), 14 deletions(-)
-
-diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c
-index 0399b6e644b28..ad0cd992a6519 100644
---- a/block/blk-cgroup.c
-+++ b/block/blk-cgroup.c
-@@ -723,6 +723,13 @@ int blkg_conf_open_bdev(struct blkg_conf_ctx *ctx)
- return -ENODEV;
- }
-
-+ mutex_lock(&bdev->bd_queue->rq_qos_mutex);
-+ if (!disk_live(bdev->bd_disk)) {
-+ blkdev_put_no_open(bdev);
-+ mutex_unlock(&bdev->bd_queue->rq_qos_mutex);
-+ return -ENODEV;
-+ }
-+
- ctx->body = input;
- ctx->bdev = bdev;
- return 0;
-@@ -867,6 +874,7 @@ EXPORT_SYMBOL_GPL(blkg_conf_prep);
- */
- void blkg_conf_exit(struct blkg_conf_ctx *ctx)
- __releases(&ctx->bdev->bd_queue->queue_lock)
-+ __releases(&ctx->bdev->bd_queue->rq_qos_mutex)
- {
- if (ctx->blkg) {
- spin_unlock_irq(&bdev_get_queue(ctx->bdev)->queue_lock);
-@@ -874,6 +882,7 @@ void blkg_conf_exit(struct blkg_conf_ctx *ctx)
- }
-
- if (ctx->bdev) {
-+ mutex_unlock(&ctx->bdev->bd_queue->rq_qos_mutex);
- blkdev_put_no_open(ctx->bdev);
- ctx->body = NULL;
- ctx->bdev = NULL;
-diff --git a/block/blk-core.c b/block/blk-core.c
-index 42926e6cb83c8..5675f711643ae 100644
---- a/block/blk-core.c
-+++ b/block/blk-core.c
-@@ -426,6 +426,7 @@ struct request_queue *blk_alloc_queue(int node_id)
- mutex_init(&q->debugfs_mutex);
- mutex_init(&q->sysfs_lock);
- mutex_init(&q->sysfs_dir_lock);
-+ mutex_init(&q->rq_qos_mutex);
- spin_lock_init(&q->queue_lock);
-
- init_waitqueue_head(&q->mq_freeze_wq);
-diff --git a/block/blk-rq-qos.c b/block/blk-rq-qos.c
-index d8cc820a365e3..167be74df4eec 100644
---- a/block/blk-rq-qos.c
-+++ b/block/blk-rq-qos.c
-@@ -288,11 +288,13 @@ void rq_qos_wait(struct rq_wait *rqw, void *private_data,
-
- void rq_qos_exit(struct request_queue *q)
- {
-+ mutex_lock(&q->rq_qos_mutex);
- while (q->rq_qos) {
- struct rq_qos *rqos = q->rq_qos;
- q->rq_qos = rqos->next;
- rqos->ops->exit(rqos);
- }
-+ mutex_unlock(&q->rq_qos_mutex);
- }
-
- int rq_qos_add(struct rq_qos *rqos, struct gendisk *disk, enum rq_qos_id id,
-@@ -300,6 +302,8 @@ int rq_qos_add(struct rq_qos *rqos, struct gendisk *disk, enum rq_qos_id id,
- {
- struct request_queue *q = disk->queue;
-
-+ lockdep_assert_held(&q->rq_qos_mutex);
-+
- rqos->disk = disk;
- rqos->id = id;
- rqos->ops = ops;
-@@ -307,18 +311,13 @@ int rq_qos_add(struct rq_qos *rqos, struct gendisk *disk, enum rq_qos_id id,
- /*
- * No IO can be in-flight when adding rqos, so freeze queue, which
- * is fine since we only support rq_qos for blk-mq queue.
-- *
-- * Reuse ->queue_lock for protecting against other concurrent
-- * rq_qos adding/deleting
- */
- blk_mq_freeze_queue(q);
-
-- spin_lock_irq(&q->queue_lock);
- if (rq_qos_id(q, rqos->id))
- goto ebusy;
- rqos->next = q->rq_qos;
- q->rq_qos = rqos;
-- spin_unlock_irq(&q->queue_lock);
-
- blk_mq_unfreeze_queue(q);
-
-@@ -330,7 +329,6 @@ int rq_qos_add(struct rq_qos *rqos, struct gendisk *disk, enum rq_qos_id id,
-
- return 0;
- ebusy:
-- spin_unlock_irq(&q->queue_lock);
- blk_mq_unfreeze_queue(q);
- return -EBUSY;
- }
-@@ -340,21 +338,15 @@ void rq_qos_del(struct rq_qos *rqos)
- struct request_queue *q = rqos->disk->queue;
- struct rq_qos **cur;
-
-- /*
-- * See comment in rq_qos_add() about freezing queue & using
-- * ->queue_lock.
-- */
-- blk_mq_freeze_queue(q);
-+ lockdep_assert_held(&q->rq_qos_mutex);
-
-- spin_lock_irq(&q->queue_lock);
-+ blk_mq_freeze_queue(q);
- for (cur = &q->rq_qos; *cur; cur = &(*cur)->next) {
- if (*cur == rqos) {
- *cur = rqos->next;
- break;
- }
- }
-- spin_unlock_irq(&q->queue_lock);
--
- blk_mq_unfreeze_queue(q);
-
- mutex_lock(&q->debugfs_mutex);
-diff --git a/block/blk-wbt.c b/block/blk-wbt.c
-index 9ec2a2f1eda38..7a87506ff8e1c 100644
---- a/block/blk-wbt.c
-+++ b/block/blk-wbt.c
-@@ -944,7 +944,9 @@ int wbt_init(struct gendisk *disk)
- /*
- * Assign rwb and add the stats callback.
- */
-+ mutex_lock(&q->rq_qos_mutex);
- ret = rq_qos_add(&rwb->rqos, disk, RQ_QOS_WBT, &wbt_rqos_ops);
-+ mutex_unlock(&q->rq_qos_mutex);
- if (ret)
- goto err_free;
-
-diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
-index 3d620f298aebd..ce4e8063b32b2 100644
---- a/include/linux/blkdev.h
-+++ b/include/linux/blkdev.h
-@@ -401,6 +401,7 @@ struct request_queue {
-
- struct blk_queue_stats *stats;
- struct rq_qos *rq_qos;
-+ struct mutex rq_qos_mutex;
-
- const struct blk_mq_ops *mq_ops;
-
---
-2.39.2
-
+++ /dev/null
-From c624ec2666cd52dba9f0c8e4e3df57320cc77eaf Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Sat, 3 Jun 2023 19:21:01 -0700
-Subject: fsverity: don't use bio_first_page_all() in fsverity_verify_bio()
-
-From: Eric Biggers <ebiggers@google.com>
-
-[ Upstream commit d1f0c5ea04cd0a93309de0246278f0b22394692d ]
-
-bio_first_page_all(bio)->mapping->host is not compatible with large
-folios, since the first page of the bio is not necessarily the head page
-of the folio, and therefore it might not have the mapping pointer set.
-
-Therefore, move the dereference of ->mapping->host into
-verify_data_blocks(), which works with a folio.
-
-(Like the commit that this Fixes, this hasn't actually been tested with
-large folios yet, since the filesystems that use fs/verity/ don't
-support that yet. But based on code review, I think this is needed.)
-
-Fixes: 5d0f0e57ed90 ("fsverity: support verifying data from large folios")
-Link: https://lore.kernel.org/r/20230604022101.48342-1-ebiggers@kernel.org
-Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org>
-Signed-off-by: Eric Biggers <ebiggers@google.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- fs/verity/verify.c | 10 +++++-----
- 1 file changed, 5 insertions(+), 5 deletions(-)
-
-diff --git a/fs/verity/verify.c b/fs/verity/verify.c
-index e9ae1eef5f191..cf40e2fe6ace7 100644
---- a/fs/verity/verify.c
-+++ b/fs/verity/verify.c
-@@ -256,9 +256,10 @@ verify_data_block(struct inode *inode, struct fsverity_info *vi,
- }
-
- static bool
--verify_data_blocks(struct inode *inode, struct folio *data_folio,
-- size_t len, size_t offset, unsigned long max_ra_pages)
-+verify_data_blocks(struct folio *data_folio, size_t len, size_t offset,
-+ unsigned long max_ra_pages)
- {
-+ struct inode *inode = data_folio->mapping->host;
- struct fsverity_info *vi = inode->i_verity_info;
- const unsigned int block_size = vi->tree_params.block_size;
- u64 pos = (u64)data_folio->index << PAGE_SHIFT;
-@@ -298,7 +299,7 @@ verify_data_blocks(struct inode *inode, struct folio *data_folio,
- */
- bool fsverity_verify_blocks(struct folio *folio, size_t len, size_t offset)
- {
-- return verify_data_blocks(folio->mapping->host, folio, len, offset, 0);
-+ return verify_data_blocks(folio, len, offset, 0);
- }
- EXPORT_SYMBOL_GPL(fsverity_verify_blocks);
-
-@@ -319,7 +320,6 @@ EXPORT_SYMBOL_GPL(fsverity_verify_blocks);
- */
- void fsverity_verify_bio(struct bio *bio)
- {
-- struct inode *inode = bio_first_page_all(bio)->mapping->host;
- struct folio_iter fi;
- unsigned long max_ra_pages = 0;
-
-@@ -337,7 +337,7 @@ void fsverity_verify_bio(struct bio *bio)
- }
-
- bio_for_each_folio_all(fi, bio) {
-- if (!verify_data_blocks(inode, fi.folio, fi.length, fi.offset,
-+ if (!verify_data_blocks(fi.folio, fi.length, fi.offset,
- max_ra_pages)) {
- bio->bi_status = BLK_STS_IOERR;
- break;
---
-2.39.2
-
+++ /dev/null
-From bc218478ab0433e37e2d3fa76ce52cb45b262b17 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Mon, 15 May 2023 22:12:16 -0700
-Subject: fsverity: use shash API instead of ahash API
-
-From: Eric Biggers <ebiggers@google.com>
-
-[ Upstream commit 8fcd94add6c5c93ed3b9314456e8420914401530 ]
-
-The "ahash" API, like the other scatterlist-based crypto APIs such as
-"skcipher", comes with some well-known limitations. First, it can't
-easily be used with vmalloc addresses. Second, the request struct can't
-be allocated on the stack. This adds complexity and a possible failure
-point that needs to be worked around, e.g. using a mempool.
-
-The only benefit of ahash over "shash" is that ahash is needed to access
-traditional memory-to-memory crypto accelerators, i.e. drivers/crypto/.
-However, this style of crypto acceleration has largely fallen out of
-favor and been superseded by CPU-based acceleration or inline crypto
-engines. Also, ahash needs to be used asynchronously to take full
-advantage of such hardware, but fs/verity/ has never done this.
-
-On all systems that aren't actually using one of these ahash-only crypto
-accelerators, ahash just adds unnecessary overhead as it sits between
-the user and the underlying shash algorithms.
-
-Also, XFS is planned to cache fsverity Merkle tree blocks in the
-existing XFS buffer cache. As a result, it will be possible for a
-single Merkle tree block to be split across discontiguous pages
-(https://lore.kernel.org/r/20230405233753.GU3223426@dread.disaster.area).
-This data will need to be hashed. It is easiest to work with a vmapped
-address in this case. However, ahash is incompatible with this.
-
-Therefore, let's convert fs/verity/ from ahash to shash. This
-simplifies the code, and it should also slightly improve performance for
-everyone who wasn't actually using one of these ahash-only crypto
-accelerators, i.e. almost everyone (or maybe even everyone)!
-
-Link: https://lore.kernel.org/r/20230516052306.99600-1-ebiggers@kernel.org
-Reviewed-by: Christoph Hellwig <hch@lst.de>
-Acked-by: Ard Biesheuvel <ardb@kernel.org>
-Signed-off-by: Eric Biggers <ebiggers@google.com>
-Stable-dep-of: d1f0c5ea04cd ("fsverity: don't use bio_first_page_all() in fsverity_verify_bio()")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- fs/verity/enable.c | 19 ++---
- fs/verity/fsverity_private.h | 13 +---
- fs/verity/hash_algs.c | 131 ++++++-----------------------------
- fs/verity/verify.c | 109 +++++++++++------------------
- 4 files changed, 71 insertions(+), 201 deletions(-)
-
-diff --git a/fs/verity/enable.c b/fs/verity/enable.c
-index fc4c50e5219dc..bd86b25ac084b 100644
---- a/fs/verity/enable.c
-+++ b/fs/verity/enable.c
-@@ -7,6 +7,7 @@
-
- #include "fsverity_private.h"
-
-+#include <crypto/hash.h>
- #include <linux/mount.h>
- #include <linux/sched/signal.h>
- #include <linux/uaccess.h>
-@@ -20,7 +21,7 @@ struct block_buffer {
- /* Hash a block, writing the result to the next level's pending block buffer. */
- static int hash_one_block(struct inode *inode,
- const struct merkle_tree_params *params,
-- struct ahash_request *req, struct block_buffer *cur)
-+ struct block_buffer *cur)
- {
- struct block_buffer *next = cur + 1;
- int err;
-@@ -36,8 +37,7 @@ static int hash_one_block(struct inode *inode,
- /* Zero-pad the block if it's shorter than the block size. */
- memset(&cur->data[cur->filled], 0, params->block_size - cur->filled);
-
-- err = fsverity_hash_block(params, inode, req, virt_to_page(cur->data),
-- offset_in_page(cur->data),
-+ err = fsverity_hash_block(params, inode, cur->data,
- &next->data[next->filled]);
- if (err)
- return err;
-@@ -76,7 +76,6 @@ static int build_merkle_tree(struct file *filp,
- struct inode *inode = file_inode(filp);
- const u64 data_size = inode->i_size;
- const int num_levels = params->num_levels;
-- struct ahash_request *req;
- struct block_buffer _buffers[1 + FS_VERITY_MAX_LEVELS + 1] = {};
- struct block_buffer *buffers = &_buffers[1];
- unsigned long level_offset[FS_VERITY_MAX_LEVELS];
-@@ -90,9 +89,6 @@ static int build_merkle_tree(struct file *filp,
- return 0;
- }
-
-- /* This allocation never fails, since it's mempool-backed. */
-- req = fsverity_alloc_hash_request(params->hash_alg, GFP_KERNEL);
--
- /*
- * Allocate the block buffers. Buffer "-1" is for data blocks.
- * Buffers 0 <= level < num_levels are for the actual tree levels.
-@@ -130,7 +126,7 @@ static int build_merkle_tree(struct file *filp,
- fsverity_err(inode, "Short read of file data");
- goto out;
- }
-- err = hash_one_block(inode, params, req, &buffers[-1]);
-+ err = hash_one_block(inode, params, &buffers[-1]);
- if (err)
- goto out;
- for (level = 0; level < num_levels; level++) {
-@@ -141,8 +137,7 @@ static int build_merkle_tree(struct file *filp,
- }
- /* Next block at @level is full */
-
-- err = hash_one_block(inode, params, req,
-- &buffers[level]);
-+ err = hash_one_block(inode, params, &buffers[level]);
- if (err)
- goto out;
- err = write_merkle_tree_block(inode,
-@@ -162,8 +157,7 @@ static int build_merkle_tree(struct file *filp,
- /* Finish all nonempty pending tree blocks. */
- for (level = 0; level < num_levels; level++) {
- if (buffers[level].filled != 0) {
-- err = hash_one_block(inode, params, req,
-- &buffers[level]);
-+ err = hash_one_block(inode, params, &buffers[level]);
- if (err)
- goto out;
- err = write_merkle_tree_block(inode,
-@@ -183,7 +177,6 @@ static int build_merkle_tree(struct file *filp,
- out:
- for (level = -1; level < num_levels; level++)
- kfree(buffers[level].data);
-- fsverity_free_hash_request(params->hash_alg, req);
- return err;
- }
-
-diff --git a/fs/verity/fsverity_private.h b/fs/verity/fsverity_private.h
-index d34dcc033d723..8527beca2a454 100644
---- a/fs/verity/fsverity_private.h
-+++ b/fs/verity/fsverity_private.h
-@@ -11,9 +11,6 @@
- #define pr_fmt(fmt) "fs-verity: " fmt
-
- #include <linux/fsverity.h>
--#include <linux/mempool.h>
--
--struct ahash_request;
-
- /*
- * Implementation limit: maximum depth of the Merkle tree. For now 8 is plenty;
-@@ -23,11 +20,10 @@ struct ahash_request;
-
- /* A hash algorithm supported by fs-verity */
- struct fsverity_hash_alg {
-- struct crypto_ahash *tfm; /* hash tfm, allocated on demand */
-+ struct crypto_shash *tfm; /* hash tfm, allocated on demand */
- const char *name; /* crypto API name, e.g. sha256 */
- unsigned int digest_size; /* digest size in bytes, e.g. 32 for SHA-256 */
- unsigned int block_size; /* block size in bytes, e.g. 64 for SHA-256 */
-- mempool_t req_pool; /* mempool with a preallocated hash request */
- /*
- * The HASH_ALGO_* constant for this algorithm. This is different from
- * FS_VERITY_HASH_ALG_*, which uses a different numbering scheme.
-@@ -85,15 +81,10 @@ extern struct fsverity_hash_alg fsverity_hash_algs[];
-
- struct fsverity_hash_alg *fsverity_get_hash_alg(const struct inode *inode,
- unsigned int num);
--struct ahash_request *fsverity_alloc_hash_request(struct fsverity_hash_alg *alg,
-- gfp_t gfp_flags);
--void fsverity_free_hash_request(struct fsverity_hash_alg *alg,
-- struct ahash_request *req);
- const u8 *fsverity_prepare_hash_state(struct fsverity_hash_alg *alg,
- const u8 *salt, size_t salt_size);
- int fsverity_hash_block(const struct merkle_tree_params *params,
-- const struct inode *inode, struct ahash_request *req,
-- struct page *page, unsigned int offset, u8 *out);
-+ const struct inode *inode, const void *data, u8 *out);
- int fsverity_hash_buffer(struct fsverity_hash_alg *alg,
- const void *data, size_t size, u8 *out);
- void __init fsverity_check_hash_algs(void);
-diff --git a/fs/verity/hash_algs.c b/fs/verity/hash_algs.c
-index ea00dbedf756b..e7e982412e23a 100644
---- a/fs/verity/hash_algs.c
-+++ b/fs/verity/hash_algs.c
-@@ -8,7 +8,6 @@
- #include "fsverity_private.h"
-
- #include <crypto/hash.h>
--#include <linux/scatterlist.h>
-
- /* The hash algorithms supported by fs-verity */
- struct fsverity_hash_alg fsverity_hash_algs[] = {
-@@ -44,7 +43,7 @@ struct fsverity_hash_alg *fsverity_get_hash_alg(const struct inode *inode,
- unsigned int num)
- {
- struct fsverity_hash_alg *alg;
-- struct crypto_ahash *tfm;
-+ struct crypto_shash *tfm;
- int err;
-
- if (num >= ARRAY_SIZE(fsverity_hash_algs) ||
-@@ -63,11 +62,7 @@ struct fsverity_hash_alg *fsverity_get_hash_alg(const struct inode *inode,
- if (alg->tfm != NULL)
- goto out_unlock;
-
-- /*
-- * Using the shash API would make things a bit simpler, but the ahash
-- * API is preferable as it allows the use of crypto accelerators.
-- */
-- tfm = crypto_alloc_ahash(alg->name, 0, 0);
-+ tfm = crypto_alloc_shash(alg->name, 0, 0);
- if (IS_ERR(tfm)) {
- if (PTR_ERR(tfm) == -ENOENT) {
- fsverity_warn(inode,
-@@ -84,68 +79,26 @@ struct fsverity_hash_alg *fsverity_get_hash_alg(const struct inode *inode,
- }
-
- err = -EINVAL;
-- if (WARN_ON_ONCE(alg->digest_size != crypto_ahash_digestsize(tfm)))
-+ if (WARN_ON_ONCE(alg->digest_size != crypto_shash_digestsize(tfm)))
- goto err_free_tfm;
-- if (WARN_ON_ONCE(alg->block_size != crypto_ahash_blocksize(tfm)))
-- goto err_free_tfm;
--
-- err = mempool_init_kmalloc_pool(&alg->req_pool, 1,
-- sizeof(struct ahash_request) +
-- crypto_ahash_reqsize(tfm));
-- if (err)
-+ if (WARN_ON_ONCE(alg->block_size != crypto_shash_blocksize(tfm)))
- goto err_free_tfm;
-
- pr_info("%s using implementation \"%s\"\n",
-- alg->name, crypto_ahash_driver_name(tfm));
-+ alg->name, crypto_shash_driver_name(tfm));
-
- /* pairs with smp_load_acquire() above */
- smp_store_release(&alg->tfm, tfm);
- goto out_unlock;
-
- err_free_tfm:
-- crypto_free_ahash(tfm);
-+ crypto_free_shash(tfm);
- alg = ERR_PTR(err);
- out_unlock:
- mutex_unlock(&fsverity_hash_alg_init_mutex);
- return alg;
- }
-
--/**
-- * fsverity_alloc_hash_request() - allocate a hash request object
-- * @alg: the hash algorithm for which to allocate the request
-- * @gfp_flags: memory allocation flags
-- *
-- * This is mempool-backed, so this never fails if __GFP_DIRECT_RECLAIM is set in
-- * @gfp_flags. However, in that case this might need to wait for all
-- * previously-allocated requests to be freed. So to avoid deadlocks, callers
-- * must never need multiple requests at a time to make forward progress.
-- *
-- * Return: the request object on success; NULL on failure (but see above)
-- */
--struct ahash_request *fsverity_alloc_hash_request(struct fsverity_hash_alg *alg,
-- gfp_t gfp_flags)
--{
-- struct ahash_request *req = mempool_alloc(&alg->req_pool, gfp_flags);
--
-- if (req)
-- ahash_request_set_tfm(req, alg->tfm);
-- return req;
--}
--
--/**
-- * fsverity_free_hash_request() - free a hash request object
-- * @alg: the hash algorithm
-- * @req: the hash request object to free
-- */
--void fsverity_free_hash_request(struct fsverity_hash_alg *alg,
-- struct ahash_request *req)
--{
-- if (req) {
-- ahash_request_zero(req);
-- mempool_free(req, &alg->req_pool);
-- }
--}
--
- /**
- * fsverity_prepare_hash_state() - precompute the initial hash state
- * @alg: hash algorithm
-@@ -159,23 +112,20 @@ const u8 *fsverity_prepare_hash_state(struct fsverity_hash_alg *alg,
- const u8 *salt, size_t salt_size)
- {
- u8 *hashstate = NULL;
-- struct ahash_request *req = NULL;
-+ SHASH_DESC_ON_STACK(desc, alg->tfm);
- u8 *padded_salt = NULL;
- size_t padded_salt_size;
-- struct scatterlist sg;
-- DECLARE_CRYPTO_WAIT(wait);
- int err;
-
-+ desc->tfm = alg->tfm;
-+
- if (salt_size == 0)
- return NULL;
-
-- hashstate = kmalloc(crypto_ahash_statesize(alg->tfm), GFP_KERNEL);
-+ hashstate = kmalloc(crypto_shash_statesize(alg->tfm), GFP_KERNEL);
- if (!hashstate)
- return ERR_PTR(-ENOMEM);
-
-- /* This allocation never fails, since it's mempool-backed. */
-- req = fsverity_alloc_hash_request(alg, GFP_KERNEL);
--
- /*
- * Zero-pad the salt to the next multiple of the input size of the hash
- * algorithm's compression function, e.g. 64 bytes for SHA-256 or 128
-@@ -190,26 +140,18 @@ const u8 *fsverity_prepare_hash_state(struct fsverity_hash_alg *alg,
- goto err_free;
- }
- memcpy(padded_salt, salt, salt_size);
--
-- sg_init_one(&sg, padded_salt, padded_salt_size);
-- ahash_request_set_callback(req, CRYPTO_TFM_REQ_MAY_SLEEP |
-- CRYPTO_TFM_REQ_MAY_BACKLOG,
-- crypto_req_done, &wait);
-- ahash_request_set_crypt(req, &sg, NULL, padded_salt_size);
--
-- err = crypto_wait_req(crypto_ahash_init(req), &wait);
-+ err = crypto_shash_init(desc);
- if (err)
- goto err_free;
-
-- err = crypto_wait_req(crypto_ahash_update(req), &wait);
-+ err = crypto_shash_update(desc, padded_salt, padded_salt_size);
- if (err)
- goto err_free;
-
-- err = crypto_ahash_export(req, hashstate);
-+ err = crypto_shash_export(desc, hashstate);
- if (err)
- goto err_free;
- out:
-- fsverity_free_hash_request(alg, req);
- kfree(padded_salt);
- return hashstate;
-
-@@ -223,9 +165,7 @@ const u8 *fsverity_prepare_hash_state(struct fsverity_hash_alg *alg,
- * fsverity_hash_block() - hash a single data or hash block
- * @params: the Merkle tree's parameters
- * @inode: inode for which the hashing is being done
-- * @req: preallocated hash request
-- * @page: the page containing the block to hash
-- * @offset: the offset of the block within @page
-+ * @data: virtual address of a buffer containing the block to hash
- * @out: output digest, size 'params->digest_size' bytes
- *
- * Hash a single data or hash block. The hash is salted if a salt is specified
-@@ -234,33 +174,24 @@ const u8 *fsverity_prepare_hash_state(struct fsverity_hash_alg *alg,
- * Return: 0 on success, -errno on failure
- */
- int fsverity_hash_block(const struct merkle_tree_params *params,
-- const struct inode *inode, struct ahash_request *req,
-- struct page *page, unsigned int offset, u8 *out)
-+ const struct inode *inode, const void *data, u8 *out)
- {
-- struct scatterlist sg;
-- DECLARE_CRYPTO_WAIT(wait);
-+ SHASH_DESC_ON_STACK(desc, params->hash_alg->tfm);
- int err;
-
-- sg_init_table(&sg, 1);
-- sg_set_page(&sg, page, params->block_size, offset);
-- ahash_request_set_callback(req, CRYPTO_TFM_REQ_MAY_SLEEP |
-- CRYPTO_TFM_REQ_MAY_BACKLOG,
-- crypto_req_done, &wait);
-- ahash_request_set_crypt(req, &sg, out, params->block_size);
-+ desc->tfm = params->hash_alg->tfm;
-
- if (params->hashstate) {
-- err = crypto_ahash_import(req, params->hashstate);
-+ err = crypto_shash_import(desc, params->hashstate);
- if (err) {
- fsverity_err(inode,
- "Error %d importing hash state", err);
- return err;
- }
-- err = crypto_ahash_finup(req);
-+ err = crypto_shash_finup(desc, data, params->block_size, out);
- } else {
-- err = crypto_ahash_digest(req);
-+ err = crypto_shash_digest(desc, data, params->block_size, out);
- }
--
-- err = crypto_wait_req(err, &wait);
- if (err)
- fsverity_err(inode, "Error %d computing block hash", err);
- return err;
-@@ -273,32 +204,12 @@ int fsverity_hash_block(const struct merkle_tree_params *params,
- * @size: size of data to hash, in bytes
- * @out: output digest, size 'alg->digest_size' bytes
- *
-- * Hash some data which is located in physically contiguous memory (i.e. memory
-- * allocated by kmalloc(), not by vmalloc()). No salt is used.
-- *
- * Return: 0 on success, -errno on failure
- */
- int fsverity_hash_buffer(struct fsverity_hash_alg *alg,
- const void *data, size_t size, u8 *out)
- {
-- struct ahash_request *req;
-- struct scatterlist sg;
-- DECLARE_CRYPTO_WAIT(wait);
-- int err;
--
-- /* This allocation never fails, since it's mempool-backed. */
-- req = fsverity_alloc_hash_request(alg, GFP_KERNEL);
--
-- sg_init_one(&sg, data, size);
-- ahash_request_set_callback(req, CRYPTO_TFM_REQ_MAY_SLEEP |
-- CRYPTO_TFM_REQ_MAY_BACKLOG,
-- crypto_req_done, &wait);
-- ahash_request_set_crypt(req, &sg, out, size);
--
-- err = crypto_wait_req(crypto_ahash_digest(req), &wait);
--
-- fsverity_free_hash_request(alg, req);
-- return err;
-+ return crypto_shash_tfm_digest(alg->tfm, data, size, out);
- }
-
- void __init fsverity_check_hash_algs(void)
-diff --git a/fs/verity/verify.c b/fs/verity/verify.c
-index e2508222750b3..e9ae1eef5f191 100644
---- a/fs/verity/verify.c
-+++ b/fs/verity/verify.c
-@@ -29,21 +29,6 @@ static inline int cmp_hashes(const struct fsverity_info *vi,
- return -EBADMSG;
- }
-
--static bool data_is_zeroed(struct inode *inode, struct page *page,
-- unsigned int len, unsigned int offset)
--{
-- void *virt = kmap_local_page(page);
--
-- if (memchr_inv(virt + offset, 0, len)) {
-- kunmap_local(virt);
-- fsverity_err(inode,
-- "FILE CORRUPTED! Data past EOF is not zeroed");
-- return false;
-- }
-- kunmap_local(virt);
-- return true;
--}
--
- /*
- * Returns true if the hash block with index @hblock_idx in the tree, located in
- * @hpage, has already been verified.
-@@ -122,9 +107,7 @@ static bool is_hash_block_verified(struct fsverity_info *vi, struct page *hpage,
- */
- static bool
- verify_data_block(struct inode *inode, struct fsverity_info *vi,
-- struct ahash_request *req, struct page *data_page,
-- u64 data_pos, unsigned int dblock_offset_in_page,
-- unsigned long max_ra_pages)
-+ const void *data, u64 data_pos, unsigned long max_ra_pages)
- {
- const struct merkle_tree_params *params = &vi->tree_params;
- const unsigned int hsize = params->digest_size;
-@@ -136,11 +119,11 @@ verify_data_block(struct inode *inode, struct fsverity_info *vi,
- struct {
- /* Page containing the hash block */
- struct page *page;
-+ /* Mapped address of the hash block (will be within @page) */
-+ const void *addr;
- /* Index of the hash block in the tree overall */
- unsigned long index;
-- /* Byte offset of the hash block within @page */
-- unsigned int offset_in_page;
-- /* Byte offset of the wanted hash within @page */
-+ /* Byte offset of the wanted hash relative to @addr */
- unsigned int hoffset;
- } hblocks[FS_VERITY_MAX_LEVELS];
- /*
-@@ -150,6 +133,9 @@ verify_data_block(struct inode *inode, struct fsverity_info *vi,
- u64 hidx = data_pos >> params->log_blocksize;
- int err;
-
-+ /* Up to 1 + FS_VERITY_MAX_LEVELS pages may be mapped at once */
-+ BUILD_BUG_ON(1 + FS_VERITY_MAX_LEVELS > KM_MAX_IDX);
-+
- if (unlikely(data_pos >= inode->i_size)) {
- /*
- * This can happen in the data page spanning EOF when the Merkle
-@@ -159,8 +145,12 @@ verify_data_block(struct inode *inode, struct fsverity_info *vi,
- * any part past EOF should be all zeroes. Therefore, we need
- * to verify that any data blocks fully past EOF are all zeroes.
- */
-- return data_is_zeroed(inode, data_page, params->block_size,
-- dblock_offset_in_page);
-+ if (memchr_inv(data, 0, params->block_size)) {
-+ fsverity_err(inode,
-+ "FILE CORRUPTED! Data past EOF is not zeroed");
-+ return false;
-+ }
-+ return true;
- }
-
- /*
-@@ -175,6 +165,7 @@ verify_data_block(struct inode *inode, struct fsverity_info *vi,
- unsigned int hblock_offset_in_page;
- unsigned int hoffset;
- struct page *hpage;
-+ const void *haddr;
-
- /*
- * The index of the block in the current level; also the index
-@@ -192,10 +183,9 @@ verify_data_block(struct inode *inode, struct fsverity_info *vi,
- hblock_offset_in_page =
- (hblock_idx << params->log_blocksize) & ~PAGE_MASK;
-
-- /* Byte offset of the hash within the page */
-- hoffset = hblock_offset_in_page +
-- ((hidx << params->log_digestsize) &
-- (params->block_size - 1));
-+ /* Byte offset of the hash within the block */
-+ hoffset = (hidx << params->log_digestsize) &
-+ (params->block_size - 1);
-
- hpage = inode->i_sb->s_vop->read_merkle_tree_page(inode,
- hpage_idx, level == 0 ? min(max_ra_pages,
-@@ -207,15 +197,17 @@ verify_data_block(struct inode *inode, struct fsverity_info *vi,
- err, hpage_idx);
- goto out;
- }
-+ haddr = kmap_local_page(hpage) + hblock_offset_in_page;
- if (is_hash_block_verified(vi, hpage, hblock_idx)) {
-- memcpy_from_page(_want_hash, hpage, hoffset, hsize);
-+ memcpy(_want_hash, haddr + hoffset, hsize);
- want_hash = _want_hash;
-+ kunmap_local(haddr);
- put_page(hpage);
- goto descend;
- }
- hblocks[level].page = hpage;
-+ hblocks[level].addr = haddr;
- hblocks[level].index = hblock_idx;
-- hblocks[level].offset_in_page = hblock_offset_in_page;
- hblocks[level].hoffset = hoffset;
- hidx = next_hidx;
- }
-@@ -225,13 +217,11 @@ verify_data_block(struct inode *inode, struct fsverity_info *vi,
- /* Descend the tree verifying hash blocks. */
- for (; level > 0; level--) {
- struct page *hpage = hblocks[level - 1].page;
-+ const void *haddr = hblocks[level - 1].addr;
- unsigned long hblock_idx = hblocks[level - 1].index;
-- unsigned int hblock_offset_in_page =
-- hblocks[level - 1].offset_in_page;
- unsigned int hoffset = hblocks[level - 1].hoffset;
-
-- err = fsverity_hash_block(params, inode, req, hpage,
-- hblock_offset_in_page, real_hash);
-+ err = fsverity_hash_block(params, inode, haddr, real_hash);
- if (err)
- goto out;
- err = cmp_hashes(vi, want_hash, real_hash, data_pos, level - 1);
-@@ -246,29 +236,30 @@ verify_data_block(struct inode *inode, struct fsverity_info *vi,
- set_bit(hblock_idx, vi->hash_block_verified);
- else
- SetPageChecked(hpage);
-- memcpy_from_page(_want_hash, hpage, hoffset, hsize);
-+ memcpy(_want_hash, haddr + hoffset, hsize);
- want_hash = _want_hash;
-+ kunmap_local(haddr);
- put_page(hpage);
- }
-
- /* Finally, verify the data block. */
-- err = fsverity_hash_block(params, inode, req, data_page,
-- dblock_offset_in_page, real_hash);
-+ err = fsverity_hash_block(params, inode, data, real_hash);
- if (err)
- goto out;
- err = cmp_hashes(vi, want_hash, real_hash, data_pos, -1);
- out:
-- for (; level > 0; level--)
-+ for (; level > 0; level--) {
-+ kunmap_local(hblocks[level - 1].addr);
- put_page(hblocks[level - 1].page);
--
-+ }
- return err == 0;
- }
-
- static bool
--verify_data_blocks(struct inode *inode, struct fsverity_info *vi,
-- struct ahash_request *req, struct folio *data_folio,
-+verify_data_blocks(struct inode *inode, struct folio *data_folio,
- size_t len, size_t offset, unsigned long max_ra_pages)
- {
-+ struct fsverity_info *vi = inode->i_verity_info;
- const unsigned int block_size = vi->tree_params.block_size;
- u64 pos = (u64)data_folio->index << PAGE_SHIFT;
-
-@@ -278,11 +269,14 @@ verify_data_blocks(struct inode *inode, struct fsverity_info *vi,
- folio_test_uptodate(data_folio)))
- return false;
- do {
-- struct page *data_page =
-- folio_page(data_folio, offset >> PAGE_SHIFT);
--
-- if (!verify_data_block(inode, vi, req, data_page, pos + offset,
-- offset & ~PAGE_MASK, max_ra_pages))
-+ void *data;
-+ bool valid;
-+
-+ data = kmap_local_folio(data_folio, offset);
-+ valid = verify_data_block(inode, vi, data, pos + offset,
-+ max_ra_pages);
-+ kunmap_local(data);
-+ if (!valid)
- return false;
- offset += block_size;
- len -= block_size;
-@@ -304,19 +298,7 @@ verify_data_blocks(struct inode *inode, struct fsverity_info *vi,
- */
- bool fsverity_verify_blocks(struct folio *folio, size_t len, size_t offset)
- {
-- struct inode *inode = folio->mapping->host;
-- struct fsverity_info *vi = inode->i_verity_info;
-- struct ahash_request *req;
-- bool valid;
--
-- /* This allocation never fails, since it's mempool-backed. */
-- req = fsverity_alloc_hash_request(vi->tree_params.hash_alg, GFP_NOFS);
--
-- valid = verify_data_blocks(inode, vi, req, folio, len, offset, 0);
--
-- fsverity_free_hash_request(vi->tree_params.hash_alg, req);
--
-- return valid;
-+ return verify_data_blocks(folio->mapping->host, folio, len, offset, 0);
- }
- EXPORT_SYMBOL_GPL(fsverity_verify_blocks);
-
-@@ -338,14 +320,9 @@ EXPORT_SYMBOL_GPL(fsverity_verify_blocks);
- void fsverity_verify_bio(struct bio *bio)
- {
- struct inode *inode = bio_first_page_all(bio)->mapping->host;
-- struct fsverity_info *vi = inode->i_verity_info;
-- struct ahash_request *req;
- struct folio_iter fi;
- unsigned long max_ra_pages = 0;
-
-- /* This allocation never fails, since it's mempool-backed. */
-- req = fsverity_alloc_hash_request(vi->tree_params.hash_alg, GFP_NOFS);
--
- if (bio->bi_opf & REQ_RAHEAD) {
- /*
- * If this bio is for data readahead, then we also do readahead
-@@ -360,14 +337,12 @@ void fsverity_verify_bio(struct bio *bio)
- }
-
- bio_for_each_folio_all(fi, bio) {
-- if (!verify_data_blocks(inode, vi, req, fi.folio, fi.length,
-- fi.offset, max_ra_pages)) {
-+ if (!verify_data_blocks(inode, fi.folio, fi.length, fi.offset,
-+ max_ra_pages)) {
- bio->bi_status = BLK_STS_IOERR;
- break;
- }
- }
--
-- fsverity_free_hash_request(vi->tree_params.hash_alg, req);
- }
- EXPORT_SYMBOL_GPL(fsverity_verify_bio);
- #endif /* CONFIG_BLOCK */
---
-2.39.2
-
+++ /dev/null
-From 0f2ca98e0e6d414c26d094ad017b554dc44fbed2 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Mon, 27 Mar 2023 21:03:26 -0700
-Subject: fsverity: use WARN_ON_ONCE instead of WARN_ON
-
-From: Eric Biggers <ebiggers@google.com>
-
-[ Upstream commit 8eb8af4b3df5965dc65a24a32768043f39d82d59 ]
-
-As per Linus's suggestion
-(https://lore.kernel.org/r/CAHk-=whefxRGyNGzCzG6BVeM=5vnvgb-XhSeFJVxJyAxAF8XRA@mail.gmail.com),
-use WARN_ON_ONCE instead of WARN_ON. This barely adds any extra
-overhead, and it makes it so that if any of these ever becomes reachable
-(they shouldn't, but that's the point), the logs can't be flooded.
-
-Link: https://lore.kernel.org/r/20230406181542.38894-1-ebiggers@kernel.org
-Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
-Reviewed-by: Christian Brauner <brauner@kernel.org>
-Signed-off-by: Eric Biggers <ebiggers@google.com>
-Stable-dep-of: d1f0c5ea04cd ("fsverity: don't use bio_first_page_all() in fsverity_verify_bio()")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- fs/verity/enable.c | 4 ++--
- fs/verity/hash_algs.c | 4 ++--
- fs/verity/open.c | 2 +-
- include/linux/fsverity.h | 6 +++---
- 4 files changed, 8 insertions(+), 8 deletions(-)
-
-diff --git a/fs/verity/enable.c b/fs/verity/enable.c
-index c547ca4eb05a7..fc4c50e5219dc 100644
---- a/fs/verity/enable.c
-+++ b/fs/verity/enable.c
-@@ -175,7 +175,7 @@ static int build_merkle_tree(struct file *filp,
- }
- }
- /* The root hash was filled by the last call to hash_one_block(). */
-- if (WARN_ON(buffers[num_levels].filled != params->digest_size)) {
-+ if (WARN_ON_ONCE(buffers[num_levels].filled != params->digest_size)) {
- err = -EINVAL;
- goto out;
- }
-@@ -287,7 +287,7 @@ static int enable_verity(struct file *filp,
- fsverity_err(inode, "%ps() failed with err %d",
- vops->end_enable_verity, err);
- fsverity_free_info(vi);
-- } else if (WARN_ON(!IS_VERITY(inode))) {
-+ } else if (WARN_ON_ONCE(!IS_VERITY(inode))) {
- err = -EINVAL;
- fsverity_free_info(vi);
- } else {
-diff --git a/fs/verity/hash_algs.c b/fs/verity/hash_algs.c
-index 13fcf31be8441..ea00dbedf756b 100644
---- a/fs/verity/hash_algs.c
-+++ b/fs/verity/hash_algs.c
-@@ -84,9 +84,9 @@ struct fsverity_hash_alg *fsverity_get_hash_alg(const struct inode *inode,
- }
-
- err = -EINVAL;
-- if (WARN_ON(alg->digest_size != crypto_ahash_digestsize(tfm)))
-+ if (WARN_ON_ONCE(alg->digest_size != crypto_ahash_digestsize(tfm)))
- goto err_free_tfm;
-- if (WARN_ON(alg->block_size != crypto_ahash_blocksize(tfm)))
-+ if (WARN_ON_ONCE(alg->block_size != crypto_ahash_blocksize(tfm)))
- goto err_free_tfm;
-
- err = mempool_init_kmalloc_pool(&alg->req_pool, 1,
-diff --git a/fs/verity/open.c b/fs/verity/open.c
-index 9366b441d01ca..52048b7630dcc 100644
---- a/fs/verity/open.c
-+++ b/fs/verity/open.c
-@@ -83,7 +83,7 @@ int fsverity_init_merkle_tree_params(struct merkle_tree_params *params,
- params->log_blocks_per_page = PAGE_SHIFT - log_blocksize;
- params->blocks_per_page = 1 << params->log_blocks_per_page;
-
-- if (WARN_ON(!is_power_of_2(params->digest_size))) {
-+ if (WARN_ON_ONCE(!is_power_of_2(params->digest_size))) {
- err = -EINVAL;
- goto out_err;
- }
-diff --git a/include/linux/fsverity.h b/include/linux/fsverity.h
-index 119a3266791fd..e76605d5b36ee 100644
---- a/include/linux/fsverity.h
-+++ b/include/linux/fsverity.h
-@@ -233,18 +233,18 @@ static inline int fsverity_ioctl_read_metadata(struct file *filp,
- static inline bool fsverity_verify_blocks(struct folio *folio, size_t len,
- size_t offset)
- {
-- WARN_ON(1);
-+ WARN_ON_ONCE(1);
- return false;
- }
-
- static inline void fsverity_verify_bio(struct bio *bio)
- {
-- WARN_ON(1);
-+ WARN_ON_ONCE(1);
- }
-
- static inline void fsverity_enqueue_verify_work(struct work_struct *work)
- {
-- WARN_ON(1);
-+ WARN_ON_ONCE(1);
- }
-
- #endif /* !CONFIG_FS_VERITY */
---
-2.39.2
-
+++ /dev/null
-From 01570ae13eecc77e9c0a57638335b5d8fecedacb Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Mon, 8 May 2023 22:51:38 +0200
-Subject: i2c: Convert to platform remove callback returning void
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-From: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
-
-[ Upstream commit e190a0c389e60178fba3d532abf936dcae223e7d ]
-
-The .remove() callback for a platform driver returns an int which makes
-many driver authors wrongly assume it's possible to do error handling by
-returning an error code. However the value returned is (mostly) ignored
-and this typically results in resource leaks. To improve here there is a
-quest to make the remove callback return void. In the first step of this
-quest all drivers are converted to .remove_new() which already returns
-void.
-
-Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
-Acked-by: Alain Volmat <alain.volmat@foss.st.com>
-Acked-by: Ard Biesheuvel <ardb@kernel.org>
-Acked-by: Baruch Siach <baruch@tkos.co.il>
-Acked-by: Florian Fainelli <f.fainelli@gmail.com>
-Acked-by: Heiko Stuebner <heiko@sntech.de>
-Acked-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
-Acked-by: Jernej Skrabec <jernej.skrabec@gmail.com>
-Acked-by: Jochen Friedrich <jochen@scram.de>
-Acked-by: Peter Rosin <peda@axentia.se>
-Acked-by: Vadim Pasternak <vadimp@nvidia.com>
-Reviewed-by: Asmaa Mnebhi <asnaa@nvidia.com>
-Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
-Reviewed-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
-Reviewed-by: Chris Pringle <chris.pringle@phabrix.com>
-Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>
-Reviewed-by: Conor Dooley <conor.dooley@microchip.com>
-Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Reviewed-by: Hans de Goede <hdegoede@redhat.com>
-Reviewed-by: Jean Delvare <jdelvare@suse.de>
-Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>
-Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
-Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
-Reviewed-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
-Reviewed-by: Matthias Brugger <matthias.bgg@gmail.com>
-Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
-Reviewed-by: Tali Perry <tali.perry@nuvoton.com>
-Reviewed-by: Vignesh Raghavendra <vigneshr@ti.com>
-Signed-off-by: Wolfram Sang <wsa@kernel.org>
-Stable-dep-of: 9e1a1ee93f6b ("i2c: ocores: use devm_ managed clks")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/i2c/busses/i2c-altera.c | 6 ++----
- drivers/i2c/busses/i2c-amd-mp2-plat.c | 5 ++---
- drivers/i2c/busses/i2c-aspeed.c | 6 ++----
- drivers/i2c/busses/i2c-at91-core.c | 6 ++----
- drivers/i2c/busses/i2c-au1550.c | 5 ++---
- drivers/i2c/busses/i2c-axxia.c | 6 ++----
- drivers/i2c/busses/i2c-bcm-iproc.c | 6 ++----
- drivers/i2c/busses/i2c-bcm-kona.c | 6 ++----
- drivers/i2c/busses/i2c-bcm2835.c | 6 ++----
- drivers/i2c/busses/i2c-brcmstb.c | 5 ++---
- drivers/i2c/busses/i2c-cadence.c | 6 ++----
- drivers/i2c/busses/i2c-cbus-gpio.c | 6 ++----
- drivers/i2c/busses/i2c-cht-wc.c | 6 ++----
- drivers/i2c/busses/i2c-cpm.c | 6 ++----
- drivers/i2c/busses/i2c-cros-ec-tunnel.c | 6 ++----
- drivers/i2c/busses/i2c-davinci.c | 14 ++++++--------
- drivers/i2c/busses/i2c-designware-platdrv.c | 6 ++----
- drivers/i2c/busses/i2c-digicolor.c | 6 ++----
- drivers/i2c/busses/i2c-dln2.c | 6 ++----
- drivers/i2c/busses/i2c-emev2.c | 6 ++----
- drivers/i2c/busses/i2c-exynos5.c | 6 ++----
- drivers/i2c/busses/i2c-gpio.c | 6 ++----
- drivers/i2c/busses/i2c-gxp.c | 6 ++----
- drivers/i2c/busses/i2c-highlander.c | 6 ++----
- drivers/i2c/busses/i2c-hix5hd2.c | 6 ++----
- drivers/i2c/busses/i2c-ibm_iic.c | 6 ++----
- drivers/i2c/busses/i2c-img-scb.c | 6 ++----
- drivers/i2c/busses/i2c-imx-lpi2c.c | 6 ++----
- drivers/i2c/busses/i2c-imx.c | 6 ++----
- drivers/i2c/busses/i2c-iop3xx.c | 6 ++----
- drivers/i2c/busses/i2c-isch.c | 6 ++----
- drivers/i2c/busses/i2c-jz4780.c | 5 ++---
- drivers/i2c/busses/i2c-kempld.c | 6 ++----
- drivers/i2c/busses/i2c-lpc2k.c | 6 ++----
- drivers/i2c/busses/i2c-meson.c | 6 ++----
- drivers/i2c/busses/i2c-microchip-corei2c.c | 6 ++----
- drivers/i2c/busses/i2c-mlxbf.c | 6 ++----
- drivers/i2c/busses/i2c-mlxcpld.c | 6 ++----
- drivers/i2c/busses/i2c-mpc.c | 6 ++----
- drivers/i2c/busses/i2c-mt65xx.c | 6 ++----
- drivers/i2c/busses/i2c-mt7621.c | 6 ++----
- drivers/i2c/busses/i2c-mv64xxx.c | 6 ++----
- drivers/i2c/busses/i2c-mxs.c | 6 ++----
- drivers/i2c/busses/i2c-npcm7xx.c | 5 ++---
- drivers/i2c/busses/i2c-ocores.c | 6 ++----
- drivers/i2c/busses/i2c-octeon-platdrv.c | 5 ++---
- drivers/i2c/busses/i2c-omap.c | 6 ++----
- drivers/i2c/busses/i2c-opal.c | 6 ++----
- drivers/i2c/busses/i2c-pasemi-platform.c | 5 ++---
- drivers/i2c/busses/i2c-pca-platform.c | 6 ++----
- drivers/i2c/busses/i2c-pnx.c | 6 ++----
- drivers/i2c/busses/i2c-powermac.c | 6 ++----
- drivers/i2c/busses/i2c-pxa.c | 6 ++----
- drivers/i2c/busses/i2c-qcom-cci.c | 6 ++----
- drivers/i2c/busses/i2c-qcom-geni.c | 5 ++---
- drivers/i2c/busses/i2c-qup.c | 5 ++---
- drivers/i2c/busses/i2c-rcar.c | 6 ++----
- drivers/i2c/busses/i2c-riic.c | 6 ++----
- drivers/i2c/busses/i2c-rk3x.c | 6 ++----
- drivers/i2c/busses/i2c-rzv2m.c | 6 ++----
- drivers/i2c/busses/i2c-s3c2410.c | 6 ++----
- drivers/i2c/busses/i2c-scmi.c | 6 ++----
- drivers/i2c/busses/i2c-sh7760.c | 6 ++----
- drivers/i2c/busses/i2c-sh_mobile.c | 5 ++---
- drivers/i2c/busses/i2c-simtec.c | 6 ++----
- drivers/i2c/busses/i2c-st.c | 6 ++----
- drivers/i2c/busses/i2c-stm32f4.c | 6 ++----
- drivers/i2c/busses/i2c-stm32f7.c | 6 ++----
- drivers/i2c/busses/i2c-sun6i-p2wi.c | 6 ++----
- drivers/i2c/busses/i2c-synquacer.c | 6 ++----
- drivers/i2c/busses/i2c-tegra-bpmp.c | 6 ++----
- drivers/i2c/busses/i2c-tegra.c | 6 ++----
- drivers/i2c/busses/i2c-uniphier-f.c | 6 ++----
- drivers/i2c/busses/i2c-uniphier.c | 6 ++----
- drivers/i2c/busses/i2c-versatile.c | 5 ++---
- drivers/i2c/busses/i2c-viperboard.c | 6 ++----
- drivers/i2c/busses/i2c-wmt.c | 6 ++----
- drivers/i2c/busses/i2c-xgene-slimpro.c | 6 ++----
- drivers/i2c/busses/i2c-xiic.c | 6 ++----
- drivers/i2c/busses/i2c-xlp9xx.c | 6 ++----
- drivers/i2c/busses/scx200_acb.c | 6 ++----
- drivers/i2c/muxes/i2c-arb-gpio-challenge.c | 5 ++---
- drivers/i2c/muxes/i2c-demux-pinctrl.c | 6 ++----
- drivers/i2c/muxes/i2c-mux-gpio.c | 6 ++----
- drivers/i2c/muxes/i2c-mux-gpmux.c | 6 ++----
- drivers/i2c/muxes/i2c-mux-mlxcpld.c | 5 ++---
- drivers/i2c/muxes/i2c-mux-pinctrl.c | 6 ++----
- drivers/i2c/muxes/i2c-mux-reg.c | 6 ++----
- 88 files changed, 180 insertions(+), 343 deletions(-)
-
-diff --git a/drivers/i2c/busses/i2c-altera.c b/drivers/i2c/busses/i2c-altera.c
-index 50e7f3f670b6f..252fbd175fb1c 100644
---- a/drivers/i2c/busses/i2c-altera.c
-+++ b/drivers/i2c/busses/i2c-altera.c
-@@ -465,14 +465,12 @@ static int altr_i2c_probe(struct platform_device *pdev)
- return 0;
- }
-
--static int altr_i2c_remove(struct platform_device *pdev)
-+static void altr_i2c_remove(struct platform_device *pdev)
- {
- struct altr_i2c_dev *idev = platform_get_drvdata(pdev);
-
- clk_disable_unprepare(idev->i2c_clk);
- i2c_del_adapter(&idev->adapter);
--
-- return 0;
- }
-
- /* Match table for of_platform binding */
-@@ -484,7 +482,7 @@ MODULE_DEVICE_TABLE(of, altr_i2c_of_match);
-
- static struct platform_driver altr_i2c_driver = {
- .probe = altr_i2c_probe,
-- .remove = altr_i2c_remove,
-+ .remove_new = altr_i2c_remove,
- .driver = {
- .name = "altera-i2c",
- .of_match_table = altr_i2c_of_match,
-diff --git a/drivers/i2c/busses/i2c-amd-mp2-plat.c b/drivers/i2c/busses/i2c-amd-mp2-plat.c
-index 423fe0c8a471e..112fe2bc5662b 100644
---- a/drivers/i2c/busses/i2c-amd-mp2-plat.c
-+++ b/drivers/i2c/busses/i2c-amd-mp2-plat.c
-@@ -322,7 +322,7 @@ static int i2c_amd_probe(struct platform_device *pdev)
- return ret;
- }
-
--static int i2c_amd_remove(struct platform_device *pdev)
-+static void i2c_amd_remove(struct platform_device *pdev)
- {
- struct amd_i2c_dev *i2c_dev = platform_get_drvdata(pdev);
- struct amd_i2c_common *i2c_common = &i2c_dev->common;
-@@ -336,7 +336,6 @@ static int i2c_amd_remove(struct platform_device *pdev)
- i2c_unlock_bus(&i2c_dev->adap, I2C_LOCK_ROOT_ADAPTER);
-
- i2c_del_adapter(&i2c_dev->adap);
-- return 0;
- }
-
- static const struct acpi_device_id i2c_amd_acpi_match[] = {
-@@ -347,7 +346,7 @@ MODULE_DEVICE_TABLE(acpi, i2c_amd_acpi_match);
-
- static struct platform_driver i2c_amd_plat_driver = {
- .probe = i2c_amd_probe,
-- .remove = i2c_amd_remove,
-+ .remove_new = i2c_amd_remove,
- .driver = {
- .name = "i2c_amd_mp2",
- .acpi_match_table = ACPI_PTR(i2c_amd_acpi_match),
-diff --git a/drivers/i2c/busses/i2c-aspeed.c b/drivers/i2c/busses/i2c-aspeed.c
-index d3c99c5b32478..2e5acfeb76c81 100644
---- a/drivers/i2c/busses/i2c-aspeed.c
-+++ b/drivers/i2c/busses/i2c-aspeed.c
-@@ -1061,7 +1061,7 @@ static int aspeed_i2c_probe_bus(struct platform_device *pdev)
- return 0;
- }
-
--static int aspeed_i2c_remove_bus(struct platform_device *pdev)
-+static void aspeed_i2c_remove_bus(struct platform_device *pdev)
- {
- struct aspeed_i2c_bus *bus = platform_get_drvdata(pdev);
- unsigned long flags;
-@@ -1077,13 +1077,11 @@ static int aspeed_i2c_remove_bus(struct platform_device *pdev)
- reset_control_assert(bus->rst);
-
- i2c_del_adapter(&bus->adap);
--
-- return 0;
- }
-
- static struct platform_driver aspeed_i2c_bus_driver = {
- .probe = aspeed_i2c_probe_bus,
-- .remove = aspeed_i2c_remove_bus,
-+ .remove_new = aspeed_i2c_remove_bus,
- .driver = {
- .name = "aspeed-i2c-bus",
- .of_match_table = aspeed_i2c_bus_of_table,
-diff --git a/drivers/i2c/busses/i2c-at91-core.c b/drivers/i2c/busses/i2c-at91-core.c
-index 2df9df5851314..05ad3bc3578ac 100644
---- a/drivers/i2c/busses/i2c-at91-core.c
-+++ b/drivers/i2c/busses/i2c-at91-core.c
-@@ -273,7 +273,7 @@ static int at91_twi_probe(struct platform_device *pdev)
- return 0;
- }
-
--static int at91_twi_remove(struct platform_device *pdev)
-+static void at91_twi_remove(struct platform_device *pdev)
- {
- struct at91_twi_dev *dev = platform_get_drvdata(pdev);
-
-@@ -282,8 +282,6 @@ static int at91_twi_remove(struct platform_device *pdev)
-
- pm_runtime_disable(dev->dev);
- pm_runtime_set_suspended(dev->dev);
--
-- return 0;
- }
-
- static int __maybe_unused at91_twi_runtime_suspend(struct device *dev)
-@@ -342,7 +340,7 @@ static const struct dev_pm_ops __maybe_unused at91_twi_pm = {
-
- static struct platform_driver at91_twi_driver = {
- .probe = at91_twi_probe,
-- .remove = at91_twi_remove,
-+ .remove_new = at91_twi_remove,
- .id_table = at91_twi_devtypes,
- .driver = {
- .name = "at91_i2c",
-diff --git a/drivers/i2c/busses/i2c-au1550.c b/drivers/i2c/busses/i2c-au1550.c
-index 7b42d35b12942..e66c12ecf2706 100644
---- a/drivers/i2c/busses/i2c-au1550.c
-+++ b/drivers/i2c/busses/i2c-au1550.c
-@@ -334,13 +334,12 @@ i2c_au1550_probe(struct platform_device *pdev)
- return 0;
- }
-
--static int i2c_au1550_remove(struct platform_device *pdev)
-+static void i2c_au1550_remove(struct platform_device *pdev)
- {
- struct i2c_au1550_data *priv = platform_get_drvdata(pdev);
-
- i2c_del_adapter(&priv->adap);
- i2c_au1550_disable(priv);
-- return 0;
- }
-
- #ifdef CONFIG_PM
-@@ -379,7 +378,7 @@ static struct platform_driver au1xpsc_smbus_driver = {
- .pm = AU1XPSC_SMBUS_PMOPS,
- },
- .probe = i2c_au1550_probe,
-- .remove = i2c_au1550_remove,
-+ .remove_new = i2c_au1550_remove,
- };
-
- module_platform_driver(au1xpsc_smbus_driver);
-diff --git a/drivers/i2c/busses/i2c-axxia.c b/drivers/i2c/busses/i2c-axxia.c
-index c1c74ce084071..d7f1e98777ace 100644
---- a/drivers/i2c/busses/i2c-axxia.c
-+++ b/drivers/i2c/busses/i2c-axxia.c
-@@ -804,14 +804,12 @@ static int axxia_i2c_probe(struct platform_device *pdev)
- return ret;
- }
-
--static int axxia_i2c_remove(struct platform_device *pdev)
-+static void axxia_i2c_remove(struct platform_device *pdev)
- {
- struct axxia_i2c_dev *idev = platform_get_drvdata(pdev);
-
- clk_disable_unprepare(idev->i2c_clk);
- i2c_del_adapter(&idev->adapter);
--
-- return 0;
- }
-
- /* Match table for of_platform binding */
-@@ -824,7 +822,7 @@ MODULE_DEVICE_TABLE(of, axxia_i2c_of_match);
-
- static struct platform_driver axxia_i2c_driver = {
- .probe = axxia_i2c_probe,
-- .remove = axxia_i2c_remove,
-+ .remove_new = axxia_i2c_remove,
- .driver = {
- .name = "axxia-i2c",
- .of_match_table = axxia_i2c_of_match,
-diff --git a/drivers/i2c/busses/i2c-bcm-iproc.c b/drivers/i2c/busses/i2c-bcm-iproc.c
-index 85d8a6b048856..2d8342fdc25de 100644
---- a/drivers/i2c/busses/i2c-bcm-iproc.c
-+++ b/drivers/i2c/busses/i2c-bcm-iproc.c
-@@ -1107,7 +1107,7 @@ static int bcm_iproc_i2c_probe(struct platform_device *pdev)
- return i2c_add_adapter(adap);
- }
-
--static int bcm_iproc_i2c_remove(struct platform_device *pdev)
-+static void bcm_iproc_i2c_remove(struct platform_device *pdev)
- {
- struct bcm_iproc_i2c_dev *iproc_i2c = platform_get_drvdata(pdev);
-
-@@ -1123,8 +1123,6 @@ static int bcm_iproc_i2c_remove(struct platform_device *pdev)
-
- i2c_del_adapter(&iproc_i2c->adapter);
- bcm_iproc_i2c_enable_disable(iproc_i2c, false);
--
-- return 0;
- }
-
- #ifdef CONFIG_PM_SLEEP
-@@ -1260,7 +1258,7 @@ static struct platform_driver bcm_iproc_i2c_driver = {
- .pm = BCM_IPROC_I2C_PM_OPS,
- },
- .probe = bcm_iproc_i2c_probe,
-- .remove = bcm_iproc_i2c_remove,
-+ .remove_new = bcm_iproc_i2c_remove,
- };
- module_platform_driver(bcm_iproc_i2c_driver);
-
-diff --git a/drivers/i2c/busses/i2c-bcm-kona.c b/drivers/i2c/busses/i2c-bcm-kona.c
-index f3e369f0fd402..a57088ec2b064 100644
---- a/drivers/i2c/busses/i2c-bcm-kona.c
-+++ b/drivers/i2c/busses/i2c-bcm-kona.c
-@@ -859,13 +859,11 @@ static int bcm_kona_i2c_probe(struct platform_device *pdev)
- return rc;
- }
-
--static int bcm_kona_i2c_remove(struct platform_device *pdev)
-+static void bcm_kona_i2c_remove(struct platform_device *pdev)
- {
- struct bcm_kona_i2c_dev *dev = platform_get_drvdata(pdev);
-
- i2c_del_adapter(&dev->adapter);
--
-- return 0;
- }
-
- static const struct of_device_id bcm_kona_i2c_of_match[] = {
-@@ -880,7 +878,7 @@ static struct platform_driver bcm_kona_i2c_driver = {
- .of_match_table = bcm_kona_i2c_of_match,
- },
- .probe = bcm_kona_i2c_probe,
-- .remove = bcm_kona_i2c_remove,
-+ .remove_new = bcm_kona_i2c_remove,
- };
- module_platform_driver(bcm_kona_i2c_driver);
-
-diff --git a/drivers/i2c/busses/i2c-bcm2835.c b/drivers/i2c/busses/i2c-bcm2835.c
-index 09a077b31bfe1..8ce6d3f495516 100644
---- a/drivers/i2c/busses/i2c-bcm2835.c
-+++ b/drivers/i2c/busses/i2c-bcm2835.c
-@@ -503,7 +503,7 @@ static int bcm2835_i2c_probe(struct platform_device *pdev)
- return ret;
- }
-
--static int bcm2835_i2c_remove(struct platform_device *pdev)
-+static void bcm2835_i2c_remove(struct platform_device *pdev)
- {
- struct bcm2835_i2c_dev *i2c_dev = platform_get_drvdata(pdev);
-
-@@ -512,8 +512,6 @@ static int bcm2835_i2c_remove(struct platform_device *pdev)
-
- free_irq(i2c_dev->irq, i2c_dev);
- i2c_del_adapter(&i2c_dev->adapter);
--
-- return 0;
- }
-
- static const struct of_device_id bcm2835_i2c_of_match[] = {
-@@ -525,7 +523,7 @@ MODULE_DEVICE_TABLE(of, bcm2835_i2c_of_match);
-
- static struct platform_driver bcm2835_i2c_driver = {
- .probe = bcm2835_i2c_probe,
-- .remove = bcm2835_i2c_remove,
-+ .remove_new = bcm2835_i2c_remove,
- .driver = {
- .name = "i2c-bcm2835",
- .of_match_table = bcm2835_i2c_of_match,
-diff --git a/drivers/i2c/busses/i2c-brcmstb.c b/drivers/i2c/busses/i2c-brcmstb.c
-index 69383be479059..26ee25f5f631c 100644
---- a/drivers/i2c/busses/i2c-brcmstb.c
-+++ b/drivers/i2c/busses/i2c-brcmstb.c
-@@ -692,12 +692,11 @@ static int brcmstb_i2c_probe(struct platform_device *pdev)
- return rc;
- }
-
--static int brcmstb_i2c_remove(struct platform_device *pdev)
-+static void brcmstb_i2c_remove(struct platform_device *pdev)
- {
- struct brcmstb_i2c_dev *dev = platform_get_drvdata(pdev);
-
- i2c_del_adapter(&dev->adapter);
-- return 0;
- }
-
- #ifdef CONFIG_PM_SLEEP
-@@ -738,7 +737,7 @@ static struct platform_driver brcmstb_i2c_driver = {
- .pm = &brcmstb_i2c_pm,
- },
- .probe = brcmstb_i2c_probe,
-- .remove = brcmstb_i2c_remove,
-+ .remove_new = brcmstb_i2c_remove,
- };
- module_platform_driver(brcmstb_i2c_driver);
-
-diff --git a/drivers/i2c/busses/i2c-cadence.c b/drivers/i2c/busses/i2c-cadence.c
-index 982c207d473b7..5749340474a2f 100644
---- a/drivers/i2c/busses/i2c-cadence.c
-+++ b/drivers/i2c/busses/i2c-cadence.c
-@@ -1359,7 +1359,7 @@ static int cdns_i2c_probe(struct platform_device *pdev)
- *
- * Return: 0 always
- */
--static int cdns_i2c_remove(struct platform_device *pdev)
-+static void cdns_i2c_remove(struct platform_device *pdev)
- {
- struct cdns_i2c *id = platform_get_drvdata(pdev);
-
-@@ -1370,8 +1370,6 @@ static int cdns_i2c_remove(struct platform_device *pdev)
- i2c_del_adapter(&id->adap);
- clk_notifier_unregister(id->clk, &id->clk_rate_change_nb);
- clk_disable_unprepare(id->clk);
--
-- return 0;
- }
-
- static struct platform_driver cdns_i2c_drv = {
-@@ -1381,7 +1379,7 @@ static struct platform_driver cdns_i2c_drv = {
- .pm = &cdns_i2c_dev_pm_ops,
- },
- .probe = cdns_i2c_probe,
-- .remove = cdns_i2c_remove,
-+ .remove_new = cdns_i2c_remove,
- };
-
- module_platform_driver(cdns_i2c_drv);
-diff --git a/drivers/i2c/busses/i2c-cbus-gpio.c b/drivers/i2c/busses/i2c-cbus-gpio.c
-index d97c61eec95c1..fdc1758a32756 100644
---- a/drivers/i2c/busses/i2c-cbus-gpio.c
-+++ b/drivers/i2c/busses/i2c-cbus-gpio.c
-@@ -200,13 +200,11 @@ static const struct i2c_algorithm cbus_i2c_algo = {
- .functionality = cbus_i2c_func,
- };
-
--static int cbus_i2c_remove(struct platform_device *pdev)
-+static void cbus_i2c_remove(struct platform_device *pdev)
- {
- struct i2c_adapter *adapter = platform_get_drvdata(pdev);
-
- i2c_del_adapter(adapter);
--
-- return 0;
- }
-
- static int cbus_i2c_probe(struct platform_device *pdev)
-@@ -266,7 +264,7 @@ MODULE_DEVICE_TABLE(of, i2c_cbus_dt_ids);
-
- static struct platform_driver cbus_i2c_driver = {
- .probe = cbus_i2c_probe,
-- .remove = cbus_i2c_remove,
-+ .remove_new = cbus_i2c_remove,
- .driver = {
- .name = "i2c-cbus-gpio",
- .of_match_table = of_match_ptr(i2c_cbus_dt_ids),
-diff --git a/drivers/i2c/busses/i2c-cht-wc.c b/drivers/i2c/busses/i2c-cht-wc.c
-index 2b2c3d090089e..0209933b9a847 100644
---- a/drivers/i2c/busses/i2c-cht-wc.c
-+++ b/drivers/i2c/busses/i2c-cht-wc.c
-@@ -529,15 +529,13 @@ static int cht_wc_i2c_adap_i2c_probe(struct platform_device *pdev)
- return ret;
- }
-
--static int cht_wc_i2c_adap_i2c_remove(struct platform_device *pdev)
-+static void cht_wc_i2c_adap_i2c_remove(struct platform_device *pdev)
- {
- struct cht_wc_i2c_adap *adap = platform_get_drvdata(pdev);
-
- i2c_unregister_device(adap->client);
- i2c_del_adapter(&adap->adapter);
- irq_domain_remove(adap->irq_domain);
--
-- return 0;
- }
-
- static const struct platform_device_id cht_wc_i2c_adap_id_table[] = {
-@@ -548,7 +546,7 @@ MODULE_DEVICE_TABLE(platform, cht_wc_i2c_adap_id_table);
-
- static struct platform_driver cht_wc_i2c_adap_driver = {
- .probe = cht_wc_i2c_adap_i2c_probe,
-- .remove = cht_wc_i2c_adap_i2c_remove,
-+ .remove_new = cht_wc_i2c_adap_i2c_remove,
- .driver = {
- .name = "cht_wcove_ext_chgr",
- },
-diff --git a/drivers/i2c/busses/i2c-cpm.c b/drivers/i2c/busses/i2c-cpm.c
-index 24d584a1c9a78..732daf6a932b3 100644
---- a/drivers/i2c/busses/i2c-cpm.c
-+++ b/drivers/i2c/busses/i2c-cpm.c
-@@ -676,7 +676,7 @@ static int cpm_i2c_probe(struct platform_device *ofdev)
- return result;
- }
-
--static int cpm_i2c_remove(struct platform_device *ofdev)
-+static void cpm_i2c_remove(struct platform_device *ofdev)
- {
- struct cpm_i2c *cpm = platform_get_drvdata(ofdev);
-
-@@ -685,8 +685,6 @@ static int cpm_i2c_remove(struct platform_device *ofdev)
- cpm_i2c_shutdown(cpm);
-
- kfree(cpm);
--
-- return 0;
- }
-
- static const struct of_device_id cpm_i2c_match[] = {
-@@ -703,7 +701,7 @@ MODULE_DEVICE_TABLE(of, cpm_i2c_match);
-
- static struct platform_driver cpm_i2c_driver = {
- .probe = cpm_i2c_probe,
-- .remove = cpm_i2c_remove,
-+ .remove_new = cpm_i2c_remove,
- .driver = {
- .name = "fsl-i2c-cpm",
- .of_match_table = cpm_i2c_match,
-diff --git a/drivers/i2c/busses/i2c-cros-ec-tunnel.c b/drivers/i2c/busses/i2c-cros-ec-tunnel.c
-index 4e787dc709f91..d3fb1a86296fd 100644
---- a/drivers/i2c/busses/i2c-cros-ec-tunnel.c
-+++ b/drivers/i2c/busses/i2c-cros-ec-tunnel.c
-@@ -283,13 +283,11 @@ static int ec_i2c_probe(struct platform_device *pdev)
- return err;
- }
-
--static int ec_i2c_remove(struct platform_device *dev)
-+static void ec_i2c_remove(struct platform_device *dev)
- {
- struct ec_i2c_device *bus = platform_get_drvdata(dev);
-
- i2c_del_adapter(&bus->adap);
--
-- return 0;
- }
-
- static const struct of_device_id cros_ec_i2c_of_match[] = {
-@@ -306,7 +304,7 @@ MODULE_DEVICE_TABLE(acpi, cros_ec_i2c_tunnel_acpi_id);
-
- static struct platform_driver ec_i2c_tunnel_driver = {
- .probe = ec_i2c_probe,
-- .remove = ec_i2c_remove,
-+ .remove_new = ec_i2c_remove,
- .driver = {
- .name = "cros-ec-i2c-tunnel",
- .acpi_match_table = ACPI_PTR(cros_ec_i2c_tunnel_acpi_id),
-diff --git a/drivers/i2c/busses/i2c-davinci.c b/drivers/i2c/busses/i2c-davinci.c
-index c836cf8841850..5010501e8e87e 100644
---- a/drivers/i2c/busses/i2c-davinci.c
-+++ b/drivers/i2c/busses/i2c-davinci.c
-@@ -888,7 +888,7 @@ static int davinci_i2c_probe(struct platform_device *pdev)
- return r;
- }
-
--static int davinci_i2c_remove(struct platform_device *pdev)
-+static void davinci_i2c_remove(struct platform_device *pdev)
- {
- struct davinci_i2c_dev *dev = platform_get_drvdata(pdev);
- int ret;
-@@ -897,17 +897,15 @@ static int davinci_i2c_remove(struct platform_device *pdev)
-
- i2c_del_adapter(&dev->adapter);
-
-- ret = pm_runtime_resume_and_get(&pdev->dev);
-+ ret = pm_runtime_get_sync(&pdev->dev);
- if (ret < 0)
-- return ret;
--
-- davinci_i2c_write_reg(dev, DAVINCI_I2C_MDR_REG, 0);
-+ dev_err(&pdev->dev, "Failed to resume device\n");
-+ else
-+ davinci_i2c_write_reg(dev, DAVINCI_I2C_MDR_REG, 0);
-
- pm_runtime_dont_use_autosuspend(dev->dev);
- pm_runtime_put_sync(dev->dev);
- pm_runtime_disable(dev->dev);
--
-- return 0;
- }
-
- #ifdef CONFIG_PM
-@@ -948,7 +946,7 @@ MODULE_ALIAS("platform:i2c_davinci");
-
- static struct platform_driver davinci_i2c_driver = {
- .probe = davinci_i2c_probe,
-- .remove = davinci_i2c_remove,
-+ .remove_new = davinci_i2c_remove,
- .driver = {
- .name = "i2c_davinci",
- .pm = davinci_i2c_pm_ops,
-diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c
-index 74182db03a88b..21537b1cd03f0 100644
---- a/drivers/i2c/busses/i2c-designware-platdrv.c
-+++ b/drivers/i2c/busses/i2c-designware-platdrv.c
-@@ -385,7 +385,7 @@ static int dw_i2c_plat_probe(struct platform_device *pdev)
- return ret;
- }
-
--static int dw_i2c_plat_remove(struct platform_device *pdev)
-+static void dw_i2c_plat_remove(struct platform_device *pdev)
- {
- struct dw_i2c_dev *dev = platform_get_drvdata(pdev);
-
-@@ -402,8 +402,6 @@ static int dw_i2c_plat_remove(struct platform_device *pdev)
- i2c_dw_remove_lock_support(dev);
-
- reset_control_assert(dev->rst);
--
-- return 0;
- }
-
- #ifdef CONFIG_PM_SLEEP
-@@ -482,7 +480,7 @@ MODULE_ALIAS("platform:i2c_designware");
-
- static struct platform_driver dw_i2c_driver = {
- .probe = dw_i2c_plat_probe,
-- .remove = dw_i2c_plat_remove,
-+ .remove_new = dw_i2c_plat_remove,
- .driver = {
- .name = "i2c_designware",
- .of_match_table = of_match_ptr(dw_i2c_of_match),
-diff --git a/drivers/i2c/busses/i2c-digicolor.c b/drivers/i2c/busses/i2c-digicolor.c
-index 50925d97fa429..3462f2bc0fa87 100644
---- a/drivers/i2c/busses/i2c-digicolor.c
-+++ b/drivers/i2c/busses/i2c-digicolor.c
-@@ -347,14 +347,12 @@ static int dc_i2c_probe(struct platform_device *pdev)
- return 0;
- }
-
--static int dc_i2c_remove(struct platform_device *pdev)
-+static void dc_i2c_remove(struct platform_device *pdev)
- {
- struct dc_i2c *i2c = platform_get_drvdata(pdev);
-
- i2c_del_adapter(&i2c->adap);
- clk_disable_unprepare(i2c->clk);
--
-- return 0;
- }
-
- static const struct of_device_id dc_i2c_match[] = {
-@@ -365,7 +363,7 @@ MODULE_DEVICE_TABLE(of, dc_i2c_match);
-
- static struct platform_driver dc_i2c_driver = {
- .probe = dc_i2c_probe,
-- .remove = dc_i2c_remove,
-+ .remove_new = dc_i2c_remove,
- .driver = {
- .name = "digicolor-i2c",
- .of_match_table = dc_i2c_match,
-diff --git a/drivers/i2c/busses/i2c-dln2.c b/drivers/i2c/busses/i2c-dln2.c
-index 2a2089db71a5e..4f02cc2fb5675 100644
---- a/drivers/i2c/busses/i2c-dln2.c
-+++ b/drivers/i2c/busses/i2c-dln2.c
-@@ -236,20 +236,18 @@ static int dln2_i2c_probe(struct platform_device *pdev)
- return ret;
- }
-
--static int dln2_i2c_remove(struct platform_device *pdev)
-+static void dln2_i2c_remove(struct platform_device *pdev)
- {
- struct dln2_i2c *dln2 = platform_get_drvdata(pdev);
-
- i2c_del_adapter(&dln2->adapter);
- dln2_i2c_enable(dln2, false);
--
-- return 0;
- }
-
- static struct platform_driver dln2_i2c_driver = {
- .driver.name = "dln2-i2c",
- .probe = dln2_i2c_probe,
-- .remove = dln2_i2c_remove,
-+ .remove_new = dln2_i2c_remove,
- };
-
- module_platform_driver(dln2_i2c_driver);
-diff --git a/drivers/i2c/busses/i2c-emev2.c b/drivers/i2c/busses/i2c-emev2.c
-index f2e537b137b20..4ba93cd91c0f0 100644
---- a/drivers/i2c/busses/i2c-emev2.c
-+++ b/drivers/i2c/busses/i2c-emev2.c
-@@ -419,14 +419,12 @@ static int em_i2c_probe(struct platform_device *pdev)
- return ret;
- }
-
--static int em_i2c_remove(struct platform_device *dev)
-+static void em_i2c_remove(struct platform_device *dev)
- {
- struct em_i2c_device *priv = platform_get_drvdata(dev);
-
- i2c_del_adapter(&priv->adap);
- clk_disable_unprepare(priv->sclk);
--
-- return 0;
- }
-
- static const struct of_device_id em_i2c_ids[] = {
-@@ -436,7 +434,7 @@ static const struct of_device_id em_i2c_ids[] = {
-
- static struct platform_driver em_i2c_driver = {
- .probe = em_i2c_probe,
-- .remove = em_i2c_remove,
-+ .remove_new = em_i2c_remove,
- .driver = {
- .name = "em-i2c",
- .of_match_table = em_i2c_ids,
-diff --git a/drivers/i2c/busses/i2c-exynos5.c b/drivers/i2c/busses/i2c-exynos5.c
-index 4a6260d04db28..f378cd479e558 100644
---- a/drivers/i2c/busses/i2c-exynos5.c
-+++ b/drivers/i2c/busses/i2c-exynos5.c
-@@ -882,7 +882,7 @@ static int exynos5_i2c_probe(struct platform_device *pdev)
- return ret;
- }
-
--static int exynos5_i2c_remove(struct platform_device *pdev)
-+static void exynos5_i2c_remove(struct platform_device *pdev)
- {
- struct exynos5_i2c *i2c = platform_get_drvdata(pdev);
-
-@@ -890,8 +890,6 @@ static int exynos5_i2c_remove(struct platform_device *pdev)
-
- clk_unprepare(i2c->clk);
- clk_unprepare(i2c->pclk);
--
-- return 0;
- }
-
- #ifdef CONFIG_PM_SLEEP
-@@ -945,7 +943,7 @@ static const struct dev_pm_ops exynos5_i2c_dev_pm_ops = {
-
- static struct platform_driver exynos5_i2c_driver = {
- .probe = exynos5_i2c_probe,
-- .remove = exynos5_i2c_remove,
-+ .remove_new = exynos5_i2c_remove,
- .driver = {
- .name = "exynos5-hsi2c",
- .pm = &exynos5_i2c_dev_pm_ops,
-diff --git a/drivers/i2c/busses/i2c-gpio.c b/drivers/i2c/busses/i2c-gpio.c
-index 1794c0399f22d..e5a5b9e8bf2c7 100644
---- a/drivers/i2c/busses/i2c-gpio.c
-+++ b/drivers/i2c/busses/i2c-gpio.c
-@@ -475,7 +475,7 @@ static int i2c_gpio_probe(struct platform_device *pdev)
- return 0;
- }
-
--static int i2c_gpio_remove(struct platform_device *pdev)
-+static void i2c_gpio_remove(struct platform_device *pdev)
- {
- struct i2c_gpio_private_data *priv;
- struct i2c_adapter *adap;
-@@ -486,8 +486,6 @@ static int i2c_gpio_remove(struct platform_device *pdev)
- adap = &priv->adap;
-
- i2c_del_adapter(adap);
--
-- return 0;
- }
-
- static const struct of_device_id i2c_gpio_dt_ids[] = {
-@@ -510,7 +508,7 @@ static struct platform_driver i2c_gpio_driver = {
- .acpi_match_table = i2c_gpio_acpi_match,
- },
- .probe = i2c_gpio_probe,
-- .remove = i2c_gpio_remove,
-+ .remove_new = i2c_gpio_remove,
- };
-
- static int __init i2c_gpio_init(void)
-diff --git a/drivers/i2c/busses/i2c-gxp.c b/drivers/i2c/busses/i2c-gxp.c
-index 8ea3fb5e4c7f7..70b0de07ed99a 100644
---- a/drivers/i2c/busses/i2c-gxp.c
-+++ b/drivers/i2c/busses/i2c-gxp.c
-@@ -577,15 +577,13 @@ static int gxp_i2c_probe(struct platform_device *pdev)
- return 0;
- }
-
--static int gxp_i2c_remove(struct platform_device *pdev)
-+static void gxp_i2c_remove(struct platform_device *pdev)
- {
- struct gxp_i2c_drvdata *drvdata = platform_get_drvdata(pdev);
-
- /* Disable interrupt */
- regmap_update_bits(i2cg_map, GXP_I2CINTEN, BIT(drvdata->engine), 0);
- i2c_del_adapter(&drvdata->adapter);
--
-- return 0;
- }
-
- static const struct of_device_id gxp_i2c_of_match[] = {
-@@ -596,7 +594,7 @@ MODULE_DEVICE_TABLE(of, gxp_i2c_of_match);
-
- static struct platform_driver gxp_i2c_driver = {
- .probe = gxp_i2c_probe,
-- .remove = gxp_i2c_remove,
-+ .remove_new = gxp_i2c_remove,
- .driver = {
- .name = "gxp-i2c",
- .of_match_table = gxp_i2c_of_match,
-diff --git a/drivers/i2c/busses/i2c-highlander.c b/drivers/i2c/busses/i2c-highlander.c
-index 4374a86772717..7922bc917c33a 100644
---- a/drivers/i2c/busses/i2c-highlander.c
-+++ b/drivers/i2c/busses/i2c-highlander.c
-@@ -435,7 +435,7 @@ static int highlander_i2c_probe(struct platform_device *pdev)
- return ret;
- }
-
--static int highlander_i2c_remove(struct platform_device *pdev)
-+static void highlander_i2c_remove(struct platform_device *pdev)
- {
- struct highlander_i2c_dev *dev = platform_get_drvdata(pdev);
-
-@@ -446,8 +446,6 @@ static int highlander_i2c_remove(struct platform_device *pdev)
-
- iounmap(dev->base);
- kfree(dev);
--
-- return 0;
- }
-
- static struct platform_driver highlander_i2c_driver = {
-@@ -456,7 +454,7 @@ static struct platform_driver highlander_i2c_driver = {
- },
-
- .probe = highlander_i2c_probe,
-- .remove = highlander_i2c_remove,
-+ .remove_new = highlander_i2c_remove,
- };
-
- module_platform_driver(highlander_i2c_driver);
-diff --git a/drivers/i2c/busses/i2c-hix5hd2.c b/drivers/i2c/busses/i2c-hix5hd2.c
-index 0e34cbaca22dc..64feaa9dca619 100644
---- a/drivers/i2c/busses/i2c-hix5hd2.c
-+++ b/drivers/i2c/busses/i2c-hix5hd2.c
-@@ -464,7 +464,7 @@ static int hix5hd2_i2c_probe(struct platform_device *pdev)
- return ret;
- }
-
--static int hix5hd2_i2c_remove(struct platform_device *pdev)
-+static void hix5hd2_i2c_remove(struct platform_device *pdev)
- {
- struct hix5hd2_i2c_priv *priv = platform_get_drvdata(pdev);
-
-@@ -472,8 +472,6 @@ static int hix5hd2_i2c_remove(struct platform_device *pdev)
- pm_runtime_disable(priv->dev);
- pm_runtime_set_suspended(priv->dev);
- clk_disable_unprepare(priv->clk);
--
-- return 0;
- }
-
- #ifdef CONFIG_PM
-@@ -511,7 +509,7 @@ MODULE_DEVICE_TABLE(of, hix5hd2_i2c_match);
-
- static struct platform_driver hix5hd2_i2c_driver = {
- .probe = hix5hd2_i2c_probe,
-- .remove = hix5hd2_i2c_remove,
-+ .remove_new = hix5hd2_i2c_remove,
- .driver = {
- .name = "hix5hd2-i2c",
- .pm = &hix5hd2_i2c_pm_ops,
-diff --git a/drivers/i2c/busses/i2c-ibm_iic.c b/drivers/i2c/busses/i2c-ibm_iic.c
-index eeb80e34f9ad7..2d11577ded38a 100644
---- a/drivers/i2c/busses/i2c-ibm_iic.c
-+++ b/drivers/i2c/busses/i2c-ibm_iic.c
-@@ -769,7 +769,7 @@ static int iic_probe(struct platform_device *ofdev)
- /*
- * Cleanup initialized IIC interface
- */
--static int iic_remove(struct platform_device *ofdev)
-+static void iic_remove(struct platform_device *ofdev)
- {
- struct ibm_iic_private *dev = platform_get_drvdata(ofdev);
-
-@@ -782,8 +782,6 @@ static int iic_remove(struct platform_device *ofdev)
-
- iounmap(dev->vaddr);
- kfree(dev);
--
-- return 0;
- }
-
- static const struct of_device_id ibm_iic_match[] = {
-@@ -798,7 +796,7 @@ static struct platform_driver ibm_iic_driver = {
- .of_match_table = ibm_iic_match,
- },
- .probe = iic_probe,
-- .remove = iic_remove,
-+ .remove_new = iic_remove,
- };
-
- module_platform_driver(ibm_iic_driver);
-diff --git a/drivers/i2c/busses/i2c-img-scb.c b/drivers/i2c/busses/i2c-img-scb.c
-index 8e987945ed450..fea2940dbf2e7 100644
---- a/drivers/i2c/busses/i2c-img-scb.c
-+++ b/drivers/i2c/busses/i2c-img-scb.c
-@@ -1413,7 +1413,7 @@ static int img_i2c_probe(struct platform_device *pdev)
- return ret;
- }
-
--static int img_i2c_remove(struct platform_device *dev)
-+static void img_i2c_remove(struct platform_device *dev)
- {
- struct img_i2c *i2c = platform_get_drvdata(dev);
-
-@@ -1421,8 +1421,6 @@ static int img_i2c_remove(struct platform_device *dev)
- pm_runtime_disable(&dev->dev);
- if (!pm_runtime_status_suspended(&dev->dev))
- img_i2c_runtime_suspend(&dev->dev);
--
-- return 0;
- }
-
- static int img_i2c_runtime_suspend(struct device *dev)
-@@ -1506,7 +1504,7 @@ static struct platform_driver img_scb_i2c_driver = {
- .pm = &img_i2c_pm,
- },
- .probe = img_i2c_probe,
-- .remove = img_i2c_remove,
-+ .remove_new = img_i2c_remove,
- };
- module_platform_driver(img_scb_i2c_driver);
-
-diff --git a/drivers/i2c/busses/i2c-imx-lpi2c.c b/drivers/i2c/busses/i2c-imx-lpi2c.c
-index ff12018bc2060..20092e8236cb0 100644
---- a/drivers/i2c/busses/i2c-imx-lpi2c.c
-+++ b/drivers/i2c/busses/i2c-imx-lpi2c.c
-@@ -623,7 +623,7 @@ static int lpi2c_imx_probe(struct platform_device *pdev)
- return ret;
- }
-
--static int lpi2c_imx_remove(struct platform_device *pdev)
-+static void lpi2c_imx_remove(struct platform_device *pdev)
- {
- struct lpi2c_imx_struct *lpi2c_imx = platform_get_drvdata(pdev);
-
-@@ -631,8 +631,6 @@ static int lpi2c_imx_remove(struct platform_device *pdev)
-
- pm_runtime_disable(&pdev->dev);
- pm_runtime_dont_use_autosuspend(&pdev->dev);
--
-- return 0;
- }
-
- static int __maybe_unused lpi2c_runtime_suspend(struct device *dev)
-@@ -669,7 +667,7 @@ static const struct dev_pm_ops lpi2c_pm_ops = {
-
- static struct platform_driver lpi2c_imx_driver = {
- .probe = lpi2c_imx_probe,
-- .remove = lpi2c_imx_remove,
-+ .remove_new = lpi2c_imx_remove,
- .driver = {
- .name = DRIVER_NAME,
- .of_match_table = lpi2c_imx_of_match,
-diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c
-index cf5bacf3a4884..f093fdb584373 100644
---- a/drivers/i2c/busses/i2c-imx.c
-+++ b/drivers/i2c/busses/i2c-imx.c
-@@ -1568,7 +1568,7 @@ static int i2c_imx_probe(struct platform_device *pdev)
- return ret;
- }
-
--static int i2c_imx_remove(struct platform_device *pdev)
-+static void i2c_imx_remove(struct platform_device *pdev)
- {
- struct imx_i2c_struct *i2c_imx = platform_get_drvdata(pdev);
- int irq, ret;
-@@ -1602,8 +1602,6 @@ static int i2c_imx_remove(struct platform_device *pdev)
-
- pm_runtime_put_noidle(&pdev->dev);
- pm_runtime_disable(&pdev->dev);
--
-- return 0;
- }
-
- static int __maybe_unused i2c_imx_runtime_suspend(struct device *dev)
-@@ -1634,7 +1632,7 @@ static const struct dev_pm_ops i2c_imx_pm_ops = {
-
- static struct platform_driver i2c_imx_driver = {
- .probe = i2c_imx_probe,
-- .remove = i2c_imx_remove,
-+ .remove_new = i2c_imx_remove,
- .driver = {
- .name = DRIVER_NAME,
- .pm = &i2c_imx_pm_ops,
-diff --git a/drivers/i2c/busses/i2c-iop3xx.c b/drivers/i2c/busses/i2c-iop3xx.c
-index 4a6ff54d87fe8..f2f7ebeeaecb0 100644
---- a/drivers/i2c/busses/i2c-iop3xx.c
-+++ b/drivers/i2c/busses/i2c-iop3xx.c
-@@ -388,7 +388,7 @@ static const struct i2c_algorithm iop3xx_i2c_algo = {
- .functionality = iop3xx_i2c_func,
- };
-
--static int
-+static void
- iop3xx_i2c_remove(struct platform_device *pdev)
- {
- struct i2c_adapter *padapter = platform_get_drvdata(pdev);
-@@ -408,8 +408,6 @@ iop3xx_i2c_remove(struct platform_device *pdev)
- release_mem_region(res->start, IOP3XX_I2C_IO_SIZE);
- kfree(adapter_data);
- kfree(padapter);
--
-- return 0;
- }
-
- static int
-@@ -529,7 +527,7 @@ MODULE_DEVICE_TABLE(of, i2c_iop3xx_match);
-
- static struct platform_driver iop3xx_i2c_driver = {
- .probe = iop3xx_i2c_probe,
-- .remove = iop3xx_i2c_remove,
-+ .remove_new = iop3xx_i2c_remove,
- .driver = {
- .name = "IOP3xx-I2C",
- .of_match_table = i2c_iop3xx_match,
-diff --git a/drivers/i2c/busses/i2c-isch.c b/drivers/i2c/busses/i2c-isch.c
-index 2dc7ada06ac50..1dc1ceaa44439 100644
---- a/drivers/i2c/busses/i2c-isch.c
-+++ b/drivers/i2c/busses/i2c-isch.c
-@@ -286,14 +286,12 @@ static int smbus_sch_probe(struct platform_device *dev)
- return retval;
- }
-
--static int smbus_sch_remove(struct platform_device *pdev)
-+static void smbus_sch_remove(struct platform_device *pdev)
- {
- if (sch_smba) {
- i2c_del_adapter(&sch_adapter);
- sch_smba = 0;
- }
--
-- return 0;
- }
-
- static struct platform_driver smbus_sch_driver = {
-@@ -301,7 +299,7 @@ static struct platform_driver smbus_sch_driver = {
- .name = "isch_smbus",
- },
- .probe = smbus_sch_probe,
-- .remove = smbus_sch_remove,
-+ .remove_new = smbus_sch_remove,
- };
-
- module_platform_driver(smbus_sch_driver);
-diff --git a/drivers/i2c/busses/i2c-jz4780.c b/drivers/i2c/busses/i2c-jz4780.c
-index baa7319eee539..0dfe603995214 100644
---- a/drivers/i2c/busses/i2c-jz4780.c
-+++ b/drivers/i2c/busses/i2c-jz4780.c
-@@ -845,18 +845,17 @@ static int jz4780_i2c_probe(struct platform_device *pdev)
- return ret;
- }
-
--static int jz4780_i2c_remove(struct platform_device *pdev)
-+static void jz4780_i2c_remove(struct platform_device *pdev)
- {
- struct jz4780_i2c *i2c = platform_get_drvdata(pdev);
-
- clk_disable_unprepare(i2c->clk);
- i2c_del_adapter(&i2c->adap);
-- return 0;
- }
-
- static struct platform_driver jz4780_i2c_driver = {
- .probe = jz4780_i2c_probe,
-- .remove = jz4780_i2c_remove,
-+ .remove_new = jz4780_i2c_remove,
- .driver = {
- .name = "jz4780-i2c",
- .of_match_table = jz4780_i2c_of_matches,
-diff --git a/drivers/i2c/busses/i2c-kempld.c b/drivers/i2c/busses/i2c-kempld.c
-index cf857cf225070..281058e3ea463 100644
---- a/drivers/i2c/busses/i2c-kempld.c
-+++ b/drivers/i2c/busses/i2c-kempld.c
-@@ -329,7 +329,7 @@ static int kempld_i2c_probe(struct platform_device *pdev)
- return 0;
- }
-
--static int kempld_i2c_remove(struct platform_device *pdev)
-+static void kempld_i2c_remove(struct platform_device *pdev)
- {
- struct kempld_i2c_data *i2c = platform_get_drvdata(pdev);
- struct kempld_device_data *pld = i2c->pld;
-@@ -348,8 +348,6 @@ static int kempld_i2c_remove(struct platform_device *pdev)
- kempld_release_mutex(pld);
-
- i2c_del_adapter(&i2c->adap);
--
-- return 0;
- }
-
- #ifdef CONFIG_PM
-@@ -389,7 +387,7 @@ static struct platform_driver kempld_i2c_driver = {
- .name = "kempld-i2c",
- },
- .probe = kempld_i2c_probe,
-- .remove = kempld_i2c_remove,
-+ .remove_new = kempld_i2c_remove,
- .suspend = kempld_i2c_suspend,
- .resume = kempld_i2c_resume,
- };
-diff --git a/drivers/i2c/busses/i2c-lpc2k.c b/drivers/i2c/busses/i2c-lpc2k.c
-index 8fff6fbb7065c..469fe907723e8 100644
---- a/drivers/i2c/busses/i2c-lpc2k.c
-+++ b/drivers/i2c/busses/i2c-lpc2k.c
-@@ -435,14 +435,12 @@ static int i2c_lpc2k_probe(struct platform_device *pdev)
- return ret;
- }
-
--static int i2c_lpc2k_remove(struct platform_device *dev)
-+static void i2c_lpc2k_remove(struct platform_device *dev)
- {
- struct lpc2k_i2c *i2c = platform_get_drvdata(dev);
-
- i2c_del_adapter(&i2c->adap);
- clk_disable_unprepare(i2c->clk);
--
-- return 0;
- }
-
- #ifdef CONFIG_PM
-@@ -483,7 +481,7 @@ MODULE_DEVICE_TABLE(of, lpc2k_i2c_match);
-
- static struct platform_driver i2c_lpc2k_driver = {
- .probe = i2c_lpc2k_probe,
-- .remove = i2c_lpc2k_remove,
-+ .remove_new = i2c_lpc2k_remove,
- .driver = {
- .name = "lpc2k-i2c",
- .pm = I2C_LPC2K_DEV_PM_OPS,
-diff --git a/drivers/i2c/busses/i2c-meson.c b/drivers/i2c/busses/i2c-meson.c
-index 889eff06b78f4..16026c895bb65 100644
---- a/drivers/i2c/busses/i2c-meson.c
-+++ b/drivers/i2c/busses/i2c-meson.c
-@@ -535,14 +535,12 @@ static int meson_i2c_probe(struct platform_device *pdev)
- return 0;
- }
-
--static int meson_i2c_remove(struct platform_device *pdev)
-+static void meson_i2c_remove(struct platform_device *pdev)
- {
- struct meson_i2c *i2c = platform_get_drvdata(pdev);
-
- i2c_del_adapter(&i2c->adap);
- clk_disable_unprepare(i2c->clk);
--
-- return 0;
- }
-
- static const struct meson_i2c_data i2c_meson6_data = {
-@@ -568,7 +566,7 @@ MODULE_DEVICE_TABLE(of, meson_i2c_match);
-
- static struct platform_driver meson_i2c_driver = {
- .probe = meson_i2c_probe,
-- .remove = meson_i2c_remove,
-+ .remove_new = meson_i2c_remove,
- .driver = {
- .name = "meson-i2c",
- .of_match_table = meson_i2c_match,
-diff --git a/drivers/i2c/busses/i2c-microchip-corei2c.c b/drivers/i2c/busses/i2c-microchip-corei2c.c
-index 4d7e9b25f018b..7f58f7eaabb63 100644
---- a/drivers/i2c/busses/i2c-microchip-corei2c.c
-+++ b/drivers/i2c/busses/i2c-microchip-corei2c.c
-@@ -446,14 +446,12 @@ static int mchp_corei2c_probe(struct platform_device *pdev)
- return 0;
- }
-
--static int mchp_corei2c_remove(struct platform_device *pdev)
-+static void mchp_corei2c_remove(struct platform_device *pdev)
- {
- struct mchp_corei2c_dev *idev = platform_get_drvdata(pdev);
-
- clk_disable_unprepare(idev->i2c_clk);
- i2c_del_adapter(&idev->adapter);
--
-- return 0;
- }
-
- static const struct of_device_id mchp_corei2c_of_match[] = {
-@@ -465,7 +463,7 @@ MODULE_DEVICE_TABLE(of, mchp_corei2c_of_match);
-
- static struct platform_driver mchp_corei2c_driver = {
- .probe = mchp_corei2c_probe,
-- .remove = mchp_corei2c_remove,
-+ .remove_new = mchp_corei2c_remove,
- .driver = {
- .name = "microchip-corei2c",
- .of_match_table = mchp_corei2c_of_match,
-diff --git a/drivers/i2c/busses/i2c-mlxbf.c b/drivers/i2c/busses/i2c-mlxbf.c
-index 1810d5791b3d7..ae66bdd1b7379 100644
---- a/drivers/i2c/busses/i2c-mlxbf.c
-+++ b/drivers/i2c/busses/i2c-mlxbf.c
-@@ -2433,7 +2433,7 @@ static int mlxbf_i2c_probe(struct platform_device *pdev)
- return 0;
- }
-
--static int mlxbf_i2c_remove(struct platform_device *pdev)
-+static void mlxbf_i2c_remove(struct platform_device *pdev)
- {
- struct mlxbf_i2c_priv *priv = platform_get_drvdata(pdev);
- struct device *dev = &pdev->dev;
-@@ -2474,13 +2474,11 @@ static int mlxbf_i2c_remove(struct platform_device *pdev)
- devm_free_irq(dev, priv->irq, priv);
-
- i2c_del_adapter(&priv->adap);
--
-- return 0;
- }
-
- static struct platform_driver mlxbf_i2c_driver = {
- .probe = mlxbf_i2c_probe,
-- .remove = mlxbf_i2c_remove,
-+ .remove_new = mlxbf_i2c_remove,
- .driver = {
- .name = "i2c-mlxbf",
- .acpi_match_table = ACPI_PTR(mlxbf_i2c_acpi_ids),
-diff --git a/drivers/i2c/busses/i2c-mlxcpld.c b/drivers/i2c/busses/i2c-mlxcpld.c
-index 081f51ef0551b..c42fd4b329e4b 100644
---- a/drivers/i2c/busses/i2c-mlxcpld.c
-+++ b/drivers/i2c/busses/i2c-mlxcpld.c
-@@ -571,19 +571,17 @@ static int mlxcpld_i2c_probe(struct platform_device *pdev)
- return err;
- }
-
--static int mlxcpld_i2c_remove(struct platform_device *pdev)
-+static void mlxcpld_i2c_remove(struct platform_device *pdev)
- {
- struct mlxcpld_i2c_priv *priv = platform_get_drvdata(pdev);
-
- i2c_del_adapter(&priv->adap);
- mutex_destroy(&priv->lock);
--
-- return 0;
- }
-
- static struct platform_driver mlxcpld_i2c_driver = {
- .probe = mlxcpld_i2c_probe,
-- .remove = mlxcpld_i2c_remove,
-+ .remove_new = mlxcpld_i2c_remove,
- .driver = {
- .name = MLXCPLD_I2C_DEVICE_NAME,
- },
-diff --git a/drivers/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c
-index 81ac92bb4f6f1..c1afd618ec1cb 100644
---- a/drivers/i2c/busses/i2c-mpc.c
-+++ b/drivers/i2c/busses/i2c-mpc.c
-@@ -879,15 +879,13 @@ static int fsl_i2c_probe(struct platform_device *op)
- return result;
- };
-
--static int fsl_i2c_remove(struct platform_device *op)
-+static void fsl_i2c_remove(struct platform_device *op)
- {
- struct mpc_i2c *i2c = platform_get_drvdata(op);
-
- i2c_del_adapter(&i2c->adap);
-
- clk_disable_unprepare(i2c->clk_per);
--
-- return 0;
- };
-
- static int __maybe_unused mpc_i2c_suspend(struct device *dev)
-@@ -948,7 +946,7 @@ MODULE_DEVICE_TABLE(of, mpc_i2c_of_match);
- /* Structure for a device driver */
- static struct platform_driver mpc_i2c_driver = {
- .probe = fsl_i2c_probe,
-- .remove = fsl_i2c_remove,
-+ .remove_new = fsl_i2c_remove,
- .driver = {
- .name = DRV_NAME,
- .of_match_table = mpc_i2c_of_match,
-diff --git a/drivers/i2c/busses/i2c-mt65xx.c b/drivers/i2c/busses/i2c-mt65xx.c
-index 43dd966d5ef58..263dd8d3484fb 100644
---- a/drivers/i2c/busses/i2c-mt65xx.c
-+++ b/drivers/i2c/busses/i2c-mt65xx.c
-@@ -1492,15 +1492,13 @@ static int mtk_i2c_probe(struct platform_device *pdev)
- return ret;
- }
-
--static int mtk_i2c_remove(struct platform_device *pdev)
-+static void mtk_i2c_remove(struct platform_device *pdev)
- {
- struct mtk_i2c *i2c = platform_get_drvdata(pdev);
-
- i2c_del_adapter(&i2c->adap);
-
- clk_bulk_unprepare(I2C_MT65XX_CLK_MAX, i2c->clocks);
--
-- return 0;
- }
-
- #ifdef CONFIG_PM_SLEEP
-@@ -1542,7 +1540,7 @@ static const struct dev_pm_ops mtk_i2c_pm = {
-
- static struct platform_driver mtk_i2c_driver = {
- .probe = mtk_i2c_probe,
-- .remove = mtk_i2c_remove,
-+ .remove_new = mtk_i2c_remove,
- .driver = {
- .name = I2C_DRV_NAME,
- .pm = &mtk_i2c_pm,
-diff --git a/drivers/i2c/busses/i2c-mt7621.c b/drivers/i2c/busses/i2c-mt7621.c
-index 20eda5738ac49..f9c294e2bd3c5 100644
---- a/drivers/i2c/busses/i2c-mt7621.c
-+++ b/drivers/i2c/busses/i2c-mt7621.c
-@@ -332,19 +332,17 @@ static int mtk_i2c_probe(struct platform_device *pdev)
- return ret;
- }
-
--static int mtk_i2c_remove(struct platform_device *pdev)
-+static void mtk_i2c_remove(struct platform_device *pdev)
- {
- struct mtk_i2c *i2c = platform_get_drvdata(pdev);
-
- clk_disable_unprepare(i2c->clk);
- i2c_del_adapter(&i2c->adap);
--
-- return 0;
- }
-
- static struct platform_driver mtk_i2c_driver = {
- .probe = mtk_i2c_probe,
-- .remove = mtk_i2c_remove,
-+ .remove_new = mtk_i2c_remove,
- .driver = {
- .name = "i2c-mt7621",
- .of_match_table = i2c_mtk_dt_ids,
-diff --git a/drivers/i2c/busses/i2c-mv64xxx.c b/drivers/i2c/busses/i2c-mv64xxx.c
-index 878c076ebdc6b..fd8403b07fa61 100644
---- a/drivers/i2c/busses/i2c-mv64xxx.c
-+++ b/drivers/i2c/busses/i2c-mv64xxx.c
-@@ -1084,7 +1084,7 @@ mv64xxx_i2c_probe(struct platform_device *pd)
- return rc;
- }
-
--static int
-+static void
- mv64xxx_i2c_remove(struct platform_device *pd)
- {
- struct mv64xxx_i2c_data *drv_data = platform_get_drvdata(pd);
-@@ -1094,8 +1094,6 @@ mv64xxx_i2c_remove(struct platform_device *pd)
- pm_runtime_disable(&pd->dev);
- if (!pm_runtime_status_suspended(&pd->dev))
- mv64xxx_i2c_runtime_suspend(&pd->dev);
--
-- return 0;
- }
-
- static const struct dev_pm_ops mv64xxx_i2c_pm_ops = {
-@@ -1107,7 +1105,7 @@ static const struct dev_pm_ops mv64xxx_i2c_pm_ops = {
-
- static struct platform_driver mv64xxx_i2c_driver = {
- .probe = mv64xxx_i2c_probe,
-- .remove = mv64xxx_i2c_remove,
-+ .remove_new = mv64xxx_i2c_remove,
- .driver = {
- .name = MV64XXX_I2C_CTLR_NAME,
- .pm = &mv64xxx_i2c_pm_ops,
-diff --git a/drivers/i2c/busses/i2c-mxs.c b/drivers/i2c/busses/i2c-mxs.c
-index e0f3b3545cfe4..1d76f1c4dc06a 100644
---- a/drivers/i2c/busses/i2c-mxs.c
-+++ b/drivers/i2c/busses/i2c-mxs.c
-@@ -864,7 +864,7 @@ static int mxs_i2c_probe(struct platform_device *pdev)
- return 0;
- }
-
--static int mxs_i2c_remove(struct platform_device *pdev)
-+static void mxs_i2c_remove(struct platform_device *pdev)
- {
- struct mxs_i2c_dev *i2c = platform_get_drvdata(pdev);
-
-@@ -874,8 +874,6 @@ static int mxs_i2c_remove(struct platform_device *pdev)
- dma_release_channel(i2c->dmach);
-
- writel(MXS_I2C_CTRL0_SFTRST, i2c->regs + MXS_I2C_CTRL0_SET);
--
-- return 0;
- }
-
- static struct platform_driver mxs_i2c_driver = {
-@@ -884,7 +882,7 @@ static struct platform_driver mxs_i2c_driver = {
- .of_match_table = mxs_i2c_dt_ids,
- },
- .probe = mxs_i2c_probe,
-- .remove = mxs_i2c_remove,
-+ .remove_new = mxs_i2c_remove,
- };
-
- static int __init mxs_i2c_init(void)
-diff --git a/drivers/i2c/busses/i2c-npcm7xx.c b/drivers/i2c/busses/i2c-npcm7xx.c
-index 38d5864d0cb5b..53b65ffb6a647 100644
---- a/drivers/i2c/busses/i2c-npcm7xx.c
-+++ b/drivers/i2c/busses/i2c-npcm7xx.c
-@@ -2361,7 +2361,7 @@ static int npcm_i2c_probe_bus(struct platform_device *pdev)
- return 0;
- }
-
--static int npcm_i2c_remove_bus(struct platform_device *pdev)
-+static void npcm_i2c_remove_bus(struct platform_device *pdev)
- {
- unsigned long lock_flags;
- struct npcm_i2c *bus = platform_get_drvdata(pdev);
-@@ -2371,7 +2371,6 @@ static int npcm_i2c_remove_bus(struct platform_device *pdev)
- npcm_i2c_disable(bus);
- spin_unlock_irqrestore(&bus->lock, lock_flags);
- i2c_del_adapter(&bus->adap);
-- return 0;
- }
-
- static const struct of_device_id npcm_i2c_bus_of_table[] = {
-@@ -2383,7 +2382,7 @@ MODULE_DEVICE_TABLE(of, npcm_i2c_bus_of_table);
-
- static struct platform_driver npcm_i2c_bus_driver = {
- .probe = npcm_i2c_probe_bus,
-- .remove = npcm_i2c_remove_bus,
-+ .remove_new = npcm_i2c_remove_bus,
- .driver = {
- .name = "nuvoton-i2c",
- .of_match_table = npcm_i2c_bus_of_table,
-diff --git a/drivers/i2c/busses/i2c-ocores.c b/drivers/i2c/busses/i2c-ocores.c
-index 2e575856c5cd5..0742b84a11eb5 100644
---- a/drivers/i2c/busses/i2c-ocores.c
-+++ b/drivers/i2c/busses/i2c-ocores.c
-@@ -743,7 +743,7 @@ static int ocores_i2c_probe(struct platform_device *pdev)
- return ret;
- }
-
--static int ocores_i2c_remove(struct platform_device *pdev)
-+static void ocores_i2c_remove(struct platform_device *pdev)
- {
- struct ocores_i2c *i2c = platform_get_drvdata(pdev);
- u8 ctrl = oc_getreg(i2c, OCI2C_CONTROL);
-@@ -757,8 +757,6 @@ static int ocores_i2c_remove(struct platform_device *pdev)
-
- if (!IS_ERR(i2c->clk))
- clk_disable_unprepare(i2c->clk);
--
-- return 0;
- }
-
- #ifdef CONFIG_PM_SLEEP
-@@ -804,7 +802,7 @@ static SIMPLE_DEV_PM_OPS(ocores_i2c_pm, ocores_i2c_suspend, ocores_i2c_resume);
-
- static struct platform_driver ocores_i2c_driver = {
- .probe = ocores_i2c_probe,
-- .remove = ocores_i2c_remove,
-+ .remove_new = ocores_i2c_remove,
- .driver = {
- .name = "ocores-i2c",
- .of_match_table = ocores_i2c_match,
-diff --git a/drivers/i2c/busses/i2c-octeon-platdrv.c b/drivers/i2c/busses/i2c-octeon-platdrv.c
-index 0c227963c8d69..7d54b3203f716 100644
---- a/drivers/i2c/busses/i2c-octeon-platdrv.c
-+++ b/drivers/i2c/busses/i2c-octeon-platdrv.c
-@@ -253,12 +253,11 @@ static int octeon_i2c_probe(struct platform_device *pdev)
- return result;
- };
-
--static int octeon_i2c_remove(struct platform_device *pdev)
-+static void octeon_i2c_remove(struct platform_device *pdev)
- {
- struct octeon_i2c *i2c = platform_get_drvdata(pdev);
-
- i2c_del_adapter(&i2c->adap);
-- return 0;
- };
-
- static const struct of_device_id octeon_i2c_match[] = {
-@@ -270,7 +269,7 @@ MODULE_DEVICE_TABLE(of, octeon_i2c_match);
-
- static struct platform_driver octeon_i2c_driver = {
- .probe = octeon_i2c_probe,
-- .remove = octeon_i2c_remove,
-+ .remove_new = octeon_i2c_remove,
- .driver = {
- .name = DRV_NAME,
- .of_match_table = octeon_i2c_match,
-diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
-index 4199f57a6bf29..58fd6fa3edf14 100644
---- a/drivers/i2c/busses/i2c-omap.c
-+++ b/drivers/i2c/busses/i2c-omap.c
-@@ -1519,7 +1519,7 @@ omap_i2c_probe(struct platform_device *pdev)
- return r;
- }
-
--static int omap_i2c_remove(struct platform_device *pdev)
-+static void omap_i2c_remove(struct platform_device *pdev)
- {
- struct omap_i2c_dev *omap = platform_get_drvdata(pdev);
- int ret;
-@@ -1535,8 +1535,6 @@ static int omap_i2c_remove(struct platform_device *pdev)
- pm_runtime_dont_use_autosuspend(&pdev->dev);
- pm_runtime_put_sync(&pdev->dev);
- pm_runtime_disable(&pdev->dev);
--
-- return 0;
- }
-
- static int __maybe_unused omap_i2c_runtime_suspend(struct device *dev)
-@@ -1588,7 +1586,7 @@ static const struct dev_pm_ops omap_i2c_pm_ops = {
-
- static struct platform_driver omap_i2c_driver = {
- .probe = omap_i2c_probe,
-- .remove = omap_i2c_remove,
-+ .remove_new = omap_i2c_remove,
- .driver = {
- .name = "omap_i2c",
- .pm = &omap_i2c_pm_ops,
-diff --git a/drivers/i2c/busses/i2c-opal.c b/drivers/i2c/busses/i2c-opal.c
-index 9f773b4f5ed8e..17ef87d50f7c7 100644
---- a/drivers/i2c/busses/i2c-opal.c
-+++ b/drivers/i2c/busses/i2c-opal.c
-@@ -232,13 +232,11 @@ static int i2c_opal_probe(struct platform_device *pdev)
- return rc;
- }
-
--static int i2c_opal_remove(struct platform_device *pdev)
-+static void i2c_opal_remove(struct platform_device *pdev)
- {
- struct i2c_adapter *adapter = platform_get_drvdata(pdev);
-
- i2c_del_adapter(adapter);
--
-- return 0;
- }
-
- static const struct of_device_id i2c_opal_of_match[] = {
-@@ -251,7 +249,7 @@ MODULE_DEVICE_TABLE(of, i2c_opal_of_match);
-
- static struct platform_driver i2c_opal_driver = {
- .probe = i2c_opal_probe,
-- .remove = i2c_opal_remove,
-+ .remove_new = i2c_opal_remove,
- .driver = {
- .name = "i2c-opal",
- .of_match_table = i2c_opal_of_match,
-diff --git a/drivers/i2c/busses/i2c-pasemi-platform.c b/drivers/i2c/busses/i2c-pasemi-platform.c
-index e35945a91dbef..0a44f64897c7a 100644
---- a/drivers/i2c/busses/i2c-pasemi-platform.c
-+++ b/drivers/i2c/busses/i2c-pasemi-platform.c
-@@ -98,12 +98,11 @@ static int pasemi_platform_i2c_probe(struct platform_device *pdev)
- return error;
- }
-
--static int pasemi_platform_i2c_remove(struct platform_device *pdev)
-+static void pasemi_platform_i2c_remove(struct platform_device *pdev)
- {
- struct pasemi_platform_i2c_data *data = platform_get_drvdata(pdev);
-
- clk_disable_unprepare(data->clk_ref);
-- return 0;
- }
-
- static const struct of_device_id pasemi_platform_i2c_of_match[] = {
-@@ -119,7 +118,7 @@ static struct platform_driver pasemi_platform_i2c_driver = {
- .of_match_table = pasemi_platform_i2c_of_match,
- },
- .probe = pasemi_platform_i2c_probe,
-- .remove = pasemi_platform_i2c_remove,
-+ .remove_new = pasemi_platform_i2c_remove,
- };
- module_platform_driver(pasemi_platform_i2c_driver);
-
-diff --git a/drivers/i2c/busses/i2c-pca-platform.c b/drivers/i2c/busses/i2c-pca-platform.c
-index 86d4f75ef8d3f..d2a9e7b61c1ab 100644
---- a/drivers/i2c/busses/i2c-pca-platform.c
-+++ b/drivers/i2c/busses/i2c-pca-platform.c
-@@ -221,13 +221,11 @@ static int i2c_pca_pf_probe(struct platform_device *pdev)
- return 0;
- }
-
--static int i2c_pca_pf_remove(struct platform_device *pdev)
-+static void i2c_pca_pf_remove(struct platform_device *pdev)
- {
- struct i2c_pca_pf_data *i2c = platform_get_drvdata(pdev);
-
- i2c_del_adapter(&i2c->adap);
--
-- return 0;
- }
-
- #ifdef CONFIG_OF
-@@ -241,7 +239,7 @@ MODULE_DEVICE_TABLE(of, i2c_pca_of_match_table);
-
- static struct platform_driver i2c_pca_pf_driver = {
- .probe = i2c_pca_pf_probe,
-- .remove = i2c_pca_pf_remove,
-+ .remove_new = i2c_pca_pf_remove,
- .driver = {
- .name = "i2c-pca-platform",
- .of_match_table = of_match_ptr(i2c_pca_of_match_table),
-diff --git a/drivers/i2c/busses/i2c-pnx.c b/drivers/i2c/busses/i2c-pnx.c
-index 50f21cdbe90d3..82400057f810a 100644
---- a/drivers/i2c/busses/i2c-pnx.c
-+++ b/drivers/i2c/busses/i2c-pnx.c
-@@ -743,14 +743,12 @@ static int i2c_pnx_probe(struct platform_device *pdev)
- return ret;
- }
-
--static int i2c_pnx_remove(struct platform_device *pdev)
-+static void i2c_pnx_remove(struct platform_device *pdev)
- {
- struct i2c_pnx_algo_data *alg_data = platform_get_drvdata(pdev);
-
- i2c_del_adapter(&alg_data->adapter);
- clk_disable_unprepare(alg_data->clk);
--
-- return 0;
- }
-
- #ifdef CONFIG_OF
-@@ -768,7 +766,7 @@ static struct platform_driver i2c_pnx_driver = {
- .pm = PNX_I2C_PM,
- },
- .probe = i2c_pnx_probe,
-- .remove = i2c_pnx_remove,
-+ .remove_new = i2c_pnx_remove,
- };
-
- static int __init i2c_adap_pnx_init(void)
-diff --git a/drivers/i2c/busses/i2c-powermac.c b/drivers/i2c/busses/i2c-powermac.c
-index 2e74747eec9ce..4d9705a0e8e2a 100644
---- a/drivers/i2c/busses/i2c-powermac.c
-+++ b/drivers/i2c/busses/i2c-powermac.c
-@@ -188,14 +188,12 @@ static const struct i2c_adapter_quirks i2c_powermac_quirks = {
- .max_num_msgs = 1,
- };
-
--static int i2c_powermac_remove(struct platform_device *dev)
-+static void i2c_powermac_remove(struct platform_device *dev)
- {
- struct i2c_adapter *adapter = platform_get_drvdata(dev);
-
- i2c_del_adapter(adapter);
- memset(adapter, 0, sizeof(*adapter));
--
-- return 0;
- }
-
- static u32 i2c_powermac_get_addr(struct i2c_adapter *adap,
-@@ -439,7 +437,7 @@ static int i2c_powermac_probe(struct platform_device *dev)
-
- static struct platform_driver i2c_powermac_driver = {
- .probe = i2c_powermac_probe,
-- .remove = i2c_powermac_remove,
-+ .remove_new = i2c_powermac_remove,
- .driver = {
- .name = "i2c-powermac",
- .bus = &platform_bus_type,
-diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c
-index b605b6e43cb90..0d6697e6602ec 100644
---- a/drivers/i2c/busses/i2c-pxa.c
-+++ b/drivers/i2c/busses/i2c-pxa.c
-@@ -1484,15 +1484,13 @@ static int i2c_pxa_probe(struct platform_device *dev)
- return ret;
- }
-
--static int i2c_pxa_remove(struct platform_device *dev)
-+static void i2c_pxa_remove(struct platform_device *dev)
- {
- struct pxa_i2c *i2c = platform_get_drvdata(dev);
-
- i2c_del_adapter(&i2c->adap);
-
- clk_disable_unprepare(i2c->clk);
--
-- return 0;
- }
-
- #ifdef CONFIG_PM
-@@ -1527,7 +1525,7 @@ static const struct dev_pm_ops i2c_pxa_dev_pm_ops = {
-
- static struct platform_driver i2c_pxa_driver = {
- .probe = i2c_pxa_probe,
-- .remove = i2c_pxa_remove,
-+ .remove_new = i2c_pxa_remove,
- .driver = {
- .name = "pxa2xx-i2c",
- .pm = I2C_PXA_DEV_PM_OPS,
-diff --git a/drivers/i2c/busses/i2c-qcom-cci.c b/drivers/i2c/busses/i2c-qcom-cci.c
-index 01358472680c4..58860014e0681 100644
---- a/drivers/i2c/busses/i2c-qcom-cci.c
-+++ b/drivers/i2c/busses/i2c-qcom-cci.c
-@@ -675,7 +675,7 @@ static int cci_probe(struct platform_device *pdev)
- return ret;
- }
-
--static int cci_remove(struct platform_device *pdev)
-+static void cci_remove(struct platform_device *pdev)
- {
- struct cci *cci = platform_get_drvdata(pdev);
- int i;
-@@ -691,8 +691,6 @@ static int cci_remove(struct platform_device *pdev)
- disable_irq(cci->irq);
- pm_runtime_disable(&pdev->dev);
- pm_runtime_set_suspended(&pdev->dev);
--
-- return 0;
- }
-
- static const struct cci_data cci_v1_data = {
-@@ -829,7 +827,7 @@ MODULE_DEVICE_TABLE(of, cci_dt_match);
-
- static struct platform_driver qcom_cci_driver = {
- .probe = cci_probe,
-- .remove = cci_remove,
-+ .remove_new = cci_remove,
- .driver = {
- .name = "i2c-qcom-cci",
- .of_match_table = cci_dt_match,
-diff --git a/drivers/i2c/busses/i2c-qcom-geni.c b/drivers/i2c/busses/i2c-qcom-geni.c
-index 83909b02a03ee..b670a67c4fdd0 100644
---- a/drivers/i2c/busses/i2c-qcom-geni.c
-+++ b/drivers/i2c/busses/i2c-qcom-geni.c
-@@ -936,14 +936,13 @@ static int geni_i2c_probe(struct platform_device *pdev)
- return ret;
- }
-
--static int geni_i2c_remove(struct platform_device *pdev)
-+static void geni_i2c_remove(struct platform_device *pdev)
- {
- struct geni_i2c_dev *gi2c = platform_get_drvdata(pdev);
-
- i2c_del_adapter(&gi2c->adap);
- release_gpi_dma(gi2c);
- pm_runtime_disable(gi2c->se.dev);
-- return 0;
- }
-
- static void geni_i2c_shutdown(struct platform_device *pdev)
-@@ -1041,7 +1040,7 @@ MODULE_DEVICE_TABLE(of, geni_i2c_dt_match);
-
- static struct platform_driver geni_i2c_driver = {
- .probe = geni_i2c_probe,
-- .remove = geni_i2c_remove,
-+ .remove_new = geni_i2c_remove,
- .shutdown = geni_i2c_shutdown,
- .driver = {
- .name = "geni_i2c",
-diff --git a/drivers/i2c/busses/i2c-qup.c b/drivers/i2c/busses/i2c-qup.c
-index 2e153f2f71b6d..6eef1dbd00de7 100644
---- a/drivers/i2c/busses/i2c-qup.c
-+++ b/drivers/i2c/busses/i2c-qup.c
-@@ -1904,7 +1904,7 @@ static int qup_i2c_probe(struct platform_device *pdev)
- return ret;
- }
-
--static int qup_i2c_remove(struct platform_device *pdev)
-+static void qup_i2c_remove(struct platform_device *pdev)
- {
- struct qup_i2c_dev *qup = platform_get_drvdata(pdev);
-
-@@ -1918,7 +1918,6 @@ static int qup_i2c_remove(struct platform_device *pdev)
- i2c_del_adapter(&qup->adap);
- pm_runtime_disable(qup->dev);
- pm_runtime_set_suspended(qup->dev);
-- return 0;
- }
-
- #ifdef CONFIG_PM
-@@ -1978,7 +1977,7 @@ MODULE_DEVICE_TABLE(of, qup_i2c_dt_match);
-
- static struct platform_driver qup_i2c_driver = {
- .probe = qup_i2c_probe,
-- .remove = qup_i2c_remove,
-+ .remove_new = qup_i2c_remove,
- .driver = {
- .name = "i2c_qup",
- .pm = &qup_i2c_qup_pm_ops,
-diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c
-index cef82b205c261..2d9c37410ebd0 100644
---- a/drivers/i2c/busses/i2c-rcar.c
-+++ b/drivers/i2c/busses/i2c-rcar.c
-@@ -1155,7 +1155,7 @@ static int rcar_i2c_probe(struct platform_device *pdev)
- return ret;
- }
-
--static int rcar_i2c_remove(struct platform_device *pdev)
-+static void rcar_i2c_remove(struct platform_device *pdev)
- {
- struct rcar_i2c_priv *priv = platform_get_drvdata(pdev);
- struct device *dev = &pdev->dev;
-@@ -1167,8 +1167,6 @@ static int rcar_i2c_remove(struct platform_device *pdev)
- if (priv->flags & ID_P_PM_BLOCKED)
- pm_runtime_put(dev);
- pm_runtime_disable(dev);
--
-- return 0;
- }
-
- #ifdef CONFIG_PM_SLEEP
-@@ -1204,7 +1202,7 @@ static struct platform_driver rcar_i2c_driver = {
- .pm = DEV_PM_OPS,
- },
- .probe = rcar_i2c_probe,
-- .remove = rcar_i2c_remove,
-+ .remove_new = rcar_i2c_remove,
- };
-
- module_platform_driver(rcar_i2c_driver);
-diff --git a/drivers/i2c/busses/i2c-riic.c b/drivers/i2c/busses/i2c-riic.c
-index 849848ccb0802..5f8c0bd508d2f 100644
---- a/drivers/i2c/busses/i2c-riic.c
-+++ b/drivers/i2c/busses/i2c-riic.c
-@@ -477,7 +477,7 @@ static int riic_i2c_probe(struct platform_device *pdev)
- return ret;
- }
-
--static int riic_i2c_remove(struct platform_device *pdev)
-+static void riic_i2c_remove(struct platform_device *pdev)
- {
- struct riic_dev *riic = platform_get_drvdata(pdev);
-
-@@ -486,8 +486,6 @@ static int riic_i2c_remove(struct platform_device *pdev)
- pm_runtime_put(&pdev->dev);
- i2c_del_adapter(&riic->adapter);
- pm_runtime_disable(&pdev->dev);
--
-- return 0;
- }
-
- static const struct of_device_id riic_i2c_dt_ids[] = {
-@@ -497,7 +495,7 @@ static const struct of_device_id riic_i2c_dt_ids[] = {
-
- static struct platform_driver riic_i2c_driver = {
- .probe = riic_i2c_probe,
-- .remove = riic_i2c_remove,
-+ .remove_new = riic_i2c_remove,
- .driver = {
- .name = "i2c-riic",
- .of_match_table = riic_i2c_dt_ids,
-diff --git a/drivers/i2c/busses/i2c-rk3x.c b/drivers/i2c/busses/i2c-rk3x.c
-index b31cf4f18f854..a044ca0c35a19 100644
---- a/drivers/i2c/busses/i2c-rk3x.c
-+++ b/drivers/i2c/busses/i2c-rk3x.c
-@@ -1372,7 +1372,7 @@ static int rk3x_i2c_probe(struct platform_device *pdev)
- return ret;
- }
-
--static int rk3x_i2c_remove(struct platform_device *pdev)
-+static void rk3x_i2c_remove(struct platform_device *pdev)
- {
- struct rk3x_i2c *i2c = platform_get_drvdata(pdev);
-
-@@ -1381,15 +1381,13 @@ static int rk3x_i2c_remove(struct platform_device *pdev)
- clk_notifier_unregister(i2c->clk, &i2c->clk_rate_nb);
- clk_unprepare(i2c->pclk);
- clk_unprepare(i2c->clk);
--
-- return 0;
- }
-
- static SIMPLE_DEV_PM_OPS(rk3x_i2c_pm_ops, NULL, rk3x_i2c_resume);
-
- static struct platform_driver rk3x_i2c_driver = {
- .probe = rk3x_i2c_probe,
-- .remove = rk3x_i2c_remove,
-+ .remove_new = rk3x_i2c_remove,
- .driver = {
- .name = "rk3x-i2c",
- .of_match_table = rk3x_i2c_match,
-diff --git a/drivers/i2c/busses/i2c-rzv2m.c b/drivers/i2c/busses/i2c-rzv2m.c
-index 56d0faee5c46e..dee9b6e655c56 100644
---- a/drivers/i2c/busses/i2c-rzv2m.c
-+++ b/drivers/i2c/busses/i2c-rzv2m.c
-@@ -460,7 +460,7 @@ static int rzv2m_i2c_probe(struct platform_device *pdev)
- return ret;
- }
-
--static int rzv2m_i2c_remove(struct platform_device *pdev)
-+static void rzv2m_i2c_remove(struct platform_device *pdev)
- {
- struct rzv2m_i2c_priv *priv = platform_get_drvdata(pdev);
- struct device *dev = priv->adap.dev.parent;
-@@ -468,8 +468,6 @@ static int rzv2m_i2c_remove(struct platform_device *pdev)
- i2c_del_adapter(&priv->adap);
- bit_clrl(priv->base + IICB0CTL0, IICB0IICE);
- pm_runtime_disable(dev);
--
-- return 0;
- }
-
- static int rzv2m_i2c_suspend(struct device *dev)
-@@ -523,7 +521,7 @@ static struct platform_driver rzv2m_i2c_driver = {
- .pm = pm_sleep_ptr(&rzv2m_i2c_pm_ops),
- },
- .probe = rzv2m_i2c_probe,
-- .remove = rzv2m_i2c_remove,
-+ .remove_new = rzv2m_i2c_remove,
- };
- module_platform_driver(rzv2m_i2c_driver);
-
-diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c
-index 45e9df81345a1..28f0e5c64f32e 100644
---- a/drivers/i2c/busses/i2c-s3c2410.c
-+++ b/drivers/i2c/busses/i2c-s3c2410.c
-@@ -1114,7 +1114,7 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev)
- return 0;
- }
-
--static int s3c24xx_i2c_remove(struct platform_device *pdev)
-+static void s3c24xx_i2c_remove(struct platform_device *pdev)
- {
- struct s3c24xx_i2c *i2c = platform_get_drvdata(pdev);
-
-@@ -1123,8 +1123,6 @@ static int s3c24xx_i2c_remove(struct platform_device *pdev)
- pm_runtime_disable(&pdev->dev);
-
- i2c_del_adapter(&i2c->adap);
--
-- return 0;
- }
-
- #ifdef CONFIG_PM_SLEEP
-@@ -1172,7 +1170,7 @@ static const struct dev_pm_ops s3c24xx_i2c_dev_pm_ops = {
-
- static struct platform_driver s3c24xx_i2c_driver = {
- .probe = s3c24xx_i2c_probe,
-- .remove = s3c24xx_i2c_remove,
-+ .remove_new = s3c24xx_i2c_remove,
- .id_table = s3c24xx_driver_ids,
- .driver = {
- .name = "s3c-i2c",
-diff --git a/drivers/i2c/busses/i2c-scmi.c b/drivers/i2c/busses/i2c-scmi.c
-index 0239e134b90f4..1045702922413 100644
---- a/drivers/i2c/busses/i2c-scmi.c
-+++ b/drivers/i2c/busses/i2c-scmi.c
-@@ -404,19 +404,17 @@ static int smbus_cmi_probe(struct platform_device *device)
- return ret;
- }
-
--static int smbus_cmi_remove(struct platform_device *device)
-+static void smbus_cmi_remove(struct platform_device *device)
- {
- struct acpi_smbus_cmi *smbus_cmi = platform_get_drvdata(device);
-
- i2c_del_adapter(&smbus_cmi->adapter);
- kfree(smbus_cmi);
--
-- return 0;
- }
-
- static struct platform_driver smbus_cmi_driver = {
- .probe = smbus_cmi_probe,
-- .remove = smbus_cmi_remove,
-+ .remove_new = smbus_cmi_remove,
- .driver = {
- .name = "smbus_cmi",
- .acpi_match_table = acpi_smbus_cmi_ids,
-diff --git a/drivers/i2c/busses/i2c-sh7760.c b/drivers/i2c/busses/i2c-sh7760.c
-index 319d1fa617c88..60efa3a5e6756 100644
---- a/drivers/i2c/busses/i2c-sh7760.c
-+++ b/drivers/i2c/busses/i2c-sh7760.c
-@@ -536,7 +536,7 @@ static int sh7760_i2c_probe(struct platform_device *pdev)
- return ret;
- }
-
--static int sh7760_i2c_remove(struct platform_device *pdev)
-+static void sh7760_i2c_remove(struct platform_device *pdev)
- {
- struct cami2c *id = platform_get_drvdata(pdev);
-
-@@ -546,8 +546,6 @@ static int sh7760_i2c_remove(struct platform_device *pdev)
- release_resource(id->ioarea);
- kfree(id->ioarea);
- kfree(id);
--
-- return 0;
- }
-
- static struct platform_driver sh7760_i2c_drv = {
-@@ -555,7 +553,7 @@ static struct platform_driver sh7760_i2c_drv = {
- .name = SH7760_I2C_DEVNAME,
- },
- .probe = sh7760_i2c_probe,
-- .remove = sh7760_i2c_remove,
-+ .remove_new = sh7760_i2c_remove,
- };
-
- module_platform_driver(sh7760_i2c_drv);
-diff --git a/drivers/i2c/busses/i2c-sh_mobile.c b/drivers/i2c/busses/i2c-sh_mobile.c
-index 29330ee64c9c0..21717b943a9e0 100644
---- a/drivers/i2c/busses/i2c-sh_mobile.c
-+++ b/drivers/i2c/busses/i2c-sh_mobile.c
-@@ -956,14 +956,13 @@ static int sh_mobile_i2c_probe(struct platform_device *dev)
- return 0;
- }
-
--static int sh_mobile_i2c_remove(struct platform_device *dev)
-+static void sh_mobile_i2c_remove(struct platform_device *dev)
- {
- struct sh_mobile_i2c_data *pd = platform_get_drvdata(dev);
-
- i2c_del_adapter(&pd->adap);
- sh_mobile_i2c_release_dma(pd);
- pm_runtime_disable(&dev->dev);
-- return 0;
- }
-
- #ifdef CONFIG_PM_SLEEP
-@@ -1000,7 +999,7 @@ static struct platform_driver sh_mobile_i2c_driver = {
- .pm = DEV_PM_OPS,
- },
- .probe = sh_mobile_i2c_probe,
-- .remove = sh_mobile_i2c_remove,
-+ .remove_new = sh_mobile_i2c_remove,
- };
-
- static int __init sh_mobile_i2c_adap_init(void)
-diff --git a/drivers/i2c/busses/i2c-simtec.c b/drivers/i2c/busses/i2c-simtec.c
-index 87701744752fb..18516bc64e046 100644
---- a/drivers/i2c/busses/i2c-simtec.c
-+++ b/drivers/i2c/busses/i2c-simtec.c
-@@ -126,7 +126,7 @@ static int simtec_i2c_probe(struct platform_device *dev)
- return ret;
- }
-
--static int simtec_i2c_remove(struct platform_device *dev)
-+static void simtec_i2c_remove(struct platform_device *dev)
- {
- struct simtec_i2c_data *pd = platform_get_drvdata(dev);
-
-@@ -135,8 +135,6 @@ static int simtec_i2c_remove(struct platform_device *dev)
- iounmap(pd->reg);
- release_mem_region(pd->ioarea->start, resource_size(pd->ioarea));
- kfree(pd);
--
-- return 0;
- }
-
- /* device driver */
-@@ -146,7 +144,7 @@ static struct platform_driver simtec_i2c_driver = {
- .name = "simtec-i2c",
- },
- .probe = simtec_i2c_probe,
-- .remove = simtec_i2c_remove,
-+ .remove_new = simtec_i2c_remove,
- };
-
- module_platform_driver(simtec_i2c_driver);
-diff --git a/drivers/i2c/busses/i2c-st.c b/drivers/i2c/busses/i2c-st.c
-index f823913b75a6f..25c3521cae0e3 100644
---- a/drivers/i2c/busses/i2c-st.c
-+++ b/drivers/i2c/busses/i2c-st.c
-@@ -876,13 +876,11 @@ static int st_i2c_probe(struct platform_device *pdev)
- return 0;
- }
-
--static int st_i2c_remove(struct platform_device *pdev)
-+static void st_i2c_remove(struct platform_device *pdev)
- {
- struct st_i2c_dev *i2c_dev = platform_get_drvdata(pdev);
-
- i2c_del_adapter(&i2c_dev->adap);
--
-- return 0;
- }
-
- static const struct of_device_id st_i2c_match[] = {
-@@ -899,7 +897,7 @@ static struct platform_driver st_i2c_driver = {
- .pm = pm_sleep_ptr(&st_i2c_pm),
- },
- .probe = st_i2c_probe,
-- .remove = st_i2c_remove,
-+ .remove_new = st_i2c_remove,
- };
-
- module_platform_driver(st_i2c_driver);
-diff --git a/drivers/i2c/busses/i2c-stm32f4.c b/drivers/i2c/busses/i2c-stm32f4.c
-index eebce7ecef25b..6ad06a5a22b43 100644
---- a/drivers/i2c/busses/i2c-stm32f4.c
-+++ b/drivers/i2c/busses/i2c-stm32f4.c
-@@ -861,15 +861,13 @@ static int stm32f4_i2c_probe(struct platform_device *pdev)
- return ret;
- }
-
--static int stm32f4_i2c_remove(struct platform_device *pdev)
-+static void stm32f4_i2c_remove(struct platform_device *pdev)
- {
- struct stm32f4_i2c_dev *i2c_dev = platform_get_drvdata(pdev);
-
- i2c_del_adapter(&i2c_dev->adap);
-
- clk_unprepare(i2c_dev->clk);
--
-- return 0;
- }
-
- static const struct of_device_id stm32f4_i2c_match[] = {
-@@ -884,7 +882,7 @@ static struct platform_driver stm32f4_i2c_driver = {
- .of_match_table = stm32f4_i2c_match,
- },
- .probe = stm32f4_i2c_probe,
-- .remove = stm32f4_i2c_remove,
-+ .remove_new = stm32f4_i2c_remove,
- };
-
- module_platform_driver(stm32f4_i2c_driver);
-diff --git a/drivers/i2c/busses/i2c-stm32f7.c b/drivers/i2c/busses/i2c-stm32f7.c
-index d1c59d83a65b9..e897d9101434d 100644
---- a/drivers/i2c/busses/i2c-stm32f7.c
-+++ b/drivers/i2c/busses/i2c-stm32f7.c
-@@ -2309,7 +2309,7 @@ static int stm32f7_i2c_probe(struct platform_device *pdev)
- return ret;
- }
-
--static int stm32f7_i2c_remove(struct platform_device *pdev)
-+static void stm32f7_i2c_remove(struct platform_device *pdev)
- {
- struct stm32f7_i2c_dev *i2c_dev = platform_get_drvdata(pdev);
-
-@@ -2341,8 +2341,6 @@ static int stm32f7_i2c_remove(struct platform_device *pdev)
- stm32f7_i2c_write_fm_plus_bits(i2c_dev, false);
-
- clk_disable_unprepare(i2c_dev->clk);
--
-- return 0;
- }
-
- static int __maybe_unused stm32f7_i2c_runtime_suspend(struct device *dev)
-@@ -2486,7 +2484,7 @@ static struct platform_driver stm32f7_i2c_driver = {
- .pm = &stm32f7_i2c_pm_ops,
- },
- .probe = stm32f7_i2c_probe,
-- .remove = stm32f7_i2c_remove,
-+ .remove_new = stm32f7_i2c_remove,
- };
-
- module_platform_driver(stm32f7_i2c_driver);
-diff --git a/drivers/i2c/busses/i2c-sun6i-p2wi.c b/drivers/i2c/busses/i2c-sun6i-p2wi.c
-index 9e3483f507ff5..3cff1afe0caa2 100644
---- a/drivers/i2c/busses/i2c-sun6i-p2wi.c
-+++ b/drivers/i2c/busses/i2c-sun6i-p2wi.c
-@@ -313,20 +313,18 @@ static int p2wi_probe(struct platform_device *pdev)
- return ret;
- }
-
--static int p2wi_remove(struct platform_device *dev)
-+static void p2wi_remove(struct platform_device *dev)
- {
- struct p2wi *p2wi = platform_get_drvdata(dev);
-
- reset_control_assert(p2wi->rstc);
- clk_disable_unprepare(p2wi->clk);
- i2c_del_adapter(&p2wi->adapter);
--
-- return 0;
- }
-
- static struct platform_driver p2wi_driver = {
- .probe = p2wi_probe,
-- .remove = p2wi_remove,
-+ .remove_new = p2wi_remove,
- .driver = {
- .name = "i2c-sunxi-p2wi",
- .of_match_table = p2wi_of_match_table,
-diff --git a/drivers/i2c/busses/i2c-synquacer.c b/drivers/i2c/busses/i2c-synquacer.c
-index e4026c5416b15..1b4ab3b6022b5 100644
---- a/drivers/i2c/busses/i2c-synquacer.c
-+++ b/drivers/i2c/busses/i2c-synquacer.c
-@@ -618,15 +618,13 @@ static int synquacer_i2c_probe(struct platform_device *pdev)
- return 0;
- }
-
--static int synquacer_i2c_remove(struct platform_device *pdev)
-+static void synquacer_i2c_remove(struct platform_device *pdev)
- {
- struct synquacer_i2c *i2c = platform_get_drvdata(pdev);
-
- i2c_del_adapter(&i2c->adapter);
- if (!IS_ERR(i2c->pclk))
- clk_disable_unprepare(i2c->pclk);
--
-- return 0;
- };
-
- static const struct of_device_id synquacer_i2c_dt_ids[] = {
-@@ -645,7 +643,7 @@ MODULE_DEVICE_TABLE(acpi, synquacer_i2c_acpi_ids);
-
- static struct platform_driver synquacer_i2c_driver = {
- .probe = synquacer_i2c_probe,
-- .remove = synquacer_i2c_remove,
-+ .remove_new = synquacer_i2c_remove,
- .driver = {
- .name = "synquacer_i2c",
- .of_match_table = of_match_ptr(synquacer_i2c_dt_ids),
-diff --git a/drivers/i2c/busses/i2c-tegra-bpmp.c b/drivers/i2c/busses/i2c-tegra-bpmp.c
-index 95139985b2d5e..bc3f94561746e 100644
---- a/drivers/i2c/busses/i2c-tegra-bpmp.c
-+++ b/drivers/i2c/busses/i2c-tegra-bpmp.c
-@@ -316,13 +316,11 @@ static int tegra_bpmp_i2c_probe(struct platform_device *pdev)
- return i2c_add_adapter(&i2c->adapter);
- }
-
--static int tegra_bpmp_i2c_remove(struct platform_device *pdev)
-+static void tegra_bpmp_i2c_remove(struct platform_device *pdev)
- {
- struct tegra_bpmp_i2c *i2c = platform_get_drvdata(pdev);
-
- i2c_del_adapter(&i2c->adapter);
--
-- return 0;
- }
-
- static const struct of_device_id tegra_bpmp_i2c_of_match[] = {
-@@ -337,7 +335,7 @@ static struct platform_driver tegra_bpmp_i2c_driver = {
- .of_match_table = tegra_bpmp_i2c_of_match,
- },
- .probe = tegra_bpmp_i2c_probe,
-- .remove = tegra_bpmp_i2c_remove,
-+ .remove_new = tegra_bpmp_i2c_remove,
- };
- module_platform_driver(tegra_bpmp_i2c_driver);
-
-diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c
-index 157066f06a32d..a82d264bf73df 100644
---- a/drivers/i2c/busses/i2c-tegra.c
-+++ b/drivers/i2c/busses/i2c-tegra.c
-@@ -1868,7 +1868,7 @@ static int tegra_i2c_probe(struct platform_device *pdev)
- return err;
- }
-
--static int tegra_i2c_remove(struct platform_device *pdev)
-+static void tegra_i2c_remove(struct platform_device *pdev)
- {
- struct tegra_i2c_dev *i2c_dev = platform_get_drvdata(pdev);
-
-@@ -1877,8 +1877,6 @@ static int tegra_i2c_remove(struct platform_device *pdev)
-
- tegra_i2c_release_dma(i2c_dev);
- tegra_i2c_release_clocks(i2c_dev);
--
-- return 0;
- }
-
- static int __maybe_unused tegra_i2c_runtime_resume(struct device *dev)
-@@ -1987,7 +1985,7 @@ MODULE_DEVICE_TABLE(acpi, tegra_i2c_acpi_match);
-
- static struct platform_driver tegra_i2c_driver = {
- .probe = tegra_i2c_probe,
-- .remove = tegra_i2c_remove,
-+ .remove_new = tegra_i2c_remove,
- .driver = {
- .name = "tegra-i2c",
- .of_match_table = tegra_i2c_of_match,
-diff --git a/drivers/i2c/busses/i2c-uniphier-f.c b/drivers/i2c/busses/i2c-uniphier-f.c
-index d7b622891e52d..54b1624ef87ea 100644
---- a/drivers/i2c/busses/i2c-uniphier-f.c
-+++ b/drivers/i2c/busses/i2c-uniphier-f.c
-@@ -586,14 +586,12 @@ static int uniphier_fi2c_probe(struct platform_device *pdev)
- return ret;
- }
-
--static int uniphier_fi2c_remove(struct platform_device *pdev)
-+static void uniphier_fi2c_remove(struct platform_device *pdev)
- {
- struct uniphier_fi2c_priv *priv = platform_get_drvdata(pdev);
-
- i2c_del_adapter(&priv->adap);
- clk_disable_unprepare(priv->clk);
--
-- return 0;
- }
-
- static int __maybe_unused uniphier_fi2c_suspend(struct device *dev)
-@@ -631,7 +629,7 @@ MODULE_DEVICE_TABLE(of, uniphier_fi2c_match);
-
- static struct platform_driver uniphier_fi2c_drv = {
- .probe = uniphier_fi2c_probe,
-- .remove = uniphier_fi2c_remove,
-+ .remove_new = uniphier_fi2c_remove,
- .driver = {
- .name = "uniphier-fi2c",
- .of_match_table = uniphier_fi2c_match,
-diff --git a/drivers/i2c/busses/i2c-uniphier.c b/drivers/i2c/busses/i2c-uniphier.c
-index e3ebae381f08a..96b1eb7489a3c 100644
---- a/drivers/i2c/busses/i2c-uniphier.c
-+++ b/drivers/i2c/busses/i2c-uniphier.c
-@@ -380,14 +380,12 @@ static int uniphier_i2c_probe(struct platform_device *pdev)
- return ret;
- }
-
--static int uniphier_i2c_remove(struct platform_device *pdev)
-+static void uniphier_i2c_remove(struct platform_device *pdev)
- {
- struct uniphier_i2c_priv *priv = platform_get_drvdata(pdev);
-
- i2c_del_adapter(&priv->adap);
- clk_disable_unprepare(priv->clk);
--
-- return 0;
- }
-
- static int __maybe_unused uniphier_i2c_suspend(struct device *dev)
-@@ -425,7 +423,7 @@ MODULE_DEVICE_TABLE(of, uniphier_i2c_match);
-
- static struct platform_driver uniphier_i2c_drv = {
- .probe = uniphier_i2c_probe,
-- .remove = uniphier_i2c_remove,
-+ .remove_new = uniphier_i2c_remove,
- .driver = {
- .name = "uniphier-i2c",
- .of_match_table = uniphier_i2c_match,
-diff --git a/drivers/i2c/busses/i2c-versatile.c b/drivers/i2c/busses/i2c-versatile.c
-index 1ab419f8fa527..0a866456db586 100644
---- a/drivers/i2c/busses/i2c-versatile.c
-+++ b/drivers/i2c/busses/i2c-versatile.c
-@@ -96,12 +96,11 @@ static int i2c_versatile_probe(struct platform_device *dev)
- return 0;
- }
-
--static int i2c_versatile_remove(struct platform_device *dev)
-+static void i2c_versatile_remove(struct platform_device *dev)
- {
- struct i2c_versatile *i2c = platform_get_drvdata(dev);
-
- i2c_del_adapter(&i2c->adap);
-- return 0;
- }
-
- static const struct of_device_id i2c_versatile_match[] = {
-@@ -112,7 +111,7 @@ MODULE_DEVICE_TABLE(of, i2c_versatile_match);
-
- static struct platform_driver i2c_versatile_driver = {
- .probe = i2c_versatile_probe,
-- .remove = i2c_versatile_remove,
-+ .remove_new = i2c_versatile_remove,
- .driver = {
- .name = "versatile-i2c",
- .of_match_table = i2c_versatile_match,
-diff --git a/drivers/i2c/busses/i2c-viperboard.c b/drivers/i2c/busses/i2c-viperboard.c
-index 8b5322c3bce0e..9e153b5b0e8e4 100644
---- a/drivers/i2c/busses/i2c-viperboard.c
-+++ b/drivers/i2c/busses/i2c-viperboard.c
-@@ -407,20 +407,18 @@ static int vprbrd_i2c_probe(struct platform_device *pdev)
- return 0;
- }
-
--static int vprbrd_i2c_remove(struct platform_device *pdev)
-+static void vprbrd_i2c_remove(struct platform_device *pdev)
- {
- struct vprbrd_i2c *vb_i2c = platform_get_drvdata(pdev);
-
- i2c_del_adapter(&vb_i2c->i2c);
--
-- return 0;
- }
-
- static struct platform_driver vprbrd_i2c_driver = {
- .driver.name = "viperboard-i2c",
- .driver.owner = THIS_MODULE,
- .probe = vprbrd_i2c_probe,
-- .remove = vprbrd_i2c_remove,
-+ .remove_new = vprbrd_i2c_remove,
- };
-
- static int __init vprbrd_i2c_init(void)
-diff --git a/drivers/i2c/busses/i2c-wmt.c b/drivers/i2c/busses/i2c-wmt.c
-index 7d4bc87360793..736acaa538d26 100644
---- a/drivers/i2c/busses/i2c-wmt.c
-+++ b/drivers/i2c/busses/i2c-wmt.c
-@@ -436,7 +436,7 @@ static int wmt_i2c_probe(struct platform_device *pdev)
- return 0;
- }
-
--static int wmt_i2c_remove(struct platform_device *pdev)
-+static void wmt_i2c_remove(struct platform_device *pdev)
- {
- struct wmt_i2c_dev *i2c_dev = platform_get_drvdata(pdev);
-
-@@ -444,8 +444,6 @@ static int wmt_i2c_remove(struct platform_device *pdev)
- writew(0, i2c_dev->base + REG_IMR);
- clk_disable_unprepare(i2c_dev->clk);
- i2c_del_adapter(&i2c_dev->adapter);
--
-- return 0;
- }
-
- static const struct of_device_id wmt_i2c_dt_ids[] = {
-@@ -455,7 +453,7 @@ static const struct of_device_id wmt_i2c_dt_ids[] = {
-
- static struct platform_driver wmt_i2c_driver = {
- .probe = wmt_i2c_probe,
-- .remove = wmt_i2c_remove,
-+ .remove_new = wmt_i2c_remove,
- .driver = {
- .name = "wmt-i2c",
- .of_match_table = wmt_i2c_dt_ids,
-diff --git a/drivers/i2c/busses/i2c-xgene-slimpro.c b/drivers/i2c/busses/i2c-xgene-slimpro.c
-index 3538d36368a90..fbc1ffbd2fa7d 100644
---- a/drivers/i2c/busses/i2c-xgene-slimpro.c
-+++ b/drivers/i2c/busses/i2c-xgene-slimpro.c
-@@ -560,7 +560,7 @@ static int xgene_slimpro_i2c_probe(struct platform_device *pdev)
- return rc;
- }
-
--static int xgene_slimpro_i2c_remove(struct platform_device *pdev)
-+static void xgene_slimpro_i2c_remove(struct platform_device *pdev)
- {
- struct slimpro_i2c_dev *ctx = platform_get_drvdata(pdev);
-
-@@ -570,8 +570,6 @@ static int xgene_slimpro_i2c_remove(struct platform_device *pdev)
- mbox_free_channel(ctx->mbox_chan);
- else
- pcc_mbox_free_channel(ctx->pcc_chan);
--
-- return 0;
- }
-
- static const struct of_device_id xgene_slimpro_i2c_dt_ids[] = {
-@@ -591,7 +589,7 @@ MODULE_DEVICE_TABLE(acpi, xgene_slimpro_i2c_acpi_ids);
-
- static struct platform_driver xgene_slimpro_i2c_driver = {
- .probe = xgene_slimpro_i2c_probe,
-- .remove = xgene_slimpro_i2c_remove,
-+ .remove_new = xgene_slimpro_i2c_remove,
- .driver = {
- .name = "xgene-slimpro-i2c",
- .of_match_table = of_match_ptr(xgene_slimpro_i2c_dt_ids),
-diff --git a/drivers/i2c/busses/i2c-xiic.c b/drivers/i2c/busses/i2c-xiic.c
-index 3b94b07cb37a6..38b988af4195a 100644
---- a/drivers/i2c/busses/i2c-xiic.c
-+++ b/drivers/i2c/busses/i2c-xiic.c
-@@ -1336,7 +1336,7 @@ static int xiic_i2c_probe(struct platform_device *pdev)
- return ret;
- }
-
--static int xiic_i2c_remove(struct platform_device *pdev)
-+static void xiic_i2c_remove(struct platform_device *pdev)
- {
- struct xiic_i2c *i2c = platform_get_drvdata(pdev);
- int ret;
-@@ -1357,8 +1357,6 @@ static int xiic_i2c_remove(struct platform_device *pdev)
- pm_runtime_disable(&pdev->dev);
- pm_runtime_set_suspended(&pdev->dev);
- pm_runtime_dont_use_autosuspend(&pdev->dev);
--
-- return 0;
- }
-
- static int __maybe_unused xiic_i2c_runtime_suspend(struct device *dev)
-@@ -1391,7 +1389,7 @@ static const struct dev_pm_ops xiic_dev_pm_ops = {
-
- static struct platform_driver xiic_i2c_driver = {
- .probe = xiic_i2c_probe,
-- .remove = xiic_i2c_remove,
-+ .remove_new = xiic_i2c_remove,
- .driver = {
- .name = DRIVER_NAME,
- .of_match_table = of_match_ptr(xiic_of_match),
-diff --git a/drivers/i2c/busses/i2c-xlp9xx.c b/drivers/i2c/busses/i2c-xlp9xx.c
-index 4e3b11c0f7325..f59e8c544f366 100644
---- a/drivers/i2c/busses/i2c-xlp9xx.c
-+++ b/drivers/i2c/busses/i2c-xlp9xx.c
-@@ -559,7 +559,7 @@ static int xlp9xx_i2c_probe(struct platform_device *pdev)
- return 0;
- }
-
--static int xlp9xx_i2c_remove(struct platform_device *pdev)
-+static void xlp9xx_i2c_remove(struct platform_device *pdev)
- {
- struct xlp9xx_i2c_dev *priv;
-
-@@ -568,8 +568,6 @@ static int xlp9xx_i2c_remove(struct platform_device *pdev)
- synchronize_irq(priv->irq);
- i2c_del_adapter(&priv->adapter);
- xlp9xx_write_i2c_reg(priv, XLP9XX_I2C_CTRL, 0);
--
-- return 0;
- }
-
- #ifdef CONFIG_ACPI
-@@ -583,7 +581,7 @@ MODULE_DEVICE_TABLE(acpi, xlp9xx_i2c_acpi_ids);
-
- static struct platform_driver xlp9xx_i2c_driver = {
- .probe = xlp9xx_i2c_probe,
-- .remove = xlp9xx_i2c_remove,
-+ .remove_new = xlp9xx_i2c_remove,
- .driver = {
- .name = "xlp9xx-i2c",
- .acpi_match_table = ACPI_PTR(xlp9xx_i2c_acpi_ids),
-diff --git a/drivers/i2c/busses/scx200_acb.c b/drivers/i2c/busses/scx200_acb.c
-index 7b42a18bd05c2..83c1db610f54b 100644
---- a/drivers/i2c/busses/scx200_acb.c
-+++ b/drivers/i2c/busses/scx200_acb.c
-@@ -523,14 +523,12 @@ static void scx200_cleanup_iface(struct scx200_acb_iface *iface)
- kfree(iface);
- }
-
--static int scx200_remove(struct platform_device *pdev)
-+static void scx200_remove(struct platform_device *pdev)
- {
- struct scx200_acb_iface *iface;
-
- iface = platform_get_drvdata(pdev);
- scx200_cleanup_iface(iface);
--
-- return 0;
- }
-
- static struct platform_driver scx200_pci_driver = {
-@@ -538,7 +536,7 @@ static struct platform_driver scx200_pci_driver = {
- .name = "cs5535-smb",
- },
- .probe = scx200_probe,
-- .remove = scx200_remove,
-+ .remove_new = scx200_remove,
- };
-
- static const struct pci_device_id scx200_isa[] = {
-diff --git a/drivers/i2c/muxes/i2c-arb-gpio-challenge.c b/drivers/i2c/muxes/i2c-arb-gpio-challenge.c
-index 1c78657631f4f..24168e9f7df4c 100644
---- a/drivers/i2c/muxes/i2c-arb-gpio-challenge.c
-+++ b/drivers/i2c/muxes/i2c-arb-gpio-challenge.c
-@@ -174,13 +174,12 @@ static int i2c_arbitrator_probe(struct platform_device *pdev)
- return ret;
- }
-
--static int i2c_arbitrator_remove(struct platform_device *pdev)
-+static void i2c_arbitrator_remove(struct platform_device *pdev)
- {
- struct i2c_mux_core *muxc = platform_get_drvdata(pdev);
-
- i2c_mux_del_adapters(muxc);
- i2c_put_adapter(muxc->parent);
-- return 0;
- }
-
- static const struct of_device_id i2c_arbitrator_of_match[] = {
-@@ -191,7 +190,7 @@ MODULE_DEVICE_TABLE(of, i2c_arbitrator_of_match);
-
- static struct platform_driver i2c_arbitrator_driver = {
- .probe = i2c_arbitrator_probe,
-- .remove = i2c_arbitrator_remove,
-+ .remove_new = i2c_arbitrator_remove,
- .driver = {
- .name = "i2c-arb-gpio-challenge",
- .of_match_table = i2c_arbitrator_of_match,
-diff --git a/drivers/i2c/muxes/i2c-demux-pinctrl.c b/drivers/i2c/muxes/i2c-demux-pinctrl.c
-index f7a7405d4350a..a3a122fae71e0 100644
---- a/drivers/i2c/muxes/i2c-demux-pinctrl.c
-+++ b/drivers/i2c/muxes/i2c-demux-pinctrl.c
-@@ -282,7 +282,7 @@ static int i2c_demux_pinctrl_probe(struct platform_device *pdev)
- return err;
- }
-
--static int i2c_demux_pinctrl_remove(struct platform_device *pdev)
-+static void i2c_demux_pinctrl_remove(struct platform_device *pdev)
- {
- struct i2c_demux_pinctrl_priv *priv = platform_get_drvdata(pdev);
- int i;
-@@ -296,8 +296,6 @@ static int i2c_demux_pinctrl_remove(struct platform_device *pdev)
- of_node_put(priv->chan[i].parent_np);
- of_changeset_destroy(&priv->chan[i].chgset);
- }
--
-- return 0;
- }
-
- static const struct of_device_id i2c_demux_pinctrl_of_match[] = {
-@@ -312,7 +310,7 @@ static struct platform_driver i2c_demux_pinctrl_driver = {
- .of_match_table = i2c_demux_pinctrl_of_match,
- },
- .probe = i2c_demux_pinctrl_probe,
-- .remove = i2c_demux_pinctrl_remove,
-+ .remove_new = i2c_demux_pinctrl_remove,
- };
- module_platform_driver(i2c_demux_pinctrl_driver);
-
-diff --git a/drivers/i2c/muxes/i2c-mux-gpio.c b/drivers/i2c/muxes/i2c-mux-gpio.c
-index 73a23e117ebec..5d5cbe0130cdf 100644
---- a/drivers/i2c/muxes/i2c-mux-gpio.c
-+++ b/drivers/i2c/muxes/i2c-mux-gpio.c
-@@ -225,14 +225,12 @@ static int i2c_mux_gpio_probe(struct platform_device *pdev)
- return ret;
- }
-
--static int i2c_mux_gpio_remove(struct platform_device *pdev)
-+static void i2c_mux_gpio_remove(struct platform_device *pdev)
- {
- struct i2c_mux_core *muxc = platform_get_drvdata(pdev);
-
- i2c_mux_del_adapters(muxc);
- i2c_put_adapter(muxc->parent);
--
-- return 0;
- }
-
- static const struct of_device_id i2c_mux_gpio_of_match[] = {
-@@ -243,7 +241,7 @@ MODULE_DEVICE_TABLE(of, i2c_mux_gpio_of_match);
-
- static struct platform_driver i2c_mux_gpio_driver = {
- .probe = i2c_mux_gpio_probe,
-- .remove = i2c_mux_gpio_remove,
-+ .remove_new = i2c_mux_gpio_remove,
- .driver = {
- .name = "i2c-mux-gpio",
- .of_match_table = i2c_mux_gpio_of_match,
-diff --git a/drivers/i2c/muxes/i2c-mux-gpmux.c b/drivers/i2c/muxes/i2c-mux-gpmux.c
-index 33024acaac02b..0405af0e15104 100644
---- a/drivers/i2c/muxes/i2c-mux-gpmux.c
-+++ b/drivers/i2c/muxes/i2c-mux-gpmux.c
-@@ -142,19 +142,17 @@ static int i2c_mux_probe(struct platform_device *pdev)
- return ret;
- }
-
--static int i2c_mux_remove(struct platform_device *pdev)
-+static void i2c_mux_remove(struct platform_device *pdev)
- {
- struct i2c_mux_core *muxc = platform_get_drvdata(pdev);
-
- i2c_mux_del_adapters(muxc);
- i2c_put_adapter(muxc->parent);
--
-- return 0;
- }
-
- static struct platform_driver i2c_mux_driver = {
- .probe = i2c_mux_probe,
-- .remove = i2c_mux_remove,
-+ .remove_new = i2c_mux_remove,
- .driver = {
- .name = "i2c-mux-gpmux",
- .of_match_table = i2c_mux_of_match,
-diff --git a/drivers/i2c/muxes/i2c-mux-mlxcpld.c b/drivers/i2c/muxes/i2c-mux-mlxcpld.c
-index 1a879f6a31efd..3dda00f1df78d 100644
---- a/drivers/i2c/muxes/i2c-mux-mlxcpld.c
-+++ b/drivers/i2c/muxes/i2c-mux-mlxcpld.c
-@@ -170,12 +170,11 @@ static int mlxcpld_mux_probe(struct platform_device *pdev)
- return err;
- }
-
--static int mlxcpld_mux_remove(struct platform_device *pdev)
-+static void mlxcpld_mux_remove(struct platform_device *pdev)
- {
- struct i2c_mux_core *muxc = platform_get_drvdata(pdev);
-
- i2c_mux_del_adapters(muxc);
-- return 0;
- }
-
- static struct platform_driver mlxcpld_mux_driver = {
-@@ -183,7 +182,7 @@ static struct platform_driver mlxcpld_mux_driver = {
- .name = "i2c-mux-mlxcpld",
- },
- .probe = mlxcpld_mux_probe,
-- .remove = mlxcpld_mux_remove,
-+ .remove_new = mlxcpld_mux_remove,
- };
-
- module_platform_driver(mlxcpld_mux_driver);
-diff --git a/drivers/i2c/muxes/i2c-mux-pinctrl.c b/drivers/i2c/muxes/i2c-mux-pinctrl.c
-index d5ad904756fdf..18236b9fa14a9 100644
---- a/drivers/i2c/muxes/i2c-mux-pinctrl.c
-+++ b/drivers/i2c/muxes/i2c-mux-pinctrl.c
-@@ -166,14 +166,12 @@ static int i2c_mux_pinctrl_probe(struct platform_device *pdev)
- return ret;
- }
-
--static int i2c_mux_pinctrl_remove(struct platform_device *pdev)
-+static void i2c_mux_pinctrl_remove(struct platform_device *pdev)
- {
- struct i2c_mux_core *muxc = platform_get_drvdata(pdev);
-
- i2c_mux_del_adapters(muxc);
- i2c_put_adapter(muxc->parent);
--
-- return 0;
- }
-
- static const struct of_device_id i2c_mux_pinctrl_of_match[] = {
-@@ -188,7 +186,7 @@ static struct platform_driver i2c_mux_pinctrl_driver = {
- .of_match_table = i2c_mux_pinctrl_of_match,
- },
- .probe = i2c_mux_pinctrl_probe,
-- .remove = i2c_mux_pinctrl_remove,
-+ .remove_new = i2c_mux_pinctrl_remove,
- };
- module_platform_driver(i2c_mux_pinctrl_driver);
-
-diff --git a/drivers/i2c/muxes/i2c-mux-reg.c b/drivers/i2c/muxes/i2c-mux-reg.c
-index 30a6de1694e07..9efc1ed01577b 100644
---- a/drivers/i2c/muxes/i2c-mux-reg.c
-+++ b/drivers/i2c/muxes/i2c-mux-reg.c
-@@ -233,14 +233,12 @@ static int i2c_mux_reg_probe(struct platform_device *pdev)
- return ret;
- }
-
--static int i2c_mux_reg_remove(struct platform_device *pdev)
-+static void i2c_mux_reg_remove(struct platform_device *pdev)
- {
- struct i2c_mux_core *muxc = platform_get_drvdata(pdev);
-
- i2c_mux_del_adapters(muxc);
- i2c_put_adapter(muxc->parent);
--
-- return 0;
- }
-
- static const struct of_device_id i2c_mux_reg_of_match[] = {
-@@ -251,7 +249,7 @@ MODULE_DEVICE_TABLE(of, i2c_mux_reg_of_match);
-
- static struct platform_driver i2c_mux_reg_driver = {
- .probe = i2c_mux_reg_probe,
-- .remove = i2c_mux_reg_remove,
-+ .remove_new = i2c_mux_reg_remove,
- .driver = {
- .name = "i2c-mux-reg",
- .of_match_table = of_match_ptr(i2c_mux_reg_of_match),
---
-2.39.2
-
+++ /dev/null
-From 2faeb111e6b39e0a477ee6537a8c8b8e8b3b68cb Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Fri, 26 May 2023 15:05:33 +0800
-Subject: i2c: ocores: use devm_ managed clks
-
-From: Wang Zhang <silver_code@hust.edu.cn>
-
-[ Upstream commit 9e1a1ee93f6b08aad5ee645073f7c7b115f71e15 ]
-
-Smatch complains that:
-drivers/i2c/busses/i2c-ocores.c:704 ocores_i2c_probe()
-warn: missing unwind goto?
-
-If any wrong occurs in ocores_i2c_of_probe, the i2c->clk needs to be
-released. But the function returns directly without freeing the clock.
-
-Fix this by updating the code to use devm_clk_get_optional_enabled()
-instead. Use dev_err_probe() where appropriate as well since we are
-changing those statements.
-
-Fixes: f5f35a92e44a ("i2c: ocores: Add irq support for sparc")
-Signed-off-by: Wang Zhang <silver_code@hust.edu.cn>
-Reviewed-by: Andi Shyti <andi.shyti@kernel.org>
-Reviewed-by: Andrew Lunn <andrew@lunn.ch>
-Signed-off-by: Wolfram Sang <wsa@kernel.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/i2c/busses/i2c-ocores.c | 64 +++++++++++----------------------
- 1 file changed, 21 insertions(+), 43 deletions(-)
-
-diff --git a/drivers/i2c/busses/i2c-ocores.c b/drivers/i2c/busses/i2c-ocores.c
-index 0742b84a11eb5..4ac77e57bbbfe 100644
---- a/drivers/i2c/busses/i2c-ocores.c
-+++ b/drivers/i2c/busses/i2c-ocores.c
-@@ -552,28 +552,20 @@ static int ocores_i2c_of_probe(struct platform_device *pdev,
- &clock_frequency);
- i2c->bus_clock_khz = 100;
-
-- i2c->clk = devm_clk_get(&pdev->dev, NULL);
--
-- if (!IS_ERR(i2c->clk)) {
-- int ret = clk_prepare_enable(i2c->clk);
--
-- if (ret) {
-- dev_err(&pdev->dev,
-- "clk_prepare_enable failed: %d\n", ret);
-- return ret;
-- }
-- i2c->ip_clock_khz = clk_get_rate(i2c->clk) / 1000;
-- if (clock_frequency_present)
-- i2c->bus_clock_khz = clock_frequency / 1000;
-- }
--
-+ i2c->clk = devm_clk_get_optional_enabled(&pdev->dev, NULL);
-+ if (IS_ERR(i2c->clk))
-+ return dev_err_probe(&pdev->dev, PTR_ERR(i2c->clk),
-+ "devm_clk_get_optional_enabled failed\n");
-+
-+ i2c->ip_clock_khz = clk_get_rate(i2c->clk) / 1000;
-+ if (clock_frequency_present)
-+ i2c->bus_clock_khz = clock_frequency / 1000;
- if (i2c->ip_clock_khz == 0) {
- if (of_property_read_u32(np, "opencores,ip-clock-frequency",
- &val)) {
- if (!clock_frequency_present) {
- dev_err(&pdev->dev,
- "Missing required parameter 'opencores,ip-clock-frequency'\n");
-- clk_disable_unprepare(i2c->clk);
- return -ENODEV;
- }
- i2c->ip_clock_khz = clock_frequency / 1000;
-@@ -678,8 +670,7 @@ static int ocores_i2c_probe(struct platform_device *pdev)
- default:
- dev_err(&pdev->dev, "Unsupported I/O width (%d)\n",
- i2c->reg_io_width);
-- ret = -EINVAL;
-- goto err_clk;
-+ return -EINVAL;
- }
- }
-
-@@ -710,13 +701,13 @@ static int ocores_i2c_probe(struct platform_device *pdev)
- pdev->name, i2c);
- if (ret) {
- dev_err(&pdev->dev, "Cannot claim IRQ\n");
-- goto err_clk;
-+ return ret;
- }
- }
-
- ret = ocores_init(&pdev->dev, i2c);
- if (ret)
-- goto err_clk;
-+ return ret;
-
- /* hook up driver to tree */
- platform_set_drvdata(pdev, i2c);
-@@ -728,7 +719,7 @@ static int ocores_i2c_probe(struct platform_device *pdev)
- /* add i2c adapter to i2c tree */
- ret = i2c_add_adapter(&i2c->adap);
- if (ret)
-- goto err_clk;
-+ return ret;
-
- /* add in known devices to the bus */
- if (pdata) {
-@@ -737,10 +728,6 @@ static int ocores_i2c_probe(struct platform_device *pdev)
- }
-
- return 0;
--
--err_clk:
-- clk_disable_unprepare(i2c->clk);
-- return ret;
- }
-
- static void ocores_i2c_remove(struct platform_device *pdev)
-@@ -754,9 +741,6 @@ static void ocores_i2c_remove(struct platform_device *pdev)
-
- /* remove adapter & data */
- i2c_del_adapter(&i2c->adap);
--
-- if (!IS_ERR(i2c->clk))
-- clk_disable_unprepare(i2c->clk);
- }
-
- #ifdef CONFIG_PM_SLEEP
-@@ -769,28 +753,22 @@ static int ocores_i2c_suspend(struct device *dev)
- ctrl &= ~(OCI2C_CTRL_EN | OCI2C_CTRL_IEN);
- oc_setreg(i2c, OCI2C_CONTROL, ctrl);
-
-- if (!IS_ERR(i2c->clk))
-- clk_disable_unprepare(i2c->clk);
-+ clk_disable_unprepare(i2c->clk);
- return 0;
- }
-
- static int ocores_i2c_resume(struct device *dev)
- {
- struct ocores_i2c *i2c = dev_get_drvdata(dev);
-+ unsigned long rate;
-+ int ret;
-
-- if (!IS_ERR(i2c->clk)) {
-- unsigned long rate;
-- int ret = clk_prepare_enable(i2c->clk);
--
-- if (ret) {
-- dev_err(dev,
-- "clk_prepare_enable failed: %d\n", ret);
-- return ret;
-- }
-- rate = clk_get_rate(i2c->clk) / 1000;
-- if (rate)
-- i2c->ip_clock_khz = rate;
-- }
-+ ret = clk_prepare_enable(i2c->clk);
-+ if (ret)
-+ return dev_err_probe(dev, ret, "clk_prepare_enable failed\n");
-+ rate = clk_get_rate(i2c->clk) / 1000;
-+ if (rate)
-+ i2c->ip_clock_khz = rate;
- return ocores_init(dev, i2c);
- }
-
---
-2.39.2
-
+++ /dev/null
-From 6155933f8f46712f12e9c630e6cc667961d14225 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Thu, 6 Apr 2023 10:23:54 +0200
-Subject: i2c: omap: Improve error reporting for problems during .remove()
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-From: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
-
-[ Upstream commit 9496fffcb28f39e0352779a0199b6e61861c9221 ]
-
-If pm_runtime_get() fails in .remove() the driver used to return the
-error to the driver core. The only effect of this (compared to returning
-zero) is a generic warning that the error value is ignored.
-
-So emit a better warning and return zero to suppress the generic (and
-little helpful) message. Also disable runtime PM in the error case.
-
-This prepares changing platform device remove callbacks to return void.
-
-Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
-Reviewed-by: Tony Lindgren <tony@atomide.com>
-Signed-off-by: Wolfram Sang <wsa@kernel.org>
-Stable-dep-of: 9e1a1ee93f6b ("i2c: ocores: use devm_ managed clks")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/i2c/busses/i2c-omap.c | 9 ++++++---
- 1 file changed, 6 insertions(+), 3 deletions(-)
-
-diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
-index 7ec2521997061..4199f57a6bf29 100644
---- a/drivers/i2c/busses/i2c-omap.c
-+++ b/drivers/i2c/busses/i2c-omap.c
-@@ -1525,14 +1525,17 @@ static int omap_i2c_remove(struct platform_device *pdev)
- int ret;
-
- i2c_del_adapter(&omap->adapter);
-- ret = pm_runtime_resume_and_get(&pdev->dev);
-+
-+ ret = pm_runtime_get_sync(&pdev->dev);
- if (ret < 0)
-- return ret;
-+ dev_err(omap->dev, "Failed to resume hardware, skip disable\n");
-+ else
-+ omap_i2c_write_reg(omap, OMAP_I2C_CON_REG, 0);
-
-- omap_i2c_write_reg(omap, OMAP_I2C_CON_REG, 0);
- pm_runtime_dont_use_autosuspend(&pdev->dev);
- pm_runtime_put_sync(&pdev->dev);
- pm_runtime_disable(&pdev->dev);
-+
- return 0;
- }
-
---
-2.39.2
-
+++ /dev/null
-From 918f61737370c61c927e8d724b1bf25fedac8259 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Mon, 19 Jun 2023 20:34:02 +0530
-Subject: PCI: qcom: Disable write access to read only registers for IP v2.9.0
-
-From: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
-
-[ Upstream commit 200b8f85f2021362adcc8efb575652a2aa44c099 ]
-
-In the post init sequence of v2.9.0, write access to read only registers
-are not disabled after updating the registers. Fix it by disabling the
-access after register update.
-
-While at it, let's also add a newline after existing dw_pcie_dbi_ro_wr_en()
-guard function to align with rest of the driver.
-
-Link: https://lore.kernel.org/r/20230619150408.8468-4-manivannan.sadhasivam@linaro.org
-Fixes: 0cf7c2efe8ac ("PCI: qcom: Add IPQ60xx support")
-Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
-Signed-off-by: Lorenzo Pieralisi <lpieralisi@kernel.org>
-Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/pci/controller/dwc/pcie-qcom.c | 3 +++
- 1 file changed, 3 insertions(+)
-
-diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c
-index dcad29c860525..70e75f6eb3ece 100644
---- a/drivers/pci/controller/dwc/pcie-qcom.c
-+++ b/drivers/pci/controller/dwc/pcie-qcom.c
-@@ -1406,6 +1406,7 @@ static int qcom_pcie_post_init_2_9_0(struct qcom_pcie *pcie)
- writel(0, pcie->parf + PARF_Q2A_FLUSH);
-
- dw_pcie_dbi_ro_wr_en(pci);
-+
- writel(PCIE_CAP_SLOT_VAL, pci->dbi_base + offset + PCI_EXP_SLTCAP);
-
- val = readl(pci->dbi_base + offset + PCI_EXP_LNKCAP);
-@@ -1415,6 +1416,8 @@ static int qcom_pcie_post_init_2_9_0(struct qcom_pcie *pcie)
- writel(PCI_EXP_DEVCTL2_COMP_TMOUT_DIS, pci->dbi_base + offset +
- PCI_EXP_DEVCTL2);
-
-+ dw_pcie_dbi_ro_wr_dis(pci);
-+
- for (i = 0; i < 256; i++)
- writel(0, pcie->parf + PARF_BDF_TO_SID_TABLE_N + (4 * i));
-
---
-2.39.2
-
+++ /dev/null
-From a8a83829f40b590383967a77fc80bf49682982d5 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Thu, 16 Mar 2023 13:41:00 +0530
-Subject: PCI: qcom: Remove PCIE20_ prefix from register definitions
-
-From: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
-
-[ Upstream commit 39171b33f6523f28c1c1256427e5f50c74b69639 ]
-
-The PCIE part is redundant and 20 doesn't represent anything across the
-SoCs supported now. So let's get rid of the prefix.
-
-This involves adding the IP version suffix to one definition of
-PARF_SLV_ADDR_SPACE_SIZE that defines offset specific to that version.
-The other definition is generic for the rest of the versions.
-
-Also, the register PCIE20_LNK_CONTROL2_LINK_STATUS2 is not used anywhere,
-hence removed.
-
-Link: https://lore.kernel.org/r/20230316081117.14288-3-manivannan.sadhasivam@linaro.org
-Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
-Signed-off-by: Lorenzo Pieralisi <lpieralisi@kernel.org>
-Stable-dep-of: 60f0072d7fb7 ("PCI: qcom: Use DWC helpers for modifying the read-only DBI registers")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/pci/controller/dwc/pcie-qcom.c | 184 ++++++++++++-------------
- 1 file changed, 91 insertions(+), 93 deletions(-)
-
-diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c
-index 89d748cc4b8a3..5855ad8e9c1cf 100644
---- a/drivers/pci/controller/dwc/pcie-qcom.c
-+++ b/drivers/pci/controller/dwc/pcie-qcom.c
-@@ -33,7 +33,7 @@
- #include "../../pci.h"
- #include "pcie-designware.h"
-
--#define PCIE20_PARF_SYS_CTRL 0x00
-+#define PARF_SYS_CTRL 0x00
- #define MST_WAKEUP_EN BIT(13)
- #define SLV_WAKEUP_EN BIT(12)
- #define MSTR_ACLK_CGC_DIS BIT(10)
-@@ -43,39 +43,39 @@
- #define L23_CLK_RMV_DIS BIT(2)
- #define L1_CLK_RMV_DIS BIT(1)
-
--#define PCIE20_PARF_PM_CTRL 0x20
-+#define PARF_PM_CTRL 0x20
- #define REQ_NOT_ENTR_L1 BIT(5)
-
--#define PCIE20_PARF_PHY_CTRL 0x40
-+#define PARF_PHY_CTRL 0x40
- #define PHY_CTRL_PHY_TX0_TERM_OFFSET_MASK GENMASK(20, 16)
- #define PHY_CTRL_PHY_TX0_TERM_OFFSET(x) ((x) << 16)
-
--#define PCIE20_PARF_PHY_REFCLK 0x4C
-+#define PARF_PHY_REFCLK 0x4C
- #define PHY_REFCLK_SSP_EN BIT(16)
- #define PHY_REFCLK_USE_PAD BIT(12)
-
--#define PCIE20_PARF_DBI_BASE_ADDR 0x168
--#define PCIE20_PARF_SLV_ADDR_SPACE_SIZE 0x16C
--#define PCIE20_PARF_MHI_CLOCK_RESET_CTRL 0x174
-+#define PARF_DBI_BASE_ADDR 0x168
-+#define PARF_SLV_ADDR_SPACE_SIZE_2_3_3 0x16C /* Register offset specific to IP rev 2.3.3 */
-+#define PARF_MHI_CLOCK_RESET_CTRL 0x174
- #define AHB_CLK_EN BIT(0)
- #define MSTR_AXI_CLK_EN BIT(1)
- #define BYPASS BIT(4)
-
--#define PCIE20_PARF_AXI_MSTR_WR_ADDR_HALT 0x178
--#define PCIE20_PARF_AXI_MSTR_WR_ADDR_HALT_V2 0x1A8
--#define PCIE20_PARF_LTSSM 0x1B0
--#define PCIE20_PARF_SID_OFFSET 0x234
--#define PCIE20_PARF_BDF_TRANSLATE_CFG 0x24C
--#define PCIE20_PARF_DEVICE_TYPE 0x1000
--#define PCIE20_PARF_BDF_TO_SID_TABLE_N 0x2000
-+#define PARF_AXI_MSTR_WR_ADDR_HALT 0x178
-+#define PARF_AXI_MSTR_WR_ADDR_HALT_V2 0x1A8
-+#define PARF_LTSSM 0x1B0
-+#define PARF_SID_OFFSET 0x234
-+#define PARF_BDF_TRANSLATE_CFG 0x24C
-+#define PARF_DEVICE_TYPE 0x1000
-+#define PARF_BDF_TO_SID_TABLE_N 0x2000
-
--#define PCIE20_ELBI_SYS_CTRL 0x04
--#define PCIE20_ELBI_SYS_CTRL_LT_ENABLE BIT(0)
-+#define ELBI_SYS_CTRL 0x04
-+#define ELBI_SYS_CTRL_LT_ENABLE BIT(0)
-
--#define PCIE20_AXI_MSTR_RESP_COMP_CTRL0 0x818
-+#define AXI_MSTR_RESP_COMP_CTRL0 0x818
- #define CFG_REMOTE_RD_REQ_BRIDGE_SIZE_2K 0x4
- #define CFG_REMOTE_RD_REQ_BRIDGE_SIZE_4K 0x5
--#define PCIE20_AXI_MSTR_RESP_COMP_CTRL1 0x81c
-+#define AXI_MSTR_RESP_COMP_CTRL1 0x81c
- #define CFG_BRIDGE_SB_INIT BIT(0)
-
- #define PCIE_CAP_SLOT_POWER_LIMIT_VAL FIELD_PREP(PCI_EXP_SLTCAP_SPLV, \
-@@ -93,30 +93,28 @@
- PCIE_CAP_SLOT_POWER_LIMIT_VAL | \
- PCIE_CAP_SLOT_POWER_LIMIT_SCALE)
-
--#define PCIE20_PARF_Q2A_FLUSH 0x1AC
-+#define PARF_Q2A_FLUSH 0x1AC
-
--#define PCIE20_MISC_CONTROL_1_REG 0x8BC
-+#define MISC_CONTROL_1_REG 0x8BC
- #define DBI_RO_WR_EN 1
-
- #define PERST_DELAY_US 1000
- /* PARF registers */
--#define PCIE20_PARF_PCS_DEEMPH 0x34
-+#define PARF_PCS_DEEMPH 0x34
- #define PCS_DEEMPH_TX_DEEMPH_GEN1(x) ((x) << 16)
- #define PCS_DEEMPH_TX_DEEMPH_GEN2_3_5DB(x) ((x) << 8)
- #define PCS_DEEMPH_TX_DEEMPH_GEN2_6DB(x) ((x) << 0)
-
--#define PCIE20_PARF_PCS_SWING 0x38
-+#define PARF_PCS_SWING 0x38
- #define PCS_SWING_TX_SWING_FULL(x) ((x) << 8)
- #define PCS_SWING_TX_SWING_LOW(x) ((x) << 0)
-
--#define PCIE20_PARF_CONFIG_BITS 0x50
-+#define PARF_CONFIG_BITS 0x50
- #define PHY_RX0_EQ(x) ((x) << 24)
-
--#define PCIE20_v3_PARF_SLV_ADDR_SPACE_SIZE 0x358
-+#define PARF_SLV_ADDR_SPACE_SIZE 0x358
- #define SLV_ADDR_SPACE_SZ 0x10000000
-
--#define PCIE20_LNK_CONTROL2_LINK_STATUS2 0xa0
--
- #define DEVICE_TYPE_RC 0x4
-
- #define QCOM_PCIE_2_1_0_MAX_SUPPLY 3
-@@ -261,9 +259,9 @@ static void qcom_pcie_2_1_0_ltssm_enable(struct qcom_pcie *pcie)
- u32 val;
-
- /* enable link training */
-- val = readl(pcie->elbi + PCIE20_ELBI_SYS_CTRL);
-- val |= PCIE20_ELBI_SYS_CTRL_LT_ENABLE;
-- writel(val, pcie->elbi + PCIE20_ELBI_SYS_CTRL);
-+ val = readl(pcie->elbi + ELBI_SYS_CTRL);
-+ val |= ELBI_SYS_CTRL_LT_ENABLE;
-+ writel(val, pcie->elbi + ELBI_SYS_CTRL);
- }
-
- static int qcom_pcie_get_resources_2_1_0(struct qcom_pcie *pcie)
-@@ -333,7 +331,7 @@ static void qcom_pcie_deinit_2_1_0(struct qcom_pcie *pcie)
- reset_control_assert(res->ext_reset);
- reset_control_assert(res->phy_reset);
-
-- writel(1, pcie->parf + PCIE20_PARF_PHY_CTRL);
-+ writel(1, pcie->parf + PARF_PHY_CTRL);
-
- regulator_bulk_disable(ARRAY_SIZE(res->supplies), res->supplies);
- }
-@@ -423,9 +421,9 @@ static int qcom_pcie_post_init_2_1_0(struct qcom_pcie *pcie)
- int ret;
-
- /* enable PCIe clocks and resets */
-- val = readl(pcie->parf + PCIE20_PARF_PHY_CTRL);
-+ val = readl(pcie->parf + PARF_PHY_CTRL);
- val &= ~BIT(0);
-- writel(val, pcie->parf + PCIE20_PARF_PHY_CTRL);
-+ writel(val, pcie->parf + PARF_PHY_CTRL);
-
- ret = clk_bulk_prepare_enable(ARRAY_SIZE(res->clks), res->clks);
- if (ret)
-@@ -436,37 +434,37 @@ static int qcom_pcie_post_init_2_1_0(struct qcom_pcie *pcie)
- writel(PCS_DEEMPH_TX_DEEMPH_GEN1(24) |
- PCS_DEEMPH_TX_DEEMPH_GEN2_3_5DB(24) |
- PCS_DEEMPH_TX_DEEMPH_GEN2_6DB(34),
-- pcie->parf + PCIE20_PARF_PCS_DEEMPH);
-+ pcie->parf + PARF_PCS_DEEMPH);
- writel(PCS_SWING_TX_SWING_FULL(120) |
- PCS_SWING_TX_SWING_LOW(120),
-- pcie->parf + PCIE20_PARF_PCS_SWING);
-- writel(PHY_RX0_EQ(4), pcie->parf + PCIE20_PARF_CONFIG_BITS);
-+ pcie->parf + PARF_PCS_SWING);
-+ writel(PHY_RX0_EQ(4), pcie->parf + PARF_CONFIG_BITS);
- }
-
- if (of_device_is_compatible(node, "qcom,pcie-ipq8064")) {
- /* set TX termination offset */
-- val = readl(pcie->parf + PCIE20_PARF_PHY_CTRL);
-+ val = readl(pcie->parf + PARF_PHY_CTRL);
- val &= ~PHY_CTRL_PHY_TX0_TERM_OFFSET_MASK;
- val |= PHY_CTRL_PHY_TX0_TERM_OFFSET(7);
-- writel(val, pcie->parf + PCIE20_PARF_PHY_CTRL);
-+ writel(val, pcie->parf + PARF_PHY_CTRL);
- }
-
- /* enable external reference clock */
-- val = readl(pcie->parf + PCIE20_PARF_PHY_REFCLK);
-+ val = readl(pcie->parf + PARF_PHY_REFCLK);
- /* USE_PAD is required only for ipq806x */
- if (!of_device_is_compatible(node, "qcom,pcie-apq8064"))
- val &= ~PHY_REFCLK_USE_PAD;
- val |= PHY_REFCLK_SSP_EN;
-- writel(val, pcie->parf + PCIE20_PARF_PHY_REFCLK);
-+ writel(val, pcie->parf + PARF_PHY_REFCLK);
-
- /* wait for clock acquisition */
- usleep_range(1000, 1500);
-
- /* Set the Max TLP size to 2K, instead of using default of 4K */
- writel(CFG_REMOTE_RD_REQ_BRIDGE_SIZE_2K,
-- pci->dbi_base + PCIE20_AXI_MSTR_RESP_COMP_CTRL0);
-+ pci->dbi_base + AXI_MSTR_RESP_COMP_CTRL0);
- writel(CFG_BRIDGE_SB_INIT,
-- pci->dbi_base + PCIE20_AXI_MSTR_RESP_COMP_CTRL1);
-+ pci->dbi_base + AXI_MSTR_RESP_COMP_CTRL1);
-
- return 0;
- }
-@@ -574,13 +572,13 @@ static int qcom_pcie_init_1_0_0(struct qcom_pcie *pcie)
- static int qcom_pcie_post_init_1_0_0(struct qcom_pcie *pcie)
- {
- /* change DBI base address */
-- writel(0, pcie->parf + PCIE20_PARF_DBI_BASE_ADDR);
-+ writel(0, pcie->parf + PARF_DBI_BASE_ADDR);
-
- if (IS_ENABLED(CONFIG_PCI_MSI)) {
-- u32 val = readl(pcie->parf + PCIE20_PARF_AXI_MSTR_WR_ADDR_HALT);
-+ u32 val = readl(pcie->parf + PARF_AXI_MSTR_WR_ADDR_HALT);
-
- val |= BIT(31);
-- writel(val, pcie->parf + PCIE20_PARF_AXI_MSTR_WR_ADDR_HALT);
-+ writel(val, pcie->parf + PARF_AXI_MSTR_WR_ADDR_HALT);
- }
-
- return 0;
-@@ -591,9 +589,9 @@ static void qcom_pcie_2_3_2_ltssm_enable(struct qcom_pcie *pcie)
- u32 val;
-
- /* enable link training */
-- val = readl(pcie->parf + PCIE20_PARF_LTSSM);
-+ val = readl(pcie->parf + PARF_LTSSM);
- val |= BIT(8);
-- writel(val, pcie->parf + PCIE20_PARF_LTSSM);
-+ writel(val, pcie->parf + PARF_LTSSM);
- }
-
- static int qcom_pcie_get_resources_2_3_2(struct qcom_pcie *pcie)
-@@ -698,25 +696,25 @@ static int qcom_pcie_post_init_2_3_2(struct qcom_pcie *pcie)
- u32 val;
-
- /* enable PCIe clocks and resets */
-- val = readl(pcie->parf + PCIE20_PARF_PHY_CTRL);
-+ val = readl(pcie->parf + PARF_PHY_CTRL);
- val &= ~BIT(0);
-- writel(val, pcie->parf + PCIE20_PARF_PHY_CTRL);
-+ writel(val, pcie->parf + PARF_PHY_CTRL);
-
- /* change DBI base address */
-- writel(0, pcie->parf + PCIE20_PARF_DBI_BASE_ADDR);
-+ writel(0, pcie->parf + PARF_DBI_BASE_ADDR);
-
- /* MAC PHY_POWERDOWN MUX DISABLE */
-- val = readl(pcie->parf + PCIE20_PARF_SYS_CTRL);
-+ val = readl(pcie->parf + PARF_SYS_CTRL);
- val &= ~BIT(29);
-- writel(val, pcie->parf + PCIE20_PARF_SYS_CTRL);
-+ writel(val, pcie->parf + PARF_SYS_CTRL);
-
-- val = readl(pcie->parf + PCIE20_PARF_MHI_CLOCK_RESET_CTRL);
-+ val = readl(pcie->parf + PARF_MHI_CLOCK_RESET_CTRL);
- val |= BIT(4);
-- writel(val, pcie->parf + PCIE20_PARF_MHI_CLOCK_RESET_CTRL);
-+ writel(val, pcie->parf + PARF_MHI_CLOCK_RESET_CTRL);
-
-- val = readl(pcie->parf + PCIE20_PARF_AXI_MSTR_WR_ADDR_HALT_V2);
-+ val = readl(pcie->parf + PARF_AXI_MSTR_WR_ADDR_HALT_V2);
- val |= BIT(31);
-- writel(val, pcie->parf + PCIE20_PARF_AXI_MSTR_WR_ADDR_HALT_V2);
-+ writel(val, pcie->parf + PARF_AXI_MSTR_WR_ADDR_HALT_V2);
-
- return 0;
- }
-@@ -977,25 +975,25 @@ static int qcom_pcie_post_init_2_4_0(struct qcom_pcie *pcie)
- u32 val;
-
- /* enable PCIe clocks and resets */
-- val = readl(pcie->parf + PCIE20_PARF_PHY_CTRL);
-+ val = readl(pcie->parf + PARF_PHY_CTRL);
- val &= ~BIT(0);
-- writel(val, pcie->parf + PCIE20_PARF_PHY_CTRL);
-+ writel(val, pcie->parf + PARF_PHY_CTRL);
-
- /* change DBI base address */
-- writel(0, pcie->parf + PCIE20_PARF_DBI_BASE_ADDR);
-+ writel(0, pcie->parf + PARF_DBI_BASE_ADDR);
-
- /* MAC PHY_POWERDOWN MUX DISABLE */
-- val = readl(pcie->parf + PCIE20_PARF_SYS_CTRL);
-+ val = readl(pcie->parf + PARF_SYS_CTRL);
- val &= ~BIT(29);
-- writel(val, pcie->parf + PCIE20_PARF_SYS_CTRL);
-+ writel(val, pcie->parf + PARF_SYS_CTRL);
-
-- val = readl(pcie->parf + PCIE20_PARF_MHI_CLOCK_RESET_CTRL);
-+ val = readl(pcie->parf + PARF_MHI_CLOCK_RESET_CTRL);
- val |= BIT(4);
-- writel(val, pcie->parf + PCIE20_PARF_MHI_CLOCK_RESET_CTRL);
-+ writel(val, pcie->parf + PARF_MHI_CLOCK_RESET_CTRL);
-
-- val = readl(pcie->parf + PCIE20_PARF_AXI_MSTR_WR_ADDR_HALT_V2);
-+ val = readl(pcie->parf + PARF_AXI_MSTR_WR_ADDR_HALT_V2);
- val |= BIT(31);
-- writel(val, pcie->parf + PCIE20_PARF_AXI_MSTR_WR_ADDR_HALT_V2);
-+ writel(val, pcie->parf + PARF_AXI_MSTR_WR_ADDR_HALT_V2);
-
- return 0;
- }
-@@ -1140,22 +1138,22 @@ static int qcom_pcie_post_init_2_3_3(struct qcom_pcie *pcie)
- u32 val;
-
- writel(SLV_ADDR_SPACE_SZ,
-- pcie->parf + PCIE20_v3_PARF_SLV_ADDR_SPACE_SIZE);
-+ pcie->parf + PARF_SLV_ADDR_SPACE_SIZE_2_3_3);
-
-- val = readl(pcie->parf + PCIE20_PARF_PHY_CTRL);
-+ val = readl(pcie->parf + PARF_PHY_CTRL);
- val &= ~BIT(0);
-- writel(val, pcie->parf + PCIE20_PARF_PHY_CTRL);
-+ writel(val, pcie->parf + PARF_PHY_CTRL);
-
-- writel(0, pcie->parf + PCIE20_PARF_DBI_BASE_ADDR);
-+ writel(0, pcie->parf + PARF_DBI_BASE_ADDR);
-
- writel(MST_WAKEUP_EN | SLV_WAKEUP_EN | MSTR_ACLK_CGC_DIS
- | SLV_ACLK_CGC_DIS | CORE_CLK_CGC_DIS |
- AUX_PWR_DET | L23_CLK_RMV_DIS | L1_CLK_RMV_DIS,
-- pcie->parf + PCIE20_PARF_SYS_CTRL);
-- writel(0, pcie->parf + PCIE20_PARF_Q2A_FLUSH);
-+ pcie->parf + PARF_SYS_CTRL);
-+ writel(0, pcie->parf + PARF_Q2A_FLUSH);
-
- writel(PCI_COMMAND_MASTER, pci->dbi_base + PCI_COMMAND);
-- writel(DBI_RO_WR_EN, pci->dbi_base + PCIE20_MISC_CONTROL_1_REG);
-+ writel(DBI_RO_WR_EN, pci->dbi_base + MISC_CONTROL_1_REG);
- writel(PCIE_CAP_SLOT_VAL, pci->dbi_base + offset + PCI_EXP_SLTCAP);
-
- val = readl(pci->dbi_base + offset + PCI_EXP_LNKCAP);
-@@ -1255,33 +1253,33 @@ static int qcom_pcie_init_2_7_0(struct qcom_pcie *pcie)
- usleep_range(1000, 1500);
-
- /* configure PCIe to RC mode */
-- writel(DEVICE_TYPE_RC, pcie->parf + PCIE20_PARF_DEVICE_TYPE);
-+ writel(DEVICE_TYPE_RC, pcie->parf + PARF_DEVICE_TYPE);
-
- /* enable PCIe clocks and resets */
-- val = readl(pcie->parf + PCIE20_PARF_PHY_CTRL);
-+ val = readl(pcie->parf + PARF_PHY_CTRL);
- val &= ~BIT(0);
-- writel(val, pcie->parf + PCIE20_PARF_PHY_CTRL);
-+ writel(val, pcie->parf + PARF_PHY_CTRL);
-
- /* change DBI base address */
-- writel(0, pcie->parf + PCIE20_PARF_DBI_BASE_ADDR);
-+ writel(0, pcie->parf + PARF_DBI_BASE_ADDR);
-
- /* MAC PHY_POWERDOWN MUX DISABLE */
-- val = readl(pcie->parf + PCIE20_PARF_SYS_CTRL);
-+ val = readl(pcie->parf + PARF_SYS_CTRL);
- val &= ~BIT(29);
-- writel(val, pcie->parf + PCIE20_PARF_SYS_CTRL);
-+ writel(val, pcie->parf + PARF_SYS_CTRL);
-
-- val = readl(pcie->parf + PCIE20_PARF_MHI_CLOCK_RESET_CTRL);
-+ val = readl(pcie->parf + PARF_MHI_CLOCK_RESET_CTRL);
- val |= BIT(4);
-- writel(val, pcie->parf + PCIE20_PARF_MHI_CLOCK_RESET_CTRL);
-+ writel(val, pcie->parf + PARF_MHI_CLOCK_RESET_CTRL);
-
- /* Enable L1 and L1SS */
-- val = readl(pcie->parf + PCIE20_PARF_PM_CTRL);
-+ val = readl(pcie->parf + PARF_PM_CTRL);
- val &= ~REQ_NOT_ENTR_L1;
-- writel(val, pcie->parf + PCIE20_PARF_PM_CTRL);
-+ writel(val, pcie->parf + PARF_PM_CTRL);
-
-- val = readl(pcie->parf + PCIE20_PARF_AXI_MSTR_WR_ADDR_HALT_V2);
-+ val = readl(pcie->parf + PARF_AXI_MSTR_WR_ADDR_HALT_V2);
- val |= BIT(31);
-- writel(val, pcie->parf + PCIE20_PARF_AXI_MSTR_WR_ADDR_HALT_V2);
-+ writel(val, pcie->parf + PARF_AXI_MSTR_WR_ADDR_HALT_V2);
-
- return 0;
- err_disable_clocks:
-@@ -1369,17 +1367,17 @@ static int qcom_pcie_post_init_2_9_0(struct qcom_pcie *pcie)
- int i;
-
- writel(SLV_ADDR_SPACE_SZ,
-- pcie->parf + PCIE20_v3_PARF_SLV_ADDR_SPACE_SIZE);
-+ pcie->parf + PARF_SLV_ADDR_SPACE_SIZE);
-
-- val = readl(pcie->parf + PCIE20_PARF_PHY_CTRL);
-+ val = readl(pcie->parf + PARF_PHY_CTRL);
- val &= ~BIT(0);
-- writel(val, pcie->parf + PCIE20_PARF_PHY_CTRL);
-+ writel(val, pcie->parf + PARF_PHY_CTRL);
-
-- writel(0, pcie->parf + PCIE20_PARF_DBI_BASE_ADDR);
-+ writel(0, pcie->parf + PARF_DBI_BASE_ADDR);
-
-- writel(DEVICE_TYPE_RC, pcie->parf + PCIE20_PARF_DEVICE_TYPE);
-+ writel(DEVICE_TYPE_RC, pcie->parf + PARF_DEVICE_TYPE);
- writel(BYPASS | MSTR_AXI_CLK_EN | AHB_CLK_EN,
-- pcie->parf + PCIE20_PARF_MHI_CLOCK_RESET_CTRL);
-+ pcie->parf + PARF_MHI_CLOCK_RESET_CTRL);
- writel(GEN3_RELATED_OFF_RXEQ_RGRDLESS_RXTS |
- GEN3_RELATED_OFF_GEN3_ZRXDC_NONCOMPL,
- pci->dbi_base + GEN3_RELATED_OFF);
-@@ -1387,9 +1385,9 @@ static int qcom_pcie_post_init_2_9_0(struct qcom_pcie *pcie)
- writel(MST_WAKEUP_EN | SLV_WAKEUP_EN | MSTR_ACLK_CGC_DIS |
- SLV_ACLK_CGC_DIS | CORE_CLK_CGC_DIS |
- AUX_PWR_DET | L23_CLK_RMV_DIS | L1_CLK_RMV_DIS,
-- pcie->parf + PCIE20_PARF_SYS_CTRL);
-+ pcie->parf + PARF_SYS_CTRL);
-
-- writel(0, pcie->parf + PCIE20_PARF_Q2A_FLUSH);
-+ writel(0, pcie->parf + PARF_Q2A_FLUSH);
-
- dw_pcie_dbi_ro_wr_en(pci);
- writel(PCIE_CAP_SLOT_VAL, pci->dbi_base + offset + PCI_EXP_SLTCAP);
-@@ -1402,7 +1400,7 @@ static int qcom_pcie_post_init_2_9_0(struct qcom_pcie *pcie)
- PCI_EXP_DEVCTL2);
-
- for (i = 0; i < 256; i++)
-- writel(0, pcie->parf + PCIE20_PARF_BDF_TO_SID_TABLE_N + (4 * i));
-+ writel(0, pcie->parf + PARF_BDF_TO_SID_TABLE_N + (4 * i));
-
- return 0;
- }
-@@ -1424,7 +1422,7 @@ static int qcom_pcie_config_sid_sm8250(struct qcom_pcie *pcie)
- u32 smmu_sid;
- u32 smmu_sid_len;
- } *map;
-- void __iomem *bdf_to_sid_base = pcie->parf + PCIE20_PARF_BDF_TO_SID_TABLE_N;
-+ void __iomem *bdf_to_sid_base = pcie->parf + PARF_BDF_TO_SID_TABLE_N;
- struct device *dev = pcie->pci->dev;
- u8 qcom_pcie_crc8_table[CRC8_TABLE_SIZE];
- int i, nr_map, size = 0;
---
-2.39.2
-
+++ /dev/null
-From f9024040572196905055cdc801f55951e6b5d9b7 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Thu, 16 Mar 2023 13:41:01 +0530
-Subject: PCI: qcom: Sort and group registers and bitfield definitions
-
-From: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
-
-[ Upstream commit 769e49d87b15c302c9aadd87c7d114cfe7052320 ]
-
-Sorting the registers and their bit definitions will make it easier to add
-more definitions in the future and it also helps in maintenance.
-
-While at it, let's also group the registers and bit definitions separately
-as done in the pcie-qcom-ep driver.
-
-Link: https://lore.kernel.org/r/20230316081117.14288-4-manivannan.sadhasivam@linaro.org
-Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
-Signed-off-by: Lorenzo Pieralisi <lpieralisi@kernel.org>
-Stable-dep-of: 60f0072d7fb7 ("PCI: qcom: Use DWC helpers for modifying the read-only DBI registers")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/pci/controller/dwc/pcie-qcom.c | 108 ++++++++++++++-----------
- 1 file changed, 63 insertions(+), 45 deletions(-)
-
-diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c
-index 5855ad8e9c1cf..a33653d576b62 100644
---- a/drivers/pci/controller/dwc/pcie-qcom.c
-+++ b/drivers/pci/controller/dwc/pcie-qcom.c
-@@ -33,7 +33,36 @@
- #include "../../pci.h"
- #include "pcie-designware.h"
-
-+/* PARF registers */
- #define PARF_SYS_CTRL 0x00
-+#define PARF_PM_CTRL 0x20
-+#define PARF_PCS_DEEMPH 0x34
-+#define PARF_PCS_SWING 0x38
-+#define PARF_PHY_CTRL 0x40
-+#define PARF_PHY_REFCLK 0x4C
-+#define PARF_CONFIG_BITS 0x50
-+#define PARF_DBI_BASE_ADDR 0x168
-+#define PARF_SLV_ADDR_SPACE_SIZE_2_3_3 0x16C /* Register offset specific to IP ver 2.3.3 */
-+#define PARF_MHI_CLOCK_RESET_CTRL 0x174
-+#define PARF_AXI_MSTR_WR_ADDR_HALT 0x178
-+#define PARF_AXI_MSTR_WR_ADDR_HALT_V2 0x1A8
-+#define PARF_Q2A_FLUSH 0x1AC
-+#define PARF_LTSSM 0x1B0
-+#define PARF_SID_OFFSET 0x234
-+#define PARF_BDF_TRANSLATE_CFG 0x24C
-+#define PARF_SLV_ADDR_SPACE_SIZE 0x358
-+#define PARF_DEVICE_TYPE 0x1000
-+#define PARF_BDF_TO_SID_TABLE_N 0x2000
-+
-+/* ELBI registers */
-+#define ELBI_SYS_CTRL 0x04
-+
-+/* DBI registers */
-+#define AXI_MSTR_RESP_COMP_CTRL0 0x818
-+#define AXI_MSTR_RESP_COMP_CTRL1 0x81c
-+#define MISC_CONTROL_1_REG 0x8BC
-+
-+/* PARF_SYS_CTRL register fields */
- #define MST_WAKEUP_EN BIT(13)
- #define SLV_WAKEUP_EN BIT(12)
- #define MSTR_ACLK_CGC_DIS BIT(10)
-@@ -43,45 +72,56 @@
- #define L23_CLK_RMV_DIS BIT(2)
- #define L1_CLK_RMV_DIS BIT(1)
-
--#define PARF_PM_CTRL 0x20
-+/* PARF_PM_CTRL register fields */
- #define REQ_NOT_ENTR_L1 BIT(5)
-
--#define PARF_PHY_CTRL 0x40
-+/* PARF_PCS_DEEMPH register fields */
-+#define PCS_DEEMPH_TX_DEEMPH_GEN1(x) ((x) << 16)
-+#define PCS_DEEMPH_TX_DEEMPH_GEN2_3_5DB(x) ((x) << 8)
-+#define PCS_DEEMPH_TX_DEEMPH_GEN2_6DB(x) ((x) << 0)
-+
-+/* PARF_PCS_SWING register fields */
-+#define PCS_SWING_TX_SWING_FULL(x) ((x) << 8)
-+#define PCS_SWING_TX_SWING_LOW(x) ((x) << 0)
-+
-+/* PARF_PHY_CTRL register fields */
- #define PHY_CTRL_PHY_TX0_TERM_OFFSET_MASK GENMASK(20, 16)
- #define PHY_CTRL_PHY_TX0_TERM_OFFSET(x) ((x) << 16)
-
--#define PARF_PHY_REFCLK 0x4C
-+/* PARF_PHY_REFCLK register fields */
- #define PHY_REFCLK_SSP_EN BIT(16)
- #define PHY_REFCLK_USE_PAD BIT(12)
-
--#define PARF_DBI_BASE_ADDR 0x168
--#define PARF_SLV_ADDR_SPACE_SIZE_2_3_3 0x16C /* Register offset specific to IP rev 2.3.3 */
--#define PARF_MHI_CLOCK_RESET_CTRL 0x174
-+/* PARF_CONFIG_BITS register fields */
-+#define PHY_RX0_EQ(x) ((x) << 24)
-+
-+/* PARF_SLV_ADDR_SPACE_SIZE register value */
-+#define SLV_ADDR_SPACE_SZ 0x10000000
-+
-+/* PARF_MHI_CLOCK_RESET_CTRL register fields */
- #define AHB_CLK_EN BIT(0)
- #define MSTR_AXI_CLK_EN BIT(1)
- #define BYPASS BIT(4)
-
--#define PARF_AXI_MSTR_WR_ADDR_HALT 0x178
--#define PARF_AXI_MSTR_WR_ADDR_HALT_V2 0x1A8
--#define PARF_LTSSM 0x1B0
--#define PARF_SID_OFFSET 0x234
--#define PARF_BDF_TRANSLATE_CFG 0x24C
--#define PARF_DEVICE_TYPE 0x1000
--#define PARF_BDF_TO_SID_TABLE_N 0x2000
-+/* PARF_DEVICE_TYPE register fields */
-+#define DEVICE_TYPE_RC 0x4
-
--#define ELBI_SYS_CTRL 0x04
-+/* ELBI_SYS_CTRL register fields */
- #define ELBI_SYS_CTRL_LT_ENABLE BIT(0)
-
--#define AXI_MSTR_RESP_COMP_CTRL0 0x818
-+/* AXI_MSTR_RESP_COMP_CTRL0 register fields */
- #define CFG_REMOTE_RD_REQ_BRIDGE_SIZE_2K 0x4
- #define CFG_REMOTE_RD_REQ_BRIDGE_SIZE_4K 0x5
--#define AXI_MSTR_RESP_COMP_CTRL1 0x81c
-+
-+/* AXI_MSTR_RESP_COMP_CTRL1 register fields */
- #define CFG_BRIDGE_SB_INIT BIT(0)
-
--#define PCIE_CAP_SLOT_POWER_LIMIT_VAL FIELD_PREP(PCI_EXP_SLTCAP_SPLV, \
-- 250)
--#define PCIE_CAP_SLOT_POWER_LIMIT_SCALE FIELD_PREP(PCI_EXP_SLTCAP_SPLS, \
-- 1)
-+/* MISC_CONTROL_1_REG register fields */
-+#define DBI_RO_WR_EN 1
-+
-+/* PCI_EXP_SLTCAP register fields */
-+#define PCIE_CAP_SLOT_POWER_LIMIT_VAL FIELD_PREP(PCI_EXP_SLTCAP_SPLV, 250)
-+#define PCIE_CAP_SLOT_POWER_LIMIT_SCALE FIELD_PREP(PCI_EXP_SLTCAP_SPLS, 1)
- #define PCIE_CAP_SLOT_VAL (PCI_EXP_SLTCAP_ABP | \
- PCI_EXP_SLTCAP_PCP | \
- PCI_EXP_SLTCAP_MRLSP | \
-@@ -93,34 +133,12 @@
- PCIE_CAP_SLOT_POWER_LIMIT_VAL | \
- PCIE_CAP_SLOT_POWER_LIMIT_SCALE)
-
--#define PARF_Q2A_FLUSH 0x1AC
--
--#define MISC_CONTROL_1_REG 0x8BC
--#define DBI_RO_WR_EN 1
--
- #define PERST_DELAY_US 1000
--/* PARF registers */
--#define PARF_PCS_DEEMPH 0x34
--#define PCS_DEEMPH_TX_DEEMPH_GEN1(x) ((x) << 16)
--#define PCS_DEEMPH_TX_DEEMPH_GEN2_3_5DB(x) ((x) << 8)
--#define PCS_DEEMPH_TX_DEEMPH_GEN2_6DB(x) ((x) << 0)
--
--#define PARF_PCS_SWING 0x38
--#define PCS_SWING_TX_SWING_FULL(x) ((x) << 8)
--#define PCS_SWING_TX_SWING_LOW(x) ((x) << 0)
--
--#define PARF_CONFIG_BITS 0x50
--#define PHY_RX0_EQ(x) ((x) << 24)
--
--#define PARF_SLV_ADDR_SPACE_SIZE 0x358
--#define SLV_ADDR_SPACE_SZ 0x10000000
--
--#define DEVICE_TYPE_RC 0x4
-
--#define QCOM_PCIE_2_1_0_MAX_SUPPLY 3
--#define QCOM_PCIE_2_1_0_MAX_CLOCKS 5
-+#define QCOM_PCIE_2_1_0_MAX_SUPPLY 3
-+#define QCOM_PCIE_2_1_0_MAX_CLOCKS 5
-
--#define QCOM_PCIE_CRC8_POLYNOMIAL (BIT(2) | BIT(1) | BIT(0))
-+#define QCOM_PCIE_CRC8_POLYNOMIAL (BIT(2) | BIT(1) | BIT(0))
-
- struct qcom_pcie_resources_2_1_0 {
- struct clk_bulk_data clks[QCOM_PCIE_2_1_0_MAX_CLOCKS];
---
-2.39.2
-
+++ /dev/null
-From 3790d7574f10698b8bbdbef04156b74cab70e271 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Mon, 19 Jun 2023 20:34:01 +0530
-Subject: PCI: qcom: Use DWC helpers for modifying the read-only DBI registers
-
-From: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
-
-[ Upstream commit 60f0072d7fb7996b9a524ef0d152e21205473192 ]
-
-DWC core already exposes dw_pcie_dbi_ro_wr_{en/dis} helper APIs for
-enabling and disabling the write access to read only DBI registers. So
-let's use them instead of doing it manually.
-
-Also, the existing code doesn't disable the write access when it's done.
-This is also fixed now.
-
-Link: https://lore.kernel.org/r/20230619150408.8468-3-manivannan.sadhasivam@linaro.org
-Fixes: 5d76117f070d ("PCI: qcom: Add support for IPQ8074 PCIe controller")
-Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
-Signed-off-by: Lorenzo Pieralisi <lpieralisi@kernel.org>
-Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/pci/controller/dwc/pcie-qcom.c | 8 +++-----
- 1 file changed, 3 insertions(+), 5 deletions(-)
-
-diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c
-index e14d1a8d8f5b3..dcad29c860525 100644
---- a/drivers/pci/controller/dwc/pcie-qcom.c
-+++ b/drivers/pci/controller/dwc/pcie-qcom.c
-@@ -60,7 +60,6 @@
- /* DBI registers */
- #define AXI_MSTR_RESP_COMP_CTRL0 0x818
- #define AXI_MSTR_RESP_COMP_CTRL1 0x81c
--#define MISC_CONTROL_1_REG 0x8bc
-
- /* PARF_SYS_CTRL register fields */
- #define MST_WAKEUP_EN BIT(13)
-@@ -116,9 +115,6 @@
- /* AXI_MSTR_RESP_COMP_CTRL1 register fields */
- #define CFG_BRIDGE_SB_INIT BIT(0)
-
--/* MISC_CONTROL_1_REG register fields */
--#define DBI_RO_WR_EN 1
--
- /* PCI_EXP_SLTCAP register fields */
- #define PCIE_CAP_SLOT_POWER_LIMIT_VAL FIELD_PREP(PCI_EXP_SLTCAP_SPLV, 250)
- #define PCIE_CAP_SLOT_POWER_LIMIT_SCALE FIELD_PREP(PCI_EXP_SLTCAP_SPLS, 1)
-@@ -1171,7 +1167,9 @@ static int qcom_pcie_post_init_2_3_3(struct qcom_pcie *pcie)
- writel(0, pcie->parf + PARF_Q2A_FLUSH);
-
- writel(PCI_COMMAND_MASTER, pci->dbi_base + PCI_COMMAND);
-- writel(DBI_RO_WR_EN, pci->dbi_base + MISC_CONTROL_1_REG);
-+
-+ dw_pcie_dbi_ro_wr_en(pci);
-+
- writel(PCIE_CAP_SLOT_VAL, pci->dbi_base + offset + PCI_EXP_SLTCAP);
-
- val = readl(pci->dbi_base + offset + PCI_EXP_LNKCAP);
---
-2.39.2
-
+++ /dev/null
-From 38b3e63c31d7b481cc1f2c4ceb3a6231bbe9c976 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Thu, 16 Mar 2023 13:41:04 +0530
-Subject: PCI: qcom: Use lower case for hex
-
-From: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
-
-[ Upstream commit 94ebd232dbc84dfdfbf0c406137a8b2aa8b37a01 ]
-
-To maintain uniformity, let's use lower case for representing hexadecimal
-numbers.
-
-Link: https://lore.kernel.org/r/20230316081117.14288-7-manivannan.sadhasivam@linaro.org
-Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
-Signed-off-by: Lorenzo Pieralisi <lpieralisi@kernel.org>
-Stable-dep-of: 60f0072d7fb7 ("PCI: qcom: Use DWC helpers for modifying the read-only DBI registers")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/pci/controller/dwc/pcie-qcom.c | 14 +++++++-------
- 1 file changed, 7 insertions(+), 7 deletions(-)
-
-diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c
-index a33653d576b62..e14d1a8d8f5b3 100644
---- a/drivers/pci/controller/dwc/pcie-qcom.c
-+++ b/drivers/pci/controller/dwc/pcie-qcom.c
-@@ -39,17 +39,17 @@
- #define PARF_PCS_DEEMPH 0x34
- #define PARF_PCS_SWING 0x38
- #define PARF_PHY_CTRL 0x40
--#define PARF_PHY_REFCLK 0x4C
-+#define PARF_PHY_REFCLK 0x4c
- #define PARF_CONFIG_BITS 0x50
- #define PARF_DBI_BASE_ADDR 0x168
--#define PARF_SLV_ADDR_SPACE_SIZE_2_3_3 0x16C /* Register offset specific to IP ver 2.3.3 */
-+#define PARF_SLV_ADDR_SPACE_SIZE_2_3_3 0x16c /* Register offset specific to IP ver 2.3.3 */
- #define PARF_MHI_CLOCK_RESET_CTRL 0x174
- #define PARF_AXI_MSTR_WR_ADDR_HALT 0x178
--#define PARF_AXI_MSTR_WR_ADDR_HALT_V2 0x1A8
--#define PARF_Q2A_FLUSH 0x1AC
--#define PARF_LTSSM 0x1B0
-+#define PARF_AXI_MSTR_WR_ADDR_HALT_V2 0x1a8
-+#define PARF_Q2A_FLUSH 0x1ac
-+#define PARF_LTSSM 0x1b0
- #define PARF_SID_OFFSET 0x234
--#define PARF_BDF_TRANSLATE_CFG 0x24C
-+#define PARF_BDF_TRANSLATE_CFG 0x24c
- #define PARF_SLV_ADDR_SPACE_SIZE 0x358
- #define PARF_DEVICE_TYPE 0x1000
- #define PARF_BDF_TO_SID_TABLE_N 0x2000
-@@ -60,7 +60,7 @@
- /* DBI registers */
- #define AXI_MSTR_RESP_COMP_CTRL0 0x818
- #define AXI_MSTR_RESP_COMP_CTRL1 0x81c
--#define MISC_CONTROL_1_REG 0x8BC
-+#define MISC_CONTROL_1_REG 0x8bc
-
- /* PARF_SYS_CTRL register fields */
- #define MST_WAKEUP_EN BIT(13)
---
-2.39.2
-
drm-use-mgr-dev-in-drm_dbg_kms-in-drm_dp_add_payload_part2.patch
fs-pipe-reveal-missing-function-protoypes.patch
block-fix-the-type-of-the-second-bdev_op_is_zoned_wr.patch
-blkcg-drop-unnecessary-rcu-read-un-locks-from-blkg_c.patch
-blkcg-restructure-blkg_conf_prep-and-friends.patch
-block-rq_qos-protect-rq_qos-apis-with-a-new-lock.patch
splice-fix-filemap_splice_read-to-use-the-correct-in.patch
erofs-kill-hooked-chains-to-avoid-loops-on-deduplica.patch
x86-resctrl-only-show-tasks-pid-in-current-pid-names.patch
-fsverity-use-warn_on_once-instead-of-warn_on.patch
-fsverity-use-shash-api-instead-of-ahash-api.patch
-fsverity-don-t-use-bio_first_page_all-in-fsverity_ve.patch
blk-iocost-use-spin_lock_irqsave-in-adjust_inuse_and.patch
x86-sev-fix-calculation-of-end-address-based-on-numb.patch
blk-cgroup-reinit-blkg_iostat_set-after-clearing-in-.patch
scsi-ufs-core-mcq-fix-the-incorrect-ocs-value-for-th.patch
powerpc-powernv-sriov-perform-null-check-on-iov-befo.patch
powerpc-update-ppc_save_regs-to-save-current-r1-in-p.patch
-pci-qcom-remove-pcie20_-prefix-from-register-definit.patch
-pci-qcom-sort-and-group-registers-and-bitfield-defin.patch
-pci-qcom-use-lower-case-for-hex.patch
-pci-qcom-use-dwc-helpers-for-modifying-the-read-only.patch
-pci-qcom-disable-write-access-to-read-only-registers.patch
platform-x86-intel-pmc-update-maps-for-meteor-lake-p.patch
riscv-uprobes-restore-thread.bad_cause.patch
powerpc-book3s64-mm-fix-directmap-stats-in-proc-memi.patch
dax-introduce-alloc_dev_dax_id.patch
dax-kmem-pass-valid-argument-to-memory_group_registe.patch
hwrng-st-keep-clock-enabled-while-hwrng-is-registere.patch
-i2c-omap-improve-error-reporting-for-problems-during.patch
-i2c-convert-to-platform-remove-callback-returning-vo.patch
-i2c-ocores-use-devm_-managed-clks.patch
kbuild-fix-cfi-failures-with-gcov.patch
kbuild-disable-gcov-for-.mod.o.patch
cxl-region-move-cache-invalidation-before-region-tea.patch