public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jesper Nilsson <jesper.nilsson@axis.com>
To: Jiri Slaby <jirislaby@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Mikael Starvik <mikael.starvik@axis.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] CRISv10 serial driver rewrite
Date: Mon, 5 Nov 2007 12:18:39 +0100	[thread overview]
Message-ID: <20071105111839.GI7621@axis.com> (raw)
In-Reply-To: <472AFE4D.5030308@gmail.com>

On Fri, Nov 02, 2007 at 11:39:09AM +0100, Jiri Slaby wrote:
> On 11/02/2007 10:34 AM, Jesper Nilsson wrote:
> > @@ -4434,7 +3941,7 @@ block_til_ready(struct tty_struct *tty, struct file * filp,
> >  	if (tty_hung_up_p(filp) ||
> >  	    (info->flags & ASYNC_CLOSING)) {
> >  		if (info->flags & ASYNC_CLOSING)
> > -			interruptible_sleep_on(&info->close_wait);
> > +			wait_event_interruptible(info->close_wait, 0);
> 
> Aiee, this is nonsense, 0 will never be 1, only signal will stop this, use
> completion instead.

True, I've changed it to use "!info->flags & ASYNC_CLOSING" condition
for now, as this is a more non-intrusive patch.
I will look at using completion later, at the same time as using
spinlocks instead of volatiles.

> You maybe want to create a function for this deinit invoked from
> more places in the new code.

Good idea, I've done that too for the new patch.

> >  static int __init
> > @@ -4812,7 +4418,26 @@ rs_init(void)
> >  #if !defined(CONFIG_ETRAX_SERIAL_FAST_TIMER)
> >  	init_timer(&flush_timer);
> >  	flush_timer.function = timed_flush_handler;
> 
> Side note, this should be setup_timer without accessing .function.

Also excellent point, have done so.

> > -	if (request_irq(SERIAL_IRQ_NBR, ser_interrupt, IRQF_SHARED | IRQF_DISABLED, "serial ", NULL))
> > -		panic("irq8");
> > +	if (request_irq(SERIAL_IRQ_NBR, ser_interrupt,
> > +			IRQF_SHARED | IRQF_DISABLED, "serial ", driver))
> > +		panic("%s: Failed to request irq8", __FUNCTION__);
> 
> Is the panic needed here? Can't the cris architecture live without the driver?

There are some differing opinions on that here, it should probably not
reach this unless there is a configuration error, and so it more like
a debug-help. I'll put this on the "to clarify" list.

> > +	u8 dma_out_enabled:1;	/* Set to 1 if DMA should be used */
> > +	u8 dma_in_enabled:1;	/* Set to 1 if DMA should be used */
> 
> bitfileds generate ugly code.

Agreed, I've changed them to u8 instead. The space saving is
not worth the aggravation.

> > +	volatile int		tr_running; /* 1 if output is running */
> 
> What's the volatile for here? atomic_t?

The driver uses old volatile style synchronization. Changing over
to spinlocks is like I mentioned on my todo-list.

> > +#ifdef DECLARE_WAITQUEUE
> > +	wait_queue_head_t	open_wait;
> > +	wait_queue_head_t	close_wait;
> > +#else
> > +	struct wait_queue	*open_wait;
> > +	struct wait_queue	*close_wait;
> > +#endif
> 
> We know, we have it, don't we?

True, old compatibility code, removed in the new patch.

> Jiri Slaby (jirislaby@gmail.com)
> Faculty of Informatics, Masaryk University

Thanks for all the comments!

/^JN - Jesper Nilsson
--
               Jesper Nilsson -- jesper.nilsson@axis.com

  reply	other threads:[~2007-11-05 11:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-02  9:34 [PATCH] CRISv10 serial driver rewrite Jesper Nilsson
2007-11-02 10:39 ` Jiri Slaby
2007-11-05 11:18   ` Jesper Nilsson [this message]
2007-11-05 11:24     ` Jiri Slaby

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=20071105111839.GI7621@axis.com \
    --to=jesper.nilsson@axis.com \
    --cc=akpm@linux-foundation.org \
    --cc=jirislaby@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mikael.starvik@axis.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