All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] scc fix for 2.6.0
@ 2003-12-25 18:52 Jeroen Vreeken
  2003-12-26 10:28 ` Re : " Jean-Luc Coulon (f5ibh)
  2003-12-27  4:05 ` Ralf Baechle DO1GRB
  0 siblings, 2 replies; 4+ messages in thread
From: Jeroen Vreeken @ 2003-12-25 18:52 UTC (permalink / raw)
  To: linux-hams; +Cc: jgarzik, ralf

[-- Attachment #1: Type: text/plain, Size: 217 bytes --]

Hi,

This is a fix for the scc driver in 2.6.0
It was calling register_netdev from within a ioctl and thus holding
rtnl_lock()
It now uses register_netdevice and calls rtnl_lock() itself if outside the
ioctl.

Jeroen

[-- Attachment #2: scc-linux-2.6.0.rxq.diff --]
[-- Type: application/octet-stream, Size: 918 bytes --]

--- linux-2.6.0/drivers/net/hamradio/scc.c	2003-12-18 03:59:27.000000000 +0100
+++ linux-2.6.0.rxq/drivers/net/hamradio/scc.c	2003-12-25 17:57:58.000000000 +0100
@@ -163,6 +163,7 @@
 #include <linux/delay.h>
 #include <linux/skbuff.h>
 #include <linux/netdevice.h>
+#include <linux/rtnetlink.h>
 #include <linux/if_ether.h>
 #include <linux/if_arp.h>
 #include <linux/socket.h>
@@ -1526,7 +1527,7 @@
 	scc->dev = dev;
 	spin_lock_init(&scc->lock);
 
-	err = register_netdev(dev);
+	err = register_netdevice(dev);
 	if (err) {
 		printk(KERN_ERR "%s: can't register network device (%d)\n", 
 		       name, err);
@@ -2119,10 +2120,13 @@
 	
 	sprintf(devname,"%s0", SCC_DriverName);
 	
+	rtnl_lock();
 	if (scc_net_alloc(devname, SCC_Info)) {
+		rtnl_unlock();
 		printk(KERN_ERR "z8530drv: cannot initialize module\n");
 		return -EIO;
 	}
+	rtnl_unlock();
 
 	proc_net_fops_create("z8530drv", 0, &scc_net_seq_fops);
 

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

* Re : [PATCH] scc fix for 2.6.0
  2003-12-25 18:52 [PATCH] scc fix for 2.6.0 Jeroen Vreeken
@ 2003-12-26 10:28 ` Jean-Luc Coulon (f5ibh)
  2003-12-27  4:05 ` Ralf Baechle DO1GRB
  1 sibling, 0 replies; 4+ messages in thread
From: Jean-Luc Coulon (f5ibh) @ 2003-12-26 10:28 UTC (permalink / raw)
  To: Jeroen Vreeken; +Cc: linux-hams, jgarzik, ralf

[-- Attachment #1: Type: text/plain, Size: 409 bytes --]

Hi,

I've tested this patch with 2.6.0 and a drsi card.
It works fine.

--
Regards and 73
			- f5ibh - Jean-Luc

Le 25.12.2003 19:52, Jeroen Vreeken a écrit :
|Hi,
|
|This is a fix for the scc driver in 2.6.0
|It was calling register_netdev from within a ioctl and thus holding
|rtnl_lock()
|It now uses register_netdevice and calls rtnl_lock() itself if
|outside the
|ioctl.
|
|Jeroen
|

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

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

* Re: [PATCH] scc fix for 2.6.0
  2003-12-25 18:52 [PATCH] scc fix for 2.6.0 Jeroen Vreeken
  2003-12-26 10:28 ` Re : " Jean-Luc Coulon (f5ibh)
@ 2003-12-27  4:05 ` Ralf Baechle DO1GRB
  2003-12-30 18:41   ` Jeroen Vreeken
  1 sibling, 1 reply; 4+ messages in thread
From: Ralf Baechle DO1GRB @ 2003-12-27  4:05 UTC (permalink / raw)
  To: Jeroen Vreeken; +Cc: linux-hams, jgarzik

On Thu, Dec 25, 2003 at 07:52:33PM +0100, Jeroen Vreeken wrote:

> This is a fix for the scc driver in 2.6.0
> It was calling register_netdev from within a ioctl and thus holding
> rtnl_lock()
> It now uses register_netdevice and calls rtnl_lock() itself if outside the
> ioctl.

Somehow the whole device registration in that driver looks suspect.
Registering from the driver's module_init() method is fine - but doing so
from ioctl looks more it's some kind of ancient workaround or so?

73 de DO1GRB op Ralf

--
Loc. JN47BS / CQ 14 / ITU 28 / DOK A21

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

* Re: [PATCH] scc fix for 2.6.0
  2003-12-27  4:05 ` Ralf Baechle DO1GRB
@ 2003-12-30 18:41   ` Jeroen Vreeken
  0 siblings, 0 replies; 4+ messages in thread
From: Jeroen Vreeken @ 2003-12-30 18:41 UTC (permalink / raw)
  To: Ralf Baechle DO1GRB; +Cc: Jeroen Vreeken, linux-hams, jgarzik

On 2003.12.27 05:05:23 +0100 Ralf Baechle DO1GRB wrote:
> On Thu, Dec 25, 2003 at 07:52:33PM +0100, Jeroen Vreeken wrote:
> 
> > This is a fix for the scc driver in 2.6.0
> > It was calling register_netdev from within a ioctl and thus holding
> > rtnl_lock()
> > It now uses register_netdevice and calls rtnl_lock() itself if outside
> the
> > ioctl.
> 
> Somehow the whole device registration in that driver looks suspect.
> Registering from the driver's module_init() method is fine - but doing so
> from ioctl looks more it's some kind of ancient workaround or so?

At module init it only registers scc0.
sccinit later uses ioctls on this device to tell the driver how many chips
there really are, what kind of boards they are on, what crystal they have
and what addresses they use for the various registers.
At that time the ioctl will generate additional scc network devices if
necessary.
To my knowledge the only way to do this otherwise is to generate some kind
of scc specific /proc device... Which would be even more ugly.

The way scc works now has been like that since altleast the 2.0 kernels and
I never heard anybody come up with a better way.

Jeroen


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

end of thread, other threads:[~2003-12-30 18:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-12-25 18:52 [PATCH] scc fix for 2.6.0 Jeroen Vreeken
2003-12-26 10:28 ` Re : " Jean-Luc Coulon (f5ibh)
2003-12-27  4:05 ` Ralf Baechle DO1GRB
2003-12-30 18:41   ` Jeroen Vreeken

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.