public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCHv3 1/2] Introduce intel_bug_present function.
@ 2014-07-07  7:00 Matwey V. Kornilov
  2014-07-09 21:28 ` Greg KH
  0 siblings, 1 reply; 2+ messages in thread
From: Matwey V. Kornilov @ 2014-07-07  7:00 UTC (permalink / raw)
  To: gregkh; +Cc: linux-kernel, linux-parport, hsommer, matwey.kornilov

>From c89138e2c968c07dd11b3c6bfc05a803d0c5434d Mon Sep 17 00:00:00 2001
From: "Matwey V. Kornilov" <matwey.kornilov@gmail.com>
Date: Wed, 25 Jun 2014 00:53:54 +0400
Subject: [PATCHv3 1/2] Introduce intel_bug_present function.

Put the code to check present of the Intel bug from parport_EPP_supported
into new intel_bug_present function. The later also return ECR register
to the state it has before function call.

Tested-by: Heiko Andreas Sommer <hsommer@eso.org>
Signed-off-by: Matwey V. Kornilov <matwey@sai.msu.ru>
---
  drivers/parport/parport_pc.c | 38 ++++++++++++++++++++++++++------------
  1 file changed, 26 insertions(+), 12 deletions(-)

diff --git a/drivers/parport/parport_pc.c b/drivers/parport/parport_pc.c
index 76ee775..a6eaafb 100644
--- a/drivers/parport/parport_pc.c
+++ b/drivers/parport/parport_pc.c
@@ -1702,6 +1702,30 @@ static int parport_ECP_supported(struct parport *pb)
  }
  #endif

+static int intel_bug_present(struct parport *pb)
+{
+	const struct parport_pc_private *priv = pb->private_data;
+	int bug_present = 0;
+
+	if (priv->ecr) {
+		/* store value of ECR */
+		unsigned char ecr = inb(ECONTROL(pb));
+		unsigned char i;
+		for (i = 0x00; i < 0x80; i += 0x20) {
+			ECR_WRITE(pb, i);
+			if (clear_epp_timeout(pb)) {
+				/* Phony EPP in ECP. */
+				bug_present = 1;
+				break;
+			}
+		}
+		/* return ECR into the inital state */
+		ECR_WRITE(pb, ecr);
+	}
+
+	return bug_present;
+}
+
  static int parport_ECPPS2_supported(struct parport *pb)
  {
  	const struct parport_pc_private *priv = pb->private_data;
@@ -1722,8 +1746,6 @@ static int parport_ECPPS2_supported(struct parport *pb)

  static int parport_EPP_supported(struct parport *pb)
  {
-	const struct parport_pc_private *priv = pb->private_data;
-
  	/*
  	 * Theory:
  	 *	Bit 0 of STR is the EPP timeout bit, this bit is 0
@@ -1742,16 +1764,8 @@ static int parport_EPP_supported(struct parport *pb)
  		return 0;  /* No way to clear timeout */

  	/* Check for Intel bug. */
-	if (priv->ecr) {
-		unsigned char i;
-		for (i = 0x00; i < 0x80; i += 0x20) {
-			ECR_WRITE(pb, i);
-			if (clear_epp_timeout(pb)) {
-				/* Phony EPP in ECP. */
-				return 0;
-			}
-		}
-	}
+	if (intel_bug_present(pb))
+		return 0;

  	pb->modes |= PARPORT_MODE_EPP;

-- 
1.8.1.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCHv3 1/2] Introduce intel_bug_present function.
  2014-07-07  7:00 [PATCHv3 1/2] Introduce intel_bug_present function Matwey V. Kornilov
@ 2014-07-09 21:28 ` Greg KH
  0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2014-07-09 21:28 UTC (permalink / raw)
  To: Matwey V. Kornilov; +Cc: linux-kernel, linux-parport, hsommer, matwey.kornilov

On Mon, Jul 07, 2014 at 11:00:59AM +0400, Matwey V. Kornilov wrote:
> >From c89138e2c968c07dd11b3c6bfc05a803d0c5434d Mon Sep 17 00:00:00 2001
> From: "Matwey V. Kornilov" <matwey.kornilov@gmail.com>
> Date: Wed, 25 Jun 2014 00:53:54 +0400
> Subject: [PATCHv3 1/2] Introduce intel_bug_present function.

What is this here for?  Please just use 'git send-email' to properly
send patches so I don't have to edit them by hand...

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-07-09 21:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-07  7:00 [PATCHv3 1/2] Introduce intel_bug_present function Matwey V. Kornilov
2014-07-09 21:28 ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox