linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Russell King - ARM Linux <linux@arm.linux.org.uk>
To: Barry Song <Barry.Song@csr.com>
Cc: alan@linux.intel.com, workgroup.linux@csr.com,
	linux-arm-kernel@lists.infradead.org,
	linux-serial@vger.kernel.org, Barry Song <Baohua.Song@csr.com>
Subject: Re: [PATCH] seria: sirf: only use lookup table to set baudrate when ioclk=150MHz
Date: Wed, 26 Dec 2012 15:04:33 +0000	[thread overview]
Message-ID: <20121226150433.GB24604@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <1356431162-8372-1-git-send-email-Barry.Song@csr.com>

On Tue, Dec 25, 2012 at 06:26:02PM +0800, Barry Song wrote:
> @@ -375,7 +375,12 @@ static void sirfsoc_uart_set_termios(struct uart_port *port,
>  	int		threshold_div;
>  	int		temp;
>  
> -	ioclk_rate = 150000000;
> +	struct clk *clk = clk_get_sys("io", NULL);
> +	BUG_ON(IS_ERR(clk));

No.  Really, no.  Stop using BUG_ON() as some kind of crappy assert().
BUG_ON() takes the entire kernel out when it fails.  There's absolutely
no need for this what so ever - especially here.

Get the clock at probe or port initialization time.  Save that pointer.
Only give it up when the port is torn down.  And treat it as any other
clock - prepare and enable it, and disable and unprepare it when you're
done with it.

And there's no need to use this clk_get_sys() crap in drivers.  Add the
necessary clkdev entries or deal with it in DT.  Absolutely do not use
clk_get_sys() in drivers; it's there for *PLATFORM* code to use when
there's no other possibility for them and NOT drivers.

  parent reply	other threads:[~2012-12-26 15:06 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-25 10:26 [PATCH] seria: sirf: only use lookup table to set baudrate when ioclk=150MHz Barry Song
2012-12-25 18:53 ` Sergei Shtylyov
2012-12-26 15:04 ` Russell King - ARM Linux [this message]
2012-12-31  2:02   ` Barry Song

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=20121226150433.GB24604@n2100.arm.linux.org.uk \
    --to=linux@arm.linux.org.uk \
    --cc=Baohua.Song@csr.com \
    --cc=Barry.Song@csr.com \
    --cc=alan@linux.intel.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=workgroup.linux@csr.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;
as well as URLs for NNTP newsgroup(s).