linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 01/16] media: rc: nuvoton-cir: use request_muxed_region for accessing EFM registers
@ 2015-12-30 16:39 Heiner Kallweit
  0 siblings, 0 replies; only message in thread
From: Heiner Kallweit @ 2015-12-30 16:39 UTC (permalink / raw)
  To: Mauro Carvalho Chehab; +Cc: linux-media

The two EFM ioports are accessed by drivers for other parts of the Nuvoton
Super-IO chips too. Therefore access to these ioports needs to be
protected by using request_muxed_region (like it's implemented e.g. in
hwmon/nct6775 already).

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
 drivers/media/rc/nuvoton-cir.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/media/rc/nuvoton-cir.c b/drivers/media/rc/nuvoton-cir.c
index 081435c..62c82c5 100644
--- a/drivers/media/rc/nuvoton-cir.c
+++ b/drivers/media/rc/nuvoton-cir.c
@@ -80,17 +80,24 @@ static inline void nvt_clear_reg_bit(struct nvt_dev *nvt, u8 val, u8 reg)
 }
 
 /* enter extended function mode */
-static inline void nvt_efm_enable(struct nvt_dev *nvt)
+static inline int nvt_efm_enable(struct nvt_dev *nvt)
 {
+	if (!request_muxed_region(nvt->cr_efir, 2, NVT_DRIVER_NAME))
+		return -EBUSY;
+
 	/* Enabling Extended Function Mode explicitly requires writing 2x */
 	outb(EFER_EFM_ENABLE, nvt->cr_efir);
 	outb(EFER_EFM_ENABLE, nvt->cr_efir);
+
+	return 0;
 }
 
 /* exit extended function mode */
 static inline void nvt_efm_disable(struct nvt_dev *nvt)
 {
 	outb(EFER_EFM_DISABLE, nvt->cr_efir);
+
+	release_region(nvt->cr_efir, 2);
 }
 
 /*
-- 
2.6.4



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2015-12-30 16:46 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-30 16:39 [PATCH 01/16] media: rc: nuvoton-cir: use request_muxed_region for accessing EFM registers Heiner Kallweit

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).