aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ieee1394
diff options
context:
space:
mode:
authorBen Collins <bcollins@ubuntu.com>2006-06-12 18:15:31 -0400
committerBen Collins <bcollins@ubuntu.com>2006-06-12 18:15:31 -0400
commit6737231ead125c7cee7ce4d3a74179bdac085529 (patch)
treef0c996c8c48d07398c47ada5a2dacdcbf0800770 /drivers/ieee1394
parente269d276792684a13ab0d9acd8c024ec7d6c5f4d (diff)
ieee1394: add preprocessor constant for invalid csr address
Replace occurrences of the magic value ~(u64)0 for invalid CSR address spaces by a named constant for better readability. Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de> Signed-off-by: Ben Collins <bcollins@ubuntu.com>
Diffstat (limited to 'drivers/ieee1394')
-rw-r--r--drivers/ieee1394/csr1212.c2
-rw-r--r--drivers/ieee1394/csr1212.h1
-rw-r--r--drivers/ieee1394/eth1394.c16
-rw-r--r--drivers/ieee1394/eth1394.h2
-rw-r--r--drivers/ieee1394/highlevel.c9
-rw-r--r--drivers/ieee1394/sbp2.c8
6 files changed, 18 insertions, 20 deletions
diff --git a/drivers/ieee1394/csr1212.c b/drivers/ieee1394/csr1212.c
index 15773544234..586f71e7346 100644
--- a/drivers/ieee1394/csr1212.c
+++ b/drivers/ieee1394/csr1212.c
@@ -779,7 +779,7 @@ static int csr1212_append_new_cache(struct csr1212_csr *csr, size_t romsize)
779 romsize = (romsize + (csr->max_rom - 1)) & ~(csr->max_rom - 1); 779 romsize = (romsize + (csr->max_rom - 1)) & ~(csr->max_rom - 1);
780 780
781 csr_addr = csr->ops->allocate_addr_range(romsize, csr->max_rom, csr->private); 781 csr_addr = csr->ops->allocate_addr_range(romsize, csr->max_rom, csr->private);
782 if (csr_addr == ~0ULL) { 782 if (csr_addr == CSR1212_INVALID_ADDR_SPACE) {
783 return CSR1212_ENOMEM; 783 return CSR1212_ENOMEM;
784 } 784 }
785 if (csr_addr < CSR1212_REGISTER_SPACE_BASE) { 785 if (csr_addr < CSR1212_REGISTER_SPACE_BASE) {
diff --git a/drivers/ieee1394/csr1212.h b/drivers/ieee1394/csr1212.h
index cecd5871f2d..17ddd72dee4 100644
--- a/drivers/ieee1394/csr1212.h
+++ b/drivers/ieee1394/csr1212.h
@@ -192,6 +192,7 @@
192 192
193#define CSR1212_EXTENDED_ROM_SIZE (0x10000 * sizeof(u_int32_t)) 193#define CSR1212_EXTENDED_ROM_SIZE (0x10000 * sizeof(u_int32_t))
194 194
195#define CSR1212_INVALID_ADDR_SPACE -1
195 196
196/* Config ROM image structures */ 197/* Config ROM image structures */
197struct csr1212_bus_info_block_img { 198struct csr1212_bus_info_block_img {
diff --git a/drivers/ieee1394/eth1394.c b/drivers/ieee1394/eth1394.c
index 3ec3b13e491..cf80fed6163 100644
--- a/drivers/ieee1394/eth1394.c
+++ b/drivers/ieee1394/eth1394.c
@@ -367,7 +367,7 @@ static int eth1394_probe(struct device *dev)
367 spin_lock_init(&node_info->pdg.lock); 367 spin_lock_init(&node_info->pdg.lock);
368 INIT_LIST_HEAD(&node_info->pdg.list); 368 INIT_LIST_HEAD(&node_info->pdg.list);
369 node_info->pdg.sz = 0; 369 node_info->pdg.sz = 0;
370 node_info->fifo = ETHER1394_INVALID_ADDR; 370 node_info->fifo = CSR1212_INVALID_ADDR_SPACE;
371 371
372 ud->device.driver_data = node_info; 372 ud->device.driver_data = node_info;
373 new_node->ud = ud; 373 new_node->ud = ud;
@@ -566,13 +566,11 @@ static void ether1394_add_host (struct hpsb_host *host)
566 if (!(host->config_roms & HPSB_CONFIG_ROM_ENTRY_IP1394)) 566 if (!(host->config_roms & HPSB_CONFIG_ROM_ENTRY_IP1394))
567 return; 567 return;
568 568
569 fifo_addr = hpsb_allocate_and_register_addrspace(&eth1394_highlevel, 569 fifo_addr = hpsb_allocate_and_register_addrspace(
570 host, 570 &eth1394_highlevel, host, &addr_ops,
571 &addr_ops, 571 ETHER1394_REGION_ADDR_LEN, ETHER1394_REGION_ADDR_LEN,
572 ETHER1394_REGION_ADDR_LEN, 572 CSR1212_INVALID_ADDR_SPACE, CSR1212_INVALID_ADDR_SPACE);
573 ETHER1394_REGION_ADDR_LEN, 573 if (fifo_addr == CSR1212_INVALID_ADDR_SPACE)
574 -1, -1);
575 if (fifo_addr == ~0ULL)
576 goto out; 574 goto out;
577 575
578 /* We should really have our own alloc_hpsbdev() function in 576 /* We should really have our own alloc_hpsbdev() function in
@@ -1686,7 +1684,7 @@ static int ether1394_tx (struct sk_buff *skb, struct net_device *dev)
1686 goto fail; 1684 goto fail;
1687 } 1685 }
1688 node_info = (struct eth1394_node_info*)node->ud->device.driver_data; 1686 node_info = (struct eth1394_node_info*)node->ud->device.driver_data;
1689 if (node_info->fifo == ETHER1394_INVALID_ADDR) { 1687 if (node_info->fifo == CSR1212_INVALID_ADDR_SPACE) {
1690 ret = -EAGAIN; 1688 ret = -EAGAIN;
1691 goto fail; 1689 goto fail;
1692 } 1690 }
diff --git a/drivers/ieee1394/eth1394.h b/drivers/ieee1394/eth1394.h
index a77213cfc48..c45cbff9138 100644
--- a/drivers/ieee1394/eth1394.h
+++ b/drivers/ieee1394/eth1394.h
@@ -32,8 +32,6 @@
32 * S3200 (per Table 16-3 of IEEE 1394b-2002). */ 32 * S3200 (per Table 16-3 of IEEE 1394b-2002). */
33#define ETHER1394_REGION_ADDR_LEN 4096 33#define ETHER1394_REGION_ADDR_LEN 4096
34 34
35#define ETHER1394_INVALID_ADDR ~0ULL
36
37/* GASP identifier numbers for IPv4 over IEEE 1394 */ 35/* GASP identifier numbers for IPv4 over IEEE 1394 */
38#define ETHER1394_GASP_SPECIFIER_ID 0x00005E 36#define ETHER1394_GASP_SPECIFIER_ID 0x00005E
39#define ETHER1394_GASP_SPECIFIER_ID_HI ((ETHER1394_GASP_SPECIFIER_ID >> 8) & 0xffff) 37#define ETHER1394_GASP_SPECIFIER_ID_HI ((ETHER1394_GASP_SPECIFIER_ID >> 8) & 0xffff)
diff --git a/drivers/ieee1394/highlevel.c b/drivers/ieee1394/highlevel.c
index 29c5255b933..165dcd66956 100644
--- a/drivers/ieee1394/highlevel.c
+++ b/drivers/ieee1394/highlevel.c
@@ -301,7 +301,7 @@ u64 hpsb_allocate_and_register_addrspace(struct hpsb_highlevel *hl,
301{ 301{
302 struct hpsb_address_serve *as, *a1, *a2; 302 struct hpsb_address_serve *as, *a1, *a2;
303 struct list_head *entry; 303 struct list_head *entry;
304 u64 retval = ~0ULL; 304 u64 retval = CSR1212_INVALID_ADDR_SPACE;
305 unsigned long flags; 305 unsigned long flags;
306 u64 align_mask = ~(alignment - 1); 306 u64 align_mask = ~(alignment - 1);
307 307
@@ -314,9 +314,10 @@ u64 hpsb_allocate_and_register_addrspace(struct hpsb_highlevel *hl,
314 314
315 /* default range, 315 /* default range,
316 * avoids controller's posted write area (see OHCI 1.1 clause 1.5) */ 316 * avoids controller's posted write area (see OHCI 1.1 clause 1.5) */
317 if (start == ~0ULL && end == ~0ULL) { 317 if (start == CSR1212_INVALID_ADDR_SPACE &&
318 end == CSR1212_INVALID_ADDR_SPACE) {
318 start = host->middle_addr_space; 319 start = host->middle_addr_space;
319 end = CSR1212_ALL_SPACE_END; 320 end = CSR1212_ALL_SPACE_END;
320 } 321 }
321 322
322 if (((start|end) & ~align_mask) || (start >= end) || (end > 0x1000000000000ULL)) { 323 if (((start|end) & ~align_mask) || (start >= end) || (end > 0x1000000000000ULL)) {
@@ -360,7 +361,7 @@ u64 hpsb_allocate_and_register_addrspace(struct hpsb_highlevel *hl,
360 361
361 write_unlock_irqrestore(&addr_space_lock, flags); 362 write_unlock_irqrestore(&addr_space_lock, flags);
362 363
363 if (retval == ~0ULL) { 364 if (retval == CSR1212_INVALID_ADDR_SPACE) {
364 kfree(as); 365 kfree(as);
365 } 366 }
366 367
diff --git a/drivers/ieee1394/sbp2.c b/drivers/ieee1394/sbp2.c
index 975a56bfab3..1d5ceb7ecc8 100644
--- a/drivers/ieee1394/sbp2.c
+++ b/drivers/ieee1394/sbp2.c
@@ -794,7 +794,7 @@ static struct scsi_id_instance_data *sbp2_alloc_device(struct unit_directory *ud
794 scsi_id->ud = ud; 794 scsi_id->ud = ud;
795 scsi_id->speed_code = IEEE1394_SPEED_100; 795 scsi_id->speed_code = IEEE1394_SPEED_100;
796 scsi_id->max_payload_size = sbp2_speedto_max_payload[IEEE1394_SPEED_100]; 796 scsi_id->max_payload_size = sbp2_speedto_max_payload[IEEE1394_SPEED_100];
797 scsi_id->status_fifo_addr = ~0ULL; 797 scsi_id->status_fifo_addr = CSR1212_INVALID_ADDR_SPACE;
798 atomic_set(&scsi_id->sbp2_login_complete, 0); 798 atomic_set(&scsi_id->sbp2_login_complete, 0);
799 INIT_LIST_HEAD(&scsi_id->sbp2_command_orb_inuse); 799 INIT_LIST_HEAD(&scsi_id->sbp2_command_orb_inuse);
800 INIT_LIST_HEAD(&scsi_id->sbp2_command_orb_completed); 800 INIT_LIST_HEAD(&scsi_id->sbp2_command_orb_completed);
@@ -848,7 +848,7 @@ static struct scsi_id_instance_data *sbp2_alloc_device(struct unit_directory *ud
848 &sbp2_highlevel, ud->ne->host, &sbp2_ops, 848 &sbp2_highlevel, ud->ne->host, &sbp2_ops,
849 sizeof(struct sbp2_status_block), sizeof(quadlet_t), 849 sizeof(struct sbp2_status_block), sizeof(quadlet_t),
850 ud->ne->host->low_addr_space, CSR1212_ALL_SPACE_END); 850 ud->ne->host->low_addr_space, CSR1212_ALL_SPACE_END);
851 if (scsi_id->status_fifo_addr == ~0ULL) { 851 if (scsi_id->status_fifo_addr == CSR1212_INVALID_ADDR_SPACE) {
852 SBP2_ERR("failed to allocate status FIFO address range"); 852 SBP2_ERR("failed to allocate status FIFO address range");
853 goto failed_alloc; 853 goto failed_alloc;
854 } 854 }
@@ -1090,9 +1090,9 @@ static void sbp2_remove_device(struct scsi_id_instance_data *scsi_id)
1090 SBP2_DMA_FREE("single query logins data"); 1090 SBP2_DMA_FREE("single query logins data");
1091 } 1091 }
1092 1092
1093 if (scsi_id->status_fifo_addr != ~0ULL) 1093 if (scsi_id->status_fifo_addr != CSR1212_INVALID_ADDR_SPACE)
1094 hpsb_unregister_addrspace(&sbp2_highlevel, hi->host, 1094 hpsb_unregister_addrspace(&sbp2_highlevel, hi->host,
1095 scsi_id->status_fifo_addr); 1095 scsi_id->status_fifo_addr);
1096 1096
1097 scsi_id->ud->device.driver_data = NULL; 1097 scsi_id->ud->device.driver_data = NULL;
1098 1098