public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Russell King <rmk+lkml@arm.linux.org.uk>
To: David Vrabel <dvrabel@cantab.net>
Cc: Pavel Machek <pavel@suse.cz>,
	rpurdie@rpsys.net, lenz@cs.wisc.edu,
	kernel list <linux-kernel@vger.kernel.org>
Subject: Re: ucb1x00 audio & zaurus touchscreen
Date: Thu, 23 Mar 2006 15:44:56 +0000	[thread overview]
Message-ID: <20060323154456.GB25849@flint.arm.linux.org.uk> (raw)
In-Reply-To: <4422B370.8010606@cantab.net>

On Thu, Mar 23, 2006 at 02:40:48PM +0000, David Vrabel wrote:
> @@ -58,9 +65,9 @@
>  	spin_lock_irqsave(&ucb->io_lock, flags);
>  	ucb->io_dir |= out;
>  	ucb->io_dir &= ~in;
> +	spin_unlock_irqrestore(&ucb->io_lock, flags);
>  
>  	ucb1x00_reg_write(ucb, UCB_IO_DIR, ucb->io_dir);
> -	spin_unlock_irqrestore(&ucb->io_lock, flags);

Racy.

> @@ -86,9 +93,9 @@
>  	spin_lock_irqsave(&ucb->io_lock, flags);
>  	ucb->io_out |= set;
>  	ucb->io_out &= ~clear;
> +	spin_unlock_irqrestore(&ucb->io_lock, flags);
>  
>  	ucb1x00_reg_write(ucb, UCB_IO_DATA, ucb->io_out);
> -	spin_unlock_irqrestore(&ucb->io_lock, flags);

Racy.

> @@ -301,22 +305,23 @@
>   */
>  void ucb1x00_disable_irq(struct ucb1x00 *ucb, unsigned int idx, int edges)
>  {
> -	unsigned long flags;
> -
>  	if (idx < 16) {
> -		spin_lock_irqsave(&ucb->lock, flags);
> -
> -		ucb1x00_enable(ucb);
> -		if (edges & UCB_RISING) {
> +		down(&ucb->lock);
> +		/* This can't be right. Can it? */
> +		if (edges & UCB_RISING)
> +			ucb->irq_ris_enbl |= 1 << idx;
> +		if (edges & UCB_FALLING)
> +			ucb->irq_fal_enbl |= 1 << idx;
> +		if (edges & UCB_RISING)
>  			ucb->irq_ris_enbl &= ~(1 << idx);
> -			ucb1x00_reg_write(ucb, UCB_IE_RIS, ucb->irq_ris_enbl);
> -		}
> -		if (edges & UCB_FALLING) {
> +		if (edges & UCB_FALLING)
>  			ucb->irq_fal_enbl &= ~(1 << idx);
> -			ucb1x00_reg_write(ucb, UCB_IE_FAL, ucb->irq_fal_enbl);
> -		}
> +		up(&ucb->lock);
> +
> +		ucb1x00_enable(ucb);
> +		ucb1x00_reg_write(ucb, UCB_IE_RIS, ucb->irq_ris_enbl);
> +		ucb1x00_reg_write(ucb, UCB_IE_FAL, ucb->irq_fal_enbl);

Racy.

I'm very much of the opinion that while UCB1400 may appear to be vaguely
register compatible with the UCB1200 and UCB1300 devices, it has
sufficiently different requirements which make any attempt at merging
drivers for both devices either racy or hard to read with additional
unnecessary complexity for the 1200 and 1300 devices.

Hence why I've been very reluctant to consider putting the UCB1400
stuff in - because it changes the existing UCB1x00 code in ways I just
don't like.

-- 
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 Serial core

      reply	other threads:[~2006-03-23 15:45 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-22 12:20 ucb1x00 audio & zaurus touchscreen Pavel Machek
2006-03-22 13:53 ` Russell King
2006-03-22 14:11   ` Pavel Machek
2006-03-22 15:21   ` Richard Purdie
2006-03-22 20:10 ` David Vrabel
2006-03-23 14:40 ` David Vrabel
2006-03-23 15:44   ` Russell King [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=20060323154456.GB25849@flint.arm.linux.org.uk \
    --to=rmk+lkml@arm.linux.org.uk \
    --cc=dvrabel@cantab.net \
    --cc=lenz@cs.wisc.edu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pavel@suse.cz \
    --cc=rpurdie@rpsys.net \
    /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