diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2014-06-04 19:55:13 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-06-04 19:55:13 -0400 |
| commit | 00170fdd0846df7cdb5ad421d3a340440f930b8f (patch) | |
| tree | 1883cfbda846cd65faed011bda54a52c1d40ecdd /drivers | |
| parent | d09cc3659db494aca4b3bb2393c533fb4946b794 (diff) | |
| parent | 3ff6db3287e8a5e8f5bb9529b8e1259ca6b10def (diff) | |
Merge branch 'akpm' (patchbomb from Andrew) into next
Merge misc updates from Andrew Morton:
- a few fixes for 3.16. Cc'ed to stable so they'll get there somehow.
- various misc fixes and cleanups
- most of the ocfs2 queue. Review is slow...
- most of MM. The MM queue is pretty huge this time, but not much in
the way of feature work.
- some tweaks under kernel/
- printk maintenance work
- updates to lib/
- checkpatch updates
- tweaks to init/
* emailed patches from Andrew Morton <akpm@linux-foundation.org>: (276 commits)
fs/autofs4/dev-ioctl.c: add __init to autofs_dev_ioctl_init
fs/ncpfs/getopt.c: replace simple_strtoul by kstrtoul
init/main.c: remove an ifdef
kthreads: kill CLONE_KERNEL, change kernel_thread(kernel_init) to avoid CLONE_SIGHAND
init/main.c: add initcall_blacklist kernel parameter
init/main.c: don't use pr_debug()
fs/binfmt_flat.c: make old_reloc() static
fs/binfmt_elf.c: fix bool assignements
fs/efs: convert printk(KERN_DEBUG to pr_debug
fs/efs: add pr_fmt / use __func__
fs/efs: convert printk to pr_foo()
scripts/checkpatch.pl: device_initcall is not the only __initcall substitute
checkpatch: check stable email address
checkpatch: warn on unnecessary void function return statements
checkpatch: prefer kstrto<foo> to sscanf(buf, "%<lhuidx>", &bar);
checkpatch: add warning for kmalloc/kzalloc with multiply
checkpatch: warn on #defines ending in semicolon
checkpatch: make --strict a default for files in drivers/net and net/
checkpatch: always warn on missing blank line after variable declaration block
checkpatch: fix wildcard DT compatible string checking
...
Diffstat (limited to 'drivers')
| -rw-r--r-- | drivers/base/Kconfig | 2 | ||||
| -rw-r--r-- | drivers/base/dma-contiguous.c | 42 | ||||
| -rw-r--r-- | drivers/base/memory.c | 12 | ||||
| -rw-r--r-- | drivers/block/brd.c | 16 | ||||
| -rw-r--r-- | drivers/block/zram/zram_drv.c | 4 | ||||
| -rw-r--r-- | drivers/gpu/drm/exynos/exynos_drm_g2d.c | 6 | ||||
| -rw-r--r-- | drivers/iommu/intel-iommu.c | 33 | ||||
| -rw-r--r-- | drivers/nubus/nubus.c | 18 | ||||
| -rw-r--r-- | drivers/tty/sysrq.c | 8 |
9 files changed, 92 insertions, 49 deletions
diff --git a/drivers/base/Kconfig b/drivers/base/Kconfig index 4b7b4522b64f..23b8726962af 100644 --- a/drivers/base/Kconfig +++ b/drivers/base/Kconfig | |||
| @@ -258,7 +258,7 @@ endchoice | |||
| 258 | 258 | ||
| 259 | config CMA_ALIGNMENT | 259 | config CMA_ALIGNMENT |
| 260 | int "Maximum PAGE_SIZE order of alignment for contiguous buffers" | 260 | int "Maximum PAGE_SIZE order of alignment for contiguous buffers" |
| 261 | range 4 9 | 261 | range 4 12 |
| 262 | default 8 | 262 | default 8 |
| 263 | help | 263 | help |
| 264 | DMA mapping framework by default aligns all buffers to the smallest | 264 | DMA mapping framework by default aligns all buffers to the smallest |
diff --git a/drivers/base/dma-contiguous.c b/drivers/base/dma-contiguous.c index c34ec3364243..83969f8c5727 100644 --- a/drivers/base/dma-contiguous.c +++ b/drivers/base/dma-contiguous.c | |||
| @@ -60,11 +60,22 @@ struct cma *dma_contiguous_default_area; | |||
| 60 | */ | 60 | */ |
| 61 | static const phys_addr_t size_bytes = CMA_SIZE_MBYTES * SZ_1M; | 61 | static const phys_addr_t size_bytes = CMA_SIZE_MBYTES * SZ_1M; |
| 62 | static phys_addr_t size_cmdline = -1; | 62 | static phys_addr_t size_cmdline = -1; |
| 63 | static phys_addr_t base_cmdline; | ||
| 64 | static phys_addr_t limit_cmdline; | ||
| 63 | 65 | ||
| 64 | static int __init early_cma(char *p) | 66 | static int __init early_cma(char *p) |
| 65 | { | 67 | { |
| 66 | pr_debug("%s(%s)\n", __func__, p); | 68 | pr_debug("%s(%s)\n", __func__, p); |
| 67 | size_cmdline = memparse(p, &p); | 69 | size_cmdline = memparse(p, &p); |
| 70 | if (*p != '@') | ||
| 71 | return 0; | ||
| 72 | base_cmdline = memparse(p + 1, &p); | ||
| 73 | if (*p != '-') { | ||
| 74 | limit_cmdline = base_cmdline + size_cmdline; | ||
| 75 | return 0; | ||
| 76 | } | ||
| 77 | limit_cmdline = memparse(p + 1, &p); | ||
| 78 | |||
| 68 | return 0; | 79 | return 0; |
| 69 | } | 80 | } |
| 70 | early_param("cma", early_cma); | 81 | early_param("cma", early_cma); |
| @@ -108,11 +119,18 @@ static inline __maybe_unused phys_addr_t cma_early_percent_memory(void) | |||
| 108 | void __init dma_contiguous_reserve(phys_addr_t limit) | 119 | void __init dma_contiguous_reserve(phys_addr_t limit) |
| 109 | { | 120 | { |
| 110 | phys_addr_t selected_size = 0; | 121 | phys_addr_t selected_size = 0; |
| 122 | phys_addr_t selected_base = 0; | ||
| 123 | phys_addr_t selected_limit = limit; | ||
| 124 | bool fixed = false; | ||
| 111 | 125 | ||
| 112 | pr_debug("%s(limit %08lx)\n", __func__, (unsigned long)limit); | 126 | pr_debug("%s(limit %08lx)\n", __func__, (unsigned long)limit); |
| 113 | 127 | ||
| 114 | if (size_cmdline != -1) { | 128 | if (size_cmdline != -1) { |
| 115 | selected_size = size_cmdline; | 129 | selected_size = size_cmdline; |
| 130 | selected_base = base_cmdline; | ||
| 131 | selected_limit = min_not_zero(limit_cmdline, limit); | ||
| 132 | if (base_cmdline + size_cmdline == limit_cmdline) | ||
| 133 | fixed = true; | ||
| 116 | } else { | 134 | } else { |
| 117 | #ifdef CONFIG_CMA_SIZE_SEL_MBYTES | 135 | #ifdef CONFIG_CMA_SIZE_SEL_MBYTES |
| 118 | selected_size = size_bytes; | 136 | selected_size = size_bytes; |
| @@ -129,10 +147,12 @@ void __init dma_contiguous_reserve(phys_addr_t limit) | |||
| 129 | pr_debug("%s: reserving %ld MiB for global area\n", __func__, | 147 | pr_debug("%s: reserving %ld MiB for global area\n", __func__, |
| 130 | (unsigned long)selected_size / SZ_1M); | 148 | (unsigned long)selected_size / SZ_1M); |
| 131 | 149 | ||
| 132 | dma_contiguous_reserve_area(selected_size, 0, limit, | 150 | dma_contiguous_reserve_area(selected_size, selected_base, |
| 133 | &dma_contiguous_default_area); | 151 | selected_limit, |
| 152 | &dma_contiguous_default_area, | ||
| 153 | fixed); | ||
| 134 | } | 154 | } |
| 135 | }; | 155 | } |
| 136 | 156 | ||
| 137 | static DEFINE_MUTEX(cma_mutex); | 157 | static DEFINE_MUTEX(cma_mutex); |
| 138 | 158 | ||
| @@ -189,15 +209,20 @@ core_initcall(cma_init_reserved_areas); | |||
| 189 | * @base: Base address of the reserved area optional, use 0 for any | 209 | * @base: Base address of the reserved area optional, use 0 for any |
| 190 | * @limit: End address of the reserved memory (optional, 0 for any). | 210 | * @limit: End address of the reserved memory (optional, 0 for any). |
| 191 | * @res_cma: Pointer to store the created cma region. | 211 | * @res_cma: Pointer to store the created cma region. |
| 212 | * @fixed: hint about where to place the reserved area | ||
| 192 | * | 213 | * |
| 193 | * This function reserves memory from early allocator. It should be | 214 | * This function reserves memory from early allocator. It should be |
| 194 | * called by arch specific code once the early allocator (memblock or bootmem) | 215 | * called by arch specific code once the early allocator (memblock or bootmem) |
| 195 | * has been activated and all other subsystems have already allocated/reserved | 216 | * has been activated and all other subsystems have already allocated/reserved |
| 196 | * memory. This function allows to create custom reserved areas for specific | 217 | * memory. This function allows to create custom reserved areas for specific |
| 197 | * devices. | 218 | * devices. |
| 219 | * | ||
| 220 | * If @fixed is true, reserve contiguous area at exactly @base. If false, | ||
| 221 | * reserve in range from @base to @limit. | ||
| 198 | */ | 222 | */ |
| 199 | int __init dma_contiguous_reserve_area(phys_addr_t size, phys_addr_t base, | 223 | int __init dma_contiguous_reserve_area(phys_addr_t size, phys_addr_t base, |
| 200 | phys_addr_t limit, struct cma **res_cma) | 224 | phys_addr_t limit, struct cma **res_cma, |
| 225 | bool fixed) | ||
| 201 | { | 226 | { |
| 202 | struct cma *cma = &cma_areas[cma_area_count]; | 227 | struct cma *cma = &cma_areas[cma_area_count]; |
| 203 | phys_addr_t alignment; | 228 | phys_addr_t alignment; |
| @@ -223,18 +248,15 @@ int __init dma_contiguous_reserve_area(phys_addr_t size, phys_addr_t base, | |||
| 223 | limit &= ~(alignment - 1); | 248 | limit &= ~(alignment - 1); |
| 224 | 249 | ||
| 225 | /* Reserve memory */ | 250 | /* Reserve memory */ |
| 226 | if (base) { | 251 | if (base && fixed) { |
| 227 | if (memblock_is_region_reserved(base, size) || | 252 | if (memblock_is_region_reserved(base, size) || |
| 228 | memblock_reserve(base, size) < 0) { | 253 | memblock_reserve(base, size) < 0) { |
| 229 | ret = -EBUSY; | 254 | ret = -EBUSY; |
| 230 | goto err; | 255 | goto err; |
| 231 | } | 256 | } |
| 232 | } else { | 257 | } else { |
| 233 | /* | 258 | phys_addr_t addr = memblock_alloc_range(size, alignment, base, |
| 234 | * Use __memblock_alloc_base() since | 259 | limit); |
| 235 | * memblock_alloc_base() panic()s. | ||
| 236 | */ | ||
| 237 | phys_addr_t addr = __memblock_alloc_base(size, alignment, limit); | ||
| 238 | if (!addr) { | 260 | if (!addr) { |
| 239 | ret = -ENOMEM; | 261 | ret = -ENOMEM; |
| 240 | goto err; | 262 | goto err; |
diff --git a/drivers/base/memory.c b/drivers/base/memory.c index bece691cb5d9..89f752dd8465 100644 --- a/drivers/base/memory.c +++ b/drivers/base/memory.c | |||
| @@ -118,16 +118,6 @@ static ssize_t show_mem_start_phys_index(struct device *dev, | |||
| 118 | return sprintf(buf, "%08lx\n", phys_index); | 118 | return sprintf(buf, "%08lx\n", phys_index); |
| 119 | } | 119 | } |
| 120 | 120 | ||
| 121 | static ssize_t show_mem_end_phys_index(struct device *dev, | ||
| 122 | struct device_attribute *attr, char *buf) | ||
| 123 | { | ||
| 124 | struct memory_block *mem = to_memory_block(dev); | ||
| 125 | unsigned long phys_index; | ||
| 126 | |||
| 127 | phys_index = mem->end_section_nr / sections_per_block; | ||
| 128 | return sprintf(buf, "%08lx\n", phys_index); | ||
| 129 | } | ||
| 130 | |||
| 131 | /* | 121 | /* |
| 132 | * Show whether the section of memory is likely to be hot-removable | 122 | * Show whether the section of memory is likely to be hot-removable |
| 133 | */ | 123 | */ |
| @@ -384,7 +374,6 @@ static ssize_t show_phys_device(struct device *dev, | |||
| 384 | } | 374 | } |
| 385 | 375 | ||
| 386 | static DEVICE_ATTR(phys_index, 0444, show_mem_start_phys_index, NULL); | 376 | static DEVICE_ATTR(phys_index, 0444, show_mem_start_phys_index, NULL); |
| 387 | static DEVICE_ATTR(end_phys_index, 0444, show_mem_end_phys_index, NULL); | ||
| 388 | static DEVICE_ATTR(state, 0644, show_mem_state, store_mem_state); | 377 | static DEVICE_ATTR(state, 0644, show_mem_state, store_mem_state); |
| 389 | static DEVICE_ATTR(phys_device, 0444, show_phys_device, NULL); | 378 | static DEVICE_ATTR(phys_device, 0444, show_phys_device, NULL); |
| 390 | static DEVICE_ATTR(removable, 0444, show_mem_removable, NULL); | 379 | static DEVICE_ATTR(removable, 0444, show_mem_removable, NULL); |
| @@ -529,7 +518,6 @@ struct memory_block *find_memory_block(struct mem_section *section) | |||
| 529 | 518 | ||
| 530 | static struct attribute *memory_memblk_attrs[] = { | 519 | static struct attribute *memory_memblk_attrs[] = { |
| 531 | &dev_attr_phys_index.attr, | 520 | &dev_attr_phys_index.attr, |
| 532 | &dev_attr_end_phys_index.attr, | ||
| 533 | &dev_attr_state.attr, | 521 | &dev_attr_state.attr, |
| 534 | &dev_attr_phys_device.attr, | 522 | &dev_attr_phys_device.attr, |
| 535 | &dev_attr_removable.attr, | 523 | &dev_attr_removable.attr, |
diff --git a/drivers/block/brd.c b/drivers/block/brd.c index e73b85cf0756..c7d138eca731 100644 --- a/drivers/block/brd.c +++ b/drivers/block/brd.c | |||
| @@ -200,11 +200,11 @@ static int copy_to_brd_setup(struct brd_device *brd, sector_t sector, size_t n) | |||
| 200 | 200 | ||
| 201 | copy = min_t(size_t, n, PAGE_SIZE - offset); | 201 | copy = min_t(size_t, n, PAGE_SIZE - offset); |
| 202 | if (!brd_insert_page(brd, sector)) | 202 | if (!brd_insert_page(brd, sector)) |
| 203 | return -ENOMEM; | 203 | return -ENOSPC; |
| 204 | if (copy < n) { | 204 | if (copy < n) { |
| 205 | sector += copy >> SECTOR_SHIFT; | 205 | sector += copy >> SECTOR_SHIFT; |
| 206 | if (!brd_insert_page(brd, sector)) | 206 | if (!brd_insert_page(brd, sector)) |
| 207 | return -ENOMEM; | 207 | return -ENOSPC; |
| 208 | } | 208 | } |
| 209 | return 0; | 209 | return 0; |
| 210 | } | 210 | } |
| @@ -360,6 +360,15 @@ out: | |||
| 360 | bio_endio(bio, err); | 360 | bio_endio(bio, err); |
| 361 | } | 361 | } |
| 362 | 362 | ||
| 363 | static int brd_rw_page(struct block_device *bdev, sector_t sector, | ||
| 364 | struct page *page, int rw) | ||
| 365 | { | ||
| 366 | struct brd_device *brd = bdev->bd_disk->private_data; | ||
| 367 | int err = brd_do_bvec(brd, page, PAGE_CACHE_SIZE, 0, rw, sector); | ||
| 368 | page_endio(page, rw & WRITE, err); | ||
| 369 | return err; | ||
| 370 | } | ||
| 371 | |||
| 363 | #ifdef CONFIG_BLK_DEV_XIP | 372 | #ifdef CONFIG_BLK_DEV_XIP |
| 364 | static int brd_direct_access(struct block_device *bdev, sector_t sector, | 373 | static int brd_direct_access(struct block_device *bdev, sector_t sector, |
| 365 | void **kaddr, unsigned long *pfn) | 374 | void **kaddr, unsigned long *pfn) |
| @@ -375,7 +384,7 @@ static int brd_direct_access(struct block_device *bdev, sector_t sector, | |||
| 375 | return -ERANGE; | 384 | return -ERANGE; |
| 376 | page = brd_insert_page(brd, sector); | 385 | page = brd_insert_page(brd, sector); |
| 377 | if (!page) | 386 | if (!page) |
| 378 | return -ENOMEM; | 387 | return -ENOSPC; |
| 379 | *kaddr = page_address(page); | 388 | *kaddr = page_address(page); |
| 380 | *pfn = page_to_pfn(page); | 389 | *pfn = page_to_pfn(page); |
| 381 | 390 | ||
| @@ -419,6 +428,7 @@ static int brd_ioctl(struct block_device *bdev, fmode_t mode, | |||
| 419 | 428 | ||
| 420 | static const struct block_device_operations brd_fops = { | 429 | static const struct block_device_operations brd_fops = { |
| 421 | .owner = THIS_MODULE, | 430 | .owner = THIS_MODULE, |
| 431 | .rw_page = brd_rw_page, | ||
| 422 | .ioctl = brd_ioctl, | 432 | .ioctl = brd_ioctl, |
| 423 | #ifdef CONFIG_BLK_DEV_XIP | 433 | #ifdef CONFIG_BLK_DEV_XIP |
| 424 | .direct_access = brd_direct_access, | 434 | .direct_access = brd_direct_access, |
diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c index 9849b5233bf4..48eccb350180 100644 --- a/drivers/block/zram/zram_drv.c +++ b/drivers/block/zram/zram_drv.c | |||
| @@ -572,10 +572,10 @@ static void zram_bio_discard(struct zram *zram, u32 index, | |||
| 572 | * skipping this logical block is appropriate here. | 572 | * skipping this logical block is appropriate here. |
| 573 | */ | 573 | */ |
| 574 | if (offset) { | 574 | if (offset) { |
| 575 | if (n < offset) | 575 | if (n <= (PAGE_SIZE - offset)) |
| 576 | return; | 576 | return; |
| 577 | 577 | ||
| 578 | n -= offset; | 578 | n -= (PAGE_SIZE - offset); |
| 579 | index++; | 579 | index++; |
| 580 | } | 580 | } |
| 581 | 581 | ||
diff --git a/drivers/gpu/drm/exynos/exynos_drm_g2d.c b/drivers/gpu/drm/exynos/exynos_drm_g2d.c index 6c1885eedfdf..800158714473 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_g2d.c +++ b/drivers/gpu/drm/exynos/exynos_drm_g2d.c | |||
| @@ -467,14 +467,17 @@ static dma_addr_t *g2d_userptr_get_dma_addr(struct drm_device *drm_dev, | |||
| 467 | goto err_free; | 467 | goto err_free; |
| 468 | } | 468 | } |
| 469 | 469 | ||
| 470 | down_read(¤t->mm->mmap_sem); | ||
| 470 | vma = find_vma(current->mm, userptr); | 471 | vma = find_vma(current->mm, userptr); |
| 471 | if (!vma) { | 472 | if (!vma) { |
| 473 | up_read(¤t->mm->mmap_sem); | ||
| 472 | DRM_ERROR("failed to get vm region.\n"); | 474 | DRM_ERROR("failed to get vm region.\n"); |
| 473 | ret = -EFAULT; | 475 | ret = -EFAULT; |
| 474 | goto err_free_pages; | 476 | goto err_free_pages; |
| 475 | } | 477 | } |
| 476 | 478 | ||
| 477 | if (vma->vm_end < userptr + size) { | 479 | if (vma->vm_end < userptr + size) { |
| 480 | up_read(¤t->mm->mmap_sem); | ||
| 478 | DRM_ERROR("vma is too small.\n"); | 481 | DRM_ERROR("vma is too small.\n"); |
| 479 | ret = -EFAULT; | 482 | ret = -EFAULT; |
| 480 | goto err_free_pages; | 483 | goto err_free_pages; |
| @@ -482,6 +485,7 @@ static dma_addr_t *g2d_userptr_get_dma_addr(struct drm_device *drm_dev, | |||
| 482 | 485 | ||
| 483 | g2d_userptr->vma = exynos_gem_get_vma(vma); | 486 | g2d_userptr->vma = exynos_gem_get_vma(vma); |
| 484 | if (!g2d_userptr->vma) { | 487 | if (!g2d_userptr->vma) { |
| 488 | up_read(¤t->mm->mmap_sem); | ||
| 485 | DRM_ERROR("failed to copy vma.\n"); | 489 | DRM_ERROR("failed to copy vma.\n"); |
| 486 | ret = -ENOMEM; | 490 | ret = -ENOMEM; |
| 487 | goto err_free_pages; | 491 | goto err_free_pages; |
| @@ -492,10 +496,12 @@ static dma_addr_t *g2d_userptr_get_dma_addr(struct drm_device *drm_dev, | |||
| 492 | ret = exynos_gem_get_pages_from_userptr(start & PAGE_MASK, | 496 | ret = exynos_gem_get_pages_from_userptr(start & PAGE_MASK, |
| 493 | npages, pages, vma); | 497 | npages, pages, vma); |
| 494 | if (ret < 0) { | 498 | if (ret < 0) { |
| 499 | up_read(¤t->mm->mmap_sem); | ||
| 495 | DRM_ERROR("failed to get user pages from userptr.\n"); | 500 | DRM_ERROR("failed to get user pages from userptr.\n"); |
| 496 | goto err_put_vma; | 501 | goto err_put_vma; |
| 497 | } | 502 | } |
| 498 | 503 | ||
| 504 | up_read(¤t->mm->mmap_sem); | ||
| 499 | g2d_userptr->pages = pages; | 505 | g2d_userptr->pages = pages; |
| 500 | 506 | ||
| 501 | sgt = kzalloc(sizeof(*sgt), GFP_KERNEL); | 507 | sgt = kzalloc(sizeof(*sgt), GFP_KERNEL); |
diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index f256ffc02e29..6bb32773c3ac 100644 --- a/drivers/iommu/intel-iommu.c +++ b/drivers/iommu/intel-iommu.c | |||
| @@ -39,6 +39,7 @@ | |||
| 39 | #include <linux/dmi.h> | 39 | #include <linux/dmi.h> |
| 40 | #include <linux/pci-ats.h> | 40 | #include <linux/pci-ats.h> |
| 41 | #include <linux/memblock.h> | 41 | #include <linux/memblock.h> |
| 42 | #include <linux/dma-contiguous.h> | ||
| 42 | #include <asm/irq_remapping.h> | 43 | #include <asm/irq_remapping.h> |
| 43 | #include <asm/cacheflush.h> | 44 | #include <asm/cacheflush.h> |
| 44 | #include <asm/iommu.h> | 45 | #include <asm/iommu.h> |
| @@ -3193,7 +3194,7 @@ static void *intel_alloc_coherent(struct device *dev, size_t size, | |||
| 3193 | dma_addr_t *dma_handle, gfp_t flags, | 3194 | dma_addr_t *dma_handle, gfp_t flags, |
| 3194 | struct dma_attrs *attrs) | 3195 | struct dma_attrs *attrs) |
| 3195 | { | 3196 | { |
| 3196 | void *vaddr; | 3197 | struct page *page = NULL; |
| 3197 | int order; | 3198 | int order; |
| 3198 | 3199 | ||
| 3199 | size = PAGE_ALIGN(size); | 3200 | size = PAGE_ALIGN(size); |
| @@ -3208,17 +3209,31 @@ static void *intel_alloc_coherent(struct device *dev, size_t size, | |||
| 3208 | flags |= GFP_DMA32; | 3209 | flags |= GFP_DMA32; |
| 3209 | } | 3210 | } |
| 3210 | 3211 | ||
| 3211 | vaddr = (void *)__get_free_pages(flags, order); | 3212 | if (flags & __GFP_WAIT) { |
| 3212 | if (!vaddr) | 3213 | unsigned int count = size >> PAGE_SHIFT; |
| 3214 | |||
| 3215 | page = dma_alloc_from_contiguous(dev, count, order); | ||
| 3216 | if (page && iommu_no_mapping(dev) && | ||
| 3217 | page_to_phys(page) + size > dev->coherent_dma_mask) { | ||
| 3218 | dma_release_from_contiguous(dev, page, count); | ||
| 3219 | page = NULL; | ||
| 3220 | } | ||
| 3221 | } | ||
| 3222 | |||
| 3223 | if (!page) | ||
| 3224 | page = alloc_pages(flags, order); | ||
| 3225 | if (!page) | ||
| 3213 | return NULL; | 3226 | return NULL; |
| 3214 | memset(vaddr, 0, size); | 3227 | memset(page_address(page), 0, size); |
| 3215 | 3228 | ||
| 3216 | *dma_handle = __intel_map_single(dev, virt_to_bus(vaddr), size, | 3229 | *dma_handle = __intel_map_single(dev, page_to_phys(page), size, |
| 3217 | DMA_BIDIRECTIONAL, | 3230 | DMA_BIDIRECTIONAL, |
| 3218 | dev->coherent_dma_mask); | 3231 | dev->coherent_dma_mask); |
| 3219 | if (*dma_handle) | 3232 | if (*dma_handle) |
| 3220 | return vaddr; | 3233 | return page_address(page); |
| 3221 | free_pages((unsigned long)vaddr, order); | 3234 | if (!dma_release_from_contiguous(dev, page, size >> PAGE_SHIFT)) |
| 3235 | __free_pages(page, order); | ||
| 3236 | |||
| 3222 | return NULL; | 3237 | return NULL; |
| 3223 | } | 3238 | } |
| 3224 | 3239 | ||
| @@ -3226,12 +3241,14 @@ static void intel_free_coherent(struct device *dev, size_t size, void *vaddr, | |||
| 3226 | dma_addr_t dma_handle, struct dma_attrs *attrs) | 3241 | dma_addr_t dma_handle, struct dma_attrs *attrs) |
| 3227 | { | 3242 | { |
| 3228 | int order; | 3243 | int order; |
| 3244 | struct page *page = virt_to_page(vaddr); | ||
| 3229 | 3245 | ||
| 3230 | size = PAGE_ALIGN(size); | 3246 | size = PAGE_ALIGN(size); |
| 3231 | order = get_order(size); | 3247 | order = get_order(size); |
| 3232 | 3248 | ||
| 3233 | intel_unmap_page(dev, dma_handle, size, DMA_BIDIRECTIONAL, NULL); | 3249 | intel_unmap_page(dev, dma_handle, size, DMA_BIDIRECTIONAL, NULL); |
| 3234 | free_pages((unsigned long)vaddr, order); | 3250 | if (!dma_release_from_contiguous(dev, page, size >> PAGE_SHIFT)) |
| 3251 | __free_pages(page, order); | ||
| 3235 | } | 3252 | } |
| 3236 | 3253 | ||
| 3237 | static void intel_unmap_sg(struct device *dev, struct scatterlist *sglist, | 3254 | static void intel_unmap_sg(struct device *dev, struct scatterlist *sglist, |
diff --git a/drivers/nubus/nubus.c b/drivers/nubus/nubus.c index 43926cd25ae8..5066a7ef7b6c 100644 --- a/drivers/nubus/nubus.c +++ b/drivers/nubus/nubus.c | |||
| @@ -473,7 +473,7 @@ static struct nubus_dev* __init | |||
| 473 | if (slot == 0 && (unsigned long)dir.base % 2) | 473 | if (slot == 0 && (unsigned long)dir.base % 2) |
| 474 | dir.base += 1; | 474 | dir.base += 1; |
| 475 | 475 | ||
| 476 | if (console_loglevel >= 10) | 476 | if (console_loglevel >= CONSOLE_LOGLEVEL_DEBUG) |
| 477 | printk(KERN_DEBUG "nubus_get_functional_resource: parent is 0x%p, dir is 0x%p\n", | 477 | printk(KERN_DEBUG "nubus_get_functional_resource: parent is 0x%p, dir is 0x%p\n", |
| 478 | parent->base, dir.base); | 478 | parent->base, dir.base); |
| 479 | 479 | ||
| @@ -568,7 +568,7 @@ static int __init nubus_get_vidnames(struct nubus_board* board, | |||
| 568 | 568 | ||
| 569 | printk(KERN_INFO " video modes supported:\n"); | 569 | printk(KERN_INFO " video modes supported:\n"); |
| 570 | nubus_get_subdir(parent, &dir); | 570 | nubus_get_subdir(parent, &dir); |
| 571 | if (console_loglevel >= 10) | 571 | if (console_loglevel >= CONSOLE_LOGLEVEL_DEBUG) |
| 572 | printk(KERN_DEBUG "nubus_get_vidnames: parent is 0x%p, dir is 0x%p\n", | 572 | printk(KERN_DEBUG "nubus_get_vidnames: parent is 0x%p, dir is 0x%p\n", |
| 573 | parent->base, dir.base); | 573 | parent->base, dir.base); |
| 574 | 574 | ||
| @@ -629,7 +629,7 @@ static int __init nubus_get_vendorinfo(struct nubus_board* board, | |||
| 629 | 629 | ||
| 630 | printk(KERN_INFO " vendor info:\n"); | 630 | printk(KERN_INFO " vendor info:\n"); |
| 631 | nubus_get_subdir(parent, &dir); | 631 | nubus_get_subdir(parent, &dir); |
| 632 | if (console_loglevel >= 10) | 632 | if (console_loglevel >= CONSOLE_LOGLEVEL_DEBUG) |
| 633 | printk(KERN_DEBUG "nubus_get_vendorinfo: parent is 0x%p, dir is 0x%p\n", | 633 | printk(KERN_DEBUG "nubus_get_vendorinfo: parent is 0x%p, dir is 0x%p\n", |
| 634 | parent->base, dir.base); | 634 | parent->base, dir.base); |
| 635 | 635 | ||
| @@ -654,7 +654,7 @@ static int __init nubus_get_board_resource(struct nubus_board* board, int slot, | |||
| 654 | struct nubus_dirent ent; | 654 | struct nubus_dirent ent; |
| 655 | 655 | ||
| 656 | nubus_get_subdir(parent, &dir); | 656 | nubus_get_subdir(parent, &dir); |
| 657 | if (console_loglevel >= 10) | 657 | if (console_loglevel >= CONSOLE_LOGLEVEL_DEBUG) |
| 658 | printk(KERN_DEBUG "nubus_get_board_resource: parent is 0x%p, dir is 0x%p\n", | 658 | printk(KERN_DEBUG "nubus_get_board_resource: parent is 0x%p, dir is 0x%p\n", |
| 659 | parent->base, dir.base); | 659 | parent->base, dir.base); |
| 660 | 660 | ||
| @@ -753,19 +753,19 @@ static void __init nubus_find_rom_dir(struct nubus_board* board) | |||
| 753 | if (nubus_readdir(&dir, &ent) == -1) | 753 | if (nubus_readdir(&dir, &ent) == -1) |
| 754 | goto badrom; | 754 | goto badrom; |
| 755 | 755 | ||
| 756 | if (console_loglevel >= 10) | 756 | if (console_loglevel >= CONSOLE_LOGLEVEL_DEBUG) |
| 757 | printk(KERN_INFO "nubus_get_rom_dir: entry %02x %06x\n", ent.type, ent.data); | 757 | printk(KERN_INFO "nubus_get_rom_dir: entry %02x %06x\n", ent.type, ent.data); |
| 758 | /* This one takes us to where we want to go. */ | 758 | /* This one takes us to where we want to go. */ |
| 759 | if (nubus_readdir(&dir, &ent) == -1) | 759 | if (nubus_readdir(&dir, &ent) == -1) |
| 760 | goto badrom; | 760 | goto badrom; |
| 761 | if (console_loglevel >= 10) | 761 | if (console_loglevel >= CONSOLE_LOGLEVEL_DEBUG) |
| 762 | printk(KERN_DEBUG "nubus_get_rom_dir: entry %02x %06x\n", ent.type, ent.data); | 762 | printk(KERN_DEBUG "nubus_get_rom_dir: entry %02x %06x\n", ent.type, ent.data); |
| 763 | nubus_get_subdir(&ent, &dir); | 763 | nubus_get_subdir(&ent, &dir); |
| 764 | 764 | ||
| 765 | /* Resource ID 01, also an "Unknown Macintosh" */ | 765 | /* Resource ID 01, also an "Unknown Macintosh" */ |
| 766 | if (nubus_readdir(&dir, &ent) == -1) | 766 | if (nubus_readdir(&dir, &ent) == -1) |
| 767 | goto badrom; | 767 | goto badrom; |
| 768 | if (console_loglevel >= 10) | 768 | if (console_loglevel >= CONSOLE_LOGLEVEL_DEBUG) |
| 769 | printk(KERN_DEBUG "nubus_get_rom_dir: entry %02x %06x\n", ent.type, ent.data); | 769 | printk(KERN_DEBUG "nubus_get_rom_dir: entry %02x %06x\n", ent.type, ent.data); |
| 770 | 770 | ||
| 771 | /* FIXME: the first one is *not* always the right one. We | 771 | /* FIXME: the first one is *not* always the right one. We |
| @@ -780,7 +780,7 @@ static void __init nubus_find_rom_dir(struct nubus_board* board) | |||
| 780 | path to that address... */ | 780 | path to that address... */ |
| 781 | if (nubus_readdir(&dir, &ent) == -1) | 781 | if (nubus_readdir(&dir, &ent) == -1) |
| 782 | goto badrom; | 782 | goto badrom; |
| 783 | if (console_loglevel >= 10) | 783 | if (console_loglevel >= CONSOLE_LOGLEVEL_DEBUG) |
| 784 | printk(KERN_DEBUG "nubus_get_rom_dir: entry %02x %06x\n", ent.type, ent.data); | 784 | printk(KERN_DEBUG "nubus_get_rom_dir: entry %02x %06x\n", ent.type, ent.data); |
| 785 | 785 | ||
| 786 | /* Bwahahahaha... */ | 786 | /* Bwahahahaha... */ |
| @@ -816,7 +816,7 @@ static struct nubus_board* __init nubus_add_board(int slot, int bytelanes) | |||
| 816 | board->fblock = rp; | 816 | board->fblock = rp; |
| 817 | 817 | ||
| 818 | /* Dump the format block for debugging purposes */ | 818 | /* Dump the format block for debugging purposes */ |
| 819 | if (console_loglevel >= 10) { | 819 | if (console_loglevel >= CONSOLE_LOGLEVEL_DEBUG) { |
| 820 | int i; | 820 | int i; |
| 821 | printk(KERN_DEBUG "Slot %X, format block at 0x%p\n", | 821 | printk(KERN_DEBUG "Slot %X, format block at 0x%p\n", |
| 822 | slot, rp); | 822 | slot, rp); |
diff --git a/drivers/tty/sysrq.c b/drivers/tty/sysrq.c index ce396ecdf412..b767a64e49d9 100644 --- a/drivers/tty/sysrq.c +++ b/drivers/tty/sysrq.c | |||
| @@ -88,7 +88,7 @@ static void sysrq_handle_loglevel(int key) | |||
| 88 | int i; | 88 | int i; |
| 89 | 89 | ||
| 90 | i = key - '0'; | 90 | i = key - '0'; |
| 91 | console_loglevel = 7; | 91 | console_loglevel = CONSOLE_LOGLEVEL_DEFAULT; |
| 92 | printk("Loglevel set to %d\n", i); | 92 | printk("Loglevel set to %d\n", i); |
| 93 | console_loglevel = i; | 93 | console_loglevel = i; |
| 94 | } | 94 | } |
| @@ -343,7 +343,7 @@ static void send_sig_all(int sig) | |||
| 343 | static void sysrq_handle_term(int key) | 343 | static void sysrq_handle_term(int key) |
| 344 | { | 344 | { |
| 345 | send_sig_all(SIGTERM); | 345 | send_sig_all(SIGTERM); |
| 346 | console_loglevel = 8; | 346 | console_loglevel = CONSOLE_LOGLEVEL_DEBUG; |
| 347 | } | 347 | } |
| 348 | static struct sysrq_key_op sysrq_term_op = { | 348 | static struct sysrq_key_op sysrq_term_op = { |
| 349 | .handler = sysrq_handle_term, | 349 | .handler = sysrq_handle_term, |
| @@ -387,7 +387,7 @@ static struct sysrq_key_op sysrq_thaw_op = { | |||
| 387 | static void sysrq_handle_kill(int key) | 387 | static void sysrq_handle_kill(int key) |
| 388 | { | 388 | { |
| 389 | send_sig_all(SIGKILL); | 389 | send_sig_all(SIGKILL); |
| 390 | console_loglevel = 8; | 390 | console_loglevel = CONSOLE_LOGLEVEL_DEBUG; |
| 391 | } | 391 | } |
| 392 | static struct sysrq_key_op sysrq_kill_op = { | 392 | static struct sysrq_key_op sysrq_kill_op = { |
| 393 | .handler = sysrq_handle_kill, | 393 | .handler = sysrq_handle_kill, |
| @@ -520,7 +520,7 @@ void __handle_sysrq(int key, bool check_mask) | |||
| 520 | * routing in the consumers of /proc/kmsg. | 520 | * routing in the consumers of /proc/kmsg. |
| 521 | */ | 521 | */ |
| 522 | orig_log_level = console_loglevel; | 522 | orig_log_level = console_loglevel; |
| 523 | console_loglevel = 7; | 523 | console_loglevel = CONSOLE_LOGLEVEL_DEFAULT; |
| 524 | printk(KERN_INFO "SysRq : "); | 524 | printk(KERN_INFO "SysRq : "); |
| 525 | 525 | ||
| 526 | op_p = __sysrq_get_key_op(key); | 526 | op_p = __sysrq_get_key_op(key); |
