diff mbox series

USB: serial: mos7720: fix parallel-port state restore

Message ID 20201104164727.26351-1-johan@kernel.org
State New
Headers show
Series USB: serial: mos7720: fix parallel-port state restore | expand

Commit Message

Johan Hovold Nov. 4, 2020, 4:47 p.m. UTC
The parallel-port restore operations is called when a driver claims the
port and is supposed to restore the provided state (e.g. saved when
releasing the port).

Fixes: b69578df7e98 ("USB: usbserial: mos7720: add support for parallel port on moschip 7715")
Cc: stable <stable@vger.kernel.org>     # 2.6.35
Signed-off-by: Johan Hovold <johan@kernel.org>
---
 drivers/usb/serial/mos7720.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Greg KH Nov. 4, 2020, 4:59 p.m. UTC | #1
On Wed, Nov 04, 2020 at 05:47:27PM +0100, Johan Hovold wrote:
> The parallel-port restore operations is called when a driver claims the

> port and is supposed to restore the provided state (e.g. saved when

> releasing the port).

> 

> Fixes: b69578df7e98 ("USB: usbserial: mos7720: add support for parallel port on moschip 7715")

> Cc: stable <stable@vger.kernel.org>     # 2.6.35

> Signed-off-by: Johan Hovold <johan@kernel.org>

> ---

>  drivers/usb/serial/mos7720.c | 2 ++

>  1 file changed, 2 insertions(+)

> 

> diff --git a/drivers/usb/serial/mos7720.c b/drivers/usb/serial/mos7720.c

> index 5eed1078fac8..5a5d2a95070e 100644

> --- a/drivers/usb/serial/mos7720.c

> +++ b/drivers/usb/serial/mos7720.c

> @@ -639,6 +639,8 @@ static void parport_mos7715_restore_state(struct parport *pp,

>  		spin_unlock(&release_lock);

>  		return;

>  	}

> +	mos_parport->shadowDCR = s->u.pc.ctr;

> +	mos_parport->shadowECR = s->u.pc.ecr;


Wow that's old code.  I'm guessing no one uses these devices really :(

Anyway, nice work:

Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


>  	write_parport_reg_nonblock(mos_parport, MOS7720_DCR,

>  				   mos_parport->shadowDCR);

>  	write_parport_reg_nonblock(mos_parport, MOS7720_ECR,

> -- 

> 2.26.2

>
Johan Hovold Nov. 5, 2020, 8:05 a.m. UTC | #2
On Wed, Nov 04, 2020 at 05:59:10PM +0100, Greg Kroah-Hartman wrote:
> On Wed, Nov 04, 2020 at 05:47:27PM +0100, Johan Hovold wrote:
> > The parallel-port restore operations is called when a driver claims the
> > port and is supposed to restore the provided state (e.g. saved when
> > releasing the port).
> > 
> > Fixes: b69578df7e98 ("USB: usbserial: mos7720: add support for parallel port on moschip 7715")
> > Cc: stable <stable@vger.kernel.org>     # 2.6.35
> > Signed-off-by: Johan Hovold <johan@kernel.org>
> > ---
> >  drivers/usb/serial/mos7720.c | 2 ++
> >  1 file changed, 2 insertions(+)
> > 
> > diff --git a/drivers/usb/serial/mos7720.c b/drivers/usb/serial/mos7720.c
> > index 5eed1078fac8..5a5d2a95070e 100644
> > --- a/drivers/usb/serial/mos7720.c
> > +++ b/drivers/usb/serial/mos7720.c
> > @@ -639,6 +639,8 @@ static void parport_mos7715_restore_state(struct parport *pp,
> >  		spin_unlock(&release_lock);
> >  		return;
> >  	}
> > +	mos_parport->shadowDCR = s->u.pc.ctr;
> > +	mos_parport->shadowECR = s->u.pc.ecr;
> 
> Wow that's old code.  I'm guessing no one uses these devices really :(

Possibly, but this would still work as long as you don't switch parallel
port driver without disconnecting the mos7715 device in between.

> Anyway, nice work:
> 
> Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Thanks, now applied for -next.

Johan
diff mbox series

Patch

diff --git a/drivers/usb/serial/mos7720.c b/drivers/usb/serial/mos7720.c
index 5eed1078fac8..5a5d2a95070e 100644
--- a/drivers/usb/serial/mos7720.c
+++ b/drivers/usb/serial/mos7720.c
@@ -639,6 +639,8 @@  static void parport_mos7715_restore_state(struct parport *pp,
 		spin_unlock(&release_lock);
 		return;
 	}
+	mos_parport->shadowDCR = s->u.pc.ctr;
+	mos_parport->shadowECR = s->u.pc.ecr;
 	write_parport_reg_nonblock(mos_parport, MOS7720_DCR,
 				   mos_parport->shadowDCR);
 	write_parport_reg_nonblock(mos_parport, MOS7720_ECR,