]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
crypto: qat - ignore subsequent state up commands
authorGiovanni Cabiddu <giovanni.cabiddu@intel.com>
Thu, 14 Sep 2023 09:55:47 +0000 (10:55 +0100)
committerHerbert Xu <herbert@gondor.apana.org.au>
Wed, 20 Sep 2023 05:15:30 +0000 (13:15 +0800)
If the device is already in the up state, a subsequent write of `up` to
the sysfs attribute /sys/bus/pci/devices/<BDF>/qat/state brings the
device down.
Fix this behaviour by ignoring subsequent `up` commands if the device is
already in the up state.

Fixes: 1bdc85550a2b ("crypto: qat - fix concurrency issue when device state changes")
Signed-off-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
Reviewed-by: Adam Guerin <adam.guerin@intel.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/intel/qat/qat_common/adf_sysfs.c

index 5e14c374ebd30459ab98ffc5bdb7acdcbe58a801..8672cfa2800f958cc63b03f8168d69c8246acb11 100644 (file)
@@ -68,7 +68,9 @@ static ssize_t state_store(struct device *dev, struct device_attribute *attr,
                dev_info(dev, "Starting device qat_dev%d\n", accel_id);
 
                ret = adf_dev_up(accel_dev, true);
-               if (ret < 0) {
+               if (ret == -EALREADY) {
+                       break;
+               } else if (ret) {
                        dev_err(dev, "Failed to start device qat_dev%d\n",
                                accel_id);
                        adf_dev_down(accel_dev, true);