crypto: qat - change behaviour of adf_cfg_add_key_value_param()
authorGiovanni Cabiddu <giovanni.cabiddu@intel.com>
Mon, 27 Jun 2022 08:36:50 +0000 (09:36 +0100)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 8 Jul 2022 07:15:59 +0000 (15:15 +0800)
commit92bf269fbfe94018f15405e1644049de7c7b46dd
tree2704fb126de55a3e3a425360d27f466d5dca71d2
parent5ee52118ac1481dd8a8f7e6a9bfe6ee05ac6ec92
crypto: qat - change behaviour of adf_cfg_add_key_value_param()

The function adf_cfg_add_key_value_param() allows to insert duplicates
entries in the key value store of the driver.

Change the behaviour of that function to the following policy:
- if the key doesn't exist, add it;
- if the key already exists with a different value, then delete it and
  replace it with a new one containing the new value;
- if the key exists with the same value, then return without doing
  anything.

The behaviour of this function has been changed in order to easily
update key-values in the driver database. In particular this is required
to update the value of the ServiceEnables key used to change the service
loaded on a device.

Signed-off-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
Reviewed-by: Adam Guerin <adam.guerin@intel.com>
Reviewed-by: Fiona Trahe <fiona.trahe@intel.com>
Reviewed-by: Wojciech Ziemba <wojciech.ziemba@intel.com>
Reviewed-by: Vladis Dronov <vdronov@redhat.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/qat/qat_common/adf_cfg.c