From: Rusty Russell <rusty@rustcorp.com.au>
To: Douglas_Warzecha@dell.com
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] work_on_cpu: use on drivers/firmware/dcdbas.c
Date: Mon, 1 Dec 2008 19:00:42 +1030 [thread overview]
Message-ID: <200812011900.43852.rusty@rustcorp.com.au> (raw)
Use work_on_cpu instead of cpumask games.
Doug: note one subtle change. If we can't get to CPU 0 for some
reason, the return will be -EINVAL not -EBUSY.
Doug: want me to fix this in the caller? ie:
return work_on_cpu(0, generate_smi, smi_cmd) == 0 ? 0 : -EBUSY;
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Cc: Douglas_Warzecha@dell.com
---
drivers/firmware/dcdbas.c | 46 +++++++++++++++++++---------------------------
1 file changed, 19 insertions(+), 27 deletions(-)
diff -r 155c7f2e2e30 drivers/firmware/dcdbas.c
--- a/drivers/firmware/dcdbas.c Thu Oct 23 11:22:04 2008 +1100
+++ b/drivers/firmware/dcdbas.c Thu Oct 23 11:23:38 2008 +1100
@@ -237,31 +237,9 @@ static ssize_t host_control_on_shutdown_
return count;
}
-/**
- * smi_request: generate SMI request
- *
- * Called with smi_data_lock.
- */
-static int smi_request(struct smi_cmd *smi_cmd)
+static long generate_smi(void *_smi_cmd)
{
- cpumask_t old_mask;
- int ret = 0;
-
- if (smi_cmd->magic != SMI_CMD_MAGIC) {
- dev_info(&dcdbas_pdev->dev, "%s: invalid magic value\n",
- __func__);
- return -EBADR;
- }
-
- /* SMI requires CPU 0 */
- old_mask = current->cpus_allowed;
- set_cpus_allowed_ptr(current, &cpumask_of_cpu(0));
- if (smp_processor_id() != 0) {
- dev_dbg(&dcdbas_pdev->dev, "%s: failed to get CPU 0\n",
- __func__);
- ret = -EBUSY;
- goto out;
- }
+ struct smi_cmd *smi_cmd = _smi_cmd;
/* generate SMI */
asm volatile (
@@ -273,10 +251,24 @@ static int smi_request(struct smi_cmd *s
"c" (smi_cmd->ecx)
: "memory"
);
+ return 0;
+}
-out:
- set_cpus_allowed_ptr(current, &old_mask);
- return ret;
+/**
+ * smi_request: generate SMI request
+ *
+ * Called with smi_data_lock.
+ */
+static int smi_request(struct smi_cmd *smi_cmd)
+{
+ if (smi_cmd->magic != SMI_CMD_MAGIC) {
+ dev_info(&dcdbas_pdev->dev, "%s: invalid magic value\n",
+ __func__);
+ return -EBADR;
+ }
+
+ /* SMI requires CPU 0 */
+ return work_on_cpu(0, generate_smi, smi_cmd);
}
/**
reply other threads:[~2008-12-01 8:30 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200812011900.43852.rusty@rustcorp.com.au \
--to=rusty@rustcorp.com.au \
--cc=Douglas_Warzecha@dell.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox