diff options
author | Tejun Heo <htejun@gmail.com> | 2008-03-24 23:22:49 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@redhat.com> | 2008-04-17 15:44:17 -0400 |
commit | 887125e3740283be25564bfc6fb5d24974b651ab (patch) | |
tree | bd037e1c17a468fabe1834e707b70b4b43513e4a /drivers/ata/pata_amd.c | |
parent | 1bd5b715a305f6f13455e89becbd839010dd14b5 (diff) |
libata: stop overloading port_info->private_data
port_info->private_data is currently used for two purposes - to record
private data about the port_info or to specify host->private_data to
use when allocating ata_host.
This overloading is confusing and counter-intuitive in that
port_info->private_data becomes host->private_data instead of
port->private_data. In addition, port_info and host don't correspond
to each other 1-to-1. Currently, the first non-NULL
port_info->private_data is used.
This patch makes port_info->private_data just be what it is -
private_data for the port_info where LLD can jot down extra info.
libata no longer sets host->private_data to the first non-NULL
port_info->private_data, @host_priv argument is added to
ata_pci_init_one() instead. LLDs which use ata_pci_init_one() can use
this argument to pass in pointer to host private data. LLDs which
don't should use init-register model anyway and can initialize
host->private_data directly.
Adding @host_priv instead of using init-register model for LLDs which
use ata_pci_init_one() is suggested by Alan Cox.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Diffstat (limited to 'drivers/ata/pata_amd.c')
-rw-r--r-- | drivers/ata/pata_amd.c | 27 |
1 files changed, 7 insertions, 20 deletions
diff --git a/drivers/ata/pata_amd.c b/drivers/ata/pata_amd.c index 644702cac6ee..09c8286b6890 100644 --- a/drivers/ata/pata_amd.c +++ b/drivers/ata/pata_amd.c | |||
@@ -144,12 +144,6 @@ static int amd_pre_reset(struct ata_link *link, unsigned long deadline) | |||
144 | return ata_std_prereset(link, deadline); | 144 | return ata_std_prereset(link, deadline); |
145 | } | 145 | } |
146 | 146 | ||
147 | static void amd_error_handler(struct ata_port *ap) | ||
148 | { | ||
149 | ata_bmdma_drive_eh(ap, amd_pre_reset, ata_std_softreset, NULL, | ||
150 | ata_std_postreset); | ||
151 | } | ||
152 | |||
153 | static int amd_cable_detect(struct ata_port *ap) | 147 | static int amd_cable_detect(struct ata_port *ap) |
154 | { | 148 | { |
155 | static const u32 bitmask[2] = {0x03, 0x0C}; | 149 | static const u32 bitmask[2] = {0x03, 0x0C}; |
@@ -300,13 +294,6 @@ static int nv_pre_reset(struct ata_link *link, unsigned long deadline) | |||
300 | return ata_std_prereset(link, deadline); | 294 | return ata_std_prereset(link, deadline); |
301 | } | 295 | } |
302 | 296 | ||
303 | static void nv_error_handler(struct ata_port *ap) | ||
304 | { | ||
305 | ata_bmdma_drive_eh(ap, nv_pre_reset, | ||
306 | ata_std_softreset, NULL, | ||
307 | ata_std_postreset); | ||
308 | } | ||
309 | |||
310 | /** | 297 | /** |
311 | * nv100_set_piomode - set initial PIO mode data | 298 | * nv100_set_piomode - set initial PIO mode data |
312 | * @ap: ATA interface | 299 | * @ap: ATA interface |
@@ -358,7 +345,7 @@ static struct scsi_host_template amd_sht = { | |||
358 | 345 | ||
359 | static const struct ata_port_operations amd_base_port_ops = { | 346 | static const struct ata_port_operations amd_base_port_ops = { |
360 | .inherits = &ata_bmdma_port_ops, | 347 | .inherits = &ata_bmdma_port_ops, |
361 | .error_handler = amd_error_handler, | 348 | .prereset = amd_pre_reset, |
362 | }; | 349 | }; |
363 | 350 | ||
364 | static struct ata_port_operations amd33_port_ops = { | 351 | static struct ata_port_operations amd33_port_ops = { |
@@ -393,7 +380,7 @@ static const struct ata_port_operations nv_base_port_ops = { | |||
393 | .inherits = &ata_bmdma_port_ops, | 380 | .inherits = &ata_bmdma_port_ops, |
394 | .cable_detect = ata_cable_ignore, | 381 | .cable_detect = ata_cable_ignore, |
395 | .mode_filter = nv_mode_filter, | 382 | .mode_filter = nv_mode_filter, |
396 | .error_handler = nv_error_handler, | 383 | .prereset = nv_pre_reset, |
397 | .host_stop = nv_host_stop, | 384 | .host_stop = nv_host_stop, |
398 | }; | 385 | }; |
399 | 386 | ||
@@ -483,10 +470,10 @@ static int amd_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
483 | .port_ops = &amd100_port_ops | 470 | .port_ops = &amd100_port_ops |
484 | } | 471 | } |
485 | }; | 472 | }; |
486 | struct ata_port_info pi; | 473 | const struct ata_port_info *ppi[] = { NULL, NULL }; |
487 | const struct ata_port_info *ppi[] = { &pi, NULL }; | ||
488 | static int printed_version; | 474 | static int printed_version; |
489 | int type = id->driver_data; | 475 | int type = id->driver_data; |
476 | void *hpriv = NULL; | ||
490 | u8 fifo; | 477 | u8 fifo; |
491 | int rc; | 478 | int rc; |
492 | 479 | ||
@@ -511,7 +498,7 @@ static int amd_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
511 | /* | 498 | /* |
512 | * Okay, type is determined now. Apply type-specific workarounds. | 499 | * Okay, type is determined now. Apply type-specific workarounds. |
513 | */ | 500 | */ |
514 | pi = info[type]; | 501 | ppi[0] = &info[type]; |
515 | 502 | ||
516 | if (type < 3) | 503 | if (type < 3) |
517 | ata_pci_clear_simplex(pdev); | 504 | ata_pci_clear_simplex(pdev); |
@@ -530,11 +517,11 @@ static int amd_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
530 | u32 udma; | 517 | u32 udma; |
531 | 518 | ||
532 | pci_read_config_dword(pdev, 0x60, &udma); | 519 | pci_read_config_dword(pdev, 0x60, &udma); |
533 | pi.private_data = (void *)(unsigned long)udma; | 520 | hpriv = (void *)(unsigned long)udma; |
534 | } | 521 | } |
535 | 522 | ||
536 | /* And fire it up */ | 523 | /* And fire it up */ |
537 | return ata_pci_init_one(pdev, ppi, &amd_sht); | 524 | return ata_pci_init_one(pdev, ppi, &amd_sht, hpriv); |
538 | } | 525 | } |
539 | 526 | ||
540 | #ifdef CONFIG_PM | 527 | #ifdef CONFIG_PM |