mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Stefan Richter <stefanr@s5r6.in-berlin.de>
To: linux1394-devel@lists.sourceforge.net
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH 2/7] firewire: sbp2: define some magic numbers as macros
Date: Sat, 24 Jan 2009 19:42:47 +0100 (CET)	[thread overview]
Message-ID: <tkrat.99a09faf4c137c20@s5r6.in-berlin.de> (raw)
In-Reply-To: <tkrat.6fe4fe5b72231863@s5r6.in-berlin.de>

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
---
 drivers/firewire/fw-sbp2.c |   23 ++++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)

Index: linux/drivers/firewire/fw-sbp2.c
===================================================================
--- linux.orig/drivers/firewire/fw-sbp2.c
+++ linux/drivers/firewire/fw-sbp2.c
@@ -311,14 +311,16 @@ struct sbp2_command_orb {
 	dma_addr_t page_table_bus;
 };
 
+#define SBP2_ROM_VALUE_WILDCARD ~0         /* match all */
+#define SBP2_ROM_VALUE_MISSING  0xff000000 /* not present in the unit dir. */
+
 /*
  * List of devices with known bugs.
  *
  * The firmware_revision field, masked with 0xffff00, is the best
  * indicator for the type of bridge chip of a device.  It yields a few
  * false positives but this did not break correctly behaving devices
- * so far.  We use ~0 as a wildcard, since the 24 bit values we get
- * from the config rom can never match that.
+ * so far.
  */
 static const struct {
 	u32 firmware_revision;
@@ -340,22 +342,22 @@ static const struct {
 	},
 	/* Initio bridges, actually only needed for some older ones */ {
 		.firmware_revision	= 0x000200,
-		.model			= ~0,
+		.model			= SBP2_ROM_VALUE_WILDCARD,
 		.workarounds		= SBP2_WORKAROUND_INQUIRY_36,
 	},
 	/* PL-3507 bridge with Prolific firmware */ {
 		.firmware_revision	= 0x012800,
-		.model			= ~0,
+		.model			= SBP2_ROM_VALUE_WILDCARD,
 		.workarounds		= SBP2_WORKAROUND_POWER_CONDITION,
 	},
 	/* Symbios bridge */ {
 		.firmware_revision	= 0xa0b800,
-		.model			= ~0,
+		.model			= SBP2_ROM_VALUE_WILDCARD,
 		.workarounds		= SBP2_WORKAROUND_128K_MAX_TRANS,
 	},
 	/* Datafab MD2-FW2 with Symbios/LSILogic SYM13FW500 bridge */ {
 		.firmware_revision	= 0x002600,
-		.model			= ~0,
+		.model			= SBP2_ROM_VALUE_WILDCARD,
 		.workarounds		= SBP2_WORKAROUND_128K_MAX_TRANS,
 	},
 
@@ -1087,7 +1089,7 @@ static void sbp2_init_workarounds(struct
 			continue;
 
 		if (sbp2_workarounds_table[i].model != model &&
-		    sbp2_workarounds_table[i].model != ~0)
+		    sbp2_workarounds_table[i].model != SBP2_ROM_VALUE_WILDCARD)
 			continue;
 
 		w |= sbp2_workarounds_table[i].workarounds;
@@ -1137,14 +1139,13 @@ static int sbp2_probe(struct device *dev
 	fw_device_get(device);
 	fw_unit_get(unit);
 
-	/* Initialize to values that won't match anything in our table. */
-	firmware_revision = 0xff000000;
-	model = 0xff000000;
-
 	/* implicit directory ID */
 	tgt->directory_id = ((unit->directory - device->config_rom) * 4
 			     + CSR_CONFIG_ROM) & 0xffffff;
 
+	firmware_revision = SBP2_ROM_VALUE_MISSING;
+	model		  = SBP2_ROM_VALUE_MISSING;
+
 	if (sbp2_scan_unit_dir(tgt, unit->directory, &model,
 			       &firmware_revision) < 0)
 		goto fail_tgt_put;

-- 
Stefan Richter
-=====-==--= ---= ==---
http://arcgraph.de/sr/


  parent reply	other threads:[~2009-01-24 18:43 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-24 18:41 [PATCH 0/7] ieee1394 + firewire: misc sbp2 updates Stefan Richter
2009-01-24 18:42 ` [PATCH 1/7] firewire: sbp2: fix payload limit at S1600 and S3200 Stefan Richter
2009-01-24 18:42 ` Stefan Richter [this message]
2009-01-24 18:43 ` [PATCH 3/7] ieee1394: " Stefan Richter
2009-01-24 18:44 ` [PATCH 4/7] ieee1394: sbp2: don't assume zero model_id or firmware_revision if there is none Stefan Richter
2009-01-24 18:45 ` [PATCH 5/7] ieee1394: sbp2: follow up on "ieee1394: inherit ud vendor_id from node vendor_id" Stefan Richter
2009-01-24 18:45 ` [PATCH RFT 6/7] ieee1394: sbp2: add workarounds for 2nd and 3rd generation iPods Stefan Richter
2009-01-24 22:29   ` Stefan Richter
2009-01-24 18:46 ` [PATCH RFT 7/7] firewire: " Stefan Richter
2009-01-28 22:18   ` Jarod Wilson
2009-01-28 22:25     ` Jarod Wilson
2009-01-28 23:11       ` [PATCH revised] " Stefan Richter
2009-01-28 23:13         ` [PATCH revised] ieee1394: " Stefan Richter
2009-01-29  3:21           ` Jarod Wilson
2009-01-29  3:20         ` [PATCH revised] firewire: " Jarod Wilson
2009-01-28 23:11     ` [PATCH RFT 7/7] " Stefan Richter
2009-01-29  3:18       ` Jarod Wilson
2009-01-29 20:09         ` Stefan Richter
2009-01-29 20:40           ` Alan Stern
2009-01-29 21:28             ` Stefan Richter
2009-01-29 22:38               ` Alan Stern
2009-01-30 15:16               ` Jarod Wilson

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=tkrat.99a09faf4c137c20@s5r6.in-berlin.de \
    --to=stefanr@s5r6.in-berlin.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux1394-devel@lists.sourceforge.net \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®