LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] cyclades: Prepare for relaxed locking in callers
@ 2008-02-20 20:12 Alan Cox
  2008-02-20 21:22 ` John Stoffel
  0 siblings, 1 reply; 4+ messages in thread
From: Alan Cox @ 2008-02-20 20:12 UTC (permalink / raw)
  To: akpm, linux-kernel

Basically wrap it in lock_kernel where it is hard to prove the locking is
ok. 

Signed-off-by: Alan Cox <alan@redhat.com>

diff -u --new-file --recursive --exclude-from /usr/src/exclude linux.vanilla-2.6.25-rc2-mm1/drivers/char/cyclades.c linux-2.6.25-rc2-mm1/drivers/char/cyclades.c
--- linux.vanilla-2.6.25-rc2-mm1/drivers/char/cyclades.c	2008-02-19 11:01:43.000000000 +0000
+++ linux-2.6.25-rc2-mm1/drivers/char/cyclades.c	2008-02-20 11:45:28.000000000 +0000
@@ -3464,6 +3464,8 @@
 	if (serial_paranoia_check(info, tty->name, __FUNCTION__))
 		return -ENODEV;
 
+	lock_kernel();
+	
 	card = info->card;
 	channel = info->line - card->first_line;
 	if (!IS_CYC_Z(*card)) {
@@ -3506,10 +3508,12 @@
 				((lstatus & C_RS_CTS) ? TIOCM_CTS : 0);
 		} else {
 			result = 0;
+			unlock_kernel();
 			return -ENODEV;
 		}
 
 	}
+	unlock_kernel();
 	return result;
 }				/* cy_tiomget */
 
@@ -3880,6 +3884,7 @@
 	printk(KERN_DEBUG "cyc:cy_ioctl ttyC%d, cmd = %x arg = %lx\n",
 		info->line, cmd, arg);
 #endif
+	lock_kernel();
 
 	switch (cmd) {
 	case CYGETMON:
@@ -3988,47 +3993,47 @@
 		p_cuser = argp;
 		ret_val = put_user(cnow.cts, &p_cuser->cts);
 		if (ret_val)
-			return ret_val;
+			break;
 		ret_val = put_user(cnow.dsr, &p_cuser->dsr);
 		if (ret_val)
-			return ret_val;
+			break;
 		ret_val = put_user(cnow.rng, &p_cuser->rng);
 		if (ret_val)
-			return ret_val;
+			break;
 		ret_val = put_user(cnow.dcd, &p_cuser->dcd);
 		if (ret_val)
-			return ret_val;
+			break;
 		ret_val = put_user(cnow.rx, &p_cuser->rx);
 		if (ret_val)
-			return ret_val;
+			break;
 		ret_val = put_user(cnow.tx, &p_cuser->tx);
 		if (ret_val)
-			return ret_val;
+			break;
 		ret_val = put_user(cnow.frame, &p_cuser->frame);
 		if (ret_val)
-			return ret_val;
+			break;
 		ret_val = put_user(cnow.overrun, &p_cuser->overrun);
 		if (ret_val)
-			return ret_val;
+			break;
 		ret_val = put_user(cnow.parity, &p_cuser->parity);
 		if (ret_val)
-			return ret_val;
+			break;
 		ret_val = put_user(cnow.brk, &p_cuser->brk);
 		if (ret_val)
-			return ret_val;
+			break;
 		ret_val = put_user(cnow.buf_overrun, &p_cuser->buf_overrun);
 		if (ret_val)
-			return ret_val;
+			break;
 		ret_val = 0;
 		break;
 	default:
 		ret_val = -ENOIOCTLCMD;
 	}
+	unlock_kernel();
 
 #ifdef CY_DEBUG_OTHER
 	printk(KERN_DEBUG "cyc:cy_ioctl done\n");
 #endif
-
 	return ret_val;
 }				/* cy_ioctl */
 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] cyclades: Prepare for relaxed locking in callers
  2008-02-20 20:12 [PATCH] cyclades: Prepare for relaxed locking in callers Alan Cox
@ 2008-02-20 21:22 ` John Stoffel
  2008-02-20 21:48   ` Alan Cox
  0 siblings, 1 reply; 4+ messages in thread
From: John Stoffel @ 2008-02-20 21:22 UTC (permalink / raw)
  To: Alan Cox; +Cc: akpm, linux-kernel


Alan> Basically wrap it in lock_kernel where it is hard to prove the
Alan> locking is ok.

I've got cyclades cards, both ISA and Serial.  Do you want/need any
specific tests?  Or should I just send you (or your deputy) the ISA
card for your collection?

John

Alan> Signed-off-by: Alan Cox <alan@redhat.com>

Alan> diff -u --new-file --recursive --exclude-from /usr/src/exclude linux.vanilla-2.6.25-rc2-mm1/drivers/char/cyclades.c linux-2.6.25-rc2-mm1/drivers/char/cyclades.c
Alan> --- linux.vanilla-2.6.25-rc2-mm1/drivers/char/cyclades.c	2008-02-19 11:01:43.000000000 +0000
Alan> +++ linux-2.6.25-rc2-mm1/drivers/char/cyclades.c	2008-02-20 11:45:28.000000000 +0000
Alan> @@ -3464,6 +3464,8 @@
Alan>  	if (serial_paranoia_check(info, tty->name, __FUNCTION__))
Alan>  		return -ENODEV;
 
Alan> +	lock_kernel();
Alan> +	
Alan>  	card = info->card;
Alan>  	channel = info->line - card->first_line;
Alan>  	if (!IS_CYC_Z(*card)) {
Alan> @@ -3506,10 +3508,12 @@
Alan>  				((lstatus & C_RS_CTS) ? TIOCM_CTS : 0);
Alan>  		} else {
Alan>  			result = 0;
Alan> +			unlock_kernel();
Alan>  			return -ENODEV;
Alan>  		}
 
Alan>  	}
Alan> +	unlock_kernel();
Alan>  	return result;
Alan>  }				/* cy_tiomget */
 
Alan> @@ -3880,6 +3884,7 @@
Alan>  	printk(KERN_DEBUG "cyc:cy_ioctl ttyC%d, cmd = %x arg = %lx\n",
info-> line, cmd, arg);
Alan>  #endif
Alan> +	lock_kernel();
 
Alan>  	switch (cmd) {
Alan>  	case CYGETMON:
Alan> @@ -3988,47 +3993,47 @@
Alan>  		p_cuser = argp;
Alan>  		ret_val = put_user(cnow.cts, &p_cuser->cts);
Alan>  		if (ret_val)
Alan> -			return ret_val;
Alan> +			break;
Alan>  		ret_val = put_user(cnow.dsr, &p_cuser->dsr);
Alan>  		if (ret_val)
Alan> -			return ret_val;
Alan> +			break;
Alan>  		ret_val = put_user(cnow.rng, &p_cuser->rng);
Alan>  		if (ret_val)
Alan> -			return ret_val;
Alan> +			break;
Alan>  		ret_val = put_user(cnow.dcd, &p_cuser->dcd);
Alan>  		if (ret_val)
Alan> -			return ret_val;
Alan> +			break;
Alan>  		ret_val = put_user(cnow.rx, &p_cuser->rx);
Alan>  		if (ret_val)
Alan> -			return ret_val;
Alan> +			break;
Alan>  		ret_val = put_user(cnow.tx, &p_cuser->tx);
Alan>  		if (ret_val)
Alan> -			return ret_val;
Alan> +			break;
Alan>  		ret_val = put_user(cnow.frame, &p_cuser->frame);
Alan>  		if (ret_val)
Alan> -			return ret_val;
Alan> +			break;
Alan>  		ret_val = put_user(cnow.overrun, &p_cuser->overrun);
Alan>  		if (ret_val)
Alan> -			return ret_val;
Alan> +			break;
Alan>  		ret_val = put_user(cnow.parity, &p_cuser->parity);
Alan>  		if (ret_val)
Alan> -			return ret_val;
Alan> +			break;
Alan>  		ret_val = put_user(cnow.brk, &p_cuser->brk);
Alan>  		if (ret_val)
Alan> -			return ret_val;
Alan> +			break;
Alan>  		ret_val = put_user(cnow.buf_overrun, &p_cuser->buf_overrun);
Alan>  		if (ret_val)
Alan> -			return ret_val;
Alan> +			break;
Alan>  		ret_val = 0;
Alan>  		break;
Alan>  	default:
Alan>  		ret_val = -ENOIOCTLCMD;
Alan>  	}
Alan> +	unlock_kernel();
 
Alan>  #ifdef CY_DEBUG_OTHER
Alan>  	printk(KERN_DEBUG "cyc:cy_ioctl done\n");
Alan>  #endif
Alan> -
Alan>  	return ret_val;
Alan>  }				/* cy_ioctl */
 
Alan> --
Alan> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
Alan> the body of a message to majordomo@vger.kernel.org
Alan> More majordomo info at  http://vger.kernel.org/majordomo-info.html
Alan> Please read the FAQ at  http://www.tux.org/lkml/


Alan> !DSPAM:47bc8c2521682037060298!

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] cyclades: Prepare for relaxed locking in callers
  2008-02-20 21:22 ` John Stoffel
