From patchwork Sun Sep 1 11:34:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= X-Patchwork-Id: 11125179 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0BDDC14F7 for ; Sun, 1 Sep 2019 11:35:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D3ECE22CE9 for ; Sun, 1 Sep 2019 11:35:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="hBirwzCZ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728324AbfIALfA (ORCPT ); Sun, 1 Sep 2019 07:35:00 -0400 Received: from mail-lj1-f180.google.com ([209.85.208.180]:41925 "EHLO mail-lj1-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727033AbfIALe7 (ORCPT ); Sun, 1 Sep 2019 07:34:59 -0400 Received: by mail-lj1-f180.google.com with SMTP id m24so10332414ljg.8 for ; Sun, 01 Sep 2019 04:34:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=+PIos16FjiE5GoL1yJskqfiUeYgV7y62AOMsmaPsaEs=; b=hBirwzCZSHdqow7MQZ7/n3/eGut9v/gJwrpGrzIy0M/AP+/b4BRNUDjXolOtwr6Ous +zh3b6HRjujcf6TmTJrGJ5JgeQNvb8jAAIVZoWfGEi1KgIYb9gJXBqoG/10hhr+BuFXK 05nQ1YzMG9NtkJgaib5LEUdsxTobT3MhcjSxc/z3X6RmAzs6ure7xSdsFxOeiTwdOd/l xIvIDRyOv4NSwHtShsSMHLCqYrxPQM1gWbELowWGOSG9yNq8Q4xaXi6SwaW9kzEOyqKn w3OCoNfV7qVsHRPPpgsDzHyHelHAGbNt17IXI2ujbXUi6FZ51xqzMq4gdHmIOgSx2A3i GieA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=+PIos16FjiE5GoL1yJskqfiUeYgV7y62AOMsmaPsaEs=; b=OZn7OK6iLiagjqua6NSE8yfgtoPF3F002a8PRPBiW8ritElY80Bpq3SHicSSmdisxu gxgIB9cC7g+8I0nhrEypOFseoHN28BXfgddkjaEvDawyLj1C4EUIv04gzSWvr3zW/HjV vcHPsGCtD/49nsZnkdLO64DMn/x/4WCq7OGSaRB70YM556KwwxqxMyG90jGvLUcW4mV9 3MC9ZHT77fGbl+QghpQ0n8ticU6htFDD+CX/+cFjHVmVlvvPt4HTDohgJltlbo6f9RBY dO53E4m0KV6SD2YU+gTY4rBlnzxIDhmEVR21HJ+153xeLrzVabW58uroXHAieelZKbcg 2fjw== X-Gm-Message-State: APjAAAUmw4hR4ID/eUGOCWPXPy/6Pfc6Qb/vIgLl1kivof2o9sNWP7xK Rrdn2/oHkMG+8gKuYdoNQpc= X-Google-Smtp-Source: APXvYqw8mCvqhTTvNoRjTmv8looTeWcLoYitah1sFGFWd9NAQ//+rHLPC5uwfeIOQTt9RxlVHRCvwg== X-Received: by 2002:a2e:91da:: with SMTP id u26mr13378916ljg.125.1567337697716; Sun, 01 Sep 2019 04:34:57 -0700 (PDT) Received: from localhost.localdomain (ip-194-187-74-233.konfederacka.maverick.com.pl. [194.187.74.233]) by smtp.gmail.com with ESMTPSA id z30sm2197045lfj.63.2019.09.01.04.34.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 01 Sep 2019 04:34:57 -0700 (PDT) From: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= To: Kalle Valo Cc: Arend van Spriel , Franky Lin , Hante Meuleman , Chi-Hsien Lin , Wright Feng , Winnie Chang , linux-wireless@vger.kernel.org, brcm80211-dev-list.pdl@broadcom.com, brcm80211-dev-list@cypress.com, =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= Subject: [PATCH V2 1/2] brcmfmac: add stub version of brcmf_debugfs_get_devdir() Date: Sun, 1 Sep 2019 13:34:35 +0200 Message-Id: <20190901113436.23665-1-zajec5@gmail.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Rafał Miłecki 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 --- 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)) From patchwork Sun Sep 1 11:34:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= X-Patchwork-Id: 11125181 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9B1F614F7 for ; Sun, 1 Sep 2019 11:35:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 77F7622CE9 for ; Sun, 1 Sep 2019 11:35:07 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="sYPN0Kzh" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728390AbfIALfD (ORCPT ); Sun, 1 Sep 2019 07:35:03 -0400 Received: from mail-lj1-f193.google.com ([209.85.208.193]:46102 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727033AbfIALfD (ORCPT ); Sun, 1 Sep 2019 07:35:03 -0400 Received: by mail-lj1-f193.google.com with SMTP id f9so10269121ljc.13 for ; Sun, 01 Sep 2019 04:35:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=hVd3kbi/hgouNhLyAxTt4JN+8o8Ew7a4R9O5k2+jamQ=; b=sYPN0KzhudKap67e4ZnJJBKcAG8IJNtCigbqzHJ2Hge7l5KlCHDGm3XweCKm/L5wtq pKbi5su9mxNuHVMh/BaY846eF8+cFtDJWylnAJ1T3mRyhJlBSqqa5j4Xjk/Mg867I+cx Q8YpGI0V+aRlG31koeSQy+bJJNuWWYfh9YRVtUAaCVbP+khEC3uqHn6W2eI82qMjCGuc U5v3IIhhg55GqRlAz2Z03n/MpTb1fBn1zAEHOUGYM3OJq8YqHOvkYg4s84YvIBDBlhPS sv6K30NeB9n6PKTVai3CYly6BLaVMFtwVIJxS5ri/dc080aq8Q0AxhYzt7yhjaav96R8 32eg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=hVd3kbi/hgouNhLyAxTt4JN+8o8Ew7a4R9O5k2+jamQ=; b=E+7WcQPZnO5nMzVGT9ybg2TPVC/gg8dgApJk/waZ5Av1bify38ZeFyv34r4FBV6TmD L6E6qUgv8aYkSn3puBIlfraUvBzcZvAylQYMODDBTHZP2awYS6J+XgTR59V6DlM1fFwC zXjsrdGdig8xFi5xr6os8t02Mx5ZTdpsmNzLPH85stWxZP1mIFq0ZNr7gQlLMjQ37C6A wIvVU/Byv47w2UV+FsoszreYQe1VqpMViNtpb5Qj+P2aAOfl5j3286plhTKIjk8vb/y9 cJEj2beNJM/Lq5jkxeGexuQAiDKTUBZAF+JuM8Z507MpMjf+kOeBQEhaaQtx7qZgbFmM 1m2g== X-Gm-Message-State: APjAAAXF3yRJT7lbTZGdXcCs/iUjjMzCUjEREAUsvEV4C5kYa88+dX6N NFSGbNrGz7Lz3CACu6UUxv0= X-Google-Smtp-Source: APXvYqwYxjf+7/VJITLhng11ECja6O7L1vfTYQpvksz3N8BgYMwMeatsLRJRqJ+8q5uJI+ZJdB0PuQ== X-Received: by 2002:a2e:9a59:: with SMTP id k25mr2834343ljj.75.1567337701304; Sun, 01 Sep 2019 04:35:01 -0700 (PDT) Received: from localhost.localdomain (ip-194-187-74-233.konfederacka.maverick.com.pl. [194.187.74.233]) by smtp.gmail.com with ESMTPSA id z30sm2197045lfj.63.2019.09.01.04.35.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 01 Sep 2019 04:35:00 -0700 (PDT) From: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= To: Kalle Valo Cc: Arend van Spriel , Franky Lin , Hante Meuleman , Chi-Hsien Lin , Wright Feng , Winnie Chang , linux-wireless@vger.kernel.org, brcm80211-dev-list.pdl@broadcom.com, brcm80211-dev-list@cypress.com, =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= Subject: [PATCH V2 2/2] brcmfmac: add "reset" debugfs entry for testing reset Date: Sun, 1 Sep 2019 13:34:36 +0200 Message-Id: <20190901113436.23665-2-zajec5@gmail.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190901113436.23665-1-zajec5@gmail.com> References: <20190901113436.23665-1-zajec5@gmail.com> MIME-Version: 1.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Rafał Miłecki 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 --- .../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);