Skip to contentSkip to conversation

pata_cmd640: don't read CFR pointlessly

PATCH Applied Sergei Shtylyov 3 participants 5 messages May 8, 2010 – May 14, 2010 libata

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pata_cmd640: don't read CFR pointlessly

cmd640_hardware_init() reads CFR but doesn't use the value read...

---
The patch is against the recent Linus' tree.

 drivers/ata/pata_cmd640.c |    3 ---
 1 file changed, 3 deletions(-)
drivers/ata/pata_cmd640.c +0 -3
Index: linux-2.6/drivers/ata/pata_cmd640.c
===================================================================
@@ -181,13 +181,10 @@ static struct ata_port_operations cmd640
 
 static void cmd640_hardware_init(struct pci_dev *pdev)
 {
-	u8 r;
 	u8 ctrl;
 
 	/* CMD640 detected, commiserations */
 	pci_write_config_byte(pdev, 0x5B, 0x00);
-	/* Get version info */
-	pci_read_config_byte(pdev, CFR, &r);
 	/* PIO0 command cycles */
 	pci_write_config_byte(pdev, CMDTIM, 0);
 	/* 512 byte bursts (sector) */
#1 lore raw
Quoted 16 lines · Sergei Shtylyov

cmd640_hardware_init() reads CFR but doesn't use the value read...

---
The patch is against the recent Linus' tree.

  drivers/ata/pata_cmd640.c |    3 ---
  1 file changed, 3 deletions(-)

Index: linux-2.6/drivers/ata/pata_cmd640.c
===================================================================

drivers/ata/pata_cmd640.c +0 -0
@@ -181,13 +181,10 @@ static struct ata_port_operations cmd640
 

drivers/ata/pata_cmd640.c static struct ata_port_operations cmd640 · line 188

Quoted 10 lines
drivers/ata/pata_cmd640.c +0 -3
  static void cmd640_hardware_init(struct pci_dev *pdev)
  {
-	u8 r;
  	u8 ctrl;
 
  	/* CMD640 detected, commiserations */
  	pci_write_config_byte(pdev, 0x5B, 0x00);
-	/* Get version info */
-	pci_read_config_byte(pdev, CFR,&r);
  	/* PIO0 command cycles */

Agreed with this patch, but we lose some information: all that remains is an uncommented 'CFR' definition. Without the code comment, which is deleted in this patch, we have no idea what that register does. Given that the chipset docs are not public AFAIK, this is a net loss of information about this chipset, IMO.

Maybe revise this patch, or add a second patch, which adds a comment where 'CFR' is defined? Something as simple as "/* version info */" would be sufficient.

Jeff

#2 lore raw

Hello.

Quoted 21 lines · Jeff Garzik
Quoted 21 lines

cmd640_hardware_init() reads CFR but doesn't use the value read...

---
The patch is against the recent Linus' tree.

  drivers/ata/pata_cmd640.c |    3 ---
  1 file changed, 3 deletions(-)

Index: linux-2.6/drivers/ata/pata_cmd640.c
===================================================================

drivers/ata/pata_cmd640.c +0 -1
@@ -181,13 +181,10 @@ static struct ata_port_operations cmd640
 
  static void cmd640_hardware_init(struct pci_dev *pdev)
  {
-    u8 r;
      u8 ctrl;
 
Quoted 7 lines

drivers/ata/pata_cmd640.c static struct ata_port_operations cmd640 · line 188

Quoted 5 lines
drivers/ata/pata_cmd640.c +0 -2
      /* CMD640 detected, commiserations */
      pci_write_config_byte(pdev, 0x5B, 0x00);
-    /* Get version info */
-    pci_read_config_byte(pdev, CFR,&r);
      /* PIO0 command cycles */

Agreed with this patch, but we lose some information: all that remains is an uncommented 'CFR' definition. Without the code comment, which is deleted in this patch, we have no idea what that register does.

It does several different things.

Quoted 1 line

Given that the chipset docs are not public AFAIK,

They were public once. And I think I've given you that spec along
with other PCI-64x specs for publishing on gkernel.sourceforge.net/specs/ already (can't open sii/cmd64x-specs.tar.bz2 now to check).

Quoted 3 lines

this is a net loss of information about this chipset, IMO.

Maybe revise this patch, or add a second patch, which adds a comment where 'CFR' is defined? Something as simple as "/* version info */" would be sufficient.

That wouldn't be a good description. The "official" name of the
register is configuration register.

Quoted 1 line

Jeff

WBR, Sergei

#3 lore raw
Quoted 3 lines · Sergei Shtylyov

They were public once. And I think I've given you that spec along with other PCI-64x specs for publishing on gkernel.sourceforge.net/specs/ already (can't open sii/cmd64x-specs.tar.bz2 now to check).

Based on this, I retract my comment. Will apply patch as-is.

cmd64x-specs.tar was missing from my local doc archive, and I naively assumed everything in my public doc archive (gkernel.sf.net/specs/) was also stored locally.

Jeff