.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* |
---|
2 | 3 | * Copyright (C) 2010 Brian King IBM Corporation |
---|
3 | | - * |
---|
4 | | - * This program is free software; you can redistribute it and/or modify |
---|
5 | | - * it under the terms of the GNU General Public License as published by |
---|
6 | | - * the Free Software Foundation; either version 2 of the License, or |
---|
7 | | - * (at your option) any later version. |
---|
8 | | - * |
---|
9 | | - * This program is distributed in the hope that it will be useful, |
---|
10 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
11 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
12 | | - * GNU General Public License for more details. |
---|
13 | | - * |
---|
14 | | - * You should have received a copy of the GNU General Public License |
---|
15 | | - * along with this program; if not, write to the Free Software |
---|
16 | | - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
---|
17 | 4 | */ |
---|
18 | 5 | |
---|
19 | 6 | #include <linux/cpu.h> |
---|
.. | .. |
---|
142 | 129 | struct device_attribute *attr, |
---|
143 | 130 | const char *buf, size_t count) |
---|
144 | 131 | { |
---|
145 | | - cpumask_var_t offline_mask; |
---|
146 | 132 | int rc; |
---|
147 | 133 | |
---|
148 | 134 | if (!capable(CAP_SYS_ADMIN)) |
---|
149 | 135 | return -EPERM; |
---|
150 | | - |
---|
151 | | - if (!alloc_cpumask_var(&offline_mask, GFP_KERNEL)) |
---|
152 | | - return -ENOMEM; |
---|
153 | 136 | |
---|
154 | 137 | stream_id = simple_strtoul(buf, NULL, 16); |
---|
155 | 138 | |
---|
.. | .. |
---|
159 | 142 | ssleep(1); |
---|
160 | 143 | } while (rc == -EAGAIN); |
---|
161 | 144 | |
---|
162 | | - if (!rc) { |
---|
163 | | - /* All present CPUs must be online */ |
---|
164 | | - cpumask_andnot(offline_mask, cpu_present_mask, |
---|
165 | | - cpu_online_mask); |
---|
166 | | - rc = rtas_online_cpus_mask(offline_mask); |
---|
167 | | - if (rc) { |
---|
168 | | - pr_err("%s: Could not bring present CPUs online.\n", |
---|
169 | | - __func__); |
---|
170 | | - goto out; |
---|
171 | | - } |
---|
172 | | - |
---|
173 | | - stop_topology_update(); |
---|
| 145 | + if (!rc) |
---|
174 | 146 | rc = pm_suspend(PM_SUSPEND_MEM); |
---|
175 | | - start_topology_update(); |
---|
176 | | - |
---|
177 | | - /* Take down CPUs not online prior to suspend */ |
---|
178 | | - if (!rtas_offline_cpus_mask(offline_mask)) |
---|
179 | | - pr_warn("%s: Could not restore CPUs to offline " |
---|
180 | | - "state.\n", __func__); |
---|
181 | | - } |
---|
182 | 147 | |
---|
183 | 148 | stream_id = 0; |
---|
184 | 149 | |
---|
185 | 150 | if (!rc) |
---|
186 | 151 | rc = count; |
---|
187 | | -out: |
---|
188 | | - free_cpumask_var(offline_mask); |
---|
| 152 | + |
---|
189 | 153 | return rc; |
---|
190 | 154 | } |
---|
191 | 155 | |
---|