mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [2.6 patch] mark virt_to_bus/bus_to_virt as __deprecated on i386
@ 2006-06-26 15:10 Adrian Bunk
  2006-06-26 15:38 ` Dave Jones
  2006-06-26 15:48 ` Alan Cox
  0 siblings, 2 replies; 13+ messages in thread
From: Adrian Bunk @ 2006-06-26 15:10 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel

virt_to_bus/bus_to_virt are long deprecated, mark them as __deprecated 
on i386.

Without such warnings people will never update their code and fix 
the errors in PPC64 builds.

And yes, some of the drivers affected are maintained.

This also ctches accidential additions of users for these functions like 
a usage of bus_to_virt() in the infiniband code that was added in 
2.6.17-rc1 (already removed).

This patch increases the number of warnings shown during builds, but it 
seems worth including it at least in -mm for making people aware of this 
issue.

Signed-off-by: Adrian Bunk <bunk@stusta.de>

---

This patch was already sent on:
- 27 Apr 2006
- 19 Apr 2006
- 6 Jan 2006
- 13 Dec 2005
- 23 Nov 2005
- 18 Nov 2005
- 12 Nov 2005

--- linux-2.6.14-mm2-full/include/asm-i386/io.h.old	2005-11-12 01:44:38.000000000 +0100
+++ linux-2.6.14-mm2-full/include/asm-i386/io.h	2005-11-12 01:45:58.000000000 +0100
@@ -144,8 +144,14 @@
  *
  * Allow them on x86 for legacy drivers, though.
  */
