From: Joerg <joerg@CrystalPalace.no.domain>
Subject: L68K: lp_mfc works again
To: linux-m68k@phil.uni-sb.de
Date: Tue, 24 Jun 1997 23:19:13 +0200 (MET DST)
Sender: owner-linux-m68k@phil.uni-sb.de
Reply-To: jdorchain@i-con.de

Hi,

I just tested the lp_mfc driver adapted for 2.1.42.
As this driver wasn't changed from 2.1.5 (the last revision I used before),
I wonder if I am really the only one with two printers, because the driver
didn't even compile any more.

Here's the patch to make it work again. Please keep it up to date when the
interface to the outer world changes.

Joerg


--- lp_mfc.c.orig	Tue Jun 24 22:00:14 1997
+++ lp_mfc.c	Tue Jun 24 22:47:51 1997
@@ -5,9 +5,13 @@
  * ported to 2.0.18 and modularised
  * 25.9.96 Joerg Dorchain
  *
+ * ported to 2.1.42
+ * 24.6.97 Joerg Dorchain (jdorchain@i-con.de)
+ *
  */
 
 #include <linux/module.h>
+#include <linux/init.h>
 #include <linux/delay.h>
 #include <linux/kernel.h>
 #include <linux/sched.h>
@@ -24,12 +28,10 @@
 static int lp_mfc_busy(int);
 static int lp_mfc_pout(int);
 static int lp_mfc_online(int);
-static int lp_mfc_interrupt(int);
+static void lp_mfc_interrupt(int, void *, struct pt_regs *);
 
 static inline struct pia *pia(int);
 
-int lp_mfc_init(void);
-
 static volatile int dummy; /* for trigger reads */
 static int minor[MAX_LP] = { -1, -1, -1, -1, -1 };
 #ifdef MODULE
@@ -60,12 +62,16 @@
 return pia(dev)->pra&4;
 }
 
-static int lp_mfc_interrupt(int dev)
+static void lp_mfc_interrupt(int irq,void *data,struct pt_regs *fp)
 {
-int inter = pia(dev)->crb&128;
+int i;
 
-dummy = pia(dev)->prb; /* clears irq bit */
-return inter;
+for( i=0; i<MAX_LP; i++)  /* test all lp's */
+	if (minor[i] != -1)  /* one of ours ? */
+		if (pia(minor[i])->crb&128) { /* has an irq? */
+			dummy = pia(minor[i])->prb; /* clear bit */
+			lp_interrupt(minor[i]);
+		}
 }
 
 static inline struct pia *pia(int dev)
@@ -73,19 +79,20 @@
 return lp_table[dev]->base;
 }
 
-static void lp_mfc_open(void)
+static int lp_mfc_open(int dev)
 {
 MOD_INC_USE_COUNT;
+return 0;
 }
 
-static void lp_mfc_release(void)
+static void lp_mfc_release(int dev)
 {
 MOD_DEC_USE_COUNT;
 }
 
 static struct lp_struct tab[MAX_LP] = {{0,},};
 
-int lp_mfc_init()
+__initfunc(int lp_mfc_init(void))
 {
 int pias;
 struct pia *pp;
@@ -113,7 +120,6 @@
 	tab[pias].lp_is_busy=lp_mfc_busy;
 	tab[pias].lp_has_pout=lp_mfc_pout;
 	tab[pias].lp_is_online=lp_mfc_online;
-	tab[pias].lp_my_interrupt=lp_mfc_interrupt;
 	tab[pias].lp_ioctl=NULL;
 	tab[pias].lp_open=lp_mfc_open;
 	tab[pias].lp_release=lp_mfc_release;
@@ -136,8 +142,8 @@
   }
 }
 if ((pias != 0) && (lp_irq != 0))
-  request_irq(IRQ_AMIGA_PORTS, lp_interrupt, 0,
-    "Multiface III printer", lp_mfc_init);
+  request_irq(IRQ_AMIGA_PORTS, lp_mfc_interrupt, 0,
+    "Multiface III printer", lp_mfc_interrupt);
 
 return (pias==0)?-ENODEV:0;
 }
@@ -153,7 +159,7 @@
 int i;
 
 if (lp_irq)
-  free_irq(IRQ_AMIGA_PORTS, lp_mfc_init);
+  free_irq(IRQ_AMIGA_PORTS, lp_mfc_interrupt);
 for(i = 0; i < MAX_LP; i++)
   if ((lp_table[i] != NULL) && (lp_table[i]->type == LP_MFC)) {
     unregister_parallel(i);
