[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250520143841.GA1298026@bhelgaas>
Date: Tue, 20 May 2025 09:38:41 -0500
From: Bjorn Helgaas <helgaas@...nel.org>
To: Sathyanarayanan Kuppuswamy <sathyanarayanan.kuppuswamy@...ux.intel.com>
Cc: linux-pci@...r.kernel.org, Jon Pan-Doh <pandoh@...gle.com>,
Karolina Stolarek <karolina.stolarek@...cle.com>,
Martin Petersen <martin.petersen@...cle.com>,
Ben Fuller <ben.fuller@...cle.com>,
Drew Walton <drewwalton@...rosoft.com>,
Anil Agrawal <anilagrawal@...a.com>,
Tony Luck <tony.luck@...el.com>,
Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>,
Lukas Wunner <lukas@...ner.de>,
Jonathan Cameron <Jonathan.Cameron@...wei.com>,
Sargun Dhillon <sargun@...a.com>,
"Paul E . McKenney" <paulmck@...nel.org>,
Mahesh J Salgaonkar <mahesh@...ux.ibm.com>,
Oliver O'Halloran <oohall@...il.com>,
Kai-Heng Feng <kaihengf@...dia.com>,
Keith Busch <kbusch@...nel.org>, Robert Richter <rrichter@....com>,
Terry Bowman <terry.bowman@....com>,
Shiju Jose <shiju.jose@...wei.com>,
Dave Jiang <dave.jiang@...el.com>, linux-kernel@...r.kernel.org,
linuxppc-dev@...ts.ozlabs.org, Bjorn Helgaas <bhelgaas@...gle.com>
Subject: Re: [PATCH v6 08/16] PCI/AER: Simplify pci_print_aer()
On Mon, May 19, 2025 at 05:02:28PM -0700, Sathyanarayanan Kuppuswamy wrote:
> On 5/19/25 2:35 PM, Bjorn Helgaas wrote:
> > From: Bjorn Helgaas <bhelgaas@...gle.com>
> >
> > Simplify pci_print_aer() by initializing the struct aer_err_info "info"
> > with a designated initializer list (it was previously initialized with
> > memset()) and using pci_name().
> >
> > Signed-off-by: Bjorn Helgaas <bhelgaas@...gle.com>
> > ---
> > drivers/pci/pcie/aer.c | 16 ++++++++--------
> > 1 file changed, 8 insertions(+), 8 deletions(-)
> >
> > diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c
> > index 40f003eca1c5..73d618354f6a 100644
> > --- a/drivers/pci/pcie/aer.c
> > +++ b/drivers/pci/pcie/aer.c
> > @@ -765,7 +765,10 @@ void pci_print_aer(struct pci_dev *dev, int aer_severity,
> > {
> > int layer, agent, tlp_header_valid = 0;
> > u32 status, mask;
> > - struct aer_err_info info;
>
> You have cleaned up other stack allocations of struct aer_err_info to zero
> initialization in your previous patches. Why not follow the same format
> here? I don't think this function resets all fields of aer_err_info, right?
This is new to me, but IIUC this does initialize all the fields.
https://gcc.gnu.org/onlinedocs/gcc/Designated-Inits.html says "Omitted
fields are implicitly initialized the same as for objects that have
static storage duration."
> > + struct aer_err_info info = {
> > + .severity = aer_severity,
> > + .first_error = PCI_ERR_CAP_FEP(aer->cap_control),
> > + };
> > if (aer_severity == AER_CORRECTABLE) {
> > status = aer->cor_status;
> > @@ -776,14 +779,11 @@ void pci_print_aer(struct pci_dev *dev, int aer_severity,
> > tlp_header_valid = status & AER_LOG_TLP_MASKS;
> > }
> > - layer = AER_GET_LAYER_ERROR(aer_severity, status);
> > - agent = AER_GET_AGENT(aer_severity, status);
> > -
> > - memset(&info, 0, sizeof(info));
> > - info.severity = aer_severity;
> > info.status = status;
> > info.mask = mask;
> > - info.first_error = PCI_ERR_CAP_FEP(aer->cap_control);
> > +
> > + layer = AER_GET_LAYER_ERROR(aer_severity, status);
> > + agent = AER_GET_AGENT(aer_severity, status);
> > pci_err(dev, "aer_status: 0x%08x, aer_mask: 0x%08x\n", status, mask);
> > __aer_print_error(dev, &info);
> > @@ -797,7 +797,7 @@ void pci_print_aer(struct pci_dev *dev, int aer_severity,
> > if (tlp_header_valid)
> > pcie_print_tlp_log(dev, &aer->header_log, dev_fmt(" "));
> > - trace_aer_event(dev_name(&dev->dev), (status & ~mask),
> > + trace_aer_event(pci_name(dev), (status & ~mask),
> > aer_severity, tlp_header_valid, &aer->header_log);
> > }
> > EXPORT_SYMBOL_NS_GPL(pci_print_aer, "CXL");
>
> --
> Sathyanarayanan Kuppuswamy
> Linux Kernel Developer
>
Powered by blists - more mailing lists