@@ -1376,8 +1376,15 @@ void devm_pinctrl_put(struct pinctrl *p)
13761376}
13771377EXPORT_SYMBOL_GPL (devm_pinctrl_put );
13781378
1379- int pinctrl_register_map (const struct pinctrl_map * maps , unsigned num_maps ,
1380- bool dup )
1379+ /**
1380+ * pinctrl_register_mappings() - register a set of pin controller mappings
1381+ * @maps: the pincontrol mappings table to register. Note the pinctrl-core
1382+ * keeps a reference to the passed in maps, so they should _not_ be
1383+ * marked with __initdata.
1384+ * @num_maps: the number of maps in the mapping table
1385+ */
1386+ int pinctrl_register_mappings (const struct pinctrl_map * maps ,
1387+ unsigned num_maps )
13811388{
13821389 int i , ret ;
13831390 struct pinctrl_maps * maps_node ;
@@ -1430,40 +1437,23 @@ int pinctrl_register_map(const struct pinctrl_map *maps, unsigned num_maps,
14301437 if (!maps_node )
14311438 return - ENOMEM ;
14321439
1440+ maps_node -> maps = maps ;
14331441 maps_node -> num_maps = num_maps ;
1434- if (dup ) {
1435- maps_node -> maps = kmemdup (maps , sizeof (* maps ) * num_maps ,
1436- GFP_KERNEL );
1437- if (!maps_node -> maps ) {
1438- kfree (maps_node );
1439- return - ENOMEM ;
1440- }
1441- } else {
1442- maps_node -> maps = maps ;
1443- }
14441442
14451443 mutex_lock (& pinctrl_maps_mutex );
14461444 list_add_tail (& maps_node -> node , & pinctrl_maps );
14471445 mutex_unlock (& pinctrl_maps_mutex );
14481446
14491447 return 0 ;
14501448}
1449+ EXPORT_SYMBOL_GPL (pinctrl_register_mappings );
14511450
14521451/**
1453- * pinctrl_register_mappings() - register a set of pin controller mappings
1454- * @maps: the pincontrol mappings table to register. This should probably be
1455- * marked with __initdata so it can be discarded after boot. This
1456- * function will perform a shallow copy for the mapping entries.
1457- * @num_maps: the number of maps in the mapping table
1452+ * pinctrl_unregister_mappings() - unregister a set of pin controller mappings
1453+ * @maps: the pincontrol mappings table passed to pinctrl_register_mappings()
1454+ * when registering the mappings.
14581455 */
1459- int pinctrl_register_mappings (const struct pinctrl_map * maps ,
1460- unsigned num_maps )
1461- {
1462- return pinctrl_register_map (maps , num_maps , true);
1463- }
1464- EXPORT_SYMBOL_GPL (pinctrl_register_mappings );
1465-
1466- void pinctrl_unregister_map (const struct pinctrl_map * map )
1456+ void pinctrl_unregister_mappings (const struct pinctrl_map * map )
14671457{
14681458 struct pinctrl_maps * maps_node ;
14691459
@@ -1478,6 +1468,7 @@ void pinctrl_unregister_map(const struct pinctrl_map *map)
14781468 }
14791469 mutex_unlock (& pinctrl_maps_mutex );
14801470}
1471+ EXPORT_SYMBOL_GPL (pinctrl_unregister_mappings );
14811472
14821473/**
14831474 * pinctrl_force_sleep() - turn a given controller device into sleep state
0 commit comments