399d821c2caf3fe00d9e93e42adc1294b1fa524c
[openwrt/svn-archive/archive.git] / target / linux / oxnas / patches-4.0 / 999-libata-hacks.patch
1 Index: linux-4.0-rc4/drivers/ata/libata-core.c
2 ===================================================================
3 --- linux-4.0-rc4.orig/drivers/ata/libata-core.c
4 +++ linux-4.0-rc4/drivers/ata/libata-core.c
5 @@ -1586,6 +1586,14 @@ unsigned ata_exec_internal_sg(struct ata
6 return AC_ERR_SYSTEM;
7 }
8
9 + if (ap->ops->acquire_hw && !ap->ops->acquire_hw(ap, 0, 0)) {
10 + spin_unlock_irqrestore(ap->lock, flags);
11 + if (!ap->ops->acquire_hw(ap, 1, (2*HZ))) {
12 + return AC_ERR_TIMEOUT;
13 + }
14 + spin_lock_irqsave(ap->lock, flags);
15 + }
16 +
17 /* initialize internal qc */
18
19 /* XXX: Tag 0 is used for drivers with legacy EH as some
20 @@ -4749,6 +4757,9 @@ struct ata_queued_cmd *ata_qc_new_init(s
21 if (unlikely(ap->pflags & ATA_PFLAG_FROZEN))
22 return NULL;
23
24 + if (ap->ops->qc_new && ap->ops->qc_new(ap))
25 + return NULL;
26 +
27 /* libsas case */
28 if (!ap->scsi_host) {
29 tag = ata_sas_allocate_tag(ap);
30 @@ -4794,6 +4805,8 @@ void ata_qc_free(struct ata_queued_cmd *
31 qc->tag = ATA_TAG_POISON;
32 if (!ap->scsi_host)
33 ata_sas_free_tag(tag, ap);
34 + if (ap->ops->qc_free)
35 + ap->ops->qc_free(qc);
36 }
37 }
38
39 Index: linux-4.0-rc4/include/linux/libata.h
40 ===================================================================
41 --- linux-4.0-rc4.orig/include/linux/libata.h
42 +++ linux-4.0-rc4/include/linux/libata.h
43 @@ -893,6 +893,8 @@ struct ata_port_operations {
44 void (*qc_prep)(struct ata_queued_cmd *qc);
45 unsigned int (*qc_issue)(struct ata_queued_cmd *qc);
46 bool (*qc_fill_rtf)(struct ata_queued_cmd *qc);
47 + int (*qc_new)(struct ata_port *ap);
48 + void (*qc_free)(struct ata_queued_cmd *qc);
49
50 /*
51 * Configuration and exception handling
52 @@ -983,6 +985,9 @@ struct ata_port_operations {
53 void (*phy_reset)(struct ata_port *ap);
54 void (*eng_timeout)(struct ata_port *ap);
55
56 + int (*acquire_hw)(struct ata_port *ap, int may_sleep,
57 + int timeout_jiffies);
58 +
59 /*
60 * ->inherits must be the last field and all the preceding
61 * fields must be pointers.