linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH #upstream-fixes 1/2] pata_atiixp: update port enabledness test handling
@ 2009-01-16  6:27 Tejun Heo
  2009-01-16  6:32 ` Tejun Heo
  2009-02-01  1:32 ` Tejun Heo
  0 siblings, 2 replies; 4+ messages in thread
From: Tejun Heo @ 2009-01-16  6:27 UTC (permalink / raw)
  To: Jeff Garzik, IDE/ATA development list, bugsbuggy

Port enabledness test fits much better into init_one() instead of
pre_reset().  The reason why these tests are in pre_reset() is purely
historical at this point.  Move it to init_one().  This will help
further changes.

Signed-off-by: Tejun Heo <tj@kernel.org>
---
 drivers/ata/pata_atiixp.c |   32 +++++++++++++-------------------
 1 file changed, 13 insertions(+), 19 deletions(-)

Index: work/drivers/ata/pata_atiixp.c
===================================================================
--- work.orig/drivers/ata/pata_atiixp.c
+++ work/drivers/ata/pata_atiixp.c
@@ -32,21 +32,6 @@ enum {
 	ATIIXP_IDE_UDMA_MODE 	= 0x56
 };
 
-static int atiixp_pre_reset(struct ata_link *link, unsigned long deadline)
-{
-	struct ata_port *ap = link->ap;
-	static const struct pci_bits atiixp_enable_bits[] = {
-		{ 0x48, 1, 0x01, 0x00 },
-		{ 0x48, 1, 0x08, 0x00 }
-	};
-	struct pci_dev *pdev = to_pci_dev(ap->host->dev);
-
-	if (!pci_test_config_bits(pdev, &atiixp_enable_bits[ap->port_no]))
-		return -ENOENT;
-
-	return ata_sff_prereset(link, deadline);
-}
-
 static int atiixp_cable_detect(struct ata_port *ap)
 {
 	struct pci_dev *pdev = to_pci_dev(ap->host->dev);
@@ -229,10 +214,9 @@ static struct ata_port_operations atiixp
 	.cable_detect	= atiixp_cable_detect,
 	.set_piomode	= atiixp_set_piomode,
 	.set_dmamode	= atiixp_set_dmamode,
-	.prereset	= atiixp_pre_reset,
 };
 
-static int atiixp_init_one(struct pci_dev *dev, const struct pci_device_id *id)
+static int atiixp_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
 {
 	static const struct ata_port_info info = {
 		.flags = ATA_FLAG_SLAVE_POSS,
@@ -241,8 +225,18 @@ static int atiixp_init_one(struct pci_de
 		.udma_mask = 0x3F,
 		.port_ops = &atiixp_port_ops
 	};
-	const struct ata_port_info *ppi[] = { &info, NULL };
-	return ata_pci_sff_init_one(dev, ppi, &atiixp_sht, NULL);
+	static const struct pci_bits atiixp_enable_bits[] = {
+		{ 0x48, 1, 0x01, 0x00 },
+		{ 0x48, 1, 0x08, 0x00 }
+	};
+	const struct ata_port_info *ppi[] = { &info, &info };
+	int i;
+
+	for (i = 0; i < 2; i++)
+		if (!pci_test_config_bits(pdev, &atiixp_enable_bits[i]))
+			ppi[i] = &ata_dummy_port_info;
+
+	return ata_pci_sff_init_one(pdev, ppi, &atiixp_sht, NULL);
 }
 
 static const struct pci_device_id atiixp[] = {

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

* Re: [PATCH #upstream-fixes 1/2] pata_atiixp: update port enabledness test handling
  2009-01-16  6:27 [PATCH #upstream-fixes 1/2] pata_atiixp: update port enabledness test handling Tejun Heo
@ 2009-01-16  6:32 ` Tejun Heo
  2009-02-01  1:32 ` Tejun Heo
  1 sibling, 0 replies; 4+ messages in thread
From: Tejun Heo @ 2009-01-16  6:32 UTC (permalink / raw)
  To: Jeff Garzik, IDE/ATA development list, bugsbuggy

Tejun Heo wrote:
> Port enabledness test fits much better into init_one() instead of
> pre_reset().  The reason why these tests are in pre_reset() is purely
> historical at this point.  Move it to init_one().  This will help
> further changes.

Eh... I'm holding the second patch for now.  Will follow up later.

Thanks.

-- 
tejun

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

* Re: [PATCH #upstream-fixes 1/2] pata_atiixp: update port enabledness test handling
  2009-01-16  6:27 [PATCH #upstream-fixes 1/2] pata_atiixp: update port enabledness test handling Tejun Heo
  2009-01-16  6:32 ` Tejun Heo
@ 2009-02-01  1:32 ` Tejun Heo
  2009-02-03  4:10   ` Jeff Garzik
  1 sibling, 1 reply; 4+ messages in thread
From: Tejun Heo @ 2009-02-01  1:32 UTC (permalink / raw)
  To: Jeff Garzik, IDE/ATA development list, bugsbuggy

Tejun Heo wrote:
> Port enabledness test fits much better into init_one() instead of
> pre_reset().  The reason why these tests are in pre_reset() is purely
> historical at this point.  Move it to init_one().  This will help
> further changes.
> 
> Signed-off-by: Tejun Heo <tj@kernel.org>

Jeff, the second one turned out to be unnecessary but this patch is
worthy on its own.  Can you please put it into #upstream?

Thanks.

-- 
tejun

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

* Re: [PATCH #upstream-fixes 1/2] pata_atiixp: update port enabledness test handling
  2009-02-01  1:32 ` Tejun Heo
@ 2009-02-03  4:10   ` Jeff Garzik
  0 siblings, 0 replies; 4+ messages in thread
From: Jeff Garzik @ 2009-02-03  4:10 UTC (permalink / raw)
  To: Tejun Heo; +Cc: IDE/ATA development list, bugsbuggy

Tejun Heo wrote:
> Tejun Heo wrote:
>> Port enabledness test fits much better into init_one() instead of
>> pre_reset().  The reason why these tests are in pre_reset() is purely
>> historical at this point.  Move it to init_one().  This will help
>> further changes.
>>
>> Signed-off-by: Tejun Heo <tj@kernel.org>
> 
> Jeff, the second one turned out to be unnecessary but this patch is
> worthy on its own.  Can you please put

You mean upstream commit 16028232bf6dc5ed7e4bd341ef335f386229ad0b ?

	Jeff




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

end of thread, other threads:[~2009-02-03  4:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-16  6:27 [PATCH #upstream-fixes 1/2] pata_atiixp: update port enabledness test handling Tejun Heo
2009-01-16  6:32 ` Tejun Heo
2009-02-01  1:32 ` Tejun Heo
2009-02-03  4:10   ` Jeff Garzik

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).