From: Vinod Koul <vinod.koul@intel.com>
To: Takashi Iwai <tiwai@suse.de>
Cc: liam.r.girdwood@linux.intel.com, patches.audio@intel.com,
alsa-devel@alsa-project.org, broonie@kernel.org,
Jeeja KP <jeeja.kp@intel.com>
Subject: Re: [PATCH v2 1/3] ALSA: hdac: add link pm and ref counting
Date: Mon, 9 May 2016 13:28:23 +0530 [thread overview]
Message-ID: <20160509075823.GB2274@localhost> (raw)
In-Reply-To: <s5hvb2nrax3.wl-tiwai@suse.de>
On Mon, May 09, 2016 at 08:40:56AM +0200, Takashi Iwai wrote:
> > > * @gtscap: gts capabilities pointer
> > > * @drsmcap: dma resume capabilities pointer
> > > * @hlink_list: link list of HDA links
> > > + * @lock: lock for link mgmt
> > > + * @cmd_io: state of cmd_io
> > > */
> > > struct hdac_ext_bus {
> > > struct hdac_bus bus;
> > > @@ -27,6 +29,9 @@ struct hdac_ext_bus {
> > > void __iomem *drsmcap;
> > >
> > > struct list_head hlink_list;
> > > +
> > > + struct mutex lock;
> > > + int cmd_io;
>
> It'd be better to put some comments what the flag means.
> Also, a bool would be clearer.
Well we do have comment that it means state of cmd_io but yes we can make it
clearer by explicitly saying the state of cmd DMAs CORB and RIRB
I will make it a bool
> > > +int snd_hdac_ext_bus_link_put(struct hdac_ext_bus *ebus,
> > > + struct hdac_ext_link *link)
> > > +{
> > > + int ret = 0, state = 0;
> > > + struct hdac_ext_link *hlink = NULL;
>
> Why initializing hlink?
Not required :)
> > > + /*
> > > + * if we move from 1 to 0, count will be 0
> > > + * so power down this link as well
> > > + */
> > > + if (--link->ref_count == 0) {
> > > + ret = snd_hdac_ext_bus_link_power_down(link);
> > > +
> > > + /*
> > > + * now check if all links are off, if so turn off
> > > + * cmd dma as well
> > > + */
> > > + list_for_each_entry(hlink, &ebus->hlink_list, list) {
> > > + if (hlink->ref_count)
> > > + state++;
> > > + }
>
> Basically you can break at the first match. But it's supposed to be a
> relatively short list, so no performance impact should be seen.
> So, take micro-optimization only if it's simple enough.
No not in this case, we are scanning the state of all links to see if they
are on or not and turning off DMAs when all the links are off, so we can't
break at first match in this case.
Yes for other places where we find a link, first match break will help, I
will check that
Thanks
--
~Vinod
next prev parent reply other threads:[~2016-05-09 7:52 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-05 6:01 [PATCH v2 0/3] ASoC: Intel: Skylake: Add HDA link management Vinod Koul
2016-05-05 6:01 ` [PATCH v2 1/3] ALSA: hdac: add link pm and ref counting Vinod Koul
2016-05-09 4:41 ` Vinod Koul
2016-05-09 6:40 ` Takashi Iwai
2016-05-09 7:58 ` Vinod Koul [this message]
2016-05-09 8:10 ` Takashi Iwai
2016-05-09 8:24 ` Vinod Koul
2016-05-05 6:01 ` [PATCH v2 2/3] ASoC: Intel: Skylake: add link management Vinod Koul
2016-05-05 6:01 ` [PATCH v2 3/3] ASoC: hdac_hdmi: " Vinod Koul
2016-05-13 12:26 ` Applied "ASoC: hdac_hdmi: add link management" to the asoc tree Mark Brown
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=20160509075823.GB2274@localhost \
--to=vinod.koul@intel.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=jeeja.kp@intel.com \
--cc=liam.r.girdwood@linux.intel.com \
--cc=patches.audio@intel.com \
--cc=tiwai@suse.de \
/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 NNTP newsgroup(s).