[PATCH v3 3/3] ath10k: create debugfs interface to trigger fw crash

Kalle Valo kvalo at qca.qualcomm.com
Fri Jul 19 06:29:46 EDT 2013


Michal Kazior <michal.kazior at tieto.com> writes:

> This can be useful for testing. To perform a
> forced firmware crash write 'crash' to
> 'simulate_fw_crash' debugfs file. E.g.
>
>   echo crash > /sys/kernel/debug/ieee80211/phy1/ath10k/simulate_fw_crash
>
> Signed-off-by: Michal Kazior <michal.kazior at tieto.com>

[...]

> +static ssize_t ath10k_write_simulate_fw_crash(struct file *file,
> +					      const char __user *user_buf,
> +					      size_t count, loff_t *ppos)
> +{
> +	struct ath10k *ar = file->private_data;
> +	char buf[32] = {};
> +	int ret;
> +
> +	mutex_lock(&ar->conf_mutex);
> +
> +	simple_write_to_buffer(buf, sizeof(buf) - 1, ppos, user_buf, count);
> +	if (strcmp(buf, "crash") && strcmp(buf, "crash\n")) {
> +		ath10k_warn("write keyword `crash` to simulate firmware crash\n");
> +		goto exit;
> +	}

Better to just return an error here.

> +	if (ar->state != ATH10K_STATE_ON &&
> +	    ar->state != ATH10K_STATE_RESTARTED) {
> +		ath10k_warn("firmware isn't loaded yet, nothing to crash\n");
> +		goto exit;
> +	}

Ditto.

-- 
Kalle Valo



More information about the ath10k mailing list