Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

crypto: qat - refactor device restart logic

Refactor the restart logic by moving it into the function
adf_dev_restart() which uses the safe function adf_dev_up() and
adf_dev_down().

This commit does not implement any functional change.

Signed-off-by: Shashank Gupta <shashank.gupta@intel.com>
Reviewed-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

authored by

Shashank Gupta and committed by
Herbert Xu
b97c5377 2b60f79c

+20 -3
+1 -3
drivers/crypto/qat/qat_common/adf_aer.c
··· 90 90 struct adf_accel_dev *accel_dev = reset_data->accel_dev; 91 91 92 92 adf_dev_restarting_notify(accel_dev); 93 - adf_dev_stop(accel_dev); 94 - adf_dev_shutdown(accel_dev); 95 - if (adf_dev_init(accel_dev) || adf_dev_start(accel_dev)) { 93 + if (adf_dev_restart(accel_dev)) { 96 94 /* The device hanged and we can't restart it so stop here */ 97 95 dev_err(&GET_DEV(accel_dev), "Restart device failed\n"); 98 96 kfree(reset_data);
+1
drivers/crypto/qat/qat_common/adf_common_drv.h
··· 60 60 61 61 int adf_dev_up(struct adf_accel_dev *accel_dev, bool init_config); 62 62 int adf_dev_down(struct adf_accel_dev *accel_dev, bool cache_config); 63 + int adf_dev_restart(struct adf_accel_dev *accel_dev); 63 64 64 65 void adf_devmgr_update_class_index(struct adf_hw_device_data *hw_data); 65 66 void adf_clean_vf_map(bool);
+18
drivers/crypto/qat/qat_common/adf_init.c
··· 464 464 return ret; 465 465 } 466 466 EXPORT_SYMBOL_GPL(adf_dev_up); 467 + 468 + int adf_dev_restart(struct adf_accel_dev *accel_dev) 469 + { 470 + int ret = 0; 471 + 472 + if (!accel_dev) 473 + return -EFAULT; 474 + 475 + adf_dev_down(accel_dev, false); 476 + 477 + ret = adf_dev_up(accel_dev, false); 478 + /* if device is already up return success*/ 479 + if (ret == -EALREADY) 480 + return 0; 481 + 482 + return ret; 483 + } 484 + EXPORT_SYMBOL_GPL(adf_dev_restart);