#include #include #include #include "cpp.h" #include "str.h" #include "proc.h" #include "xmalloc.h" static size_t argv_len(char *const argv[]) { size_t len = 0; for (; argv && *argv; argv++) len++; return len; } int cpp_exec(char *in_file, char *out_file, size_t out_len, char *const argv[]) { size_t argc = 7 + argv_len(argv); char *tmp = xstrdup(in_file); char **cpp_argv; int fd, ret = -1; char *base; unsigned int i = 0; base = basename(tmp); slprintf(out_file, out_len, "/tmp/.tmp-XXXXXX-%s", base); fd = mkstemps(out_file, strlen(base) + 1); if (fd < 0) goto err; cpp_argv = xmalloc(argc * sizeof(char *)); cpp_argv[i++] = "cpp"; for (; argv && *argv; argv++, i++) cpp_argv[i] = *argv; cpp_argv[i++] = "-I"; cpp_argv[i++] = ETCDIRE_STRING; cpp_argv[i++] = "-o"; cpp_argv[i++] = out_file; cpp_argv[i++] = in_file; cpp_argv[i++] = NULL; ret = proc_exec("cpp", cpp_argv); close(fd); xfree(cpp_argv); err: xfree(tmp); return ret; } nge='this.form.submit();'> net-next plumbingsTobias Klauser
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoger Quadros <rogerq@ti.com>2016-09-29 08:32:55 +0100
committerRussell King <rmk+kernel@armlinux.org.uk>2016-09-29 16:57:44 +0100
commitd248220f0465b818887baa9829e691fe662b2c5e (patch)
treea7eba33d46ee26de6a5d6738b0ba4c870d0f3f04
parentba6dea4f7cedb4b1c17e36f4087675d817c2e24b (diff)
ARM: 8617/1: dma: fix dma_max_pfn()
Since commit 6ce0d2001692 ("ARM: dma: Use dma_pfn_offset for dma address translation"), dma_to_pfn() already returns the PFN with the physical memory start offset so we don't need to add it again. This fixes USB mass storage lock-up problem on systems that can't do DMA over the entire physical memory range (e.g.) Keystone 2 systems with 4GB RAM can only do DMA over the first 2GB. [K2E-EVM]. What happens there is that without this patch SCSI layer sets a wrong bounce buffer limit in scsi_calculate_bounce_limit() for the USB mass storage device. dma_max_pfn() evaluates to 0x8fffff and bounce_limit is set to 0x8fffff000 whereas maximum DMA'ble physical memory on Keystone 2 is 0x87fffffff. This results in non DMA'ble pages being given to the USB controller and hence the lock-up. NOTE: in the above case, USB-SCSI-device's dma_pfn_offset was showing as 0. This should have really been 0x780000 as on K2e, LOWMEM_START is 0x80000000 and HIGHMEM_START is 0x800000000. DMA zone is 2GB so dma_max_pfn should be 0x87ffff. The incorrect dma_pfn_offset for the USB storage device is because USB devices are not correctly inheriting the dma_pfn_offset from the USB host controller. This will be fixed by a separate patch. Fixes: 6ce0d2001692 ("ARM: dma: Use dma_pfn_offset for dma address translation") Cc: stable@vger.kernel.org Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Santosh Shilimkar <santosh.shilimkar@oracle.com> Cc: Arnd Bergmann <arnd@arndb.de> Cc: Olof Johansson <olof@lixom.net> Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: Linus Walleij <linus.walleij@linaro.org> Reported-by: Grygorii Strashko <grygorii.strashko@ti.com> Signed-off-by: Roger Quadros <rogerq@ti.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>