From: Linus Torvalds Date: Wed, 27 Nov 2019 03:45:12 +0000 (-0800) Subject: Merge tag 'devprop-5.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael... X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=361b0d286afea0d867537536977a695b5557d133;p=linux.git Merge tag 'devprop-5.5-rc1' of git://git./linux/kernel/git/rafael/linux-pm Pull device properties framework updates from Rafael Wysocki: "Add support for printing fwnode names using a new conversion specifier "%pfw" (Sakari Ailus), clean up the software node and efi/apple-properties code in preparation for improved software node reference properties handling (Dmitry Torokhov) and fix the struct fwnode_operations description (Heikki Krogerus)" * tag 'devprop-5.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (22 commits) software node: simplify property_entry_read_string_array() software node: unify PROPERTY_ENTRY_XXX macros software node: remove property_entry_read_uNN_array functions software node: get rid of property_set_pointer() software node: clean up property_copy_string_array() software node: mark internal macros with double underscores efi/apple-properties: use PROPERTY_ENTRY_U8_ARRAY_LEN software node: introduce PROPERTY_ENTRY_XXX_ARRAY_LEN() software node: remove DEV_PROP_MAX device property: Fix the description of struct fwnode_operations lib/test_printf: Add tests for %pfw printk modifier lib/vsprintf: Add %pfw conversion specifier for printing fwnode names lib/vsprintf: OF nodes are first and foremost, struct device_nodes lib/vsprintf: Make use of fwnode API to obtain node names and separators lib/vsprintf: Add a note on re-using %pf or %pF lib/vsprintf: Remove support for %pF and %pf in favour of %pS and %ps device property: Add a function to obtain a node's prefix device property: Add fwnode_get_name for returning the name of a node device property: Add functions for accessing node's parents device property: Move fwnode_get_parent() up ... --- 361b0d286afea0d867537536977a695b5557d133 diff --cc lib/test_printf.c index 030daeb4fe211,422b847db4242..2d9f520d2f275 --- a/lib/test_printf.c +++ b/lib/test_printf.c @@@ -593,26 -595,35 +595,55 @@@ flags(void kfree(cmp_buffer); } + static void __init fwnode_pointer(void) + { + const struct software_node softnodes[] = { + { .name = "first", }, + { .name = "second", .parent = &softnodes[0], }, + { .name = "third", .parent = &softnodes[1], }, + { NULL /* Guardian */ } + }; + const char * const full_name = "first/second/third"; + const char * const full_name_second = "first/second"; + const char * const second_name = "second"; + const char * const third_name = "third"; + int rval; + + rval = software_node_register_nodes(softnodes); + if (rval) { + pr_warn("cannot register softnodes; rval %d\n", rval); + return; + } + + test(full_name_second, "%pfw", software_node_fwnode(&softnodes[1])); + test(full_name, "%pfw", software_node_fwnode(&softnodes[2])); + test(full_name, "%pfwf", software_node_fwnode(&softnodes[2])); + test(second_name, "%pfwP", software_node_fwnode(&softnodes[1])); + test(third_name, "%pfwP", software_node_fwnode(&softnodes[2])); + + software_node_unregister_nodes(softnodes); + } + +static void __init +errptr(void) +{ + test("-1234", "%pe", ERR_PTR(-1234)); + + /* Check that %pe with a non-ERR_PTR gets treated as ordinary %p. */ + BUILD_BUG_ON(IS_ERR(PTR)); + test_hashed("%pe", PTR); + +#ifdef CONFIG_SYMBOLIC_ERRNAME + test("(-ENOTSOCK)", "(%pe)", ERR_PTR(-ENOTSOCK)); + test("(-EAGAIN)", "(%pe)", ERR_PTR(-EAGAIN)); + BUILD_BUG_ON(EAGAIN != EWOULDBLOCK); + test("(-EAGAIN)", "(%pe)", ERR_PTR(-EWOULDBLOCK)); + test("[-EIO ]", "[%-8pe]", ERR_PTR(-EIO)); + test("[ -EIO]", "[%8pe]", ERR_PTR(-EIO)); + test("-EPROBE_DEFER", "%pe", ERR_PTR(-EPROBE_DEFER)); +#endif +} + static void __init test_pointer(void) { @@@ -635,7 -646,7 +666,8 @@@ bitmap(); netdev_features(); flags(); + errptr(); + fwnode_pointer(); } static void __init selftest(void) diff --cc lib/vsprintf.c index b54d252b398e0,65dd5804a93bc..dee8fc467fcfd --- a/lib/vsprintf.c +++ b/lib/vsprintf.c @@@ -2204,14 -2203,11 +2223,16 @@@ char *pointer(const char *fmt, char *bu case 'G': return flags_string(buf, end, ptr, spec, fmt); case 'O': - return kobject_string(buf, end, ptr, spec, fmt); + return device_node_string(buf, end, ptr, spec, fmt + 1); + case 'f': + return fwnode_string(buf, end, ptr, spec, fmt + 1); case 'x': return pointer_string(buf, end, ptr, spec); + case 'e': + /* %pe with a non-ERR_PTR gets treated as plain %p */ + if (!IS_ERR(ptr)) + break; + return err_ptr(buf, end, ptr, spec); } /* default is to _not_ leak addresses, hash before printing */ @@@ -2844,11 -2840,8 +2865,9 @@@ int vbin_printf(u32 *bin_buf, size_t si /* Dereference of functions is still OK */ case 'S': case 's': - case 'F': - case 'f': case 'x': case 'K': + case 'e': save_arg(void *); break; default: diff --cc scripts/checkpatch.pl index 4b40445938dc1,3d1f08fa091cd..64890be3c8fd3 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@@ -6019,10 -6020,13 +6020,13 @@@ sub process my $fmt = get_quoted_string($lines[$count - 1], raw_line($count, 0)); $fmt =~ s/%%//g; - while ($fmt =~ /(\%[\*\d\.]*p(\w))/g) { + while ($fmt =~ /(\%[\*\d\.]*p(\w)(\w*))/g) { $specifier = $1; $extension = $2; - if ($extension !~ /[SsBKRraEehMmIiUDdgVCbGNOxt]/) { + $qualifier = $3; - if ($extension !~ /[SsBKRraEhMmIiUDdgVCbGNOxtf]/ || ++ if ($extension !~ /[SsBKRraEehMmIiUDdgVCbGNOxtf]/ || + ($extension eq "f" && + defined $qualifier && $qualifier !~ /^w/)) { $bad_specifier = $specifier; last; }