aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/firmware
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/firmware')
-rw-r--r--drivers/firmware/dcdbas.c51
1 files changed, 26 insertions, 25 deletions
diff --git a/drivers/firmware/dcdbas.c b/drivers/firmware/dcdbas.c
index 829eec8959f2..2fe1a130189f 100644
--- a/drivers/firmware/dcdbas.c
+++ b/drivers/firmware/dcdbas.c
@@ -23,6 +23,7 @@
23#include <linux/platform_device.h> 23#include <linux/platform_device.h>
24#include <linux/dma-mapping.h> 24#include <linux/dma-mapping.h>
25#include <linux/errno.h> 25#include <linux/errno.h>
26#include <linux/cpu.h>
26#include <linux/gfp.h> 27#include <linux/gfp.h>
27#include <linux/init.h> 28#include <linux/init.h>
28#include <linux/kernel.h> 29#include <linux/kernel.h>
@@ -238,33 +239,14 @@ static ssize_t host_control_on_shutdown_store(struct device *dev,
238 return count; 239 return count;
239} 240}
240 241
241/** 242static int raise_smi(void *par)
242 * dcdbas_smi_request: generate SMI request
243 *
244 * Called with smi_data_lock.
245 */
246int dcdbas_smi_request(struct smi_cmd *smi_cmd)
247{ 243{
248 cpumask_var_t old_mask; 244 struct smi_cmd *smi_cmd = par;
249 int ret = 0;
250
251 if (smi_cmd->magic != SMI_CMD_MAGIC) {
252 dev_info(&dcdbas_pdev->dev, "%s: invalid magic value\n",
253 __func__);
254 return -EBADR;
255 }
256 245
257 /* SMI requires CPU 0 */
258 if (!alloc_cpumask_var(&old_mask, GFP_KERNEL))
259 return -ENOMEM;
260
261 cpumask_copy(old_mask, &current->cpus_allowed);
262 set_cpus_allowed_ptr(current, cpumask_of(0));
263 if (smp_processor_id() != 0) { 246 if (smp_processor_id() != 0) {
264 dev_dbg(&dcdbas_pdev->dev, "%s: failed to get CPU 0\n", 247 dev_dbg(&dcdbas_pdev->dev, "%s: failed to get CPU 0\n",
265 __func__); 248 __func__);
266 ret = -EBUSY; 249 return -EBUSY;
267 goto out;
268 } 250 }
269 251
270 /* generate SMI */ 252 /* generate SMI */
@@ -280,9 +262,28 @@ int dcdbas_smi_request(struct smi_cmd *smi_cmd)
280 : "memory" 262 : "memory"
281 ); 263 );
282 264
283out: 265 return 0;
284 set_cpus_allowed_ptr(current, old_mask); 266}
285 free_cpumask_var(old_mask); 267/**
268 * dcdbas_smi_request: generate SMI request
269 *
270 * Called with smi_data_lock.
271 */
272int dcdbas_smi_request(struct smi_cmd *smi_cmd)
273{
274 int ret;
275
276 if (smi_cmd->magic != SMI_CMD_MAGIC) {
277 dev_info(&dcdbas_pdev->dev, "%s: invalid magic value\n",
278 __func__);
279 return -EBADR;
280 }
281
282 /* SMI requires CPU 0 */
283 get_online_cpus();
284 ret = smp_call_on_cpu(0, raise_smi, smi_cmd, true);
285 put_online_cpus();
286
286 return ret; 287 return ret;
287} 288}
288 289