All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paul Mundt <lethal@linux-sh.org>
To: linux-sh@vger.kernel.org
Subject: Re: [PATCH v2] ARM: mach-shmobile: ap4evb: add fsib 44100Hz rate fixup
Date: Tue, 16 Nov 2010 08:48:26 +0000	[thread overview]
Message-ID: <20101116084826.GC1330@linux-sh.org> (raw)
In-Reply-To: <w3pd3wmt65q.wl%kuninori.morimoto.gx@renesas.com>

On Tue, Nov 16, 2010 at 04:34:34PM +0900, Kuninori Morimoto wrote:
> FSIDIVB is used when HDMI sound is 48kHz,
> but it should be disabled when 44.1kHz.
> And fsidiv_set_rate do that if selected rate is same as parent rate.
> This patch select parent rate to fdiv_clk when 44.1kHz
> 
Ok, now that I now what this is doing, this is also totally bogus.

You have hard-coded some bizzare enable/disable logic in the middle of
the ->set_rate() op that completely blindsides the refcounting. This
might be ok in practice since you probably only have 1 user of the clock
at the moment, but consider what would happen if you had 2 users and one
just happens to randomly turn the clock off on the other. We do
refcounting and API abstraction for a reason. Any time you are deviating
from the API, you are probably doing something wrong.

Furthermore, what does any of this have to do with rate setting? And if
it has nothing to do with rate setting, why would you bother adding it to
the ->set_rate op?

Disabling of the parent clock will happen automatically by the clock
framework when the refcount on it drops. Disabling of the sibling clock
will happen automatically when its refcount drops, too. It seems that all
of your use cases here can be fixed up by simply using proper
clk_get/put() and enable/disable() refcounting.

It is never acceptable to bypass the refcount, under any situation.

      parent reply	other threads:[~2010-11-16  8:48 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-24  1:55 [PATCH v2] ARM: mach-shmobile: ap4evb: Add FSI2 support Kuninori Morimoto
2010-05-24  3:49 ` Magnus Damm
2010-05-24  5:32 ` Kuninori Morimoto
2010-11-16  7:34 ` [PATCH v2] ARM: mach-shmobile: ap4evb: add fsib 44100Hz rate fixup Kuninori Morimoto
2010-11-16  8:48 ` Paul Mundt [this message]

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=20101116084826.GC1330@linux-sh.org \
    --to=lethal@linux-sh.org \
    --cc=linux-sh@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.