diff options
author | Alexandre Bounine <alexandre.bounine@idt.com> | 2016-03-22 21:26:41 (GMT) |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-03-22 22:36:02 (GMT) |
commit | b6cb95e8eb97e51a1a1b5609b59df859cc6dc2f2 (patch) | |
tree | 9b4f2bdd88833156a48b07ac845ff7c5ec54feeb /drivers/rapidio/rio.c | |
parent | 5024622f583eb242ed8040d0b9d1e0d2458d1db8 (diff) | |
download | linux-b6cb95e8eb97e51a1a1b5609b59df859cc6dc2f2.tar.xz |
rapidio: move rio_pw_enable into core code
Make rio_pw_enable() routine available to other RapidIO drivers.
Signed-off-by: Alexandre Bounine <alexandre.bounine@idt.com>
Cc: Matt Porter <mporter@kernel.crashing.org>
Cc: Aurelien Jacquiot <a-jacquiot@ti.com>
Cc: Andre van Herk <andre.van.herk@prodrive-technologies.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/rapidio/rio.c')
-rw-r--r-- | drivers/rapidio/rio.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/drivers/rapidio/rio.c b/drivers/rapidio/rio.c index 095801c..673774b 100644 --- a/drivers/rapidio/rio.c +++ b/drivers/rapidio/rio.c @@ -560,6 +560,24 @@ int rio_release_inb_pwrite(struct rio_dev *rdev) EXPORT_SYMBOL_GPL(rio_release_inb_pwrite); /** + * rio_pw_enable - Enables/disables port-write handling by a master port + * @mport: Master port associated with port-write handling + * @enable: 1=enable, 0=disable + */ +void rio_pw_enable(struct rio_mport *mport, int enable) +{ + if (mport->ops->pwenable) { + mutex_lock(&mport->lock); + + if ((enable && ++mport->pwe_refcnt == 1) || + (!enable && mport->pwe_refcnt && --mport->pwe_refcnt == 0)) + mport->ops->pwenable(mport, enable); + mutex_unlock(&mport->lock); + } +} +EXPORT_SYMBOL_GPL(rio_pw_enable); + +/** * rio_map_inb_region -- Map inbound memory region. * @mport: Master port. * @local: physical address of memory region to be mapped @@ -2041,6 +2059,7 @@ int rio_mport_initialize(struct rio_mport *mport) mport->host_deviceid = rio_get_hdid(mport->id); mport->nscan = NULL; mutex_init(&mport->lock); + mport->pwe_refcnt = 0; return 0; } |