kernel: bump 5.4 to 5.4.69
[openwrt/openwrt.git] / target / linux / oxnas / patches-5.4 / 999-libata-hacks.patch
1 --- a/drivers/ata/libata-core.c
2 +++ b/drivers/ata/libata-core.c
3 @@ -1583,6 +1583,14 @@ unsigned ata_exec_internal_sg(struct ata
4 return AC_ERR_SYSTEM;
5 }
6
7 + if (ap->ops->acquire_hw && !ap->ops->acquire_hw(ap, 0, 0)) {
8 + spin_unlock_irqrestore(ap->lock, flags);
9 + if (!ap->ops->acquire_hw(ap, 1, (2*HZ))) {
10 + return AC_ERR_TIMEOUT;
11 + }
12 + spin_lock_irqsave(ap->lock, flags);
13 + }
14 +
15 /* initialize internal qc */
16 qc = __ata_qc_from_tag(ap, ATA_TAG_INTERNAL);
17
18 @@ -5124,6 +5132,9 @@ struct ata_queued_cmd *ata_qc_new_init(s
19 if (unlikely(ap->pflags & ATA_PFLAG_FROZEN))
20 return NULL;
21
22 + if (ap->ops->qc_new && ap->ops->qc_new(ap))
23 + return NULL;
24 +
25 /* libsas case */
26 if (ap->flags & ATA_FLAG_SAS_HOST) {
27 tag = ata_sas_allocate_tag(ap);
28 @@ -5169,6 +5180,8 @@ void ata_qc_free(struct ata_queued_cmd *
29 qc->tag = ATA_TAG_POISON;
30 if (ap->flags & ATA_FLAG_SAS_HOST)
31 ata_sas_free_tag(tag, ap);
32 + if (ap->ops->qc_free)
33 + ap->ops->qc_free(qc);
34 }
35 }
36
37 --- a/include/linux/libata.h
38 +++ b/include/linux/libata.h
39 @@ -910,6 +910,8 @@ struct ata_port_operations {
40 enum ata_completion_errors (*qc_prep)(struct ata_queued_cmd *qc);
41 unsigned int (*qc_issue)(struct ata_queued_cmd *qc);
42 bool (*qc_fill_rtf)(struct ata_queued_cmd *qc);
43 + int (*qc_new)(struct ata_port *ap);
44 + void (*qc_free)(struct ata_queued_cmd *qc);
45
46 /*
47 * Configuration and exception handling
48 @@ -1000,6 +1002,9 @@ struct ata_port_operations {
49 void (*phy_reset)(struct ata_port *ap);
50 void (*eng_timeout)(struct ata_port *ap);
51
52 + int (*acquire_hw)(struct ata_port *ap, int may_sleep,
53 + int timeout_jiffies);
54 +
55 /*
56 * ->inherits must be the last field and all the preceding
57 * fields must be pointers.