Re: [PATCH v7 01/10] EDAC/aspeed: Stop keeping driver state in global variables
From: Borislav Petkov
Date: Mon Nov 30 2026 - 21:39:14 EST
On Mon, Nov 30, 2026 at 03:24:28PM +0800, Ryan Chen wrote:
> The register map and the interrupt number are global variables. The
> following changes need to keep more state for the device, such as a
> lock and the chip type, and adding more globals for that is not the
> right way.
Change that commit text to:
"EDAC/aspeed: Add a driver private struct
Collect all driver-specific variables in a private driver structure, like it
is usually done for EDAC drivers."
This is much clearer.
Also, what is "struct aspeed_edac"'s name telling me?
Your struct names should be descriptive and say what they are. For example:
struct driver_priv or so.
And then declarations like:
struct driver_priv *priv = mci->pvt_info;
make perfect sense.
Same with:
struct aspeed_edac_chip
which appears later.
This is not an "EDAC chip" but an aspeed memory controller chip, AFAICT.
Right?
So "struct aspeed_mc" perhaps?
Naming is sooo important.
And so on.
Other than that, I cannot spot any more nasties.
Thx.
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette