diff options
author | Gwendal Grignou <gwendal@google.com> | 2010-05-25 15:31:38 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@redhat.com> | 2010-10-21 20:21:03 -0400 |
commit | d9027470b88631d0956ac37cdadfdeb9cdcf2c99 (patch) | |
tree | b15273e88431ba734a24965dfc81132ac13bc8bd /drivers/ata/libata-pmp.c | |
parent | f6f94e2ab1b33f0082ac22d71f66385a60d8157f (diff) |
[libata] Add ATA transport class
This is a scheleton for libata transport class.
All information is read only, exporting information from libata:
- ata_port class: one per ATA port
- ata_link class: one per ATA port or 15 for SATA Port Multiplier
- ata_device class: up to 2 for PATA link, usually one for SATA.
Signed-off-by: Gwendal Grignou <gwendal@google.com>
Reviewed-by: Grant Grundler <grundler@google.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers/ata/libata-pmp.c')
-rw-r--r-- | drivers/ata/libata-pmp.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/drivers/ata/libata-pmp.c b/drivers/ata/libata-pmp.c index 224faabd7b7e..505470237d79 100644 --- a/drivers/ata/libata-pmp.c +++ b/drivers/ata/libata-pmp.c | |||
@@ -11,6 +11,7 @@ | |||
11 | #include <linux/libata.h> | 11 | #include <linux/libata.h> |
12 | #include <linux/slab.h> | 12 | #include <linux/slab.h> |
13 | #include "libata.h" | 13 | #include "libata.h" |
14 | #include "libata-transport.h" | ||
14 | 15 | ||
15 | const struct ata_port_operations sata_pmp_port_ops = { | 16 | const struct ata_port_operations sata_pmp_port_ops = { |
16 | .inherits = &sata_port_ops, | 17 | .inherits = &sata_port_ops, |
@@ -312,10 +313,10 @@ static int sata_pmp_configure(struct ata_device *dev, int print_info) | |||
312 | return rc; | 313 | return rc; |
313 | } | 314 | } |
314 | 315 | ||
315 | static int sata_pmp_init_links(struct ata_port *ap, int nr_ports) | 316 | static int sata_pmp_init_links (struct ata_port *ap, int nr_ports) |
316 | { | 317 | { |
317 | struct ata_link *pmp_link = ap->pmp_link; | 318 | struct ata_link *pmp_link = ap->pmp_link; |
318 | int i; | 319 | int i, err; |
319 | 320 | ||
320 | if (!pmp_link) { | 321 | if (!pmp_link) { |
321 | pmp_link = kzalloc(sizeof(pmp_link[0]) * SATA_PMP_MAX_PORTS, | 322 | pmp_link = kzalloc(sizeof(pmp_link[0]) * SATA_PMP_MAX_PORTS, |
@@ -327,6 +328,13 @@ static int sata_pmp_init_links(struct ata_port *ap, int nr_ports) | |||
327 | ata_link_init(ap, &pmp_link[i], i); | 328 | ata_link_init(ap, &pmp_link[i], i); |
328 | 329 | ||
329 | ap->pmp_link = pmp_link; | 330 | ap->pmp_link = pmp_link; |
331 | |||
332 | for (i = 0; i < SATA_PMP_MAX_PORTS; i++) { | ||
333 | err = ata_tlink_add(&pmp_link[i]); | ||
334 | if (err) { | ||
335 | goto err_tlink; | ||
336 | } | ||
337 | } | ||
330 | } | 338 | } |
331 | 339 | ||
332 | for (i = 0; i < nr_ports; i++) { | 340 | for (i = 0; i < nr_ports; i++) { |
@@ -339,6 +347,12 @@ static int sata_pmp_init_links(struct ata_port *ap, int nr_ports) | |||
339 | } | 347 | } |
340 | 348 | ||
341 | return 0; | 349 | return 0; |
350 | err_tlink: | ||
351 | while (--i >= 0) | ||
352 | ata_tlink_delete(&pmp_link[i]); | ||
353 | kfree(pmp_link); | ||
354 | ap->pmp_link = NULL; | ||
355 | return err; | ||
342 | } | 356 | } |
343 | 357 | ||
344 | static void sata_pmp_quirks(struct ata_port *ap) | 358 | static void sata_pmp_quirks(struct ata_port *ap) |