[PATCH 2/2] ieee1394: add preprocessor constant for invalid csr address

[PATCH 2/2] ieee1394: add preprocessor constant for invalid csr address

Post by Stefan Ric » Sun, 04 Jun 2006 20:20:10


eplace occurrences of the magic value ~(u64)0 for invalid
CSR address spaces by a named constant for better readability.

Signed-off-by: Stefan Richter < XXXX@XXXXX.COM >
---
drivers/ieee1394/csr1212.c | 2 +-
drivers/ieee1394/csr1212.h | 1 +
drivers/ieee1394/highlevel.c | 9 +++++----
drivers/ieee1394/eth1394.c | 16 +++++++---------
drivers/ieee1394/eth1394.h | 2 --
drivers/ieee1394/sbp2.c | 8 ++++----
6 files changed, 18 insertions(+), 20 deletions(-)

Index: linux/drivers/ieee1394/csr1212.h
===================================================================
--- linux.orig/drivers/ieee1394/csr1212.h 2006-04-24 22:20:24.000000000 +0200
+++ linux/drivers/ieee1394/csr1212.h 2006-06-03 12:52:32.000000000 +0200
@@ -192,6 +192,7 @@

#define CSR1212_EXTENDED_ROM_SIZE (0x10000 * sizeof(u_int32_t))

+#define CSR1212_INVALID_ADDR_SPACE -1

/* Config ROM image structures */
struct csr1212_bus_info_block_img {
Index: linux/drivers/ieee1394/csr1212.c
===================================================================
--- linux.orig/drivers/ieee1394/csr1212.c 2006-04-24 22:20:24.000000000 +0200
+++ linux/drivers/ieee1394/csr1212.c 2006-06-03 12:12:20.000000000 +0200
@@ -779,7 +779,7 @@ static int csr1212_append_new_cache(stru
romsize = (romsize + (csr->max_rom - 1)) & ~(csr->max_rom - 1);

csr_addr = csr->ops->allocate_addr_range(romsize, csr->max_rom, csr->private);
- if (csr_addr == ~0ULL) {
+ if (csr_addr == CSR1212_INVALID_ADDR_SPACE) {
return CSR1212_ENOMEM;
}
if (csr_addr < CSR1212_REGISTER_SPACE_BASE) {
Index: linux/drivers/ieee1394/highlevel.c
===================================================================
--- linux.orig/drivers/ieee1394/highlevel.c 2006-06-03 02:13:18.000000000 +0200
+++ linux/drivers/ieee1394/highlevel.c 2006-06-03 12:18:23.000000000 +0200
@@ -301,7 +301,7 @@ u64 hpsb_allocate_and_register_addrspace
{
struct hpsb_address_serve *as, *a1, *a2;
struct list_head *entry;
- u64 retval = ~0ULL;
+ u64 retval = CSR1212_INVALID_ADDR_SPACE;
unsigned long flags;
u64 align_mask = ~(alignment - 1);

@@ -315,9 +315,10 @@ u64 hpsb_allocate_and_register_addrspace

/* default range,
* avoids controller's posted write area (see OHCI 1.1 clause 1.5) */
- if (start == ~0ULL && end == ~0ULL) {
+ if (start == CSR1212_INVALID_ADDR_SPACE &&
+ end == CSR1212_INVALID_ADDR_SPACE) {
start = host->middle_addr_space;
- end = CSR1212_ALL_SPACE_END;
+ end = CSR1212_ALL_SPACE_END;
}

if (((start|end) & ~align_mask) || (start >= end) || (end > 0x1000000000000ULL)) {
@@ -361,7 +362,7 @@ u64 hpsb_allocate_and_register_addrspace

write_unlock_irqrestore(&addr_space_lock, flags);

- if (retval == ~0ULL) {
+ if (retval == CSR1212_INVALID_ADDR_SPACE) {
kfree(as);
}

Index: linux/drivers/ieee1394/eth1394.h
===================================================================
--- linux.orig/drivers/ieee1394/eth1394.h 2006-04-24 22:20:24.000000000 +0200
+++ linux/drivers/ieee1394/eth1394.h 2006-06-03 12:14:40.000000000 +0200
@@ -32,8 +32,6 @@
* S3200 (per Table 16-3 of IEEE 1394b-2002). */
#define ETHER1394_REGION_ADDR_LEN 4096

-#define ETHER1394_INVALID_ADDR ~0ULL
-
/* GASP identifier numbers for IPv4 over IEEE 1394 */
#define ETHER1394_GASP_SPECIFIER_ID 0x00005E
#define ETHER1394_GASP_SPECIFIER_ID_HI ((ETHER1394_GASP_SPECIFIER_ID >
 
 
 

1. ieee1394/oui.db (was [PATCH] ieee1394: allow building with absolute SUBDIRS path)

2. ieee1394/oui.db (was [PATCH] ieee1394: allow building with absolute SUBDIRS path)


I have no strong feelings for or against oui.db. It is nice to have the
vendor names decoded in sysfs, although the footprint is considerable:

$ du oui.o ieee1394.ko
252K oui.o
356K ieee1394.ko

OTOH, nobody is forced to compile it in. And except for the Makefile
patch and .gitignore patch which came in this month, oui.db does not
impose a real maintenance burden. The fact that we are too lazy to
update the db saves us work too. :-)

BTW, oui.db has 7048 entries but IEEE lists 8949 today. Either people
vote oui.db off the island now, or I will submit an update.
--
Stefan Richter
-=====-=-==- ---= =====
http://www.yqcomputer.com/
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to XXXX@XXXXX.COM
More majordomo info at http://www.yqcomputer.com/
Please read the FAQ at http://www.yqcomputer.com/

3. [PATCH] ieee1394: remove NULL checks prior to kfree in ieee1394, kfree handles null pointers fine.

4. [PATCH 27/46] IEEE1394: remove rwsem use from ieee1394 core

5. [PATCH] ieee1394: remove NULL checks prior to kfree in ieee1394, kfree handles null pointers fine.

6. ieee1394/oui.db (was [PATCH] ieee1394: allow building with absolute SUBDIRS path)

7. [PATCH] ieee1394: raw1394: Add ioctl() for 32bit userland on 64bit kernel, amendment

8. [PATCH] ieee1394: ohci1394: add reg_flush, remove bogus barriers

9. [PATCH 18/59] drivers/ieee1394: Add missing "space"

10. [PATCH 3/3] ieee1394: raw1394: Add ioctl() for 32bit userland on 64bit kernel

11. [PATCH RFT 6/7] ieee1394: sbp2: add workarounds for 2nd and 3rd generation iPods

12. Invalid Internet address specified. Invalid Internet address specified.

13. [PATCH] Add documentation to some preprocessor directives in init/*.c.

14. can't register CSR - invalid X500 Char - HELP!!

15. predefined preprocessor constants