Commit 605c3698 authored by Sebastian Ott's avatar Sebastian Ott Committed by Martin Schwidefsky

s390/scm_block: do not hide eadm subchannel dependency

Stop hiding scm_block's dependency to the eadm subchannel driver
(by using functions provided by the eadm subchannel instead of
wrappers provided by the scm bus).

This will help userspace recognizing module dependencies (e.g. for
building a ramdisk). As a side effect we can get rid of some code
reimplementing refcounting between those modules.
Reported-by: default avatarHendrik Brueckner <brueckner@linux.vnet.ibm.com>
Reviewed-by: default avatarPeter Oberparleiter <peter.oberparleiter@de.ibm.com>
Signed-off-by: default avatarSebastian Ott <sebott@linux.vnet.ibm.com>
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
parent 7b50da53
...@@ -111,18 +111,7 @@ struct scm_driver { ...@@ -111,18 +111,7 @@ struct scm_driver {
int scm_driver_register(struct scm_driver *scmdrv); int scm_driver_register(struct scm_driver *scmdrv);
void scm_driver_unregister(struct scm_driver *scmdrv); void scm_driver_unregister(struct scm_driver *scmdrv);
int scm_start_aob(struct aob *aob); int eadm_start_aob(struct aob *aob);
void scm_irq_handler(struct aob *aob, int error); void scm_irq_handler(struct aob *aob, int error);
struct eadm_ops {
int (*eadm_start) (struct aob *aob);
struct module *owner;
};
int scm_get_ref(void);
void scm_put_ref(void);
void register_eadm_ops(struct eadm_ops *ops);
void unregister_eadm_ops(struct eadm_ops *ops);
#endif /* _ASM_S390_EADM_H */ #endif /* _ASM_S390_EADM_H */
...@@ -118,22 +118,6 @@ static void scm_request_done(struct scm_request *scmrq) ...@@ -118,22 +118,6 @@ static void scm_request_done(struct scm_request *scmrq)
spin_unlock_irqrestore(&list_lock, flags); spin_unlock_irqrestore(&list_lock, flags);
} }
static int scm_open(struct block_device *blkdev, fmode_t mode)
{
return scm_get_ref();
}
static void scm_release(struct gendisk *gendisk, fmode_t mode)
{
scm_put_ref();
}
static const struct block_device_operations scm_blk_devops = {
.owner = THIS_MODULE,
.open = scm_open,
.release = scm_release,
};
static bool scm_permit_request(struct scm_blk_dev *bdev, struct request *req) static bool scm_permit_request(struct scm_blk_dev *bdev, struct request *req)
{ {
return rq_data_dir(req) != WRITE || bdev->state != SCM_WR_PROHIBIT; return rq_data_dir(req) != WRITE || bdev->state != SCM_WR_PROHIBIT;
...@@ -256,7 +240,7 @@ static void scm_blk_request(struct request_queue *rq) ...@@ -256,7 +240,7 @@ static void scm_blk_request(struct request_queue *rq)
atomic_inc(&bdev->queued_reqs); atomic_inc(&bdev->queued_reqs);
blk_start_request(req); blk_start_request(req);
ret = scm_start_aob(scmrq->aob); ret = eadm_start_aob(scmrq->aob);
if (ret) { if (ret) {
SCM_LOG(5, "no subchannel"); SCM_LOG(5, "no subchannel");
scm_request_requeue(scmrq); scm_request_requeue(scmrq);
...@@ -320,7 +304,7 @@ static void scm_blk_handle_error(struct scm_request *scmrq) ...@@ -320,7 +304,7 @@ static void scm_blk_handle_error(struct scm_request *scmrq)
} }
restart: restart:
if (!scm_start_aob(scmrq->aob)) if (!eadm_start_aob(scmrq->aob))
return; return;
requeue: requeue:
...@@ -363,6 +347,10 @@ static void scm_blk_tasklet(struct scm_blk_dev *bdev) ...@@ -363,6 +347,10 @@ static void scm_blk_tasklet(struct scm_blk_dev *bdev)
blk_run_queue(bdev->rq); blk_run_queue(bdev->rq);
} }
static const struct block_device_operations scm_blk_devops = {
.owner = THIS_MODULE,
};
int scm_blk_dev_setup(struct scm_blk_dev *bdev, struct scm_device *scmdev) int scm_blk_dev_setup(struct scm_blk_dev *bdev, struct scm_device *scmdev)
{ {
struct request_queue *rq; struct request_queue *rq;
......
...@@ -187,7 +187,7 @@ bool scm_need_cluster_request(struct scm_request *scmrq) ...@@ -187,7 +187,7 @@ bool scm_need_cluster_request(struct scm_request *scmrq)
void scm_initiate_cluster_request(struct scm_request *scmrq) void scm_initiate_cluster_request(struct scm_request *scmrq)
{ {
scm_prepare_cluster_request(scmrq); scm_prepare_cluster_request(scmrq);
if (scm_start_aob(scmrq->aob)) if (eadm_start_aob(scmrq->aob))
scm_request_requeue(scmrq); scm_request_requeue(scmrq);
} }
......
...@@ -190,7 +190,7 @@ static struct subchannel *eadm_get_idle_sch(void) ...@@ -190,7 +190,7 @@ static struct subchannel *eadm_get_idle_sch(void)
return NULL; return NULL;
} }
static int eadm_start_aob(struct aob *aob) int eadm_start_aob(struct aob *aob)
{ {
struct eadm_private *private; struct eadm_private *private;
struct subchannel *sch; struct subchannel *sch;
...@@ -218,6 +218,7 @@ static int eadm_start_aob(struct aob *aob) ...@@ -218,6 +218,7 @@ static int eadm_start_aob(struct aob *aob)
return ret; return ret;
} }
EXPORT_SYMBOL_GPL(eadm_start_aob);
static int eadm_subchannel_probe(struct subchannel *sch) static int eadm_subchannel_probe(struct subchannel *sch)
{ {
...@@ -380,11 +381,6 @@ static struct css_driver eadm_subchannel_driver = { ...@@ -380,11 +381,6 @@ static struct css_driver eadm_subchannel_driver = {
.restore = eadm_subchannel_restore, .restore = eadm_subchannel_restore,
}; };
static struct eadm_ops eadm_ops = {
.eadm_start = eadm_start_aob,
.owner = THIS_MODULE,
};
static int __init eadm_sch_init(void) static int __init eadm_sch_init(void)
{ {
int ret; int ret;
...@@ -404,7 +400,6 @@ static int __init eadm_sch_init(void) ...@@ -404,7 +400,6 @@ static int __init eadm_sch_init(void)
if (ret) if (ret)
goto cleanup; goto cleanup;
register_eadm_ops(&eadm_ops);
return ret; return ret;
cleanup: cleanup:
...@@ -415,7 +410,6 @@ static int __init eadm_sch_init(void) ...@@ -415,7 +410,6 @@ static int __init eadm_sch_init(void)
static void __exit eadm_sch_exit(void) static void __exit eadm_sch_exit(void)
{ {
unregister_eadm_ops(&eadm_ops);
css_driver_unregister(&eadm_subchannel_driver); css_driver_unregister(&eadm_subchannel_driver);
isc_unregister(EADM_SCH_ISC); isc_unregister(EADM_SCH_ISC);
debug_unregister(eadm_debug); debug_unregister(eadm_debug);
......
...@@ -15,8 +15,6 @@ ...@@ -15,8 +15,6 @@
#include "chsc.h" #include "chsc.h"
static struct device *scm_root; static struct device *scm_root;
static struct eadm_ops *eadm_ops;
static DEFINE_MUTEX(eadm_ops_mutex);
#define to_scm_dev(n) container_of(n, struct scm_device, dev) #define to_scm_dev(n) container_of(n, struct scm_device, dev)
#define to_scm_drv(d) container_of(d, struct scm_driver, drv) #define to_scm_drv(d) container_of(d, struct scm_driver, drv)
...@@ -73,49 +71,6 @@ void scm_driver_unregister(struct scm_driver *scmdrv) ...@@ -73,49 +71,6 @@ void scm_driver_unregister(struct scm_driver *scmdrv)
} }
EXPORT_SYMBOL_GPL(scm_driver_unregister); EXPORT_SYMBOL_GPL(scm_driver_unregister);
int scm_get_ref(void)
{
int ret = 0;
mutex_lock(&eadm_ops_mutex);
if (!eadm_ops || !try_module_get(eadm_ops->owner))
ret = -ENOENT;
mutex_unlock(&eadm_ops_mutex);
return ret;
}
EXPORT_SYMBOL_GPL(scm_get_ref);
void scm_put_ref(void)
{
mutex_lock(&eadm_ops_mutex);
module_put(eadm_ops->owner);
mutex_unlock(&eadm_ops_mutex);
}
EXPORT_SYMBOL_GPL(scm_put_ref);
void register_eadm_ops(struct eadm_ops *ops)
{
mutex_lock(&eadm_ops_mutex);
eadm_ops = ops;
mutex_unlock(&eadm_ops_mutex);
}
EXPORT_SYMBOL_GPL(register_eadm_ops);
void unregister_eadm_ops(struct eadm_ops *ops)
{
mutex_lock(&eadm_ops_mutex);
eadm_ops = NULL;
mutex_unlock(&eadm_ops_mutex);
}
EXPORT_SYMBOL_GPL(unregister_eadm_ops);
int scm_start_aob(struct aob *aob)
{
return eadm_ops->eadm_start(aob);
}
EXPORT_SYMBOL_GPL(scm_start_aob);
void scm_irq_handler(struct aob *aob, int error) void scm_irq_handler(struct aob *aob, int error)
{ {
struct aob_rq_header *aobrq = (void *) aob->request.data; struct aob_rq_header *aobrq = (void *) aob->request.data;
......
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