|
31 | 31 |
|
32 | 32 | #include "core.h"
|
33 | 33 |
|
| 34 | +#define ROOT_DIR_OFFSET 5 |
| 35 | + |
34 | 36 | void fw_csr_iterator_init(struct fw_csr_iterator *ci, const u32 *p)
|
35 | 37 | {
|
36 | 38 | ci->p = p + 1;
|
@@ -135,7 +137,7 @@ static void get_ids(const u32 *directory, int *id)
|
135 | 137 |
|
136 | 138 | static void get_modalias_ids(const struct fw_unit *unit, int *id)
|
137 | 139 | {
|
138 |
| - get_ids(&fw_parent_device(unit)->config_rom[5], id); |
| 140 | + get_ids(&fw_parent_device(unit)->config_rom[ROOT_DIR_OFFSET], id); |
139 | 141 | get_ids(unit->directory, id);
|
140 | 142 | }
|
141 | 143 |
|
@@ -259,7 +261,7 @@ static ssize_t show_immediate(struct device *dev,
|
259 | 261 | if (is_fw_unit(dev))
|
260 | 262 | dir = fw_unit(dev)->directory;
|
261 | 263 | else
|
262 |
| - dir = fw_device(dev)->config_rom + 5; |
| 264 | + dir = fw_device(dev)->config_rom + ROOT_DIR_OFFSET; |
263 | 265 |
|
264 | 266 | fw_csr_iterator_init(&ci, dir);
|
265 | 267 | while (fw_csr_iterator_next(&ci, &key, &value))
|
@@ -292,7 +294,7 @@ static ssize_t show_text_leaf(struct device *dev,
|
292 | 294 | if (is_fw_unit(dev))
|
293 | 295 | dir = fw_unit(dev)->directory;
|
294 | 296 | else
|
295 |
| - dir = fw_device(dev)->config_rom + 5; |
| 297 | + dir = fw_device(dev)->config_rom + ROOT_DIR_OFFSET; |
296 | 298 |
|
297 | 299 | if (buf) {
|
298 | 300 | bufsize = PAGE_SIZE - 1;
|
@@ -446,7 +448,7 @@ static ssize_t units_show(struct device *dev,
|
446 | 448 | int key, value, i = 0;
|
447 | 449 |
|
448 | 450 | down_read(&fw_device_rwsem);
|
449 |
| - fw_csr_iterator_init(&ci, &device->config_rom[5]); |
| 451 | + fw_csr_iterator_init(&ci, &device->config_rom[ROOT_DIR_OFFSET]); |
450 | 452 | while (fw_csr_iterator_next(&ci, &key, &value)) {
|
451 | 453 | if (key != (CSR_UNIT | CSR_DIRECTORY))
|
452 | 454 | continue;
|
@@ -691,7 +693,7 @@ static void create_units(struct fw_device *device)
|
691 | 693 | int key, value, i;
|
692 | 694 |
|
693 | 695 | i = 0;
|
694 |
| - fw_csr_iterator_init(&ci, &device->config_rom[5]); |
| 696 | + fw_csr_iterator_init(&ci, &device->config_rom[ROOT_DIR_OFFSET]); |
695 | 697 | while (fw_csr_iterator_next(&ci, &key, &value)) {
|
696 | 698 | if (key != (CSR_UNIT | CSR_DIRECTORY))
|
697 | 699 | continue;
|
|
0 commit comments