[git:v4l-dvb/v2.6.36] V4L/DVB: cx23885: Protect PCI interrupt mask manipulations with a spinlock
This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/media-tree.git tree: Subject: V4L/DVB: cx23885: Protect PCI interrupt mask manipulations with a spinlock Author: Andy Walls Date:Mon Jul 19 01:19:43 2010 -0300 This patch encapsulates access to the PCI_INT_MSK register and dev->pci_irqmask variable and protects them with a spinlock. This is needed because both the hard IRQ handler and a workhandler will need to manipulate the mask to disable the AV_CORE interrupt. Signed-off-by: Andy Walls Signed-off-by: Mauro Carvalho Chehab drivers/media/video/cx23885/cx23885-cards.c | 17 ++--- drivers/media/video/cx23885/cx23885-core.c | 94 +-- drivers/media/video/cx23885/cx23885-vbi.c |2 +- drivers/media/video/cx23885/cx23885-video.c |7 +- drivers/media/video/cx23885/cx23885.h |5 ++ 5 files changed, 103 insertions(+), 22 deletions(-) --- http://git.linuxtv.org/media-tree.git?a=commitdiff;h=dbe83a3b921328e12b2abe894fc692afba293d7f diff --git a/drivers/media/video/cx23885/cx23885-cards.c b/drivers/media/video/cx23885/cx23885-cards.c index 294a753..d72b48e 100644 --- a/drivers/media/video/cx23885/cx23885-cards.c +++ b/drivers/media/video/cx23885/cx23885-cards.c @@ -1012,7 +1012,6 @@ int cx23885_ir_init(struct cx23885_dev *dev) dev->sd_ir = cx23885_find_hw(dev, CX23885_HW_888_IR); v4l2_subdev_call(dev->sd_cx25840, core, s_io_pin_config, ir_rxtx_pin_cfg_count, ir_rxtx_pin_cfg); - dev->pci_irqmask |= PCI_MSK_IR; /* * For these boards we need to invert the Tx output via the * IR controller to have the LED off while idle @@ -1033,7 +1032,6 @@ int cx23885_ir_init(struct cx23885_dev *dev) } v4l2_subdev_call(dev->sd_cx25840, core, s_io_pin_config, ir_rx_pin_cfg_count, ir_rx_pin_cfg); - dev->pci_irqmask |= PCI_MSK_AV_CORE; break; case CX23885_BOARD_HAUPPAUGE_HVR1250: dev->sd_ir = cx23885_find_hw(dev, CX23885_HW_AV_CORE); @@ -1043,7 +1041,6 @@ int cx23885_ir_init(struct cx23885_dev *dev) } v4l2_subdev_call(dev->sd_cx25840, core, s_io_pin_config, ir_rxtx_pin_cfg_count, ir_rxtx_pin_cfg); - dev->pci_irqmask |= PCI_MSK_AV_CORE; break; case CX23885_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL_EXP: request_module("ir-kbd-i2c"); @@ -1058,15 +1055,13 @@ void cx23885_ir_fini(struct cx23885_dev *dev) switch (dev->board) { case CX23885_BOARD_HAUPPAUGE_HVR1850: case CX23885_BOARD_HAUPPAUGE_HVR1290: - dev->pci_irqmask &= ~PCI_MSK_IR; - cx_clear(PCI_INT_MSK, PCI_MSK_IR); + cx23885_irq_remove(dev, PCI_MSK_IR); cx23888_ir_remove(dev); dev->sd_ir = NULL; break; case CX23885_BOARD_TEVII_S470: case CX23885_BOARD_HAUPPAUGE_HVR1250: - dev->pci_irqmask &= ~PCI_MSK_AV_CORE; - cx_clear(PCI_INT_MSK, PCI_MSK_AV_CORE); + cx23885_irq_remove(dev, PCI_MSK_AV_CORE); /* sd_ir is a duplicate pointer to the AV Core, just clear it */ dev->sd_ir = NULL; break; @@ -1078,13 +1073,13 @@ void cx23885_ir_pci_int_enable(struct cx23885_dev *dev) switch (dev->board) { case CX23885_BOARD_HAUPPAUGE_HVR1850: case CX23885_BOARD_HAUPPAUGE_HVR1290: - if (dev->sd_ir && (dev->pci_irqmask & PCI_MSK_IR)) - cx_set(PCI_INT_MSK, PCI_MSK_IR); + if (dev->sd_ir) + cx23885_irq_add_enable(dev, PCI_MSK_IR); break; case CX23885_BOARD_TEVII_S470: case CX23885_BOARD_HAUPPAUGE_HVR1250: - if (dev->sd_ir && (dev->pci_irqmask & PCI_MSK_AV_CORE)) - cx_set(PCI_INT_MSK, PCI_MSK_AV_CORE); + if (dev->sd_ir) + cx23885_irq_add_enable(dev, PCI_MSK_AV_CORE); break; } } diff --git a/drivers/media/video/cx23885/cx23885-core.c b/drivers/media/video/cx23885/cx23885-core.c index 93e7afb..0765abf 100644 --- a/drivers/media/video/cx23885/cx23885-core.c +++ b/drivers/media/video/cx23885/cx23885-core.c @@ -299,6 +299,83 @@ static struct sram_channel cx23887_sram_channels[] = { }, }; +void cx23885_irq_add(struct cx23885_dev *dev, u32 mask) +{ + unsigned long flags; + spin_lock_irqsave(&dev->pci_irqmask_lock, flags); + + dev->pci_irqmask |= mask; + + spin_unlock_irqrestore(&dev->pci_irqmask_lock, flags); +} + +void cx23885_irq_add_enable(struct cx23885_dev *dev, u32 mask) +{ + unsigned long flags; + spin_lock_irqsave(&dev->pci_irqmask_lock, flags)
[git:v4l-dvb/v2.6.36] V4L/DVB: cx23885: Protect PCI interrupt mask manipulations with a spinlock
This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/media-tree.git tree: Subject: V4L/DVB: cx23885: Protect PCI interrupt mask manipulations with a spinlock Author: Andy Walls Date:Mon Jul 19 01:19:43 2010 -0300 This patch encapsulates access to the PCI_INT_MSK register and dev->pci_irqmask variable and protects them with a spinlock. This is needed because both the hard IRQ handler and a workhandler will need to manipulate the mask to disable the AV_CORE interrupt. Signed-off-by: Andy Walls Signed-off-by: Mauro Carvalho Chehab drivers/media/video/cx23885/cx23885-cards.c | 17 ++--- drivers/media/video/cx23885/cx23885-core.c | 94 +-- drivers/media/video/cx23885/cx23885-vbi.c |2 +- drivers/media/video/cx23885/cx23885-video.c |7 +- drivers/media/video/cx23885/cx23885.h |5 ++ 5 files changed, 103 insertions(+), 22 deletions(-) --- http://git.linuxtv.org/media-tree.git?a=commitdiff;h=9feacdfecef2fc8bb6373a6835b58359e24b diff --git a/drivers/media/video/cx23885/cx23885-cards.c b/drivers/media/video/cx23885/cx23885-cards.c index 294a753..d72b48e 100644 --- a/drivers/media/video/cx23885/cx23885-cards.c +++ b/drivers/media/video/cx23885/cx23885-cards.c @@ -1012,7 +1012,6 @@ int cx23885_ir_init(struct cx23885_dev *dev) dev->sd_ir = cx23885_find_hw(dev, CX23885_HW_888_IR); v4l2_subdev_call(dev->sd_cx25840, core, s_io_pin_config, ir_rxtx_pin_cfg_count, ir_rxtx_pin_cfg); - dev->pci_irqmask |= PCI_MSK_IR; /* * For these boards we need to invert the Tx output via the * IR controller to have the LED off while idle @@ -1033,7 +1032,6 @@ int cx23885_ir_init(struct cx23885_dev *dev) } v4l2_subdev_call(dev->sd_cx25840, core, s_io_pin_config, ir_rx_pin_cfg_count, ir_rx_pin_cfg); - dev->pci_irqmask |= PCI_MSK_AV_CORE; break; case CX23885_BOARD_HAUPPAUGE_HVR1250: dev->sd_ir = cx23885_find_hw(dev, CX23885_HW_AV_CORE); @@ -1043,7 +1041,6 @@ int cx23885_ir_init(struct cx23885_dev *dev) } v4l2_subdev_call(dev->sd_cx25840, core, s_io_pin_config, ir_rxtx_pin_cfg_count, ir_rxtx_pin_cfg); - dev->pci_irqmask |= PCI_MSK_AV_CORE; break; case CX23885_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL_EXP: request_module("ir-kbd-i2c"); @@ -1058,15 +1055,13 @@ void cx23885_ir_fini(struct cx23885_dev *dev) switch (dev->board) { case CX23885_BOARD_HAUPPAUGE_HVR1850: case CX23885_BOARD_HAUPPAUGE_HVR1290: - dev->pci_irqmask &= ~PCI_MSK_IR; - cx_clear(PCI_INT_MSK, PCI_MSK_IR); + cx23885_irq_remove(dev, PCI_MSK_IR); cx23888_ir_remove(dev); dev->sd_ir = NULL; break; case CX23885_BOARD_TEVII_S470: case CX23885_BOARD_HAUPPAUGE_HVR1250: - dev->pci_irqmask &= ~PCI_MSK_AV_CORE; - cx_clear(PCI_INT_MSK, PCI_MSK_AV_CORE); + cx23885_irq_remove(dev, PCI_MSK_AV_CORE); /* sd_ir is a duplicate pointer to the AV Core, just clear it */ dev->sd_ir = NULL; break; @@ -1078,13 +1073,13 @@ void cx23885_ir_pci_int_enable(struct cx23885_dev *dev) switch (dev->board) { case CX23885_BOARD_HAUPPAUGE_HVR1850: case CX23885_BOARD_HAUPPAUGE_HVR1290: - if (dev->sd_ir && (dev->pci_irqmask & PCI_MSK_IR)) - cx_set(PCI_INT_MSK, PCI_MSK_IR); + if (dev->sd_ir) + cx23885_irq_add_enable(dev, PCI_MSK_IR); break; case CX23885_BOARD_TEVII_S470: case CX23885_BOARD_HAUPPAUGE_HVR1250: - if (dev->sd_ir && (dev->pci_irqmask & PCI_MSK_AV_CORE)) - cx_set(PCI_INT_MSK, PCI_MSK_AV_CORE); + if (dev->sd_ir) + cx23885_irq_add_enable(dev, PCI_MSK_AV_CORE); break; } } diff --git a/drivers/media/video/cx23885/cx23885-core.c b/drivers/media/video/cx23885/cx23885-core.c index 93e7afb..0765abf 100644 --- a/drivers/media/video/cx23885/cx23885-core.c +++ b/drivers/media/video/cx23885/cx23885-core.c @@ -299,6 +299,83 @@ static struct sram_channel cx23887_sram_channels[] = { }, }; +void cx23885_irq_add(struct cx23885_dev *dev, u32 mask) +{ + unsigned long flags; + spin_lock_irqsave(&dev->pci_irqmask_lock, flags); + + dev->pci_irqmask |= mask; + + spin_unlock_irqrestore(&dev->pci_irqmask_lock, flags); +} + +void cx23885_irq_add_enable(struct cx23885_dev *dev, u32 mask) +{ + unsigned long flags; + spin_lock_irqsave(&dev->pci_irqmask_lock, flags)