linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Adam J. Richter" <adam@yggdrasil.com>
To: htejun@gmail.com, jgarzik@pobox.com
Cc: linux-ide@vger.kernel.org
Subject: Patch: slight shrink of vt6421_init_addrs()
Date: Fri, 16 Feb 2007 19:46:56 +0800	[thread overview]
Message-ID: <20070216194656.A4375@freya> (raw)

[-- Attachment #1: Type: text/plain, Size: 1163 bytes --]

Hi Tejun and Jeff,

	The discussion about the vt6421 problems caused me to glance
at the code and try a very minor clean-up to vt6421_init_addrs().
Please note that I don't have a vt6421, so this patch is UNTESTED.
The patch does two things:

	1. Elminate the bmdma_addr variable, which was only used once,
	   in an assignment to a field also named bmdma_addr.  So having
	   a separate variable served no documentary purpose.  This change
	   causes the value to be computed a little later, so please make
	   sure that that is OK.  The effect is just to make the source
	   code one line smaller.  The binary size is unchanged by this
	   modification, at least on my x86 configuration, which has
	   SMP and lots of debugging options activated.

	2. Add a variable ata_ports, to replace the six times the
	   same value appeared to be computed.  I assume the compiler
	   was smart enough to avoid most of the recomputation, but
	   this change shrinks the .text by 7 bytes in my configuration,
	   makes the routine more readable and reduces opportunities for
	   typos.

	If it looks OK to everyone, please forward it upstream as
appropriate.

Adam Richter

[-- Attachment #2: vt6421.patch --]
[-- Type: text/plain, Size: 1104 bytes --]

--- drivers/ata/sata_via.c.tejun	2007-02-16 19:16:40.000000000 +0800
+++ drivers/ata/sata_via.c	2007-02-16 19:23:45.000000000 +0800
@@ -406,18 +406,18 @@
 static void vt6421_init_addrs(struct ata_probe_ent *probe_ent,
 			      void __iomem * const *iomap, unsigned int port)
 {
 	void __iomem *reg_addr = iomap[port];
-	void __iomem *bmdma_addr = iomap[4] + (port * 8);
+	struct ata_ioports *ata_ports = &probe_ent->port[port];
 
-	probe_ent->port[port].cmd_addr = reg_addr;
-	probe_ent->port[port].altstatus_addr =
-	probe_ent->port[port].ctl_addr = (void __iomem *)
+	ata_ports->cmd_addr = reg_addr;
+	ata_ports->altstatus_addr =
+	ata_ports->ctl_addr = (void __iomem *)
 		((unsigned long)(reg_addr + 8) | ATA_PCI_CTL_OFS);
-	probe_ent->port[port].bmdma_addr = bmdma_addr;
-	probe_ent->port[port].scr_addr = vt6421_scr_addr(iomap[5], port);
+	ata_ports->bmdma_addr = iomap[4] + (port * 8);
+	ata_ports->scr_addr = vt6421_scr_addr(iomap[5], port);
 
-	ata_std_ports(&probe_ent->port[port]);
+	ata_std_ports(ata_ports);
 }
 
 static struct ata_probe_ent *vt6420_init_probe_ent(struct pci_dev *pdev)
 {

             reply	other threads:[~2007-02-16 12:43 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-16 11:46 Adam J. Richter [this message]
2007-02-23 10:30 ` Patch: slight shrink of vt6421_init_addrs() Jeff Garzik
2007-02-24  0:23   ` Adam J. Richter
  -- strict thread matches above, loose matches on Subject: below --
2007-02-16 11:52 Adam J. Richter

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=20070216194656.A4375@freya \
    --to=adam@yggdrasil.com \
    --cc=htejun@gmail.com \
    --cc=jgarzik@pobox.com \
    --cc=linux-ide@vger.kernel.org \
    /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).