linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Anton Vorontsov <avorontsov@ru.mvista.com>
To: Mark Ware <mware@elphinstone.net>
Cc: Scott Wood <scottwood@freescale.com>,
	Linuxppc-dev Development <linuxppc-dev@ozlabs.org>
Subject: Re: [PATCH v2] cpm2_pic: Allow correct flow_types for port C interrupts
Date: Thu, 10 Dec 2009 00:53:34 +0300	[thread overview]
Message-ID: <20091209215334.GA536@oksana.dev.rtsoft.ru> (raw)
In-Reply-To: <4B1EF3E9.8050005@elphinstone.net>

On Wed, Dec 09, 2009 at 11:48:41AM +1100, Mark Ware wrote:
> Port C interrupts can be either falling edge, or either edge.
> Other external interrupts are either falling edge or active low.
> 
> Signed-Off-By: Mark Ware <mware@elphinstone.net>

Looks correct (checked with 8272 and 8555 specs).

Reviewed-by: Anton Vorontsov <avorontsov@ru.mvista.com>


Cosmetic nitpicks below. I tend to think they don't desire
another resend, but I couldn't resist making them anyway. ;-)

[...]
> +	if (src >= CPM2_IRQ_PORTC15 && src <= CPM2_IRQ_PORTC0) {
> +		if (flow_type == IRQ_TYPE_NONE)
> +			flow_type = IRQ_TYPE_EDGE_BOTH;
> +
> +		if ((flow_type != IRQ_TYPE_EDGE_BOTH) && 
> +			(flow_type != IRQ_TYPE_EDGE_FALLING)) {

I'd place one more tab here. And parenthesis aren't actually needed.

> +			printk(KERN_ERR "CPM2 PIC: sense type 0x%x not supported\n",
> +				flow_type);
> +			return -EINVAL;
> +		}
> +	} else {
> +		if (flow_type == IRQ_TYPE_NONE)
> +			flow_type = IRQ_TYPE_LEVEL_LOW;
> +
> +		if (flow_type & (IRQ_TYPE_EDGE_RISING | IRQ_TYPE_LEVEL_HIGH)) {
> +			printk(KERN_ERR "CPM2 PIC: sense type 0x%x not supported\n",
> +				flow_type);

pr_err is shorter. Also, this message is duplicated. Would be better
to do something like:

	if (somethingwrong)
		goto err_sense;
	...
	return 0;

err_sense:
	pr_err("CPM2 PIC: sense type 0x%x not supported\n", flow_type);
	return -EINVAL;
}

Or we may don't print any errors at all. For internal interrupts
we don't print them anyway, i.e. the current code has just

	return (flow_type & IRQ_TYPE_LEVEL_LOW) ? 0 : -EINVAL;

Thanks,

-- 
Anton Vorontsov
email: cbouatmailru@gmail.com
irc://irc.freenode.net/bd2

  parent reply	other threads:[~2009-12-09 21:53 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-09  0:48 [PATCH v2] cpm2_pic: Allow correct flow_types for port C interrupts Mark Ware
2009-12-09 20:43 ` Kumar Gala
2009-12-09 21:53 ` Anton Vorontsov [this message]
2009-12-09 21:57   ` Scott Wood
2009-12-10 11:10     ` Mark Ware

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=20091209215334.GA536@oksana.dev.rtsoft.ru \
    --to=avorontsov@ru.mvista.com \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=mware@elphinstone.net \
    --cc=scottwood@freescale.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).