diff options
Diffstat (limited to 'drivers/ieee1394')
-rw-r--r-- | drivers/ieee1394/dv1394.c | 13 | ||||
-rw-r--r-- | drivers/ieee1394/highlevel.c | 25 | ||||
-rw-r--r-- | drivers/ieee1394/hosts.c | 4 | ||||
-rw-r--r-- | drivers/ieee1394/hosts.h | 4 | ||||
-rw-r--r-- | drivers/ieee1394/nodemgr.c | 22 | ||||
-rw-r--r-- | drivers/ieee1394/raw1394.c | 9 | ||||
-rw-r--r-- | drivers/ieee1394/sbp2.c | 14 |
7 files changed, 55 insertions, 36 deletions
diff --git a/drivers/ieee1394/dv1394.c b/drivers/ieee1394/dv1394.c index 2f83543a9dfc..c19f23267157 100644 --- a/drivers/ieee1394/dv1394.c +++ b/drivers/ieee1394/dv1394.c | |||
@@ -1270,8 +1270,14 @@ static int dv1394_mmap(struct file *file, struct vm_area_struct *vma) | |||
1270 | struct video_card *video = file_to_video_card(file); | 1270 | struct video_card *video = file_to_video_card(file); |
1271 | int retval = -EINVAL; | 1271 | int retval = -EINVAL; |
1272 | 1272 | ||
1273 | /* serialize mmap */ | 1273 | /* |
1274 | mutex_lock(&video->mtx); | 1274 | * We cannot use the blocking variant mutex_lock here because .mmap |
1275 | * is called with mmap_sem held, while .ioctl, .read, .write acquire | ||
1276 | * video->mtx and subsequently call copy_to/from_user which will | ||
1277 | * grab mmap_sem in case of a page fault. | ||
1278 | */ | ||
1279 | if (!mutex_trylock(&video->mtx)) | ||
1280 | return -EAGAIN; | ||
1275 | 1281 | ||
1276 | if ( ! video_card_initialized(video) ) { | 1282 | if ( ! video_card_initialized(video) ) { |
1277 | retval = do_dv1394_init_default(video); | 1283 | retval = do_dv1394_init_default(video); |
@@ -1828,9 +1834,6 @@ static int dv1394_release(struct inode *inode, struct file *file) | |||
1828 | /* OK to free the DMA buffer, no more mappings can exist */ | 1834 | /* OK to free the DMA buffer, no more mappings can exist */ |
1829 | do_dv1394_shutdown(video, 1); | 1835 | do_dv1394_shutdown(video, 1); |
1830 | 1836 | ||
1831 | /* clean up async I/O users */ | ||
1832 | dv1394_fasync(-1, file, 0); | ||
1833 | |||
1834 | /* give someone else a turn */ | 1837 | /* give someone else a turn */ |
1835 | clear_bit(0, &video->open); | 1838 | clear_bit(0, &video->open); |
1836 | 1839 | ||
diff --git a/drivers/ieee1394/highlevel.c b/drivers/ieee1394/highlevel.c index 918ffc4fc8ac..272543a42a43 100644 --- a/drivers/ieee1394/highlevel.c +++ b/drivers/ieee1394/highlevel.c | |||
@@ -46,10 +46,6 @@ static DEFINE_RWLOCK(hl_irqs_lock); | |||
46 | 46 | ||
47 | static DEFINE_RWLOCK(addr_space_lock); | 47 | static DEFINE_RWLOCK(addr_space_lock); |
48 | 48 | ||
49 | /* addr_space list will have zero and max already included as bounds */ | ||
50 | static struct hpsb_address_ops dummy_ops = { NULL, NULL, NULL, NULL }; | ||
51 | static struct hpsb_address_serve dummy_zero_addr, dummy_max_addr; | ||
52 | |||
53 | 49 | ||
54 | static struct hl_host_info *hl_get_hostinfo(struct hpsb_highlevel *hl, | 50 | static struct hl_host_info *hl_get_hostinfo(struct hpsb_highlevel *hl, |
55 | struct hpsb_host *host) | 51 | struct hpsb_host *host) |
@@ -481,20 +477,23 @@ int hpsb_unregister_addrspace(struct hpsb_highlevel *hl, struct hpsb_host *host, | |||
481 | return retval; | 477 | return retval; |
482 | } | 478 | } |
483 | 479 | ||
480 | static struct hpsb_address_ops dummy_ops; | ||
481 | |||
482 | /* dummy address spaces as lower and upper bounds of the host's a.s. list */ | ||
484 | static void init_hpsb_highlevel(struct hpsb_host *host) | 483 | static void init_hpsb_highlevel(struct hpsb_host *host) |
485 | { | 484 | { |
486 | INIT_LIST_HEAD(&dummy_zero_addr.host_list); | 485 | INIT_LIST_HEAD(&host->dummy_zero_addr.host_list); |
487 | INIT_LIST_HEAD(&dummy_zero_addr.hl_list); | 486 | INIT_LIST_HEAD(&host->dummy_zero_addr.hl_list); |
488 | INIT_LIST_HEAD(&dummy_max_addr.host_list); | 487 | INIT_LIST_HEAD(&host->dummy_max_addr.host_list); |
489 | INIT_LIST_HEAD(&dummy_max_addr.hl_list); | 488 | INIT_LIST_HEAD(&host->dummy_max_addr.hl_list); |
490 | 489 | ||
491 | dummy_zero_addr.op = dummy_max_addr.op = &dummy_ops; | 490 | host->dummy_zero_addr.op = host->dummy_max_addr.op = &dummy_ops; |
492 | 491 | ||
493 | dummy_zero_addr.start = dummy_zero_addr.end = 0; | 492 | host->dummy_zero_addr.start = host->dummy_zero_addr.end = 0; |
494 | dummy_max_addr.start = dummy_max_addr.end = ((u64) 1) << 48; | 493 | host->dummy_max_addr.start = host->dummy_max_addr.end = ((u64) 1) << 48; |
495 | 494 | ||
496 | list_add_tail(&dummy_zero_addr.host_list, &host->addr_space); | 495 | list_add_tail(&host->dummy_zero_addr.host_list, &host->addr_space); |
497 | list_add_tail(&dummy_max_addr.host_list, &host->addr_space); | 496 | list_add_tail(&host->dummy_max_addr.host_list, &host->addr_space); |
498 | } | 497 | } |
499 | 498 | ||
500 | void highlevel_add_host(struct hpsb_host *host) | 499 | void highlevel_add_host(struct hpsb_host *host) |
diff --git a/drivers/ieee1394/hosts.c b/drivers/ieee1394/hosts.c index 8dd09d850419..237d0c9d69c6 100644 --- a/drivers/ieee1394/hosts.c +++ b/drivers/ieee1394/hosts.c | |||
@@ -155,11 +155,11 @@ struct hpsb_host *hpsb_alloc_host(struct hpsb_host_driver *drv, size_t extra, | |||
155 | memcpy(&h->device, &nodemgr_dev_template_host, sizeof(h->device)); | 155 | memcpy(&h->device, &nodemgr_dev_template_host, sizeof(h->device)); |
156 | h->device.parent = dev; | 156 | h->device.parent = dev; |
157 | set_dev_node(&h->device, dev_to_node(dev)); | 157 | set_dev_node(&h->device, dev_to_node(dev)); |
158 | snprintf(h->device.bus_id, BUS_ID_SIZE, "fw-host%d", h->id); | 158 | dev_set_name(&h->device, "fw-host%d", h->id); |
159 | 159 | ||
160 | h->host_dev.parent = &h->device; | 160 | h->host_dev.parent = &h->device; |
161 | h->host_dev.class = &hpsb_host_class; | 161 | h->host_dev.class = &hpsb_host_class; |
162 | snprintf(h->host_dev.bus_id, BUS_ID_SIZE, "fw-host%d", h->id); | 162 | dev_set_name(&h->host_dev, "fw-host%d", h->id); |
163 | 163 | ||
164 | if (device_register(&h->device)) | 164 | if (device_register(&h->device)) |
165 | goto fail; | 165 | goto fail; |
diff --git a/drivers/ieee1394/hosts.h b/drivers/ieee1394/hosts.h index e4e8aeb4d778..dd229950acca 100644 --- a/drivers/ieee1394/hosts.h +++ b/drivers/ieee1394/hosts.h | |||
@@ -13,6 +13,7 @@ struct module; | |||
13 | 13 | ||
14 | #include "ieee1394_types.h" | 14 | #include "ieee1394_types.h" |
15 | #include "csr.h" | 15 | #include "csr.h" |
16 | #include "highlevel.h" | ||
16 | 17 | ||
17 | struct hpsb_packet; | 18 | struct hpsb_packet; |
18 | struct hpsb_iso; | 19 | struct hpsb_iso; |
@@ -72,6 +73,9 @@ struct hpsb_host { | |||
72 | struct { DECLARE_BITMAP(map, 64); } tl_pool[ALL_NODES]; | 73 | struct { DECLARE_BITMAP(map, 64); } tl_pool[ALL_NODES]; |
73 | 74 | ||
74 | struct csr_control csr; | 75 | struct csr_control csr; |
76 | |||
77 | struct hpsb_address_serve dummy_zero_addr; | ||
78 | struct hpsb_address_serve dummy_max_addr; | ||
75 | }; | 79 | }; |
76 | 80 | ||
77 | enum devctl_cmd { | 81 | enum devctl_cmd { |
diff --git a/drivers/ieee1394/nodemgr.c b/drivers/ieee1394/nodemgr.c index 2376b729e876..79ef5fd928ae 100644 --- a/drivers/ieee1394/nodemgr.c +++ b/drivers/ieee1394/nodemgr.c | |||
@@ -115,8 +115,14 @@ static int nodemgr_bus_read(struct csr1212_csr *csr, u64 addr, u16 length, | |||
115 | return error; | 115 | return error; |
116 | } | 116 | } |
117 | 117 | ||
118 | #define OUI_FREECOM_TECHNOLOGIES_GMBH 0x0001db | ||
119 | |||
118 | static int nodemgr_get_max_rom(quadlet_t *bus_info_data, void *__ci) | 120 | static int nodemgr_get_max_rom(quadlet_t *bus_info_data, void *__ci) |
119 | { | 121 | { |
122 | /* Freecom FireWire Hard Drive firmware bug */ | ||
123 | if (be32_to_cpu(bus_info_data[3]) >> 8 == OUI_FREECOM_TECHNOLOGIES_GMBH) | ||
124 | return 0; | ||
125 | |||
120 | return (be32_to_cpu(bus_info_data[2]) >> 8) & 0x3; | 126 | return (be32_to_cpu(bus_info_data[2]) >> 8) & 0x3; |
121 | } | 127 | } |
122 | 128 | ||
@@ -826,13 +832,11 @@ static struct node_entry *nodemgr_create_node(octlet_t guid, | |||
826 | memcpy(&ne->device, &nodemgr_dev_template_ne, | 832 | memcpy(&ne->device, &nodemgr_dev_template_ne, |
827 | sizeof(ne->device)); | 833 | sizeof(ne->device)); |
828 | ne->device.parent = &host->device; | 834 | ne->device.parent = &host->device; |
829 | snprintf(ne->device.bus_id, BUS_ID_SIZE, "%016Lx", | 835 | dev_set_name(&ne->device, "%016Lx", (unsigned long long)(ne->guid)); |
830 | (unsigned long long)(ne->guid)); | ||
831 | 836 | ||
832 | ne->node_dev.parent = &ne->device; | 837 | ne->node_dev.parent = &ne->device; |
833 | ne->node_dev.class = &nodemgr_ne_class; | 838 | ne->node_dev.class = &nodemgr_ne_class; |
834 | snprintf(ne->node_dev.bus_id, BUS_ID_SIZE, "%016Lx", | 839 | dev_set_name(&ne->node_dev, "%016Lx", (unsigned long long)(ne->guid)); |
835 | (unsigned long long)(ne->guid)); | ||
836 | 840 | ||
837 | if (device_register(&ne->device)) | 841 | if (device_register(&ne->device)) |
838 | goto fail_devreg; | 842 | goto fail_devreg; |
@@ -932,13 +936,11 @@ static void nodemgr_register_device(struct node_entry *ne, | |||
932 | 936 | ||
933 | ud->device.parent = parent; | 937 | ud->device.parent = parent; |
934 | 938 | ||
935 | snprintf(ud->device.bus_id, BUS_ID_SIZE, "%s-%u", | 939 | dev_set_name(&ud->device, "%s-%u", dev_name(&ne->device), ud->id); |
936 | ne->device.bus_id, ud->id); | ||
937 | 940 | ||
938 | ud->unit_dev.parent = &ud->device; | 941 | ud->unit_dev.parent = &ud->device; |
939 | ud->unit_dev.class = &nodemgr_ud_class; | 942 | ud->unit_dev.class = &nodemgr_ud_class; |
940 | snprintf(ud->unit_dev.bus_id, BUS_ID_SIZE, "%s-%u", | 943 | dev_set_name(&ud->unit_dev, "%s-%u", dev_name(&ne->device), ud->id); |
941 | ne->device.bus_id, ud->id); | ||
942 | 944 | ||
943 | if (device_register(&ud->device)) | 945 | if (device_register(&ud->device)) |
944 | goto fail_devreg; | 946 | goto fail_devreg; |
@@ -953,7 +955,7 @@ static void nodemgr_register_device(struct node_entry *ne, | |||
953 | fail_classdevreg: | 955 | fail_classdevreg: |
954 | device_unregister(&ud->device); | 956 | device_unregister(&ud->device); |
955 | fail_devreg: | 957 | fail_devreg: |
956 | HPSB_ERR("Failed to create unit %s", ud->device.bus_id); | 958 | HPSB_ERR("Failed to create unit %s", dev_name(&ud->device)); |
957 | } | 959 | } |
958 | 960 | ||
959 | 961 | ||
@@ -1689,6 +1691,7 @@ static int nodemgr_host_thread(void *data) | |||
1689 | g = get_hpsb_generation(host); | 1691 | g = get_hpsb_generation(host); |
1690 | for (i = 0; i < 4 ; i++) { | 1692 | for (i = 0; i < 4 ; i++) { |
1691 | msleep_interruptible(63); | 1693 | msleep_interruptible(63); |
1694 | try_to_freeze(); | ||
1692 | if (kthread_should_stop()) | 1695 | if (kthread_should_stop()) |
1693 | goto exit; | 1696 | goto exit; |
1694 | 1697 | ||
@@ -1729,6 +1732,7 @@ static int nodemgr_host_thread(void *data) | |||
1729 | /* Sleep 3 seconds */ | 1732 | /* Sleep 3 seconds */ |
1730 | for (i = 3000/200; i; i--) { | 1733 | for (i = 3000/200; i; i--) { |
1731 | msleep_interruptible(200); | 1734 | msleep_interruptible(200); |
1735 | try_to_freeze(); | ||
1732 | if (kthread_should_stop()) | 1736 | if (kthread_should_stop()) |
1733 | goto exit; | 1737 | goto exit; |
1734 | 1738 | ||
diff --git a/drivers/ieee1394/raw1394.c b/drivers/ieee1394/raw1394.c index 9f19ac492106..bf7e761c12b1 100644 --- a/drivers/ieee1394/raw1394.c +++ b/drivers/ieee1394/raw1394.c | |||
@@ -2268,7 +2268,8 @@ static ssize_t raw1394_write(struct file *file, const char __user * buffer, | |||
2268 | return -EFAULT; | 2268 | return -EFAULT; |
2269 | } | 2269 | } |
2270 | 2270 | ||
2271 | mutex_lock(&fi->state_mutex); | 2271 | if (!mutex_trylock(&fi->state_mutex)) |
2272 | return -EAGAIN; | ||
2272 | 2273 | ||
2273 | switch (fi->state) { | 2274 | switch (fi->state) { |
2274 | case opened: | 2275 | case opened: |
@@ -2548,7 +2549,8 @@ static int raw1394_mmap(struct file *file, struct vm_area_struct *vma) | |||
2548 | struct file_info *fi = file->private_data; | 2549 | struct file_info *fi = file->private_data; |
2549 | int ret; | 2550 | int ret; |
2550 | 2551 | ||
2551 | mutex_lock(&fi->state_mutex); | 2552 | if (!mutex_trylock(&fi->state_mutex)) |
2553 | return -EAGAIN; | ||
2552 | 2554 | ||
2553 | if (fi->iso_state == RAW1394_ISO_INACTIVE) | 2555 | if (fi->iso_state == RAW1394_ISO_INACTIVE) |
2554 | ret = -EINVAL; | 2556 | ret = -EINVAL; |
@@ -2669,7 +2671,8 @@ static long raw1394_ioctl(struct file *file, unsigned int cmd, | |||
2669 | break; | 2671 | break; |
2670 | } | 2672 | } |
2671 | 2673 | ||
2672 | mutex_lock(&fi->state_mutex); | 2674 | if (!mutex_trylock(&fi->state_mutex)) |
2675 | return -EAGAIN; | ||
2673 | 2676 | ||
2674 | switch (fi->iso_state) { | 2677 | switch (fi->iso_state) { |
2675 | case RAW1394_ISO_INACTIVE: | 2678 | case RAW1394_ISO_INACTIVE: |
diff --git a/drivers/ieee1394/sbp2.c b/drivers/ieee1394/sbp2.c index c52f6e6e8af2..a373c18cf7b8 100644 --- a/drivers/ieee1394/sbp2.c +++ b/drivers/ieee1394/sbp2.c | |||
@@ -402,6 +402,11 @@ static const struct { | |||
402 | }, | 402 | }, |
403 | /* iPod mini */ { | 403 | /* iPod mini */ { |
404 | .firmware_revision = 0x0a2700, | 404 | .firmware_revision = 0x0a2700, |
405 | .model_id = 0x000022, | ||
406 | .workarounds = SBP2_WORKAROUND_FIX_CAPACITY, | ||
407 | }, | ||
408 | /* iPod mini */ { | ||
409 | .firmware_revision = 0x0a2700, | ||
405 | .model_id = 0x000023, | 410 | .model_id = 0x000023, |
406 | .workarounds = SBP2_WORKAROUND_FIX_CAPACITY, | 411 | .workarounds = SBP2_WORKAROUND_FIX_CAPACITY, |
407 | }, | 412 | }, |
@@ -890,12 +895,13 @@ static void sbp2_host_reset(struct hpsb_host *host) | |||
890 | return; | 895 | return; |
891 | 896 | ||
892 | read_lock_irqsave(&sbp2_hi_logical_units_lock, flags); | 897 | read_lock_irqsave(&sbp2_hi_logical_units_lock, flags); |
898 | |||
893 | list_for_each_entry(lu, &hi->logical_units, lu_list) | 899 | list_for_each_entry(lu, &hi->logical_units, lu_list) |
894 | if (likely(atomic_read(&lu->state) != | 900 | if (atomic_cmpxchg(&lu->state, |
895 | SBP2LU_STATE_IN_SHUTDOWN)) { | 901 | SBP2LU_STATE_RUNNING, SBP2LU_STATE_IN_RESET) |
896 | atomic_set(&lu->state, SBP2LU_STATE_IN_RESET); | 902 | == SBP2LU_STATE_RUNNING) |
897 | scsi_block_requests(lu->shost); | 903 | scsi_block_requests(lu->shost); |
898 | } | 904 | |
899 | read_unlock_irqrestore(&sbp2_hi_logical_units_lock, flags); | 905 | read_unlock_irqrestore(&sbp2_hi_logical_units_lock, flags); |
900 | } | 906 | } |
901 | 907 | ||