marko.kohtala | 5 Sep 20:31 2005
Picon

[patch 08/10] parport: ieee1284 fixes and cleanups

Make drivers that use directly PC parport HW depend on PARPORT_PC
rather than HW independent PARPORT.

Signed-off-by: Marko Kohtala <marko.kohtala <at> gmail.com>

---

 drivers/block/Kconfig        |    2 +-
 drivers/block/paride/Kconfig |    5 +++--
 drivers/scsi/Kconfig         |    8 ++++----
 3 files changed, 8 insertions(+), 7 deletions(-)

Index: linux-dvb/drivers/block/Kconfig
===================================================================
--- linux-dvb.orig/drivers/block/Kconfig	2005-06-23 22:12:45.000000000 +0300
+++ linux-dvb/drivers/block/Kconfig	2005-06-24 13:03:46.000000000 +0300
 <at>  <at>  -117,7 +117,7  <at>  <at>  config BLK_DEV_XD

 config PARIDE
 	tristate "Parallel port IDE device support"
-	depends on PARPORT
+	depends on PARPORT_PC
 	---help---
 	  There are many external CD-ROM and disk devices that connect through
 	  your computer's parallel port. Most of them are actually IDE devices
Index: linux-dvb/drivers/block/paride/Kconfig
===================================================================
--- linux-dvb.orig/drivers/block/paride/Kconfig	2005-06-23 22:12:45.000000000 +0300
+++ linux-dvb/drivers/block/paride/Kconfig	2005-06-24 13:03:46.000000000 +0300
 <at>  <at>  -4,11 +4,12  <at>  <at> 
(Continue reading)

marko.kohtala | 5 Sep 20:31 2005
Picon

[patch 02/10] parport: ieee1284 fixes and cleanups

Did not move the parport interface properly into IEEE1284_PH_REV_IDLE
phase at end of data due to comparing bytes with nibbles. Internal
phase IEEE1284_PH_HBUSY_DNA became unused, so remove it.

Signed-off-by: Marko Kohtala <marko.kohtala <at> gmail.com>

---

 drivers/media/video/cpia_pp.c  |   30 ++++++++-----------
 drivers/parport/ieee1284_ops.c |   62 +++++++++++++++++++----------------------
 include/linux/parport.h        |    1 
 3 files changed, 42 insertions(+), 51 deletions(-)

