From: Kalle Valo <kvalo@qca.qualcomm.com>
To: <ath10k@lists.infradead.org>
Cc: <linux-wireless@vger.kernel.org>
Subject: Re: [PATCH v2 2/2] ath10k: add memory dump debugfs interface
Date: Tue, 25 Nov 2014 10:41:25 +0200 [thread overview]
Message-ID: <87r3wr1xl6.fsf@kamboji.qca.qualcomm.com> (raw)
In-Reply-To: <20141124164208.29422.76134.stgit@potku.adurom.net> (Kalle Valo's message of "Mon, 24 Nov 2014 18:42:08 +0200")
Kalle Valo <kvalo@qca.qualcomm.com> writes:
> +static ssize_t ath10k_mem_value_read(struct file *file,
> + char __user *user_buf,
> + size_t count, loff_t *ppos)
> +{
> + struct ath10k *ar = file->private_data;
> + u8 *buf;
> + int ret;
> +
> + if (*ppos < 0)
> + return -EINVAL;
> +
> + if (!count)
> + return 0;
> +
> + buf = vmalloc(count);
> + if (!buf)
> + return -ENOMEM;
> +
> + ret = ath10k_hif_diag_read(ar, *ppos, buf, count);
> + if (ret) {
> + ath10k_warn(ar, "failed to read address 0x%08x via diagnose window from debugfs: %d\n",
> + (u32)(*ppos), ret);
> + goto read_err;
> + }
> +
[...]
> +static ssize_t ath10k_mem_value_write(struct file *file,
> + const char __user *user_buf,
> + size_t count, loff_t *ppos)
> +{
> + struct ath10k *ar = file->private_data;
> + u8 *buf;
> + int ret;
> +
> + if (*ppos < 0)
> + return -EINVAL;
> +
> + if (!count)
> + return 0;
> +
> + buf = vmalloc(count);
> + if (!buf)
> + return -ENOMEM;
> +
> + ret = copy_from_user(buf, user_buf, count);
> + if (ret)
> + goto err_free_copy;
> +
> + ret = ath10k_hif_diag_write(ar, *ppos, buf, count);
> + if (ret) {
> + ath10k_warn(ar, "failed to write address 0x%08x via diagnose window from debugfs: %d\n",
> + (u32)(*ppos), ret);
> + goto err_free_copy;
> + }
In these two functions we also need to check ar->state.
--
Kalle Valo
next prev parent reply other threads:[~2014-11-25 8:41 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-24 16:41 [PATCH v2 0/2] ath10k: firmware memory debugfs interface Kalle Valo
2014-11-24 16:41 ` [PATCH v2 1/2] ath10k: add register access " Kalle Valo
2014-11-25 8:39 ` Kalle Valo
2014-11-25 8:58 ` Michal Kazior
2014-11-24 16:42 ` [PATCH v2 2/2] ath10k: add memory dump " Kalle Valo
2014-11-24 16:52 ` Kalle Valo
2014-11-25 8:41 ` Kalle Valo [this message]
2014-11-25 9:03 ` Michal Kazior
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=87r3wr1xl6.fsf@kamboji.qca.qualcomm.com \
--to=kvalo@qca.qualcomm.com \
--cc=ath10k@lists.infradead.org \
--cc=linux-wireless@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