mirror of
https://github.com/nxp-imx/linux-imx.git
synced 2025-07-07 18:05:21 +02:00
ANDROID: dm-bow: Fix 5.15 compatibility issue
Patch https://patchwork.kernel.org/project/linux-block/patch/20210804094147.459763-8-hch@lst.de/ delays registering the gendisk, so move creating our sysfs nodes until resume. Test: runs Bug: 210958368 Change-Id: If671893d50434bb39ea37babb0bea05cebae6f54 Signed-off-by: Paul Lawrence <paullawrence@google.com> (cherry picked from commit 88e27b17aab604fb2d486e538b2ef55cd967a430)
This commit is contained in:
parent
221a0b451c
commit
4b5ae75dd7
|
@ -695,7 +695,6 @@ static int dm_bow_ctr(struct dm_target *ti, unsigned int argc, char **argv)
|
|||
struct bow_context *bc;
|
||||
struct bow_range *br;
|
||||
int ret;
|
||||
struct mapped_device *md = dm_table_get_md(ti->table);
|
||||
|
||||
if (argc < 1) {
|
||||
ti->error = "Invalid argument count";
|
||||
|
@ -735,14 +734,6 @@ static int dm_bow_ctr(struct dm_target *ti, unsigned int argc, char **argv)
|
|||
}
|
||||
|
||||
init_completion(&bc->kobj_holder.completion);
|
||||
ret = kobject_init_and_add(&bc->kobj_holder.kobj, &bow_ktype,
|
||||
&disk_to_dev(dm_disk(md))->kobj, "%s",
|
||||
"bow");
|
||||
if (ret) {
|
||||
ti->error = "Cannot create sysfs node";
|
||||
goto bad;
|
||||
}
|
||||
|
||||
mutex_init(&bc->ranges_lock);
|
||||
bc->ranges = RB_ROOT;
|
||||
bc->bufio = dm_bufio_client_create(bc->dev->bdev, bc->block_size, 1, 0,
|
||||
|
@ -799,6 +790,22 @@ bad:
|
|||
return ret;
|
||||
}
|
||||
|
||||
void dm_bow_resume(struct dm_target *ti)
|
||||
{
|
||||
struct mapped_device *md = dm_table_get_md(ti->table);
|
||||
struct bow_context *bc = ti->private;
|
||||
int ret;
|
||||
|
||||
if (bc->kobj_holder.kobj.state_initialized)
|
||||
return;
|
||||
|
||||
ret = kobject_init_and_add(&bc->kobj_holder.kobj, &bow_ktype,
|
||||
&disk_to_dev(dm_disk(md))->kobj, "%s",
|
||||
"bow");
|
||||
if (ret)
|
||||
ti->error = "Cannot create sysfs node";
|
||||
}
|
||||
|
||||
/****** Handle writes ******/
|
||||
|
||||
static int prepare_unchanged_range(struct bow_context *bc, struct bow_range *br,
|
||||
|
@ -1273,6 +1280,7 @@ static struct target_type bow_target = {
|
|||
.features = DM_TARGET_PASSES_CRYPTO,
|
||||
.module = THIS_MODULE,
|
||||
.ctr = dm_bow_ctr,
|
||||
.resume = dm_bow_resume,
|
||||
.dtr = dm_bow_dtr,
|
||||
.map = dm_bow_map,
|
||||
.status = dm_bow_status,
|
||||
|
|
Loading…
Reference in New Issue
Block a user