EDAC: AMD8111 driver source file
Quoted 9 lines · Andrew Morton
From: Andrew Morton <[email protected]>
Subject: Re: [v1 PATCH 3/8] EDAC: AMD8111 driver source file
To: "Harry Ciao" <[email protected]>
Cc: [email protected], [email protected]
Date: Tuesday, March 10, 2009, 2:46 PM
On Mon, 9 Mar 2009 16:08:12
+0800
Harry Ciao <[email protected]>
wrote:
<snip>
Quoted 35 lines
Quoted 1 line
+static void edac_pci_write_dword(struct
pci_dev*dev,int reg, u32 val32)
Review
Quoted 4 lines
(quoted diff) +4
-0+{ + int ret; + + ret = pci_write_config_dword(dev,reg, val32);
Quoted 2 lines
+ if (ret > 0)
+ printk(KERN_ERR
AMD8111_EDAC_MOD_STRQuoted 1 line
+
" PCI Access Write Error at 0x%x\n",
reg);Review
Quoted 3 lines
(quoted diff) +3
-0+} + +static void edac_pci_write_byte(struct pci_dev *dev,int reg, u8 val8)
Review
Quoted 4 lines
(quoted diff) +4
-0+{ + int ret; + + ret = pci_write_config_byte(dev,reg, val8);
Quoted 2 lines
+ if (ret > 0)
+ printk(KERN_ERR
AMD8111_EDAC_MOD_STRQuoted 1 line
+
" PCI Access Write Error at 0x%x\n",
reg);Quoted 1 line
+}
<spends a while trying to work out what the return value of
pci_read_config_dword()means>
Quoted 5 lines
<gets frustrated and gives up>
Is it correct that all of these functions treat a +ve return value as
an error?
Yes, the config APIs do return an error code on an operation error. I found that before and during the transition to the AMD IOCF8 IO-Space config transition - the 12 bits of config space vs the 8 bits of config space and where AMD started using the PCI reserved bits to access the their extended config space.
The yet to be pushed upstream AMD64 EDAC driver required the extended config space access for the Family 10h CPUs
Now, I bracketed such error processing with #DEFINE DEBUG printouts to provide some type of signal during development of an error. This is not in the kernel yet.
I suppose these lines here are similar to provide some useless notice of an error
doug t
Quoted 50 lines · On Wed, 11 Mar 2009 11:55:36 -0700 (PDT) Doug Thompson <[email protected]> wrote:
Quoted 9 lines · Andrew Morton
From: Andrew Morton <[email protected]>
Subject: Re: [v1 PATCH 3/8] EDAC: AMD8111 driver source file
To: "Harry Ciao" <[email protected]>
Cc: [email protected], [email protected]
Date: Tuesday, March 10, 2009, 2:46 PM
On Mon,__ 9 Mar 2009 16:08:12
+0800
Harry Ciao <[email protected]>
wrote:<snip>
Quoted 35 lines
Quoted 1 line
+static void edac_pci_write_dword(struct
pci_dev*dev,int reg, u32 val32)
Review
Quoted 4 lines
(quoted diff) +4
-0+{ +______ int ret; + +______ ret = pci_write_config_dword(dev,reg, val32);
Review
Quoted 2 lines
(quoted diff) +2
-0+______ if (ret > 0) +______ ______ printk(KERN_ERR
AMD8111_EDAC_MOD_STRQuoted 1 line
+______ ______
______ " PCI Access Write Error at 0x%x\n",
reg);Review
Quoted 3 lines
(quoted diff) +3
-0+} + +static void edac_pci_write_byte(struct pci_dev *dev,int reg, u8 val8)
Review
Quoted 4 lines
(quoted diff) +4
-0+{ +______ int ret; + +______ ret = pci_write_config_byte(dev,reg, val8);
Review
Quoted 2 lines
(quoted diff) +2
-0+______ if (ret > 0) +______ ______ printk(KERN_ERR
AMD8111_EDAC_MOD_STRQuoted 1 line
+______ ______
______ " PCI Access Write Error at 0x%x\n",
reg);Quoted 1 line
+}
<spends a while trying to work out what the return value of
pci_read_config_dword()means>
Quoted 7 lines
Quoted 5 lines
<gets frustrated and gives up>
Is it correct that all of these functions treat a +ve return value as
an error?Yes, the config APIs do return an error code on an operation error.
OK, but presumably they're negative error codes, so
if (ret > 0) error()
isn't right.
<checks>
Harry has turned that into
if (ret != 0) error();
which looks better.