diff options
author | Tejun Heo <tj@kernel.org> | 2009-01-16 01:27:27 -0500 |
---|---|---|
committer | Jeff Garzik <jgarzik@redhat.com> | 2009-01-16 10:20:27 -0500 |
commit | 16028232bf6dc5ed7e4bd341ef335f386229ad0b (patch) | |
tree | 44795da29621afb0012dc77c09f316b4e5a80cc4 /drivers/ata/pata_atiixp.c | |
parent | 94be9a58d7e683ac3c1df1858a17f09ebade8da0 (diff) |
pata_atiixp: update port enabledness test handling
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>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers/ata/pata_atiixp.c')
-rw-r--r-- | drivers/ata/pata_atiixp.c | 32 |
1 files changed, 13 insertions, 19 deletions
diff --git a/drivers/ata/pata_atiixp.c b/drivers/ata/pata_atiixp.c index 0e2cde8f9973..506adde8ebb3 100644 --- a/drivers/ata/pata_atiixp.c +++ b/drivers/ata/pata_atiixp.c | |||
@@ -32,21 +32,6 @@ enum { | |||
32 | ATIIXP_IDE_UDMA_MODE = 0x56 | 32 | ATIIXP_IDE_UDMA_MODE = 0x56 |
33 | }; | 33 | }; |
34 | 34 | ||
35 | static int atiixp_pre_reset(struct ata_link *link, unsigned long deadline) | ||
36 | { | ||
37 | struct ata_port *ap = link->ap; | ||
38 | static const struct pci_bits atiixp_enable_bits[] = { | ||
39 | { 0x48, 1, 0x01, 0x00 }, | ||
40 | { 0x48, 1, 0x08, 0x00 } | ||
41 | }; | ||
42 | struct pci_dev *pdev = to_pci_dev(ap->host->dev); | ||
43 | |||
44 | if (!pci_test_config_bits(pdev, &atiixp_enable_bits[ap->port_no])) | ||
45 | return -ENOENT; | ||
46 | |||
47 | return ata_sff_prereset(link, deadline); | ||
48 | } | ||
49 | |||
50 | static int atiixp_cable_detect(struct ata_port *ap) | 35 | static int atiixp_cable_detect(struct ata_port *ap) |
51 | { | 36 | { |
52 | struct pci_dev *pdev = to_pci_dev(ap->host->dev); | 37 | struct pci_dev *pdev = to_pci_dev(ap->host->dev); |
@@ -229,10 +214,9 @@ static struct ata_port_operations atiixp_port_ops = { | |||
229 | .cable_detect = atiixp_cable_detect, | 214 | .cable_detect = atiixp_cable_detect, |
230 | .set_piomode = atiixp_set_piomode, | 215 | .set_piomode = atiixp_set_piomode, |
231 | .set_dmamode = atiixp_set_dmamode, | 216 | .set_dmamode = atiixp_set_dmamode, |
232 | .prereset = atiixp_pre_reset, | ||
233 | }; | 217 | }; |
234 | 218 | ||
235 | static int atiixp_init_one(struct pci_dev *dev, const struct pci_device_id *id) | 219 | static int atiixp_init_one(struct pci_dev *pdev, const struct pci_device_id *id) |
236 | { | 220 | { |
237 | static const struct ata_port_info info = { | 221 | static const struct ata_port_info info = { |
238 | .flags = ATA_FLAG_SLAVE_POSS, | 222 | .flags = ATA_FLAG_SLAVE_POSS, |
@@ -241,8 +225,18 @@ static int atiixp_init_one(struct pci_dev *dev, const struct pci_device_id *id) | |||
241 | .udma_mask = 0x3F, | 225 | .udma_mask = 0x3F, |
242 | .port_ops = &atiixp_port_ops | 226 | .port_ops = &atiixp_port_ops |
243 | }; | 227 | }; |
244 | const struct ata_port_info *ppi[] = { &info, NULL }; | 228 | static const struct pci_bits atiixp_enable_bits[] = { |
245 | return ata_pci_sff_init_one(dev, ppi, &atiixp_sht, NULL); | 229 | { 0x48, 1, 0x01, 0x00 }, |
230 | { 0x48, 1, 0x08, 0x00 } | ||
231 | }; | ||
232 | const struct ata_port_info *ppi[] = { &info, &info }; | ||
233 | int i; | ||
234 | |||
235 | for (i = 0; i < 2; i++) | ||
236 | if (!pci_test_config_bits(pdev, &atiixp_enable_bits[i])) | ||
237 | ppi[i] = &ata_dummy_port_info; | ||
238 | |||
239 | return ata_pci_sff_init_one(pdev, ppi, &atiixp_sht, NULL); | ||
246 | } | 240 | } |
247 | 241 | ||
248 | static const struct pci_device_id atiixp[] = { | 242 | static const struct pci_device_id atiixp[] = { |