Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965313AbeAJNyp (ORCPT + 1 other); Wed, 10 Jan 2018 08:54:45 -0500 Received: from rnd-relay.smtp.broadcom.com ([192.19.229.170]:45823 "EHLO rnd-relay.smtp.broadcom.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964945AbeAJNyD (ORCPT ); Wed, 10 Jan 2018 08:54:03 -0500 From: Arend van Spriel To: Greg Koah Hartmann Cc: LKML , Arend van Spriel Subject: [RFC 3/3] brcmfmac: pcie: implement .coredump() driver callback Date: Wed, 10 Jan 2018 14:53:49 +0100 Message-Id: <1515592429-17420-4-git-send-email-aspriel@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1515592429-17420-1-git-send-email-aspriel@gmail.com> References: <1515592429-17420-1-git-send-email-aspriel@gmail.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: This implements the .coredump() driver callback obtaining binary data from the device and using devcoredump function to expose it in sysfs. Signed-off-by: Arend van Spriel --- .../wireless/broadcom/brcm80211/brcmfmac/pcie.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c index 3c87157..55d0d25 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include @@ -1744,6 +1745,26 @@ static void brcmf_pcie_setup(struct device *dev, int ret, device_release_driver(dev); } +static int brcmf_pcie_dev_coredump(struct device *dev) +{ + struct brcmf_bus *bus_if = dev_get_drvdata(dev); + struct brcmf_pciedev *buspub = bus_if->bus_priv.pcie; + struct brcmf_pciedev_info *devinfo = buspub->devinfo; + size_t len; + void *dump; + + len = devinfo->ci->ramsize - devinfo->ci->srsize; + dump = vzalloc(len); + if (!dump) + return -ENOMEM; + + brcmf_dbg(PCIE, "dump at 0x%08X: len=%zu\n", devinfo->ci->rambase, len); + brcmf_pcie_copy_dev_tomem(devinfo, devinfo->ci->rambase, dump, len); + + dev_coredumpv(dev, dump, len, GFP_KERNEL); + return 0; +} + static int brcmf_pcie_probe(struct pci_dev *pdev, const struct pci_device_id *id) { @@ -2002,6 +2023,7 @@ static int brcmf_pcie_pm_leave_D3(struct device *dev) .id_table = brcmf_pcie_devid_table, .probe = brcmf_pcie_probe, .remove = brcmf_pcie_remove, + .driver.coredump = brcmf_pcie_dev_coredump, #ifdef CONFIG_PM .driver.pm = &brcmf_pciedrvr_pm, #endif -- 1.9.1