From: tglx@linutronix.de (Thomas Gleixner)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v6 1/1] PRUSS UIO driver support
Date: Tue, 1 Mar 2011 10:51:43 +0100 (CET) [thread overview]
Message-ID: <alpine.LFD.2.00.1103011045340.2701@localhost6.localdomain6> (raw)
In-Reply-To: <1298926895-5294-2-git-send-email-pratheesh@ti.com>
On Tue, 1 Mar 2011, Pratheesh Gangadhar wrote:
> +
> +static spinlock_t lock;
static DEFINE_SPINLOCK(lock);
> +static struct clk *pruss_clk;
> +static struct uio_info *info;
> +static dma_addr_t sram_paddr, ddr_paddr;
> +static void *prussio_vaddr, *sram_vaddr, *ddr_vaddr;
> +
> +static irqreturn_t pruss_handler(int irq, struct uio_info *dev_info)
> +{
> + unsigned long flags;
> + int val, intr_mask = (1 << (irq - 1));
> + void __iomem *base = dev_info->mem[0].internal_addr;
> + void __iomem *intren_reg = base + PINTC_HIER;
> + void __iomem *intrstat_reg = base + PINTC_HIPIR + ((irq - 1) << 2);
> +
> + spin_lock_irqsave(&lock, flags);
spin_lock() is enough as we run handlers with interrupts disabled.
> + val = ioread32(intren_reg);
> + /* Is interrupt enabled and active ? */
> + if (!(val & intr_mask) && (ioread32(intrstat_reg) & HIPIR_NOPEND)) {
> + spin_unlock_irqrestore(&lock, flags);
> + return IRQ_NONE;
> + }
> +
> + /* Disable interrupt */
> + iowrite32((val & ~intr_mask), intren_reg);
> + spin_unlock_irqrestore(&lock, flags);
> + return IRQ_HANDLED;
> +}
So now you still have not solved the problem of user space enabling an
interrupt again. That's racy as well and you can solve it by providing
an uio->irq_control function which handles the interrupt enable
register under the lock as well.
Thanks,
tglx
prev parent reply other threads:[~2011-03-01 9:51 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-28 21:01 [PATCH v6 0/1] Add PRUSS UIO driver support Pratheesh Gangadhar
2011-02-28 21:01 ` [PATCH v6 1/1] " Pratheesh Gangadhar
2011-02-28 21:26 ` Hans J. Koch
2011-03-01 4:45 ` TK, Pratheesh Gangadhar
2011-03-01 9:53 ` Thomas Gleixner
2011-03-01 18:33 ` Hans J. Koch
2011-03-01 21:19 ` TK, Pratheesh Gangadhar
2011-03-01 21:38 ` Thomas Gleixner
2011-03-01 9:51 ` Thomas Gleixner [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.LFD.2.00.1103011045340.2701@localhost6.localdomain6 \
--to=tglx@linutronix.de \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox