From: Kalle Valo <kvalo@qca.qualcomm.com>
To: <ath10k@lists.infradead.org>
Cc: <linux-wireless@vger.kernel.org>
Subject: Re: [PATCH v2 1/2] ath10k: add register access debugfs interface
Date: Tue, 25 Nov 2014 10:39:55 +0200 [thread overview]
Message-ID: <87vbm31xno.fsf@kamboji.qca.qualcomm.com> (raw)
In-Reply-To: <20141124164159.29422.98462.stgit@potku.adurom.net> (Kalle Valo's message of "Mon, 24 Nov 2014 18:41:59 +0200")
Kalle Valo <kvalo@qca.qualcomm.com> writes:
> +static ssize_t ath10k_reg_value_read(struct file *file,
> + char __user *user_buf,
> + size_t count, loff_t *ppos)
> +{
> + struct ath10k *ar = file->private_data;
> + u8 buf[48];
> + unsigned int len;
> + u32 reg_addr, reg_val;
> +
> + spin_lock_bh(&ar->data_lock);
> + reg_addr = ar->debug.reg_addr;
> + spin_unlock_bh(&ar->data_lock);
> +
> + reg_val = ath10k_hif_read32(ar, reg_addr);
> + len = scnprintf(buf, sizeof(buf), "0x%08x:0x%08x\n", reg_addr, reg_val);
> +
> + return simple_read_from_buffer(user_buf, count, ppos, buf, len);
> +}
I just realised that we need to check ar->state to make sure that
firmware is running. Because of that I'll need to change the data_lock
to conf_mutex as well.
> +static ssize_t ath10k_reg_value_write(struct file *file,
> + const char __user *user_buf,
> + size_t count, loff_t *ppos)
> +{
> + struct ath10k *ar = file->private_data;
> + u32 reg_addr, reg_val;
> + int ret;
> +
> + spin_lock_bh(&ar->data_lock);
> + reg_addr = ar->debug.reg_addr;
> + spin_unlock_bh(&ar->data_lock);
> +
> + ret = kstrtou32_from_user(user_buf, count, 0, ®_val);
> + if (ret)
> + return ret;
> +
> + ath10k_hif_write32(ar, reg_addr, reg_val);
> +
> + return count;
> +}
And same here as well. I'll send v3.
--
Kalle Valo
next prev parent reply other threads:[~2014-11-25 8:40 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 [this message]
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
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=87vbm31xno.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