Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) // SPDX-License-Identifier: GPL-2.0+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  *  Copyright IBM Corp. 2001, 2012
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  *  Author(s): Robert Burroughs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  *	       Eric Rossman (edrossma@us.ibm.com)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  *	       Cornelia Huck <cornelia.huck@de.ibm.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8)  *  Hotplug & misc device support: Jochen Roehrig (roehrig@de.ibm.com)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9)  *  Major cleanup & driver split: Martin Schwidefsky <schwidefsky@de.ibm.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10)  *				  Ralph Wuerthner <rwuerthn@de.ibm.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11)  *  MSGTYPE restruct:		  Holger Dengler <hd@linux.vnet.ibm.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) #include <linux/module.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) #include <linux/init.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) #include <linux/interrupt.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) #include <linux/miscdevice.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) #include <linux/fs.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) #include <linux/proc_fs.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) #include <linux/seq_file.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) #include <linux/compat.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) #include <linux/slab.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) #include <linux/atomic.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) #include <linux/uaccess.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) #include <linux/hw_random.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) #include <linux/debugfs.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) #include <asm/debug.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) #include "zcrypt_debug.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) #include "zcrypt_api.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) #include "zcrypt_msgtype6.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) #include "zcrypt_msgtype50.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36)  * Device attributes common for all crypto queue devices.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) static ssize_t online_show(struct device *dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) 			   struct device_attribute *attr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) 			   char *buf)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) 	struct ap_queue *aq = to_ap_queue(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) 	struct zcrypt_queue *zq = aq->private;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) 	int online = aq->config && zq->online ? 1 : 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) 	return scnprintf(buf, PAGE_SIZE, "%d\n", online);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) static ssize_t online_store(struct device *dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 			    struct device_attribute *attr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 			    const char *buf, size_t count)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 	struct ap_queue *aq = to_ap_queue(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 	struct zcrypt_queue *zq = aq->private;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 	struct zcrypt_card *zc = zq->zcard;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 	int online;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 	if (sscanf(buf, "%d\n", &online) != 1 || online < 0 || online > 1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 		return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 	if (online && (!aq->config || !aq->card->config))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 		return -ENODEV;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 	if (online && !zc->online)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 		return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 	zq->online = online;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 	ZCRYPT_DBF(DBF_INFO, "queue=%02x.%04x online=%d\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 		   AP_QID_CARD(zq->queue->qid),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 		   AP_QID_QUEUE(zq->queue->qid),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 		   online);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 	if (!online)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 		ap_flush_queue(zq->queue);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 	return count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) static DEVICE_ATTR_RW(online);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) static ssize_t load_show(struct device *dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 			 struct device_attribute *attr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 			 char *buf)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 	struct zcrypt_queue *zq = to_ap_queue(dev)->private;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 	return scnprintf(buf, PAGE_SIZE, "%d\n", atomic_read(&zq->load));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) static DEVICE_ATTR_RO(load);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) static struct attribute *zcrypt_queue_attrs[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 	&dev_attr_online.attr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 	&dev_attr_load.attr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 	NULL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) static const struct attribute_group zcrypt_queue_attr_group = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 	.attrs = zcrypt_queue_attrs,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) void zcrypt_queue_force_online(struct zcrypt_queue *zq, int online)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 	zq->online = online;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 	if (!online)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 		ap_flush_queue(zq->queue);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) struct zcrypt_queue *zcrypt_queue_alloc(size_t max_response_size)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 	struct zcrypt_queue *zq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 	zq = kzalloc(sizeof(struct zcrypt_queue), GFP_KERNEL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 	if (!zq)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 		return NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 	zq->reply.msg = kmalloc(max_response_size, GFP_KERNEL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 	if (!zq->reply.msg)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 		goto out_free;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 	zq->reply.len = max_response_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 	INIT_LIST_HEAD(&zq->list);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 	kref_init(&zq->refcount);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 	return zq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) out_free:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) 	kfree(zq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) 	return NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) EXPORT_SYMBOL(zcrypt_queue_alloc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) void zcrypt_queue_free(struct zcrypt_queue *zq)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 	kfree(zq->reply.msg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) 	kfree(zq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) EXPORT_SYMBOL(zcrypt_queue_free);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) static void zcrypt_queue_release(struct kref *kref)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) 	struct zcrypt_queue *zq =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) 		container_of(kref, struct zcrypt_queue, refcount);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 	zcrypt_queue_free(zq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) void zcrypt_queue_get(struct zcrypt_queue *zq)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) 	kref_get(&zq->refcount);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) EXPORT_SYMBOL(zcrypt_queue_get);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) int zcrypt_queue_put(struct zcrypt_queue *zq)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) 	return kref_put(&zq->refcount, zcrypt_queue_release);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) EXPORT_SYMBOL(zcrypt_queue_put);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156)  * zcrypt_queue_register() - Register a crypto queue device.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157)  * @zq: Pointer to a crypto queue device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159)  * Register a crypto queue device. Returns 0 if successful.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) int zcrypt_queue_register(struct zcrypt_queue *zq)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) 	struct zcrypt_card *zc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) 	int rc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) 	spin_lock(&zcrypt_list_lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) 	zc = zq->queue->card->private;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) 	zcrypt_card_get(zc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) 	zq->zcard = zc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) 	zq->online = 1;	/* New devices are online by default. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) 	ZCRYPT_DBF(DBF_INFO, "queue=%02x.%04x register online=1\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) 		   AP_QID_CARD(zq->queue->qid), AP_QID_QUEUE(zq->queue->qid));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) 	list_add_tail(&zq->list, &zc->zqueues);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) 	zcrypt_device_count++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) 	spin_unlock(&zcrypt_list_lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) 	rc = sysfs_create_group(&zq->queue->ap_dev.device.kobj,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) 				&zcrypt_queue_attr_group);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) 	if (rc)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) 		goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) 	if (zq->ops->rng) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) 		rc = zcrypt_rng_device_add();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) 		if (rc)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) 			goto out_unregister;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) out_unregister:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) 	sysfs_remove_group(&zq->queue->ap_dev.device.kobj,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) 			   &zcrypt_queue_attr_group);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) out:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) 	spin_lock(&zcrypt_list_lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) 	list_del_init(&zq->list);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) 	spin_unlock(&zcrypt_list_lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) 	zcrypt_card_put(zc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) 	return rc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) EXPORT_SYMBOL(zcrypt_queue_register);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204)  * zcrypt_queue_unregister(): Unregister a crypto queue device.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205)  * @zq: Pointer to crypto queue device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207)  * Unregister a crypto queue device.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) void zcrypt_queue_unregister(struct zcrypt_queue *zq)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) 	struct zcrypt_card *zc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) 	ZCRYPT_DBF(DBF_INFO, "queue=%02x.%04x unregister\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) 		   AP_QID_CARD(zq->queue->qid), AP_QID_QUEUE(zq->queue->qid));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) 	zc = zq->zcard;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) 	spin_lock(&zcrypt_list_lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) 	list_del_init(&zq->list);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) 	zcrypt_device_count--;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) 	spin_unlock(&zcrypt_list_lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) 	if (zq->ops->rng)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) 		zcrypt_rng_device_remove();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) 	sysfs_remove_group(&zq->queue->ap_dev.device.kobj,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) 			   &zcrypt_queue_attr_group);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) 	zcrypt_card_put(zc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) 	zcrypt_queue_put(zq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) EXPORT_SYMBOL(zcrypt_queue_unregister);