aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/scripts/python
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2014-07-15 16:03:14 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2014-07-15 19:45:21 -0400
commit86f5f3ca49e3d20c1a5e83917b2c8b98a7c95506 (patch)
tree39cdc562463e0fb96707c5472619bcdade76d568 /tools/perf/scripts/python
parent1795cd9b3a91d4b5473c97f491d63892442212ab (diff)
ACPI / hotplug / PCI: Eliminate acpiphp_dev_to_bridge()
Since acpiphp_dev_to_bridge() is only called by acpiphp_check_host_bridge(), move the code from it to that function directly which reduces the call chain depth and makes the code slightly easier to follow. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Acked-by: Bjorn Helgaas <bhelgaas@google.com>
Diffstat (limited to 'tools/perf/scripts/python')
0 files changed, 0 insertions, 0 deletions
+ find_zero(data) + 1 - align; } res += sizeof(unsigned long); if (unlikely(max < sizeof(unsigned long))) break; max -= sizeof(unsigned long); if (unlikely(__get_user(c,(unsigned long __user *)(src+res)))) return 0; } res -= align; /* * Uhhuh. We hit 'max'. But was that the user-specified maximum * too? If so, return the marker for "too long". */ if (res >= count) return count+1; /* * Nope: we hit the address space limit, and we still had more * characters the caller would have wanted. That's 0. */ return 0; } /** * strnlen_user: - Get the size of a user string INCLUDING final NUL. * @str: The string to measure. * @count: Maximum count (including NUL character) * * Context: User context only. This function may sleep. * * Get the size of a NUL-terminated string in user space. * * Returns the size of the string INCLUDING the terminating NUL. * If the string is too long, returns 'count+1'. * On exception (or invalid count), returns 0. */ long strnlen_user(const char __user *str, long count) { unsigned long max_addr, src_addr; if (unlikely(count <= 0)) return 0; max_addr = user_addr_max(); src_addr = (unsigned long)str; if (likely(src_addr < max_addr)) { unsigned long max = max_addr - src_addr; return do_strnlen_user(str, count, max); } return 0; } EXPORT_SYMBOL(strnlen_user); /** * strlen_user: - Get the size of a user string INCLUDING final NUL. * @str: The string to measure. * * Context: User context only. This function may sleep. * * Get the size of a NUL-terminated string in user space. * * Returns the size of the string INCLUDING the terminating NUL. * On exception, returns 0. * * If there is a limit on the length of a valid string, you may wish to * consider using strnlen_user() instead. */ long strlen_user(const char __user *str) { unsigned long max_addr, src_addr; max_addr = user_addr_max(); src_addr = (unsigned long)str; if (likely(src_addr < max_addr)) { unsigned long max = max_addr - src_addr; return do_strnlen_user(str, ~0ul, max); } return 0; } EXPORT_SYMBOL(strlen_user);