diff options
author | Stefan Richter <stefanr@s5r6.in-berlin.de> | 2006-10-20 19:23:56 -0400 |
---|---|---|
committer | Stefan Richter <stefanr@s5r6.in-berlin.de> | 2006-12-07 15:32:01 -0500 |
commit | 7fdfc90945e308dc1be37e3914cd979a535263e9 (patch) | |
tree | 524361e6f2d765bb92812906fcec541c5f5cdef2 | |
parent | b7cffc57a777722941cfd904fcdbb47fc615b808 (diff) |
ieee1394: nodemgr: reflect which return values are errors
Give better names to local variables.
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
-rw-r--r-- | drivers/ieee1394/nodemgr.c | 64 |
1 files changed, 30 insertions, 34 deletions
diff --git a/drivers/ieee1394/nodemgr.c b/drivers/ieee1394/nodemgr.c index b79ff695ca3c..bffa26e48152 100644 --- a/drivers/ieee1394/nodemgr.c +++ b/drivers/ieee1394/nodemgr.c | |||
@@ -67,7 +67,7 @@ static int nodemgr_check_speed(struct nodemgr_csr_info *ci, u64 addr, | |||
67 | { | 67 | { |
68 | quadlet_t q; | 68 | quadlet_t q; |
69 | u8 i, *speed, old_speed, good_speed; | 69 | u8 i, *speed, old_speed, good_speed; |
70 | int ret; | 70 | int error; |
71 | 71 | ||
72 | speed = &(ci->host->speed[NODEID_TO_NODE(ci->nodeid)]); | 72 | speed = &(ci->host->speed[NODEID_TO_NODE(ci->nodeid)]); |
73 | old_speed = *speed; | 73 | old_speed = *speed; |
@@ -79,9 +79,9 @@ static int nodemgr_check_speed(struct nodemgr_csr_info *ci, u64 addr, | |||
79 | * just finished its initialization. */ | 79 | * just finished its initialization. */ |
80 | for (i = IEEE1394_SPEED_100; i <= old_speed; i++) { | 80 | for (i = IEEE1394_SPEED_100; i <= old_speed; i++) { |
81 | *speed = i; | 81 | *speed = i; |
82 | ret = hpsb_read(ci->host, ci->nodeid, ci->generation, addr, | 82 | error = hpsb_read(ci->host, ci->nodeid, ci->generation, addr, |
83 | &q, sizeof(quadlet_t)); | 83 | &q, sizeof(quadlet_t)); |
84 | if (ret) | 84 | if (error) |
85 | break; | 85 | break; |
86 | *buffer = q; | 86 | *buffer = q; |
87 | good_speed = i; | 87 | good_speed = i; |
@@ -95,19 +95,19 @@ static int nodemgr_check_speed(struct nodemgr_csr_info *ci, u64 addr, | |||
95 | return 0; | 95 | return 0; |
96 | } | 96 | } |
97 | *speed = old_speed; | 97 | *speed = old_speed; |
98 | return ret; | 98 | return error; |
99 | } | 99 | } |
100 | 100 | ||
101 | static int nodemgr_bus_read(struct csr1212_csr *csr, u64 addr, u16 length, | 101 | static int nodemgr_bus_read(struct csr1212_csr *csr, u64 addr, u16 length, |
102 | void *buffer, void *__ci) | 102 | void *buffer, void *__ci) |
103 | { | 103 | { |
104 | struct nodemgr_csr_info *ci = (struct nodemgr_csr_info*)__ci; | 104 | struct nodemgr_csr_info *ci = (struct nodemgr_csr_info*)__ci; |
105 | int i, ret; | 105 | int i, error; |
106 | 106 | ||
107 | for (i = 1; ; i++) { | 107 | for (i = 1; ; i++) { |
108 | ret = hpsb_read(ci->host, ci->nodeid, ci->generation, addr, | 108 | error = hpsb_read(ci->host, ci->nodeid, ci->generation, addr, |
109 | buffer, length); | 109 | buffer, length); |
110 | if (!ret) { | 110 | if (!error) { |
111 | ci->speed_unverified = 0; | 111 | ci->speed_unverified = 0; |
112 | break; | 112 | break; |
113 | } | 113 | } |
@@ -118,14 +118,14 @@ static int nodemgr_bus_read(struct csr1212_csr *csr, u64 addr, u16 length, | |||
118 | /* The ieee1394_core guessed the node's speed capability from | 118 | /* The ieee1394_core guessed the node's speed capability from |
119 | * the self ID. Check whether a lower speed works. */ | 119 | * the self ID. Check whether a lower speed works. */ |
120 | if (ci->speed_unverified && length == sizeof(quadlet_t)) { | 120 | if (ci->speed_unverified && length == sizeof(quadlet_t)) { |
121 | ret = nodemgr_check_speed(ci, addr, buffer); | 121 | error = nodemgr_check_speed(ci, addr, buffer); |
122 | if (!ret) | 122 | if (!error) |
123 | break; | 123 | break; |
124 | } | 124 | } |
125 | if (msleep_interruptible(334)) | 125 | if (msleep_interruptible(334)) |
126 | return -EINTR; | 126 | return -EINTR; |
127 | } | 127 | } |
128 | return ret; | 128 | return error; |
129 | } | 129 | } |
130 | 130 | ||
131 | static int nodemgr_get_max_rom(quadlet_t *bus_info_data, void *__ci) | 131 | static int nodemgr_get_max_rom(quadlet_t *bus_info_data, void *__ci) |
@@ -1226,14 +1226,11 @@ static int nodemgr_uevent(struct class_device *cdev, char **envp, int num_envp, | |||
1226 | 1226 | ||
1227 | int hpsb_register_protocol(struct hpsb_protocol_driver *driver) | 1227 | int hpsb_register_protocol(struct hpsb_protocol_driver *driver) |
1228 | { | 1228 | { |
1229 | int ret; | ||
1230 | |||
1231 | /* This will cause a probe for devices */ | 1229 | /* This will cause a probe for devices */ |
1232 | ret = driver_register(&driver->driver); | 1230 | int error = driver_register(&driver->driver); |
1233 | if (!ret) | 1231 | if (!error) |
1234 | nodemgr_create_drv_files(driver); | 1232 | nodemgr_create_drv_files(driver); |
1235 | 1233 | return error; | |
1236 | return ret; | ||
1237 | } | 1234 | } |
1238 | 1235 | ||
1239 | void hpsb_unregister_protocol(struct hpsb_protocol_driver *driver) | 1236 | void hpsb_unregister_protocol(struct hpsb_protocol_driver *driver) |
@@ -1468,7 +1465,7 @@ static void nodemgr_irm_write_bc(struct node_entry *ne, int generation) | |||
1468 | { | 1465 | { |
1469 | const u64 bc_addr = (CSR_REGISTER_BASE | CSR_BROADCAST_CHANNEL); | 1466 | const u64 bc_addr = (CSR_REGISTER_BASE | CSR_BROADCAST_CHANNEL); |
1470 | quadlet_t bc_remote, bc_local; | 1467 | quadlet_t bc_remote, bc_local; |
1471 | int ret; | 1468 | int error; |
1472 | 1469 | ||
1473 | if (!ne->host->is_irm || ne->generation != generation || | 1470 | if (!ne->host->is_irm || ne->generation != generation || |
1474 | ne->nodeid == ne->host->node_id) | 1471 | ne->nodeid == ne->host->node_id) |
@@ -1477,9 +1474,9 @@ static void nodemgr_irm_write_bc(struct node_entry *ne, int generation) | |||
1477 | bc_local = cpu_to_be32(ne->host->csr.broadcast_channel); | 1474 | bc_local = cpu_to_be32(ne->host->csr.broadcast_channel); |
1478 | 1475 | ||
1479 | /* Check if the register is implemented and 1394a compliant. */ | 1476 | /* Check if the register is implemented and 1394a compliant. */ |
1480 | ret = hpsb_read(ne->host, ne->nodeid, generation, bc_addr, &bc_remote, | 1477 | error = hpsb_read(ne->host, ne->nodeid, generation, bc_addr, &bc_remote, |
1481 | sizeof(bc_remote)); | 1478 | sizeof(bc_remote)); |
1482 | if (!ret && bc_remote & cpu_to_be32(0x80000000) && | 1479 | if (!error && bc_remote & cpu_to_be32(0x80000000) && |
1483 | bc_remote != bc_local) | 1480 | bc_remote != bc_local) |
1484 | hpsb_node_write(ne, bc_addr, &bc_local, sizeof(bc_local)); | 1481 | hpsb_node_write(ne, bc_addr, &bc_local, sizeof(bc_local)); |
1485 | } | 1482 | } |
@@ -1569,7 +1566,7 @@ static void nodemgr_node_probe(struct host_info *hi, int generation) | |||
1569 | static int nodemgr_send_resume_packet(struct hpsb_host *host) | 1566 | static int nodemgr_send_resume_packet(struct hpsb_host *host) |
1570 | { | 1567 | { |
1571 | struct hpsb_packet *packet; | 1568 | struct hpsb_packet *packet; |
1572 | int ret = 1; | 1569 | int error = -ENOMEM; |
1573 | 1570 | ||
1574 | packet = hpsb_make_phypacket(host, | 1571 | packet = hpsb_make_phypacket(host, |
1575 | EXTPHYPACKET_TYPE_RESUME | | 1572 | EXTPHYPACKET_TYPE_RESUME | |
@@ -1577,12 +1574,12 @@ static int nodemgr_send_resume_packet(struct hpsb_host *host) | |||
1577 | if (packet) { | 1574 | if (packet) { |
1578 | packet->no_waiter = 1; | 1575 | packet->no_waiter = 1; |
1579 | packet->generation = get_hpsb_generation(host); | 1576 | packet->generation = get_hpsb_generation(host); |
1580 | ret = hpsb_send_packet(packet); | 1577 | error = hpsb_send_packet(packet); |
1581 | } | 1578 | } |
1582 | if (ret) | 1579 | if (error) |
1583 | HPSB_WARN("fw-host%d: Failed to broadcast resume packet", | 1580 | HPSB_WARN("fw-host%d: Failed to broadcast resume packet", |
1584 | host->id); | 1581 | host->id); |
1585 | return ret; | 1582 | return error; |
1586 | } | 1583 | } |
1587 | 1584 | ||
1588 | /* Perform a few high-level IRM responsibilities. */ | 1585 | /* Perform a few high-level IRM responsibilities. */ |
@@ -1852,20 +1849,19 @@ static struct hpsb_highlevel nodemgr_highlevel = { | |||
1852 | 1849 | ||
1853 | int init_ieee1394_nodemgr(void) | 1850 | int init_ieee1394_nodemgr(void) |
1854 | { | 1851 | { |
1855 | int ret; | 1852 | int error; |
1856 | 1853 | ||
1857 | ret = class_register(&nodemgr_ne_class); | 1854 | error = class_register(&nodemgr_ne_class); |
1858 | if (ret < 0) | 1855 | if (error) |
1859 | return ret; | 1856 | return error; |
1860 | 1857 | ||
1861 | ret = class_register(&nodemgr_ud_class); | 1858 | error = class_register(&nodemgr_ud_class); |
1862 | if (ret < 0) { | 1859 | if (error) { |
1863 | class_unregister(&nodemgr_ne_class); | 1860 | class_unregister(&nodemgr_ne_class); |
1864 | return ret; | 1861 | return error; |
1865 | } | 1862 | } |
1866 | 1863 | ||
1867 | hpsb_register_highlevel(&nodemgr_highlevel); | 1864 | hpsb_register_highlevel(&nodemgr_highlevel); |
1868 | |||
1869 | return 0; | 1865 | return 0; |
1870 | } | 1866 | } |
1871 | 1867 | ||