core.c (543256d239b4156bf5817049fb92138f6661f15f) core.c (95073b721c03c0438b7ee692c20ad2075d3a937a)
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * Generic OPP Interface
4 *
5 * Copyright (C) 2009-2010 Texas Instruments Incorporated.
6 * Nishanth Menon
7 * Romit Dasgupta
8 * Kevin Hilman

--- 1472 unchanged lines hidden (view full) ---

1481 * dev_pm_opp_remove() - Remove an OPP from OPP table
1482 * @dev: device for which we do this operation
1483 * @freq: OPP to remove with matching 'freq'
1484 *
1485 * This function removes an opp from the opp table.
1486 */
1487void dev_pm_opp_remove(struct device *dev, unsigned long freq)
1488{
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * Generic OPP Interface
4 *
5 * Copyright (C) 2009-2010 Texas Instruments Incorporated.
6 * Nishanth Menon
7 * Romit Dasgupta
8 * Kevin Hilman

--- 1472 unchanged lines hidden (view full) ---

1481 * dev_pm_opp_remove() - Remove an OPP from OPP table
1482 * @dev: device for which we do this operation
1483 * @freq: OPP to remove with matching 'freq'
1484 *
1485 * This function removes an opp from the opp table.
1486 */
1487void dev_pm_opp_remove(struct device *dev, unsigned long freq)
1488{
1489 struct dev_pm_opp *opp;
1489 struct dev_pm_opp *opp = NULL, *iter;
1490 struct opp_table *opp_table;
1490 struct opp_table *opp_table;
1491 bool found = false;
1492
1493 opp_table = _find_opp_table(dev);
1494 if (IS_ERR(opp_table))
1495 return;
1496
1497 mutex_lock(&opp_table->lock);
1498
1491
1492 opp_table = _find_opp_table(dev);
1493 if (IS_ERR(opp_table))
1494 return;
1495
1496 mutex_lock(&opp_table->lock);
1497
1499 list_for_each_entry(opp, &opp_table->opp_list, node) {
1500 if (opp->rate == freq) {
1501 found = true;
1498 list_for_each_entry(iter, &opp_table->opp_list, node) {
1499 if (iter->rate == freq) {
1500 opp = iter;
1502 break;
1503 }
1504 }
1505
1506 mutex_unlock(&opp_table->lock);
1507
1501 break;
1502 }
1503 }
1504
1505 mutex_unlock(&opp_table->lock);
1506
1508 if (found) {
1507 if (opp) {
1509 dev_pm_opp_put(opp);
1510
1511 /* Drop the reference taken by dev_pm_opp_add() */
1512 dev_pm_opp_put_opp_table(opp_table);
1513 } else {
1514 dev_warn(dev, "%s: Couldn't find OPP with freq: %lu\n",
1515 __func__, freq);
1516 }

--- 1438 unchanged lines hidden ---
1508 dev_pm_opp_put(opp);
1509
1510 /* Drop the reference taken by dev_pm_opp_add() */
1511 dev_pm_opp_put_opp_table(opp_table);
1512 } else {
1513 dev_warn(dev, "%s: Couldn't find OPP with freq: %lu\n",
1514 __func__, freq);
1515 }

--- 1438 unchanged lines hidden ---