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

s390/ap: use the common device_driver pointer

The device struct itself already contains a pointer to its driver.
Use this consistently, instead of duplicating it.
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 81a07617
...@@ -703,7 +703,7 @@ static int __ap_calc_helper(struct device *dev, void *arg) ...@@ -703,7 +703,7 @@ static int __ap_calc_helper(struct device *dev, void *arg)
if (is_queue_dev(dev)) { if (is_queue_dev(dev)) {
pctrs->apqns++; pctrs->apqns++;
if ((to_ap_dev(dev))->drv) if (dev->driver)
pctrs->bound++; pctrs->bound++;
} }
...@@ -883,7 +883,6 @@ static int ap_device_probe(struct device *dev) ...@@ -883,7 +883,6 @@ static int ap_device_probe(struct device *dev)
to_ap_queue(dev)->qid); to_ap_queue(dev)->qid);
spin_unlock_bh(&ap_queues_lock); spin_unlock_bh(&ap_queues_lock);
ap_dev->drv = ap_drv;
rc = ap_drv->probe ? ap_drv->probe(ap_dev) : -ENODEV; rc = ap_drv->probe ? ap_drv->probe(ap_dev) : -ENODEV;
if (rc) { if (rc) {
...@@ -891,7 +890,6 @@ static int ap_device_probe(struct device *dev) ...@@ -891,7 +890,6 @@ static int ap_device_probe(struct device *dev)
if (is_queue_dev(dev)) if (is_queue_dev(dev))
hash_del(&to_ap_queue(dev)->hnode); hash_del(&to_ap_queue(dev)->hnode);
spin_unlock_bh(&ap_queues_lock); spin_unlock_bh(&ap_queues_lock);
ap_dev->drv = NULL;
} else } else
ap_check_bindings_complete(); ap_check_bindings_complete();
...@@ -904,7 +902,7 @@ static int ap_device_probe(struct device *dev) ...@@ -904,7 +902,7 @@ static int ap_device_probe(struct device *dev)
static int ap_device_remove(struct device *dev) static int ap_device_remove(struct device *dev)
{ {
struct ap_device *ap_dev = to_ap_dev(dev); struct ap_device *ap_dev = to_ap_dev(dev);
struct ap_driver *ap_drv = ap_dev->drv; struct ap_driver *ap_drv = to_ap_drv(dev->driver);
/* prepare ap queue device removal */ /* prepare ap queue device removal */
if (is_queue_dev(dev)) if (is_queue_dev(dev))
...@@ -923,7 +921,6 @@ static int ap_device_remove(struct device *dev) ...@@ -923,7 +921,6 @@ static int ap_device_remove(struct device *dev)
if (is_queue_dev(dev)) if (is_queue_dev(dev))
hash_del(&to_ap_queue(dev)->hnode); hash_del(&to_ap_queue(dev)->hnode);
spin_unlock_bh(&ap_queues_lock); spin_unlock_bh(&ap_queues_lock);
ap_dev->drv = NULL;
put_device(dev); put_device(dev);
......
...@@ -157,7 +157,6 @@ void ap_driver_unregister(struct ap_driver *); ...@@ -157,7 +157,6 @@ void ap_driver_unregister(struct ap_driver *);
struct ap_device { struct ap_device {
struct device device; struct device device;
struct ap_driver *drv; /* Pointer to AP device driver. */
int device_type; /* AP device type. */ int device_type; /* AP device type. */
}; };
......
...@@ -572,14 +572,14 @@ static inline struct zcrypt_queue *zcrypt_pick_queue(struct zcrypt_card *zc, ...@@ -572,14 +572,14 @@ static inline struct zcrypt_queue *zcrypt_pick_queue(struct zcrypt_card *zc,
struct module **pmod, struct module **pmod,
unsigned int weight) unsigned int weight)
{ {
if (!zq || !try_module_get(zq->queue->ap_dev.drv->driver.owner)) if (!zq || !try_module_get(zq->queue->ap_dev.device.driver->owner))
return NULL; return NULL;
zcrypt_queue_get(zq); zcrypt_queue_get(zq);
get_device(&zq->queue->ap_dev.device); get_device(&zq->queue->ap_dev.device);
atomic_add(weight, &zc->load); atomic_add(weight, &zc->load);
atomic_add(weight, &zq->load); atomic_add(weight, &zq->load);
zq->request_count++; zq->request_count++;
*pmod = zq->queue->ap_dev.drv->driver.owner; *pmod = zq->queue->ap_dev.device.driver->owner;
return zq; return zq;
} }
......
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