diff options
54 files changed, 922 insertions, 328 deletions
diff --git a/Documentation/fault-injection/fault-injection.txt b/Documentation/fault-injection/fault-injection.txt index 079305640790..7be15e44d481 100644 --- a/Documentation/fault-injection/fault-injection.txt +++ b/Documentation/fault-injection/fault-injection.txt | |||
@@ -143,8 +143,8 @@ o provide a way to configure fault attributes | |||
143 | failslab, fail_page_alloc, and fail_make_request use this way. | 143 | failslab, fail_page_alloc, and fail_make_request use this way. |
144 | Helper functions: | 144 | Helper functions: |
145 | 145 | ||
146 | init_fault_attr_entries(entries, attr, name); | 146 | init_fault_attr_dentries(entries, attr, name); |
147 | void cleanup_fault_attr_entries(entries); | 147 | void cleanup_fault_attr_dentries(entries); |
148 | 148 | ||
149 | - module parameters | 149 | - module parameters |
150 | 150 | ||
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c index 5198b9bb34ef..69ddfbd91135 100644 --- a/arch/x86/mm/init_64.c +++ b/arch/x86/mm/init_64.c | |||
@@ -49,6 +49,7 @@ | |||
49 | #include <asm/numa.h> | 49 | #include <asm/numa.h> |
50 | #include <asm/cacheflush.h> | 50 | #include <asm/cacheflush.h> |
51 | #include <asm/init.h> | 51 | #include <asm/init.h> |
52 | #include <linux/bootmem.h> | ||
52 | 53 | ||
53 | static unsigned long dma_reserve __initdata; | 54 | static unsigned long dma_reserve __initdata; |
54 | 55 | ||
@@ -616,6 +617,21 @@ void __init paging_init(void) | |||
616 | */ | 617 | */ |
617 | #ifdef CONFIG_MEMORY_HOTPLUG | 618 | #ifdef CONFIG_MEMORY_HOTPLUG |
618 | /* | 619 | /* |
620 | * After memory hotplug the variables max_pfn, max_low_pfn and high_memory need | ||
621 | * updating. | ||
622 | */ | ||
623 | static void update_end_of_memory_vars(u64 start, u64 size) | ||
624 | { | ||
625 | unsigned long end_pfn = PFN_UP(start + size); | ||
626 | |||
627 | if (end_pfn > max_pfn) { | ||
628 | max_pfn = end_pfn; | ||
629 | max_low_pfn = end_pfn; | ||
630 | high_memory = (void *)__va(max_pfn * PAGE_SIZE - 1) + 1; | ||
631 | } | ||
632 | } | ||
633 | |||
634 | /* | ||
619 | * Memory is added always to NORMAL zone. This means you will never get | 635 | * Memory is added always to NORMAL zone. This means you will never get |
620 | * additional DMA/DMA32 memory. | 636 | * additional DMA/DMA32 memory. |
621 | */ | 637 | */ |
@@ -634,6 +650,9 @@ int arch_add_memory(int nid, u64 start, u64 size) | |||
634 | ret = __add_pages(nid, zone, start_pfn, nr_pages); | 650 | ret = __add_pages(nid, zone, start_pfn, nr_pages); |
635 | WARN_ON_ONCE(ret); | 651 | WARN_ON_ONCE(ret); |
636 | 652 | ||
653 | /* update max_pfn, max_low_pfn and high_memory */ | ||
654 | update_end_of_memory_vars(start, size); | ||
655 | |||
637 | return ret; | 656 | return ret; |
638 | } | 657 | } |
639 | EXPORT_SYMBOL_GPL(arch_add_memory); | 658 | EXPORT_SYMBOL_GPL(arch_add_memory); |
diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c index 2ddf03ae034e..68b5957f107c 100644 --- a/drivers/block/pktcdvd.c +++ b/drivers/block/pktcdvd.c | |||
@@ -322,7 +322,7 @@ static void pkt_sysfs_dev_remove(struct pktcdvd_device *pd) | |||
322 | pkt_kobj_remove(pd->kobj_stat); | 322 | pkt_kobj_remove(pd->kobj_stat); |
323 | pkt_kobj_remove(pd->kobj_wqueue); | 323 | pkt_kobj_remove(pd->kobj_wqueue); |
324 | if (class_pktcdvd) | 324 | if (class_pktcdvd) |
325 | device_destroy(class_pktcdvd, pd->pkt_dev); | 325 | device_unregister(pd->dev); |
326 | } | 326 | } |
327 | 327 | ||
328 | 328 | ||
diff --git a/drivers/bluetooth/Kconfig b/drivers/bluetooth/Kconfig index 652367aa6546..058fbccf2f52 100644 --- a/drivers/bluetooth/Kconfig +++ b/drivers/bluetooth/Kconfig | |||
@@ -195,5 +195,16 @@ config BT_MRVL_SDIO | |||
195 | Say Y here to compile support for Marvell BT-over-SDIO driver | 195 | Say Y here to compile support for Marvell BT-over-SDIO driver |
196 | into the kernel or say M to compile it as module. | 196 | into the kernel or say M to compile it as module. |
197 | 197 | ||
198 | endmenu | 198 | config BT_ATH3K |
199 | tristate "Atheros firmware download driver" | ||
200 | depends on BT_HCIBTUSB | ||
201 | select FW_LOADER | ||
202 | help | ||
203 | Bluetooth firmware download driver. | ||
204 | This driver loads the firmware into the Atheros Bluetooth | ||
205 | chipset. | ||
199 | 206 | ||
207 | Say Y here to compile support for "Atheros firmware download driver" | ||
208 | into the kernel or say M to compile it as module (ath3k). | ||
209 | |||
210 | endmenu | ||
diff --git a/drivers/bluetooth/Makefile b/drivers/bluetooth/Makefile index b3f57d2d4eb0..7e5aed598121 100644 --- a/drivers/bluetooth/Makefile +++ b/drivers/bluetooth/Makefile | |||
@@ -15,6 +15,7 @@ obj-$(CONFIG_BT_HCIBTUART) += btuart_cs.o | |||
15 | obj-$(CONFIG_BT_HCIBTUSB) += btusb.o | 15 | obj-$(CONFIG_BT_HCIBTUSB) += btusb.o |
16 | obj-$(CONFIG_BT_HCIBTSDIO) += btsdio.o | 16 | obj-$(CONFIG_BT_HCIBTSDIO) += btsdio.o |
17 | 17 | ||
18 | obj-$(CONFIG_BT_ATH3K) += ath3k.o | ||
18 | obj-$(CONFIG_BT_MRVL) += btmrvl.o | 19 | obj-$(CONFIG_BT_MRVL) += btmrvl.o |
19 | obj-$(CONFIG_BT_MRVL_SDIO) += btmrvl_sdio.o | 20 | obj-$(CONFIG_BT_MRVL_SDIO) += btmrvl_sdio.o |
20 | 21 | ||
diff --git a/drivers/bluetooth/ath3k.c b/drivers/bluetooth/ath3k.c new file mode 100644 index 000000000000..add9485ca5b6 --- /dev/null +++ b/drivers/bluetooth/ath3k.c | |||
@@ -0,0 +1,187 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2008-2009 Atheros Communications Inc. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License as published by | ||
6 | * the Free Software Foundation; either version 2 of the License, or | ||
7 | * (at your option) any later version. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License | ||
15 | * along with this program; if not, write to the Free Software | ||
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
17 | * | ||
18 | */ | ||
19 | |||
20 | |||
21 | #include <linux/module.h> | ||
22 | #include <linux/kernel.h> | ||
23 | #include <linux/init.h> | ||
24 | #include <linux/slab.h> | ||
25 | #include <linux/types.h> | ||
26 | #include <linux/errno.h> | ||
27 | #include <linux/device.h> | ||
28 | #include <linux/firmware.h> | ||
29 | #include <linux/usb.h> | ||
30 | #include <net/bluetooth/bluetooth.h> | ||
31 | |||
32 | #define VERSION "1.0" | ||
33 | |||
34 | |||
35 | static struct usb_device_id ath3k_table[] = { | ||
36 | /* Atheros AR3011 */ | ||
37 | { USB_DEVICE(0x0CF3, 0x3000) }, | ||
38 | { } /* Terminating entry */ | ||
39 | }; | ||
40 | |||
41 | MODULE_DEVICE_TABLE(usb, ath3k_table); | ||
42 | |||
43 | #define USB_REQ_DFU_DNLOAD 1 | ||
44 | #define BULK_SIZE 4096 | ||
45 | |||
46 | struct ath3k_data { | ||
47 | struct usb_device *udev; | ||
48 | u8 *fw_data; | ||
49 | u32 fw_size; | ||
50 | u32 fw_sent; | ||
51 | }; | ||
52 | |||
53 | static int ath3k_load_firmware(struct ath3k_data *data, | ||
54 | unsigned char *firmware, | ||
55 | int count) | ||
56 | { | ||
57 | u8 *send_buf; | ||
58 | int err, pipe, len, size, sent = 0; | ||
59 | |||
60 | BT_DBG("ath3k %p udev %p", data, data->udev); | ||
61 | |||
62 | pipe = usb_sndctrlpipe(data->udev, 0); | ||
63 | |||
64 | if ((usb_control_msg(data->udev, pipe, | ||
65 | USB_REQ_DFU_DNLOAD, | ||
66 | USB_TYPE_VENDOR, 0, 0, | ||
67 | firmware, 20, USB_CTRL_SET_TIMEOUT)) < 0) { | ||
68 | BT_ERR("Can't change to loading configuration err"); | ||
69 | return -EBUSY; | ||
70 | } | ||
71 | sent += 20; | ||
72 | count -= 20; | ||
73 | |||
74 | send_buf = kmalloc(BULK_SIZE, GFP_ATOMIC); | ||
75 | if (!send_buf) { | ||
76 | BT_ERR("Can't allocate memory chunk for firmware"); | ||
77 | return -ENOMEM; | ||
78 | } | ||
79 | |||
80 | while (count) { | ||
81 | size = min_t(uint, count, BULK_SIZE); | ||
82 | pipe = usb_sndbulkpipe(data->udev, 0x02); | ||
83 | memcpy(send_buf, firmware + sent, size); | ||
84 | |||
85 | err = usb_bulk_msg(data->udev, pipe, send_buf, size, | ||
86 | &len, 3000); | ||
87 | |||
88 | if (err || (len != size)) { | ||
89 | BT_ERR("Error in firmware loading err = %d," | ||
90 | "len = %d, size = %d", err, len, size); | ||
91 | goto error; | ||
92 | } | ||
93 | |||
94 | sent += size; | ||
95 | count -= size; | ||
96 | } | ||
97 | |||
98 | kfree(send_buf); | ||
99 | return 0; | ||
100 | |||
101 | error: | ||
102 | kfree(send_buf); | ||
103 | return err; | ||
104 | } | ||
105 | |||
106 | static int ath3k_probe(struct usb_interface *intf, | ||
107 | const struct usb_device_id *id) | ||
108 | { | ||
109 | const struct firmware *firmware; | ||
110 | struct usb_device *udev = interface_to_usbdev(intf); | ||
111 | struct ath3k_data *data; | ||
112 | int size; | ||
113 | |||
114 | BT_DBG("intf %p id %p", intf, id); | ||
115 | |||
116 | if (intf->cur_altsetting->desc.bInterfaceNumber != 0) | ||
117 | return -ENODEV; | ||
118 | |||
119 | data = kzalloc(sizeof(*data), GFP_KERNEL); | ||
120 | if (!data) | ||
121 | return -ENOMEM; | ||
122 | |||
123 | data->udev = udev; | ||
124 | |||
125 | if (request_firmware(&firmware, "ath3k-1.fw", &udev->dev) < 0) { | ||
126 | kfree(data); | ||
127 | return -EIO; | ||
128 | } | ||
129 | |||
130 | size = max_t(uint, firmware->size, 4096); | ||
131 | data->fw_data = kmalloc(size, GFP_KERNEL); | ||
132 | if (!data->fw_data) { | ||
133 | release_firmware(firmware); | ||
134 | kfree(data); | ||
135 | return -ENOMEM; | ||
136 | } | ||
137 | |||
138 | memcpy(data->fw_data, firmware->data, firmware->size); | ||
139 | data->fw_size = firmware->size; | ||
140 | data->fw_sent = 0; | ||
141 | release_firmware(firmware); | ||
142 | |||
143 | usb_set_intfdata(intf, data); | ||
144 | if (ath3k_load_firmware(data, data->fw_data, data->fw_size)) { | ||
145 | usb_set_intfdata(intf, NULL); | ||
146 | return -EIO; | ||
147 | } | ||
148 | |||
149 | return 0; | ||
150 | } | ||
151 | |||
152 | static void ath3k_disconnect(struct usb_interface *intf) | ||
153 | { | ||
154 | struct ath3k_data *data = usb_get_intfdata(intf); | ||
155 | |||
156 | BT_DBG("ath3k_disconnect intf %p", intf); | ||
157 | |||
158 | kfree(data->fw_data); | ||
159 | kfree(data); | ||
160 | } | ||
161 | |||
162 | static struct usb_driver ath3k_driver = { | ||
163 | .name = "ath3k", | ||
164 | .probe = ath3k_probe, | ||
165 | .disconnect = ath3k_disconnect, | ||
166 | .id_table = ath3k_table, | ||
167 | }; | ||
168 | |||
169 | static int __init ath3k_init(void) | ||
170 | { | ||
171 | BT_INFO("Atheros AR30xx firmware driver ver %s", VERSION); | ||
172 | return usb_register(&ath3k_driver); | ||
173 | } | ||
174 | |||
175 | static void __exit ath3k_exit(void) | ||
176 | { | ||
177 | usb_deregister(&ath3k_driver); | ||
178 | } | ||
179 | |||
180 | module_init(ath3k_init); | ||
181 | module_exit(ath3k_exit); | ||
182 | |||
183 | MODULE_AUTHOR("Atheros Communications"); | ||
184 | MODULE_DESCRIPTION("Atheros AR30xx firmware driver"); | ||
185 | MODULE_VERSION(VERSION); | ||
186 | MODULE_LICENSE("GPL"); | ||
187 | MODULE_FIRMWARE("ath3k-1.fw"); | ||
diff --git a/drivers/bluetooth/bluecard_cs.c b/drivers/bluetooth/bluecard_cs.c index 2acdc605cb4b..c2cf81144715 100644 --- a/drivers/bluetooth/bluecard_cs.c +++ b/drivers/bluetooth/bluecard_cs.c | |||
@@ -503,7 +503,9 @@ static irqreturn_t bluecard_interrupt(int irq, void *dev_inst) | |||
503 | unsigned int iobase; | 503 | unsigned int iobase; |
504 | unsigned char reg; | 504 | unsigned char reg; |
505 | 505 | ||
506 | BUG_ON(!info->hdev); | 506 | if (!info || !info->hdev) |
507 | /* our irq handler is shared */ | ||
508 | return IRQ_NONE; | ||
507 | 509 | ||
508 | if (!test_bit(CARD_READY, &(info->hw_state))) | 510 | if (!test_bit(CARD_READY, &(info->hw_state))) |
509 | return IRQ_HANDLED; | 511 | return IRQ_HANDLED; |
diff --git a/drivers/bluetooth/bt3c_cs.c b/drivers/bluetooth/bt3c_cs.c index d814a2755ccb..9f5926aaf57f 100644 --- a/drivers/bluetooth/bt3c_cs.c +++ b/drivers/bluetooth/bt3c_cs.c | |||
@@ -345,7 +345,9 @@ static irqreturn_t bt3c_interrupt(int irq, void *dev_inst) | |||
345 | int iir; | 345 | int iir; |
346 | irqreturn_t r = IRQ_NONE; | 346 | irqreturn_t r = IRQ_NONE; |
347 | 347 | ||
348 | BUG_ON(!info->hdev); | 348 | if (!info || !info->hdev) |
349 | /* our irq handler is shared */ | ||
350 | return IRQ_NONE; | ||
349 | 351 | ||
350 | iobase = info->p_dev->io.BasePort1; | 352 | iobase = info->p_dev->io.BasePort1; |
351 | 353 | ||
diff --git a/drivers/bluetooth/btuart_cs.c b/drivers/bluetooth/btuart_cs.c index d339464dc15e..91c523099804 100644 --- a/drivers/bluetooth/btuart_cs.c +++ b/drivers/bluetooth/btuart_cs.c | |||
@@ -295,7 +295,9 @@ static irqreturn_t btuart_interrupt(int irq, void *dev_inst) | |||
295 | int iir, lsr; | 295 | int iir, lsr; |
296 | irqreturn_t r = IRQ_NONE; | 296 | irqreturn_t r = IRQ_NONE; |
297 | 297 | ||
298 | BUG_ON(!info->hdev); | 298 | if (!info || !info->hdev) |
299 | /* our irq handler is shared */ | ||
300 | return IRQ_NONE; | ||
299 | 301 | ||
300 | iobase = info->p_dev->io.BasePort1; | 302 | iobase = info->p_dev->io.BasePort1; |
301 | 303 | ||
diff --git a/drivers/bluetooth/dtl1_cs.c b/drivers/bluetooth/dtl1_cs.c index 4f02a6f3c980..697591941e17 100644 --- a/drivers/bluetooth/dtl1_cs.c +++ b/drivers/bluetooth/dtl1_cs.c | |||
@@ -299,7 +299,9 @@ static irqreturn_t dtl1_interrupt(int irq, void *dev_inst) | |||
299 | int iir, lsr; | 299 | int iir, lsr; |
300 | irqreturn_t r = IRQ_NONE; | 300 | irqreturn_t r = IRQ_NONE; |
301 | 301 | ||
302 | BUG_ON(!info->hdev); | 302 | if (!info || !info->hdev) |
303 | /* our irq handler is shared */ | ||
304 | return IRQ_NONE; | ||
303 | 305 | ||
304 | iobase = info->p_dev->io.BasePort1; | 306 | iobase = info->p_dev->io.BasePort1; |
305 | 307 | ||
diff --git a/drivers/char/mem.c b/drivers/char/mem.c index be832b6f8279..48788db4e280 100644 --- a/drivers/char/mem.c +++ b/drivers/char/mem.c | |||
@@ -395,6 +395,7 @@ static ssize_t read_kmem(struct file *file, char __user *buf, | |||
395 | unsigned long p = *ppos; | 395 | unsigned long p = *ppos; |
396 | ssize_t low_count, read, sz; | 396 | ssize_t low_count, read, sz; |
397 | char * kbuf; /* k-addr because vread() takes vmlist_lock rwlock */ | 397 | char * kbuf; /* k-addr because vread() takes vmlist_lock rwlock */ |
398 | int err = 0; | ||
398 | 399 | ||
399 | read = 0; | 400 | read = 0; |
400 | if (p < (unsigned long) high_memory) { | 401 | if (p < (unsigned long) high_memory) { |
@@ -441,12 +442,16 @@ static ssize_t read_kmem(struct file *file, char __user *buf, | |||
441 | return -ENOMEM; | 442 | return -ENOMEM; |
442 | while (count > 0) { | 443 | while (count > 0) { |
443 | sz = size_inside_page(p, count); | 444 | sz = size_inside_page(p, count); |
445 | if (!is_vmalloc_or_module_addr((void *)p)) { | ||
446 | err = -ENXIO; | ||
447 | break; | ||
448 | } | ||
444 | sz = vread(kbuf, (char *)p, sz); | 449 | sz = vread(kbuf, (char *)p, sz); |
445 | if (!sz) | 450 | if (!sz) |
446 | break; | 451 | break; |
447 | if (copy_to_user(buf, kbuf, sz)) { | 452 | if (copy_to_user(buf, kbuf, sz)) { |
448 | free_page((unsigned long)kbuf); | 453 | err = -EFAULT; |
449 | return -EFAULT; | 454 | break; |
450 | } | 455 | } |
451 | count -= sz; | 456 | count -= sz; |
452 | buf += sz; | 457 | buf += sz; |
@@ -455,8 +460,8 @@ static ssize_t read_kmem(struct file *file, char __user *buf, | |||
455 | } | 460 | } |
456 | free_page((unsigned long)kbuf); | 461 | free_page((unsigned long)kbuf); |
457 | } | 462 | } |
458 | *ppos = p; | 463 | *ppos = p; |
459 | return read; | 464 | return read ? read : err; |
460 | } | 465 | } |
461 | 466 | ||
462 | 467 | ||
@@ -520,6 +525,7 @@ static ssize_t write_kmem(struct file * file, const char __user * buf, | |||
520 | ssize_t wrote = 0; | 525 | ssize_t wrote = 0; |
521 | ssize_t virtr = 0; | 526 | ssize_t virtr = 0; |
522 | char * kbuf; /* k-addr because vwrite() takes vmlist_lock rwlock */ | 527 | char * kbuf; /* k-addr because vwrite() takes vmlist_lock rwlock */ |
528 | int err = 0; | ||
523 | 529 | ||
524 | if (p < (unsigned long) high_memory) { | 530 | if (p < (unsigned long) high_memory) { |
525 | unsigned long to_write = min_t(unsigned long, count, | 531 | unsigned long to_write = min_t(unsigned long, count, |
@@ -540,14 +546,16 @@ static ssize_t write_kmem(struct file * file, const char __user * buf, | |||
540 | unsigned long sz = size_inside_page(p, count); | 546 | unsigned long sz = size_inside_page(p, count); |
541 | unsigned long n; | 547 | unsigned long n; |
542 | 548 | ||
549 | if (!is_vmalloc_or_module_addr((void *)p)) { | ||
550 | err = -ENXIO; | ||
551 | break; | ||
552 | } | ||
543 | n = copy_from_user(kbuf, buf, sz); | 553 | n = copy_from_user(kbuf, buf, sz); |
544 | if (n) { | 554 | if (n) { |
545 | if (wrote + virtr) | 555 | err = -EFAULT; |
546 | break; | 556 | break; |
547 | free_page((unsigned long)kbuf); | ||
548 | return -EFAULT; | ||
549 | } | 557 | } |
550 | sz = vwrite(kbuf, (char *)p, sz); | 558 | vwrite(kbuf, (char *)p, sz); |
551 | count -= sz; | 559 | count -= sz; |
552 | buf += sz; | 560 | buf += sz; |
553 | virtr += sz; | 561 | virtr += sz; |
@@ -556,8 +564,8 @@ static ssize_t write_kmem(struct file * file, const char __user * buf, | |||
556 | free_page((unsigned long)kbuf); | 564 | free_page((unsigned long)kbuf); |
557 | } | 565 | } |
558 | 566 | ||
559 | *ppos = p; | 567 | *ppos = p; |
560 | return virtr + wrote; | 568 | return virtr + wrote ? : err; |
561 | } | 569 | } |
562 | #endif | 570 | #endif |
563 | 571 | ||
diff --git a/drivers/connector/connector.c b/drivers/connector/connector.c index f06024668f99..537c29ac4487 100644 --- a/drivers/connector/connector.c +++ b/drivers/connector/connector.c | |||
@@ -36,17 +36,6 @@ MODULE_LICENSE("GPL"); | |||
36 | MODULE_AUTHOR("Evgeniy Polyakov <zbr@ioremap.net>"); | 36 | MODULE_AUTHOR("Evgeniy Polyakov <zbr@ioremap.net>"); |
37 | MODULE_DESCRIPTION("Generic userspace <-> kernelspace connector."); | 37 | MODULE_DESCRIPTION("Generic userspace <-> kernelspace connector."); |
38 | 38 | ||
39 | static u32 cn_idx = CN_IDX_CONNECTOR; | ||
40 | static u32 cn_val = CN_VAL_CONNECTOR; | ||
41 | |||
42 | module_param(cn_idx, uint, 0); | ||
43 | module_param(cn_val, uint, 0); | ||
44 | MODULE_PARM_DESC(cn_idx, "Connector's main device idx."); | ||
45 | MODULE_PARM_DESC(cn_val, "Connector's main device val."); | ||
46 | |||
47 | static DEFINE_MUTEX(notify_lock); | ||
48 | static LIST_HEAD(notify_list); | ||
49 | |||
50 | static struct cn_dev cdev; | 39 | static struct cn_dev cdev; |
51 | 40 | ||
52 | static int cn_already_initialized; | 41 | static int cn_already_initialized; |
@@ -210,54 +199,6 @@ static void cn_rx_skb(struct sk_buff *__skb) | |||
210 | } | 199 | } |
211 | 200 | ||
212 | /* | 201 | /* |
213 | * Notification routing. | ||
214 | * | ||
215 | * Gets id and checks if there are notification request for it's idx | ||
216 | * and val. If there are such requests notify the listeners with the | ||
217 | * given notify event. | ||
218 | * | ||
219 | */ | ||
220 | static void cn_notify(struct cb_id *id, u32 notify_event) | ||
221 | { | ||
222 | struct cn_ctl_entry *ent; | ||
223 | |||
224 | mutex_lock(¬ify_lock); | ||
225 | list_for_each_entry(ent, ¬ify_list, notify_entry) { | ||
226 | int i; | ||
227 | struct cn_notify_req *req; | ||
228 | struct cn_ctl_msg *ctl = ent->msg; | ||
229 | int idx_found, val_found; | ||
230 | |||
231 | idx_found = val_found = 0; | ||
232 | |||
233 | req = (struct cn_notify_req *)ctl->data; | ||
234 | for (i = 0; i < ctl->idx_notify_num; ++i, ++req) { | ||
235 | if (id->idx >= req->first && | ||
236 | id->idx < req->first + req->range) { | ||
237 | idx_found = 1; | ||
238 | break; | ||
239 | } | ||
240 | } | ||
241 | |||
242 | for (i = 0; i < ctl->val_notify_num; ++i, ++req) { | ||
243 | if (id->val >= req->first && | ||
244 | id->val < req->first + req->range) { | ||
245 | val_found = 1; | ||
246 | break; | ||
247 | } | ||
248 | } | ||
249 | |||
250 | if (idx_found && val_found) { | ||
251 | struct cn_msg m = { .ack = notify_event, }; | ||
252 | |||
253 | memcpy(&m.id, id, sizeof(m.id)); | ||
254 | cn_netlink_send(&m, ctl->group, GFP_KERNEL); | ||
255 | } | ||
256 | } | ||
257 | mutex_unlock(¬ify_lock); | ||
258 | } | ||
259 | |||
260 | /* | ||
261 | * Callback add routing - adds callback with given ID and name. | 202 | * Callback add routing - adds callback with given ID and name. |
262 | * If there is registered callback with the same ID it will not be added. | 203 | * If there is registered callback with the same ID it will not be added. |
263 | * | 204 | * |
@@ -276,8 +217,6 @@ int cn_add_callback(struct cb_id *id, char *name, | |||
276 | if (err) | 217 | if (err) |
277 | return err; | 218 | return err; |
278 | 219 | ||
279 | cn_notify(id, 0); | ||
280 | |||
281 | return 0; | 220 | return 0; |
282 | } | 221 | } |
283 | EXPORT_SYMBOL_GPL(cn_add_callback); | 222 | EXPORT_SYMBOL_GPL(cn_add_callback); |
@@ -295,111 +234,9 @@ void cn_del_callback(struct cb_id *id) | |||
295 | struct cn_dev *dev = &cdev; | 234 | struct cn_dev *dev = &cdev; |
296 | 235 | ||
297 | cn_queue_del_callback(dev->cbdev, id); | 236 | cn_queue_del_callback(dev->cbdev, id); |
298 | cn_notify(id, 1); | ||
299 | } | 237 | } |
300 | EXPORT_SYMBOL_GPL(cn_del_callback); | 238 | EXPORT_SYMBOL_GPL(cn_del_callback); |
301 | 239 | ||
302 | /* | ||
303 | * Checks two connector's control messages to be the same. | ||
304 | * Returns 1 if they are the same or if the first one is corrupted. | ||
305 | */ | ||
306 | static int cn_ctl_msg_equals(struct cn_ctl_msg *m1, struct cn_ctl_msg *m2) | ||
307 | { | ||
308 | int i; | ||
309 | struct cn_notify_req *req1, *req2; | ||
310 | |||
311 | if (m1->idx_notify_num != m2->idx_notify_num) | ||
312 | return 0; | ||
313 | |||
314 | if (m1->val_notify_num != m2->val_notify_num) | ||
315 | return 0; | ||
316 | |||
317 | if (m1->len != m2->len) | ||
318 | return 0; | ||
319 | |||
320 | if ((m1->idx_notify_num + m1->val_notify_num) * sizeof(*req1) != | ||
321 | m1->len) | ||
322 | return 1; | ||
323 | |||
324 | req1 = (struct cn_notify_req *)m1->data; | ||
325 | req2 = (struct cn_notify_req *)m2->data; | ||
326 | |||
327 | for (i = 0; i < m1->idx_notify_num; ++i) { | ||
328 | if (req1->first != req2->first || req1->range != req2->range) | ||
329 | return 0; | ||
330 | req1++; | ||
331 | req2++; | ||
332 | } | ||
333 | |||
334 | for (i = 0; i < m1->val_notify_num; ++i) { | ||
335 | if (req1->first != req2->first || req1->range != req2->range) | ||
336 | return 0; | ||
337 | req1++; | ||
338 | req2++; | ||
339 | } | ||
340 | |||
341 | return 1; | ||
342 | } | ||
343 | |||
344 | /* | ||
345 | * Main connector device's callback. | ||
346 | * | ||
347 | * Used for notification of a request's processing. | ||
348 | */ | ||
349 | static void cn_callback(struct cn_msg *msg, struct netlink_skb_parms *nsp) | ||
350 | { | ||
351 | struct cn_ctl_msg *ctl; | ||
352 | struct cn_ctl_entry *ent; | ||
353 | u32 size; | ||
354 | |||
355 | if (msg->len < sizeof(*ctl)) | ||
356 | return; | ||
357 | |||
358 | ctl = (struct cn_ctl_msg *)msg->data; | ||
359 | |||
360 | size = (sizeof(*ctl) + ((ctl->idx_notify_num + | ||
361 | ctl->val_notify_num) * | ||
362 | sizeof(struct cn_notify_req))); | ||
363 | |||
364 | if (msg->len != size) | ||
365 | return; | ||
366 | |||
367 | if (ctl->len + sizeof(*ctl) != msg->len) | ||
368 | return; | ||
369 | |||
370 | /* | ||
371 | * Remove notification. | ||
372 | */ | ||
373 | if (ctl->group == 0) { | ||
374 | struct cn_ctl_entry *n; | ||
375 | |||
376 | mutex_lock(¬ify_lock); | ||
377 | list_for_each_entry_safe(ent, n, ¬ify_list, notify_entry) { | ||
378 | if (cn_ctl_msg_equals(ent->msg, ctl)) { | ||
379 | list_del(&ent->notify_entry); | ||
380 | kfree(ent); | ||
381 | } | ||
382 | } | ||
383 | mutex_unlock(¬ify_lock); | ||
384 | |||
385 | return; | ||
386 | } | ||
387 | |||
388 | size += sizeof(*ent); | ||
389 | |||
390 | ent = kzalloc(size, GFP_KERNEL); | ||
391 | if (!ent) | ||
392 | return; | ||
393 | |||
394 | ent->msg = (struct cn_ctl_msg *)(ent + 1); | ||
395 | |||
396 | memcpy(ent->msg, ctl, size - sizeof(*ent)); | ||
397 | |||
398 | mutex_lock(¬ify_lock); | ||
399 | list_add(&ent->notify_entry, ¬ify_list); | ||
400 | mutex_unlock(¬ify_lock); | ||
401 | } | ||
402 | |||
403 | static int cn_proc_show(struct seq_file *m, void *v) | 240 | static int cn_proc_show(struct seq_file *m, void *v) |
404 | { | 241 | { |
405 | struct cn_queue_dev *dev = cdev.cbdev; | 242 | struct cn_queue_dev *dev = cdev.cbdev; |
@@ -437,11 +274,8 @@ static const struct file_operations cn_file_ops = { | |||
437 | static int __devinit cn_init(void) | 274 | static int __devinit cn_init(void) |
438 | { | 275 | { |
439 | struct cn_dev *dev = &cdev; | 276 | struct cn_dev *dev = &cdev; |
440 | int err; | ||
441 | 277 | ||
442 | dev->input = cn_rx_skb; | 278 | dev->input = cn_rx_skb; |
443 | dev->id.idx = cn_idx; | ||
444 | dev->id.val = cn_val; | ||
445 | 279 | ||
446 | dev->nls = netlink_kernel_create(&init_net, NETLINK_CONNECTOR, | 280 | dev->nls = netlink_kernel_create(&init_net, NETLINK_CONNECTOR, |
447 | CN_NETLINK_USERS + 0xf, | 281 | CN_NETLINK_USERS + 0xf, |
@@ -457,14 +291,6 @@ static int __devinit cn_init(void) | |||
457 | 291 | ||
458 | cn_already_initialized = 1; | 292 | cn_already_initialized = 1; |
459 | 293 | ||
460 | err = cn_add_callback(&dev->id, "connector", &cn_callback); | ||
461 | if (err) { | ||
462 | cn_already_initialized = 0; | ||
463 | cn_queue_free_dev(dev->cbdev); | ||
464 | netlink_kernel_release(dev->nls); | ||
465 | return -EINVAL; | ||
466 | } | ||
467 | |||
468 | proc_net_fops_create(&init_net, "connector", S_IRUGO, &cn_file_ops); | 294 | proc_net_fops_create(&init_net, "connector", S_IRUGO, &cn_file_ops); |
469 | 295 | ||
470 | return 0; | 296 | return 0; |
@@ -478,7 +304,6 @@ static void __devexit cn_fini(void) | |||
478 | 304 | ||
479 | proc_net_remove(&init_net, "connector"); | 305 | proc_net_remove(&init_net, "connector"); |
480 | 306 | ||
481 | cn_del_callback(&dev->id); | ||
482 | cn_queue_free_dev(dev->cbdev); | 307 | cn_queue_free_dev(dev->cbdev); |
483 | netlink_kernel_release(dev->nls); | 308 | netlink_kernel_release(dev->nls); |
484 | } | 309 | } |
diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig index 2b93d7f647ee..71d4c0703629 100644 --- a/drivers/hid/Kconfig +++ b/drivers/hid/Kconfig | |||
@@ -197,6 +197,15 @@ config LOGIG940_FF | |||
197 | Say Y here if you want to enable force feedback support for Logitech | 197 | Say Y here if you want to enable force feedback support for Logitech |
198 | Flight System G940 devices. | 198 | Flight System G940 devices. |
199 | 199 | ||
200 | config HID_MAGICMOUSE | ||
201 | tristate "Apple MagicMouse multi-touch support" | ||
202 | depends on BT_HIDP | ||
203 | ---help--- | ||
204 | Support for the Apple Magic Mouse multi-touch. | ||
205 | |||
206 | Say Y here if you want support for the multi-touch features of the | ||
207 | Apple Wireless "Magic" Mouse. | ||
208 | |||
200 | config HID_MICROSOFT | 209 | config HID_MICROSOFT |
201 | tristate "Microsoft" if EMBEDDED | 210 | tristate "Microsoft" if EMBEDDED |
202 | depends on USB_HID | 211 | depends on USB_HID |
diff --git a/drivers/hid/Makefile b/drivers/hid/Makefile index 03051694d546..0b2618f092ca 100644 --- a/drivers/hid/Makefile +++ b/drivers/hid/Makefile | |||
@@ -35,6 +35,7 @@ obj-$(CONFIG_HID_GYRATION) += hid-gyration.o | |||
35 | obj-$(CONFIG_HID_KENSINGTON) += hid-kensington.o | 35 | obj-$(CONFIG_HID_KENSINGTON) += hid-kensington.o |
36 | obj-$(CONFIG_HID_KYE) += hid-kye.o | 36 | obj-$(CONFIG_HID_KYE) += hid-kye.o |
37 | obj-$(CONFIG_HID_LOGITECH) += hid-logitech.o | 37 | obj-$(CONFIG_HID_LOGITECH) += hid-logitech.o |
38 | obj-$(CONFIG_HID_MAGICMOUSE) += hid-magicmouse.o | ||
38 | obj-$(CONFIG_HID_MICROSOFT) += hid-microsoft.o | 39 | obj-$(CONFIG_HID_MICROSOFT) += hid-microsoft.o |
39 | obj-$(CONFIG_HID_MONTEREY) += hid-monterey.o | 40 | obj-$(CONFIG_HID_MONTEREY) += hid-monterey.o |
40 | obj-$(CONFIG_HID_MOSART) += hid-mosart.o | 41 | obj-$(CONFIG_HID_MOSART) += hid-mosart.o |
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index da97195474ff..368fbb0c4ca6 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c | |||
@@ -51,7 +51,7 @@ EXPORT_SYMBOL_GPL(hid_debug); | |||
51 | * Register a new report for a device. | 51 | * Register a new report for a device. |
52 | */ | 52 | */ |
53 | 53 | ||
54 | static struct hid_report *hid_register_report(struct hid_device *device, unsigned type, unsigned id) | 54 | struct hid_report *hid_register_report(struct hid_device *device, unsigned type, unsigned id) |
55 | { | 55 | { |
56 | struct hid_report_enum *report_enum = device->report_enum + type; | 56 | struct hid_report_enum *report_enum = device->report_enum + type; |
57 | struct hid_report *report; | 57 | struct hid_report *report; |
@@ -75,6 +75,7 @@ static struct hid_report *hid_register_report(struct hid_device *device, unsigne | |||
75 | 75 | ||
76 | return report; | 76 | return report; |
77 | } | 77 | } |
78 | EXPORT_SYMBOL_GPL(hid_register_report); | ||
78 | 79 | ||
79 | /* | 80 | /* |
80 | * Register a new field for this report. | 81 | * Register a new field for this report. |
@@ -1255,6 +1256,7 @@ static const struct hid_device_id hid_blacklist[] = { | |||
1255 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ATV_IRCONTROL) }, | 1256 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ATV_IRCONTROL) }, |
1256 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IRCONTROL4) }, | 1257 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IRCONTROL4) }, |
1257 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MIGHTYMOUSE) }, | 1258 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MIGHTYMOUSE) }, |
1259 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGICMOUSE) }, | ||
1258 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_ANSI) }, | 1260 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_ANSI) }, |
1259 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_ISO) }, | 1261 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_ISO) }, |
1260 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_ANSI) }, | 1262 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_ANSI) }, |
@@ -1346,6 +1348,7 @@ static const struct hid_device_id hid_blacklist[] = { | |||
1346 | { HID_USB_DEVICE(USB_VENDOR_ID_QUANTA, USB_DEVICE_ID_PIXART_IMAGING_INC_OPTICAL_TOUCH_SCREEN) }, | 1348 | { HID_USB_DEVICE(USB_VENDOR_ID_QUANTA, USB_DEVICE_ID_PIXART_IMAGING_INC_OPTICAL_TOUCH_SCREEN) }, |
1347 | { HID_USB_DEVICE(USB_VENDOR_ID_SAMSUNG, USB_DEVICE_ID_SAMSUNG_IR_REMOTE) }, | 1349 | { HID_USB_DEVICE(USB_VENDOR_ID_SAMSUNG, USB_DEVICE_ID_SAMSUNG_IR_REMOTE) }, |
1348 | { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_CONTROLLER) }, | 1350 | { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_CONTROLLER) }, |
1351 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_CONTROLLER) }, | ||
1349 | { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_VAIO_VGX_MOUSE) }, | 1352 | { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_VAIO_VGX_MOUSE) }, |
1350 | { HID_USB_DEVICE(USB_VENDOR_ID_STANTUM, USB_DEVICE_ID_MTP) }, | 1353 | { HID_USB_DEVICE(USB_VENDOR_ID_STANTUM, USB_DEVICE_ID_MTP) }, |
1351 | { HID_USB_DEVICE(USB_VENDOR_ID_SUNPLUS, USB_DEVICE_ID_SUNPLUS_WDESKTOP) }, | 1354 | { HID_USB_DEVICE(USB_VENDOR_ID_SUNPLUS, USB_DEVICE_ID_SUNPLUS_WDESKTOP) }, |
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h index ab370f1c4b6e..72c05f90553c 100644 --- a/drivers/hid/hid-ids.h +++ b/drivers/hid/hid-ids.h | |||
@@ -59,6 +59,7 @@ | |||
59 | 59 | ||
60 | #define USB_VENDOR_ID_APPLE 0x05ac | 60 | #define USB_VENDOR_ID_APPLE 0x05ac |
61 | #define USB_DEVICE_ID_APPLE_MIGHTYMOUSE 0x0304 | 61 | #define USB_DEVICE_ID_APPLE_MIGHTYMOUSE 0x0304 |
62 | #define USB_DEVICE_ID_APPLE_MAGICMOUSE 0x030d | ||
62 | #define USB_DEVICE_ID_APPLE_FOUNTAIN_ANSI 0x020e | 63 | #define USB_DEVICE_ID_APPLE_FOUNTAIN_ANSI 0x020e |
63 | #define USB_DEVICE_ID_APPLE_FOUNTAIN_ISO 0x020f | 64 | #define USB_DEVICE_ID_APPLE_FOUNTAIN_ISO 0x020f |
64 | #define USB_DEVICE_ID_APPLE_GEYSER_ANSI 0x0214 | 65 | #define USB_DEVICE_ID_APPLE_GEYSER_ANSI 0x0214 |
diff --git a/drivers/hid/hid-magicmouse.c b/drivers/hid/hid-magicmouse.c new file mode 100644 index 000000000000..4a3a94f2b10c --- /dev/null +++ b/drivers/hid/hid-magicmouse.c | |||
@@ -0,0 +1,449 @@ | |||
1 | /* | ||
2 | * Apple "Magic" Wireless Mouse driver | ||
3 | * | ||
4 | * Copyright (c) 2010 Michael Poole <mdpoole@troilus.org> | ||
5 | */ | ||
6 | |||
7 | /* | ||
8 | * This program is free software; you can redistribute it and/or modify it | ||
9 | * under the terms of the GNU General Public License as published by the Free | ||
10 | * Software Foundation; either version 2 of the License, or (at your option) | ||
11 | * any later version. | ||
12 | */ | ||
13 | |||
14 | #include <linux/device.h> | ||
15 | #include <linux/hid.h> | ||
16 | #include <linux/module.h> | ||
17 | #include <linux/usb.h> | ||
18 | |||
19 | #include "hid-ids.h" | ||
20 | |||
21 | static bool emulate_3button = true; | ||
22 | module_param(emulate_3button, bool, 0644); | ||
23 | MODULE_PARM_DESC(emulate_3button, "Emulate a middle button"); | ||
24 | |||
25 | static int middle_button_start = -350; | ||
26 | static int middle_button_stop = +350; | ||
27 | |||
28 | static bool emulate_scroll_wheel = true; | ||
29 | module_param(emulate_scroll_wheel, bool, 0644); | ||
30 | MODULE_PARM_DESC(emulate_scroll_wheel, "Emulate a scroll wheel"); | ||
31 | |||
32 | static bool report_touches = true; | ||
33 | module_param(report_touches, bool, 0644); | ||
34 | MODULE_PARM_DESC(report_touches, "Emit touch records (otherwise, only use them for emulation)"); | ||
35 | |||
36 | static bool report_undeciphered; | ||
37 | module_param(report_undeciphered, bool, 0644); | ||
38 | MODULE_PARM_DESC(report_undeciphered, "Report undeciphered multi-touch state field using a MSC_RAW event"); | ||
39 | |||
40 | #define TOUCH_REPORT_ID 0x29 | ||
41 | /* These definitions are not precise, but they're close enough. (Bits | ||
42 | * 0x03 seem to indicate the aspect ratio of the touch, bits 0x70 seem | ||
43 | * to be some kind of bit mask -- 0x20 may be a near-field reading, | ||
44 | * and 0x40 is actual contact, and 0x10 may be a start/stop or change | ||
45 | * indication.) | ||
46 | */ | ||
47 | #define TOUCH_STATE_MASK 0xf0 | ||
48 | #define TOUCH_STATE_NONE 0x00 | ||
49 | #define TOUCH_STATE_START 0x30 | ||
50 | #define TOUCH_STATE_DRAG 0x40 | ||
51 | |||
52 | /** | ||
53 | * struct magicmouse_sc - Tracks Magic Mouse-specific data. | ||
54 | * @input: Input device through which we report events. | ||
55 | * @quirks: Currently unused. | ||
56 | * @last_timestamp: Timestamp from most recent (18-bit) touch report | ||
57 | * (units of milliseconds over short windows, but seems to | ||
58 | * increase faster when there are no touches). | ||
59 | * @delta_time: 18-bit difference between the two most recent touch | ||
60 | * reports from the mouse. | ||
61 | * @ntouches: Number of touches in most recent touch report. | ||
62 | * @scroll_accel: Number of consecutive scroll motions. | ||
63 | * @scroll_jiffies: Time of last scroll motion. | ||
64 | * @touches: Most recent data for a touch, indexed by tracking ID. | ||
65 | * @tracking_ids: Mapping of current touch input data to @touches. | ||
66 | */ | ||
67 | struct magicmouse_sc { | ||
68 | struct input_dev *input; | ||
69 | unsigned long quirks; | ||
70 | |||
71 | int last_timestamp; | ||
72 | int delta_time; | ||
73 | int ntouches; | ||
74 | int scroll_accel; | ||
75 | unsigned long scroll_jiffies; | ||
76 | |||
77 | struct { | ||
78 | short x; | ||
79 | short y; | ||
80 | short scroll_y; | ||
81 | u8 size; | ||
82 | } touches[16]; | ||
83 | int tracking_ids[16]; | ||
84 | }; | ||
85 | |||
86 | static int magicmouse_firm_touch(struct magicmouse_sc *msc) | ||
87 | { | ||
88 | int touch = -1; | ||
89 | int ii; | ||
90 | |||
91 | /* If there is only one "firm" touch, set touch to its | ||
92 | * tracking ID. | ||
93 | */ | ||
94 | for (ii = 0; ii < msc->ntouches; ii++) { | ||
95 | int idx = msc->tracking_ids[ii]; | ||
96 | if (msc->touches[idx].size < 8) { | ||
97 | /* Ignore this touch. */ | ||
98 | } else if (touch >= 0) { | ||
99 | touch = -1; | ||
100 | break; | ||
101 | } else { | ||
102 | touch = idx; | ||
103 | } | ||
104 | } | ||
105 | |||
106 | return touch; | ||
107 | } | ||
108 | |||
109 | static void magicmouse_emit_buttons(struct magicmouse_sc *msc, int state) | ||
110 | { | ||
111 | int last_state = test_bit(BTN_LEFT, msc->input->key) << 0 | | ||
112 | test_bit(BTN_RIGHT, msc->input->key) << 1 | | ||
113 | test_bit(BTN_MIDDLE, msc->input->key) << 2; | ||
114 | |||
115 | if (emulate_3button) { | ||
116 | int id; | ||
117 | |||
118 | /* If some button was pressed before, keep it held | ||
119 | * down. Otherwise, if there's exactly one firm | ||
120 | * touch, use that to override the mouse's guess. | ||
121 | */ | ||
122 | if (state == 0) { | ||
123 | /* The button was released. */ | ||
124 | } else if (last_state != 0) { | ||
125 | state = last_state; | ||
126 | } else if ((id = magicmouse_firm_touch(msc)) >= 0) { | ||
127 | int x = msc->touches[id].x; | ||
128 | if (x < middle_button_start) | ||
129 | state = 1; | ||
130 | else if (x > middle_button_stop) | ||
131 | state = 2; | ||
132 | else | ||
133 | state = 4; | ||
134 | } /* else: we keep the mouse's guess */ | ||
135 | |||
136 | input_report_key(msc->input, BTN_MIDDLE, state & 4); | ||
137 | } | ||
138 | |||
139 | input_report_key(msc->input, BTN_LEFT, state & 1); | ||
140 | input_report_key(msc->input, BTN_RIGHT, state & 2); | ||
141 | |||
142 | if (state != last_state) | ||
143 | msc->scroll_accel = 0; | ||
144 | } | ||
145 | |||
146 | static void magicmouse_emit_touch(struct magicmouse_sc *msc, int raw_id, u8 *tdata) | ||
147 | { | ||
148 | struct input_dev *input = msc->input; | ||
149 | __s32 x_y = tdata[0] << 8 | tdata[1] << 16 | tdata[2] << 24; | ||
150 | int misc = tdata[5] | tdata[6] << 8; | ||
151 | int id = (misc >> 6) & 15; | ||
152 | int x = x_y << 12 >> 20; | ||
153 | int y = -(x_y >> 20); | ||
154 | |||
155 | /* Store tracking ID and other fields. */ | ||
156 | msc->tracking_ids[raw_id] = id; | ||
157 | msc->touches[id].x = x; | ||
158 | msc->touches[id].y = y; | ||
159 | msc->touches[id].size = misc & 63; | ||
160 | |||
161 | /* If requested, emulate a scroll wheel by detecting small | ||
162 | * vertical touch motions along the middle of the mouse. | ||
163 | */ | ||
164 | if (emulate_scroll_wheel && | ||
165 | middle_button_start < x && x < middle_button_stop) { | ||
166 | static const int accel_profile[] = { | ||
167 | 256, 228, 192, 160, 128, 96, 64, 32, | ||
168 | }; | ||
169 | unsigned long now = jiffies; | ||
170 | int step = msc->touches[id].scroll_y - y; | ||
171 | |||
172 | /* Reset acceleration after half a second. */ | ||
173 | if (time_after(now, msc->scroll_jiffies + HZ / 2)) | ||
174 | msc->scroll_accel = 0; | ||
175 | |||
176 | /* Calculate and apply the scroll motion. */ | ||
177 | switch (tdata[7] & TOUCH_STATE_MASK) { | ||
178 | case TOUCH_STATE_START: | ||
179 | msc->touches[id].scroll_y = y; | ||
180 | msc->scroll_accel = min_t(int, msc->scroll_accel + 1, | ||
181 | ARRAY_SIZE(accel_profile) - 1); | ||
182 | break; | ||
183 | case TOUCH_STATE_DRAG: | ||
184 | step = step / accel_profile[msc->scroll_accel]; | ||
185 | if (step != 0) { | ||
186 | msc->touches[id].scroll_y = y; | ||
187 | msc->scroll_jiffies = now; | ||
188 | input_report_rel(input, REL_WHEEL, step); | ||
189 | } | ||
190 | break; | ||
191 | } | ||
192 | } | ||
193 | |||
194 | /* Generate the input events for this touch. */ | ||
195 | if (report_touches) { | ||
196 | int orientation = (misc >> 10) - 32; | ||
197 | |||
198 | input_report_abs(input, ABS_MT_TRACKING_ID, id); | ||
199 | input_report_abs(input, ABS_MT_TOUCH_MAJOR, tdata[3]); | ||
200 | input_report_abs(input, ABS_MT_TOUCH_MINOR, tdata[4]); | ||
201 | input_report_abs(input, ABS_MT_ORIENTATION, orientation); | ||
202 | input_report_abs(input, ABS_MT_POSITION_X, x); | ||
203 | input_report_abs(input, ABS_MT_POSITION_Y, y); | ||
204 | |||
205 | if (report_undeciphered) | ||
206 | input_event(input, EV_MSC, MSC_RAW, tdata[7]); | ||
207 | |||
208 | input_mt_sync(input); | ||
209 | } | ||
210 | } | ||
211 | |||
212 | static int magicmouse_raw_event(struct hid_device *hdev, | ||
213 | struct hid_report *report, u8 *data, int size) | ||
214 | { | ||
215 | struct magicmouse_sc *msc = hid_get_drvdata(hdev); | ||
216 | struct input_dev *input = msc->input; | ||
217 | int x, y, ts, ii, clicks; | ||
218 | |||
219 | switch (data[0]) { | ||
220 | case 0x10: | ||
221 | if (size != 6) | ||
222 | return 0; | ||
223 | x = (__s16)(data[2] | data[3] << 8); | ||
224 | y = (__s16)(data[4] | data[5] << 8); | ||
225 | clicks = data[1]; | ||
226 | break; | ||
227 | case TOUCH_REPORT_ID: | ||
228 | /* Expect six bytes of prefix, and N*8 bytes of touch data. */ | ||
229 | if (size < 6 || ((size - 6) % 8) != 0) | ||
230 | return 0; | ||
231 | ts = data[3] >> 6 | data[4] << 2 | data[5] << 10; | ||
232 | msc->delta_time = (ts - msc->last_timestamp) & 0x3ffff; | ||
233 | msc->last_timestamp = ts; | ||
234 | msc->ntouches = (size - 6) / 8; | ||
235 | for (ii = 0; ii < msc->ntouches; ii++) | ||
236 | magicmouse_emit_touch(msc, ii, data + ii * 8 + 6); | ||
237 | /* When emulating three-button mode, it is important | ||
238 | * to have the current touch information before | ||
239 | * generating a click event. | ||
240 | */ | ||
241 | x = (signed char)data[1]; | ||
242 | y = (signed char)data[2]; | ||
243 | clicks = data[3]; | ||
244 | break; | ||
245 | case 0x20: /* Theoretically battery status (0-100), but I have | ||
246 | * never seen it -- maybe it is only upon request. | ||
247 | */ | ||
248 | case 0x60: /* Unknown, maybe laser on/off. */ | ||
249 | case 0x61: /* Laser reflection status change. | ||
250 | * data[1]: 0 = spotted, 1 = lost | ||
251 | */ | ||
252 | default: | ||
253 | return 0; | ||
254 | } | ||
255 | |||
256 | magicmouse_emit_buttons(msc, clicks & 3); | ||
257 | input_report_rel(input, REL_X, x); | ||
258 | input_report_rel(input, REL_Y, y); | ||
259 | input_sync(input); | ||
260 | return 1; | ||
261 | } | ||
262 | |||
263 | static int magicmouse_input_open(struct input_dev *dev) | ||
264 | { | ||
265 | struct hid_device *hid = input_get_drvdata(dev); | ||
266 | |||
267 | return hid->ll_driver->open(hid); | ||
268 | } | ||
269 | |||
270 | static void magicmouse_input_close(struct input_dev *dev) | ||
271 | { | ||
272 | struct hid_device *hid = input_get_drvdata(dev); | ||
273 | |||
274 | hid->ll_driver->close(hid); | ||
275 | } | ||
276 | |||
277 | static void magicmouse_setup_input(struct input_dev *input, struct hid_device *hdev) | ||
278 | { | ||
279 | input_set_drvdata(input, hdev); | ||
280 | input->event = hdev->ll_driver->hidinput_input_event; | ||
281 | input->open = magicmouse_input_open; | ||
282 | input->close = magicmouse_input_close; | ||
283 | |||
284 | input->name = hdev->name; | ||
285 | input->phys = hdev->phys; | ||
286 | input->uniq = hdev->uniq; | ||
287 | input->id.bustype = hdev->bus; | ||
288 | input->id.vendor = hdev->vendor; | ||
289 | input->id.product = hdev->product; | ||
290 | input->id.version = hdev->version; | ||
291 | input->dev.parent = hdev->dev.parent; | ||
292 | |||
293 | __set_bit(EV_KEY, input->evbit); | ||
294 | __set_bit(BTN_LEFT, input->keybit); | ||
295 | __set_bit(BTN_RIGHT, input->keybit); | ||
296 | if (emulate_3button) | ||
297 | __set_bit(BTN_MIDDLE, input->keybit); | ||
298 | __set_bit(BTN_TOOL_FINGER, input->keybit); | ||
299 | |||
300 | __set_bit(EV_REL, input->evbit); | ||
301 | __set_bit(REL_X, input->relbit); | ||
302 | __set_bit(REL_Y, input->relbit); | ||
303 | if (emulate_scroll_wheel) | ||
304 | __set_bit(REL_WHEEL, input->relbit); | ||
305 | |||
306 | if (report_touches) { | ||
307 | __set_bit(EV_ABS, input->evbit); | ||
308 | |||
309 | input_set_abs_params(input, ABS_MT_TRACKING_ID, 0, 15, 0, 0); | ||
310 | input_set_abs_params(input, ABS_MT_TOUCH_MAJOR, 0, 255, 4, 0); | ||
311 | input_set_abs_params(input, ABS_MT_TOUCH_MINOR, 0, 255, 4, 0); | ||
312 | input_set_abs_params(input, ABS_MT_ORIENTATION, -32, 31, 1, 0); | ||
313 | input_set_abs_params(input, ABS_MT_POSITION_X, -1100, 1358, | ||
314 | 4, 0); | ||
315 | /* Note: Touch Y position from the device is inverted relative | ||
316 | * to how pointer motion is reported (and relative to how USB | ||
317 | * HID recommends the coordinates work). This driver keeps | ||
318 | * the origin at the same position, and just uses the additive | ||
319 | * inverse of the reported Y. | ||
320 | */ | ||
321 | input_set_abs_params(input, ABS_MT_POSITION_Y, -1589, 2047, | ||
322 | 4, 0); | ||
323 | } | ||
324 | |||
325 | if (report_undeciphered) { | ||
326 | __set_bit(EV_MSC, input->evbit); | ||
327 | __set_bit(MSC_RAW, input->mscbit); | ||
328 | } | ||
329 | } | ||
330 | |||
331 | static int magicmouse_probe(struct hid_device *hdev, | ||
332 | const struct hid_device_id *id) | ||
333 | { | ||
334 | __u8 feature_1[] = { 0xd7, 0x01 }; | ||
335 | __u8 feature_2[] = { 0xf8, 0x01, 0x32 }; | ||
336 | struct input_dev *input; | ||
337 | struct magicmouse_sc *msc; | ||
338 | struct hid_report *report; | ||
339 | int ret; | ||
340 | |||
341 | msc = kzalloc(sizeof(*msc), GFP_KERNEL); | ||
342 | if (msc == NULL) { | ||
343 | dev_err(&hdev->dev, "can't alloc magicmouse descriptor\n"); | ||
344 | return -ENOMEM; | ||
345 | } | ||
346 | |||
347 | msc->quirks = id->driver_data; | ||
348 | hid_set_drvdata(hdev, msc); | ||
349 | |||
350 | ret = hid_parse(hdev); | ||
351 | if (ret) { | ||
352 | dev_err(&hdev->dev, "magicmouse hid parse failed\n"); | ||
353 | goto err_free; | ||
354 | } | ||
355 | |||
356 | ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT); | ||
357 | if (ret) { | ||
358 | dev_err(&hdev->dev, "magicmouse hw start failed\n"); | ||
359 | goto err_free; | ||
360 | } | ||
361 | |||
362 | report = hid_register_report(hdev, HID_INPUT_REPORT, TOUCH_REPORT_ID); | ||
363 | if (!report) { | ||
364 | dev_err(&hdev->dev, "unable to register touch report\n"); | ||
365 | ret = -ENOMEM; | ||
366 | goto err_stop_hw; | ||
367 | } | ||
368 | report->size = 6; | ||
369 | |||
370 | ret = hdev->hid_output_raw_report(hdev, feature_1, sizeof(feature_1), | ||
371 | HID_FEATURE_REPORT); | ||
372 | if (ret != sizeof(feature_1)) { | ||
373 | dev_err(&hdev->dev, "unable to request touch data (1:%d)\n", | ||
374 | ret); | ||
375 | goto err_stop_hw; | ||
376 | } | ||
377 | ret = hdev->hid_output_raw_report(hdev, feature_2, | ||
378 | sizeof(feature_2), HID_FEATURE_REPORT); | ||
379 | if (ret != sizeof(feature_2)) { | ||
380 | dev_err(&hdev->dev, "unable to request touch data (2:%d)\n", | ||
381 | ret); | ||
382 | goto err_stop_hw; | ||
383 | } | ||
384 | |||
385 | input = input_allocate_device(); | ||
386 | if (!input) { | ||
387 | dev_err(&hdev->dev, "can't alloc input device\n"); | ||
388 | ret = -ENOMEM; | ||
389 | goto err_stop_hw; | ||
390 | } | ||
391 | magicmouse_setup_input(input, hdev); | ||
392 | |||
393 | ret = input_register_device(input); | ||
394 | if (ret) { | ||
395 | dev_err(&hdev->dev, "input device registration failed\n"); | ||
396 | goto err_input; | ||
397 | } | ||
398 | msc->input = input; | ||
399 | |||
400 | return 0; | ||
401 | err_input: | ||
402 | input_free_device(input); | ||
403 | err_stop_hw: | ||
404 | hid_hw_stop(hdev); | ||
405 | err_free: | ||
406 | kfree(msc); | ||
407 | return ret; | ||
408 | } | ||
409 | |||
410 | static void magicmouse_remove(struct hid_device *hdev) | ||
411 | { | ||
412 | hid_hw_stop(hdev); | ||
413 | kfree(hid_get_drvdata(hdev)); | ||
414 | } | ||
415 | |||
416 | static const struct hid_device_id magic_mice[] = { | ||
417 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGICMOUSE), | ||
418 | .driver_data = 0 }, | ||
419 | { } | ||
420 | }; | ||
421 | MODULE_DEVICE_TABLE(hid, magic_mice); | ||
422 | |||
423 | static struct hid_driver magicmouse_driver = { | ||
424 | .name = "magicmouse", | ||
425 | .id_table = magic_mice, | ||
426 | .probe = magicmouse_probe, | ||
427 | .remove = magicmouse_remove, | ||
428 | .raw_event = magicmouse_raw_event, | ||
429 | }; | ||
430 | |||
431 | static int __init magicmouse_init(void) | ||
432 | { | ||
433 | int ret; | ||
434 | |||
435 | ret = hid_register_driver(&magicmouse_driver); | ||
436 | if (ret) | ||
437 | printk(KERN_ERR "can't register magicmouse driver\n"); | ||
438 | |||
439 | return ret; | ||
440 | } | ||
441 | |||
442 | static void __exit magicmouse_exit(void) | ||
443 | { | ||
444 | hid_unregister_driver(&magicmouse_driver); | ||
445 | } | ||
446 | |||
447 | module_init(magicmouse_init); | ||
448 | module_exit(magicmouse_exit); | ||
449 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c index 96d723ea5131..9bf00d77d92b 100644 --- a/drivers/hid/hid-sony.c +++ b/drivers/hid/hid-sony.c | |||
@@ -48,7 +48,7 @@ static void sony_report_fixup(struct hid_device *hdev, __u8 *rdesc, | |||
48 | * to "operational". Without this, the ps3 controller will not report any | 48 | * to "operational". Without this, the ps3 controller will not report any |
49 | * events. | 49 | * events. |
50 | */ | 50 | */ |
51 | static int sony_set_operational(struct hid_device *hdev) | 51 | static int sony_set_operational_usb(struct hid_device *hdev) |
52 | { | 52 | { |
53 | struct usb_interface *intf = to_usb_interface(hdev->dev.parent); | 53 | struct usb_interface *intf = to_usb_interface(hdev->dev.parent); |
54 | struct usb_device *dev = interface_to_usbdev(intf); | 54 | struct usb_device *dev = interface_to_usbdev(intf); |
@@ -73,6 +73,12 @@ static int sony_set_operational(struct hid_device *hdev) | |||
73 | return ret; | 73 | return ret; |
74 | } | 74 | } |
75 | 75 | ||
76 | static int sony_set_operational_bt(struct hid_device *hdev) | ||
77 | { | ||
78 | unsigned char buf[] = { 0x53, 0xf4, 0x42, 0x03, 0x00, 0x00 }; | ||
79 | return hdev->hid_output_raw_report(hdev, buf, sizeof(buf), HID_FEATURE_REPORT); | ||
80 | } | ||
81 | |||
76 | static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id) | 82 | static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id) |
77 | { | 83 | { |
78 | int ret; | 84 | int ret; |
@@ -101,7 +107,17 @@ static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id) | |||
101 | goto err_free; | 107 | goto err_free; |
102 | } | 108 | } |
103 | 109 | ||
104 | ret = sony_set_operational(hdev); | 110 | switch (hdev->bus) { |
111 | case BUS_USB: | ||
112 | ret = sony_set_operational_usb(hdev); | ||
113 | break; | ||
114 | case BUS_BLUETOOTH: | ||
115 | ret = sony_set_operational_bt(hdev); | ||
116 | break; | ||
117 | default: | ||
118 | ret = 0; | ||
119 | } | ||
120 | |||
105 | if (ret < 0) | 121 | if (ret < 0) |
106 | goto err_stop; | 122 | goto err_stop; |
107 | 123 | ||
@@ -121,6 +137,7 @@ static void sony_remove(struct hid_device *hdev) | |||
121 | 137 | ||
122 | static const struct hid_device_id sony_devices[] = { | 138 | static const struct hid_device_id sony_devices[] = { |
123 | { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_CONTROLLER) }, | 139 | { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_CONTROLLER) }, |
140 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_CONTROLLER) }, | ||
124 | { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_VAIO_VGX_MOUSE), | 141 | { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_VAIO_VGX_MOUSE), |
125 | .driver_data = VAIO_RDESC_CONSTANT }, | 142 | .driver_data = VAIO_RDESC_CONSTANT }, |
126 | { } | 143 | { } |
diff --git a/drivers/hid/hid-wacom.c b/drivers/hid/hid-wacom.c index 12dcda529201..8d3b46f5d149 100644 --- a/drivers/hid/hid-wacom.c +++ b/drivers/hid/hid-wacom.c | |||
@@ -156,7 +156,9 @@ static int wacom_probe(struct hid_device *hdev, | |||
156 | struct hid_input *hidinput; | 156 | struct hid_input *hidinput; |
157 | struct input_dev *input; | 157 | struct input_dev *input; |
158 | struct wacom_data *wdata; | 158 | struct wacom_data *wdata; |
159 | char rep_data[2]; | ||
159 | int ret; | 160 | int ret; |
161 | int limit; | ||
160 | 162 | ||
161 | wdata = kzalloc(sizeof(*wdata), GFP_KERNEL); | 163 | wdata = kzalloc(sizeof(*wdata), GFP_KERNEL); |
162 | if (wdata == NULL) { | 164 | if (wdata == NULL) { |
@@ -166,6 +168,7 @@ static int wacom_probe(struct hid_device *hdev, | |||
166 | 168 | ||
167 | hid_set_drvdata(hdev, wdata); | 169 | hid_set_drvdata(hdev, wdata); |
168 | 170 | ||
171 | /* Parse the HID report now */ | ||
169 | ret = hid_parse(hdev); | 172 | ret = hid_parse(hdev); |
170 | if (ret) { | 173 | if (ret) { |
171 | dev_err(&hdev->dev, "parse failed\n"); | 174 | dev_err(&hdev->dev, "parse failed\n"); |
@@ -178,6 +181,31 @@ static int wacom_probe(struct hid_device *hdev, | |||
178 | goto err_free; | 181 | goto err_free; |
179 | } | 182 | } |
180 | 183 | ||
184 | /* | ||
185 | * Note that if the raw queries fail, it's not a hard failure and it | ||
186 | * is safe to continue | ||
187 | */ | ||
188 | |||
189 | /* Set Wacom mode2 */ | ||
190 | rep_data[0] = 0x03; rep_data[1] = 0x00; | ||
191 | limit = 3; | ||
192 | do { | ||
193 | ret = hdev->hid_output_raw_report(hdev, rep_data, 2, | ||
194 | HID_FEATURE_REPORT); | ||
195 | } while (ret < 0 && limit-- > 0); | ||
196 | if (ret < 0) | ||
197 | dev_warn(&hdev->dev, "failed to poke device #1, %d\n", ret); | ||
198 | |||
199 | /* 0x06 - high reporting speed, 0x05 - low speed */ | ||
200 | rep_data[0] = 0x06; rep_data[1] = 0x00; | ||
201 | limit = 3; | ||
202 | do { | ||
203 | ret = hdev->hid_output_raw_report(hdev, rep_data, 2, | ||
204 | HID_FEATURE_REPORT); | ||
205 | } while (ret < 0 && limit-- > 0); | ||
206 | if (ret < 0) | ||
207 | dev_warn(&hdev->dev, "failed to poke device #2, %d\n", ret); | ||
208 | |||
181 | hidinput = list_entry(hdev->inputs.next, struct hid_input, list); | 209 | hidinput = list_entry(hdev->inputs.next, struct hid_input, list); |
182 | input = hidinput->input; | 210 | input = hidinput->input; |
183 | 211 | ||
diff --git a/drivers/hid/hidraw.c b/drivers/hid/hidraw.c index cdd136942bca..d04476700b7b 100644 --- a/drivers/hid/hidraw.c +++ b/drivers/hid/hidraw.c | |||
@@ -134,7 +134,7 @@ static ssize_t hidraw_write(struct file *file, const char __user *buffer, size_t | |||
134 | goto out; | 134 | goto out; |
135 | } | 135 | } |
136 | 136 | ||
137 | ret = dev->hid_output_raw_report(dev, buf, count); | 137 | ret = dev->hid_output_raw_report(dev, buf, count, HID_OUTPUT_REPORT); |
138 | out: | 138 | out: |
139 | kfree(buf); | 139 | kfree(buf); |
140 | return ret; | 140 | return ret; |
diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c index ceaf4a14b67b..56d06cd8075b 100644 --- a/drivers/hid/usbhid/hid-core.c +++ b/drivers/hid/usbhid/hid-core.c | |||
@@ -798,7 +798,8 @@ static int hid_alloc_buffers(struct usb_device *dev, struct hid_device *hid) | |||
798 | return 0; | 798 | return 0; |
799 | } | 799 | } |
800 | 800 | ||
801 | static int usbhid_output_raw_report(struct hid_device *hid, __u8 *buf, size_t count) | 801 | static int usbhid_output_raw_report(struct hid_device *hid, __u8 *buf, size_t count, |
802 | unsigned char report_type) | ||
802 | { | 803 | { |
803 | struct usbhid_device *usbhid = hid->driver_data; | 804 | struct usbhid_device *usbhid = hid->driver_data; |
804 | struct usb_device *dev = hid_to_usb_dev(hid); | 805 | struct usb_device *dev = hid_to_usb_dev(hid); |
@@ -809,7 +810,7 @@ static int usbhid_output_raw_report(struct hid_device *hid, __u8 *buf, size_t co | |||
809 | ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), | 810 | ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), |
810 | HID_REQ_SET_REPORT, | 811 | HID_REQ_SET_REPORT, |
811 | USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE, | 812 | USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE, |
812 | ((HID_OUTPUT_REPORT + 1) << 8) | *buf, | 813 | ((report_type + 1) << 8) | *buf, |
813 | interface->desc.bInterfaceNumber, buf + 1, count - 1, | 814 | interface->desc.bInterfaceNumber, buf + 1, count - 1, |
814 | USB_CTRL_SET_TIMEOUT); | 815 | USB_CTRL_SET_TIMEOUT); |
815 | 816 | ||
diff --git a/drivers/net/benet/be.h b/drivers/net/benet/be.h index 9fd8e5ecd5d7..5bc74590c73e 100644 --- a/drivers/net/benet/be.h +++ b/drivers/net/benet/be.h | |||
@@ -276,8 +276,13 @@ struct be_adapter { | |||
276 | int link_speed; | 276 | int link_speed; |
277 | u8 port_type; | 277 | u8 port_type; |
278 | u8 transceiver; | 278 | u8 transceiver; |
279 | u8 generation; /* BladeEngine ASIC generation */ | ||
279 | }; | 280 | }; |
280 | 281 | ||
282 | /* BladeEngine Generation numbers */ | ||
283 | #define BE_GEN2 2 | ||
284 | #define BE_GEN3 3 | ||
285 | |||
281 | extern const struct ethtool_ops be_ethtool_ops; | 286 | extern const struct ethtool_ops be_ethtool_ops; |
282 | 287 | ||
283 | #define drvr_stats(adapter) (&adapter->stats.drvr_stats) | 288 | #define drvr_stats(adapter) (&adapter->stats.drvr_stats) |
diff --git a/drivers/net/benet/be_cmds.h b/drivers/net/benet/be_cmds.h index c002b8391b4d..13b33c841083 100644 --- a/drivers/net/benet/be_cmds.h +++ b/drivers/net/benet/be_cmds.h | |||
@@ -164,7 +164,8 @@ struct be_cmd_req_hdr { | |||
164 | u8 domain; /* dword 0 */ | 164 | u8 domain; /* dword 0 */ |
165 | u32 timeout; /* dword 1 */ | 165 | u32 timeout; /* dword 1 */ |
166 | u32 request_length; /* dword 2 */ | 166 | u32 request_length; /* dword 2 */ |
167 | u32 rsvd; /* dword 3 */ | 167 | u8 version; /* dword 3 */ |
168 | u8 rsvd[3]; /* dword 3 */ | ||
168 | }; | 169 | }; |
169 | 170 | ||
170 | #define RESP_HDR_INFO_OPCODE_SHIFT 0 /* bits 0 - 7 */ | 171 | #define RESP_HDR_INFO_OPCODE_SHIFT 0 /* bits 0 - 7 */ |
diff --git a/drivers/net/benet/be_main.c b/drivers/net/benet/be_main.c index 33ab8c7f14fe..626b76c0ebc7 100644 --- a/drivers/net/benet/be_main.c +++ b/drivers/net/benet/be_main.c | |||
@@ -1350,7 +1350,7 @@ static irqreturn_t be_intx(int irq, void *dev) | |||
1350 | int isr; | 1350 | int isr; |
1351 | 1351 | ||
1352 | isr = ioread32(adapter->csr + CEV_ISR0_OFFSET + | 1352 | isr = ioread32(adapter->csr + CEV_ISR0_OFFSET + |
1353 | be_pci_func(adapter) * CEV_ISR_SIZE); | 1353 | (adapter->tx_eq.q.id/ 8) * CEV_ISR_SIZE); |
1354 | if (!isr) | 1354 | if (!isr) |
1355 | return IRQ_NONE; | 1355 | return IRQ_NONE; |
1356 | 1356 | ||
@@ -2051,6 +2051,7 @@ static void be_unmap_pci_bars(struct be_adapter *adapter) | |||
2051 | static int be_map_pci_bars(struct be_adapter *adapter) | 2051 | static int be_map_pci_bars(struct be_adapter *adapter) |
2052 | { | 2052 | { |
2053 | u8 __iomem *addr; | 2053 | u8 __iomem *addr; |
2054 | int pcicfg_reg; | ||
2054 | 2055 | ||
2055 | addr = ioremap_nocache(pci_resource_start(adapter->pdev, 2), | 2056 | addr = ioremap_nocache(pci_resource_start(adapter->pdev, 2), |
2056 | pci_resource_len(adapter->pdev, 2)); | 2057 | pci_resource_len(adapter->pdev, 2)); |
@@ -2064,8 +2065,13 @@ static int be_map_pci_bars(struct be_adapter *adapter) | |||
2064 | goto pci_map_err; | 2065 | goto pci_map_err; |
2065 | adapter->db = addr; | 2066 | adapter->db = addr; |
2066 | 2067 | ||
2067 | addr = ioremap_nocache(pci_resource_start(adapter->pdev, 1), | 2068 | if (adapter->generation == BE_GEN2) |
2068 | pci_resource_len(adapter->pdev, 1)); | 2069 | pcicfg_reg = 1; |
2070 | else | ||
2071 | pcicfg_reg = 0; | ||
2072 | |||
2073 | addr = ioremap_nocache(pci_resource_start(adapter->pdev, pcicfg_reg), | ||
2074 | pci_resource_len(adapter->pdev, pcicfg_reg)); | ||
2069 | if (addr == NULL) | 2075 | if (addr == NULL) |
2070 | goto pci_map_err; | 2076 | goto pci_map_err; |
2071 | adapter->pcicfg = addr; | 2077 | adapter->pcicfg = addr; |
@@ -2162,6 +2168,7 @@ static int be_stats_init(struct be_adapter *adapter) | |||
2162 | cmd->va = pci_alloc_consistent(adapter->pdev, cmd->size, &cmd->dma); | 2168 | cmd->va = pci_alloc_consistent(adapter->pdev, cmd->size, &cmd->dma); |
2163 | if (cmd->va == NULL) | 2169 | if (cmd->va == NULL) |
2164 | return -1; | 2170 | return -1; |
2171 | memset(cmd->va, 0, cmd->size); | ||
2165 | return 0; | 2172 | return 0; |
2166 | } | 2173 | } |
2167 | 2174 | ||
@@ -2240,6 +2247,20 @@ static int __devinit be_probe(struct pci_dev *pdev, | |||
2240 | goto rel_reg; | 2247 | goto rel_reg; |
2241 | } | 2248 | } |
2242 | adapter = netdev_priv(netdev); | 2249 | adapter = netdev_priv(netdev); |
2250 | |||
2251 | switch (pdev->device) { | ||
2252 | case BE_DEVICE_ID1: | ||
2253 | case OC_DEVICE_ID1: | ||
2254 | adapter->generation = BE_GEN2; | ||
2255 | break; | ||
2256 | case BE_DEVICE_ID2: | ||
2257 | case OC_DEVICE_ID2: | ||
2258 | adapter->generation = BE_GEN3; | ||
2259 | break; | ||
2260 | default: | ||
2261 | adapter->generation = 0; | ||
2262 | } | ||
2263 | |||
2243 | adapter->pdev = pdev; | 2264 | adapter->pdev = pdev; |
2244 | pci_set_drvdata(pdev, adapter); | 2265 | pci_set_drvdata(pdev, adapter); |
2245 | adapter->netdev = netdev; | 2266 | adapter->netdev = netdev; |
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 3f0071cfe56b..efa0e41bf3ec 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
@@ -3639,7 +3639,7 @@ static int bond_open(struct net_device *bond_dev) | |||
3639 | */ | 3639 | */ |
3640 | if (bond_alb_initialize(bond, (bond->params.mode == BOND_MODE_ALB))) { | 3640 | if (bond_alb_initialize(bond, (bond->params.mode == BOND_MODE_ALB))) { |
3641 | /* something went wrong - fail the open operation */ | 3641 | /* something went wrong - fail the open operation */ |
3642 | return -1; | 3642 | return -ENOMEM; |
3643 | } | 3643 | } |
3644 | 3644 | ||
3645 | INIT_DELAYED_WORK(&bond->alb_work, bond_alb_monitor); | 3645 | INIT_DELAYED_WORK(&bond->alb_work, bond_alb_monitor); |
diff --git a/drivers/net/igbvf/netdev.c b/drivers/net/igbvf/netdev.c index 297a5ddd77f0..2aa71a766c35 100644 --- a/drivers/net/igbvf/netdev.c +++ b/drivers/net/igbvf/netdev.c | |||
@@ -2117,6 +2117,7 @@ static inline int igbvf_tx_map_adv(struct igbvf_adapter *adapter, | |||
2117 | /* set time_stamp *before* dma to help avoid a possible race */ | 2117 | /* set time_stamp *before* dma to help avoid a possible race */ |
2118 | buffer_info->time_stamp = jiffies; | 2118 | buffer_info->time_stamp = jiffies; |
2119 | buffer_info->next_to_watch = i; | 2119 | buffer_info->next_to_watch = i; |
2120 | buffer_info->mapped_as_page = false; | ||
2120 | buffer_info->dma = pci_map_single(pdev, skb->data, len, | 2121 | buffer_info->dma = pci_map_single(pdev, skb->data, len, |
2121 | PCI_DMA_TODEVICE); | 2122 | PCI_DMA_TODEVICE); |
2122 | if (pci_dma_mapping_error(pdev, buffer_info->dma)) | 2123 | if (pci_dma_mapping_error(pdev, buffer_info->dma)) |
diff --git a/drivers/net/ixgbe/ixgbe_dcb_nl.c b/drivers/net/ixgbe/ixgbe_dcb_nl.c index 56f37f66b696..dd4883f642be 100644 --- a/drivers/net/ixgbe/ixgbe_dcb_nl.c +++ b/drivers/net/ixgbe/ixgbe_dcb_nl.c | |||
@@ -223,7 +223,7 @@ static void ixgbe_dcbnl_set_pg_bwg_cfg_tx(struct net_device *netdev, int bwg_id, | |||
223 | 223 | ||
224 | if (adapter->temp_dcb_cfg.bw_percentage[0][bwg_id] != | 224 | if (adapter->temp_dcb_cfg.bw_percentage[0][bwg_id] != |
225 | adapter->dcb_cfg.bw_percentage[0][bwg_id]) { | 225 | adapter->dcb_cfg.bw_percentage[0][bwg_id]) { |
226 | adapter->dcb_set_bitmap |= BIT_PG_RX; | 226 | adapter->dcb_set_bitmap |= BIT_PG_TX; |
227 | adapter->dcb_set_bitmap |= BIT_RESETLINK; | 227 | adapter->dcb_set_bitmap |= BIT_RESETLINK; |
228 | } | 228 | } |
229 | } | 229 | } |
@@ -341,6 +341,12 @@ static u8 ixgbe_dcbnl_set_all(struct net_device *netdev) | |||
341 | if (!adapter->dcb_set_bitmap) | 341 | if (!adapter->dcb_set_bitmap) |
342 | return DCB_NO_HW_CHG; | 342 | return DCB_NO_HW_CHG; |
343 | 343 | ||
344 | ret = ixgbe_copy_dcb_cfg(&adapter->temp_dcb_cfg, &adapter->dcb_cfg, | ||
345 | adapter->ring_feature[RING_F_DCB].indices); | ||
346 | |||
347 | if (ret) | ||
348 | return DCB_NO_HW_CHG; | ||
349 | |||
344 | /* | 350 | /* |
345 | * Only take down the adapter if the configuration change | 351 | * Only take down the adapter if the configuration change |
346 | * requires a reset. | 352 | * requires a reset. |
@@ -359,14 +365,6 @@ static u8 ixgbe_dcbnl_set_all(struct net_device *netdev) | |||
359 | } | 365 | } |
360 | } | 366 | } |
361 | 367 | ||
362 | ret = ixgbe_copy_dcb_cfg(&adapter->temp_dcb_cfg, &adapter->dcb_cfg, | ||
363 | adapter->ring_feature[RING_F_DCB].indices); | ||
364 | if (ret) { | ||
365 | if (adapter->dcb_set_bitmap & BIT_RESETLINK) | ||
366 | clear_bit(__IXGBE_RESETTING, &adapter->state); | ||
367 | return DCB_NO_HW_CHG; | ||
368 | } | ||
369 | |||
370 | if (adapter->dcb_cfg.pfc_mode_enable) { | 368 | if (adapter->dcb_cfg.pfc_mode_enable) { |
371 | if ((adapter->hw.mac.type != ixgbe_mac_82598EB) && | 369 | if ((adapter->hw.mac.type != ixgbe_mac_82598EB) && |
372 | (adapter->hw.fc.current_mode != ixgbe_fc_pfc)) | 370 | (adapter->hw.fc.current_mode != ixgbe_fc_pfc)) |
diff --git a/drivers/net/ks8851_mll.c b/drivers/net/ks8851_mll.c index c146304d8d6c..c0ceebccaa49 100644 --- a/drivers/net/ks8851_mll.c +++ b/drivers/net/ks8851_mll.c | |||
@@ -854,8 +854,8 @@ static void ks_update_link_status(struct net_device *netdev, struct ks_net *ks) | |||
854 | 854 | ||
855 | static irqreturn_t ks_irq(int irq, void *pw) | 855 | static irqreturn_t ks_irq(int irq, void *pw) |
856 | { | 856 | { |
857 | struct ks_net *ks = pw; | 857 | struct net_device *netdev = pw; |
858 | struct net_device *netdev = ks->netdev; | 858 | struct ks_net *ks = netdev_priv(netdev); |
859 | u16 status; | 859 | u16 status; |
860 | 860 | ||
861 | /*this should be the first in IRQ handler */ | 861 | /*this should be the first in IRQ handler */ |
diff --git a/drivers/net/starfire.c b/drivers/net/starfire.c index 95db60adde41..f9521136a869 100644 --- a/drivers/net/starfire.c +++ b/drivers/net/starfire.c | |||
@@ -1063,7 +1063,7 @@ static int netdev_open(struct net_device *dev) | |||
1063 | if (retval) { | 1063 | if (retval) { |
1064 | printk(KERN_ERR "starfire: Failed to load firmware \"%s\"\n", | 1064 | printk(KERN_ERR "starfire: Failed to load firmware \"%s\"\n", |
1065 | FIRMWARE_RX); | 1065 | FIRMWARE_RX); |
1066 | return retval; | 1066 | goto out_init; |
1067 | } | 1067 | } |
1068 | if (fw_rx->size % 4) { | 1068 | if (fw_rx->size % 4) { |
1069 | printk(KERN_ERR "starfire: bogus length %zu in \"%s\"\n", | 1069 | printk(KERN_ERR "starfire: bogus length %zu in \"%s\"\n", |
@@ -1108,6 +1108,9 @@ out_tx: | |||
1108 | release_firmware(fw_tx); | 1108 | release_firmware(fw_tx); |
1109 | out_rx: | 1109 | out_rx: |
1110 | release_firmware(fw_rx); | 1110 | release_firmware(fw_rx); |
1111 | out_init: | ||
1112 | if (retval) | ||
1113 | netdev_close(dev); | ||
1111 | return retval; | 1114 | return retval; |
1112 | } | 1115 | } |
1113 | 1116 | ||
diff --git a/drivers/net/usb/cdc_ether.c b/drivers/net/usb/cdc_ether.c index 21e183a83b99..4f27f022fbf7 100644 --- a/drivers/net/usb/cdc_ether.c +++ b/drivers/net/usb/cdc_ether.c | |||
@@ -419,7 +419,7 @@ static int cdc_manage_power(struct usbnet *dev, int on) | |||
419 | 419 | ||
420 | static const struct driver_info cdc_info = { | 420 | static const struct driver_info cdc_info = { |
421 | .description = "CDC Ethernet Device", | 421 | .description = "CDC Ethernet Device", |
422 | .flags = FLAG_ETHER | FLAG_LINK_INTR, | 422 | .flags = FLAG_ETHER, |
423 | // .check_connect = cdc_check_connect, | 423 | // .check_connect = cdc_check_connect, |
424 | .bind = cdc_bind, | 424 | .bind = cdc_bind, |
425 | .unbind = usbnet_cdc_unbind, | 425 | .unbind = usbnet_cdc_unbind, |
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c index 2ec61f08cfdb..ae371448b5a0 100644 --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c | |||
@@ -855,12 +855,11 @@ static void ath9k_hw_init_mode_gain_regs(struct ath_hw *ah) | |||
855 | } | 855 | } |
856 | } | 856 | } |
857 | 857 | ||
858 | static void ath9k_hw_init_11a_eeprom_fix(struct ath_hw *ah) | 858 | static void ath9k_hw_init_eeprom_fix(struct ath_hw *ah) |
859 | { | 859 | { |
860 | u32 i, j; | 860 | u32 i, j; |
861 | 861 | ||
862 | if ((ah->hw_version.devid == AR9280_DEVID_PCI) && | 862 | if (ah->hw_version.devid == AR9280_DEVID_PCI) { |
863 | test_bit(ATH9K_MODE_11A, ah->caps.wireless_modes)) { | ||
864 | 863 | ||
865 | /* EEPROM Fixup */ | 864 | /* EEPROM Fixup */ |
866 | for (i = 0; i < ah->iniModes.ia_rows; i++) { | 865 | for (i = 0; i < ah->iniModes.ia_rows; i++) { |
@@ -980,7 +979,7 @@ int ath9k_hw_init(struct ath_hw *ah) | |||
980 | if (r) | 979 | if (r) |
981 | return r; | 980 | return r; |
982 | 981 | ||
983 | ath9k_hw_init_11a_eeprom_fix(ah); | 982 | ath9k_hw_init_eeprom_fix(ah); |
984 | 983 | ||
985 | r = ath9k_hw_init_macaddr(ah); | 984 | r = ath9k_hw_init_macaddr(ah); |
986 | if (r) { | 985 | if (r) { |
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c index 996eb90263cc..643bea35686f 100644 --- a/drivers/net/wireless/ath/ath9k/main.c +++ b/drivers/net/wireless/ath/ath9k/main.c | |||
@@ -2655,10 +2655,10 @@ static void ath9k_remove_interface(struct ieee80211_hw *hw, | |||
2655 | (sc->sc_ah->opmode == NL80211_IFTYPE_MESH_POINT)) { | 2655 | (sc->sc_ah->opmode == NL80211_IFTYPE_MESH_POINT)) { |
2656 | ath9k_ps_wakeup(sc); | 2656 | ath9k_ps_wakeup(sc); |
2657 | ath9k_hw_stoptxdma(sc->sc_ah, sc->beacon.beaconq); | 2657 | ath9k_hw_stoptxdma(sc->sc_ah, sc->beacon.beaconq); |
2658 | ath_beacon_return(sc, avp); | ||
2659 | ath9k_ps_restore(sc); | 2658 | ath9k_ps_restore(sc); |
2660 | } | 2659 | } |
2661 | 2660 | ||
2661 | ath_beacon_return(sc, avp); | ||
2662 | sc->sc_flags &= ~SC_OP_BEACONS; | 2662 | sc->sc_flags &= ~SC_OP_BEACONS; |
2663 | 2663 | ||
2664 | for (i = 0; i < ARRAY_SIZE(sc->beacon.bslot); i++) { | 2664 | for (i = 0; i < ARRAY_SIZE(sc->beacon.bslot); i++) { |
diff --git a/drivers/net/wireless/iwlwifi/iwl-sta.c b/drivers/net/wireless/iwlwifi/iwl-sta.c index cde09a890b73..90fbdb25399e 100644 --- a/drivers/net/wireless/iwlwifi/iwl-sta.c +++ b/drivers/net/wireless/iwlwifi/iwl-sta.c | |||
@@ -297,7 +297,7 @@ u8 iwl_add_station(struct iwl_priv *priv, const u8 *addr, bool is_ap, u8 flags, | |||
297 | } | 297 | } |
298 | EXPORT_SYMBOL(iwl_add_station); | 298 | EXPORT_SYMBOL(iwl_add_station); |
299 | 299 | ||
300 | static void iwl_sta_ucode_deactivate(struct iwl_priv *priv, const char *addr) | 300 | static void iwl_sta_ucode_deactivate(struct iwl_priv *priv, const u8 *addr) |
301 | { | 301 | { |
302 | unsigned long flags; | 302 | unsigned long flags; |
303 | u8 sta_id = iwl_find_station(priv, addr); | 303 | u8 sta_id = iwl_find_station(priv, addr); |
@@ -324,7 +324,7 @@ static void iwl_remove_sta_callback(struct iwl_priv *priv, | |||
324 | { | 324 | { |
325 | struct iwl_rem_sta_cmd *rm_sta = | 325 | struct iwl_rem_sta_cmd *rm_sta = |
326 | (struct iwl_rem_sta_cmd *)cmd->cmd.payload; | 326 | (struct iwl_rem_sta_cmd *)cmd->cmd.payload; |
327 | const char *addr = rm_sta->addr; | 327 | const u8 *addr = rm_sta->addr; |
328 | 328 | ||
329 | if (pkt->hdr.flags & IWL_CMD_FAILED_MSK) { | 329 | if (pkt->hdr.flags & IWL_CMD_FAILED_MSK) { |
330 | IWL_ERR(priv, "Bad return from REPLY_REMOVE_STA (0x%08X)\n", | 330 | IWL_ERR(priv, "Bad return from REPLY_REMOVE_STA (0x%08X)\n", |
diff --git a/drivers/rtc/rtc-fm3130.c b/drivers/rtc/rtc-fm3130.c index 3a7be11cc6b9..812c66755083 100644 --- a/drivers/rtc/rtc-fm3130.c +++ b/drivers/rtc/rtc-fm3130.c | |||
@@ -376,20 +376,22 @@ static int __devinit fm3130_probe(struct i2c_client *client, | |||
376 | } | 376 | } |
377 | 377 | ||
378 | /* Disabling calibration mode */ | 378 | /* Disabling calibration mode */ |
379 | if (fm3130->regs[FM3130_RTC_CONTROL] & FM3130_RTC_CONTROL_BIT_CAL) | 379 | if (fm3130->regs[FM3130_RTC_CONTROL] & FM3130_RTC_CONTROL_BIT_CAL) { |
380 | i2c_smbus_write_byte_data(client, FM3130_RTC_CONTROL, | 380 | i2c_smbus_write_byte_data(client, FM3130_RTC_CONTROL, |
381 | fm3130->regs[FM3130_RTC_CONTROL] & | 381 | fm3130->regs[FM3130_RTC_CONTROL] & |
382 | ~(FM3130_RTC_CONTROL_BIT_CAL)); | 382 | ~(FM3130_RTC_CONTROL_BIT_CAL)); |
383 | dev_warn(&client->dev, "Disabling calibration mode!\n"); | 383 | dev_warn(&client->dev, "Disabling calibration mode!\n"); |
384 | } | ||
384 | 385 | ||
385 | /* Disabling read and write modes */ | 386 | /* Disabling read and write modes */ |
386 | if (fm3130->regs[FM3130_RTC_CONTROL] & FM3130_RTC_CONTROL_BIT_WRITE || | 387 | if (fm3130->regs[FM3130_RTC_CONTROL] & FM3130_RTC_CONTROL_BIT_WRITE || |
387 | fm3130->regs[FM3130_RTC_CONTROL] & FM3130_RTC_CONTROL_BIT_READ) | 388 | fm3130->regs[FM3130_RTC_CONTROL] & FM3130_RTC_CONTROL_BIT_READ) { |
388 | i2c_smbus_write_byte_data(client, FM3130_RTC_CONTROL, | 389 | i2c_smbus_write_byte_data(client, FM3130_RTC_CONTROL, |
389 | fm3130->regs[FM3130_RTC_CONTROL] & | 390 | fm3130->regs[FM3130_RTC_CONTROL] & |
390 | ~(FM3130_RTC_CONTROL_BIT_READ | | 391 | ~(FM3130_RTC_CONTROL_BIT_READ | |
391 | FM3130_RTC_CONTROL_BIT_WRITE)); | 392 | FM3130_RTC_CONTROL_BIT_WRITE)); |
392 | dev_warn(&client->dev, "Disabling READ or WRITE mode!\n"); | 393 | dev_warn(&client->dev, "Disabling READ or WRITE mode!\n"); |
394 | } | ||
393 | 395 | ||
394 | /* oscillator off? turn it on, so clock can tick. */ | 396 | /* oscillator off? turn it on, so clock can tick. */ |
395 | if (fm3130->regs[FM3130_CAL_CONTROL] & FM3130_CAL_CONTROL_BIT_nOSCEN) | 397 | if (fm3130->regs[FM3130_CAL_CONTROL] & FM3130_CAL_CONTROL_BIT_nOSCEN) |
diff --git a/drivers/serial/uartlite.c b/drivers/serial/uartlite.c index 377f2712289e..ab2ab3c81834 100644 --- a/drivers/serial/uartlite.c +++ b/drivers/serial/uartlite.c | |||
@@ -394,7 +394,7 @@ static void ulite_console_write(struct console *co, const char *s, | |||
394 | spin_unlock_irqrestore(&port->lock, flags); | 394 | spin_unlock_irqrestore(&port->lock, flags); |
395 | } | 395 | } |
396 | 396 | ||
397 | static int __init ulite_console_setup(struct console *co, char *options) | 397 | static int __devinit ulite_console_setup(struct console *co, char *options) |
398 | { | 398 | { |
399 | struct uart_port *port; | 399 | struct uart_port *port; |
400 | int baud = 9600; | 400 | int baud = 9600; |
diff --git a/drivers/video/imxfb.c b/drivers/video/imxfb.c index 66358fa825f3..b4b6deceed15 100644 --- a/drivers/video/imxfb.c +++ b/drivers/video/imxfb.c | |||
@@ -593,7 +593,8 @@ static int imxfb_activate_var(struct fb_var_screeninfo *var, struct fb_info *inf | |||
593 | */ | 593 | */ |
594 | static int imxfb_suspend(struct platform_device *dev, pm_message_t state) | 594 | static int imxfb_suspend(struct platform_device *dev, pm_message_t state) |
595 | { | 595 | { |
596 | struct imxfb_info *fbi = platform_get_drvdata(dev); | 596 | struct fb_info *info = platform_get_drvdata(dev); |
597 | struct imxfb_info *fbi = info->par; | ||
597 | 598 | ||
598 | pr_debug("%s\n", __func__); | 599 | pr_debug("%s\n", __func__); |
599 | 600 | ||
@@ -603,7 +604,8 @@ static int imxfb_suspend(struct platform_device *dev, pm_message_t state) | |||
603 | 604 | ||
604 | static int imxfb_resume(struct platform_device *dev) | 605 | static int imxfb_resume(struct platform_device *dev) |
605 | { | 606 | { |
606 | struct imxfb_info *fbi = platform_get_drvdata(dev); | 607 | struct fb_info *info = platform_get_drvdata(dev); |
608 | struct imxfb_info *fbi = info->par; | ||
607 | 609 | ||
608 | pr_debug("%s\n", __func__); | 610 | pr_debug("%s\n", __func__); |
609 | 611 | ||
diff --git a/drivers/video/mx3fb.c b/drivers/video/mx3fb.c index 054ef29be479..772ba3f45e6f 100644 --- a/drivers/video/mx3fb.c +++ b/drivers/video/mx3fb.c | |||
@@ -324,8 +324,11 @@ static void sdc_enable_channel(struct mx3fb_info *mx3_fbi) | |||
324 | unsigned long flags; | 324 | unsigned long flags; |
325 | dma_cookie_t cookie; | 325 | dma_cookie_t cookie; |
326 | 326 | ||
327 | dev_dbg(mx3fb->dev, "mx3fbi %p, desc %p, sg %p\n", mx3_fbi, | 327 | if (mx3_fbi->txd) |
328 | to_tx_desc(mx3_fbi->txd), to_tx_desc(mx3_fbi->txd)->sg); | 328 | dev_dbg(mx3fb->dev, "mx3fbi %p, desc %p, sg %p\n", mx3_fbi, |
329 | to_tx_desc(mx3_fbi->txd), to_tx_desc(mx3_fbi->txd)->sg); | ||
330 | else | ||
331 | dev_dbg(mx3fb->dev, "mx3fbi %p, txd = NULL\n", mx3_fbi); | ||
329 | 332 | ||
330 | /* This enables the channel */ | 333 | /* This enables the channel */ |
331 | if (mx3_fbi->cookie < 0) { | 334 | if (mx3_fbi->cookie < 0) { |
@@ -646,6 +649,7 @@ static int sdc_set_global_alpha(struct mx3fb_data *mx3fb, bool enable, uint8_t a | |||
646 | 649 | ||
647 | static void sdc_set_brightness(struct mx3fb_data *mx3fb, uint8_t value) | 650 | static void sdc_set_brightness(struct mx3fb_data *mx3fb, uint8_t value) |
648 | { | 651 | { |
652 | dev_dbg(mx3fb->dev, "%s: value = %d\n", __func__, value); | ||
649 | /* This might be board-specific */ | 653 | /* This might be board-specific */ |
650 | mx3fb_write_reg(mx3fb, 0x03000000UL | value << 16, SDC_PWM_CTRL); | 654 | mx3fb_write_reg(mx3fb, 0x03000000UL | value << 16, SDC_PWM_CTRL); |
651 | return; | 655 | return; |
@@ -1486,12 +1490,12 @@ static int mx3fb_probe(struct platform_device *pdev) | |||
1486 | goto ersdc0; | 1490 | goto ersdc0; |
1487 | } | 1491 | } |
1488 | 1492 | ||
1493 | mx3fb->backlight_level = 255; | ||
1494 | |||
1489 | ret = init_fb_chan(mx3fb, to_idmac_chan(chan)); | 1495 | ret = init_fb_chan(mx3fb, to_idmac_chan(chan)); |
1490 | if (ret < 0) | 1496 | if (ret < 0) |
1491 | goto eisdc0; | 1497 | goto eisdc0; |
1492 | 1498 | ||
1493 | mx3fb->backlight_level = 255; | ||
1494 | |||
1495 | return 0; | 1499 | return 0; |
1496 | 1500 | ||
1497 | eisdc0: | 1501 | eisdc0: |
diff --git a/fs/fuse/file.c b/fs/fuse/file.c index c18913a777ae..a9f5e137f1d3 100644 --- a/fs/fuse/file.c +++ b/fs/fuse/file.c | |||
@@ -828,6 +828,9 @@ static ssize_t fuse_fill_write_pages(struct fuse_req *req, | |||
828 | if (!page) | 828 | if (!page) |
829 | break; | 829 | break; |
830 | 830 | ||
831 | if (mapping_writably_mapped(mapping)) | ||
832 | flush_dcache_page(page); | ||
833 | |||
831 | pagefault_disable(); | 834 | pagefault_disable(); |
832 | tmp = iov_iter_copy_from_user_atomic(page, ii, offset, bytes); | 835 | tmp = iov_iter_copy_from_user_atomic(page, ii, offset, bytes); |
833 | pagefault_enable(); | 836 | pagefault_enable(); |
diff --git a/include/linux/connector.h b/include/linux/connector.h index 72ba63eb83c5..3a779ffba60b 100644 --- a/include/linux/connector.h +++ b/include/linux/connector.h | |||
@@ -24,9 +24,6 @@ | |||
24 | 24 | ||
25 | #include <linux/types.h> | 25 | #include <linux/types.h> |
26 | 26 | ||
27 | #define CN_IDX_CONNECTOR 0xffffffff | ||
28 | #define CN_VAL_CONNECTOR 0xffffffff | ||
29 | |||
30 | /* | 27 | /* |
31 | * Process Events connector unique ids -- used for message routing | 28 | * Process Events connector unique ids -- used for message routing |
32 | */ | 29 | */ |
@@ -75,30 +72,6 @@ struct cn_msg { | |||
75 | __u8 data[0]; | 72 | __u8 data[0]; |
76 | }; | 73 | }; |
77 | 74 | ||
78 | /* | ||
79 | * Notify structure - requests notification about | ||
80 | * registering/unregistering idx/val in range [first, first+range]. | ||
81 | */ | ||
82 | struct cn_notify_req { | ||
83 | __u32 first; | ||
84 | __u32 range; | ||
85 | }; | ||
86 | |||
87 | /* | ||
88 | * Main notification control message | ||
89 | * *_notify_num - number of appropriate cn_notify_req structures after | ||
90 | * this struct. | ||
91 | * group - notification receiver's idx. | ||
92 | * len - total length of the attached data. | ||
93 | */ | ||
94 | struct cn_ctl_msg { | ||
95 | __u32 idx_notify_num; | ||
96 | __u32 val_notify_num; | ||
97 | __u32 group; | ||
98 | __u32 len; | ||
99 | __u8 data[0]; | ||
100 | }; | ||
101 | |||
102 | #ifdef __KERNEL__ | 75 | #ifdef __KERNEL__ |
103 | 76 | ||
104 | #include <asm/atomic.h> | 77 | #include <asm/atomic.h> |
@@ -151,11 +124,6 @@ struct cn_callback_entry { | |||
151 | u32 seq, group; | 124 | u32 seq, group; |
152 | }; | 125 | }; |
153 | 126 | ||
154 | struct cn_ctl_entry { | ||
155 | struct list_head notify_entry; | ||
156 | struct cn_ctl_msg *msg; | ||
157 | }; | ||
158 | |||
159 | struct cn_dev { | 127 | struct cn_dev { |
160 | struct cb_id id; | 128 | struct cb_id id; |
161 | 129 | ||
diff --git a/include/linux/hid.h b/include/linux/hid.h index b978c1e2e74d..b1344ec4b7fc 100644 --- a/include/linux/hid.h +++ b/include/linux/hid.h | |||
@@ -501,7 +501,7 @@ struct hid_device { /* device report descriptor */ | |||
501 | void (*hiddev_report_event) (struct hid_device *, struct hid_report *); | 501 | void (*hiddev_report_event) (struct hid_device *, struct hid_report *); |
502 | 502 | ||
503 | /* handler for raw output data, used by hidraw */ | 503 | /* handler for raw output data, used by hidraw */ |
504 | int (*hid_output_raw_report) (struct hid_device *, __u8 *, size_t); | 504 | int (*hid_output_raw_report) (struct hid_device *, __u8 *, size_t, unsigned char); |
505 | 505 | ||
506 | /* debugging support via debugfs */ | 506 | /* debugging support via debugfs */ |
507 | unsigned short debug; | 507 | unsigned short debug; |
@@ -690,6 +690,7 @@ int hid_input_report(struct hid_device *, int type, u8 *, int, int); | |||
690 | int hidinput_find_field(struct hid_device *hid, unsigned int type, unsigned int code, struct hid_field **field); | 690 | int hidinput_find_field(struct hid_device *hid, unsigned int type, unsigned int code, struct hid_field **field); |
691 | void hid_output_report(struct hid_report *report, __u8 *data); | 691 | void hid_output_report(struct hid_report *report, __u8 *data); |
692 | struct hid_device *hid_allocate_device(void); | 692 | struct hid_device *hid_allocate_device(void); |
693 | struct hid_report *hid_register_report(struct hid_device *device, unsigned type, unsigned id); | ||
693 | int hid_parse_report(struct hid_device *hid, __u8 *start, unsigned size); | 694 | int hid_parse_report(struct hid_device *hid, __u8 *start, unsigned size); |
694 | int hid_check_keys_pressed(struct hid_device *hid); | 695 | int hid_check_keys_pressed(struct hid_device *hid); |
695 | int hid_connect(struct hid_device *hid, unsigned int connect_mask); | 696 | int hid_connect(struct hid_device *hid, unsigned int connect_mask); |
diff --git a/kernel/cgroup.c b/kernel/cgroup.c index 1fbcc748044a..aa3bee566446 100644 --- a/kernel/cgroup.c +++ b/kernel/cgroup.c | |||
@@ -2936,14 +2936,17 @@ static long cgroup_create(struct cgroup *parent, struct dentry *dentry, | |||
2936 | 2936 | ||
2937 | for_each_subsys(root, ss) { | 2937 | for_each_subsys(root, ss) { |
2938 | struct cgroup_subsys_state *css = ss->create(ss, cgrp); | 2938 | struct cgroup_subsys_state *css = ss->create(ss, cgrp); |
2939 | |||
2939 | if (IS_ERR(css)) { | 2940 | if (IS_ERR(css)) { |
2940 | err = PTR_ERR(css); | 2941 | err = PTR_ERR(css); |
2941 | goto err_destroy; | 2942 | goto err_destroy; |
2942 | } | 2943 | } |
2943 | init_cgroup_css(css, ss, cgrp); | 2944 | init_cgroup_css(css, ss, cgrp); |
2944 | if (ss->use_id) | 2945 | if (ss->use_id) { |
2945 | if (alloc_css_id(ss, parent, cgrp)) | 2946 | err = alloc_css_id(ss, parent, cgrp); |
2947 | if (err) | ||
2946 | goto err_destroy; | 2948 | goto err_destroy; |
2949 | } | ||
2947 | /* At error, ->destroy() callback has to free assigned ID. */ | 2950 | /* At error, ->destroy() callback has to free assigned ID. */ |
2948 | } | 2951 | } |
2949 | 2952 | ||
diff --git a/kernel/cred.c b/kernel/cred.c index dd76cfe5f5b0..1ed8ca18790c 100644 --- a/kernel/cred.c +++ b/kernel/cred.c | |||
@@ -224,7 +224,7 @@ struct cred *cred_alloc_blank(void) | |||
224 | #ifdef CONFIG_KEYS | 224 | #ifdef CONFIG_KEYS |
225 | new->tgcred = kzalloc(sizeof(*new->tgcred), GFP_KERNEL); | 225 | new->tgcred = kzalloc(sizeof(*new->tgcred), GFP_KERNEL); |
226 | if (!new->tgcred) { | 226 | if (!new->tgcred) { |
227 | kfree(new); | 227 | kmem_cache_free(cred_jar, new); |
228 | return NULL; | 228 | return NULL; |
229 | } | 229 | } |
230 | atomic_set(&new->tgcred->usage, 1); | 230 | atomic_set(&new->tgcred->usage, 1); |
diff --git a/kernel/kfifo.c b/kernel/kfifo.c index 32c5c15d750d..498cabba225e 100644 --- a/kernel/kfifo.c +++ b/kernel/kfifo.c | |||
@@ -349,6 +349,7 @@ EXPORT_SYMBOL(__kfifo_from_user_n); | |||
349 | * @fifo: the fifo to be used. | 349 | * @fifo: the fifo to be used. |
350 | * @from: pointer to the data to be added. | 350 | * @from: pointer to the data to be added. |
351 | * @len: the length of the data to be added. | 351 | * @len: the length of the data to be added. |
352 | * @total: the actual returned data length. | ||
352 | * | 353 | * |
353 | * This function copies at most @len bytes from the @from into the | 354 | * This function copies at most @len bytes from the @from into the |
354 | * FIFO depending and returns -EFAULT/0. | 355 | * FIFO depending and returns -EFAULT/0. |
@@ -399,7 +400,7 @@ EXPORT_SYMBOL(__kfifo_to_user_n); | |||
399 | * @fifo: the fifo to be used. | 400 | * @fifo: the fifo to be used. |
400 | * @to: where the data must be copied. | 401 | * @to: where the data must be copied. |
401 | * @len: the size of the destination buffer. | 402 | * @len: the size of the destination buffer. |
402 | @ @lenout: pointer to output variable with copied data | 403 | * @lenout: pointer to output variable with copied data |
403 | * | 404 | * |
404 | * This function copies at most @len bytes from the FIFO into the | 405 | * This function copies at most @len bytes from the FIFO into the |
405 | * @to buffer and 0 or -EFAULT. | 406 | * @to buffer and 0 or -EFAULT. |
@@ -140,8 +140,7 @@ static int sub_alloc(struct idr *idp, int *starting_id, struct idr_layer **pa) | |||
140 | id = *starting_id; | 140 | id = *starting_id; |
141 | restart: | 141 | restart: |
142 | p = idp->top; | 142 | p = idp->top; |
143 | l = idp->layers; | 143 | l = p->layer; |
144 | pa[l--] = NULL; | ||
145 | while (1) { | 144 | while (1) { |
146 | /* | 145 | /* |
147 | * We run around this while until we reach the leaf node... | 146 | * We run around this while until we reach the leaf node... |
@@ -155,8 +154,8 @@ static int sub_alloc(struct idr *idp, int *starting_id, struct idr_layer **pa) | |||
155 | oid = id; | 154 | oid = id; |
156 | id = (id | ((1 << (IDR_BITS * l)) - 1)) + 1; | 155 | id = (id | ((1 << (IDR_BITS * l)) - 1)) + 1; |
157 | 156 | ||
158 | /* if already at the top layer, we need to grow */ | 157 | /* did id go over the limit? */ |
159 | if (!(p = pa[l])) { | 158 | if (id >= (1 << (idp->layers * IDR_BITS))) { |
160 | *starting_id = id; | 159 | *starting_id = id; |
161 | return IDR_NEED_TO_GROW; | 160 | return IDR_NEED_TO_GROW; |
162 | } | 161 | } |
diff --git a/mm/filemap.c b/mm/filemap.c index e3736923220e..698ea80f2102 100644 --- a/mm/filemap.c +++ b/mm/filemap.c | |||
@@ -2232,6 +2232,9 @@ again: | |||
2232 | if (unlikely(status)) | 2232 | if (unlikely(status)) |
2233 | break; | 2233 | break; |
2234 | 2234 | ||
2235 | if (mapping_writably_mapped(mapping)) | ||
2236 | flush_dcache_page(page); | ||
2237 | |||
2235 | pagefault_disable(); | 2238 | pagefault_disable(); |
2236 | copied = iov_iter_copy_from_user_atomic(page, i, offset, bytes); | 2239 | copied = iov_iter_copy_from_user_atomic(page, i, offset, bytes); |
2237 | pagefault_enable(); | 2240 | pagefault_enable(); |
diff --git a/mm/hugetlb.c b/mm/hugetlb.c index e91b81b63670..2d16fa6b8c2d 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c | |||
@@ -1515,10 +1515,9 @@ static struct attribute_group hstate_attr_group = { | |||
1515 | .attrs = hstate_attrs, | 1515 | .attrs = hstate_attrs, |
1516 | }; | 1516 | }; |
1517 | 1517 | ||
1518 | static int __init hugetlb_sysfs_add_hstate(struct hstate *h, | 1518 | static int hugetlb_sysfs_add_hstate(struct hstate *h, struct kobject *parent, |
1519 | struct kobject *parent, | 1519 | struct kobject **hstate_kobjs, |
1520 | struct kobject **hstate_kobjs, | 1520 | struct attribute_group *hstate_attr_group) |
1521 | struct attribute_group *hstate_attr_group) | ||
1522 | { | 1521 | { |
1523 | int retval; | 1522 | int retval; |
1524 | int hi = h - hstates; | 1523 | int hi = h - hstates; |
diff --git a/net/bluetooth/hidp/core.c b/net/bluetooth/hidp/core.c index 18e7f5a43dc4..37ba153c4cd4 100644 --- a/net/bluetooth/hidp/core.c +++ b/net/bluetooth/hidp/core.c | |||
@@ -243,6 +243,39 @@ static void hidp_input_report(struct hidp_session *session, struct sk_buff *skb) | |||
243 | input_sync(dev); | 243 | input_sync(dev); |
244 | } | 244 | } |
245 | 245 | ||
246 | static int __hidp_send_ctrl_message(struct hidp_session *session, | ||
247 | unsigned char hdr, unsigned char *data, int size) | ||
248 | { | ||
249 | struct sk_buff *skb; | ||
250 | |||
251 | BT_DBG("session %p data %p size %d", session, data, size); | ||
252 | |||
253 | if (!(skb = alloc_skb(size + 1, GFP_ATOMIC))) { | ||
254 | BT_ERR("Can't allocate memory for new frame"); | ||
255 | return -ENOMEM; | ||
256 | } | ||
257 | |||
258 | *skb_put(skb, 1) = hdr; | ||
259 | if (data && size > 0) | ||
260 | memcpy(skb_put(skb, size), data, size); | ||
261 | |||
262 | skb_queue_tail(&session->ctrl_transmit, skb); | ||
263 | |||
264 | return 0; | ||
265 | } | ||
266 | |||
267 | static inline int hidp_send_ctrl_message(struct hidp_session *session, | ||
268 | unsigned char hdr, unsigned char *data, int size) | ||
269 | { | ||
270 | int err; | ||
271 | |||
272 | err = __hidp_send_ctrl_message(session, hdr, data, size); | ||
273 | |||
274 | hidp_schedule(session); | ||
275 | |||
276 | return err; | ||
277 | } | ||
278 | |||
246 | static int hidp_queue_report(struct hidp_session *session, | 279 | static int hidp_queue_report(struct hidp_session *session, |
247 | unsigned char *data, int size) | 280 | unsigned char *data, int size) |
248 | { | 281 | { |
@@ -280,9 +313,22 @@ static int hidp_send_report(struct hidp_session *session, struct hid_report *rep | |||
280 | return hidp_queue_report(session, buf, rsize); | 313 | return hidp_queue_report(session, buf, rsize); |
281 | } | 314 | } |
282 | 315 | ||
283 | static int hidp_output_raw_report(struct hid_device *hid, unsigned char *data, size_t count) | 316 | static int hidp_output_raw_report(struct hid_device *hid, unsigned char *data, size_t count, |
317 | unsigned char report_type) | ||
284 | { | 318 | { |
285 | if (hidp_queue_report(hid->driver_data, data, count)) | 319 | switch (report_type) { |
320 | case HID_FEATURE_REPORT: | ||
321 | report_type = HIDP_TRANS_SET_REPORT | HIDP_DATA_RTYPE_FEATURE; | ||
322 | break; | ||
323 | case HID_OUTPUT_REPORT: | ||
324 | report_type = HIDP_TRANS_DATA | HIDP_DATA_RTYPE_OUPUT; | ||
325 | break; | ||
326 | default: | ||
327 | return -EINVAL; | ||
328 | } | ||
329 | |||
330 | if (hidp_send_ctrl_message(hid->driver_data, report_type, | ||
331 | data, count)) | ||
286 | return -ENOMEM; | 332 | return -ENOMEM; |
287 | return count; | 333 | return count; |
288 | } | 334 | } |
@@ -307,39 +353,6 @@ static inline void hidp_del_timer(struct hidp_session *session) | |||
307 | del_timer(&session->timer); | 353 | del_timer(&session->timer); |
308 | } | 354 | } |
309 | 355 | ||
310 | static int __hidp_send_ctrl_message(struct hidp_session *session, | ||
311 | unsigned char hdr, unsigned char *data, int size) | ||
312 | { | ||
313 | struct sk_buff *skb; | ||
314 | |||
315 | BT_DBG("session %p data %p size %d", session, data, size); | ||
316 | |||
317 | if (!(skb = alloc_skb(size + 1, GFP_ATOMIC))) { | ||
318 | BT_ERR("Can't allocate memory for new frame"); | ||
319 | return -ENOMEM; | ||
320 | } | ||
321 | |||
322 | *skb_put(skb, 1) = hdr; | ||
323 | if (data && size > 0) | ||
324 | memcpy(skb_put(skb, size), data, size); | ||
325 | |||
326 | skb_queue_tail(&session->ctrl_transmit, skb); | ||
327 | |||
328 | return 0; | ||
329 | } | ||
330 | |||
331 | static inline int hidp_send_ctrl_message(struct hidp_session *session, | ||
332 | unsigned char hdr, unsigned char *data, int size) | ||
333 | { | ||
334 | int err; | ||
335 | |||
336 | err = __hidp_send_ctrl_message(session, hdr, data, size); | ||
337 | |||
338 | hidp_schedule(session); | ||
339 | |||
340 | return err; | ||
341 | } | ||
342 | |||
343 | static void hidp_process_handshake(struct hidp_session *session, | 356 | static void hidp_process_handshake(struct hidp_session *session, |
344 | unsigned char param) | 357 | unsigned char param) |
345 | { | 358 | { |
diff --git a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c index 1120cf14a548..400efa26ddba 100644 --- a/net/bluetooth/l2cap.c +++ b/net/bluetooth/l2cap.c | |||
@@ -1368,7 +1368,6 @@ static int l2cap_ertm_send(struct sock *sk) | |||
1368 | 1368 | ||
1369 | while ((skb = sk->sk_send_head) && (!l2cap_tx_window_full(sk)) && | 1369 | while ((skb = sk->sk_send_head) && (!l2cap_tx_window_full(sk)) && |
1370 | !(pi->conn_state & L2CAP_CONN_REMOTE_BUSY)) { | 1370 | !(pi->conn_state & L2CAP_CONN_REMOTE_BUSY)) { |
1371 | tx_skb = skb_clone(skb, GFP_ATOMIC); | ||
1372 | 1371 | ||
1373 | if (pi->remote_max_tx && | 1372 | if (pi->remote_max_tx && |
1374 | bt_cb(skb)->retries == pi->remote_max_tx) { | 1373 | bt_cb(skb)->retries == pi->remote_max_tx) { |
@@ -1376,6 +1375,8 @@ static int l2cap_ertm_send(struct sock *sk) | |||
1376 | break; | 1375 | break; |
1377 | } | 1376 | } |
1378 | 1377 | ||
1378 | tx_skb = skb_clone(skb, GFP_ATOMIC); | ||
1379 | |||
1379 | bt_cb(skb)->retries++; | 1380 | bt_cb(skb)->retries++; |
1380 | 1381 | ||
1381 | control = get_unaligned_le16(tx_skb->data + L2CAP_HDR_SIZE); | 1382 | control = get_unaligned_le16(tx_skb->data + L2CAP_HDR_SIZE); |
@@ -3518,7 +3519,6 @@ static inline int l2cap_data_channel(struct l2cap_conn *conn, u16 cid, struct sk | |||
3518 | struct l2cap_pinfo *pi; | 3519 | struct l2cap_pinfo *pi; |
3519 | u16 control, len; | 3520 | u16 control, len; |
3520 | u8 tx_seq; | 3521 | u8 tx_seq; |
3521 | int err; | ||
3522 | 3522 | ||
3523 | sk = l2cap_get_chan_by_scid(&conn->chan_list, cid); | 3523 | sk = l2cap_get_chan_by_scid(&conn->chan_list, cid); |
3524 | if (!sk) { | 3524 | if (!sk) { |
@@ -3570,13 +3570,11 @@ static inline int l2cap_data_channel(struct l2cap_conn *conn, u16 cid, struct sk | |||
3570 | goto drop; | 3570 | goto drop; |
3571 | 3571 | ||
3572 | if (__is_iframe(control)) | 3572 | if (__is_iframe(control)) |
3573 | err = l2cap_data_channel_iframe(sk, control, skb); | 3573 | l2cap_data_channel_iframe(sk, control, skb); |
3574 | else | 3574 | else |
3575 | err = l2cap_data_channel_sframe(sk, control, skb); | 3575 | l2cap_data_channel_sframe(sk, control, skb); |
3576 | 3576 | ||
3577 | if (!err) | 3577 | goto done; |
3578 | goto done; | ||
3579 | break; | ||
3580 | 3578 | ||
3581 | case L2CAP_MODE_STREAMING: | 3579 | case L2CAP_MODE_STREAMING: |
3582 | control = get_unaligned_le16(skb->data); | 3580 | control = get_unaligned_le16(skb->data); |
@@ -3602,7 +3600,7 @@ static inline int l2cap_data_channel(struct l2cap_conn *conn, u16 cid, struct sk | |||
3602 | else | 3600 | else |
3603 | pi->expected_tx_seq = tx_seq + 1; | 3601 | pi->expected_tx_seq = tx_seq + 1; |
3604 | 3602 | ||
3605 | err = l2cap_sar_reassembly_sdu(sk, skb, control); | 3603 | l2cap_sar_reassembly_sdu(sk, skb, control); |
3606 | 3604 | ||
3607 | goto done; | 3605 | goto done; |
3608 | 3606 | ||
diff --git a/net/ipv6/netfilter/nf_conntrack_reasm.c b/net/ipv6/netfilter/nf_conntrack_reasm.c index 312c20adc83f..624a54832a7c 100644 --- a/net/ipv6/netfilter/nf_conntrack_reasm.c +++ b/net/ipv6/netfilter/nf_conntrack_reasm.c | |||
@@ -63,6 +63,7 @@ struct nf_ct_frag6_queue | |||
63 | struct inet_frag_queue q; | 63 | struct inet_frag_queue q; |
64 | 64 | ||
65 | __be32 id; /* fragment id */ | 65 | __be32 id; /* fragment id */ |
66 | u32 user; | ||
66 | struct in6_addr saddr; | 67 | struct in6_addr saddr; |
67 | struct in6_addr daddr; | 68 | struct in6_addr daddr; |
68 | 69 | ||
diff --git a/net/mac80211/driver-trace.h b/net/mac80211/driver-trace.h index ee94ea0c67e9..da8497ef7063 100644 --- a/net/mac80211/driver-trace.h +++ b/net/mac80211/driver-trace.h | |||
@@ -680,7 +680,7 @@ TRACE_EVENT(drv_ampdu_action, | |||
680 | __entry->ret = ret; | 680 | __entry->ret = ret; |
681 | __entry->action = action; | 681 | __entry->action = action; |
682 | __entry->tid = tid; | 682 | __entry->tid = tid; |
683 | __entry->ssn = *ssn; | 683 | __entry->ssn = ssn ? *ssn : 0; |
684 | ), | 684 | ), |
685 | 685 | ||
686 | TP_printk( | 686 | TP_printk( |
diff --git a/net/netfilter/nf_conntrack_netlink.c b/net/netfilter/nf_conntrack_netlink.c index 59d8064eb522..42f21c01a93e 100644 --- a/net/netfilter/nf_conntrack_netlink.c +++ b/net/netfilter/nf_conntrack_netlink.c | |||
@@ -1437,8 +1437,9 @@ ctnetlink_exp_dump_mask(struct sk_buff *skb, | |||
1437 | struct nlattr *nest_parms; | 1437 | struct nlattr *nest_parms; |
1438 | 1438 | ||
1439 | memset(&m, 0xFF, sizeof(m)); | 1439 | memset(&m, 0xFF, sizeof(m)); |
1440 | m.src.u.all = mask->src.u.all; | ||
1441 | memcpy(&m.src.u3, &mask->src.u3, sizeof(m.src.u3)); | 1440 | memcpy(&m.src.u3, &mask->src.u3, sizeof(m.src.u3)); |
1441 | m.src.u.all = mask->src.u.all; | ||
1442 | m.dst.protonum = tuple->dst.protonum; | ||
1442 | 1443 | ||
1443 | nest_parms = nla_nest_start(skb, CTA_EXPECT_MASK | NLA_F_NESTED); | 1444 | nest_parms = nla_nest_start(skb, CTA_EXPECT_MASK | NLA_F_NESTED); |
1444 | if (!nest_parms) | 1445 | if (!nest_parms) |
diff --git a/net/netfilter/nf_conntrack_sip.c b/net/netfilter/nf_conntrack_sip.c index 4b572163784b..023966b569bf 100644 --- a/net/netfilter/nf_conntrack_sip.c +++ b/net/netfilter/nf_conntrack_sip.c | |||
@@ -376,7 +376,7 @@ int ct_sip_get_header(const struct nf_conn *ct, const char *dptr, | |||
376 | dptr += hdr->len; | 376 | dptr += hdr->len; |
377 | else if (hdr->cname && limit - dptr >= hdr->clen + 1 && | 377 | else if (hdr->cname && limit - dptr >= hdr->clen + 1 && |
378 | strnicmp(dptr, hdr->cname, hdr->clen) == 0 && | 378 | strnicmp(dptr, hdr->cname, hdr->clen) == 0 && |
379 | !isalpha(*(dptr + hdr->clen + 1))) | 379 | !isalpha(*(dptr + hdr->clen))) |
380 | dptr += hdr->clen; | 380 | dptr += hdr->clen; |
381 | else | 381 | else |
382 | continue; | 382 | continue; |
diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl index 090f24839700..2f3230db7ffb 100755 --- a/scripts/get_maintainer.pl +++ b/scripts/get_maintainer.pl | |||
@@ -74,8 +74,8 @@ my %VCS_cmds; | |||
74 | my %VCS_cmds_git = ( | 74 | my %VCS_cmds_git = ( |
75 | "execute_cmd" => \&git_execute_cmd, | 75 | "execute_cmd" => \&git_execute_cmd, |
76 | "available" => '(which("git") ne "") && (-d ".git")', | 76 | "available" => '(which("git") ne "") && (-d ".git")', |
77 | "find_signers_cmd" => "git log --since=\$email_git_since -- \$file", | 77 | "find_signers_cmd" => "git log --no-color --since=\$email_git_since -- \$file", |
78 | "find_commit_signers_cmd" => "git log -1 \$commit", | 78 | "find_commit_signers_cmd" => "git log --no-color -1 \$commit", |
79 | "blame_range_cmd" => "git blame -l -L \$diff_start,+\$diff_length \$file", | 79 | "blame_range_cmd" => "git blame -l -L \$diff_start,+\$diff_length \$file", |
80 | "blame_file_cmd" => "git blame -l \$file", | 80 | "blame_file_cmd" => "git blame -l \$file", |
81 | "commit_pattern" => "^commit [0-9a-f]{40,40}", | 81 | "commit_pattern" => "^commit [0-9a-f]{40,40}", |
diff --git a/scripts/markup_oops.pl b/scripts/markup_oops.pl index ce3e40b01e48..e950f9cde019 100644 --- a/scripts/markup_oops.pl +++ b/scripts/markup_oops.pl | |||
@@ -158,7 +158,7 @@ while (<STDIN>) { | |||
158 | $function = $1; | 158 | $function = $1; |
159 | $func_offset = $2; | 159 | $func_offset = $2; |
160 | } | 160 | } |
161 | if ($line =~ /RIP: 0010:\[\<[0-9a-f]+\>\] \[\<[0-9a-f]+\>\] ([a-zA-Z0-9\_]+)\+(0x[0-9a-f]+)\/0x[a-f0-9]/) { | 161 | if ($line =~ /RIP: 0010:\[\<[0-9a-f]+\>\] \[\<[0-9a-f]+\>\] ([a-zA-Z0-9\_]+)\+0x([0-9a-f]+)\/0x[a-f0-9]/) { |
162 | $function = $1; | 162 | $function = $1; |
163 | $func_offset = $2; | 163 | $func_offset = $2; |
164 | } | 164 | } |