diff options
author | Jacob Keller <jacob.e.keller@intel.com> | 2020-03-26 19:37:09 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2020-03-27 03:39:26 +0100 |
commit | a0a09f6bb2c1501e24246edf2a7d42558d263b2b (patch) | |
tree | 103b9278bb7f89a40aa2ecde3251eb7b1c0eb77b /drivers/net/netdevsim | |
parent | devlink: prepare to support region operations (diff) | |
download | linux-a0a09f6bb2c1501e24246edf2a7d42558d263b2b.tar.xz linux-a0a09f6bb2c1501e24246edf2a7d42558d263b2b.zip |
devlink: convert snapshot destructor callback to region op
It does not makes sense that two snapshots for a given region would use
different destructors. Simplify snapshot creation by adding
a .destructor op for regions.
This operation will replace the data_destructor for the snapshot
creation, and makes snapshot creation easier.
Noticed-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/netdevsim')
-rw-r--r-- | drivers/net/netdevsim/dev.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/net/netdevsim/dev.c b/drivers/net/netdevsim/dev.c index 47a8f8c570c4..f7621ccb7b88 100644 --- a/drivers/net/netdevsim/dev.c +++ b/drivers/net/netdevsim/dev.c @@ -56,7 +56,7 @@ static ssize_t nsim_dev_take_snapshot_write(struct file *file, id = devlink_region_snapshot_id_get(priv_to_devlink(nsim_dev)); err = devlink_region_snapshot_create(nsim_dev->dummy_region, - dummy_data, id, kfree); + dummy_data, id); if (err) { pr_err("Failed to create region snapshot\n"); kfree(dummy_data); @@ -342,6 +342,7 @@ static void nsim_devlink_param_load_driverinit_values(struct devlink *devlink) static const struct devlink_region_ops dummy_region_ops = { .name = "dummy", + .destructor = &kfree, }; static int nsim_dev_dummy_region_init(struct nsim_dev *nsim_dev, |