summaryrefslogtreecommitdiffstats
path: root/src/drivers/net
diff options
context:
space:
mode:
authorMichael Brown2017-03-23 16:35:10 +0100
committerMichael Brown2017-03-23 16:43:13 +0100
commit19d3e966d9ee535fc89e8fa26737cc133882ae1c (patch)
treeefc66e0d9fc2cb1d10f888e952224d770bf0d747 /src/drivers/net
parent[golan] Bug fixes and improved paging allocation method (diff)
downloadipxe-19d3e966d9ee535fc89e8fa26737cc133882ae1c.tar.gz
ipxe-19d3e966d9ee535fc89e8fa26737cc133882ae1c.tar.xz
ipxe-19d3e966d9ee535fc89e8fa26737cc133882ae1c.zip
[pcnet32] Eliminate redundant register read
The value of ( ( x & 0x0c00 ) | 0x0c00 ) is always 0x0c00 regardless of the value of x, and so the read_csr() is redundant. (There are no read side effects for this register, according to the datasheet.) This line of code originated in Linux kernel 2.3.19pre1 as a->write_csr(ioaddr, 80, a->read_csr(ioaddr, 80) | 0x0c00); and was modified in kernel 2.3.41pre4 to read a->write_csr(ioaddr, 80, (a->read_csr(ioaddr, 80) & 0x0C00) | 0x0c00); In the absence of commit messages, the intention of the code is unclear. However, the logic resulting in a fixed value of 0x0c00 has remained unaltered for over 17 years, and can probably be assumed to have the correct overall result. Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/drivers/net')
-rw-r--r--src/drivers/net/pcnet32.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/drivers/net/pcnet32.c b/src/drivers/net/pcnet32.c
index 26633a24..2635aaca 100644
--- a/src/drivers/net/pcnet32.c
+++ b/src/drivers/net/pcnet32.c
@@ -414,8 +414,7 @@ pcnet32_chip_detect ( struct pcnet32_private *priv )
if (fset) {
a->write_bcr ( ioaddr, 18,
( a->read_bcr ( ioaddr, 18 ) | 0x0860 ) );
- a->write_csr ( ioaddr, 80,
- ( a->read_csr ( ioaddr, 80 ) & 0x0C00) | 0x0C00 );
+ a->write_csr ( ioaddr, 80, 0x0c00 );
}
priv->full_duplex = fdx;