-#define virt_to_bus virt_to_phys
-#define bus_to_virt phys_to_virt
+static inline unsigned long __deprecated virt_to_bus(volatile void * address)
+{
+	return __pa(address);
+}
+static inline void * __deprecated bus_to_virt(unsigned long address)
+{
+	return __va(address);
+}
 
 /*
  * readX/writeX() are used to access memory mapped devices. On some


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

* Re: [2.6 patch] mark virt_to_bus/bus_to_virt as __deprecated on i386
  2006-06-26 15:10 [2.6 patch] mark virt_to_bus/bus_to_virt as __deprecated on i386 Adrian Bunk
@ 2006-06-26 15:38 ` Dave Jones
  2006-06-26 15:46   ` Arjan van de Ven
  2006-06-26 16:14   ` Adrian Bunk
  2006-06-26 15:48 ` Alan Cox
  1 sibling, 2 replies; 13+ messages in thread
From: Dave Jones @ 2006-06-26 15:38 UTC (permalink / raw)
  To: Adrian Bunk; +Cc: Andrew Morton, linux-kernel

On Mon, Jun 26, 2006 at 05:10:12PM +0200, Adrian Bunk wrote:
 > virt_to_bus/bus_to_virt are long deprecated, mark them as __deprecated 
 > on i386.
 > 
 > Without such warnings people will never update their code and fix 
 > the errors in PPC64 builds.

.. and deprecating pm_send_all, cli, sti, restore_flags, check_region yadayada
has really been a great success at motivating people to fix those up too.

How about we fix up some of the existing noise before we add more?
A build log of a fedora kernel I had handy shows 165 deprecated warnings
that have been there forever.  Your proposal will add over 500 warnings
in drivers/ alone.

		Dave

-- 
http://www.codemonkey.org.uk

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

* Re: [2.6 patch] mark virt_to_bus/bus_to_virt as __deprecated on i386
  2006-06-26 15:38 ` Dave Jones
@ 2006-06-26 15:46   ` Arjan van de Ven
  2006-06-26 15:54     ` Dave Jones
  2006-06-26 16:14   ` Adrian Bunk
  1 sibling, 1 reply; 13+ messages in thread
From: Arjan van de Ven @ 2006-06-26 15:46 UTC (permalink / raw)
  To: Dave Jones; +Cc: Adrian Bunk, Andrew Morton, linux-kernel

On Mon, 2006-06-26 at 11:38 -0400, Dave Jones wrote:
> On Mon, Jun 26, 2006 at 05:10:12PM +0200, Adrian Bunk wrote:
>  > virt_to_bus/bus_to_virt are long deprecated, mark them as __deprecated 
>  > on i386.
>  > 
>  > Without such warnings people will never update their code and fix 
>  > the errors in PPC64 builds.
> 
> .. and deprecating pm_send_all, cli, sti, restore_flags, check_region yadayada
> has really been a great success at motivating people to fix those up too.

cli/sti should just be removed, or at least have those drivers marked
BROKEN... nobody is apparently using them anyway...


Maybe depreciation needs to go together with a "will mark users broken
in X days, and will remove entirely in X+Y days".. and then stick to
it. 


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

* Re: [2.6 patch] mark virt_to_bus/bus_to_virt as __deprecated on i386
  2006-06-26 15:10 [2.6 patch] mark virt_to_bus/bus_to_virt as __deprecated on i386 Adrian Bunk
  2006-06-26 15:38 ` Dave Jones
@ 2006-06-26 15:48 ` Alan Cox
  1 sibling, 0 replies; 13+ messages in thread
From: Alan Cox @ 2006-06-26 15:48 UTC (permalink / raw)
  To: Adrian Bunk; +Cc: Andrew Morton, linux-kernel

Ar Llu, 2006-06-26 am 17:10 +0200, ysgrifennodd Adrian Bunk:
> virt_to_bus/bus_to_virt are long deprecated, mark them as __deprecated 
> on i386.
> 
> Without such warnings people will never update their code and fix 
> the errors in PPC64 builds.

Most of the uses of virt_to_bus/bus_to_virt are hardware that isn't even
available on obscure platforms like PPC64. Would still be good to get
these in and nailed.



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

* Re: [2.6 patch] mark virt_to_bus/bus_to_virt as __deprecated on i386
  2006-06-26 15:46   ` Arjan van de Ven
@ 2006-06-26 15:54     ` Dave Jones
  2006-06-27 14:27       ` Jan Engelhardt
  0 siblings, 1 reply; 13+ messages in thread
From: Dave Jones @ 2006-06-26 15:54 UTC (permalink / raw)
  To: Arjan van de Ven; +Cc: Adrian Bunk, Andrew Morton, linux-kernel

On Mon, Jun 26, 2006 at 05:46:55PM +0200, Arjan van de Ven wrote:
 > On Mon, 2006-06-26 at 11:38 -0400, Dave Jones wrote:
 > > On Mon, Jun 26, 2006 at 05:10:12PM +0200, Adrian Bunk wrote:
 > >  > virt_to_bus/bus_to_virt are long deprecated, mark them as __deprecated 
 > >  > on i386.
 > >  > 
 > >  > Without such warnings people will never update their code and fix 
 > >  > the errors in PPC64 builds.
 > > 
 > > .. and deprecating pm_send_all, cli, sti, restore_flags, check_region yadayada
 > > has really been a great success at motivating people to fix those up too.
 > 
 > cli/sti should just be removed, or at least have those drivers marked
 > BROKEN... nobody is apparently using them anyway...

Just ISDN really.

		Dave

-- 
http://www.codemonkey.org.uk

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

* Re: [2.6 patch] mark virt_to_bus/bus_to_virt as __deprecated on i386
  2006-06-26 15:38 ` Dave Jones
  2006-06-26 15:46   ` Arjan van de Ven
@ 2006-06-26 16:14   ` Adrian Bunk
  2006-06-26 16:45     ` Dave Jones
  2006-06-26 20:50     ` PATCH: stallion clean up: " Alan Cox
  1 sibling, 2 replies; 13+ messages in thread
From: Adrian Bunk @ 2006-06-26 16:14 UTC (permalink / raw)
  To: Dave Jones, Andrew Morton, linux-kernel

On Mon, Jun 26, 2006 at 11:38:35AM -0400, Dave Jones wrote:
> On Mon, Jun 26, 2006 at 05:10:12PM +0200, Adrian Bunk wrote:
>  > virt_to_bus/bus_to_virt are long deprecated, mark them as __deprecated 
>  > on i386.
>  > 
>  > Without such warnings people will never update their code and fix 
>  > the errors in PPC64 builds.
> 
> .. and deprecating pm_send_all, cli, sti, restore_flags, check_region yadayada
> has really been a great success at motivating people to fix those up too.

It has been a success, look at the numbers:

2.6.0     : 36 options depending on BROKEN_ON_SMP
2.6.17-mm2: 17 options depending on BROKEN_ON_SMP

2.6.7-mm7 : 20 drivers with warnings due to check_region
2.6.17-mm2:  3 drivers with warnings due to check_region

It's not that everything was fixed immediately, but there is definitely 
some progress.

> How about we fix up some of the existing noise before we add more?
> A build log of a fedora kernel I had handy shows 165 deprecated warnings
> that have been there forever.  Your proposal will add over 500 warnings
> in drivers/ alone.

There are few drivers generating many warnings, e.g. stallion+istallion 
alone give 138 __deprecated warnings only for cli/sti/restore_flags 
usage. Most of the code doesn't have any problems.

And my main motivation for getting virt_to_bus/bus_to_virt removed is 
the following:

If the virt_to_bus/bus_to_virt are fixed, Andrew might finally accept my 
patch to add -Werror-implicit-function-declaration to the CFLAGS (which 
he only rejected since it turned link errors into compile errors in his 
ppc64 builds). 

And -Werror-implicit-function-declaration is important since it will 
turn some nasty to debug runtime stack corruptions into compile errors.

> 		Dave

cu
Adrian

-- 

       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed


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

* Re: [2.6 patch] mark virt_to_bus/bus_to_virt as __deprecated on i386
  2006-06-26 16:14   ` Adrian Bunk
@ 2006-06-26 16:45     ` Dave Jones
  2006-06-26 20:50     ` PATCH: stallion clean up: " Alan Cox
  1 sibling, 0 replies; 13+ messages in thread
From: Dave Jones @ 2006-06-26 16:45 UTC (permalink / raw)
  To: Adrian Bunk; +Cc: Andrew Morton, linux-kernel

On Mon, Jun 26, 2006 at 06:14:11PM +0200, Adrian Bunk wrote:

 > If the virt_to_bus/bus_to_virt are fixed, Andrew might finally accept my 
 > patch to add -Werror-implicit-function-declaration to the CFLAGS (which 
 > he only rejected since it turned link errors into compile errors in his 
 > ppc64 builds). 

Indeed. That was so useful in fact that I added the same to the Fedora
kernel quite some time back.  Having a build fail in the first few minutes
is much preferable to having it fail after 15 minutes.

I've not encountered any breakage due to that for some time though.
Though perhaps Andrew had config options enabled that we disabled in
our builds.

		Dave

-- 
http://www.codemonkey.org.uk

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

* PATCH: stallion clean up: Re: [2.6 patch] mark virt_to_bus/bus_to_virt as __deprecated on i386
  2006-06-26 16:14   ` Adrian Bunk
  2006-06-26 16:45     ` Dave Jones
@ 2006-06-26 20:50     ` Alan Cox
  1 sibling, 0 replies; 13+ messages in thread
From: Alan Cox @ 2006-06-26 20:50 UTC (permalink / raw)
  To: Adrian Bunk; +Cc: Dave Jones, Andrew Morton, linux-kernel

> There are few drivers generating many warnings, e.g. stallion+istallion 
> alone give 138 __deprecated warnings only for cli/sti/restore_flags 
> usage. Most of the code doesn't have any problems.

Stallion locking is easy to fix as far as I can tell. I've left the
wake/sleep stuff for a janitor project

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

There are two locking sets involved. One locks the board mappings and the
other is the tty open/close locking. The low level code was clearly designed
to be ported to OS's with spin locks already so pretty much comes out in the
wash

--- linux.vanilla-2.6.17/drivers/char/stallion.c	2006-06-19 17:29:45.000000000 +0100
+++ linux-2.6.17/drivers/char/stallion.c	2006-06-26 21:18:04.015037064 +0100
@@ -141,15 +141,6 @@
 static struct tty_driver	*stl_serial;
 
 /*
- *	We will need to allocate a temporary write buffer for chars that
- *	come direct from user space. The problem is that a copy from user
- *	space might cause a page fault (typically on a system that is
- *	swapping!). All ports will share one buffer - since if the system
- *	is already swapping a shared buffer won't make things any worse.
- */
-static char			*stl_tmpwritebuf;
-
-/*
  *	Define a local default termios struct. All ports will be created
  *	with this termios initially. Basically all it defines is a raw port
  *	at 9600, 8 data bits, 1 stop bit.
@@ -363,6 +354,14 @@
 };
 
 /*
+ *	Lock ordering is that you may not take stallion_lock holding
+ *	brd_lock.
+ */
+ 
+static spinlock_t brd_lock; 		/* Guard the board mapping */
+static spinlock_t stallion_lock;	/* Guard the tty driver */
+
+/*
  *	Set up enable and disable macros for the ECH boards. They require
  *	the secondary io address space to be activated and deactivated.
  *	This way all ECH boards can share their secondary io region.
@@ -725,17 +724,7 @@
 
 static int __init stallion_module_init(void)
 {
-	unsigned long	flags;
-
-#ifdef DEBUG
-	printk("init_module()\n");
-#endif
-
-	save_flags(flags);
-	cli();
 	stl_init();
-	restore_flags(flags);
-
 	return 0;
 }
 
@@ -746,7 +735,6 @@
 	stlbrd_t	*brdp;
 	stlpanel_t	*panelp;
 	stlport_t	*portp;
-	unsigned long	flags;
 	int		i, j, k;
 
 #ifdef DEBUG
@@ -756,9 +744,6 @@
 	printk(KERN_INFO "Unloading %s: version %s\n", stl_drvtitle,
 		stl_drvversion);
 
-	save_flags(flags);
-	cli();
-
 /*
  *	Free up all allocated resources used by the ports. This includes
  *	memory and interrupts. As part of this process we will also do
@@ -770,7 +755,6 @@
 	if (i) {
 		printk("STALLION: failed to un-register tty driver, "
 			"errno=%d\n", -i);
-		restore_flags(flags);
 		return;
 	}
 	for (i = 0; i < 4; i++) {
@@ -783,8 +767,6 @@
 			"errno=%d\n", -i);
 	class_destroy(stallion_class);
 
-	kfree(stl_tmpwritebuf);
-
 	for (i = 0; (i < stl_nrbrds); i++) {
 		if ((brdp = stl_brds[i]) == (stlbrd_t *) NULL)
 			continue;
@@ -814,8 +796,6 @@
 		kfree(brdp);
 		stl_brds[i] = (stlbrd_t *) NULL;
 	}
-
-	restore_flags(flags);
 }
 
 module_init(stallion_module_init);
@@ -948,7 +928,7 @@
 
 	brdp = kzalloc(sizeof(stlbrd_t), GFP_KERNEL);
 	if (!brdp) {
-		printk("STALLION: failed to allocate memory (size=%d)\n",
+		printk("STALLION: failed to allocate memory (size=%Zd)\n",
 			sizeof(stlbrd_t));
 		return NULL;
 	}
@@ -1066,16 +1046,17 @@
 	rc = 0;
 	doclocal = 0;
 
+	spin_lock_irqsave(&stallion_lock, flags);
+
 	if (portp->tty->termios->c_cflag & CLOCAL)
 		doclocal++;
 
-	save_flags(flags);
-	cli();
 	portp->openwaitcnt++;
 	if (! tty_hung_up_p(filp))
 		portp->refcount--;
 
 	for (;;) {
+		/* Takes brd_lock internally */
 		stl_setsignals(portp, 1, 1);
 		if (tty_hung_up_p(filp) ||
 		    ((portp->flags & ASYNC_INITIALIZED) == 0)) {
@@ -1093,13 +1074,14 @@
 			rc = -ERESTARTSYS;
 			break;
 		}
+		/* FIXME */
 		interruptible_sleep_on(&portp->open_wait);
 	}
 
 	if (! tty_hung_up_p(filp))
 		portp->refcount++;
 	portp->openwaitcnt--;
-	restore_flags(flags);
+	spin_unlock_irqrestore(&stallion_lock, flags);
 
 	return rc;
 }
@@ -1119,16 +1101,15 @@
 	if (portp == (stlport_t *) NULL)
 		return;
 
-	save_flags(flags);
-	cli();
+	spin_lock_irqsave(&stallion_lock, flags);
 	if (tty_hung_up_p(filp)) {
-		restore_flags(flags);
+		spin_unlock_irqrestore(&stallion_lock, flags);
 		return;
 	}
 	if ((tty->count == 1) && (portp->refcount != 1))
 		portp->refcount = 1;
 	if (portp->refcount-- > 1) {
-		restore_flags(flags);
+		spin_unlock_irqrestore(&stallion_lock, flags);
 		return;
 	}
 
@@ -1142,11 +1123,18 @@
  *	(The sc26198 has no "end-of-data" interrupt only empty FIFO)
  */
 	tty->closing = 1;
+	
+	spin_unlock_irqrestore(&stallion_lock, flags);
+	
 	if (portp->closing_wait != ASYNC_CLOSING_WAIT_NONE)
 		tty_wait_until_sent(tty, portp->closing_wait);
 	stl_waituntilsent(tty, (HZ / 2));
 
+
+	spin_lock_irqsave(&stallion_lock, flags);
 	portp->flags &= ~ASYNC_INITIALIZED;
+	spin_unlock_irqrestore(&stallion_lock, flags);
+	
 	stl_disableintrs(portp);
 	if (tty->termios->c_cflag & HUPCL)
 		stl_setsignals(portp, 0, 0);
@@ -1173,7 +1161,6 @@
 
 	portp->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING);
 	wake_up_interruptible(&portp->close_wait);
-	restore_flags(flags);
 }
 
 /*****************************************************************************/
@@ -1195,9 +1182,6 @@
 		(int) tty, (int) buf, count);
 #endif
 
-	if ((tty == (struct tty_struct *) NULL) ||
-	    (stl_tmpwritebuf == (char *) NULL))
-		return 0;
 	portp = tty->driver_data;
 	if (portp == (stlport_t *) NULL)
 		return 0;
@@ -1302,11 +1286,6 @@
 	if (portp->tx.buf == (char *) NULL)
 		return;
 
-#if 0
-	if (tty->stopped || tty->hw_stopped ||
-	    (portp->tx.head == portp->tx.tail))
-		return;
-#endif
 	stl_startrxtx(portp, -1, 1);
 }
 
@@ -1977,12 +1956,14 @@
 	unsigned int	iobase;
 	int		handled = 0;
 
+	spin_lock(&brd_lock);
 	panelp = brdp->panels[0];
 	iobase = panelp->iobase;
 	while (inb(brdp->iostatus) & EIO_INTRPEND) {
 		handled = 1;
 		(* panelp->isr)(panelp, iobase);
 	}
+	spin_unlock(&brd_lock);
 	return handled;
 }
 
@@ -2168,7 +2149,7 @@
 		portp = kzalloc(sizeof(stlport_t), GFP_KERNEL);
 		if (!portp) {
 			printk("STALLION: failed to allocate memory "
-				"(size=%d)\n", sizeof(stlport_t));
+				"(size=%Zd)\n", sizeof(stlport_t));
 			break;
 		}
 
@@ -2304,7 +2285,7 @@
 	panelp = kzalloc(sizeof(stlpanel_t), GFP_KERNEL);
 	if (!panelp) {
 		printk(KERN_WARNING "STALLION: failed to allocate memory "
-			"(size=%d)\n", sizeof(stlpanel_t));
+			"(size=%Zd)\n", sizeof(stlpanel_t));
 		return -ENOMEM;
 	}
 
@@ -2478,7 +2459,7 @@
 		panelp = kzalloc(sizeof(stlpanel_t), GFP_KERNEL);
 		if (!panelp) {
 			printk("STALLION: failed to allocate memory "
-				"(size=%d)\n", sizeof(stlpanel_t));
+				"(size=%Zd)\n", sizeof(stlpanel_t));
 			break;
 		}
 		panelp->magic = STL_PANELMAGIC;
@@ -2879,8 +2860,7 @@
 	portp->stats.lflags = 0;
 	portp->stats.rxbuffered = 0;
 
-	save_flags(flags);
-	cli();
+	spin_lock_irqsave(&stallion_lock, flags);
 	if (portp->tty != (struct tty_struct *) NULL) {
 		if (portp->tty->driver_data == portp) {
 			portp->stats.ttystate = portp->tty->flags;
@@ -2894,7 +2874,7 @@
 			}
 		}
 	}
-	restore_flags(flags);
+	spin_unlock_irqrestore(&stallion_lock, flags);
 
 	head = portp->tx.head;
 	tail = portp->tx.tail;
@@ -3056,14 +3036,6 @@
 		return -1;
 
 /*
- *	Allocate a temporary write buffer.
- */
-	stl_tmpwritebuf = kmalloc(STL_TXBUFSIZE, GFP_KERNEL);
-	if (!stl_tmpwritebuf)
-		printk("STALLION: failed to allocate memory (size=%d)\n",
-			STL_TXBUFSIZE);
-
-/*
  *	Set up a character driver for per board stuff. This is mainly used
  *	to do stats ioctls on the ports.
  */
@@ -3147,11 +3119,13 @@
 	unsigned int	gfrcr;
 	int		chipmask, i, j;
 	int		nrchips, uartaddr, ioaddr;
+	unsigned long   flags;
 
 #ifdef DEBUG
 	printk("stl_panelinit(brdp=%x,panelp=%x)\n", (int) brdp, (int) panelp);
 #endif
 
+	spin_lock_irqsave(&brd_lock, flags);
 	BRDENABLE(panelp->brdnr, panelp->pagenr);
 
 /*
@@ -3189,6 +3163,7 @@
 	}
 
 	BRDDISABLE(panelp->brdnr);
+	spin_unlock_irqrestore(&brd_lock, flags);
 	return chipmask;
 }
 
@@ -3200,6 +3175,7 @@
 
 static void stl_cd1400portinit(stlbrd_t *brdp, stlpanel_t *panelp, stlport_t *portp)
 {
+	unsigned long flags;
 #ifdef DEBUG
 	printk("stl_cd1400portinit(brdp=%x,panelp=%x,portp=%x)\n",
 		(int) brdp, (int) panelp, (int) portp);
@@ -3209,6 +3185,7 @@
 	    (portp == (stlport_t *) NULL))
 		return;
 
+	spin_lock_irqsave(&brd_lock, flags);
 	portp->ioaddr = panelp->iobase + (((brdp->brdtype == BRD_ECHPCI) ||
 		(portp->portnr < 8)) ? 0 : EREG_BANKSIZE);
 	portp->uartaddr = (portp->portnr & 0x04) << 5;
@@ -3219,6 +3196,7 @@
 	stl_cd1400setreg(portp, LIVR, (portp->portnr << 3));
 	portp->hwid = stl_cd1400getreg(portp, GFRCR);
 	BRDDISABLE(portp->brdnr);
+	spin_unlock_irqrestore(&brd_lock, flags);
 }
 
 /*****************************************************************************/
@@ -3428,8 +3406,7 @@
 		tiosp->c_cc[VSTART], tiosp->c_cc[VSTOP]);
 #endif
 
-	save_flags(flags);
-	cli();
+	spin_lock_irqsave(&brd_lock, flags);
 	BRDENABLE(portp->brdnr, portp->pagenr);
 	stl_cd1400setreg(portp, CAR, (portp->portnr & 0x3));
 	srer = stl_cd1400getreg(portp, SRER);
@@ -3466,7 +3443,7 @@
 		portp->sigs &= ~TIOCM_CD;
 	stl_cd1400setreg(portp, SRER, ((srer & ~sreroff) | sreron));
 	BRDDISABLE(portp->brdnr);
-	restore_flags(flags);
+	spin_unlock_irqrestore(&brd_lock, flags);
 }
 
 /*****************************************************************************/
@@ -3492,8 +3469,7 @@
 	if (rts > 0)
 		msvr2 = MSVR2_RTS;
 
-	save_flags(flags);
-	cli();
+	spin_lock_irqsave(&brd_lock, flags);
 	BRDENABLE(portp->brdnr, portp->pagenr);
 	stl_cd1400setreg(portp, CAR, (portp->portnr & 0x03));
 	if (rts >= 0)
@@ -3501,7 +3477,7 @@
 	if (dtr >= 0)
 		stl_cd1400setreg(portp, MSVR1, msvr1);
 	BRDDISABLE(portp->brdnr);
-	restore_flags(flags);
+	spin_unlock_irqrestore(&brd_lock, flags);
 }
 
 /*****************************************************************************/
@@ -3520,14 +3496,13 @@
 	printk("stl_cd1400getsignals(portp=%x)\n", (int) portp);
 #endif
 
-	save_flags(flags);
-	cli();
+	spin_lock_irqsave(&brd_lock, flags);
 	BRDENABLE(portp->brdnr, portp->pagenr);
 	stl_cd1400setreg(portp, CAR, (portp->portnr & 0x03));
 	msvr1 = stl_cd1400getreg(portp, MSVR1);
 	msvr2 = stl_cd1400getreg(portp, MSVR2);
 	BRDDISABLE(portp->brdnr);
-	restore_flags(flags);
+	spin_unlock_irqrestore(&brd_lock, flags);
 
 	sigs = 0;
 	sigs |= (msvr1 & MSVR1_DCD) ? TIOCM_CD : 0;
@@ -3569,15 +3544,14 @@
 	else if (rx > 0)
 		ccr |= CCR_RXENABLE;
 
-	save_flags(flags);
-	cli();
+	spin_lock_irqsave(&brd_lock, flags);
 	BRDENABLE(portp->brdnr, portp->pagenr);
 	stl_cd1400setreg(portp, CAR, (portp->portnr & 0x03));
 	stl_cd1400ccrwait(portp);
 	stl_cd1400setreg(portp, CCR, ccr);
 	stl_cd1400ccrwait(portp);
 	BRDDISABLE(portp->brdnr);
-	restore_flags(flags);
+	spin_unlock_irqrestore(&brd_lock, flags);
 }
 
 /*****************************************************************************/
@@ -3609,8 +3583,7 @@
 	else if (rx > 0)
 		sreron |= SRER_RXDATA;
 
-	save_flags(flags);
-	cli();
+	spin_lock_irqsave(&brd_lock, flags);
 	BRDENABLE(portp->brdnr, portp->pagenr);
 	stl_cd1400setreg(portp, CAR, (portp->portnr & 0x03));
 	stl_cd1400setreg(portp, SRER,
@@ -3618,7 +3591,7 @@
 	BRDDISABLE(portp->brdnr);
 	if (tx > 0)
 		set_bit(ASYI_TXBUSY, &portp->istate);
-	restore_flags(flags);
+	spin_unlock_irqrestore(&brd_lock, flags);
 }
 
 /*****************************************************************************/
@@ -3634,13 +3607,12 @@
 #ifdef DEBUG
 	printk("stl_cd1400disableintrs(portp=%x)\n", (int) portp);
 #endif
-	save_flags(flags);
-	cli();
+	spin_lock_irqsave(&brd_lock, flags);
 	BRDENABLE(portp->brdnr, portp->pagenr);
 	stl_cd1400setreg(portp, CAR, (portp->portnr & 0x03));
 	stl_cd1400setreg(portp, SRER, 0);
 	BRDDISABLE(portp->brdnr);
-	restore_flags(flags);
+	spin_unlock_irqrestore(&brd_lock, flags);
 }
 
 /*****************************************************************************/
@@ -3653,8 +3625,7 @@
 	printk("stl_cd1400sendbreak(portp=%x,len=%d)\n", (int) portp, len);
 #endif
 
-	save_flags(flags);
-	cli();
+	spin_lock_irqsave(&brd_lock, flags);
 	BRDENABLE(portp->brdnr, portp->pagenr);
 	stl_cd1400setreg(portp, CAR, (portp->portnr & 0x03));
 	stl_cd1400setreg(portp, SRER,
@@ -3664,7 +3635,7 @@
 	portp->brklen = len;
 	if (len == 1)
 		portp->stats.txbreaks++;
-	restore_flags(flags);
+	spin_unlock_irqrestore(&brd_lock, flags);
 }
 
 /*****************************************************************************/
@@ -3688,8 +3659,7 @@
 	if (tty == (struct tty_struct *) NULL)
 		return;
 
-	save_flags(flags);
-	cli();
+	spin_lock_irqsave(&brd_lock, flags);
 	BRDENABLE(portp->brdnr, portp->pagenr);
 	stl_cd1400setreg(portp, CAR, (portp->portnr & 0x03));
 
@@ -3729,7 +3699,7 @@
 	}
 
 	BRDDISABLE(portp->brdnr);
-	restore_flags(flags);
+	spin_unlock_irqrestore(&brd_lock, flags);
 }
 
 /*****************************************************************************/
@@ -3753,8 +3723,7 @@
 	if (tty == (struct tty_struct *) NULL)
 		return;
 
-	save_flags(flags);
-	cli();
+	spin_lock_irqsave(&brd_lock, flags);
 	BRDENABLE(portp->brdnr, portp->pagenr);
 	stl_cd1400setreg(portp, CAR, (portp->portnr & 0x03));
 	if (state) {
@@ -3769,7 +3738,7 @@
 		stl_cd1400ccrwait(portp);
 	}
 	BRDDISABLE(portp->brdnr);
-	restore_flags(flags);
+	spin_unlock_irqrestore(&brd_lock, flags);
 }
 
 /*****************************************************************************/
@@ -3785,8 +3754,7 @@
 	if (portp == (stlport_t *) NULL)
 		return;
 
-	save_flags(flags);
-	cli();
+	spin_lock_irqsave(&brd_lock, flags);
 	BRDENABLE(portp->brdnr, portp->pagenr);
 	stl_cd1400setreg(portp, CAR, (portp->portnr & 0x03));
 	stl_cd1400ccrwait(portp);
@@ -3794,7 +3762,7 @@
 	stl_cd1400ccrwait(portp);
 	portp->tx.tail = portp->tx.head;
 	BRDDISABLE(portp->brdnr);
-	restore_flags(flags);
+	spin_unlock_irqrestore(&brd_lock, flags);
 }
 
 /*****************************************************************************/
@@ -3833,6 +3801,7 @@
 		(int) panelp, iobase);
 #endif
 
+	spin_lock(&brd_lock);
 	outb(SVRR, iobase);
 	svrtype = inb(iobase + EREG_DATA);
 	if (panelp->nrports > 4) {
@@ -3846,6 +3815,8 @@
 		stl_cd1400txisr(panelp, iobase);
 	else if (svrtype & SVRR_MDM)
 		stl_cd1400mdmisr(panelp, iobase);
+		
+	spin_unlock(&brd_lock);
 }
 
 /*****************************************************************************/
@@ -4433,8 +4404,7 @@
 		tiosp->c_cc[VSTART], tiosp->c_cc[VSTOP]);
 #endif
 
-	save_flags(flags);
-	cli();
+	spin_lock_irqsave(&brd_lock, flags);
 	BRDENABLE(portp->brdnr, portp->pagenr);
 	stl_sc26198setreg(portp, IMR, 0);
 	stl_sc26198updatereg(portp, MR0, mr0);
@@ -4461,7 +4431,7 @@
 	portp->imr = (portp->imr & ~imroff) | imron;
 	stl_sc26198setreg(portp, IMR, portp->imr);
 	BRDDISABLE(portp->brdnr);
-	restore_flags(flags);
+	spin_unlock_irqrestore(&brd_lock, flags);
 }
 
 /*****************************************************************************/
@@ -4491,13 +4461,12 @@
 	else if (rts > 0)
 		iopioron |= IPR_RTS;
 
-	save_flags(flags);
-	cli();
+	spin_lock_irqsave(&brd_lock, flags);
 	BRDENABLE(portp->brdnr, portp->pagenr);
 	stl_sc26198setreg(portp, IOPIOR,
 		((stl_sc26198getreg(portp, IOPIOR) & ~iopioroff) | iopioron));
 	BRDDISABLE(portp->brdnr);
-	restore_flags(flags);
+	spin_unlock_irqrestore(&brd_lock, flags);
 }
 
 /*****************************************************************************/
@@ -4516,12 +4485,11 @@
 	printk("stl_sc26198getsignals(portp=%x)\n", (int) portp);
 #endif
 
-	save_flags(flags);
-	cli();
+	spin_lock_irqsave(&brd_lock, flags);
 	BRDENABLE(portp->brdnr, portp->pagenr);
 	ipr = stl_sc26198getreg(portp, IPR);
 	BRDDISABLE(portp->brdnr);
-	restore_flags(flags);
+	spin_unlock_irqrestore(&brd_lock, flags);
 
 	sigs = 0;
 	sigs |= (ipr & IPR_DCD) ? 0 : TIOCM_CD;
@@ -4558,13 +4526,12 @@
 	else if (rx > 0)
 		ccr |= CR_RXENABLE;
 
-	save_flags(flags);
-	cli();
+	spin_lock_irqsave(&brd_lock, flags);
 	BRDENABLE(portp->brdnr, portp->pagenr);
 	stl_sc26198setreg(portp, SCCR, ccr);
 	BRDDISABLE(portp->brdnr);
 	portp->crenable = ccr;
-	restore_flags(flags);
+	spin_unlock_irqrestore(&brd_lock, flags);
 }
 
 /*****************************************************************************/
@@ -4593,15 +4560,14 @@
 	else if (rx > 0)
 		imr |= IR_RXRDY | IR_RXBREAK | IR_RXWATCHDOG;
 
-	save_flags(flags);
-	cli();
+	spin_lock_irqsave(&brd_lock, flags);
 	BRDENABLE(portp->brdnr, portp->pagenr);
 	stl_sc26198setreg(portp, IMR, imr);
 	BRDDISABLE(portp->brdnr);
 	portp->imr = imr;
 	if (tx > 0)
 		set_bit(ASYI_TXBUSY, &portp->istate);
-	restore_flags(flags);
+	spin_unlock_irqrestore(&brd_lock, flags);
 }
 
 /*****************************************************************************/
@@ -4618,13 +4584,12 @@
 	printk("stl_sc26198disableintrs(portp=%x)\n", (int) portp);
 #endif
 
-	save_flags(flags);
-	cli();
+	spin_lock_irqsave(&brd_lock, flags);
 	BRDENABLE(portp->brdnr, portp->pagenr);
 	portp->imr = 0;
 	stl_sc26198setreg(portp, IMR, 0);
 	BRDDISABLE(portp->brdnr);
-	restore_flags(flags);
+	spin_unlock_irqrestore(&brd_lock, flags);
 }
 
 /*****************************************************************************/
@@ -4637,8 +4602,7 @@
 	printk("stl_sc26198sendbreak(portp=%x,len=%d)\n", (int) portp, len);
 #endif
 
-	save_flags(flags);
-	cli();
+	spin_lock_irqsave(&brd_lock, flags);
 	BRDENABLE(portp->brdnr, portp->pagenr);
 	if (len == 1) {
 		stl_sc26198setreg(portp, SCCR, CR_TXSTARTBREAK);
@@ -4647,7 +4611,7 @@
 		stl_sc26198setreg(portp, SCCR, CR_TXSTOPBREAK);
 	}
 	BRDDISABLE(portp->brdnr);
-	restore_flags(flags);
+	spin_unlock_irqrestore(&brd_lock, flags);
 }
 
 /*****************************************************************************/
@@ -4672,8 +4636,7 @@
 	if (tty == (struct tty_struct *) NULL)
 		return;
 
-	save_flags(flags);
-	cli();
+	spin_lock_irqsave(&brd_lock, flags);
 	BRDENABLE(portp->brdnr, portp->pagenr);
 
 	if (state) {
@@ -4719,7 +4682,7 @@
 	}
 
 	BRDDISABLE(portp->brdnr);
-	restore_flags(flags);
+	spin_unlock_irqrestore(&brd_lock, flags);
 }
 
 /*****************************************************************************/
@@ -4744,8 +4707,7 @@
 	if (tty == (struct tty_struct *) NULL)
 		return;
 
-	save_flags(flags);
-	cli();
+	spin_lock_irqsave(&brd_lock, flags);
 	BRDENABLE(portp->brdnr, portp->pagenr);
 	if (state) {
 		mr0 = stl_sc26198getreg(portp, MR0);
@@ -4765,7 +4727,7 @@
 		stl_sc26198setreg(portp, MR0, mr0);
 	}
 	BRDDISABLE(portp->brdnr);
-	restore_flags(flags);
+	spin_unlock_irqrestore(&brd_lock, flags);
 }
 
 /*****************************************************************************/
@@ -4781,14 +4743,13 @@
 	if (portp == (stlport_t *) NULL)
 		return;
 
-	save_flags(flags);
-	cli();
+	spin_lock_irqsave(&brd_lock, flags);
 	BRDENABLE(portp->brdnr, portp->pagenr);
 	stl_sc26198setreg(portp, SCCR, CR_TXRESET);
 	stl_sc26198setreg(portp, SCCR, portp->crenable);
 	BRDDISABLE(portp->brdnr);
 	portp->tx.tail = portp->tx.head;
-	restore_flags(flags);
+	spin_unlock_irqrestore(&brd_lock, flags);
 }
 
 /*****************************************************************************/
@@ -4815,12 +4776,11 @@
 	if (test_bit(ASYI_TXBUSY, &portp->istate))
 		return 1;
 
-	save_flags(flags);
-	cli();
+	spin_lock_irqsave(&brd_lock, flags);
 	BRDENABLE(portp->brdnr, portp->pagenr);
 	sr = stl_sc26198getreg(portp, SR);
 	BRDDISABLE(portp->brdnr);
-	restore_flags(flags);
+	spin_unlock_irqrestore(&brd_lock, flags);
 
 	return (sr & SR_TXEMPTY) ? 0 : 1;
 }
@@ -4877,6 +4837,8 @@
 {
 	stlport_t	*portp;
 	unsigned int	iack;
+	
+	spin_lock(&brd_lock);
 
 /* 
  *	Work around bug in sc26198 chip... Cannot have A6 address
@@ -4893,6 +4855,8 @@
 		stl_sc26198txisr(portp);
 	else
 		stl_sc26198otherisr(portp, iack);
+		
+	spin_unlock(&brd_lock);
 }
 
 /*****************************************************************************/


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

* Re: [2.6 patch] mark virt_to_bus/bus_to_virt as __deprecated on i386
  2006-06-26 15:54     ` Dave Jones
@ 2006-06-27 14:27       ` Jan Engelhardt
  2006-06-27 14:42         ` Arjan van de Ven
  2006-06-27 15:17         ` Alan Cox
  0 siblings, 2 replies; 13+ messages in thread
From: Jan Engelhardt @ 2006-06-27 14:27 UTC (permalink / raw)
  To: Dave Jones; +Cc: Arjan van de Ven, Adrian Bunk, Andrew Morton, linux-kernel

> > cli/sti should just be removed, or at least have those drivers marked
> > BROKEN... nobody is apparently using them anyway...
>
>Just ISDN really.
>
And ISDN is widespread in Germany (besides 56k and DSL(PPPOE)).


Jan Engelhardt
-- 

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

* Re: [2.6 patch] mark virt_to_bus/bus_to_virt as __deprecated on i386
  2006-06-27 14:27       ` Jan Engelhardt
@ 2006-06-27 14:42         ` Arjan van de Ven
  2006-06-27 15:17         ` Alan Cox
  1 sibling, 0 replies; 13+ messages in thread
From: Arjan van de Ven @ 2006-06-27 14:42 UTC (permalink / raw)
  To: Jan Engelhardt; +Cc: Dave Jones, Adrian Bunk, Andrew Morton, linux-kernel

On Tue, 2006-06-27 at 16:27 +0200, Jan Engelhardt wrote:
> > > cli/sti should just be removed, or at least have those drivers marked
> > > BROKEN... nobody is apparently using them anyway...
> >
> >Just ISDN really.
> >
> And ISDN is widespread in Germany (besides 56k and DSL(PPPOE)).
> 

so it really should be fixed ;-)



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

* Re: [2.6 patch] mark virt_to_bus/bus_to_virt as __deprecated on i386
  2006-06-27 14:27       ` Jan Engelhardt
  2006-06-27 14:42         ` Arjan van de Ven
@ 2006-06-27 15:17         ` Alan Cox
  2006-06-27 19:09           ` Jan Engelhardt
  1 sibling, 1 reply; 13+ messages in thread
From: Alan Cox @ 2006-06-27 15:17 UTC (permalink / raw)
  To: Jan Engelhardt
  Cc: Dave Jones, Arjan van de Ven, Adrian Bunk, Andrew Morton, linux-kernel

Ar Maw, 2006-06-27 am 16:27 +0200, ysgrifennodd Jan Engelhardt:
> > > cli/sti should just be removed, or at least have those drivers marked
> > > BROKEN... nobody is apparently using them anyway...
> >
> >Just ISDN really.
> >
> And ISDN is widespread in Germany (besides 56k and DSL(PPPOE)).

Then there should be lots of Germans eager to fix it when it gets dealt
with.

Alan


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

* Re: [2.6 patch] mark virt_to_bus/bus_to_virt as __deprecated on i386
  2006-06-27 15:17         ` Alan Cox
@ 2006-06-27 19:09           ` Jan Engelhardt
  2006-06-27 19:17             ` Arjan van de Ven
  0 siblings, 1 reply; 13+ messages in thread
From: Jan Engelhardt @ 2006-06-27 19:09 UTC (permalink / raw)
  To: Alan Cox
  Cc: Dave Jones, Arjan van de Ven, Adrian Bunk, Andrew Morton, linux-kernel

>> > > cli/sti should just be removed, or at least have those drivers marked
>> > > BROKEN... nobody is apparently using them anyway...
>> >
>> >Just ISDN really.
>> >
>> And ISDN is widespread in Germany (besides 56k and DSL(PPPOE)).
>
>Then there should be lots of Germans eager to fix it when it gets dealt
>with.
>

/* Heh, heh */

So what do I need to replace cli/sti with?

Oh btw:
(linux-2.6.17)
21:05 shanghai:../drivers/isdn > grep cli'()'  -lr .
./hardware/avm/t1isa.c
./hysdn/boardergo.c
./hysdn/hysdn_proclog.c
./hysdn/hysdn_sched.c
./isdnloop/isdnloop.c

There does not really seem to be a lot of places (yes, isdnloop is full of 
it) to change. Especially HISAX has no cli/stis anymore as it seems, 
which, among AVM stuff, is commonly in use. I am running this one:
  00:0a.0 Network controller: Tiger Jet Network Inc. Tiger3XX Modem/ISDN 
  interface (PCI, CONFIG_HISAX_NETJET)
previously I had a Teledat 100 (ISA, CONFIG_HISAX_SEDLBAUER) but had to 
replace that when I got a new motherboard with no ISA slots.


Have a nice day,
Jan Engelhardt
-- 

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

* Re: [2.6 patch] mark virt_to_bus/bus_to_virt as __deprecated on i386
  2006-06-27 19:09           ` Jan Engelhardt
@ 2006-06-27 19:17             ` Arjan van de Ven
  0 siblings, 0 replies; 13+ messages in thread
From: Arjan van de Ven @ 2006-06-27 19:17 UTC (permalink / raw)
  To: Jan Engelhardt
  Cc: Alan Cox, Dave Jones, Adrian Bunk, Andrew Morton, linux-kernel

On Tue, 2006-06-27 at 21:09 +0200, Jan Engelhardt wrote:
> >> > > cli/sti should just be removed, or at least have those drivers marked
> >> > > BROKEN... nobody is apparently using them anyway...
> >> >
> >> >Just ISDN really.
> >> >
> >> And ISDN is widespread in Germany (besides 56k and DSL(PPPOE)).
> >
> >Then there should be lots of Germans eager to fix it when it gets dealt
> >with.
> >
> 
> /* Heh, heh */
> 
> So what do I need to replace cli/sti with?

proper spinlocks ;)

cli/sti assumed to disable interrupts on all processors, and so when an
old driver uses cli/sti it's sort of a lock against any interrupt
handler (yes this is locking code not data!). In general you need to
find out what data the author wanted to protect, and just create proper
locking for that data.  

yes this is not a mechanical transformation.. if it was it would have
been done already :)



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

end of thread, other threads:[~2006-06-27 19:17 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-06-26 15:10 [2.6 patch] mark virt_to_bus/bus_to_virt as __deprecated on i386 Adrian Bunk
2006-06-26 15:38 ` Dave Jones
2006-06-26 15:46   ` Arjan van de Ven
2006-06-26 15:54     ` Dave Jones
2006-06-27 14:27       ` Jan Engelhardt
2006-06-27 14:42         ` Arjan van de Ven
2006-06-27 15:17         ` Alan Cox
2006-06-27 19:09           ` Jan Engelhardt
2006-06-27 19:17             ` Arjan van de Ven
2006-06-26 16:14   ` Adrian Bunk
2006-06-26 16:45     ` Dave Jones
2006-06-26 20:50     ` PATCH: stallion clean up: " Alan Cox
2006-06-26 15:48 ` Alan Cox

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®