diff options
| author | Geert Uytterhoeven <geert@linux-m68k.org> | 2013-08-29 11:40:42 -0400 |
|---|---|---|
| committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2013-08-29 11:45:15 -0400 |
| commit | ca0abe3d89fd95b80654e3429d84e4aad567a395 (patch) | |
| tree | 336210a2329c81a9a02a11edfc474785e7ab34ec /drivers/input/touchscreen | |
| parent | 1ea4c16120f529d811de0a35db6b252352268e95 (diff) | |
Input: cyttsp4 - kill 'defined but not used' compiler warnings
If both CONFIG_PM_SLEEP and CONFIG_PM_RUNTIME are unset:
drivers/input/touchscreen/cyttsp4_core.c:1556: warning: ‘cyttsp4_core_sleep’ defined but not used
drivers/input/touchscreen/cyttsp4_core.c:1634: warning: ‘cyttsp4_core_wake’ defined but not used
Move cyttsp4_core_sleep(), cyttsp4_core_wake(), and cyttsp4_core_wake_()
(which is called from cyttsp4_core_wake() only) inside the existing section
protected by #if defined(CONFIG_PM_SLEEP) || defined(CONFIG_PM_RUNTIME)
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'drivers/input/touchscreen')
| -rw-r--r-- | drivers/input/touchscreen/cyttsp4_core.c | 200 |
1 files changed, 100 insertions, 100 deletions
diff --git a/drivers/input/touchscreen/cyttsp4_core.c b/drivers/input/touchscreen/cyttsp4_core.c index 8238d9881bcb..580004049b9e 100644 --- a/drivers/input/touchscreen/cyttsp4_core.c +++ b/drivers/input/touchscreen/cyttsp4_core.c | |||
| @@ -1554,106 +1554,6 @@ exit: | |||
| 1554 | return rc; | 1554 | return rc; |
| 1555 | } | 1555 | } |
| 1556 | 1556 | ||
| 1557 | static int cyttsp4_core_sleep(struct cyttsp4 *cd) | ||
| 1558 | { | ||
| 1559 | int rc; | ||
| 1560 | |||
| 1561 | rc = cyttsp4_request_exclusive(cd, cd->dev, | ||
| 1562 | CY_CORE_SLEEP_REQUEST_EXCLUSIVE_TIMEOUT); | ||
| 1563 | if (rc < 0) { | ||
| 1564 | dev_err(cd->dev, "%s: fail get exclusive ex=%p own=%p\n", | ||
| 1565 | __func__, cd->exclusive_dev, cd->dev); | ||
| 1566 | return 0; | ||
| 1567 | } | ||
| 1568 | |||
| 1569 | rc = cyttsp4_core_sleep_(cd); | ||
| 1570 | |||
| 1571 | if (cyttsp4_release_exclusive(cd, cd->dev) < 0) | ||
| 1572 | dev_err(cd->dev, "%s: fail to release exclusive\n", __func__); | ||
| 1573 | else | ||
| 1574 | dev_vdbg(cd->dev, "%s: pass release exclusive\n", __func__); | ||
| 1575 | |||
| 1576 | return rc; | ||
| 1577 | } | ||
| 1578 | |||
| 1579 | static int cyttsp4_core_wake_(struct cyttsp4 *cd) | ||
| 1580 | { | ||
| 1581 | struct device *dev = cd->dev; | ||
| 1582 | int rc; | ||
| 1583 | u8 mode; | ||
| 1584 | int t; | ||
| 1585 | |||
| 1586 | /* Already woken? */ | ||
| 1587 | mutex_lock(&cd->system_lock); | ||
| 1588 | if (cd->sleep_state == SS_SLEEP_OFF) { | ||
| 1589 | mutex_unlock(&cd->system_lock); | ||
| 1590 | return 0; | ||
| 1591 | } | ||
| 1592 | cd->int_status &= ~CY_INT_IGNORE; | ||
| 1593 | cd->int_status |= CY_INT_AWAKE; | ||
| 1594 | cd->sleep_state = SS_WAKING; | ||
| 1595 | |||
| 1596 | if (cd->cpdata->power) { | ||
| 1597 | dev_dbg(dev, "%s: Power up HW\n", __func__); | ||
| 1598 | rc = cd->cpdata->power(cd->cpdata, 1, dev, &cd->ignore_irq); | ||
| 1599 | } else { | ||
| 1600 | dev_dbg(dev, "%s: No power function\n", __func__); | ||
| 1601 | rc = -ENOSYS; | ||
| 1602 | } | ||
| 1603 | if (rc < 0) { | ||
| 1604 | dev_err(dev, "%s: HW Power up fails r=%d\n", | ||
| 1605 | __func__, rc); | ||
| 1606 | |||
| 1607 | /* Initiate a read transaction to wake up */ | ||
| 1608 | cyttsp4_adap_read(cd, CY_REG_BASE, sizeof(mode), &mode); | ||
| 1609 | } else | ||
| 1610 | dev_vdbg(cd->dev, "%s: HW power up succeeds\n", | ||
| 1611 | __func__); | ||
| 1612 | mutex_unlock(&cd->system_lock); | ||
| 1613 | |||
| 1614 | t = wait_event_timeout(cd->wait_q, | ||
| 1615 | (cd->int_status & CY_INT_AWAKE) == 0, | ||
| 1616 | msecs_to_jiffies(CY_CORE_WAKEUP_TIMEOUT)); | ||
| 1617 | if (IS_TMO(t)) { | ||
| 1618 | dev_err(dev, "%s: TMO waiting for wakeup\n", __func__); | ||
| 1619 | mutex_lock(&cd->system_lock); | ||
| 1620 | cd->int_status &= ~CY_INT_AWAKE; | ||
| 1621 | /* Try starting up */ | ||
| 1622 | cyttsp4_queue_startup_(cd); | ||
| 1623 | mutex_unlock(&cd->system_lock); | ||
| 1624 | } | ||
| 1625 | |||
| 1626 | mutex_lock(&cd->system_lock); | ||
| 1627 | cd->sleep_state = SS_SLEEP_OFF; | ||
| 1628 | mutex_unlock(&cd->system_lock); | ||
| 1629 | |||
| 1630 | cyttsp4_start_wd_timer(cd); | ||
| 1631 | |||
| 1632 | return 0; | ||
| 1633 | } | ||
| 1634 | |||
| 1635 | static int cyttsp4_core_wake(struct cyttsp4 *cd) | ||
| 1636 | { | ||
| 1637 | int rc; | ||
| 1638 | |||
| 1639 | rc = cyttsp4_request_exclusive(cd, cd->dev, | ||
| 1640 | CY_CORE_REQUEST_EXCLUSIVE_TIMEOUT); | ||
| 1641 | if (rc < 0) { | ||
| 1642 | dev_err(cd->dev, "%s: fail get exclusive ex=%p own=%p\n", | ||
| 1643 | __func__, cd->exclusive_dev, cd->dev); | ||
| 1644 | return 0; | ||
| 1645 | } | ||
| 1646 | |||
| 1647 | rc = cyttsp4_core_wake_(cd); | ||
| 1648 | |||
| 1649 | if (cyttsp4_release_exclusive(cd, cd->dev) < 0) | ||
| 1650 | dev_err(cd->dev, "%s: fail to release exclusive\n", __func__); | ||
| 1651 | else | ||
| 1652 | dev_vdbg(cd->dev, "%s: pass release exclusive\n", __func__); | ||
| 1653 | |||
| 1654 | return rc; | ||
| 1655 | } | ||
| 1656 | |||
| 1657 | static int cyttsp4_startup_(struct cyttsp4 *cd) | 1557 | static int cyttsp4_startup_(struct cyttsp4 *cd) |
| 1658 | { | 1558 | { |
| 1659 | int retry = CY_CORE_STARTUP_RETRY_COUNT; | 1559 | int retry = CY_CORE_STARTUP_RETRY_COUNT; |
| @@ -1823,6 +1723,106 @@ static void cyttsp4_free_si_ptrs(struct cyttsp4 *cd) | |||
| 1823 | } | 1723 | } |
| 1824 | 1724 | ||
| 1825 | #if defined(CONFIG_PM_SLEEP) || defined(CONFIG_PM_RUNTIME) | 1725 | #if defined(CONFIG_PM_SLEEP) || defined(CONFIG_PM_RUNTIME) |
| 1726 | static int cyttsp4_core_sleep(struct cyttsp4 *cd) | ||
| 1727 | { | ||
| 1728 | int rc; | ||
| 1729 | |||
| 1730 | rc = cyttsp4_request_exclusive(cd, cd->dev, | ||
| 1731 | CY_CORE_SLEEP_REQUEST_EXCLUSIVE_TIMEOUT); | ||
| 1732 | if (rc < 0) { | ||
| 1733 | dev_err(cd->dev, "%s: fail get exclusive ex=%p own=%p\n", | ||
| 1734 | __func__, cd->exclusive_dev, cd->dev); | ||
| 1735 | return 0; | ||
| 1736 | } | ||
| 1737 | |||
| 1738 | rc = cyttsp4_core_sleep_(cd); | ||
| 1739 | |||
| 1740 | if (cyttsp4_release_exclusive(cd, cd->dev) < 0) | ||
| 1741 | dev_err(cd->dev, "%s: fail to release exclusive\n", __func__); | ||
| 1742 | else | ||
| 1743 | dev_vdbg(cd->dev, "%s: pass release exclusive\n", __func__); | ||
| 1744 | |||
| 1745 | return rc; | ||
| 1746 | } | ||
| 1747 | |||
| 1748 | static int cyttsp4_core_wake_(struct cyttsp4 *cd) | ||
| 1749 | { | ||
| 1750 | struct device *dev = cd->dev; | ||
| 1751 | int rc; | ||
| 1752 | u8 mode; | ||
| 1753 | int t; | ||
| 1754 | |||
| 1755 | /* Already woken? */ | ||
| 1756 | mutex_lock(&cd->system_lock); | ||
| 1757 | if (cd->sleep_state == SS_SLEEP_OFF) { | ||
| 1758 | mutex_unlock(&cd->system_lock); | ||
| 1759 | return 0; | ||
| 1760 | } | ||
| 1761 | cd->int_status &= ~CY_INT_IGNORE; | ||
| 1762 | cd->int_status |= CY_INT_AWAKE; | ||
| 1763 | cd->sleep_state = SS_WAKING; | ||
| 1764 | |||
| 1765 | if (cd->cpdata->power) { | ||
| 1766 | dev_dbg(dev, "%s: Power up HW\n", __func__); | ||
| 1767 | rc = cd->cpdata->power(cd->cpdata, 1, dev, &cd->ignore_irq); | ||
| 1768 | } else { | ||
| 1769 | dev_dbg(dev, "%s: No power function\n", __func__); | ||
| 1770 | rc = -ENOSYS; | ||
| 1771 | } | ||
| 1772 | if (rc < 0) { | ||
| 1773 | dev_err(dev, "%s: HW Power up fails r=%d\n", | ||
| 1774 | __func__, rc); | ||
| 1775 | |||
| 1776 | /* Initiate a read transaction to wake up */ | ||
| 1777 | cyttsp4_adap_read(cd, CY_REG_BASE, sizeof(mode), &mode); | ||
| 1778 | } else | ||
| 1779 | dev_vdbg(cd->dev, "%s: HW power up succeeds\n", | ||
| 1780 | __func__); | ||
| 1781 | mutex_unlock(&cd->system_lock); | ||
| 1782 | |||
| 1783 | t = wait_event_timeout(cd->wait_q, | ||
| 1784 | (cd->int_status & CY_INT_AWAKE) == 0, | ||
| 1785 | msecs_to_jiffies(CY_CORE_WAKEUP_TIMEOUT)); | ||
| 1786 | if (IS_TMO(t)) { | ||
| 1787 | dev_err(dev, "%s: TMO waiting for wakeup\n", __func__); | ||
| 1788 | mutex_lock(&cd->system_lock); | ||
| 1789 | cd->int_status &= ~CY_INT_AWAKE; | ||
| 1790 | /* Try starting up */ | ||
| 1791 | cyttsp4_queue_startup_(cd); | ||
| 1792 | mutex_unlock(&cd->system_lock); | ||
| 1793 | } | ||
| 1794 | |||
| 1795 | mutex_lock(&cd->system_lock); | ||
| 1796 | cd->sleep_state = SS_SLEEP_OFF; | ||
| 1797 | mutex_unlock(&cd->system_lock); | ||
| 1798 | |||
| 1799 | cyttsp4_start_wd_timer(cd); | ||
| 1800 | |||
| 1801 | return 0; | ||
| 1802 | } | ||
| 1803 | |||
| 1804 | static int cyttsp4_core_wake(struct cyttsp4 *cd) | ||
| 1805 | { | ||
| 1806 | int rc; | ||
| 1807 | |||
| 1808 | rc = cyttsp4_request_exclusive(cd, cd->dev, | ||
| 1809 | CY_CORE_REQUEST_EXCLUSIVE_TIMEOUT); | ||
| 1810 | if (rc < 0) { | ||
| 1811 | dev_err(cd->dev, "%s: fail get exclusive ex=%p own=%p\n", | ||
| 1812 | __func__, cd->exclusive_dev, cd->dev); | ||
| 1813 | return 0; | ||
| 1814 | } | ||
| 1815 | |||
| 1816 | rc = cyttsp4_core_wake_(cd); | ||
| 1817 | |||
| 1818 | if (cyttsp4_release_exclusive(cd, cd->dev) < 0) | ||
| 1819 | dev_err(cd->dev, "%s: fail to release exclusive\n", __func__); | ||
| 1820 | else | ||
| 1821 | dev_vdbg(cd->dev, "%s: pass release exclusive\n", __func__); | ||
| 1822 | |||
| 1823 | return rc; | ||
| 1824 | } | ||
| 1825 | |||
| 1826 | static int cyttsp4_core_suspend(struct device *dev) | 1826 | static int cyttsp4_core_suspend(struct device *dev) |
| 1827 | { | 1827 | { |
| 1828 | struct cyttsp4 *cd = dev_get_drvdata(dev); | 1828 | struct cyttsp4 *cd = dev_get_drvdata(dev); |
