All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Hounschell <markh@compro.net>
To: driverdev-devel@linuxdriverproject.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Subject: [PATCH 03/03] staging: dgap: remove more unneeded brd-state states
Date: Wed, 12 Mar 2014 12:50:55 -0400	[thread overview]
Message-ID: <1394643056-3412-4-git-send-email-markh@compro.net> (raw)
In-Reply-To: <1394643056-3412-1-git-send-email-markh@compro.net>

This patch removes more unneeded brd-state states

Signed-off-by: Mark Hounschell <markh@compro.net>
Tested-by: Mark Hounschell <markh@compro.net>
---
 drivers/staging/dgap/dgap.c | 35 +++++++++++++++++------------------
 drivers/staging/dgap/dgap.h |  2 --
 2 files changed, 17 insertions(+), 20 deletions(-)

diff --git a/drivers/staging/dgap/dgap.c b/drivers/staging/dgap/dgap.c
index fc42511..ddeff5f 100644
--- a/drivers/staging/dgap/dgap.c
+++ b/drivers/staging/dgap/dgap.c
@@ -221,8 +221,8 @@ static int dgap_finalize_board_init(struct board_t *brd);
 
 static void dgap_get_vpd(struct board_t *brd);
 static void dgap_do_reset_board(struct board_t *brd);
-static void dgap_do_wait_for_bios(struct board_t *brd);
-static void dgap_do_wait_for_fep(struct board_t *brd);
+static int dgap_do_wait_for_bios(struct board_t *brd);
+static int dgap_do_wait_for_fep(struct board_t *brd);
 static int dgap_tty_register_ports(struct board_t *brd);
 static int dgap_firmware_load(struct pci_dev *pdev, int card_type);
 
@@ -923,9 +923,7 @@ static int dgap_firmware_load(struct pci_dev *pdev, int card_type)
 		release_firmware(fw);
 
 		/* Wait for BIOS to test board... */
-		dgap_do_wait_for_bios(brd);
-
-		if (brd->state != FINISHED_BIOS_LOAD)
+		if (!dgap_do_wait_for_bios(brd))
 			return -ENXIO;
 	}
 
@@ -941,9 +939,7 @@ static int dgap_firmware_load(struct pci_dev *pdev, int card_type)
 		release_firmware(fw);
 
 		/* Wait for FEP to load on board... */
-		dgap_do_wait_for_fep(brd);
-
-		if (brd->state != FINISHED_FEP_LOAD)
+		if (!dgap_do_wait_for_fep(brd))
 			return -ENXIO;
 	}
 
@@ -4368,15 +4364,16 @@ static void dgap_do_bios_load(struct board_t *brd, uchar __user *ubios, int len)
 /*
  * Checks to see if the BIOS completed running on the card.
  */
-static void dgap_do_wait_for_bios(struct board_t *brd)
+static int dgap_do_wait_for_bios(struct board_t *brd)
 {
 	uchar *addr;
 	u16 word;
 	u16 err1;
 	u16 err2;
+	int ret = 0;
 
 	if (!brd || (brd->magic != DGAP_BOARD_MAGIC) || !brd->re_map_membase)
-		return;
+		return ret;
 
 	addr = brd->re_map_membase;
 	word = readw(addr + POSTAREA);
@@ -4389,10 +4386,8 @@ static void dgap_do_wait_for_bios(struct board_t *brd)
 	brd->wait_for_bios = 0;
 	while (brd->wait_for_bios < 1000) {
 		/* Check to see if BIOS thinks board is good. (GD). */
-		if (word == *(u16 *) "GD") {
-			brd->state = FINISHED_BIOS_LOAD;
-			return;
-		}
+		if (word == *(u16 *) "GD")
+			return 1;
 		msleep_interruptible(10);
 		brd->wait_for_bios++;
 		word = readw(addr + POSTAREA);
@@ -4405,6 +4400,8 @@ static void dgap_do_wait_for_bios(struct board_t *brd)
 		brd->name, err1, err2);
 	brd->state = BOARD_FAILED;
 	brd->dpastatus = BD_NOBIOS;
+
+	return ret;
 }
 
 /*
@@ -4455,15 +4452,16 @@ static void dgap_do_fep_load(struct board_t *brd, uchar *ufep, int len)
 /*
  * Waits for the FEP to report thats its ready for us to use.
  */
