Linux-mediatek Archive mirror
 help / color / mirror / Atom feed
From: Sean Wang <sean.wang@kernel.org>
To: JB Tsai <jb.tsai@mediatek.com>
Cc: nbd@nbd.name, lorenzo@kernel.org, linux-wireless@vger.kernel.org,
	 linux-mediatek@lists.infradead.org, Deren.Wu@mediatek.com,
	 Sean.Wang@mediatek.com, Quan.Zhou@mediatek.com,
	Ryder.Lee@mediatek.com,  Leon.Yen@mediatek.com,
	litien.chang@mediatek.com, jeff.hsu@mediatek.com
Subject: Re: [PATCH] wifi: mt76: mt7925: Add coredump callback in pci_driver
Date: Tue, 12 May 2026 16:30:39 -0500	[thread overview]
Message-ID: <CAGp9LzpTJLsU_TB+6Cvm1Nhdqkpb7fR0x2WvFBuJMx=M4YrOew@mail.gmail.com> (raw)
In-Reply-To: <20260505055252.2558613-1-jb.tsai@mediatek.com>

Hi,

On Tue, May 5, 2026 at 12:53 AM JB Tsai <jb.tsai@mediatek.com> wrote:
>
> From: Jeff Hsu <Jeff.Hsu@mediatek.com>
>
> Register coredump callback(mt7925_coredump) in pci_driver,
> it can let platform can trigger core dump to collect the
> log and recover back after coredump complete without debugfs
>
> Some platform not have debugfs
>
> Signed-off-by: Jeff Hsu <Jeff.Hsu@mediatek.com>
> ---
>  drivers/net/wireless/mediatek/mt76/mt7925/mcu.c |  1 +
>  drivers/net/wireless/mediatek/mt76/mt7925/pci.c | 12 ++++++++++++
>  2 files changed, 13 insertions(+)
>
> diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c
> index 37cdf3e8a067..cd502166a7f9 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c
> @@ -1014,6 +1014,7 @@ int mt7925_mcu_chip_config(struct mt792x_dev *dev, const char *cmd)
>         return mt76_mcu_send_msg(&dev->mt76, MCU_UNI_CMD(CHIP_CONFIG),
>                                  &req, sizeof(req), false);
>  }
> +EXPORT_SYMBOL_GPL(mt7925_mcu_chip_config);
>
>  int mt7925_mcu_set_deep_sleep(struct mt792x_dev *dev, bool enable)
>  {
> diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/pci.c b/drivers/net/wireless/mediatek/mt76/mt7925/pci.c
> index c4161754c01d..5b3e62e5f157 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt7925/pci.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt7925/pci.c
> @@ -610,6 +610,17 @@ static int mt7925_pci_restore(struct device *device)
>         return _mt7925_pci_resume(device, true);
>  }
>
> +static void mt7925_coredump(struct device *dev)
> +{
> +       struct pci_dev *pdev = to_pci_dev(device);

There is a build error on this line.

../drivers/net/wireless/mediatek/mt76/mt7925/pci.c: In function
‘mt7925_coredump’:
../drivers/net/wireless/mediatek/mt76/mt7925/pci.c:682:43: error:
‘device’ undeclared (first use in this function)
  682 |         struct pci_dev *pdev = to_pci_dev(device);
      |                                           ^~~~~~
../include/linux/container_of.h:20:33: note: in definition of macro
‘container_of’
   20 |         void *__mptr = (void *)(ptr);
         \
      |                                 ^~~
../drivers/net/wireless/mediatek/mt76/mt7925/pci.c:682:32: note: in
expansion of macro ‘to_pci_dev’
  682 |         struct pci_dev *pdev = to_pci_dev(device);
      |                                ^~~~~~~~~~
../drivers/net/wireless/mediatek/mt76/mt7925/pci.c:682:43: note: each
undeclared identifier is reported only once for each function it
appears in
  682 |         struct pci_dev *pdev = to_pci_dev(device);
      |                                           ^~~~~~
../include/linux/container_of.h:20:33: note: in definition of macro
‘container_of’
   20 |         void *__mptr = (void *)(ptr);

> +       struct mt76_dev *mdev = pci_get_drvdata(pdev);
> +       struct mt792x_dev *dev_792x = container_of(mdev, struct mt792x_dev, mt76);
> +
> +       mt792x_mutex_acquire(dev_792x);
> +       mt7925_mcu_chip_config(dev_792x, "assert");
> +       mt792x_mutex_release(dev_792x);
> +}
> +
>  static const struct dev_pm_ops mt7925_pm_ops = {
>         .suspend = pm_sleep_ptr(mt7925_pci_suspend),
>         .resume  = pm_sleep_ptr(mt7925_pci_resume),
> @@ -626,6 +637,7 @@ static struct pci_driver mt7925_pci_driver = {
>         .remove         = mt7925_pci_remove,
>         .shutdown       = mt7925_pci_shutdown,
>         .driver.pm      = pm_sleep_ptr(&mt7925_pm_ops),
> +       .driver.coredump = mt7925_coredump,
>  };
>
>  module_pci_driver(mt7925_pci_driver);
> --
> 2.45.2
>
>


      reply	other threads:[~2026-05-12 21:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-05  5:52 [PATCH] wifi: mt76: mt7925: Add coredump callback in pci_driver JB Tsai
2026-05-12 21:30 ` Sean Wang [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAGp9LzpTJLsU_TB+6Cvm1Nhdqkpb7fR0x2WvFBuJMx=M4YrOew@mail.gmail.com' \
    --to=sean.wang@kernel.org \
    --cc=Deren.Wu@mediatek.com \
    --cc=Leon.Yen@mediatek.com \
    --cc=Quan.Zhou@mediatek.com \
    --cc=Ryder.Lee@mediatek.com \
    --cc=Sean.Wang@mediatek.com \
    --cc=jb.tsai@mediatek.com \
    --cc=jeff.hsu@mediatek.com \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=litien.chang@mediatek.com \
    --cc=lorenzo@kernel.org \
    --cc=nbd@nbd.name \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 read-only IMAP folder(s) and NNTP newsgroup(s).