diff options
Diffstat (limited to 'drivers/ieee1394/hosts.c')
| -rw-r--r-- | drivers/ieee1394/hosts.c | 41 |
1 files changed, 24 insertions, 17 deletions
diff --git a/drivers/ieee1394/hosts.c b/drivers/ieee1394/hosts.c index b935e08695a9..ee82a5320bf7 100644 --- a/drivers/ieee1394/hosts.c +++ b/drivers/ieee1394/hosts.c | |||
| @@ -44,9 +44,10 @@ static void delayed_reset_bus(struct work_struct *work) | |||
| 44 | 44 | ||
| 45 | CSR_SET_BUS_INFO_GENERATION(host->csr.rom, generation); | 45 | CSR_SET_BUS_INFO_GENERATION(host->csr.rom, generation); |
| 46 | if (csr1212_generate_csr_image(host->csr.rom) != CSR1212_SUCCESS) { | 46 | if (csr1212_generate_csr_image(host->csr.rom) != CSR1212_SUCCESS) { |
| 47 | /* CSR image creation failed, reset generation field and do not | 47 | /* CSR image creation failed. |
| 48 | * issue a bus reset. */ | 48 | * Reset generation field and do not issue a bus reset. */ |
| 49 | CSR_SET_BUS_INFO_GENERATION(host->csr.rom, host->csr.generation); | 49 | CSR_SET_BUS_INFO_GENERATION(host->csr.rom, |
| 50 | host->csr.generation); | ||
| 50 | return; | 51 | return; |
| 51 | } | 52 | } |
| 52 | 53 | ||
| @@ -54,7 +55,8 @@ static void delayed_reset_bus(struct work_struct *work) | |||
| 54 | 55 | ||
| 55 | host->update_config_rom = 0; | 56 | host->update_config_rom = 0; |
| 56 | if (host->driver->set_hw_config_rom) | 57 | if (host->driver->set_hw_config_rom) |
| 57 | host->driver->set_hw_config_rom(host, host->csr.rom->bus_info_data); | 58 | host->driver->set_hw_config_rom(host, |
| 59 | host->csr.rom->bus_info_data); | ||
| 58 | 60 | ||
| 59 | host->csr.gen_timestamp[host->csr.generation] = jiffies; | 61 | host->csr.gen_timestamp[host->csr.generation] = jiffies; |
| 60 | hpsb_reset_bus(host, SHORT_RESET); | 62 | hpsb_reset_bus(host, SHORT_RESET); |
| @@ -70,7 +72,8 @@ static int dummy_devctl(struct hpsb_host *h, enum devctl_cmd c, int arg) | |||
| 70 | return -1; | 72 | return -1; |
| 71 | } | 73 | } |
| 72 | 74 | ||
| 73 | static int dummy_isoctl(struct hpsb_iso *iso, enum isoctl_cmd command, unsigned long arg) | 75 | static int dummy_isoctl(struct hpsb_iso *iso, enum isoctl_cmd command, |
| 76 | unsigned long arg) | ||
| 74 | { | 77 | { |
| 75 | return -1; | 78 | return -1; |
| 76 | } | 79 | } |
| @@ -128,10 +131,8 @@ struct hpsb_host *hpsb_alloc_host(struct hpsb_host_driver *drv, size_t extra, | |||
| 128 | return NULL; | 131 | return NULL; |
| 129 | 132 | ||
| 130 | h->csr.rom = csr1212_create_csr(&csr_bus_ops, CSR_BUS_INFO_SIZE, h); | 133 | h->csr.rom = csr1212_create_csr(&csr_bus_ops, CSR_BUS_INFO_SIZE, h); |
| 131 | if (!h->csr.rom) { | 134 | if (!h->csr.rom) |
| 132 | kfree(h); | 135 | goto fail; |
| 133 | return NULL; | ||
| 134 | } | ||
| 135 | 136 | ||
| 136 | h->hostdata = h + 1; | 137 | h->hostdata = h + 1; |
| 137 | h->driver = drv; | 138 | h->driver = drv; |
| @@ -151,16 +152,15 @@ struct hpsb_host *hpsb_alloc_host(struct hpsb_host_driver *drv, size_t extra, | |||
| 151 | init_timer(&h->timeout); | 152 | init_timer(&h->timeout); |
| 152 | h->timeout.data = (unsigned long) h; | 153 | h->timeout.data = (unsigned long) h; |
| 153 | h->timeout.function = abort_timedouts; | 154 | h->timeout.function = abort_timedouts; |
| 154 | h->timeout_interval = HZ / 20; // 50ms by default | 155 | h->timeout_interval = HZ / 20; /* 50ms, half of minimum SPLIT_TIMEOUT */ |
| 155 | 156 | ||
| 156 | h->topology_map = h->csr.topology_map + 3; | 157 | h->topology_map = h->csr.topology_map + 3; |
| 157 | h->speed_map = (u8 *)(h->csr.speed_map + 2); | 158 | h->speed_map = (u8 *)(h->csr.speed_map + 2); |
| 158 | 159 | ||
| 159 | mutex_lock(&host_num_alloc); | 160 | mutex_lock(&host_num_alloc); |
| 160 | |||
| 161 | while (nodemgr_for_each_host(&hostnum, alloc_hostnum_cb)) | 161 | while (nodemgr_for_each_host(&hostnum, alloc_hostnum_cb)) |
| 162 | hostnum++; | 162 | hostnum++; |
| 163 | 163 | mutex_unlock(&host_num_alloc); | |
| 164 | h->id = hostnum; | 164 | h->id = hostnum; |
| 165 | 165 | ||
| 166 | memcpy(&h->device, &nodemgr_dev_template_host, sizeof(h->device)); | 166 | memcpy(&h->device, &nodemgr_dev_template_host, sizeof(h->device)); |
| @@ -171,13 +171,19 @@ struct hpsb_host *hpsb_alloc_host(struct hpsb_host_driver *drv, size_t extra, | |||
| 171 | h->class_dev.class = &hpsb_host_class; | 171 | h->class_dev.class = &hpsb_host_class; |
| 172 | snprintf(h->class_dev.class_id, BUS_ID_SIZE, "fw-host%d", h->id); | 172 | snprintf(h->class_dev.class_id, BUS_ID_SIZE, "fw-host%d", h->id); |
| 173 | 173 | ||
| 174 | device_register(&h->device); | 174 | if (device_register(&h->device)) |
| 175 | class_device_register(&h->class_dev); | 175 | goto fail; |
| 176 | if (class_device_register(&h->class_dev)) { | ||
| 177 | device_unregister(&h->device); | ||
| 178 | goto fail; | ||
| 179 | } | ||
| 176 | get_device(&h->device); | 180 | get_device(&h->device); |
| 177 | 181 | ||
| 178 | mutex_unlock(&host_num_alloc); | ||
| 179 | |||
| 180 | return h; | 182 | return h; |
| 183 | |||
| 184 | fail: | ||
| 185 | kfree(h); | ||
| 186 | return NULL; | ||
| 181 | } | 187 | } |
| 182 | 188 | ||
| 183 | int hpsb_add_host(struct hpsb_host *host) | 189 | int hpsb_add_host(struct hpsb_host *host) |
| @@ -229,7 +235,8 @@ int hpsb_update_config_rom_image(struct hpsb_host *host) | |||
| 229 | if (time_before(jiffies, host->csr.gen_timestamp[next_gen] + 60 * HZ)) | 235 | if (time_before(jiffies, host->csr.gen_timestamp[next_gen] + 60 * HZ)) |
| 230 | /* Wait 60 seconds from the last time this generation number was | 236 | /* Wait 60 seconds from the last time this generation number was |
| 231 | * used. */ | 237 | * used. */ |
| 232 | reset_delay = (60 * HZ) + host->csr.gen_timestamp[next_gen] - jiffies; | 238 | reset_delay = |
| 239 | (60 * HZ) + host->csr.gen_timestamp[next_gen] - jiffies; | ||
| 233 | else | 240 | else |
| 234 | /* Wait 1 second in case some other code wants to change the | 241 | /* Wait 1 second in case some other code wants to change the |
| 235 | * Config ROM in the near future. */ | 242 | * Config ROM in the near future. */ |
