From: Andrew Morton <akpm@osdl.org>
To: Pat Gefre <pfg@sgi.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] 2.6 Altix : rs422 support for ioc4 serial driver
Date: Fri, 17 Mar 2006 18:13:05 -0800 [thread overview]
Message-ID: <20060317181305.2d007447.akpm@osdl.org> (raw)
In-Reply-To: <200603171938.k2HJcTDU007298@fsgi900.americas.sgi.com>
Pat Gefre <pfg@sgi.com> wrote:
>
> This patch adds rs422 support to the Altix ioc4 serial driver.
>
> +
> +#define PORT_IS_ACTIVE(_x, _y) ((_x->ip_flags & PORT_ACTIVE) \
> + && (_x->ip_port == _y))
> +
- Forgets to parenthesise macro args
- Evaluates args multiple times
- ugleeeee
This:
/*
* Nice comment goes here
*/
static inline int port_is_active(struct ioc4_port *current_port,
struct ioc4_port *my_port)
{
...
}
Is more pleasing, no?
> + if (port && PORT_IS_ACTIVE(port, the_port)) {
And in every case the test for port==NULL can be folded into port_is_active().
> +int ioc4_serial_remove_one(struct ioc4_driver_data *idd)
Should have static scope.
> +{
> + int ii, jj;
> + struct ioc4_control *control;
> + struct uart_port *the_port;
> + struct ioc4_port *port;
> + struct ioc4_soft *soft;
> +
> + control = idd->idd_serial_data;
> +
> + for (ii = 0; ii < IOC4_NUM_SERIAL_PORTS; ii++) {
> + for (jj = UART_PORT_MIN; jj < UART_PORT_COUNT; jj++) {
> + the_port = &control->ic_port[ii].icp_uart_port[jj];
> + if (the_port) {
> + switch (jj) {
> + case UART_PORT_RS422:
> + uart_remove_one_port(&ioc4_uart_rs422,
> + the_port);
> + break;
> + default:
> + case UART_PORT_RS232:
> + uart_remove_one_port(&ioc4_uart_rs232,
> + the_port);
> + break;
> + }
> + }
> + }
> + port = control->ic_port[ii].icp_port;
> + if (!(ii & 1) && port) {
> + pci_free_consistent(port->ip_pdev,
> + TOTAL_RING_BUF_SIZE,
> + (void *)port->ip_cpu_ringbuf,
> + port->ip_dma_ringbuf);
> + kfree(port);
> + }
> + }
Choosing more meaningful identifiers than `ii' and `jj' would help
understandability here.
> + free_irq(control->ic_irq, (void *)soft);
The typecast is unneeded.
next prev parent reply other threads:[~2006-03-18 2:15 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-03-17 19:38 Pat Gefre
2006-03-18 2:13 ` Andrew Morton [this message]
2006-03-22 22:14 ` Pat Gefre
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=20060317181305.2d007447.akpm@osdl.org \
--to=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pfg@sgi.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
Powered by JetHome