-static void dgap_do_wait_for_fep(struct board_t *brd)
+static int dgap_do_wait_for_fep(struct board_t *brd)
 {
 	uchar *addr;
 	u16 word;
 	u16 err1;
 	u16 err2;
+	int ret = 0;
 
 	if (!brd || (brd->magic != DGAP_BOARD_MAGIC) || !brd->re_map_membase)
-		return;
+		return ret;
 
 	addr = brd->re_map_membase;
 	word = readw(addr + FEPSTAT);
@@ -4476,7 +4474,6 @@ static void dgap_do_wait_for_fep(struct board_t *brd)
 	while (brd->wait_for_fep < 500) {
 		/* Check to see if FEP is up and running now. */
 		if (word == *(u16 *) "OS") {
-			brd->state = FINISHED_FEP_LOAD;
 			/*
 			 * Check to see if the board can support FEP5+ commands.
 			*/
@@ -4484,7 +4481,7 @@ static void dgap_do_wait_for_fep(struct board_t *brd)
 			if (word == *(u16 *) "5A")
 				brd->bd_flags |= BD_FEP5PLUS;
 
-			return;
+			return 1;
 		}
 		msleep_interruptible(10);
 		brd->wait_for_fep++;
@@ -4498,6 +4495,8 @@ static void dgap_do_wait_for_fep(struct board_t *brd)
 		brd->name, err1, err2);
 	brd->state = BOARD_FAILED;
 	brd->dpastatus = BD_NOFEP;
+
+	return ret;
 }
 
 /*
diff --git a/drivers/staging/dgap/dgap.h b/drivers/staging/dgap/dgap.h
index 02d267f..c4d714c 100644
--- a/drivers/staging/dgap/dgap.h
+++ b/drivers/staging/dgap/dgap.h
@@ -487,8 +487,6 @@ enum {
  */
 enum {
 	BOARD_FAILED = 0,
-	FINISHED_BIOS_LOAD,
-	FINISHED_FEP_LOAD,
 	BOARD_READY
 };
 
-- 
1.8.1.4

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

  parent reply	other threads:[~2014-03-12 16:51 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-12 16:50 [PATCH 00/04] staging: dgap: Digi International dgap driver Mark Hounschell
2014-03-12 16:50 ` [PATCH 01/03] staging: dgap: remove unneeded dgap_driver_states Mark Hounschell
2014-03-12 16:50 ` [PATCH 02/03] staging: dgap: remove unused brd->state states Mark Hounschell
2014-03-12 16:50 ` Mark Hounschell [this message]
2014-03-28 11:34   ` [PATCH 03/03] staging: dgap: remove more unneeded brd-state states Dan Carpenter
     [not found]   ` <1990728274.443672.1396006449519.JavaMail.root@mx2.compro.net>
2014-03-28 13:08     ` Mark Hounschell
2014-03-28 15:43       ` Dan Carpenter
     [not found]     ` <1288128483.444586.1396012119570.JavaMail.root@mx2.compro.net>
2014-03-28 13:21       ` Mark Hounschell
2014-03-12 16:50 ` [PATCH 04/04] staging: dgap: Add a pr_info per board info Mark Hounschell
2014-03-17 21:35   ` Greg Kroah-Hartman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1394643056-3412-4-git-send-email-markh@compro.net \
    --to=markh@compro.net \
    --cc=driverdev-devel@linuxdriverproject.org \
    --cc=gregkh@linuxfoundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.