aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenoit Cousson <b-cousson@ti.com>2010-12-21 23:31:28 -0500
committerPaul Walmsley <paul@pwsan.com>2010-12-21 23:31:28 -0500
commitce35b2446945c506cb02960eab2072f56efdf1c0 (patch)
tree28d42c3dd74b0f1e0a5b32f4f9129358311f30e1
parent01592df95049a6f3d4abb0571ae1c7cb6e9d1cd7 (diff)
OMAP2+: hwmod: Remove omap_hwmod_mutex
The hwmod list will be built are init time and never be modified at runtime. There is no need anymore to protect the list from concurrent accesses using a mutex. Signed-off-by: Benoit Cousson <b-cousson@ti.com> Signed-off-by: Paul Walmsley <paul@pwsan.com> Cc: Kevin Hilman <khilman@deeprootsystems.com>
-rw-r--r--arch/arm/mach-omap2/omap_hwmod.c26
1 files changed, 4 insertions, 22 deletions
diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
index 1a0dd5647cf6..91b011e3a7cb 100644
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -159,8 +159,6 @@
159/* omap_hwmod_list contains all registered struct omap_hwmods */ 159/* omap_hwmod_list contains all registered struct omap_hwmods */
160static LIST_HEAD(omap_hwmod_list); 160static LIST_HEAD(omap_hwmod_list);
161 161
162static DEFINE_MUTEX(omap_hwmod_mutex);
163
164/* mpu_oh: used to add/remove MPU initiator from sleepdep list */ 162/* mpu_oh: used to add/remove MPU initiator from sleepdep list */
165static struct omap_hwmod *mpu_oh; 163static struct omap_hwmod *mpu_oh;
166 164
@@ -872,7 +870,6 @@ static void _shutdown_sysc(struct omap_hwmod *oh)
872 * @name: find an omap_hwmod by name 870 * @name: find an omap_hwmod by name
873 * 871 *
874 * Return a pointer to an omap_hwmod by name, or NULL if not found. 872 * Return a pointer to an omap_hwmod by name, or NULL if not found.
875 * Caller must hold omap_hwmod_mutex.
876 */ 873 */
877static struct omap_hwmod *_lookup(const char *name) 874static struct omap_hwmod *_lookup(const char *name)
878{ 875{
@@ -1443,14 +1440,10 @@ static int __init _register(struct omap_hwmod *oh)
1443 (oh->_state != _HWMOD_STATE_UNKNOWN)) 1440 (oh->_state != _HWMOD_STATE_UNKNOWN))
1444 return -EINVAL; 1441 return -EINVAL;
1445 1442
1446 mutex_lock(&omap_hwmod_mutex);
1447
1448 pr_debug("omap_hwmod: %s: registering\n", oh->name); 1443 pr_debug("omap_hwmod: %s: registering\n", oh->name);
1449 1444
1450 if (_lookup(oh->name)) { 1445 if (_lookup(oh->name))
1451 ret = -EEXIST; 1446 return -EEXIST;
1452 goto ohr_unlock;
1453 }
1454 1447
1455 ms_id = _find_mpu_port_index(oh); 1448 ms_id = _find_mpu_port_index(oh);
1456 if (!IS_ERR_VALUE(ms_id)) { 1449 if (!IS_ERR_VALUE(ms_id)) {
@@ -1468,8 +1461,6 @@ static int __init _register(struct omap_hwmod *oh)
1468 1461
1469 ret = 0; 1462 ret = 0;
1470 1463
1471ohr_unlock:
1472 mutex_unlock(&omap_hwmod_mutex);
1473 return ret; 1464 return ret;
1474} 1465}
1475 1466
@@ -1538,9 +1529,7 @@ struct omap_hwmod *omap_hwmod_lookup(const char *name)
1538 if (!name) 1529 if (!name)
1539 return NULL; 1530 return NULL;
1540 1531
1541 mutex_lock(&omap_hwmod_mutex);
1542 oh = _lookup(name); 1532 oh = _lookup(name);
1543 mutex_unlock(&omap_hwmod_mutex);
1544 1533
1545 return oh; 1534 return oh;
1546} 1535}
@@ -1566,13 +1555,11 @@ int omap_hwmod_for_each(int (*fn)(struct omap_hwmod *oh, void *data),
1566 if (!fn) 1555 if (!fn)
1567 return -EINVAL; 1556 return -EINVAL;
1568 1557
1569 mutex_lock(&omap_hwmod_mutex);
1570 list_for_each_entry(temp_oh, &omap_hwmod_list, node) { 1558 list_for_each_entry(temp_oh, &omap_hwmod_list, node) {
1571 ret = (*fn)(temp_oh, data); 1559 ret = (*fn)(temp_oh, data);
1572 if (ret) 1560 if (ret)
1573 break; 1561 break;
1574 } 1562 }
1575 mutex_unlock(&omap_hwmod_mutex);
1576 1563
1577 return ret; 1564 return ret;
1578} 1565}
@@ -2112,9 +2099,8 @@ int omap_hwmod_read_hardreset(struct omap_hwmod *oh, const char *name)
2112 * @fn: callback function pointer to call for each hwmod in class @classname 2099 * @fn: callback function pointer to call for each hwmod in class @classname
2113 * @user: arbitrary context data to pass to the callback function 2100 * @user: arbitrary context data to pass to the callback function
2114 * 2101 *
2115 * For each omap_hwmod of class @classname, call @fn. Takes 2102 * For each omap_hwmod of class @classname, call @fn.
2116 * omap_hwmod_mutex to prevent the hwmod list from changing during the 2103 * If the callback function returns something other than
2117 * iteration. If the callback function returns something other than
2118 * zero, the iterator is terminated, and the callback function's return 2104 * zero, the iterator is terminated, and the callback function's return
2119 * value is passed back to the caller. Returns 0 upon success, -EINVAL 2105 * value is passed back to the caller. Returns 0 upon success, -EINVAL
2120 * if @classname or @fn are NULL, or passes back the error code from @fn. 2106 * if @classname or @fn are NULL, or passes back the error code from @fn.
@@ -2133,8 +2119,6 @@ int omap_hwmod_for_each_by_class(const char *classname,
2133 pr_debug("omap_hwmod: %s: looking for modules of class %s\n", 2119 pr_debug("omap_hwmod: %s: looking for modules of class %s\n",
2134 __func__, classname); 2120 __func__, classname);
2135 2121
2136 mutex_lock(&omap_hwmod_mutex);
2137
2138 list_for_each_entry(temp_oh, &omap_hwmod_list, node) { 2122 list_for_each_entry(temp_oh, &omap_hwmod_list, node) {
2139 if (!strcmp(temp_oh->class->name, classname)) { 2123 if (!strcmp(temp_oh->class->name, classname)) {
2140 pr_debug("omap_hwmod: %s: %s: calling callback fn\n", 2124 pr_debug("omap_hwmod: %s: %s: calling callback fn\n",
@@ -2145,8 +2129,6 @@ int omap_hwmod_for_each_by_class(const char *classname,
2145 } 2129 }
2146 } 2130 }
2147 2131
2148 mutex_unlock(&omap_hwmod_mutex);
2149
2150 if (ret) 2132 if (ret)
2151 pr_debug("omap_hwmod: %s: iterator terminated early: %d\n", 2133 pr_debug("omap_hwmod: %s: iterator terminated early: %d\n",
2152 __func__, ret); 2134 __func__, ret);