[17/86] pata_efar: fix register naming used in efar_set_piomode()

Submitted by Bartlomiej Zolnierkiewicz on Nov. 25, 2009, 5:04 p.m.

Details

Message ID 20091125170422.5446.10637.sendpatchset@localhost
State Not Applicable
Delegated to: David Miller
Headers show

Commit Message

Bartlomiej Zolnierkiewicz Nov. 25, 2009, 5:04 p.m.
From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Subject: [PATCH] pata_efar: fix register naming used in efar_set_piomode()

Rename 'idetm_port' and 'idetm_data' variables to 'master_port'
and 'master_data' respectively to match register naming used in
efar_set_dma_mode() and in ata_piix.c.

Fix efar_set_piomode() documentation and 'master_port' type
while at it.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
 drivers/ata/pata_efar.c |   22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Alan Cox Nov. 25, 2009, 5:25 p.m.
> Rename 'idetm_port' and 'idetm_data' variables to 'master_port'
> and 'master_data' respectively to match register naming used in
> efar_set_dma_mode() and in ata_piix.c.

Probably better to do the reverse to match the docs ?

> -	u16 idetm_data;
> +	u8 master_port		= ap->port_no ? 0x42 : 0x40;
> +	u16 master_data;

Please don't drop undocumented type changes in. And btw it uses unsigned
int here as all over the kernel because it produced better code in many
cases

These patches seem to spend a lot of time renaming everything in drivers
which is usually pointless churn (eg the atp grand renaming), but the bug
fixes all look good
--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Bartlomiej Zolnierkiewicz Nov. 25, 2009, 5:32 p.m.
On Wednesday 25 November 2009 06:25:41 pm Alan Cox wrote:
> > Rename 'idetm_port' and 'idetm_data' variables to 'master_port'
> > and 'master_data' respectively to match register naming used in
> > efar_set_dma_mode() and in ata_piix.c.
> 
> Probably better to do the reverse to match the docs ?

It just matches ata_piix.c code currently.

> > -	u16 idetm_data;
> > +	u8 master_port		= ap->port_no ? 0x42 : 0x40;
> > +	u16 master_data;
> 
> Please don't drop undocumented type changes in. And btw it uses unsigned

Oh, I forgot to document it in this patch.  Others should have it documented.

[ Will fix later. ]

> int here as all over the kernel because it produced better code in many
> cases

Better code is smaller code in this situation and this is clearly minor
issue anyway (since the code is not performance critical having cleaner
code wins over).

> These patches seem to spend a lot of time renaming everything in drivers

It just prepares the code for unification of code programming PIO and MWDMA
methods, see patch #18.

--
Bartlomiej Zolnierkiewicz
--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch hide | download patch | download mbox

Index: b/drivers/ata/pata_efar.c
===================================================================
--- a/drivers/ata/pata_efar.c
+++ b/drivers/ata/pata_efar.c
@@ -71,7 +71,7 @@  static int efar_cable_detect(struct ata_
 /**
  *	efar_set_piomode - Initialize host controller PATA PIO timings
  *	@ap: Port whose timings we are configuring
- *	@adev: um
+ *	@adev: Device to program
  *
  *	Set PIO mode for device, in host controller PCI config space.
  *
@@ -83,8 +83,8 @@  static void efar_set_piomode (struct ata
 {
 	unsigned int pio	= adev->pio_mode - XFER_PIO_0;
 	struct pci_dev *dev	= to_pci_dev(ap->host->dev);
-	unsigned int idetm_port= ap->port_no ? 0x42 : 0x40;
-	u16 idetm_data;
+	u8 master_port		= ap->port_no ? 0x42 : 0x40;
+	u16 master_data;
 	int control = 0;
 
 	/*
@@ -107,20 +107,20 @@  static void efar_set_piomode (struct ata
 	if (adev->class == ATA_DEV_ATA)
 		control |= 4;	/* PPE */
 
-	pci_read_config_word(dev, idetm_port, &idetm_data);
+	pci_read_config_word(dev, master_port, &master_data);
 
 	/* Set PPE, IE, and TIME as appropriate */
 	if (adev->devno == 0) {
-		idetm_data &= 0xCCF0;
-		idetm_data |= control;
-		idetm_data |= (timings[pio][0] << 12) |
+		master_data &= 0xCCF0;
+		master_data |= control;
+		master_data |= (timings[pio][0] << 12) |
 			(timings[pio][1] << 8);
 	} else {
 		int shift = 4 * ap->port_no;
 		u8 slave_data;
 
-		idetm_data &= 0xFF0F;
-		idetm_data |= (control << 4);
+		master_data &= 0xFF0F;
+		master_data |= (control << 4);
 
 		/* Slave timing in separate register */
 		pci_read_config_byte(dev, 0x44, &slave_data);
@@ -129,8 +129,8 @@  static void efar_set_piomode (struct ata
 		pci_write_config_byte(dev, 0x44, slave_data);
 	}
 
-	idetm_data |= 0x4000;	/* Ensure SITRE is set */
-	pci_write_config_word(dev, idetm_port, idetm_data);
+	master_data |= 0x4000;	/* Ensure SITRE is set */
+	pci_write_config_word(dev, master_port, master_data);
 }
 
 /**