diff options
author | Arnd Bergmann <arnd@arndb.de> | 2012-11-12 16:54:08 -0500 |
---|---|---|
committer | Arnd Bergmann <arnd@arndb.de> | 2012-11-12 16:54:08 -0500 |
commit | 8a6ff8a0a2bc51b29681aab093b349c9eb32acf5 (patch) | |
tree | 7ee7315a4aa9b33cba73cf46e59187157a00866a /drivers | |
parent | 65829ef5a0b9bdffa34b35479853d24e547cfde8 (diff) | |
parent | 75984df05d86956541795f01e62d7dc67bc522fd (diff) |
Merge tag 'for-3.8-at91_header_clean' of git://github.com/at91linux/linux-at91 into next/headers
From Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>:
arm: at91: mach header cleanup
This first patch serie start the cleanup of the header in mach
by moving all the platform data to include/linux/platform_data
and move the board header and drivers header next to them
* tag 'for-3.8-at91_header_clean' of git://github.com/at91linux/linux-at91:
arm: at91: move at91rm9200 rtc header in drivers/rtc
arm: at91: move reset controller header to arm/arm/mach-at91
arm: at91: move pit define to the driver
arm: at91: move at91_shdwc.h to arch/arm/mach-at91
arm: at91: move board header to arch/arm/mach-at91
arn: at91: move at91_tc.h to arch/arm/mach-at91
arm: at91 move at91_aic.h to arch/arm/mach-at91
arm: at91 move board.h to arch/arm/mach-at91
arm: at91: move platfarm_data to include/linux/platform_data/atmel.h
arm: at91: drop machine defconfig
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Cc: Nicolas Ferre <nicolas.ferre@atmel.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Diffstat (limited to 'drivers')
200 files changed, 2684 insertions, 2000 deletions
diff --git a/drivers/acpi/glue.c b/drivers/acpi/glue.c index d1a2d74033e9..08373086cd7e 100644 --- a/drivers/acpi/glue.c +++ b/drivers/acpi/glue.c | |||
@@ -159,6 +159,7 @@ static int acpi_bind_one(struct device *dev, acpi_handle handle) | |||
159 | if (physical_node->node_id >= ACPI_MAX_PHYSICAL_NODE) { | 159 | if (physical_node->node_id >= ACPI_MAX_PHYSICAL_NODE) { |
160 | retval = -ENOSPC; | 160 | retval = -ENOSPC; |
161 | mutex_unlock(&acpi_dev->physical_node_lock); | 161 | mutex_unlock(&acpi_dev->physical_node_lock); |
162 | kfree(physical_node); | ||
162 | goto err; | 163 | goto err; |
163 | } | 164 | } |
164 | 165 | ||
diff --git a/drivers/acpi/processor_driver.c b/drivers/acpi/processor_driver.c index e78c2a52ea46..bd4e5dca3ff7 100644 --- a/drivers/acpi/processor_driver.c +++ b/drivers/acpi/processor_driver.c | |||
@@ -409,6 +409,7 @@ static void acpi_processor_notify(struct acpi_device *device, u32 event) | |||
409 | acpi_bus_generate_proc_event(device, event, 0); | 409 | acpi_bus_generate_proc_event(device, event, 0); |
410 | acpi_bus_generate_netlink_event(device->pnp.device_class, | 410 | acpi_bus_generate_netlink_event(device->pnp.device_class, |
411 | dev_name(&device->dev), event, 0); | 411 | dev_name(&device->dev), event, 0); |
412 | break; | ||
412 | default: | 413 | default: |
413 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 414 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
414 | "Unsupported event [0x%x]\n", event)); | 415 | "Unsupported event [0x%x]\n", event)); |
diff --git a/drivers/ata/pata_at91.c b/drivers/ata/pata_at91.c index 53d3770a0b1b..2a96bb2c53ee 100644 --- a/drivers/ata/pata_at91.c +++ b/drivers/ata/pata_at91.c | |||
@@ -27,9 +27,9 @@ | |||
27 | #include <linux/libata.h> | 27 | #include <linux/libata.h> |
28 | #include <linux/platform_device.h> | 28 | #include <linux/platform_device.h> |
29 | #include <linux/ata_platform.h> | 29 | #include <linux/ata_platform.h> |
30 | #include <linux/platform_data/atmel.h> | ||
30 | 31 | ||
31 | #include <mach/at91sam9_smc.h> | 32 | #include <mach/at91sam9_smc.h> |
32 | #include <mach/board.h> | ||
33 | #include <asm/gpio.h> | 33 | #include <asm/gpio.h> |
34 | 34 | ||
35 | #define DRV_NAME "pata_at91" | 35 | #define DRV_NAME "pata_at91" |
diff --git a/drivers/base/Kconfig b/drivers/base/Kconfig index 08b4c5209384..b34b5cda5ae1 100644 --- a/drivers/base/Kconfig +++ b/drivers/base/Kconfig | |||
@@ -236,7 +236,7 @@ config CMA_SIZE_PERCENTAGE | |||
236 | 236 | ||
237 | choice | 237 | choice |
238 | prompt "Selected region size" | 238 | prompt "Selected region size" |
239 | default CMA_SIZE_SEL_ABSOLUTE | 239 | default CMA_SIZE_SEL_MBYTES |
240 | 240 | ||
241 | config CMA_SIZE_SEL_MBYTES | 241 | config CMA_SIZE_SEL_MBYTES |
242 | bool "Use mega bytes value only" | 242 | bool "Use mega bytes value only" |
diff --git a/drivers/base/dma-coherent.c b/drivers/base/dma-coherent.c index 560a7173f810..bc256b641027 100644 --- a/drivers/base/dma-coherent.c +++ b/drivers/base/dma-coherent.c | |||
@@ -191,9 +191,8 @@ EXPORT_SYMBOL(dma_release_from_coherent); | |||
191 | * This checks whether the memory was allocated from the per-device | 191 | * This checks whether the memory was allocated from the per-device |
192 | * coherent memory pool and if so, maps that memory to the provided vma. | 192 | * coherent memory pool and if so, maps that memory to the provided vma. |
193 | * | 193 | * |
194 | * Returns 1 if we correctly mapped the memory, or 0 if | 194 | * Returns 1 if we correctly mapped the memory, or 0 if the caller should |
195 | * dma_release_coherent() should proceed with mapping memory from | 195 | * proceed with mapping memory from generic pools. |
196 | * generic pools. | ||
197 | */ | 196 | */ |
198 | int dma_mmap_from_coherent(struct device *dev, struct vm_area_struct *vma, | 197 | int dma_mmap_from_coherent(struct device *dev, struct vm_area_struct *vma, |
199 | void *vaddr, size_t size, int *ret) | 198 | void *vaddr, size_t size, int *ret) |
diff --git a/drivers/base/dma-contiguous.c b/drivers/base/dma-contiguous.c index 9a1469474f55..612afcc5a938 100644 --- a/drivers/base/dma-contiguous.c +++ b/drivers/base/dma-contiguous.c | |||
@@ -27,15 +27,12 @@ | |||
27 | #include <linux/mm.h> | 27 | #include <linux/mm.h> |
28 | #include <linux/mutex.h> | 28 | #include <linux/mutex.h> |
29 | #include <linux/page-isolation.h> | 29 | #include <linux/page-isolation.h> |
30 | #include <linux/sizes.h> | ||
30 | #include <linux/slab.h> | 31 | #include <linux/slab.h> |
31 | #include <linux/swap.h> | 32 | #include <linux/swap.h> |
32 | #include <linux/mm_types.h> | 33 | #include <linux/mm_types.h> |
33 | #include <linux/dma-contiguous.h> | 34 | #include <linux/dma-contiguous.h> |
34 | 35 | ||
35 | #ifndef SZ_1M | ||
36 | #define SZ_1M (1 << 20) | ||
37 | #endif | ||
38 | |||
39 | struct cma { | 36 | struct cma { |
40 | unsigned long base_pfn; | 37 | unsigned long base_pfn; |
41 | unsigned long count; | 38 | unsigned long count; |
diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c index 81541452887b..8945f4e489ed 100644 --- a/drivers/base/firmware_class.c +++ b/drivers/base/firmware_class.c | |||
@@ -36,68 +36,6 @@ MODULE_AUTHOR("Manuel Estrada Sainz"); | |||
36 | MODULE_DESCRIPTION("Multi purpose firmware loading support"); | 36 | MODULE_DESCRIPTION("Multi purpose firmware loading support"); |
37 | MODULE_LICENSE("GPL"); | 37 | MODULE_LICENSE("GPL"); |
38 | 38 | ||
39 | static const char *fw_path[] = { | ||
40 | "/lib/firmware/updates/" UTS_RELEASE, | ||
41 | "/lib/firmware/updates", | ||
42 | "/lib/firmware/" UTS_RELEASE, | ||
43 | "/lib/firmware" | ||
44 | }; | ||
45 | |||
46 | /* Don't inline this: 'struct kstat' is biggish */ | ||
47 | static noinline long fw_file_size(struct file *file) | ||
48 | { | ||
49 | struct kstat st; | ||
50 | if (vfs_getattr(file->f_path.mnt, file->f_path.dentry, &st)) | ||
51 | return -1; | ||
52 | if (!S_ISREG(st.mode)) | ||
53 | return -1; | ||
54 | if (st.size != (long)st.size) | ||
55 | return -1; | ||
56 | return st.size; | ||
57 | } | ||
58 | |||
59 | static bool fw_read_file_contents(struct file *file, struct firmware *fw) | ||
60 | { | ||
61 | long size; | ||
62 | char *buf; | ||
63 | |||
64 | size = fw_file_size(file); | ||
65 | if (size < 0) | ||
66 | return false; | ||
67 | buf = vmalloc(size); | ||
68 | if (!buf) | ||
69 | return false; | ||
70 | if (kernel_read(file, 0, buf, size) != size) { | ||
71 | vfree(buf); | ||
72 | return false; | ||
73 | } | ||
74 | fw->data = buf; | ||
75 | fw->size = size; | ||
76 | return true; | ||
77 | } | ||
78 | |||
79 | static bool fw_get_filesystem_firmware(struct firmware *fw, const char *name) | ||
80 | { | ||
81 | int i; | ||
82 | bool success = false; | ||
83 | char *path = __getname(); | ||
84 | |||
85 | for (i = 0; i < ARRAY_SIZE(fw_path); i++) { | ||
86 | struct file *file; | ||
87 | snprintf(path, PATH_MAX, "%s/%s", fw_path[i], name); | ||
88 | |||
89 | file = filp_open(path, O_RDONLY, 0); | ||
90 | if (IS_ERR(file)) | ||
91 | continue; | ||
92 | success = fw_read_file_contents(file, fw); | ||
93 | fput(file); | ||
94 | if (success) | ||
95 | break; | ||
96 | } | ||
97 | __putname(path); | ||
98 | return success; | ||
99 | } | ||
100 | |||
101 | /* Builtin firmware support */ | 39 | /* Builtin firmware support */ |
102 | 40 | ||
103 | #ifdef CONFIG_FW_LOADER | 41 | #ifdef CONFIG_FW_LOADER |
@@ -150,6 +88,11 @@ enum { | |||
150 | FW_STATUS_ABORT, | 88 | FW_STATUS_ABORT, |
151 | }; | 89 | }; |
152 | 90 | ||
91 | enum fw_buf_fmt { | ||
92 | VMALLOC_BUF, /* used in direct loading */ | ||
93 | PAGE_BUF, /* used in loading via userspace */ | ||
94 | }; | ||
95 | |||
153 | static int loading_timeout = 60; /* In seconds */ | 96 | static int loading_timeout = 60; /* In seconds */ |
154 | 97 | ||
155 | static inline long firmware_loading_timeout(void) | 98 | static inline long firmware_loading_timeout(void) |
@@ -173,8 +116,6 @@ struct firmware_cache { | |||
173 | spinlock_t name_lock; | 116 | spinlock_t name_lock; |
174 | struct list_head fw_names; | 117 | struct list_head fw_names; |
175 | 118 | ||
176 | wait_queue_head_t wait_queue; | ||
177 | int cnt; | ||
178 | struct delayed_work work; | 119 | struct delayed_work work; |
179 | 120 | ||
180 | struct notifier_block pm_notify; | 121 | struct notifier_block pm_notify; |
@@ -187,6 +128,7 @@ struct firmware_buf { | |||
187 | struct completion completion; | 128 | struct completion completion; |
188 | struct firmware_cache *fwc; | 129 | struct firmware_cache *fwc; |
189 | unsigned long status; | 130 | unsigned long status; |
131 | enum fw_buf_fmt fmt; | ||
190 | void *data; | 132 | void *data; |
191 | size_t size; | 133 | size_t size; |
192 | struct page **pages; | 134 | struct page **pages; |
@@ -240,6 +182,7 @@ static struct firmware_buf *__allocate_fw_buf(const char *fw_name, | |||
240 | strcpy(buf->fw_id, fw_name); | 182 | strcpy(buf->fw_id, fw_name); |
241 | buf->fwc = fwc; | 183 | buf->fwc = fwc; |
242 | init_completion(&buf->completion); | 184 | init_completion(&buf->completion); |
185 | buf->fmt = VMALLOC_BUF; | ||
243 | 186 | ||
244 | pr_debug("%s: fw-%s buf=%p\n", __func__, fw_name, buf); | 187 | pr_debug("%s: fw-%s buf=%p\n", __func__, fw_name, buf); |
245 | 188 | ||
@@ -307,10 +250,14 @@ static void __fw_free_buf(struct kref *ref) | |||
307 | list_del(&buf->list); | 250 | list_del(&buf->list); |
308 | spin_unlock(&fwc->lock); | 251 | spin_unlock(&fwc->lock); |
309 | 252 | ||
310 | vunmap(buf->data); | 253 | |
311 | for (i = 0; i < buf->nr_pages; i++) | 254 | if (buf->fmt == PAGE_BUF) { |
312 | __free_page(buf->pages[i]); | 255 | vunmap(buf->data); |
313 | kfree(buf->pages); | 256 | for (i = 0; i < buf->nr_pages; i++) |
257 | __free_page(buf->pages[i]); | ||
258 | kfree(buf->pages); | ||
259 | } else | ||
260 | vfree(buf->data); | ||
314 | kfree(buf); | 261 | kfree(buf); |
315 | } | 262 | } |
316 | 263 | ||
@@ -319,6 +266,69 @@ static void fw_free_buf(struct firmware_buf *buf) | |||
319 | kref_put(&buf->ref, __fw_free_buf); | 266 | kref_put(&buf->ref, __fw_free_buf); |
320 | } | 267 | } |
321 | 268 | ||
269 | /* direct firmware loading support */ | ||
270 | static const char *fw_path[] = { | ||
271 | "/lib/firmware/updates/" UTS_RELEASE, | ||
272 | "/lib/firmware/updates", | ||
273 | "/lib/firmware/" UTS_RELEASE, | ||
274 | "/lib/firmware" | ||
275 | }; | ||
276 | |||
277 | /* Don't inline this: 'struct kstat' is biggish */ | ||
278 | static noinline long fw_file_size(struct file *file) | ||
279 | { | ||
280 | struct kstat st; | ||
281 | if (vfs_getattr(file->f_path.mnt, file->f_path.dentry, &st)) | ||
282 | return -1; | ||
283 | if (!S_ISREG(st.mode)) | ||
284 | return -1; | ||
285 | if (st.size != (long)st.size) | ||
286 | return -1; | ||
287 | return st.size; | ||
288 | } | ||
289 | |||
290 | static bool fw_read_file_contents(struct file *file, struct firmware_buf *fw_buf) | ||
291 | { | ||
292 | long size; | ||
293 | char *buf; | ||
294 | |||
295 | size = fw_file_size(file); | ||
296 | if (size < 0) | ||
297 | return false; | ||
298 | buf = vmalloc(size); | ||
299 | if (!buf) | ||
300 | return false; | ||
301 | if (kernel_read(file, 0, buf, size) != size) { | ||
302 | vfree(buf); | ||
303 | return false; | ||
304 | } | ||
305 | fw_buf->data = buf; | ||
306 | fw_buf->size = size; | ||
307 | return true; | ||
308 | } | ||
309 | |||
310 | static bool fw_get_filesystem_firmware(struct firmware_buf *buf) | ||
311 | { | ||
312 | int i; | ||
313 | bool success = false; | ||
314 | char *path = __getname(); | ||
315 | |||
316 | for (i = 0; i < ARRAY_SIZE(fw_path); i++) { | ||
317 | struct file *file; | ||
318 | snprintf(path, PATH_MAX, "%s/%s", fw_path[i], buf->fw_id); | ||
319 | |||
320 | file = filp_open(path, O_RDONLY, 0); | ||
321 | if (IS_ERR(file)) | ||
322 | continue; | ||
323 | success = fw_read_file_contents(file, buf); | ||
324 | fput(file); | ||
325 | if (success) | ||
326 | break; | ||
327 | } | ||
328 | __putname(path); | ||
329 | return success; | ||
330 | } | ||
331 | |||
322 | static struct firmware_priv *to_firmware_priv(struct device *dev) | 332 | static struct firmware_priv *to_firmware_priv(struct device *dev) |
323 | { | 333 | { |
324 | return container_of(dev, struct firmware_priv, dev); | 334 | return container_of(dev, struct firmware_priv, dev); |
@@ -423,6 +433,21 @@ static void firmware_free_data(const struct firmware *fw) | |||
423 | #ifndef PAGE_KERNEL_RO | 433 | #ifndef PAGE_KERNEL_RO |
424 | #define PAGE_KERNEL_RO PAGE_KERNEL | 434 | #define PAGE_KERNEL_RO PAGE_KERNEL |
425 | #endif | 435 | #endif |
436 | |||
437 | /* one pages buffer should be mapped/unmapped only once */ | ||
438 | static int fw_map_pages_buf(struct firmware_buf *buf) | ||
439 | { | ||
440 | if (buf->fmt != PAGE_BUF) | ||
441 | return 0; | ||
442 | |||
443 | if (buf->data) | ||
444 | vunmap(buf->data); | ||
445 | buf->data = vmap(buf->pages, buf->nr_pages, 0, PAGE_KERNEL_RO); | ||
446 | if (!buf->data) | ||
447 | return -ENOMEM; | ||
448 | return 0; | ||
449 | } | ||
450 | |||
426 | /** | 451 | /** |
427 | * firmware_loading_store - set value in the 'loading' control file | 452 | * firmware_loading_store - set value in the 'loading' control file |
428 | * @dev: device pointer | 453 | * @dev: device pointer |
@@ -467,6 +492,14 @@ static ssize_t firmware_loading_store(struct device *dev, | |||
467 | if (test_bit(FW_STATUS_LOADING, &fw_buf->status)) { | 492 | if (test_bit(FW_STATUS_LOADING, &fw_buf->status)) { |
468 | set_bit(FW_STATUS_DONE, &fw_buf->status); | 493 | set_bit(FW_STATUS_DONE, &fw_buf->status); |
469 | clear_bit(FW_STATUS_LOADING, &fw_buf->status); | 494 | clear_bit(FW_STATUS_LOADING, &fw_buf->status); |
495 | |||
496 | /* | ||
497 | * Several loading requests may be pending on | ||
498 | * one same firmware buf, so let all requests | ||
499 | * see the mapped 'buf->data' once the loading | ||
500 | * is completed. | ||
501 | * */ | ||
502 | fw_map_pages_buf(fw_buf); | ||
470 | complete_all(&fw_buf->completion); | 503 | complete_all(&fw_buf->completion); |
471 | break; | 504 | break; |
472 | } | 505 | } |
@@ -670,15 +703,6 @@ exit: | |||
670 | return fw_priv; | 703 | return fw_priv; |
671 | } | 704 | } |
672 | 705 | ||
673 | /* one pages buffer is mapped/unmapped only once */ | ||
674 | static int fw_map_pages_buf(struct firmware_buf *buf) | ||
675 | { | ||
676 | buf->data = vmap(buf->pages, buf->nr_pages, 0, PAGE_KERNEL_RO); | ||
677 | if (!buf->data) | ||
678 | return -ENOMEM; | ||
679 | return 0; | ||
680 | } | ||
681 | |||
682 | /* store the pages buffer info firmware from buf */ | 706 | /* store the pages buffer info firmware from buf */ |
683 | static void fw_set_page_data(struct firmware_buf *buf, struct firmware *fw) | 707 | static void fw_set_page_data(struct firmware_buf *buf, struct firmware *fw) |
684 | { | 708 | { |
@@ -778,11 +802,6 @@ _request_firmware_prepare(const struct firmware **firmware_p, const char *name, | |||
778 | return NULL; | 802 | return NULL; |
779 | } | 803 | } |
780 | 804 | ||
781 | if (fw_get_filesystem_firmware(firmware, name)) { | ||
782 | dev_dbg(device, "firmware: direct-loading firmware %s\n", name); | ||
783 | return NULL; | ||
784 | } | ||
785 | |||
786 | ret = fw_lookup_and_allocate_buf(name, &fw_cache, &buf); | 805 | ret = fw_lookup_and_allocate_buf(name, &fw_cache, &buf); |
787 | if (!ret) | 806 | if (!ret) |
788 | fw_priv = fw_create_instance(firmware, name, device, | 807 | fw_priv = fw_create_instance(firmware, name, device, |
@@ -832,6 +851,21 @@ static int _request_firmware_load(struct firmware_priv *fw_priv, bool uevent, | |||
832 | struct device *f_dev = &fw_priv->dev; | 851 | struct device *f_dev = &fw_priv->dev; |
833 | struct firmware_buf *buf = fw_priv->buf; | 852 | struct firmware_buf *buf = fw_priv->buf; |
834 | struct firmware_cache *fwc = &fw_cache; | 853 | struct firmware_cache *fwc = &fw_cache; |
854 | int direct_load = 0; | ||
855 | |||
856 | /* try direct loading from fs first */ | ||
857 | if (fw_get_filesystem_firmware(buf)) { | ||
858 | dev_dbg(f_dev->parent, "firmware: direct-loading" | ||
859 | " firmware %s\n", buf->fw_id); | ||
860 | |||
861 | set_bit(FW_STATUS_DONE, &buf->status); | ||
862 | complete_all(&buf->completion); | ||
863 | direct_load = 1; | ||
864 | goto handle_fw; | ||
865 | } | ||
866 | |||
867 | /* fall back on userspace loading */ | ||
868 | buf->fmt = PAGE_BUF; | ||
835 | 869 | ||
836 | dev_set_uevent_suppress(f_dev, true); | 870 | dev_set_uevent_suppress(f_dev, true); |
837 | 871 | ||
@@ -870,6 +904,7 @@ static int _request_firmware_load(struct firmware_priv *fw_priv, bool uevent, | |||
870 | 904 | ||
871 | del_timer_sync(&fw_priv->timeout); | 905 | del_timer_sync(&fw_priv->timeout); |
872 | 906 | ||
907 | handle_fw: | ||
873 | mutex_lock(&fw_lock); | 908 | mutex_lock(&fw_lock); |
874 | if (!buf->size || test_bit(FW_STATUS_ABORT, &buf->status)) | 909 | if (!buf->size || test_bit(FW_STATUS_ABORT, &buf->status)) |
875 | retval = -ENOENT; | 910 | retval = -ENOENT; |
@@ -884,9 +919,6 @@ static int _request_firmware_load(struct firmware_priv *fw_priv, bool uevent, | |||
884 | if (!retval && f_dev->parent) | 919 | if (!retval && f_dev->parent) |
885 | fw_add_devm_name(f_dev->parent, buf->fw_id); | 920 | fw_add_devm_name(f_dev->parent, buf->fw_id); |
886 | 921 | ||
887 | if (!retval) | ||
888 | retval = fw_map_pages_buf(buf); | ||
889 | |||
890 | /* | 922 | /* |
891 | * After caching firmware image is started, let it piggyback | 923 | * After caching firmware image is started, let it piggyback |
892 | * on request firmware. | 924 | * on request firmware. |
@@ -902,6 +934,9 @@ static int _request_firmware_load(struct firmware_priv *fw_priv, bool uevent, | |||
902 | fw_priv->buf = NULL; | 934 | fw_priv->buf = NULL; |
903 | mutex_unlock(&fw_lock); | 935 | mutex_unlock(&fw_lock); |
904 | 936 | ||
937 | if (direct_load) | ||
938 | goto err_put_dev; | ||
939 | |||
905 | device_remove_file(f_dev, &dev_attr_loading); | 940 | device_remove_file(f_dev, &dev_attr_loading); |
906 | err_del_bin_attr: | 941 | err_del_bin_attr: |
907 | device_remove_bin_file(f_dev, &firmware_attr_data); | 942 | device_remove_bin_file(f_dev, &firmware_attr_data); |
@@ -1129,6 +1164,8 @@ int uncache_firmware(const char *fw_name) | |||
1129 | } | 1164 | } |
1130 | 1165 | ||
1131 | #ifdef CONFIG_PM_SLEEP | 1166 | #ifdef CONFIG_PM_SLEEP |
1167 | static ASYNC_DOMAIN_EXCLUSIVE(fw_cache_domain); | ||
1168 | |||
1132 | static struct fw_cache_entry *alloc_fw_cache_entry(const char *name) | 1169 | static struct fw_cache_entry *alloc_fw_cache_entry(const char *name) |
1133 | { | 1170 | { |
1134 | struct fw_cache_entry *fce; | 1171 | struct fw_cache_entry *fce; |
@@ -1142,17 +1179,27 @@ exit: | |||
1142 | return fce; | 1179 | return fce; |
1143 | } | 1180 | } |
1144 | 1181 | ||
1145 | static int fw_cache_piggyback_on_request(const char *name) | 1182 | static int __fw_entry_found(const char *name) |
1146 | { | 1183 | { |
1147 | struct firmware_cache *fwc = &fw_cache; | 1184 | struct firmware_cache *fwc = &fw_cache; |
1148 | struct fw_cache_entry *fce; | 1185 | struct fw_cache_entry *fce; |
1149 | int ret = 0; | ||
1150 | 1186 | ||
1151 | spin_lock(&fwc->name_lock); | ||
1152 | list_for_each_entry(fce, &fwc->fw_names, list) { | 1187 | list_for_each_entry(fce, &fwc->fw_names, list) { |
1153 | if (!strcmp(fce->name, name)) | 1188 | if (!strcmp(fce->name, name)) |
1154 | goto found; | 1189 | return 1; |
1155 | } | 1190 | } |
1191 | return 0; | ||
1192 | } | ||
1193 | |||
1194 | static int fw_cache_piggyback_on_request(const char *name) | ||
1195 | { | ||
1196 | struct firmware_cache *fwc = &fw_cache; | ||
1197 | struct fw_cache_entry *fce; | ||
1198 | int ret = 0; | ||
1199 | |||
1200 | spin_lock(&fwc->name_lock); | ||
1201 | if (__fw_entry_found(name)) | ||
1202 | goto found; | ||
1156 | 1203 | ||
1157 | fce = alloc_fw_cache_entry(name); | 1204 | fce = alloc_fw_cache_entry(name); |
1158 | if (fce) { | 1205 | if (fce) { |
@@ -1185,12 +1232,6 @@ static void __async_dev_cache_fw_image(void *fw_entry, | |||
1185 | 1232 | ||
1186 | free_fw_cache_entry(fce); | 1233 | free_fw_cache_entry(fce); |
1187 | } | 1234 | } |
1188 | |||
1189 | spin_lock(&fwc->name_lock); | ||
1190 | fwc->cnt--; | ||
1191 | spin_unlock(&fwc->name_lock); | ||
1192 | |||
1193 | wake_up(&fwc->wait_queue); | ||
1194 | } | 1235 | } |
1195 | 1236 | ||
1196 | /* called with dev->devres_lock held */ | 1237 | /* called with dev->devres_lock held */ |
@@ -1229,11 +1270,19 @@ static void dev_cache_fw_image(struct device *dev, void *data) | |||
1229 | list_del(&fce->list); | 1270 | list_del(&fce->list); |
1230 | 1271 | ||
1231 | spin_lock(&fwc->name_lock); | 1272 | spin_lock(&fwc->name_lock); |
1232 | fwc->cnt++; | 1273 | /* only one cache entry for one firmware */ |
1233 | list_add(&fce->list, &fwc->fw_names); | 1274 | if (!__fw_entry_found(fce->name)) { |
1275 | list_add(&fce->list, &fwc->fw_names); | ||
1276 | } else { | ||
1277 | free_fw_cache_entry(fce); | ||
1278 | fce = NULL; | ||
1279 | } | ||
1234 | spin_unlock(&fwc->name_lock); | 1280 | spin_unlock(&fwc->name_lock); |
1235 | 1281 | ||
1236 | async_schedule(__async_dev_cache_fw_image, (void *)fce); | 1282 | if (fce) |
1283 | async_schedule_domain(__async_dev_cache_fw_image, | ||
1284 | (void *)fce, | ||
1285 | &fw_cache_domain); | ||
1237 | } | 1286 | } |
1238 | } | 1287 | } |
1239 | 1288 | ||
@@ -1275,6 +1324,9 @@ static void device_cache_fw_images(void) | |||
1275 | 1324 | ||
1276 | pr_debug("%s\n", __func__); | 1325 | pr_debug("%s\n", __func__); |
1277 | 1326 | ||
1327 | /* cancel uncache work */ | ||
1328 | cancel_delayed_work_sync(&fwc->work); | ||
1329 | |||
1278 | /* | 1330 | /* |
1279 | * use small loading timeout for caching devices' firmware | 1331 | * use small loading timeout for caching devices' firmware |
1280 | * because all these firmware images have been loaded | 1332 | * because all these firmware images have been loaded |
@@ -1292,21 +1344,7 @@ static void device_cache_fw_images(void) | |||
1292 | mutex_unlock(&fw_lock); | 1344 | mutex_unlock(&fw_lock); |
1293 | 1345 | ||
1294 | /* wait for completion of caching firmware for all devices */ | 1346 | /* wait for completion of caching firmware for all devices */ |
1295 | spin_lock(&fwc->name_lock); | 1347 | async_synchronize_full_domain(&fw_cache_domain); |
1296 | for (;;) { | ||
1297 | prepare_to_wait(&fwc->wait_queue, &wait, | ||
1298 | TASK_UNINTERRUPTIBLE); | ||
1299 | if (!fwc->cnt) | ||
1300 | break; | ||
1301 | |||
1302 | spin_unlock(&fwc->name_lock); | ||
1303 | |||
1304 | schedule(); | ||
1305 | |||
1306 | spin_lock(&fwc->name_lock); | ||
1307 | } | ||
1308 | spin_unlock(&fwc->name_lock); | ||
1309 | finish_wait(&fwc->wait_queue, &wait); | ||
1310 | 1348 | ||
1311 | loading_timeout = old_timeout; | 1349 | loading_timeout = old_timeout; |
1312 | } | 1350 | } |
@@ -1394,9 +1432,7 @@ static void __init fw_cache_init(void) | |||
1394 | #ifdef CONFIG_PM_SLEEP | 1432 | #ifdef CONFIG_PM_SLEEP |
1395 | spin_lock_init(&fw_cache.name_lock); | 1433 | spin_lock_init(&fw_cache.name_lock); |
1396 | INIT_LIST_HEAD(&fw_cache.fw_names); | 1434 | INIT_LIST_HEAD(&fw_cache.fw_names); |
1397 | fw_cache.cnt = 0; | ||
1398 | 1435 | ||
1399 | init_waitqueue_head(&fw_cache.wait_queue); | ||
1400 | INIT_DELAYED_WORK(&fw_cache.work, | 1436 | INIT_DELAYED_WORK(&fw_cache.work, |
1401 | device_uncache_fw_images_work); | 1437 | device_uncache_fw_images_work); |
1402 | 1438 | ||
diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index c22b869245d9..96b71b6536d6 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c | |||
@@ -1862,7 +1862,7 @@ int pm_genpd_attach_cpuidle(struct generic_pm_domain *genpd, int state) | |||
1862 | cpuidle_drv = cpuidle_driver_ref(); | 1862 | cpuidle_drv = cpuidle_driver_ref(); |
1863 | if (!cpuidle_drv) { | 1863 | if (!cpuidle_drv) { |
1864 | ret = -ENODEV; | 1864 | ret = -ENODEV; |
1865 | goto out; | 1865 | goto err_drv; |
1866 | } | 1866 | } |
1867 | if (cpuidle_drv->state_count <= state) { | 1867 | if (cpuidle_drv->state_count <= state) { |
1868 | ret = -EINVAL; | 1868 | ret = -EINVAL; |
@@ -1884,6 +1884,9 @@ int pm_genpd_attach_cpuidle(struct generic_pm_domain *genpd, int state) | |||
1884 | 1884 | ||
1885 | err: | 1885 | err: |
1886 | cpuidle_driver_unref(); | 1886 | cpuidle_driver_unref(); |
1887 | |||
1888 | err_drv: | ||
1889 | kfree(cpu_data); | ||
1887 | goto out; | 1890 | goto out; |
1888 | } | 1891 | } |
1889 | 1892 | ||
diff --git a/drivers/base/regmap/Kconfig b/drivers/base/regmap/Kconfig index 6be390bd8bd1..f0d30543fcce 100644 --- a/drivers/base/regmap/Kconfig +++ b/drivers/base/regmap/Kconfig | |||
@@ -3,7 +3,7 @@ | |||
3 | # subsystems should select the appropriate symbols. | 3 | # subsystems should select the appropriate symbols. |
4 | 4 | ||
5 | config REGMAP | 5 | config REGMAP |
6 | default y if (REGMAP_I2C || REGMAP_SPI) | 6 | default y if (REGMAP_I2C || REGMAP_SPI || REGMAP_MMIO || REGMAP_IRQ) |
7 | select LZO_COMPRESS | 7 | select LZO_COMPRESS |
8 | select LZO_DECOMPRESS | 8 | select LZO_DECOMPRESS |
9 | select IRQ_DOMAIN if REGMAP_IRQ | 9 | select IRQ_DOMAIN if REGMAP_IRQ |
diff --git a/drivers/bcma/main.c b/drivers/bcma/main.c index 432aeeedfd5e..d865470bc951 100644 --- a/drivers/bcma/main.c +++ b/drivers/bcma/main.c | |||
@@ -158,9 +158,10 @@ static int bcma_register_cores(struct bcma_bus *bus) | |||
158 | 158 | ||
159 | static void bcma_unregister_cores(struct bcma_bus *bus) | 159 | static void bcma_unregister_cores(struct bcma_bus *bus) |
160 | { | 160 | { |
161 | struct bcma_device *core; | 161 | struct bcma_device *core, *tmp; |
162 | 162 | ||
163 | list_for_each_entry(core, &bus->cores, list) { | 163 | list_for_each_entry_safe(core, tmp, &bus->cores, list) { |
164 | list_del(&core->list); | ||
164 | if (core->dev_registered) | 165 | if (core->dev_registered) |
165 | device_unregister(&core->dev); | 166 | device_unregister(&core->dev); |
166 | } | 167 | } |
diff --git a/drivers/char/sonypi.c b/drivers/char/sonypi.c index 320debbe32fa..9b4f0116ff21 100644 --- a/drivers/char/sonypi.c +++ b/drivers/char/sonypi.c | |||
@@ -1456,7 +1456,7 @@ static int __devexit sonypi_remove(struct platform_device *dev) | |||
1456 | return 0; | 1456 | return 0; |
1457 | } | 1457 | } |
1458 | 1458 | ||
1459 | #ifdef CONFIG_PM | 1459 | #ifdef CONFIG_PM_SLEEP |
1460 | static int old_camera_power; | 1460 | static int old_camera_power; |
1461 | 1461 | ||
1462 | static int sonypi_suspend(struct device *dev) | 1462 | static int sonypi_suspend(struct device *dev) |
diff --git a/drivers/cpufreq/cpufreq_stats.c b/drivers/cpufreq/cpufreq_stats.c index b40ee1403be9..399831690fed 100644 --- a/drivers/cpufreq/cpufreq_stats.c +++ b/drivers/cpufreq/cpufreq_stats.c | |||
@@ -328,6 +328,7 @@ static int __cpuinit cpufreq_stat_cpu_callback(struct notifier_block *nfb, | |||
328 | cpufreq_update_policy(cpu); | 328 | cpufreq_update_policy(cpu); |
329 | break; | 329 | break; |
330 | case CPU_DOWN_PREPARE: | 330 | case CPU_DOWN_PREPARE: |
331 | case CPU_DOWN_PREPARE_FROZEN: | ||
331 | cpufreq_stats_free_sysfs(cpu); | 332 | cpufreq_stats_free_sysfs(cpu); |
332 | break; | 333 | break; |
333 | case CPU_DEAD: | 334 | case CPU_DEAD: |
diff --git a/drivers/cpufreq/powernow-k8.c b/drivers/cpufreq/powernow-k8.c index 129e80bfff22..c16a3a593ba4 100644 --- a/drivers/cpufreq/powernow-k8.c +++ b/drivers/cpufreq/powernow-k8.c | |||
@@ -1052,14 +1052,7 @@ static int powernowk8_target(struct cpufreq_policy *pol, | |||
1052 | struct powernowk8_target_arg pta = { .pol = pol, .targfreq = targfreq, | 1052 | struct powernowk8_target_arg pta = { .pol = pol, .targfreq = targfreq, |
1053 | .relation = relation }; | 1053 | .relation = relation }; |
1054 | 1054 | ||
1055 | /* | 1055 | return work_on_cpu(pol->cpu, powernowk8_target_fn, &pta); |
1056 | * Must run on @pol->cpu. cpufreq core is responsible for ensuring | ||
1057 | * that we're bound to the current CPU and pol->cpu stays online. | ||
1058 | */ | ||
1059 | if (smp_processor_id() == pol->cpu) | ||
1060 | return powernowk8_target_fn(&pta); | ||
1061 | else | ||
1062 | return work_on_cpu(pol->cpu, powernowk8_target_fn, &pta); | ||
1063 | } | 1056 | } |
1064 | 1057 | ||
1065 | /* Driver entry point to verify the policy and range of frequencies */ | 1058 | /* Driver entry point to verify the policy and range of frequencies */ |
diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig index 677cd6e4e1a1..d4c12180c654 100644 --- a/drivers/dma/Kconfig +++ b/drivers/dma/Kconfig | |||
@@ -90,6 +90,17 @@ config DW_DMAC | |||
90 | Support the Synopsys DesignWare AHB DMA controller. This | 90 | Support the Synopsys DesignWare AHB DMA controller. This |
91 | can be integrated in chips such as the Atmel AT32ap7000. | 91 | can be integrated in chips such as the Atmel AT32ap7000. |
92 | 92 | ||
93 | config DW_DMAC_BIG_ENDIAN_IO | ||
94 | bool "Use big endian I/O register access" | ||
95 | default y if AVR32 | ||
96 | depends on DW_DMAC | ||
97 | help | ||
98 | Say yes here to use big endian I/O access when reading and writing | ||
99 | to the DMA controller registers. This is needed on some platforms, | ||
100 | like the Atmel AVR32 architecture. | ||
101 | |||
102 | If unsure, use the default setting. | ||
103 | |||
93 | config AT_HDMAC | 104 | config AT_HDMAC |
94 | tristate "Atmel AHB DMA support" | 105 | tristate "Atmel AHB DMA support" |
95 | depends on ARCH_AT91 | 106 | depends on ARCH_AT91 |
diff --git a/drivers/dma/dw_dmac_regs.h b/drivers/dma/dw_dmac_regs.h index ff39fa6cd2bc..88965597b7d0 100644 --- a/drivers/dma/dw_dmac_regs.h +++ b/drivers/dma/dw_dmac_regs.h | |||
@@ -98,9 +98,17 @@ struct dw_dma_regs { | |||
98 | u32 DW_PARAMS; | 98 | u32 DW_PARAMS; |
99 | }; | 99 | }; |
100 | 100 | ||
101 | #ifdef CONFIG_DW_DMAC_BIG_ENDIAN_IO | ||
102 | #define dma_readl_native ioread32be | ||
103 | #define dma_writel_native iowrite32be | ||
104 | #else | ||
105 | #define dma_readl_native readl | ||
106 | #define dma_writel_native writel | ||
107 | #endif | ||
108 | |||
101 | /* To access the registers in early stage of probe */ | 109 | /* To access the registers in early stage of probe */ |
102 | #define dma_read_byaddr(addr, name) \ | 110 | #define dma_read_byaddr(addr, name) \ |
103 | readl((addr) + offsetof(struct dw_dma_regs, name)) | 111 | dma_readl_native((addr) + offsetof(struct dw_dma_regs, name)) |
104 | 112 | ||
105 | /* Bitfields in DW_PARAMS */ | 113 | /* Bitfields in DW_PARAMS */ |
106 | #define DW_PARAMS_NR_CHAN 8 /* number of channels */ | 114 | #define DW_PARAMS_NR_CHAN 8 /* number of channels */ |
@@ -216,9 +224,9 @@ __dwc_regs(struct dw_dma_chan *dwc) | |||
216 | } | 224 | } |
217 | 225 | ||
218 | #define channel_readl(dwc, name) \ | 226 | #define channel_readl(dwc, name) \ |
219 | readl(&(__dwc_regs(dwc)->name)) | 227 | dma_readl_native(&(__dwc_regs(dwc)->name)) |
220 | #define channel_writel(dwc, name, val) \ | 228 | #define channel_writel(dwc, name, val) \ |
221 | writel((val), &(__dwc_regs(dwc)->name)) | 229 | dma_writel_native((val), &(__dwc_regs(dwc)->name)) |
222 | 230 | ||
223 | static inline struct dw_dma_chan *to_dw_dma_chan(struct dma_chan *chan) | 231 | static inline struct dw_dma_chan *to_dw_dma_chan(struct dma_chan *chan) |
224 | { | 232 | { |
@@ -246,9 +254,9 @@ static inline struct dw_dma_regs __iomem *__dw_regs(struct dw_dma *dw) | |||
246 | } | 254 | } |
247 | 255 | ||
248 | #define dma_readl(dw, name) \ | 256 | #define dma_readl(dw, name) \ |
249 | readl(&(__dw_regs(dw)->name)) | 257 | dma_readl_native(&(__dw_regs(dw)->name)) |
250 | #define dma_writel(dw, name, val) \ | 258 | #define dma_writel(dw, name, val) \ |
251 | writel((val), &(__dw_regs(dw)->name)) | 259 | dma_writel_native((val), &(__dw_regs(dw)->name)) |
252 | 260 | ||
253 | #define channel_set_bit(dw, reg, mask) \ | 261 | #define channel_set_bit(dw, reg, mask) \ |
254 | dma_writel(dw, reg, ((mask) << 8) | (mask)) | 262 | dma_writel(dw, reg, ((mask) << 8) | (mask)) |
diff --git a/drivers/dma/imx-dma.c b/drivers/dma/imx-dma.c index f11b5b2b1a1c..7d9554cc4976 100644 --- a/drivers/dma/imx-dma.c +++ b/drivers/dma/imx-dma.c | |||
@@ -474,8 +474,10 @@ static int imxdma_xfer_desc(struct imxdma_desc *d) | |||
474 | slot = i; | 474 | slot = i; |
475 | break; | 475 | break; |
476 | } | 476 | } |
477 | if (slot < 0) | 477 | if (slot < 0) { |
478 | spin_unlock_irqrestore(&imxdma->lock, flags); | ||
478 | return -EBUSY; | 479 | return -EBUSY; |
480 | } | ||
479 | 481 | ||
480 | imxdma->slots_2d[slot].xsr = d->x; | 482 | imxdma->slots_2d[slot].xsr = d->x; |
481 | imxdma->slots_2d[slot].ysr = d->y; | 483 | imxdma->slots_2d[slot].ysr = d->y; |
diff --git a/drivers/dma/sirf-dma.c b/drivers/dma/sirf-dma.c index 64385cde044b..d451caace806 100644 --- a/drivers/dma/sirf-dma.c +++ b/drivers/dma/sirf-dma.c | |||
@@ -109,7 +109,7 @@ static void sirfsoc_dma_execute(struct sirfsoc_dma_chan *schan) | |||
109 | sdesc = list_first_entry(&schan->queued, struct sirfsoc_dma_desc, | 109 | sdesc = list_first_entry(&schan->queued, struct sirfsoc_dma_desc, |
110 | node); | 110 | node); |
111 | /* Move the first queued descriptor to active list */ | 111 | /* Move the first queued descriptor to active list */ |
112 | list_move_tail(&schan->queued, &schan->active); | 112 | list_move_tail(&sdesc->node, &schan->active); |
113 | 113 | ||
114 | /* Start the DMA transfer */ | 114 | /* Start the DMA transfer */ |
115 | writel_relaxed(sdesc->width, sdma->base + SIRFSOC_DMA_WIDTH_0 + | 115 | writel_relaxed(sdesc->width, sdma->base + SIRFSOC_DMA_WIDTH_0 + |
@@ -428,7 +428,7 @@ static struct dma_async_tx_descriptor *sirfsoc_dma_prep_interleaved( | |||
428 | unsigned long iflags; | 428 | unsigned long iflags; |
429 | int ret; | 429 | int ret; |
430 | 430 | ||
431 | if ((xt->dir != DMA_MEM_TO_DEV) || (xt->dir != DMA_DEV_TO_MEM)) { | 431 | if ((xt->dir != DMA_MEM_TO_DEV) && (xt->dir != DMA_DEV_TO_MEM)) { |
432 | ret = -EINVAL; | 432 | ret = -EINVAL; |
433 | goto err_dir; | 433 | goto err_dir; |
434 | } | 434 | } |
diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c index 5a297a26211d..cc8e7c78a23c 100644 --- a/drivers/edac/amd64_edac.c +++ b/drivers/edac/amd64_edac.c | |||
@@ -170,8 +170,11 @@ static int __amd64_set_scrub_rate(struct pci_dev *ctl, u32 new_bw, u32 min_rate) | |||
170 | * memory controller and apply to register. Search for the first | 170 | * memory controller and apply to register. Search for the first |
171 | * bandwidth entry that is greater or equal than the setting requested | 171 | * bandwidth entry that is greater or equal than the setting requested |
172 | * and program that. If at last entry, turn off DRAM scrubbing. | 172 | * and program that. If at last entry, turn off DRAM scrubbing. |
173 | * | ||
174 | * If no suitable bandwidth is found, turn off DRAM scrubbing entirely | ||
175 | * by falling back to the last element in scrubrates[]. | ||
173 | */ | 176 | */ |
174 | for (i = 0; i < ARRAY_SIZE(scrubrates); i++) { | 177 | for (i = 0; i < ARRAY_SIZE(scrubrates) - 1; i++) { |
175 | /* | 178 | /* |
176 | * skip scrub rates which aren't recommended | 179 | * skip scrub rates which aren't recommended |
177 | * (see F10 BKDG, F3x58) | 180 | * (see F10 BKDG, F3x58) |
@@ -181,12 +184,6 @@ static int __amd64_set_scrub_rate(struct pci_dev *ctl, u32 new_bw, u32 min_rate) | |||
181 | 184 | ||
182 | if (scrubrates[i].bandwidth <= new_bw) | 185 | if (scrubrates[i].bandwidth <= new_bw) |
183 | break; | 186 | break; |
184 | |||
185 | /* | ||
186 | * if no suitable bandwidth found, turn off DRAM scrubbing | ||
187 | * entirely by falling back to the last element in the | ||
188 | * scrubrates array. | ||
189 | */ | ||
190 | } | 187 | } |
191 | 188 | ||
192 | scrubval = scrubrates[i].scrubval; | 189 | scrubval = scrubrates[i].scrubval; |
diff --git a/drivers/extcon/extcon-adc-jack.c b/drivers/extcon/extcon-adc-jack.c index 725eb5aa8d8c..e87196f6d2d2 100644 --- a/drivers/extcon/extcon-adc-jack.c +++ b/drivers/extcon/extcon-adc-jack.c | |||
@@ -14,6 +14,7 @@ | |||
14 | * | 14 | * |
15 | */ | 15 | */ |
16 | 16 | ||
17 | #include <linux/module.h> | ||
17 | #include <linux/slab.h> | 18 | #include <linux/slab.h> |
18 | #include <linux/device.h> | 19 | #include <linux/device.h> |
19 | #include <linux/platform_device.h> | 20 | #include <linux/platform_device.h> |
@@ -161,13 +162,12 @@ static int __devinit adc_jack_probe(struct platform_device *pdev) | |||
161 | err = request_any_context_irq(data->irq, adc_jack_irq_thread, | 162 | err = request_any_context_irq(data->irq, adc_jack_irq_thread, |
162 | pdata->irq_flags, pdata->name, data); | 163 | pdata->irq_flags, pdata->name, data); |
163 | 164 | ||
164 | if (err) { | 165 | if (err < 0) { |
165 | dev_err(&pdev->dev, "error: irq %d\n", data->irq); | 166 | dev_err(&pdev->dev, "error: irq %d\n", data->irq); |
166 | err = -EINVAL; | ||
167 | goto err_irq; | 167 | goto err_irq; |
168 | } | 168 | } |
169 | 169 | ||
170 | goto out; | 170 | return 0; |
171 | 171 | ||
172 | err_irq: | 172 | err_irq: |
173 | extcon_dev_unregister(&data->edev); | 173 | extcon_dev_unregister(&data->edev); |
@@ -196,3 +196,7 @@ static struct platform_driver adc_jack_driver = { | |||
196 | }; | 196 | }; |
197 | 197 | ||
198 | module_platform_driver(adc_jack_driver); | 198 | module_platform_driver(adc_jack_driver); |
199 | |||
200 | MODULE_AUTHOR("MyungJoo Ham <myungjoo.ham@samsung.com>"); | ||
201 | MODULE_DESCRIPTION("ADC Jack extcon driver"); | ||
202 | MODULE_LICENSE("GPL v2"); | ||
diff --git a/drivers/extcon/extcon-class.c b/drivers/extcon/extcon-class.c index 946a3188b2b7..d398821097f3 100644 --- a/drivers/extcon/extcon-class.c +++ b/drivers/extcon/extcon-class.c | |||
@@ -41,7 +41,7 @@ | |||
41 | * every single port-type of the following cable names. Please choose cable | 41 | * every single port-type of the following cable names. Please choose cable |
42 | * names that are actually used in your extcon device. | 42 | * names that are actually used in your extcon device. |
43 | */ | 43 | */ |
44 | const char *extcon_cable_name[] = { | 44 | const char extcon_cable_name[][CABLE_NAME_MAX + 1] = { |
45 | [EXTCON_USB] = "USB", | 45 | [EXTCON_USB] = "USB", |
46 | [EXTCON_USB_HOST] = "USB-Host", | 46 | [EXTCON_USB_HOST] = "USB-Host", |
47 | [EXTCON_TA] = "TA", | 47 | [EXTCON_TA] = "TA", |
@@ -62,8 +62,6 @@ const char *extcon_cable_name[] = { | |||
62 | [EXTCON_VIDEO_IN] = "Video-in", | 62 | [EXTCON_VIDEO_IN] = "Video-in", |
63 | [EXTCON_VIDEO_OUT] = "Video-out", | 63 | [EXTCON_VIDEO_OUT] = "Video-out", |
64 | [EXTCON_MECHANICAL] = "Mechanical", | 64 | [EXTCON_MECHANICAL] = "Mechanical", |
65 | |||
66 | NULL, | ||
67 | }; | 65 | }; |
68 | 66 | ||
69 | static struct class *extcon_class; | 67 | static struct class *extcon_class; |
@@ -91,17 +89,13 @@ static int check_mutually_exclusive(struct extcon_dev *edev, u32 new_state) | |||
91 | return 0; | 89 | return 0; |
92 | 90 | ||
93 | for (i = 0; edev->mutually_exclusive[i]; i++) { | 91 | for (i = 0; edev->mutually_exclusive[i]; i++) { |
94 | int count = 0, j; | 92 | int weight; |
95 | u32 correspondants = new_state & edev->mutually_exclusive[i]; | 93 | u32 correspondants = new_state & edev->mutually_exclusive[i]; |
96 | u32 exp = 1; | 94 | |
97 | 95 | /* calculate the total number of bits set */ | |
98 | for (j = 0; j < 32; j++) { | 96 | weight = hweight32(correspondants); |
99 | if (exp & correspondants) | 97 | if (weight > 1) |
100 | count++; | 98 | return i + 1; |
101 | if (count > 1) | ||
102 | return i + 1; | ||
103 | exp <<= 1; | ||
104 | } | ||
105 | } | 99 | } |
106 | 100 | ||
107 | return 0; | 101 | return 0; |
@@ -362,7 +356,7 @@ int extcon_get_cable_state(struct extcon_dev *edev, const char *cable_name) | |||
362 | EXPORT_SYMBOL_GPL(extcon_get_cable_state); | 356 | EXPORT_SYMBOL_GPL(extcon_get_cable_state); |
363 | 357 | ||
364 | /** | 358 | /** |
365 | * extcon_get_cable_state_() - Set the status of a specific cable. | 359 | * extcon_set_cable_state_() - Set the status of a specific cable. |
366 | * @edev: the extcon device that has the cable. | 360 | * @edev: the extcon device that has the cable. |
367 | * @index: cable index that can be retrieved by extcon_find_cable_index(). | 361 | * @index: cable index that can be retrieved by extcon_find_cable_index(). |
368 | * @cable_state: the new cable status. The default semantics is | 362 | * @cable_state: the new cable status. The default semantics is |
@@ -382,7 +376,7 @@ int extcon_set_cable_state_(struct extcon_dev *edev, | |||
382 | EXPORT_SYMBOL_GPL(extcon_set_cable_state_); | 376 | EXPORT_SYMBOL_GPL(extcon_set_cable_state_); |
383 | 377 | ||
384 | /** | 378 | /** |
385 | * extcon_get_cable_state() - Set the status of a specific cable. | 379 | * extcon_set_cable_state() - Set the status of a specific cable. |
386 | * @edev: the extcon device that has the cable. | 380 | * @edev: the extcon device that has the cable. |
387 | * @cable_name: cable name. | 381 | * @cable_name: cable name. |
388 | * @cable_state: the new cable status. The default semantics is | 382 | * @cable_state: the new cable status. The default semantics is |
@@ -447,6 +441,8 @@ static int _call_per_cable(struct notifier_block *nb, unsigned long val, | |||
447 | * extcon device. | 441 | * extcon device. |
448 | * @obj: an empty extcon_specific_cable_nb object to be returned. | 442 | * @obj: an empty extcon_specific_cable_nb object to be returned. |
449 | * @extcon_name: the name of extcon device. | 443 | * @extcon_name: the name of extcon device. |
444 | * if NULL, extcon_register_interest will register | ||
445 | * every cable with the target cable_name given. | ||
450 | * @cable_name: the target cable name. | 446 | * @cable_name: the target cable name. |
451 | * @nb: the notifier block to get notified. | 447 | * @nb: the notifier block to get notified. |
452 | * | 448 | * |
@@ -466,22 +462,44 @@ int extcon_register_interest(struct extcon_specific_cable_nb *obj, | |||
466 | const char *extcon_name, const char *cable_name, | 462 | const char *extcon_name, const char *cable_name, |
467 | struct notifier_block *nb) | 463 | struct notifier_block *nb) |
468 | { | 464 | { |
469 | if (!obj || !extcon_name || !cable_name || !nb) | 465 | if (!obj || !cable_name || !nb) |
470 | return -EINVAL; | 466 | return -EINVAL; |
471 | 467 | ||
472 | obj->edev = extcon_get_extcon_dev(extcon_name); | 468 | if (extcon_name) { |
473 | if (!obj->edev) | 469 | obj->edev = extcon_get_extcon_dev(extcon_name); |
474 | return -ENODEV; | 470 | if (!obj->edev) |
471 | return -ENODEV; | ||
475 | 472 | ||
476 | obj->cable_index = extcon_find_cable_index(obj->edev, cable_name); | 473 | obj->cable_index = extcon_find_cable_index(obj->edev, cable_name); |
477 | if (obj->cable_index < 0) | 474 | if (obj->cable_index < 0) |
478 | return -ENODEV; | 475 | return -ENODEV; |
476 | |||
477 | obj->user_nb = nb; | ||
479 | 478 | ||
480 | obj->user_nb = nb; | 479 | obj->internal_nb.notifier_call = _call_per_cable; |
481 | 480 | ||
482 | obj->internal_nb.notifier_call = _call_per_cable; | 481 | return raw_notifier_chain_register(&obj->edev->nh, &obj->internal_nb); |
482 | } else { | ||
483 | struct class_dev_iter iter; | ||
484 | struct extcon_dev *extd; | ||
485 | struct device *dev; | ||
486 | |||
487 | if (!extcon_class) | ||
488 | return -ENODEV; | ||
489 | class_dev_iter_init(&iter, extcon_class, NULL, NULL); | ||
490 | while ((dev = class_dev_iter_next(&iter))) { | ||
491 | extd = (struct extcon_dev *)dev_get_drvdata(dev); | ||
492 | |||
493 | if (extcon_find_cable_index(extd, cable_name) < 0) | ||
494 | continue; | ||
495 | |||
496 | class_dev_iter_exit(&iter); | ||
497 | return extcon_register_interest(obj, extd->name, | ||
498 | cable_name, nb); | ||
499 | } | ||
483 | 500 | ||
484 | return raw_notifier_chain_register(&obj->edev->nh, &obj->internal_nb); | 501 | return -ENODEV; |
502 | } | ||
485 | } | 503 | } |
486 | 504 | ||
487 | /** | 505 | /** |
@@ -551,43 +569,9 @@ static int create_extcon_class(void) | |||
551 | return 0; | 569 | return 0; |
552 | } | 570 | } |
553 | 571 | ||
554 | static void extcon_cleanup(struct extcon_dev *edev, bool skip) | ||
555 | { | ||
556 | mutex_lock(&extcon_dev_list_lock); | ||
557 | list_del(&edev->entry); | ||
558 | mutex_unlock(&extcon_dev_list_lock); | ||
559 | |||
560 | if (!skip && get_device(edev->dev)) { | ||
561 | int index; | ||
562 | |||
563 | if (edev->mutually_exclusive && edev->max_supported) { | ||
564 | for (index = 0; edev->mutually_exclusive[index]; | ||
565 | index++) | ||
566 | kfree(edev->d_attrs_muex[index].attr.name); | ||
567 | kfree(edev->d_attrs_muex); | ||
568 | kfree(edev->attrs_muex); | ||
569 | } | ||
570 | |||
571 | for (index = 0; index < edev->max_supported; index++) | ||
572 | kfree(edev->cables[index].attr_g.name); | ||
573 | |||
574 | if (edev->max_supported) { | ||
575 | kfree(edev->extcon_dev_type.groups); | ||
576 | kfree(edev->cables); | ||
577 | } | ||
578 | |||
579 | device_unregister(edev->dev); | ||
580 | put_device(edev->dev); | ||
581 | } | ||
582 | |||
583 | kfree(edev->dev); | ||
584 | } | ||
585 | |||
586 | static void extcon_dev_release(struct device *dev) | 572 | static void extcon_dev_release(struct device *dev) |
587 | { | 573 | { |
588 | struct extcon_dev *edev = (struct extcon_dev *) dev_get_drvdata(dev); | 574 | kfree(dev); |
589 | |||
590 | extcon_cleanup(edev, true); | ||
591 | } | 575 | } |
592 | 576 | ||
593 | static const char *muex_name = "mutually_exclusive"; | 577 | static const char *muex_name = "mutually_exclusive"; |
@@ -813,7 +797,40 @@ EXPORT_SYMBOL_GPL(extcon_dev_register); | |||
813 | */ | 797 | */ |
814 | void extcon_dev_unregister(struct extcon_dev *edev) | 798 | void extcon_dev_unregister(struct extcon_dev *edev) |
815 | { | 799 | { |
816 | extcon_cleanup(edev, false); | 800 | int index; |
801 | |||
802 | mutex_lock(&extcon_dev_list_lock); | ||
803 | list_del(&edev->entry); | ||
804 | mutex_unlock(&extcon_dev_list_lock); | ||
805 | |||
806 | if (IS_ERR_OR_NULL(get_device(edev->dev))) { | ||
807 | dev_err(edev->dev, "Failed to unregister extcon_dev (%s)\n", | ||
808 | dev_name(edev->dev)); | ||
809 | return; | ||
810 | } | ||
811 | |||
812 | if (edev->mutually_exclusive && edev->max_supported) { | ||
813 | for (index = 0; edev->mutually_exclusive[index]; | ||
814 | index++) | ||
815 | kfree(edev->d_attrs_muex[index].attr.name); | ||
816 | kfree(edev->d_attrs_muex); | ||
817 | kfree(edev->attrs_muex); | ||
818 | } | ||
819 | |||
820 | for (index = 0; index < edev->max_supported; index++) | ||
821 | kfree(edev->cables[index].attr_g.name); | ||
822 | |||
823 | if (edev->max_supported) { | ||
824 | kfree(edev->extcon_dev_type.groups); | ||
825 | kfree(edev->cables); | ||
826 | } | ||
827 | |||
828 | #if defined(CONFIG_ANDROID) | ||
829 | if (switch_class) | ||
830 | class_compat_remove_link(switch_class, edev->dev, NULL); | ||
831 | #endif | ||
832 | device_unregister(edev->dev); | ||
833 | put_device(edev->dev); | ||
817 | } | 834 | } |
818 | EXPORT_SYMBOL_GPL(extcon_dev_unregister); | 835 | EXPORT_SYMBOL_GPL(extcon_dev_unregister); |
819 | 836 | ||
@@ -825,6 +842,9 @@ module_init(extcon_class_init); | |||
825 | 842 | ||
826 | static void __exit extcon_class_exit(void) | 843 | static void __exit extcon_class_exit(void) |
827 | { | 844 | { |
845 | #if defined(CONFIG_ANDROID) | ||
846 | class_compat_unregister(switch_class); | ||
847 | #endif | ||
828 | class_destroy(extcon_class); | 848 | class_destroy(extcon_class); |
829 | } | 849 | } |
830 | module_exit(extcon_class_exit); | 850 | module_exit(extcon_class_exit); |
diff --git a/drivers/extcon/extcon-gpio.c b/drivers/extcon/extcon-gpio.c index 3cc152e690b0..71d3ab7b3d8d 100644 --- a/drivers/extcon/extcon-gpio.c +++ b/drivers/extcon/extcon-gpio.c | |||
@@ -26,7 +26,6 @@ | |||
26 | #include <linux/interrupt.h> | 26 | #include <linux/interrupt.h> |
27 | #include <linux/platform_device.h> | 27 | #include <linux/platform_device.h> |
28 | #include <linux/slab.h> | 28 | #include <linux/slab.h> |
29 | #include <linux/extcon.h> | ||
30 | #include <linux/workqueue.h> | 29 | #include <linux/workqueue.h> |
31 | #include <linux/gpio.h> | 30 | #include <linux/gpio.h> |
32 | #include <linux/extcon.h> | 31 | #include <linux/extcon.h> |
diff --git a/drivers/extcon/extcon-max77693.c b/drivers/extcon/extcon-max77693.c index e21387e2da5c..a17d0d91ada2 100644 --- a/drivers/extcon/extcon-max77693.c +++ b/drivers/extcon/extcon-max77693.c | |||
@@ -239,25 +239,19 @@ const char *max77693_extcon_cable[] = { | |||
239 | static int max77693_muic_set_debounce_time(struct max77693_muic_info *info, | 239 | static int max77693_muic_set_debounce_time(struct max77693_muic_info *info, |
240 | enum max77693_muic_adc_debounce_time time) | 240 | enum max77693_muic_adc_debounce_time time) |
241 | { | 241 | { |
242 | int ret = 0; | 242 | int ret; |
243 | u8 ctrl3; | ||
244 | 243 | ||
245 | switch (time) { | 244 | switch (time) { |
246 | case ADC_DEBOUNCE_TIME_5MS: | 245 | case ADC_DEBOUNCE_TIME_5MS: |
247 | case ADC_DEBOUNCE_TIME_10MS: | 246 | case ADC_DEBOUNCE_TIME_10MS: |
248 | case ADC_DEBOUNCE_TIME_25MS: | 247 | case ADC_DEBOUNCE_TIME_25MS: |
249 | case ADC_DEBOUNCE_TIME_38_62MS: | 248 | case ADC_DEBOUNCE_TIME_38_62MS: |
250 | ret = max77693_read_reg(info->max77693->regmap_muic, | 249 | ret = max77693_update_reg(info->max77693->regmap_muic, |
251 | MAX77693_MUIC_REG_CTRL3, &ctrl3); | 250 | MAX77693_MUIC_REG_CTRL3, |
252 | ctrl3 &= ~CONTROL3_ADCDBSET_MASK; | 251 | time << CONTROL3_ADCDBSET_SHIFT, |
253 | ctrl3 |= (time << CONTROL3_ADCDBSET_SHIFT); | 252 | CONTROL3_ADCDBSET_MASK); |
254 | 253 | if (ret) | |
255 | ret = max77693_write_reg(info->max77693->regmap_muic, | ||
256 | MAX77693_MUIC_REG_CTRL3, ctrl3); | ||
257 | if (ret) { | ||
258 | dev_err(info->dev, "failed to set ADC debounce time\n"); | 254 | dev_err(info->dev, "failed to set ADC debounce time\n"); |
259 | ret = -EINVAL; | ||
260 | } | ||
261 | break; | 255 | break; |
262 | default: | 256 | default: |
263 | dev_err(info->dev, "invalid ADC debounce time\n"); | 257 | dev_err(info->dev, "invalid ADC debounce time\n"); |
@@ -657,6 +651,8 @@ out: | |||
657 | static int __devinit max77693_muic_probe(struct platform_device *pdev) | 651 | static int __devinit max77693_muic_probe(struct platform_device *pdev) |
658 | { | 652 | { |
659 | struct max77693_dev *max77693 = dev_get_drvdata(pdev->dev.parent); | 653 | struct max77693_dev *max77693 = dev_get_drvdata(pdev->dev.parent); |
654 | struct max77693_platform_data *pdata = dev_get_platdata(max77693->dev); | ||
655 | struct max77693_muic_platform_data *muic_pdata = pdata->muic_data; | ||
660 | struct max77693_muic_info *info; | 656 | struct max77693_muic_info *info; |
661 | int ret, i; | 657 | int ret, i; |
662 | u8 id; | 658 | u8 id; |
@@ -727,6 +723,31 @@ static int __devinit max77693_muic_probe(struct platform_device *pdev) | |||
727 | goto err_extcon; | 723 | goto err_extcon; |
728 | } | 724 | } |
729 | 725 | ||
726 | /* Initialize MUIC register by using platform data */ | ||
727 | for (i = 0 ; i < muic_pdata->num_init_data ; i++) { | ||
728 | enum max77693_irq_source irq_src = MAX77693_IRQ_GROUP_NR; | ||
729 | |||
730 | max77693_write_reg(info->max77693->regmap_muic, | ||
731 | muic_pdata->init_data[i].addr, | ||
732 | muic_pdata->init_data[i].data); | ||
733 | |||
734 | switch (muic_pdata->init_data[i].addr) { | ||
735 | case MAX77693_MUIC_REG_INTMASK1: | ||
736 | irq_src = MUIC_INT1; | ||
737 | break; | ||
738 | case MAX77693_MUIC_REG_INTMASK2: | ||
739 | irq_src = MUIC_INT2; | ||
740 | break; | ||
741 | case MAX77693_MUIC_REG_INTMASK3: | ||
742 | irq_src = MUIC_INT3; | ||
743 | break; | ||
744 | } | ||
745 | |||
746 | if (irq_src < MAX77693_IRQ_GROUP_NR) | ||
747 | info->max77693->irq_masks_cur[irq_src] | ||
748 | = muic_pdata->init_data[i].data; | ||
749 | } | ||
750 | |||
730 | /* Check revision number of MUIC device*/ | 751 | /* Check revision number of MUIC device*/ |
731 | ret = max77693_read_reg(info->max77693->regmap_muic, | 752 | ret = max77693_read_reg(info->max77693->regmap_muic, |
732 | MAX77693_MUIC_REG_ID, &id); | 753 | MAX77693_MUIC_REG_ID, &id); |
@@ -762,6 +783,7 @@ static int __devexit max77693_muic_remove(struct platform_device *pdev) | |||
762 | free_irq(muic_irqs[i].virq, info); | 783 | free_irq(muic_irqs[i].virq, info); |
763 | cancel_work_sync(&info->irq_work); | 784 | cancel_work_sync(&info->irq_work); |
764 | extcon_dev_unregister(info->edev); | 785 | extcon_dev_unregister(info->edev); |
786 | kfree(info->edev); | ||
765 | kfree(info); | 787 | kfree(info); |
766 | 788 | ||
767 | return 0; | 789 | return 0; |
diff --git a/drivers/extcon/extcon-max8997.c b/drivers/extcon/extcon-max8997.c index ef9090a4271d..77b66b0cc8f5 100644 --- a/drivers/extcon/extcon-max8997.c +++ b/drivers/extcon/extcon-max8997.c | |||
@@ -271,8 +271,6 @@ out: | |||
271 | static int max8997_muic_handle_charger_type_detach( | 271 | static int max8997_muic_handle_charger_type_detach( |
272 | struct max8997_muic_info *info) | 272 | struct max8997_muic_info *info) |
273 | { | 273 | { |
274 | int ret = 0; | ||
275 | |||
276 | switch (info->pre_charger_type) { | 274 | switch (info->pre_charger_type) { |
277 | case MAX8997_CHARGER_TYPE_USB: | 275 | case MAX8997_CHARGER_TYPE_USB: |
278 | extcon_set_cable_state(info->edev, "USB", false); | 276 | extcon_set_cable_state(info->edev, "USB", false); |
@@ -290,11 +288,11 @@ static int max8997_muic_handle_charger_type_detach( | |||
290 | extcon_set_cable_state(info->edev, "Fast-charger", false); | 288 | extcon_set_cable_state(info->edev, "Fast-charger", false); |
291 | break; | 289 | break; |
292 | default: | 290 | default: |
293 | ret = -EINVAL; | 291 | return -EINVAL; |
294 | break; | 292 | break; |
295 | } | 293 | } |
296 | 294 | ||
297 | return ret; | 295 | return 0; |
298 | } | 296 | } |
299 | 297 | ||
300 | static int max8997_muic_handle_charger_type(struct max8997_muic_info *info, | 298 | static int max8997_muic_handle_charger_type(struct max8997_muic_info *info, |
diff --git a/drivers/gpu/drm/drm_fb_cma_helper.c b/drivers/gpu/drm/drm_fb_cma_helper.c index 09e11a5d921a..fd9d0af4d536 100644 --- a/drivers/gpu/drm/drm_fb_cma_helper.c +++ b/drivers/gpu/drm/drm_fb_cma_helper.c | |||
@@ -206,7 +206,7 @@ static int drm_fbdev_cma_create(struct drm_fb_helper *helper, | |||
206 | size_t size; | 206 | size_t size; |
207 | int ret; | 207 | int ret; |
208 | 208 | ||
209 | DRM_DEBUG_KMS("surface width(%d), height(%d) and bpp(%d\n", | 209 | DRM_DEBUG_KMS("surface width(%d), height(%d) and bpp(%d)\n", |
210 | sizes->surface_width, sizes->surface_height, | 210 | sizes->surface_width, sizes->surface_height, |
211 | sizes->surface_bpp); | 211 | sizes->surface_bpp); |
212 | 212 | ||
@@ -220,7 +220,7 @@ static int drm_fbdev_cma_create(struct drm_fb_helper *helper, | |||
220 | 220 | ||
221 | size = mode_cmd.pitches[0] * mode_cmd.height; | 221 | size = mode_cmd.pitches[0] * mode_cmd.height; |
222 | obj = drm_gem_cma_create(dev, size); | 222 | obj = drm_gem_cma_create(dev, size); |
223 | if (!obj) | 223 | if (IS_ERR(obj)) |
224 | return -ENOMEM; | 224 | return -ENOMEM; |
225 | 225 | ||
226 | fbi = framebuffer_alloc(0, dev->dev); | 226 | fbi = framebuffer_alloc(0, dev->dev); |
diff --git a/drivers/gpu/drm/drm_info.c b/drivers/gpu/drm/drm_info.c index 441ebc1bdbef..d4b20ceda3fb 100644 --- a/drivers/gpu/drm/drm_info.c +++ b/drivers/gpu/drm/drm_info.c | |||
@@ -205,8 +205,6 @@ static int drm_gem_one_name_info(int id, void *ptr, void *data) | |||
205 | struct drm_gem_object *obj = ptr; | 205 | struct drm_gem_object *obj = ptr; |
206 | struct seq_file *m = data; | 206 | struct seq_file *m = data; |
207 | 207 | ||
208 | seq_printf(m, "name %d size %zd\n", obj->name, obj->size); | ||
209 | |||
210 | seq_printf(m, "%6d %8zd %7d %8d\n", | 208 | seq_printf(m, "%6d %8zd %7d %8d\n", |
211 | obj->name, obj->size, | 209 | obj->name, obj->size, |
212 | atomic_read(&obj->handle_count), | 210 | atomic_read(&obj->handle_count), |
diff --git a/drivers/gpu/drm/drm_platform.c b/drivers/gpu/drm/drm_platform.c index aaeb6f8d69ce..b8a282ea8751 100644 --- a/drivers/gpu/drm/drm_platform.c +++ b/drivers/gpu/drm/drm_platform.c | |||
@@ -64,7 +64,6 @@ int drm_get_platform_dev(struct platform_device *platdev, | |||
64 | } | 64 | } |
65 | 65 | ||
66 | if (drm_core_check_feature(dev, DRIVER_MODESET)) { | 66 | if (drm_core_check_feature(dev, DRIVER_MODESET)) { |
67 | dev_set_drvdata(&platdev->dev, dev); | ||
68 | ret = drm_get_minor(dev, &dev->control, DRM_MINOR_CONTROL); | 67 | ret = drm_get_minor(dev, &dev->control, DRM_MINOR_CONTROL); |
69 | if (ret) | 68 | if (ret) |
70 | goto err_g1; | 69 | goto err_g1; |
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c index aac4e5e1a5b9..6770ee6084b4 100644 --- a/drivers/gpu/drm/i915/i915_drv.c +++ b/drivers/gpu/drm/i915/i915_drv.c | |||
@@ -118,6 +118,13 @@ module_param_named(i915_enable_ppgtt, i915_enable_ppgtt, int, 0600); | |||
118 | MODULE_PARM_DESC(i915_enable_ppgtt, | 118 | MODULE_PARM_DESC(i915_enable_ppgtt, |
119 | "Enable PPGTT (default: true)"); | 119 | "Enable PPGTT (default: true)"); |
120 | 120 | ||
121 | unsigned int i915_preliminary_hw_support __read_mostly = 0; | ||
122 | module_param_named(preliminary_hw_support, i915_preliminary_hw_support, int, 0600); | ||
123 | MODULE_PARM_DESC(preliminary_hw_support, | ||
124 | "Enable preliminary hardware support. " | ||
125 | "Enable Haswell and ValleyView Support. " | ||
126 | "(default: false)"); | ||
127 | |||
121 | static struct drm_driver driver; | 128 | static struct drm_driver driver; |
122 | extern int intel_agp_enabled; | 129 | extern int intel_agp_enabled; |
123 | 130 | ||
@@ -826,6 +833,12 @@ i915_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
826 | struct intel_device_info *intel_info = | 833 | struct intel_device_info *intel_info = |
827 | (struct intel_device_info *) ent->driver_data; | 834 | (struct intel_device_info *) ent->driver_data; |
828 | 835 | ||
836 | if (intel_info->is_haswell || intel_info->is_valleyview) | ||
837 | if(!i915_preliminary_hw_support) { | ||
838 | DRM_ERROR("Preliminary hardware support disabled\n"); | ||
839 | return -ENODEV; | ||
840 | } | ||
841 | |||
829 | /* Only bind to function 0 of the device. Early generations | 842 | /* Only bind to function 0 of the device. Early generations |
830 | * used function 1 as a placeholder for multi-head. This causes | 843 | * used function 1 as a placeholder for multi-head. This causes |
831 | * us confusion instead, especially on the systems where both | 844 | * us confusion instead, especially on the systems where both |
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index b84f7861e438..f511fa2f4168 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h | |||
@@ -1217,6 +1217,7 @@ extern int i915_enable_rc6 __read_mostly; | |||
1217 | extern int i915_enable_fbc __read_mostly; | 1217 | extern int i915_enable_fbc __read_mostly; |
1218 | extern bool i915_enable_hangcheck __read_mostly; | 1218 | extern bool i915_enable_hangcheck __read_mostly; |
1219 | extern int i915_enable_ppgtt __read_mostly; | 1219 | extern int i915_enable_ppgtt __read_mostly; |
1220 | extern unsigned int i915_preliminary_hw_support __read_mostly; | ||
1220 | 1221 | ||
1221 | extern int i915_suspend(struct drm_device *dev, pm_message_t state); | 1222 | extern int i915_suspend(struct drm_device *dev, pm_message_t state); |
1222 | extern int i915_resume(struct drm_device *dev); | 1223 | extern int i915_resume(struct drm_device *dev); |
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index d33d02d13c96..107f09befe92 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c | |||
@@ -1407,8 +1407,10 @@ out: | |||
1407 | return VM_FAULT_NOPAGE; | 1407 | return VM_FAULT_NOPAGE; |
1408 | case -ENOMEM: | 1408 | case -ENOMEM: |
1409 | return VM_FAULT_OOM; | 1409 | return VM_FAULT_OOM; |
1410 | case -ENOSPC: | ||
1411 | return VM_FAULT_SIGBUS; | ||
1410 | default: | 1412 | default: |
1411 | WARN_ON_ONCE(ret); | 1413 | WARN_ONCE(ret, "unhandled error in i915_gem_fault: %i\n", ret); |
1412 | return VM_FAULT_SIGBUS; | 1414 | return VM_FAULT_SIGBUS; |
1413 | } | 1415 | } |
1414 | } | 1416 | } |
@@ -1822,10 +1824,11 @@ i915_gem_object_get_pages_gtt(struct drm_i915_gem_object *obj) | |||
1822 | sg_set_page(sg, page, PAGE_SIZE, 0); | 1824 | sg_set_page(sg, page, PAGE_SIZE, 0); |
1823 | } | 1825 | } |
1824 | 1826 | ||
1827 | obj->pages = st; | ||
1828 | |||
1825 | if (i915_gem_object_needs_bit17_swizzle(obj)) | 1829 | if (i915_gem_object_needs_bit17_swizzle(obj)) |
1826 | i915_gem_object_do_bit_17_swizzle(obj); | 1830 | i915_gem_object_do_bit_17_swizzle(obj); |
1827 | 1831 | ||
1828 | obj->pages = st; | ||
1829 | return 0; | 1832 | return 0; |
1830 | 1833 | ||
1831 | err_pages: | 1834 | err_pages: |
diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c index 893f30164b7e..f78061af7045 100644 --- a/drivers/gpu/drm/i915/intel_crt.c +++ b/drivers/gpu/drm/i915/intel_crt.c | |||
@@ -219,20 +219,7 @@ static void intel_crt_mode_set(struct drm_encoder *encoder, | |||
219 | intel_encoder_to_crt(to_intel_encoder(encoder)); | 219 | intel_encoder_to_crt(to_intel_encoder(encoder)); |
220 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); | 220 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); |
221 | struct drm_i915_private *dev_priv = dev->dev_private; | 221 | struct drm_i915_private *dev_priv = dev->dev_private; |
222 | int dpll_md_reg; | 222 | u32 adpa; |
223 | u32 adpa, dpll_md; | ||
224 | |||
225 | dpll_md_reg = DPLL_MD(intel_crtc->pipe); | ||
226 | |||
227 | /* | ||
228 | * Disable separate mode multiplier used when cloning SDVO to CRT | ||
229 | * XXX this needs to be adjusted when we really are cloning | ||
230 | */ | ||
231 | if (INTEL_INFO(dev)->gen >= 4 && !HAS_PCH_SPLIT(dev)) { | ||
232 | dpll_md = I915_READ(dpll_md_reg); | ||
233 | I915_WRITE(dpll_md_reg, | ||
234 | dpll_md & ~DPLL_MD_UDI_MULTIPLIER_MASK); | ||
235 | } | ||
236 | 223 | ||
237 | adpa = ADPA_HOTPLUG_BITS; | 224 | adpa = ADPA_HOTPLUG_BITS; |
238 | if (adjusted_mode->flags & DRM_MODE_FLAG_PHSYNC) | 225 | if (adjusted_mode->flags & DRM_MODE_FLAG_PHSYNC) |
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 682bd3729baf..461a637f1ef7 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
@@ -7892,6 +7892,34 @@ struct intel_quirk { | |||
7892 | void (*hook)(struct drm_device *dev); | 7892 | void (*hook)(struct drm_device *dev); |
7893 | }; | 7893 | }; |
7894 | 7894 | ||
7895 | /* For systems that don't have a meaningful PCI subdevice/subvendor ID */ | ||
7896 | struct intel_dmi_quirk { | ||
7897 | void (*hook)(struct drm_device *dev); | ||
7898 | const struct dmi_system_id (*dmi_id_list)[]; | ||
7899 | }; | ||
7900 | |||
7901 | static int intel_dmi_reverse_brightness(const struct dmi_system_id *id) | ||
7902 | { | ||
7903 | DRM_INFO("Backlight polarity reversed on %s\n", id->ident); | ||
7904 | return 1; | ||
7905 | } | ||
7906 | |||
7907 | static const struct intel_dmi_quirk intel_dmi_quirks[] = { | ||
7908 | { | ||
7909 | .dmi_id_list = &(const struct dmi_system_id[]) { | ||
7910 | { | ||
7911 | .callback = intel_dmi_reverse_brightness, | ||
7912 | .ident = "NCR Corporation", | ||
7913 | .matches = {DMI_MATCH(DMI_SYS_VENDOR, "NCR Corporation"), | ||
7914 | DMI_MATCH(DMI_PRODUCT_NAME, ""), | ||
7915 | }, | ||
7916 | }, | ||
7917 | { } /* terminating entry */ | ||
7918 | }, | ||
7919 | .hook = quirk_invert_brightness, | ||
7920 | }, | ||
7921 | }; | ||
7922 | |||
7895 | static struct intel_quirk intel_quirks[] = { | 7923 | static struct intel_quirk intel_quirks[] = { |
7896 | /* HP Mini needs pipe A force quirk (LP: #322104) */ | 7924 | /* HP Mini needs pipe A force quirk (LP: #322104) */ |
7897 | { 0x27ae, 0x103c, 0x361a, quirk_pipea_force }, | 7925 | { 0x27ae, 0x103c, 0x361a, quirk_pipea_force }, |
@@ -7931,6 +7959,10 @@ static void intel_init_quirks(struct drm_device *dev) | |||
7931 | q->subsystem_device == PCI_ANY_ID)) | 7959 | q->subsystem_device == PCI_ANY_ID)) |
7932 | q->hook(dev); | 7960 | q->hook(dev); |
7933 | } | 7961 | } |
7962 | for (i = 0; i < ARRAY_SIZE(intel_dmi_quirks); i++) { | ||
7963 | if (dmi_check_system(*intel_dmi_quirks[i].dmi_id_list) != 0) | ||
7964 | intel_dmi_quirks[i].hook(dev); | ||
7965 | } | ||
7934 | } | 7966 | } |
7935 | 7967 | ||
7936 | /* Disable the VGA plane that we never use */ | 7968 | /* Disable the VGA plane that we never use */ |
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index 1b727a5c9ee5..368ed8ef1600 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c | |||
@@ -1797,7 +1797,8 @@ intel_dp_start_link_train(struct intel_dp *intel_dp) | |||
1797 | if ((intel_dp->train_set[i] & DP_TRAIN_MAX_SWING_REACHED) == 0) | 1797 | if ((intel_dp->train_set[i] & DP_TRAIN_MAX_SWING_REACHED) == 0) |
1798 | break; | 1798 | break; |
1799 | if (i == intel_dp->lane_count && voltage_tries == 5) { | 1799 | if (i == intel_dp->lane_count && voltage_tries == 5) { |
1800 | if (++loop_tries == 5) { | 1800 | ++loop_tries; |
1801 | if (loop_tries == 5) { | ||
1801 | DRM_DEBUG_KMS("too many full retries, give up\n"); | 1802 | DRM_DEBUG_KMS("too many full retries, give up\n"); |
1802 | break; | 1803 | break; |
1803 | } | 1804 | } |
@@ -1807,11 +1808,15 @@ intel_dp_start_link_train(struct intel_dp *intel_dp) | |||
1807 | } | 1808 | } |
1808 | 1809 | ||
1809 | /* Check to see if we've tried the same voltage 5 times */ | 1810 | /* Check to see if we've tried the same voltage 5 times */ |
1810 | if ((intel_dp->train_set[0] & DP_TRAIN_VOLTAGE_SWING_MASK) != voltage) { | 1811 | if ((intel_dp->train_set[0] & DP_TRAIN_VOLTAGE_SWING_MASK) == voltage) { |
1811 | voltage = intel_dp->train_set[0] & DP_TRAIN_VOLTAGE_SWING_MASK; | ||
1812 | voltage_tries = 0; | ||
1813 | } else | ||
1814 | ++voltage_tries; | 1812 | ++voltage_tries; |
1813 | if (voltage_tries == 5) { | ||
1814 | DRM_DEBUG_KMS("too many voltage retries, give up\n"); | ||
1815 | break; | ||
1816 | } | ||
1817 | } else | ||
1818 | voltage_tries = 0; | ||
1819 | voltage = intel_dp->train_set[0] & DP_TRAIN_VOLTAGE_SWING_MASK; | ||
1815 | 1820 | ||
1816 | /* Compute new intel_dp->train_set as requested by target */ | 1821 | /* Compute new intel_dp->train_set as requested by target */ |
1817 | intel_get_adjust_train(intel_dp, link_status); | 1822 | intel_get_adjust_train(intel_dp, link_status); |
diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c index e3166df55daa..edba93b3474b 100644 --- a/drivers/gpu/drm/i915/intel_lvds.c +++ b/drivers/gpu/drm/i915/intel_lvds.c | |||
@@ -777,6 +777,14 @@ static const struct dmi_system_id intel_no_lvds[] = { | |||
777 | DMI_MATCH(DMI_BOARD_NAME, "D525TUD"), | 777 | DMI_MATCH(DMI_BOARD_NAME, "D525TUD"), |
778 | }, | 778 | }, |
779 | }, | 779 | }, |
780 | { | ||
781 | .callback = intel_no_lvds_dmi_callback, | ||
782 | .ident = "Supermicro X7SPA-H", | ||
783 | .matches = { | ||
784 | DMI_MATCH(DMI_SYS_VENDOR, "Supermicro"), | ||
785 | DMI_MATCH(DMI_PRODUCT_NAME, "X7SPA-H"), | ||
786 | }, | ||
787 | }, | ||
780 | 788 | ||
781 | { } /* terminating entry */ | 789 | { } /* terminating entry */ |
782 | }; | 790 | }; |
diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c index 0007a4d9bf6e..c01d97db0061 100644 --- a/drivers/gpu/drm/i915/intel_sdvo.c +++ b/drivers/gpu/drm/i915/intel_sdvo.c | |||
@@ -139,6 +139,11 @@ struct intel_sdvo { | |||
139 | 139 | ||
140 | /* DDC bus used by this SDVO encoder */ | 140 | /* DDC bus used by this SDVO encoder */ |
141 | uint8_t ddc_bus; | 141 | uint8_t ddc_bus; |
142 | |||
143 | /* | ||
144 | * the sdvo flag gets lost in round trip: dtd->adjusted_mode->dtd | ||
145 | */ | ||
146 | uint8_t dtd_sdvo_flags; | ||
142 | }; | 147 | }; |
143 | 148 | ||
144 | struct intel_sdvo_connector { | 149 | struct intel_sdvo_connector { |
@@ -984,6 +989,7 @@ intel_sdvo_get_preferred_input_mode(struct intel_sdvo *intel_sdvo, | |||
984 | return false; | 989 | return false; |
985 | 990 | ||
986 | intel_sdvo_get_mode_from_dtd(adjusted_mode, &input_dtd); | 991 | intel_sdvo_get_mode_from_dtd(adjusted_mode, &input_dtd); |
992 | intel_sdvo->dtd_sdvo_flags = input_dtd.part2.sdvo_flags; | ||
987 | 993 | ||
988 | return true; | 994 | return true; |
989 | } | 995 | } |
@@ -1092,6 +1098,8 @@ static void intel_sdvo_mode_set(struct drm_encoder *encoder, | |||
1092 | * adjusted_mode. | 1098 | * adjusted_mode. |
1093 | */ | 1099 | */ |
1094 | intel_sdvo_get_dtd_from_mode(&input_dtd, adjusted_mode); | 1100 | intel_sdvo_get_dtd_from_mode(&input_dtd, adjusted_mode); |
1101 | if (intel_sdvo->is_tv || intel_sdvo->is_lvds) | ||
1102 | input_dtd.part2.sdvo_flags = intel_sdvo->dtd_sdvo_flags; | ||
1095 | if (!intel_sdvo_set_input_timing(intel_sdvo, &input_dtd)) | 1103 | if (!intel_sdvo_set_input_timing(intel_sdvo, &input_dtd)) |
1096 | DRM_INFO("Setting input timings on %s failed\n", | 1104 | DRM_INFO("Setting input timings on %s failed\n", |
1097 | SDVO_NAME(intel_sdvo)); | 1105 | SDVO_NAME(intel_sdvo)); |
@@ -2277,10 +2285,8 @@ intel_sdvo_lvds_init(struct intel_sdvo *intel_sdvo, int device) | |||
2277 | intel_sdvo_connector->output_flag = SDVO_OUTPUT_LVDS1; | 2285 | intel_sdvo_connector->output_flag = SDVO_OUTPUT_LVDS1; |
2278 | } | 2286 | } |
2279 | 2287 | ||
2280 | /* SDVO LVDS is cloneable because the SDVO encoder does the upscaling, | 2288 | /* SDVO LVDS is not cloneable because the input mode gets adjusted by the encoder */ |
2281 | * as opposed to native LVDS, where we upscale with the panel-fitter | 2289 | intel_sdvo->base.cloneable = false; |
2282 | * (and hence only the native LVDS resolution could be cloned). */ | ||
2283 | intel_sdvo->base.cloneable = true; | ||
2284 | 2290 | ||
2285 | intel_sdvo_connector_init(intel_sdvo_connector, intel_sdvo); | 2291 | intel_sdvo_connector_init(intel_sdvo_connector, intel_sdvo); |
2286 | if (!intel_sdvo_create_enhance_property(intel_sdvo, intel_sdvo_connector)) | 2292 | if (!intel_sdvo_create_enhance_property(intel_sdvo, intel_sdvo_connector)) |
diff --git a/drivers/gpu/drm/nouveau/core/core/gpuobj.c b/drivers/gpu/drm/nouveau/core/core/gpuobj.c index 1f34549aff18..70586fde69cf 100644 --- a/drivers/gpu/drm/nouveau/core/core/gpuobj.c +++ b/drivers/gpu/drm/nouveau/core/core/gpuobj.c | |||
@@ -39,6 +39,11 @@ nouveau_gpuobj_destroy(struct nouveau_gpuobj *gpuobj) | |||
39 | nv_wo32(gpuobj, i, 0x00000000); | 39 | nv_wo32(gpuobj, i, 0x00000000); |
40 | } | 40 | } |
41 | 41 | ||
42 | if (gpuobj->node) { | ||
43 | nouveau_mm_free(&nv_gpuobj(gpuobj->parent)->heap, | ||
44 | &gpuobj->node); | ||
45 | } | ||
46 | |||
42 | if (gpuobj->heap.block_size) | 47 | if (gpuobj->heap.block_size) |
43 | nouveau_mm_fini(&gpuobj->heap); | 48 | nouveau_mm_fini(&gpuobj->heap); |
44 | 49 | ||
diff --git a/drivers/gpu/drm/nouveau/core/core/mm.c b/drivers/gpu/drm/nouveau/core/core/mm.c index bfddf87926dd..4d6206448670 100644 --- a/drivers/gpu/drm/nouveau/core/core/mm.c +++ b/drivers/gpu/drm/nouveau/core/core/mm.c | |||
@@ -236,7 +236,7 @@ nouveau_mm_fini(struct nouveau_mm *mm) | |||
236 | int nodes = 0; | 236 | int nodes = 0; |
237 | 237 | ||
238 | list_for_each_entry(node, &mm->nodes, nl_entry) { | 238 | list_for_each_entry(node, &mm->nodes, nl_entry) { |
239 | if (nodes++ == mm->heap_nodes) | 239 | if (WARN_ON(nodes++ == mm->heap_nodes)) |
240 | return -EBUSY; | 240 | return -EBUSY; |
241 | } | 241 | } |
242 | 242 | ||
diff --git a/drivers/gpu/drm/nouveau/core/subdev/bios/base.c b/drivers/gpu/drm/nouveau/core/subdev/bios/base.c index dcb5c2befc92..70ca7d5a1aa1 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/bios/base.c +++ b/drivers/gpu/drm/nouveau/core/subdev/bios/base.c | |||
@@ -72,7 +72,7 @@ nouveau_bios_shadow_of(struct nouveau_bios *bios) | |||
72 | } | 72 | } |
73 | 73 | ||
74 | data = of_get_property(dn, "NVDA,BMP", &size); | 74 | data = of_get_property(dn, "NVDA,BMP", &size); |
75 | if (data) { | 75 | if (data && size) { |
76 | bios->size = size; | 76 | bios->size = size; |
77 | bios->data = kmalloc(bios->size, GFP_KERNEL); | 77 | bios->data = kmalloc(bios->size, GFP_KERNEL); |
78 | if (bios->data) | 78 | if (bios->data) |
@@ -104,6 +104,9 @@ nouveau_bios_shadow_pramin(struct nouveau_bios *bios) | |||
104 | goto out; | 104 | goto out; |
105 | 105 | ||
106 | bios->size = nv_rd08(bios, 0x700002) * 512; | 106 | bios->size = nv_rd08(bios, 0x700002) * 512; |
107 | if (!bios->size) | ||
108 | goto out; | ||
109 | |||
107 | bios->data = kmalloc(bios->size, GFP_KERNEL); | 110 | bios->data = kmalloc(bios->size, GFP_KERNEL); |
108 | if (bios->data) { | 111 | if (bios->data) { |
109 | for (i = 0; i < bios->size; i++) | 112 | for (i = 0; i < bios->size; i++) |
@@ -155,6 +158,9 @@ nouveau_bios_shadow_prom(struct nouveau_bios *bios) | |||
155 | 158 | ||
156 | /* read entire bios image to system memory */ | 159 | /* read entire bios image to system memory */ |
157 | bios->size = nv_rd08(bios, 0x300002) * 512; | 160 | bios->size = nv_rd08(bios, 0x300002) * 512; |
161 | if (!bios->size) | ||
162 | goto out; | ||
163 | |||
158 | bios->data = kmalloc(bios->size, GFP_KERNEL); | 164 | bios->data = kmalloc(bios->size, GFP_KERNEL); |
159 | if (bios->data) { | 165 | if (bios->data) { |
160 | for (i = 0; i < bios->size; i++) | 166 | for (i = 0; i < bios->size; i++) |
@@ -186,14 +192,22 @@ nouveau_bios_shadow_acpi(struct nouveau_bios *bios) | |||
186 | { | 192 | { |
187 | struct pci_dev *pdev = nv_device(bios)->pdev; | 193 | struct pci_dev *pdev = nv_device(bios)->pdev; |
188 | int ret, cnt, i; | 194 | int ret, cnt, i; |
189 | u8 data[3]; | ||
190 | 195 | ||
191 | if (!nouveau_acpi_rom_supported(pdev)) | 196 | if (!nouveau_acpi_rom_supported(pdev)) { |
197 | bios->data = NULL; | ||
192 | return; | 198 | return; |
199 | } | ||
193 | 200 | ||
194 | bios->size = 0; | 201 | bios->size = 0; |
195 | if (nouveau_acpi_get_bios_chunk(data, 0, 3) == 3) | 202 | bios->data = kmalloc(4096, GFP_KERNEL); |
196 | bios->size = data[2] * 512; | 203 | if (bios->data) { |
204 | if (nouveau_acpi_get_bios_chunk(bios->data, 0, 4096) == 4096) | ||
205 | bios->size = bios->data[2] * 512; | ||
206 | kfree(bios->data); | ||
207 | } | ||
208 | |||
209 | if (!bios->size) | ||
210 | return; | ||
197 | 211 | ||
198 | bios->data = kmalloc(bios->size, GFP_KERNEL); | 212 | bios->data = kmalloc(bios->size, GFP_KERNEL); |
199 | for (i = 0; bios->data && i < bios->size; i += cnt) { | 213 | for (i = 0; bios->data && i < bios->size; i += cnt) { |
@@ -229,12 +243,14 @@ nouveau_bios_shadow_pci(struct nouveau_bios *bios) | |||
229 | static int | 243 | static int |
230 | nouveau_bios_score(struct nouveau_bios *bios, const bool writeable) | 244 | nouveau_bios_score(struct nouveau_bios *bios, const bool writeable) |
231 | { | 245 | { |
232 | if (!bios->data || bios->data[0] != 0x55 || bios->data[1] != 0xAA) { | 246 | if (bios->size < 3 || !bios->data || bios->data[0] != 0x55 || |
247 | bios->data[1] != 0xAA) { | ||
233 | nv_info(bios, "... signature not found\n"); | 248 | nv_info(bios, "... signature not found\n"); |
234 | return 0; | 249 | return 0; |
235 | } | 250 | } |
236 | 251 | ||
237 | if (nvbios_checksum(bios->data, bios->data[2] * 512)) { | 252 | if (nvbios_checksum(bios->data, |
253 | min_t(u32, bios->data[2] * 512, bios->size))) { | ||
238 | nv_info(bios, "... checksum invalid\n"); | 254 | nv_info(bios, "... checksum invalid\n"); |
239 | /* if a ro image is somewhat bad, it's probably all rubbish */ | 255 | /* if a ro image is somewhat bad, it's probably all rubbish */ |
240 | return writeable ? 2 : 1; | 256 | return writeable ? 2 : 1; |
diff --git a/drivers/gpu/drm/nouveau/core/subdev/bios/pll.c b/drivers/gpu/drm/nouveau/core/subdev/bios/pll.c index 5e5f4cddae3c..f835501203e5 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/bios/pll.c +++ b/drivers/gpu/drm/nouveau/core/subdev/bios/pll.c | |||
@@ -157,11 +157,10 @@ pll_map_reg(struct nouveau_bios *bios, u32 reg, u32 *type, u8 *ver, u8 *len) | |||
157 | while (map->reg) { | 157 | while (map->reg) { |
158 | if (map->reg == reg && *ver >= 0x20) { | 158 | if (map->reg == reg && *ver >= 0x20) { |
159 | u16 addr = (data += hdr); | 159 | u16 addr = (data += hdr); |
160 | *type = map->type; | ||
160 | while (cnt--) { | 161 | while (cnt--) { |
161 | if (nv_ro32(bios, data) == map->reg) { | 162 | if (nv_ro32(bios, data) == map->reg) |
162 | *type = map->type; | ||
163 | return data; | 163 | return data; |
164 | } | ||
165 | data += *len; | 164 | data += *len; |
166 | } | 165 | } |
167 | return addr; | 166 | return addr; |
@@ -200,11 +199,10 @@ pll_map_type(struct nouveau_bios *bios, u8 type, u32 *reg, u8 *ver, u8 *len) | |||
200 | while (map->reg) { | 199 | while (map->reg) { |
201 | if (map->type == type && *ver >= 0x20) { | 200 | if (map->type == type && *ver >= 0x20) { |
202 | u16 addr = (data += hdr); | 201 | u16 addr = (data += hdr); |
202 | *reg = map->reg; | ||
203 | while (cnt--) { | 203 | while (cnt--) { |
204 | if (nv_ro32(bios, data) == map->reg) { | 204 | if (nv_ro32(bios, data) == map->reg) |
205 | *reg = map->reg; | ||
206 | return data; | 205 | return data; |
207 | } | ||
208 | data += *len; | 206 | data += *len; |
209 | } | 207 | } |
210 | return addr; | 208 | return addr; |
diff --git a/drivers/gpu/drm/nouveau/core/subdev/fb/nv50.c b/drivers/gpu/drm/nouveau/core/subdev/fb/nv50.c index 42d7539e6525..27fb1af7a779 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/fb/nv50.c +++ b/drivers/gpu/drm/nouveau/core/subdev/fb/nv50.c | |||
@@ -237,6 +237,7 @@ nv50_fb_ctor(struct nouveau_object *parent, struct nouveau_object *engine, | |||
237 | return ret; | 237 | return ret; |
238 | 238 | ||
239 | priv->base.ram.stolen = (u64)nv_rd32(priv, 0x100e10) << 12; | 239 | priv->base.ram.stolen = (u64)nv_rd32(priv, 0x100e10) << 12; |
240 | priv->base.ram.type = NV_MEM_TYPE_STOLEN; | ||
240 | break; | 241 | break; |
241 | default: | 242 | default: |
242 | ret = nouveau_mm_init(&priv->base.vram, rsvd_head, size, | 243 | ret = nouveau_mm_init(&priv->base.vram, rsvd_head, size, |
diff --git a/drivers/gpu/drm/nouveau/core/subdev/vm/nv41.c b/drivers/gpu/drm/nouveau/core/subdev/vm/nv41.c index 0203e1e12caa..49050d991e75 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/vm/nv41.c +++ b/drivers/gpu/drm/nouveau/core/subdev/vm/nv41.c | |||
@@ -92,7 +92,8 @@ nv41_vmmgr_ctor(struct nouveau_object *parent, struct nouveau_object *engine, | |||
92 | struct nv04_vmmgr_priv *priv; | 92 | struct nv04_vmmgr_priv *priv; |
93 | int ret; | 93 | int ret; |
94 | 94 | ||
95 | if (!nouveau_boolopt(device->cfgopt, "NvPCIE", true)) { | 95 | if (pci_find_capability(device->pdev, PCI_CAP_ID_AGP) || |
96 | !nouveau_boolopt(device->cfgopt, "NvPCIE", true)) { | ||
96 | return nouveau_object_ctor(parent, engine, &nv04_vmmgr_oclass, | 97 | return nouveau_object_ctor(parent, engine, &nv04_vmmgr_oclass, |
97 | data, size, pobject); | 98 | data, size, pobject); |
98 | } | 99 | } |
diff --git a/drivers/gpu/drm/nouveau/core/subdev/vm/nv44.c b/drivers/gpu/drm/nouveau/core/subdev/vm/nv44.c index 0ac18d05a146..aa8131436e3d 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/vm/nv44.c +++ b/drivers/gpu/drm/nouveau/core/subdev/vm/nv44.c | |||
@@ -163,7 +163,8 @@ nv44_vmmgr_ctor(struct nouveau_object *parent, struct nouveau_object *engine, | |||
163 | struct nv04_vmmgr_priv *priv; | 163 | struct nv04_vmmgr_priv *priv; |
164 | int ret; | 164 | int ret; |
165 | 165 | ||
166 | if (!nouveau_boolopt(device->cfgopt, "NvPCIE", true)) { | 166 | if (pci_find_capability(device->pdev, PCI_CAP_ID_AGP) || |
167 | !nouveau_boolopt(device->cfgopt, "NvPCIE", true)) { | ||
167 | return nouveau_object_ctor(parent, engine, &nv04_vmmgr_oclass, | 168 | return nouveau_object_ctor(parent, engine, &nv04_vmmgr_oclass, |
168 | data, size, pobject); | 169 | data, size, pobject); |
169 | } | 170 | } |
diff --git a/drivers/gpu/drm/nouveau/nouveau_display.c b/drivers/gpu/drm/nouveau/nouveau_display.c index 8f98e5a8c488..d2f8ffeed742 100644 --- a/drivers/gpu/drm/nouveau/nouveau_display.c +++ b/drivers/gpu/drm/nouveau/nouveau_display.c | |||
@@ -530,9 +530,11 @@ nouveau_page_flip_reserve(struct nouveau_bo *old_bo, | |||
530 | if (ret) | 530 | if (ret) |
531 | goto fail; | 531 | goto fail; |
532 | 532 | ||
533 | ret = ttm_bo_reserve(&old_bo->bo, false, false, false, 0); | 533 | if (likely(old_bo != new_bo)) { |
534 | if (ret) | 534 | ret = ttm_bo_reserve(&old_bo->bo, false, false, false, 0); |
535 | goto fail_unreserve; | 535 | if (ret) |
536 | goto fail_unreserve; | ||
537 | } | ||
536 | 538 | ||
537 | return 0; | 539 | return 0; |
538 | 540 | ||
@@ -551,8 +553,10 @@ nouveau_page_flip_unreserve(struct nouveau_bo *old_bo, | |||
551 | nouveau_bo_fence(new_bo, fence); | 553 | nouveau_bo_fence(new_bo, fence); |
552 | ttm_bo_unreserve(&new_bo->bo); | 554 | ttm_bo_unreserve(&new_bo->bo); |
553 | 555 | ||
554 | nouveau_bo_fence(old_bo, fence); | 556 | if (likely(old_bo != new_bo)) { |
555 | ttm_bo_unreserve(&old_bo->bo); | 557 | nouveau_bo_fence(old_bo, fence); |
558 | ttm_bo_unreserve(&old_bo->bo); | ||
559 | } | ||
556 | 560 | ||
557 | nouveau_bo_unpin(old_bo); | 561 | nouveau_bo_unpin(old_bo); |
558 | } | 562 | } |
diff --git a/drivers/gpu/drm/radeon/atombios_encoders.c b/drivers/gpu/drm/radeon/atombios_encoders.c index 49cbb3795a10..ba498f8e47a2 100644 --- a/drivers/gpu/drm/radeon/atombios_encoders.c +++ b/drivers/gpu/drm/radeon/atombios_encoders.c | |||
@@ -184,6 +184,7 @@ void radeon_atom_backlight_init(struct radeon_encoder *radeon_encoder, | |||
184 | struct radeon_backlight_privdata *pdata; | 184 | struct radeon_backlight_privdata *pdata; |
185 | struct radeon_encoder_atom_dig *dig; | 185 | struct radeon_encoder_atom_dig *dig; |
186 | u8 backlight_level; | 186 | u8 backlight_level; |
187 | char bl_name[16]; | ||
187 | 188 | ||
188 | if (!radeon_encoder->enc_priv) | 189 | if (!radeon_encoder->enc_priv) |
189 | return; | 190 | return; |
@@ -203,7 +204,9 @@ void radeon_atom_backlight_init(struct radeon_encoder *radeon_encoder, | |||
203 | memset(&props, 0, sizeof(props)); | 204 | memset(&props, 0, sizeof(props)); |
204 | props.max_brightness = RADEON_MAX_BL_LEVEL; | 205 | props.max_brightness = RADEON_MAX_BL_LEVEL; |
205 | props.type = BACKLIGHT_RAW; | 206 | props.type = BACKLIGHT_RAW; |
206 | bd = backlight_device_register("radeon_bl", &drm_connector->kdev, | 207 | snprintf(bl_name, sizeof(bl_name), |
208 | "radeon_bl%d", dev->primary->index); | ||
209 | bd = backlight_device_register(bl_name, &drm_connector->kdev, | ||
207 | pdata, &radeon_atom_backlight_ops, &props); | 210 | pdata, &radeon_atom_backlight_ops, &props); |
208 | if (IS_ERR(bd)) { | 211 | if (IS_ERR(bd)) { |
209 | DRM_ERROR("Backlight registration failed\n"); | 212 | DRM_ERROR("Backlight registration failed\n"); |
diff --git a/drivers/gpu/drm/radeon/evergreen_cs.c b/drivers/gpu/drm/radeon/evergreen_cs.c index 573ed1bc6cf7..30271b641913 100644 --- a/drivers/gpu/drm/radeon/evergreen_cs.c +++ b/drivers/gpu/drm/radeon/evergreen_cs.c | |||
@@ -2829,6 +2829,7 @@ static bool evergreen_vm_reg_valid(u32 reg) | |||
2829 | case CAYMAN_SQ_EX_ALLOC_TABLE_SLOTS: | 2829 | case CAYMAN_SQ_EX_ALLOC_TABLE_SLOTS: |
2830 | return true; | 2830 | return true; |
2831 | default: | 2831 | default: |
2832 | DRM_ERROR("Invalid register 0x%x in CS\n", reg); | ||
2832 | return false; | 2833 | return false; |
2833 | } | 2834 | } |
2834 | } | 2835 | } |
diff --git a/drivers/gpu/drm/radeon/ni.c b/drivers/gpu/drm/radeon/ni.c index 8c74c729586d..81e6a568c29d 100644 --- a/drivers/gpu/drm/radeon/ni.c +++ b/drivers/gpu/drm/radeon/ni.c | |||
@@ -1538,26 +1538,31 @@ void cayman_vm_set_page(struct radeon_device *rdev, uint64_t pe, | |||
1538 | { | 1538 | { |
1539 | struct radeon_ring *ring = &rdev->ring[rdev->asic->vm.pt_ring_index]; | 1539 | struct radeon_ring *ring = &rdev->ring[rdev->asic->vm.pt_ring_index]; |
1540 | uint32_t r600_flags = cayman_vm_page_flags(rdev, flags); | 1540 | uint32_t r600_flags = cayman_vm_page_flags(rdev, flags); |
1541 | int i; | ||
1542 | 1541 | ||
1543 | radeon_ring_write(ring, PACKET3(PACKET3_ME_WRITE, 1 + count * 2)); | 1542 | while (count) { |
1544 | radeon_ring_write(ring, pe); | 1543 | unsigned ndw = 1 + count * 2; |
1545 | radeon_ring_write(ring, upper_32_bits(pe) & 0xff); | 1544 | if (ndw > 0x3FFF) |
1546 | for (i = 0; i < count; ++i) { | 1545 | ndw = 0x3FFF; |
1547 | uint64_t value = 0; | 1546 | |
1548 | if (flags & RADEON_VM_PAGE_SYSTEM) { | 1547 | radeon_ring_write(ring, PACKET3(PACKET3_ME_WRITE, ndw)); |
1549 | value = radeon_vm_map_gart(rdev, addr); | 1548 | radeon_ring_write(ring, pe); |
1550 | value &= 0xFFFFFFFFFFFFF000ULL; | 1549 | radeon_ring_write(ring, upper_32_bits(pe) & 0xff); |
1551 | addr += incr; | 1550 | for (; ndw > 1; ndw -= 2, --count, pe += 8) { |
1552 | 1551 | uint64_t value = 0; | |
1553 | } else if (flags & RADEON_VM_PAGE_VALID) { | 1552 | if (flags & RADEON_VM_PAGE_SYSTEM) { |
1554 | value = addr; | 1553 | value = radeon_vm_map_gart(rdev, addr); |
1555 | addr += incr; | 1554 | value &= 0xFFFFFFFFFFFFF000ULL; |
1556 | } | 1555 | addr += incr; |
1556 | |||
1557 | } else if (flags & RADEON_VM_PAGE_VALID) { | ||
1558 | value = addr; | ||
1559 | addr += incr; | ||
1560 | } | ||
1557 | 1561 | ||
1558 | value |= r600_flags; | 1562 | value |= r600_flags; |
1559 | radeon_ring_write(ring, value); | 1563 | radeon_ring_write(ring, value); |
1560 | radeon_ring_write(ring, upper_32_bits(value)); | 1564 | radeon_ring_write(ring, upper_32_bits(value)); |
1565 | } | ||
1561 | } | 1566 | } |
1562 | } | 1567 | } |
1563 | 1568 | ||
@@ -1586,4 +1591,8 @@ void cayman_vm_flush(struct radeon_device *rdev, int ridx, struct radeon_vm *vm) | |||
1586 | /* bits 0-7 are the VM contexts0-7 */ | 1591 | /* bits 0-7 are the VM contexts0-7 */ |
1587 | radeon_ring_write(ring, PACKET0(VM_INVALIDATE_REQUEST, 0)); | 1592 | radeon_ring_write(ring, PACKET0(VM_INVALIDATE_REQUEST, 0)); |
1588 | radeon_ring_write(ring, 1 << vm->id); | 1593 | radeon_ring_write(ring, 1 << vm->id); |
1594 | |||
1595 | /* sync PFP to ME, otherwise we might get invalid PFP reads */ | ||
1596 | radeon_ring_write(ring, PACKET3(PACKET3_PFP_SYNC_ME, 0)); | ||
1597 | radeon_ring_write(ring, 0x0); | ||
1589 | } | 1598 | } |
diff --git a/drivers/gpu/drm/radeon/nid.h b/drivers/gpu/drm/radeon/nid.h index 2423d1b5d385..cbef6815907a 100644 --- a/drivers/gpu/drm/radeon/nid.h +++ b/drivers/gpu/drm/radeon/nid.h | |||
@@ -502,6 +502,7 @@ | |||
502 | #define PACKET3_MPEG_INDEX 0x3A | 502 | #define PACKET3_MPEG_INDEX 0x3A |
503 | #define PACKET3_WAIT_REG_MEM 0x3C | 503 | #define PACKET3_WAIT_REG_MEM 0x3C |
504 | #define PACKET3_MEM_WRITE 0x3D | 504 | #define PACKET3_MEM_WRITE 0x3D |
505 | #define PACKET3_PFP_SYNC_ME 0x42 | ||
505 | #define PACKET3_SURFACE_SYNC 0x43 | 506 | #define PACKET3_SURFACE_SYNC 0x43 |
506 | # define PACKET3_CB0_DEST_BASE_ENA (1 << 6) | 507 | # define PACKET3_CB0_DEST_BASE_ENA (1 << 6) |
507 | # define PACKET3_CB1_DEST_BASE_ENA (1 << 7) | 508 | # define PACKET3_CB1_DEST_BASE_ENA (1 << 7) |
diff --git a/drivers/gpu/drm/radeon/radeon_atpx_handler.c b/drivers/gpu/drm/radeon/radeon_atpx_handler.c index 1aa3f910b993..37f6a907aea4 100644 --- a/drivers/gpu/drm/radeon/radeon_atpx_handler.c +++ b/drivers/gpu/drm/radeon/radeon_atpx_handler.c | |||
@@ -87,7 +87,7 @@ static union acpi_object *radeon_atpx_call(acpi_handle handle, int function, | |||
87 | atpx_arg_elements[1].integer.value = 0; | 87 | atpx_arg_elements[1].integer.value = 0; |
88 | } | 88 | } |
89 | 89 | ||
90 | status = acpi_evaluate_object(handle, "ATPX", &atpx_arg, &buffer); | 90 | status = acpi_evaluate_object(handle, NULL, &atpx_arg, &buffer); |
91 | 91 | ||
92 | /* Fail only if calling the method fails and ATPX is supported */ | 92 | /* Fail only if calling the method fails and ATPX is supported */ |
93 | if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) { | 93 | if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) { |
@@ -373,11 +373,11 @@ static int radeon_atpx_power_state(enum vga_switcheroo_client_id id, | |||
373 | } | 373 | } |
374 | 374 | ||
375 | /** | 375 | /** |
376 | * radeon_atpx_pci_probe_handle - look up the ATRM and ATPX handles | 376 | * radeon_atpx_pci_probe_handle - look up the ATPX handle |
377 | * | 377 | * |
378 | * @pdev: pci device | 378 | * @pdev: pci device |
379 | * | 379 | * |
380 | * Look up the ATPX and ATRM handles (all asics). | 380 | * Look up the ATPX handles (all asics). |
381 | * Returns true if the handles are found, false if not. | 381 | * Returns true if the handles are found, false if not. |
382 | */ | 382 | */ |
383 | static bool radeon_atpx_pci_probe_handle(struct pci_dev *pdev) | 383 | static bool radeon_atpx_pci_probe_handle(struct pci_dev *pdev) |
diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c index bd13ca09eb62..e2f5f888c374 100644 --- a/drivers/gpu/drm/radeon/radeon_device.c +++ b/drivers/gpu/drm/radeon/radeon_device.c | |||
@@ -355,6 +355,8 @@ int radeon_wb_init(struct radeon_device *rdev) | |||
355 | */ | 355 | */ |
356 | void radeon_vram_location(struct radeon_device *rdev, struct radeon_mc *mc, u64 base) | 356 | void radeon_vram_location(struct radeon_device *rdev, struct radeon_mc *mc, u64 base) |
357 | { | 357 | { |
358 | uint64_t limit = (uint64_t)radeon_vram_limit << 20; | ||
359 | |||
358 | mc->vram_start = base; | 360 | mc->vram_start = base; |
359 | if (mc->mc_vram_size > (0xFFFFFFFF - base + 1)) { | 361 | if (mc->mc_vram_size > (0xFFFFFFFF - base + 1)) { |
360 | dev_warn(rdev->dev, "limiting VRAM to PCI aperture size\n"); | 362 | dev_warn(rdev->dev, "limiting VRAM to PCI aperture size\n"); |
@@ -368,8 +370,8 @@ void radeon_vram_location(struct radeon_device *rdev, struct radeon_mc *mc, u64 | |||
368 | mc->mc_vram_size = mc->aper_size; | 370 | mc->mc_vram_size = mc->aper_size; |
369 | } | 371 | } |
370 | mc->vram_end = mc->vram_start + mc->mc_vram_size - 1; | 372 | mc->vram_end = mc->vram_start + mc->mc_vram_size - 1; |
371 | if (radeon_vram_limit && radeon_vram_limit < mc->real_vram_size) | 373 | if (limit && limit < mc->real_vram_size) |
372 | mc->real_vram_size = radeon_vram_limit; | 374 | mc->real_vram_size = limit; |
373 | dev_info(rdev->dev, "VRAM: %lluM 0x%016llX - 0x%016llX (%lluM used)\n", | 375 | dev_info(rdev->dev, "VRAM: %lluM 0x%016llX - 0x%016llX (%lluM used)\n", |
374 | mc->mc_vram_size >> 20, mc->vram_start, | 376 | mc->mc_vram_size >> 20, mc->vram_start, |
375 | mc->vram_end, mc->real_vram_size >> 20); | 377 | mc->vram_end, mc->real_vram_size >> 20); |
@@ -835,6 +837,19 @@ static unsigned int radeon_vga_set_decode(void *cookie, bool state) | |||
835 | } | 837 | } |
836 | 838 | ||
837 | /** | 839 | /** |
840 | * radeon_check_pot_argument - check that argument is a power of two | ||
841 | * | ||
842 | * @arg: value to check | ||
843 | * | ||
844 | * Validates that a certain argument is a power of two (all asics). | ||
845 | * Returns true if argument is valid. | ||
846 | */ | ||
847 | static bool radeon_check_pot_argument(int arg) | ||
848 | { | ||
849 | return (arg & (arg - 1)) == 0; | ||
850 | } | ||
851 | |||
852 | /** | ||
838 | * radeon_check_arguments - validate module params | 853 | * radeon_check_arguments - validate module params |
839 | * | 854 | * |
840 | * @rdev: radeon_device pointer | 855 | * @rdev: radeon_device pointer |
@@ -845,52 +860,25 @@ static unsigned int radeon_vga_set_decode(void *cookie, bool state) | |||
845 | static void radeon_check_arguments(struct radeon_device *rdev) | 860 | static void radeon_check_arguments(struct radeon_device *rdev) |
846 | { | 861 | { |
847 | /* vramlimit must be a power of two */ | 862 | /* vramlimit must be a power of two */ |
848 | switch (radeon_vram_limit) { | 863 | if (!radeon_check_pot_argument(radeon_vram_limit)) { |
849 | case 0: | ||
850 | case 4: | ||
851 | case 8: | ||
852 | case 16: | ||
853 | case 32: | ||
854 | case 64: | ||
855 | case 128: | ||
856 | case 256: | ||
857 | case 512: | ||
858 | case 1024: | ||
859 | case 2048: | ||
860 | case 4096: | ||
861 | break; | ||
862 | default: | ||
863 | dev_warn(rdev->dev, "vram limit (%d) must be a power of 2\n", | 864 | dev_warn(rdev->dev, "vram limit (%d) must be a power of 2\n", |
864 | radeon_vram_limit); | 865 | radeon_vram_limit); |
865 | radeon_vram_limit = 0; | 866 | radeon_vram_limit = 0; |
866 | break; | ||
867 | } | 867 | } |
868 | radeon_vram_limit = radeon_vram_limit << 20; | 868 | |
869 | /* gtt size must be power of two and greater or equal to 32M */ | 869 | /* gtt size must be power of two and greater or equal to 32M */ |
870 | switch (radeon_gart_size) { | 870 | if (radeon_gart_size < 32) { |
871 | case 4: | ||
872 | case 8: | ||
873 | case 16: | ||
874 | dev_warn(rdev->dev, "gart size (%d) too small forcing to 512M\n", | 871 | dev_warn(rdev->dev, "gart size (%d) too small forcing to 512M\n", |
875 | radeon_gart_size); | 872 | radeon_gart_size); |
876 | radeon_gart_size = 512; | 873 | radeon_gart_size = 512; |
877 | break; | 874 | |
878 | case 32: | 875 | } else if (!radeon_check_pot_argument(radeon_gart_size)) { |
879 | case 64: | ||
880 | case 128: | ||
881 | case 256: | ||
882 | case 512: | ||
883 | case 1024: | ||
884 | case 2048: | ||
885 | case 4096: | ||
886 | break; | ||
887 | default: | ||
888 | dev_warn(rdev->dev, "gart size (%d) must be a power of 2\n", | 876 | dev_warn(rdev->dev, "gart size (%d) must be a power of 2\n", |
889 | radeon_gart_size); | 877 | radeon_gart_size); |
890 | radeon_gart_size = 512; | 878 | radeon_gart_size = 512; |
891 | break; | ||
892 | } | 879 | } |
893 | rdev->mc.gtt_size = radeon_gart_size * 1024 * 1024; | 880 | rdev->mc.gtt_size = (uint64_t)radeon_gart_size << 20; |
881 | |||
894 | /* AGP mode can only be -1, 1, 2, 4, 8 */ | 882 | /* AGP mode can only be -1, 1, 2, 4, 8 */ |
895 | switch (radeon_agpmode) { | 883 | switch (radeon_agpmode) { |
896 | case -1: | 884 | case -1: |
diff --git a/drivers/gpu/drm/radeon/radeon_gart.c b/drivers/gpu/drm/radeon/radeon_gart.c index a7677dd1ce98..4debd60e5aa6 100644 --- a/drivers/gpu/drm/radeon/radeon_gart.c +++ b/drivers/gpu/drm/radeon/radeon_gart.c | |||
@@ -355,14 +355,13 @@ int radeon_gart_init(struct radeon_device *rdev) | |||
355 | DRM_INFO("GART: num cpu pages %u, num gpu pages %u\n", | 355 | DRM_INFO("GART: num cpu pages %u, num gpu pages %u\n", |
356 | rdev->gart.num_cpu_pages, rdev->gart.num_gpu_pages); | 356 | rdev->gart.num_cpu_pages, rdev->gart.num_gpu_pages); |
357 | /* Allocate pages table */ | 357 | /* Allocate pages table */ |
358 | rdev->gart.pages = kzalloc(sizeof(void *) * rdev->gart.num_cpu_pages, | 358 | rdev->gart.pages = vzalloc(sizeof(void *) * rdev->gart.num_cpu_pages); |
359 | GFP_KERNEL); | ||
360 | if (rdev->gart.pages == NULL) { | 359 | if (rdev->gart.pages == NULL) { |
361 | radeon_gart_fini(rdev); | 360 | radeon_gart_fini(rdev); |
362 | return -ENOMEM; | 361 | return -ENOMEM; |
363 | } | 362 | } |
364 | rdev->gart.pages_addr = kzalloc(sizeof(dma_addr_t) * | 363 | rdev->gart.pages_addr = vzalloc(sizeof(dma_addr_t) * |
365 | rdev->gart.num_cpu_pages, GFP_KERNEL); | 364 | rdev->gart.num_cpu_pages); |
366 | if (rdev->gart.pages_addr == NULL) { | 365 | if (rdev->gart.pages_addr == NULL) { |
367 | radeon_gart_fini(rdev); | 366 | radeon_gart_fini(rdev); |
368 | return -ENOMEM; | 367 | return -ENOMEM; |
@@ -388,8 +387,8 @@ void radeon_gart_fini(struct radeon_device *rdev) | |||
388 | radeon_gart_unbind(rdev, 0, rdev->gart.num_cpu_pages); | 387 | radeon_gart_unbind(rdev, 0, rdev->gart.num_cpu_pages); |
389 | } | 388 | } |
390 | rdev->gart.ready = false; | 389 | rdev->gart.ready = false; |
391 | kfree(rdev->gart.pages); | 390 | vfree(rdev->gart.pages); |
392 | kfree(rdev->gart.pages_addr); | 391 | vfree(rdev->gart.pages_addr); |
393 | rdev->gart.pages = NULL; | 392 | rdev->gart.pages = NULL; |
394 | rdev->gart.pages_addr = NULL; | 393 | rdev->gart.pages_addr = NULL; |
395 | 394 | ||
@@ -577,7 +576,7 @@ void radeon_vm_manager_fini(struct radeon_device *rdev) | |||
577 | * | 576 | * |
578 | * Global and local mutex must be locked! | 577 | * Global and local mutex must be locked! |
579 | */ | 578 | */ |
580 | int radeon_vm_evict(struct radeon_device *rdev, struct radeon_vm *vm) | 579 | static int radeon_vm_evict(struct radeon_device *rdev, struct radeon_vm *vm) |
581 | { | 580 | { |
582 | struct radeon_vm *vm_evict; | 581 | struct radeon_vm *vm_evict; |
583 | 582 | ||
@@ -1036,8 +1035,7 @@ static void radeon_vm_update_ptes(struct radeon_device *rdev, | |||
1036 | pte = radeon_sa_bo_gpu_addr(vm->page_tables[pt_idx]); | 1035 | pte = radeon_sa_bo_gpu_addr(vm->page_tables[pt_idx]); |
1037 | pte += (addr & mask) * 8; | 1036 | pte += (addr & mask) * 8; |
1038 | 1037 | ||
1039 | if (((last_pte + 8 * count) != pte) || | 1038 | if ((last_pte + 8 * count) != pte) { |
1040 | ((count + nptes) > 1 << 11)) { | ||
1041 | 1039 | ||
1042 | if (count) { | 1040 | if (count) { |
1043 | radeon_asic_vm_set_page(rdev, last_pte, | 1041 | radeon_asic_vm_set_page(rdev, last_pte, |
@@ -1148,17 +1146,17 @@ int radeon_vm_bo_update_pte(struct radeon_device *rdev, | |||
1148 | 1146 | ||
1149 | if (RADEON_VM_BLOCK_SIZE > 11) | 1147 | if (RADEON_VM_BLOCK_SIZE > 11) |
1150 | /* reserve space for one header for every 2k dwords */ | 1148 | /* reserve space for one header for every 2k dwords */ |
1151 | ndw += (nptes >> 11) * 3; | 1149 | ndw += (nptes >> 11) * 4; |
1152 | else | 1150 | else |
1153 | /* reserve space for one header for | 1151 | /* reserve space for one header for |
1154 | every (1 << BLOCK_SIZE) entries */ | 1152 | every (1 << BLOCK_SIZE) entries */ |
1155 | ndw += (nptes >> RADEON_VM_BLOCK_SIZE) * 3; | 1153 | ndw += (nptes >> RADEON_VM_BLOCK_SIZE) * 4; |
1156 | 1154 | ||
1157 | /* reserve space for pte addresses */ | 1155 | /* reserve space for pte addresses */ |
1158 | ndw += nptes * 2; | 1156 | ndw += nptes * 2; |
1159 | 1157 | ||
1160 | /* reserve space for one header for every 2k dwords */ | 1158 | /* reserve space for one header for every 2k dwords */ |
1161 | ndw += (npdes >> 11) * 3; | 1159 | ndw += (npdes >> 11) * 4; |
1162 | 1160 | ||
1163 | /* reserve space for pde addresses */ | 1161 | /* reserve space for pde addresses */ |
1164 | ndw += npdes * 2; | 1162 | ndw += npdes * 2; |
diff --git a/drivers/gpu/drm/radeon/radeon_gem.c b/drivers/gpu/drm/radeon/radeon_gem.c index f38fbcc46935..fe5c1f6b7957 100644 --- a/drivers/gpu/drm/radeon/radeon_gem.c +++ b/drivers/gpu/drm/radeon/radeon_gem.c | |||
@@ -53,6 +53,7 @@ int radeon_gem_object_create(struct radeon_device *rdev, int size, | |||
53 | struct drm_gem_object **obj) | 53 | struct drm_gem_object **obj) |
54 | { | 54 | { |
55 | struct radeon_bo *robj; | 55 | struct radeon_bo *robj; |
56 | unsigned long max_size; | ||
56 | int r; | 57 | int r; |
57 | 58 | ||
58 | *obj = NULL; | 59 | *obj = NULL; |
@@ -60,11 +61,26 @@ int radeon_gem_object_create(struct radeon_device *rdev, int size, | |||
60 | if (alignment < PAGE_SIZE) { | 61 | if (alignment < PAGE_SIZE) { |
61 | alignment = PAGE_SIZE; | 62 | alignment = PAGE_SIZE; |
62 | } | 63 | } |
64 | |||
65 | /* maximun bo size is the minimun btw visible vram and gtt size */ | ||
66 | max_size = min(rdev->mc.visible_vram_size, rdev->mc.gtt_size); | ||
67 | if (size > max_size) { | ||
68 | printk(KERN_WARNING "%s:%d alloc size %dMb bigger than %ldMb limit\n", | ||
69 | __func__, __LINE__, size >> 20, max_size >> 20); | ||
70 | return -ENOMEM; | ||
71 | } | ||
72 | |||
73 | retry: | ||
63 | r = radeon_bo_create(rdev, size, alignment, kernel, initial_domain, NULL, &robj); | 74 | r = radeon_bo_create(rdev, size, alignment, kernel, initial_domain, NULL, &robj); |
64 | if (r) { | 75 | if (r) { |
65 | if (r != -ERESTARTSYS) | 76 | if (r != -ERESTARTSYS) { |
77 | if (initial_domain == RADEON_GEM_DOMAIN_VRAM) { | ||
78 | initial_domain |= RADEON_GEM_DOMAIN_GTT; | ||
79 | goto retry; | ||
80 | } | ||
66 | DRM_ERROR("Failed to allocate GEM object (%d, %d, %u, %d)\n", | 81 | DRM_ERROR("Failed to allocate GEM object (%d, %d, %u, %d)\n", |
67 | size, initial_domain, alignment, r); | 82 | size, initial_domain, alignment, r); |
83 | } | ||
68 | return r; | 84 | return r; |
69 | } | 85 | } |
70 | *obj = &robj->gem_base; | 86 | *obj = &robj->gem_base; |
diff --git a/drivers/gpu/drm/radeon/radeon_legacy_encoders.c b/drivers/gpu/drm/radeon/radeon_legacy_encoders.c index a13ad9d707cf..0063df9d166d 100644 --- a/drivers/gpu/drm/radeon/radeon_legacy_encoders.c +++ b/drivers/gpu/drm/radeon/radeon_legacy_encoders.c | |||
@@ -370,6 +370,7 @@ void radeon_legacy_backlight_init(struct radeon_encoder *radeon_encoder, | |||
370 | struct backlight_properties props; | 370 | struct backlight_properties props; |
371 | struct radeon_backlight_privdata *pdata; | 371 | struct radeon_backlight_privdata *pdata; |
372 | uint8_t backlight_level; | 372 | uint8_t backlight_level; |
373 | char bl_name[16]; | ||
373 | 374 | ||
374 | if (!radeon_encoder->enc_priv) | 375 | if (!radeon_encoder->enc_priv) |
375 | return; | 376 | return; |
@@ -389,7 +390,9 @@ void radeon_legacy_backlight_init(struct radeon_encoder *radeon_encoder, | |||
389 | memset(&props, 0, sizeof(props)); | 390 | memset(&props, 0, sizeof(props)); |
390 | props.max_brightness = RADEON_MAX_BL_LEVEL; | 391 | props.max_brightness = RADEON_MAX_BL_LEVEL; |
391 | props.type = BACKLIGHT_RAW; | 392 | props.type = BACKLIGHT_RAW; |
392 | bd = backlight_device_register("radeon_bl", &drm_connector->kdev, | 393 | snprintf(bl_name, sizeof(bl_name), |
394 | "radeon_bl%d", dev->primary->index); | ||
395 | bd = backlight_device_register(bl_name, &drm_connector->kdev, | ||
393 | pdata, &radeon_backlight_ops, &props); | 396 | pdata, &radeon_backlight_ops, &props); |
394 | if (IS_ERR(bd)) { | 397 | if (IS_ERR(bd)) { |
395 | DRM_ERROR("Backlight registration failed\n"); | 398 | DRM_ERROR("Backlight registration failed\n"); |
diff --git a/drivers/gpu/drm/radeon/radeon_object.c b/drivers/gpu/drm/radeon/radeon_object.c index 8b27dd6e3144..b91118ccef86 100644 --- a/drivers/gpu/drm/radeon/radeon_object.c +++ b/drivers/gpu/drm/radeon/radeon_object.c | |||
@@ -105,7 +105,6 @@ int radeon_bo_create(struct radeon_device *rdev, | |||
105 | struct radeon_bo *bo; | 105 | struct radeon_bo *bo; |
106 | enum ttm_bo_type type; | 106 | enum ttm_bo_type type; |
107 | unsigned long page_align = roundup(byte_align, PAGE_SIZE) >> PAGE_SHIFT; | 107 | unsigned long page_align = roundup(byte_align, PAGE_SIZE) >> PAGE_SHIFT; |
108 | unsigned long max_size = 0; | ||
109 | size_t acc_size; | 108 | size_t acc_size; |
110 | int r; | 109 | int r; |
111 | 110 | ||
@@ -121,18 +120,9 @@ int radeon_bo_create(struct radeon_device *rdev, | |||
121 | } | 120 | } |
122 | *bo_ptr = NULL; | 121 | *bo_ptr = NULL; |
123 | 122 | ||
124 | /* maximun bo size is the minimun btw visible vram and gtt size */ | ||
125 | max_size = min(rdev->mc.visible_vram_size, rdev->mc.gtt_size); | ||
126 | if ((page_align << PAGE_SHIFT) >= max_size) { | ||
127 | printk(KERN_WARNING "%s:%d alloc size %ldM bigger than %ldMb limit\n", | ||
128 | __func__, __LINE__, page_align >> (20 - PAGE_SHIFT), max_size >> 20); | ||
129 | return -ENOMEM; | ||
130 | } | ||
131 | |||
132 | acc_size = ttm_bo_dma_acc_size(&rdev->mman.bdev, size, | 123 | acc_size = ttm_bo_dma_acc_size(&rdev->mman.bdev, size, |
133 | sizeof(struct radeon_bo)); | 124 | sizeof(struct radeon_bo)); |
134 | 125 | ||
135 | retry: | ||
136 | bo = kzalloc(sizeof(struct radeon_bo), GFP_KERNEL); | 126 | bo = kzalloc(sizeof(struct radeon_bo), GFP_KERNEL); |
137 | if (bo == NULL) | 127 | if (bo == NULL) |
138 | return -ENOMEM; | 128 | return -ENOMEM; |
@@ -154,15 +144,6 @@ retry: | |||
154 | acc_size, sg, &radeon_ttm_bo_destroy); | 144 | acc_size, sg, &radeon_ttm_bo_destroy); |
155 | up_read(&rdev->pm.mclk_lock); | 145 | up_read(&rdev->pm.mclk_lock); |
156 | if (unlikely(r != 0)) { | 146 | if (unlikely(r != 0)) { |
157 | if (r != -ERESTARTSYS) { | ||
158 | if (domain == RADEON_GEM_DOMAIN_VRAM) { | ||
159 | domain |= RADEON_GEM_DOMAIN_GTT; | ||
160 | goto retry; | ||
161 | } | ||
162 | dev_err(rdev->dev, | ||
163 | "object_init failed for (%lu, 0x%08X)\n", | ||
164 | size, domain); | ||
165 | } | ||
166 | return r; | 147 | return r; |
167 | } | 148 | } |
168 | *bo_ptr = bo; | 149 | *bo_ptr = bo; |
diff --git a/drivers/gpu/drm/radeon/si.c b/drivers/gpu/drm/radeon/si.c index df8dd7701643..b0db712060fb 100644 --- a/drivers/gpu/drm/radeon/si.c +++ b/drivers/gpu/drm/radeon/si.c | |||
@@ -2808,26 +2808,31 @@ void si_vm_set_page(struct radeon_device *rdev, uint64_t pe, | |||
2808 | { | 2808 | { |
2809 | struct radeon_ring *ring = &rdev->ring[rdev->asic->vm.pt_ring_index]; | 2809 | struct radeon_ring *ring = &rdev->ring[rdev->asic->vm.pt_ring_index]; |
2810 | uint32_t r600_flags = cayman_vm_page_flags(rdev, flags); | 2810 | uint32_t r600_flags = cayman_vm_page_flags(rdev, flags); |
2811 | int i; | ||
2812 | uint64_t value; | ||
2813 | 2811 | ||
2814 | radeon_ring_write(ring, PACKET3(PACKET3_WRITE_DATA, 2 + count * 2)); | 2812 | while (count) { |
2815 | radeon_ring_write(ring, (WRITE_DATA_ENGINE_SEL(0) | | 2813 | unsigned ndw = 2 + count * 2; |
2816 | WRITE_DATA_DST_SEL(1))); | 2814 | if (ndw > 0x3FFE) |
2817 | radeon_ring_write(ring, pe); | 2815 | ndw = 0x3FFE; |
2818 | radeon_ring_write(ring, upper_32_bits(pe)); | 2816 | |
2819 | for (i = 0; i < count; ++i) { | 2817 | radeon_ring_write(ring, PACKET3(PACKET3_WRITE_DATA, ndw)); |
2820 | if (flags & RADEON_VM_PAGE_SYSTEM) { | 2818 | radeon_ring_write(ring, (WRITE_DATA_ENGINE_SEL(0) | |
2821 | value = radeon_vm_map_gart(rdev, addr); | 2819 | WRITE_DATA_DST_SEL(1))); |
2822 | value &= 0xFFFFFFFFFFFFF000ULL; | 2820 | radeon_ring_write(ring, pe); |
2823 | } else if (flags & RADEON_VM_PAGE_VALID) | 2821 | radeon_ring_write(ring, upper_32_bits(pe)); |
2824 | value = addr; | 2822 | for (; ndw > 2; ndw -= 2, --count, pe += 8) { |
2825 | else | 2823 | uint64_t value; |
2826 | value = 0; | 2824 | if (flags & RADEON_VM_PAGE_SYSTEM) { |
2827 | addr += incr; | 2825 | value = radeon_vm_map_gart(rdev, addr); |
2828 | value |= r600_flags; | 2826 | value &= 0xFFFFFFFFFFFFF000ULL; |
2829 | radeon_ring_write(ring, value); | 2827 | } else if (flags & RADEON_VM_PAGE_VALID) |
2830 | radeon_ring_write(ring, upper_32_bits(value)); | 2828 | value = addr; |
2829 | else | ||
2830 | value = 0; | ||
2831 | addr += incr; | ||
2832 | value |= r600_flags; | ||
2833 | radeon_ring_write(ring, value); | ||
2834 | radeon_ring_write(ring, upper_32_bits(value)); | ||
2835 | } | ||
2831 | } | 2836 | } |
2832 | } | 2837 | } |
2833 | 2838 | ||
@@ -2868,6 +2873,10 @@ void si_vm_flush(struct radeon_device *rdev, int ridx, struct radeon_vm *vm) | |||
2868 | radeon_ring_write(ring, VM_INVALIDATE_REQUEST >> 2); | 2873 | radeon_ring_write(ring, VM_INVALIDATE_REQUEST >> 2); |
2869 | radeon_ring_write(ring, 0); | 2874 | radeon_ring_write(ring, 0); |
2870 | radeon_ring_write(ring, 1 << vm->id); | 2875 | radeon_ring_write(ring, 1 << vm->id); |
2876 | |||
2877 | /* sync PFP to ME, otherwise we might get invalid PFP reads */ | ||
2878 | radeon_ring_write(ring, PACKET3(PACKET3_PFP_SYNC_ME, 0)); | ||
2879 | radeon_ring_write(ring, 0x0); | ||
2871 | } | 2880 | } |
2872 | 2881 | ||
2873 | /* | 2882 | /* |
diff --git a/drivers/gpu/drm/shmobile/shmob_drm_drv.c b/drivers/gpu/drm/shmobile/shmob_drm_drv.c index c71d493fd0c5..1c350fc4e449 100644 --- a/drivers/gpu/drm/shmobile/shmob_drm_drv.c +++ b/drivers/gpu/drm/shmobile/shmob_drm_drv.c | |||
@@ -201,6 +201,8 @@ static int shmob_drm_load(struct drm_device *dev, unsigned long flags) | |||
201 | goto done; | 201 | goto done; |
202 | } | 202 | } |
203 | 203 | ||
204 | platform_set_drvdata(pdev, sdev); | ||
205 | |||
204 | done: | 206 | done: |
205 | if (ret) | 207 | if (ret) |
206 | shmob_drm_unload(dev); | 208 | shmob_drm_unload(dev); |
@@ -299,11 +301,9 @@ static struct drm_driver shmob_drm_driver = { | |||
299 | #if CONFIG_PM_SLEEP | 301 | #if CONFIG_PM_SLEEP |
300 | static int shmob_drm_pm_suspend(struct device *dev) | 302 | static int shmob_drm_pm_suspend(struct device *dev) |
301 | { | 303 | { |
302 | struct platform_device *pdev = to_platform_device(dev); | 304 | struct shmob_drm_device *sdev = dev_get_drvdata(dev); |
303 | struct drm_device *ddev = platform_get_drvdata(pdev); | ||
304 | struct shmob_drm_device *sdev = ddev->dev_private; | ||
305 | 305 | ||
306 | drm_kms_helper_poll_disable(ddev); | 306 | drm_kms_helper_poll_disable(sdev->ddev); |
307 | shmob_drm_crtc_suspend(&sdev->crtc); | 307 | shmob_drm_crtc_suspend(&sdev->crtc); |
308 | 308 | ||
309 | return 0; | 309 | return 0; |
@@ -311,9 +311,7 @@ static int shmob_drm_pm_suspend(struct device *dev) | |||
311 | 311 | ||
312 | static int shmob_drm_pm_resume(struct device *dev) | 312 | static int shmob_drm_pm_resume(struct device *dev) |
313 | { | 313 | { |
314 | struct platform_device *pdev = to_platform_device(dev); | 314 | struct shmob_drm_device *sdev = dev_get_drvdata(dev); |
315 | struct drm_device *ddev = platform_get_drvdata(pdev); | ||
316 | struct shmob_drm_device *sdev = ddev->dev_private; | ||
317 | 315 | ||
318 | mutex_lock(&sdev->ddev->mode_config.mutex); | 316 | mutex_lock(&sdev->ddev->mode_config.mutex); |
319 | shmob_drm_crtc_resume(&sdev->crtc); | 317 | shmob_drm_crtc_resume(&sdev->crtc); |
diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c index 402ab69f9f99..bf6e4b5a73b5 100644 --- a/drivers/gpu/drm/ttm/ttm_bo.c +++ b/drivers/gpu/drm/ttm/ttm_bo.c | |||
@@ -580,6 +580,7 @@ retry: | |||
580 | if (unlikely(ret != 0)) | 580 | if (unlikely(ret != 0)) |
581 | return ret; | 581 | return ret; |
582 | 582 | ||
583 | retry_reserve: | ||
583 | spin_lock(&glob->lru_lock); | 584 | spin_lock(&glob->lru_lock); |
584 | 585 | ||
585 | if (unlikely(list_empty(&bo->ddestroy))) { | 586 | if (unlikely(list_empty(&bo->ddestroy))) { |
@@ -587,14 +588,20 @@ retry: | |||
587 | return 0; | 588 | return 0; |
588 | } | 589 | } |
589 | 590 | ||
590 | ret = ttm_bo_reserve_locked(bo, interruptible, | 591 | ret = ttm_bo_reserve_locked(bo, false, true, false, 0); |
591 | no_wait_reserve, false, 0); | ||
592 | 592 | ||
593 | if (unlikely(ret != 0)) { | 593 | if (unlikely(ret == -EBUSY)) { |
594 | spin_unlock(&glob->lru_lock); | 594 | spin_unlock(&glob->lru_lock); |
595 | return ret; | 595 | if (likely(!no_wait_reserve)) |
596 | ret = ttm_bo_wait_unreserved(bo, interruptible); | ||
597 | if (unlikely(ret != 0)) | ||
598 | return ret; | ||
599 | |||
600 | goto retry_reserve; | ||
596 | } | 601 | } |
597 | 602 | ||
603 | BUG_ON(ret != 0); | ||
604 | |||
598 | /** | 605 | /** |
599 | * We can re-check for sync object without taking | 606 | * We can re-check for sync object without taking |
600 | * the bo::lock since setting the sync object requires | 607 | * the bo::lock since setting the sync object requires |
@@ -811,17 +818,14 @@ retry: | |||
811 | no_wait_reserve, no_wait_gpu); | 818 | no_wait_reserve, no_wait_gpu); |
812 | kref_put(&bo->list_kref, ttm_bo_release_list); | 819 | kref_put(&bo->list_kref, ttm_bo_release_list); |
813 | 820 | ||
814 | if (likely(ret == 0 || ret == -ERESTARTSYS)) | 821 | return ret; |
815 | return ret; | ||
816 | |||
817 | goto retry; | ||
818 | } | 822 | } |
819 | 823 | ||
820 | ret = ttm_bo_reserve_locked(bo, false, no_wait_reserve, false, 0); | 824 | ret = ttm_bo_reserve_locked(bo, false, true, false, 0); |
821 | 825 | ||
822 | if (unlikely(ret == -EBUSY)) { | 826 | if (unlikely(ret == -EBUSY)) { |
823 | spin_unlock(&glob->lru_lock); | 827 | spin_unlock(&glob->lru_lock); |
824 | if (likely(!no_wait_gpu)) | 828 | if (likely(!no_wait_reserve)) |
825 | ret = ttm_bo_wait_unreserved(bo, interruptible); | 829 | ret = ttm_bo_wait_unreserved(bo, interruptible); |
826 | 830 | ||
827 | kref_put(&bo->list_kref, ttm_bo_release_list); | 831 | kref_put(&bo->list_kref, ttm_bo_release_list); |
diff --git a/drivers/hv/channel.c b/drivers/hv/channel.c index 406537420fff..f4c3d28cd1fc 100644 --- a/drivers/hv/channel.c +++ b/drivers/hv/channel.c | |||
@@ -146,14 +146,14 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size, | |||
146 | 146 | ||
147 | if (ret != 0) { | 147 | if (ret != 0) { |
148 | err = ret; | 148 | err = ret; |
149 | goto errorout; | 149 | goto error0; |
150 | } | 150 | } |
151 | 151 | ||
152 | ret = hv_ringbuffer_init( | 152 | ret = hv_ringbuffer_init( |
153 | &newchannel->inbound, in, recv_ringbuffer_size); | 153 | &newchannel->inbound, in, recv_ringbuffer_size); |
154 | if (ret != 0) { | 154 | if (ret != 0) { |
155 | err = ret; | 155 | err = ret; |
156 | goto errorout; | 156 | goto error0; |
157 | } | 157 | } |
158 | 158 | ||
159 | 159 | ||
@@ -168,7 +168,7 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size, | |||
168 | 168 | ||
169 | if (ret != 0) { | 169 | if (ret != 0) { |
170 | err = ret; | 170 | err = ret; |
171 | goto errorout; | 171 | goto error0; |
172 | } | 172 | } |
173 | 173 | ||
174 | /* Create and init the channel open message */ | 174 | /* Create and init the channel open message */ |
@@ -177,7 +177,7 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size, | |||
177 | GFP_KERNEL); | 177 | GFP_KERNEL); |
178 | if (!open_info) { | 178 | if (!open_info) { |
179 | err = -ENOMEM; | 179 | err = -ENOMEM; |
180 | goto errorout; | 180 | goto error0; |
181 | } | 181 | } |
182 | 182 | ||
183 | init_completion(&open_info->waitevent); | 183 | init_completion(&open_info->waitevent); |
@@ -193,7 +193,7 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size, | |||
193 | 193 | ||
194 | if (userdatalen > MAX_USER_DEFINED_BYTES) { | 194 | if (userdatalen > MAX_USER_DEFINED_BYTES) { |
195 | err = -EINVAL; | 195 | err = -EINVAL; |
196 | goto errorout; | 196 | goto error0; |
197 | } | 197 | } |
198 | 198 | ||
199 | if (userdatalen) | 199 | if (userdatalen) |
@@ -208,19 +208,18 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size, | |||
208 | sizeof(struct vmbus_channel_open_channel)); | 208 | sizeof(struct vmbus_channel_open_channel)); |
209 | 209 | ||
210 | if (ret != 0) | 210 | if (ret != 0) |
211 | goto cleanup; | 211 | goto error1; |
212 | 212 | ||
213 | t = wait_for_completion_timeout(&open_info->waitevent, 5*HZ); | 213 | t = wait_for_completion_timeout(&open_info->waitevent, 5*HZ); |
214 | if (t == 0) { | 214 | if (t == 0) { |
215 | err = -ETIMEDOUT; | 215 | err = -ETIMEDOUT; |
216 | goto errorout; | 216 | goto error1; |
217 | } | 217 | } |
218 | 218 | ||
219 | 219 | ||
220 | if (open_info->response.open_result.status) | 220 | if (open_info->response.open_result.status) |
221 | err = open_info->response.open_result.status; | 221 | err = open_info->response.open_result.status; |
222 | 222 | ||
223 | cleanup: | ||
224 | spin_lock_irqsave(&vmbus_connection.channelmsg_lock, flags); | 223 | spin_lock_irqsave(&vmbus_connection.channelmsg_lock, flags); |
225 | list_del(&open_info->msglistentry); | 224 | list_del(&open_info->msglistentry); |
226 | spin_unlock_irqrestore(&vmbus_connection.channelmsg_lock, flags); | 225 | spin_unlock_irqrestore(&vmbus_connection.channelmsg_lock, flags); |
@@ -228,9 +227,12 @@ cleanup: | |||
228 | kfree(open_info); | 227 | kfree(open_info); |
229 | return err; | 228 | return err; |
230 | 229 | ||
231 | errorout: | 230 | error1: |
232 | hv_ringbuffer_cleanup(&newchannel->outbound); | 231 | spin_lock_irqsave(&vmbus_connection.channelmsg_lock, flags); |
233 | hv_ringbuffer_cleanup(&newchannel->inbound); | 232 | list_del(&open_info->msglistentry); |
233 | spin_unlock_irqrestore(&vmbus_connection.channelmsg_lock, flags); | ||
234 | |||
235 | error0: | ||
234 | free_pages((unsigned long)out, | 236 | free_pages((unsigned long)out, |
235 | get_order(send_ringbuffer_size + recv_ringbuffer_size)); | 237 | get_order(send_ringbuffer_size + recv_ringbuffer_size)); |
236 | kfree(open_info); | 238 | kfree(open_info); |
diff --git a/drivers/iio/Kconfig b/drivers/iio/Kconfig index 6e3f143fc71d..fc937aca71fb 100644 --- a/drivers/iio/Kconfig +++ b/drivers/iio/Kconfig | |||
@@ -62,7 +62,6 @@ source "drivers/iio/frequency/Kconfig" | |||
62 | source "drivers/iio/dac/Kconfig" | 62 | source "drivers/iio/dac/Kconfig" |
63 | source "drivers/iio/common/Kconfig" | 63 | source "drivers/iio/common/Kconfig" |
64 | source "drivers/iio/gyro/Kconfig" | 64 | source "drivers/iio/gyro/Kconfig" |
65 | source "drivers/iio/light/Kconfig" | ||
66 | source "drivers/iio/magnetometer/Kconfig" | 65 | source "drivers/iio/magnetometer/Kconfig" |
67 | 66 | ||
68 | endif # IIO | 67 | endif # IIO |
diff --git a/drivers/iio/Makefile b/drivers/iio/Makefile index f7fa3c0867b4..761f2b65ac52 100644 --- a/drivers/iio/Makefile +++ b/drivers/iio/Makefile | |||
@@ -18,5 +18,4 @@ obj-y += frequency/ | |||
18 | obj-y += dac/ | 18 | obj-y += dac/ |
19 | obj-y += common/ | 19 | obj-y += common/ |
20 | obj-y += gyro/ | 20 | obj-y += gyro/ |
21 | obj-y += light/ | ||
22 | obj-y += magnetometer/ | 21 | obj-y += magnetometer/ |
diff --git a/drivers/infiniband/hw/cxgb4/mem.c b/drivers/infiniband/hw/cxgb4/mem.c index 57e07c61ace2..afd81790ab3c 100644 --- a/drivers/infiniband/hw/cxgb4/mem.c +++ b/drivers/infiniband/hw/cxgb4/mem.c | |||
@@ -468,7 +468,7 @@ struct ib_mr *c4iw_register_phys_mem(struct ib_pd *pd, | |||
468 | ret = alloc_pbl(mhp, npages); | 468 | ret = alloc_pbl(mhp, npages); |
469 | if (ret) { | 469 | if (ret) { |
470 | kfree(page_list); | 470 | kfree(page_list); |
471 | goto err_pbl; | 471 | goto err; |
472 | } | 472 | } |
473 | 473 | ||
474 | ret = write_pbl(&mhp->rhp->rdev, page_list, mhp->attr.pbl_addr, | 474 | ret = write_pbl(&mhp->rhp->rdev, page_list, mhp->attr.pbl_addr, |
diff --git a/drivers/infiniband/hw/mlx4/alias_GUID.c b/drivers/infiniband/hw/mlx4/alias_GUID.c index d2fb38d43571..2f215b93db6b 100644 --- a/drivers/infiniband/hw/mlx4/alias_GUID.c +++ b/drivers/infiniband/hw/mlx4/alias_GUID.c | |||
@@ -107,7 +107,7 @@ static __be64 get_cached_alias_guid(struct mlx4_ib_dev *dev, int port, int index | |||
107 | { | 107 | { |
108 | if (index >= NUM_ALIAS_GUID_PER_PORT) { | 108 | if (index >= NUM_ALIAS_GUID_PER_PORT) { |
109 | pr_err("%s: ERROR: asked for index:%d\n", __func__, index); | 109 | pr_err("%s: ERROR: asked for index:%d\n", __func__, index); |
110 | return (__force __be64) ((u64) 0xFFFFFFFFFFFFFFFFUL); | 110 | return (__force __be64) -1; |
111 | } | 111 | } |
112 | return *(__be64 *)&dev->sriov.demux[port - 1].guid_cache[index]; | 112 | return *(__be64 *)&dev->sriov.demux[port - 1].guid_cache[index]; |
113 | } | 113 | } |
diff --git a/drivers/infiniband/hw/mlx4/mad.c b/drivers/infiniband/hw/mlx4/mad.c index 21a794152d15..0a903c129f0a 100644 --- a/drivers/infiniband/hw/mlx4/mad.c +++ b/drivers/infiniband/hw/mlx4/mad.c | |||
@@ -409,38 +409,45 @@ int mlx4_ib_find_real_gid(struct ib_device *ibdev, u8 port, __be64 guid) | |||
409 | } | 409 | } |
410 | 410 | ||
411 | 411 | ||
412 | static int get_pkey_phys_indices(struct mlx4_ib_dev *ibdev, u8 port, u8 ph_pkey_ix, | 412 | static int find_slave_port_pkey_ix(struct mlx4_ib_dev *dev, int slave, |
413 | u8 *full_pk_ix, u8 *partial_pk_ix, | 413 | u8 port, u16 pkey, u16 *ix) |
414 | int *is_full_member) | ||
415 | { | 414 | { |
416 | u16 search_pkey; | 415 | int i, ret; |
417 | int fm; | 416 | u8 unassigned_pkey_ix, pkey_ix, partial_ix = 0xFF; |
418 | int err = 0; | 417 | u16 slot_pkey; |
419 | u16 pk; | ||
420 | 418 | ||
421 | err = ib_get_cached_pkey(&ibdev->ib_dev, port, ph_pkey_ix, &search_pkey); | 419 | if (slave == mlx4_master_func_num(dev->dev)) |
422 | if (err) | 420 | return ib_find_cached_pkey(&dev->ib_dev, port, pkey, ix); |
423 | return err; | ||
424 | 421 | ||
425 | fm = (search_pkey & 0x8000) ? 1 : 0; | 422 | unassigned_pkey_ix = dev->dev->phys_caps.pkey_phys_table_len[port] - 1; |
426 | if (fm) { | ||
427 | *full_pk_ix = ph_pkey_ix; | ||
428 | search_pkey &= 0x7FFF; | ||
429 | } else { | ||
430 | *partial_pk_ix = ph_pkey_ix; | ||
431 | search_pkey |= 0x8000; | ||
432 | } | ||
433 | 423 | ||
434 | if (ib_find_exact_cached_pkey(&ibdev->ib_dev, port, search_pkey, &pk)) | 424 | for (i = 0; i < dev->dev->caps.pkey_table_len[port]; i++) { |
435 | pk = 0xFFFF; | 425 | if (dev->pkeys.virt2phys_pkey[slave][port - 1][i] == unassigned_pkey_ix) |
426 | continue; | ||
436 | 427 | ||
437 | if (fm) | 428 | pkey_ix = dev->pkeys.virt2phys_pkey[slave][port - 1][i]; |
438 | *partial_pk_ix = (pk & 0xFF); | ||
439 | else | ||
440 | *full_pk_ix = (pk & 0xFF); | ||
441 | 429 | ||
442 | *is_full_member = fm; | 430 | ret = ib_get_cached_pkey(&dev->ib_dev, port, pkey_ix, &slot_pkey); |
443 | return err; | 431 | if (ret) |
432 | continue; | ||
433 | if ((slot_pkey & 0x7FFF) == (pkey & 0x7FFF)) { | ||
434 | if (slot_pkey & 0x8000) { | ||
435 | *ix = (u16) pkey_ix; | ||
436 | return 0; | ||
437 | } else { | ||
438 | /* take first partial pkey index found */ | ||
439 | if (partial_ix == 0xFF) | ||
440 | partial_ix = pkey_ix; | ||
441 | } | ||
442 | } | ||
443 | } | ||
444 | |||
445 | if (partial_ix < 0xFF) { | ||
446 | *ix = (u16) partial_ix; | ||
447 | return 0; | ||
448 | } | ||
449 | |||
450 | return -EINVAL; | ||
444 | } | 451 | } |
445 | 452 | ||
446 | int mlx4_ib_send_to_slave(struct mlx4_ib_dev *dev, int slave, u8 port, | 453 | int mlx4_ib_send_to_slave(struct mlx4_ib_dev *dev, int slave, u8 port, |
@@ -458,10 +465,8 @@ int mlx4_ib_send_to_slave(struct mlx4_ib_dev *dev, int slave, u8 port, | |||
458 | unsigned tun_tx_ix = 0; | 465 | unsigned tun_tx_ix = 0; |
459 | int dqpn; | 466 | int dqpn; |
460 | int ret = 0; | 467 | int ret = 0; |
461 | int i; | ||
462 | int is_full_member = 0; | ||
463 | u16 tun_pkey_ix; | 468 | u16 tun_pkey_ix; |
464 | u8 ph_pkey_ix, full_pk_ix = 0, partial_pk_ix = 0; | 469 | u16 cached_pkey; |
465 | 470 | ||
466 | if (dest_qpt > IB_QPT_GSI) | 471 | if (dest_qpt > IB_QPT_GSI) |
467 | return -EINVAL; | 472 | return -EINVAL; |
@@ -481,27 +486,17 @@ int mlx4_ib_send_to_slave(struct mlx4_ib_dev *dev, int slave, u8 port, | |||
481 | else | 486 | else |
482 | tun_qp = &tun_ctx->qp[1]; | 487 | tun_qp = &tun_ctx->qp[1]; |
483 | 488 | ||
484 | /* compute pkey index for slave */ | 489 | /* compute P_Key index to put in tunnel header for slave */ |
485 | /* get physical pkey -- virtualized Dom0 pkey to phys*/ | ||
486 | if (dest_qpt) { | 490 | if (dest_qpt) { |
487 | ph_pkey_ix = | 491 | u16 pkey_ix; |
488 | dev->pkeys.virt2phys_pkey[mlx4_master_func_num(dev->dev)][port - 1][wc->pkey_index]; | 492 | ret = ib_get_cached_pkey(&dev->ib_dev, port, wc->pkey_index, &cached_pkey); |
489 | |||
490 | /* now, translate this to the slave pkey index */ | ||
491 | ret = get_pkey_phys_indices(dev, port, ph_pkey_ix, &full_pk_ix, | ||
492 | &partial_pk_ix, &is_full_member); | ||
493 | if (ret) | 493 | if (ret) |
494 | return -EINVAL; | 494 | return -EINVAL; |
495 | 495 | ||
496 | for (i = 0; i < dev->dev->caps.pkey_table_len[port]; i++) { | 496 | ret = find_slave_port_pkey_ix(dev, slave, port, cached_pkey, &pkey_ix); |
497 | if ((dev->pkeys.virt2phys_pkey[slave][port - 1][i] == full_pk_ix) || | 497 | if (ret) |
498 | (is_full_member && | ||
499 | (dev->pkeys.virt2phys_pkey[slave][port - 1][i] == partial_pk_ix))) | ||
500 | break; | ||
501 | } | ||
502 | if (i == dev->dev->caps.pkey_table_len[port]) | ||
503 | return -EINVAL; | 498 | return -EINVAL; |
504 | tun_pkey_ix = i; | 499 | tun_pkey_ix = pkey_ix; |
505 | } else | 500 | } else |
506 | tun_pkey_ix = dev->pkeys.virt2phys_pkey[slave][port - 1][0]; | 501 | tun_pkey_ix = dev->pkeys.virt2phys_pkey[slave][port - 1][0]; |
507 | 502 | ||
diff --git a/drivers/infiniband/hw/mlx4/mcg.c b/drivers/infiniband/hw/mlx4/mcg.c index 3c3b54c3fdd9..25b2cdff00f8 100644 --- a/drivers/infiniband/hw/mlx4/mcg.c +++ b/drivers/infiniband/hw/mlx4/mcg.c | |||
@@ -233,7 +233,8 @@ static int send_mad_to_slave(int slave, struct mlx4_ib_demux_ctx *ctx, | |||
233 | 233 | ||
234 | ib_query_ah(dev->sm_ah[ctx->port - 1], &ah_attr); | 234 | ib_query_ah(dev->sm_ah[ctx->port - 1], &ah_attr); |
235 | 235 | ||
236 | wc.pkey_index = 0; | 236 | if (ib_find_cached_pkey(&dev->ib_dev, ctx->port, IB_DEFAULT_PKEY_FULL, &wc.pkey_index)) |
237 | return -EINVAL; | ||
237 | wc.sl = 0; | 238 | wc.sl = 0; |
238 | wc.dlid_path_bits = 0; | 239 | wc.dlid_path_bits = 0; |
239 | wc.port_num = ctx->port; | 240 | wc.port_num = ctx->port; |
@@ -1074,10 +1075,6 @@ static void _mlx4_ib_mcg_port_cleanup(struct mlx4_ib_demux_ctx *ctx, int destroy | |||
1074 | unsigned long end; | 1075 | unsigned long end; |
1075 | int count; | 1076 | int count; |
1076 | 1077 | ||
1077 | if (ctx->flushing) | ||
1078 | return; | ||
1079 | |||
1080 | ctx->flushing = 1; | ||
1081 | for (i = 0; i < MAX_VFS; ++i) | 1078 | for (i = 0; i < MAX_VFS; ++i) |
1082 | clean_vf_mcast(ctx, i); | 1079 | clean_vf_mcast(ctx, i); |
1083 | 1080 | ||
@@ -1107,9 +1104,6 @@ static void _mlx4_ib_mcg_port_cleanup(struct mlx4_ib_demux_ctx *ctx, int destroy | |||
1107 | force_clean_group(group); | 1104 | force_clean_group(group); |
1108 | } | 1105 | } |
1109 | mutex_unlock(&ctx->mcg_table_lock); | 1106 | mutex_unlock(&ctx->mcg_table_lock); |
1110 | |||
1111 | if (!destroy_wq) | ||
1112 | ctx->flushing = 0; | ||
1113 | } | 1107 | } |
1114 | 1108 | ||
1115 | struct clean_work { | 1109 | struct clean_work { |
@@ -1123,6 +1117,7 @@ static void mcg_clean_task(struct work_struct *work) | |||
1123 | struct clean_work *cw = container_of(work, struct clean_work, work); | 1117 | struct clean_work *cw = container_of(work, struct clean_work, work); |
1124 | 1118 | ||
1125 | _mlx4_ib_mcg_port_cleanup(cw->ctx, cw->destroy_wq); | 1119 | _mlx4_ib_mcg_port_cleanup(cw->ctx, cw->destroy_wq); |
1120 | cw->ctx->flushing = 0; | ||
1126 | kfree(cw); | 1121 | kfree(cw); |
1127 | } | 1122 | } |
1128 | 1123 | ||
@@ -1130,13 +1125,20 @@ void mlx4_ib_mcg_port_cleanup(struct mlx4_ib_demux_ctx *ctx, int destroy_wq) | |||
1130 | { | 1125 | { |
1131 | struct clean_work *work; | 1126 | struct clean_work *work; |
1132 | 1127 | ||
1128 | if (ctx->flushing) | ||
1129 | return; | ||
1130 | |||
1131 | ctx->flushing = 1; | ||
1132 | |||
1133 | if (destroy_wq) { | 1133 | if (destroy_wq) { |
1134 | _mlx4_ib_mcg_port_cleanup(ctx, destroy_wq); | 1134 | _mlx4_ib_mcg_port_cleanup(ctx, destroy_wq); |
1135 | ctx->flushing = 0; | ||
1135 | return; | 1136 | return; |
1136 | } | 1137 | } |
1137 | 1138 | ||
1138 | work = kmalloc(sizeof *work, GFP_KERNEL); | 1139 | work = kmalloc(sizeof *work, GFP_KERNEL); |
1139 | if (!work) { | 1140 | if (!work) { |
1141 | ctx->flushing = 0; | ||
1140 | mcg_warn("failed allocating work for cleanup\n"); | 1142 | mcg_warn("failed allocating work for cleanup\n"); |
1141 | return; | 1143 | return; |
1142 | } | 1144 | } |
diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c index 6ae2ac47c9c8..f0f8928b3c8a 100644 --- a/drivers/input/evdev.c +++ b/drivers/input/evdev.c | |||
@@ -292,7 +292,6 @@ static int evdev_release(struct inode *inode, struct file *file) | |||
292 | kfree(client); | 292 | kfree(client); |
293 | 293 | ||
294 | evdev_close_device(evdev); | 294 | evdev_close_device(evdev); |
295 | put_device(&evdev->dev); | ||
296 | 295 | ||
297 | return 0; | 296 | return 0; |
298 | } | 297 | } |
@@ -331,7 +330,6 @@ static int evdev_open(struct inode *inode, struct file *file) | |||
331 | file->private_data = client; | 330 | file->private_data = client; |
332 | nonseekable_open(inode, file); | 331 | nonseekable_open(inode, file); |
333 | 332 | ||
334 | get_device(&evdev->dev); | ||
335 | return 0; | 333 | return 0; |
336 | 334 | ||
337 | err_free_client: | 335 | err_free_client: |
@@ -1001,6 +999,7 @@ static int evdev_connect(struct input_handler *handler, struct input_dev *dev, | |||
1001 | goto err_free_evdev; | 999 | goto err_free_evdev; |
1002 | 1000 | ||
1003 | cdev_init(&evdev->cdev, &evdev_fops); | 1001 | cdev_init(&evdev->cdev, &evdev_fops); |
1002 | evdev->cdev.kobj.parent = &evdev->dev.kobj; | ||
1004 | error = cdev_add(&evdev->cdev, evdev->dev.devt, 1); | 1003 | error = cdev_add(&evdev->cdev, evdev->dev.devt, 1); |
1005 | if (error) | 1004 | if (error) |
1006 | goto err_unregister_handle; | 1005 | goto err_unregister_handle; |
diff --git a/drivers/input/joydev.c b/drivers/input/joydev.c index b62b5891f399..f362883c94e3 100644 --- a/drivers/input/joydev.c +++ b/drivers/input/joydev.c | |||
@@ -243,7 +243,6 @@ static int joydev_release(struct inode *inode, struct file *file) | |||
243 | kfree(client); | 243 | kfree(client); |
244 | 244 | ||
245 | joydev_close_device(joydev); | 245 | joydev_close_device(joydev); |
246 | put_device(&joydev->dev); | ||
247 | 246 | ||
248 | return 0; | 247 | return 0; |
249 | } | 248 | } |
@@ -270,7 +269,6 @@ static int joydev_open(struct inode *inode, struct file *file) | |||
270 | file->private_data = client; | 269 | file->private_data = client; |
271 | nonseekable_open(inode, file); | 270 | nonseekable_open(inode, file); |
272 | 271 | ||
273 | get_device(&joydev->dev); | ||
274 | return 0; | 272 | return 0; |
275 | 273 | ||
276 | err_free_client: | 274 | err_free_client: |
@@ -858,6 +856,7 @@ static int joydev_connect(struct input_handler *handler, struct input_dev *dev, | |||
858 | goto err_free_joydev; | 856 | goto err_free_joydev; |
859 | 857 | ||
860 | cdev_init(&joydev->cdev, &joydev_fops); | 858 | cdev_init(&joydev->cdev, &joydev_fops); |
859 | joydev->cdev.kobj.parent = &joydev->dev.kobj; | ||
861 | error = cdev_add(&joydev->cdev, joydev->dev.devt, 1); | 860 | error = cdev_add(&joydev->cdev, joydev->dev.devt, 1); |
862 | if (error) | 861 | if (error) |
863 | goto err_unregister_handle; | 862 | goto err_unregister_handle; |
diff --git a/drivers/input/mousedev.c b/drivers/input/mousedev.c index a1b4c37956b2..8f02e3d0e712 100644 --- a/drivers/input/mousedev.c +++ b/drivers/input/mousedev.c | |||
@@ -523,7 +523,6 @@ static int mousedev_release(struct inode *inode, struct file *file) | |||
523 | kfree(client); | 523 | kfree(client); |
524 | 524 | ||
525 | mousedev_close_device(mousedev); | 525 | mousedev_close_device(mousedev); |
526 | put_device(&mousedev->dev); | ||
527 | 526 | ||
528 | return 0; | 527 | return 0; |
529 | } | 528 | } |
@@ -558,7 +557,6 @@ static int mousedev_open(struct inode *inode, struct file *file) | |||
558 | file->private_data = client; | 557 | file->private_data = client; |
559 | nonseekable_open(inode, file); | 558 | nonseekable_open(inode, file); |
560 | 559 | ||
561 | get_device(&mousedev->dev); | ||
562 | return 0; | 560 | return 0; |
563 | 561 | ||
564 | err_free_client: | 562 | err_free_client: |
@@ -892,6 +890,7 @@ static struct mousedev *mousedev_create(struct input_dev *dev, | |||
892 | } | 890 | } |
893 | 891 | ||
894 | cdev_init(&mousedev->cdev, &mousedev_fops); | 892 | cdev_init(&mousedev->cdev, &mousedev_fops); |
893 | mousedev->cdev.kobj.parent = &mousedev->dev.kobj; | ||
895 | error = cdev_add(&mousedev->cdev, mousedev->dev.devt, 1); | 894 | error = cdev_add(&mousedev->cdev, mousedev->dev.devt, 1); |
896 | if (error) | 895 | if (error) |
897 | goto err_unregister_handle; | 896 | goto err_unregister_handle; |
diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c index 9edf9806cff9..2c1e12bf2ab4 100644 --- a/drivers/input/tablet/wacom_sys.c +++ b/drivers/input/tablet/wacom_sys.c | |||
@@ -391,7 +391,7 @@ static int wacom_parse_hid(struct usb_interface *intf, | |||
391 | features->pktlen = WACOM_PKGLEN_TPC2FG; | 391 | features->pktlen = WACOM_PKGLEN_TPC2FG; |
392 | } | 392 | } |
393 | 393 | ||
394 | if (features->type == MTSCREEN) | 394 | if (features->type == MTSCREEN || WACOM_24HDT) |
395 | features->pktlen = WACOM_PKGLEN_MTOUCH; | 395 | features->pktlen = WACOM_PKGLEN_MTOUCH; |
396 | 396 | ||
397 | if (features->type == BAMBOO_PT) { | 397 | if (features->type == BAMBOO_PT) { |
@@ -402,6 +402,14 @@ static int wacom_parse_hid(struct usb_interface *intf, | |||
402 | features->x_max = | 402 | features->x_max = |
403 | get_unaligned_le16(&report[i + 8]); | 403 | get_unaligned_le16(&report[i + 8]); |
404 | i += 15; | 404 | i += 15; |
405 | } else if (features->type == WACOM_24HDT) { | ||
406 | features->x_max = | ||
407 | get_unaligned_le16(&report[i + 3]); | ||
408 | features->x_phy = | ||
409 | get_unaligned_le16(&report[i + 8]); | ||
410 | features->unit = report[i - 1]; | ||
411 | features->unitExpo = report[i - 3]; | ||
412 | i += 12; | ||
405 | } else { | 413 | } else { |
406 | features->x_max = | 414 | features->x_max = |
407 | get_unaligned_le16(&report[i + 3]); | 415 | get_unaligned_le16(&report[i + 3]); |
@@ -434,6 +442,12 @@ static int wacom_parse_hid(struct usb_interface *intf, | |||
434 | features->y_phy = | 442 | features->y_phy = |
435 | get_unaligned_le16(&report[i + 6]); | 443 | get_unaligned_le16(&report[i + 6]); |
436 | i += 7; | 444 | i += 7; |
445 | } else if (type == WACOM_24HDT) { | ||
446 | features->y_max = | ||
447 | get_unaligned_le16(&report[i + 3]); | ||
448 | features->y_phy = | ||
449 | get_unaligned_le16(&report[i - 2]); | ||
450 | i += 7; | ||
437 | } else if (type == BAMBOO_PT) { | 451 | } else if (type == BAMBOO_PT) { |
438 | features->y_phy = | 452 | features->y_phy = |
439 | get_unaligned_le16(&report[i + 3]); | 453 | get_unaligned_le16(&report[i + 3]); |
@@ -541,6 +555,9 @@ static int wacom_query_tablet_data(struct usb_interface *intf, struct wacom_feat | |||
541 | /* MT Tablet PC touch */ | 555 | /* MT Tablet PC touch */ |
542 | return wacom_set_device_mode(intf, 3, 4, 4); | 556 | return wacom_set_device_mode(intf, 3, 4, 4); |
543 | } | 557 | } |
558 | else if (features->type == WACOM_24HDT) { | ||
559 | return wacom_set_device_mode(intf, 18, 3, 2); | ||
560 | } | ||
544 | } else if (features->device_type == BTN_TOOL_PEN) { | 561 | } else if (features->device_type == BTN_TOOL_PEN) { |
545 | if (features->type <= BAMBOO_PT && features->type != WIRELESS) { | 562 | if (features->type <= BAMBOO_PT && features->type != WIRELESS) { |
546 | return wacom_set_device_mode(intf, 2, 2, 2); | 563 | return wacom_set_device_mode(intf, 2, 2, 2); |
@@ -613,6 +630,30 @@ struct wacom_usbdev_data { | |||
613 | static LIST_HEAD(wacom_udev_list); | 630 | static LIST_HEAD(wacom_udev_list); |
614 | static DEFINE_MUTEX(wacom_udev_list_lock); | 631 | static DEFINE_MUTEX(wacom_udev_list_lock); |
615 | 632 | ||
633 | static struct usb_device *wacom_get_sibling(struct usb_device *dev, int vendor, int product) | ||
634 | { | ||
635 | int port1; | ||
636 | struct usb_device *sibling; | ||
637 | |||
638 | if (vendor == 0 && product == 0) | ||
639 | return dev; | ||
640 | |||
641 | if (dev->parent == NULL) | ||
642 | return NULL; | ||
643 | |||
644 | usb_hub_for_each_child(dev->parent, port1, sibling) { | ||
645 | struct usb_device_descriptor *d; | ||
646 | if (sibling == NULL) | ||
647 | continue; | ||
648 | |||
649 | d = &sibling->descriptor; | ||
650 | if (d->idVendor == vendor && d->idProduct == product) | ||
651 | return sibling; | ||
652 | } | ||
653 | |||
654 | return NULL; | ||
655 | } | ||
656 | |||
616 | static struct wacom_usbdev_data *wacom_get_usbdev_data(struct usb_device *dev) | 657 | static struct wacom_usbdev_data *wacom_get_usbdev_data(struct usb_device *dev) |
617 | { | 658 | { |
618 | struct wacom_usbdev_data *data; | 659 | struct wacom_usbdev_data *data; |
@@ -1257,13 +1298,19 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i | |||
1257 | strlcpy(wacom_wac->name, features->name, sizeof(wacom_wac->name)); | 1298 | strlcpy(wacom_wac->name, features->name, sizeof(wacom_wac->name)); |
1258 | 1299 | ||
1259 | if (features->quirks & WACOM_QUIRK_MULTI_INPUT) { | 1300 | if (features->quirks & WACOM_QUIRK_MULTI_INPUT) { |
1301 | struct usb_device *other_dev; | ||
1302 | |||
1260 | /* Append the device type to the name */ | 1303 | /* Append the device type to the name */ |
1261 | strlcat(wacom_wac->name, | 1304 | strlcat(wacom_wac->name, |
1262 | features->device_type == BTN_TOOL_PEN ? | 1305 | features->device_type == BTN_TOOL_PEN ? |
1263 | " Pen" : " Finger", | 1306 | " Pen" : " Finger", |
1264 | sizeof(wacom_wac->name)); | 1307 | sizeof(wacom_wac->name)); |
1265 | 1308 | ||
1266 | error = wacom_add_shared_data(wacom_wac, dev); | 1309 | |
1310 | other_dev = wacom_get_sibling(dev, features->oVid, features->oPid); | ||
1311 | if (other_dev == NULL || wacom_get_usbdev_data(other_dev) == NULL) | ||
1312 | other_dev = dev; | ||
1313 | error = wacom_add_shared_data(wacom_wac, other_dev); | ||
1267 | if (error) | 1314 | if (error) |
1268 | goto fail3; | 1315 | goto fail3; |
1269 | } | 1316 | } |
diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c index c3468c8dbd89..aa6010131179 100644 --- a/drivers/input/tablet/wacom_wac.c +++ b/drivers/input/tablet/wacom_wac.c | |||
@@ -806,6 +806,70 @@ static int find_slot_from_contactid(struct wacom_wac *wacom, int contactid) | |||
806 | return -1; | 806 | return -1; |
807 | } | 807 | } |
808 | 808 | ||
809 | static int int_dist(int x1, int y1, int x2, int y2) | ||
810 | { | ||
811 | int x = x2 - x1; | ||
812 | int y = y2 - y1; | ||
813 | |||
814 | return int_sqrt(x*x + y*y); | ||
815 | } | ||
816 | |||
817 | static int wacom_24hdt_irq(struct wacom_wac *wacom) | ||
818 | { | ||
819 | struct input_dev *input = wacom->input; | ||
820 | char *data = wacom->data; | ||
821 | int i; | ||
822 | int current_num_contacts = data[61]; | ||
823 | int contacts_to_send = 0; | ||
824 | |||
825 | /* | ||
826 | * First packet resets the counter since only the first | ||
827 | * packet in series will have non-zero current_num_contacts. | ||
828 | */ | ||
829 | if (current_num_contacts) | ||
830 | wacom->num_contacts_left = current_num_contacts; | ||
831 | |||
832 | /* There are at most 4 contacts per packet */ | ||
833 | contacts_to_send = min(4, wacom->num_contacts_left); | ||
834 | |||
835 | for (i = 0; i < contacts_to_send; i++) { | ||
836 | int offset = (WACOM_BYTES_PER_24HDT_PACKET * i) + 1; | ||
837 | bool touch = data[offset] & 0x1 && !wacom->shared->stylus_in_proximity; | ||
838 | int id = data[offset + 1]; | ||
839 | int slot = find_slot_from_contactid(wacom, id); | ||
840 | |||
841 | if (slot < 0) | ||
842 | continue; | ||
843 | input_mt_slot(input, slot); | ||
844 | input_mt_report_slot_state(input, MT_TOOL_FINGER, touch); | ||
845 | |||
846 | if (touch) { | ||
847 | int t_x = le16_to_cpup((__le16 *)&data[offset + 2]); | ||
848 | int c_x = le16_to_cpup((__le16 *)&data[offset + 4]); | ||
849 | int t_y = le16_to_cpup((__le16 *)&data[offset + 6]); | ||
850 | int c_y = le16_to_cpup((__le16 *)&data[offset + 8]); | ||
851 | int w = le16_to_cpup((__le16 *)&data[offset + 10]); | ||
852 | int h = le16_to_cpup((__le16 *)&data[offset + 12]); | ||
853 | |||
854 | input_report_abs(input, ABS_MT_POSITION_X, t_x); | ||
855 | input_report_abs(input, ABS_MT_POSITION_Y, t_y); | ||
856 | input_report_abs(input, ABS_MT_TOUCH_MAJOR, min(w,h)); | ||
857 | input_report_abs(input, ABS_MT_WIDTH_MAJOR, min(w, h) + int_dist(t_x, t_y, c_x, c_y)); | ||
858 | input_report_abs(input, ABS_MT_WIDTH_MINOR, min(w, h)); | ||
859 | input_report_abs(input, ABS_MT_ORIENTATION, w > h); | ||
860 | } | ||
861 | wacom->slots[slot] = touch ? id : -1; | ||
862 | } | ||
863 | |||
864 | input_mt_report_pointer_emulation(input, true); | ||
865 | |||
866 | wacom->num_contacts_left -= contacts_to_send; | ||
867 | if (wacom->num_contacts_left <= 0) | ||
868 | wacom->num_contacts_left = 0; | ||
869 | |||
870 | return 1; | ||
871 | } | ||
872 | |||
809 | static int wacom_mt_touch(struct wacom_wac *wacom) | 873 | static int wacom_mt_touch(struct wacom_wac *wacom) |
810 | { | 874 | { |
811 | struct input_dev *input = wacom->input; | 875 | struct input_dev *input = wacom->input; |
@@ -1255,6 +1319,10 @@ void wacom_wac_irq(struct wacom_wac *wacom_wac, size_t len) | |||
1255 | sync = wacom_intuos_irq(wacom_wac); | 1319 | sync = wacom_intuos_irq(wacom_wac); |
1256 | break; | 1320 | break; |
1257 | 1321 | ||
1322 | case WACOM_24HDT: | ||
1323 | sync = wacom_24hdt_irq(wacom_wac); | ||
1324 | break; | ||
1325 | |||
1258 | case INTUOS5S: | 1326 | case INTUOS5S: |
1259 | case INTUOS5: | 1327 | case INTUOS5: |
1260 | case INTUOS5L: | 1328 | case INTUOS5L: |
@@ -1340,7 +1408,8 @@ void wacom_setup_device_quirks(struct wacom_features *features) | |||
1340 | 1408 | ||
1341 | /* these device have multiple inputs */ | 1409 | /* these device have multiple inputs */ |
1342 | if (features->type >= WIRELESS || | 1410 | if (features->type >= WIRELESS || |
1343 | (features->type >= INTUOS5S && features->type <= INTUOS5L)) | 1411 | (features->type >= INTUOS5S && features->type <= INTUOS5L) || |
1412 | (features->oVid && features->oPid)) | ||
1344 | features->quirks |= WACOM_QUIRK_MULTI_INPUT; | 1413 | features->quirks |= WACOM_QUIRK_MULTI_INPUT; |
1345 | 1414 | ||
1346 | /* quirk for bamboo touch with 2 low res touches */ | 1415 | /* quirk for bamboo touch with 2 low res touches */ |
@@ -1575,6 +1644,15 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev, | |||
1575 | __set_bit(INPUT_PROP_POINTER, input_dev->propbit); | 1644 | __set_bit(INPUT_PROP_POINTER, input_dev->propbit); |
1576 | break; | 1645 | break; |
1577 | 1646 | ||
1647 | case WACOM_24HDT: | ||
1648 | if (features->device_type == BTN_TOOL_FINGER) { | ||
1649 | input_set_abs_params(input_dev, ABS_MT_TOUCH_MAJOR, 0, features->x_max, 0, 0); | ||
1650 | input_set_abs_params(input_dev, ABS_MT_WIDTH_MAJOR, 0, features->x_max, 0, 0); | ||
1651 | input_set_abs_params(input_dev, ABS_MT_WIDTH_MINOR, 0, features->y_max, 0, 0); | ||
1652 | input_set_abs_params(input_dev, ABS_MT_ORIENTATION, 0, 1, 0, 0); | ||
1653 | } | ||
1654 | /* fall through */ | ||
1655 | |||
1578 | case MTSCREEN: | 1656 | case MTSCREEN: |
1579 | if (features->device_type == BTN_TOOL_FINGER) { | 1657 | if (features->device_type == BTN_TOOL_FINGER) { |
1580 | wacom_wac->slots = kmalloc(features->touch_max * | 1658 | wacom_wac->slots = kmalloc(features->touch_max * |
@@ -1869,8 +1947,11 @@ static const struct wacom_features wacom_features_0xF4 = | |||
1869 | { "Wacom Cintiq 24HD", WACOM_PKGLEN_INTUOS, 104480, 65600, 2047, | 1947 | { "Wacom Cintiq 24HD", WACOM_PKGLEN_INTUOS, 104480, 65600, 2047, |
1870 | 63, WACOM_24HD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; | 1948 | 63, WACOM_24HD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; |
1871 | static const struct wacom_features wacom_features_0xF8 = | 1949 | static const struct wacom_features wacom_features_0xF8 = |
1872 | { "Wacom Cintiq 24HD touch", WACOM_PKGLEN_INTUOS, 104480, 65600, 2047, | 1950 | { "Wacom Cintiq 24HD touch", WACOM_PKGLEN_INTUOS, 104480, 65600, 2047, /* Pen */ |
1873 | 63, WACOM_24HD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; | 1951 | 63, WACOM_24HD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, .oVid = USB_VENDOR_ID_WACOM, .oPid = 0xf6 }; |
1952 | static const struct wacom_features wacom_features_0xF6 = | ||
1953 | { "Wacom Cintiq 24HD touch", .type = WACOM_24HDT, /* Touch */ | ||
1954 | .oVid = USB_VENDOR_ID_WACOM, .oPid = 0xf8, .touch_max = 10 }; | ||
1874 | static const struct wacom_features wacom_features_0x3F = | 1955 | static const struct wacom_features wacom_features_0x3F = |
1875 | { "Wacom Cintiq 21UX", WACOM_PKGLEN_INTUOS, 87200, 65600, 1023, | 1956 | { "Wacom Cintiq 21UX", WACOM_PKGLEN_INTUOS, 87200, 65600, 1023, |
1876 | 63, CINTIQ, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; | 1957 | 63, CINTIQ, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; |
@@ -2113,6 +2194,7 @@ const struct usb_device_id wacom_ids[] = { | |||
2113 | { USB_DEVICE_WACOM(0x47) }, | 2194 | { USB_DEVICE_WACOM(0x47) }, |
2114 | { USB_DEVICE_WACOM(0xF4) }, | 2195 | { USB_DEVICE_WACOM(0xF4) }, |
2115 | { USB_DEVICE_WACOM(0xF8) }, | 2196 | { USB_DEVICE_WACOM(0xF8) }, |
2197 | { USB_DEVICE_WACOM(0xF6) }, | ||
2116 | { USB_DEVICE_WACOM(0xFA) }, | 2198 | { USB_DEVICE_WACOM(0xFA) }, |
2117 | { USB_DEVICE_LENOVO(0x6004) }, | 2199 | { USB_DEVICE_LENOVO(0x6004) }, |
2118 | { } | 2200 | { } |
diff --git a/drivers/input/tablet/wacom_wac.h b/drivers/input/tablet/wacom_wac.h index 96c185cc301e..345f1e76975e 100644 --- a/drivers/input/tablet/wacom_wac.h +++ b/drivers/input/tablet/wacom_wac.h | |||
@@ -29,6 +29,7 @@ | |||
29 | 29 | ||
30 | /* wacom data size per MT contact */ | 30 | /* wacom data size per MT contact */ |
31 | #define WACOM_BYTES_PER_MT_PACKET 11 | 31 | #define WACOM_BYTES_PER_MT_PACKET 11 |
32 | #define WACOM_BYTES_PER_24HDT_PACKET 14 | ||
32 | 33 | ||
33 | /* device IDs */ | 34 | /* device IDs */ |
34 | #define STYLUS_DEVICE_ID 0x02 | 35 | #define STYLUS_DEVICE_ID 0x02 |
@@ -49,6 +50,7 @@ | |||
49 | #define WACOM_REPORT_TPCHID 15 | 50 | #define WACOM_REPORT_TPCHID 15 |
50 | #define WACOM_REPORT_TPCST 16 | 51 | #define WACOM_REPORT_TPCST 16 |
51 | #define WACOM_REPORT_TPC1FGE 18 | 52 | #define WACOM_REPORT_TPC1FGE 18 |
53 | #define WACOM_REPORT_24HDT 1 | ||
52 | 54 | ||
53 | /* device quirks */ | 55 | /* device quirks */ |
54 | #define WACOM_QUIRK_MULTI_INPUT 0x0001 | 56 | #define WACOM_QUIRK_MULTI_INPUT 0x0001 |
@@ -81,6 +83,7 @@ enum { | |||
81 | WACOM_MO, | 83 | WACOM_MO, |
82 | WIRELESS, | 84 | WIRELESS, |
83 | BAMBOO_PT, | 85 | BAMBOO_PT, |
86 | WACOM_24HDT, | ||
84 | TABLETPC, /* add new TPC below */ | 87 | TABLETPC, /* add new TPC below */ |
85 | TABLETPCE, | 88 | TABLETPCE, |
86 | TABLETPC2FG, | 89 | TABLETPC2FG, |
@@ -109,6 +112,8 @@ struct wacom_features { | |||
109 | int distance_fuzz; | 112 | int distance_fuzz; |
110 | unsigned quirks; | 113 | unsigned quirks; |
111 | unsigned touch_max; | 114 | unsigned touch_max; |
115 | int oVid; | ||
116 | int oPid; | ||
112 | }; | 117 | }; |
113 | 118 | ||
114 | struct wacom_shared { | 119 | struct wacom_shared { |
diff --git a/drivers/input/touchscreen/atmel_tsadcc.c b/drivers/input/touchscreen/atmel_tsadcc.c index 201b2d2ec1b3..ea392ee138ed 100644 --- a/drivers/input/touchscreen/atmel_tsadcc.c +++ b/drivers/input/touchscreen/atmel_tsadcc.c | |||
@@ -22,7 +22,7 @@ | |||
22 | #include <linux/clk.h> | 22 | #include <linux/clk.h> |
23 | #include <linux/platform_device.h> | 23 | #include <linux/platform_device.h> |
24 | #include <linux/io.h> | 24 | #include <linux/io.h> |
25 | #include <mach/board.h> | 25 | #include <linux/platform_data/atmel.h> |
26 | #include <mach/cpu.h> | 26 | #include <mach/cpu.h> |
27 | 27 | ||
28 | /* Register definitions based on AT91SAM9RL64 preliminary draft datasheet */ | 28 | /* Register definitions based on AT91SAM9RL64 preliminary draft datasheet */ |
diff --git a/drivers/iommu/amd_iommu_init.c b/drivers/iommu/amd_iommu_init.c index 18b0d99bd4d6..81837b0710a9 100644 --- a/drivers/iommu/amd_iommu_init.c +++ b/drivers/iommu/amd_iommu_init.c | |||
@@ -1599,21 +1599,46 @@ static void __init free_on_init_error(void) | |||
1599 | #endif | 1599 | #endif |
1600 | } | 1600 | } |
1601 | 1601 | ||
1602 | /* SB IOAPIC is always on this device in AMD systems */ | ||
1603 | #define IOAPIC_SB_DEVID ((0x00 << 8) | PCI_DEVFN(0x14, 0)) | ||
1604 | |||
1602 | static bool __init check_ioapic_information(void) | 1605 | static bool __init check_ioapic_information(void) |
1603 | { | 1606 | { |
1607 | bool ret, has_sb_ioapic; | ||
1604 | int idx; | 1608 | int idx; |
1605 | 1609 | ||
1606 | for (idx = 0; idx < nr_ioapics; idx++) { | 1610 | has_sb_ioapic = false; |
1607 | int id = mpc_ioapic_id(idx); | 1611 | ret = false; |
1608 | 1612 | ||
1609 | if (get_ioapic_devid(id) < 0) { | 1613 | for (idx = 0; idx < nr_ioapics; idx++) { |
1610 | pr_err(FW_BUG "AMD-Vi: IO-APIC[%d] not in IVRS table\n", id); | 1614 | int devid, id = mpc_ioapic_id(idx); |
1611 | pr_err("AMD-Vi: Disabling interrupt remapping due to BIOS Bug\n"); | 1615 | |
1612 | return false; | 1616 | devid = get_ioapic_devid(id); |
1617 | if (devid < 0) { | ||
1618 | pr_err(FW_BUG "AMD-Vi: IOAPIC[%d] not in IVRS table\n", id); | ||
1619 | ret = false; | ||
1620 | } else if (devid == IOAPIC_SB_DEVID) { | ||
1621 | has_sb_ioapic = true; | ||
1622 | ret = true; | ||
1613 | } | 1623 | } |
1614 | } | 1624 | } |
1615 | 1625 | ||
1616 | return true; | 1626 | if (!has_sb_ioapic) { |
1627 | /* | ||
1628 | * We expect the SB IOAPIC to be listed in the IVRS | ||
1629 | * table. The system timer is connected to the SB IOAPIC | ||
1630 | * and if we don't have it in the list the system will | ||
1631 | * panic at boot time. This situation usually happens | ||
1632 | * when the BIOS is buggy and provides us the wrong | ||
1633 | * device id for the IOAPIC in the system. | ||
1634 | */ | ||
1635 | pr_err(FW_BUG "AMD-Vi: No southbridge IOAPIC found in IVRS table\n"); | ||
1636 | } | ||
1637 | |||
1638 | if (!ret) | ||
1639 | pr_err("AMD-Vi: Disabling interrupt remapping due to BIOS Bug(s)\n"); | ||
1640 | |||
1641 | return ret; | ||
1617 | } | 1642 | } |
1618 | 1643 | ||
1619 | static void __init free_dma_resources(void) | 1644 | static void __init free_dma_resources(void) |
diff --git a/drivers/iommu/tegra-smmu.c b/drivers/iommu/tegra-smmu.c index 0b4d62e0c645..a649f146d17b 100644 --- a/drivers/iommu/tegra-smmu.c +++ b/drivers/iommu/tegra-smmu.c | |||
@@ -200,7 +200,7 @@ enum { | |||
200 | 200 | ||
201 | #define SMMU_ADDR_TO_PFN(addr) ((addr) >> 12) | 201 | #define SMMU_ADDR_TO_PFN(addr) ((addr) >> 12) |
202 | #define SMMU_ADDR_TO_PDN(addr) ((addr) >> 22) | 202 | #define SMMU_ADDR_TO_PDN(addr) ((addr) >> 22) |
203 | #define SMMU_PDN_TO_ADDR(addr) ((pdn) << 22) | 203 | #define SMMU_PDN_TO_ADDR(pdn) ((pdn) << 22) |
204 | 204 | ||
205 | #define _READABLE (1 << SMMU_PTB_DATA_ASID_READABLE_SHIFT) | 205 | #define _READABLE (1 << SMMU_PTB_DATA_ASID_READABLE_SHIFT) |
206 | #define _WRITABLE (1 << SMMU_PTB_DATA_ASID_WRITABLE_SHIFT) | 206 | #define _WRITABLE (1 << SMMU_PTB_DATA_ASID_WRITABLE_SHIFT) |
diff --git a/drivers/isdn/gigaset/bas-gigaset.c b/drivers/isdn/gigaset/bas-gigaset.c index 527588708948..c44950d3eb7b 100644 --- a/drivers/isdn/gigaset/bas-gigaset.c +++ b/drivers/isdn/gigaset/bas-gigaset.c | |||
@@ -617,7 +617,13 @@ static void int_in_work(struct work_struct *work) | |||
617 | if (rc == 0) | 617 | if (rc == 0) |
618 | /* success, resubmit interrupt read URB */ | 618 | /* success, resubmit interrupt read URB */ |
619 | rc = usb_submit_urb(urb, GFP_ATOMIC); | 619 | rc = usb_submit_urb(urb, GFP_ATOMIC); |
620 | if (rc != 0 && rc != -ENODEV) { | 620 | |
621 | switch (rc) { | ||
622 | case 0: /* success */ | ||
623 | case -ENODEV: /* device gone */ | ||
624 | case -EINVAL: /* URB already resubmitted, or terminal badness */ | ||
625 | break; | ||
626 | default: /* failure: try to recover by resetting the device */ | ||
621 | dev_err(cs->dev, "clear halt failed: %s\n", get_usb_rcmsg(rc)); | 627 | dev_err(cs->dev, "clear halt failed: %s\n", get_usb_rcmsg(rc)); |
622 | rc = usb_lock_device_for_reset(ucs->udev, ucs->interface); | 628 | rc = usb_lock_device_for_reset(ucs->udev, ucs->interface); |
623 | if (rc == 0) { | 629 | if (rc == 0) { |
@@ -2442,7 +2448,9 @@ static void gigaset_disconnect(struct usb_interface *interface) | |||
2442 | } | 2448 | } |
2443 | 2449 | ||
2444 | /* gigaset_suspend | 2450 | /* gigaset_suspend |
2445 | * This function is called before the USB connection is suspended. | 2451 | * This function is called before the USB connection is suspended |
2452 | * or before the USB device is reset. | ||
2453 | * In the latter case, message == PMSG_ON. | ||
2446 | */ | 2454 | */ |
2447 | static int gigaset_suspend(struct usb_interface *intf, pm_message_t message) | 2455 | static int gigaset_suspend(struct usb_interface *intf, pm_message_t message) |
2448 | { | 2456 | { |
@@ -2498,7 +2506,12 @@ static int gigaset_suspend(struct usb_interface *intf, pm_message_t message) | |||
2498 | del_timer_sync(&ucs->timer_atrdy); | 2506 | del_timer_sync(&ucs->timer_atrdy); |
2499 | del_timer_sync(&ucs->timer_cmd_in); | 2507 | del_timer_sync(&ucs->timer_cmd_in); |
2500 | del_timer_sync(&ucs->timer_int_in); | 2508 | del_timer_sync(&ucs->timer_int_in); |
2501 | cancel_work_sync(&ucs->int_in_wq); | 2509 | |
2510 | /* don't try to cancel int_in_wq from within reset as it | ||
2511 | * might be the one requesting the reset | ||
2512 | */ | ||
2513 | if (message.event != PM_EVENT_ON) | ||
2514 | cancel_work_sync(&ucs->int_in_wq); | ||
2502 | 2515 | ||
2503 | gig_dbg(DEBUG_SUSPEND, "suspend complete"); | 2516 | gig_dbg(DEBUG_SUSPEND, "suspend complete"); |
2504 | return 0; | 2517 | return 0; |
diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c index ddf096e3803f..868998925826 100644 --- a/drivers/mmc/host/atmel-mci.c +++ b/drivers/mmc/host/atmel-mci.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <linux/slab.h> | 28 | #include <linux/slab.h> |
29 | #include <linux/stat.h> | 29 | #include <linux/stat.h> |
30 | #include <linux/types.h> | 30 | #include <linux/types.h> |
31 | #include <linux/platform_data/atmel.h> | ||
31 | 32 | ||
32 | #include <linux/mmc/host.h> | 33 | #include <linux/mmc/host.h> |
33 | #include <linux/mmc/sdio.h> | 34 | #include <linux/mmc/sdio.h> |
@@ -40,7 +41,6 @@ | |||
40 | #include <asm/unaligned.h> | 41 | #include <asm/unaligned.h> |
41 | 42 | ||
42 | #include <mach/cpu.h> | 43 | #include <mach/cpu.h> |
43 | #include <mach/board.h> | ||
44 | 44 | ||
45 | #include "atmel-mci-regs.h" | 45 | #include "atmel-mci-regs.h" |
46 | 46 | ||
diff --git a/drivers/net/can/at91_can.c b/drivers/net/can/at91_can.c index fcff73a73b1d..994b6acd65f4 100644 --- a/drivers/net/can/at91_can.c +++ b/drivers/net/can/at91_can.c | |||
@@ -33,12 +33,11 @@ | |||
33 | #include <linux/spinlock.h> | 33 | #include <linux/spinlock.h> |
34 | #include <linux/string.h> | 34 | #include <linux/string.h> |
35 | #include <linux/types.h> | 35 | #include <linux/types.h> |
36 | #include <linux/platform_data/atmel.h> | ||
36 | 37 | ||
37 | #include <linux/can/dev.h> | 38 | #include <linux/can/dev.h> |
38 | #include <linux/can/error.h> | 39 | #include <linux/can/error.h> |
39 | 40 | ||
40 | #include <mach/board.h> | ||
41 | |||
42 | #define AT91_MB_MASK(i) ((1 << (i)) - 1) | 41 | #define AT91_MB_MASK(i) ((1 << (i)) - 1) |
43 | 42 | ||
44 | /* Common registers */ | 43 | /* Common registers */ |
diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c index c78ecfca1e45..a412bf6d73ef 100644 --- a/drivers/net/can/flexcan.c +++ b/drivers/net/can/flexcan.c | |||
@@ -144,9 +144,22 @@ | |||
144 | 144 | ||
145 | #define FLEXCAN_MB_CODE_MASK (0xf0ffffff) | 145 | #define FLEXCAN_MB_CODE_MASK (0xf0ffffff) |
146 | 146 | ||
147 | /* FLEXCAN hardware feature flags */ | 147 | /* |
148 | * FLEXCAN hardware feature flags | ||
149 | * | ||
150 | * Below is some version info we got: | ||
151 | * SOC Version IP-Version Glitch- [TR]WRN_INT | ||
152 | * Filter? connected? | ||
153 | * MX25 FlexCAN2 03.00.00.00 no no | ||
154 | * MX28 FlexCAN2 03.00.04.00 yes yes | ||
155 | * MX35 FlexCAN2 03.00.00.00 no no | ||
156 | * MX53 FlexCAN2 03.00.00.00 yes no | ||
157 | * MX6s FlexCAN3 10.00.12.00 yes yes | ||
158 | * | ||
159 | * Some SOCs do not have the RX_WARN & TX_WARN interrupt line connected. | ||
160 | */ | ||
148 | #define FLEXCAN_HAS_V10_FEATURES BIT(1) /* For core version >= 10 */ | 161 | #define FLEXCAN_HAS_V10_FEATURES BIT(1) /* For core version >= 10 */ |
149 | #define FLEXCAN_HAS_BROKEN_ERR_STATE BIT(2) /* Broken error state handling */ | 162 | #define FLEXCAN_HAS_BROKEN_ERR_STATE BIT(2) /* [TR]WRN_INT not connected */ |
150 | 163 | ||
151 | /* Structure of the message buffer */ | 164 | /* Structure of the message buffer */ |
152 | struct flexcan_mb { | 165 | struct flexcan_mb { |
@@ -205,7 +218,7 @@ static struct flexcan_devtype_data fsl_p1010_devtype_data = { | |||
205 | }; | 218 | }; |
206 | static struct flexcan_devtype_data fsl_imx28_devtype_data; | 219 | static struct flexcan_devtype_data fsl_imx28_devtype_data; |
207 | static struct flexcan_devtype_data fsl_imx6q_devtype_data = { | 220 | static struct flexcan_devtype_data fsl_imx6q_devtype_data = { |
208 | .features = FLEXCAN_HAS_V10_FEATURES | FLEXCAN_HAS_BROKEN_ERR_STATE, | 221 | .features = FLEXCAN_HAS_V10_FEATURES, |
209 | }; | 222 | }; |
210 | 223 | ||
211 | static const struct can_bittiming_const flexcan_bittiming_const = { | 224 | static const struct can_bittiming_const flexcan_bittiming_const = { |
diff --git a/drivers/net/can/sja1000/peak_pci.c b/drivers/net/can/sja1000/peak_pci.c index f5b82aeb2540..6525dbcca4e3 100644 --- a/drivers/net/can/sja1000/peak_pci.c +++ b/drivers/net/can/sja1000/peak_pci.c | |||
@@ -30,9 +30,10 @@ | |||
30 | 30 | ||
31 | #include "sja1000.h" | 31 | #include "sja1000.h" |
32 | 32 | ||
33 | MODULE_AUTHOR("Wolfgang Grandegger <wg@grandegger.com>"); | 33 | MODULE_AUTHOR("Stephane Grosjean <s.grosjean@peak-system.com>"); |
34 | MODULE_DESCRIPTION("Socket-CAN driver for PEAK PCAN PCI family cards"); | 34 | MODULE_DESCRIPTION("Socket-CAN driver for PEAK PCAN PCI family cards"); |
35 | MODULE_SUPPORTED_DEVICE("PEAK PCAN PCI/PCIe/PCIeC miniPCI CAN cards"); | 35 | MODULE_SUPPORTED_DEVICE("PEAK PCAN PCI/PCIe/PCIeC miniPCI CAN cards"); |
36 | MODULE_SUPPORTED_DEVICE("PEAK PCAN miniPCIe/cPCI PC/104+ PCI/104e CAN Cards"); | ||
36 | MODULE_LICENSE("GPL v2"); | 37 | MODULE_LICENSE("GPL v2"); |
37 | 38 | ||
38 | #define DRV_NAME "peak_pci" | 39 | #define DRV_NAME "peak_pci" |
@@ -64,7 +65,11 @@ struct peak_pci_chan { | |||
64 | #define PEAK_PCI_DEVICE_ID 0x0001 /* for PCI/PCIe slot cards */ | 65 | #define PEAK_PCI_DEVICE_ID 0x0001 /* for PCI/PCIe slot cards */ |
65 | #define PEAK_PCIEC_DEVICE_ID 0x0002 /* for ExpressCard slot cards */ | 66 | #define PEAK_PCIEC_DEVICE_ID 0x0002 /* for ExpressCard slot cards */ |
66 | #define PEAK_PCIE_DEVICE_ID 0x0003 /* for nextgen PCIe slot cards */ | 67 | #define PEAK_PCIE_DEVICE_ID 0x0003 /* for nextgen PCIe slot cards */ |
67 | #define PEAK_MPCI_DEVICE_ID 0x0008 /* The miniPCI slot cards */ | 68 | #define PEAK_CPCI_DEVICE_ID 0x0004 /* for nextgen cPCI slot cards */ |
69 | #define PEAK_MPCI_DEVICE_ID 0x0005 /* for nextgen miniPCI slot cards */ | ||
70 | #define PEAK_PC_104P_DEVICE_ID 0x0006 /* PCAN-PC/104+ cards */ | ||
71 | #define PEAK_PCI_104E_DEVICE_ID 0x0007 /* PCAN-PCI/104 Express cards */ | ||
72 | #define PEAK_MPCIE_DEVICE_ID 0x0008 /* The miniPCIe slot cards */ | ||
68 | 73 | ||
69 | #define PEAK_PCI_CHAN_MAX 4 | 74 | #define PEAK_PCI_CHAN_MAX 4 |
70 | 75 | ||
@@ -76,6 +81,10 @@ static DEFINE_PCI_DEVICE_TABLE(peak_pci_tbl) = { | |||
76 | {PEAK_PCI_VENDOR_ID, PEAK_PCI_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID,}, | 81 | {PEAK_PCI_VENDOR_ID, PEAK_PCI_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID,}, |
77 | {PEAK_PCI_VENDOR_ID, PEAK_PCIE_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID,}, | 82 | {PEAK_PCI_VENDOR_ID, PEAK_PCIE_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID,}, |
78 | {PEAK_PCI_VENDOR_ID, PEAK_MPCI_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID,}, | 83 | {PEAK_PCI_VENDOR_ID, PEAK_MPCI_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID,}, |
84 | {PEAK_PCI_VENDOR_ID, PEAK_MPCIE_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID,}, | ||
85 | {PEAK_PCI_VENDOR_ID, PEAK_PC_104P_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID,}, | ||
86 | {PEAK_PCI_VENDOR_ID, PEAK_PCI_104E_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID,}, | ||
87 | {PEAK_PCI_VENDOR_ID, PEAK_CPCI_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID,}, | ||
79 | #ifdef CONFIG_CAN_PEAK_PCIEC | 88 | #ifdef CONFIG_CAN_PEAK_PCIEC |
80 | {PEAK_PCI_VENDOR_ID, PEAK_PCIEC_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID,}, | 89 | {PEAK_PCI_VENDOR_ID, PEAK_PCIEC_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID,}, |
81 | #endif | 90 | #endif |
diff --git a/drivers/net/ethernet/cadence/at91_ether.c b/drivers/net/ethernet/cadence/at91_ether.c index 4e980a7886fb..35fc6edbacf8 100644 --- a/drivers/net/ethernet/cadence/at91_ether.c +++ b/drivers/net/ethernet/cadence/at91_ether.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <linux/clk.h> | 31 | #include <linux/clk.h> |
32 | #include <linux/gfp.h> | 32 | #include <linux/gfp.h> |
33 | #include <linux/phy.h> | 33 | #include <linux/phy.h> |
34 | #include <linux/platform_data/atmel.h> | ||
34 | 35 | ||
35 | #include <asm/io.h> | 36 | #include <asm/io.h> |
36 | #include <asm/uaccess.h> | 37 | #include <asm/uaccess.h> |
@@ -38,7 +39,6 @@ | |||
38 | 39 | ||
39 | #include <mach/at91rm9200_emac.h> | 40 | #include <mach/at91rm9200_emac.h> |
40 | #include <asm/gpio.h> | 41 | #include <asm/gpio.h> |
41 | #include <mach/board.h> | ||
42 | 42 | ||
43 | #include "at91_ether.h" | 43 | #include "at91_ether.h" |
44 | 44 | ||
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h b/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h index a4da893ac1e1..378988b5709a 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h | |||
@@ -251,6 +251,8 @@ struct adapter_params { | |||
251 | unsigned char rev; /* chip revision */ | 251 | unsigned char rev; /* chip revision */ |
252 | unsigned char offload; | 252 | unsigned char offload; |
253 | 253 | ||
254 | unsigned char bypass; | ||
255 | |||
254 | unsigned int ofldq_wr_cred; | 256 | unsigned int ofldq_wr_cred; |
255 | }; | 257 | }; |
256 | 258 | ||
@@ -642,6 +644,23 @@ extern int dbfifo_int_thresh; | |||
642 | #define for_each_port(adapter, iter) \ | 644 | #define for_each_port(adapter, iter) \ |
643 | for (iter = 0; iter < (adapter)->params.nports; ++iter) | 645 | for (iter = 0; iter < (adapter)->params.nports; ++iter) |
644 | 646 | ||
647 | static inline int is_bypass(struct adapter *adap) | ||
648 | { | ||
649 | return adap->params.bypass; | ||
650 | } | ||
651 | |||
652 | static inline int is_bypass_device(int device) | ||
653 | { | ||
654 | /* this should be set based upon device capabilities */ | ||
655 | switch (device) { | ||
656 | case 0x440b: | ||
657 | case 0x440c: | ||
658 | return 1; | ||
659 | default: | ||
660 | return 0; | ||
661 | } | ||
662 | } | ||
663 | |||
645 | static inline unsigned int core_ticks_per_usec(const struct adapter *adap) | 664 | static inline unsigned int core_ticks_per_usec(const struct adapter *adap) |
646 | { | 665 | { |
647 | return adap->params.vpd.cclk / 1000; | 666 | return adap->params.vpd.cclk / 1000; |
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c index 604f4f87f550..c1cde11b0c6d 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | |||
@@ -3513,18 +3513,6 @@ static int adap_init0_no_config(struct adapter *adapter, int reset) | |||
3513 | if (ret < 0) | 3513 | if (ret < 0) |
3514 | goto bye; | 3514 | goto bye; |
3515 | 3515 | ||
3516 | #ifndef CONFIG_CHELSIO_T4_OFFLOAD | ||
3517 | /* | ||
3518 | * If we're a pure NIC driver then disable all offloading facilities. | ||
3519 | * This will allow the firmware to optimize aspects of the hardware | ||
3520 | * configuration which will result in improved performance. | ||
3521 | */ | ||
3522 | caps_cmd.ofldcaps = 0; | ||
3523 | caps_cmd.iscsicaps = 0; | ||
3524 | caps_cmd.rdmacaps = 0; | ||
3525 | caps_cmd.fcoecaps = 0; | ||
3526 | #endif | ||
3527 | |||
3528 | if (caps_cmd.niccaps & htons(FW_CAPS_CONFIG_NIC_VM)) { | 3516 | if (caps_cmd.niccaps & htons(FW_CAPS_CONFIG_NIC_VM)) { |
3529 | if (!vf_acls) | 3517 | if (!vf_acls) |
3530 | caps_cmd.niccaps ^= htons(FW_CAPS_CONFIG_NIC_VM); | 3518 | caps_cmd.niccaps ^= htons(FW_CAPS_CONFIG_NIC_VM); |
@@ -3745,6 +3733,7 @@ static int adap_init0(struct adapter *adap) | |||
3745 | u32 v, port_vec; | 3733 | u32 v, port_vec; |
3746 | enum dev_state state; | 3734 | enum dev_state state; |
3747 | u32 params[7], val[7]; | 3735 | u32 params[7], val[7]; |
3736 | struct fw_caps_config_cmd caps_cmd; | ||
3748 | int reset = 1, j; | 3737 | int reset = 1, j; |
3749 | 3738 | ||
3750 | /* | 3739 | /* |
@@ -3898,6 +3887,9 @@ static int adap_init0(struct adapter *adap) | |||
3898 | goto bye; | 3887 | goto bye; |
3899 | } | 3888 | } |
3900 | 3889 | ||
3890 | if (is_bypass_device(adap->pdev->device)) | ||
3891 | adap->params.bypass = 1; | ||
3892 | |||
3901 | /* | 3893 | /* |
3902 | * Grab some of our basic fundamental operating parameters. | 3894 | * Grab some of our basic fundamental operating parameters. |
3903 | */ | 3895 | */ |
@@ -3940,13 +3932,12 @@ static int adap_init0(struct adapter *adap) | |||
3940 | adap->tids.aftid_end = val[1]; | 3932 | adap->tids.aftid_end = val[1]; |
3941 | } | 3933 | } |
3942 | 3934 | ||
3943 | #ifdef CONFIG_CHELSIO_T4_OFFLOAD | ||
3944 | /* | 3935 | /* |
3945 | * Get device capabilities so we can determine what resources we need | 3936 | * Get device capabilities so we can determine what resources we need |
3946 | * to manage. | 3937 | * to manage. |
3947 | */ | 3938 | */ |
3948 | memset(&caps_cmd, 0, sizeof(caps_cmd)); | 3939 | memset(&caps_cmd, 0, sizeof(caps_cmd)); |
3949 | caps_cmd.op_to_write = htonl(V_FW_CMD_OP(FW_CAPS_CONFIG_CMD) | | 3940 | caps_cmd.op_to_write = htonl(FW_CMD_OP(FW_CAPS_CONFIG_CMD) | |
3950 | FW_CMD_REQUEST | FW_CMD_READ); | 3941 | FW_CMD_REQUEST | FW_CMD_READ); |
3951 | caps_cmd.retval_len16 = htonl(FW_LEN16(caps_cmd)); | 3942 | caps_cmd.retval_len16 = htonl(FW_LEN16(caps_cmd)); |
3952 | ret = t4_wr_mbox(adap, adap->mbox, &caps_cmd, sizeof(caps_cmd), | 3943 | ret = t4_wr_mbox(adap, adap->mbox, &caps_cmd, sizeof(caps_cmd), |
@@ -3991,15 +3982,6 @@ static int adap_init0(struct adapter *adap) | |||
3991 | adap->vres.ddp.size = val[4] - val[3] + 1; | 3982 | adap->vres.ddp.size = val[4] - val[3] + 1; |
3992 | adap->params.ofldq_wr_cred = val[5]; | 3983 | adap->params.ofldq_wr_cred = val[5]; |
3993 | 3984 | ||
3994 | params[0] = FW_PARAM_PFVF(ETHOFLD_START); | ||
3995 | params[1] = FW_PARAM_PFVF(ETHOFLD_END); | ||
3996 | ret = t4_query_params(adap, adap->mbox, adap->fn, 0, 2, | ||
3997 | params, val); | ||
3998 | if ((val[0] != val[1]) && (ret >= 0)) { | ||
3999 | adap->tids.uotid_base = val[0]; | ||
4000 | adap->tids.nuotids = val[1] - val[0] + 1; | ||
4001 | } | ||
4002 | |||
4003 | adap->params.offload = 1; | 3985 | adap->params.offload = 1; |
4004 | } | 3986 | } |
4005 | if (caps_cmd.rdmacaps) { | 3987 | if (caps_cmd.rdmacaps) { |
@@ -4048,7 +4030,6 @@ static int adap_init0(struct adapter *adap) | |||
4048 | } | 4030 | } |
4049 | #undef FW_PARAM_PFVF | 4031 | #undef FW_PARAM_PFVF |
4050 | #undef FW_PARAM_DEV | 4032 | #undef FW_PARAM_DEV |
4051 | #endif /* CONFIG_CHELSIO_T4_OFFLOAD */ | ||
4052 | 4033 | ||
4053 | /* | 4034 | /* |
4054 | * These are finalized by FW initialization, load their values now. | 4035 | * These are finalized by FW initialization, load their values now. |
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.h b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.h index 1b899fea1a91..39bec73ff87c 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.h +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.h | |||
@@ -102,6 +102,9 @@ struct tid_info { | |||
102 | unsigned int ftid_base; | 102 | unsigned int ftid_base; |
103 | unsigned int aftid_base; | 103 | unsigned int aftid_base; |
104 | unsigned int aftid_end; | 104 | unsigned int aftid_end; |
105 | /* Server filter region */ | ||
106 | unsigned int sftid_base; | ||
107 | unsigned int nsftids; | ||
105 | 108 | ||
106 | spinlock_t atid_lock ____cacheline_aligned_in_smp; | 109 | spinlock_t atid_lock ____cacheline_aligned_in_smp; |
107 | union aopen_entry *afree; | 110 | union aopen_entry *afree; |
diff --git a/drivers/net/ethernet/freescale/gianfar_ptp.c b/drivers/net/ethernet/freescale/gianfar_ptp.c index b9db0e040563..2e5daee0438a 100644 --- a/drivers/net/ethernet/freescale/gianfar_ptp.c +++ b/drivers/net/ethernet/freescale/gianfar_ptp.c | |||
@@ -478,7 +478,7 @@ static int gianfar_ptp_probe(struct platform_device *dev) | |||
478 | pr_err("no resource\n"); | 478 | pr_err("no resource\n"); |
479 | goto no_resource; | 479 | goto no_resource; |
480 | } | 480 | } |
481 | if (request_resource(&ioport_resource, etsects->rsrc)) { | 481 | if (request_resource(&iomem_resource, etsects->rsrc)) { |
482 | pr_err("resource busy\n"); | 482 | pr_err("resource busy\n"); |
483 | goto no_resource; | 483 | goto no_resource; |
484 | } | 484 | } |
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_tx.c b/drivers/net/ethernet/mellanox/mlx4/en_tx.c index c10e3a6de09f..b35094c590ba 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_tx.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_tx.c | |||
@@ -143,7 +143,6 @@ void mlx4_en_destroy_tx_ring(struct mlx4_en_priv *priv, | |||
143 | mlx4_bf_free(mdev->dev, &ring->bf); | 143 | mlx4_bf_free(mdev->dev, &ring->bf); |
144 | mlx4_qp_remove(mdev->dev, &ring->qp); | 144 | mlx4_qp_remove(mdev->dev, &ring->qp); |
145 | mlx4_qp_free(mdev->dev, &ring->qp); | 145 | mlx4_qp_free(mdev->dev, &ring->qp); |
146 | mlx4_qp_release_range(mdev->dev, ring->qpn, 1); | ||
147 | mlx4_en_unmap_buffer(&ring->wqres.buf); | 146 | mlx4_en_unmap_buffer(&ring->wqres.buf); |
148 | mlx4_free_hwq_res(mdev->dev, &ring->wqres, ring->buf_size); | 147 | mlx4_free_hwq_res(mdev->dev, &ring->wqres, ring->buf_size); |
149 | kfree(ring->bounce_buf); | 148 | kfree(ring->bounce_buf); |
@@ -712,7 +711,7 @@ netdev_tx_t mlx4_en_xmit(struct sk_buff *skb, struct net_device *dev) | |||
712 | if (bounce) | 711 | if (bounce) |
713 | tx_desc = mlx4_en_bounce_to_desc(priv, ring, index, desc_size); | 712 | tx_desc = mlx4_en_bounce_to_desc(priv, ring, index, desc_size); |
714 | 713 | ||
715 | if (ring->bf_enabled && desc_size <= MAX_BF && !bounce && !vlan_tag) { | 714 | if (ring->bf_enabled && desc_size <= MAX_BF && !bounce && !vlan_tx_tag_present(skb)) { |
716 | *(__be32 *) (&tx_desc->ctrl.vlan_tag) |= cpu_to_be32(ring->doorbell_qpn); | 715 | *(__be32 *) (&tx_desc->ctrl.vlan_tag) |= cpu_to_be32(ring->doorbell_qpn); |
717 | op_own |= htonl((bf_index & 0xffff) << 8); | 716 | op_own |= htonl((bf_index & 0xffff) << 8); |
718 | /* Ensure new descirptor hits memory | 717 | /* Ensure new descirptor hits memory |
diff --git a/drivers/net/ethernet/mellanox/mlx4/eq.c b/drivers/net/ethernet/mellanox/mlx4/eq.c index 51c764901ad2..b84a88bc44dc 100644 --- a/drivers/net/ethernet/mellanox/mlx4/eq.c +++ b/drivers/net/ethernet/mellanox/mlx4/eq.c | |||
@@ -329,9 +329,6 @@ int set_and_calc_slave_port_state(struct mlx4_dev *dev, int slave, | |||
329 | ctx = &priv->mfunc.master.slave_state[slave]; | 329 | ctx = &priv->mfunc.master.slave_state[slave]; |
330 | spin_lock_irqsave(&ctx->lock, flags); | 330 | spin_lock_irqsave(&ctx->lock, flags); |
331 | 331 | ||
332 | mlx4_dbg(dev, "%s: slave: %d, current state: %d new event :%d\n", | ||
333 | __func__, slave, cur_state, event); | ||
334 | |||
335 | switch (cur_state) { | 332 | switch (cur_state) { |
336 | case SLAVE_PORT_DOWN: | 333 | case SLAVE_PORT_DOWN: |
337 | if (MLX4_PORT_STATE_DEV_EVENT_PORT_UP == event) | 334 | if (MLX4_PORT_STATE_DEV_EVENT_PORT_UP == event) |
@@ -366,9 +363,6 @@ int set_and_calc_slave_port_state(struct mlx4_dev *dev, int slave, | |||
366 | goto out; | 363 | goto out; |
367 | } | 364 | } |
368 | ret = mlx4_get_slave_port_state(dev, slave, port); | 365 | ret = mlx4_get_slave_port_state(dev, slave, port); |
369 | mlx4_dbg(dev, "%s: slave: %d, current state: %d new event" | ||
370 | " :%d gen_event: %d\n", | ||
371 | __func__, slave, cur_state, event, *gen_event); | ||
372 | 366 | ||
373 | out: | 367 | out: |
374 | spin_unlock_irqrestore(&ctx->lock, flags); | 368 | spin_unlock_irqrestore(&ctx->lock, flags); |
@@ -843,6 +837,18 @@ static void __iomem *mlx4_get_eq_uar(struct mlx4_dev *dev, struct mlx4_eq *eq) | |||
843 | return priv->eq_table.uar_map[index] + 0x800 + 8 * (eq->eqn % 4); | 837 | return priv->eq_table.uar_map[index] + 0x800 + 8 * (eq->eqn % 4); |
844 | } | 838 | } |
845 | 839 | ||
840 | static void mlx4_unmap_uar(struct mlx4_dev *dev) | ||
841 | { | ||
842 | struct mlx4_priv *priv = mlx4_priv(dev); | ||
843 | int i; | ||
844 | |||
845 | for (i = 0; i < mlx4_num_eq_uar(dev); ++i) | ||
846 | if (priv->eq_table.uar_map[i]) { | ||
847 | iounmap(priv->eq_table.uar_map[i]); | ||
848 | priv->eq_table.uar_map[i] = NULL; | ||
849 | } | ||
850 | } | ||
851 | |||
846 | static int mlx4_create_eq(struct mlx4_dev *dev, int nent, | 852 | static int mlx4_create_eq(struct mlx4_dev *dev, int nent, |
847 | u8 intr, struct mlx4_eq *eq) | 853 | u8 intr, struct mlx4_eq *eq) |
848 | { | 854 | { |
@@ -1207,6 +1213,7 @@ err_out_unmap: | |||
1207 | mlx4_free_irqs(dev); | 1213 | mlx4_free_irqs(dev); |
1208 | 1214 | ||
1209 | err_out_bitmap: | 1215 | err_out_bitmap: |
1216 | mlx4_unmap_uar(dev); | ||
1210 | mlx4_bitmap_cleanup(&priv->eq_table.bitmap); | 1217 | mlx4_bitmap_cleanup(&priv->eq_table.bitmap); |
1211 | 1218 | ||
1212 | err_out_free: | 1219 | err_out_free: |
@@ -1231,10 +1238,7 @@ void mlx4_cleanup_eq_table(struct mlx4_dev *dev) | |||
1231 | if (!mlx4_is_slave(dev)) | 1238 | if (!mlx4_is_slave(dev)) |
1232 | mlx4_unmap_clr_int(dev); | 1239 | mlx4_unmap_clr_int(dev); |
1233 | 1240 | ||
1234 | for (i = 0; i < mlx4_num_eq_uar(dev); ++i) | 1241 | mlx4_unmap_uar(dev); |
1235 | if (priv->eq_table.uar_map[i]) | ||
1236 | iounmap(priv->eq_table.uar_map[i]); | ||
1237 | |||
1238 | mlx4_bitmap_cleanup(&priv->eq_table.bitmap); | 1242 | mlx4_bitmap_cleanup(&priv->eq_table.bitmap); |
1239 | 1243 | ||
1240 | kfree(priv->eq_table.uar_map); | 1244 | kfree(priv->eq_table.uar_map); |
diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c index 80df2ab0177c..2aa80afd98d2 100644 --- a/drivers/net/ethernet/mellanox/mlx4/main.c +++ b/drivers/net/ethernet/mellanox/mlx4/main.c | |||
@@ -1405,7 +1405,10 @@ unmap_bf: | |||
1405 | unmap_bf_area(dev); | 1405 | unmap_bf_area(dev); |
1406 | 1406 | ||
1407 | err_close: | 1407 | err_close: |
1408 | mlx4_close_hca(dev); | 1408 | if (mlx4_is_slave(dev)) |
1409 | mlx4_slave_exit(dev); | ||
1410 | else | ||
1411 | mlx4_CLOSE_HCA(dev, 0); | ||
1409 | 1412 | ||
1410 | err_free_icm: | 1413 | err_free_icm: |
1411 | if (!mlx4_is_slave(dev)) | 1414 | if (!mlx4_is_slave(dev)) |
diff --git a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c index 926c911c0ac4..b05705f50f0f 100644 --- a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c +++ b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c | |||
@@ -330,9 +330,6 @@ static void update_pkey_index(struct mlx4_dev *dev, int slave, | |||
330 | 330 | ||
331 | new_index = priv->virt2phys_pkey[slave][port - 1][orig_index]; | 331 | new_index = priv->virt2phys_pkey[slave][port - 1][orig_index]; |
332 | *(u8 *)(inbox->buf + 35) = new_index; | 332 | *(u8 *)(inbox->buf + 35) = new_index; |
333 | |||
334 | mlx4_dbg(dev, "port = %d, orig pkey index = %d, " | ||
335 | "new pkey index = %d\n", port, orig_index, new_index); | ||
336 | } | 333 | } |
337 | 334 | ||
338 | static void update_gid(struct mlx4_dev *dev, struct mlx4_cmd_mailbox *inbox, | 335 | static void update_gid(struct mlx4_dev *dev, struct mlx4_cmd_mailbox *inbox, |
@@ -351,9 +348,6 @@ static void update_gid(struct mlx4_dev *dev, struct mlx4_cmd_mailbox *inbox, | |||
351 | if (optpar & MLX4_QP_OPTPAR_ALT_ADDR_PATH) | 348 | if (optpar & MLX4_QP_OPTPAR_ALT_ADDR_PATH) |
352 | qp_ctx->alt_path.mgid_index = slave & 0x7F; | 349 | qp_ctx->alt_path.mgid_index = slave & 0x7F; |
353 | } | 350 | } |
354 | |||
355 | mlx4_dbg(dev, "slave %d, new gid index: 0x%x ", | ||
356 | slave, qp_ctx->pri_path.mgid_index); | ||
357 | } | 351 | } |
358 | 352 | ||
359 | static int mpt_mask(struct mlx4_dev *dev) | 353 | static int mpt_mask(struct mlx4_dev *dev) |
diff --git a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c index b2a94d02a521..4c4fe5b1a29a 100644 --- a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c +++ b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c | |||
@@ -339,26 +339,6 @@ static void pch_gbe_wait_clr_bit(void *reg, u32 bit) | |||
339 | } | 339 | } |
340 | 340 | ||
341 | /** | 341 | /** |
342 | * pch_gbe_wait_clr_bit_irq - Wait to clear a bit for interrupt context | ||
343 | * @reg: Pointer of register | ||
344 | * @busy: Busy bit | ||
345 | */ | ||
346 | static int pch_gbe_wait_clr_bit_irq(void *reg, u32 bit) | ||
347 | { | ||
348 | u32 tmp; | ||
349 | int ret = -1; | ||
350 | /* wait busy */ | ||
351 | tmp = 20; | ||
352 | while ((ioread32(reg) & bit) && --tmp) | ||
353 | udelay(5); | ||
354 | if (!tmp) | ||
355 | pr_err("Error: busy bit is not cleared\n"); | ||
356 | else | ||
357 | ret = 0; | ||
358 | return ret; | ||
359 | } | ||
360 | |||
361 | /** | ||
362 | * pch_gbe_mac_mar_set - Set MAC address register | 342 | * pch_gbe_mac_mar_set - Set MAC address register |
363 | * @hw: Pointer to the HW structure | 343 | * @hw: Pointer to the HW structure |
364 | * @addr: Pointer to the MAC address | 344 | * @addr: Pointer to the MAC address |
@@ -409,15 +389,20 @@ static void pch_gbe_mac_reset_hw(struct pch_gbe_hw *hw) | |||
409 | return; | 389 | return; |
410 | } | 390 | } |
411 | 391 | ||
412 | static void pch_gbe_mac_reset_rx(struct pch_gbe_hw *hw) | 392 | static void pch_gbe_disable_mac_rx(struct pch_gbe_hw *hw) |
413 | { | 393 | { |
414 | /* Read the MAC addresses. and store to the private data */ | 394 | u32 rctl; |
415 | pch_gbe_mac_read_mac_addr(hw); | 395 | /* Disables Receive MAC */ |
416 | iowrite32(PCH_GBE_RX_RST, &hw->reg->RESET); | 396 | rctl = ioread32(&hw->reg->MAC_RX_EN); |
417 | pch_gbe_wait_clr_bit_irq(&hw->reg->RESET, PCH_GBE_RX_RST); | 397 | iowrite32((rctl & ~PCH_GBE_MRE_MAC_RX_EN), &hw->reg->MAC_RX_EN); |
418 | /* Setup the MAC addresses */ | 398 | } |
419 | pch_gbe_mac_mar_set(hw, hw->mac.addr, 0); | 399 | |
420 | return; | 400 | static void pch_gbe_enable_mac_rx(struct pch_gbe_hw *hw) |
401 | { | ||
402 | u32 rctl; | ||
403 | /* Enables Receive MAC */ | ||
404 | rctl = ioread32(&hw->reg->MAC_RX_EN); | ||
405 | iowrite32((rctl | PCH_GBE_MRE_MAC_RX_EN), &hw->reg->MAC_RX_EN); | ||
421 | } | 406 | } |
422 | 407 | ||
423 | /** | 408 | /** |
@@ -913,7 +898,7 @@ static void pch_gbe_setup_rctl(struct pch_gbe_adapter *adapter) | |||
913 | static void pch_gbe_configure_rx(struct pch_gbe_adapter *adapter) | 898 | static void pch_gbe_configure_rx(struct pch_gbe_adapter *adapter) |
914 | { | 899 | { |
915 | struct pch_gbe_hw *hw = &adapter->hw; | 900 | struct pch_gbe_hw *hw = &adapter->hw; |
916 | u32 rdba, rdlen, rctl, rxdma; | 901 | u32 rdba, rdlen, rxdma; |
917 | 902 | ||
918 | pr_debug("dma adr = 0x%08llx size = 0x%08x\n", | 903 | pr_debug("dma adr = 0x%08llx size = 0x%08x\n", |
919 | (unsigned long long)adapter->rx_ring->dma, | 904 | (unsigned long long)adapter->rx_ring->dma, |
@@ -921,9 +906,7 @@ static void pch_gbe_configure_rx(struct pch_gbe_adapter *adapter) | |||
921 | 906 | ||
922 | pch_gbe_mac_force_mac_fc(hw); | 907 | pch_gbe_mac_force_mac_fc(hw); |
923 | 908 | ||
924 | /* Disables Receive MAC */ | 909 | pch_gbe_disable_mac_rx(hw); |
925 | rctl = ioread32(&hw->reg->MAC_RX_EN); | ||
926 | iowrite32((rctl & ~PCH_GBE_MRE_MAC_RX_EN), &hw->reg->MAC_RX_EN); | ||
927 | 910 | ||
928 | /* Disables Receive DMA */ | 911 | /* Disables Receive DMA */ |
929 | rxdma = ioread32(&hw->reg->DMA_CTRL); | 912 | rxdma = ioread32(&hw->reg->DMA_CTRL); |
@@ -1316,38 +1299,17 @@ void pch_gbe_update_stats(struct pch_gbe_adapter *adapter) | |||
1316 | spin_unlock_irqrestore(&adapter->stats_lock, flags); | 1299 | spin_unlock_irqrestore(&adapter->stats_lock, flags); |
1317 | } | 1300 | } |
1318 | 1301 | ||
1319 | static void pch_gbe_stop_receive(struct pch_gbe_adapter *adapter) | 1302 | static void pch_gbe_disable_dma_rx(struct pch_gbe_hw *hw) |
1320 | { | 1303 | { |
1321 | struct pch_gbe_hw *hw = &adapter->hw; | ||
1322 | u32 rxdma; | 1304 | u32 rxdma; |
1323 | u16 value; | ||
1324 | int ret; | ||
1325 | 1305 | ||
1326 | /* Disable Receive DMA */ | 1306 | /* Disable Receive DMA */ |
1327 | rxdma = ioread32(&hw->reg->DMA_CTRL); | 1307 | rxdma = ioread32(&hw->reg->DMA_CTRL); |
1328 | rxdma &= ~PCH_GBE_RX_DMA_EN; | 1308 | rxdma &= ~PCH_GBE_RX_DMA_EN; |
1329 | iowrite32(rxdma, &hw->reg->DMA_CTRL); | 1309 | iowrite32(rxdma, &hw->reg->DMA_CTRL); |
1330 | /* Wait Rx DMA BUS is IDLE */ | ||
1331 | ret = pch_gbe_wait_clr_bit_irq(&hw->reg->RX_DMA_ST, PCH_GBE_IDLE_CHECK); | ||
1332 | if (ret) { | ||
1333 | /* Disable Bus master */ | ||
1334 | pci_read_config_word(adapter->pdev, PCI_COMMAND, &value); | ||
1335 | value &= ~PCI_COMMAND_MASTER; | ||
1336 | pci_write_config_word(adapter->pdev, PCI_COMMAND, value); | ||
1337 | /* Stop Receive */ | ||
1338 | pch_gbe_mac_reset_rx(hw); | ||
1339 | /* Enable Bus master */ | ||
1340 | value |= PCI_COMMAND_MASTER; | ||
1341 | pci_write_config_word(adapter->pdev, PCI_COMMAND, value); | ||
1342 | } else { | ||
1343 | /* Stop Receive */ | ||
1344 | pch_gbe_mac_reset_rx(hw); | ||
1345 | } | ||
1346 | /* reprogram multicast address register after reset */ | ||
1347 | pch_gbe_set_multi(adapter->netdev); | ||
1348 | } | 1310 | } |
1349 | 1311 | ||
1350 | static void pch_gbe_start_receive(struct pch_gbe_hw *hw) | 1312 | static void pch_gbe_enable_dma_rx(struct pch_gbe_hw *hw) |
1351 | { | 1313 | { |
1352 | u32 rxdma; | 1314 | u32 rxdma; |
1353 | 1315 | ||
@@ -1355,9 +1317,6 @@ static void pch_gbe_start_receive(struct pch_gbe_hw *hw) | |||
1355 | rxdma = ioread32(&hw->reg->DMA_CTRL); | 1317 | rxdma = ioread32(&hw->reg->DMA_CTRL); |
1356 | rxdma |= PCH_GBE_RX_DMA_EN; | 1318 | rxdma |= PCH_GBE_RX_DMA_EN; |
1357 | iowrite32(rxdma, &hw->reg->DMA_CTRL); | 1319 | iowrite32(rxdma, &hw->reg->DMA_CTRL); |
1358 | /* Enables Receive */ | ||
1359 | iowrite32(PCH_GBE_MRE_MAC_RX_EN, &hw->reg->MAC_RX_EN); | ||
1360 | return; | ||
1361 | } | 1320 | } |
1362 | 1321 | ||
1363 | /** | 1322 | /** |
@@ -1393,7 +1352,7 @@ static irqreturn_t pch_gbe_intr(int irq, void *data) | |||
1393 | int_en = ioread32(&hw->reg->INT_EN); | 1352 | int_en = ioread32(&hw->reg->INT_EN); |
1394 | iowrite32((int_en & ~PCH_GBE_INT_RX_FIFO_ERR), | 1353 | iowrite32((int_en & ~PCH_GBE_INT_RX_FIFO_ERR), |
1395 | &hw->reg->INT_EN); | 1354 | &hw->reg->INT_EN); |
1396 | pch_gbe_stop_receive(adapter); | 1355 | pch_gbe_disable_dma_rx(&adapter->hw); |
1397 | int_st |= ioread32(&hw->reg->INT_ST); | 1356 | int_st |= ioread32(&hw->reg->INT_ST); |
1398 | int_st = int_st & ioread32(&hw->reg->INT_EN); | 1357 | int_st = int_st & ioread32(&hw->reg->INT_EN); |
1399 | } | 1358 | } |
@@ -1971,12 +1930,12 @@ int pch_gbe_up(struct pch_gbe_adapter *adapter) | |||
1971 | struct net_device *netdev = adapter->netdev; | 1930 | struct net_device *netdev = adapter->netdev; |
1972 | struct pch_gbe_tx_ring *tx_ring = adapter->tx_ring; | 1931 | struct pch_gbe_tx_ring *tx_ring = adapter->tx_ring; |
1973 | struct pch_gbe_rx_ring *rx_ring = adapter->rx_ring; | 1932 | struct pch_gbe_rx_ring *rx_ring = adapter->rx_ring; |
1974 | int err; | 1933 | int err = -EINVAL; |
1975 | 1934 | ||
1976 | /* Ensure we have a valid MAC */ | 1935 | /* Ensure we have a valid MAC */ |
1977 | if (!is_valid_ether_addr(adapter->hw.mac.addr)) { | 1936 | if (!is_valid_ether_addr(adapter->hw.mac.addr)) { |
1978 | pr_err("Error: Invalid MAC address\n"); | 1937 | pr_err("Error: Invalid MAC address\n"); |
1979 | return -EINVAL; | 1938 | goto out; |
1980 | } | 1939 | } |
1981 | 1940 | ||
1982 | /* hardware has been reset, we need to reload some things */ | 1941 | /* hardware has been reset, we need to reload some things */ |
@@ -1989,18 +1948,19 @@ int pch_gbe_up(struct pch_gbe_adapter *adapter) | |||
1989 | 1948 | ||
1990 | err = pch_gbe_request_irq(adapter); | 1949 | err = pch_gbe_request_irq(adapter); |
1991 | if (err) { | 1950 | if (err) { |
1992 | pr_err("Error: can't bring device up\n"); | 1951 | pr_err("Error: can't bring device up - irq request failed\n"); |
1993 | return err; | 1952 | goto out; |
1994 | } | 1953 | } |
1995 | err = pch_gbe_alloc_rx_buffers_pool(adapter, rx_ring, rx_ring->count); | 1954 | err = pch_gbe_alloc_rx_buffers_pool(adapter, rx_ring, rx_ring->count); |
1996 | if (err) { | 1955 | if (err) { |
1997 | pr_err("Error: can't bring device up\n"); | 1956 | pr_err("Error: can't bring device up - alloc rx buffers pool failed\n"); |
1998 | return err; | 1957 | goto freeirq; |
1999 | } | 1958 | } |
2000 | pch_gbe_alloc_tx_buffers(adapter, tx_ring); | 1959 | pch_gbe_alloc_tx_buffers(adapter, tx_ring); |
2001 | pch_gbe_alloc_rx_buffers(adapter, rx_ring, rx_ring->count); | 1960 | pch_gbe_alloc_rx_buffers(adapter, rx_ring, rx_ring->count); |
2002 | adapter->tx_queue_len = netdev->tx_queue_len; | 1961 | adapter->tx_queue_len = netdev->tx_queue_len; |
2003 | pch_gbe_start_receive(&adapter->hw); | 1962 | pch_gbe_enable_dma_rx(&adapter->hw); |
1963 | pch_gbe_enable_mac_rx(&adapter->hw); | ||
2004 | 1964 | ||
2005 | mod_timer(&adapter->watchdog_timer, jiffies); | 1965 | mod_timer(&adapter->watchdog_timer, jiffies); |
2006 | 1966 | ||
@@ -2009,6 +1969,11 @@ int pch_gbe_up(struct pch_gbe_adapter *adapter) | |||
2009 | netif_start_queue(adapter->netdev); | 1969 | netif_start_queue(adapter->netdev); |
2010 | 1970 | ||
2011 | return 0; | 1971 | return 0; |
1972 | |||
1973 | freeirq: | ||
1974 | pch_gbe_free_irq(adapter); | ||
1975 | out: | ||
1976 | return err; | ||
2012 | } | 1977 | } |
2013 | 1978 | ||
2014 | /** | 1979 | /** |
@@ -2405,7 +2370,6 @@ static int pch_gbe_napi_poll(struct napi_struct *napi, int budget) | |||
2405 | int work_done = 0; | 2370 | int work_done = 0; |
2406 | bool poll_end_flag = false; | 2371 | bool poll_end_flag = false; |
2407 | bool cleaned = false; | 2372 | bool cleaned = false; |
2408 | u32 int_en; | ||
2409 | 2373 | ||
2410 | pr_debug("budget : %d\n", budget); | 2374 | pr_debug("budget : %d\n", budget); |
2411 | 2375 | ||
@@ -2422,19 +2386,13 @@ static int pch_gbe_napi_poll(struct napi_struct *napi, int budget) | |||
2422 | 2386 | ||
2423 | if (poll_end_flag) { | 2387 | if (poll_end_flag) { |
2424 | napi_complete(napi); | 2388 | napi_complete(napi); |
2425 | if (adapter->rx_stop_flag) { | ||
2426 | adapter->rx_stop_flag = false; | ||
2427 | pch_gbe_start_receive(&adapter->hw); | ||
2428 | } | ||
2429 | pch_gbe_irq_enable(adapter); | 2389 | pch_gbe_irq_enable(adapter); |
2430 | } else | 2390 | } |
2431 | if (adapter->rx_stop_flag) { | 2391 | |
2432 | adapter->rx_stop_flag = false; | 2392 | if (adapter->rx_stop_flag) { |
2433 | pch_gbe_start_receive(&adapter->hw); | 2393 | adapter->rx_stop_flag = false; |
2434 | int_en = ioread32(&adapter->hw.reg->INT_EN); | 2394 | pch_gbe_enable_dma_rx(&adapter->hw); |
2435 | iowrite32((int_en | PCH_GBE_INT_RX_FIFO_ERR), | 2395 | } |
2436 | &adapter->hw.reg->INT_EN); | ||
2437 | } | ||
2438 | 2396 | ||
2439 | pr_debug("poll_end_flag : %d work_done : %d budget : %d\n", | 2397 | pr_debug("poll_end_flag : %d work_done : %d budget : %d\n", |
2440 | poll_end_flag, work_done, budget); | 2398 | poll_end_flag, work_done, budget); |
diff --git a/drivers/net/ethernet/qlogic/qla3xxx.c b/drivers/net/ethernet/qlogic/qla3xxx.c index df09b1cb742f..6407d0d77e81 100644 --- a/drivers/net/ethernet/qlogic/qla3xxx.c +++ b/drivers/net/ethernet/qlogic/qla3xxx.c | |||
@@ -2525,6 +2525,13 @@ static int ql_alloc_net_req_rsp_queues(struct ql3_adapter *qdev) | |||
2525 | qdev->req_q_size = | 2525 | qdev->req_q_size = |
2526 | (u32) (NUM_REQ_Q_ENTRIES * sizeof(struct ob_mac_iocb_req)); | 2526 | (u32) (NUM_REQ_Q_ENTRIES * sizeof(struct ob_mac_iocb_req)); |
2527 | 2527 | ||
2528 | qdev->rsp_q_size = NUM_RSP_Q_ENTRIES * sizeof(struct net_rsp_iocb); | ||
2529 | |||
2530 | /* The barrier is required to ensure request and response queue | ||
2531 | * addr writes to the registers. | ||
2532 | */ | ||
2533 | wmb(); | ||
2534 | |||
2528 | qdev->req_q_virt_addr = | 2535 | qdev->req_q_virt_addr = |
2529 | pci_alloc_consistent(qdev->pdev, | 2536 | pci_alloc_consistent(qdev->pdev, |
2530 | (size_t) qdev->req_q_size, | 2537 | (size_t) qdev->req_q_size, |
@@ -2536,8 +2543,6 @@ static int ql_alloc_net_req_rsp_queues(struct ql3_adapter *qdev) | |||
2536 | return -ENOMEM; | 2543 | return -ENOMEM; |
2537 | } | 2544 | } |
2538 | 2545 | ||
2539 | qdev->rsp_q_size = NUM_RSP_Q_ENTRIES * sizeof(struct net_rsp_iocb); | ||
2540 | |||
2541 | qdev->rsp_q_virt_addr = | 2546 | qdev->rsp_q_virt_addr = |
2542 | pci_alloc_consistent(qdev->pdev, | 2547 | pci_alloc_consistent(qdev->pdev, |
2543 | (size_t) qdev->rsp_q_size, | 2548 | (size_t) qdev->rsp_q_size, |
diff --git a/drivers/net/ethernet/ti/Kconfig b/drivers/net/ethernet/ti/Kconfig index b26cbda5efa9..2c41894d5472 100644 --- a/drivers/net/ethernet/ti/Kconfig +++ b/drivers/net/ethernet/ti/Kconfig | |||
@@ -5,7 +5,7 @@ | |||
5 | config NET_VENDOR_TI | 5 | config NET_VENDOR_TI |
6 | bool "Texas Instruments (TI) devices" | 6 | bool "Texas Instruments (TI) devices" |
7 | default y | 7 | default y |
8 | depends on PCI || EISA || AR7 || (ARM && (ARCH_DAVINCI || ARCH_OMAP3)) | 8 | depends on PCI || EISA || AR7 || (ARM && (ARCH_DAVINCI || ARCH_OMAP3 || SOC_AM33XX)) |
9 | ---help--- | 9 | ---help--- |
10 | If you have a network (Ethernet) card belonging to this class, say Y | 10 | If you have a network (Ethernet) card belonging to this class, say Y |
11 | and read the Ethernet-HOWTO, available from | 11 | and read the Ethernet-HOWTO, available from |
diff --git a/drivers/net/ethernet/tile/tilegx.c b/drivers/net/ethernet/tile/tilegx.c index 4e2a1628484d..4e9810013850 100644 --- a/drivers/net/ethernet/tile/tilegx.c +++ b/drivers/net/ethernet/tile/tilegx.c | |||
@@ -1334,11 +1334,11 @@ static int tso_count_edescs(struct sk_buff *skb) | |||
1334 | { | 1334 | { |
1335 | struct skb_shared_info *sh = skb_shinfo(skb); | 1335 | struct skb_shared_info *sh = skb_shinfo(skb); |
1336 | unsigned int sh_len = skb_transport_offset(skb) + tcp_hdrlen(skb); | 1336 | unsigned int sh_len = skb_transport_offset(skb) + tcp_hdrlen(skb); |
1337 | unsigned int data_len = skb->data_len + skb->hdr_len - sh_len; | 1337 | unsigned int data_len = skb->len - sh_len; |
1338 | unsigned int p_len = sh->gso_size; | 1338 | unsigned int p_len = sh->gso_size; |
1339 | long f_id = -1; /* id of the current fragment */ | 1339 | long f_id = -1; /* id of the current fragment */ |
1340 | long f_size = skb->hdr_len; /* size of the current fragment */ | 1340 | long f_size = skb_headlen(skb) - sh_len; /* current fragment size */ |
1341 | long f_used = sh_len; /* bytes used from the current fragment */ | 1341 | long f_used = 0; /* bytes used from the current fragment */ |
1342 | long n; /* size of the current piece of payload */ | 1342 | long n; /* size of the current piece of payload */ |
1343 | int num_edescs = 0; | 1343 | int num_edescs = 0; |
1344 | int segment; | 1344 | int segment; |
@@ -1353,7 +1353,7 @@ static int tso_count_edescs(struct sk_buff *skb) | |||
1353 | /* Advance as needed. */ | 1353 | /* Advance as needed. */ |
1354 | while (f_used >= f_size) { | 1354 | while (f_used >= f_size) { |
1355 | f_id++; | 1355 | f_id++; |
1356 | f_size = sh->frags[f_id].size; | 1356 | f_size = skb_frag_size(&sh->frags[f_id]); |
1357 | f_used = 0; | 1357 | f_used = 0; |
1358 | } | 1358 | } |
1359 | 1359 | ||
@@ -1384,13 +1384,13 @@ static void tso_headers_prepare(struct sk_buff *skb, unsigned char *headers, | |||
1384 | struct iphdr *ih; | 1384 | struct iphdr *ih; |
1385 | struct tcphdr *th; | 1385 | struct tcphdr *th; |
1386 | unsigned int sh_len = skb_transport_offset(skb) + tcp_hdrlen(skb); | 1386 | unsigned int sh_len = skb_transport_offset(skb) + tcp_hdrlen(skb); |
1387 | unsigned int data_len = skb->data_len + skb->hdr_len - sh_len; | 1387 | unsigned int data_len = skb->len - sh_len; |
1388 | unsigned char *data = skb->data; | 1388 | unsigned char *data = skb->data; |
1389 | unsigned int ih_off, th_off, p_len; | 1389 | unsigned int ih_off, th_off, p_len; |
1390 | unsigned int isum_seed, tsum_seed, id, seq; | 1390 | unsigned int isum_seed, tsum_seed, id, seq; |
1391 | long f_id = -1; /* id of the current fragment */ | 1391 | long f_id = -1; /* id of the current fragment */ |
1392 | long f_size = skb->hdr_len; /* size of the current fragment */ | 1392 | long f_size = skb_headlen(skb) - sh_len; /* current fragment size */ |
1393 | long f_used = sh_len; /* bytes used from the current fragment */ | 1393 | long f_used = 0; /* bytes used from the current fragment */ |
1394 | long n; /* size of the current piece of payload */ | 1394 | long n; /* size of the current piece of payload */ |
1395 | int segment; | 1395 | int segment; |
1396 | 1396 | ||
@@ -1405,7 +1405,7 @@ static void tso_headers_prepare(struct sk_buff *skb, unsigned char *headers, | |||
1405 | isum_seed = ((0xFFFF - ih->check) + | 1405 | isum_seed = ((0xFFFF - ih->check) + |
1406 | (0xFFFF - ih->tot_len) + | 1406 | (0xFFFF - ih->tot_len) + |
1407 | (0xFFFF - ih->id)); | 1407 | (0xFFFF - ih->id)); |
1408 | tsum_seed = th->check + (0xFFFF ^ htons(sh_len + data_len)); | 1408 | tsum_seed = th->check + (0xFFFF ^ htons(skb->len)); |
1409 | id = ntohs(ih->id); | 1409 | id = ntohs(ih->id); |
1410 | seq = ntohl(th->seq); | 1410 | seq = ntohl(th->seq); |
1411 | 1411 | ||
@@ -1444,7 +1444,7 @@ static void tso_headers_prepare(struct sk_buff *skb, unsigned char *headers, | |||
1444 | /* Advance as needed. */ | 1444 | /* Advance as needed. */ |
1445 | while (f_used >= f_size) { | 1445 | while (f_used >= f_size) { |
1446 | f_id++; | 1446 | f_id++; |
1447 | f_size = sh->frags[f_id].size; | 1447 | f_size = skb_frag_size(&sh->frags[f_id]); |
1448 | f_used = 0; | 1448 | f_used = 0; |
1449 | } | 1449 | } |
1450 | 1450 | ||
@@ -1478,14 +1478,14 @@ static void tso_egress(struct net_device *dev, gxio_mpipe_equeue_t *equeue, | |||
1478 | struct tile_net_priv *priv = netdev_priv(dev); | 1478 | struct tile_net_priv *priv = netdev_priv(dev); |
1479 | struct skb_shared_info *sh = skb_shinfo(skb); | 1479 | struct skb_shared_info *sh = skb_shinfo(skb); |
1480 | unsigned int sh_len = skb_transport_offset(skb) + tcp_hdrlen(skb); | 1480 | unsigned int sh_len = skb_transport_offset(skb) + tcp_hdrlen(skb); |
1481 | unsigned int data_len = skb->data_len + skb->hdr_len - sh_len; | 1481 | unsigned int data_len = skb->len - sh_len; |
1482 | unsigned int p_len = sh->gso_size; | 1482 | unsigned int p_len = sh->gso_size; |
1483 | gxio_mpipe_edesc_t edesc_head = { { 0 } }; | 1483 | gxio_mpipe_edesc_t edesc_head = { { 0 } }; |
1484 | gxio_mpipe_edesc_t edesc_body = { { 0 } }; | 1484 | gxio_mpipe_edesc_t edesc_body = { { 0 } }; |
1485 | long f_id = -1; /* id of the current fragment */ | 1485 | long f_id = -1; /* id of the current fragment */ |
1486 | long f_size = skb->hdr_len; /* size of the current fragment */ | 1486 | long f_size = skb_headlen(skb) - sh_len; /* current fragment size */ |
1487 | long f_used = sh_len; /* bytes used from the current fragment */ | 1487 | long f_used = 0; /* bytes used from the current fragment */ |
1488 | void *f_data = skb->data; | 1488 | void *f_data = skb->data + sh_len; |
1489 | long n; /* size of the current piece of payload */ | 1489 | long n; /* size of the current piece of payload */ |
1490 | unsigned long tx_packets = 0, tx_bytes = 0; | 1490 | unsigned long tx_packets = 0, tx_bytes = 0; |
1491 | unsigned int csum_start; | 1491 | unsigned int csum_start; |
@@ -1516,15 +1516,18 @@ static void tso_egress(struct net_device *dev, gxio_mpipe_equeue_t *equeue, | |||
1516 | 1516 | ||
1517 | /* Egress the payload. */ | 1517 | /* Egress the payload. */ |
1518 | while (p_used < p_len) { | 1518 | while (p_used < p_len) { |
1519 | void *va; | ||
1519 | 1520 | ||
1520 | /* Advance as needed. */ | 1521 | /* Advance as needed. */ |
1521 | while (f_used >= f_size) { | 1522 | while (f_used >= f_size) { |
1522 | f_id++; | 1523 | f_id++; |
1523 | f_size = sh->frags[f_id].size; | 1524 | f_size = skb_frag_size(&sh->frags[f_id]); |
1524 | f_used = 0; | ||
1525 | f_data = tile_net_frag_buf(&sh->frags[f_id]); | 1525 | f_data = tile_net_frag_buf(&sh->frags[f_id]); |
1526 | f_used = 0; | ||
1526 | } | 1527 | } |
1527 | 1528 | ||
1529 | va = f_data + f_used; | ||
1530 | |||
1528 | /* Use bytes from the current fragment. */ | 1531 | /* Use bytes from the current fragment. */ |
1529 | n = p_len - p_used; | 1532 | n = p_len - p_used; |
1530 | if (n > f_size - f_used) | 1533 | if (n > f_size - f_used) |
@@ -1533,7 +1536,7 @@ static void tso_egress(struct net_device *dev, gxio_mpipe_equeue_t *equeue, | |||
1533 | p_used += n; | 1536 | p_used += n; |
1534 | 1537 | ||
1535 | /* Egress a piece of the payload. */ | 1538 | /* Egress a piece of the payload. */ |
1536 | edesc_body.va = va_to_tile_io_addr(f_data) + f_used; | 1539 | edesc_body.va = va_to_tile_io_addr(va); |
1537 | edesc_body.xfer_size = n; | 1540 | edesc_body.xfer_size = n; |
1538 | edesc_body.bound = !(p_used < p_len); | 1541 | edesc_body.bound = !(p_used < p_len); |
1539 | gxio_mpipe_equeue_put_at(equeue, edesc_body, slot); | 1542 | gxio_mpipe_equeue_put_at(equeue, edesc_body, slot); |
diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig index 983bbf4d5ef6..961f0b293913 100644 --- a/drivers/net/phy/Kconfig +++ b/drivers/net/phy/Kconfig | |||
@@ -15,6 +15,11 @@ if PHYLIB | |||
15 | 15 | ||
16 | comment "MII PHY device drivers" | 16 | comment "MII PHY device drivers" |
17 | 17 | ||
18 | config AT803X_PHY | ||
19 | tristate "Drivers for Atheros AT803X PHYs" | ||
20 | ---help--- | ||
21 | Currently supports the AT8030 and AT8035 model | ||
22 | |||
18 | config AMD_PHY | 23 | config AMD_PHY |
19 | tristate "Drivers for the AMD PHYs" | 24 | tristate "Drivers for the AMD PHYs" |
20 | ---help--- | 25 | ---help--- |
diff --git a/drivers/net/phy/Makefile b/drivers/net/phy/Makefile index 426674debae4..9645e389a58d 100644 --- a/drivers/net/phy/Makefile +++ b/drivers/net/phy/Makefile | |||
@@ -25,6 +25,7 @@ obj-$(CONFIG_STE10XP) += ste10Xp.o | |||
25 | obj-$(CONFIG_MICREL_PHY) += micrel.o | 25 | obj-$(CONFIG_MICREL_PHY) += micrel.o |
26 | obj-$(CONFIG_MDIO_OCTEON) += mdio-octeon.o | 26 | obj-$(CONFIG_MDIO_OCTEON) += mdio-octeon.o |
27 | obj-$(CONFIG_MICREL_KS8995MA) += spi_ks8995.o | 27 | obj-$(CONFIG_MICREL_KS8995MA) += spi_ks8995.o |
28 | obj-$(CONFIG_AT803X_PHY) += at803x.o | ||
28 | obj-$(CONFIG_AMD_PHY) += amd.o | 29 | obj-$(CONFIG_AMD_PHY) += amd.o |
29 | obj-$(CONFIG_MDIO_BUS_MUX) += mdio-mux.o | 30 | obj-$(CONFIG_MDIO_BUS_MUX) += mdio-mux.o |
30 | obj-$(CONFIG_MDIO_BUS_MUX_GPIO) += mdio-mux-gpio.o | 31 | obj-$(CONFIG_MDIO_BUS_MUX_GPIO) += mdio-mux-gpio.o |
diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c new file mode 100644 index 000000000000..45cbc10de01c --- /dev/null +++ b/drivers/net/phy/at803x.c | |||
@@ -0,0 +1,176 @@ | |||
1 | /* | ||
2 | * drivers/net/phy/at803x.c | ||
3 | * | ||
4 | * Driver for Atheros 803x PHY | ||
5 | * | ||
6 | * Author: Matus Ujhelyi <ujhelyi.m@gmail.com> | ||
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 | ||
10 | * Free Software Foundation; either version 2 of the License, or (at your | ||
11 | * option) any later version. | ||
12 | */ | ||
13 | |||
14 | #include <linux/phy.h> | ||
15 | #include <linux/module.h> | ||
16 | #include <linux/string.h> | ||
17 | #include <linux/netdevice.h> | ||
18 | #include <linux/etherdevice.h> | ||
19 | |||
20 | #define AT803X_INTR_ENABLE 0x12 | ||
21 | #define AT803X_INTR_STATUS 0x13 | ||
22 | #define AT803X_WOL_ENABLE 0x01 | ||
23 | #define AT803X_DEVICE_ADDR 0x03 | ||
24 | #define AT803X_LOC_MAC_ADDR_0_15_OFFSET 0x804C | ||
25 | #define AT803X_LOC_MAC_ADDR_16_31_OFFSET 0x804B | ||
26 | #define AT803X_LOC_MAC_ADDR_32_47_OFFSET 0x804A | ||
27 | #define AT803X_MMD_ACCESS_CONTROL 0x0D | ||
28 | #define AT803X_MMD_ACCESS_CONTROL_DATA 0x0E | ||
29 | #define AT803X_FUNC_DATA 0x4003 | ||
30 | |||
31 | MODULE_DESCRIPTION("Atheros 803x PHY driver"); | ||
32 | MODULE_AUTHOR("Matus Ujhelyi"); | ||
33 | MODULE_LICENSE("GPL"); | ||
34 | |||
35 | static void at803x_set_wol_mac_addr(struct phy_device *phydev) | ||
36 | { | ||
37 | struct net_device *ndev = phydev->attached_dev; | ||
38 | const u8 *mac; | ||
39 | unsigned int i, offsets[] = { | ||
40 | AT803X_LOC_MAC_ADDR_32_47_OFFSET, | ||
41 | AT803X_LOC_MAC_ADDR_16_31_OFFSET, | ||
42 | AT803X_LOC_MAC_ADDR_0_15_OFFSET, | ||
43 | }; | ||
44 | |||
45 | if (!ndev) | ||
46 | return; | ||
47 | |||
48 | mac = (const u8 *) ndev->dev_addr; | ||
49 | |||
50 | if (!is_valid_ether_addr(mac)) | ||
51 | return; | ||
52 | |||
53 | for (i = 0; i < 3; i++) { | ||
54 | phy_write(phydev, AT803X_MMD_ACCESS_CONTROL, | ||
55 | AT803X_DEVICE_ADDR); | ||
56 | phy_write(phydev, AT803X_MMD_ACCESS_CONTROL_DATA, | ||
57 | offsets[i]); | ||
58 | phy_write(phydev, AT803X_MMD_ACCESS_CONTROL, | ||
59 | AT803X_FUNC_DATA); | ||
60 | phy_write(phydev, AT803X_MMD_ACCESS_CONTROL_DATA, | ||
61 | mac[(i * 2) + 1] | (mac[(i * 2)] << 8)); | ||
62 | } | ||
63 | } | ||
64 | |||
65 | static int at803x_config_init(struct phy_device *phydev) | ||
66 | { | ||
67 | int val; | ||
68 | u32 features; | ||
69 | int status; | ||
70 | |||
71 | features = SUPPORTED_TP | SUPPORTED_MII | SUPPORTED_AUI | | ||
72 | SUPPORTED_FIBRE | SUPPORTED_BNC; | ||
73 | |||
74 | val = phy_read(phydev, MII_BMSR); | ||
75 | if (val < 0) | ||
76 | return val; | ||
77 | |||
78 | if (val & BMSR_ANEGCAPABLE) | ||
79 | features |= SUPPORTED_Autoneg; | ||
80 | if (val & BMSR_100FULL) | ||
81 | features |= SUPPORTED_100baseT_Full; | ||
82 | if (val & BMSR_100HALF) | ||
83 | features |= SUPPORTED_100baseT_Half; | ||
84 | if (val & BMSR_10FULL) | ||
85 | features |= SUPPORTED_10baseT_Full; | ||
86 | if (val & BMSR_10HALF) | ||
87 | features |= SUPPORTED_10baseT_Half; | ||
88 | |||
89 | if (val & BMSR_ESTATEN) { | ||
90 | val = phy_read(phydev, MII_ESTATUS); | ||
91 | if (val < 0) | ||
92 | return val; | ||
93 | |||
94 | if (val & ESTATUS_1000_TFULL) | ||
95 | features |= SUPPORTED_1000baseT_Full; | ||
96 | if (val & ESTATUS_1000_THALF) | ||
97 | features |= SUPPORTED_1000baseT_Half; | ||
98 | } | ||
99 | |||
100 | phydev->supported = features; | ||
101 | phydev->advertising = features; | ||
102 | |||
103 | /* enable WOL */ | ||
104 | at803x_set_wol_mac_addr(phydev); | ||
105 | status = phy_write(phydev, AT803X_INTR_ENABLE, AT803X_WOL_ENABLE); | ||
106 | status = phy_read(phydev, AT803X_INTR_STATUS); | ||
107 | |||
108 | return 0; | ||
109 | } | ||
110 | |||
111 | /* ATHEROS 8035 */ | ||
112 | static struct phy_driver at8035_driver = { | ||
113 | .phy_id = 0x004dd072, | ||
114 | .name = "Atheros 8035 ethernet", | ||
115 | .phy_id_mask = 0xffffffef, | ||
116 | .config_init = at803x_config_init, | ||
117 | .features = PHY_GBIT_FEATURES, | ||
118 | .flags = PHY_HAS_INTERRUPT, | ||
119 | .config_aneg = &genphy_config_aneg, | ||
120 | .read_status = &genphy_read_status, | ||
121 | .driver = { | ||
122 | .owner = THIS_MODULE, | ||
123 | }, | ||
124 | }; | ||
125 | |||
126 | /* ATHEROS 8030 */ | ||
127 | static struct phy_driver at8030_driver = { | ||
128 | .phy_id = 0x004dd076, | ||
129 | .name = "Atheros 8030 ethernet", | ||
130 | .phy_id_mask = 0xffffffef, | ||
131 | .config_init = at803x_config_init, | ||
132 | .features = PHY_GBIT_FEATURES, | ||
133 | .flags = PHY_HAS_INTERRUPT, | ||
134 | .config_aneg = &genphy_config_aneg, | ||
135 | .read_status = &genphy_read_status, | ||
136 | .driver = { | ||
137 | .owner = THIS_MODULE, | ||
138 | }, | ||
139 | }; | ||
140 | |||
141 | static int __init atheros_init(void) | ||
142 | { | ||
143 | int ret; | ||
144 | |||
145 | ret = phy_driver_register(&at8035_driver); | ||
146 | if (ret) | ||
147 | goto err1; | ||
148 | |||
149 | ret = phy_driver_register(&at8030_driver); | ||
150 | if (ret) | ||
151 | goto err2; | ||
152 | |||
153 | return 0; | ||
154 | |||
155 | err2: | ||
156 | phy_driver_unregister(&at8035_driver); | ||
157 | err1: | ||
158 | return ret; | ||
159 | } | ||
160 | |||
161 | static void __exit atheros_exit(void) | ||
162 | { | ||
163 | phy_driver_unregister(&at8035_driver); | ||
164 | phy_driver_unregister(&at8030_driver); | ||
165 | } | ||
166 | |||
167 | module_init(atheros_init); | ||
168 | module_exit(atheros_exit); | ||
169 | |||
170 | static struct mdio_device_id __maybe_unused atheros_tbl[] = { | ||
171 | { 0x004dd076, 0xffffffef }, | ||
172 | { 0x004dd072, 0xffffffef }, | ||
173 | { } | ||
174 | }; | ||
175 | |||
176 | MODULE_DEVICE_TABLE(mdio, atheros_tbl); | ||
diff --git a/drivers/net/usb/cdc_ether.c b/drivers/net/usb/cdc_ether.c index a03de7197049..d0129827602b 100644 --- a/drivers/net/usb/cdc_ether.c +++ b/drivers/net/usb/cdc_ether.c | |||
@@ -592,6 +592,32 @@ static const struct usb_device_id products [] = { | |||
592 | .driver_info = 0, | 592 | .driver_info = 0, |
593 | }, | 593 | }, |
594 | 594 | ||
595 | /* Novatel USB551L and MC551 - handled by qmi_wwan */ | ||
596 | { | ||
597 | .match_flags = USB_DEVICE_ID_MATCH_VENDOR | ||
598 | | USB_DEVICE_ID_MATCH_PRODUCT | ||
599 | | USB_DEVICE_ID_MATCH_INT_INFO, | ||
600 | .idVendor = NOVATEL_VENDOR_ID, | ||
601 | .idProduct = 0xB001, | ||
602 | .bInterfaceClass = USB_CLASS_COMM, | ||
603 | .bInterfaceSubClass = USB_CDC_SUBCLASS_ETHERNET, | ||
604 | .bInterfaceProtocol = USB_CDC_PROTO_NONE, | ||
605 | .driver_info = 0, | ||
606 | }, | ||
607 | |||
608 | /* Novatel E362 - handled by qmi_wwan */ | ||
609 | { | ||
610 | .match_flags = USB_DEVICE_ID_MATCH_VENDOR | ||
611 | | USB_DEVICE_ID_MATCH_PRODUCT | ||
612 | | USB_DEVICE_ID_MATCH_INT_INFO, | ||
613 | .idVendor = NOVATEL_VENDOR_ID, | ||
614 | .idProduct = 0x9010, | ||
615 | .bInterfaceClass = USB_CLASS_COMM, | ||
616 | .bInterfaceSubClass = USB_CDC_SUBCLASS_ETHERNET, | ||
617 | .bInterfaceProtocol = USB_CDC_PROTO_NONE, | ||
618 | .driver_info = 0, | ||
619 | }, | ||
620 | |||
595 | /* | 621 | /* |
596 | * WHITELIST!!! | 622 | * WHITELIST!!! |
597 | * | 623 | * |
@@ -604,21 +630,6 @@ static const struct usb_device_id products [] = { | |||
604 | * because of bugs/quirks in a given product (like Zaurus, above). | 630 | * because of bugs/quirks in a given product (like Zaurus, above). |
605 | */ | 631 | */ |
606 | { | 632 | { |
607 | /* Novatel USB551L */ | ||
608 | /* This match must come *before* the generic CDC-ETHER match so that | ||
609 | * we get FLAG_WWAN set on the device, since it's descriptors are | ||
610 | * generic CDC-ETHER. | ||
611 | */ | ||
612 | .match_flags = USB_DEVICE_ID_MATCH_VENDOR | ||
613 | | USB_DEVICE_ID_MATCH_PRODUCT | ||
614 | | USB_DEVICE_ID_MATCH_INT_INFO, | ||
615 | .idVendor = NOVATEL_VENDOR_ID, | ||
616 | .idProduct = 0xB001, | ||
617 | .bInterfaceClass = USB_CLASS_COMM, | ||
618 | .bInterfaceSubClass = USB_CDC_SUBCLASS_ETHERNET, | ||
619 | .bInterfaceProtocol = USB_CDC_PROTO_NONE, | ||
620 | .driver_info = (unsigned long)&wwan_info, | ||
621 | }, { | ||
622 | /* ZTE (Vodafone) K3805-Z */ | 633 | /* ZTE (Vodafone) K3805-Z */ |
623 | .match_flags = USB_DEVICE_ID_MATCH_VENDOR | 634 | .match_flags = USB_DEVICE_ID_MATCH_VENDOR |
624 | | USB_DEVICE_ID_MATCH_PRODUCT | 635 | | USB_DEVICE_ID_MATCH_PRODUCT |
diff --git a/drivers/net/usb/ipheth.c b/drivers/net/usb/ipheth.c index a28a983d465e..534d8becbbdc 100644 --- a/drivers/net/usb/ipheth.c +++ b/drivers/net/usb/ipheth.c | |||
@@ -62,6 +62,7 @@ | |||
62 | #define USB_PRODUCT_IPAD 0x129a | 62 | #define USB_PRODUCT_IPAD 0x129a |
63 | #define USB_PRODUCT_IPHONE_4_VZW 0x129c | 63 | #define USB_PRODUCT_IPHONE_4_VZW 0x129c |
64 | #define USB_PRODUCT_IPHONE_4S 0x12a0 | 64 | #define USB_PRODUCT_IPHONE_4S 0x12a0 |
65 | #define USB_PRODUCT_IPHONE_5 0x12a8 | ||
65 | 66 | ||
66 | #define IPHETH_USBINTF_CLASS 255 | 67 | #define IPHETH_USBINTF_CLASS 255 |
67 | #define IPHETH_USBINTF_SUBCLASS 253 | 68 | #define IPHETH_USBINTF_SUBCLASS 253 |
@@ -113,6 +114,10 @@ static struct usb_device_id ipheth_table[] = { | |||
113 | USB_VENDOR_APPLE, USB_PRODUCT_IPHONE_4S, | 114 | USB_VENDOR_APPLE, USB_PRODUCT_IPHONE_4S, |
114 | IPHETH_USBINTF_CLASS, IPHETH_USBINTF_SUBCLASS, | 115 | IPHETH_USBINTF_CLASS, IPHETH_USBINTF_SUBCLASS, |
115 | IPHETH_USBINTF_PROTO) }, | 116 | IPHETH_USBINTF_PROTO) }, |
117 | { USB_DEVICE_AND_INTERFACE_INFO( | ||
118 | USB_VENDOR_APPLE, USB_PRODUCT_IPHONE_5, | ||
119 | IPHETH_USBINTF_CLASS, IPHETH_USBINTF_SUBCLASS, | ||
120 | IPHETH_USBINTF_PROTO) }, | ||
116 | { } | 121 | { } |
117 | }; | 122 | }; |
118 | MODULE_DEVICE_TABLE(usb, ipheth_table); | 123 | MODULE_DEVICE_TABLE(usb, ipheth_table); |
diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c index 6883c371c59f..3b566fa0f8e6 100644 --- a/drivers/net/usb/qmi_wwan.c +++ b/drivers/net/usb/qmi_wwan.c | |||
@@ -369,18 +369,73 @@ static const struct usb_device_id products[] = { | |||
369 | USB_VENDOR_AND_INTERFACE_INFO(0x106c, USB_CLASS_VENDOR_SPEC, 0xf1, 0xff), | 369 | USB_VENDOR_AND_INTERFACE_INFO(0x106c, USB_CLASS_VENDOR_SPEC, 0xf1, 0xff), |
370 | .driver_info = (unsigned long)&qmi_wwan_info, | 370 | .driver_info = (unsigned long)&qmi_wwan_info, |
371 | }, | 371 | }, |
372 | { /* Novatel USB551L and MC551 */ | ||
373 | USB_DEVICE_AND_INTERFACE_INFO(0x1410, 0xb001, | ||
374 | USB_CLASS_COMM, | ||
375 | USB_CDC_SUBCLASS_ETHERNET, | ||
376 | USB_CDC_PROTO_NONE), | ||
377 | .driver_info = (unsigned long)&qmi_wwan_info, | ||
378 | }, | ||
379 | { /* Novatel E362 */ | ||
380 | USB_DEVICE_AND_INTERFACE_INFO(0x1410, 0x9010, | ||
381 | USB_CLASS_COMM, | ||
382 | USB_CDC_SUBCLASS_ETHERNET, | ||
383 | USB_CDC_PROTO_NONE), | ||
384 | .driver_info = (unsigned long)&qmi_wwan_info, | ||
385 | }, | ||
372 | 386 | ||
373 | /* 3. Combined interface devices matching on interface number */ | 387 | /* 3. Combined interface devices matching on interface number */ |
388 | {QMI_FIXED_INTF(0x19d2, 0x0002, 1)}, | ||
389 | {QMI_FIXED_INTF(0x19d2, 0x0012, 1)}, | ||
390 | {QMI_FIXED_INTF(0x19d2, 0x0017, 3)}, | ||
391 | {QMI_FIXED_INTF(0x19d2, 0x0021, 4)}, | ||
392 | {QMI_FIXED_INTF(0x19d2, 0x0025, 1)}, | ||
393 | {QMI_FIXED_INTF(0x19d2, 0x0031, 4)}, | ||
394 | {QMI_FIXED_INTF(0x19d2, 0x0042, 4)}, | ||
395 | {QMI_FIXED_INTF(0x19d2, 0x0049, 5)}, | ||
396 | {QMI_FIXED_INTF(0x19d2, 0x0052, 4)}, | ||
374 | {QMI_FIXED_INTF(0x19d2, 0x0055, 1)}, /* ZTE (Vodafone) K3520-Z */ | 397 | {QMI_FIXED_INTF(0x19d2, 0x0055, 1)}, /* ZTE (Vodafone) K3520-Z */ |
398 | {QMI_FIXED_INTF(0x19d2, 0x0058, 4)}, | ||
375 | {QMI_FIXED_INTF(0x19d2, 0x0063, 4)}, /* ZTE (Vodafone) K3565-Z */ | 399 | {QMI_FIXED_INTF(0x19d2, 0x0063, 4)}, /* ZTE (Vodafone) K3565-Z */ |
376 | {QMI_FIXED_INTF(0x19d2, 0x0104, 4)}, /* ZTE (Vodafone) K4505-Z */ | 400 | {QMI_FIXED_INTF(0x19d2, 0x0104, 4)}, /* ZTE (Vodafone) K4505-Z */ |
401 | {QMI_FIXED_INTF(0x19d2, 0x0113, 5)}, | ||
402 | {QMI_FIXED_INTF(0x19d2, 0x0118, 5)}, | ||
403 | {QMI_FIXED_INTF(0x19d2, 0x0121, 5)}, | ||
404 | {QMI_FIXED_INTF(0x19d2, 0x0123, 4)}, | ||
405 | {QMI_FIXED_INTF(0x19d2, 0x0124, 5)}, | ||
406 | {QMI_FIXED_INTF(0x19d2, 0x0125, 6)}, | ||
407 | {QMI_FIXED_INTF(0x19d2, 0x0126, 5)}, | ||
408 | {QMI_FIXED_INTF(0x19d2, 0x0130, 1)}, | ||
409 | {QMI_FIXED_INTF(0x19d2, 0x0133, 3)}, | ||
410 | {QMI_FIXED_INTF(0x19d2, 0x0141, 5)}, | ||
377 | {QMI_FIXED_INTF(0x19d2, 0x0157, 5)}, /* ZTE MF683 */ | 411 | {QMI_FIXED_INTF(0x19d2, 0x0157, 5)}, /* ZTE MF683 */ |
412 | {QMI_FIXED_INTF(0x19d2, 0x0158, 3)}, | ||
378 | {QMI_FIXED_INTF(0x19d2, 0x0167, 4)}, /* ZTE MF820D */ | 413 | {QMI_FIXED_INTF(0x19d2, 0x0167, 4)}, /* ZTE MF820D */ |
414 | {QMI_FIXED_INTF(0x19d2, 0x0168, 4)}, | ||
415 | {QMI_FIXED_INTF(0x19d2, 0x0176, 3)}, | ||
416 | {QMI_FIXED_INTF(0x19d2, 0x0178, 3)}, | ||
417 | {QMI_FIXED_INTF(0x19d2, 0x0191, 4)}, /* ZTE EuFi890 */ | ||
418 | {QMI_FIXED_INTF(0x19d2, 0x0199, 1)}, /* ZTE MF820S */ | ||
419 | {QMI_FIXED_INTF(0x19d2, 0x0200, 1)}, | ||
420 | {QMI_FIXED_INTF(0x19d2, 0x0257, 3)}, /* ZTE MF821 */ | ||
379 | {QMI_FIXED_INTF(0x19d2, 0x0326, 4)}, /* ZTE MF821D */ | 421 | {QMI_FIXED_INTF(0x19d2, 0x0326, 4)}, /* ZTE MF821D */ |
380 | {QMI_FIXED_INTF(0x19d2, 0x1008, 4)}, /* ZTE (Vodafone) K3570-Z */ | 422 | {QMI_FIXED_INTF(0x19d2, 0x1008, 4)}, /* ZTE (Vodafone) K3570-Z */ |
381 | {QMI_FIXED_INTF(0x19d2, 0x1010, 4)}, /* ZTE (Vodafone) K3571-Z */ | 423 | {QMI_FIXED_INTF(0x19d2, 0x1010, 4)}, /* ZTE (Vodafone) K3571-Z */ |
424 | {QMI_FIXED_INTF(0x19d2, 0x1012, 4)}, | ||
382 | {QMI_FIXED_INTF(0x19d2, 0x1018, 3)}, /* ZTE (Vodafone) K5006-Z */ | 425 | {QMI_FIXED_INTF(0x19d2, 0x1018, 3)}, /* ZTE (Vodafone) K5006-Z */ |
426 | {QMI_FIXED_INTF(0x19d2, 0x1021, 2)}, | ||
427 | {QMI_FIXED_INTF(0x19d2, 0x1245, 4)}, | ||
428 | {QMI_FIXED_INTF(0x19d2, 0x1247, 4)}, | ||
429 | {QMI_FIXED_INTF(0x19d2, 0x1252, 4)}, | ||
430 | {QMI_FIXED_INTF(0x19d2, 0x1254, 4)}, | ||
431 | {QMI_FIXED_INTF(0x19d2, 0x1255, 3)}, | ||
432 | {QMI_FIXED_INTF(0x19d2, 0x1255, 4)}, | ||
433 | {QMI_FIXED_INTF(0x19d2, 0x1256, 4)}, | ||
434 | {QMI_FIXED_INTF(0x19d2, 0x1401, 2)}, | ||
383 | {QMI_FIXED_INTF(0x19d2, 0x1402, 2)}, /* ZTE MF60 */ | 435 | {QMI_FIXED_INTF(0x19d2, 0x1402, 2)}, /* ZTE MF60 */ |
436 | {QMI_FIXED_INTF(0x19d2, 0x1424, 2)}, | ||
437 | {QMI_FIXED_INTF(0x19d2, 0x1425, 2)}, | ||
438 | {QMI_FIXED_INTF(0x19d2, 0x1426, 2)}, /* ZTE MF91 */ | ||
384 | {QMI_FIXED_INTF(0x19d2, 0x2002, 4)}, /* ZTE (Vodafone) K3765-Z */ | 439 | {QMI_FIXED_INTF(0x19d2, 0x2002, 4)}, /* ZTE (Vodafone) K3765-Z */ |
385 | {QMI_FIXED_INTF(0x0f3d, 0x68a2, 8)}, /* Sierra Wireless MC7700 */ | 440 | {QMI_FIXED_INTF(0x0f3d, 0x68a2, 8)}, /* Sierra Wireless MC7700 */ |
386 | {QMI_FIXED_INTF(0x114f, 0x68a2, 8)}, /* Sierra Wireless MC7750 */ | 441 | {QMI_FIXED_INTF(0x114f, 0x68a2, 8)}, /* Sierra Wireless MC7750 */ |
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c index f9819d10b1f9..cb04f900cc46 100644 --- a/drivers/net/usb/usbnet.c +++ b/drivers/net/usb/usbnet.c | |||
@@ -1158,6 +1158,7 @@ netdev_tx_t usbnet_start_xmit (struct sk_buff *skb, | |||
1158 | usb_anchor_urb(urb, &dev->deferred); | 1158 | usb_anchor_urb(urb, &dev->deferred); |
1159 | /* no use to process more packets */ | 1159 | /* no use to process more packets */ |
1160 | netif_stop_queue(net); | 1160 | netif_stop_queue(net); |
1161 | usb_put_urb(urb); | ||
1161 | spin_unlock_irqrestore(&dev->txq.lock, flags); | 1162 | spin_unlock_irqrestore(&dev->txq.lock, flags); |
1162 | netdev_dbg(dev->net, "Delaying transmission for resumption\n"); | 1163 | netdev_dbg(dev->net, "Delaying transmission for resumption\n"); |
1163 | goto deferred; | 1164 | goto deferred; |
@@ -1310,6 +1311,8 @@ void usbnet_disconnect (struct usb_interface *intf) | |||
1310 | 1311 | ||
1311 | cancel_work_sync(&dev->kevent); | 1312 | cancel_work_sync(&dev->kevent); |
1312 | 1313 | ||
1314 | usb_scuttle_anchored_urbs(&dev->deferred); | ||
1315 | |||
1313 | if (dev->driver_info->unbind) | 1316 | if (dev->driver_info->unbind) |
1314 | dev->driver_info->unbind (dev, intf); | 1317 | dev->driver_info->unbind (dev, intf); |
1315 | 1318 | ||
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_2p2_initvals.h b/drivers/net/wireless/ath/ath9k/ar9003_2p2_initvals.h index 89bf94d4d8a1..6f7cf49eff4d 100644 --- a/drivers/net/wireless/ath/ath9k/ar9003_2p2_initvals.h +++ b/drivers/net/wireless/ath/ath9k/ar9003_2p2_initvals.h | |||
@@ -534,107 +534,107 @@ static const u32 ar9300_2p2_baseband_core[][2] = { | |||
534 | 534 | ||
535 | static const u32 ar9300Modes_high_power_tx_gain_table_2p2[][5] = { | 535 | static const u32 ar9300Modes_high_power_tx_gain_table_2p2[][5] = { |
536 | /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ | 536 | /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ |
537 | {0x0000a2dc, 0x000cfff0, 0x000cfff0, 0x03aaa352, 0x03aaa352}, | 537 | {0x0000a2dc, 0x00033800, 0x00033800, 0x03aaa352, 0x03aaa352}, |
538 | {0x0000a2e0, 0x000f0000, 0x000f0000, 0x03ccc584, 0x03ccc584}, | 538 | {0x0000a2e0, 0x0003c000, 0x0003c000, 0x03ccc584, 0x03ccc584}, |
539 | {0x0000a2e4, 0x03f00000, 0x03f00000, 0x03f0f800, 0x03f0f800}, | 539 | {0x0000a2e4, 0x03fc0000, 0x03fc0000, 0x03f0f800, 0x03f0f800}, |
540 | {0x0000a2e8, 0x00000000, 0x00000000, 0x03ff0000, 0x03ff0000}, | 540 | {0x0000a2e8, 0x00000000, 0x00000000, 0x03ff0000, 0x03ff0000}, |
541 | {0x0000a410, 0x000050d9, 0x000050d9, 0x000050d9, 0x000050d9}, | 541 | {0x0000a410, 0x000050d9, 0x000050d9, 0x000050d9, 0x000050d9}, |
542 | {0x0000a500, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | 542 | {0x0000a500, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, |
543 | {0x0000a504, 0x06000003, 0x06000003, 0x04000002, 0x04000002}, | 543 | {0x0000a504, 0x06000003, 0x06000003, 0x04000002, 0x04000002}, |
544 | {0x0000a508, 0x0a000020, 0x0a000020, 0x08000004, 0x08000004}, | 544 | {0x0000a508, 0x0a000020, 0x0a000020, 0x08000004, 0x08000004}, |
545 | {0x0000a50c, 0x10000023, 0x10000023, 0x0b000200, 0x0b000200}, | 545 | {0x0000a50c, 0x10000023, 0x10000023, 0x0b000200, 0x0b000200}, |
546 | {0x0000a510, 0x15000028, 0x15000028, 0x0f000202, 0x0f000202}, | 546 | {0x0000a510, 0x16000220, 0x16000220, 0x0f000202, 0x0f000202}, |
547 | {0x0000a514, 0x1b00002b, 0x1b00002b, 0x12000400, 0x12000400}, | 547 | {0x0000a514, 0x1c000223, 0x1c000223, 0x12000400, 0x12000400}, |
548 | {0x0000a518, 0x1f020028, 0x1f020028, 0x16000402, 0x16000402}, | 548 | {0x0000a518, 0x21002220, 0x21002220, 0x16000402, 0x16000402}, |
549 | {0x0000a51c, 0x2502002b, 0x2502002b, 0x19000404, 0x19000404}, | 549 | {0x0000a51c, 0x27002223, 0x27002223, 0x19000404, 0x19000404}, |
550 | {0x0000a520, 0x2a04002a, 0x2a04002a, 0x1c000603, 0x1c000603}, | 550 | {0x0000a520, 0x2b022220, 0x2b022220, 0x1c000603, 0x1c000603}, |
551 | {0x0000a524, 0x2e06002a, 0x2e06002a, 0x21000a02, 0x21000a02}, | 551 | {0x0000a524, 0x2f022222, 0x2f022222, 0x21000a02, 0x21000a02}, |
552 | {0x0000a528, 0x3302202d, 0x3302202d, 0x25000a04, 0x25000a04}, | 552 | {0x0000a528, 0x34022225, 0x34022225, 0x25000a04, 0x25000a04}, |
553 | {0x0000a52c, 0x3804202c, 0x3804202c, 0x28000a20, 0x28000a20}, | 553 | {0x0000a52c, 0x3a02222a, 0x3a02222a, 0x28000a20, 0x28000a20}, |
554 | {0x0000a530, 0x3c06202c, 0x3c06202c, 0x2c000e20, 0x2c000e20}, | 554 | {0x0000a530, 0x3e02222c, 0x3e02222c, 0x2c000e20, 0x2c000e20}, |
555 | {0x0000a534, 0x4108202d, 0x4108202d, 0x30000e22, 0x30000e22}, | 555 | {0x0000a534, 0x4202242a, 0x4202242a, 0x30000e22, 0x30000e22}, |
556 | {0x0000a538, 0x4506402d, 0x4506402d, 0x34000e24, 0x34000e24}, | 556 | {0x0000a538, 0x4702244a, 0x4702244a, 0x34000e24, 0x34000e24}, |
557 | {0x0000a53c, 0x4906222d, 0x4906222d, 0x38001640, 0x38001640}, | 557 | {0x0000a53c, 0x4b02244c, 0x4b02244c, 0x38001640, 0x38001640}, |
558 | {0x0000a540, 0x4d062231, 0x4d062231, 0x3c001660, 0x3c001660}, | 558 | {0x0000a540, 0x4e02246c, 0x4e02246c, 0x3c001660, 0x3c001660}, |
559 | {0x0000a544, 0x50082231, 0x50082231, 0x3f001861, 0x3f001861}, | 559 | {0x0000a544, 0x52022470, 0x52022470, 0x3f001861, 0x3f001861}, |
560 | {0x0000a548, 0x5608422e, 0x5608422e, 0x43001a81, 0x43001a81}, | 560 | {0x0000a548, 0x55022490, 0x55022490, 0x43001a81, 0x43001a81}, |
561 | {0x0000a54c, 0x5a08442e, 0x5a08442e, 0x47001a83, 0x47001a83}, | 561 | {0x0000a54c, 0x59022492, 0x59022492, 0x47001a83, 0x47001a83}, |
562 | {0x0000a550, 0x5e0a4431, 0x5e0a4431, 0x4a001c84, 0x4a001c84}, | 562 | {0x0000a550, 0x5d022692, 0x5d022692, 0x4a001c84, 0x4a001c84}, |
563 | {0x0000a554, 0x640a4432, 0x640a4432, 0x4e001ce3, 0x4e001ce3}, | 563 | {0x0000a554, 0x61022892, 0x61022892, 0x4e001ce3, 0x4e001ce3}, |
564 | {0x0000a558, 0x680a4434, 0x680a4434, 0x52001ce5, 0x52001ce5}, | 564 | {0x0000a558, 0x65024890, 0x65024890, 0x52001ce5, 0x52001ce5}, |
565 | {0x0000a55c, 0x6c0a6434, 0x6c0a6434, 0x56001ce9, 0x56001ce9}, | 565 | {0x0000a55c, 0x69024892, 0x69024892, 0x56001ce9, 0x56001ce9}, |
566 | {0x0000a560, 0x6f0a6633, 0x6f0a6633, 0x5a001ceb, 0x5a001ceb}, | 566 | {0x0000a560, 0x6e024c92, 0x6e024c92, 0x5a001ceb, 0x5a001ceb}, |
567 | {0x0000a564, 0x730c6634, 0x730c6634, 0x5d001eec, 0x5d001eec}, | 567 | {0x0000a564, 0x74026e92, 0x74026e92, 0x5d001eec, 0x5d001eec}, |
568 | {0x0000a568, 0x730c6634, 0x730c6634, 0x5d001eec, 0x5d001eec}, | 568 | {0x0000a568, 0x74026e92, 0x74026e92, 0x5d001eec, 0x5d001eec}, |
569 | {0x0000a56c, 0x730c6634, 0x730c6634, 0x5d001eec, 0x5d001eec}, | 569 | {0x0000a56c, 0x74026e92, 0x74026e92, 0x5d001eec, 0x5d001eec}, |
570 | {0x0000a570, 0x730c6634, 0x730c6634, 0x5d001eec, 0x5d001eec}, | 570 | {0x0000a570, 0x74026e92, 0x74026e92, 0x5d001eec, 0x5d001eec}, |
571 | {0x0000a574, 0x730c6634, 0x730c6634, 0x5d001eec, 0x5d001eec}, | 571 | {0x0000a574, 0x74026e92, 0x74026e92, 0x5d001eec, 0x5d001eec}, |
572 | {0x0000a578, 0x730c6634, 0x730c6634, 0x5d001eec, 0x5d001eec}, | 572 | {0x0000a578, 0x74026e92, 0x74026e92, 0x5d001eec, 0x5d001eec}, |
573 | {0x0000a57c, 0x730c6634, 0x730c6634, 0x5d001eec, 0x5d001eec}, | 573 | {0x0000a57c, 0x74026e92, 0x74026e92, 0x5d001eec, 0x5d001eec}, |
574 | {0x0000a580, 0x00800000, 0x00800000, 0x00800000, 0x00800000}, | 574 | {0x0000a580, 0x00800000, 0x00800000, 0x00800000, 0x00800000}, |
575 | {0x0000a584, 0x06800003, 0x06800003, 0x04800002, 0x04800002}, | 575 | {0x0000a584, 0x06800003, 0x06800003, 0x04800002, 0x04800002}, |
576 | {0x0000a588, 0x0a800020, 0x0a800020, 0x08800004, 0x08800004}, | 576 | {0x0000a588, 0x0a800020, 0x0a800020, 0x08800004, 0x08800004}, |
577 | {0x0000a58c, 0x10800023, 0x10800023, 0x0b800200, 0x0b800200}, | 577 | {0x0000a58c, 0x10800023, 0x10800023, 0x0b800200, 0x0b800200}, |
578 | {0x0000a590, 0x15800028, 0x15800028, 0x0f800202, 0x0f800202}, | 578 | {0x0000a590, 0x16800220, 0x16800220, 0x0f800202, 0x0f800202}, |
579 | {0x0000a594, 0x1b80002b, 0x1b80002b, 0x12800400, 0x12800400}, | 579 | {0x0000a594, 0x1c800223, 0x1c800223, 0x12800400, 0x12800400}, |
580 | {0x0000a598, 0x1f820028, 0x1f820028, 0x16800402, 0x16800402}, | 580 | {0x0000a598, 0x21802220, 0x21802220, 0x16800402, 0x16800402}, |
581 | {0x0000a59c, 0x2582002b, 0x2582002b, 0x19800404, 0x19800404}, | 581 | {0x0000a59c, 0x27802223, 0x27802223, 0x19800404, 0x19800404}, |
582 | {0x0000a5a0, 0x2a84002a, 0x2a84002a, 0x1c800603, 0x1c800603}, | 582 | {0x0000a5a0, 0x2b822220, 0x2b822220, 0x1c800603, 0x1c800603}, |
583 | {0x0000a5a4, 0x2e86002a, 0x2e86002a, 0x21800a02, 0x21800a02}, | 583 | {0x0000a5a4, 0x2f822222, 0x2f822222, 0x21800a02, 0x21800a02}, |
584 | {0x0000a5a8, 0x3382202d, 0x3382202d, 0x25800a04, 0x25800a04}, | 584 | {0x0000a5a8, 0x34822225, 0x34822225, 0x25800a04, 0x25800a04}, |
585 | {0x0000a5ac, 0x3884202c, 0x3884202c, 0x28800a20, 0x28800a20}, | 585 | {0x0000a5ac, 0x3a82222a, 0x3a82222a, 0x28800a20, 0x28800a20}, |
586 | {0x0000a5b0, 0x3c86202c, 0x3c86202c, 0x2c800e20, 0x2c800e20}, | 586 | {0x0000a5b0, 0x3e82222c, 0x3e82222c, 0x2c800e20, 0x2c800e20}, |
587 | {0x0000a5b4, 0x4188202d, 0x4188202d, 0x30800e22, 0x30800e22}, | 587 | {0x0000a5b4, 0x4282242a, 0x4282242a, 0x30800e22, 0x30800e22}, |
588 | {0x0000a5b8, 0x4586402d, 0x4586402d, 0x34800e24, 0x34800e24}, | 588 | {0x0000a5b8, 0x4782244a, 0x4782244a, 0x34800e24, 0x34800e24}, |
589 | {0x0000a5bc, 0x4986222d, 0x4986222d, 0x38801640, 0x38801640}, | 589 | {0x0000a5bc, 0x4b82244c, 0x4b82244c, 0x38801640, 0x38801640}, |
590 | {0x0000a5c0, 0x4d862231, 0x4d862231, 0x3c801660, 0x3c801660}, | 590 | {0x0000a5c0, 0x4e82246c, 0x4e82246c, 0x3c801660, 0x3c801660}, |
591 | {0x0000a5c4, 0x50882231, 0x50882231, 0x3f801861, 0x3f801861}, | 591 | {0x0000a5c4, 0x52822470, 0x52822470, 0x3f801861, 0x3f801861}, |
592 | {0x0000a5c8, 0x5688422e, 0x5688422e, 0x43801a81, 0x43801a81}, | 592 | {0x0000a5c8, 0x55822490, 0x55822490, 0x43801a81, 0x43801a81}, |
593 | {0x0000a5cc, 0x5a88442e, 0x5a88442e, 0x47801a83, 0x47801a83}, | 593 | {0x0000a5cc, 0x59822492, 0x59822492, 0x47801a83, 0x47801a83}, |
594 | {0x0000a5d0, 0x5e8a4431, 0x5e8a4431, 0x4a801c84, 0x4a801c84}, | 594 | {0x0000a5d0, 0x5d822692, 0x5d822692, 0x4a801c84, 0x4a801c84}, |
595 | {0x0000a5d4, 0x648a4432, 0x648a4432, 0x4e801ce3, 0x4e801ce3}, | 595 | {0x0000a5d4, 0x61822892, 0x61822892, 0x4e801ce3, 0x4e801ce3}, |
596 | {0x0000a5d8, 0x688a4434, 0x688a4434, 0x52801ce5, 0x52801ce5}, | 596 | {0x0000a5d8, 0x65824890, 0x65824890, 0x52801ce5, 0x52801ce5}, |
597 | {0x0000a5dc, 0x6c8a6434, 0x6c8a6434, 0x56801ce9, 0x56801ce9}, | 597 | {0x0000a5dc, 0x69824892, 0x69824892, 0x56801ce9, 0x56801ce9}, |
598 | {0x0000a5e0, 0x6f8a6633, 0x6f8a6633, 0x5a801ceb, 0x5a801ceb}, | 598 | {0x0000a5e0, 0x6e824c92, 0x6e824c92, 0x5a801ceb, 0x5a801ceb}, |
599 | {0x0000a5e4, 0x738c6634, 0x738c6634, 0x5d801eec, 0x5d801eec}, | 599 | {0x0000a5e4, 0x74826e92, 0x74826e92, 0x5d801eec, 0x5d801eec}, |
600 | {0x0000a5e8, 0x738c6634, 0x738c6634, 0x5d801eec, 0x5d801eec}, | 600 | {0x0000a5e8, 0x74826e92, 0x74826e92, 0x5d801eec, 0x5d801eec}, |
601 | {0x0000a5ec, 0x738c6634, 0x738c6634, 0x5d801eec, 0x5d801eec}, | 601 | {0x0000a5ec, 0x74826e92, 0x74826e92, 0x5d801eec, 0x5d801eec}, |
602 | {0x0000a5f0, 0x738c6634, 0x738c6634, 0x5d801eec, 0x5d801eec}, | 602 | {0x0000a5f0, 0x74826e92, 0x74826e92, 0x5d801eec, 0x5d801eec}, |
603 | {0x0000a5f4, 0x738c6634, 0x738c6634, 0x5d801eec, 0x5d801eec}, | 603 | {0x0000a5f4, 0x74826e92, 0x74826e92, 0x5d801eec, 0x5d801eec}, |
604 | {0x0000a5f8, 0x738c6634, 0x738c6634, 0x5d801eec, 0x5d801eec}, | 604 | {0x0000a5f8, 0x74826e92, 0x74826e92, 0x5d801eec, 0x5d801eec}, |
605 | {0x0000a5fc, 0x738c6634, 0x738c6634, 0x5d801eec, 0x5d801eec}, | 605 | {0x0000a5fc, 0x74826e92, 0x74826e92, 0x5d801eec, 0x5d801eec}, |
606 | {0x0000a600, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | 606 | {0x0000a600, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, |
607 | {0x0000a604, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | 607 | {0x0000a604, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, |
608 | {0x0000a608, 0x01804601, 0x01804601, 0x00000000, 0x00000000}, | 608 | {0x0000a608, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, |
609 | {0x0000a60c, 0x01804601, 0x01804601, 0x00000000, 0x00000000}, | 609 | {0x0000a60c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, |
610 | {0x0000a610, 0x01804601, 0x01804601, 0x00000000, 0x00000000}, | 610 | {0x0000a610, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, |
611 | {0x0000a614, 0x01804601, 0x01804601, 0x01404000, 0x01404000}, | 611 | {0x0000a614, 0x02004000, 0x02004000, 0x01404000, 0x01404000}, |
612 | {0x0000a618, 0x01804601, 0x01804601, 0x01404501, 0x01404501}, | 612 | {0x0000a618, 0x02004801, 0x02004801, 0x01404501, 0x01404501}, |
613 | {0x0000a61c, 0x01804601, 0x01804601, 0x02008501, 0x02008501}, | 613 | {0x0000a61c, 0x02808a02, 0x02808a02, 0x02008501, 0x02008501}, |
614 | {0x0000a620, 0x03408d02, 0x03408d02, 0x0280ca03, 0x0280ca03}, | 614 | {0x0000a620, 0x0380ce03, 0x0380ce03, 0x0280ca03, 0x0280ca03}, |
615 | {0x0000a624, 0x0300cc03, 0x0300cc03, 0x03010c04, 0x03010c04}, | 615 | {0x0000a624, 0x04411104, 0x04411104, 0x03010c04, 0x03010c04}, |
616 | {0x0000a628, 0x03410d04, 0x03410d04, 0x04014c04, 0x04014c04}, | 616 | {0x0000a628, 0x04411104, 0x04411104, 0x04014c04, 0x04014c04}, |
617 | {0x0000a62c, 0x03410d04, 0x03410d04, 0x04015005, 0x04015005}, | 617 | {0x0000a62c, 0x04411104, 0x04411104, 0x04015005, 0x04015005}, |
618 | {0x0000a630, 0x03410d04, 0x03410d04, 0x04015005, 0x04015005}, | 618 | {0x0000a630, 0x04411104, 0x04411104, 0x04015005, 0x04015005}, |
619 | {0x0000a634, 0x03410d04, 0x03410d04, 0x04015005, 0x04015005}, | 619 | {0x0000a634, 0x04411104, 0x04411104, 0x04015005, 0x04015005}, |
620 | {0x0000a638, 0x03410d04, 0x03410d04, 0x04015005, 0x04015005}, | 620 | {0x0000a638, 0x04411104, 0x04411104, 0x04015005, 0x04015005}, |
621 | {0x0000a63c, 0x03410d04, 0x03410d04, 0x04015005, 0x04015005}, | 621 | {0x0000a63c, 0x04411104, 0x04411104, 0x04015005, 0x04015005}, |
622 | {0x0000b2dc, 0x000cfff0, 0x000cfff0, 0x03aaa352, 0x03aaa352}, | 622 | {0x0000b2dc, 0x00033800, 0x00033800, 0x03aaa352, 0x03aaa352}, |
623 | {0x0000b2e0, 0x000f0000, 0x000f0000, 0x03ccc584, 0x03ccc584}, | 623 | {0x0000b2e0, 0x0003c000, 0x0003c000, 0x03ccc584, 0x03ccc584}, |
624 | {0x0000b2e4, 0x03f00000, 0x03f00000, 0x03f0f800, 0x03f0f800}, | 624 | {0x0000b2e4, 0x03fc0000, 0x03fc0000, 0x03f0f800, 0x03f0f800}, |
625 | {0x0000b2e8, 0x00000000, 0x00000000, 0x03ff0000, 0x03ff0000}, | 625 | {0x0000b2e8, 0x00000000, 0x00000000, 0x03ff0000, 0x03ff0000}, |
626 | {0x0000c2dc, 0x000cfff0, 0x000cfff0, 0x03aaa352, 0x03aaa352}, | 626 | {0x0000c2dc, 0x00033800, 0x00033800, 0x03aaa352, 0x03aaa352}, |
627 | {0x0000c2e0, 0x000f0000, 0x000f0000, 0x03ccc584, 0x03ccc584}, | 627 | {0x0000c2e0, 0x0003c000, 0x0003c000, 0x03ccc584, 0x03ccc584}, |
628 | {0x0000c2e4, 0x03f00000, 0x03f00000, 0x03f0f800, 0x03f0f800}, | 628 | {0x0000c2e4, 0x03fc0000, 0x03fc0000, 0x03f0f800, 0x03f0f800}, |
629 | {0x0000c2e8, 0x00000000, 0x00000000, 0x03ff0000, 0x03ff0000}, | 629 | {0x0000c2e8, 0x00000000, 0x00000000, 0x03ff0000, 0x03ff0000}, |
630 | {0x00016044, 0x012492d4, 0x012492d4, 0x012492d4, 0x012492d4}, | 630 | {0x00016044, 0x012492d4, 0x012492d4, 0x012492d4, 0x012492d4}, |
631 | {0x00016048, 0x61200001, 0x61200001, 0x66480001, 0x66480001}, | 631 | {0x00016048, 0x66480001, 0x66480001, 0x66480001, 0x66480001}, |
632 | {0x00016068, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c}, | 632 | {0x00016068, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c}, |
633 | {0x00016444, 0x012492d4, 0x012492d4, 0x012492d4, 0x012492d4}, | 633 | {0x00016444, 0x012492d4, 0x012492d4, 0x012492d4, 0x012492d4}, |
634 | {0x00016448, 0x61200001, 0x61200001, 0x66480001, 0x66480001}, | 634 | {0x00016448, 0x66480001, 0x66480001, 0x66480001, 0x66480001}, |
635 | {0x00016468, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c}, | 635 | {0x00016468, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c}, |
636 | {0x00016844, 0x012492d4, 0x012492d4, 0x012492d4, 0x012492d4}, | 636 | {0x00016844, 0x012492d4, 0x012492d4, 0x012492d4, 0x012492d4}, |
637 | {0x00016848, 0x61200001, 0x61200001, 0x66480001, 0x66480001}, | 637 | {0x00016848, 0x66480001, 0x66480001, 0x66480001, 0x66480001}, |
638 | {0x00016868, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c}, | 638 | {0x00016868, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c}, |
639 | }; | 639 | }; |
640 | 640 | ||
diff --git a/drivers/net/wireless/ath/ath9k/hif_usb.c b/drivers/net/wireless/ath/ath9k/hif_usb.c index 924c4616c3d9..f5dda84176c3 100644 --- a/drivers/net/wireless/ath/ath9k/hif_usb.c +++ b/drivers/net/wireless/ath/ath9k/hif_usb.c | |||
@@ -38,6 +38,7 @@ static struct usb_device_id ath9k_hif_usb_ids[] = { | |||
38 | { USB_DEVICE(0x04CA, 0x4605) }, /* Liteon */ | 38 | { USB_DEVICE(0x04CA, 0x4605) }, /* Liteon */ |
39 | { USB_DEVICE(0x040D, 0x3801) }, /* VIA */ | 39 | { USB_DEVICE(0x040D, 0x3801) }, /* VIA */ |
40 | { USB_DEVICE(0x0cf3, 0xb003) }, /* Ubiquiti WifiStation Ext */ | 40 | { USB_DEVICE(0x0cf3, 0xb003) }, /* Ubiquiti WifiStation Ext */ |
41 | { USB_DEVICE(0x0cf3, 0xb002) }, /* Ubiquiti WifiStation */ | ||
41 | { USB_DEVICE(0x057c, 0x8403) }, /* AVM FRITZ!WLAN 11N v2 USB */ | 42 | { USB_DEVICE(0x057c, 0x8403) }, /* AVM FRITZ!WLAN 11N v2 USB */ |
42 | 43 | ||
43 | { USB_DEVICE(0x0cf3, 0x7015), | 44 | { USB_DEVICE(0x0cf3, 0x7015), |
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c index 73730e94e0ac..c5a99c8c8168 100644 --- a/drivers/net/wireless/b43/main.c +++ b/drivers/net/wireless/b43/main.c | |||
@@ -5404,6 +5404,8 @@ static void b43_bcma_remove(struct bcma_device *core) | |||
5404 | cancel_work_sync(&wldev->restart_work); | 5404 | cancel_work_sync(&wldev->restart_work); |
5405 | 5405 | ||
5406 | B43_WARN_ON(!wl); | 5406 | B43_WARN_ON(!wl); |
5407 | if (!wldev->fw.ucode.data) | ||
5408 | return; /* NULL if firmware never loaded */ | ||
5407 | if (wl->current_dev == wldev && wl->hw_registred) { | 5409 | if (wl->current_dev == wldev && wl->hw_registred) { |
5408 | b43_leds_stop(wldev); | 5410 | b43_leds_stop(wldev); |
5409 | ieee80211_unregister_hw(wl->hw); | 5411 | ieee80211_unregister_hw(wl->hw); |
@@ -5478,6 +5480,8 @@ static void b43_ssb_remove(struct ssb_device *sdev) | |||
5478 | cancel_work_sync(&wldev->restart_work); | 5480 | cancel_work_sync(&wldev->restart_work); |
5479 | 5481 | ||
5480 | B43_WARN_ON(!wl); | 5482 | B43_WARN_ON(!wl); |
5483 | if (!wldev->fw.ucode.data) | ||
5484 | return; /* NULL if firmware never loaded */ | ||
5481 | if (wl->current_dev == wldev && wl->hw_registred) { | 5485 | if (wl->current_dev == wldev && wl->hw_registred) { |
5482 | b43_leds_stop(wldev); | 5486 | b43_leds_stop(wldev); |
5483 | ieee80211_unregister_hw(wl->hw); | 5487 | ieee80211_unregister_hw(wl->hw); |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/usb.c b/drivers/net/wireless/brcm80211/brcmfmac/usb.c index a2b4b1e71017..7a6dfdc67b6c 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/usb.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/usb.c | |||
@@ -1339,7 +1339,7 @@ static int brcmf_usb_probe_cb(struct brcmf_usbdev_info *devinfo, | |||
1339 | } | 1339 | } |
1340 | 1340 | ||
1341 | ret = brcmf_bus_start(dev); | 1341 | ret = brcmf_bus_start(dev); |
1342 | if (ret == -ENOLINK) { | 1342 | if (ret) { |
1343 | brcmf_dbg(ERROR, "dongle is not responding\n"); | 1343 | brcmf_dbg(ERROR, "dongle is not responding\n"); |
1344 | brcmf_detach(dev); | 1344 | brcmf_detach(dev); |
1345 | goto fail; | 1345 | goto fail; |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c index c1abaa6db59e..a6f1e8166008 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c | |||
@@ -3569,7 +3569,7 @@ brcmf_cfg80211_sched_scan_start(struct wiphy *wiphy, | |||
3569 | 3569 | ||
3570 | if (!request || !request->n_ssids || !request->n_match_sets) { | 3570 | if (!request || !request->n_ssids || !request->n_match_sets) { |
3571 | WL_ERR("Invalid sched scan req!! n_ssids:%d\n", | 3571 | WL_ERR("Invalid sched scan req!! n_ssids:%d\n", |
3572 | request->n_ssids); | 3572 | request ? request->n_ssids : 0); |
3573 | return -EINVAL; | 3573 | return -EINVAL; |
3574 | } | 3574 | } |
3575 | 3575 | ||
@@ -3972,7 +3972,7 @@ brcmf_set_management_ie(struct brcmf_cfg80211_info *cfg, | |||
3972 | u8 *iovar_ie_buf; | 3972 | u8 *iovar_ie_buf; |
3973 | u8 *curr_ie_buf; | 3973 | u8 *curr_ie_buf; |
3974 | u8 *mgmt_ie_buf = NULL; | 3974 | u8 *mgmt_ie_buf = NULL; |
3975 | u32 mgmt_ie_buf_len = 0; | 3975 | int mgmt_ie_buf_len; |
3976 | u32 *mgmt_ie_len = 0; | 3976 | u32 *mgmt_ie_len = 0; |
3977 | u32 del_add_ie_buf_len = 0; | 3977 | u32 del_add_ie_buf_len = 0; |
3978 | u32 total_ie_buf_len = 0; | 3978 | u32 total_ie_buf_len = 0; |
@@ -3982,7 +3982,7 @@ brcmf_set_management_ie(struct brcmf_cfg80211_info *cfg, | |||
3982 | struct parsed_vndr_ie_info *vndrie_info; | 3982 | struct parsed_vndr_ie_info *vndrie_info; |
3983 | s32 i; | 3983 | s32 i; |
3984 | u8 *ptr; | 3984 | u8 *ptr; |
3985 | u32 remained_buf_len; | 3985 | int remained_buf_len; |
3986 | 3986 | ||
3987 | WL_TRACE("bssidx %d, pktflag : 0x%02X\n", bssidx, pktflag); | 3987 | WL_TRACE("bssidx %d, pktflag : 0x%02X\n", bssidx, pktflag); |
3988 | iovar_ie_buf = kzalloc(WL_EXTRA_BUF_MAX, GFP_KERNEL); | 3988 | iovar_ie_buf = kzalloc(WL_EXTRA_BUF_MAX, GFP_KERNEL); |
@@ -4606,12 +4606,13 @@ brcmf_bss_roaming_done(struct brcmf_cfg80211_info *cfg, | |||
4606 | struct brcmf_cfg80211_profile *profile = cfg->profile; | 4606 | struct brcmf_cfg80211_profile *profile = cfg->profile; |
4607 | struct brcmf_cfg80211_connect_info *conn_info = cfg_to_conn(cfg); | 4607 | struct brcmf_cfg80211_connect_info *conn_info = cfg_to_conn(cfg); |
4608 | struct wiphy *wiphy = cfg_to_wiphy(cfg); | 4608 | struct wiphy *wiphy = cfg_to_wiphy(cfg); |
4609 | struct brcmf_channel_info_le channel_le; | 4609 | struct ieee80211_channel *notify_channel = NULL; |
4610 | struct ieee80211_channel *notify_channel; | ||
4611 | struct ieee80211_supported_band *band; | 4610 | struct ieee80211_supported_band *band; |
4611 | struct brcmf_bss_info_le *bi; | ||
4612 | u32 freq; | 4612 | u32 freq; |
4613 | s32 err = 0; | 4613 | s32 err = 0; |
4614 | u32 target_channel; | 4614 | u32 target_channel; |
4615 | u8 *buf; | ||
4615 | 4616 | ||
4616 | WL_TRACE("Enter\n"); | 4617 | WL_TRACE("Enter\n"); |
4617 | 4618 | ||
@@ -4619,11 +4620,22 @@ brcmf_bss_roaming_done(struct brcmf_cfg80211_info *cfg, | |||
4619 | memcpy(profile->bssid, e->addr, ETH_ALEN); | 4620 | memcpy(profile->bssid, e->addr, ETH_ALEN); |
4620 | brcmf_update_bss_info(cfg); | 4621 | brcmf_update_bss_info(cfg); |
4621 | 4622 | ||
4622 | brcmf_exec_dcmd(ndev, BRCMF_C_GET_CHANNEL, &channel_le, | 4623 | buf = kzalloc(WL_BSS_INFO_MAX, GFP_KERNEL); |
4623 | sizeof(channel_le)); | 4624 | if (buf == NULL) { |
4625 | err = -ENOMEM; | ||
4626 | goto done; | ||
4627 | } | ||
4628 | |||
4629 | /* data sent to dongle has to be little endian */ | ||
4630 | *(__le32 *)buf = cpu_to_le32(WL_BSS_INFO_MAX); | ||
4631 | err = brcmf_exec_dcmd(ndev, BRCMF_C_GET_BSS_INFO, buf, WL_BSS_INFO_MAX); | ||
4632 | |||
4633 | if (err) | ||
4634 | goto done; | ||
4624 | 4635 | ||
4625 | target_channel = le32_to_cpu(channel_le.target_channel); | 4636 | bi = (struct brcmf_bss_info_le *)(buf + 4); |
4626 | WL_CONN("Roamed to channel %d\n", target_channel); | 4637 | target_channel = bi->ctl_ch ? bi->ctl_ch : |
4638 | CHSPEC_CHANNEL(le16_to_cpu(bi->chanspec)); | ||
4627 | 4639 | ||
4628 | if (target_channel <= CH_MAX_2G_CHANNEL) | 4640 | if (target_channel <= CH_MAX_2G_CHANNEL) |
4629 | band = wiphy->bands[IEEE80211_BAND_2GHZ]; | 4641 | band = wiphy->bands[IEEE80211_BAND_2GHZ]; |
@@ -4633,6 +4645,8 @@ brcmf_bss_roaming_done(struct brcmf_cfg80211_info *cfg, | |||
4633 | freq = ieee80211_channel_to_frequency(target_channel, band->band); | 4645 | freq = ieee80211_channel_to_frequency(target_channel, band->band); |
4634 | notify_channel = ieee80211_get_channel(wiphy, freq); | 4646 | notify_channel = ieee80211_get_channel(wiphy, freq); |
4635 | 4647 | ||
4648 | done: | ||
4649 | kfree(buf); | ||
4636 | cfg80211_roamed(ndev, notify_channel, (u8 *)profile->bssid, | 4650 | cfg80211_roamed(ndev, notify_channel, (u8 *)profile->bssid, |
4637 | conn_info->req_ie, conn_info->req_ie_len, | 4651 | conn_info->req_ie, conn_info->req_ie_len, |
4638 | conn_info->resp_ie, conn_info->resp_ie_len, GFP_KERNEL); | 4652 | conn_info->resp_ie, conn_info->resp_ie_len, GFP_KERNEL); |
@@ -5186,41 +5200,6 @@ brcmf_cfg80211_event(struct net_device *ndev, | |||
5186 | schedule_work(&cfg->event_work); | 5200 | schedule_work(&cfg->event_work); |
5187 | } | 5201 | } |
5188 | 5202 | ||
5189 | static s32 brcmf_dongle_mode(struct net_device *ndev, s32 iftype) | ||
5190 | { | ||
5191 | s32 infra = 0; | ||
5192 | s32 err = 0; | ||
5193 | |||
5194 | switch (iftype) { | ||
5195 | case NL80211_IFTYPE_MONITOR: | ||
5196 | case NL80211_IFTYPE_WDS: | ||
5197 | WL_ERR("type (%d) : currently we do not support this mode\n", | ||
5198 | iftype); | ||
5199 | err = -EINVAL; | ||
5200 | return err; | ||
5201 | case NL80211_IFTYPE_ADHOC: | ||
5202 | infra = 0; | ||
5203 | break; | ||
5204 | case NL80211_IFTYPE_STATION: | ||
5205 | infra = 1; | ||
5206 | break; | ||
5207 | case NL80211_IFTYPE_AP: | ||
5208 | infra = 1; | ||
5209 | break; | ||
5210 | default: | ||
5211 | err = -EINVAL; | ||
5212 | WL_ERR("invalid type (%d)\n", iftype); | ||
5213 | return err; | ||
5214 | } | ||
5215 | err = brcmf_exec_dcmd_u32(ndev, BRCMF_C_SET_INFRA, &infra); | ||
5216 | if (err) { | ||
5217 | WL_ERR("WLC_SET_INFRA error (%d)\n", err); | ||
5218 | return err; | ||
5219 | } | ||
5220 | |||
5221 | return 0; | ||
5222 | } | ||
5223 | |||
5224 | static s32 brcmf_dongle_eventmsg(struct net_device *ndev) | 5203 | static s32 brcmf_dongle_eventmsg(struct net_device *ndev) |
5225 | { | 5204 | { |
5226 | /* Room for "event_msgs" + '\0' + bitvec */ | 5205 | /* Room for "event_msgs" + '\0' + bitvec */ |
@@ -5439,7 +5418,8 @@ static s32 brcmf_config_dongle(struct brcmf_cfg80211_info *cfg) | |||
5439 | WL_BEACON_TIMEOUT); | 5418 | WL_BEACON_TIMEOUT); |
5440 | if (err) | 5419 | if (err) |
5441 | goto default_conf_out; | 5420 | goto default_conf_out; |
5442 | err = brcmf_dongle_mode(ndev, wdev->iftype); | 5421 | err = brcmf_cfg80211_change_iface(wdev->wiphy, ndev, wdev->iftype, |
5422 | NULL, NULL); | ||
5443 | if (err && err != -EINPROGRESS) | 5423 | if (err && err != -EINPROGRESS) |
5444 | goto default_conf_out; | 5424 | goto default_conf_out; |
5445 | err = brcmf_dongle_probecap(cfg); | 5425 | err = brcmf_dongle_probecap(cfg); |
diff --git a/drivers/net/wireless/ipw2x00/ipw2200.c b/drivers/net/wireless/ipw2x00/ipw2200.c index 935120fc8c93..768bf612533e 100644 --- a/drivers/net/wireless/ipw2x00/ipw2200.c +++ b/drivers/net/wireless/ipw2x00/ipw2200.c | |||
@@ -10472,7 +10472,7 @@ static void ipw_handle_promiscuous_tx(struct ipw_priv *priv, | |||
10472 | } else | 10472 | } else |
10473 | len = src->len; | 10473 | len = src->len; |
10474 | 10474 | ||
10475 | dst = alloc_skb(len + sizeof(*rt_hdr), GFP_ATOMIC); | 10475 | dst = alloc_skb(len + sizeof(*rt_hdr) + sizeof(u16)*2, GFP_ATOMIC); |
10476 | if (!dst) | 10476 | if (!dst) |
10477 | continue; | 10477 | continue; |
10478 | 10478 | ||
diff --git a/drivers/net/wireless/iwlwifi/dvm/devices.c b/drivers/net/wireless/iwlwifi/dvm/devices.c index 349c205d5f62..da5862064195 100644 --- a/drivers/net/wireless/iwlwifi/dvm/devices.c +++ b/drivers/net/wireless/iwlwifi/dvm/devices.c | |||
@@ -518,7 +518,7 @@ static int iwl6000_hw_channel_switch(struct iwl_priv *priv, | |||
518 | * See iwlagn_mac_channel_switch. | 518 | * See iwlagn_mac_channel_switch. |
519 | */ | 519 | */ |
520 | struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; | 520 | struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; |
521 | struct iwl6000_channel_switch_cmd cmd; | 521 | struct iwl6000_channel_switch_cmd *cmd; |
522 | u32 switch_time_in_usec, ucode_switch_time; | 522 | u32 switch_time_in_usec, ucode_switch_time; |
523 | u16 ch; | 523 | u16 ch; |
524 | u32 tsf_low; | 524 | u32 tsf_low; |
@@ -527,18 +527,25 @@ static int iwl6000_hw_channel_switch(struct iwl_priv *priv, | |||
527 | struct ieee80211_vif *vif = ctx->vif; | 527 | struct ieee80211_vif *vif = ctx->vif; |
528 | struct iwl_host_cmd hcmd = { | 528 | struct iwl_host_cmd hcmd = { |
529 | .id = REPLY_CHANNEL_SWITCH, | 529 | .id = REPLY_CHANNEL_SWITCH, |
530 | .len = { sizeof(cmd), }, | 530 | .len = { sizeof(*cmd), }, |
531 | .flags = CMD_SYNC, | 531 | .flags = CMD_SYNC, |
532 | .data = { &cmd, }, | 532 | .dataflags[0] = IWL_HCMD_DFL_NOCOPY, |
533 | }; | 533 | }; |
534 | int err; | ||
534 | 535 | ||
535 | cmd.band = priv->band == IEEE80211_BAND_2GHZ; | 536 | cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); |
537 | if (!cmd) | ||
538 | return -ENOMEM; | ||
539 | |||
540 | hcmd.data[0] = cmd; | ||
541 | |||
542 | cmd->band = priv->band == IEEE80211_BAND_2GHZ; | ||
536 | ch = ch_switch->channel->hw_value; | 543 | ch = ch_switch->channel->hw_value; |
537 | IWL_DEBUG_11H(priv, "channel switch from %u to %u\n", | 544 | IWL_DEBUG_11H(priv, "channel switch from %u to %u\n", |
538 | ctx->active.channel, ch); | 545 | ctx->active.channel, ch); |
539 | cmd.channel = cpu_to_le16(ch); | 546 | cmd->channel = cpu_to_le16(ch); |
540 | cmd.rxon_flags = ctx->staging.flags; | 547 | cmd->rxon_flags = ctx->staging.flags; |
541 | cmd.rxon_filter_flags = ctx->staging.filter_flags; | 548 | cmd->rxon_filter_flags = ctx->staging.filter_flags; |
542 | switch_count = ch_switch->count; | 549 | switch_count = ch_switch->count; |
543 | tsf_low = ch_switch->timestamp & 0x0ffffffff; | 550 | tsf_low = ch_switch->timestamp & 0x0ffffffff; |
544 | /* | 551 | /* |
@@ -554,23 +561,25 @@ static int iwl6000_hw_channel_switch(struct iwl_priv *priv, | |||
554 | switch_count = 0; | 561 | switch_count = 0; |
555 | } | 562 | } |
556 | if (switch_count <= 1) | 563 | if (switch_count <= 1) |
557 | cmd.switch_time = cpu_to_le32(priv->ucode_beacon_time); | 564 | cmd->switch_time = cpu_to_le32(priv->ucode_beacon_time); |
558 | else { | 565 | else { |
559 | switch_time_in_usec = | 566 | switch_time_in_usec = |
560 | vif->bss_conf.beacon_int * switch_count * TIME_UNIT; | 567 | vif->bss_conf.beacon_int * switch_count * TIME_UNIT; |
561 | ucode_switch_time = iwl_usecs_to_beacons(priv, | 568 | ucode_switch_time = iwl_usecs_to_beacons(priv, |
562 | switch_time_in_usec, | 569 | switch_time_in_usec, |
563 | beacon_interval); | 570 | beacon_interval); |
564 | cmd.switch_time = iwl_add_beacon_time(priv, | 571 | cmd->switch_time = iwl_add_beacon_time(priv, |
565 | priv->ucode_beacon_time, | 572 | priv->ucode_beacon_time, |
566 | ucode_switch_time, | 573 | ucode_switch_time, |
567 | beacon_interval); | 574 | beacon_interval); |
568 | } | 575 | } |
569 | IWL_DEBUG_11H(priv, "uCode time for the switch is 0x%x\n", | 576 | IWL_DEBUG_11H(priv, "uCode time for the switch is 0x%x\n", |
570 | cmd.switch_time); | 577 | cmd->switch_time); |
571 | cmd.expect_beacon = ch_switch->channel->flags & IEEE80211_CHAN_RADAR; | 578 | cmd->expect_beacon = ch_switch->channel->flags & IEEE80211_CHAN_RADAR; |
572 | 579 | ||
573 | return iwl_dvm_send_cmd(priv, &hcmd); | 580 | err = iwl_dvm_send_cmd(priv, &hcmd); |
581 | kfree(cmd); | ||
582 | return err; | ||
574 | } | 583 | } |
575 | 584 | ||
576 | struct iwl_lib_ops iwl6000_lib = { | 585 | struct iwl_lib_ops iwl6000_lib = { |
diff --git a/drivers/net/wireless/mwifiex/cfg80211.c b/drivers/net/wireless/mwifiex/cfg80211.c index 0679458a1bac..780d3e168297 100644 --- a/drivers/net/wireless/mwifiex/cfg80211.c +++ b/drivers/net/wireless/mwifiex/cfg80211.c | |||
@@ -1825,8 +1825,6 @@ mwifiex_cfg80211_scan(struct wiphy *wiphy, | |||
1825 | return -EBUSY; | 1825 | return -EBUSY; |
1826 | } | 1826 | } |
1827 | 1827 | ||
1828 | priv->scan_request = request; | ||
1829 | |||
1830 | priv->user_scan_cfg = kzalloc(sizeof(struct mwifiex_user_scan_cfg), | 1828 | priv->user_scan_cfg = kzalloc(sizeof(struct mwifiex_user_scan_cfg), |
1831 | GFP_KERNEL); | 1829 | GFP_KERNEL); |
1832 | if (!priv->user_scan_cfg) { | 1830 | if (!priv->user_scan_cfg) { |
@@ -1834,6 +1832,8 @@ mwifiex_cfg80211_scan(struct wiphy *wiphy, | |||
1834 | return -ENOMEM; | 1832 | return -ENOMEM; |
1835 | } | 1833 | } |
1836 | 1834 | ||
1835 | priv->scan_request = request; | ||
1836 | |||
1837 | priv->user_scan_cfg->num_ssids = request->n_ssids; | 1837 | priv->user_scan_cfg->num_ssids = request->n_ssids; |
1838 | priv->user_scan_cfg->ssid_list = request->ssids; | 1838 | priv->user_scan_cfg->ssid_list = request->ssids; |
1839 | 1839 | ||
@@ -1870,6 +1870,9 @@ mwifiex_cfg80211_scan(struct wiphy *wiphy, | |||
1870 | ret = mwifiex_scan_networks(priv, priv->user_scan_cfg); | 1870 | ret = mwifiex_scan_networks(priv, priv->user_scan_cfg); |
1871 | if (ret) { | 1871 | if (ret) { |
1872 | dev_err(priv->adapter->dev, "scan failed: %d\n", ret); | 1872 | dev_err(priv->adapter->dev, "scan failed: %d\n", ret); |
1873 | priv->scan_request = NULL; | ||
1874 | kfree(priv->user_scan_cfg); | ||
1875 | priv->user_scan_cfg = NULL; | ||
1873 | return ret; | 1876 | return ret; |
1874 | } | 1877 | } |
1875 | 1878 | ||
diff --git a/drivers/net/wireless/mwifiex/scan.c b/drivers/net/wireless/mwifiex/scan.c index 00b658d3b6ec..9171aaedbccd 100644 --- a/drivers/net/wireless/mwifiex/scan.c +++ b/drivers/net/wireless/mwifiex/scan.c | |||
@@ -1843,21 +1843,18 @@ static int mwifiex_scan_specific_ssid(struct mwifiex_private *priv, | |||
1843 | struct cfg80211_ssid *req_ssid) | 1843 | struct cfg80211_ssid *req_ssid) |
1844 | { | 1844 | { |
1845 | struct mwifiex_adapter *adapter = priv->adapter; | 1845 | struct mwifiex_adapter *adapter = priv->adapter; |
1846 | int ret = 0; | 1846 | int ret; |
1847 | struct mwifiex_user_scan_cfg *scan_cfg; | 1847 | struct mwifiex_user_scan_cfg *scan_cfg; |
1848 | 1848 | ||
1849 | if (!req_ssid) | ||
1850 | return -1; | ||
1851 | |||
1852 | if (adapter->scan_processing) { | 1849 | if (adapter->scan_processing) { |
1853 | dev_dbg(adapter->dev, "cmd: Scan already in process...\n"); | 1850 | dev_err(adapter->dev, "cmd: Scan already in process...\n"); |
1854 | return ret; | 1851 | return -EBUSY; |
1855 | } | 1852 | } |
1856 | 1853 | ||
1857 | if (priv->scan_block) { | 1854 | if (priv->scan_block) { |
1858 | dev_dbg(adapter->dev, | 1855 | dev_err(adapter->dev, |
1859 | "cmd: Scan is blocked during association...\n"); | 1856 | "cmd: Scan is blocked during association...\n"); |
1860 | return ret; | 1857 | return -EBUSY; |
1861 | } | 1858 | } |
1862 | 1859 | ||
1863 | scan_cfg = kzalloc(sizeof(struct mwifiex_user_scan_cfg), GFP_KERNEL); | 1860 | scan_cfg = kzalloc(sizeof(struct mwifiex_user_scan_cfg), GFP_KERNEL); |
diff --git a/drivers/net/wireless/rt2x00/rt2500usb.c b/drivers/net/wireless/rt2x00/rt2500usb.c index a12e84f892be..6b2e1e431dd2 100644 --- a/drivers/net/wireless/rt2x00/rt2500usb.c +++ b/drivers/net/wireless/rt2x00/rt2500usb.c | |||
@@ -1988,6 +1988,7 @@ static struct usb_driver rt2500usb_driver = { | |||
1988 | .disconnect = rt2x00usb_disconnect, | 1988 | .disconnect = rt2x00usb_disconnect, |
1989 | .suspend = rt2x00usb_suspend, | 1989 | .suspend = rt2x00usb_suspend, |
1990 | .resume = rt2x00usb_resume, | 1990 | .resume = rt2x00usb_resume, |
1991 | .reset_resume = rt2x00usb_resume, | ||
1991 | .disable_hub_initiated_lpm = 1, | 1992 | .disable_hub_initiated_lpm = 1, |
1992 | }; | 1993 | }; |
1993 | 1994 | ||
diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c index c9e9370eb789..3b8fb5a603f2 100644 --- a/drivers/net/wireless/rt2x00/rt2800usb.c +++ b/drivers/net/wireless/rt2x00/rt2800usb.c | |||
@@ -1282,6 +1282,7 @@ static struct usb_driver rt2800usb_driver = { | |||
1282 | .disconnect = rt2x00usb_disconnect, | 1282 | .disconnect = rt2x00usb_disconnect, |
1283 | .suspend = rt2x00usb_suspend, | 1283 | .suspend = rt2x00usb_suspend, |
1284 | .resume = rt2x00usb_resume, | 1284 | .resume = rt2x00usb_resume, |
1285 | .reset_resume = rt2x00usb_resume, | ||
1285 | .disable_hub_initiated_lpm = 1, | 1286 | .disable_hub_initiated_lpm = 1, |
1286 | }; | 1287 | }; |
1287 | 1288 | ||
diff --git a/drivers/net/wireless/rt2x00/rt73usb.c b/drivers/net/wireless/rt2x00/rt73usb.c index e5eb43b3eee7..24eec66e9fd2 100644 --- a/drivers/net/wireless/rt2x00/rt73usb.c +++ b/drivers/net/wireless/rt2x00/rt73usb.c | |||
@@ -2535,6 +2535,7 @@ static struct usb_driver rt73usb_driver = { | |||
2535 | .disconnect = rt2x00usb_disconnect, | 2535 | .disconnect = rt2x00usb_disconnect, |
2536 | .suspend = rt2x00usb_suspend, | 2536 | .suspend = rt2x00usb_suspend, |
2537 | .resume = rt2x00usb_resume, | 2537 | .resume = rt2x00usb_resume, |
2538 | .reset_resume = rt2x00usb_resume, | ||
2538 | .disable_hub_initiated_lpm = 1, | 2539 | .disable_hub_initiated_lpm = 1, |
2539 | }; | 2540 | }; |
2540 | 2541 | ||
diff --git a/drivers/net/wireless/rtlwifi/usb.c b/drivers/net/wireless/rtlwifi/usb.c index 030beb45d8b0..e3ea4b346889 100644 --- a/drivers/net/wireless/rtlwifi/usb.c +++ b/drivers/net/wireless/rtlwifi/usb.c | |||
@@ -673,7 +673,7 @@ static int rtl_usb_start(struct ieee80211_hw *hw) | |||
673 | set_hal_start(rtlhal); | 673 | set_hal_start(rtlhal); |
674 | 674 | ||
675 | /* Start bulk IN */ | 675 | /* Start bulk IN */ |
676 | _rtl_usb_receive(hw); | 676 | err = _rtl_usb_receive(hw); |
677 | } | 677 | } |
678 | 678 | ||
679 | return err; | 679 | return err; |
diff --git a/drivers/pcmcia/at91_cf.c b/drivers/pcmcia/at91_cf.c index 9694c1e783a5..01463c781847 100644 --- a/drivers/pcmcia/at91_cf.c +++ b/drivers/pcmcia/at91_cf.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <linux/interrupt.h> | 17 | #include <linux/interrupt.h> |
18 | #include <linux/slab.h> | 18 | #include <linux/slab.h> |
19 | #include <linux/gpio.h> | 19 | #include <linux/gpio.h> |
20 | #include <linux/platform_data/atmel.h> | ||
20 | 21 | ||
21 | #include <pcmcia/ss.h> | 22 | #include <pcmcia/ss.h> |
22 | 23 | ||
@@ -24,7 +25,6 @@ | |||
24 | #include <asm/io.h> | 25 | #include <asm/io.h> |
25 | #include <asm/sizes.h> | 26 | #include <asm/sizes.h> |
26 | 27 | ||
27 | #include <mach/board.h> | ||
28 | #include <mach/at91rm9200_mc.h> | 28 | #include <mach/at91rm9200_mc.h> |
29 | #include <mach/at91_ramc.h> | 29 | #include <mach/at91_ramc.h> |
30 | 30 | ||
diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c index 0f1ec9e8ff14..2e39c04fc16b 100644 --- a/drivers/pinctrl/core.c +++ b/drivers/pinctrl/core.c | |||
@@ -1061,8 +1061,10 @@ static int pinctrl_groups_show(struct seq_file *s, void *what) | |||
1061 | seq_printf(s, "group: %s\n", gname); | 1061 | seq_printf(s, "group: %s\n", gname); |
1062 | for (i = 0; i < num_pins; i++) { | 1062 | for (i = 0; i < num_pins; i++) { |
1063 | pname = pin_get_name(pctldev, pins[i]); | 1063 | pname = pin_get_name(pctldev, pins[i]); |
1064 | if (WARN_ON(!pname)) | 1064 | if (WARN_ON(!pname)) { |
1065 | mutex_unlock(&pinctrl_mutex); | ||
1065 | return -EINVAL; | 1066 | return -EINVAL; |
1067 | } | ||
1066 | seq_printf(s, "pin %d (%s)\n", pins[i], pname); | 1068 | seq_printf(s, "pin %d (%s)\n", pins[i], pname); |
1067 | } | 1069 | } |
1068 | seq_puts(s, "\n"); | 1070 | seq_puts(s, "\n"); |
diff --git a/drivers/pinctrl/pinconf.c b/drivers/pinctrl/pinconf.c index 43f474cdc110..baee2cc46a17 100644 --- a/drivers/pinctrl/pinconf.c +++ b/drivers/pinctrl/pinconf.c | |||
@@ -537,8 +537,6 @@ static int pinconf_groups_show(struct seq_file *s, void *what) | |||
537 | seq_puts(s, "Pin config settings per pin group\n"); | 537 | seq_puts(s, "Pin config settings per pin group\n"); |
538 | seq_puts(s, "Format: group (name): configs\n"); | 538 | seq_puts(s, "Format: group (name): configs\n"); |
539 | 539 | ||
540 | mutex_lock(&pinctrl_mutex); | ||
541 | |||
542 | while (selector < ngroups) { | 540 | while (selector < ngroups) { |
543 | const char *gname = pctlops->get_group_name(pctldev, selector); | 541 | const char *gname = pctlops->get_group_name(pctldev, selector); |
544 | 542 | ||
@@ -549,8 +547,6 @@ static int pinconf_groups_show(struct seq_file *s, void *what) | |||
549 | selector++; | 547 | selector++; |
550 | } | 548 | } |
551 | 549 | ||
552 | mutex_unlock(&pinctrl_mutex); | ||
553 | |||
554 | return 0; | 550 | return 0; |
555 | } | 551 | } |
556 | 552 | ||
diff --git a/drivers/pinctrl/pinctrl-nomadik.c b/drivers/pinctrl/pinctrl-nomadik.c index 01aea1c3b5fa..cf82d9ce4dee 100644 --- a/drivers/pinctrl/pinctrl-nomadik.c +++ b/drivers/pinctrl/pinctrl-nomadik.c | |||
@@ -1056,7 +1056,7 @@ static int nmk_gpio_to_irq(struct gpio_chip *chip, unsigned offset) | |||
1056 | struct nmk_gpio_chip *nmk_chip = | 1056 | struct nmk_gpio_chip *nmk_chip = |
1057 | container_of(chip, struct nmk_gpio_chip, chip); | 1057 | container_of(chip, struct nmk_gpio_chip, chip); |
1058 | 1058 | ||
1059 | return irq_find_mapping(nmk_chip->domain, offset); | 1059 | return irq_create_mapping(nmk_chip->domain, offset); |
1060 | } | 1060 | } |
1061 | 1061 | ||
1062 | #ifdef CONFIG_DEBUG_FS | 1062 | #ifdef CONFIG_DEBUG_FS |
@@ -1281,7 +1281,7 @@ static int __devinit nmk_gpio_probe(struct platform_device *dev) | |||
1281 | struct clk *clk; | 1281 | struct clk *clk; |
1282 | int secondary_irq; | 1282 | int secondary_irq; |
1283 | void __iomem *base; | 1283 | void __iomem *base; |
1284 | int irq_start = -1; | 1284 | int irq_start = 0; |
1285 | int irq; | 1285 | int irq; |
1286 | int ret; | 1286 | int ret; |
1287 | 1287 | ||
@@ -1387,7 +1387,7 @@ static int __devinit nmk_gpio_probe(struct platform_device *dev) | |||
1387 | 1387 | ||
1388 | if (!np) | 1388 | if (!np) |
1389 | irq_start = NOMADIK_GPIO_TO_IRQ(pdata->first_gpio); | 1389 | irq_start = NOMADIK_GPIO_TO_IRQ(pdata->first_gpio); |
1390 | nmk_chip->domain = irq_domain_add_simple(NULL, | 1390 | nmk_chip->domain = irq_domain_add_simple(np, |
1391 | NMK_GPIO_PER_CHIP, irq_start, | 1391 | NMK_GPIO_PER_CHIP, irq_start, |
1392 | &nmk_gpio_irq_simple_ops, nmk_chip); | 1392 | &nmk_gpio_irq_simple_ops, nmk_chip); |
1393 | if (!nmk_chip->domain) { | 1393 | if (!nmk_chip->domain) { |
diff --git a/drivers/pinctrl/pinctrl-tegra.c b/drivers/pinctrl/pinctrl-tegra.c index 729b686c3ad2..7da0b371fd65 100644 --- a/drivers/pinctrl/pinctrl-tegra.c +++ b/drivers/pinctrl/pinctrl-tegra.c | |||
@@ -464,7 +464,7 @@ static int tegra_pinconf_reg(struct tegra_pmx *pmx, | |||
464 | *bank = g->drv_bank; | 464 | *bank = g->drv_bank; |
465 | *reg = g->drv_reg; | 465 | *reg = g->drv_reg; |
466 | *bit = g->lpmd_bit; | 466 | *bit = g->lpmd_bit; |
467 | *width = 1; | 467 | *width = 2; |
468 | break; | 468 | break; |
469 | case TEGRA_PINCONF_PARAM_DRIVE_DOWN_STRENGTH: | 469 | case TEGRA_PINCONF_PARAM_DRIVE_DOWN_STRENGTH: |
470 | *bank = g->drv_bank; | 470 | *bank = g->drv_bank; |
diff --git a/drivers/pinctrl/pinctrl-tegra30.c b/drivers/pinctrl/pinctrl-tegra30.c index 0386fdf0da16..7894f14c7059 100644 --- a/drivers/pinctrl/pinctrl-tegra30.c +++ b/drivers/pinctrl/pinctrl-tegra30.c | |||
@@ -3345,10 +3345,10 @@ static const struct tegra_function tegra30_functions[] = { | |||
3345 | FUNCTION(vi_alt3), | 3345 | FUNCTION(vi_alt3), |
3346 | }; | 3346 | }; |
3347 | 3347 | ||
3348 | #define MUXCTL_REG_A 0x3000 | 3348 | #define DRV_PINGROUP_REG_A 0x868 /* bank 0 */ |
3349 | #define PINGROUP_REG_A 0x868 | 3349 | #define PINGROUP_REG_A 0x3000 /* bank 1 */ |
3350 | 3350 | ||
3351 | #define PINGROUP_REG_Y(r) ((r) - MUXCTL_REG_A) | 3351 | #define PINGROUP_REG_Y(r) ((r) - PINGROUP_REG_A) |
3352 | #define PINGROUP_REG_N(r) -1 | 3352 | #define PINGROUP_REG_N(r) -1 |
3353 | 3353 | ||
3354 | #define PINGROUP(pg_name, f0, f1, f2, f3, f_safe, r, od, ior) \ | 3354 | #define PINGROUP(pg_name, f0, f1, f2, f3, f_safe, r, od, ior) \ |
@@ -3364,25 +3364,25 @@ static const struct tegra_function tegra30_functions[] = { | |||
3364 | }, \ | 3364 | }, \ |
3365 | .func_safe = TEGRA_MUX_ ## f_safe, \ | 3365 | .func_safe = TEGRA_MUX_ ## f_safe, \ |
3366 | .mux_reg = PINGROUP_REG_Y(r), \ | 3366 | .mux_reg = PINGROUP_REG_Y(r), \ |
3367 | .mux_bank = 0, \ | 3367 | .mux_bank = 1, \ |
3368 | .mux_bit = 0, \ | 3368 | .mux_bit = 0, \ |
3369 | .pupd_reg = PINGROUP_REG_Y(r), \ | 3369 | .pupd_reg = PINGROUP_REG_Y(r), \ |
3370 | .pupd_bank = 0, \ | 3370 | .pupd_bank = 1, \ |
3371 | .pupd_bit = 2, \ | 3371 | .pupd_bit = 2, \ |
3372 | .tri_reg = PINGROUP_REG_Y(r), \ | 3372 | .tri_reg = PINGROUP_REG_Y(r), \ |
3373 | .tri_bank = 0, \ | 3373 | .tri_bank = 1, \ |
3374 | .tri_bit = 4, \ | 3374 | .tri_bit = 4, \ |
3375 | .einput_reg = PINGROUP_REG_Y(r), \ | 3375 | .einput_reg = PINGROUP_REG_Y(r), \ |
3376 | .einput_bank = 0, \ | 3376 | .einput_bank = 1, \ |
3377 | .einput_bit = 5, \ | 3377 | .einput_bit = 5, \ |
3378 | .odrain_reg = PINGROUP_REG_##od(r), \ | 3378 | .odrain_reg = PINGROUP_REG_##od(r), \ |
3379 | .odrain_bank = 0, \ | 3379 | .odrain_bank = 1, \ |
3380 | .odrain_bit = 6, \ | 3380 | .odrain_bit = 6, \ |
3381 | .lock_reg = PINGROUP_REG_Y(r), \ | 3381 | .lock_reg = PINGROUP_REG_Y(r), \ |
3382 | .lock_bank = 0, \ | 3382 | .lock_bank = 1, \ |
3383 | .lock_bit = 7, \ | 3383 | .lock_bit = 7, \ |
3384 | .ioreset_reg = PINGROUP_REG_##ior(r), \ | 3384 | .ioreset_reg = PINGROUP_REG_##ior(r), \ |
3385 | .ioreset_bank = 0, \ | 3385 | .ioreset_bank = 1, \ |
3386 | .ioreset_bit = 8, \ | 3386 | .ioreset_bit = 8, \ |
3387 | .drv_reg = -1, \ | 3387 | .drv_reg = -1, \ |
3388 | } | 3388 | } |
@@ -3401,8 +3401,8 @@ static const struct tegra_function tegra30_functions[] = { | |||
3401 | .odrain_reg = -1, \ | 3401 | .odrain_reg = -1, \ |
3402 | .lock_reg = -1, \ | 3402 | .lock_reg = -1, \ |
3403 | .ioreset_reg = -1, \ | 3403 | .ioreset_reg = -1, \ |
3404 | .drv_reg = ((r) - PINGROUP_REG_A), \ | 3404 | .drv_reg = ((r) - DRV_PINGROUP_REG_A), \ |
3405 | .drv_bank = 1, \ | 3405 | .drv_bank = 0, \ |
3406 | .hsm_bit = hsm_b, \ | 3406 | .hsm_bit = hsm_b, \ |
3407 | .schmitt_bit = schmitt_b, \ | 3407 | .schmitt_bit = schmitt_b, \ |
3408 | .lpmd_bit = lpmd_b, \ | 3408 | .lpmd_bit = lpmd_b, \ |
diff --git a/drivers/rtc/rtc-at91rm9200.c b/drivers/rtc/rtc-at91rm9200.c index fca9790c7de7..b6469e2cae89 100644 --- a/drivers/rtc/rtc-at91rm9200.c +++ b/drivers/rtc/rtc-at91rm9200.c | |||
@@ -31,7 +31,7 @@ | |||
31 | 31 | ||
32 | #include <asm/uaccess.h> | 32 | #include <asm/uaccess.h> |
33 | 33 | ||
34 | #include <mach/at91_rtc.h> | 34 | #include "rtc-at91rm9200.h" |
35 | 35 | ||
36 | #define at91_rtc_read(field) \ | 36 | #define at91_rtc_read(field) \ |
37 | __raw_readl(at91_rtc_regs + field) | 37 | __raw_readl(at91_rtc_regs + field) |
diff --git a/drivers/rtc/rtc-at91rm9200.h b/drivers/rtc/rtc-at91rm9200.h new file mode 100644 index 000000000000..da1945e5f714 --- /dev/null +++ b/drivers/rtc/rtc-at91rm9200.h | |||
@@ -0,0 +1,75 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-at91/include/mach/at91_rtc.h | ||
3 | * | ||
4 | * Copyright (C) 2005 Ivan Kokshaysky | ||
5 | * Copyright (C) SAN People | ||
6 | * | ||
7 | * Real Time Clock (RTC) - System peripheral registers. | ||
8 | * Based on AT91RM9200 datasheet revision E. | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or modify | ||
11 | * it under the terms of the GNU General Public License as published by | ||
12 | * the Free Software Foundation; either version 2 of the License, or | ||
13 | * (at your option) any later version. | ||
14 | */ | ||
15 | |||
16 | #ifndef AT91_RTC_H | ||
17 | #define AT91_RTC_H | ||
18 | |||
19 | #define AT91_RTC_CR 0x00 /* Control Register */ | ||
20 | #define AT91_RTC_UPDTIM (1 << 0) /* Update Request Time Register */ | ||
21 | #define AT91_RTC_UPDCAL (1 << 1) /* Update Request Calendar Register */ | ||
22 | #define AT91_RTC_TIMEVSEL (3 << 8) /* Time Event Selection */ | ||
23 | #define AT91_RTC_TIMEVSEL_MINUTE (0 << 8) | ||
24 | #define AT91_RTC_TIMEVSEL_HOUR (1 << 8) | ||
25 | #define AT91_RTC_TIMEVSEL_DAY24 (2 << 8) | ||
26 | #define AT91_RTC_TIMEVSEL_DAY12 (3 << 8) | ||
27 | #define AT91_RTC_CALEVSEL (3 << 16) /* Calendar Event Selection */ | ||
28 | #define AT91_RTC_CALEVSEL_WEEK (0 << 16) | ||
29 | #define AT91_RTC_CALEVSEL_MONTH (1 << 16) | ||
30 | #define AT91_RTC_CALEVSEL_YEAR (2 << 16) | ||
31 | |||
32 | #define AT91_RTC_MR 0x04 /* Mode Register */ | ||
33 | #define AT91_RTC_HRMOD (1 << 0) /* 12/24 Hour Mode */ | ||
34 | |||
35 | #define AT91_RTC_TIMR 0x08 /* Time Register */ | ||
36 | #define AT91_RTC_SEC (0x7f << 0) /* Current Second */ | ||
37 | #define AT91_RTC_MIN (0x7f << 8) /* Current Minute */ | ||
38 | #define AT91_RTC_HOUR (0x3f << 16) /* Current Hour */ | ||
39 | #define AT91_RTC_AMPM (1 << 22) /* Ante Meridiem Post Meridiem Indicator */ | ||
40 | |||
41 | #define AT91_RTC_CALR 0x0c /* Calendar Register */ | ||
42 | #define AT91_RTC_CENT (0x7f << 0) /* Current Century */ | ||
43 | #define AT91_RTC_YEAR (0xff << 8) /* Current Year */ | ||
44 | #define AT91_RTC_MONTH (0x1f << 16) /* Current Month */ | ||
45 | #define AT91_RTC_DAY (7 << 21) /* Current Day */ | ||
46 | #define AT91_RTC_DATE (0x3f << 24) /* Current Date */ | ||
47 | |||
48 | #define AT91_RTC_TIMALR 0x10 /* Time Alarm Register */ | ||
49 | #define AT91_RTC_SECEN (1 << 7) /* Second Alarm Enable */ | ||
50 | #define AT91_RTC_MINEN (1 << 15) /* Minute Alarm Enable */ | ||
51 | #define AT91_RTC_HOUREN (1 << 23) /* Hour Alarm Enable */ | ||
52 | |||
53 | #define AT91_RTC_CALALR 0x14 /* Calendar Alarm Register */ | ||
54 | #define AT91_RTC_MTHEN (1 << 23) /* Month Alarm Enable */ | ||
55 | #define AT91_RTC_DATEEN (1 << 31) /* Date Alarm Enable */ | ||
56 | |||
57 | #define AT91_RTC_SR 0x18 /* Status Register */ | ||
58 | #define AT91_RTC_ACKUPD (1 << 0) /* Acknowledge for Update */ | ||
59 | #define AT91_RTC_ALARM (1 << 1) /* Alarm Flag */ | ||
60 | #define AT91_RTC_SECEV (1 << 2) /* Second Event */ | ||
61 | #define AT91_RTC_TIMEV (1 << 3) /* Time Event */ | ||
62 | #define AT91_RTC_CALEV (1 << 4) /* Calendar Event */ | ||
63 | |||
64 | #define AT91_RTC_SCCR 0x1c /* Status Clear Command Register */ | ||
65 | #define AT91_RTC_IER 0x20 /* Interrupt Enable Register */ | ||
66 | #define AT91_RTC_IDR 0x24 /* Interrupt Disable Register */ | ||
67 | #define AT91_RTC_IMR 0x28 /* Interrupt Mask Register */ | ||
68 | |||
69 | #define AT91_RTC_VER 0x2c /* Valid Entry Register */ | ||
70 | #define AT91_RTC_NVTIM (1 << 0) /* Non valid Time */ | ||
71 | #define AT91_RTC_NVCAL (1 << 1) /* Non valid Calendar */ | ||
72 | #define AT91_RTC_NVTIMALR (1 << 2) /* Non valid Time Alarm */ | ||
73 | #define AT91_RTC_NVCALALR (1 << 3) /* Non valid Calendar Alarm */ | ||
74 | |||
75 | #endif | ||
diff --git a/drivers/rtc/rtc-at91sam9.c b/drivers/rtc/rtc-at91sam9.c index 2dfe7a2fb998..e981798e9a9b 100644 --- a/drivers/rtc/rtc-at91sam9.c +++ b/drivers/rtc/rtc-at91sam9.c | |||
@@ -19,8 +19,8 @@ | |||
19 | #include <linux/interrupt.h> | 19 | #include <linux/interrupt.h> |
20 | #include <linux/ioctl.h> | 20 | #include <linux/ioctl.h> |
21 | #include <linux/slab.h> | 21 | #include <linux/slab.h> |
22 | #include <linux/platform_data/atmel.h> | ||
22 | 23 | ||
23 | #include <mach/board.h> | ||
24 | #include <mach/at91_rtt.h> | 24 | #include <mach/at91_rtt.h> |
25 | #include <mach/cpu.h> | 25 | #include <mach/cpu.h> |
26 | 26 | ||
diff --git a/drivers/rtc/rtc-imxdi.c b/drivers/rtc/rtc-imxdi.c index 891cd6c61d0a..4eed51044c5d 100644 --- a/drivers/rtc/rtc-imxdi.c +++ b/drivers/rtc/rtc-imxdi.c | |||
@@ -392,6 +392,8 @@ static int dryice_rtc_probe(struct platform_device *pdev) | |||
392 | if (imxdi->ioaddr == NULL) | 392 | if (imxdi->ioaddr == NULL) |
393 | return -ENOMEM; | 393 | return -ENOMEM; |
394 | 394 | ||
395 | spin_lock_init(&imxdi->irq_lock); | ||
396 | |||
395 | imxdi->irq = platform_get_irq(pdev, 0); | 397 | imxdi->irq = platform_get_irq(pdev, 0); |
396 | if (imxdi->irq < 0) | 398 | if (imxdi->irq < 0) |
397 | return imxdi->irq; | 399 | return imxdi->irq; |
diff --git a/drivers/s390/cio/css.c b/drivers/s390/cio/css.c index b4d572f65f07..fd00afd8b850 100644 --- a/drivers/s390/cio/css.c +++ b/drivers/s390/cio/css.c | |||
@@ -377,7 +377,11 @@ static int css_evaluate_new_subchannel(struct subchannel_id schid, int slow) | |||
377 | /* Will be done on the slow path. */ | 377 | /* Will be done on the slow path. */ |
378 | return -EAGAIN; | 378 | return -EAGAIN; |
379 | } | 379 | } |
380 | if (stsch_err(schid, &schib) || !css_sch_is_valid(&schib)) { | 380 | if (stsch_err(schid, &schib)) { |
381 | /* Subchannel is not provided. */ | ||
382 | return -ENXIO; | ||
383 | } | ||
384 | if (!css_sch_is_valid(&schib)) { | ||
381 | /* Unusable - ignore. */ | 385 | /* Unusable - ignore. */ |
382 | return 0; | 386 | return 0; |
383 | } | 387 | } |
@@ -536,6 +540,7 @@ static int slow_eval_unknown_fn(struct subchannel_id schid, void *data) | |||
536 | case -ENOMEM: | 540 | case -ENOMEM: |
537 | case -EIO: | 541 | case -EIO: |
538 | /* These should abort looping */ | 542 | /* These should abort looping */ |
543 | idset_sch_del_subseq(slow_subchannel_set, schid); | ||
539 | break; | 544 | break; |
540 | default: | 545 | default: |
541 | rc = 0; | 546 | rc = 0; |
diff --git a/drivers/s390/cio/idset.c b/drivers/s390/cio/idset.c index e6d5f8c49524..199bc6791177 100644 --- a/drivers/s390/cio/idset.c +++ b/drivers/s390/cio/idset.c | |||
@@ -1,9 +1,10 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright IBM Corp. 2007 | 2 | * Copyright IBM Corp. 2007, 2012 |
3 | * Author(s): Peter Oberparleiter <peter.oberparleiter@de.ibm.com> | 3 | * Author(s): Peter Oberparleiter <peter.oberparleiter@de.ibm.com> |
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include <linux/vmalloc.h> | 6 | #include <linux/vmalloc.h> |
7 | #include <linux/bitmap.h> | ||
7 | #include <linux/bitops.h> | 8 | #include <linux/bitops.h> |
8 | #include "idset.h" | 9 | #include "idset.h" |
9 | #include "css.h" | 10 | #include "css.h" |
@@ -89,6 +90,14 @@ void idset_sch_del(struct idset *set, struct subchannel_id schid) | |||
89 | idset_del(set, schid.ssid, schid.sch_no); | 90 | idset_del(set, schid.ssid, schid.sch_no); |
90 | } | 91 | } |
91 | 92 | ||
93 | /* Clear ids starting from @schid up to end of subchannel set. */ | ||
94 | void idset_sch_del_subseq(struct idset *set, struct subchannel_id schid) | ||
95 | { | ||
96 | int pos = schid.ssid * set->num_id + schid.sch_no; | ||
97 | |||
98 | bitmap_clear(set->bitmap, pos, set->num_id - schid.sch_no); | ||
99 | } | ||
100 | |||
92 | int idset_sch_contains(struct idset *set, struct subchannel_id schid) | 101 | int idset_sch_contains(struct idset *set, struct subchannel_id schid) |
93 | { | 102 | { |
94 | return idset_contains(set, schid.ssid, schid.sch_no); | 103 | return idset_contains(set, schid.ssid, schid.sch_no); |
@@ -111,20 +120,13 @@ int idset_sch_get_first(struct idset *set, struct subchannel_id *schid) | |||
111 | 120 | ||
112 | int idset_is_empty(struct idset *set) | 121 | int idset_is_empty(struct idset *set) |
113 | { | 122 | { |
114 | int bitnum; | 123 | return bitmap_empty(set->bitmap, set->num_ssid * set->num_id); |
115 | |||
116 | bitnum = find_first_bit(set->bitmap, set->num_ssid * set->num_id); | ||
117 | if (bitnum >= set->num_ssid * set->num_id) | ||
118 | return 1; | ||
119 | return 0; | ||
120 | } | 124 | } |
121 | 125 | ||
122 | void idset_add_set(struct idset *to, struct idset *from) | 126 | void idset_add_set(struct idset *to, struct idset *from) |
123 | { | 127 | { |
124 | unsigned long i, len; | 128 | int len = min(__BITOPS_WORDS(to->num_ssid * to->num_id), |
129 | __BITOPS_WORDS(from->num_ssid * from->num_id)); | ||
125 | 130 | ||
126 | len = min(__BITOPS_WORDS(to->num_ssid * to->num_id), | 131 | bitmap_or(to->bitmap, to->bitmap, from->bitmap, len); |
127 | __BITOPS_WORDS(from->num_ssid * from->num_id)); | ||
128 | for (i = 0; i < len ; i++) | ||
129 | to->bitmap[i] |= from->bitmap[i]; | ||
130 | } | 132 | } |
diff --git a/drivers/s390/cio/idset.h b/drivers/s390/cio/idset.h index 3d943f03591e..06d3bc01bb09 100644 --- a/drivers/s390/cio/idset.h +++ b/drivers/s390/cio/idset.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright IBM Corp. 2007 | 2 | * Copyright IBM Corp. 2007, 2012 |
3 | * Author(s): Peter Oberparleiter <peter.oberparleiter@de.ibm.com> | 3 | * Author(s): Peter Oberparleiter <peter.oberparleiter@de.ibm.com> |
4 | */ | 4 | */ |
5 | 5 | ||
@@ -17,6 +17,7 @@ void idset_fill(struct idset *set); | |||
17 | struct idset *idset_sch_new(void); | 17 | struct idset *idset_sch_new(void); |
18 | void idset_sch_add(struct idset *set, struct subchannel_id id); | 18 | void idset_sch_add(struct idset *set, struct subchannel_id id); |
19 | void idset_sch_del(struct idset *set, struct subchannel_id id); | 19 | void idset_sch_del(struct idset *set, struct subchannel_id id); |
20 | void idset_sch_del_subseq(struct idset *set, struct subchannel_id schid); | ||
20 | int idset_sch_contains(struct idset *set, struct subchannel_id id); | 21 | int idset_sch_contains(struct idset *set, struct subchannel_id id); |
21 | int idset_sch_get_first(struct idset *set, struct subchannel_id *id); | 22 | int idset_sch_get_first(struct idset *set, struct subchannel_id *id); |
22 | int idset_is_empty(struct idset *set); | 23 | int idset_is_empty(struct idset *set); |
diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c index 16d6a839c7fa..61fb0ec26f06 100644 --- a/drivers/spi/spi-atmel.c +++ b/drivers/spi/spi-atmel.c | |||
@@ -19,9 +19,9 @@ | |||
19 | #include <linux/interrupt.h> | 19 | #include <linux/interrupt.h> |
20 | #include <linux/spi/spi.h> | 20 | #include <linux/spi/spi.h> |
21 | #include <linux/slab.h> | 21 | #include <linux/slab.h> |
22 | #include <linux/platform_data/atmel.h> | ||
22 | 23 | ||
23 | #include <asm/io.h> | 24 | #include <asm/io.h> |
24 | #include <mach/board.h> | ||
25 | #include <asm/gpio.h> | 25 | #include <asm/gpio.h> |
26 | #include <mach/cpu.h> | 26 | #include <mach/cpu.h> |
27 | 27 | ||
diff --git a/drivers/spi/spi-mxs.c b/drivers/spi/spi-mxs.c index edf1360ab09e..86dd04d6bc87 100644 --- a/drivers/spi/spi-mxs.c +++ b/drivers/spi/spi-mxs.c | |||
@@ -323,6 +323,7 @@ static int mxs_spi_txrx_dma(struct mxs_spi *spi, int cs, | |||
323 | if (!ret) { | 323 | if (!ret) { |
324 | dev_err(ssp->dev, "DMA transfer timeout\n"); | 324 | dev_err(ssp->dev, "DMA transfer timeout\n"); |
325 | ret = -ETIMEDOUT; | 325 | ret = -ETIMEDOUT; |
326 | dmaengine_terminate_all(ssp->dmach); | ||
326 | goto err_vmalloc; | 327 | goto err_vmalloc; |
327 | } | 328 | } |
328 | 329 | ||
@@ -480,7 +481,7 @@ static int mxs_spi_transfer_one(struct spi_master *master, | |||
480 | first = last = 0; | 481 | first = last = 0; |
481 | } | 482 | } |
482 | 483 | ||
483 | m->status = 0; | 484 | m->status = status; |
484 | spi_finalize_current_message(master); | 485 | spi_finalize_current_message(master); |
485 | 486 | ||
486 | return status; | 487 | return status; |
diff --git a/drivers/spi/spi-pl022.c b/drivers/spi/spi-pl022.c index 919464102d33..a1db91a99b89 100644 --- a/drivers/spi/spi-pl022.c +++ b/drivers/spi/spi-pl022.c | |||
@@ -2186,8 +2186,6 @@ pl022_probe(struct amba_device *adev, const struct amba_id *id) | |||
2186 | printk(KERN_INFO "pl022: mapped registers from 0x%08x to %p\n", | 2186 | printk(KERN_INFO "pl022: mapped registers from 0x%08x to %p\n", |
2187 | adev->res.start, pl022->virtbase); | 2187 | adev->res.start, pl022->virtbase); |
2188 | 2188 | ||
2189 | pm_runtime_resume(dev); | ||
2190 | |||
2191 | pl022->clk = devm_clk_get(&adev->dev, NULL); | 2189 | pl022->clk = devm_clk_get(&adev->dev, NULL); |
2192 | if (IS_ERR(pl022->clk)) { | 2190 | if (IS_ERR(pl022->clk)) { |
2193 | status = PTR_ERR(pl022->clk); | 2191 | status = PTR_ERR(pl022->clk); |
@@ -2292,7 +2290,6 @@ pl022_remove(struct amba_device *adev) | |||
2292 | 2290 | ||
2293 | clk_disable(pl022->clk); | 2291 | clk_disable(pl022->clk); |
2294 | clk_unprepare(pl022->clk); | 2292 | clk_unprepare(pl022->clk); |
2295 | pm_runtime_disable(&adev->dev); | ||
2296 | amba_release_regions(adev); | 2293 | amba_release_regions(adev); |
2297 | tasklet_disable(&pl022->pump_transfers); | 2294 | tasklet_disable(&pl022->pump_transfers); |
2298 | spi_unregister_master(pl022->master); | 2295 | spi_unregister_master(pl022->master); |
diff --git a/drivers/spi/spi-rspi.c b/drivers/spi/spi-rspi.c index 4894bde4bbff..30faf6d4ab91 100644 --- a/drivers/spi/spi-rspi.c +++ b/drivers/spi/spi-rspi.c | |||
@@ -147,8 +147,6 @@ struct rspi_data { | |||
147 | unsigned char spsr; | 147 | unsigned char spsr; |
148 | 148 | ||
149 | /* for dmaengine */ | 149 | /* for dmaengine */ |
150 | struct sh_dmae_slave dma_tx; | ||
151 | struct sh_dmae_slave dma_rx; | ||
152 | struct dma_chan *chan_tx; | 150 | struct dma_chan *chan_tx; |
153 | struct dma_chan *chan_rx; | 151 | struct dma_chan *chan_rx; |
154 | int irq; | 152 | int irq; |
@@ -663,20 +661,16 @@ static irqreturn_t rspi_irq(int irq, void *_sr) | |||
663 | return ret; | 661 | return ret; |
664 | } | 662 | } |
665 | 663 | ||
666 | static bool rspi_filter(struct dma_chan *chan, void *filter_param) | 664 | static int __devinit rspi_request_dma(struct rspi_data *rspi, |
667 | { | 665 | struct platform_device *pdev) |
668 | chan->private = filter_param; | ||
669 | return true; | ||
670 | } | ||
671 | |||
672 | static void __devinit rspi_request_dma(struct rspi_data *rspi, | ||
673 | struct platform_device *pdev) | ||
674 | { | 666 | { |
675 | struct rspi_plat_data *rspi_pd = pdev->dev.platform_data; | 667 | struct rspi_plat_data *rspi_pd = pdev->dev.platform_data; |
676 | dma_cap_mask_t mask; | 668 | dma_cap_mask_t mask; |
669 | struct dma_slave_config cfg; | ||
670 | int ret; | ||
677 | 671 | ||
678 | if (!rspi_pd) | 672 | if (!rspi_pd) |
679 | return; | 673 | return 0; /* The driver assumes no error. */ |
680 | 674 | ||
681 | rspi->dma_width_16bit = rspi_pd->dma_width_16bit; | 675 | rspi->dma_width_16bit = rspi_pd->dma_width_16bit; |
682 | 676 | ||
@@ -684,21 +678,35 @@ static void __devinit rspi_request_dma(struct rspi_data *rspi, | |||
684 | if (rspi_pd->dma_rx_id && rspi_pd->dma_tx_id) { | 678 | if (rspi_pd->dma_rx_id && rspi_pd->dma_tx_id) { |
685 | dma_cap_zero(mask); | 679 | dma_cap_zero(mask); |
686 | dma_cap_set(DMA_SLAVE, mask); | 680 | dma_cap_set(DMA_SLAVE, mask); |
687 | rspi->dma_rx.slave_id = rspi_pd->dma_rx_id; | 681 | rspi->chan_rx = dma_request_channel(mask, shdma_chan_filter, |
688 | rspi->chan_rx = dma_request_channel(mask, rspi_filter, | 682 | (void *)rspi_pd->dma_rx_id); |
689 | &rspi->dma_rx); | 683 | if (rspi->chan_rx) { |
690 | if (rspi->chan_rx) | 684 | cfg.slave_id = rspi_pd->dma_rx_id; |
691 | dev_info(&pdev->dev, "Use DMA when rx.\n"); | 685 | cfg.direction = DMA_DEV_TO_MEM; |
686 | ret = dmaengine_slave_config(rspi->chan_rx, &cfg); | ||
687 | if (!ret) | ||
688 | dev_info(&pdev->dev, "Use DMA when rx.\n"); | ||
689 | else | ||
690 | return ret; | ||
691 | } | ||
692 | } | 692 | } |
693 | if (rspi_pd->dma_tx_id) { | 693 | if (rspi_pd->dma_tx_id) { |
694 | dma_cap_zero(mask); | 694 | dma_cap_zero(mask); |
695 | dma_cap_set(DMA_SLAVE, mask); | 695 | dma_cap_set(DMA_SLAVE, mask); |
696 | rspi->dma_tx.slave_id = rspi_pd->dma_tx_id; | 696 | rspi->chan_tx = dma_request_channel(mask, shdma_chan_filter, |
697 | rspi->chan_tx = dma_request_channel(mask, rspi_filter, | 697 | (void *)rspi_pd->dma_tx_id); |
698 | &rspi->dma_tx); | 698 | if (rspi->chan_tx) { |
699 | if (rspi->chan_tx) | 699 | cfg.slave_id = rspi_pd->dma_tx_id; |
700 | dev_info(&pdev->dev, "Use DMA when tx\n"); | 700 | cfg.direction = DMA_MEM_TO_DEV; |
701 | ret = dmaengine_slave_config(rspi->chan_tx, &cfg); | ||
702 | if (!ret) | ||
703 | dev_info(&pdev->dev, "Use DMA when tx\n"); | ||
704 | else | ||
705 | return ret; | ||
706 | } | ||
701 | } | 707 | } |
708 | |||
709 | return 0; | ||
702 | } | 710 | } |
703 | 711 | ||
704 | static void __devexit rspi_release_dma(struct rspi_data *rspi) | 712 | static void __devexit rspi_release_dma(struct rspi_data *rspi) |
@@ -788,7 +796,11 @@ static int __devinit rspi_probe(struct platform_device *pdev) | |||
788 | } | 796 | } |
789 | 797 | ||
790 | rspi->irq = irq; | 798 | rspi->irq = irq; |
791 | rspi_request_dma(rspi, pdev); | 799 | ret = rspi_request_dma(rspi, pdev); |
800 | if (ret < 0) { | ||
801 | dev_err(&pdev->dev, "rspi_request_dma failed.\n"); | ||
802 | goto error4; | ||
803 | } | ||
792 | 804 | ||
793 | ret = spi_register_master(master); | 805 | ret = spi_register_master(master); |
794 | if (ret < 0) { | 806 | if (ret < 0) { |
diff --git a/drivers/staging/android/binder.c b/drivers/staging/android/binder.c index 7b0ba92e7e46..5d4610babd8a 100644 --- a/drivers/staging/android/binder.c +++ b/drivers/staging/android/binder.c | |||
@@ -567,7 +567,7 @@ static int binder_update_page_range(struct binder_proc *proc, int allocate, | |||
567 | page = &proc->pages[(page_addr - proc->buffer) / PAGE_SIZE]; | 567 | page = &proc->pages[(page_addr - proc->buffer) / PAGE_SIZE]; |
568 | 568 | ||
569 | BUG_ON(*page); | 569 | BUG_ON(*page); |
570 | *page = alloc_page(GFP_KERNEL | __GFP_ZERO); | 570 | *page = alloc_page(GFP_KERNEL | __GFP_HIGHMEM | __GFP_ZERO); |
571 | if (*page == NULL) { | 571 | if (*page == NULL) { |
572 | pr_err("binder: %d: binder_alloc_buf failed " | 572 | pr_err("binder: %d: binder_alloc_buf failed " |
573 | "for page at %p\n", proc->pid, page_addr); | 573 | "for page at %p\n", proc->pid, page_addr); |
@@ -2419,14 +2419,38 @@ static void binder_release_work(struct list_head *list) | |||
2419 | struct binder_transaction *t; | 2419 | struct binder_transaction *t; |
2420 | 2420 | ||
2421 | t = container_of(w, struct binder_transaction, work); | 2421 | t = container_of(w, struct binder_transaction, work); |
2422 | if (t->buffer->target_node && !(t->flags & TF_ONE_WAY)) | 2422 | if (t->buffer->target_node && |
2423 | !(t->flags & TF_ONE_WAY)) { | ||
2423 | binder_send_failed_reply(t, BR_DEAD_REPLY); | 2424 | binder_send_failed_reply(t, BR_DEAD_REPLY); |
2425 | } else { | ||
2426 | binder_debug(BINDER_DEBUG_DEAD_TRANSACTION, | ||
2427 | "binder: undelivered transaction %d\n", | ||
2428 | t->debug_id); | ||
2429 | t->buffer->transaction = NULL; | ||
2430 | kfree(t); | ||
2431 | binder_stats_deleted(BINDER_STAT_TRANSACTION); | ||
2432 | } | ||
2424 | } break; | 2433 | } break; |
2425 | case BINDER_WORK_TRANSACTION_COMPLETE: { | 2434 | case BINDER_WORK_TRANSACTION_COMPLETE: { |
2435 | binder_debug(BINDER_DEBUG_DEAD_TRANSACTION, | ||
2436 | "binder: undelivered TRANSACTION_COMPLETE\n"); | ||
2426 | kfree(w); | 2437 | kfree(w); |
2427 | binder_stats_deleted(BINDER_STAT_TRANSACTION_COMPLETE); | 2438 | binder_stats_deleted(BINDER_STAT_TRANSACTION_COMPLETE); |
2428 | } break; | 2439 | } break; |
2440 | case BINDER_WORK_DEAD_BINDER_AND_CLEAR: | ||
2441 | case BINDER_WORK_CLEAR_DEATH_NOTIFICATION: { | ||
2442 | struct binder_ref_death *death; | ||
2443 | |||
2444 | death = container_of(w, struct binder_ref_death, work); | ||
2445 | binder_debug(BINDER_DEBUG_DEAD_TRANSACTION, | ||
2446 | "binder: undelivered death notification, %p\n", | ||
2447 | death->cookie); | ||
2448 | kfree(death); | ||
2449 | binder_stats_deleted(BINDER_STAT_DEATH); | ||
2450 | } break; | ||
2429 | default: | 2451 | default: |
2452 | pr_err("binder: unexpected work type, %d, not freed\n", | ||
2453 | w->type); | ||
2430 | break; | 2454 | break; |
2431 | } | 2455 | } |
2432 | } | 2456 | } |
@@ -2899,6 +2923,7 @@ static void binder_deferred_release(struct binder_proc *proc) | |||
2899 | nodes++; | 2923 | nodes++; |
2900 | rb_erase(&node->rb_node, &proc->nodes); | 2924 | rb_erase(&node->rb_node, &proc->nodes); |
2901 | list_del_init(&node->work.entry); | 2925 | list_del_init(&node->work.entry); |
2926 | binder_release_work(&node->async_todo); | ||
2902 | if (hlist_empty(&node->refs)) { | 2927 | if (hlist_empty(&node->refs)) { |
2903 | kfree(node); | 2928 | kfree(node); |
2904 | binder_stats_deleted(BINDER_STAT_NODE); | 2929 | binder_stats_deleted(BINDER_STAT_NODE); |
@@ -2937,6 +2962,7 @@ static void binder_deferred_release(struct binder_proc *proc) | |||
2937 | binder_delete_ref(ref); | 2962 | binder_delete_ref(ref); |
2938 | } | 2963 | } |
2939 | binder_release_work(&proc->todo); | 2964 | binder_release_work(&proc->todo); |
2965 | binder_release_work(&proc->delivered_death); | ||
2940 | buffers = 0; | 2966 | buffers = 0; |
2941 | 2967 | ||
2942 | while ((n = rb_first(&proc->allocated_buffers))) { | 2968 | while ((n = rb_first(&proc->allocated_buffers))) { |
diff --git a/drivers/staging/comedi/drivers/8255_pci.c b/drivers/staging/comedi/drivers/8255_pci.c index 7dff3c01dc29..d00aff6671df 100644 --- a/drivers/staging/comedi/drivers/8255_pci.c +++ b/drivers/staging/comedi/drivers/8255_pci.c | |||
@@ -289,6 +289,8 @@ static void pci_8255_detach(struct comedi_device *dev) | |||
289 | struct comedi_subdevice *s; | 289 | struct comedi_subdevice *s; |
290 | int i; | 290 | int i; |
291 | 291 | ||
292 | if (!board || !devpriv) | ||
293 | return; | ||
292 | if (dev->subdevices) { | 294 | if (dev->subdevices) { |
293 | for (i = 0; i < board->n_8255; i++) { | 295 | for (i = 0; i < board->n_8255; i++) { |
294 | s = &dev->subdevices[i]; | 296 | s = &dev->subdevices[i]; |
diff --git a/drivers/staging/comedi/drivers/amplc_dio200.c b/drivers/staging/comedi/drivers/amplc_dio200.c index 08f305210a69..29eb52d11d2f 100644 --- a/drivers/staging/comedi/drivers/amplc_dio200.c +++ b/drivers/staging/comedi/drivers/amplc_dio200.c | |||
@@ -1410,6 +1410,8 @@ static void dio200_detach(struct comedi_device *dev) | |||
1410 | const struct dio200_layout_struct *layout; | 1410 | const struct dio200_layout_struct *layout; |
1411 | unsigned n; | 1411 | unsigned n; |
1412 | 1412 | ||
1413 | if (!thisboard) | ||
1414 | return; | ||
1413 | if (dev->irq) | 1415 | if (dev->irq) |
1414 | free_irq(dev->irq, dev); | 1416 | free_irq(dev->irq, dev); |
1415 | if (dev->subdevices) { | 1417 | if (dev->subdevices) { |
diff --git a/drivers/staging/comedi/drivers/amplc_pc236.c b/drivers/staging/comedi/drivers/amplc_pc236.c index eacb5e4735d7..4e4f3c15df87 100644 --- a/drivers/staging/comedi/drivers/amplc_pc236.c +++ b/drivers/staging/comedi/drivers/amplc_pc236.c | |||
@@ -573,9 +573,10 @@ static int __devinit pc236_attach_pci(struct comedi_device *dev, | |||
573 | static void pc236_detach(struct comedi_device *dev) | 573 | static void pc236_detach(struct comedi_device *dev) |
574 | { | 574 | { |
575 | const struct pc236_board *thisboard = comedi_board(dev); | 575 | const struct pc236_board *thisboard = comedi_board(dev); |
576 | struct pc236_private *devpriv = dev->private; | ||
577 | 576 | ||
578 | if (devpriv) | 577 | if (!thisboard) |
578 | return; | ||
579 | if (dev->iobase) | ||
579 | pc236_intr_disable(dev); | 580 | pc236_intr_disable(dev); |
580 | if (dev->irq) | 581 | if (dev->irq) |
581 | free_irq(dev->irq, dev); | 582 | free_irq(dev->irq, dev); |
diff --git a/drivers/staging/comedi/drivers/amplc_pc263.c b/drivers/staging/comedi/drivers/amplc_pc263.c index 60830ccfb903..d0a4c441228b 100644 --- a/drivers/staging/comedi/drivers/amplc_pc263.c +++ b/drivers/staging/comedi/drivers/amplc_pc263.c | |||
@@ -323,6 +323,8 @@ static void pc263_detach(struct comedi_device *dev) | |||
323 | { | 323 | { |
324 | const struct pc263_board *thisboard = comedi_board(dev); | 324 | const struct pc263_board *thisboard = comedi_board(dev); |
325 | 325 | ||
326 | if (!thisboard) | ||
327 | return; | ||
326 | if (is_isa_board(thisboard)) { | 328 | if (is_isa_board(thisboard)) { |
327 | if (dev->iobase) | 329 | if (dev->iobase) |
328 | release_region(dev->iobase, PC263_IO_SIZE); | 330 | release_region(dev->iobase, PC263_IO_SIZE); |
diff --git a/drivers/staging/comedi/drivers/das08.c b/drivers/staging/comedi/drivers/das08.c index 5fd21fa6c1c7..c304528cfb13 100644 --- a/drivers/staging/comedi/drivers/das08.c +++ b/drivers/staging/comedi/drivers/das08.c | |||
@@ -846,6 +846,8 @@ static void __maybe_unused das08_detach(struct comedi_device *dev) | |||
846 | { | 846 | { |
847 | const struct das08_board_struct *thisboard = comedi_board(dev); | 847 | const struct das08_board_struct *thisboard = comedi_board(dev); |
848 | 848 | ||
849 | if (!thisboard) | ||
850 | return; | ||
849 | das08_common_detach(dev); | 851 | das08_common_detach(dev); |
850 | if (is_isa_board(thisboard)) { | 852 | if (is_isa_board(thisboard)) { |
851 | if (dev->iobase) | 853 | if (dev->iobase) |
diff --git a/drivers/staging/comedi/drivers/ni_daq_700.c b/drivers/staging/comedi/drivers/ni_daq_700.c index 2ba0ade45c64..68d7c6a5db7d 100644 --- a/drivers/staging/comedi/drivers/ni_daq_700.c +++ b/drivers/staging/comedi/drivers/ni_daq_700.c | |||
@@ -95,7 +95,7 @@ static int daq700_dio_insn_bits(struct comedi_device *dev, | |||
95 | } | 95 | } |
96 | 96 | ||
97 | data[1] = s->state & 0xff; | 97 | data[1] = s->state & 0xff; |
98 | data[1] |= inb(dev->iobase + DIO_R); | 98 | data[1] |= inb(dev->iobase + DIO_R) << 8; |
99 | 99 | ||
100 | return insn->n; | 100 | return insn->n; |
101 | } | 101 | } |
diff --git a/drivers/staging/comedi/drivers/ni_labpc.c b/drivers/staging/comedi/drivers/ni_labpc.c index 28b91a6c3789..b5a19a0863fb 100644 --- a/drivers/staging/comedi/drivers/ni_labpc.c +++ b/drivers/staging/comedi/drivers/ni_labpc.c | |||
@@ -772,6 +772,8 @@ void labpc_common_detach(struct comedi_device *dev) | |||
772 | { | 772 | { |
773 | struct comedi_subdevice *s; | 773 | struct comedi_subdevice *s; |
774 | 774 | ||
775 | if (!thisboard) | ||
776 | return; | ||
775 | if (dev->subdevices) { | 777 | if (dev->subdevices) { |
776 | s = &dev->subdevices[2]; | 778 | s = &dev->subdevices[2]; |
777 | subdev_8255_cleanup(dev, s); | 779 | subdev_8255_cleanup(dev, s); |
diff --git a/drivers/staging/iio/accel/adis16201_core.c b/drivers/staging/iio/accel/adis16201_core.c index 8e37d6e04277..b12ca68cd9e4 100644 --- a/drivers/staging/iio/accel/adis16201_core.c +++ b/drivers/staging/iio/accel/adis16201_core.c | |||
@@ -310,30 +310,32 @@ static int adis16201_read_raw(struct iio_dev *indio_dev, | |||
310 | case IIO_CHAN_INFO_SCALE: | 310 | case IIO_CHAN_INFO_SCALE: |
311 | switch (chan->type) { | 311 | switch (chan->type) { |
312 | case IIO_VOLTAGE: | 312 | case IIO_VOLTAGE: |
313 | *val = 0; | 313 | if (chan->channel == 0) { |
314 | if (chan->channel == 0) | 314 | *val = 1; |
315 | *val2 = 1220; | 315 | *val2 = 220000; /* 1.22 mV */ |
316 | else | 316 | } else { |
317 | *val2 = 610; | 317 | *val = 0; |
318 | *val2 = 610000; /* 0.610 mV */ | ||
319 | } | ||
318 | return IIO_VAL_INT_PLUS_MICRO; | 320 | return IIO_VAL_INT_PLUS_MICRO; |
319 | case IIO_TEMP: | 321 | case IIO_TEMP: |
320 | *val = 0; | 322 | *val = -470; /* 0.47 C */ |
321 | *val2 = -470000; | 323 | *val2 = 0; |
322 | return IIO_VAL_INT_PLUS_MICRO; | 324 | return IIO_VAL_INT_PLUS_MICRO; |
323 | case IIO_ACCEL: | 325 | case IIO_ACCEL: |
324 | *val = 0; | 326 | *val = 0; |
325 | *val2 = 462500; | 327 | *val2 = IIO_G_TO_M_S_2(462400); /* 0.4624 mg */ |
326 | return IIO_VAL_INT_PLUS_MICRO; | 328 | return IIO_VAL_INT_PLUS_NANO; |
327 | case IIO_INCLI: | 329 | case IIO_INCLI: |
328 | *val = 0; | 330 | *val = 0; |
329 | *val2 = 100000; | 331 | *val2 = 100000; /* 0.1 degree */ |
330 | return IIO_VAL_INT_PLUS_MICRO; | 332 | return IIO_VAL_INT_PLUS_MICRO; |
331 | default: | 333 | default: |
332 | return -EINVAL; | 334 | return -EINVAL; |
333 | } | 335 | } |
334 | break; | 336 | break; |
335 | case IIO_CHAN_INFO_OFFSET: | 337 | case IIO_CHAN_INFO_OFFSET: |
336 | *val = 25; | 338 | *val = 25000 / -470 - 1278; /* 25 C = 1278 */ |
337 | return IIO_VAL_INT; | 339 | return IIO_VAL_INT; |
338 | case IIO_CHAN_INFO_CALIBBIAS: | 340 | case IIO_CHAN_INFO_CALIBBIAS: |
339 | switch (chan->type) { | 341 | switch (chan->type) { |
diff --git a/drivers/staging/iio/accel/adis16203_core.c b/drivers/staging/iio/accel/adis16203_core.c index 002fa9dfc375..e7b3441115ae 100644 --- a/drivers/staging/iio/accel/adis16203_core.c +++ b/drivers/staging/iio/accel/adis16203_core.c | |||
@@ -316,25 +316,27 @@ static int adis16203_read_raw(struct iio_dev *indio_dev, | |||
316 | case IIO_CHAN_INFO_SCALE: | 316 | case IIO_CHAN_INFO_SCALE: |
317 | switch (chan->type) { | 317 | switch (chan->type) { |
318 | case IIO_VOLTAGE: | 318 | case IIO_VOLTAGE: |
319 | *val = 0; | 319 | if (chan->channel == 0) { |
320 | if (chan->channel == 0) | 320 | *val = 1; |
321 | *val2 = 1220; | 321 | *val2 = 220000; /* 1.22 mV */ |
322 | else | 322 | } else { |
323 | *val2 = 610; | 323 | *val = 0; |
324 | *val2 = 610000; /* 0.61 mV */ | ||
325 | } | ||
324 | return IIO_VAL_INT_PLUS_MICRO; | 326 | return IIO_VAL_INT_PLUS_MICRO; |
325 | case IIO_TEMP: | 327 | case IIO_TEMP: |
326 | *val = 0; | 328 | *val = -470; /* -0.47 C */ |
327 | *val2 = -470000; | 329 | *val2 = 0; |
328 | return IIO_VAL_INT_PLUS_MICRO; | 330 | return IIO_VAL_INT_PLUS_MICRO; |
329 | case IIO_INCLI: | 331 | case IIO_INCLI: |
330 | *val = 0; | 332 | *val = 0; |
331 | *val2 = 25000; | 333 | *val2 = 25000; /* 0.025 degree */ |
332 | return IIO_VAL_INT_PLUS_MICRO; | 334 | return IIO_VAL_INT_PLUS_MICRO; |
333 | default: | 335 | default: |
334 | return -EINVAL; | 336 | return -EINVAL; |
335 | } | 337 | } |
336 | case IIO_CHAN_INFO_OFFSET: | 338 | case IIO_CHAN_INFO_OFFSET: |
337 | *val = 25; | 339 | *val = 25000 / -470 - 1278; /* 25 C = 1278 */ |
338 | return IIO_VAL_INT; | 340 | return IIO_VAL_INT; |
339 | case IIO_CHAN_INFO_CALIBBIAS: | 341 | case IIO_CHAN_INFO_CALIBBIAS: |
340 | bits = 14; | 342 | bits = 14; |
diff --git a/drivers/staging/iio/accel/adis16204_core.c b/drivers/staging/iio/accel/adis16204_core.c index 05bdb7c2c8e3..c6234c2f46aa 100644 --- a/drivers/staging/iio/accel/adis16204_core.c +++ b/drivers/staging/iio/accel/adis16204_core.c | |||
@@ -317,26 +317,28 @@ static int adis16204_read_raw(struct iio_dev *indio_dev, | |||
317 | case IIO_CHAN_INFO_SCALE: | 317 | case IIO_CHAN_INFO_SCALE: |
318 | switch (chan->type) { | 318 | switch (chan->type) { |
319 | case IIO_VOLTAGE: | 319 | case IIO_VOLTAGE: |
320 | *val = 0; | 320 | if (chan->channel == 0) { |
321 | if (chan->channel == 0) | 321 | *val = 1; |
322 | *val2 = 1220; | 322 | *val2 = 220000; /* 1.22 mV */ |
323 | else | 323 | } else { |
324 | *val2 = 610; | 324 | *val = 0; |
325 | *val2 = 610000; /* 0.61 mV */ | ||
326 | } | ||
325 | return IIO_VAL_INT_PLUS_MICRO; | 327 | return IIO_VAL_INT_PLUS_MICRO; |
326 | case IIO_TEMP: | 328 | case IIO_TEMP: |
327 | *val = 0; | 329 | *val = -470; /* 0.47 C */ |
328 | *val2 = -470000; | 330 | *val2 = 0; |
329 | return IIO_VAL_INT_PLUS_MICRO; | 331 | return IIO_VAL_INT_PLUS_MICRO; |
330 | case IIO_ACCEL: | 332 | case IIO_ACCEL: |
331 | *val = 0; | 333 | *val = 0; |
332 | switch (chan->channel2) { | 334 | switch (chan->channel2) { |
333 | case IIO_MOD_X: | 335 | case IIO_MOD_X: |
334 | case IIO_MOD_ROOT_SUM_SQUARED_X_Y: | 336 | case IIO_MOD_ROOT_SUM_SQUARED_X_Y: |
335 | *val2 = 17125; | 337 | *val2 = IIO_G_TO_M_S_2(17125); /* 17.125 mg */ |
336 | break; | 338 | break; |
337 | case IIO_MOD_Y: | 339 | case IIO_MOD_Y: |
338 | case IIO_MOD_Z: | 340 | case IIO_MOD_Z: |
339 | *val2 = 8407; | 341 | *val2 = IIO_G_TO_M_S_2(8407); /* 8.407 mg */ |
340 | break; | 342 | break; |
341 | } | 343 | } |
342 | return IIO_VAL_INT_PLUS_MICRO; | 344 | return IIO_VAL_INT_PLUS_MICRO; |
@@ -345,7 +347,7 @@ static int adis16204_read_raw(struct iio_dev *indio_dev, | |||
345 | } | 347 | } |
346 | break; | 348 | break; |
347 | case IIO_CHAN_INFO_OFFSET: | 349 | case IIO_CHAN_INFO_OFFSET: |
348 | *val = 25; | 350 | *val = 25000 / -470 - 1278; /* 25 C = 1278 */ |
349 | return IIO_VAL_INT; | 351 | return IIO_VAL_INT; |
350 | case IIO_CHAN_INFO_CALIBBIAS: | 352 | case IIO_CHAN_INFO_CALIBBIAS: |
351 | case IIO_CHAN_INFO_PEAK: | 353 | case IIO_CHAN_INFO_PEAK: |
diff --git a/drivers/staging/iio/accel/adis16209_core.c b/drivers/staging/iio/accel/adis16209_core.c index b7333bfe0b2f..7ee974b45d7d 100644 --- a/drivers/staging/iio/accel/adis16209_core.c +++ b/drivers/staging/iio/accel/adis16209_core.c | |||
@@ -343,28 +343,29 @@ static int adis16209_read_raw(struct iio_dev *indio_dev, | |||
343 | case IIO_VOLTAGE: | 343 | case IIO_VOLTAGE: |
344 | *val = 0; | 344 | *val = 0; |
345 | if (chan->channel == 0) | 345 | if (chan->channel == 0) |
346 | *val2 = 305180; | 346 | *val2 = 305180; /* 0.30518 mV */ |
347 | else | 347 | else |
348 | *val2 = 610500; | 348 | *val2 = 610500; /* 0.6105 mV */ |
349 | return IIO_VAL_INT_PLUS_MICRO; | 349 | return IIO_VAL_INT_PLUS_MICRO; |
350 | case IIO_TEMP: | 350 | case IIO_TEMP: |
351 | *val = 0; | 351 | *val = -470; /* -0.47 C */ |
352 | *val2 = -470000; | 352 | *val2 = 0; |
353 | return IIO_VAL_INT_PLUS_MICRO; | 353 | return IIO_VAL_INT_PLUS_MICRO; |
354 | case IIO_ACCEL: | 354 | case IIO_ACCEL: |
355 | *val = 0; | 355 | *val = 0; |
356 | *val2 = 2394; | 356 | *val2 = IIO_G_TO_M_S_2(244140); /* 0.244140 mg */ |
357 | return IIO_VAL_INT_PLUS_MICRO; | 357 | return IIO_VAL_INT_PLUS_NANO; |
358 | case IIO_INCLI: | 358 | case IIO_INCLI: |
359 | case IIO_ROT: | ||
359 | *val = 0; | 360 | *val = 0; |
360 | *val2 = 436; | 361 | *val2 = 25000; /* 0.025 degree */ |
361 | return IIO_VAL_INT_PLUS_MICRO; | 362 | return IIO_VAL_INT_PLUS_MICRO; |
362 | default: | 363 | default: |
363 | return -EINVAL; | 364 | return -EINVAL; |
364 | } | 365 | } |
365 | break; | 366 | break; |
366 | case IIO_CHAN_INFO_OFFSET: | 367 | case IIO_CHAN_INFO_OFFSET: |
367 | *val = 25; | 368 | *val = 25000 / -470 - 0x4FE; /* 25 C = 0x4FE */ |
368 | return IIO_VAL_INT; | 369 | return IIO_VAL_INT; |
369 | case IIO_CHAN_INFO_CALIBBIAS: | 370 | case IIO_CHAN_INFO_CALIBBIAS: |
370 | switch (chan->type) { | 371 | switch (chan->type) { |
@@ -491,6 +492,7 @@ static const struct iio_chan_spec adis16209_channels[] = { | |||
491 | .modified = 1, | 492 | .modified = 1, |
492 | .channel2 = IIO_MOD_X, | 493 | .channel2 = IIO_MOD_X, |
493 | .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT, | 494 | .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT, |
495 | IIO_CHAN_INFO_SCALE_SHARED_BIT, | ||
494 | .address = rot, | 496 | .address = rot, |
495 | .scan_index = ADIS16209_SCAN_ROT, | 497 | .scan_index = ADIS16209_SCAN_ROT, |
496 | .scan_type = { | 498 | .scan_type = { |
diff --git a/drivers/staging/iio/accel/adis16220_core.c b/drivers/staging/iio/accel/adis16220_core.c index c755089c7117..eaadd9df3f78 100644 --- a/drivers/staging/iio/accel/adis16220_core.c +++ b/drivers/staging/iio/accel/adis16220_core.c | |||
@@ -486,7 +486,7 @@ static int adis16220_read_raw(struct iio_dev *indio_dev, | |||
486 | break; | 486 | break; |
487 | case IIO_CHAN_INFO_OFFSET: | 487 | case IIO_CHAN_INFO_OFFSET: |
488 | if (chan->type == IIO_TEMP) { | 488 | if (chan->type == IIO_TEMP) { |
489 | *val = 25; | 489 | *val = 25000 / -470 - 1278; /* 25 C = 1278 */ |
490 | return IIO_VAL_INT; | 490 | return IIO_VAL_INT; |
491 | } | 491 | } |
492 | addrind = 1; | 492 | addrind = 1; |
@@ -495,19 +495,22 @@ static int adis16220_read_raw(struct iio_dev *indio_dev, | |||
495 | addrind = 2; | 495 | addrind = 2; |
496 | break; | 496 | break; |
497 | case IIO_CHAN_INFO_SCALE: | 497 | case IIO_CHAN_INFO_SCALE: |
498 | *val = 0; | ||
499 | switch (chan->type) { | 498 | switch (chan->type) { |
500 | case IIO_TEMP: | 499 | case IIO_TEMP: |
501 | *val2 = -470000; | 500 | *val = -470; /* -0.47 C */ |
501 | *val2 = 0; | ||
502 | return IIO_VAL_INT_PLUS_MICRO; | 502 | return IIO_VAL_INT_PLUS_MICRO; |
503 | case IIO_ACCEL: | 503 | case IIO_ACCEL: |
504 | *val2 = 1887042; | 504 | *val2 = IIO_G_TO_M_S_2(19073); /* 19.073 g */ |
505 | return IIO_VAL_INT_PLUS_MICRO; | 505 | return IIO_VAL_INT_PLUS_MICRO; |
506 | case IIO_VOLTAGE: | 506 | case IIO_VOLTAGE: |
507 | if (chan->channel == 0) | 507 | if (chan->channel == 0) { |
508 | *val2 = 0012221; | 508 | *val = 1; |
509 | else /* Should really be dependent on VDD */ | 509 | *val2 = 220700; /* 1.2207 mV */ |
510 | *val2 = 305; | 510 | } else { |
511 | /* Should really be dependent on VDD */ | ||
512 | *val2 = 305180; /* 305.18 uV */ | ||
513 | } | ||
511 | return IIO_VAL_INT_PLUS_MICRO; | 514 | return IIO_VAL_INT_PLUS_MICRO; |
512 | default: | 515 | default: |
513 | return -EINVAL; | 516 | return -EINVAL; |
diff --git a/drivers/staging/iio/accel/adis16240_core.c b/drivers/staging/iio/accel/adis16240_core.c index 0fc26a49d681..35e093973d5c 100644 --- a/drivers/staging/iio/accel/adis16240_core.c +++ b/drivers/staging/iio/accel/adis16240_core.c | |||
@@ -373,30 +373,31 @@ static int adis16240_read_raw(struct iio_dev *indio_dev, | |||
373 | case IIO_CHAN_INFO_SCALE: | 373 | case IIO_CHAN_INFO_SCALE: |
374 | switch (chan->type) { | 374 | switch (chan->type) { |
375 | case IIO_VOLTAGE: | 375 | case IIO_VOLTAGE: |
376 | *val = 0; | 376 | if (chan->channel == 0) { |
377 | if (chan->channel == 0) | 377 | *val = 4; |
378 | *val2 = 4880; | 378 | *val2 = 880000; /* 4.88 mV */ |
379 | else | 379 | return IIO_VAL_INT_PLUS_MICRO; |
380 | } else { | ||
380 | return -EINVAL; | 381 | return -EINVAL; |
381 | return IIO_VAL_INT_PLUS_MICRO; | 382 | } |
382 | case IIO_TEMP: | 383 | case IIO_TEMP: |
383 | *val = 0; | 384 | *val = 244; /* 0.244 C */ |
384 | *val2 = 244000; | 385 | *val2 = 0; |
385 | return IIO_VAL_INT_PLUS_MICRO; | 386 | return IIO_VAL_INT_PLUS_MICRO; |
386 | case IIO_ACCEL: | 387 | case IIO_ACCEL: |
387 | *val = 0; | 388 | *val = 0; |
388 | *val2 = 504062; | 389 | *val2 = IIO_G_TO_M_S_2(51400); /* 51.4 mg */ |
389 | return IIO_VAL_INT_PLUS_MICRO; | 390 | return IIO_VAL_INT_PLUS_MICRO; |
390 | default: | 391 | default: |
391 | return -EINVAL; | 392 | return -EINVAL; |
392 | } | 393 | } |
393 | break; | 394 | break; |
394 | case IIO_CHAN_INFO_PEAK_SCALE: | 395 | case IIO_CHAN_INFO_PEAK_SCALE: |
395 | *val = 6; | 396 | *val = 0; |
396 | *val2 = 629295; | 397 | *val2 = IIO_G_TO_M_S_2(51400); /* 51.4 mg */ |
397 | return IIO_VAL_INT_PLUS_MICRO; | 398 | return IIO_VAL_INT_PLUS_MICRO; |
398 | case IIO_CHAN_INFO_OFFSET: | 399 | case IIO_CHAN_INFO_OFFSET: |
399 | *val = 25; | 400 | *val = 25000 / 244 - 0x133; /* 25 C = 0x133 */ |
400 | return IIO_VAL_INT; | 401 | return IIO_VAL_INT; |
401 | case IIO_CHAN_INFO_CALIBBIAS: | 402 | case IIO_CHAN_INFO_CALIBBIAS: |
402 | bits = 10; | 403 | bits = 10; |
diff --git a/drivers/staging/iio/gyro/adis16260_core.c b/drivers/staging/iio/gyro/adis16260_core.c index 9571c03aa4cc..aa964a2d8290 100644 --- a/drivers/staging/iio/gyro/adis16260_core.c +++ b/drivers/staging/iio/gyro/adis16260_core.c | |||
@@ -498,28 +498,33 @@ static int adis16260_read_raw(struct iio_dev *indio_dev, | |||
498 | switch (chan->type) { | 498 | switch (chan->type) { |
499 | case IIO_ANGL_VEL: | 499 | case IIO_ANGL_VEL: |
500 | *val = 0; | 500 | *val = 0; |
501 | if (spi_get_device_id(st->us)->driver_data) | 501 | if (spi_get_device_id(st->us)->driver_data) { |
502 | *val2 = 320; | 502 | /* 0.01832 degree / sec */ |
503 | else | 503 | *val2 = IIO_DEGREE_TO_RAD(18320); |
504 | *val2 = 1278; | 504 | } else { |
505 | /* 0.07326 degree / sec */ | ||
506 | *val2 = IIO_DEGREE_TO_RAD(73260); | ||
507 | } | ||
505 | return IIO_VAL_INT_PLUS_MICRO; | 508 | return IIO_VAL_INT_PLUS_MICRO; |
506 | case IIO_VOLTAGE: | 509 | case IIO_VOLTAGE: |
507 | *val = 0; | 510 | if (chan->channel == 0) { |
508 | if (chan->channel == 0) | 511 | *val = 1; |
509 | *val2 = 18315; | 512 | *val2 = 831500; /* 1.8315 mV */ |
510 | else | 513 | } else { |
511 | *val2 = 610500; | 514 | *val = 0; |
515 | *val2 = 610500; /* 610.5 uV */ | ||
516 | } | ||
512 | return IIO_VAL_INT_PLUS_MICRO; | 517 | return IIO_VAL_INT_PLUS_MICRO; |
513 | case IIO_TEMP: | 518 | case IIO_TEMP: |
514 | *val = 0; | 519 | *val = 145; |
515 | *val2 = 145300; | 520 | *val2 = 300000; /* 0.1453 C */ |
516 | return IIO_VAL_INT_PLUS_MICRO; | 521 | return IIO_VAL_INT_PLUS_MICRO; |
517 | default: | 522 | default: |
518 | return -EINVAL; | 523 | return -EINVAL; |
519 | } | 524 | } |
520 | break; | 525 | break; |
521 | case IIO_CHAN_INFO_OFFSET: | 526 | case IIO_CHAN_INFO_OFFSET: |
522 | *val = 25; | 527 | *val = 250000 / 1453; /* 25 C = 0x00 */ |
523 | return IIO_VAL_INT; | 528 | return IIO_VAL_INT; |
524 | case IIO_CHAN_INFO_CALIBBIAS: | 529 | case IIO_CHAN_INFO_CALIBBIAS: |
525 | switch (chan->type) { | 530 | switch (chan->type) { |
diff --git a/drivers/staging/iio/imu/adis16400.h b/drivers/staging/iio/imu/adis16400.h index d59d7ac856a9..77c601da1846 100644 --- a/drivers/staging/iio/imu/adis16400.h +++ b/drivers/staging/iio/imu/adis16400.h | |||
@@ -139,6 +139,8 @@ struct adis16400_chip_info { | |||
139 | const long flags; | 139 | const long flags; |
140 | unsigned int gyro_scale_micro; | 140 | unsigned int gyro_scale_micro; |
141 | unsigned int accel_scale_micro; | 141 | unsigned int accel_scale_micro; |
142 | int temp_scale_nano; | ||
143 | int temp_offset; | ||
142 | unsigned long default_scan_mask; | 144 | unsigned long default_scan_mask; |
143 | }; | 145 | }; |
144 | 146 | ||
diff --git a/drivers/staging/iio/imu/adis16400_core.c b/drivers/staging/iio/imu/adis16400_core.c index b302c9ba2712..3144a7b1e1c4 100644 --- a/drivers/staging/iio/imu/adis16400_core.c +++ b/drivers/staging/iio/imu/adis16400_core.c | |||
@@ -553,10 +553,13 @@ static int adis16400_read_raw(struct iio_dev *indio_dev, | |||
553 | return IIO_VAL_INT_PLUS_MICRO; | 553 | return IIO_VAL_INT_PLUS_MICRO; |
554 | case IIO_VOLTAGE: | 554 | case IIO_VOLTAGE: |
555 | *val = 0; | 555 | *val = 0; |
556 | if (chan->channel == 0) | 556 | if (chan->channel == 0) { |
557 | *val2 = 2418; | 557 | *val = 2; |
558 | else | 558 | *val2 = 418000; /* 2.418 mV */ |
559 | *val2 = 806; | 559 | } else { |
560 | *val = 0; | ||
561 | *val2 = 805800; /* 805.8 uV */ | ||
562 | } | ||
560 | return IIO_VAL_INT_PLUS_MICRO; | 563 | return IIO_VAL_INT_PLUS_MICRO; |
561 | case IIO_ACCEL: | 564 | case IIO_ACCEL: |
562 | *val = 0; | 565 | *val = 0; |
@@ -564,11 +567,11 @@ static int adis16400_read_raw(struct iio_dev *indio_dev, | |||
564 | return IIO_VAL_INT_PLUS_MICRO; | 567 | return IIO_VAL_INT_PLUS_MICRO; |
565 | case IIO_MAGN: | 568 | case IIO_MAGN: |
566 | *val = 0; | 569 | *val = 0; |
567 | *val2 = 500; | 570 | *val2 = 500; /* 0.5 mgauss */ |
568 | return IIO_VAL_INT_PLUS_MICRO; | 571 | return IIO_VAL_INT_PLUS_MICRO; |
569 | case IIO_TEMP: | 572 | case IIO_TEMP: |
570 | *val = 0; | 573 | *val = st->variant->temp_scale_nano / 1000000; |
571 | *val2 = 140000; | 574 | *val2 = (st->variant->temp_scale_nano % 1000000); |
572 | return IIO_VAL_INT_PLUS_MICRO; | 575 | return IIO_VAL_INT_PLUS_MICRO; |
573 | default: | 576 | default: |
574 | return -EINVAL; | 577 | return -EINVAL; |
@@ -586,9 +589,8 @@ static int adis16400_read_raw(struct iio_dev *indio_dev, | |||
586 | return IIO_VAL_INT; | 589 | return IIO_VAL_INT; |
587 | case IIO_CHAN_INFO_OFFSET: | 590 | case IIO_CHAN_INFO_OFFSET: |
588 | /* currently only temperature */ | 591 | /* currently only temperature */ |
589 | *val = 198; | 592 | *val = st->variant->temp_offset; |
590 | *val2 = 160000; | 593 | return IIO_VAL_INT; |
591 | return IIO_VAL_INT_PLUS_MICRO; | ||
592 | case IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY: | 594 | case IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY: |
593 | mutex_lock(&indio_dev->mlock); | 595 | mutex_lock(&indio_dev->mlock); |
594 | /* Need both the number of taps and the sampling frequency */ | 596 | /* Need both the number of taps and the sampling frequency */ |
@@ -1035,7 +1037,7 @@ static const struct iio_chan_spec adis16334_channels[] = { | |||
1035 | .indexed = 1, | 1037 | .indexed = 1, |
1036 | .channel = 0, | 1038 | .channel = 0, |
1037 | .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | | 1039 | .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | |
1038 | IIO_CHAN_INFO_CALIBBIAS_SEPARATE_BIT | | 1040 | IIO_CHAN_INFO_OFFSET_SEPARATE_BIT | |
1039 | IIO_CHAN_INFO_SCALE_SHARED_BIT, | 1041 | IIO_CHAN_INFO_SCALE_SHARED_BIT, |
1040 | .address = temp0, | 1042 | .address = temp0, |
1041 | .scan_index = ADIS16400_SCAN_TEMP, | 1043 | .scan_index = ADIS16400_SCAN_TEMP, |
@@ -1058,8 +1060,10 @@ static struct adis16400_chip_info adis16400_chips[] = { | |||
1058 | [ADIS16300] = { | 1060 | [ADIS16300] = { |
1059 | .channels = adis16300_channels, | 1061 | .channels = adis16300_channels, |
1060 | .num_channels = ARRAY_SIZE(adis16300_channels), | 1062 | .num_channels = ARRAY_SIZE(adis16300_channels), |
1061 | .gyro_scale_micro = 873, | 1063 | .gyro_scale_micro = IIO_DEGREE_TO_RAD(50000), /* 0.05 deg/s */ |
1062 | .accel_scale_micro = 5884, | 1064 | .accel_scale_micro = 5884, |
1065 | .temp_scale_nano = 140000000, /* 0.14 C */ | ||
1066 | .temp_offset = 25000000 / 140000, /* 25 C = 0x00 */ | ||
1063 | .default_scan_mask = (1 << ADIS16400_SCAN_SUPPLY) | | 1067 | .default_scan_mask = (1 << ADIS16400_SCAN_SUPPLY) | |
1064 | (1 << ADIS16400_SCAN_GYRO_X) | (1 << ADIS16400_SCAN_ACC_X) | | 1068 | (1 << ADIS16400_SCAN_GYRO_X) | (1 << ADIS16400_SCAN_ACC_X) | |
1065 | (1 << ADIS16400_SCAN_ACC_Y) | (1 << ADIS16400_SCAN_ACC_Z) | | 1069 | (1 << ADIS16400_SCAN_ACC_Y) | (1 << ADIS16400_SCAN_ACC_Z) | |
@@ -1070,8 +1074,10 @@ static struct adis16400_chip_info adis16400_chips[] = { | |||
1070 | [ADIS16334] = { | 1074 | [ADIS16334] = { |
1071 | .channels = adis16334_channels, | 1075 | .channels = adis16334_channels, |
1072 | .num_channels = ARRAY_SIZE(adis16334_channels), | 1076 | .num_channels = ARRAY_SIZE(adis16334_channels), |
1073 | .gyro_scale_micro = 873, | 1077 | .gyro_scale_micro = IIO_DEGREE_TO_RAD(50000), /* 0.05 deg/s */ |
1074 | .accel_scale_micro = 981, | 1078 | .accel_scale_micro = IIO_G_TO_M_S_2(1000), /* 1 mg */ |
1079 | .temp_scale_nano = 67850000, /* 0.06785 C */ | ||
1080 | .temp_offset = 25000000 / 67850, /* 25 C = 0x00 */ | ||
1075 | .default_scan_mask = (1 << ADIS16400_SCAN_GYRO_X) | | 1081 | .default_scan_mask = (1 << ADIS16400_SCAN_GYRO_X) | |
1076 | (1 << ADIS16400_SCAN_GYRO_Y) | (1 << ADIS16400_SCAN_GYRO_Z) | | 1082 | (1 << ADIS16400_SCAN_GYRO_Y) | (1 << ADIS16400_SCAN_GYRO_Z) | |
1077 | (1 << ADIS16400_SCAN_ACC_X) | (1 << ADIS16400_SCAN_ACC_Y) | | 1083 | (1 << ADIS16400_SCAN_ACC_X) | (1 << ADIS16400_SCAN_ACC_Y) | |
@@ -1080,8 +1086,10 @@ static struct adis16400_chip_info adis16400_chips[] = { | |||
1080 | [ADIS16350] = { | 1086 | [ADIS16350] = { |
1081 | .channels = adis16350_channels, | 1087 | .channels = adis16350_channels, |
1082 | .num_channels = ARRAY_SIZE(adis16350_channels), | 1088 | .num_channels = ARRAY_SIZE(adis16350_channels), |
1083 | .gyro_scale_micro = 872664, | 1089 | .gyro_scale_micro = IIO_DEGREE_TO_RAD(73260), /* 0.07326 deg/s */ |
1084 | .accel_scale_micro = 24732, | 1090 | .accel_scale_micro = IIO_G_TO_M_S_2(2522), /* 0.002522 g */ |
1091 | .temp_scale_nano = 145300000, /* 0.1453 C */ | ||
1092 | .temp_offset = 25000000 / 145300, /* 25 C = 0x00 */ | ||
1085 | .default_scan_mask = 0x7FF, | 1093 | .default_scan_mask = 0x7FF, |
1086 | .flags = ADIS16400_NO_BURST, | 1094 | .flags = ADIS16400_NO_BURST, |
1087 | }, | 1095 | }, |
@@ -1090,8 +1098,10 @@ static struct adis16400_chip_info adis16400_chips[] = { | |||
1090 | .num_channels = ARRAY_SIZE(adis16350_channels), | 1098 | .num_channels = ARRAY_SIZE(adis16350_channels), |
1091 | .flags = ADIS16400_HAS_PROD_ID, | 1099 | .flags = ADIS16400_HAS_PROD_ID, |
1092 | .product_id = 0x3FE8, | 1100 | .product_id = 0x3FE8, |
1093 | .gyro_scale_micro = 1279, | 1101 | .gyro_scale_micro = IIO_DEGREE_TO_RAD(50000), /* 0.05 deg/s */ |
1094 | .accel_scale_micro = 24732, | 1102 | .accel_scale_micro = IIO_G_TO_M_S_2(3333), /* 3.333 mg */ |
1103 | .temp_scale_nano = 136000000, /* 0.136 C */ | ||
1104 | .temp_offset = 25000000 / 136000, /* 25 C = 0x00 */ | ||
1095 | .default_scan_mask = 0x7FF, | 1105 | .default_scan_mask = 0x7FF, |
1096 | }, | 1106 | }, |
1097 | [ADIS16362] = { | 1107 | [ADIS16362] = { |
@@ -1099,8 +1109,10 @@ static struct adis16400_chip_info adis16400_chips[] = { | |||
1099 | .num_channels = ARRAY_SIZE(adis16350_channels), | 1109 | .num_channels = ARRAY_SIZE(adis16350_channels), |
1100 | .flags = ADIS16400_HAS_PROD_ID, | 1110 | .flags = ADIS16400_HAS_PROD_ID, |
1101 | .product_id = 0x3FEA, | 1111 | .product_id = 0x3FEA, |
1102 | .gyro_scale_micro = 1279, | 1112 | .gyro_scale_micro = IIO_DEGREE_TO_RAD(50000), /* 0.05 deg/s */ |
1103 | .accel_scale_micro = 24732, | 1113 | .accel_scale_micro = IIO_G_TO_M_S_2(333), /* 0.333 mg */ |
1114 | .temp_scale_nano = 136000000, /* 0.136 C */ | ||
1115 | .temp_offset = 25000000 / 136000, /* 25 C = 0x00 */ | ||
1104 | .default_scan_mask = 0x7FF, | 1116 | .default_scan_mask = 0x7FF, |
1105 | }, | 1117 | }, |
1106 | [ADIS16364] = { | 1118 | [ADIS16364] = { |
@@ -1108,8 +1120,10 @@ static struct adis16400_chip_info adis16400_chips[] = { | |||
1108 | .num_channels = ARRAY_SIZE(adis16350_channels), | 1120 | .num_channels = ARRAY_SIZE(adis16350_channels), |
1109 | .flags = ADIS16400_HAS_PROD_ID, | 1121 | .flags = ADIS16400_HAS_PROD_ID, |
1110 | .product_id = 0x3FEC, | 1122 | .product_id = 0x3FEC, |
1111 | .gyro_scale_micro = 1279, | 1123 | .gyro_scale_micro = IIO_DEGREE_TO_RAD(50000), /* 0.05 deg/s */ |
1112 | .accel_scale_micro = 24732, | 1124 | .accel_scale_micro = IIO_G_TO_M_S_2(1000), /* 1 mg */ |
1125 | .temp_scale_nano = 136000000, /* 0.136 C */ | ||
1126 | .temp_offset = 25000000 / 136000, /* 25 C = 0x00 */ | ||
1113 | .default_scan_mask = 0x7FF, | 1127 | .default_scan_mask = 0x7FF, |
1114 | }, | 1128 | }, |
1115 | [ADIS16365] = { | 1129 | [ADIS16365] = { |
@@ -1117,8 +1131,10 @@ static struct adis16400_chip_info adis16400_chips[] = { | |||
1117 | .num_channels = ARRAY_SIZE(adis16350_channels), | 1131 | .num_channels = ARRAY_SIZE(adis16350_channels), |
1118 | .flags = ADIS16400_HAS_PROD_ID, | 1132 | .flags = ADIS16400_HAS_PROD_ID, |
1119 | .product_id = 0x3FED, | 1133 | .product_id = 0x3FED, |
1120 | .gyro_scale_micro = 1279, | 1134 | .gyro_scale_micro = IIO_DEGREE_TO_RAD(50000), /* 0.05 deg/s */ |
1121 | .accel_scale_micro = 24732, | 1135 | .accel_scale_micro = IIO_G_TO_M_S_2(1000), /* 1 mg */ |
1136 | .temp_scale_nano = 136000000, /* 0.136 C */ | ||
1137 | .temp_offset = 25000000 / 136000, /* 25 C = 0x00 */ | ||
1122 | .default_scan_mask = 0x7FF, | 1138 | .default_scan_mask = 0x7FF, |
1123 | }, | 1139 | }, |
1124 | [ADIS16400] = { | 1140 | [ADIS16400] = { |
@@ -1126,9 +1142,11 @@ static struct adis16400_chip_info adis16400_chips[] = { | |||
1126 | .num_channels = ARRAY_SIZE(adis16400_channels), | 1142 | .num_channels = ARRAY_SIZE(adis16400_channels), |
1127 | .flags = ADIS16400_HAS_PROD_ID, | 1143 | .flags = ADIS16400_HAS_PROD_ID, |
1128 | .product_id = 0x4015, | 1144 | .product_id = 0x4015, |
1129 | .gyro_scale_micro = 873, | 1145 | .gyro_scale_micro = IIO_DEGREE_TO_RAD(50000), /* 0.05 deg/s */ |
1130 | .accel_scale_micro = 32656, | 1146 | .accel_scale_micro = IIO_G_TO_M_S_2(3333), /* 3.333 mg */ |
1131 | .default_scan_mask = 0xFFF, | 1147 | .default_scan_mask = 0xFFF, |
1148 | .temp_scale_nano = 140000000, /* 0.14 C */ | ||
1149 | .temp_offset = 25000000 / 140000, /* 25 C = 0x00 */ | ||
1132 | } | 1150 | } |
1133 | }; | 1151 | }; |
1134 | 1152 | ||
diff --git a/drivers/staging/ipack/bridges/tpci200.c b/drivers/staging/ipack/bridges/tpci200.c index bb8aa70281cd..46d6657280b8 100644 --- a/drivers/staging/ipack/bridges/tpci200.c +++ b/drivers/staging/ipack/bridges/tpci200.c | |||
@@ -12,6 +12,7 @@ | |||
12 | */ | 12 | */ |
13 | 13 | ||
14 | #include <linux/module.h> | 14 | #include <linux/module.h> |
15 | #include <linux/slab.h> | ||
15 | #include "tpci200.h" | 16 | #include "tpci200.h" |
16 | 17 | ||
17 | static u16 tpci200_status_timeout[] = { | 18 | static u16 tpci200_status_timeout[] = { |
diff --git a/drivers/staging/omapdrm/omap_gem.c b/drivers/staging/omapdrm/omap_gem.c index 3434e6ec0142..66e2c2f8a239 100644 --- a/drivers/staging/omapdrm/omap_gem.c +++ b/drivers/staging/omapdrm/omap_gem.c | |||
@@ -246,7 +246,7 @@ static int omap_gem_attach_pages(struct drm_gem_object *obj) | |||
246 | * DSS, GPU, etc. are not cache coherent: | 246 | * DSS, GPU, etc. are not cache coherent: |
247 | */ | 247 | */ |
248 | if (omap_obj->flags & (OMAP_BO_WC|OMAP_BO_UNCACHED)) { | 248 | if (omap_obj->flags & (OMAP_BO_WC|OMAP_BO_UNCACHED)) { |
249 | addrs = kmalloc(npages * sizeof(addrs), GFP_KERNEL); | 249 | addrs = kmalloc(npages * sizeof(*addrs), GFP_KERNEL); |
250 | if (!addrs) { | 250 | if (!addrs) { |
251 | ret = -ENOMEM; | 251 | ret = -ENOMEM; |
252 | goto free_pages; | 252 | goto free_pages; |
@@ -257,7 +257,7 @@ static int omap_gem_attach_pages(struct drm_gem_object *obj) | |||
257 | 0, PAGE_SIZE, DMA_BIDIRECTIONAL); | 257 | 0, PAGE_SIZE, DMA_BIDIRECTIONAL); |
258 | } | 258 | } |
259 | } else { | 259 | } else { |
260 | addrs = kzalloc(npages * sizeof(addrs), GFP_KERNEL); | 260 | addrs = kzalloc(npages * sizeof(*addrs), GFP_KERNEL); |
261 | if (!addrs) { | 261 | if (!addrs) { |
262 | ret = -ENOMEM; | 262 | ret = -ENOMEM; |
263 | goto free_pages; | 263 | goto free_pages; |
diff --git a/drivers/staging/ramster/Kconfig b/drivers/staging/ramster/Kconfig index 843c54101438..3abf6619dace 100644 --- a/drivers/staging/ramster/Kconfig +++ b/drivers/staging/ramster/Kconfig | |||
@@ -18,6 +18,7 @@ config ZCACHE2 | |||
18 | config RAMSTER | 18 | config RAMSTER |
19 | bool "Cross-machine RAM capacity sharing, aka peer-to-peer tmem" | 19 | bool "Cross-machine RAM capacity sharing, aka peer-to-peer tmem" |
20 | depends on CONFIGFS_FS=y && SYSFS=y && !HIGHMEM && ZCACHE2=y | 20 | depends on CONFIGFS_FS=y && SYSFS=y && !HIGHMEM && ZCACHE2=y |
21 | depends on NET | ||
21 | # must ensure struct page is 8-byte aligned | 22 | # must ensure struct page is 8-byte aligned |
22 | select HAVE_ALIGNED_STRUCT_PAGE if !64_BIT | 23 | select HAVE_ALIGNED_STRUCT_PAGE if !64_BIT |
23 | default n | 24 | default n |
diff --git a/drivers/staging/tidspbridge/core/tiomap3430.c b/drivers/staging/tidspbridge/core/tiomap3430.c index 066a3ceec65e..f619fb3c56d2 100644 --- a/drivers/staging/tidspbridge/core/tiomap3430.c +++ b/drivers/staging/tidspbridge/core/tiomap3430.c | |||
@@ -126,7 +126,8 @@ static int mem_map_vmalloc(struct bridge_dev_context *dev_context, | |||
126 | u32 ul_num_bytes, | 126 | u32 ul_num_bytes, |
127 | struct hw_mmu_map_attrs_t *hw_attrs); | 127 | struct hw_mmu_map_attrs_t *hw_attrs); |
128 | 128 | ||
129 | bool wait_for_start(struct bridge_dev_context *dev_context, u32 dw_sync_addr); | 129 | bool wait_for_start(struct bridge_dev_context *dev_context, |
130 | void __iomem *sync_addr); | ||
130 | 131 | ||
131 | /* ----------------------------------- Globals */ | 132 | /* ----------------------------------- Globals */ |
132 | 133 | ||
@@ -363,10 +364,11 @@ static int bridge_brd_start(struct bridge_dev_context *dev_ctxt, | |||
363 | { | 364 | { |
364 | int status = 0; | 365 | int status = 0; |
365 | struct bridge_dev_context *dev_context = dev_ctxt; | 366 | struct bridge_dev_context *dev_context = dev_ctxt; |
366 | u32 dw_sync_addr = 0; | 367 | void __iomem *sync_addr; |
367 | u32 ul_shm_base; /* Gpp Phys SM base addr(byte) */ | 368 | u32 ul_shm_base; /* Gpp Phys SM base addr(byte) */ |
368 | u32 ul_shm_base_virt; /* Dsp Virt SM base addr */ | 369 | u32 ul_shm_base_virt; /* Dsp Virt SM base addr */ |
369 | u32 ul_tlb_base_virt; /* Base of MMU TLB entry */ | 370 | u32 ul_tlb_base_virt; /* Base of MMU TLB entry */ |
371 | u32 shm_sync_pa; | ||
370 | /* Offset of shm_base_virt from tlb_base_virt */ | 372 | /* Offset of shm_base_virt from tlb_base_virt */ |
371 | u32 ul_shm_offset_virt; | 373 | u32 ul_shm_offset_virt; |
372 | s32 entry_ndx; | 374 | s32 entry_ndx; |
@@ -397,15 +399,22 @@ static int bridge_brd_start(struct bridge_dev_context *dev_ctxt, | |||
397 | /* Kernel logical address */ | 399 | /* Kernel logical address */ |
398 | ul_shm_base = dev_context->atlb_entry[0].gpp_va + ul_shm_offset_virt; | 400 | ul_shm_base = dev_context->atlb_entry[0].gpp_va + ul_shm_offset_virt; |
399 | 401 | ||
402 | /* SHM physical sync address */ | ||
403 | shm_sync_pa = dev_context->atlb_entry[0].gpp_pa + ul_shm_offset_virt + | ||
404 | SHMSYNCOFFSET; | ||
405 | |||
400 | /* 2nd wd is used as sync field */ | 406 | /* 2nd wd is used as sync field */ |
401 | dw_sync_addr = ul_shm_base + SHMSYNCOFFSET; | 407 | sync_addr = ioremap(shm_sync_pa, SZ_32); |
408 | if (!sync_addr) | ||
409 | return -ENOMEM; | ||
410 | |||
402 | /* Write a signature into the shm base + offset; this will | 411 | /* Write a signature into the shm base + offset; this will |
403 | * get cleared when the DSP program starts. */ | 412 | * get cleared when the DSP program starts. */ |
404 | if ((ul_shm_base_virt == 0) || (ul_shm_base == 0)) { | 413 | if ((ul_shm_base_virt == 0) || (ul_shm_base == 0)) { |
405 | pr_err("%s: Illegal SM base\n", __func__); | 414 | pr_err("%s: Illegal SM base\n", __func__); |
406 | status = -EPERM; | 415 | status = -EPERM; |
407 | } else | 416 | } else |
408 | __raw_writel(0xffffffff, dw_sync_addr); | 417 | __raw_writel(0xffffffff, sync_addr); |
409 | 418 | ||
410 | if (!status) { | 419 | if (!status) { |
411 | resources = dev_context->resources; | 420 | resources = dev_context->resources; |
@@ -419,8 +428,10 @@ static int bridge_brd_start(struct bridge_dev_context *dev_ctxt, | |||
419 | * function is made available. | 428 | * function is made available. |
420 | */ | 429 | */ |
421 | void __iomem *ctrl = ioremap(0x48002000, SZ_4K); | 430 | void __iomem *ctrl = ioremap(0x48002000, SZ_4K); |
422 | if (!ctrl) | 431 | if (!ctrl) { |
432 | iounmap(sync_addr); | ||
423 | return -ENOMEM; | 433 | return -ENOMEM; |
434 | } | ||
424 | 435 | ||
425 | (*pdata->dsp_prm_rmw_bits)(OMAP3430_RST1_IVA2_MASK, | 436 | (*pdata->dsp_prm_rmw_bits)(OMAP3430_RST1_IVA2_MASK, |
426 | OMAP3430_RST1_IVA2_MASK, OMAP3430_IVA2_MOD, | 437 | OMAP3430_RST1_IVA2_MASK, OMAP3430_IVA2_MOD, |
@@ -588,15 +599,15 @@ static int bridge_brd_start(struct bridge_dev_context *dev_ctxt, | |||
588 | (*pdata->dsp_prm_rmw_bits)(OMAP3430_RST1_IVA2_MASK, 0, | 599 | (*pdata->dsp_prm_rmw_bits)(OMAP3430_RST1_IVA2_MASK, 0, |
589 | OMAP3430_IVA2_MOD, OMAP2_RM_RSTCTRL); | 600 | OMAP3430_IVA2_MOD, OMAP2_RM_RSTCTRL); |
590 | 601 | ||
591 | dev_dbg(bridge, "Waiting for Sync @ 0x%x\n", dw_sync_addr); | 602 | dev_dbg(bridge, "Waiting for Sync @ 0x%x\n", *(u32 *)sync_addr); |
592 | dev_dbg(bridge, "DSP c_int00 Address = 0x%x\n", dsp_addr); | 603 | dev_dbg(bridge, "DSP c_int00 Address = 0x%x\n", dsp_addr); |
593 | if (dsp_debug) | 604 | if (dsp_debug) |
594 | while (__raw_readw(dw_sync_addr)) | 605 | while (__raw_readw(sync_addr)) |
595 | ; | 606 | ; |
596 | 607 | ||
597 | /* Wait for DSP to clear word in shared memory */ | 608 | /* Wait for DSP to clear word in shared memory */ |
598 | /* Read the Location */ | 609 | /* Read the Location */ |
599 | if (!wait_for_start(dev_context, dw_sync_addr)) | 610 | if (!wait_for_start(dev_context, sync_addr)) |
600 | status = -ETIMEDOUT; | 611 | status = -ETIMEDOUT; |
601 | 612 | ||
602 | dev_get_symbol(dev_context->dev_obj, "_WDT_enable", &wdt_en); | 613 | dev_get_symbol(dev_context->dev_obj, "_WDT_enable", &wdt_en); |
@@ -612,7 +623,7 @@ static int bridge_brd_start(struct bridge_dev_context *dev_ctxt, | |||
612 | /* Write the synchronization bit to indicate the | 623 | /* Write the synchronization bit to indicate the |
613 | * completion of OPP table update to DSP | 624 | * completion of OPP table update to DSP |
614 | */ | 625 | */ |
615 | __raw_writel(0XCAFECAFE, dw_sync_addr); | 626 | __raw_writel(0XCAFECAFE, sync_addr); |
616 | 627 | ||
617 | /* update board state */ | 628 | /* update board state */ |
618 | dev_context->brd_state = BRD_RUNNING; | 629 | dev_context->brd_state = BRD_RUNNING; |
@@ -621,6 +632,9 @@ static int bridge_brd_start(struct bridge_dev_context *dev_ctxt, | |||
621 | dev_context->brd_state = BRD_UNKNOWN; | 632 | dev_context->brd_state = BRD_UNKNOWN; |
622 | } | 633 | } |
623 | } | 634 | } |
635 | |||
636 | iounmap(sync_addr); | ||
637 | |||
624 | return status; | 638 | return status; |
625 | } | 639 | } |
626 | 640 | ||
@@ -1796,12 +1810,13 @@ static int mem_map_vmalloc(struct bridge_dev_context *dev_context, | |||
1796 | * ======== wait_for_start ======== | 1810 | * ======== wait_for_start ======== |
1797 | * Wait for the singal from DSP that it has started, or time out. | 1811 | * Wait for the singal from DSP that it has started, or time out. |
1798 | */ | 1812 | */ |
1799 | bool wait_for_start(struct bridge_dev_context *dev_context, u32 dw_sync_addr) | 1813 | bool wait_for_start(struct bridge_dev_context *dev_context, |
1814 | void __iomem *sync_addr) | ||
1800 | { | 1815 | { |
1801 | u16 timeout = TIHELEN_ACKTIMEOUT; | 1816 | u16 timeout = TIHELEN_ACKTIMEOUT; |
1802 | 1817 | ||
1803 | /* Wait for response from board */ | 1818 | /* Wait for response from board */ |
1804 | while (__raw_readw(dw_sync_addr) && --timeout) | 1819 | while (__raw_readw(sync_addr) && --timeout) |
1805 | udelay(10); | 1820 | udelay(10); |
1806 | 1821 | ||
1807 | /* If timed out: return false */ | 1822 | /* If timed out: return false */ |
diff --git a/drivers/staging/tidspbridge/hw/hw_mmu.c b/drivers/staging/tidspbridge/hw/hw_mmu.c index 71cb82293649..50244a474178 100644 --- a/drivers/staging/tidspbridge/hw/hw_mmu.c +++ b/drivers/staging/tidspbridge/hw/hw_mmu.c | |||
@@ -48,37 +48,12 @@ enum hw_mmu_page_size_t { | |||
48 | }; | 48 | }; |
49 | 49 | ||
50 | /* | 50 | /* |
51 | * FUNCTION : mmu_flush_entry | ||
52 | * | ||
53 | * INPUTS: | ||
54 | * | ||
55 | * Identifier : base_address | ||
56 | * Type : const u32 | ||
57 | * Description : Base Address of instance of MMU module | ||
58 | * | ||
59 | * RETURNS: | ||
60 | * | ||
61 | * Type : hw_status | ||
62 | * Description : 0 -- No errors occurred | ||
63 | * RET_BAD_NULL_PARAM -- A Pointer | ||
64 | * Parameter was set to NULL | ||
65 | * | ||
66 | * PURPOSE: : Flush the TLB entry pointed by the | ||
67 | * lock counter register | ||
68 | * even if this entry is set protected | ||
69 | * | ||
70 | * METHOD: : Check the Input parameter and Flush a | ||
71 | * single entry in the TLB. | ||
72 | */ | ||
73 | static hw_status mmu_flush_entry(const void __iomem *base_address); | ||
74 | |||
75 | /* | ||
76 | * FUNCTION : mmu_set_cam_entry | 51 | * FUNCTION : mmu_set_cam_entry |
77 | * | 52 | * |
78 | * INPUTS: | 53 | * INPUTS: |
79 | * | 54 | * |
80 | * Identifier : base_address | 55 | * Identifier : base_address |
81 | * TypE : const u32 | 56 | * Type : void __iomem * |
82 | * Description : Base Address of instance of MMU module | 57 | * Description : Base Address of instance of MMU module |
83 | * | 58 | * |
84 | * Identifier : page_sz | 59 | * Identifier : page_sz |
@@ -112,7 +87,7 @@ static hw_status mmu_flush_entry(const void __iomem *base_address); | |||
112 | * | 87 | * |
113 | * METHOD: : Check the Input parameters and set the CAM entry. | 88 | * METHOD: : Check the Input parameters and set the CAM entry. |
114 | */ | 89 | */ |
115 | static hw_status mmu_set_cam_entry(const void __iomem *base_address, | 90 | static hw_status mmu_set_cam_entry(void __iomem *base_address, |
116 | const u32 page_sz, | 91 | const u32 page_sz, |
117 | const u32 preserved_bit, | 92 | const u32 preserved_bit, |
118 | const u32 valid_bit, | 93 | const u32 valid_bit, |
@@ -124,7 +99,7 @@ static hw_status mmu_set_cam_entry(const void __iomem *base_address, | |||
124 | * INPUTS: | 99 | * INPUTS: |
125 | * | 100 | * |
126 | * Identifier : base_address | 101 | * Identifier : base_address |
127 | * Type : const u32 | 102 | * Type : void __iomem * |
128 | * Description : Base Address of instance of MMU module | 103 | * Description : Base Address of instance of MMU module |
129 | * | 104 | * |
130 | * Identifier : physical_addr | 105 | * Identifier : physical_addr |
@@ -157,7 +132,7 @@ static hw_status mmu_set_cam_entry(const void __iomem *base_address, | |||
157 | * | 132 | * |
158 | * METHOD: : Check the Input parameters and set the RAM entry. | 133 | * METHOD: : Check the Input parameters and set the RAM entry. |
159 | */ | 134 | */ |
160 | static hw_status mmu_set_ram_entry(const void __iomem *base_address, | 135 | static hw_status mmu_set_ram_entry(void __iomem *base_address, |
161 | const u32 physical_addr, | 136 | const u32 physical_addr, |
162 | enum hw_endianism_t endianism, | 137 | enum hw_endianism_t endianism, |
163 | enum hw_element_size_t element_size, | 138 | enum hw_element_size_t element_size, |
@@ -165,7 +140,7 @@ static hw_status mmu_set_ram_entry(const void __iomem *base_address, | |||
165 | 140 | ||
166 | /* HW FUNCTIONS */ | 141 | /* HW FUNCTIONS */ |
167 | 142 | ||
168 | hw_status hw_mmu_enable(const void __iomem *base_address) | 143 | hw_status hw_mmu_enable(void __iomem *base_address) |
169 | { | 144 | { |
170 | hw_status status = 0; | 145 | hw_status status = 0; |
171 | 146 | ||
@@ -174,7 +149,7 @@ hw_status hw_mmu_enable(const void __iomem *base_address) | |||
174 | return status; | 149 | return status; |
175 | } | 150 | } |
176 | 151 | ||
177 | hw_status hw_mmu_disable(const void __iomem *base_address) | 152 | hw_status hw_mmu_disable(void __iomem *base_address) |
178 | { | 153 | { |
179 | hw_status status = 0; | 154 | hw_status status = 0; |
180 | 155 | ||
@@ -183,7 +158,7 @@ hw_status hw_mmu_disable(const void __iomem *base_address) | |||
183 | return status; | 158 | return status; |
184 | } | 159 | } |
185 | 160 | ||
186 | hw_status hw_mmu_num_locked_set(const void __iomem *base_address, | 161 | hw_status hw_mmu_num_locked_set(void __iomem *base_address, |
187 | u32 num_locked_entries) | 162 | u32 num_locked_entries) |
188 | { | 163 | { |
189 | hw_status status = 0; | 164 | hw_status status = 0; |
@@ -193,7 +168,7 @@ hw_status hw_mmu_num_locked_set(const void __iomem *base_address, | |||
193 | return status; | 168 | return status; |
194 | } | 169 | } |
195 | 170 | ||
196 | hw_status hw_mmu_victim_num_set(const void __iomem *base_address, | 171 | hw_status hw_mmu_victim_num_set(void __iomem *base_address, |
197 | u32 victim_entry_num) | 172 | u32 victim_entry_num) |
198 | { | 173 | { |
199 | hw_status status = 0; | 174 | hw_status status = 0; |
@@ -203,7 +178,7 @@ hw_status hw_mmu_victim_num_set(const void __iomem *base_address, | |||
203 | return status; | 178 | return status; |
204 | } | 179 | } |
205 | 180 | ||
206 | hw_status hw_mmu_event_ack(const void __iomem *base_address, u32 irq_mask) | 181 | hw_status hw_mmu_event_ack(void __iomem *base_address, u32 irq_mask) |
207 | { | 182 | { |
208 | hw_status status = 0; | 183 | hw_status status = 0; |
209 | 184 | ||
@@ -212,7 +187,7 @@ hw_status hw_mmu_event_ack(const void __iomem *base_address, u32 irq_mask) | |||
212 | return status; | 187 | return status; |
213 | } | 188 | } |
214 | 189 | ||
215 | hw_status hw_mmu_event_disable(const void __iomem *base_address, u32 irq_mask) | 190 | hw_status hw_mmu_event_disable(void __iomem *base_address, u32 irq_mask) |
216 | { | 191 | { |
217 | hw_status status = 0; | 192 | hw_status status = 0; |
218 | u32 irq_reg; | 193 | u32 irq_reg; |
@@ -224,7 +199,7 @@ hw_status hw_mmu_event_disable(const void __iomem *base_address, u32 irq_mask) | |||
224 | return status; | 199 | return status; |
225 | } | 200 | } |
226 | 201 | ||
227 | hw_status hw_mmu_event_enable(const void __iomem *base_address, u32 irq_mask) | 202 | hw_status hw_mmu_event_enable(void __iomem *base_address, u32 irq_mask) |
228 | { | 203 | { |
229 | hw_status status = 0; | 204 | hw_status status = 0; |
230 | u32 irq_reg; | 205 | u32 irq_reg; |
@@ -236,7 +211,7 @@ hw_status hw_mmu_event_enable(const void __iomem *base_address, u32 irq_mask) | |||
236 | return status; | 211 | return status; |
237 | } | 212 | } |
238 | 213 | ||
239 | hw_status hw_mmu_event_status(const void __iomem *base_address, u32 *irq_mask) | 214 | hw_status hw_mmu_event_status(void __iomem *base_address, u32 *irq_mask) |
240 | { | 215 | { |
241 | hw_status status = 0; | 216 | hw_status status = 0; |
242 | 217 | ||
@@ -245,7 +220,7 @@ hw_status hw_mmu_event_status(const void __iomem *base_address, u32 *irq_mask) | |||
245 | return status; | 220 | return status; |
246 | } | 221 | } |
247 | 222 | ||
248 | hw_status hw_mmu_fault_addr_read(const void __iomem *base_address, u32 *addr) | 223 | hw_status hw_mmu_fault_addr_read(void __iomem *base_address, u32 *addr) |
249 | { | 224 | { |
250 | hw_status status = 0; | 225 | hw_status status = 0; |
251 | 226 | ||
@@ -255,7 +230,7 @@ hw_status hw_mmu_fault_addr_read(const void __iomem *base_address, u32 *addr) | |||
255 | return status; | 230 | return status; |
256 | } | 231 | } |
257 | 232 | ||
258 | hw_status hw_mmu_ttb_set(const void __iomem *base_address, u32 ttb_phys_addr) | 233 | hw_status hw_mmu_ttb_set(void __iomem *base_address, u32 ttb_phys_addr) |
259 | { | 234 | { |
260 | hw_status status = 0; | 235 | hw_status status = 0; |
261 | u32 load_ttb; | 236 | u32 load_ttb; |
@@ -267,7 +242,7 @@ hw_status hw_mmu_ttb_set(const void __iomem *base_address, u32 ttb_phys_addr) | |||
267 | return status; | 242 | return status; |
268 | } | 243 | } |
269 | 244 | ||
270 | hw_status hw_mmu_twl_enable(const void __iomem *base_address) | 245 | hw_status hw_mmu_twl_enable(void __iomem *base_address) |
271 | { | 246 | { |
272 | hw_status status = 0; | 247 | hw_status status = 0; |
273 | 248 | ||
@@ -276,7 +251,7 @@ hw_status hw_mmu_twl_enable(const void __iomem *base_address) | |||
276 | return status; | 251 | return status; |
277 | } | 252 | } |
278 | 253 | ||
279 | hw_status hw_mmu_twl_disable(const void __iomem *base_address) | 254 | hw_status hw_mmu_twl_disable(void __iomem *base_address) |
280 | { | 255 | { |
281 | hw_status status = 0; | 256 | hw_status status = 0; |
282 | 257 | ||
@@ -285,45 +260,7 @@ hw_status hw_mmu_twl_disable(const void __iomem *base_address) | |||
285 | return status; | 260 | return status; |
286 | } | 261 | } |
287 | 262 | ||
288 | hw_status hw_mmu_tlb_flush(const void __iomem *base_address, u32 virtual_addr, | 263 | hw_status hw_mmu_tlb_add(void __iomem *base_address, |
289 | u32 page_sz) | ||
290 | { | ||
291 | hw_status status = 0; | ||
292 | u32 virtual_addr_tag; | ||
293 | enum hw_mmu_page_size_t pg_size_bits; | ||
294 | |||
295 | switch (page_sz) { | ||
296 | case HW_PAGE_SIZE4KB: | ||
297 | pg_size_bits = HW_MMU_SMALL_PAGE; | ||
298 | break; | ||
299 | |||
300 | case HW_PAGE_SIZE64KB: | ||
301 | pg_size_bits = HW_MMU_LARGE_PAGE; | ||
302 | break; | ||
303 | |||
304 | case HW_PAGE_SIZE1MB: | ||
305 | pg_size_bits = HW_MMU_SECTION; | ||
306 | break; | ||
307 | |||
308 | case HW_PAGE_SIZE16MB: | ||
309 | pg_size_bits = HW_MMU_SUPERSECTION; | ||
310 | break; | ||
311 | |||
312 | default: | ||
313 | return -EINVAL; | ||
314 | } | ||
315 | |||
316 | /* Generate the 20-bit tag from virtual address */ | ||
317 | virtual_addr_tag = ((virtual_addr & MMU_ADDR_MASK) >> 12); | ||
318 | |||
319 | mmu_set_cam_entry(base_address, pg_size_bits, 0, 0, virtual_addr_tag); | ||
320 | |||
321 | mmu_flush_entry(base_address); | ||
322 | |||
323 | return status; | ||
324 | } | ||
325 | |||
326 | hw_status hw_mmu_tlb_add(const void __iomem *base_address, | ||
327 | u32 physical_addr, | 264 | u32 physical_addr, |
328 | u32 virtual_addr, | 265 | u32 virtual_addr, |
329 | u32 page_sz, | 266 | u32 page_sz, |
@@ -503,20 +440,8 @@ hw_status hw_mmu_pte_clear(const u32 pg_tbl_va, u32 virtual_addr, u32 page_size) | |||
503 | return status; | 440 | return status; |
504 | } | 441 | } |
505 | 442 | ||
506 | /* mmu_flush_entry */ | ||
507 | static hw_status mmu_flush_entry(const void __iomem *base_address) | ||
508 | { | ||
509 | hw_status status = 0; | ||
510 | u32 flush_entry_data = 0x1; | ||
511 | |||
512 | /* write values to register */ | ||
513 | MMUMMU_FLUSH_ENTRY_WRITE_REGISTER32(base_address, flush_entry_data); | ||
514 | |||
515 | return status; | ||
516 | } | ||
517 | |||
518 | /* mmu_set_cam_entry */ | 443 | /* mmu_set_cam_entry */ |
519 | static hw_status mmu_set_cam_entry(const void __iomem *base_address, | 444 | static hw_status mmu_set_cam_entry(void __iomem *base_address, |
520 | const u32 page_sz, | 445 | const u32 page_sz, |
521 | const u32 preserved_bit, | 446 | const u32 preserved_bit, |
522 | const u32 valid_bit, | 447 | const u32 valid_bit, |
@@ -536,7 +461,7 @@ static hw_status mmu_set_cam_entry(const void __iomem *base_address, | |||
536 | } | 461 | } |
537 | 462 | ||
538 | /* mmu_set_ram_entry */ | 463 | /* mmu_set_ram_entry */ |
539 | static hw_status mmu_set_ram_entry(const void __iomem *base_address, | 464 | static hw_status mmu_set_ram_entry(void __iomem *base_address, |
540 | const u32 physical_addr, | 465 | const u32 physical_addr, |
541 | enum hw_endianism_t endianism, | 466 | enum hw_endianism_t endianism, |
542 | enum hw_element_size_t element_size, | 467 | enum hw_element_size_t element_size, |
@@ -556,7 +481,7 @@ static hw_status mmu_set_ram_entry(const void __iomem *base_address, | |||
556 | 481 | ||
557 | } | 482 | } |
558 | 483 | ||
559 | void hw_mmu_tlb_flush_all(const void __iomem *base) | 484 | void hw_mmu_tlb_flush_all(void __iomem *base) |
560 | { | 485 | { |
561 | __raw_writel(1, base + MMU_GFLUSH); | 486 | __raw_writel(1, base + MMU_GFLUSH); |
562 | } | 487 | } |
diff --git a/drivers/staging/tidspbridge/hw/hw_mmu.h b/drivers/staging/tidspbridge/hw/hw_mmu.h index 1458a2c6027b..1c50bb36edfe 100644 --- a/drivers/staging/tidspbridge/hw/hw_mmu.h +++ b/drivers/staging/tidspbridge/hw/hw_mmu.h | |||
@@ -42,44 +42,41 @@ struct hw_mmu_map_attrs_t { | |||
42 | bool donotlockmpupage; | 42 | bool donotlockmpupage; |
43 | }; | 43 | }; |
44 | 44 | ||
45 | extern hw_status hw_mmu_enable(const void __iomem *base_address); | 45 | extern hw_status hw_mmu_enable(void __iomem *base_address); |
46 | 46 | ||
47 | extern hw_status hw_mmu_disable(const void __iomem *base_address); | 47 | extern hw_status hw_mmu_disable(void __iomem *base_address); |
48 | 48 | ||
49 | extern hw_status hw_mmu_num_locked_set(const void __iomem *base_address, | 49 | extern hw_status hw_mmu_num_locked_set(void __iomem *base_address, |
50 | u32 num_locked_entries); | 50 | u32 num_locked_entries); |
51 | 51 | ||
52 | extern hw_status hw_mmu_victim_num_set(const void __iomem *base_address, | 52 | extern hw_status hw_mmu_victim_num_set(void __iomem *base_address, |
53 | u32 victim_entry_num); | 53 | u32 victim_entry_num); |
54 | 54 | ||
55 | /* For MMU faults */ | 55 | /* For MMU faults */ |
56 | extern hw_status hw_mmu_event_ack(const void __iomem *base_address, | 56 | extern hw_status hw_mmu_event_ack(void __iomem *base_address, |
57 | u32 irq_mask); | 57 | u32 irq_mask); |
58 | 58 | ||
59 | extern hw_status hw_mmu_event_disable(const void __iomem *base_address, | 59 | extern hw_status hw_mmu_event_disable(void __iomem *base_address, |
60 | u32 irq_mask); | 60 | u32 irq_mask); |
61 | 61 | ||
62 | extern hw_status hw_mmu_event_enable(const void __iomem *base_address, | 62 | extern hw_status hw_mmu_event_enable(void __iomem *base_address, |
63 | u32 irq_mask); | 63 | u32 irq_mask); |
64 | 64 | ||
65 | extern hw_status hw_mmu_event_status(const void __iomem *base_address, | 65 | extern hw_status hw_mmu_event_status(void __iomem *base_address, |
66 | u32 *irq_mask); | 66 | u32 *irq_mask); |
67 | 67 | ||
68 | extern hw_status hw_mmu_fault_addr_read(const void __iomem *base_address, | 68 | extern hw_status hw_mmu_fault_addr_read(void __iomem *base_address, |
69 | u32 *addr); | 69 | u32 *addr); |
70 | 70 | ||
71 | /* Set the TT base address */ | 71 | /* Set the TT base address */ |
72 | extern hw_status hw_mmu_ttb_set(const void __iomem *base_address, | 72 | extern hw_status hw_mmu_ttb_set(void __iomem *base_address, |
73 | u32 ttb_phys_addr); | 73 | u32 ttb_phys_addr); |
74 | 74 | ||
75 | extern hw_status hw_mmu_twl_enable(const void __iomem *base_address); | 75 | extern hw_status hw_mmu_twl_enable(void __iomem *base_address); |
76 | 76 | ||
77 | extern hw_status hw_mmu_twl_disable(const void __iomem *base_address); | 77 | extern hw_status hw_mmu_twl_disable(void __iomem *base_address); |
78 | 78 | ||
79 | extern hw_status hw_mmu_tlb_flush(const void __iomem *base_address, | 79 | extern hw_status hw_mmu_tlb_add(void __iomem *base_address, |
80 | u32 virtual_addr, u32 page_sz); | ||
81 | |||
82 | extern hw_status hw_mmu_tlb_add(const void __iomem *base_address, | ||
83 | u32 physical_addr, | 80 | u32 physical_addr, |
84 | u32 virtual_addr, | 81 | u32 virtual_addr, |
85 | u32 page_sz, | 82 | u32 page_sz, |
@@ -97,7 +94,7 @@ extern hw_status hw_mmu_pte_set(const u32 pg_tbl_va, | |||
97 | extern hw_status hw_mmu_pte_clear(const u32 pg_tbl_va, | 94 | extern hw_status hw_mmu_pte_clear(const u32 pg_tbl_va, |
98 | u32 virtual_addr, u32 page_size); | 95 | u32 virtual_addr, u32 page_size); |
99 | 96 | ||
100 | void hw_mmu_tlb_flush_all(const void __iomem *base); | 97 | void hw_mmu_tlb_flush_all(void __iomem *base); |
101 | 98 | ||
102 | static inline u32 hw_mmu_pte_addr_l1(u32 l1_base, u32 va) | 99 | static inline u32 hw_mmu_pte_addr_l1(u32 l1_base, u32 va) |
103 | { | 100 | { |
diff --git a/drivers/staging/tidspbridge/include/dspbridge/cfgdefs.h b/drivers/staging/tidspbridge/include/dspbridge/cfgdefs.h index 60a278136bdf..b32c75673ab4 100644 --- a/drivers/staging/tidspbridge/include/dspbridge/cfgdefs.h +++ b/drivers/staging/tidspbridge/include/dspbridge/cfgdefs.h | |||
@@ -53,8 +53,8 @@ struct cfg_hostres { | |||
53 | u32 chnl_buf_size; | 53 | u32 chnl_buf_size; |
54 | u32 num_chnls; | 54 | u32 num_chnls; |
55 | void __iomem *per_base; | 55 | void __iomem *per_base; |
56 | u32 per_pm_base; | 56 | void __iomem *per_pm_base; |
57 | u32 core_pm_base; | 57 | void __iomem *core_pm_base; |
58 | void __iomem *dmmu_base; | 58 | void __iomem *dmmu_base; |
59 | }; | 59 | }; |
60 | 60 | ||
diff --git a/drivers/staging/tidspbridge/include/dspbridge/host_os.h b/drivers/staging/tidspbridge/include/dspbridge/host_os.h index 896f1579d5d7..7f3a1db31619 100644 --- a/drivers/staging/tidspbridge/include/dspbridge/host_os.h +++ b/drivers/staging/tidspbridge/include/dspbridge/host_os.h | |||
@@ -46,8 +46,8 @@ | |||
46 | #include <asm/cacheflush.h> | 46 | #include <asm/cacheflush.h> |
47 | #include <linux/dma-mapping.h> | 47 | #include <linux/dma-mapping.h> |
48 | 48 | ||
49 | /* TODO -- Remove, once BP defines them */ | 49 | /* TODO -- Remove, once omap-iommu is used */ |
50 | #define INT_DSP_MMU_IRQ 28 | 50 | #define INT_DSP_MMU_IRQ (28 + NR_IRQS) |
51 | 51 | ||
52 | #define PRCM_VDD1 1 | 52 | #define PRCM_VDD1 1 |
53 | 53 | ||
diff --git a/drivers/staging/tidspbridge/rmgr/drv.c b/drivers/staging/tidspbridge/rmgr/drv.c index 6795205b0155..db1da28cecba 100644 --- a/drivers/staging/tidspbridge/rmgr/drv.c +++ b/drivers/staging/tidspbridge/rmgr/drv.c | |||
@@ -667,10 +667,10 @@ int drv_request_bridge_res_dsp(void **phost_resources) | |||
667 | OMAP_DSP_MEM3_SIZE); | 667 | OMAP_DSP_MEM3_SIZE); |
668 | host_res->per_base = ioremap(OMAP_PER_CM_BASE, | 668 | host_res->per_base = ioremap(OMAP_PER_CM_BASE, |
669 | OMAP_PER_CM_SIZE); | 669 | OMAP_PER_CM_SIZE); |
670 | host_res->per_pm_base = (u32) ioremap(OMAP_PER_PRM_BASE, | 670 | host_res->per_pm_base = ioremap(OMAP_PER_PRM_BASE, |
671 | OMAP_PER_PRM_SIZE); | 671 | OMAP_PER_PRM_SIZE); |
672 | host_res->core_pm_base = (u32) ioremap(OMAP_CORE_PRM_BASE, | 672 | host_res->core_pm_base = ioremap(OMAP_CORE_PRM_BASE, |
673 | OMAP_CORE_PRM_SIZE); | 673 | OMAP_CORE_PRM_SIZE); |
674 | host_res->dmmu_base = ioremap(OMAP_DMMU_BASE, | 674 | host_res->dmmu_base = ioremap(OMAP_DMMU_BASE, |
675 | OMAP_DMMU_SIZE); | 675 | OMAP_DMMU_SIZE); |
676 | 676 | ||
diff --git a/drivers/staging/tidspbridge/rmgr/node.c b/drivers/staging/tidspbridge/rmgr/node.c index c2fc6137c770..294e9b40f516 100644 --- a/drivers/staging/tidspbridge/rmgr/node.c +++ b/drivers/staging/tidspbridge/rmgr/node.c | |||
@@ -304,8 +304,7 @@ int node_allocate(struct proc_object *hprocessor, | |||
304 | u32 pul_value; | 304 | u32 pul_value; |
305 | u32 dynext_base; | 305 | u32 dynext_base; |
306 | u32 off_set = 0; | 306 | u32 off_set = 0; |
307 | u32 ul_stack_seg_addr, ul_stack_seg_val; | 307 | u32 ul_stack_seg_val; |
308 | u32 ul_gpp_mem_base; | ||
309 | struct cfg_hostres *host_res; | 308 | struct cfg_hostres *host_res; |
310 | struct bridge_dev_context *pbridge_context; | 309 | struct bridge_dev_context *pbridge_context; |
311 | u32 mapped_addr = 0; | 310 | u32 mapped_addr = 0; |
@@ -581,6 +580,9 @@ func_cont: | |||
581 | if (strcmp((char *) | 580 | if (strcmp((char *) |
582 | pnode->dcd_props.obj_data.node_obj.ndb_props. | 581 | pnode->dcd_props.obj_data.node_obj.ndb_props. |
583 | stack_seg_name, STACKSEGLABEL) == 0) { | 582 | stack_seg_name, STACKSEGLABEL) == 0) { |
583 | void __iomem *stack_seg; | ||
584 | u32 stack_seg_pa; | ||
585 | |||
584 | status = | 586 | status = |
585 | hnode_mgr->nldr_fxns. | 587 | hnode_mgr->nldr_fxns. |
586 | get_fxn_addr(pnode->nldr_node_obj, "DYNEXT_BEG", | 588 | get_fxn_addr(pnode->nldr_node_obj, "DYNEXT_BEG", |
@@ -608,14 +610,21 @@ func_cont: | |||
608 | goto func_end; | 610 | goto func_end; |
609 | } | 611 | } |
610 | 612 | ||
611 | ul_gpp_mem_base = (u32) host_res->mem_base[1]; | ||
612 | off_set = pul_value - dynext_base; | 613 | off_set = pul_value - dynext_base; |
613 | ul_stack_seg_addr = ul_gpp_mem_base + off_set; | 614 | stack_seg_pa = host_res->mem_phys[1] + off_set; |
614 | ul_stack_seg_val = readl(ul_stack_seg_addr); | 615 | stack_seg = ioremap(stack_seg_pa, SZ_32); |
616 | if (!stack_seg) { | ||
617 | status = -ENOMEM; | ||
618 | goto func_end; | ||
619 | } | ||
620 | |||
621 | ul_stack_seg_val = readl(stack_seg); | ||
622 | |||
623 | iounmap(stack_seg); | ||
615 | 624 | ||
616 | dev_dbg(bridge, "%s: StackSegVal = 0x%x, StackSegAddr =" | 625 | dev_dbg(bridge, "%s: StackSegVal = 0x%x, StackSegAddr =" |
617 | " 0x%x\n", __func__, ul_stack_seg_val, | 626 | " 0x%x\n", __func__, ul_stack_seg_val, |
618 | ul_stack_seg_addr); | 627 | host_res->mem_base[1] + off_set); |
619 | 628 | ||
620 | pnode->create_args.asa.task_arg_obj.stack_seg = | 629 | pnode->create_args.asa.task_arg_obj.stack_seg = |
621 | ul_stack_seg_val; | 630 | ul_stack_seg_val; |
diff --git a/drivers/staging/zram/zram_drv.c b/drivers/staging/zram/zram_drv.c index 653b074035f7..6edefde23722 100644 --- a/drivers/staging/zram/zram_drv.c +++ b/drivers/staging/zram/zram_drv.c | |||
@@ -223,8 +223,13 @@ static int zram_bvec_read(struct zram *zram, struct bio_vec *bvec, | |||
223 | cmem = zs_map_object(zram->mem_pool, zram->table[index].handle, | 223 | cmem = zs_map_object(zram->mem_pool, zram->table[index].handle, |
224 | ZS_MM_RO); | 224 | ZS_MM_RO); |
225 | 225 | ||
226 | ret = lzo1x_decompress_safe(cmem, zram->table[index].size, | 226 | if (zram->table[index].size == PAGE_SIZE) { |
227 | memcpy(uncmem, cmem, PAGE_SIZE); | ||
228 | ret = LZO_E_OK; | ||
229 | } else { | ||
230 | ret = lzo1x_decompress_safe(cmem, zram->table[index].size, | ||
227 | uncmem, &clen); | 231 | uncmem, &clen); |
232 | } | ||
228 | 233 | ||
229 | if (is_partial_io(bvec)) { | 234 | if (is_partial_io(bvec)) { |
230 | memcpy(user_mem + bvec->bv_offset, uncmem + offset, | 235 | memcpy(user_mem + bvec->bv_offset, uncmem + offset, |
@@ -342,8 +347,11 @@ static int zram_bvec_write(struct zram *zram, struct bio_vec *bvec, u32 index, | |||
342 | goto out; | 347 | goto out; |
343 | } | 348 | } |
344 | 349 | ||
345 | if (unlikely(clen > max_zpage_size)) | 350 | if (unlikely(clen > max_zpage_size)) { |
346 | zram_stat_inc(&zram->stats.bad_compress); | 351 | zram_stat_inc(&zram->stats.bad_compress); |
352 | src = uncmem; | ||
353 | clen = PAGE_SIZE; | ||
354 | } | ||
347 | 355 | ||
348 | handle = zs_malloc(zram->mem_pool, clen); | 356 | handle = zs_malloc(zram->mem_pool, clen); |
349 | if (!handle) { | 357 | if (!handle) { |
diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c index 3d7e1ee2fa57..5660ec2618a3 100644 --- a/drivers/tty/serial/atmel_serial.c +++ b/drivers/tty/serial/atmel_serial.c | |||
@@ -39,12 +39,12 @@ | |||
39 | #include <linux/atmel_pdc.h> | 39 | #include <linux/atmel_pdc.h> |
40 | #include <linux/atmel_serial.h> | 40 | #include <linux/atmel_serial.h> |
41 | #include <linux/uaccess.h> | 41 | #include <linux/uaccess.h> |
42 | #include <linux/platform_data/atmel.h> | ||
42 | 43 | ||
43 | #include <asm/io.h> | 44 | #include <asm/io.h> |
44 | #include <asm/ioctls.h> | 45 | #include <asm/ioctls.h> |
45 | 46 | ||
46 | #include <asm/mach/serial_at91.h> | 47 | #include <asm/mach/serial_at91.h> |
47 | #include <mach/board.h> | ||
48 | 48 | ||
49 | #ifdef CONFIG_ARM | 49 | #ifdef CONFIG_ARM |
50 | #include <mach/cpu.h> | 50 | #include <mach/cpu.h> |
diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c index 6ede6fd92b4c..6d3d26a607b9 100644 --- a/drivers/tty/serial/omap-serial.c +++ b/drivers/tty/serial/omap-serial.c | |||
@@ -671,19 +671,19 @@ serial_omap_configure_xonxoff | |||
671 | 671 | ||
672 | /* | 672 | /* |
673 | * IXON Flag: | 673 | * IXON Flag: |
674 | * Flow control for OMAP.TX | 674 | * Enable XON/XOFF flow control on output. |
675 | * OMAP.RX should listen for XON/XOFF | 675 | * Transmit XON1, XOFF1 |
676 | */ | 676 | */ |
677 | if (termios->c_iflag & IXON) | 677 | if (termios->c_iflag & IXON) |
678 | up->efr |= OMAP_UART_SW_RX; | 678 | up->efr |= OMAP_UART_SW_TX; |
679 | 679 | ||
680 | /* | 680 | /* |
681 | * IXOFF Flag: | 681 | * IXOFF Flag: |
682 | * Flow control for OMAP.RX | 682 | * Enable XON/XOFF flow control on input. |
683 | * OMAP.TX should send XON/XOFF | 683 | * Receiver compares XON1, XOFF1. |
684 | */ | 684 | */ |
685 | if (termios->c_iflag & IXOFF) | 685 | if (termios->c_iflag & IXOFF) |
686 | up->efr |= OMAP_UART_SW_TX; | 686 | up->efr |= OMAP_UART_SW_RX; |
687 | 687 | ||
688 | serial_out(up, UART_EFR, up->efr | UART_EFR_ECB); | 688 | serial_out(up, UART_EFR, up->efr | UART_EFR_ECB); |
689 | serial_out(up, UART_LCR, UART_LCR_CONF_MODE_A); | 689 | serial_out(up, UART_LCR, UART_LCR_CONF_MODE_A); |
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 64854d76f529..1af04bdeaf0c 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c | |||
@@ -739,13 +739,16 @@ static void hub_tt_work(struct work_struct *work) | |||
739 | int limit = 100; | 739 | int limit = 100; |
740 | 740 | ||
741 | spin_lock_irqsave (&hub->tt.lock, flags); | 741 | spin_lock_irqsave (&hub->tt.lock, flags); |
742 | while (--limit && !list_empty (&hub->tt.clear_list)) { | 742 | while (!list_empty(&hub->tt.clear_list)) { |
743 | struct list_head *next; | 743 | struct list_head *next; |
744 | struct usb_tt_clear *clear; | 744 | struct usb_tt_clear *clear; |
745 | struct usb_device *hdev = hub->hdev; | 745 | struct usb_device *hdev = hub->hdev; |
746 | const struct hc_driver *drv; | 746 | const struct hc_driver *drv; |
747 | int status; | 747 | int status; |
748 | 748 | ||
749 | if (!hub->quiescing && --limit < 0) | ||
750 | break; | ||
751 | |||
749 | next = hub->tt.clear_list.next; | 752 | next = hub->tt.clear_list.next; |
750 | clear = list_entry (next, struct usb_tt_clear, clear_list); | 753 | clear = list_entry (next, struct usb_tt_clear, clear_list); |
751 | list_del (&clear->clear_list); | 754 | list_del (&clear->clear_list); |
@@ -1210,7 +1213,7 @@ static void hub_quiesce(struct usb_hub *hub, enum hub_quiescing_type type) | |||
1210 | if (hub->has_indicators) | 1213 | if (hub->has_indicators) |
1211 | cancel_delayed_work_sync(&hub->leds); | 1214 | cancel_delayed_work_sync(&hub->leds); |
1212 | if (hub->tt.hub) | 1215 | if (hub->tt.hub) |
1213 | cancel_work_sync(&hub->tt.clear_work); | 1216 | flush_work(&hub->tt.clear_work); |
1214 | } | 1217 | } |
1215 | 1218 | ||
1216 | /* caller has locked the hub device */ | 1219 | /* caller has locked the hub device */ |
diff --git a/drivers/usb/gadget/at91_udc.c b/drivers/usb/gadget/at91_udc.c index 89d90b5fb787..a7b042b781d5 100644 --- a/drivers/usb/gadget/at91_udc.c +++ b/drivers/usb/gadget/at91_udc.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <linux/usb/gadget.h> | 31 | #include <linux/usb/gadget.h> |
32 | #include <linux/of.h> | 32 | #include <linux/of.h> |
33 | #include <linux/of_gpio.h> | 33 | #include <linux/of_gpio.h> |
34 | #include <linux/platform_data/atmel.h> | ||
34 | 35 | ||
35 | #include <asm/byteorder.h> | 36 | #include <asm/byteorder.h> |
36 | #include <mach/hardware.h> | 37 | #include <mach/hardware.h> |
@@ -38,7 +39,6 @@ | |||
38 | #include <asm/irq.h> | 39 | #include <asm/irq.h> |
39 | #include <asm/gpio.h> | 40 | #include <asm/gpio.h> |
40 | 41 | ||
41 | #include <mach/board.h> | ||
42 | #include <mach/cpu.h> | 42 | #include <mach/cpu.h> |
43 | #include <mach/at91sam9261_matrix.h> | 43 | #include <mach/at91sam9261_matrix.h> |
44 | #include <mach/at91_matrix.h> | 44 | #include <mach/at91_matrix.h> |
diff --git a/drivers/usb/gadget/atmel_usba_udc.c b/drivers/usb/gadget/atmel_usba_udc.c index 9a9bced813ed..a7aed84d98c9 100644 --- a/drivers/usb/gadget/atmel_usba_udc.c +++ b/drivers/usb/gadget/atmel_usba_udc.c | |||
@@ -21,9 +21,9 @@ | |||
21 | #include <linux/usb/gadget.h> | 21 | #include <linux/usb/gadget.h> |
22 | #include <linux/usb/atmel_usba_udc.h> | 22 | #include <linux/usb/atmel_usba_udc.h> |
23 | #include <linux/delay.h> | 23 | #include <linux/delay.h> |
24 | #include <linux/platform_data/atmel.h> | ||
24 | 25 | ||
25 | #include <asm/gpio.h> | 26 | #include <asm/gpio.h> |
26 | #include <mach/board.h> | ||
27 | 27 | ||
28 | #include "atmel_usba_udc.h" | 28 | #include "atmel_usba_udc.h" |
29 | 29 | ||
diff --git a/drivers/usb/gadget/net2272.c b/drivers/usb/gadget/net2272.c index 43ac7482fa91..c009263a47e3 100644 --- a/drivers/usb/gadget/net2272.c +++ b/drivers/usb/gadget/net2272.c | |||
@@ -2069,8 +2069,10 @@ static irqreturn_t net2272_irq(int irq, void *_dev) | |||
2069 | #if defined(PLX_PCI_RDK2) | 2069 | #if defined(PLX_PCI_RDK2) |
2070 | /* see if PCI int for us by checking irqstat */ | 2070 | /* see if PCI int for us by checking irqstat */ |
2071 | intcsr = readl(dev->rdk2.fpga_base_addr + RDK2_IRQSTAT); | 2071 | intcsr = readl(dev->rdk2.fpga_base_addr + RDK2_IRQSTAT); |
2072 | if (!intcsr & (1 << NET2272_PCI_IRQ)) | 2072 | if (!intcsr & (1 << NET2272_PCI_IRQ)) { |
2073 | spin_unlock(&dev->lock); | ||
2073 | return IRQ_NONE; | 2074 | return IRQ_NONE; |
2075 | } | ||
2074 | /* check dma interrupts */ | 2076 | /* check dma interrupts */ |
2075 | #endif | 2077 | #endif |
2076 | /* Platform/devcice interrupt handler */ | 2078 | /* Platform/devcice interrupt handler */ |
diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c index 0bf72f943b00..8e62f81ae1ed 100644 --- a/drivers/usb/host/ohci-at91.c +++ b/drivers/usb/host/ohci-at91.c | |||
@@ -16,11 +16,11 @@ | |||
16 | #include <linux/platform_device.h> | 16 | #include <linux/platform_device.h> |
17 | #include <linux/of_platform.h> | 17 | #include <linux/of_platform.h> |
18 | #include <linux/of_gpio.h> | 18 | #include <linux/of_gpio.h> |
19 | #include <linux/platform_data/atmel.h> | ||
19 | 20 | ||
20 | #include <mach/hardware.h> | 21 | #include <mach/hardware.h> |
21 | #include <asm/gpio.h> | 22 | #include <asm/gpio.h> |
22 | 23 | ||
23 | #include <mach/board.h> | ||
24 | #include <mach/cpu.h> | 24 | #include <mach/cpu.h> |
25 | 25 | ||
26 | #ifndef CONFIG_ARCH_AT91 | 26 | #ifndef CONFIG_ARCH_AT91 |
diff --git a/drivers/usb/host/pci-quirks.c b/drivers/usb/host/pci-quirks.c index 966d1484ee79..39f9e4a9a2d3 100644 --- a/drivers/usb/host/pci-quirks.c +++ b/drivers/usb/host/pci-quirks.c | |||
@@ -545,7 +545,14 @@ static const struct dmi_system_id __devinitconst ehci_dmi_nohandoff_table[] = { | |||
545 | /* Pegatron Lucid (Ordissimo AIRIS) */ | 545 | /* Pegatron Lucid (Ordissimo AIRIS) */ |
546 | .matches = { | 546 | .matches = { |
547 | DMI_MATCH(DMI_BOARD_NAME, "M11JB"), | 547 | DMI_MATCH(DMI_BOARD_NAME, "M11JB"), |
548 | DMI_MATCH(DMI_BIOS_VERSION, "Lucid-GE-133"), | 548 | DMI_MATCH(DMI_BIOS_VERSION, "Lucid-"), |
549 | }, | ||
550 | }, | ||
551 | { | ||
552 | /* Pegatron Lucid (Ordissimo) */ | ||
553 | .matches = { | ||
554 | DMI_MATCH(DMI_BOARD_NAME, "Ordissimo"), | ||
555 | DMI_MATCH(DMI_BIOS_VERSION, "Lucid-"), | ||
549 | }, | 556 | }, |
550 | }, | 557 | }, |
551 | { } | 558 | { } |
diff --git a/drivers/usb/host/xhci-dbg.c b/drivers/usb/host/xhci-dbg.c index 4b436f5a4171..5f3a7c74aa8d 100644 --- a/drivers/usb/host/xhci-dbg.c +++ b/drivers/usb/host/xhci-dbg.c | |||
@@ -544,7 +544,6 @@ void xhci_dbg_ctx(struct xhci_hcd *xhci, | |||
544 | int i; | 544 | int i; |
545 | /* Fields are 32 bits wide, DMA addresses are in bytes */ | 545 | /* Fields are 32 bits wide, DMA addresses are in bytes */ |
546 | int field_size = 32 / 8; | 546 | int field_size = 32 / 8; |
547 | struct xhci_slot_ctx *slot_ctx; | ||
548 | dma_addr_t dma = ctx->dma; | 547 | dma_addr_t dma = ctx->dma; |
549 | int csz = HCC_64BYTE_CONTEXT(xhci->hcc_params); | 548 | int csz = HCC_64BYTE_CONTEXT(xhci->hcc_params); |
550 | 549 | ||
@@ -570,7 +569,6 @@ void xhci_dbg_ctx(struct xhci_hcd *xhci, | |||
570 | dbg_rsvd64(xhci, (u64 *)ctrl_ctx, dma); | 569 | dbg_rsvd64(xhci, (u64 *)ctrl_ctx, dma); |
571 | } | 570 | } |
572 | 571 | ||
573 | slot_ctx = xhci_get_slot_ctx(xhci, ctx); | ||
574 | xhci_dbg_slot_ctx(xhci, ctx); | 572 | xhci_dbg_slot_ctx(xhci, ctx); |
575 | xhci_dbg_ep_ctx(xhci, ctx, last_ep); | 573 | xhci_dbg_ep_ctx(xhci, ctx, last_ep); |
576 | } | 574 | } |
diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c index aa90ad4d4fd5..a686cf4905bb 100644 --- a/drivers/usb/host/xhci-hub.c +++ b/drivers/usb/host/xhci-hub.c | |||
@@ -151,9 +151,8 @@ static void xhci_usb3_hub_descriptor(struct usb_hcd *hcd, struct xhci_hcd *xhci, | |||
151 | if (portsc & PORT_DEV_REMOVE) | 151 | if (portsc & PORT_DEV_REMOVE) |
152 | port_removable |= 1 << (i + 1); | 152 | port_removable |= 1 << (i + 1); |
153 | } | 153 | } |
154 | memset(&desc->u.ss.DeviceRemovable, | 154 | |
155 | (__force __u16) cpu_to_le16(port_removable), | 155 | desc->u.ss.DeviceRemovable = cpu_to_le16(port_removable); |
156 | sizeof(__u16)); | ||
157 | } | 156 | } |
158 | 157 | ||
159 | static void xhci_hub_descriptor(struct usb_hcd *hcd, struct xhci_hcd *xhci, | 158 | static void xhci_hub_descriptor(struct usb_hcd *hcd, struct xhci_hcd *xhci, |
@@ -809,11 +808,13 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, | |||
809 | temp = xhci_readl(xhci, port_array[wIndex]); | 808 | temp = xhci_readl(xhci, port_array[wIndex]); |
810 | xhci_dbg(xhci, "set port power, actual port %d status = 0x%x\n", wIndex, temp); | 809 | xhci_dbg(xhci, "set port power, actual port %d status = 0x%x\n", wIndex, temp); |
811 | 810 | ||
811 | spin_unlock_irqrestore(&xhci->lock, flags); | ||
812 | temp = usb_acpi_power_manageable(hcd->self.root_hub, | 812 | temp = usb_acpi_power_manageable(hcd->self.root_hub, |
813 | wIndex); | 813 | wIndex); |
814 | if (temp) | 814 | if (temp) |
815 | usb_acpi_set_power_state(hcd->self.root_hub, | 815 | usb_acpi_set_power_state(hcd->self.root_hub, |
816 | wIndex, true); | 816 | wIndex, true); |
817 | spin_lock_irqsave(&xhci->lock, flags); | ||
817 | break; | 818 | break; |
818 | case USB_PORT_FEAT_RESET: | 819 | case USB_PORT_FEAT_RESET: |
819 | temp = (temp | PORT_RESET); | 820 | temp = (temp | PORT_RESET); |
@@ -917,11 +918,13 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, | |||
917 | xhci_writel(xhci, temp & ~PORT_POWER, | 918 | xhci_writel(xhci, temp & ~PORT_POWER, |
918 | port_array[wIndex]); | 919 | port_array[wIndex]); |
919 | 920 | ||
921 | spin_unlock_irqrestore(&xhci->lock, flags); | ||
920 | temp = usb_acpi_power_manageable(hcd->self.root_hub, | 922 | temp = usb_acpi_power_manageable(hcd->self.root_hub, |
921 | wIndex); | 923 | wIndex); |
922 | if (temp) | 924 | if (temp) |
923 | usb_acpi_set_power_state(hcd->self.root_hub, | 925 | usb_acpi_set_power_state(hcd->self.root_hub, |
924 | wIndex, false); | 926 | wIndex, false); |
927 | spin_lock_irqsave(&xhci->lock, flags); | ||
925 | break; | 928 | break; |
926 | default: | 929 | default: |
927 | goto error; | 930 | goto error; |
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index c6ebb176dc4f..4e1a8946b8d1 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c | |||
@@ -1228,6 +1228,17 @@ static void xhci_cmd_to_noop(struct xhci_hcd *xhci, struct xhci_cd *cur_cd) | |||
1228 | cur_seg = find_trb_seg(xhci->cmd_ring->first_seg, | 1228 | cur_seg = find_trb_seg(xhci->cmd_ring->first_seg, |
1229 | xhci->cmd_ring->dequeue, &cycle_state); | 1229 | xhci->cmd_ring->dequeue, &cycle_state); |
1230 | 1230 | ||
1231 | if (!cur_seg) { | ||
1232 | xhci_warn(xhci, "Command ring mismatch, dequeue = %p %llx (dma)\n", | ||
1233 | xhci->cmd_ring->dequeue, | ||
1234 | (unsigned long long) | ||
1235 | xhci_trb_virt_to_dma(xhci->cmd_ring->deq_seg, | ||
1236 | xhci->cmd_ring->dequeue)); | ||
1237 | xhci_debug_ring(xhci, xhci->cmd_ring); | ||
1238 | xhci_dbg_ring_ptrs(xhci, xhci->cmd_ring); | ||
1239 | return; | ||
1240 | } | ||
1241 | |||
1231 | /* find the command trb matched by cd from command ring */ | 1242 | /* find the command trb matched by cd from command ring */ |
1232 | for (cmd_trb = xhci->cmd_ring->dequeue; | 1243 | for (cmd_trb = xhci->cmd_ring->dequeue; |
1233 | cmd_trb != xhci->cmd_ring->enqueue; | 1244 | cmd_trb != xhci->cmd_ring->enqueue; |
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index 7d462bf20092..c9e419f29b74 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c | |||
@@ -1627,7 +1627,6 @@ int xhci_add_endpoint(struct usb_hcd *hcd, struct usb_device *udev, | |||
1627 | struct xhci_hcd *xhci; | 1627 | struct xhci_hcd *xhci; |
1628 | struct xhci_container_ctx *in_ctx, *out_ctx; | 1628 | struct xhci_container_ctx *in_ctx, *out_ctx; |
1629 | unsigned int ep_index; | 1629 | unsigned int ep_index; |
1630 | struct xhci_ep_ctx *ep_ctx; | ||
1631 | struct xhci_slot_ctx *slot_ctx; | 1630 | struct xhci_slot_ctx *slot_ctx; |
1632 | struct xhci_input_control_ctx *ctrl_ctx; | 1631 | struct xhci_input_control_ctx *ctrl_ctx; |
1633 | u32 added_ctxs; | 1632 | u32 added_ctxs; |
@@ -1663,7 +1662,6 @@ int xhci_add_endpoint(struct usb_hcd *hcd, struct usb_device *udev, | |||
1663 | out_ctx = virt_dev->out_ctx; | 1662 | out_ctx = virt_dev->out_ctx; |
1664 | ctrl_ctx = xhci_get_input_control_ctx(xhci, in_ctx); | 1663 | ctrl_ctx = xhci_get_input_control_ctx(xhci, in_ctx); |
1665 | ep_index = xhci_get_endpoint_index(&ep->desc); | 1664 | ep_index = xhci_get_endpoint_index(&ep->desc); |
1666 | ep_ctx = xhci_get_ep_ctx(xhci, out_ctx, ep_index); | ||
1667 | 1665 | ||
1668 | /* If this endpoint is already in use, and the upper layers are trying | 1666 | /* If this endpoint is already in use, and the upper layers are trying |
1669 | * to add it again without dropping it, reject the addition. | 1667 | * to add it again without dropping it, reject the addition. |
@@ -1817,6 +1815,8 @@ static int xhci_evaluate_context_result(struct xhci_hcd *xhci, | |||
1817 | case COMP_EBADSLT: | 1815 | case COMP_EBADSLT: |
1818 | dev_warn(&udev->dev, "WARN: slot not enabled for" | 1816 | dev_warn(&udev->dev, "WARN: slot not enabled for" |
1819 | "evaluate context command.\n"); | 1817 | "evaluate context command.\n"); |
1818 | ret = -EINVAL; | ||
1819 | break; | ||
1820 | case COMP_CTX_STATE: | 1820 | case COMP_CTX_STATE: |
1821 | dev_warn(&udev->dev, "WARN: invalid context state for " | 1821 | dev_warn(&udev->dev, "WARN: invalid context state for " |
1822 | "evaluate context command.\n"); | 1822 | "evaluate context command.\n"); |
@@ -4021,7 +4021,7 @@ int xhci_update_device(struct usb_hcd *hcd, struct usb_device *udev) | |||
4021 | static unsigned long long xhci_service_interval_to_ns( | 4021 | static unsigned long long xhci_service_interval_to_ns( |
4022 | struct usb_endpoint_descriptor *desc) | 4022 | struct usb_endpoint_descriptor *desc) |
4023 | { | 4023 | { |
4024 | return (1 << (desc->bInterval - 1)) * 125 * 1000; | 4024 | return (1ULL << (desc->bInterval - 1)) * 125 * 1000; |
4025 | } | 4025 | } |
4026 | 4026 | ||
4027 | static u16 xhci_get_timeout_no_hub_lpm(struct usb_device *udev, | 4027 | static u16 xhci_get_timeout_no_hub_lpm(struct usb_device *udev, |
@@ -4142,7 +4142,7 @@ static u16 xhci_calculate_intel_u2_timeout(struct usb_device *udev, | |||
4142 | (xhci_service_interval_to_ns(desc) > timeout_ns)) | 4142 | (xhci_service_interval_to_ns(desc) > timeout_ns)) |
4143 | timeout_ns = xhci_service_interval_to_ns(desc); | 4143 | timeout_ns = xhci_service_interval_to_ns(desc); |
4144 | 4144 | ||
4145 | u2_del_ns = udev->bos->ss_cap->bU2DevExitLat * 1000; | 4145 | u2_del_ns = le16_to_cpu(udev->bos->ss_cap->bU2DevExitLat) * 1000ULL; |
4146 | if (u2_del_ns > timeout_ns) | 4146 | if (u2_del_ns > timeout_ns) |
4147 | timeout_ns = u2_del_ns; | 4147 | timeout_ns = u2_del_ns; |
4148 | 4148 | ||
diff --git a/drivers/usb/misc/ezusb.c b/drivers/usb/misc/ezusb.c index 4223d761223d..6589268a6515 100644 --- a/drivers/usb/misc/ezusb.c +++ b/drivers/usb/misc/ezusb.c | |||
@@ -158,3 +158,4 @@ int ezusb_fx2_ihex_firmware_download(struct usb_device *dev, | |||
158 | } | 158 | } |
159 | EXPORT_SYMBOL_GPL(ezusb_fx2_ihex_firmware_download); | 159 | EXPORT_SYMBOL_GPL(ezusb_fx2_ihex_firmware_download); |
160 | 160 | ||
161 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c index a67af21c1460..aa34f22181c1 100644 --- a/drivers/usb/musb/musb_dsps.c +++ b/drivers/usb/musb/musb_dsps.c | |||
@@ -457,11 +457,11 @@ static int __devinit dsps_create_musb_pdev(struct dsps_glue *glue, u8 id) | |||
457 | struct platform_device *musb; | 457 | struct platform_device *musb; |
458 | struct resource *res; | 458 | struct resource *res; |
459 | struct resource resources[2]; | 459 | struct resource resources[2]; |
460 | char res_name[10]; | 460 | char res_name[11]; |
461 | int ret, musbid; | 461 | int ret, musbid; |
462 | 462 | ||
463 | /* get memory resource */ | 463 | /* get memory resource */ |
464 | sprintf(res_name, "musb%d", id); | 464 | snprintf(res_name, sizeof(res_name), "musb%d", id); |
465 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, res_name); | 465 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, res_name); |
466 | if (!res) { | 466 | if (!res) { |
467 | dev_err(dev, "%s get mem resource failed\n", res_name); | 467 | dev_err(dev, "%s get mem resource failed\n", res_name); |
@@ -472,7 +472,7 @@ static int __devinit dsps_create_musb_pdev(struct dsps_glue *glue, u8 id) | |||
472 | resources[0] = *res; | 472 | resources[0] = *res; |
473 | 473 | ||
474 | /* get irq resource */ | 474 | /* get irq resource */ |
475 | sprintf(res_name, "musb%d-irq", id); | 475 | snprintf(res_name, sizeof(res_name), "musb%d-irq", id); |
476 | res = platform_get_resource_byname(pdev, IORESOURCE_IRQ, res_name); | 476 | res = platform_get_resource_byname(pdev, IORESOURCE_IRQ, res_name); |
477 | if (!res) { | 477 | if (!res) { |
478 | dev_err(dev, "%s get irq resource failed\n", res_name); | 478 | dev_err(dev, "%s get irq resource failed\n", res_name); |
@@ -529,7 +529,7 @@ static int __devinit dsps_create_musb_pdev(struct dsps_glue *glue, u8 id) | |||
529 | 529 | ||
530 | of_property_read_u32(np, "num-eps", (u32 *)&config->num_eps); | 530 | of_property_read_u32(np, "num-eps", (u32 *)&config->num_eps); |
531 | of_property_read_u32(np, "ram-bits", (u32 *)&config->ram_bits); | 531 | of_property_read_u32(np, "ram-bits", (u32 *)&config->ram_bits); |
532 | sprintf(res_name, "port%d-mode", id); | 532 | snprintf(res_name, sizeof(res_name), "port%d-mode", id); |
533 | of_property_read_u32(np, res_name, (u32 *)&pdata->mode); | 533 | of_property_read_u32(np, res_name, (u32 *)&pdata->mode); |
534 | of_property_read_u32(np, "power", (u32 *)&pdata->power); | 534 | of_property_read_u32(np, "power", (u32 *)&pdata->power); |
535 | config->multipoint = of_property_read_bool(np, "multipoint"); | 535 | config->multipoint = of_property_read_bool(np, "multipoint"); |
diff --git a/drivers/usb/renesas_usbhs/fifo.c b/drivers/usb/renesas_usbhs/fifo.c index 143c4e9e1be4..c021b202c0f3 100644 --- a/drivers/usb/renesas_usbhs/fifo.c +++ b/drivers/usb/renesas_usbhs/fifo.c | |||
@@ -795,6 +795,7 @@ static void xfer_work(struct work_struct *work) | |||
795 | dev_dbg(dev, " %s %d (%d/ %d)\n", | 795 | dev_dbg(dev, " %s %d (%d/ %d)\n", |
796 | fifo->name, usbhs_pipe_number(pipe), pkt->length, pkt->zero); | 796 | fifo->name, usbhs_pipe_number(pipe), pkt->length, pkt->zero); |
797 | 797 | ||
798 | usbhs_pipe_enable(pipe); | ||
798 | usbhsf_dma_start(pipe, fifo); | 799 | usbhsf_dma_start(pipe, fifo); |
799 | dma_async_issue_pending(chan); | 800 | dma_async_issue_pending(chan); |
800 | } | 801 | } |
diff --git a/drivers/usb/renesas_usbhs/mod_host.c b/drivers/usb/renesas_usbhs/mod_host.c index 9b69a1323294..069cd765400c 100644 --- a/drivers/usb/renesas_usbhs/mod_host.c +++ b/drivers/usb/renesas_usbhs/mod_host.c | |||
@@ -334,6 +334,11 @@ static void usbhsh_pipe_detach(struct usbhsh_hpriv *hpriv, | |||
334 | struct device *dev = usbhs_priv_to_dev(priv); | 334 | struct device *dev = usbhs_priv_to_dev(priv); |
335 | unsigned long flags; | 335 | unsigned long flags; |
336 | 336 | ||
337 | if (unlikely(!uep)) { | ||
338 | dev_err(dev, "no uep\n"); | ||
339 | return; | ||
340 | } | ||
341 | |||
337 | /******************** spin lock ********************/ | 342 | /******************** spin lock ********************/ |
338 | usbhs_lock(priv, flags); | 343 | usbhs_lock(priv, flags); |
339 | 344 | ||
diff --git a/drivers/usb/serial/ch341.c b/drivers/usb/serial/ch341.c index e9c7046ae355..d255f66e708e 100644 --- a/drivers/usb/serial/ch341.c +++ b/drivers/usb/serial/ch341.c | |||
@@ -242,13 +242,11 @@ out: kfree(buffer); | |||
242 | return r; | 242 | return r; |
243 | } | 243 | } |
244 | 244 | ||
245 | /* allocate private data */ | 245 | static int ch341_port_probe(struct usb_serial_port *port) |
246 | static int ch341_attach(struct usb_serial *serial) | ||
247 | { | 246 | { |
248 | struct ch341_private *priv; | 247 | struct ch341_private *priv; |
249 | int r; | 248 | int r; |
250 | 249 | ||
251 | /* private data */ | ||
252 | priv = kzalloc(sizeof(struct ch341_private), GFP_KERNEL); | 250 | priv = kzalloc(sizeof(struct ch341_private), GFP_KERNEL); |
253 | if (!priv) | 251 | if (!priv) |
254 | return -ENOMEM; | 252 | return -ENOMEM; |
@@ -258,17 +256,27 @@ static int ch341_attach(struct usb_serial *serial) | |||
258 | priv->baud_rate = DEFAULT_BAUD_RATE; | 256 | priv->baud_rate = DEFAULT_BAUD_RATE; |
259 | priv->line_control = CH341_BIT_RTS | CH341_BIT_DTR; | 257 | priv->line_control = CH341_BIT_RTS | CH341_BIT_DTR; |
260 | 258 | ||
261 | r = ch341_configure(serial->dev, priv); | 259 | r = ch341_configure(port->serial->dev, priv); |
262 | if (r < 0) | 260 | if (r < 0) |
263 | goto error; | 261 | goto error; |
264 | 262 | ||
265 | usb_set_serial_port_data(serial->port[0], priv); | 263 | usb_set_serial_port_data(port, priv); |
266 | return 0; | 264 | return 0; |
267 | 265 | ||
268 | error: kfree(priv); | 266 | error: kfree(priv); |
269 | return r; | 267 | return r; |
270 | } | 268 | } |
271 | 269 | ||
270 | static int ch341_port_remove(struct usb_serial_port *port) | ||
271 | { | ||
272 | struct ch341_private *priv; | ||
273 | |||
274 | priv = usb_get_serial_port_data(port); | ||
275 | kfree(priv); | ||
276 | |||
277 | return 0; | ||
278 | } | ||
279 | |||
272 | static int ch341_carrier_raised(struct usb_serial_port *port) | 280 | static int ch341_carrier_raised(struct usb_serial_port *port) |
273 | { | 281 | { |
274 | struct ch341_private *priv = usb_get_serial_port_data(port); | 282 | struct ch341_private *priv = usb_get_serial_port_data(port); |
@@ -304,7 +312,7 @@ static void ch341_close(struct usb_serial_port *port) | |||
304 | static int ch341_open(struct tty_struct *tty, struct usb_serial_port *port) | 312 | static int ch341_open(struct tty_struct *tty, struct usb_serial_port *port) |
305 | { | 313 | { |
306 | struct usb_serial *serial = port->serial; | 314 | struct usb_serial *serial = port->serial; |
307 | struct ch341_private *priv = usb_get_serial_port_data(serial->port[0]); | 315 | struct ch341_private *priv = usb_get_serial_port_data(port); |
308 | int r; | 316 | int r; |
309 | 317 | ||
310 | priv->baud_rate = DEFAULT_BAUD_RATE; | 318 | priv->baud_rate = DEFAULT_BAUD_RATE; |
@@ -608,7 +616,8 @@ static struct usb_serial_driver ch341_device = { | |||
608 | .tiocmget = ch341_tiocmget, | 616 | .tiocmget = ch341_tiocmget, |
609 | .tiocmset = ch341_tiocmset, | 617 | .tiocmset = ch341_tiocmset, |
610 | .read_int_callback = ch341_read_int_callback, | 618 | .read_int_callback = ch341_read_int_callback, |
611 | .attach = ch341_attach, | 619 | .port_probe = ch341_port_probe, |
620 | .port_remove = ch341_port_remove, | ||
612 | .reset_resume = ch341_reset_resume, | 621 | .reset_resume = ch341_reset_resume, |
613 | }; | 622 | }; |
614 | 623 | ||
diff --git a/drivers/usb/serial/digi_acceleport.c b/drivers/usb/serial/digi_acceleport.c index c86f68c6b078..b50fa1c6d885 100644 --- a/drivers/usb/serial/digi_acceleport.c +++ b/drivers/usb/serial/digi_acceleport.c | |||
@@ -244,6 +244,8 @@ static int digi_startup_device(struct usb_serial *serial); | |||
244 | static int digi_startup(struct usb_serial *serial); | 244 | static int digi_startup(struct usb_serial *serial); |
245 | static void digi_disconnect(struct usb_serial *serial); | 245 | static void digi_disconnect(struct usb_serial *serial); |
246 | static void digi_release(struct usb_serial *serial); | 246 | static void digi_release(struct usb_serial *serial); |
247 | static int digi_port_probe(struct usb_serial_port *port); | ||
248 | static int digi_port_remove(struct usb_serial_port *port); | ||
247 | static void digi_read_bulk_callback(struct urb *urb); | 249 | static void digi_read_bulk_callback(struct urb *urb); |
248 | static int digi_read_inb_callback(struct urb *urb); | 250 | static int digi_read_inb_callback(struct urb *urb); |
249 | static int digi_read_oob_callback(struct urb *urb); | 251 | static int digi_read_oob_callback(struct urb *urb); |
@@ -294,6 +296,8 @@ static struct usb_serial_driver digi_acceleport_2_device = { | |||
294 | .attach = digi_startup, | 296 | .attach = digi_startup, |
295 | .disconnect = digi_disconnect, | 297 | .disconnect = digi_disconnect, |
296 | .release = digi_release, | 298 | .release = digi_release, |
299 | .port_probe = digi_port_probe, | ||
300 | .port_remove = digi_port_remove, | ||
297 | }; | 301 | }; |
298 | 302 | ||
299 | static struct usb_serial_driver digi_acceleport_4_device = { | 303 | static struct usb_serial_driver digi_acceleport_4_device = { |
@@ -320,6 +324,8 @@ static struct usb_serial_driver digi_acceleport_4_device = { | |||
320 | .attach = digi_startup, | 324 | .attach = digi_startup, |
321 | .disconnect = digi_disconnect, | 325 | .disconnect = digi_disconnect, |
322 | .release = digi_release, | 326 | .release = digi_release, |
327 | .port_probe = digi_port_probe, | ||
328 | .port_remove = digi_port_remove, | ||
323 | }; | 329 | }; |
324 | 330 | ||
325 | static struct usb_serial_driver * const serial_drivers[] = { | 331 | static struct usb_serial_driver * const serial_drivers[] = { |
@@ -1240,59 +1246,50 @@ static int digi_startup_device(struct usb_serial *serial) | |||
1240 | return ret; | 1246 | return ret; |
1241 | } | 1247 | } |
1242 | 1248 | ||
1243 | 1249 | static int digi_port_init(struct usb_serial_port *port, unsigned port_num) | |
1244 | static int digi_startup(struct usb_serial *serial) | ||
1245 | { | 1250 | { |
1246 | |||
1247 | int i; | ||
1248 | struct digi_port *priv; | 1251 | struct digi_port *priv; |
1249 | struct digi_serial *serial_priv; | ||
1250 | 1252 | ||
1251 | /* allocate the private data structures for all ports */ | 1253 | priv = kzalloc(sizeof(*priv), GFP_KERNEL); |
1252 | /* number of regular ports + 1 for the out-of-band port */ | 1254 | if (!priv) |
1253 | for (i = 0; i < serial->type->num_ports + 1; i++) { | 1255 | return -ENOMEM; |
1254 | /* allocate port private structure */ | ||
1255 | priv = kmalloc(sizeof(struct digi_port), GFP_KERNEL); | ||
1256 | if (priv == NULL) { | ||
1257 | while (--i >= 0) | ||
1258 | kfree(usb_get_serial_port_data(serial->port[i])); | ||
1259 | return 1; /* error */ | ||
1260 | } | ||
1261 | 1256 | ||
1262 | /* initialize port private structure */ | 1257 | spin_lock_init(&priv->dp_port_lock); |
1263 | spin_lock_init(&priv->dp_port_lock); | 1258 | priv->dp_port_num = port_num; |
1264 | priv->dp_port_num = i; | 1259 | init_waitqueue_head(&priv->dp_modem_change_wait); |
1265 | priv->dp_out_buf_len = 0; | 1260 | init_waitqueue_head(&priv->dp_transmit_idle_wait); |
1266 | priv->dp_write_urb_in_use = 0; | 1261 | init_waitqueue_head(&priv->dp_flush_wait); |
1267 | priv->dp_modem_signals = 0; | 1262 | init_waitqueue_head(&priv->dp_close_wait); |
1268 | init_waitqueue_head(&priv->dp_modem_change_wait); | 1263 | INIT_WORK(&priv->dp_wakeup_work, digi_wakeup_write_lock); |
1269 | priv->dp_transmit_idle = 0; | 1264 | priv->dp_port = port; |
1270 | init_waitqueue_head(&priv->dp_transmit_idle_wait); | ||
1271 | priv->dp_throttled = 0; | ||
1272 | priv->dp_throttle_restart = 0; | ||
1273 | init_waitqueue_head(&priv->dp_flush_wait); | ||
1274 | init_waitqueue_head(&priv->dp_close_wait); | ||
1275 | INIT_WORK(&priv->dp_wakeup_work, digi_wakeup_write_lock); | ||
1276 | priv->dp_port = serial->port[i]; | ||
1277 | /* initialize write wait queue for this port */ | ||
1278 | init_waitqueue_head(&serial->port[i]->write_wait); | ||
1279 | |||
1280 | usb_set_serial_port_data(serial->port[i], priv); | ||
1281 | } | ||
1282 | 1265 | ||
1283 | /* allocate serial private structure */ | 1266 | init_waitqueue_head(&port->write_wait); |
1284 | serial_priv = kmalloc(sizeof(struct digi_serial), GFP_KERNEL); | 1267 | |
1285 | if (serial_priv == NULL) { | 1268 | usb_set_serial_port_data(port, priv); |
1286 | for (i = 0; i < serial->type->num_ports + 1; i++) | 1269 | |
1287 | kfree(usb_get_serial_port_data(serial->port[i])); | 1270 | return 0; |
1288 | return 1; /* error */ | 1271 | } |
1289 | } | 1272 | |
1273 | static int digi_startup(struct usb_serial *serial) | ||
1274 | { | ||
1275 | struct digi_serial *serial_priv; | ||
1276 | int ret; | ||
1277 | |||
1278 | serial_priv = kzalloc(sizeof(*serial_priv), GFP_KERNEL); | ||
1279 | if (!serial_priv) | ||
1280 | return -ENOMEM; | ||
1290 | 1281 | ||
1291 | /* initialize serial private structure */ | ||
1292 | spin_lock_init(&serial_priv->ds_serial_lock); | 1282 | spin_lock_init(&serial_priv->ds_serial_lock); |
1293 | serial_priv->ds_oob_port_num = serial->type->num_ports; | 1283 | serial_priv->ds_oob_port_num = serial->type->num_ports; |
1294 | serial_priv->ds_oob_port = serial->port[serial_priv->ds_oob_port_num]; | 1284 | serial_priv->ds_oob_port = serial->port[serial_priv->ds_oob_port_num]; |
1295 | serial_priv->ds_device_started = 0; | 1285 | |
1286 | ret = digi_port_init(serial_priv->ds_oob_port, | ||
1287 | serial_priv->ds_oob_port_num); | ||
1288 | if (ret) { | ||
1289 | kfree(serial_priv); | ||
1290 | return ret; | ||
1291 | } | ||
1292 | |||
1296 | usb_set_serial_data(serial, serial_priv); | 1293 | usb_set_serial_data(serial, serial_priv); |
1297 | 1294 | ||
1298 | return 0; | 1295 | return 0; |
@@ -1313,15 +1310,35 @@ static void digi_disconnect(struct usb_serial *serial) | |||
1313 | 1310 | ||
1314 | static void digi_release(struct usb_serial *serial) | 1311 | static void digi_release(struct usb_serial *serial) |
1315 | { | 1312 | { |
1316 | int i; | 1313 | struct digi_serial *serial_priv; |
1314 | struct digi_port *priv; | ||
1315 | |||
1316 | serial_priv = usb_get_serial_data(serial); | ||
1317 | |||
1318 | priv = usb_get_serial_port_data(serial_priv->ds_oob_port); | ||
1319 | kfree(priv); | ||
1317 | 1320 | ||
1318 | /* free the private data structures for all ports */ | 1321 | kfree(serial_priv); |
1319 | /* number of regular ports + 1 for the out-of-band port */ | ||
1320 | for (i = 0; i < serial->type->num_ports + 1; i++) | ||
1321 | kfree(usb_get_serial_port_data(serial->port[i])); | ||
1322 | kfree(usb_get_serial_data(serial)); | ||
1323 | } | 1322 | } |
1324 | 1323 | ||
1324 | static int digi_port_probe(struct usb_serial_port *port) | ||
1325 | { | ||
1326 | unsigned port_num; | ||
1327 | |||
1328 | port_num = port->number - port->serial->minor; | ||
1329 | |||
1330 | return digi_port_init(port, port_num); | ||
1331 | } | ||
1332 | |||
1333 | static int digi_port_remove(struct usb_serial_port *port) | ||
1334 | { | ||
1335 | struct digi_port *priv; | ||
1336 | |||
1337 | priv = usb_get_serial_port_data(port); | ||
1338 | kfree(priv); | ||
1339 | |||
1340 | return 0; | ||
1341 | } | ||
1325 | 1342 | ||
1326 | static void digi_read_bulk_callback(struct urb *urb) | 1343 | static void digi_read_bulk_callback(struct urb *urb) |
1327 | { | 1344 | { |
diff --git a/drivers/usb/serial/ipw.c b/drivers/usb/serial/ipw.c index 20a132ec39e2..4264821a3b34 100644 --- a/drivers/usb/serial/ipw.c +++ b/drivers/usb/serial/ipw.c | |||
@@ -203,8 +203,7 @@ static int ipw_open(struct tty_struct *tty, struct usb_serial_port *port) | |||
203 | return 0; | 203 | return 0; |
204 | } | 204 | } |
205 | 205 | ||
206 | /* fake probe - only to allocate data structures */ | 206 | static int ipw_attach(struct usb_serial *serial) |
207 | static int ipw_probe(struct usb_serial *serial, const struct usb_device_id *id) | ||
208 | { | 207 | { |
209 | struct usb_wwan_intf_private *data; | 208 | struct usb_wwan_intf_private *data; |
210 | 209 | ||
@@ -303,9 +302,9 @@ static struct usb_serial_driver ipw_device = { | |||
303 | .num_ports = 1, | 302 | .num_ports = 1, |
304 | .open = ipw_open, | 303 | .open = ipw_open, |
305 | .close = ipw_close, | 304 | .close = ipw_close, |
306 | .probe = ipw_probe, | 305 | .attach = ipw_attach, |
307 | .attach = usb_wwan_startup, | ||
308 | .release = ipw_release, | 306 | .release = ipw_release, |
307 | .port_probe = usb_wwan_port_probe, | ||
309 | .port_remove = usb_wwan_port_remove, | 308 | .port_remove = usb_wwan_port_remove, |
310 | .dtr_rts = ipw_dtr_rts, | 309 | .dtr_rts = ipw_dtr_rts, |
311 | .write = usb_wwan_write, | 310 | .write = usb_wwan_write, |
diff --git a/drivers/usb/serial/keyspan.c b/drivers/usb/serial/keyspan.c index 29c943d737d0..7179b0c5f814 100644 --- a/drivers/usb/serial/keyspan.c +++ b/drivers/usb/serial/keyspan.c | |||
@@ -1374,13 +1374,9 @@ static struct callbacks { | |||
1374 | data in device_details */ | 1374 | data in device_details */ |
1375 | static void keyspan_setup_urbs(struct usb_serial *serial) | 1375 | static void keyspan_setup_urbs(struct usb_serial *serial) |
1376 | { | 1376 | { |
1377 | int i, j; | ||
1378 | struct keyspan_serial_private *s_priv; | 1377 | struct keyspan_serial_private *s_priv; |
1379 | const struct keyspan_device_details *d_details; | 1378 | const struct keyspan_device_details *d_details; |
1380 | struct usb_serial_port *port; | ||
1381 | struct keyspan_port_private *p_priv; | ||
1382 | struct callbacks *cback; | 1379 | struct callbacks *cback; |
1383 | int endp; | ||
1384 | 1380 | ||
1385 | s_priv = usb_get_serial_data(serial); | 1381 | s_priv = usb_get_serial_data(serial); |
1386 | d_details = s_priv->device_details; | 1382 | d_details = s_priv->device_details; |
@@ -1404,45 +1400,6 @@ static void keyspan_setup_urbs(struct usb_serial *serial) | |||
1404 | (serial, d_details->glocont_endpoint, USB_DIR_OUT, | 1400 | (serial, d_details->glocont_endpoint, USB_DIR_OUT, |
1405 | serial, s_priv->glocont_buf, GLOCONT_BUFLEN, | 1401 | serial, s_priv->glocont_buf, GLOCONT_BUFLEN, |
1406 | cback->glocont_callback); | 1402 | cback->glocont_callback); |
1407 | |||
1408 | /* Setup endpoints for each port specific thing */ | ||
1409 | for (i = 0; i < d_details->num_ports; i++) { | ||
1410 | port = serial->port[i]; | ||
1411 | p_priv = usb_get_serial_port_data(port); | ||
1412 | |||
1413 | /* Do indat endpoints first, once for each flip */ | ||
1414 | endp = d_details->indat_endpoints[i]; | ||
1415 | for (j = 0; j <= d_details->indat_endp_flip; ++j, ++endp) { | ||
1416 | p_priv->in_urbs[j] = keyspan_setup_urb | ||
1417 | (serial, endp, USB_DIR_IN, port, | ||
1418 | p_priv->in_buffer[j], 64, | ||
1419 | cback->indat_callback); | ||
1420 | } | ||
1421 | for (; j < 2; ++j) | ||
1422 | p_priv->in_urbs[j] = NULL; | ||
1423 | |||
1424 | /* outdat endpoints also have flip */ | ||
1425 | endp = d_details->outdat_endpoints[i]; | ||
1426 | for (j = 0; j <= d_details->outdat_endp_flip; ++j, ++endp) { | ||
1427 | p_priv->out_urbs[j] = keyspan_setup_urb | ||
1428 | (serial, endp, USB_DIR_OUT, port, | ||
1429 | p_priv->out_buffer[j], 64, | ||
1430 | cback->outdat_callback); | ||
1431 | } | ||
1432 | for (; j < 2; ++j) | ||
1433 | p_priv->out_urbs[j] = NULL; | ||
1434 | |||
1435 | /* inack endpoint */ | ||
1436 | p_priv->inack_urb = keyspan_setup_urb | ||
1437 | (serial, d_details->inack_endpoints[i], USB_DIR_IN, | ||
1438 | port, p_priv->inack_buffer, 1, cback->inack_callback); | ||
1439 | |||
1440 | /* outcont endpoint */ | ||
1441 | p_priv->outcont_urb = keyspan_setup_urb | ||
1442 | (serial, d_details->outcont_endpoints[i], USB_DIR_OUT, | ||
1443 | port, p_priv->outcont_buffer, 64, | ||
1444 | cback->outcont_callback); | ||
1445 | } | ||
1446 | } | 1403 | } |
1447 | 1404 | ||
1448 | /* usa19 function doesn't require prescaler */ | 1405 | /* usa19 function doesn't require prescaler */ |
@@ -2407,9 +2364,7 @@ static void keyspan_send_setup(struct usb_serial_port *port, int reset_port) | |||
2407 | static int keyspan_startup(struct usb_serial *serial) | 2364 | static int keyspan_startup(struct usb_serial *serial) |
2408 | { | 2365 | { |
2409 | int i, err; | 2366 | int i, err; |
2410 | struct usb_serial_port *port; | ||
2411 | struct keyspan_serial_private *s_priv; | 2367 | struct keyspan_serial_private *s_priv; |
2412 | struct keyspan_port_private *p_priv; | ||
2413 | const struct keyspan_device_details *d_details; | 2368 | const struct keyspan_device_details *d_details; |
2414 | 2369 | ||
2415 | for (i = 0; (d_details = keyspan_devices[i]) != NULL; ++i) | 2370 | for (i = 0; (d_details = keyspan_devices[i]) != NULL; ++i) |
@@ -2432,19 +2387,6 @@ static int keyspan_startup(struct usb_serial *serial) | |||
2432 | s_priv->device_details = d_details; | 2387 | s_priv->device_details = d_details; |
2433 | usb_set_serial_data(serial, s_priv); | 2388 | usb_set_serial_data(serial, s_priv); |
2434 | 2389 | ||
2435 | /* Now setup per port private data */ | ||
2436 | for (i = 0; i < serial->num_ports; i++) { | ||
2437 | port = serial->port[i]; | ||
2438 | p_priv = kzalloc(sizeof(struct keyspan_port_private), | ||
2439 | GFP_KERNEL); | ||
2440 | if (!p_priv) { | ||
2441 | dev_dbg(&port->dev, "%s - kmalloc for keyspan_port_private (%d) failed!.\n", __func__, i); | ||
2442 | return 1; | ||
2443 | } | ||
2444 | p_priv->device_details = d_details; | ||
2445 | usb_set_serial_port_data(port, p_priv); | ||
2446 | } | ||
2447 | |||
2448 | keyspan_setup_urbs(serial); | 2390 | keyspan_setup_urbs(serial); |
2449 | 2391 | ||
2450 | if (s_priv->instat_urb != NULL) { | 2392 | if (s_priv->instat_urb != NULL) { |
@@ -2463,59 +2405,112 @@ static int keyspan_startup(struct usb_serial *serial) | |||
2463 | 2405 | ||
2464 | static void keyspan_disconnect(struct usb_serial *serial) | 2406 | static void keyspan_disconnect(struct usb_serial *serial) |
2465 | { | 2407 | { |
2466 | int i, j; | 2408 | struct keyspan_serial_private *s_priv; |
2467 | struct usb_serial_port *port; | ||
2468 | struct keyspan_serial_private *s_priv; | ||
2469 | struct keyspan_port_private *p_priv; | ||
2470 | 2409 | ||
2471 | s_priv = usb_get_serial_data(serial); | 2410 | s_priv = usb_get_serial_data(serial); |
2472 | 2411 | ||
2473 | /* Stop reading/writing urbs */ | ||
2474 | stop_urb(s_priv->instat_urb); | 2412 | stop_urb(s_priv->instat_urb); |
2475 | stop_urb(s_priv->glocont_urb); | 2413 | stop_urb(s_priv->glocont_urb); |
2476 | stop_urb(s_priv->indat_urb); | 2414 | stop_urb(s_priv->indat_urb); |
2477 | for (i = 0; i < serial->num_ports; ++i) { | 2415 | } |
2478 | port = serial->port[i]; | 2416 | |
2479 | p_priv = usb_get_serial_port_data(port); | 2417 | static void keyspan_release(struct usb_serial *serial) |
2480 | stop_urb(p_priv->inack_urb); | 2418 | { |
2481 | stop_urb(p_priv->outcont_urb); | 2419 | struct keyspan_serial_private *s_priv; |
2482 | for (j = 0; j < 2; j++) { | 2420 | |
2483 | stop_urb(p_priv->in_urbs[j]); | 2421 | s_priv = usb_get_serial_data(serial); |
2484 | stop_urb(p_priv->out_urbs[j]); | ||
2485 | } | ||
2486 | } | ||
2487 | 2422 | ||
2488 | /* Now free them */ | ||
2489 | usb_free_urb(s_priv->instat_urb); | 2423 | usb_free_urb(s_priv->instat_urb); |
2490 | usb_free_urb(s_priv->indat_urb); | 2424 | usb_free_urb(s_priv->indat_urb); |
2491 | usb_free_urb(s_priv->glocont_urb); | 2425 | usb_free_urb(s_priv->glocont_urb); |
2492 | for (i = 0; i < serial->num_ports; ++i) { | 2426 | |
2493 | port = serial->port[i]; | 2427 | kfree(s_priv); |
2494 | p_priv = usb_get_serial_port_data(port); | ||
2495 | usb_free_urb(p_priv->inack_urb); | ||
2496 | usb_free_urb(p_priv->outcont_urb); | ||
2497 | for (j = 0; j < 2; j++) { | ||
2498 | usb_free_urb(p_priv->in_urbs[j]); | ||
2499 | usb_free_urb(p_priv->out_urbs[j]); | ||
2500 | } | ||
2501 | } | ||
2502 | } | 2428 | } |
2503 | 2429 | ||
2504 | static void keyspan_release(struct usb_serial *serial) | 2430 | static int keyspan_port_probe(struct usb_serial_port *port) |
2505 | { | 2431 | { |
2506 | int i; | 2432 | struct usb_serial *serial = port->serial; |
2507 | struct usb_serial_port *port; | 2433 | struct keyspan_port_private *s_priv; |
2508 | struct keyspan_serial_private *s_priv; | 2434 | struct keyspan_port_private *p_priv; |
2435 | const struct keyspan_device_details *d_details; | ||
2436 | struct callbacks *cback; | ||
2437 | int endp; | ||
2438 | int port_num; | ||
2439 | int i; | ||
2509 | 2440 | ||
2510 | s_priv = usb_get_serial_data(serial); | 2441 | s_priv = usb_get_serial_data(serial); |
2442 | d_details = s_priv->device_details; | ||
2511 | 2443 | ||
2512 | kfree(s_priv); | 2444 | p_priv = kzalloc(sizeof(*p_priv), GFP_KERNEL); |
2445 | if (!p_priv) | ||
2446 | return -ENOMEM; | ||
2513 | 2447 | ||
2514 | /* Now free per port private data */ | 2448 | s_priv = usb_get_serial_data(port->serial); |
2515 | for (i = 0; i < serial->num_ports; i++) { | 2449 | p_priv->device_details = d_details; |
2516 | port = serial->port[i]; | 2450 | |
2517 | kfree(usb_get_serial_port_data(port)); | 2451 | /* Setup values for the various callback routines */ |
2452 | cback = &keyspan_callbacks[d_details->msg_format]; | ||
2453 | |||
2454 | port_num = port->number - port->serial->minor; | ||
2455 | |||
2456 | /* Do indat endpoints first, once for each flip */ | ||
2457 | endp = d_details->indat_endpoints[port_num]; | ||
2458 | for (i = 0; i <= d_details->indat_endp_flip; ++i, ++endp) { | ||
2459 | p_priv->in_urbs[i] = keyspan_setup_urb(serial, endp, | ||
2460 | USB_DIR_IN, port, | ||
2461 | p_priv->in_buffer[i], 64, | ||
2462 | cback->indat_callback); | ||
2463 | } | ||
2464 | /* outdat endpoints also have flip */ | ||
2465 | endp = d_details->outdat_endpoints[port_num]; | ||
2466 | for (i = 0; i <= d_details->outdat_endp_flip; ++i, ++endp) { | ||
2467 | p_priv->out_urbs[i] = keyspan_setup_urb(serial, endp, | ||
2468 | USB_DIR_OUT, port, | ||
2469 | p_priv->out_buffer[i], 64, | ||
2470 | cback->outdat_callback); | ||
2471 | } | ||
2472 | /* inack endpoint */ | ||
2473 | p_priv->inack_urb = keyspan_setup_urb(serial, | ||
2474 | d_details->inack_endpoints[port_num], | ||
2475 | USB_DIR_IN, port, | ||
2476 | p_priv->inack_buffer, 1, | ||
2477 | cback->inack_callback); | ||
2478 | /* outcont endpoint */ | ||
2479 | p_priv->outcont_urb = keyspan_setup_urb(serial, | ||
2480 | d_details->outcont_endpoints[port_num], | ||
2481 | USB_DIR_OUT, port, | ||
2482 | p_priv->outcont_buffer, 64, | ||
2483 | cback->outcont_callback); | ||
2484 | |||
2485 | usb_set_serial_port_data(port, p_priv); | ||
2486 | |||
2487 | return 0; | ||
2488 | } | ||
2489 | |||
2490 | static int keyspan_port_remove(struct usb_serial_port *port) | ||
2491 | { | ||
2492 | struct keyspan_port_private *p_priv; | ||
2493 | int i; | ||
2494 | |||
2495 | p_priv = usb_get_serial_port_data(port); | ||
2496 | |||
2497 | stop_urb(p_priv->inack_urb); | ||
2498 | stop_urb(p_priv->outcont_urb); | ||
2499 | for (i = 0; i < 2; i++) { | ||
2500 | stop_urb(p_priv->in_urbs[i]); | ||
2501 | stop_urb(p_priv->out_urbs[i]); | ||
2502 | } | ||
2503 | |||
2504 | usb_free_urb(p_priv->inack_urb); | ||
2505 | usb_free_urb(p_priv->outcont_urb); | ||
2506 | for (i = 0; i < 2; i++) { | ||
2507 | usb_free_urb(p_priv->in_urbs[i]); | ||
2508 | usb_free_urb(p_priv->out_urbs[i]); | ||
2518 | } | 2509 | } |
2510 | |||
2511 | kfree(p_priv); | ||
2512 | |||
2513 | return 0; | ||
2519 | } | 2514 | } |
2520 | 2515 | ||
2521 | MODULE_AUTHOR(DRIVER_AUTHOR); | 2516 | MODULE_AUTHOR(DRIVER_AUTHOR); |
diff --git a/drivers/usb/serial/keyspan.h b/drivers/usb/serial/keyspan.h index 0a8a40b5711e..0273dda303a4 100644 --- a/drivers/usb/serial/keyspan.h +++ b/drivers/usb/serial/keyspan.h | |||
@@ -42,6 +42,8 @@ static void keyspan_dtr_rts (struct usb_serial_port *port, int on); | |||
42 | static int keyspan_startup (struct usb_serial *serial); | 42 | static int keyspan_startup (struct usb_serial *serial); |
43 | static void keyspan_disconnect (struct usb_serial *serial); | 43 | static void keyspan_disconnect (struct usb_serial *serial); |
44 | static void keyspan_release (struct usb_serial *serial); | 44 | static void keyspan_release (struct usb_serial *serial); |
45 | static int keyspan_port_probe(struct usb_serial_port *port); | ||
46 | static int keyspan_port_remove(struct usb_serial_port *port); | ||
45 | static int keyspan_write_room (struct tty_struct *tty); | 47 | static int keyspan_write_room (struct tty_struct *tty); |
46 | 48 | ||
47 | static int keyspan_write (struct tty_struct *tty, | 49 | static int keyspan_write (struct tty_struct *tty, |
@@ -567,6 +569,8 @@ static struct usb_serial_driver keyspan_1port_device = { | |||
567 | .attach = keyspan_startup, | 569 | .attach = keyspan_startup, |
568 | .disconnect = keyspan_disconnect, | 570 | .disconnect = keyspan_disconnect, |
569 | .release = keyspan_release, | 571 | .release = keyspan_release, |
572 | .port_probe = keyspan_port_probe, | ||
573 | .port_remove = keyspan_port_remove, | ||
570 | }; | 574 | }; |
571 | 575 | ||
572 | static struct usb_serial_driver keyspan_2port_device = { | 576 | static struct usb_serial_driver keyspan_2port_device = { |
@@ -589,6 +593,8 @@ static struct usb_serial_driver keyspan_2port_device = { | |||
589 | .attach = keyspan_startup, | 593 | .attach = keyspan_startup, |
590 | .disconnect = keyspan_disconnect, | 594 | .disconnect = keyspan_disconnect, |
591 | .release = keyspan_release, | 595 | .release = keyspan_release, |
596 | .port_probe = keyspan_port_probe, | ||
597 | .port_remove = keyspan_port_remove, | ||
592 | }; | 598 | }; |
593 | 599 | ||
594 | static struct usb_serial_driver keyspan_4port_device = { | 600 | static struct usb_serial_driver keyspan_4port_device = { |
@@ -611,6 +617,8 @@ static struct usb_serial_driver keyspan_4port_device = { | |||
611 | .attach = keyspan_startup, | 617 | .attach = keyspan_startup, |
612 | .disconnect = keyspan_disconnect, | 618 | .disconnect = keyspan_disconnect, |
613 | .release = keyspan_release, | 619 | .release = keyspan_release, |
620 | .port_probe = keyspan_port_probe, | ||
621 | .port_remove = keyspan_port_remove, | ||
614 | }; | 622 | }; |
615 | 623 | ||
616 | static struct usb_serial_driver * const serial_drivers[] = { | 624 | static struct usb_serial_driver * const serial_drivers[] = { |
diff --git a/drivers/usb/serial/mct_u232.c b/drivers/usb/serial/mct_u232.c index f3947712e137..8a2081004107 100644 --- a/drivers/usb/serial/mct_u232.c +++ b/drivers/usb/serial/mct_u232.c | |||
@@ -49,7 +49,8 @@ | |||
49 | * Function prototypes | 49 | * Function prototypes |
50 | */ | 50 | */ |
51 | static int mct_u232_startup(struct usb_serial *serial); | 51 | static int mct_u232_startup(struct usb_serial *serial); |
52 | static void mct_u232_release(struct usb_serial *serial); | 52 | static int mct_u232_port_probe(struct usb_serial_port *port); |
53 | static int mct_u232_port_remove(struct usb_serial_port *remove); | ||
53 | static int mct_u232_open(struct tty_struct *tty, struct usb_serial_port *port); | 54 | static int mct_u232_open(struct tty_struct *tty, struct usb_serial_port *port); |
54 | static void mct_u232_close(struct usb_serial_port *port); | 55 | static void mct_u232_close(struct usb_serial_port *port); |
55 | static void mct_u232_dtr_rts(struct usb_serial_port *port, int on); | 56 | static void mct_u232_dtr_rts(struct usb_serial_port *port, int on); |
@@ -99,7 +100,8 @@ static struct usb_serial_driver mct_u232_device = { | |||
99 | .tiocmget = mct_u232_tiocmget, | 100 | .tiocmget = mct_u232_tiocmget, |
100 | .tiocmset = mct_u232_tiocmset, | 101 | .tiocmset = mct_u232_tiocmset, |
101 | .attach = mct_u232_startup, | 102 | .attach = mct_u232_startup, |
102 | .release = mct_u232_release, | 103 | .port_probe = mct_u232_port_probe, |
104 | .port_remove = mct_u232_port_remove, | ||
103 | .ioctl = mct_u232_ioctl, | 105 | .ioctl = mct_u232_ioctl, |
104 | .get_icount = mct_u232_get_icount, | 106 | .get_icount = mct_u232_get_icount, |
105 | }; | 107 | }; |
@@ -388,18 +390,8 @@ static void mct_u232_msr_to_state(struct usb_serial_port *port, | |||
388 | 390 | ||
389 | static int mct_u232_startup(struct usb_serial *serial) | 391 | static int mct_u232_startup(struct usb_serial *serial) |
390 | { | 392 | { |
391 | struct mct_u232_private *priv; | ||
392 | struct usb_serial_port *port, *rport; | 393 | struct usb_serial_port *port, *rport; |
393 | 394 | ||
394 | priv = kzalloc(sizeof(struct mct_u232_private), GFP_KERNEL); | ||
395 | if (!priv) | ||
396 | return -ENOMEM; | ||
397 | spin_lock_init(&priv->lock); | ||
398 | init_waitqueue_head(&priv->msr_wait); | ||
399 | usb_set_serial_port_data(serial->port[0], priv); | ||
400 | |||
401 | init_waitqueue_head(&serial->port[0]->write_wait); | ||
402 | |||
403 | /* Puh, that's dirty */ | 395 | /* Puh, that's dirty */ |
404 | port = serial->port[0]; | 396 | port = serial->port[0]; |
405 | rport = serial->port[1]; | 397 | rport = serial->port[1]; |
@@ -412,18 +404,31 @@ static int mct_u232_startup(struct usb_serial *serial) | |||
412 | return 0; | 404 | return 0; |
413 | } /* mct_u232_startup */ | 405 | } /* mct_u232_startup */ |
414 | 406 | ||
407 | static int mct_u232_port_probe(struct usb_serial_port *port) | ||
408 | { | ||
409 | struct mct_u232_private *priv; | ||
410 | |||
411 | priv = kzalloc(sizeof(*priv), GFP_KERNEL); | ||
412 | if (!priv) | ||
413 | return -ENOMEM; | ||
414 | |||
415 | spin_lock_init(&priv->lock); | ||
416 | init_waitqueue_head(&priv->msr_wait); | ||
417 | |||
418 | usb_set_serial_port_data(port, priv); | ||
415 | 419 | ||
416 | static void mct_u232_release(struct usb_serial *serial) | 420 | return 0; |
421 | } | ||
422 | |||
423 | static int mct_u232_port_remove(struct usb_serial_port *port) | ||
417 | { | 424 | { |
418 | struct mct_u232_private *priv; | 425 | struct mct_u232_private *priv; |
419 | int i; | ||
420 | 426 | ||
421 | for (i = 0; i < serial->num_ports; ++i) { | 427 | priv = usb_get_serial_port_data(port); |
422 | /* My special items, the standard routines free my urbs */ | 428 | kfree(priv); |
423 | priv = usb_get_serial_port_data(serial->port[i]); | 429 | |
424 | kfree(priv); | 430 | return 0; |
425 | } | 431 | } |
426 | } /* mct_u232_release */ | ||
427 | 432 | ||
428 | static int mct_u232_open(struct tty_struct *tty, struct usb_serial_port *port) | 433 | static int mct_u232_open(struct tty_struct *tty, struct usb_serial_port *port) |
429 | { | 434 | { |
@@ -515,12 +520,14 @@ static void mct_u232_dtr_rts(struct usb_serial_port *port, int on) | |||
515 | 520 | ||
516 | static void mct_u232_close(struct usb_serial_port *port) | 521 | static void mct_u232_close(struct usb_serial_port *port) |
517 | { | 522 | { |
518 | if (port->serial->dev) { | 523 | /* |
519 | /* shutdown our urbs */ | 524 | * Must kill the read urb as it is actually an interrupt urb, which |
520 | usb_kill_urb(port->write_urb); | 525 | * generic close thus fails to kill. |
521 | usb_kill_urb(port->read_urb); | 526 | */ |
522 | usb_kill_urb(port->interrupt_in_urb); | 527 | usb_kill_urb(port->read_urb); |
523 | } | 528 | usb_kill_urb(port->interrupt_in_urb); |
529 | |||
530 | usb_serial_generic_close(port); | ||
524 | } /* mct_u232_close */ | 531 | } /* mct_u232_close */ |
525 | 532 | ||
526 | 533 | ||
diff --git a/drivers/usb/serial/metro-usb.c b/drivers/usb/serial/metro-usb.c index 0b257ddffbdb..6f29c74eb769 100644 --- a/drivers/usb/serial/metro-usb.c +++ b/drivers/usb/serial/metro-usb.c | |||
@@ -179,16 +179,13 @@ static void metrousb_cleanup(struct usb_serial_port *port) | |||
179 | { | 179 | { |
180 | dev_dbg(&port->dev, "%s\n", __func__); | 180 | dev_dbg(&port->dev, "%s\n", __func__); |
181 | 181 | ||
182 | if (port->serial->dev) { | 182 | usb_unlink_urb(port->interrupt_in_urb); |
183 | /* Shutdown any interrupt in urbs. */ | 183 | usb_kill_urb(port->interrupt_in_urb); |
184 | if (port->interrupt_in_urb) { | 184 | |
185 | usb_unlink_urb(port->interrupt_in_urb); | 185 | mutex_lock(&port->serial->disc_mutex); |
186 | usb_kill_urb(port->interrupt_in_urb); | 186 | if (!port->serial->disconnected) |
187 | } | ||
188 | |||
189 | /* Send deactivate cmd to device */ | ||
190 | metrousb_send_unidirectional_cmd(UNI_CMD_CLOSE, port); | 187 | metrousb_send_unidirectional_cmd(UNI_CMD_CLOSE, port); |
191 | } | 188 | mutex_unlock(&port->serial->disc_mutex); |
192 | } | 189 | } |
193 | 190 | ||
194 | static int metrousb_open(struct tty_struct *tty, struct usb_serial_port *port) | 191 | static int metrousb_open(struct tty_struct *tty, struct usb_serial_port *port) |
@@ -271,51 +268,27 @@ static int metrousb_set_modem_ctrl(struct usb_serial *serial, unsigned int contr | |||
271 | return retval; | 268 | return retval; |
272 | } | 269 | } |
273 | 270 | ||
274 | static void metrousb_shutdown(struct usb_serial *serial) | 271 | static int metrousb_port_probe(struct usb_serial_port *port) |
275 | { | 272 | { |
276 | int i = 0; | 273 | struct metrousb_private *metro_priv; |
277 | 274 | ||
278 | dev_dbg(&serial->dev->dev, "%s\n", __func__); | 275 | metro_priv = kzalloc(sizeof(*metro_priv), GFP_KERNEL); |
276 | if (!metro_priv) | ||
277 | return -ENOMEM; | ||
279 | 278 | ||
280 | /* Stop reading and writing on all ports. */ | 279 | spin_lock_init(&metro_priv->lock); |
281 | for (i = 0; i < serial->num_ports; ++i) { | ||
282 | /* Close any open urbs. */ | ||
283 | metrousb_cleanup(serial->port[i]); | ||
284 | 280 | ||
285 | /* Free memory. */ | 281 | usb_set_serial_port_data(port, metro_priv); |
286 | kfree(usb_get_serial_port_data(serial->port[i])); | ||
287 | usb_set_serial_port_data(serial->port[i], NULL); | ||
288 | 282 | ||
289 | dev_dbg(&serial->dev->dev, "%s - freed port number=%d\n", | 283 | return 0; |
290 | __func__, serial->port[i]->number); | ||
291 | } | ||
292 | } | 284 | } |
293 | 285 | ||
294 | static int metrousb_startup(struct usb_serial *serial) | 286 | static int metrousb_port_remove(struct usb_serial_port *port) |
295 | { | 287 | { |
296 | struct metrousb_private *metro_priv; | 288 | struct metrousb_private *metro_priv; |
297 | struct usb_serial_port *port; | ||
298 | int i = 0; | ||
299 | 289 | ||
300 | dev_dbg(&serial->dev->dev, "%s\n", __func__); | 290 | metro_priv = usb_get_serial_port_data(port); |
301 | 291 | kfree(metro_priv); | |
302 | /* Loop through the serial ports setting up the private structures. | ||
303 | * Currently we only use one port. */ | ||
304 | for (i = 0; i < serial->num_ports; ++i) { | ||
305 | port = serial->port[i]; | ||
306 | |||
307 | /* Declare memory. */ | ||
308 | metro_priv = kzalloc(sizeof(struct metrousb_private), GFP_KERNEL); | ||
309 | if (!metro_priv) | ||
310 | return -ENOMEM; | ||
311 | |||
312 | /* Initialize memory. */ | ||
313 | spin_lock_init(&metro_priv->lock); | ||
314 | usb_set_serial_port_data(port, metro_priv); | ||
315 | |||
316 | dev_dbg(&serial->dev->dev, "%s - port number=%d\n ", | ||
317 | __func__, port->number); | ||
318 | } | ||
319 | 292 | ||
320 | return 0; | 293 | return 0; |
321 | } | 294 | } |
@@ -414,8 +387,8 @@ static struct usb_serial_driver metrousb_device = { | |||
414 | .close = metrousb_cleanup, | 387 | .close = metrousb_cleanup, |
415 | .read_int_callback = metrousb_read_int_callback, | 388 | .read_int_callback = metrousb_read_int_callback, |
416 | .write_int_callback = metrousb_write_int_callback, | 389 | .write_int_callback = metrousb_write_int_callback, |
417 | .attach = metrousb_startup, | 390 | .port_probe = metrousb_port_probe, |
418 | .release = metrousb_shutdown, | 391 | .port_remove = metrousb_port_remove, |
419 | .throttle = metrousb_throttle, | 392 | .throttle = metrousb_throttle, |
420 | .unthrottle = metrousb_unthrottle, | 393 | .unthrottle = metrousb_unthrottle, |
421 | .tiocmget = metrousb_tiocmget, | 394 | .tiocmget = metrousb_tiocmget, |
diff --git a/drivers/usb/serial/mos7720.c b/drivers/usb/serial/mos7720.c index 1bf1ad066666..75267421aad8 100644 --- a/drivers/usb/serial/mos7720.c +++ b/drivers/usb/serial/mos7720.c | |||
@@ -1966,9 +1966,7 @@ static int mos7720_ioctl(struct tty_struct *tty, | |||
1966 | 1966 | ||
1967 | static int mos7720_startup(struct usb_serial *serial) | 1967 | static int mos7720_startup(struct usb_serial *serial) |
1968 | { | 1968 | { |
1969 | struct moschip_port *mos7720_port; | ||
1970 | struct usb_device *dev; | 1969 | struct usb_device *dev; |
1971 | int i; | ||
1972 | char data; | 1970 | char data; |
1973 | u16 product; | 1971 | u16 product; |
1974 | int ret_val; | 1972 | int ret_val; |
@@ -1999,29 +1997,6 @@ static int mos7720_startup(struct usb_serial *serial) | |||
1999 | serial->port[1]->interrupt_in_buffer = NULL; | 1997 | serial->port[1]->interrupt_in_buffer = NULL; |
2000 | } | 1998 | } |
2001 | 1999 | ||
2002 | |||
2003 | /* set up serial port private structures */ | ||
2004 | for (i = 0; i < serial->num_ports; ++i) { | ||
2005 | mos7720_port = kzalloc(sizeof(struct moschip_port), GFP_KERNEL); | ||
2006 | if (mos7720_port == NULL) { | ||
2007 | dev_err(&dev->dev, "%s - Out of memory\n", __func__); | ||
2008 | return -ENOMEM; | ||
2009 | } | ||
2010 | |||
2011 | /* Initialize all port interrupt end point to port 0 int | ||
2012 | * endpoint. Our device has only one interrupt endpoint | ||
2013 | * common to all ports */ | ||
2014 | serial->port[i]->interrupt_in_endpointAddress = | ||
2015 | serial->port[0]->interrupt_in_endpointAddress; | ||
2016 | |||
2017 | mos7720_port->port = serial->port[i]; | ||
2018 | usb_set_serial_port_data(serial->port[i], mos7720_port); | ||
2019 | |||
2020 | dev_dbg(&dev->dev, "port number is %d\n", serial->port[i]->number); | ||
2021 | dev_dbg(&dev->dev, "serial number is %d\n", serial->minor); | ||
2022 | } | ||
2023 | |||
2024 | |||
2025 | /* setting configuration feature to one */ | 2000 | /* setting configuration feature to one */ |
2026 | usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0), | 2001 | usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0), |
2027 | (__u8)0x03, 0x00, 0x01, 0x00, NULL, 0x00, 5*HZ); | 2002 | (__u8)0x03, 0x00, 0x01, 0x00, NULL, 0x00, 5*HZ); |
@@ -2049,8 +2024,6 @@ static int mos7720_startup(struct usb_serial *serial) | |||
2049 | 2024 | ||
2050 | static void mos7720_release(struct usb_serial *serial) | 2025 | static void mos7720_release(struct usb_serial *serial) |
2051 | { | 2026 | { |
2052 | int i; | ||
2053 | |||
2054 | #ifdef CONFIG_USB_SERIAL_MOS7715_PARPORT | 2027 | #ifdef CONFIG_USB_SERIAL_MOS7715_PARPORT |
2055 | /* close the parallel port */ | 2028 | /* close the parallel port */ |
2056 | 2029 | ||
@@ -2089,9 +2062,36 @@ static void mos7720_release(struct usb_serial *serial) | |||
2089 | kref_put(&mos_parport->ref_count, destroy_mos_parport); | 2062 | kref_put(&mos_parport->ref_count, destroy_mos_parport); |
2090 | } | 2063 | } |
2091 | #endif | 2064 | #endif |
2092 | /* free private structure allocated for serial port */ | 2065 | } |
2093 | for (i = 0; i < serial->num_ports; ++i) | 2066 | |
2094 | kfree(usb_get_serial_port_data(serial->port[i])); | 2067 | static int mos7720_port_probe(struct usb_serial_port *port) |
2068 | { | ||
2069 | struct moschip_port *mos7720_port; | ||
2070 | |||
2071 | mos7720_port = kzalloc(sizeof(*mos7720_port), GFP_KERNEL); | ||
2072 | if (!mos7720_port) | ||
2073 | return -ENOMEM; | ||
2074 | |||
2075 | /* Initialize all port interrupt end point to port 0 int endpoint. | ||
2076 | * Our device has only one interrupt endpoint common to all ports. | ||
2077 | */ | ||
2078 | port->interrupt_in_endpointAddress = | ||
2079 | port->serial->port[0]->interrupt_in_endpointAddress; | ||
2080 | mos7720_port->port = port; | ||
2081 | |||
2082 | usb_set_serial_port_data(port, mos7720_port); | ||
2083 | |||
2084 | return 0; | ||
2085 | } | ||
2086 | |||
2087 | static int mos7720_port_remove(struct usb_serial_port *port) | ||
2088 | { | ||
2089 | struct moschip_port *mos7720_port; | ||
2090 | |||
2091 | mos7720_port = usb_get_serial_port_data(port); | ||
2092 | kfree(mos7720_port); | ||
2093 | |||
2094 | return 0; | ||
2095 | } | 2095 | } |
2096 | 2096 | ||
2097 | static struct usb_serial_driver moschip7720_2port_driver = { | 2097 | static struct usb_serial_driver moschip7720_2port_driver = { |
@@ -2109,6 +2109,8 @@ static struct usb_serial_driver moschip7720_2port_driver = { | |||
2109 | .probe = mos77xx_probe, | 2109 | .probe = mos77xx_probe, |
2110 | .attach = mos7720_startup, | 2110 | .attach = mos7720_startup, |
2111 | .release = mos7720_release, | 2111 | .release = mos7720_release, |
2112 | .port_probe = mos7720_port_probe, | ||
2113 | .port_remove = mos7720_port_remove, | ||
2112 | .ioctl = mos7720_ioctl, | 2114 | .ioctl = mos7720_ioctl, |
2113 | .tiocmget = mos7720_tiocmget, | 2115 | .tiocmget = mos7720_tiocmget, |
2114 | .tiocmset = mos7720_tiocmset, | 2116 | .tiocmset = mos7720_tiocmset, |
diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c index d6d4eeca8c68..1cf3375ec1af 100644 --- a/drivers/usb/serial/mos7840.c +++ b/drivers/usb/serial/mos7840.c | |||
@@ -218,12 +218,10 @@ struct moschip_port { | |||
218 | int port_num; /*Actual port number in the device(1,2,etc) */ | 218 | int port_num; /*Actual port number in the device(1,2,etc) */ |
219 | struct urb *write_urb; /* write URB for this port */ | 219 | struct urb *write_urb; /* write URB for this port */ |
220 | struct urb *read_urb; /* read URB for this port */ | 220 | struct urb *read_urb; /* read URB for this port */ |
221 | struct urb *int_urb; | ||
222 | __u8 shadowLCR; /* last LCR value received */ | 221 | __u8 shadowLCR; /* last LCR value received */ |
223 | __u8 shadowMCR; /* last MCR value received */ | 222 | __u8 shadowMCR; /* last MCR value received */ |
224 | char open; | 223 | char open; |
225 | char open_ports; | 224 | char open_ports; |
226 | char zombie; | ||
227 | wait_queue_head_t wait_chase; /* for handling sleeping while waiting for chase to finish */ | 225 | wait_queue_head_t wait_chase; /* for handling sleeping while waiting for chase to finish */ |
228 | wait_queue_head_t delta_msr_wait; /* for handling sleeping while waiting for msr change to happen */ | 226 | wait_queue_head_t delta_msr_wait; /* for handling sleeping while waiting for msr change to happen */ |
229 | int delta_msr_cond; | 227 | int delta_msr_cond; |
@@ -478,7 +476,6 @@ static void mos7840_control_callback(struct urb *urb) | |||
478 | struct moschip_port *mos7840_port; | 476 | struct moschip_port *mos7840_port; |
479 | struct device *dev = &urb->dev->dev; | 477 | struct device *dev = &urb->dev->dev; |
480 | __u8 regval = 0x0; | 478 | __u8 regval = 0x0; |
481 | int result = 0; | ||
482 | int status = urb->status; | 479 | int status = urb->status; |
483 | 480 | ||
484 | mos7840_port = urb->context; | 481 | mos7840_port = urb->context; |
@@ -495,7 +492,7 @@ static void mos7840_control_callback(struct urb *urb) | |||
495 | return; | 492 | return; |
496 | default: | 493 | default: |
497 | dev_dbg(dev, "%s - nonzero urb status received: %d\n", __func__, status); | 494 | dev_dbg(dev, "%s - nonzero urb status received: %d\n", __func__, status); |
498 | goto exit; | 495 | return; |
499 | } | 496 | } |
500 | 497 | ||
501 | dev_dbg(dev, "%s urb buffer size is %d\n", __func__, urb->actual_length); | 498 | dev_dbg(dev, "%s urb buffer size is %d\n", __func__, urb->actual_length); |
@@ -508,16 +505,6 @@ static void mos7840_control_callback(struct urb *urb) | |||
508 | mos7840_handle_new_msr(mos7840_port, regval); | 505 | mos7840_handle_new_msr(mos7840_port, regval); |
509 | else if (mos7840_port->MsrLsr == 1) | 506 | else if (mos7840_port->MsrLsr == 1) |
510 | mos7840_handle_new_lsr(mos7840_port, regval); | 507 | mos7840_handle_new_lsr(mos7840_port, regval); |
511 | |||
512 | exit: | ||
513 | spin_lock(&mos7840_port->pool_lock); | ||
514 | if (!mos7840_port->zombie) | ||
515 | result = usb_submit_urb(mos7840_port->int_urb, GFP_ATOMIC); | ||
516 | spin_unlock(&mos7840_port->pool_lock); | ||
517 | if (result) { | ||
518 | dev_err(dev, "%s - Error %d submitting interrupt urb\n", | ||
519 | __func__, result); | ||
520 | } | ||
521 | } | 508 | } |
522 | 509 | ||
523 | static int mos7840_get_reg(struct moschip_port *mcs, __u16 Wval, __u16 reg, | 510 | static int mos7840_get_reg(struct moschip_port *mcs, __u16 Wval, __u16 reg, |
@@ -686,14 +673,7 @@ static void mos7840_interrupt_callback(struct urb *urb) | |||
686 | wreg = MODEM_STATUS_REGISTER; | 673 | wreg = MODEM_STATUS_REGISTER; |
687 | break; | 674 | break; |
688 | } | 675 | } |
689 | spin_lock(&mos7840_port->pool_lock); | 676 | rv = mos7840_get_reg(mos7840_port, wval, wreg, &Data); |
690 | if (!mos7840_port->zombie) { | ||
691 | rv = mos7840_get_reg(mos7840_port, wval, wreg, &Data); | ||
692 | } else { | ||
693 | spin_unlock(&mos7840_port->pool_lock); | ||
694 | return; | ||
695 | } | ||
696 | spin_unlock(&mos7840_port->pool_lock); | ||
697 | } | 677 | } |
698 | } | 678 | } |
699 | } | 679 | } |
@@ -2347,309 +2327,249 @@ static int mos7840_calc_num_ports(struct usb_serial *serial) | |||
2347 | return mos7840_num_ports; | 2327 | return mos7840_num_ports; |
2348 | } | 2328 | } |
2349 | 2329 | ||
2350 | /**************************************************************************** | 2330 | static int mos7840_port_probe(struct usb_serial_port *port) |
2351 | * mos7840_startup | ||
2352 | ****************************************************************************/ | ||
2353 | |||
2354 | static int mos7840_startup(struct usb_serial *serial) | ||
2355 | { | 2331 | { |
2332 | struct usb_serial *serial = port->serial; | ||
2356 | struct moschip_port *mos7840_port; | 2333 | struct moschip_port *mos7840_port; |
2357 | struct usb_device *dev; | 2334 | int status; |
2358 | int i, status; | 2335 | int pnum; |
2359 | __u16 Data; | 2336 | __u16 Data; |
2360 | 2337 | ||
2361 | dev = serial->dev; | ||
2362 | |||
2363 | /* we set up the pointers to the endpoints in the mos7840_open * | 2338 | /* we set up the pointers to the endpoints in the mos7840_open * |
2364 | * function, as the structures aren't created yet. */ | 2339 | * function, as the structures aren't created yet. */ |
2365 | 2340 | ||
2366 | /* set up port private structures */ | 2341 | pnum = port->number - serial->minor; |
2367 | for (i = 0; i < serial->num_ports; ++i) { | ||
2368 | dev_dbg(&dev->dev, "mos7840_startup: configuring port %d............\n", i); | ||
2369 | mos7840_port = kzalloc(sizeof(struct moschip_port), GFP_KERNEL); | ||
2370 | if (mos7840_port == NULL) { | ||
2371 | dev_err(&dev->dev, "%s - Out of memory\n", __func__); | ||
2372 | status = -ENOMEM; | ||
2373 | i--; /* don't follow NULL pointer cleaning up */ | ||
2374 | goto error; | ||
2375 | } | ||
2376 | |||
2377 | /* Initialize all port interrupt end point to port 0 int | ||
2378 | * endpoint. Our device has only one interrupt end point | ||
2379 | * common to all port */ | ||
2380 | |||
2381 | mos7840_port->port = serial->port[i]; | ||
2382 | mos7840_set_port_private(serial->port[i], mos7840_port); | ||
2383 | spin_lock_init(&mos7840_port->pool_lock); | ||
2384 | |||
2385 | /* minor is not initialised until later by | ||
2386 | * usb-serial.c:get_free_serial() and cannot therefore be used | ||
2387 | * to index device instances */ | ||
2388 | mos7840_port->port_num = i + 1; | ||
2389 | dev_dbg(&dev->dev, "serial->port[i]->number = %d\n", serial->port[i]->number); | ||
2390 | dev_dbg(&dev->dev, "serial->port[i]->serial->minor = %d\n", serial->port[i]->serial->minor); | ||
2391 | dev_dbg(&dev->dev, "mos7840_port->port_num = %d\n", mos7840_port->port_num); | ||
2392 | dev_dbg(&dev->dev, "serial->minor = %d\n", serial->minor); | ||
2393 | |||
2394 | if (mos7840_port->port_num == 1) { | ||
2395 | mos7840_port->SpRegOffset = 0x0; | ||
2396 | mos7840_port->ControlRegOffset = 0x1; | ||
2397 | mos7840_port->DcrRegOffset = 0x4; | ||
2398 | } else if ((mos7840_port->port_num == 2) | ||
2399 | && (serial->num_ports == 4)) { | ||
2400 | mos7840_port->SpRegOffset = 0x8; | ||
2401 | mos7840_port->ControlRegOffset = 0x9; | ||
2402 | mos7840_port->DcrRegOffset = 0x16; | ||
2403 | } else if ((mos7840_port->port_num == 2) | ||
2404 | && (serial->num_ports == 2)) { | ||
2405 | mos7840_port->SpRegOffset = 0xa; | ||
2406 | mos7840_port->ControlRegOffset = 0xb; | ||
2407 | mos7840_port->DcrRegOffset = 0x19; | ||
2408 | } else if ((mos7840_port->port_num == 3) | ||
2409 | && (serial->num_ports == 4)) { | ||
2410 | mos7840_port->SpRegOffset = 0xa; | ||
2411 | mos7840_port->ControlRegOffset = 0xb; | ||
2412 | mos7840_port->DcrRegOffset = 0x19; | ||
2413 | } else if ((mos7840_port->port_num == 4) | ||
2414 | && (serial->num_ports == 4)) { | ||
2415 | mos7840_port->SpRegOffset = 0xc; | ||
2416 | mos7840_port->ControlRegOffset = 0xd; | ||
2417 | mos7840_port->DcrRegOffset = 0x1c; | ||
2418 | } | ||
2419 | mos7840_dump_serial_port(serial->port[i], mos7840_port); | ||
2420 | mos7840_set_port_private(serial->port[i], mos7840_port); | ||
2421 | 2342 | ||
2422 | /* enable rx_disable bit in control register */ | 2343 | dev_dbg(&port->dev, "mos7840_startup: configuring port %d\n", pnum); |
2423 | status = mos7840_get_reg_sync(serial->port[i], | 2344 | mos7840_port = kzalloc(sizeof(struct moschip_port), GFP_KERNEL); |
2424 | mos7840_port->ControlRegOffset, &Data); | 2345 | if (mos7840_port == NULL) { |
2425 | if (status < 0) { | 2346 | dev_err(&port->dev, "%s - Out of memory\n", __func__); |
2426 | dev_dbg(&dev->dev, "Reading ControlReg failed status-0x%x\n", status); | 2347 | return -ENOMEM; |
2427 | break; | 2348 | } |
2428 | } else | ||
2429 | dev_dbg(&dev->dev, "ControlReg Reading success val is %x, status%d\n", Data, status); | ||
2430 | Data |= 0x08; /* setting driver done bit */ | ||
2431 | Data |= 0x04; /* sp1_bit to have cts change reflect in | ||
2432 | modem status reg */ | ||
2433 | |||
2434 | /* Data |= 0x20; //rx_disable bit */ | ||
2435 | status = mos7840_set_reg_sync(serial->port[i], | ||
2436 | mos7840_port->ControlRegOffset, Data); | ||
2437 | if (status < 0) { | ||
2438 | dev_dbg(&dev->dev, "Writing ControlReg failed(rx_disable) status-0x%x\n", status); | ||
2439 | break; | ||
2440 | } else | ||
2441 | dev_dbg(&dev->dev, "ControlReg Writing success(rx_disable) status%d\n", status); | ||
2442 | 2349 | ||
2443 | /* Write default values in DCR (i.e 0x01 in DCR0, 0x05 in DCR2 | 2350 | /* Initialize all port interrupt end point to port 0 int |
2444 | and 0x24 in DCR3 */ | 2351 | * endpoint. Our device has only one interrupt end point |
2445 | Data = 0x01; | 2352 | * common to all port */ |
2446 | status = mos7840_set_reg_sync(serial->port[i], | 2353 | |
2447 | (__u16) (mos7840_port->DcrRegOffset + 0), Data); | 2354 | mos7840_port->port = port; |
2448 | if (status < 0) { | 2355 | mos7840_set_port_private(port, mos7840_port); |
2449 | dev_dbg(&dev->dev, "Writing DCR0 failed status-0x%x\n", status); | 2356 | spin_lock_init(&mos7840_port->pool_lock); |
2450 | break; | 2357 | |
2451 | } else | 2358 | /* minor is not initialised until later by |
2452 | dev_dbg(&dev->dev, "DCR0 Writing success status%d\n", status); | 2359 | * usb-serial.c:get_free_serial() and cannot therefore be used |
2360 | * to index device instances */ | ||
2361 | mos7840_port->port_num = pnum + 1; | ||
2362 | dev_dbg(&port->dev, "port->number = %d\n", port->number); | ||
2363 | dev_dbg(&port->dev, "port->serial->minor = %d\n", port->serial->minor); | ||
2364 | dev_dbg(&port->dev, "mos7840_port->port_num = %d\n", mos7840_port->port_num); | ||
2365 | dev_dbg(&port->dev, "serial->minor = %d\n", serial->minor); | ||
2366 | |||
2367 | if (mos7840_port->port_num == 1) { | ||
2368 | mos7840_port->SpRegOffset = 0x0; | ||
2369 | mos7840_port->ControlRegOffset = 0x1; | ||
2370 | mos7840_port->DcrRegOffset = 0x4; | ||
2371 | } else if ((mos7840_port->port_num == 2) && (serial->num_ports == 4)) { | ||
2372 | mos7840_port->SpRegOffset = 0x8; | ||
2373 | mos7840_port->ControlRegOffset = 0x9; | ||
2374 | mos7840_port->DcrRegOffset = 0x16; | ||
2375 | } else if ((mos7840_port->port_num == 2) && (serial->num_ports == 2)) { | ||
2376 | mos7840_port->SpRegOffset = 0xa; | ||
2377 | mos7840_port->ControlRegOffset = 0xb; | ||
2378 | mos7840_port->DcrRegOffset = 0x19; | ||
2379 | } else if ((mos7840_port->port_num == 3) && (serial->num_ports == 4)) { | ||
2380 | mos7840_port->SpRegOffset = 0xa; | ||
2381 | mos7840_port->ControlRegOffset = 0xb; | ||
2382 | mos7840_port->DcrRegOffset = 0x19; | ||
2383 | } else if ((mos7840_port->port_num == 4) && (serial->num_ports == 4)) { | ||
2384 | mos7840_port->SpRegOffset = 0xc; | ||
2385 | mos7840_port->ControlRegOffset = 0xd; | ||
2386 | mos7840_port->DcrRegOffset = 0x1c; | ||
2387 | } | ||
2388 | mos7840_dump_serial_port(port, mos7840_port); | ||
2389 | mos7840_set_port_private(port, mos7840_port); | ||
2390 | |||
2391 | /* enable rx_disable bit in control register */ | ||
2392 | status = mos7840_get_reg_sync(port, | ||
2393 | mos7840_port->ControlRegOffset, &Data); | ||
2394 | if (status < 0) { | ||
2395 | dev_dbg(&port->dev, "Reading ControlReg failed status-0x%x\n", status); | ||
2396 | goto out; | ||
2397 | } else | ||
2398 | dev_dbg(&port->dev, "ControlReg Reading success val is %x, status%d\n", Data, status); | ||
2399 | Data |= 0x08; /* setting driver done bit */ | ||
2400 | Data |= 0x04; /* sp1_bit to have cts change reflect in | ||
2401 | modem status reg */ | ||
2453 | 2402 | ||
2454 | Data = 0x05; | 2403 | /* Data |= 0x20; //rx_disable bit */ |
2455 | status = mos7840_set_reg_sync(serial->port[i], | 2404 | status = mos7840_set_reg_sync(port, |
2456 | (__u16) (mos7840_port->DcrRegOffset + 1), Data); | 2405 | mos7840_port->ControlRegOffset, Data); |
2457 | if (status < 0) { | 2406 | if (status < 0) { |
2458 | dev_dbg(&dev->dev, "Writing DCR1 failed status-0x%x\n", status); | 2407 | dev_dbg(&port->dev, "Writing ControlReg failed(rx_disable) status-0x%x\n", status); |
2459 | break; | 2408 | goto out; |
2460 | } else | 2409 | } else |
2461 | dev_dbg(&dev->dev, "DCR1 Writing success status%d\n", status); | 2410 | dev_dbg(&port->dev, "ControlReg Writing success(rx_disable) status%d\n", status); |
2462 | 2411 | ||
2463 | Data = 0x24; | 2412 | /* Write default values in DCR (i.e 0x01 in DCR0, 0x05 in DCR2 |
2464 | status = mos7840_set_reg_sync(serial->port[i], | 2413 | and 0x24 in DCR3 */ |
2465 | (__u16) (mos7840_port->DcrRegOffset + 2), Data); | 2414 | Data = 0x01; |
2466 | if (status < 0) { | 2415 | status = mos7840_set_reg_sync(port, |
2467 | dev_dbg(&dev->dev, "Writing DCR2 failed status-0x%x\n", status); | 2416 | (__u16) (mos7840_port->DcrRegOffset + 0), Data); |
2468 | break; | 2417 | if (status < 0) { |
2469 | } else | 2418 | dev_dbg(&port->dev, "Writing DCR0 failed status-0x%x\n", status); |
2470 | dev_dbg(&dev->dev, "DCR2 Writing success status%d\n", status); | 2419 | goto out; |
2420 | } else | ||
2421 | dev_dbg(&port->dev, "DCR0 Writing success status%d\n", status); | ||
2471 | 2422 | ||
2472 | /* write values in clkstart0x0 and clkmulti 0x20 */ | 2423 | Data = 0x05; |
2473 | Data = 0x0; | 2424 | status = mos7840_set_reg_sync(port, |
2474 | status = mos7840_set_reg_sync(serial->port[i], | 2425 | (__u16) (mos7840_port->DcrRegOffset + 1), Data); |
2475 | CLK_START_VALUE_REGISTER, Data); | 2426 | if (status < 0) { |
2476 | if (status < 0) { | 2427 | dev_dbg(&port->dev, "Writing DCR1 failed status-0x%x\n", status); |
2477 | dev_dbg(&dev->dev, "Writing CLK_START_VALUE_REGISTER failed status-0x%x\n", status); | 2428 | goto out; |
2478 | break; | 2429 | } else |
2479 | } else | 2430 | dev_dbg(&port->dev, "DCR1 Writing success status%d\n", status); |
2480 | dev_dbg(&dev->dev, "CLK_START_VALUE_REGISTER Writing success status%d\n", status); | ||
2481 | 2431 | ||
2482 | Data = 0x20; | 2432 | Data = 0x24; |
2483 | status = mos7840_set_reg_sync(serial->port[i], | 2433 | status = mos7840_set_reg_sync(port, |
2484 | CLK_MULTI_REGISTER, Data); | 2434 | (__u16) (mos7840_port->DcrRegOffset + 2), Data); |
2485 | if (status < 0) { | 2435 | if (status < 0) { |
2486 | dev_dbg(&dev->dev, "Writing CLK_MULTI_REGISTER failed status-0x%x\n", status); | 2436 | dev_dbg(&port->dev, "Writing DCR2 failed status-0x%x\n", status); |
2487 | goto error; | 2437 | goto out; |
2488 | } else | 2438 | } else |
2489 | dev_dbg(&dev->dev, "CLK_MULTI_REGISTER Writing success status%d\n", status); | 2439 | dev_dbg(&port->dev, "DCR2 Writing success status%d\n", status); |
2490 | 2440 | ||
2491 | /* write value 0x0 to scratchpad register */ | 2441 | /* write values in clkstart0x0 and clkmulti 0x20 */ |
2492 | Data = 0x00; | 2442 | Data = 0x0; |
2493 | status = mos7840_set_uart_reg(serial->port[i], | 2443 | status = mos7840_set_reg_sync(port, CLK_START_VALUE_REGISTER, Data); |
2494 | SCRATCH_PAD_REGISTER, Data); | 2444 | if (status < 0) { |
2495 | if (status < 0) { | 2445 | dev_dbg(&port->dev, "Writing CLK_START_VALUE_REGISTER failed status-0x%x\n", status); |
2496 | dev_dbg(&dev->dev, "Writing SCRATCH_PAD_REGISTER failed status-0x%x\n", status); | 2446 | goto out; |
2497 | break; | 2447 | } else |
2498 | } else | 2448 | dev_dbg(&port->dev, "CLK_START_VALUE_REGISTER Writing success status%d\n", status); |
2499 | dev_dbg(&dev->dev, "SCRATCH_PAD_REGISTER Writing success status%d\n", status); | ||
2500 | 2449 | ||
2501 | /* Zero Length flag register */ | 2450 | Data = 0x20; |
2502 | if ((mos7840_port->port_num != 1) | 2451 | status = mos7840_set_reg_sync(port, CLK_MULTI_REGISTER, Data); |
2503 | && (serial->num_ports == 2)) { | 2452 | if (status < 0) { |
2453 | dev_dbg(&port->dev, "Writing CLK_MULTI_REGISTER failed status-0x%x\n", status); | ||
2454 | goto error; | ||
2455 | } else | ||
2456 | dev_dbg(&port->dev, "CLK_MULTI_REGISTER Writing success status%d\n", status); | ||
2504 | 2457 | ||
2505 | Data = 0xff; | 2458 | /* write value 0x0 to scratchpad register */ |
2506 | status = mos7840_set_reg_sync(serial->port[i], | 2459 | Data = 0x00; |
2507 | (__u16) (ZLP_REG1 + | 2460 | status = mos7840_set_uart_reg(port, SCRATCH_PAD_REGISTER, Data); |
2508 | ((__u16)mos7840_port->port_num)), Data); | 2461 | if (status < 0) { |
2509 | dev_dbg(&dev->dev, "ZLIP offset %x\n", | 2462 | dev_dbg(&port->dev, "Writing SCRATCH_PAD_REGISTER failed status-0x%x\n", status); |
2463 | goto out; | ||
2464 | } else | ||
2465 | dev_dbg(&port->dev, "SCRATCH_PAD_REGISTER Writing success status%d\n", status); | ||
2466 | |||
2467 | /* Zero Length flag register */ | ||
2468 | if ((mos7840_port->port_num != 1) && (serial->num_ports == 2)) { | ||
2469 | Data = 0xff; | ||
2470 | status = mos7840_set_reg_sync(port, | ||
2471 | (__u16) (ZLP_REG1 + | ||
2472 | ((__u16)mos7840_port->port_num)), Data); | ||
2473 | dev_dbg(&port->dev, "ZLIP offset %x\n", | ||
2510 | (__u16)(ZLP_REG1 + ((__u16) mos7840_port->port_num))); | 2474 | (__u16)(ZLP_REG1 + ((__u16) mos7840_port->port_num))); |
2511 | if (status < 0) { | 2475 | if (status < 0) { |
2512 | dev_dbg(&dev->dev, "Writing ZLP_REG%d failed status-0x%x\n", i + 2, status); | 2476 | dev_dbg(&port->dev, "Writing ZLP_REG%d failed status-0x%x\n", pnum + 2, status); |
2513 | break; | 2477 | goto out; |
2514 | } else | 2478 | } else |
2515 | dev_dbg(&dev->dev, "ZLP_REG%d Writing success status%d\n", i + 2, status); | 2479 | dev_dbg(&port->dev, "ZLP_REG%d Writing success status%d\n", pnum + 2, status); |
2516 | } else { | 2480 | } else { |
2517 | Data = 0xff; | 2481 | Data = 0xff; |
2518 | status = mos7840_set_reg_sync(serial->port[i], | 2482 | status = mos7840_set_reg_sync(port, |
2519 | (__u16) (ZLP_REG1 + | 2483 | (__u16) (ZLP_REG1 + |
2520 | ((__u16)mos7840_port->port_num) - 0x1), Data); | 2484 | ((__u16)mos7840_port->port_num) - 0x1), Data); |
2521 | dev_dbg(&dev->dev, "ZLIP offset %x\n", | 2485 | dev_dbg(&port->dev, "ZLIP offset %x\n", |
2522 | (__u16)(ZLP_REG1 + ((__u16) mos7840_port->port_num) - 0x1)); | 2486 | (__u16)(ZLP_REG1 + ((__u16) mos7840_port->port_num) - 0x1)); |
2523 | if (status < 0) { | 2487 | if (status < 0) { |
2524 | dev_dbg(&dev->dev, "Writing ZLP_REG%d failed status-0x%x\n", i + 1, status); | 2488 | dev_dbg(&port->dev, "Writing ZLP_REG%d failed status-0x%x\n", pnum + 1, status); |
2525 | break; | 2489 | goto out; |
2526 | } else | 2490 | } else |
2527 | dev_dbg(&dev->dev, "ZLP_REG%d Writing success status%d\n", i + 1, status); | 2491 | dev_dbg(&port->dev, "ZLP_REG%d Writing success status%d\n", pnum + 1, status); |
2528 | 2492 | ||
2529 | } | 2493 | } |
2530 | mos7840_port->control_urb = usb_alloc_urb(0, GFP_KERNEL); | 2494 | mos7840_port->control_urb = usb_alloc_urb(0, GFP_KERNEL); |
2531 | mos7840_port->ctrl_buf = kmalloc(16, GFP_KERNEL); | 2495 | mos7840_port->ctrl_buf = kmalloc(16, GFP_KERNEL); |
2532 | mos7840_port->dr = kmalloc(sizeof(struct usb_ctrlrequest), | 2496 | mos7840_port->dr = kmalloc(sizeof(struct usb_ctrlrequest), |
2533 | GFP_KERNEL); | 2497 | GFP_KERNEL); |
2534 | if (!mos7840_port->control_urb || !mos7840_port->ctrl_buf || | 2498 | if (!mos7840_port->control_urb || !mos7840_port->ctrl_buf || |
2535 | !mos7840_port->dr) { | 2499 | !mos7840_port->dr) { |
2536 | status = -ENOMEM; | 2500 | status = -ENOMEM; |
2537 | goto error; | 2501 | goto error; |
2538 | } | 2502 | } |
2539 | 2503 | ||
2540 | mos7840_port->has_led = false; | 2504 | mos7840_port->has_led = false; |
2541 | 2505 | ||
2542 | /* Initialize LED timers */ | 2506 | /* Initialize LED timers */ |
2543 | if (device_type == MOSCHIP_DEVICE_ID_7810) { | 2507 | if (device_type == MOSCHIP_DEVICE_ID_7810) { |
2544 | mos7840_port->has_led = true; | 2508 | mos7840_port->has_led = true; |
2545 | 2509 | ||
2546 | init_timer(&mos7840_port->led_timer1); | 2510 | init_timer(&mos7840_port->led_timer1); |
2547 | mos7840_port->led_timer1.function = mos7840_led_off; | 2511 | mos7840_port->led_timer1.function = mos7840_led_off; |
2548 | mos7840_port->led_timer1.expires = | 2512 | mos7840_port->led_timer1.expires = |
2549 | jiffies + msecs_to_jiffies(LED_ON_MS); | 2513 | jiffies + msecs_to_jiffies(LED_ON_MS); |
2550 | mos7840_port->led_timer1.data = | 2514 | mos7840_port->led_timer1.data = (unsigned long)mos7840_port; |
2551 | (unsigned long)mos7840_port; | ||
2552 | 2515 | ||
2553 | init_timer(&mos7840_port->led_timer2); | 2516 | init_timer(&mos7840_port->led_timer2); |
2554 | mos7840_port->led_timer2.function = | 2517 | mos7840_port->led_timer2.function = mos7840_led_flag_off; |
2555 | mos7840_led_flag_off; | 2518 | mos7840_port->led_timer2.expires = |
2556 | mos7840_port->led_timer2.expires = | 2519 | jiffies + msecs_to_jiffies(LED_OFF_MS); |
2557 | jiffies + msecs_to_jiffies(LED_OFF_MS); | 2520 | mos7840_port->led_timer2.data = (unsigned long)mos7840_port; |
2558 | mos7840_port->led_timer2.data = | ||
2559 | (unsigned long)mos7840_port; | ||
2560 | 2521 | ||
2561 | mos7840_port->led_flag = false; | 2522 | mos7840_port->led_flag = false; |
2562 | 2523 | ||
2563 | /* Turn off LED */ | 2524 | /* Turn off LED */ |
2564 | mos7840_set_led_sync(serial->port[i], | 2525 | mos7840_set_led_sync(port, MODEM_CONTROL_REGISTER, 0x0300); |
2565 | MODEM_CONTROL_REGISTER, 0x0300); | ||
2566 | } | ||
2567 | } | 2526 | } |
2527 | out: | ||
2528 | if (pnum == serial->num_ports - 1) { | ||
2529 | /* Zero Length flag enable */ | ||
2530 | Data = 0x0f; | ||
2531 | status = mos7840_set_reg_sync(serial->port[0], ZLP_REG5, Data); | ||
2532 | if (status < 0) { | ||
2533 | dev_dbg(&port->dev, "Writing ZLP_REG5 failed status-0x%x\n", status); | ||
2534 | goto error; | ||
2535 | } else | ||
2536 | dev_dbg(&port->dev, "ZLP_REG5 Writing success status%d\n", status); | ||
2568 | 2537 | ||
2569 | /* Zero Length flag enable */ | 2538 | /* setting configuration feature to one */ |
2570 | Data = 0x0f; | 2539 | usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0), |
2571 | status = mos7840_set_reg_sync(serial->port[0], ZLP_REG5, Data); | 2540 | 0x03, 0x00, 0x01, 0x00, NULL, 0x00, |
2572 | if (status < 0) { | 2541 | MOS_WDR_TIMEOUT); |
2573 | dev_dbg(&dev->dev, "Writing ZLP_REG5 failed status-0x%x\n", status); | 2542 | } |
2574 | goto error; | ||
2575 | } else | ||
2576 | dev_dbg(&dev->dev, "ZLP_REG5 Writing success status%d\n", status); | ||
2577 | |||
2578 | /* setting configuration feature to one */ | ||
2579 | usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0), | ||
2580 | (__u8) 0x03, 0x00, 0x01, 0x00, NULL, 0x00, MOS_WDR_TIMEOUT); | ||
2581 | return 0; | 2543 | return 0; |
2582 | error: | 2544 | error: |
2583 | for (/* nothing */; i >= 0; i--) { | 2545 | kfree(mos7840_port->dr); |
2584 | mos7840_port = mos7840_get_port_private(serial->port[i]); | 2546 | kfree(mos7840_port->ctrl_buf); |
2547 | usb_free_urb(mos7840_port->control_urb); | ||
2548 | kfree(mos7840_port); | ||
2585 | 2549 | ||
2586 | kfree(mos7840_port->dr); | ||
2587 | kfree(mos7840_port->ctrl_buf); | ||
2588 | usb_free_urb(mos7840_port->control_urb); | ||
2589 | kfree(mos7840_port); | ||
2590 | serial->port[i] = NULL; | ||
2591 | } | ||
2592 | return status; | 2550 | return status; |
2593 | } | 2551 | } |
2594 | 2552 | ||
2595 | /**************************************************************************** | 2553 | static int mos7840_port_remove(struct usb_serial_port *port) |
2596 | * mos7840_disconnect | ||
2597 | * This function is called whenever the device is removed from the usb bus. | ||
2598 | ****************************************************************************/ | ||
2599 | |||
2600 | static void mos7840_disconnect(struct usb_serial *serial) | ||
2601 | { | 2554 | { |
2602 | int i; | ||
2603 | unsigned long flags; | ||
2604 | struct moschip_port *mos7840_port; | 2555 | struct moschip_port *mos7840_port; |
2605 | 2556 | ||
2606 | /* check for the ports to be closed,close the ports and disconnect */ | 2557 | mos7840_port = mos7840_get_port_private(port); |
2607 | 2558 | ||
2608 | /* free private structure allocated for serial port * | 2559 | if (mos7840_port->has_led) { |
2609 | * stop reads and writes on all ports */ | 2560 | /* Turn off LED */ |
2561 | mos7840_set_led_sync(port, MODEM_CONTROL_REGISTER, 0x0300); | ||
2610 | 2562 | ||
2611 | for (i = 0; i < serial->num_ports; ++i) { | 2563 | del_timer_sync(&mos7840_port->led_timer1); |
2612 | mos7840_port = mos7840_get_port_private(serial->port[i]); | 2564 | del_timer_sync(&mos7840_port->led_timer2); |
2613 | if (mos7840_port) { | ||
2614 | spin_lock_irqsave(&mos7840_port->pool_lock, flags); | ||
2615 | mos7840_port->zombie = 1; | ||
2616 | spin_unlock_irqrestore(&mos7840_port->pool_lock, flags); | ||
2617 | usb_kill_urb(mos7840_port->control_urb); | ||
2618 | } | ||
2619 | } | 2565 | } |
2620 | } | 2566 | usb_kill_urb(mos7840_port->control_urb); |
2621 | 2567 | usb_free_urb(mos7840_port->control_urb); | |
2622 | /**************************************************************************** | 2568 | kfree(mos7840_port->ctrl_buf); |
2623 | * mos7840_release | 2569 | kfree(mos7840_port->dr); |
2624 | * This function is called when the usb_serial structure is freed. | 2570 | kfree(mos7840_port); |
2625 | ****************************************************************************/ | ||
2626 | |||
2627 | static void mos7840_release(struct usb_serial *serial) | ||
2628 | { | ||
2629 | int i; | ||
2630 | struct moschip_port *mos7840_port; | ||
2631 | |||
2632 | /* check for the ports to be closed,close the ports and disconnect */ | ||
2633 | 2571 | ||
2634 | /* free private structure allocated for serial port * | 2572 | return 0; |
2635 | * stop reads and writes on all ports */ | ||
2636 | |||
2637 | for (i = 0; i < serial->num_ports; ++i) { | ||
2638 | mos7840_port = mos7840_get_port_private(serial->port[i]); | ||
2639 | if (mos7840_port) { | ||
2640 | if (mos7840_port->has_led) { | ||
2641 | /* Turn off LED */ | ||
2642 | mos7840_set_led_sync(mos7840_port->port, | ||
2643 | MODEM_CONTROL_REGISTER, 0x0300); | ||
2644 | |||
2645 | del_timer_sync(&mos7840_port->led_timer1); | ||
2646 | del_timer_sync(&mos7840_port->led_timer2); | ||
2647 | } | ||
2648 | kfree(mos7840_port->ctrl_buf); | ||
2649 | kfree(mos7840_port->dr); | ||
2650 | kfree(mos7840_port); | ||
2651 | } | ||
2652 | } | ||
2653 | } | 2573 | } |
2654 | 2574 | ||
2655 | static struct usb_serial_driver moschip7840_4port_device = { | 2575 | static struct usb_serial_driver moschip7840_4port_device = { |
@@ -2677,9 +2597,8 @@ static struct usb_serial_driver moschip7840_4port_device = { | |||
2677 | .tiocmget = mos7840_tiocmget, | 2597 | .tiocmget = mos7840_tiocmget, |
2678 | .tiocmset = mos7840_tiocmset, | 2598 | .tiocmset = mos7840_tiocmset, |
2679 | .get_icount = mos7840_get_icount, | 2599 | .get_icount = mos7840_get_icount, |
2680 | .attach = mos7840_startup, | 2600 | .port_probe = mos7840_port_probe, |
2681 | .disconnect = mos7840_disconnect, | 2601 | .port_remove = mos7840_port_remove, |
2682 | .release = mos7840_release, | ||
2683 | .read_bulk_callback = mos7840_bulk_in_callback, | 2602 | .read_bulk_callback = mos7840_bulk_in_callback, |
2684 | .read_int_callback = mos7840_interrupt_callback, | 2603 | .read_int_callback = mos7840_interrupt_callback, |
2685 | }; | 2604 | }; |
diff --git a/drivers/usb/serial/omninet.c b/drivers/usb/serial/omninet.c index 6def58b79382..9ab73d295774 100644 --- a/drivers/usb/serial/omninet.c +++ b/drivers/usb/serial/omninet.c | |||
@@ -44,8 +44,8 @@ static int omninet_write(struct tty_struct *tty, struct usb_serial_port *port, | |||
44 | const unsigned char *buf, int count); | 44 | const unsigned char *buf, int count); |
45 | static int omninet_write_room(struct tty_struct *tty); | 45 | static int omninet_write_room(struct tty_struct *tty); |
46 | static void omninet_disconnect(struct usb_serial *serial); | 46 | static void omninet_disconnect(struct usb_serial *serial); |
47 | static void omninet_release(struct usb_serial *serial); | 47 | static int omninet_port_probe(struct usb_serial_port *port); |
48 | static int omninet_attach(struct usb_serial *serial); | 48 | static int omninet_port_remove(struct usb_serial_port *port); |
49 | 49 | ||
50 | static const struct usb_device_id id_table[] = { | 50 | static const struct usb_device_id id_table[] = { |
51 | { USB_DEVICE(ZYXEL_VENDOR_ID, ZYXEL_OMNINET_ID) }, | 51 | { USB_DEVICE(ZYXEL_VENDOR_ID, ZYXEL_OMNINET_ID) }, |
@@ -62,7 +62,8 @@ static struct usb_serial_driver zyxel_omninet_device = { | |||
62 | .description = "ZyXEL - omni.net lcd plus usb", | 62 | .description = "ZyXEL - omni.net lcd plus usb", |
63 | .id_table = id_table, | 63 | .id_table = id_table, |
64 | .num_ports = 1, | 64 | .num_ports = 1, |
65 | .attach = omninet_attach, | 65 | .port_probe = omninet_port_probe, |
66 | .port_remove = omninet_port_remove, | ||
66 | .open = omninet_open, | 67 | .open = omninet_open, |
67 | .close = omninet_close, | 68 | .close = omninet_close, |
68 | .write = omninet_write, | 69 | .write = omninet_write, |
@@ -70,7 +71,6 @@ static struct usb_serial_driver zyxel_omninet_device = { | |||
70 | .read_bulk_callback = omninet_read_bulk_callback, | 71 | .read_bulk_callback = omninet_read_bulk_callback, |
71 | .write_bulk_callback = omninet_write_bulk_callback, | 72 | .write_bulk_callback = omninet_write_bulk_callback, |
72 | .disconnect = omninet_disconnect, | 73 | .disconnect = omninet_disconnect, |
73 | .release = omninet_release, | ||
74 | }; | 74 | }; |
75 | 75 | ||
76 | static struct usb_serial_driver * const serial_drivers[] = { | 76 | static struct usb_serial_driver * const serial_drivers[] = { |
@@ -112,18 +112,26 @@ struct omninet_data { | |||
112 | __u8 od_outseq; /* Sequence number for bulk_out URBs */ | 112 | __u8 od_outseq; /* Sequence number for bulk_out URBs */ |
113 | }; | 113 | }; |
114 | 114 | ||
115 | static int omninet_attach(struct usb_serial *serial) | 115 | static int omninet_port_probe(struct usb_serial_port *port) |
116 | { | 116 | { |
117 | struct omninet_data *od; | 117 | struct omninet_data *od; |
118 | struct usb_serial_port *port = serial->port[0]; | ||
119 | 118 | ||
120 | od = kmalloc(sizeof(struct omninet_data), GFP_KERNEL); | 119 | od = kmalloc(sizeof(struct omninet_data), GFP_KERNEL); |
121 | if (!od) { | 120 | if (!od) |
122 | dev_err(&port->dev, "%s- kmalloc(%Zd) failed.\n", | ||
123 | __func__, sizeof(struct omninet_data)); | ||
124 | return -ENOMEM; | 121 | return -ENOMEM; |
125 | } | 122 | |
126 | usb_set_serial_port_data(port, od); | 123 | usb_set_serial_port_data(port, od); |
124 | |||
125 | return 0; | ||
126 | } | ||
127 | |||
128 | static int omninet_port_remove(struct usb_serial_port *port) | ||
129 | { | ||
130 | struct omninet_data *od; | ||
131 | |||
132 | od = usb_get_serial_port_data(port); | ||
133 | kfree(od); | ||
134 | |||
127 | return 0; | 135 | return 0; |
128 | } | 136 | } |
129 | 137 | ||
@@ -279,14 +287,6 @@ static void omninet_disconnect(struct usb_serial *serial) | |||
279 | usb_kill_urb(wport->write_urb); | 287 | usb_kill_urb(wport->write_urb); |
280 | } | 288 | } |
281 | 289 | ||
282 | |||
283 | static void omninet_release(struct usb_serial *serial) | ||
284 | { | ||
285 | struct usb_serial_port *port = serial->port[0]; | ||
286 | |||
287 | kfree(usb_get_serial_port_data(port)); | ||
288 | } | ||
289 | |||
290 | module_usb_serial_driver(serial_drivers, id_table); | 290 | module_usb_serial_driver(serial_drivers, id_table); |
291 | 291 | ||
292 | MODULE_AUTHOR(DRIVER_AUTHOR); | 292 | MODULE_AUTHOR(DRIVER_AUTHOR); |
diff --git a/drivers/usb/serial/opticon.c b/drivers/usb/serial/opticon.c index 41b1647306eb..6aba731d4864 100644 --- a/drivers/usb/serial/opticon.c +++ b/drivers/usb/serial/opticon.c | |||
@@ -155,7 +155,11 @@ static int send_control_msg(struct usb_serial_port *port, u8 requesttype, | |||
155 | { | 155 | { |
156 | struct usb_serial *serial = port->serial; | 156 | struct usb_serial *serial = port->serial; |
157 | int retval; | 157 | int retval; |
158 | u8 buffer[2]; | 158 | u8 *buffer; |
159 | |||
160 | buffer = kzalloc(1, GFP_KERNEL); | ||
161 | if (!buffer) | ||
162 | return -ENOMEM; | ||
159 | 163 | ||
160 | buffer[0] = val; | 164 | buffer[0] = val; |
161 | /* Send the message to the vendor control endpoint | 165 | /* Send the message to the vendor control endpoint |
@@ -164,6 +168,7 @@ static int send_control_msg(struct usb_serial_port *port, u8 requesttype, | |||
164 | requesttype, | 168 | requesttype, |
165 | USB_DIR_OUT|USB_TYPE_VENDOR|USB_RECIP_INTERFACE, | 169 | USB_DIR_OUT|USB_TYPE_VENDOR|USB_RECIP_INTERFACE, |
166 | 0, 0, buffer, 1, 0); | 170 | 0, 0, buffer, 1, 0); |
171 | kfree(buffer); | ||
167 | 172 | ||
168 | return retval; | 173 | return retval; |
169 | } | 174 | } |
@@ -281,7 +286,7 @@ static int opticon_write(struct tty_struct *tty, struct usb_serial_port *port, | |||
281 | if (!dr) { | 286 | if (!dr) { |
282 | dev_err(&port->dev, "out of memory\n"); | 287 | dev_err(&port->dev, "out of memory\n"); |
283 | count = -ENOMEM; | 288 | count = -ENOMEM; |
284 | goto error; | 289 | goto error_no_dr; |
285 | } | 290 | } |
286 | 291 | ||
287 | dr->bRequestType = USB_TYPE_VENDOR | USB_RECIP_INTERFACE | USB_DIR_OUT; | 292 | dr->bRequestType = USB_TYPE_VENDOR | USB_RECIP_INTERFACE | USB_DIR_OUT; |
@@ -311,6 +316,8 @@ static int opticon_write(struct tty_struct *tty, struct usb_serial_port *port, | |||
311 | 316 | ||
312 | return count; | 317 | return count; |
313 | error: | 318 | error: |
319 | kfree(dr); | ||
320 | error_no_dr: | ||
314 | usb_free_urb(urb); | 321 | usb_free_urb(urb); |
315 | error_no_urb: | 322 | error_no_urb: |
316 | kfree(buffer); | 323 | kfree(buffer); |
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c index 54d4148d01d1..5dee7d61241e 100644 --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c | |||
@@ -47,6 +47,7 @@ | |||
47 | /* Function prototypes */ | 47 | /* Function prototypes */ |
48 | static int option_probe(struct usb_serial *serial, | 48 | static int option_probe(struct usb_serial *serial, |
49 | const struct usb_device_id *id); | 49 | const struct usb_device_id *id); |
50 | static int option_attach(struct usb_serial *serial); | ||
50 | static void option_release(struct usb_serial *serial); | 51 | static void option_release(struct usb_serial *serial); |
51 | static int option_send_setup(struct usb_serial_port *port); | 52 | static int option_send_setup(struct usb_serial_port *port); |
52 | static void option_instat_callback(struct urb *urb); | 53 | static void option_instat_callback(struct urb *urb); |
@@ -1288,8 +1289,9 @@ static struct usb_serial_driver option_1port_device = { | |||
1288 | .tiocmget = usb_wwan_tiocmget, | 1289 | .tiocmget = usb_wwan_tiocmget, |
1289 | .tiocmset = usb_wwan_tiocmset, | 1290 | .tiocmset = usb_wwan_tiocmset, |
1290 | .ioctl = usb_wwan_ioctl, | 1291 | .ioctl = usb_wwan_ioctl, |
1291 | .attach = usb_wwan_startup, | 1292 | .attach = option_attach, |
1292 | .release = option_release, | 1293 | .release = option_release, |
1294 | .port_probe = usb_wwan_port_probe, | ||
1293 | .port_remove = usb_wwan_port_remove, | 1295 | .port_remove = usb_wwan_port_remove, |
1294 | .read_int_callback = option_instat_callback, | 1296 | .read_int_callback = option_instat_callback, |
1295 | #ifdef CONFIG_PM | 1297 | #ifdef CONFIG_PM |
@@ -1335,8 +1337,6 @@ static bool is_blacklisted(const u8 ifnum, enum option_blacklist_reason reason, | |||
1335 | static int option_probe(struct usb_serial *serial, | 1337 | static int option_probe(struct usb_serial *serial, |
1336 | const struct usb_device_id *id) | 1338 | const struct usb_device_id *id) |
1337 | { | 1339 | { |
1338 | struct usb_wwan_intf_private *data; | ||
1339 | struct option_private *priv; | ||
1340 | struct usb_interface_descriptor *iface_desc = | 1340 | struct usb_interface_descriptor *iface_desc = |
1341 | &serial->interface->cur_altsetting->desc; | 1341 | &serial->interface->cur_altsetting->desc; |
1342 | struct usb_device_descriptor *dev_desc = &serial->dev->descriptor; | 1342 | struct usb_device_descriptor *dev_desc = &serial->dev->descriptor; |
@@ -1374,6 +1374,19 @@ static int option_probe(struct usb_serial *serial, | |||
1374 | iface_desc->bInterfaceClass != USB_CLASS_CDC_DATA) | 1374 | iface_desc->bInterfaceClass != USB_CLASS_CDC_DATA) |
1375 | return -ENODEV; | 1375 | return -ENODEV; |
1376 | 1376 | ||
1377 | /* Store device id so we can use it during attach. */ | ||
1378 | usb_set_serial_data(serial, (void *)id); | ||
1379 | |||
1380 | return 0; | ||
1381 | } | ||
1382 | |||
1383 | static int option_attach(struct usb_serial *serial) | ||
1384 | { | ||
1385 | struct usb_interface_descriptor *iface_desc; | ||
1386 | const struct usb_device_id *id; | ||
1387 | struct usb_wwan_intf_private *data; | ||
1388 | struct option_private *priv; | ||
1389 | |||
1377 | data = kzalloc(sizeof(struct usb_wwan_intf_private), GFP_KERNEL); | 1390 | data = kzalloc(sizeof(struct usb_wwan_intf_private), GFP_KERNEL); |
1378 | if (!data) | 1391 | if (!data) |
1379 | return -ENOMEM; | 1392 | return -ENOMEM; |
@@ -1384,6 +1397,10 @@ static int option_probe(struct usb_serial *serial, | |||
1384 | return -ENOMEM; | 1397 | return -ENOMEM; |
1385 | } | 1398 | } |
1386 | 1399 | ||
1400 | /* Retrieve device id stored at probe. */ | ||
1401 | id = usb_get_serial_data(serial); | ||
1402 | iface_desc = &serial->interface->cur_altsetting->desc; | ||
1403 | |||
1387 | priv->bInterfaceNumber = iface_desc->bInterfaceNumber; | 1404 | priv->bInterfaceNumber = iface_desc->bInterfaceNumber; |
1388 | data->private = priv; | 1405 | data->private = priv; |
1389 | 1406 | ||
diff --git a/drivers/usb/serial/qcserial.c b/drivers/usb/serial/qcserial.c index c3ddb65c05f2..aa148c21ea40 100644 --- a/drivers/usb/serial/qcserial.c +++ b/drivers/usb/serial/qcserial.c | |||
@@ -138,7 +138,6 @@ MODULE_DEVICE_TABLE(usb, id_table); | |||
138 | 138 | ||
139 | static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id) | 139 | static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id) |
140 | { | 140 | { |
141 | struct usb_wwan_intf_private *data; | ||
142 | struct usb_host_interface *intf = serial->interface->cur_altsetting; | 141 | struct usb_host_interface *intf = serial->interface->cur_altsetting; |
143 | struct device *dev = &serial->dev->dev; | 142 | struct device *dev = &serial->dev->dev; |
144 | int retval = -ENODEV; | 143 | int retval = -ENODEV; |
@@ -154,13 +153,6 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id) | |||
154 | ifnum = intf->desc.bInterfaceNumber; | 153 | ifnum = intf->desc.bInterfaceNumber; |
155 | dev_dbg(dev, "This Interface = %d\n", ifnum); | 154 | dev_dbg(dev, "This Interface = %d\n", ifnum); |
156 | 155 | ||
157 | data = kzalloc(sizeof(struct usb_wwan_intf_private), | ||
158 | GFP_KERNEL); | ||
159 | if (!data) | ||
160 | return -ENOMEM; | ||
161 | |||
162 | spin_lock_init(&data->susp_lock); | ||
163 | |||
164 | if (nintf == 1) { | 156 | if (nintf == 1) { |
165 | /* QDL mode */ | 157 | /* QDL mode */ |
166 | /* Gobi 2000 has a single altsetting, older ones have two */ | 158 | /* Gobi 2000 has a single altsetting, older ones have two */ |
@@ -253,20 +245,28 @@ done: | |||
253 | } | 245 | } |
254 | } | 246 | } |
255 | 247 | ||
256 | /* Set serial->private if not returning error */ | ||
257 | if (retval == 0) | ||
258 | usb_set_serial_data(serial, data); | ||
259 | else | ||
260 | kfree(data); | ||
261 | |||
262 | return retval; | 248 | return retval; |
263 | } | 249 | } |
264 | 250 | ||
251 | static int qc_attach(struct usb_serial *serial) | ||
252 | { | ||
253 | struct usb_wwan_intf_private *data; | ||
254 | |||
255 | data = kzalloc(sizeof(*data), GFP_KERNEL); | ||
256 | if (!data) | ||
257 | return -ENOMEM; | ||
258 | |||
259 | spin_lock_init(&data->susp_lock); | ||
260 | |||
261 | usb_set_serial_data(serial, data); | ||
262 | |||
263 | return 0; | ||
264 | } | ||
265 | |||
265 | static void qc_release(struct usb_serial *serial) | 266 | static void qc_release(struct usb_serial *serial) |
266 | { | 267 | { |
267 | struct usb_wwan_intf_private *priv = usb_get_serial_data(serial); | 268 | struct usb_wwan_intf_private *priv = usb_get_serial_data(serial); |
268 | 269 | ||
269 | /* Free the private data allocated in qcprobe */ | ||
270 | usb_set_serial_data(serial, NULL); | 270 | usb_set_serial_data(serial, NULL); |
271 | kfree(priv); | 271 | kfree(priv); |
272 | } | 272 | } |
@@ -285,8 +285,9 @@ static struct usb_serial_driver qcdevice = { | |||
285 | .write = usb_wwan_write, | 285 | .write = usb_wwan_write, |
286 | .write_room = usb_wwan_write_room, | 286 | .write_room = usb_wwan_write_room, |
287 | .chars_in_buffer = usb_wwan_chars_in_buffer, | 287 | .chars_in_buffer = usb_wwan_chars_in_buffer, |
288 | .attach = usb_wwan_startup, | 288 | .attach = qc_attach, |
289 | .release = qc_release, | 289 | .release = qc_release, |
290 | .port_probe = usb_wwan_port_probe, | ||
290 | .port_remove = usb_wwan_port_remove, | 291 | .port_remove = usb_wwan_port_remove, |
291 | #ifdef CONFIG_PM | 292 | #ifdef CONFIG_PM |
292 | .suspend = usb_wwan_suspend, | 293 | .suspend = usb_wwan_suspend, |
diff --git a/drivers/usb/serial/quatech2.c b/drivers/usb/serial/quatech2.c index 2cdfdcc90b37..ffcfc962ab10 100644 --- a/drivers/usb/serial/quatech2.c +++ b/drivers/usb/serial/quatech2.c | |||
@@ -143,12 +143,12 @@ static void qt2_read_bulk_callback(struct urb *urb); | |||
143 | 143 | ||
144 | static void qt2_release(struct usb_serial *serial) | 144 | static void qt2_release(struct usb_serial *serial) |
145 | { | 145 | { |
146 | int i; | 146 | struct qt2_serial_private *serial_priv; |
147 | 147 | ||
148 | kfree(usb_get_serial_data(serial)); | 148 | serial_priv = usb_get_serial_data(serial); |
149 | 149 | ||
150 | for (i = 0; i < serial->num_ports; i++) | 150 | usb_free_urb(serial_priv->read_urb); |
151 | kfree(usb_get_serial_port_data(serial->port[i])); | 151 | kfree(serial_priv); |
152 | } | 152 | } |
153 | 153 | ||
154 | static inline int calc_baud_divisor(int baudrate) | 154 | static inline int calc_baud_divisor(int baudrate) |
@@ -423,11 +423,16 @@ static void qt2_close(struct usb_serial_port *port) | |||
423 | port_priv->is_open = false; | 423 | port_priv->is_open = false; |
424 | 424 | ||
425 | spin_lock_irqsave(&port_priv->urb_lock, flags); | 425 | spin_lock_irqsave(&port_priv->urb_lock, flags); |
426 | if (port_priv->write_urb->status == -EINPROGRESS) | 426 | usb_kill_urb(port_priv->write_urb); |
427 | usb_kill_urb(port_priv->write_urb); | ||
428 | port_priv->urb_in_use = false; | 427 | port_priv->urb_in_use = false; |
429 | spin_unlock_irqrestore(&port_priv->urb_lock, flags); | 428 | spin_unlock_irqrestore(&port_priv->urb_lock, flags); |
430 | 429 | ||
430 | mutex_lock(&port->serial->disc_mutex); | ||
431 | if (port->serial->disconnected) { | ||
432 | mutex_unlock(&port->serial->disc_mutex); | ||
433 | return; | ||
434 | } | ||
435 | |||
431 | /* flush the port transmit buffer */ | 436 | /* flush the port transmit buffer */ |
432 | i = usb_control_msg(serial->dev, | 437 | i = usb_control_msg(serial->dev, |
433 | usb_rcvctrlpipe(serial->dev, 0), | 438 | usb_rcvctrlpipe(serial->dev, 0), |
@@ -459,26 +464,14 @@ static void qt2_close(struct usb_serial_port *port) | |||
459 | dev_err(&port->dev, "%s - close port failed %i\n", | 464 | dev_err(&port->dev, "%s - close port failed %i\n", |
460 | __func__, i); | 465 | __func__, i); |
461 | 466 | ||
467 | mutex_unlock(&port->serial->disc_mutex); | ||
462 | } | 468 | } |
463 | 469 | ||
464 | static void qt2_disconnect(struct usb_serial *serial) | 470 | static void qt2_disconnect(struct usb_serial *serial) |
465 | { | 471 | { |
466 | struct qt2_serial_private *serial_priv = usb_get_serial_data(serial); | 472 | struct qt2_serial_private *serial_priv = usb_get_serial_data(serial); |
467 | struct qt2_port_private *port_priv; | ||
468 | int i; | ||
469 | |||
470 | if (serial_priv->read_urb->status == -EINPROGRESS) | ||
471 | usb_kill_urb(serial_priv->read_urb); | ||
472 | |||
473 | usb_free_urb(serial_priv->read_urb); | ||
474 | 473 | ||
475 | for (i = 0; i < serial->num_ports; i++) { | 474 | usb_kill_urb(serial_priv->read_urb); |
476 | port_priv = usb_get_serial_port_data(serial->port[i]); | ||
477 | |||
478 | if (port_priv->write_urb->status == -EINPROGRESS) | ||
479 | usb_kill_urb(port_priv->write_urb); | ||
480 | usb_free_urb(port_priv->write_urb); | ||
481 | } | ||
482 | } | 475 | } |
483 | 476 | ||
484 | static int get_serial_info(struct usb_serial_port *port, | 477 | static int get_serial_info(struct usb_serial_port *port, |
@@ -773,11 +766,9 @@ static void qt2_read_bulk_callback(struct urb *urb) | |||
773 | 766 | ||
774 | static int qt2_setup_urbs(struct usb_serial *serial) | 767 | static int qt2_setup_urbs(struct usb_serial *serial) |
775 | { | 768 | { |
776 | struct usb_serial_port *port; | ||
777 | struct usb_serial_port *port0; | 769 | struct usb_serial_port *port0; |
778 | struct qt2_serial_private *serial_priv; | 770 | struct qt2_serial_private *serial_priv; |
779 | struct qt2_port_private *port_priv; | 771 | int status; |
780 | int pcount, status; | ||
781 | 772 | ||
782 | port0 = serial->port[0]; | 773 | port0 = serial->port[0]; |
783 | 774 | ||
@@ -795,46 +786,21 @@ static int qt2_setup_urbs(struct usb_serial *serial) | |||
795 | sizeof(serial_priv->read_buffer), | 786 | sizeof(serial_priv->read_buffer), |
796 | qt2_read_bulk_callback, serial); | 787 | qt2_read_bulk_callback, serial); |
797 | 788 | ||
798 | /* setup write_urb for each port */ | ||
799 | for (pcount = 0; pcount < serial->num_ports; pcount++) { | ||
800 | |||
801 | port = serial->port[pcount]; | ||
802 | port_priv = usb_get_serial_port_data(port); | ||
803 | |||
804 | port_priv->write_urb = usb_alloc_urb(0, GFP_KERNEL); | ||
805 | if (!port_priv->write_urb) { | ||
806 | dev_err(&serial->dev->dev, | ||
807 | "failed to alloc write_urb for port %i\n", | ||
808 | pcount); | ||
809 | return -ENOMEM; | ||
810 | } | ||
811 | |||
812 | usb_fill_bulk_urb(port_priv->write_urb, | ||
813 | serial->dev, | ||
814 | usb_sndbulkpipe(serial->dev, | ||
815 | port0-> | ||
816 | bulk_out_endpointAddress), | ||
817 | port_priv->write_buffer, | ||
818 | sizeof(port_priv->write_buffer), | ||
819 | qt2_write_bulk_callback, port); | ||
820 | } | ||
821 | |||
822 | status = usb_submit_urb(serial_priv->read_urb, GFP_KERNEL); | 789 | status = usb_submit_urb(serial_priv->read_urb, GFP_KERNEL); |
823 | if (status != 0) { | 790 | if (status != 0) { |
824 | dev_err(&serial->dev->dev, | 791 | dev_err(&serial->dev->dev, |
825 | "%s - submit read urb failed %i\n", __func__, status); | 792 | "%s - submit read urb failed %i\n", __func__, status); |
793 | usb_free_urb(serial_priv->read_urb); | ||
826 | return status; | 794 | return status; |
827 | } | 795 | } |
828 | 796 | ||
829 | return 0; | 797 | return 0; |
830 | |||
831 | } | 798 | } |
832 | 799 | ||
833 | static int qt2_attach(struct usb_serial *serial) | 800 | static int qt2_attach(struct usb_serial *serial) |
834 | { | 801 | { |
835 | struct qt2_serial_private *serial_priv; | 802 | struct qt2_serial_private *serial_priv; |
836 | struct qt2_port_private *port_priv; | 803 | int status; |
837 | int status, pcount; | ||
838 | 804 | ||
839 | /* power on unit */ | 805 | /* power on unit */ |
840 | status = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0), | 806 | status = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0), |
@@ -854,26 +820,6 @@ static int qt2_attach(struct usb_serial *serial) | |||
854 | 820 | ||
855 | usb_set_serial_data(serial, serial_priv); | 821 | usb_set_serial_data(serial, serial_priv); |
856 | 822 | ||
857 | for (pcount = 0; pcount < serial->num_ports; pcount++) { | ||
858 | port_priv = kzalloc(sizeof(*port_priv), GFP_KERNEL); | ||
859 | if (!port_priv) { | ||
860 | dev_err(&serial->dev->dev, | ||
861 | "%s- kmalloc(%Zd) failed.\n", __func__, | ||
862 | sizeof(*port_priv)); | ||
863 | pcount--; | ||
864 | status = -ENOMEM; | ||
865 | goto attach_failed; | ||
866 | } | ||
867 | |||
868 | spin_lock_init(&port_priv->lock); | ||
869 | spin_lock_init(&port_priv->urb_lock); | ||
870 | init_waitqueue_head(&port_priv->delta_msr_wait); | ||
871 | |||
872 | port_priv->port = serial->port[pcount]; | ||
873 | |||
874 | usb_set_serial_port_data(serial->port[pcount], port_priv); | ||
875 | } | ||
876 | |||
877 | status = qt2_setup_urbs(serial); | 823 | status = qt2_setup_urbs(serial); |
878 | if (status != 0) | 824 | if (status != 0) |
879 | goto attach_failed; | 825 | goto attach_failed; |
@@ -881,14 +827,53 @@ static int qt2_attach(struct usb_serial *serial) | |||
881 | return 0; | 827 | return 0; |
882 | 828 | ||
883 | attach_failed: | 829 | attach_failed: |
884 | for (/* empty */; pcount >= 0; pcount--) { | ||
885 | port_priv = usb_get_serial_port_data(serial->port[pcount]); | ||
886 | kfree(port_priv); | ||
887 | } | ||
888 | kfree(serial_priv); | 830 | kfree(serial_priv); |
889 | return status; | 831 | return status; |
890 | } | 832 | } |
891 | 833 | ||
834 | static int qt2_port_probe(struct usb_serial_port *port) | ||
835 | { | ||
836 | struct usb_serial *serial = port->serial; | ||
837 | struct qt2_port_private *port_priv; | ||
838 | u8 bEndpointAddress; | ||
839 | |||
840 | port_priv = kzalloc(sizeof(*port_priv), GFP_KERNEL); | ||
841 | if (!port_priv) | ||
842 | return -ENOMEM; | ||
843 | |||
844 | spin_lock_init(&port_priv->lock); | ||
845 | spin_lock_init(&port_priv->urb_lock); | ||
846 | init_waitqueue_head(&port_priv->delta_msr_wait); | ||
847 | port_priv->port = port; | ||
848 | |||
849 | port_priv->write_urb = usb_alloc_urb(0, GFP_KERNEL); | ||
850 | if (!port_priv->write_urb) { | ||
851 | kfree(port_priv); | ||
852 | return -ENOMEM; | ||
853 | } | ||
854 | bEndpointAddress = serial->port[0]->bulk_out_endpointAddress; | ||
855 | usb_fill_bulk_urb(port_priv->write_urb, serial->dev, | ||
856 | usb_sndbulkpipe(serial->dev, bEndpointAddress), | ||
857 | port_priv->write_buffer, | ||
858 | sizeof(port_priv->write_buffer), | ||
859 | qt2_write_bulk_callback, port); | ||
860 | |||
861 | usb_set_serial_port_data(port, port_priv); | ||
862 | |||
863 | return 0; | ||
864 | } | ||
865 | |||
866 | static int qt2_port_remove(struct usb_serial_port *port) | ||
867 | { | ||
868 | struct qt2_port_private *port_priv; | ||
869 | |||
870 | port_priv = usb_get_serial_port_data(port); | ||
871 | usb_free_urb(port_priv->write_urb); | ||
872 | kfree(port_priv); | ||
873 | |||
874 | return 0; | ||
875 | } | ||
876 | |||
892 | static int qt2_tiocmget(struct tty_struct *tty) | 877 | static int qt2_tiocmget(struct tty_struct *tty) |
893 | { | 878 | { |
894 | struct usb_serial_port *port = tty->driver_data; | 879 | struct usb_serial_port *port = tty->driver_data; |
@@ -1127,6 +1112,8 @@ static struct usb_serial_driver qt2_device = { | |||
1127 | .attach = qt2_attach, | 1112 | .attach = qt2_attach, |
1128 | .release = qt2_release, | 1113 | .release = qt2_release, |
1129 | .disconnect = qt2_disconnect, | 1114 | .disconnect = qt2_disconnect, |
1115 | .port_probe = qt2_port_probe, | ||
1116 | .port_remove = qt2_port_remove, | ||
1130 | .dtr_rts = qt2_dtr_rts, | 1117 | .dtr_rts = qt2_dtr_rts, |
1131 | .break_ctl = qt2_break_ctl, | 1118 | .break_ctl = qt2_break_ctl, |
1132 | .tiocmget = qt2_tiocmget, | 1119 | .tiocmget = qt2_tiocmget, |
diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c index 01d882cf3775..270860f6bb2a 100644 --- a/drivers/usb/serial/sierra.c +++ b/drivers/usb/serial/sierra.c | |||
@@ -161,7 +161,6 @@ static int sierra_probe(struct usb_serial *serial, | |||
161 | { | 161 | { |
162 | int result = 0; | 162 | int result = 0; |
163 | struct usb_device *udev; | 163 | struct usb_device *udev; |
164 | struct sierra_intf_private *data; | ||
165 | u8 ifnum; | 164 | u8 ifnum; |
166 | 165 | ||
167 | udev = serial->dev; | 166 | udev = serial->dev; |
@@ -188,11 +187,6 @@ static int sierra_probe(struct usb_serial *serial, | |||
188 | return -ENODEV; | 187 | return -ENODEV; |
189 | } | 188 | } |
190 | 189 | ||
191 | data = serial->private = kzalloc(sizeof(struct sierra_intf_private), GFP_KERNEL); | ||
192 | if (!data) | ||
193 | return -ENOMEM; | ||
194 | spin_lock_init(&data->susp_lock); | ||
195 | |||
196 | return result; | 190 | return result; |
197 | } | 191 | } |
198 | 192 | ||
@@ -884,11 +878,15 @@ static void sierra_dtr_rts(struct usb_serial_port *port, int on) | |||
884 | 878 | ||
885 | static int sierra_startup(struct usb_serial *serial) | 879 | static int sierra_startup(struct usb_serial *serial) |
886 | { | 880 | { |
887 | struct usb_serial_port *port; | 881 | struct sierra_intf_private *intfdata; |
888 | struct sierra_port_private *portdata; | 882 | |
889 | struct sierra_iface_info *himemoryp = NULL; | 883 | intfdata = kzalloc(sizeof(*intfdata), GFP_KERNEL); |
890 | int i; | 884 | if (!intfdata) |
891 | u8 ifnum; | 885 | return -ENOMEM; |
886 | |||
887 | spin_lock_init(&intfdata->susp_lock); | ||
888 | |||
889 | usb_set_serial_data(serial, intfdata); | ||
892 | 890 | ||
893 | /* Set Device mode to D0 */ | 891 | /* Set Device mode to D0 */ |
894 | sierra_set_power_state(serial->dev, 0x0000); | 892 | sierra_set_power_state(serial->dev, 0x0000); |
@@ -897,68 +895,71 @@ static int sierra_startup(struct usb_serial *serial) | |||
897 | if (nmea) | 895 | if (nmea) |
898 | sierra_vsc_set_nmea(serial->dev, 1); | 896 | sierra_vsc_set_nmea(serial->dev, 1); |
899 | 897 | ||
900 | /* Now setup per port private data */ | ||
901 | for (i = 0; i < serial->num_ports; i++) { | ||
902 | port = serial->port[i]; | ||
903 | portdata = kzalloc(sizeof(*portdata), GFP_KERNEL); | ||
904 | if (!portdata) { | ||
905 | dev_dbg(&port->dev, "%s: kmalloc for " | ||
906 | "sierra_port_private (%d) failed!\n", | ||
907 | __func__, i); | ||
908 | return -ENOMEM; | ||
909 | } | ||
910 | spin_lock_init(&portdata->lock); | ||
911 | init_usb_anchor(&portdata->active); | ||
912 | init_usb_anchor(&portdata->delayed); | ||
913 | ifnum = i; | ||
914 | /* Assume low memory requirements */ | ||
915 | portdata->num_out_urbs = N_OUT_URB; | ||
916 | portdata->num_in_urbs = N_IN_URB; | ||
917 | |||
918 | /* Determine actual memory requirements */ | ||
919 | if (serial->num_ports == 1) { | ||
920 | /* Get interface number for composite device */ | ||
921 | ifnum = sierra_calc_interface(serial); | ||
922 | himemoryp = | ||
923 | (struct sierra_iface_info *)&typeB_interface_list; | ||
924 | if (is_himemory(ifnum, himemoryp)) { | ||
925 | portdata->num_out_urbs = N_OUT_URB_HM; | ||
926 | portdata->num_in_urbs = N_IN_URB_HM; | ||
927 | } | ||
928 | } | ||
929 | else { | ||
930 | himemoryp = | ||
931 | (struct sierra_iface_info *)&typeA_interface_list; | ||
932 | if (is_himemory(i, himemoryp)) { | ||
933 | portdata->num_out_urbs = N_OUT_URB_HM; | ||
934 | portdata->num_in_urbs = N_IN_URB_HM; | ||
935 | } | ||
936 | } | ||
937 | dev_dbg(&serial->dev->dev, | ||
938 | "Memory usage (urbs) interface #%d, in=%d, out=%d\n", | ||
939 | ifnum,portdata->num_in_urbs, portdata->num_out_urbs ); | ||
940 | /* Set the port private data pointer */ | ||
941 | usb_set_serial_port_data(port, portdata); | ||
942 | } | ||
943 | |||
944 | return 0; | 898 | return 0; |
945 | } | 899 | } |
946 | 900 | ||
947 | static void sierra_release(struct usb_serial *serial) | 901 | static void sierra_release(struct usb_serial *serial) |
948 | { | 902 | { |
949 | int i; | 903 | struct sierra_intf_private *intfdata; |
950 | struct usb_serial_port *port; | 904 | |
905 | intfdata = usb_get_serial_data(serial); | ||
906 | kfree(intfdata); | ||
907 | } | ||
908 | |||
909 | static int sierra_port_probe(struct usb_serial_port *port) | ||
910 | { | ||
911 | struct usb_serial *serial = port->serial; | ||
951 | struct sierra_port_private *portdata; | 912 | struct sierra_port_private *portdata; |
913 | const struct sierra_iface_info *himemoryp; | ||
914 | u8 ifnum; | ||
952 | 915 | ||
953 | for (i = 0; i < serial->num_ports; ++i) { | 916 | portdata = kzalloc(sizeof(*portdata), GFP_KERNEL); |
954 | port = serial->port[i]; | 917 | if (!portdata) |
955 | if (!port) | 918 | return -ENOMEM; |
956 | continue; | 919 | |
957 | portdata = usb_get_serial_port_data(port); | 920 | spin_lock_init(&portdata->lock); |
958 | if (!portdata) | 921 | init_usb_anchor(&portdata->active); |
959 | continue; | 922 | init_usb_anchor(&portdata->delayed); |
960 | kfree(portdata); | 923 | |
924 | /* Assume low memory requirements */ | ||
925 | portdata->num_out_urbs = N_OUT_URB; | ||
926 | portdata->num_in_urbs = N_IN_URB; | ||
927 | |||
928 | /* Determine actual memory requirements */ | ||
929 | if (serial->num_ports == 1) { | ||
930 | /* Get interface number for composite device */ | ||
931 | ifnum = sierra_calc_interface(serial); | ||
932 | himemoryp = &typeB_interface_list; | ||
933 | } else { | ||
934 | /* This is really the usb-serial port number of the interface | ||
935 | * rather than the interface number. | ||
936 | */ | ||
937 | ifnum = port->number - serial->minor; | ||
938 | himemoryp = &typeA_interface_list; | ||
961 | } | 939 | } |
940 | |||
941 | if (is_himemory(ifnum, himemoryp)) { | ||
942 | portdata->num_out_urbs = N_OUT_URB_HM; | ||
943 | portdata->num_in_urbs = N_IN_URB_HM; | ||
944 | } | ||
945 | |||
946 | dev_dbg(&port->dev, | ||
947 | "Memory usage (urbs) interface #%d, in=%d, out=%d\n", | ||
948 | ifnum, portdata->num_in_urbs, portdata->num_out_urbs); | ||
949 | |||
950 | usb_set_serial_port_data(port, portdata); | ||
951 | |||
952 | return 0; | ||
953 | } | ||
954 | |||
955 | static int sierra_port_remove(struct usb_serial_port *port) | ||
956 | { | ||
957 | struct sierra_port_private *portdata; | ||
958 | |||
959 | portdata = usb_get_serial_port_data(port); | ||
960 | kfree(portdata); | ||
961 | |||
962 | return 0; | ||
962 | } | 963 | } |
963 | 964 | ||
964 | #ifdef CONFIG_PM | 965 | #ifdef CONFIG_PM |
@@ -1062,6 +1063,8 @@ static struct usb_serial_driver sierra_device = { | |||
1062 | .tiocmset = sierra_tiocmset, | 1063 | .tiocmset = sierra_tiocmset, |
1063 | .attach = sierra_startup, | 1064 | .attach = sierra_startup, |
1064 | .release = sierra_release, | 1065 | .release = sierra_release, |
1066 | .port_probe = sierra_port_probe, | ||
1067 | .port_remove = sierra_port_remove, | ||
1065 | .suspend = sierra_suspend, | 1068 | .suspend = sierra_suspend, |
1066 | .resume = sierra_resume, | 1069 | .resume = sierra_resume, |
1067 | .read_int_callback = sierra_instat_callback, | 1070 | .read_int_callback = sierra_instat_callback, |
diff --git a/drivers/usb/serial/usb-wwan.h b/drivers/usb/serial/usb-wwan.h index 1f034d2397c6..684739b8efd0 100644 --- a/drivers/usb/serial/usb-wwan.h +++ b/drivers/usb/serial/usb-wwan.h | |||
@@ -8,7 +8,7 @@ | |||
8 | extern void usb_wwan_dtr_rts(struct usb_serial_port *port, int on); | 8 | extern void usb_wwan_dtr_rts(struct usb_serial_port *port, int on); |
9 | extern int usb_wwan_open(struct tty_struct *tty, struct usb_serial_port *port); | 9 | extern int usb_wwan_open(struct tty_struct *tty, struct usb_serial_port *port); |
10 | extern void usb_wwan_close(struct usb_serial_port *port); | 10 | extern void usb_wwan_close(struct usb_serial_port *port); |
11 | extern int usb_wwan_startup(struct usb_serial *serial); | 11 | extern int usb_wwan_port_probe(struct usb_serial_port *port); |
12 | extern int usb_wwan_port_remove(struct usb_serial_port *port); | 12 | extern int usb_wwan_port_remove(struct usb_serial_port *port); |
13 | extern int usb_wwan_write_room(struct tty_struct *tty); | 13 | extern int usb_wwan_write_room(struct tty_struct *tty); |
14 | extern void usb_wwan_set_termios(struct tty_struct *tty, | 14 | extern void usb_wwan_set_termios(struct tty_struct *tty, |
diff --git a/drivers/usb/serial/usb_wwan.c b/drivers/usb/serial/usb_wwan.c index e42aa398ed37..61a73ad1a187 100644 --- a/drivers/usb/serial/usb_wwan.c +++ b/drivers/usb/serial/usb_wwan.c | |||
@@ -447,10 +447,12 @@ void usb_wwan_close(struct usb_serial_port *port) | |||
447 | EXPORT_SYMBOL(usb_wwan_close); | 447 | EXPORT_SYMBOL(usb_wwan_close); |
448 | 448 | ||
449 | /* Helper functions used by usb_wwan_setup_urbs */ | 449 | /* Helper functions used by usb_wwan_setup_urbs */ |
450 | static struct urb *usb_wwan_setup_urb(struct usb_serial *serial, int endpoint, | 450 | static struct urb *usb_wwan_setup_urb(struct usb_serial_port *port, |
451 | int endpoint, | ||
451 | int dir, void *ctx, char *buf, int len, | 452 | int dir, void *ctx, char *buf, int len, |
452 | void (*callback) (struct urb *)) | 453 | void (*callback) (struct urb *)) |
453 | { | 454 | { |
455 | struct usb_serial *serial = port->serial; | ||
454 | struct urb *urb; | 456 | struct urb *urb; |
455 | 457 | ||
456 | if (endpoint == -1) | 458 | if (endpoint == -1) |
@@ -472,101 +474,75 @@ static struct urb *usb_wwan_setup_urb(struct usb_serial *serial, int endpoint, | |||
472 | return urb; | 474 | return urb; |
473 | } | 475 | } |
474 | 476 | ||
475 | /* Setup urbs */ | 477 | int usb_wwan_port_probe(struct usb_serial_port *port) |
476 | static void usb_wwan_setup_urbs(struct usb_serial *serial) | ||
477 | { | 478 | { |
478 | int i, j; | ||
479 | struct usb_serial_port *port; | ||
480 | struct usb_wwan_port_private *portdata; | 479 | struct usb_wwan_port_private *portdata; |
480 | struct urb *urb; | ||
481 | u8 *buffer; | ||
482 | int err; | ||
483 | int i; | ||
481 | 484 | ||
482 | for (i = 0; i < serial->num_ports; i++) { | 485 | portdata = kzalloc(sizeof(*portdata), GFP_KERNEL); |
483 | port = serial->port[i]; | 486 | if (!portdata) |
484 | portdata = usb_get_serial_port_data(port); | 487 | return -ENOMEM; |
485 | 488 | ||
486 | /* Do indat endpoints first */ | 489 | init_usb_anchor(&portdata->delayed); |
487 | for (j = 0; j < N_IN_URB; ++j) { | ||
488 | portdata->in_urbs[j] = usb_wwan_setup_urb(serial, | ||
489 | port-> | ||
490 | bulk_in_endpointAddress, | ||
491 | USB_DIR_IN, | ||
492 | port, | ||
493 | portdata-> | ||
494 | in_buffer[j], | ||
495 | IN_BUFLEN, | ||
496 | usb_wwan_indat_callback); | ||
497 | } | ||
498 | 490 | ||
499 | /* outdat endpoints */ | 491 | for (i = 0; i < N_IN_URB; i++) { |
500 | for (j = 0; j < N_OUT_URB; ++j) { | 492 | buffer = (u8 *)__get_free_page(GFP_KERNEL); |
501 | portdata->out_urbs[j] = usb_wwan_setup_urb(serial, | 493 | if (!buffer) |
502 | port-> | 494 | goto bail_out_error; |
503 | bulk_out_endpointAddress, | 495 | portdata->in_buffer[i] = buffer; |
504 | USB_DIR_OUT, | 496 | |
505 | port, | 497 | urb = usb_wwan_setup_urb(port, port->bulk_in_endpointAddress, |
506 | portdata-> | 498 | USB_DIR_IN, port, |
507 | out_buffer | 499 | buffer, IN_BUFLEN, |
508 | [j], | 500 | usb_wwan_indat_callback); |
509 | OUT_BUFLEN, | 501 | portdata->in_urbs[i] = urb; |
510 | usb_wwan_outdat_callback); | ||
511 | } | ||
512 | } | 502 | } |
513 | } | ||
514 | |||
515 | int usb_wwan_startup(struct usb_serial *serial) | ||
516 | { | ||
517 | int i, j, err; | ||
518 | struct usb_serial_port *port; | ||
519 | struct usb_wwan_port_private *portdata; | ||
520 | u8 *buffer; | ||
521 | 503 | ||
522 | /* Now setup per port private data */ | 504 | for (i = 0; i < N_OUT_URB; i++) { |
523 | for (i = 0; i < serial->num_ports; i++) { | 505 | if (port->bulk_out_endpointAddress == -1) |
524 | port = serial->port[i]; | 506 | continue; |
525 | portdata = kzalloc(sizeof(*portdata), GFP_KERNEL); | ||
526 | if (!portdata) { | ||
527 | dev_dbg(&port->dev, "%s: kmalloc for usb_wwan_port_private (%d) failed!.\n", | ||
528 | __func__, i); | ||
529 | return 1; | ||
530 | } | ||
531 | init_usb_anchor(&portdata->delayed); | ||
532 | 507 | ||
533 | for (j = 0; j < N_IN_URB; j++) { | 508 | buffer = kmalloc(OUT_BUFLEN, GFP_KERNEL); |
534 | buffer = (u8 *) __get_free_page(GFP_KERNEL); | 509 | if (!buffer) |
535 | if (!buffer) | 510 | goto bail_out_error2; |
536 | goto bail_out_error; | 511 | portdata->out_buffer[i] = buffer; |
537 | portdata->in_buffer[j] = buffer; | ||
538 | } | ||
539 | 512 | ||
540 | for (j = 0; j < N_OUT_URB; j++) { | 513 | urb = usb_wwan_setup_urb(port, port->bulk_out_endpointAddress, |
541 | buffer = kmalloc(OUT_BUFLEN, GFP_KERNEL); | 514 | USB_DIR_OUT, port, |
542 | if (!buffer) | 515 | buffer, OUT_BUFLEN, |
543 | goto bail_out_error2; | 516 | usb_wwan_outdat_callback); |
544 | portdata->out_buffer[j] = buffer; | 517 | portdata->out_urbs[i] = urb; |
545 | } | 518 | } |
546 | 519 | ||
547 | usb_set_serial_port_data(port, portdata); | 520 | usb_set_serial_port_data(port, portdata); |
548 | 521 | ||
549 | if (!port->interrupt_in_urb) | 522 | if (port->interrupt_in_urb) { |
550 | continue; | ||
551 | err = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL); | 523 | err = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL); |
552 | if (err) | 524 | if (err) |
553 | dev_dbg(&port->dev, "%s: submit irq_in urb failed %d\n", | 525 | dev_dbg(&port->dev, "%s: submit irq_in urb failed %d\n", |
554 | __func__, err); | 526 | __func__, err); |
555 | } | 527 | } |
556 | usb_wwan_setup_urbs(serial); | 528 | |
557 | return 0; | 529 | return 0; |
558 | 530 | ||
559 | bail_out_error2: | 531 | bail_out_error2: |
560 | for (j = 0; j < N_OUT_URB; j++) | 532 | for (i = 0; i < N_OUT_URB; i++) { |
561 | kfree(portdata->out_buffer[j]); | 533 | usb_free_urb(portdata->out_urbs[i]); |
534 | kfree(portdata->out_buffer[i]); | ||
535 | } | ||
562 | bail_out_error: | 536 | bail_out_error: |
563 | for (j = 0; j < N_IN_URB; j++) | 537 | for (i = 0; i < N_IN_URB; i++) { |
564 | if (portdata->in_buffer[j]) | 538 | usb_free_urb(portdata->in_urbs[i]); |
565 | free_page((unsigned long)portdata->in_buffer[j]); | 539 | free_page((unsigned long)portdata->in_buffer[i]); |
540 | } | ||
566 | kfree(portdata); | 541 | kfree(portdata); |
567 | return 1; | 542 | |
543 | return -ENOMEM; | ||
568 | } | 544 | } |
569 | EXPORT_SYMBOL(usb_wwan_startup); | 545 | EXPORT_SYMBOL_GPL(usb_wwan_port_probe); |
570 | 546 | ||
571 | int usb_wwan_port_remove(struct usb_serial_port *port) | 547 | int usb_wwan_port_remove(struct usb_serial_port *port) |
572 | { | 548 | { |
diff --git a/drivers/usb/serial/whiteheat.c b/drivers/usb/serial/whiteheat.c index 346c7efc20b0..b9fca3586d74 100644 --- a/drivers/usb/serial/whiteheat.c +++ b/drivers/usb/serial/whiteheat.c | |||
@@ -83,6 +83,8 @@ static int whiteheat_firmware_attach(struct usb_serial *serial); | |||
83 | /* function prototypes for the Connect Tech WhiteHEAT serial converter */ | 83 | /* function prototypes for the Connect Tech WhiteHEAT serial converter */ |
84 | static int whiteheat_attach(struct usb_serial *serial); | 84 | static int whiteheat_attach(struct usb_serial *serial); |
85 | static void whiteheat_release(struct usb_serial *serial); | 85 | static void whiteheat_release(struct usb_serial *serial); |
86 | static int whiteheat_port_probe(struct usb_serial_port *port); | ||
87 | static int whiteheat_port_remove(struct usb_serial_port *port); | ||
86 | static int whiteheat_open(struct tty_struct *tty, | 88 | static int whiteheat_open(struct tty_struct *tty, |
87 | struct usb_serial_port *port); | 89 | struct usb_serial_port *port); |
88 | static void whiteheat_close(struct usb_serial_port *port); | 90 | static void whiteheat_close(struct usb_serial_port *port); |
@@ -117,6 +119,8 @@ static struct usb_serial_driver whiteheat_device = { | |||
117 | .num_ports = 4, | 119 | .num_ports = 4, |
118 | .attach = whiteheat_attach, | 120 | .attach = whiteheat_attach, |
119 | .release = whiteheat_release, | 121 | .release = whiteheat_release, |
122 | .port_probe = whiteheat_port_probe, | ||
123 | .port_remove = whiteheat_port_remove, | ||
120 | .open = whiteheat_open, | 124 | .open = whiteheat_open, |
121 | .close = whiteheat_close, | 125 | .close = whiteheat_close, |
122 | .ioctl = whiteheat_ioctl, | 126 | .ioctl = whiteheat_ioctl, |
@@ -218,15 +222,12 @@ static int whiteheat_attach(struct usb_serial *serial) | |||
218 | { | 222 | { |
219 | struct usb_serial_port *command_port; | 223 | struct usb_serial_port *command_port; |
220 | struct whiteheat_command_private *command_info; | 224 | struct whiteheat_command_private *command_info; |
221 | struct usb_serial_port *port; | ||
222 | struct whiteheat_private *info; | ||
223 | struct whiteheat_hw_info *hw_info; | 225 | struct whiteheat_hw_info *hw_info; |
224 | int pipe; | 226 | int pipe; |
225 | int ret; | 227 | int ret; |
226 | int alen; | 228 | int alen; |
227 | __u8 *command; | 229 | __u8 *command; |
228 | __u8 *result; | 230 | __u8 *result; |
229 | int i; | ||
230 | 231 | ||
231 | command_port = serial->port[COMMAND_PORT]; | 232 | command_port = serial->port[COMMAND_PORT]; |
232 | 233 | ||
@@ -285,22 +286,6 @@ static int whiteheat_attach(struct usb_serial *serial) | |||
285 | serial->type->description, | 286 | serial->type->description, |
286 | hw_info->sw_major_rev, hw_info->sw_minor_rev); | 287 | hw_info->sw_major_rev, hw_info->sw_minor_rev); |
287 | 288 | ||
288 | for (i = 0; i < serial->num_ports; i++) { | ||
289 | port = serial->port[i]; | ||
290 | |||
291 | info = kmalloc(sizeof(struct whiteheat_private), GFP_KERNEL); | ||
292 | if (info == NULL) { | ||
293 | dev_err(&port->dev, | ||
294 | "%s: Out of memory for port structures\n", | ||
295 | serial->type->description); | ||
296 | goto no_private; | ||
297 | } | ||
298 | |||
299 | info->mcr = 0; | ||
300 | |||
301 | usb_set_serial_port_data(port, info); | ||
302 | } | ||
303 | |||
304 | command_info = kmalloc(sizeof(struct whiteheat_command_private), | 289 | command_info = kmalloc(sizeof(struct whiteheat_command_private), |
305 | GFP_KERNEL); | 290 | GFP_KERNEL); |
306 | if (command_info == NULL) { | 291 | if (command_info == NULL) { |
@@ -333,16 +318,10 @@ no_firmware: | |||
333 | "%s: please contact support@connecttech.com\n", | 318 | "%s: please contact support@connecttech.com\n", |
334 | serial->type->description); | 319 | serial->type->description); |
335 | kfree(result); | 320 | kfree(result); |
321 | kfree(command); | ||
336 | return -ENODEV; | 322 | return -ENODEV; |
337 | 323 | ||
338 | no_command_private: | 324 | no_command_private: |
339 | for (i = serial->num_ports - 1; i >= 0; i--) { | ||
340 | port = serial->port[i]; | ||
341 | info = usb_get_serial_port_data(port); | ||
342 | kfree(info); | ||
343 | no_private: | ||
344 | ; | ||
345 | } | ||
346 | kfree(result); | 325 | kfree(result); |
347 | no_result_buffer: | 326 | no_result_buffer: |
348 | kfree(command); | 327 | kfree(command); |
@@ -350,21 +329,36 @@ no_command_buffer: | |||
350 | return -ENOMEM; | 329 | return -ENOMEM; |
351 | } | 330 | } |
352 | 331 | ||
353 | |||
354 | static void whiteheat_release(struct usb_serial *serial) | 332 | static void whiteheat_release(struct usb_serial *serial) |
355 | { | 333 | { |
356 | struct usb_serial_port *command_port; | 334 | struct usb_serial_port *command_port; |
357 | struct whiteheat_private *info; | ||
358 | int i; | ||
359 | 335 | ||
360 | /* free up our private data for our command port */ | 336 | /* free up our private data for our command port */ |
361 | command_port = serial->port[COMMAND_PORT]; | 337 | command_port = serial->port[COMMAND_PORT]; |
362 | kfree(usb_get_serial_port_data(command_port)); | 338 | kfree(usb_get_serial_port_data(command_port)); |
339 | } | ||
363 | 340 | ||
364 | for (i = 0; i < serial->num_ports; i++) { | 341 | static int whiteheat_port_probe(struct usb_serial_port *port) |
365 | info = usb_get_serial_port_data(serial->port[i]); | 342 | { |
366 | kfree(info); | 343 | struct whiteheat_private *info; |
367 | } | 344 | |
345 | info = kzalloc(sizeof(*info), GFP_KERNEL); | ||
346 | if (!info) | ||
347 | return -ENOMEM; | ||
348 | |||
349 | usb_set_serial_port_data(port, info); | ||
350 | |||
351 | return 0; | ||
352 | } | ||
353 | |||
354 | static int whiteheat_port_remove(struct usb_serial_port *port) | ||
355 | { | ||
356 | struct whiteheat_private *info; | ||
357 | |||
358 | info = usb_get_serial_port_data(port); | ||
359 | kfree(info); | ||
360 | |||
361 | return 0; | ||
368 | } | 362 | } |
369 | 363 | ||
370 | static int whiteheat_open(struct tty_struct *tty, struct usb_serial_port *port) | 364 | static int whiteheat_open(struct tty_struct *tty, struct usb_serial_port *port) |
diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h index 779cd954abcb..d305a5aa3a5d 100644 --- a/drivers/usb/storage/unusual_devs.h +++ b/drivers/usb/storage/unusual_devs.h | |||
@@ -1004,6 +1004,12 @@ UNUSUAL_DEV( 0x07cf, 0x1001, 0x1000, 0x9999, | |||
1004 | USB_SC_8070, USB_PR_CB, NULL, | 1004 | USB_SC_8070, USB_PR_CB, NULL, |
1005 | US_FL_NEED_OVERRIDE | US_FL_FIX_INQUIRY ), | 1005 | US_FL_NEED_OVERRIDE | US_FL_FIX_INQUIRY ), |
1006 | 1006 | ||
1007 | /* Submitted by Oleksandr Chumachenko <ledest@gmail.com> */ | ||
1008 | UNUSUAL_DEV( 0x07cf, 0x1167, 0x0100, 0x0100, | ||
1009 | "Casio", | ||
1010 | "EX-N1 DigitalCamera", | ||
1011 | USB_SC_8070, USB_PR_DEVICE, NULL, 0), | ||
1012 | |||
1007 | /* Submitted by Hartmut Wahl <hwahl@hwahl.de>*/ | 1013 | /* Submitted by Hartmut Wahl <hwahl@hwahl.de>*/ |
1008 | UNUSUAL_DEV( 0x0839, 0x000a, 0x0001, 0x0001, | 1014 | UNUSUAL_DEV( 0x0839, 0x000a, 0x0001, 0x0001, |
1009 | "Samsung", | 1015 | "Samsung", |
diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c index 072cbbadbc36..7f93f34b7f91 100644 --- a/drivers/vhost/net.c +++ b/drivers/vhost/net.c | |||
@@ -379,7 +379,8 @@ static void handle_rx(struct vhost_net *net) | |||
379 | .hdr.gso_type = VIRTIO_NET_HDR_GSO_NONE | 379 | .hdr.gso_type = VIRTIO_NET_HDR_GSO_NONE |
380 | }; | 380 | }; |
381 | size_t total_len = 0; | 381 | size_t total_len = 0; |
382 | int err, headcount, mergeable; | 382 | int err, mergeable; |
383 | s16 headcount; | ||
383 | size_t vhost_hlen, sock_hlen; | 384 | size_t vhost_hlen, sock_hlen; |
384 | size_t vhost_len, sock_len; | 385 | size_t vhost_len, sock_len; |
385 | /* TODO: check that we are running from vhost_worker? */ | 386 | /* TODO: check that we are running from vhost_worker? */ |
diff --git a/drivers/video/atmel_lcdfb.c b/drivers/video/atmel_lcdfb.c index 94cac9f9919f..12cf5f31ee8f 100644 --- a/drivers/video/atmel_lcdfb.c +++ b/drivers/video/atmel_lcdfb.c | |||
@@ -19,8 +19,8 @@ | |||
19 | #include <linux/backlight.h> | 19 | #include <linux/backlight.h> |
20 | #include <linux/gfp.h> | 20 | #include <linux/gfp.h> |
21 | #include <linux/module.h> | 21 | #include <linux/module.h> |
22 | #include <linux/platform_data/atmel.h> | ||
22 | 23 | ||
23 | #include <mach/board.h> | ||
24 | #include <mach/cpu.h> | 24 | #include <mach/cpu.h> |
25 | #include <asm/gpio.h> | 25 | #include <asm/gpio.h> |
26 | 26 | ||
diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig index c101697a4ba7..765a945f8ea1 100644 --- a/drivers/video/backlight/Kconfig +++ b/drivers/video/backlight/Kconfig | |||
@@ -60,7 +60,8 @@ config LCD_LTV350QV | |||
60 | The LTV350QV panel is present on all ATSTK1000 boards. | 60 | The LTV350QV panel is present on all ATSTK1000 boards. |
61 | 61 | ||
62 | config LCD_ILI9320 | 62 | config LCD_ILI9320 |
63 | tristate | 63 | tristate "ILI Technology ILI9320 controller support" |
64 | depends on SPI | ||
64 | help | 65 | help |
65 | If you have a panel based on the ILI9320 controller chip | 66 | If you have a panel based on the ILI9320 controller chip |
66 | then say y to include a power driver for it. | 67 | then say y to include a power driver for it. |
diff --git a/drivers/xen/Kconfig b/drivers/xen/Kconfig index d4dffcd52873..126d8ce591ce 100644 --- a/drivers/xen/Kconfig +++ b/drivers/xen/Kconfig | |||
@@ -3,6 +3,7 @@ menu "Xen driver support" | |||
3 | 3 | ||
4 | config XEN_BALLOON | 4 | config XEN_BALLOON |
5 | bool "Xen memory balloon driver" | 5 | bool "Xen memory balloon driver" |
6 | depends on !ARM | ||
6 | default y | 7 | default y |
7 | help | 8 | help |
8 | The balloon driver allows the Xen domain to request more memory from | 9 | The balloon driver allows the Xen domain to request more memory from |
@@ -145,6 +146,7 @@ config SWIOTLB_XEN | |||
145 | 146 | ||
146 | config XEN_TMEM | 147 | config XEN_TMEM |
147 | bool | 148 | bool |
149 | depends on !ARM | ||
148 | default y if (CLEANCACHE || FRONTSWAP) | 150 | default y if (CLEANCACHE || FRONTSWAP) |
149 | help | 151 | help |
150 | Shim to interface in-kernel Transcendent Memory hooks | 152 | Shim to interface in-kernel Transcendent Memory hooks |
diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c index 31ab82fda38a..d6886d90ccfd 100644 --- a/drivers/xen/balloon.c +++ b/drivers/xen/balloon.c | |||
@@ -55,7 +55,6 @@ | |||
55 | #include <asm/pgalloc.h> | 55 | #include <asm/pgalloc.h> |
56 | #include <asm/pgtable.h> | 56 | #include <asm/pgtable.h> |
57 | #include <asm/tlb.h> | 57 | #include <asm/tlb.h> |
58 | #include <asm/e820.h> | ||
59 | 58 | ||
60 | #include <asm/xen/hypervisor.h> | 59 | #include <asm/xen/hypervisor.h> |
61 | #include <asm/xen/hypercall.h> | 60 | #include <asm/xen/hypercall.h> |
@@ -88,7 +87,7 @@ struct balloon_stats balloon_stats; | |||
88 | EXPORT_SYMBOL_GPL(balloon_stats); | 87 | EXPORT_SYMBOL_GPL(balloon_stats); |
89 | 88 | ||
90 | /* We increase/decrease in batches which fit in a page */ | 89 | /* We increase/decrease in batches which fit in a page */ |
91 | static unsigned long frame_list[PAGE_SIZE / sizeof(unsigned long)]; | 90 | static xen_pfn_t frame_list[PAGE_SIZE / sizeof(unsigned long)]; |
92 | 91 | ||
93 | #ifdef CONFIG_HIGHMEM | 92 | #ifdef CONFIG_HIGHMEM |
94 | #define inc_totalhigh_pages() (totalhigh_pages++) | 93 | #define inc_totalhigh_pages() (totalhigh_pages++) |
diff --git a/drivers/xen/dbgp.c b/drivers/xen/dbgp.c index 42569c77ccc8..f3ccc80a455f 100644 --- a/drivers/xen/dbgp.c +++ b/drivers/xen/dbgp.c | |||
@@ -8,7 +8,9 @@ | |||
8 | 8 | ||
9 | static int xen_dbgp_op(struct usb_hcd *hcd, int op) | 9 | static int xen_dbgp_op(struct usb_hcd *hcd, int op) |
10 | { | 10 | { |
11 | #ifdef CONFIG_PCI | ||
11 | const struct device *ctrlr = hcd_to_bus(hcd)->controller; | 12 | const struct device *ctrlr = hcd_to_bus(hcd)->controller; |
13 | #endif | ||
12 | struct physdev_dbgp_op dbgp; | 14 | struct physdev_dbgp_op dbgp; |
13 | 15 | ||
14 | if (!xen_initial_domain()) | 16 | if (!xen_initial_domain()) |
diff --git a/drivers/xen/events.c b/drivers/xen/events.c index 59e10a1286d5..912ac81b6dbf 100644 --- a/drivers/xen/events.c +++ b/drivers/xen/events.c | |||
@@ -115,7 +115,9 @@ struct irq_info { | |||
115 | #define PIRQ_SHAREABLE (1 << 1) | 115 | #define PIRQ_SHAREABLE (1 << 1) |
116 | 116 | ||
117 | static int *evtchn_to_irq; | 117 | static int *evtchn_to_irq; |
118 | #ifdef CONFIG_X86 | ||
118 | static unsigned long *pirq_eoi_map; | 119 | static unsigned long *pirq_eoi_map; |
120 | #endif | ||
119 | static bool (*pirq_needs_eoi)(unsigned irq); | 121 | static bool (*pirq_needs_eoi)(unsigned irq); |
120 | 122 | ||
121 | static DEFINE_PER_CPU(unsigned long [NR_EVENT_CHANNELS/BITS_PER_LONG], | 123 | static DEFINE_PER_CPU(unsigned long [NR_EVENT_CHANNELS/BITS_PER_LONG], |
@@ -277,10 +279,12 @@ static unsigned int cpu_from_evtchn(unsigned int evtchn) | |||
277 | return ret; | 279 | return ret; |
278 | } | 280 | } |
279 | 281 | ||
282 | #ifdef CONFIG_X86 | ||
280 | static bool pirq_check_eoi_map(unsigned irq) | 283 | static bool pirq_check_eoi_map(unsigned irq) |
281 | { | 284 | { |
282 | return test_bit(pirq_from_irq(irq), pirq_eoi_map); | 285 | return test_bit(pirq_from_irq(irq), pirq_eoi_map); |
283 | } | 286 | } |
287 | #endif | ||
284 | 288 | ||
285 | static bool pirq_needs_eoi_flag(unsigned irq) | 289 | static bool pirq_needs_eoi_flag(unsigned irq) |
286 | { | 290 | { |
diff --git a/drivers/xen/grant-table.c b/drivers/xen/grant-table.c index b2b0a375b348..b91f14e83164 100644 --- a/drivers/xen/grant-table.c +++ b/drivers/xen/grant-table.c | |||
@@ -84,7 +84,7 @@ struct gnttab_ops { | |||
84 | * nr_gframes is the number of frames to map grant table. Returning | 84 | * nr_gframes is the number of frames to map grant table. Returning |
85 | * GNTST_okay means success and negative value means failure. | 85 | * GNTST_okay means success and negative value means failure. |
86 | */ | 86 | */ |
87 | int (*map_frames)(unsigned long *frames, unsigned int nr_gframes); | 87 | int (*map_frames)(xen_pfn_t *frames, unsigned int nr_gframes); |
88 | /* | 88 | /* |
89 | * Release a list of frames which are mapped in map_frames for grant | 89 | * Release a list of frames which are mapped in map_frames for grant |
90 | * entry status. | 90 | * entry status. |
@@ -960,7 +960,7 @@ static unsigned nr_status_frames(unsigned nr_grant_frames) | |||
960 | return (nr_grant_frames * GREFS_PER_GRANT_FRAME + SPP - 1) / SPP; | 960 | return (nr_grant_frames * GREFS_PER_GRANT_FRAME + SPP - 1) / SPP; |
961 | } | 961 | } |
962 | 962 | ||
963 | static int gnttab_map_frames_v1(unsigned long *frames, unsigned int nr_gframes) | 963 | static int gnttab_map_frames_v1(xen_pfn_t *frames, unsigned int nr_gframes) |
964 | { | 964 | { |
965 | int rc; | 965 | int rc; |
966 | 966 | ||
@@ -977,7 +977,7 @@ static void gnttab_unmap_frames_v1(void) | |||
977 | arch_gnttab_unmap(gnttab_shared.addr, nr_grant_frames); | 977 | arch_gnttab_unmap(gnttab_shared.addr, nr_grant_frames); |
978 | } | 978 | } |
979 | 979 | ||
980 | static int gnttab_map_frames_v2(unsigned long *frames, unsigned int nr_gframes) | 980 | static int gnttab_map_frames_v2(xen_pfn_t *frames, unsigned int nr_gframes) |
981 | { | 981 | { |
982 | uint64_t *sframes; | 982 | uint64_t *sframes; |
983 | unsigned int nr_sframes; | 983 | unsigned int nr_sframes; |
@@ -1029,7 +1029,7 @@ static void gnttab_unmap_frames_v2(void) | |||
1029 | static int gnttab_map(unsigned int start_idx, unsigned int end_idx) | 1029 | static int gnttab_map(unsigned int start_idx, unsigned int end_idx) |
1030 | { | 1030 | { |
1031 | struct gnttab_setup_table setup; | 1031 | struct gnttab_setup_table setup; |
1032 | unsigned long *frames; | 1032 | xen_pfn_t *frames; |
1033 | unsigned int nr_gframes = end_idx + 1; | 1033 | unsigned int nr_gframes = end_idx + 1; |
1034 | int rc; | 1034 | int rc; |
1035 | 1035 | ||
diff --git a/drivers/xen/sys-hypervisor.c b/drivers/xen/sys-hypervisor.c index 5e5ad7e28858..96453f8a85c5 100644 --- a/drivers/xen/sys-hypervisor.c +++ b/drivers/xen/sys-hypervisor.c | |||
@@ -11,6 +11,7 @@ | |||
11 | #include <linux/kernel.h> | 11 | #include <linux/kernel.h> |
12 | #include <linux/module.h> | 12 | #include <linux/module.h> |
13 | #include <linux/kobject.h> | 13 | #include <linux/kobject.h> |
14 | #include <linux/err.h> | ||
14 | 15 | ||
15 | #include <asm/xen/hypervisor.h> | 16 | #include <asm/xen/hypervisor.h> |
16 | #include <asm/xen/hypercall.h> | 17 | #include <asm/xen/hypercall.h> |
@@ -284,7 +285,8 @@ static ssize_t virtual_start_show(struct hyp_sysfs_attr *attr, char *buffer) | |||
284 | ret = HYPERVISOR_xen_version(XENVER_platform_parameters, | 285 | ret = HYPERVISOR_xen_version(XENVER_platform_parameters, |
285 | parms); | 286 | parms); |
286 | if (!ret) | 287 | if (!ret) |
287 | ret = sprintf(buffer, "%lx\n", parms->virt_start); | 288 | ret = sprintf(buffer, "%"PRI_xen_ulong"\n", |
289 | parms->virt_start); | ||
288 | kfree(parms); | 290 | kfree(parms); |
289 | } | 291 | } |
290 | 292 | ||
diff --git a/drivers/xen/xen-pciback/vpci.c b/drivers/xen/xen-pciback/vpci.c index 46d140baebd8..0f478ac483cd 100644 --- a/drivers/xen/xen-pciback/vpci.c +++ b/drivers/xen/xen-pciback/vpci.c | |||
@@ -89,9 +89,15 @@ static int __xen_pcibk_add_pci_dev(struct xen_pcibk_device *pdev, | |||
89 | 89 | ||
90 | mutex_lock(&vpci_dev->lock); | 90 | mutex_lock(&vpci_dev->lock); |
91 | 91 | ||
92 | /* Keep multi-function devices together on the virtual PCI bus */ | 92 | /* |
93 | for (slot = 0; slot < PCI_SLOT_MAX; slot++) { | 93 | * Keep multi-function devices together on the virtual PCI bus, except |
94 | if (!list_empty(&vpci_dev->dev_list[slot])) { | 94 | * virtual functions. |
95 | */ | ||
96 | if (!dev->is_virtfn) { | ||
97 | for (slot = 0; slot < PCI_SLOT_MAX; slot++) { | ||
98 | if (list_empty(&vpci_dev->dev_list[slot])) | ||
99 | continue; | ||
100 | |||
95 | t = list_entry(list_first(&vpci_dev->dev_list[slot]), | 101 | t = list_entry(list_first(&vpci_dev->dev_list[slot]), |
96 | struct pci_dev_entry, list); | 102 | struct pci_dev_entry, list); |
97 | 103 | ||
@@ -116,7 +122,7 @@ static int __xen_pcibk_add_pci_dev(struct xen_pcibk_device *pdev, | |||
116 | pci_name(dev), slot); | 122 | pci_name(dev), slot); |
117 | list_add_tail(&dev_entry->list, | 123 | list_add_tail(&dev_entry->list, |
118 | &vpci_dev->dev_list[slot]); | 124 | &vpci_dev->dev_list[slot]); |
119 | func = PCI_FUNC(dev->devfn); | 125 | func = dev->is_virtfn ? 0 : PCI_FUNC(dev->devfn); |
120 | goto unlock; | 126 | goto unlock; |
121 | } | 127 | } |
122 | } | 128 | } |
diff --git a/drivers/xen/xenbus/xenbus_xs.c b/drivers/xen/xenbus/xenbus_xs.c index f5dda83ad7a5..acedeabe589c 100644 --- a/drivers/xen/xenbus/xenbus_xs.c +++ b/drivers/xen/xenbus/xenbus_xs.c | |||
@@ -627,6 +627,7 @@ static struct xenbus_watch *find_watch(const char *token) | |||
627 | */ | 627 | */ |
628 | static bool xen_strict_xenbus_quirk(void) | 628 | static bool xen_strict_xenbus_quirk(void) |
629 | { | 629 | { |
630 | #ifdef CONFIG_X86 | ||
630 | uint32_t eax, ebx, ecx, edx, base; | 631 | uint32_t eax, ebx, ecx, edx, base; |
631 | 632 | ||
632 | base = xen_cpuid_base(); | 633 | base = xen_cpuid_base(); |
@@ -634,6 +635,7 @@ static bool xen_strict_xenbus_quirk(void) | |||
634 | 635 | ||
635 | if ((eax >> 16) < 4) | 636 | if ((eax >> 16) < 4) |
636 | return true; | 637 | return true; |
638 | #endif | ||
637 | return false; | 639 | return false; |
638 | 640 | ||
639 | } | 641 | } |