From e7be5403ad45264226de5fbd836013db464113a0 Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Fri, 23 Nov 2007 15:26:19 -0500 Subject: [PATCH] Import 2.3.11 --- drivers/misc/parport_ieee1284.c | 38 +++++++++++++++++++++++++++++--------- fs/exec.c | 2 +- include/linux/parport.h | 5 +++++ 3 files changed, 35 insertions(+), 10 deletions(-) diff --git a/drivers/misc/parport_ieee1284.c b/drivers/misc/parport_ieee1284.c index e3f27fd03..de7a269c2 100644 --- a/drivers/misc/parport_ieee1284.c +++ b/drivers/misc/parport_ieee1284.c @@ -220,7 +220,7 @@ int parport_negotiate (struct parport *port, int mode) printk (KERN_ERR "parport: IEEE1284 not supported in this kernel\n"); return -1; #else - int m = mode; + int m = mode & ~IEEE1284_ADDR; unsigned char xflag; port = port->physport; @@ -229,6 +229,12 @@ int parport_negotiate (struct parport *port, int mode) if (port->ieee1284.mode == mode) return 0; + /* Is the difference just an address-or-not bit? */ + if ((port->ieee1284.mode & ~IEEE1284_ADDR) == (mode & ~IEEE1284_ADDR)){ + port->ieee1284.mode = mode; + return 0; + } + /* Go to compability forward idle mode */ if (port->ieee1284.mode != IEEE1284_MODE_COMPAT) parport_ieee1284_terminate (port); @@ -409,10 +415,11 @@ ssize_t parport_write (struct parport *port, const void *buffer, size_t len) #else ssize_t retval; int mode = port->ieee1284.mode; + int addr = mode & IEEE1284_ADDR; size_t (*fn) (struct parport *, const void *, size_t, int); - /* Ignore the device-ID-request bit. */ - mode &= ~IEEE1284_DEVICEID; + /* Ignore the device-ID-request bit and the address bit. */ + mode &= ~(IEEE1284_DEVICEID | IEEE1284_ADDR); /* Use the mode we're in. */ switch (mode) { @@ -426,13 +433,19 @@ ssize_t parport_write (struct parport *port, const void *buffer, size_t len) case IEEE1284_MODE_EPP: DPRINTK (KERN_DEBUG "%s: Using EPP mode\n", port->name); - fn = port->ops->epp_write_data; + if (addr) + fn = port->ops->epp_write_addr; + else + fn = port->ops->epp_write_data; break; case IEEE1284_MODE_ECP: case IEEE1284_MODE_ECPRLE: DPRINTK (KERN_DEBUG "%s: Using ECP mode\n", port->name); - fn = port->ops->ecp_write_data; + if (addr) + fn = port->ops->ecp_write_addr; + else + fn = port->ops->ecp_write_data; break; case IEEE1284_MODE_ECPSWE: @@ -440,7 +453,10 @@ ssize_t parport_write (struct parport *port, const void *buffer, size_t len) port->name); /* The caller has specified that it must be emulated, * even if we have ECP hardware! */ - fn = parport_ieee1284_ecp_write_data; + if (addr) + fn = parport_ieee1284_ecp_write_addr; + else + fn = parport_ieee1284_ecp_write_data; break; default: @@ -464,10 +480,11 @@ ssize_t parport_read (struct parport *port, void *buffer, size_t len) return -ENODEV; #else int mode = port->physport->ieee1284.mode; + int addr = mode & IEEE1284_ADDR; size_t (*fn) (struct parport *, void *, size_t, int); - /* Ignore the device-ID-request bit. */ - mode &= ~IEEE1284_DEVICEID; + /* Ignore the device-ID-request bit and the address bit. */ + mode &= ~(IEEE1284_DEVICEID | IEEE1284_ADDR); /* Use the mode we're in. */ switch (mode) { @@ -486,7 +503,10 @@ ssize_t parport_read (struct parport *port, void *buffer, size_t len) case IEEE1284_MODE_EPP: DPRINTK (KERN_DEBUG "%s: Using EPP mode\n", port->name); - fn = port->ops->epp_read_data; + if (addr) + fn = port->ops->epp_read_addr; + else + fn = port->ops->epp_read_data; break; case IEEE1284_MODE_ECP: diff --git a/fs/exec.c b/fs/exec.c index 131a15ab5..debc7ed04 100644 --- a/fs/exec.c +++ b/fs/exec.c @@ -365,7 +365,7 @@ end_readexec: static int exec_mmap(void) { - struct mm_struct * mm, * old_mm, * active_mm; + struct mm_struct * mm, * old_mm; old_mm = current->mm; if (old_mm && atomic_read(&old_mm->mm_users) == 1) { diff --git a/include/linux/parport.h b/include/linux/parport.h index 0d65afa67..fa8db76db 100644 --- a/include/linux/parport.h +++ b/include/linux/parport.h @@ -70,6 +70,11 @@ typedef enum { #define IEEE1284_MODE_EPPSWE (1<<12) /* Software-emulated */ #define IEEE1284_DEVICEID (1<<2) /* This is a flag */ +/* For the benefit of parport_read/write, you can use these with + * parport_negotiate to use address operations. They have no effect + * other than to make parport_read/write use address transfers. */ +#define IEEE1284_ADDR (1<<13) /* This is a flag */ + /* The rest is for the kernel only */ #ifdef __KERNEL__ -- 2.11.4.GIT