Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932446AbeAKIg4 (ORCPT + 1 other); Thu, 11 Jan 2018 03:36:56 -0500 Received: from rnd-relay.smtp.broadcom.com ([192.19.229.170]:57787 "EHLO rnd-relay.smtp.broadcom.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932220AbeAKIgw (ORCPT ); Thu, 11 Jan 2018 03:36:52 -0500 From: Arend van Spriel To: Greg Koah Hartmann Cc: LKML , Arend van Spriel Subject: [RFC V2 3/3] brcmfmac: pcie: implement .coredump() driver callback Date: Thu, 11 Jan 2018 09:36:39 +0100 Message-Id: <1515659799-23521-4-git-send-email-aspriel@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1515659799-23521-1-git-send-email-aspriel@gmail.com> References: <1515659799-23521-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 --- V2: - no changes --- .../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