@ 2008-02-20 21:48   ` Alan Cox
  2008-02-20 22:00     ` John Stoffel
  0 siblings, 1 reply; 4+ messages in thread
From: Alan Cox @ 2008-02-20 21:48 UTC (permalink / raw)
  To: John Stoffel; +Cc: akpm, linux-kernel

On Wed, 20 Feb 2008 16:22:29 -0500
"John Stoffel" <john@stoffel.org> wrote:

> 
> Alan> Basically wrap it in lock_kernel where it is hard to prove the
> Alan> locking is ok.
> 
> I've got cyclades cards, both ISA and Serial.  Do you want/need any
> specific tests?  Or should I just send you (or your deputy) the ISA
> card for your collection?

At the moment its fairly tricky to test unless you want to hack your tree
up further. The patch prepares for stuff that I've not yet sent Andrew. I
want to make sure we haven't broken anything before sending the small
patches to fire it all up.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] cyclades: Prepare for relaxed locking in callers
  2008-02-20 21:48   ` Alan Cox
@ 2008-02-20 22:00     ` John Stoffel
  0 siblings, 0 replies; 4+ messages in thread
From: John Stoffel @ 2008-02-20 22:00 UTC (permalink / raw)
  To: Alan Cox; +Cc: John Stoffel, akpm, linux-kernel

>>>>> "Alan" == Alan Cox <alan@lxorguk.ukuu.org.uk> writes:

Alan> On Wed, 20 Feb 2008 16:22:29 -0500
Alan> "John Stoffel" <john@stoffel.org> wrote:

>> 
Alan> Basically wrap it in lock_kernel where it is hard to prove the
Alan> locking is ok.
>> 
>> I've got cyclades cards, both ISA and Serial.  Do you want/need any
>> specific tests?  Or should I just send you (or your deputy) the ISA
>> card for your collection?

Alan> At the moment its fairly tricky to test unless you want to hack
Alan> your tree up further. The patch prepares for stuff that I've not
Alan> yet sent Andrew. I want to make sure we haven't broken anything
Alan> before sending the small patches to fire it all up.

Ok, please feel free to keep me in mind for testing. I've still got
ISA box(en) here up and running and being used.  As well as my
Cyclom-Y PCI card in actual use still.

John


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-02-20 22:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-20 20:12 [PATCH] cyclades: Prepare for relaxed locking in callers Alan Cox
2008-02-20 21:22 ` John Stoffel
2008-02-20 21:48   ` Alan Cox
2008-02-20 22:00     ` John Stoffel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).