* [PATCH V2 1/2] brcmfmac: add stub version of brcmf_debugfs_get_devdir()
@ 2019-09-01 11:34 Rafał Miłecki
2019-09-01 11:34 ` [PATCH V2 2/2] brcmfmac: add "reset" debugfs entry for testing reset Rafał Miłecki
2019-09-06 14:09 ` [PATCH V2 1/2] brcmfmac: add stub version of brcmf_debugfs_get_devdir() Kalle Valo
0 siblings, 2 replies; 3+ messages in thread
From: Rafał Miłecki @ 2019-09-01 11:34 UTC (permalink / raw)
To: Kalle Valo
Cc: Arend van Spriel, Franky Lin, Hante Meuleman, Chi-Hsien Lin,
Wright Feng, Winnie Chang, linux-wireless,
brcm80211-dev-list.pdl, brcm80211-dev-list,
Rafał Miłecki
From: Rafał Miłecki <rafal@milecki.pl>
In case of compiling driver without DEBUG expose a stub function to make
writing debug code much simpler (no extra conditions). This will allow
e.g. using debugfs_create_file() without any magic if or #ifdef.
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
---
drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h
index ea6e8e839cae..9b221b509ade 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h
@@ -121,6 +121,10 @@ int brcmf_debugfs_add_entry(struct brcmf_pub *drvr, const char *fn,
int brcmf_debug_create_memdump(struct brcmf_bus *bus, const void *data,
size_t len);
#else
+static inline struct dentry *brcmf_debugfs_get_devdir(struct brcmf_pub *drvr)
+{
+ return ERR_PTR(-ENOENT);
+}
static inline
int brcmf_debugfs_add_entry(struct brcmf_pub *drvr, const char *fn,
int (*read_fn)(struct seq_file *seq, void *data))
--
2.21.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH V2 2/2] brcmfmac: add "reset" debugfs entry for testing reset
2019-09-01 11:34 [PATCH V2 1/2] brcmfmac: add stub version of brcmf_debugfs_get_devdir() Rafał Miłecki
@ 2019-09-01 11:34 ` Rafał Miłecki
2019-09-06 14:09 ` [PATCH V2 1/2] brcmfmac: add stub version of brcmf_debugfs_get_devdir() Kalle Valo
1 sibling, 0 replies; 3+ messages in thread
From: Rafał Miłecki @ 2019-09-01 11:34 UTC (permalink / raw)
To: Kalle Valo
Cc: Arend van Spriel, Franky Lin, Hante Meuleman, Chi-Hsien Lin,
Wright Feng, Winnie Chang, linux-wireless,
brcm80211-dev-list.pdl, brcm80211-dev-list,
Rafał Miłecki
From: Rafał Miłecki <rafal@milecki.pl>
This is a trivial debugfs entry for triggering reset just like in case
of firmware crash. It works by writing 1 to it:
echo 1 > reset
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
---
.../broadcom/brcm80211/brcmfmac/core.c | 25 +++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
index 705b8cc53c3e..21e07d1ceeae 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
@@ -1086,6 +1086,29 @@ static void brcmf_core_bus_reset(struct work_struct *work)
brcmf_bus_reset(drvr->bus_if);
}
+static ssize_t bus_reset_write(struct file *file, const char __user *user_buf,
+ size_t count, loff_t *ppos)
+{
+ struct brcmf_pub *drvr = file->private_data;
+ u8 value;
+
+ if (kstrtou8_from_user(user_buf, count, 0, &value))
+ return -EINVAL;
+
+ if (value != 1)
+ return -EINVAL;
+
+ schedule_work(&drvr->bus_reset);
+
+ return count;
+}
+
+static const struct file_operations bus_reset_fops = {
+ .open = simple_open,
+ .llseek = no_llseek,
+ .write = bus_reset_write,
+};
+
static int brcmf_bus_started(struct brcmf_pub *drvr, struct cfg80211_ops *ops)
{
int ret = -1;
@@ -1161,6 +1184,8 @@ static int brcmf_bus_started(struct brcmf_pub *drvr, struct cfg80211_ops *ops)
/* populate debugfs */
brcmf_debugfs_add_entry(drvr, "revinfo", brcmf_revinfo_read);
+ debugfs_create_file("reset", 0600, brcmf_debugfs_get_devdir(drvr), drvr,
+ &bus_reset_fops);
brcmf_feat_debugfs_create(drvr);
brcmf_proto_debugfs_create(drvr);
brcmf_bus_debugfs_create(bus_if);
--
2.21.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH V2 1/2] brcmfmac: add stub version of brcmf_debugfs_get_devdir()
2019-09-01 11:34 [PATCH V2 1/2] brcmfmac: add stub version of brcmf_debugfs_get_devdir() Rafał Miłecki
2019-09-01 11:34 ` [PATCH V2 2/2] brcmfmac: add "reset" debugfs entry for testing reset Rafał Miłecki
@ 2019-09-06 14:09 ` Kalle Valo
1 sibling, 0 replies; 3+ messages in thread
From: Kalle Valo @ 2019-09-06 14:09 UTC (permalink / raw)
To: Rafał Miłecki
Cc: Arend van Spriel, Franky Lin, Hante Meuleman, Chi-Hsien Lin,
Wright Feng, Winnie Chang, linux-wireless,
brcm80211-dev-list.pdl, brcm80211-dev-list,
Rafał Miłecki
Rafał Miłecki wrote:
> From: Rafał Miłecki <rafal@milecki.pl>
>
> In case of compiling driver without DEBUG expose a stub function to make
> writing debug code much simpler (no extra conditions). This will allow
> e.g. using debugfs_create_file() without any magic if or #ifdef.
>
> Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
2 patches applied to wireless-drivers-next.git, thanks.
cb34212b1c25 brcmfmac: add stub version of brcmf_debugfs_get_devdir()
2f8c8e62cd50 brcmfmac: add "reset" debugfs entry for testing reset
--
https://patchwork.kernel.org/patch/11125179/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-09-06 14:09 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-01 11:34 [PATCH V2 1/2] brcmfmac: add stub version of brcmf_debugfs_get_devdir() Rafał Miłecki
2019-09-01 11:34 ` [PATCH V2 2/2] brcmfmac: add "reset" debugfs entry for testing reset Rafał Miłecki
2019-09-06 14:09 ` [PATCH V2 1/2] brcmfmac: add stub version of brcmf_debugfs_get_devdir() Kalle Valo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).