public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] pata_marvell: switch to pci_iomap as Jeff asked
@ 2006-10-18 17:25 Alan Cox
  2006-10-21 19:51 ` Jeff Garzik
  0 siblings, 1 reply; 3+ messages in thread
From: Alan Cox @ 2006-10-18 17:25 UTC (permalink / raw)
  To: akpm, jgarzik, linux-kernel

Signed-off-by: Alan Cox <alan@redhat.com>

diff -u --new-file --recursive --exclude-from /usr/src/exclude linux.vanilla-2.6.19-rc2-mm1/drivers/ata/pata_marvell.c linux-2.6.19-rc2-mm1/drivers/ata/pata_marvell.c
--- linux.vanilla-2.6.19-rc2-mm1/drivers/ata/pata_marvell.c	2006-10-18 13:51:02.000000000 +0100
+++ linux-2.6.19-rc2-mm1/drivers/ata/pata_marvell.c	2006-10-18 13:56:55.000000000 +0100
@@ -20,7 +20,7 @@
 #include <linux/ata.h>
 
 #define DRV_NAME	"pata_marvell"
-#define DRV_VERSION	"0.0.4t"
+#define DRV_VERSION	"0.0.5t"
 
 /**
  *	marvell_pre_reset	-	check for 40/80 pin
@@ -39,18 +39,17 @@
 
 	/* Check if our port is enabled */
 
-	bar5 = pci_resource_start(pdev, 5);
-	barp = ioremap(bar5, 0x10);
+	barp = pci_ioremap(pdev, 5, 0x10);
 	if (barp == NULL)
 		return -ENOMEM;
 	printk("BAR5:");
 	for(i = 0; i <= 0x0F; i++)
 		printk("%02X:%02X ", i, readb(barp + i));
 	printk("\n");
-
+	
 	devices = readl(barp + 0x0C);
-	iounmap(barp);
-
+	pci_iounmap(pdev, barp);
+	
 	if (pdev->device == 0x6145 && ap->port_no == 0 && !(devices & 0x10))	/* PATA enable ? */
 		return -ENOENT;
 


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] pata_marvell: switch to pci_iomap as Jeff asked
  2006-10-18 17:25 [PATCH] pata_marvell: switch to pci_iomap as Jeff asked Alan Cox
@ 2006-10-21 19:51 ` Jeff Garzik
  2006-10-22 19:51   ` Alan Cox
  0 siblings, 1 reply; 3+ messages in thread
From: Jeff Garzik @ 2006-10-21 19:51 UTC (permalink / raw)
  To: Alan Cox; +Cc: akpm, linux-kernel

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

Alan Cox wrote:
> Signed-off-by: Alan Cox <alan@redhat.com>
> 
> diff -u --new-file --recursive --exclude-from /usr/src/exclude linux.vanilla-2.6.19-rc2-mm1/drivers/ata/pata_marvell.c linux-2.6.19-rc2-mm1/drivers/ata/pata_marvell.c
> --- linux.vanilla-2.6.19-rc2-mm1/drivers/ata/pata_marvell.c	2006-10-18 13:51:02.000000000 +0100
> +++ linux-2.6.19-rc2-mm1/drivers/ata/pata_marvell.c	2006-10-18 13:56:55.000000000 +0100
> @@ -20,7 +20,7 @@
>  #include <linux/ata.h>
>  
>  #define DRV_NAME	"pata_marvell"
> -#define DRV_VERSION	"0.0.4t"
> +#define DRV_VERSION	"0.0.5t"
>  
>  /**
>   *	marvell_pre_reset	-	check for 40/80 pin
> @@ -39,18 +39,17 @@
>  
>  	/* Check if our port is enabled */
>  
> -	bar5 = pci_resource_start(pdev, 5);
> -	barp = ioremap(bar5, 0x10);
> +	barp = pci_ioremap(pdev, 5, 0x10);

Please provide code that links successfully, and compiles without 
obvious warnings.  pci_ioremap() does not exist; you wanted pci_iomap().

I applied the patch, fixed the obvious bugs, and then did my own line 
length, trailing whitespace, "if(" javaism, 'case' indentation, and 
other cosmetic cleanups.

	Jeff




[-- Attachment #2: patch --]
[-- Type: text/plain, Size: 3172 bytes --]

diff --git a/drivers/ata/pata_marvell.c b/drivers/ata/pata_marvell.c
index 2b8e00c..1ea6407 100644
--- a/drivers/ata/pata_marvell.c
+++ b/drivers/ata/pata_marvell.c
@@ -20,7 +20,7 @@ #include <linux/libata.h>
 #include <linux/ata.h>
 
 #define DRV_NAME	"pata_marvell"
-#define DRV_VERSION	"0.0.4t"
+#define DRV_VERSION	"0.0.5u"
 
 /**
  *	marvell_pre_reset	-	check for 40/80 pin
@@ -33,14 +33,12 @@ static int marvell_pre_reset(struct ata_
 {
 	struct pci_dev *pdev = to_pci_dev(ap->host->dev);
 	u32 devices;
-	unsigned long bar5;
 	void __iomem *barp;
 	int i;
 
 	/* Check if our port is enabled */
 
-	bar5 = pci_resource_start(pdev, 5);
-	barp = ioremap(bar5, 0x10);
+	barp = pci_iomap(pdev, 5, 0x10);
 	if (barp == NULL)
 		return -ENOMEM;
 	printk("BAR5:");
@@ -49,24 +47,25 @@ static int marvell_pre_reset(struct ata_
 	printk("\n");
 	
 	devices = readl(barp + 0x0C);
-	iounmap(barp);
+	pci_iounmap(pdev, barp);
 	
-	if (pdev->device == 0x6145 && ap->port_no == 0 && !(devices & 0x10))	/* PATA enable ? */
+	if ((pdev->device == 0x6145) && (ap->port_no == 0) &&
+	    (!(devices & 0x10)))	/* PATA enable ? */
 		return -ENOENT;
 
 	/* Cable type */
 	switch(ap->port_no)
 	{
-		case 0:
-			/* Might be backward, docs unclear */
-			if(inb(ap->ioaddr.bmdma_addr + 1) & 1)
-				ap->cbl = ATA_CBL_PATA80;
-			else
-				ap->cbl = ATA_CBL_PATA40;
-			
-		case 1: /* Legacy SATA port */
-			ap->cbl = ATA_CBL_SATA;
-			break;
+	case 0:
+		/* Might be backward, docs unclear */
+		if (inb(ap->ioaddr.bmdma_addr + 1) & 1)
+			ap->cbl = ATA_CBL_PATA80;
+		else
+			ap->cbl = ATA_CBL_PATA40;
+
+	case 1: /* Legacy SATA port */
+		ap->cbl = ATA_CBL_SATA;
+		break;
 	}
 	return ata_std_prereset(ap);
 }
@@ -81,7 +80,8 @@ static int marvell_pre_reset(struct ata_
 
 static void marvell_error_handler(struct ata_port *ap)
 {
-	return ata_bmdma_drive_eh(ap, marvell_pre_reset, ata_std_softreset, NULL, ata_std_postreset);
+	return ata_bmdma_drive_eh(ap, marvell_pre_reset, ata_std_softreset,
+				  NULL, ata_std_postreset);
 }
 
 /* No PIO or DMA methods needed for this device */
@@ -130,7 +130,6 @@ static const struct ata_port_operations 
 	.data_xfer		= ata_pio_data_xfer,
 
 	/* Timeout handling */
-	.eng_timeout		= ata_eng_timeout,
 	.irq_handler		= ata_interrupt,
 	.irq_clear		= ata_bmdma_irq_clear,
 
@@ -159,7 +158,7 @@ static int marvell_init_one (struct pci_
 {
 	static struct ata_port_info info = {
 		.sht		= &marvell_sht,
-		.flags	= ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST,
+		.flags		= ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST,
 
 		.pio_mask	= 0x1f,
 		.mwdma_mask	= 0x07,
@@ -170,7 +169,7 @@ static int marvell_init_one (struct pci_
 	static struct ata_port_info info_sata = {
 		.sht		= &marvell_sht,
 		/* Slave possible as its magically mapped not real */
-		.flags	= ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST,
+		.flags		= ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST,
 
 		.pio_mask	= 0x1f,
 		.mwdma_mask	= 0x07,
@@ -180,10 +179,10 @@ static int marvell_init_one (struct pci_
 	};
 	struct ata_port_info *port_info[2] = { &info, &info_sata };
 	int n_port = 2;
-	
+
 	if (pdev->device == 0x6101)
 		n_port = 1;
-	
+
 	return ata_pci_init_one(pdev, port_info, n_port);
 }
 

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] pata_marvell: switch to pci_iomap as Jeff asked
  2006-10-21 19:51 ` Jeff Garzik
@ 2006-10-22 19:51   ` Alan Cox
  0 siblings, 0 replies; 3+ messages in thread
From: Alan Cox @ 2006-10-22 19:51 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: akpm, linux-kernel

Ar Sad, 2006-10-21 am 15:51 -0400, ysgrifennodd Jeff Garzik:
> Please provide code that links successfully, and compiles without 
> obvious warnings.  pci_ioremap() does not exist; you wanted pci_iomap().

Sent you the wrong diff, sorry



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-10-22 19:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-18 17:25 [PATCH] pata_marvell: switch to pci_iomap as Jeff asked Alan Cox
2006-10-21 19:51 ` Jeff Garzik
2006-10-22 19:51   ` Alan Cox

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox