mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@osdl.org>
To: stephen@streetfiresound.com
Cc: linux-kernel@vger.kernel.org, dvrabel@arcom.com,
	david-b@pacbell.net, spi-devel-general@lists.sourceforge.net,
	nico@cam.org
Subject: Re: [PATCH] spi: Updated PXA2xx SSP SPI Driver
Date: Fri, 10 Feb 2006 15:49:28 -0800	[thread overview]
Message-ID: <20060210154928.583db9e2.akpm@osdl.org> (raw)
In-Reply-To: <1139612861.30189.126.camel@ststephen.streetfiresound.com>

Stephen Street <stephen@streetfiresound.com> wrote:
>
> ...
> > > +		unmap_dma_buffers(drv_data);
> > > +
> > > +		/* Calculate number of trailing bytes, read them */
> > > +		trailing_sssr = SSP_REG(sssr);
> > > +		if ((trailing_sssr & 0xf008) != 0xf000) {
> > > +			drv_data->rx = drv_data->rx_end -
> > > +					(((trailing_sssr >> 12) & 0x0f) + 1);
> > > +			drv_data->read(drv_data);
> > > +		}
> > > +		msg->actual_length += drv_data->len;
> > > +
> > > +		/* Release chip select if requested, transfer delays are
> > > +		 * handled in pump_transfers */
> > > +		if (drv_data->cs_change)
> > > +			drv_data->cs_control(PXA2XX_CS_DEASSERT);
> > > +
> > > +		/* Move to next transfer */
> > > +		msg->state = next_transfer(drv_data);
> > > +
> > > +		/* Schedule transfer tasklet */
> > > +		tasklet_schedule(&drv_data->pump_transfers);
> > > +
> > > +		return IRQ_HANDLED;
> > > +	}
> > > +
> > > +	/* Never Fail */
> > 
> > WARN_ON(1)?
> > 
> > Why not return IRQ_NONE here?  That way, the IRQ system will save the
> > machine if the IRQ gets stuck.
> > 
> In my generally confused state I decided that if the IRQ handler ran
> then by definition I handled the interrupt. But thats probably not
> right.  Will change.

Yes, IRQ_NONE means "I don't have a clue why this IRQ handler was called -
none of my device registers indicate that anything needs servicing".

The core kernel IRQ handling will see that as a signal that perhaps the
hardware is busted and ultimately it will disable the entire IRQ line so
the machine can continue to struggle along.

> > This all looks very non-64-bit-capable.
> Just the null_dma_buf issue or something more?

Well, yes, that expression.  Generally if you get all the types right and
avoid typecasting, the compiler will shout at you about 64-bit-brokenness.

> > > +#ifdef CONFIG_PM
> > > +static int stall_queue(struct driver_data *drv_data)
> > > +{
> > > +	unsigned long flags;
> > > +	unsigned limit = 500;
> > > +
> > > +	spin_lock_irqsave(&drv_data->lock, flags);
> > > +
> > > +	drv_data->run = QUEUE_STALLED;
> > > +
> > > +	while (drv_data->busy && limit--) {
> > > +		spin_unlock_irqrestore(&drv_data->lock, flags);
> > > +		msleep(10);
> > > +		spin_lock_irqsave(&drv_data->lock, flags);
> > > +	}
> > 
> > That looks a bit lame.  What's happening here?
> Sort of dumb, I agree.  I interpreted PM_EVENT_FREEZE to mean that I
> should stop processing the internal message queue but leave the queue
> intact so that it can be restarted. "stall_queue" does this by setting
> the run flag to QUEUE_STALLED (checked in pump_messages) and waiting for
> the busy to indicate the idle state.  I considered using an wait_queue
> but this seemed to much for to little.  Would you prefer a wait_queue?
> 

I guess a waitqueue would be nicer.  I don't recall seeing drivers doing
anything really fancy like this in response to a suspend request though. 


  reply	other threads:[~2006-02-10 23:50 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-07  3:06 [PATCH] spi: Add " stephen
2006-02-07  4:22 ` [PATCH] pxa2xx_spi, board support for Lubbock David Brownell
2006-02-07 11:50 ` [PATCH] spi: Add PXA2xx SSP SPI Driver David Vrabel
2006-02-07 15:05   ` David Vrabel
2006-02-07 21:27     ` Stephen Street
2006-02-07 21:17   ` Stephen Street
2006-02-10  1:38 ` [PATCH] spi: Updated " Stephen Street
2006-02-10  2:18   ` Andrew Morton
2006-02-10 23:07     ` Stephen Street
2006-02-10 23:49       ` Andrew Morton [this message]
2006-02-10 17:40   ` Nicolas Pitre
2006-02-10 22:19     ` Stephen Street
2006-02-10 22:45       ` Nicolas Pitre
2006-02-10 23:22         ` Stephen Street
2006-02-14  1:35   ` [PATCH] spi: Code Review " Stephen Street

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=20060210154928.583db9e2.akpm@osdl.org \
    --to=akpm@osdl.org \
    --cc=david-b@pacbell.net \
    --cc=dvrabel@arcom.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nico@cam.org \
    --cc=spi-devel-general@lists.sourceforge.net \
    --cc=stephen@streetfiresound.com \
    /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

Powered by JetHome