Commit 137aa361 authored by Heiner Kallweit's avatar Heiner Kallweit Committed by Mauro Carvalho Chehab

[media] rc/nuvoton_cir: fix locking issue when calling nvt_disable_cir

nvt_disable_cir calls nvt_disable_logical_dev (that may sleep) and is
called from contexts holding a spinlock.
Fix this and remove the unneeded clearing of CIR_IREN as this is done
in nvt_cir_disable already.
Signed-off-by: default avatarHeiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
parent b883af30
...@@ -950,6 +950,10 @@ static irqreturn_t nvt_cir_wake_isr(int irq, void *data) ...@@ -950,6 +950,10 @@ static irqreturn_t nvt_cir_wake_isr(int irq, void *data)
static void nvt_disable_cir(struct nvt_dev *nvt) static void nvt_disable_cir(struct nvt_dev *nvt)
{ {
unsigned long flags;
spin_lock_irqsave(&nvt->nvt_lock, flags);
/* disable CIR interrupts */ /* disable CIR interrupts */
nvt_cir_reg_write(nvt, 0, CIR_IREN); nvt_cir_reg_write(nvt, 0, CIR_IREN);
...@@ -963,6 +967,8 @@ static void nvt_disable_cir(struct nvt_dev *nvt) ...@@ -963,6 +967,8 @@ static void nvt_disable_cir(struct nvt_dev *nvt)
nvt_clear_cir_fifo(nvt); nvt_clear_cir_fifo(nvt);
nvt_clear_tx_fifo(nvt); nvt_clear_tx_fifo(nvt);
spin_unlock_irqrestore(&nvt->nvt_lock, flags);
/* disable the CIR logical device */ /* disable the CIR logical device */
nvt_disable_logical_dev(nvt, LOGICAL_DEV_CIR); nvt_disable_logical_dev(nvt, LOGICAL_DEV_CIR);
} }
...@@ -996,11 +1002,8 @@ static int nvt_open(struct rc_dev *dev) ...@@ -996,11 +1002,8 @@ static int nvt_open(struct rc_dev *dev)
static void nvt_close(struct rc_dev *dev) static void nvt_close(struct rc_dev *dev)
{ {
struct nvt_dev *nvt = dev->priv; struct nvt_dev *nvt = dev->priv;
unsigned long flags;
spin_lock_irqsave(&nvt->nvt_lock, flags);
nvt_disable_cir(nvt); nvt_disable_cir(nvt);
spin_unlock_irqrestore(&nvt->nvt_lock, flags);
} }
/* Allocate memory, probe hardware, and initialize everything */ /* Allocate memory, probe hardware, and initialize everything */
...@@ -1152,13 +1155,8 @@ static int nvt_probe(struct pnp_dev *pdev, const struct pnp_device_id *dev_id) ...@@ -1152,13 +1155,8 @@ static int nvt_probe(struct pnp_dev *pdev, const struct pnp_device_id *dev_id)
static void nvt_remove(struct pnp_dev *pdev) static void nvt_remove(struct pnp_dev *pdev)
{ {
struct nvt_dev *nvt = pnp_get_drvdata(pdev); struct nvt_dev *nvt = pnp_get_drvdata(pdev);
unsigned long flags;
spin_lock_irqsave(&nvt->nvt_lock, flags);
/* disable CIR */
nvt_cir_reg_write(nvt, 0, CIR_IREN);
nvt_disable_cir(nvt); nvt_disable_cir(nvt);
spin_unlock_irqrestore(&nvt->nvt_lock, flags);
/* enable CIR Wake (for IR power-on) */ /* enable CIR Wake (for IR power-on) */
nvt_enable_wake(nvt); nvt_enable_wake(nvt);
......
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