Re: [PATCH] CRISv10 serial driver rewrite

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 ([email protected])
> Faculty of Informatics, Masaryk University

Thanks for all the comments!

/^JN - Jesper Nilsson
--
               Jesper Nilsson -- [email protected]
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux