mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Russell King - ARM Linux <linux@arm.linux.org.uk>
To: Andrew Lunn <andrew@lunn.ch>
Cc: Viresh Kumar <viresh.kumar@st.com>,
	"akpm@linux-foundation.org" <akpm@linux-foundation.org>,
	"sshtylyov@mvista.com" <sshtylyov@mvista.com>,
	spear-devel <spear-devel@list.st.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-ide@vger.kernel.org" <linux-ide@vger.kernel.org>,
	"viresh.linux@gmail.com" <viresh.linux@gmail.com>,
	"mturquette@linaro.org" <mturquette@linaro.org>,
	"jgarzik@redhat.com" <jgarzik@redhat.com>,
	"linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH V2 4/9] ata/sata_mv: Remove conditional compilation of clk code
Date: Tue, 24 Apr 2012 08:42:03 +0100	[thread overview]
Message-ID: <20120424074202.GO24211@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <20120424072653.GB24089@lunn.ch>

On Tue, Apr 24, 2012 at 09:26:53AM +0200, Andrew Lunn wrote:
> On Tue, Apr 24, 2012 at 12:35:23PM +0530, Viresh Kumar wrote:
> > On 4/24/2012 12:34 PM, Andrew Lunn wrote:
> > > I don't think this change is correct. With the old semantics, it was:
> > 
> > Sorry. :(
> > 
> > > If we have CLK support, we expect there to be a clock for sata_mv, and
> > > if there is no such clock, output a notice message, something is
> > > probably wrong, i expected there to be a clock.
> > > 
> > > The new semantics are:
> > > 
> > > We expect there to be a clock for sata_mv, and if there is no such
> > > clock, output a notice message, something is probably wrong, i
> > > expected there to be a clock.
> > > 
> > > We are going to see this notice message much more, when it is not
> > > expected.
> > 
> > So, the only problem is this message?
> > How do you suggest to tackle this now. Have #ifdef,#endif around this print?
> 
> Well, adding #ifdef defeats the point of adding dummy implementations.
> 
> Maybe, rather than return -ENODEV, return -ENOTSUP.
> 
> IS_ERR() still returns true, so in most cases, no code needs
> changing. However, when you need to differentiate between, "clock does
> not exists" and "Dummy clock functions being used", you can tell the
> difference. mv_sata could look like:
> 
>         hpriv->clk = clk_get(&pdev->dev, NULL);
>         if (IS_ERR(hpriv->clk))
> 	        if (PTR_ERR(hpriv->clk) == -ENODEV)
> 		        dev_notice(&pdev->dev, "cannot get clkdev\n");
>         else
>                 clk_prepare_enable(hpriv->clk);
> 
> 
> You would however, need to look at all uses of clk_get and see if any
> are looked for ENODEV, and not just IS_ERR(), and fix those....

Why bother?

If you don't have the clk API configured, you have no clocks to control.
So, why not make clk_get() return NULL, and make the rest of the API
calls do nothing?  That's what you'll end up codifying in the drivers
anyway.

  reply	other threads:[~2012-04-24  7:42 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-24  7:04 Andrew Lunn
2012-04-24  7:05 ` Viresh Kumar
2012-04-24  7:26   ` Andrew Lunn
2012-04-24  7:42     ` Russell King - ARM Linux [this message]
2012-04-24  7:58       ` Viresh Kumar
2012-04-24  8:26         ` Russell King - ARM Linux
2012-04-24  8:30           ` Viresh Kumar
2012-04-24 12:04   ` Sergei Shtylyov
  -- strict thread matches above, loose matches on Subject: below --
2012-04-24  5:56 [PATCH V2 0/9] clk: Add non CONFIG_HAVE_CLK routines Viresh Kumar
2012-04-24  5:56 ` [PATCH V2 4/9] ata/sata_mv: Remove conditional compilation of clk code Viresh Kumar

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=20120424074202.GO24211@n2100.arm.linux.org.uk \
    --to=linux@arm.linux.org.uk \
    --cc=akpm@linux-foundation.org \
    --cc=andrew@lunn.ch \
    --cc=jgarzik@redhat.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mturquette@linaro.org \
    --cc=spear-devel@list.st.com \
    --cc=sshtylyov@mvista.com \
    --cc=viresh.kumar@st.com \
    --cc=viresh.linux@gmail.com \
    /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

all inboxes | Powered by JetHome®