Unified · Split
| @@ -201,7 +201,7 @@ static unsigned long pin_highz_conf[] = { · 200 unmodified lines | |||
| 201 | }; | 201 | }; |
| 202 | 202 | ||
| 203 | /* Pin control settings */ | 203 | /* Pin control settings */ |
| 204 | static struct pinctrl_map __initdata u300_pinmux_map[] = { | 204 | static const struct pinctrl_map u300_pinmux_map[] = { |
| 205 | /* anonymous maps for chip power and EMIFs */ | 205 | /* anonymous maps for chip power and EMIFs */ |
| 206 | PIN_MAP_MUX_GROUP_HOG_DEFAULT("pinctrl-u300", NULL, "power"), | 206 | PIN_MAP_MUX_GROUP_HOG_DEFAULT("pinctrl-u300", NULL, "power"), |
| 207 | PIN_MAP_MUX_GROUP_HOG_DEFAULT("pinctrl-u300", NULL, "emif0"), | 207 | PIN_MAP_MUX_GROUP_HOG_DEFAULT("pinctrl-u300", NULL, "emif0"), |
| @@ -1376,8 +1376,15 @@ void devm_pinctrl_put(struct pinctrl *p) · 1375 unmodified lines | |||
| 1376 | } | 1376 | } |
| 1377 | EXPORT_SYMBOL_GPL(devm_pinctrl_put); | 1377 | EXPORT_SYMBOL_GPL(devm_pinctrl_put); |
| 1378 | 1378 | ||
| 1379 | int pinctrl_register_map(const struct pinctrl_map *maps, unsigned num_maps, | 1379 | /** |
| 1380 | bool dup) | 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) | ||
| 1381 | { | 1388 | { |
| 1382 | int i, ret; | 1389 | int i, ret; |
| 1383 | struct pinctrl_maps *maps_node; | 1390 | struct pinctrl_maps *maps_node; |
| @@ -1430,17 +1437,8 @@ int pinctrl_register_map(const struct pinctrl_map *maps, unsigned num_maps, · 46 unmodified lines | |||
| 1430 | if (!maps_node) | 1437 | if (!maps_node) |
| 1431 | return -ENOMEM; | 1438 | return -ENOMEM; |
| 1432 | 1439 | ||
| 1440 | maps_node->maps = maps; | ||
| 1433 | maps_node->num_maps = num_maps; | 1441 | 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 | } | ||
| 1444 | 1442 | ||
| 1445 | mutex_lock(&pinctrl_maps_mutex); | 1443 | mutex_lock(&pinctrl_maps_mutex); |
| 1446 | list_add_tail(&maps_node->node, &pinctrl_maps); | 1444 | list_add_tail(&maps_node->node, &pinctrl_maps); |
| @@ -1448,22 +1446,14 @@ int pinctrl_register_map(const struct pinctrl_map *maps, unsigned num_maps, · 1 unmodified line | |||
| 1448 | 1446 | ||
| 1449 | return 0; | 1447 | return 0; |
| 1450 | } | 1448 | } |
| 1449 | EXPORT_SYMBOL_GPL(pinctrl_register_mappings); | ||
| 1451 | 1450 | ||
| 1452 | /** | 1451 | /** |
| 1453 | * pinctrl_register_mappings() - register a set of pin controller mappings | 1452 | * pinctrl_unregister_mappings() - unregister a set of pin controller mappings |
| 1454 | * @maps: the pincontrol mappings table to register. This should probably be | 1453 | * @maps: the pincontrol mappings table passed to pinctrl_register_mappings() |
| 1455 | * marked with __initdata so it can be discarded after boot. This | 1454 | * when registering the mappings. |
| 1456 | * function will perform a shallow copy for the mapping entries. | ||
| 1457 | * @num_maps: the number of maps in the mapping table | ||
| 1458 | */ | 1455 | */ |
| 1459 | int pinctrl_register_mappings(const struct pinctrl_map *maps, | 1456 | void pinctrl_unregister_mappings(const struct pinctrl_map *map) |
| 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) | ||
| 1467 | { | 1457 | { |
| 1468 | struct pinctrl_maps *maps_node; | 1458 | struct pinctrl_maps *maps_node; |
| 1469 | 1459 | ||
| @@ -1478,6 +1468,7 @@ void pinctrl_unregister_map(const struct pinctrl_map *map) · 8 unmodified lines | |||
| 1478 | } | 1468 | } |
| 1479 | mutex_unlock(&pinctrl_maps_mutex); | 1469 | mutex_unlock(&pinctrl_maps_mutex); |
| 1480 | } | 1470 | } |
| 1471 | EXPORT_SYMBOL_GPL(pinctrl_unregister_mappings); | ||
| 1481 | 1472 | ||
| 1482 | /** | 1473 | /** |
| 1483 | * pinctrl_force_sleep() - turn a given controller device into sleep state | 1474 | * pinctrl_force_sleep() - turn a given controller device into sleep state |
| @@ -236,10 +236,6 @@ extern struct pinctrl_gpio_range * · 235 unmodified lines | |||
| 236 | pinctrl_find_gpio_range_from_pin_nolock(struct pinctrl_dev *pctldev, | 236 | pinctrl_find_gpio_range_from_pin_nolock(struct pinctrl_dev *pctldev, |
| 237 | unsigned int pin); | 237 | unsigned int pin); |
| 238 | 238 | ||
| 239 | int pinctrl_register_map(const struct pinctrl_map *maps, unsigned num_maps, | ||
| 240 | bool dup); | ||
| 241 | void pinctrl_unregister_map(const struct pinctrl_map *map); | ||
| 242 | |||
| 243 | extern int pinctrl_force_sleep(struct pinctrl_dev *pctldev); | 239 | extern int pinctrl_force_sleep(struct pinctrl_dev *pctldev); |
| 244 | extern int pinctrl_force_default(struct pinctrl_dev *pctldev); | 240 | extern int pinctrl_force_default(struct pinctrl_dev *pctldev); |
| 245 | 241 | ||
| @@ -51,7 +51,7 @@ void pinctrl_dt_free_maps(struct pinctrl *p) · 50 unmodified lines | |||
| 51 | struct pinctrl_dt_map *dt_map, *n1; | 51 | struct pinctrl_dt_map *dt_map, *n1; |
| 52 | 52 | ||
| 53 | list_for_each_entry_safe(dt_map, n1, &p->dt_maps, node) { | 53 | list_for_each_entry_safe(dt_map, n1, &p->dt_maps, node) { |
| 54 | pinctrl_unregister_map(dt_map->map); | 54 | pinctrl_unregister_mappings(dt_map->map); |
| 55 | list_del(&dt_map->node); | 55 | list_del(&dt_map->node); |
| 56 | dt_free_map(dt_map->pctldev, dt_map->map, | 56 | dt_free_map(dt_map->pctldev, dt_map->map, |
| 57 | dt_map->num_maps); | 57 | dt_map->num_maps); |
| @@ -92,7 +92,7 @@ static int dt_remember_or_free_map(struct pinctrl *p, const char *statename, · 34 unmodified lines | |||
| 92 | dt_map->num_maps = num_maps; | 92 | dt_map->num_maps = num_maps; |
| 93 | list_add_tail(&dt_map->node, &p->dt_maps); | 93 | list_add_tail(&dt_map->node, &p->dt_maps); |
| 94 | 94 | ||
| 95 | return pinctrl_register_map(map, num_maps, false); | 95 | return pinctrl_register_mappings(map, num_maps); |
| 96 | 96 | ||
| 97 | err_free_map: | 97 | err_free_map: |
| 98 | dt_free_map(pctldev, map, num_maps); | 98 | dt_free_map(pctldev, map, num_maps); |
| @@ -153,6 +153,7 @@ struct pinctrl_map { · 152 unmodified lines | |||
| 153 | 153 | ||
| 154 | extern int pinctrl_register_mappings(const struct pinctrl_map *map, | 154 | extern int pinctrl_register_mappings(const struct pinctrl_map *map, |
| 155 | unsigned num_maps); | 155 | unsigned num_maps); |
| 156 | extern void pinctrl_unregister_mappings(const struct pinctrl_map *map); | ||
| 156 | extern void pinctrl_provide_dummies(void); | 157 | extern void pinctrl_provide_dummies(void); |
| 157 | #else | 158 | #else |
| 158 | 159 | ||
| @@ -162,6 +163,10 @@ static inline int pinctrl_register_mappings(const struct pinctrl_map *map, · 3 unmodified lines | |||
| 162 | return 0; | 163 | return 0; |
| 163 | } | 164 | } |
| 164 | 165 | ||
| 166 | static inline void pinctrl_unregister_mappings(const struct pinctrl_map *map) | ||
| 167 | { | ||
| 168 | } | ||
| 169 | |||
| 165 | static inline void pinctrl_provide_dummies(void) | 170 | static inline void pinctrl_provide_dummies(void) |
| 166 | { | 171 | { |
| 167 | } | 172 | } |