aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging
diff options
context:
space:
mode:
authorDavid Kershner <david.kershner@unisys.com>2016-09-19 17:09:20 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-09-20 07:26:20 -0400
commit3d8394c86f1b482ec2509e5a152484a27cc6cc74 (patch)
treeb8caab9dd346a2631b9bbfa4c9c6e39c3f57233b /drivers/staging
parentc071b6f541b62f4d143cc4316e4b1167dcaea8fe (diff)
staging: unisys: visorbus: reorder controlvm_periodic_work
Move controlvm_periodic_work lower in the file to avoid having to create function prototypes. Reported-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: David Kershner <david.kershner@unisys.com> Reviewed-by: Tim Sell <Timothy.Sell@unisys.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging')
-rw-r--r--drivers/staging/unisys/visorbus/visorchipset.c134
1 files changed, 67 insertions, 67 deletions
diff --git a/drivers/staging/unisys/visorbus/visorchipset.c b/drivers/staging/unisys/visorbus/visorchipset.c
index de2e92fbadb1..7cb7c0073a7e 100644
--- a/drivers/staging/unisys/visorbus/visorchipset.c
+++ b/drivers/staging/unisys/visorbus/visorchipset.c
@@ -1752,73 +1752,6 @@ static u64 controlvm_get_channel_address(void)
1752} 1752}
1753 1753
1754static void 1754static void
1755controlvm_periodic_work(struct work_struct *work)
1756{
1757 struct controlvm_message inmsg;
1758 bool got_command = false;
1759 bool handle_command_failed = false;
1760
1761 while (visorchannel_signalremove(controlvm_channel,
1762 CONTROLVM_QUEUE_RESPONSE,
1763 &inmsg))
1764 ;
1765 if (!got_command) {
1766 if (controlvm_pending_msg_valid) {
1767 /*
1768 * we throttled processing of a prior
1769 * msg, so try to process it again
1770 * rather than reading a new one
1771 */
1772 inmsg = controlvm_pending_msg;
1773 controlvm_pending_msg_valid = false;
1774 got_command = true;
1775 } else {
1776 got_command = read_controlvm_event(&inmsg);
1777 }
1778 }
1779
1780 handle_command_failed = false;
1781 while (got_command && (!handle_command_failed)) {
1782 most_recent_message_jiffies = jiffies;
1783 if (handle_command(inmsg,
1784 visorchannel_get_physaddr
1785 (controlvm_channel)))
1786 got_command = read_controlvm_event(&inmsg);
1787 else {
1788 /*
1789 * this is a scenario where throttling
1790 * is required, but probably NOT an
1791 * error...; we stash the current
1792 * controlvm msg so we will attempt to
1793 * reprocess it on our next loop
1794 */
1795 handle_command_failed = true;
1796 controlvm_pending_msg = inmsg;
1797 controlvm_pending_msg_valid = true;
1798 }
1799 }
1800
1801 /* parahotplug_worker */
1802 parahotplug_process_list();
1803
1804 if (time_after(jiffies,
1805 most_recent_message_jiffies + (HZ * MIN_IDLE_SECONDS))) {
1806 /*
1807 * it's been longer than MIN_IDLE_SECONDS since we
1808 * processed our last controlvm message; slow down the
1809 * polling
1810 */
1811 if (poll_jiffies != POLLJIFFIES_CONTROLVMCHANNEL_SLOW)
1812 poll_jiffies = POLLJIFFIES_CONTROLVMCHANNEL_SLOW;
1813 } else {
1814 if (poll_jiffies != POLLJIFFIES_CONTROLVMCHANNEL_FAST)
1815 poll_jiffies = POLLJIFFIES_CONTROLVMCHANNEL_FAST;
1816 }
1817
1818 schedule_delayed_work(&periodic_controlvm_work, poll_jiffies);
1819}
1820
1821static void
1822setup_crash_devices_work_queue(struct work_struct *work) 1755setup_crash_devices_work_queue(struct work_struct *work)
1823{ 1756{
1824 struct controlvm_message local_crash_bus_msg; 1757 struct controlvm_message local_crash_bus_msg;
@@ -2158,6 +2091,73 @@ visorchipset_file_cleanup(dev_t major_dev)
2158 unregister_chrdev_region(major_dev, 1); 2091 unregister_chrdev_region(major_dev, 1);
2159} 2092}
2160 2093
2094static void
2095controlvm_periodic_work(struct work_struct *work)
2096{
2097 struct controlvm_message inmsg;
2098 bool got_command = false;
2099 bool handle_command_failed = false;
2100
2101 while (visorchannel_signalremove(controlvm_channel,
2102 CONTROLVM_QUEUE_RESPONSE,
2103 &inmsg))
2104 ;
2105 if (!got_command) {
2106 if (controlvm_pending_msg_valid) {
2107 /*
2108 * we throttled processing of a prior
2109 * msg, so try to process it again
2110 * rather than reading a new one
2111 */
2112 inmsg = controlvm_pending_msg;
2113 controlvm_pending_msg_valid = false;
2114 got_command = true;
2115 } else {
2116 got_command = read_controlvm_event(&inmsg);
2117 }
2118 }
2119
2120 handle_command_failed = false;
2121 while (got_command && (!handle_command_failed)) {
2122 most_recent_message_jiffies = jiffies;
2123 if (handle_command(inmsg,
2124 visorchannel_get_physaddr
2125 (controlvm_channel)))
2126 got_command = read_controlvm_event(&inmsg);
2127 else {
2128 /*
2129 * this is a scenario where throttling
2130 * is required, but probably NOT an
2131 * error...; we stash the current
2132 * controlvm msg so we will attempt to
2133 * reprocess it on our next loop
2134 */
2135 handle_command_failed = true;
2136 controlvm_pending_msg = inmsg;
2137 controlvm_pending_msg_valid = true;
2138 }
2139 }
2140
2141 /* parahotplug_worker */
2142 parahotplug_process_list();
2143
2144 if (time_after(jiffies,
2145 most_recent_message_jiffies + (HZ * MIN_IDLE_SECONDS))) {
2146 /*
2147 * it's been longer than MIN_IDLE_SECONDS since we
2148 * processed our last controlvm message; slow down the
2149 * polling
2150 */
2151 if (poll_jiffies != POLLJIFFIES_CONTROLVMCHANNEL_SLOW)
2152 poll_jiffies = POLLJIFFIES_CONTROLVMCHANNEL_SLOW;
2153 } else {
2154 if (poll_jiffies != POLLJIFFIES_CONTROLVMCHANNEL_FAST)
2155 poll_jiffies = POLLJIFFIES_CONTROLVMCHANNEL_FAST;
2156 }
2157
2158 schedule_delayed_work(&periodic_controlvm_work, poll_jiffies);
2159}
2160
2161static int 2161static int
2162visorchipset_init(struct acpi_device *acpi_device) 2162visorchipset_init(struct acpi_device *acpi_device)
2163{ 2163{