Commit b5adbbf8 authored by Julian Wiedmann's avatar Julian Wiedmann Committed by Heiko Carstens

s390/ap: use the common driver-data pointer

The device struct provides a pointer for driver-private data. Use this
in the zcrypt drivers (as vfio_ap already does), and then remove the
custom pointer from the AP device structs.

As really_probe() will always clear the drvdata pointer on error, we
no longer have to do so ourselves.
Signed-off-by: default avatarJulian Wiedmann <jwi@linux.ibm.com>
Signed-off-by: default avatarHarald Freudenberger <freude@linux.ibm.com>
Signed-off-by: default avatarHeiko Carstens <hca@linux.ibm.com>
parent c8c68c5f
...@@ -164,7 +164,6 @@ struct ap_device { ...@@ -164,7 +164,6 @@ struct ap_device {
struct ap_card { struct ap_card {
struct ap_device ap_dev; struct ap_device ap_dev;
void *private; /* ap driver private pointer. */
int raw_hwtype; /* AP raw hardware type. */ int raw_hwtype; /* AP raw hardware type. */
unsigned int functions; /* AP device function bitfield. */ unsigned int functions; /* AP device function bitfield. */
int queue_depth; /* AP queue depth.*/ int queue_depth; /* AP queue depth.*/
...@@ -181,7 +180,6 @@ struct ap_queue { ...@@ -181,7 +180,6 @@ struct ap_queue {
struct hlist_node hnode; /* Node for the ap_queues hashtable */ struct hlist_node hnode; /* Node for the ap_queues hashtable */
struct ap_card *card; /* Ptr to assoc. AP card. */ struct ap_card *card; /* Ptr to assoc. AP card. */
spinlock_t lock; /* Per device lock. */ spinlock_t lock; /* Per device lock. */
void *private; /* ap driver private pointer. */
enum ap_dev_state dev_state; /* queue device state */ enum ap_dev_state dev_state; /* queue device state */
bool config; /* configured state */ bool config; /* configured state */
ap_qid_t qid; /* AP queue id. */ ap_qid_t qid; /* AP queue id. */
......
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
static ssize_t type_show(struct device *dev, static ssize_t type_show(struct device *dev,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
struct zcrypt_card *zc = to_ap_card(dev)->private; struct zcrypt_card *zc = dev_get_drvdata(dev);
return scnprintf(buf, PAGE_SIZE, "%s\n", zc->type_string); return scnprintf(buf, PAGE_SIZE, "%s\n", zc->type_string);
} }
...@@ -50,8 +50,8 @@ static ssize_t online_show(struct device *dev, ...@@ -50,8 +50,8 @@ static ssize_t online_show(struct device *dev,
struct device_attribute *attr, struct device_attribute *attr,
char *buf) char *buf)
{ {
struct zcrypt_card *zc = dev_get_drvdata(dev);
struct ap_card *ac = to_ap_card(dev); struct ap_card *ac = to_ap_card(dev);
struct zcrypt_card *zc = ac->private;
int online = ac->config && zc->online ? 1 : 0; int online = ac->config && zc->online ? 1 : 0;
return scnprintf(buf, PAGE_SIZE, "%d\n", online); return scnprintf(buf, PAGE_SIZE, "%d\n", online);
...@@ -61,8 +61,8 @@ static ssize_t online_store(struct device *dev, ...@@ -61,8 +61,8 @@ static ssize_t online_store(struct device *dev,
struct device_attribute *attr, struct device_attribute *attr,
const char *buf, size_t count) const char *buf, size_t count)
{ {
struct zcrypt_card *zc = dev_get_drvdata(dev);
struct ap_card *ac = to_ap_card(dev); struct ap_card *ac = to_ap_card(dev);
struct zcrypt_card *zc = ac->private;
struct zcrypt_queue *zq; struct zcrypt_queue *zq;
int online, id, i = 0, maxzqs = 0; int online, id, i = 0, maxzqs = 0;
struct zcrypt_queue **zq_uelist = NULL; struct zcrypt_queue **zq_uelist = NULL;
...@@ -116,7 +116,7 @@ static ssize_t load_show(struct device *dev, ...@@ -116,7 +116,7 @@ static ssize_t load_show(struct device *dev,
struct device_attribute *attr, struct device_attribute *attr,
char *buf) char *buf)
{ {
struct zcrypt_card *zc = to_ap_card(dev)->private; struct zcrypt_card *zc = dev_get_drvdata(dev);
return scnprintf(buf, PAGE_SIZE, "%d\n", atomic_read(&zc->load)); return scnprintf(buf, PAGE_SIZE, "%d\n", atomic_read(&zc->load));
} }
......
...@@ -89,7 +89,7 @@ static int zcrypt_cex2a_card_probe(struct ap_device *ap_dev) ...@@ -89,7 +89,7 @@ static int zcrypt_cex2a_card_probe(struct ap_device *ap_dev)
if (!zc) if (!zc)
return -ENOMEM; return -ENOMEM;
zc->card = ac; zc->card = ac;
ac->private = zc; dev_set_drvdata(&ap_dev->device, zc);
if (ac->ap_dev.device_type == AP_DEVICE_TYPE_CEX2A) { if (ac->ap_dev.device_type == AP_DEVICE_TYPE_CEX2A) {
zc->min_mod_size = CEX2A_MIN_MOD_SIZE; zc->min_mod_size = CEX2A_MIN_MOD_SIZE;
...@@ -118,7 +118,6 @@ static int zcrypt_cex2a_card_probe(struct ap_device *ap_dev) ...@@ -118,7 +118,6 @@ static int zcrypt_cex2a_card_probe(struct ap_device *ap_dev)
rc = zcrypt_card_register(zc); rc = zcrypt_card_register(zc);
if (rc) { if (rc) {
ac->private = NULL;
zcrypt_card_free(zc); zcrypt_card_free(zc);
} }
...@@ -131,7 +130,7 @@ static int zcrypt_cex2a_card_probe(struct ap_device *ap_dev) ...@@ -131,7 +130,7 @@ static int zcrypt_cex2a_card_probe(struct ap_device *ap_dev)
*/ */
static void zcrypt_cex2a_card_remove(struct ap_device *ap_dev) static void zcrypt_cex2a_card_remove(struct ap_device *ap_dev)
{ {
struct zcrypt_card *zc = to_ap_card(&ap_dev->device)->private; struct zcrypt_card *zc = dev_get_drvdata(&ap_dev->device);
if (zc) if (zc)
zcrypt_card_unregister(zc); zcrypt_card_unregister(zc);
...@@ -176,10 +175,9 @@ static int zcrypt_cex2a_queue_probe(struct ap_device *ap_dev) ...@@ -176,10 +175,9 @@ static int zcrypt_cex2a_queue_probe(struct ap_device *ap_dev)
ap_queue_init_state(aq); ap_queue_init_state(aq);
ap_queue_init_reply(aq, &zq->reply); ap_queue_init_reply(aq, &zq->reply);
aq->request_timeout = CEX2A_CLEANUP_TIME; aq->request_timeout = CEX2A_CLEANUP_TIME;
aq->private = zq; dev_set_drvdata(&ap_dev->device, zq);
rc = zcrypt_queue_register(zq); rc = zcrypt_queue_register(zq);
if (rc) { if (rc) {
aq->private = NULL;
zcrypt_queue_free(zq); zcrypt_queue_free(zq);
} }
...@@ -192,8 +190,7 @@ static int zcrypt_cex2a_queue_probe(struct ap_device *ap_dev) ...@@ -192,8 +190,7 @@ static int zcrypt_cex2a_queue_probe(struct ap_device *ap_dev)
*/ */
static void zcrypt_cex2a_queue_remove(struct ap_device *ap_dev) static void zcrypt_cex2a_queue_remove(struct ap_device *ap_dev)
{ {
struct ap_queue *aq = to_ap_queue(&ap_dev->device); struct zcrypt_queue *zq = dev_get_drvdata(&ap_dev->device);
struct zcrypt_queue *zq = aq->private;
if (zq) if (zq)
zcrypt_queue_unregister(zq); zcrypt_queue_unregister(zq);
......
...@@ -66,9 +66,9 @@ static ssize_t cca_serialnr_show(struct device *dev, ...@@ -66,9 +66,9 @@ static ssize_t cca_serialnr_show(struct device *dev,
struct device_attribute *attr, struct device_attribute *attr,
char *buf) char *buf)
{ {
struct zcrypt_card *zc = dev_get_drvdata(dev);
struct cca_info ci; struct cca_info ci;
struct ap_card *ac = to_ap_card(dev); struct ap_card *ac = to_ap_card(dev);
struct zcrypt_card *zc = ac->private;
memset(&ci, 0, sizeof(ci)); memset(&ci, 0, sizeof(ci));
...@@ -97,9 +97,9 @@ static ssize_t cca_mkvps_show(struct device *dev, ...@@ -97,9 +97,9 @@ static ssize_t cca_mkvps_show(struct device *dev,
struct device_attribute *attr, struct device_attribute *attr,
char *buf) char *buf)
{ {
struct zcrypt_queue *zq = dev_get_drvdata(dev);
int n = 0; int n = 0;
struct cca_info ci; struct cca_info ci;
struct zcrypt_queue *zq = to_ap_queue(dev)->private;
static const char * const cao_state[] = { "invalid", "valid" }; static const char * const cao_state[] = { "invalid", "valid" };
static const char * const new_state[] = { "empty", "partial", "full" }; static const char * const new_state[] = { "empty", "partial", "full" };
...@@ -261,7 +261,7 @@ static int zcrypt_cex2c_card_probe(struct ap_device *ap_dev) ...@@ -261,7 +261,7 @@ static int zcrypt_cex2c_card_probe(struct ap_device *ap_dev)
if (!zc) if (!zc)
return -ENOMEM; return -ENOMEM;
zc->card = ac; zc->card = ac;
ac->private = zc; dev_set_drvdata(&ap_dev->device, zc);
switch (ac->ap_dev.device_type) { switch (ac->ap_dev.device_type) {
case AP_DEVICE_TYPE_CEX2C: case AP_DEVICE_TYPE_CEX2C:
zc->user_space_type = ZCRYPT_CEX2C; zc->user_space_type = ZCRYPT_CEX2C;
...@@ -287,7 +287,6 @@ static int zcrypt_cex2c_card_probe(struct ap_device *ap_dev) ...@@ -287,7 +287,6 @@ static int zcrypt_cex2c_card_probe(struct ap_device *ap_dev)
rc = zcrypt_card_register(zc); rc = zcrypt_card_register(zc);
if (rc) { if (rc) {
ac->private = NULL;
zcrypt_card_free(zc); zcrypt_card_free(zc);
return rc; return rc;
} }
...@@ -297,7 +296,6 @@ static int zcrypt_cex2c_card_probe(struct ap_device *ap_dev) ...@@ -297,7 +296,6 @@ static int zcrypt_cex2c_card_probe(struct ap_device *ap_dev)
&cca_card_attr_grp); &cca_card_attr_grp);
if (rc) { if (rc) {
zcrypt_card_unregister(zc); zcrypt_card_unregister(zc);
ac->private = NULL;
zcrypt_card_free(zc); zcrypt_card_free(zc);
} }
} }
...@@ -311,8 +309,8 @@ static int zcrypt_cex2c_card_probe(struct ap_device *ap_dev) ...@@ -311,8 +309,8 @@ static int zcrypt_cex2c_card_probe(struct ap_device *ap_dev)
*/ */
static void zcrypt_cex2c_card_remove(struct ap_device *ap_dev) static void zcrypt_cex2c_card_remove(struct ap_device *ap_dev)
{ {
struct zcrypt_card *zc = dev_get_drvdata(&ap_dev->device);
struct ap_card *ac = to_ap_card(&ap_dev->device); struct ap_card *ac = to_ap_card(&ap_dev->device);
struct zcrypt_card *zc = to_ap_card(&ap_dev->device)->private;
if (ap_test_bit(&ac->functions, AP_FUNC_COPRO)) if (ap_test_bit(&ac->functions, AP_FUNC_COPRO))
sysfs_remove_group(&ap_dev->device.kobj, &cca_card_attr_grp); sysfs_remove_group(&ap_dev->device.kobj, &cca_card_attr_grp);
...@@ -359,10 +357,9 @@ static int zcrypt_cex2c_queue_probe(struct ap_device *ap_dev) ...@@ -359,10 +357,9 @@ static int zcrypt_cex2c_queue_probe(struct ap_device *ap_dev)
ap_queue_init_state(aq); ap_queue_init_state(aq);
ap_queue_init_reply(aq, &zq->reply); ap_queue_init_reply(aq, &zq->reply);
aq->request_timeout = CEX2C_CLEANUP_TIME; aq->request_timeout = CEX2C_CLEANUP_TIME;
aq->private = zq; dev_set_drvdata(&ap_dev->device, zq);
rc = zcrypt_queue_register(zq); rc = zcrypt_queue_register(zq);
if (rc) { if (rc) {
aq->private = NULL;
zcrypt_queue_free(zq); zcrypt_queue_free(zq);
return rc; return rc;
} }
...@@ -372,7 +369,6 @@ static int zcrypt_cex2c_queue_probe(struct ap_device *ap_dev) ...@@ -372,7 +369,6 @@ static int zcrypt_cex2c_queue_probe(struct ap_device *ap_dev)
&cca_queue_attr_grp); &cca_queue_attr_grp);
if (rc) { if (rc) {
zcrypt_queue_unregister(zq); zcrypt_queue_unregister(zq);
aq->private = NULL;
zcrypt_queue_free(zq); zcrypt_queue_free(zq);
} }
} }
...@@ -386,8 +382,8 @@ static int zcrypt_cex2c_queue_probe(struct ap_device *ap_dev) ...@@ -386,8 +382,8 @@ static int zcrypt_cex2c_queue_probe(struct ap_device *ap_dev)
*/ */
static void zcrypt_cex2c_queue_remove(struct ap_device *ap_dev) static void zcrypt_cex2c_queue_remove(struct ap_device *ap_dev)
{ {
struct zcrypt_queue *zq = dev_get_drvdata(&ap_dev->device);
struct ap_queue *aq = to_ap_queue(&ap_dev->device); struct ap_queue *aq = to_ap_queue(&ap_dev->device);
struct zcrypt_queue *zq = aq->private;
if (ap_test_bit(&aq->card->functions, AP_FUNC_COPRO)) if (ap_test_bit(&aq->card->functions, AP_FUNC_COPRO))
sysfs_remove_group(&ap_dev->device.kobj, &cca_queue_attr_grp); sysfs_remove_group(&ap_dev->device.kobj, &cca_queue_attr_grp);
......
...@@ -75,9 +75,9 @@ static ssize_t cca_serialnr_show(struct device *dev, ...@@ -75,9 +75,9 @@ static ssize_t cca_serialnr_show(struct device *dev,
struct device_attribute *attr, struct device_attribute *attr,
char *buf) char *buf)
{ {
struct zcrypt_card *zc = dev_get_drvdata(dev);
struct cca_info ci; struct cca_info ci;
struct ap_card *ac = to_ap_card(dev); struct ap_card *ac = to_ap_card(dev);
struct zcrypt_card *zc = ac->private;
memset(&ci, 0, sizeof(ci)); memset(&ci, 0, sizeof(ci));
...@@ -106,9 +106,9 @@ static ssize_t cca_mkvps_show(struct device *dev, ...@@ -106,9 +106,9 @@ static ssize_t cca_mkvps_show(struct device *dev,
struct device_attribute *attr, struct device_attribute *attr,
char *buf) char *buf)
{ {
struct zcrypt_queue *zq = dev_get_drvdata(dev);
int n = 0; int n = 0;
struct cca_info ci; struct cca_info ci;
struct zcrypt_queue *zq = to_ap_queue(dev)->private;
static const char * const cao_state[] = { "invalid", "valid" }; static const char * const cao_state[] = { "invalid", "valid" };
static const char * const new_state[] = { "empty", "partial", "full" }; static const char * const new_state[] = { "empty", "partial", "full" };
...@@ -187,9 +187,9 @@ static ssize_t ep11_api_ordinalnr_show(struct device *dev, ...@@ -187,9 +187,9 @@ static ssize_t ep11_api_ordinalnr_show(struct device *dev,
struct device_attribute *attr, struct device_attribute *attr,
char *buf) char *buf)
{ {
struct zcrypt_card *zc = dev_get_drvdata(dev);
struct ep11_card_info ci; struct ep11_card_info ci;
struct ap_card *ac = to_ap_card(dev); struct ap_card *ac = to_ap_card(dev);
struct zcrypt_card *zc = ac->private;
memset(&ci, 0, sizeof(ci)); memset(&ci, 0, sizeof(ci));
...@@ -208,9 +208,9 @@ static ssize_t ep11_fw_version_show(struct device *dev, ...@@ -208,9 +208,9 @@ static ssize_t ep11_fw_version_show(struct device *dev,
struct device_attribute *attr, struct device_attribute *attr,
char *buf) char *buf)
{ {
struct zcrypt_card *zc = dev_get_drvdata(dev);
struct ep11_card_info ci; struct ep11_card_info ci;
struct ap_card *ac = to_ap_card(dev); struct ap_card *ac = to_ap_card(dev);
struct zcrypt_card *zc = ac->private;
memset(&ci, 0, sizeof(ci)); memset(&ci, 0, sizeof(ci));
...@@ -231,9 +231,9 @@ static ssize_t ep11_serialnr_show(struct device *dev, ...@@ -231,9 +231,9 @@ static ssize_t ep11_serialnr_show(struct device *dev,
struct device_attribute *attr, struct device_attribute *attr,
char *buf) char *buf)
{ {
struct zcrypt_card *zc = dev_get_drvdata(dev);
struct ep11_card_info ci; struct ep11_card_info ci;
struct ap_card *ac = to_ap_card(dev); struct ap_card *ac = to_ap_card(dev);
struct zcrypt_card *zc = ac->private;
memset(&ci, 0, sizeof(ci)); memset(&ci, 0, sizeof(ci));
...@@ -264,10 +264,10 @@ static ssize_t ep11_card_op_modes_show(struct device *dev, ...@@ -264,10 +264,10 @@ static ssize_t ep11_card_op_modes_show(struct device *dev,
struct device_attribute *attr, struct device_attribute *attr,
char *buf) char *buf)
{ {
struct zcrypt_card *zc = dev_get_drvdata(dev);
int i, n = 0; int i, n = 0;
struct ep11_card_info ci; struct ep11_card_info ci;
struct ap_card *ac = to_ap_card(dev); struct ap_card *ac = to_ap_card(dev);
struct zcrypt_card *zc = ac->private;
memset(&ci, 0, sizeof(ci)); memset(&ci, 0, sizeof(ci));
...@@ -309,9 +309,9 @@ static ssize_t ep11_mkvps_show(struct device *dev, ...@@ -309,9 +309,9 @@ static ssize_t ep11_mkvps_show(struct device *dev,
struct device_attribute *attr, struct device_attribute *attr,
char *buf) char *buf)
{ {
struct zcrypt_queue *zq = dev_get_drvdata(dev);
int n = 0; int n = 0;
struct ep11_domain_info di; struct ep11_domain_info di;
struct zcrypt_queue *zq = to_ap_queue(dev)->private;
static const char * const cwk_state[] = { "invalid", "valid" }; static const char * const cwk_state[] = { "invalid", "valid" };
static const char * const nwk_state[] = { "empty", "uncommitted", static const char * const nwk_state[] = { "empty", "uncommitted",
"committed" }; "committed" };
...@@ -357,9 +357,9 @@ static ssize_t ep11_queue_op_modes_show(struct device *dev, ...@@ -357,9 +357,9 @@ static ssize_t ep11_queue_op_modes_show(struct device *dev,
struct device_attribute *attr, struct device_attribute *attr,
char *buf) char *buf)
{ {
struct zcrypt_queue *zq = dev_get_drvdata(dev);
int i, n = 0; int i, n = 0;
struct ep11_domain_info di; struct ep11_domain_info di;
struct zcrypt_queue *zq = to_ap_queue(dev)->private;
memset(&di, 0, sizeof(di)); memset(&di, 0, sizeof(di));
...@@ -441,7 +441,7 @@ static int zcrypt_cex4_card_probe(struct ap_device *ap_dev) ...@@ -441,7 +441,7 @@ static int zcrypt_cex4_card_probe(struct ap_device *ap_dev)
if (!zc) if (!zc)
return -ENOMEM; return -ENOMEM;
zc->card = ac; zc->card = ac;
ac->private = zc; dev_set_drvdata(&ap_dev->device, zc);
if (ap_test_bit(&ac->functions, AP_FUNC_ACCEL)) { if (ap_test_bit(&ac->functions, AP_FUNC_ACCEL)) {
if (ac->ap_dev.device_type == AP_DEVICE_TYPE_CEX4) { if (ac->ap_dev.device_type == AP_DEVICE_TYPE_CEX4) {
zc->type_string = "CEX4A"; zc->type_string = "CEX4A";
...@@ -539,7 +539,6 @@ static int zcrypt_cex4_card_probe(struct ap_device *ap_dev) ...@@ -539,7 +539,6 @@ static int zcrypt_cex4_card_probe(struct ap_device *ap_dev)
rc = zcrypt_card_register(zc); rc = zcrypt_card_register(zc);
if (rc) { if (rc) {
ac->private = NULL;
zcrypt_card_free(zc); zcrypt_card_free(zc);
return rc; return rc;
} }
...@@ -549,7 +548,6 @@ static int zcrypt_cex4_card_probe(struct ap_device *ap_dev) ...@@ -549,7 +548,6 @@ static int zcrypt_cex4_card_probe(struct ap_device *ap_dev)
&cca_card_attr_grp); &cca_card_attr_grp);
if (rc) { if (rc) {
zcrypt_card_unregister(zc); zcrypt_card_unregister(zc);
ac->private = NULL;
zcrypt_card_free(zc); zcrypt_card_free(zc);
} }
} else if (ap_test_bit(&ac->functions, AP_FUNC_EP11)) { } else if (ap_test_bit(&ac->functions, AP_FUNC_EP11)) {
...@@ -557,7 +555,6 @@ static int zcrypt_cex4_card_probe(struct ap_device *ap_dev) ...@@ -557,7 +555,6 @@ static int zcrypt_cex4_card_probe(struct ap_device *ap_dev)
&ep11_card_attr_grp); &ep11_card_attr_grp);
if (rc) { if (rc) {
zcrypt_card_unregister(zc); zcrypt_card_unregister(zc);
ac->private = NULL;
zcrypt_card_free(zc); zcrypt_card_free(zc);
} }
} }
...@@ -571,8 +568,8 @@ static int zcrypt_cex4_card_probe(struct ap_device *ap_dev) ...@@ -571,8 +568,8 @@ static int zcrypt_cex4_card_probe(struct ap_device *ap_dev)
*/ */
static void zcrypt_cex4_card_remove(struct ap_device *ap_dev) static void zcrypt_cex4_card_remove(struct ap_device *ap_dev)
{ {
struct zcrypt_card *zc = dev_get_drvdata(&ap_dev->device);
struct ap_card *ac = to_ap_card(&ap_dev->device); struct ap_card *ac = to_ap_card(&ap_dev->device);
struct zcrypt_card *zc = ac->private;
if (ap_test_bit(&ac->functions, AP_FUNC_COPRO)) if (ap_test_bit(&ac->functions, AP_FUNC_COPRO))
sysfs_remove_group(&ap_dev->device.kobj, &cca_card_attr_grp); sysfs_remove_group(&ap_dev->device.kobj, &cca_card_attr_grp);
...@@ -629,10 +626,9 @@ static int zcrypt_cex4_queue_probe(struct ap_device *ap_dev) ...@@ -629,10 +626,9 @@ static int zcrypt_cex4_queue_probe(struct ap_device *ap_dev)
ap_queue_init_state(aq); ap_queue_init_state(aq);
ap_queue_init_reply(aq, &zq->reply); ap_queue_init_reply(aq, &zq->reply);
aq->request_timeout = CEX4_CLEANUP_TIME; aq->request_timeout = CEX4_CLEANUP_TIME;
aq->private = zq; dev_set_drvdata(&ap_dev->device, zq);
rc = zcrypt_queue_register(zq); rc = zcrypt_queue_register(zq);
if (rc) { if (rc) {
aq->private = NULL;
zcrypt_queue_free(zq); zcrypt_queue_free(zq);
return rc; return rc;
} }
...@@ -642,7 +638,6 @@ static int zcrypt_cex4_queue_probe(struct ap_device *ap_dev) ...@@ -642,7 +638,6 @@ static int zcrypt_cex4_queue_probe(struct ap_device *ap_dev)
&cca_queue_attr_grp); &cca_queue_attr_grp);
if (rc) { if (rc) {
zcrypt_queue_unregister(zq); zcrypt_queue_unregister(zq);
aq->private = NULL;
zcrypt_queue_free(zq); zcrypt_queue_free(zq);
} }
} else if (ap_test_bit(&aq->card->functions, AP_FUNC_EP11)) { } else if (ap_test_bit(&aq->card->functions, AP_FUNC_EP11)) {
...@@ -650,7 +645,6 @@ static int zcrypt_cex4_queue_probe(struct ap_device *ap_dev) ...@@ -650,7 +645,6 @@ static int zcrypt_cex4_queue_probe(struct ap_device *ap_dev)
&ep11_queue_attr_grp); &ep11_queue_attr_grp);
if (rc) { if (rc) {
zcrypt_queue_unregister(zq); zcrypt_queue_unregister(zq);
aq->private = NULL;
zcrypt_queue_free(zq); zcrypt_queue_free(zq);
} }
} }
...@@ -664,8 +658,8 @@ static int zcrypt_cex4_queue_probe(struct ap_device *ap_dev) ...@@ -664,8 +658,8 @@ static int zcrypt_cex4_queue_probe(struct ap_device *ap_dev)
*/ */
static void zcrypt_cex4_queue_remove(struct ap_device *ap_dev) static void zcrypt_cex4_queue_remove(struct ap_device *ap_dev)
{ {
struct zcrypt_queue *zq = dev_get_drvdata(&ap_dev->device);
struct ap_queue *aq = to_ap_queue(&ap_dev->device); struct ap_queue *aq = to_ap_queue(&ap_dev->device);
struct zcrypt_queue *zq = aq->private;
if (ap_test_bit(&aq->card->functions, AP_FUNC_COPRO)) if (ap_test_bit(&aq->card->functions, AP_FUNC_COPRO))
sysfs_remove_group(&ap_dev->device.kobj, &cca_queue_attr_grp); sysfs_remove_group(&ap_dev->device.kobj, &cca_queue_attr_grp);
......
...@@ -40,8 +40,8 @@ static ssize_t online_show(struct device *dev, ...@@ -40,8 +40,8 @@ static ssize_t online_show(struct device *dev,
struct device_attribute *attr, struct device_attribute *attr,
char *buf) char *buf)
{ {
struct zcrypt_queue *zq = dev_get_drvdata(dev);
struct ap_queue *aq = to_ap_queue(dev); struct ap_queue *aq = to_ap_queue(dev);
struct zcrypt_queue *zq = aq->private;
int online = aq->config && zq->online ? 1 : 0; int online = aq->config && zq->online ? 1 : 0;
return scnprintf(buf, PAGE_SIZE, "%d\n", online); return scnprintf(buf, PAGE_SIZE, "%d\n", online);
...@@ -51,8 +51,8 @@ static ssize_t online_store(struct device *dev, ...@@ -51,8 +51,8 @@ static ssize_t online_store(struct device *dev,
struct device_attribute *attr, struct device_attribute *attr,
const char *buf, size_t count) const char *buf, size_t count)
{ {
struct zcrypt_queue *zq = dev_get_drvdata(dev);
struct ap_queue *aq = to_ap_queue(dev); struct ap_queue *aq = to_ap_queue(dev);
struct zcrypt_queue *zq = aq->private;
struct zcrypt_card *zc = zq->zcard; struct zcrypt_card *zc = zq->zcard;
int online; int online;
...@@ -83,7 +83,7 @@ static ssize_t load_show(struct device *dev, ...@@ -83,7 +83,7 @@ static ssize_t load_show(struct device *dev,
struct device_attribute *attr, struct device_attribute *attr,
char *buf) char *buf)
{ {
struct zcrypt_queue *zq = to_ap_queue(dev)->private; struct zcrypt_queue *zq = dev_get_drvdata(dev);
return scnprintf(buf, PAGE_SIZE, "%d\n", atomic_read(&zq->load)); return scnprintf(buf, PAGE_SIZE, "%d\n", atomic_read(&zq->load));
} }
...@@ -170,7 +170,7 @@ int zcrypt_queue_register(struct zcrypt_queue *zq) ...@@ -170,7 +170,7 @@ int zcrypt_queue_register(struct zcrypt_queue *zq)
int rc; int rc;
spin_lock(&zcrypt_list_lock); spin_lock(&zcrypt_list_lock);
zc = zq->queue->card->private; zc = dev_get_drvdata(&zq->queue->card->ap_dev.device);
zcrypt_card_get(zc); zcrypt_card_get(zc);
zq->zcard = zc; zq->zcard = zc;
zq->online = 1; /* New devices are online by default. */ zq->online = 1; /* New devices are online by default. */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment