[parisc-linux-cvs] linux deller

Helge Deller deller@gmx.de
Thu, 27 Jun 2002 20:47:19 +0200


--Boundary-00=_321G929G9U3lO5u
Content-Type: text/plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: 8bit
Content-Disposition: inline

On Thursday 27 June 2002 20:46, Helge Deller wrote:
> CVSROOT:	/var/cvs
> Module name:	linux
> Changes by:	deller	02/06/27 12:46:00
>
> Modified files:
> 	drivers/hil    : hil_mlc.c
>
> Log message:
> - fix crash when HIL driver is built-into kernel. Driver doesn't work yet
> though :-( - use DECLARE_TASKLET_DISABLED()
> - remove my old debugging-cruft
> - fix some indenting


--Boundary-00=_321G929G9U3lO5u
Content-Type: text/plain;
  charset="iso-8859-1";
  name="diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="diff"

Index: hil_mlc.c
===================================================================
RCS file: /var/cvs/linux/drivers/hil/hil_mlc.c,v
retrieving revision 1.1
diff -u -p -r1.1 hil_mlc.c
--- hil_mlc.c	2002/06/25 19:53:07	1.1
+++ hil_mlc.c	2002/06/27 18:43:33
@@ -70,11 +70,15 @@ EXPORT_SYMBOL(hil_mlc_unregister);
 
 static hil_mlc			*hil_mlcs;		
 static rwlock_t			hil_mlcs_lock;
-static struct tasklet_struct	hil_mlcs_tasklet;
 static struct timer_list	hil_mlcs_kicker;
 static int			hil_mlcs_probe;
 
+static void hil_mlcs_process(unsigned long unused);
+DECLARE_TASKLET_DISABLED(hil_mlcs_tasklet, hil_mlcs_process, 0);
 
+
+/* #define HIL_MLC_DEBUG */
+
 /********************** Device info/instance management **********************/
 
 static void hil_mlc_clear_di_map (hil_mlc *mlc, int val) {
@@ -865,7 +869,7 @@ int hil_mlc_register(hil_mlc *mlc) {
 	hil_mlc_clear_di_map(mlc, 0);
 	for (i = 0; i < HIL_MLC_DEVMEM; i++) {
 		hil_mlc_copy_di_scratch(mlc, i);
-		memset(&(mlc->serio[i]), 0, sizeof(struct serio));
+		memset(&(mlc->serio[i]), 0, sizeof(mlc->serio[0]));
 		mlc->serio[i].type		= SERIO_HIL | SERIO_HIL_MLC;
 		mlc->serio[i].write		= hil_mlc_serio_write;
 		mlc->serio[i].open		= hil_mlc_serio_open;
@@ -881,10 +885,10 @@ int hil_mlc_register(hil_mlc *mlc) {
 
 	mlc->tasklet = &hil_mlcs_tasklet;
 
-        write_lock_irqsave(&hil_mlcs_lock, flags);
-        ptr = hil_mlcs;
-        hil_mlcs = mlc;
-        mlc->next = ptr;
+	write_lock_irqsave(&hil_mlcs_lock, flags);
+	ptr = hil_mlcs;
+	hil_mlcs = mlc;
+	mlc->next = ptr;
 	mlc->seidx = HILSEN_START;
 	write_unlock_irqrestore(&hil_mlcs_lock, flags);
 	printk("Registered MLC %p\n", mlc);
@@ -923,8 +927,8 @@ int hil_mlc_unregister(hil_mlc *mlc) {
 	printk("Unregistered MLC %p\n", mlc);
 	hil_tasklet_schedule(&hil_mlcs_tasklet);
 	return 0;
- fail:
-        write_unlock_irqrestore(&hil_mlcs_lock, flags);
+  fail:
+	write_unlock_irqrestore(&hil_mlcs_lock, flags);
 	hil_tasklet_schedule(&hil_mlcs_tasklet);
 	return -ENODEV;
 }
@@ -933,38 +937,28 @@ int hil_mlc_unregister(hil_mlc *mlc) {
 
 static int __init hil_mlc_init(void)
 {
-        printk("A\n");
-        printk("A\n");
-        printk("A\n");
-        printk("A\n");
-	schedule();
-        printk("HIL M\n");
-        printk("HIL M\n");
-        printk("HIL M\n");
-        printk("HIL M\n");
-        printk("HIL MLC support infrastructure loaded.\n");
+	printk("HIL MLC support infrastructure loaded.\n");
 	hil_mlcs = NULL;
 	hil_mlcs_lock = RW_LOCK_UNLOCKED;
 
-	tasklet_init(&hil_mlcs_tasklet, hil_mlcs_process, 0);
-
 	init_timer(&hil_mlcs_kicker);
-        hil_mlcs_kicker.expires = jiffies + HZ;
-        hil_mlcs_kicker.function = &hil_mlcs_timer;
-        add_timer(&hil_mlcs_kicker);
+	hil_mlcs_kicker.expires = jiffies + HZ;
+	hil_mlcs_kicker.function = &hil_mlcs_timer;
+	add_timer(&hil_mlcs_kicker);
 
-        return 0;
+	tasklet_enable(&hil_mlcs_tasklet);
+
+	return 0;
 }
                 
 static void __exit hil_mlc_exit(void)
 {
-        del_timer(&hil_mlcs_kicker);
+	del_timer(&hil_mlcs_kicker);
 
-	write_lock_irq(&hil_mlcs_lock);
+	tasklet_disable(&hil_mlcs_tasklet);
 	tasklet_kill(&hil_mlcs_tasklet);
-	write_unlock_irq(&hil_mlcs_lock);
 
-        printk("HIL MLC support infrastructure unloaded.\n");
+	printk("HIL MLC support infrastructure unloaded.\n");
 }
                         
 module_init(hil_mlc_init);

--Boundary-00=_321G929G9U3lO5u--