Index: linux-dvb/drivers/media/video/cpia_pp.c
===================================================================
--- linux-dvb.orig/drivers/media/video/cpia_pp.c	2005-05-30 19:44:27.000000000 +0300
+++ linux-dvb/drivers/media/video/cpia_pp.c	2005-05-30 19:48:30.000000000 +0300
 <at>  <at>  -170,16 +170,9  <at>  <at>  static size_t cpia_read_nibble (struct p
 		/* Does the error line indicate end of data? */
 		if (((i /*& 1*/) == 0) &&
 		    (parport_read_status(port) & PARPORT_STATUS_ERROR)) {
-			port->physport->ieee1284.phase = IEEE1284_PH_HBUSY_DNA;
-				DBG("%s: No more nibble data (%d bytes)\n",
-				port->name, i/2);
-
-			/* Go to reverse idle phase. */
-			parport_frob_control (port,
-					      PARPORT_CONTROL_AUTOFD,
-					      PARPORT_CONTROL_AUTOFD);
-			port->physport->ieee1284.phase = IEEE1284_PH_REV_IDLE;
(Continue reading)

marko.kohtala | 5 Sep 20:31 2005
Picon

[patch 05/10] parport: ieee1284 fixes and cleanups

Use the complete slab buffer that is allocated by kmalloc.

Signed-off-by: Marko Kohtala <marko.kohtala <at> gmail.com>

---

 drivers/parport/daisy.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

Index: linux-dvb/drivers/parport/daisy.c
===================================================================
--- linux-dvb.orig/drivers/parport/daisy.c	2005-08-29 20:17:06.000000000 +0300
+++ linux-dvb/drivers/parport/daisy.c	2005-08-29 20:17:26.000000000 +0300
 <at>  <at>  -144,9 +144,9  <at>  <at>  again:
 	add_dev (numdevs++, port, -1);

 	/* Find out the legacy device's IEEE 1284 device ID. */
-	deviceid = kmalloc (1000, GFP_KERNEL);
+	deviceid = kmalloc (1024, GFP_KERNEL);
 	if (deviceid) {
-		if (parport_device_id (numdevs - 1, deviceid, 1000) > 2)
+		if (parport_device_id (numdevs - 1, deviceid, 1024) > 2)
 			detected++;

 		kfree (deviceid);
 <at>  <at>  -508,11 +508,11  <at>  <at>  static int assign_addrs (struct parport 
 		 detected);

 	/* Ask the new devices to introduce themselves. */
-	deviceid = kmalloc (1000, GFP_KERNEL);
(Continue reading)

marko.kohtala | 5 Sep 20:31 2005
Picon

[patch 00/10] parport: ieee1284 fixes and cleanups

I played with a daisy chain device that is not ieee1284 compliant
and found buffer overflow and failure to open daisy chain devices.
While fixing it I found also a number of other problems also affecting
proper ieee1284 devices.

This is a collection of the changes I have made. They have been through
linux-parport mailing list already in January and they have been modified
according to comments.

--
marko.kohtala | 5 Sep 20:31 2005
Picon

[patch 09/10] parport: ieee1284 fixes and cleanups

Small cleanup of includes meant for older implementation.

Signed-off-by: Marko Kohtala <marko.kohtala <at> gmail.com>

---

diff -Nru a/drivers/net/plip.c b/drivers/net/plip.c
--- a/drivers/net/plip.c	2005-01-08 07:44:25 +02:00
+++ b/drivers/net/plip.c	2005-01-16 12:20:44 +02:00
 <at>  <at>  -98,7 +98,6  <at>  <at> 
 #include <linux/in.h>
 #include <linux/errno.h>
 #include <linux/delay.h>
-#include <linux/lp.h>
 #include <linux/init.h>
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
 <at>  <at>  -106,7 +105,6  <at>  <at> 
 #include <linux/skbuff.h>
 #include <linux/if_plip.h>
 #include <linux/workqueue.h>
-#include <linux/ioport.h>
 #include <linux/spinlock.h>
 #include <linux/parport.h>
 #include <linux/bitops.h>

--
marko.kohtala | 5 Sep 20:31 2005
Picon

[patch 03/10] parport: ieee1284 fixes and cleanups

Daisy chain end detection failed at least with older daisy chain
devices that do not implement the last device signal.

Signed-off-by: Marko Kohtala <marko.kohtala <at> gmail.com>

---

 drivers/parport/daisy.c |   27 +++++++++++++++++----------
 1 files changed, 17 insertions(+), 10 deletions(-)

Index: linux-dvb/drivers/parport/daisy.c
===================================================================
--- linux-dvb.orig/drivers/parport/daisy.c	2005-08-29 20:11:52.000000000 +0300
+++ linux-dvb/drivers/parport/daisy.c	2005-08-29 20:12:35.000000000 +0300
 <at>  <at>  -436,7 +436,7  <at>  <at>  static int select_port (struct parport *

 static int assign_addrs (struct parport *port)
 {
-	unsigned char s, last_dev;
+	unsigned char s;
 	unsigned char daisy;
 	int thisdev = numdevs;
 	int detected;
 <at>  <at>  -472,10 +472,13  <at>  <at>  static int assign_addrs (struct parport 
 	}

 	parport_write_data (port, 0x78); udelay (2);
-	last_dev = 0; /* We've just been speaking to a device, so we
-			 know there must be at least _one_ out there. */
+	s = parport_read_status (port);
(Continue reading)

marko.kohtala | 5 Sep 20:31 2005
Picon

[patch 10/10] parport: ieee1284 fixes and cleanups

Help external ppSCSI driver by exporting parport_get_port to match the
parport_put_port.

Signed-off-by: Marko Kohtala <marko.kohtala <at> gmail.com>

---

diff -Nru a/drivers/parport/share.c b/drivers/parport/share.c
--- a/drivers/parport/share.c	2004-10-28 10:39:58 +03:00
+++ b/drivers/parport/share.c	2004-12-15 22:50:57 +02:00
 <at>  <at>  -1007,6 +1007,7  <at>  <at> 
 EXPORT_SYMBOL(parport_unregister_driver);
 EXPORT_SYMBOL(parport_register_device);
 EXPORT_SYMBOL(parport_unregister_device);
+EXPORT_SYMBOL(parport_get_port);
 EXPORT_SYMBOL(parport_put_port);
 EXPORT_SYMBOL(parport_find_number);
 EXPORT_SYMBOL(parport_find_base);

--
marko.kohtala | 5 Sep 20:31 2005
Picon

[patch 06/10] parport: ieee1284 fixes and cleanups

Trivial "const" additions to places in parport that truly are const.

Signed-off-by: Marko Kohtala <marko.kohtala <at> gmail.com>

---

 drivers/parport/parport_pc.c |   38 ++++++++++++++++++++++----------------
 drivers/parport/probe.c      |    6 +++---
 2 files changed, 25 insertions(+), 19 deletions(-)

Index: linux-dvb/drivers/parport/parport_pc.c
===================================================================
--- linux-dvb.orig/drivers/parport/parport_pc.c	2005-06-24 10:41:40.000000000 +0300
+++ linux-dvb/drivers/parport/parport_pc.c	2005-06-24 13:03:46.000000000 +0300
 <at>  <at>  -1170,7 +1170,7  <at>  <at>  dump_parport_state ("fwd idle", port);

 /* GCC is not inlining extern inline function later overwriten to non-inline,
    so we use outlined_ variants here.  */
-static struct parport_operations parport_pc_ops =
+static const struct parport_operations parport_pc_ops =
 {
 	.write_data	= parport_pc_write_data,
 	.read_data	= parport_pc_read_data,
 <at>  <at>  -1212,10 +1212,11  <at>  <at>  static struct parport_operations parport
 static void __devinit show_parconfig_smsc37c669(int io, int key)
 {
 	int cr1,cr4,cra,cr23,cr26,cr27,i=0;
-	static const char *modes[]={ "SPP and Bidirectional (PS/2)",	
-				     "EPP and SPP",
-				     "ECP",
(Continue reading)

marko.kohtala | 5 Sep 20:31 2005
Picon

[patch 04/10] parport: ieee1284 fixes and cleanups

Device ID reading from daisy chain devices failed because the daisy
device could not be opened.

Signed-off-by: Marko Kohtala <marko.kohtala <at> gmail.com>

---

Index: linux-dvb/drivers/parport/daisy.c
===================================================================
--- linux-dvb.orig/drivers/parport/daisy.c	2005-08-29 20:16:48.000000000 +0300
+++ linux-dvb/drivers/parport/daisy.c	2005-08-29 20:17:06.000000000 +0300
 <at>  <at>  -252,7 +252,7  <at>  <at>  struct pardevice *parport_open (int devn
 		selected = port->daisy;
 		parport_release (dev);

-		if (selected != port->daisy) {
+		if (selected != daisy) {
 			/* No corresponding device. */
 			parport_unregister_device (dev);
 			return NULL;

--
marko.kohtala | 5 Sep 20:31 2005
Picon

[patch 07/10] parport: ieee1284 fixes and cleanups

Add missing "struct" keyword preventing compilation with DEBUG_PARPORT
defined. Also add some "const".

Signed-off-by: Marko Kohtala <marko.kohtala <at> gmail.com>

---

 include/linux/parport_pc.h |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

Index: linux-dvb/include/linux/parport_pc.h
===================================================================
--- linux-dvb.orig/include/linux/parport_pc.h	2005-06-24 15:42:28.000000000 +0300
+++ linux-dvb/include/linux/parport_pc.h	2005-06-24 15:42:52.000000000 +0300
 <at>  <at>  -85,8 +85,8  <at>  <at>  extern __inline__ void dump_parport_stat
 	unsigned char ecr = inb (ECONTROL (p));
 	unsigned char dcr = inb (CONTROL (p));
 	unsigned char dsr = inb (STATUS (p));
-	static char *ecr_modes[] = {"SPP", "PS2", "PPFIFO", "ECP", "xXx", "yYy", "TST", "CFG"};
-	const struct parport_pc_private *priv = (parport_pc_private *)p->physport->private_data;
+	static const char *const ecr_modes[] = {"SPP", "PS2", "PPFIFO", "ECP", "xXx", "yYy", "TST", "CFG"};
+	const struct parport_pc_private *priv = (struct parport_pc_private *)p->physport->private_data;
 	int i;

 	printk (KERN_DEBUG "*** parport state (%s): ecr=[%s", str, ecr_modes[(ecr & 0xe0) >> 5]);

--

Gmane