FSL_SSI: fix fsl_ssi interrupt reporting so that interrupts are only reported when they have been enabled.
Subsystems (3)
PATCH 1/1 FSL_SSI: fix fsl_ssi interrupt reporting so that interrupts are only reported when they have been enabled.
The current implementation reports all interrupt stats in /sys/kernel/debug/*.ssi/stats, even if the interrupt was not enabled. This is not the intention as per the comments. This fix keeps track of ever bit in the SIER register that has ever been enabled, which allows fsl_ssi_stats_show to actually only report those interrupt counts for interrupts that are enabled.
--- sound/soc/fsl/fsl_ssi.c | 15 +++++++++++++++ sound/soc/fsl/fsl_ssi.h | 1 + sound/soc/fsl/fsl_ssi_dbg.c | 8 +++----- 3 files changed, 19 insertions(+), 5 deletions(-)
sound/soc/fsl/fsl_ssi.c +15 -0
@@ -299,6 +299,18 @@ static irqreturn_t fsl_ssi_isr(int irq, void *dev_id)return IRQ_HANDLED ; } +// call fsl_ssi_dbg_update_sier_enbled every time sier is +// updated. it tracks which interrupts have ever been enabled. +// so that the print function can keep track. +void fsl_ssi_update_sier_enabled ( +struct fsl_ssi_private *ssi_private) +{ +int sier; +struct regmap *regs = ssi_private->regs; +regmap_read (regs,CCSR_SSI_SIER , &sier); + ssi_private->dbg_stats.sier_ever_enabled |= sier; +} +/* * Enable/Disable all rx/tx config flags at once. */
@@ -312,6 +324,7 @@ static void fsl_ssi_rxtx_config(struct fsl_ssi_private *ssi_private,regmap_update_bits (regs,CCSR_SSI_SIER , vals->rx.sier | vals->tx.sier, vals->rx.sier | vals->tx.sier); +fsl_ssi_update_sier_enabled (ssi_private);regmap_update_bits (regs,CCSR_SSI_SRCR , vals->rx.srcr | vals->tx.srcr, vals->rx.srcr | vals->tx.srcr);
@@ -404,6 +417,7 @@ static void fsl_ssi_config(struct fsl_ssi_private *ssi_private, bool enable,*/ if (enable) {regmap_update_bits (regs,CCSR_SSI_SIER , vals->sier, vals->sier); +fsl_ssi_update_sier_enabled (ssi_private);regmap_update_bits (regs,CCSR_SSI_SRCR , vals->srcr, vals->srcr);regmap_update_bits (regs,CCSR_SSI_STCR , vals->stcr, vals->stcr); }else {
@@ -431,6 +445,7 @@ static void fsl_ssi_config(struct fsl_ssi_private *ssi_private, bool enable,regmap_update_bits (regs,CCSR_SSI_SRCR , srcr,0 );regmap_update_bits (regs,CCSR_SSI_STCR , stcr,0 );regmap_update_bits (regs,CCSR_SSI_SIER , sier,0 ); +fsl_ssi_update_sier_enabled (ssi_private); } config_done:
sound/soc/fsl/fsl_ssi.h +1 -0
@@ -237,6 +237,7 @@ struct fsl_ssi_dbg {unsigned int tfe1;unsigned int tfe0; } stats; +unsigned int sier_ever_enabled; };void fsl_ssi_dbg_isr (struct fsl_ssi_dbg *ssi_dbg,u32 sisr);
sound/soc/fsl/fsl_ssi_dbg.c +3 -5
@@ -82,13 +82,10 @@ void fsl_ssi_dbg_isr(struct fsl_ssi_dbg *dbg, u32 sisr) dbg->stats.tfe0++; } -/* Show the statistics of a flag only if its interrupt is enabled. The -* compiler will optimze this code to a no-op if the interrupt is not -* enabled. -*/ +/* Show the statistics of a flag only if its interrupt is enabled. */ #define SIER_SHOW (flag, name) \ do { \ - if (CCSR_SSI_SIER_##flag) \ + if (CCSR_SSI_SIER_##flag & sier) \ seq_printf(s, #name "=%u\n", ssi_dbg->stats.name); \ } while (0)
@@ -102,6 +99,7 @@ void fsl_ssi_dbg_isr(struct fsl_ssi_dbg *dbg, u32 sisr)static int fsl_ssi_stats_show (struct seq_file *s,void *unused) {struct fsl_ssi_dbg *ssi_dbg = s->private; +unsigned int sier = ssi_dbg->sier_ever_enabled;SIER_SHOW (RFRC_EN , rfrc);SIER_SHOW (TFRC_EN , tfrc);
Signature · 1 line
2.1.4
Fabio Estevam
reviewerHi Caleb,
sound/soc/fsl/fsl_ssi.c static irqreturn_t fsl_ssi_isr(int irq, void *dev_id) · line 304
Quoted 3 lines · Caleb Crome
sound/soc/fsl/fsl_ssi.c +3
-0+// call fsl_ssi_dbg_update_sier_enbled every time sier is +// updated. it tracks which interrupts have ever been enabled. +// so that the print function can keep track.
The standard style for multi-line comments is:
/*
* Bla bla bla
* bla bla
* foo foo
*/
Quoted 10 lines · Fabio Estevam
Hi Caleb,
sound/soc/fsl/fsl_ssi.c static irqreturn_t fsl_ssi_isr(int irq, void *dev_id) · line 304
Quoted 3 lines · Caleb Crome
sound/soc/fsl/fsl_ssi.c +3
-0+// call fsl_ssi_dbg_update_sier_enbled every time sier is +// updated. it tracks which interrupts have ever been enabled. +// so that the print function can keep track. The standard style for multi-line comments is:
Quoted 5 lines
/*
* Bla bla bla
* bla bla
* foo foo
*/
Ah, thanks. Will fix it and resubmit.
-Caleb
Fabio Estevam
reviewerQuoted 11 lines · Caleb Crome
Quoted 10 lines · Fabio Estevam
Hi Caleb,
sound/soc/fsl/fsl_ssi.c static irqreturn_t fsl_ssi_isr(int irq, void *dev_id) · line 304
Quoted 3 lines · Caleb Crome
sound/soc/fsl/fsl_ssi.c +3
-0+// call fsl_ssi_dbg_update_sier_enbled every time sier is +// updated. it tracks which interrupts have ever been enabled. +// so that the print function can keep track. The standard style for multi-line comments is:
Quoted 6 lines
Quoted 5 lines
/*
* Bla bla bla
* bla bla
* foo foo
*/Ah, thanks. Will fix it and resubmit.
Some more tips:
- The Subject should be something like: ASoC: fsl_ssi: Fix fsl_ssi interrupt reporting
- Then run ./scripts/checkpatch.pl 0001-yourpatch.patch to see potential issues. The // comment issue would be reported by checkpatch
- Also run ./scripts/get_maintainer.pl 0001-yourpatch.patch so that you get the correct people to Cc the patch too. The email address you put for Timur is no longer valid and Nicolin must be on Cc.
Regards,
Fabio Estevam
Quoted 27 lines · Fabio Estevam
Quoted 11 lines · Caleb Crome
Quoted 10 lines · Fabio Estevam
Hi Caleb,
sound/soc/fsl/fsl_ssi.c static irqreturn_t fsl_ssi_isr(int irq, void *dev_id) · line 304
Quoted 3 lines · Caleb Crome
sound/soc/fsl/fsl_ssi.c +3
-0+// call fsl_ssi_dbg_update_sier_enbled every time sier is +// updated. it tracks which interrupts have ever been enabled. +// so that the print function can keep track. The standard style for multi-line comments is:
Quoted 6 lines
Quoted 5 lines
/*
* Bla bla bla
* bla bla
* foo foo
*/Ah, thanks. Will fix it and resubmit.
Some more tips:
- The Subject should be something like: ASoC:
fsl_ssi: Fixfsl_ssiinterrupt reporting- Then run
./scripts/checkpatch.pl0001-yourpatch.patch to see potential issues. The // comment issue would be reported by checkpatch
Quoted 7 lines
- Also run
./scripts/get_maintainer.pl0001-yourpatch.patch so that you get the correct people to Cc the patch too. The email address you put for Timur is no longer valid and Nicolin must be on Cc.Regards,
Fabio Estevam
Great. Thank you, that will make things go more smoothly for me.
Thanks,
-Caleb
Quoted 4 lines · Caleb Crome
The current implementation reports all interrupt stats in
/sys/kernel/debug/*.ssi/stats, even if the interrupt was not enabled. This is not the intention as per the comments. This fix keeps track of ever bit in the
"every"
Also, please send patches to [email protected] and not [email protected]. Thanks.