linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH] ASoC: Intel: sst: Delete sst_save_shim64(); saved regs are never used
@ 2017-05-26 16:34 Douglas Anderson
  2017-05-27 16:35 ` Andy Shevchenko
  0 siblings, 1 reply; 3+ messages in thread
From: Douglas Anderson @ 2017-05-26 16:34 UTC (permalink / raw)
  To: Mark Brown
  Cc: Vinod Koul, mka, Douglas Anderson, lgirdwood, perex, tiwai,
	colin.king, o-takashi, sebastien.guiriec, alsa-devel,
	linux-kernel

In commit 9a075265c6dc ("ASoC: Intel: sst: Remove unused function
sst_restore_shim64()"), we deleted the sst_restore_shim64() since it
was never used.  ...but a quick look at the code shows that we should
also be able to remove the sst_save_shim64() function and the
structure members we were storing data in.

Note that the saving code (and the comments talking about how
important it is to do the save) has been around since
commit 336cfbb05edf ("ASoC: Intel: mrfld- add ACPI module").

Signed-off-by: Douglas Anderson <dianders@chromium.org>
---
This problem was found only by code inspection and only compile
tested.  Hence, RFC.

 sound/soc/intel/atom/sst/sst.c | 19 -------------------
 sound/soc/intel/atom/sst/sst.h |  2 --
 2 files changed, 21 deletions(-)

diff --git a/sound/soc/intel/atom/sst/sst.c b/sound/soc/intel/atom/sst/sst.c
index 2d43b8693c0c..5ee92257ca85 100644
--- a/sound/soc/intel/atom/sst/sst.c
+++ b/sound/soc/intel/atom/sst/sst.c
@@ -382,21 +382,6 @@ void sst_context_cleanup(struct intel_sst_drv *ctx)
 }
 EXPORT_SYMBOL_GPL(sst_context_cleanup);
 
-static inline void sst_save_shim64(struct intel_sst_drv *ctx,
-			    void __iomem *shim,
-			    struct sst_shim_regs64 *shim_regs)
-{
-	unsigned long irq_flags;
-
-	spin_lock_irqsave(&ctx->ipc_spin_lock, irq_flags);
-
-	shim_regs->imrx = sst_shim_read64(shim, SST_IMRX);
-	shim_regs->csr = sst_shim_read64(shim, SST_CSR);
-
-
-	spin_unlock_irqrestore(&ctx->ipc_spin_lock, irq_flags);
-}
-
 void sst_configure_runtime_pm(struct intel_sst_drv *ctx)
 {
 	pm_runtime_set_autosuspend_delay(ctx->dev, SST_SUSPEND_DELAY);
@@ -416,8 +401,6 @@ void sst_configure_runtime_pm(struct intel_sst_drv *ctx)
 		pm_runtime_set_active(ctx->dev);
 	else
 		pm_runtime_put_noidle(ctx->dev);
-
-	sst_save_shim64(ctx, ctx->shim, ctx->shim_regs64);
 }
 EXPORT_SYMBOL_GPL(sst_configure_runtime_pm);
 
@@ -441,8 +424,6 @@ static int intel_sst_runtime_suspend(struct device *dev)
 	flush_workqueue(ctx->post_msg_wq);
 
 	ctx->ops->reset(ctx);
-	/* save the shim registers because PMC doesn't save state */
-	sst_save_shim64(ctx, ctx->shim, ctx->shim_regs64);
 
 	return ret;
 }
diff --git a/sound/soc/intel/atom/sst/sst.h b/sound/soc/intel/atom/sst/sst.h
index 5c9a51cc77aa..d8cac09e8997 100644
--- a/sound/soc/intel/atom/sst/sst.h
+++ b/sound/soc/intel/atom/sst/sst.h
@@ -318,12 +318,10 @@ struct sst_ipc_reg {
 };
 
 struct sst_shim_regs64 {
-	u64 csr;
 	u64 pisr;
 	u64 pimr;
 	u64 isrx;
 	u64 isrd;
-	u64 imrx;
 	u64 imrd;
 	u64 ipcx;
 	u64 ipcd;
-- 
2.13.0.219.gdb65acc882-goog

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [RFC PATCH] ASoC: Intel: sst: Delete sst_save_shim64(); saved regs are never used
  2017-05-26 16:34 [RFC PATCH] ASoC: Intel: sst: Delete sst_save_shim64(); saved regs are never used Douglas Anderson
@ 2017-05-27 16:35 ` Andy Shevchenko
  2017-05-30 16:55   ` Doug Anderson
  0 siblings, 1 reply; 3+ messages in thread
From: Andy Shevchenko @ 2017-05-27 16:35 UTC (permalink / raw)
  To: Douglas Anderson
  Cc: Mark Brown, Vinod Koul, Matthias Kaehlcke, Liam Girdwood,
	Jaroslav Kysela, Takashi Iwai, colin.king, o-takashi,
	sebastien.guiriec, ALSA Development Mailing List, linux-kernel

On Fri, May 26, 2017 at 7:34 PM, Douglas Anderson <dianders@chromium.org> wrote:
> In commit 9a075265c6dc ("ASoC: Intel: sst: Remove unused function
> sst_restore_shim64()"), we deleted the sst_restore_shim64() since it
> was never used.  ...but a quick look at the code shows that we should
> also be able to remove the sst_save_shim64() function and the
> structure members we were storing data in.
>
> Note that the saving code (and the comments talking about how
> important it is to do the save) has been around since
> commit 336cfbb05edf ("ASoC: Intel: mrfld- add ACPI module").

While I like "-" statistics, the below I think should be preserved if
it's repeating real registers layout.

>  struct sst_shim_regs64 {
> -       u64 csr;
>         u64 pisr;
>         u64 pimr;
>         u64 isrx;
>         u64 isrd;
> -       u64 imrx;
>         u64 imrd;
>         u64 ipcx;
>         u64 ipcd;

-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [RFC PATCH] ASoC: Intel: sst: Delete sst_save_shim64(); saved regs are never used
  2017-05-27 16:35 ` Andy Shevchenko
@ 2017-05-30 16:55   ` Doug Anderson
  0 siblings, 0 replies; 3+ messages in thread
From: Doug Anderson @ 2017-05-30 16:55 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Mark Brown, Vinod Koul, Matthias Kaehlcke, Liam Girdwood,
	Jaroslav Kysela, Takashi Iwai, colin.king, o-takashi,
	sebastien.guiriec, ALSA Development Mailing List, linux-kernel

Hi,

On Sat, May 27, 2017 at 9:35 AM, Andy Shevchenko
<andy.shevchenko@gmail.com> wrote:
> On Fri, May 26, 2017 at 7:34 PM, Douglas Anderson <dianders@chromium.org> wrote:
>> In commit 9a075265c6dc ("ASoC: Intel: sst: Remove unused function
>> sst_restore_shim64()"), we deleted the sst_restore_shim64() since it
>> was never used.  ...but a quick look at the code shows that we should
>> also be able to remove the sst_save_shim64() function and the
>> structure members we were storing data in.
>>
>> Note that the saving code (and the comments talking about how
>> important it is to do the save) has been around since
>> commit 336cfbb05edf ("ASoC: Intel: mrfld- add ACPI module").
>
> While I like "-" statistics, the below I think should be preserved if
> it's repeating real registers layout.
>
>>  struct sst_shim_regs64 {
>> -       u64 csr;
>>         u64 pisr;
>>         u64 pimr;
>>         u64 isrx;
>>         u64 isrd;
>> -       u64 imrx;
>>         u64 imrd;
>>         u64 ipcx;
>>         u64 ipcd;

Yup, it does seem to follow real hardware.  From the header file:

#define SST_CSR 0x00
#define SST_PISR 0x08
#define SST_PIMR 0x10
#define SST_ISRX 0x18
#define SST_ISRD 0x20
#define SST_IMRX 0x28
#define SST_IMRD 0x30
#define SST_IPCX 0x38 /* IPC IA -> SST */
#define SST_IPCD 0x40 /* IPC SST -> IA */
...

Thus, I'm happy to rework the patch to not delete the elements from
the structure.  Just for curiosity's sake, Let's see how much memory
that will waste (check how much these are used).

...umm, wait a second.  We don't even use the dang structure anymore!
So I guess an even cleaner solution is to totally delete
shim_regs64...  I'll send out a v2 with an even better diffstat and
with totally avoiding a devm allocation of a 136 byte structure.  :)

Posted a v2 here: https://patchwork.kernel.org/patch/9754923/

-Doug

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-05-30 16:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-26 16:34 [RFC PATCH] ASoC: Intel: sst: Delete sst_save_shim64(); saved regs are never used Douglas Anderson
2017-05-27 16:35 ` Andy Shevchenko
2017-05-30 16:55   ` Doug Anderson

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 NNTP newsgroup(s).