Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: tglx@linutronix.de (Thomas Gleixner)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v7 1/1] PRUSS UIO driver support
Date: Tue, 1 Mar 2011 22:45:25 +0100 (CET)	[thread overview]
Message-ID: <alpine.LFD.2.00.1103012238360.2701@localhost6.localdomain6> (raw)
In-Reply-To: <1299014895-2022-2-git-send-email-pratheesh@ti.com>

On Wed, 2 Mar 2011, Pratheesh Gangadhar wrote:
> +
> +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 *info)
> +{
> +	int intr_bit = (irq - IRQ_DA8XX_EVTOUT0 + 2);
> +	int val, intr_mask = (1 << intr_bit);
> +	void __iomem *base = info->mem[0].internal_addr;
> +	void __iomem *intren_reg = base + PINTC_HIER;
> +	void __iomem *intrstat_reg = base + PINTC_HIPIR + (intr_bit << 2);
> +
> +	spin_lock_irq(&lock);

No, I said: spin_lock() is sufficient.

> +	val = ioread32(intren_reg);
> +	/* Is interrupt enabled and active ? */
> +	if (!(val & intr_mask) && (ioread32(intrstat_reg) & HIPIR_NOPEND)) {
> +		spin_unlock_irq(&lock);

You unconditinally enable interrupts here where you are not supposed
to do so.

> +		return IRQ_NONE;
> +	}
> +
> +	/* Disable interrupt */
> +	iowrite32((val & ~intr_mask), intren_reg);
> +	spin_unlock_irq(&lock);
> +	return IRQ_HANDLED;
> +}
> +
> +static int pruss_irqcontrol(struct uio_info *info, s32 irq_on)
> +{
> +	int intr_bit = info->irq - IRQ_DA8XX_EVTOUT0 + 2;
> +	int val, intr_mask = (1 << intr_bit);
> +	void __iomem *base = info->mem[0].internal_addr;
> +	void __iomem *intren_reg = base + PINTC_HIER;
> +
> +	spin_lock_irq(&lock);

This one is correct, as this is always called from non interrupt
disabled context.

> +	val = ioread32(intren_reg);
> +	if (irq_on)
> +		iowrite32((val | intr_mask), intren_reg);
> +	else
> +		iowrite32((val & ~intr_mask), intren_reg);
> +	spin_unlock_irq(&lock);
> +
> +	return 0;
> +}


> +
> +	spin_lock_init(&lock);

Sigh. DEFINE_SPINLOCK(lock); already initializes the lock.

It's not the purpose of a review to tell you what you need to change
mechanically. Reviewers hint to a correct solution and you are
supposed to lookup what that solution means and act accordingly. If
you do not understand the hint or its implications please ask _before_
sending a new patch set.

Thanks,

	tglx

  reply	other threads:[~2011-03-01 21:45 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-01 21:28 [PATCH v7 0/1] Add PRUSS UIO driver support Pratheesh Gangadhar
2011-03-01 21:28 ` [PATCH v7 1/1] " Pratheesh Gangadhar
2011-03-01 21:45   ` Thomas Gleixner [this message]
2011-03-01 22:22     ` Hans J. Koch
2011-03-02  8:47     ` TK, Pratheesh Gangadhar
2011-03-02  9:27       ` Thomas Gleixner

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.1103012238360.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