.. | .. |
---|
797 | 797 | |
---|
798 | 798 | if (status == SDW_SLAVE_UNATTACHED) { |
---|
799 | 799 | dev_dbg(&slave->dev, |
---|
800 | | - "%s: initializing completion for Slave %d\n", |
---|
| 800 | + "%s: initializing enumeration and init completion for Slave %d\n", |
---|
801 | 801 | __func__, slave->dev_num); |
---|
802 | 802 | |
---|
803 | | - init_completion(&slave->enumeration_complete); |
---|
804 | | - init_completion(&slave->initialization_complete); |
---|
| 803 | + reinit_completion(&slave->enumeration_complete); |
---|
| 804 | + reinit_completion(&slave->initialization_complete); |
---|
805 | 805 | |
---|
806 | 806 | } else if ((status == SDW_SLAVE_ATTACHED) && |
---|
807 | 807 | (slave->status == SDW_SLAVE_UNATTACHED)) { |
---|
808 | 808 | dev_dbg(&slave->dev, |
---|
809 | | - "%s: signaling completion for Slave %d\n", |
---|
| 809 | + "%s: signaling enumeration completion for Slave %d\n", |
---|
810 | 810 | __func__, slave->dev_num); |
---|
811 | 811 | |
---|
812 | | - complete(&slave->enumeration_complete); |
---|
| 812 | + complete_all(&slave->enumeration_complete); |
---|
813 | 813 | } |
---|
814 | 814 | slave->status = status; |
---|
815 | 815 | mutex_unlock(&slave->bus->bus_lock); |
---|
.. | .. |
---|
1734 | 1734 | if (ret) |
---|
1735 | 1735 | dev_err(slave->bus->dev, |
---|
1736 | 1736 | "Update Slave status failed:%d\n", ret); |
---|
1737 | | - if (attached_initializing) |
---|
1738 | | - complete(&slave->initialization_complete); |
---|
| 1737 | + if (attached_initializing) { |
---|
| 1738 | + dev_dbg(&slave->dev, |
---|
| 1739 | + "%s: signaling initialization completion for Slave %d\n", |
---|
| 1740 | + __func__, slave->dev_num); |
---|
| 1741 | + |
---|
| 1742 | + complete_all(&slave->initialization_complete); |
---|
| 1743 | + |
---|
| 1744 | + /* |
---|
| 1745 | + * If the manager became pm_runtime active, the peripherals will be |
---|
| 1746 | + * restarted and attach, but their pm_runtime status may remain |
---|
| 1747 | + * suspended. If the 'update_slave_status' callback initiates |
---|
| 1748 | + * any sort of deferred processing, this processing would not be |
---|
| 1749 | + * cancelled on pm_runtime suspend. |
---|
| 1750 | + * To avoid such zombie states, we queue a request to resume. |
---|
| 1751 | + * This would be a no-op in case the peripheral was being resumed |
---|
| 1752 | + * by e.g. the ALSA/ASoC framework. |
---|
| 1753 | + */ |
---|
| 1754 | + pm_request_resume(&slave->dev); |
---|
| 1755 | + } |
---|
1739 | 1756 | } |
---|
1740 | 1757 | |
---|
1741 | 1758 | return ret; |
---|