mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Patrick Gefre <pfg@sgi.com>
Cc: Christoph Hellwig <hch@infradead.org>,
	linux-kernel@vger.kernel.org, matthew@wil.cx,
	B.Zolnierkiewicz@elka.pw.edu.pl
Subject: Re: [PATCH] Altix : ioc4 serial driver support
Date: Mon, 7 Feb 2005 16:25:25 +0000	[thread overview]
Message-ID: <20050207162525.GA15926@infradead.org> (raw)
In-Reply-To: <42079029.5040401@sgi.com>

On Mon, Feb 07, 2005 at 09:58:33AM -0600, Patrick Gefre wrote:
> Latest version with review mods:
> ftp://oss.sgi.com/projects/sn2/sn2-update/033-ioc4-support


 - still not __iomem annotations.
 - still a ->remove method

more comments (mostly nipicks I missed last time, nothing too exciting):


+#define DEVICE_NAME_DYNAMIC "ttyIOC0"	/* need full name for misc_register */

this one is completely unused.

+#define PENDING(_p)	readl(&(_p)->ip_mem->sio_ir) & _p->ip_ienb

probably wants some braces around the macro body

+static struct ioc4_port *get_ioc4_port(struct uart_port *the_port)
+{
+	struct ioc4_control *control = dev_get_drvdata(the_port->dev);
+	int ii;
+
+	if (control) {
+		for ( ii = 0; ii < IOC4_NUM_SERIAL_PORTS; ii++ ) {
+			if (!control->ic_port[ii].icp_port)
+				continue;
+			if (the_port == control->ic_port[ii].icp_port->ip_port)
+				return control->ic_port[ii].icp_port;
+		}
+	}
+	return (struct ioc4_port *)0;

just return NULL here.

+static irqreturn_t ioc4_intr(int irq, void *arg, struct pt_regs *regs)
+{
+	struct ioc4_soft *soft;
+	uint32_t this_ir, this_mir;
+	int xx, num_intrs = 0;
+	int intr_type;
+	int handled = 0;
+	struct ioc4_intr_info *ii;
+
+	soft = (struct ioc4_soft *)arg;
+	if (!soft)
+		return IRQ_NONE;	/* Polled but no ioc4 registered */

no need to cast.  and it can't be NULL either.

+	spin_lock_irqsave(&port->ip_lock, port_flags);
+	wake_up_interruptible(&info->delta_msr_wait);
+	spin_unlock_irqrestore(&port->ip_lock, port_flags);

no need to lock around a wake_up()

+	/* Start up the serial port */
+	spin_lock_irqsave(&port->ip_lock, port_flags);
+	retval = ic4_startup_local(the_port);
+	if (retval) {
+		spin_unlock_irqrestore(&port->ip_lock, port_flags);
+		return retval;
+	}
+	spin_unlock_irqrestore(&port->ip_lock, port_flags);
+	return 0;

what about just

	spin_lock_irqsave(&port->ip_lock, port_flags);
	retval = ic4_startup_local(the_port);
	spin_unlock_irqrestore(&port->ip_lock, port_flags);
	return reval;

?
	
+	struct ioc4_port *port = get_ioc4_port(the_port);
+	unsigned long port_flags;
+
+	spin_lock_irqsave(&port->ip_lock, port_flags);
+	ioc4_change_speed(the_port, termios, old_termios);
+	spin_unlock_irqrestore(&port->ip_lock, port_flags);
+	return;

no need for empty returns at the end of void functions

+static struct uart_driver ioc4_uart = {
+	.owner		= THIS_MODULE,
+	.driver_name	= "ioc4_serial",
+	.dev_name	= DEVICE_NAME,
+	.major		= DEVICE_MAJOR,
+	.minor		= DEVICE_MINOR,
+	.nr		= IOC4_NUM_CARDS * IOC4_NUM_SERIAL_PORTS,
+	.cons		= NULL,
+};

no need to initialize .cons to zero, the compiler does that for you.

+	if ( !request_region(tmp_addr, sizeof(struct ioc4_mem), "sioc4_mem")) {

superflous space before the !

+	if (!request_irq(pdev->irq, ioc4_intr, SA_SHIRQ,
+				"sgi-ioc4serial", (void *)soft)) {
+		control->ic_irq = pdev->irq;
+	} else {
+		printk(KERN_WARNING
+		    "%s : request_irq fails for IRQ 0x%x\n ",
+			__FUNCTION__, pdev->irq);
+	}

Can the driver work without an irq?


  reply	other threads:[~2005-02-07 16:26 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-12-22  0:28 [PATCH] 2.6.10 " Pat Gefre
2004-12-22 13:44 ` Christoph Hellwig
2004-12-22 14:03   ` Russell King
2004-12-22 15:20     ` Patrick Gefre
2004-12-22 18:49       ` Russell King
2004-12-22 19:53   ` Patrick Gefre
2004-12-22 20:33     ` Matthew Wilcox
2005-01-03 14:09     ` Christoph Hellwig
2005-01-31 22:45       ` [PATCH] " Pat Gefre
2005-02-01  9:23         ` Christoph Hellwig
2005-02-02 20:36           ` Patrick Gefre
2005-02-02 21:37             ` Bartlomiej Zolnierkiewicz
2005-02-02 21:57             ` Christoph Hellwig
2005-02-07 15:58               ` Patrick Gefre
2005-02-07 16:25                 ` Christoph Hellwig [this message]
2005-02-08 16:52                   ` Patrick Gefre
2005-02-08 19:32                     ` Patrick Gefre
2005-02-10 19:09                     ` Jesse Barnes
2005-02-10 19:15                       ` Christoph Hellwig
2005-02-10 21:07                         ` Patrick Gefre
2005-02-17 21:55                           ` Patrick 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=20050207162525.GA15926@infradead.org \
    --to=hch@infradead.org \
    --cc=B.Zolnierkiewicz@elka.pw.edu.pl \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matthew@wil.cx \
    --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

all inboxes | Powered by JetHome®