aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ieee1394
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-07-15 15:39:13 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-07-15 15:39:13 -0400
commit849c529f57020cc47085400edd5e641d95cd4faf (patch)
tree5f2d1add9f98995bf8c22cdfc6ade3e02869e1ac /drivers/ieee1394
parentb9d2252c1e44fa83a4e65fdc9eb93db6297c55af (diff)
parenta7ea67823af4a7e442e92064b0fab46603a588f6 (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394-2.6: firewire: don't respond to broadcast write requests firewire: clean up fw_card reference counting firewire: clean up some includes firewire: remove unused struct members firewire: implement broadcast_channel CSR for 1394a compliance ieee1394: dump mmapped iso buffers in core files ieee1394: raw1394: Push the BKL down into the driver ioctls ieee1394: video1394: reorder module init, prepare BKL removal ieee1394: reduce log noise about config ROM CRC errors
Diffstat (limited to 'drivers/ieee1394')
-rw-r--r--drivers/ieee1394/csr1212.c32
-rw-r--r--drivers/ieee1394/dma.c2
-rw-r--r--drivers/ieee1394/highlevel.c4
-rw-r--r--drivers/ieee1394/highlevel.h13
-rw-r--r--drivers/ieee1394/raw1394.c20
-rw-r--r--drivers/ieee1394/video1394.c2
6 files changed, 53 insertions, 20 deletions
diff --git a/drivers/ieee1394/csr1212.c b/drivers/ieee1394/csr1212.c
index e8122def164d..9f95337139e3 100644
--- a/drivers/ieee1394/csr1212.c
+++ b/drivers/ieee1394/csr1212.c
@@ -1049,6 +1049,24 @@ int csr1212_read(struct csr1212_csr *csr, u32 offset, void *buffer, u32 len)
1049 return -ENOENT; 1049 return -ENOENT;
1050} 1050}
1051 1051
1052/*
1053 * Apparently there are many different wrong implementations of the CRC
1054 * algorithm. We don't fail, we just warn... approximately once per GUID.
1055 */
1056static void
1057csr1212_check_crc(const u32 *buffer, size_t length, u16 crc, __be32 *guid)
1058{
1059 static u64 last_bad_eui64;
1060 u64 eui64 = ((u64)be32_to_cpu(guid[0]) << 32) | be32_to_cpu(guid[1]);
1061
1062 if (csr1212_crc16(buffer, length) == crc ||
1063 csr1212_msft_crc16(buffer, length) == crc ||
1064 eui64 == last_bad_eui64)
1065 return;
1066
1067 printk(KERN_DEBUG "ieee1394: config ROM CRC error\n");
1068 last_bad_eui64 = eui64;
1069}
1052 1070
1053/* Parse a chunk of data as a Config ROM */ 1071/* Parse a chunk of data as a Config ROM */
1054 1072
@@ -1092,11 +1110,8 @@ static int csr1212_parse_bus_info_block(struct csr1212_csr *csr)
1092 return ret; 1110 return ret;
1093 } 1111 }
1094 1112
1095 /* Apparently there are many different wrong implementations of the CRC 1113 csr1212_check_crc(bi->data, bi->crc_length, bi->crc,
1096 * algorithm. We don't fail, we just warn. */ 1114 &csr->bus_info_data[3]);
1097 if ((csr1212_crc16(bi->data, bi->crc_length) != bi->crc) &&
1098 (csr1212_msft_crc16(bi->data, bi->crc_length) != bi->crc))
1099 printk(KERN_DEBUG "IEEE 1394 device has ROM CRC error\n");
1100 1115
1101 cr = CSR1212_MALLOC(sizeof(*cr)); 1116 cr = CSR1212_MALLOC(sizeof(*cr));
1102 if (!cr) 1117 if (!cr)
@@ -1205,11 +1220,8 @@ int csr1212_parse_keyval(struct csr1212_keyval *kv,
1205 &cache->data[bytes_to_quads(kv->offset - cache->offset)]; 1220 &cache->data[bytes_to_quads(kv->offset - cache->offset)];
1206 kvi_len = be16_to_cpu(kvi->length); 1221 kvi_len = be16_to_cpu(kvi->length);
1207 1222
1208 /* Apparently there are many different wrong implementations of the CRC 1223 /* GUID is wrong in here in case of extended ROM. We don't care. */
1209 * algorithm. We don't fail, we just warn. */ 1224 csr1212_check_crc(kvi->data, kvi_len, kvi->crc, &cache->data[3]);
1210 if ((csr1212_crc16(kvi->data, kvi_len) != kvi->crc) &&
1211 (csr1212_msft_crc16(kvi->data, kvi_len) != kvi->crc))
1212 printk(KERN_DEBUG "IEEE 1394 device has ROM CRC error\n");
1213 1225
1214 switch (kv->key.type) { 1226 switch (kv->key.type) {
1215 case CSR1212_KV_TYPE_DIRECTORY: 1227 case CSR1212_KV_TYPE_DIRECTORY:
diff --git a/drivers/ieee1394/dma.c b/drivers/ieee1394/dma.c
index 73685e7dc7e4..1aba8c13fe8f 100644
--- a/drivers/ieee1394/dma.c
+++ b/drivers/ieee1394/dma.c
@@ -274,7 +274,7 @@ int dma_region_mmap(struct dma_region *dma, struct file *file,
274 vma->vm_ops = &dma_region_vm_ops; 274 vma->vm_ops = &dma_region_vm_ops;
275 vma->vm_private_data = dma; 275 vma->vm_private_data = dma;
276 vma->vm_file = file; 276 vma->vm_file = file;
277 vma->vm_flags |= VM_RESERVED; 277 vma->vm_flags |= VM_RESERVED | VM_ALWAYSDUMP;
278 278
279 return 0; 279 return 0;
280} 280}
diff --git a/drivers/ieee1394/highlevel.c b/drivers/ieee1394/highlevel.c
index fa2bfec0fca2..918ffc4fc8ac 100644
--- a/drivers/ieee1394/highlevel.c
+++ b/drivers/ieee1394/highlevel.c
@@ -228,10 +228,8 @@ void hpsb_register_highlevel(struct hpsb_highlevel *hl)
228{ 228{
229 unsigned long flags; 229 unsigned long flags;
230 230
231 hpsb_init_highlevel(hl);
231 INIT_LIST_HEAD(&hl->addr_list); 232 INIT_LIST_HEAD(&hl->addr_list);
232 INIT_LIST_HEAD(&hl->host_info_list);
233
234 rwlock_init(&hl->host_info_lock);
235 233
236 down_write(&hl_drivers_sem); 234 down_write(&hl_drivers_sem);
237 list_add_tail(&hl->hl_list, &hl_drivers); 235 list_add_tail(&hl->hl_list, &hl_drivers);
diff --git a/drivers/ieee1394/highlevel.h b/drivers/ieee1394/highlevel.h
index eb9fe321e09a..bc5d0854c17e 100644
--- a/drivers/ieee1394/highlevel.h
+++ b/drivers/ieee1394/highlevel.h
@@ -2,7 +2,7 @@
2#define IEEE1394_HIGHLEVEL_H 2#define IEEE1394_HIGHLEVEL_H
3 3
4#include <linux/list.h> 4#include <linux/list.h>
5#include <linux/spinlock_types.h> 5#include <linux/spinlock.h>
6#include <linux/types.h> 6#include <linux/types.h>
7 7
8struct module; 8struct module;
@@ -103,6 +103,17 @@ int highlevel_lock64(struct hpsb_host *host, int nodeid, octlet_t *store,
103void highlevel_fcp_request(struct hpsb_host *host, int nodeid, int direction, 103void highlevel_fcp_request(struct hpsb_host *host, int nodeid, int direction,
104 void *data, size_t length); 104 void *data, size_t length);
105 105
106/**
107 * hpsb_init_highlevel - initialize a struct hpsb_highlevel
108 *
109 * This is only necessary if hpsb_get_hostinfo_bykey can be called
110 * before hpsb_register_highlevel.
111 */
112static inline void hpsb_init_highlevel(struct hpsb_highlevel *hl)
113{
114 rwlock_init(&hl->host_info_lock);
115 INIT_LIST_HEAD(&hl->host_info_list);
116}
106void hpsb_register_highlevel(struct hpsb_highlevel *hl); 117void hpsb_register_highlevel(struct hpsb_highlevel *hl);
107void hpsb_unregister_highlevel(struct hpsb_highlevel *hl); 118void hpsb_unregister_highlevel(struct hpsb_highlevel *hl);
108 119
diff --git a/drivers/ieee1394/raw1394.c b/drivers/ieee1394/raw1394.c
index ec2a0adbedb2..96f2847b0405 100644
--- a/drivers/ieee1394/raw1394.c
+++ b/drivers/ieee1394/raw1394.c
@@ -2549,8 +2549,8 @@ static int raw1394_mmap(struct file *file, struct vm_area_struct *vma)
2549} 2549}
2550 2550
2551/* ioctl is only used for rawiso operations */ 2551/* ioctl is only used for rawiso operations */
2552static int raw1394_ioctl(struct inode *inode, struct file *file, 2552static long do_raw1394_ioctl(struct file *file, unsigned int cmd,
2553 unsigned int cmd, unsigned long arg) 2553 unsigned long arg)
2554{ 2554{
2555 struct file_info *fi = file->private_data; 2555 struct file_info *fi = file->private_data;
2556 void __user *argp = (void __user *)arg; 2556 void __user *argp = (void __user *)arg;
@@ -2656,6 +2656,16 @@ static int raw1394_ioctl(struct inode *inode, struct file *file,
2656 return -EINVAL; 2656 return -EINVAL;
2657} 2657}
2658 2658
2659static long raw1394_ioctl(struct file *file, unsigned int cmd,
2660 unsigned long arg)
2661{
2662 long ret;
2663 lock_kernel();
2664 ret = do_raw1394_ioctl(file, cmd, arg);
2665 unlock_kernel();
2666 return ret;
2667}
2668
2659#ifdef CONFIG_COMPAT 2669#ifdef CONFIG_COMPAT
2660struct raw1394_iso_packets32 { 2670struct raw1394_iso_packets32 {
2661 __u32 n_packets; 2671 __u32 n_packets;
@@ -2690,7 +2700,7 @@ static long raw1394_iso_xmit_recv_packets32(struct file *file, unsigned int cmd,
2690 !copy_from_user(&infos32, &arg->infos, sizeof infos32)) { 2700 !copy_from_user(&infos32, &arg->infos, sizeof infos32)) {
2691 infos = compat_ptr(infos32); 2701 infos = compat_ptr(infos32);
2692 if (!copy_to_user(&dst->infos, &infos, sizeof infos)) 2702 if (!copy_to_user(&dst->infos, &infos, sizeof infos))
2693 err = raw1394_ioctl(NULL, file, cmd, (unsigned long)dst); 2703 err = do_raw1394_ioctl(file, cmd, (unsigned long)dst);
2694 } 2704 }
2695 return err; 2705 return err;
2696} 2706}
@@ -2731,7 +2741,7 @@ static long raw1394_compat_ioctl(struct file *file,
2731 case RAW1394_IOC_ISO_GET_STATUS: 2741 case RAW1394_IOC_ISO_GET_STATUS:
2732 case RAW1394_IOC_ISO_SHUTDOWN: 2742 case RAW1394_IOC_ISO_SHUTDOWN:
2733 case RAW1394_IOC_ISO_QUEUE_ACTIVITY: 2743 case RAW1394_IOC_ISO_QUEUE_ACTIVITY:
2734 err = raw1394_ioctl(NULL, file, cmd, arg); 2744 err = do_raw1394_ioctl(file, cmd, arg);
2735 break; 2745 break;
2736 /* These request have different format. */ 2746 /* These request have different format. */
2737 case RAW1394_IOC_ISO_RECV_PACKETS32: 2747 case RAW1394_IOC_ISO_RECV_PACKETS32:
@@ -2984,7 +2994,7 @@ static const struct file_operations raw1394_fops = {
2984 .read = raw1394_read, 2994 .read = raw1394_read,
2985 .write = raw1394_write, 2995 .write = raw1394_write,
2986 .mmap = raw1394_mmap, 2996 .mmap = raw1394_mmap,
2987 .ioctl = raw1394_ioctl, 2997 .unlocked_ioctl = raw1394_ioctl,
2988#ifdef CONFIG_COMPAT 2998#ifdef CONFIG_COMPAT
2989 .compat_ioctl = raw1394_compat_ioctl, 2999 .compat_ioctl = raw1394_compat_ioctl,
2990#endif 3000#endif
diff --git a/drivers/ieee1394/video1394.c b/drivers/ieee1394/video1394.c
index e24772d336e1..069b9f6bf16d 100644
--- a/drivers/ieee1394/video1394.c
+++ b/drivers/ieee1394/video1394.c
@@ -1503,6 +1503,8 @@ static int __init video1394_init_module (void)
1503{ 1503{
1504 int ret; 1504 int ret;
1505 1505
1506 hpsb_init_highlevel(&video1394_highlevel);
1507
1506 cdev_init(&video1394_cdev, &video1394_fops); 1508 cdev_init(&video1394_cdev, &video1394_fops);
1507 video1394_cdev.owner = THIS_MODULE; 1509 video1394_cdev.owner = THIS_MODULE;
1508 ret = cdev_add(&video1394_cdev, IEEE1394_VIDEO1394_DEV, 16); 1510 ret = cdev_add(&video1394_cdev, IEEE1394_VIDEO1394_DEV, 16);