diff options
Diffstat (limited to 'drivers')
84 files changed, 936 insertions, 443 deletions
diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig index ad1f59c1b3fc..b4a8d6030e48 100644 --- a/drivers/ata/Kconfig +++ b/drivers/ata/Kconfig | |||
@@ -132,7 +132,7 @@ config SATA_SIS | |||
132 | depends on PCI | 132 | depends on PCI |
133 | select PATA_SIS | 133 | select PATA_SIS |
134 | help | 134 | help |
135 | This option enables support for SiS Serial ATA on | 135 | This option enables support for SiS Serial ATA on |
136 | SiS 964/965/966/180 and Parallel ATA on SiS 180. | 136 | SiS 964/965/966/180 and Parallel ATA on SiS 180. |
137 | The PATA support for SiS 180 requires additionally to | 137 | The PATA support for SiS 180 requires additionally to |
138 | enable the PATA_SIS driver in the config. | 138 | enable the PATA_SIS driver in the config. |
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c index e00e1b913d28..7baeaffefe7a 100644 --- a/drivers/ata/ahci.c +++ b/drivers/ata/ahci.c | |||
@@ -46,7 +46,7 @@ | |||
46 | #include <linux/libata.h> | 46 | #include <linux/libata.h> |
47 | 47 | ||
48 | #define DRV_NAME "ahci" | 48 | #define DRV_NAME "ahci" |
49 | #define DRV_VERSION "2.1" | 49 | #define DRV_VERSION "2.2" |
50 | 50 | ||
51 | 51 | ||
52 | enum { | 52 | enum { |
@@ -170,6 +170,7 @@ enum { | |||
170 | AHCI_FLAG_IGN_IRQ_IF_ERR = (1 << 25), /* ignore IRQ_IF_ERR */ | 170 | AHCI_FLAG_IGN_IRQ_IF_ERR = (1 << 25), /* ignore IRQ_IF_ERR */ |
171 | AHCI_FLAG_HONOR_PI = (1 << 26), /* honor PORTS_IMPL */ | 171 | AHCI_FLAG_HONOR_PI = (1 << 26), /* honor PORTS_IMPL */ |
172 | AHCI_FLAG_IGN_SERR_INTERNAL = (1 << 27), /* ignore SERR_INTERNAL */ | 172 | AHCI_FLAG_IGN_SERR_INTERNAL = (1 << 27), /* ignore SERR_INTERNAL */ |
173 | AHCI_FLAG_32BIT_ONLY = (1 << 28), /* force 32bit */ | ||
173 | 174 | ||
174 | AHCI_FLAG_COMMON = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | | 175 | AHCI_FLAG_COMMON = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | |
175 | ATA_FLAG_MMIO | ATA_FLAG_PIO_DMA | | 176 | ATA_FLAG_MMIO | ATA_FLAG_PIO_DMA | |
@@ -354,7 +355,8 @@ static const struct ata_port_info ahci_port_info[] = { | |||
354 | /* board_ahci_sb600 */ | 355 | /* board_ahci_sb600 */ |
355 | { | 356 | { |
356 | .flags = AHCI_FLAG_COMMON | | 357 | .flags = AHCI_FLAG_COMMON | |
357 | AHCI_FLAG_IGN_SERR_INTERNAL, | 358 | AHCI_FLAG_IGN_SERR_INTERNAL | |
359 | AHCI_FLAG_32BIT_ONLY, | ||
358 | .pio_mask = 0x1f, /* pio0-4 */ | 360 | .pio_mask = 0x1f, /* pio0-4 */ |
359 | .udma_mask = 0x7f, /* udma0-6 ; FIXME */ | 361 | .udma_mask = 0x7f, /* udma0-6 ; FIXME */ |
360 | .port_ops = &ahci_ops, | 362 | .port_ops = &ahci_ops, |
@@ -492,6 +494,13 @@ static void ahci_save_initial_config(struct pci_dev *pdev, | |||
492 | hpriv->saved_cap = cap = readl(mmio + HOST_CAP); | 494 | hpriv->saved_cap = cap = readl(mmio + HOST_CAP); |
493 | hpriv->saved_port_map = port_map = readl(mmio + HOST_PORTS_IMPL); | 495 | hpriv->saved_port_map = port_map = readl(mmio + HOST_PORTS_IMPL); |
494 | 496 | ||
497 | /* some chips lie about 64bit support */ | ||
498 | if ((cap & HOST_CAP_64) && (pi->flags & AHCI_FLAG_32BIT_ONLY)) { | ||
499 | dev_printk(KERN_INFO, &pdev->dev, | ||
500 | "controller can't do 64bit DMA, forcing 32bit\n"); | ||
501 | cap &= ~HOST_CAP_64; | ||
502 | } | ||
503 | |||
495 | /* fixup zero port_map */ | 504 | /* fixup zero port_map */ |
496 | if (!port_map) { | 505 | if (!port_map) { |
497 | port_map = (1 << ahci_nr_ports(hpriv->cap)) - 1; | 506 | port_map = (1 << ahci_nr_ports(hpriv->cap)) - 1; |
diff --git a/drivers/ata/ata_generic.c b/drivers/ata/ata_generic.c index c3d753296bc6..7565f022bd69 100644 --- a/drivers/ata/ata_generic.c +++ b/drivers/ata/ata_generic.c | |||
@@ -26,7 +26,7 @@ | |||
26 | #include <linux/libata.h> | 26 | #include <linux/libata.h> |
27 | 27 | ||
28 | #define DRV_NAME "ata_generic" | 28 | #define DRV_NAME "ata_generic" |
29 | #define DRV_VERSION "0.2.11" | 29 | #define DRV_VERSION "0.2.12" |
30 | 30 | ||
31 | /* | 31 | /* |
32 | * A generic parallel ATA driver using libata | 32 | * A generic parallel ATA driver using libata |
diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c index 13b6b1df2ac4..0458811010fd 100644 --- a/drivers/ata/ata_piix.c +++ b/drivers/ata/ata_piix.c | |||
@@ -155,7 +155,6 @@ struct piix_host_priv { | |||
155 | static int piix_init_one (struct pci_dev *pdev, | 155 | static int piix_init_one (struct pci_dev *pdev, |
156 | const struct pci_device_id *ent); | 156 | const struct pci_device_id *ent); |
157 | static void piix_pata_error_handler(struct ata_port *ap); | 157 | static void piix_pata_error_handler(struct ata_port *ap); |
158 | static void piix_sata_error_handler(struct ata_port *ap); | ||
159 | static void piix_set_piomode (struct ata_port *ap, struct ata_device *adev); | 158 | static void piix_set_piomode (struct ata_port *ap, struct ata_device *adev); |
160 | static void piix_set_dmamode (struct ata_port *ap, struct ata_device *adev); | 159 | static void piix_set_dmamode (struct ata_port *ap, struct ata_device *adev); |
161 | static void ich_set_dmamode (struct ata_port *ap, struct ata_device *adev); | 160 | static void ich_set_dmamode (struct ata_port *ap, struct ata_device *adev); |
@@ -364,7 +363,7 @@ static const struct ata_port_operations piix_sata_ops = { | |||
364 | 363 | ||
365 | .freeze = ata_bmdma_freeze, | 364 | .freeze = ata_bmdma_freeze, |
366 | .thaw = ata_bmdma_thaw, | 365 | .thaw = ata_bmdma_thaw, |
367 | .error_handler = piix_sata_error_handler, | 366 | .error_handler = ata_bmdma_error_handler, |
368 | .post_internal_cmd = ata_bmdma_post_internal_cmd, | 367 | .post_internal_cmd = ata_bmdma_post_internal_cmd, |
369 | 368 | ||
370 | .irq_handler = ata_interrupt, | 369 | .irq_handler = ata_interrupt, |
@@ -641,12 +640,6 @@ static void piix_pata_error_handler(struct ata_port *ap) | |||
641 | ata_std_postreset); | 640 | ata_std_postreset); |
642 | } | 641 | } |
643 | 642 | ||
644 | static void piix_sata_error_handler(struct ata_port *ap) | ||
645 | { | ||
646 | ata_bmdma_drive_eh(ap, ata_std_prereset, ata_std_softreset, NULL, | ||
647 | ata_std_postreset); | ||
648 | } | ||
649 | |||
650 | /** | 643 | /** |
651 | * piix_set_piomode - Initialize host controller PATA PIO timings | 644 | * piix_set_piomode - Initialize host controller PATA PIO timings |
652 | * @ap: Port whose timings we are configuring | 645 | * @ap: Port whose timings we are configuring |
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index d3ea7f55283c..a6de57e02047 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
@@ -59,7 +59,7 @@ | |||
59 | 59 | ||
60 | #include "libata.h" | 60 | #include "libata.h" |
61 | 61 | ||
62 | #define DRV_VERSION "2.20" /* must be exactly four chars */ | 62 | #define DRV_VERSION "2.21" /* must be exactly four chars */ |
63 | 63 | ||
64 | 64 | ||
65 | /* debounce timing parameters in msecs { interval, duration, timeout } */ | 65 | /* debounce timing parameters in msecs { interval, duration, timeout } */ |
@@ -977,7 +977,7 @@ static u64 ata_hpa_resize(struct ata_device *dev) | |||
977 | { | 977 | { |
978 | u64 sectors = dev->n_sectors; | 978 | u64 sectors = dev->n_sectors; |
979 | u64 hpa_sectors; | 979 | u64 hpa_sectors; |
980 | 980 | ||
981 | if (ata_id_has_lba48(dev->id)) | 981 | if (ata_id_has_lba48(dev->id)) |
982 | hpa_sectors = ata_read_native_max_address_ext(dev); | 982 | hpa_sectors = ata_read_native_max_address_ext(dev); |
983 | else | 983 | else |
@@ -1588,7 +1588,7 @@ unsigned int ata_do_simple_cmd(struct ata_device *dev, u8 cmd) | |||
1588 | * Check if the current speed of the device requires IORDY. Used | 1588 | * Check if the current speed of the device requires IORDY. Used |
1589 | * by various controllers for chip configuration. | 1589 | * by various controllers for chip configuration. |
1590 | */ | 1590 | */ |
1591 | 1591 | ||
1592 | unsigned int ata_pio_need_iordy(const struct ata_device *adev) | 1592 | unsigned int ata_pio_need_iordy(const struct ata_device *adev) |
1593 | { | 1593 | { |
1594 | /* Controller doesn't support IORDY. Probably a pointless check | 1594 | /* Controller doesn't support IORDY. Probably a pointless check |
@@ -1611,7 +1611,7 @@ unsigned int ata_pio_need_iordy(const struct ata_device *adev) | |||
1611 | * Compute the highest mode possible if we are not using iordy. Return | 1611 | * Compute the highest mode possible if we are not using iordy. Return |
1612 | * -1 if no iordy mode is available. | 1612 | * -1 if no iordy mode is available. |
1613 | */ | 1613 | */ |
1614 | 1614 | ||
1615 | static u32 ata_pio_mask_no_iordy(const struct ata_device *adev) | 1615 | static u32 ata_pio_mask_no_iordy(const struct ata_device *adev) |
1616 | { | 1616 | { |
1617 | /* If we have no drive specific rule, then PIO 2 is non IORDY */ | 1617 | /* If we have no drive specific rule, then PIO 2 is non IORDY */ |
@@ -2663,7 +2663,7 @@ int ata_timing_compute(struct ata_device *adev, unsigned short speed, | |||
2663 | t->active += (t->cycle - (t->active + t->recover)) / 2; | 2663 | t->active += (t->cycle - (t->active + t->recover)) / 2; |
2664 | t->recover = t->cycle - t->active; | 2664 | t->recover = t->cycle - t->active; |
2665 | } | 2665 | } |
2666 | 2666 | ||
2667 | /* In a few cases quantisation may produce enough errors to | 2667 | /* In a few cases quantisation may produce enough errors to |
2668 | leave t->cycle too low for the sum of active and recovery | 2668 | leave t->cycle too low for the sum of active and recovery |
2669 | if so we must correct this */ | 2669 | if so we must correct this */ |
@@ -2893,9 +2893,6 @@ int ata_do_set_mode(struct ata_port *ap, struct ata_device **r_failed_dev) | |||
2893 | if (used_dma && (ap->host->flags & ATA_HOST_SIMPLEX)) | 2893 | if (used_dma && (ap->host->flags & ATA_HOST_SIMPLEX)) |
2894 | ap->host->simplex_claimed = ap; | 2894 | ap->host->simplex_claimed = ap; |
2895 | 2895 | ||
2896 | /* step5: chip specific finalisation */ | ||
2897 | if (ap->ops->post_set_mode) | ||
2898 | ap->ops->post_set_mode(ap); | ||
2899 | out: | 2896 | out: |
2900 | if (rc) | 2897 | if (rc) |
2901 | *r_failed_dev = dev; | 2898 | *r_failed_dev = dev; |
@@ -3771,6 +3768,7 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = { | |||
3771 | { "ATAPI CD-ROM DRIVE 40X MAXIMUM",NULL,ATA_HORKAGE_NODMA }, | 3768 | { "ATAPI CD-ROM DRIVE 40X MAXIMUM",NULL,ATA_HORKAGE_NODMA }, |
3772 | { "_NEC DV5800A", NULL, ATA_HORKAGE_NODMA }, | 3769 | { "_NEC DV5800A", NULL, ATA_HORKAGE_NODMA }, |
3773 | { "SAMSUNG CD-ROM SN-124","N001", ATA_HORKAGE_NODMA }, | 3770 | { "SAMSUNG CD-ROM SN-124","N001", ATA_HORKAGE_NODMA }, |
3771 | { "Seagate STT20000A", NULL, ATA_HORKAGE_NODMA }, | ||
3774 | 3772 | ||
3775 | /* Weird ATAPI devices */ | 3773 | /* Weird ATAPI devices */ |
3776 | { "TORiSAN DVD-ROM DRD-N216", NULL, ATA_HORKAGE_MAX_SEC_128 | | 3774 | { "TORiSAN DVD-ROM DRD-N216", NULL, ATA_HORKAGE_MAX_SEC_128 | |
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c index 5309c312f517..d8070989a39f 100644 --- a/drivers/ata/libata-eh.c +++ b/drivers/ata/libata-eh.c | |||
@@ -1009,7 +1009,7 @@ static unsigned int atapi_eh_request_sense(struct ata_queued_cmd *qc) | |||
1009 | sense_buf[0] = 0x70; | 1009 | sense_buf[0] = 0x70; |
1010 | sense_buf[2] = qc->result_tf.feature >> 4; | 1010 | sense_buf[2] = qc->result_tf.feature >> 4; |
1011 | 1011 | ||
1012 | /* some devices time out if garbage left in tf */ | 1012 | /* some devices time out if garbage left in tf */ |
1013 | ata_tf_init(dev, &tf); | 1013 | ata_tf_init(dev, &tf); |
1014 | 1014 | ||
1015 | memset(cdb, 0, ATAPI_CDB_LEN); | 1015 | memset(cdb, 0, ATAPI_CDB_LEN); |
diff --git a/drivers/ata/pata_artop.c b/drivers/ata/pata_artop.c index 9861059dd673..7b4810c171b7 100644 --- a/drivers/ata/pata_artop.c +++ b/drivers/ata/pata_artop.c | |||
@@ -28,7 +28,7 @@ | |||
28 | #include <linux/ata.h> | 28 | #include <linux/ata.h> |
29 | 29 | ||
30 | #define DRV_NAME "pata_artop" | 30 | #define DRV_NAME "pata_artop" |
31 | #define DRV_VERSION "0.4.2" | 31 | #define DRV_VERSION "0.4.3" |
32 | 32 | ||
33 | /* | 33 | /* |
34 | * The ARTOP has 33 Mhz and "over clocked" timing tables. Until we | 34 | * The ARTOP has 33 Mhz and "over clocked" timing tables. Until we |
@@ -99,7 +99,7 @@ static int artop6260_pre_reset(struct ata_port *ap, unsigned long deadline) | |||
99 | * | 99 | * |
100 | * Identify the cable type for the ARTOp interface in question | 100 | * Identify the cable type for the ARTOp interface in question |
101 | */ | 101 | */ |
102 | 102 | ||
103 | static int artop6260_cable_detect(struct ata_port *ap) | 103 | static int artop6260_cable_detect(struct ata_port *ap) |
104 | { | 104 | { |
105 | struct pci_dev *pdev = to_pci_dev(ap->host->dev); | 105 | struct pci_dev *pdev = to_pci_dev(ap->host->dev); |
diff --git a/drivers/ata/pata_cmd640.c b/drivers/ata/pata_cmd640.c index ed00fa9d53be..31cbf8daa299 100644 --- a/drivers/ata/pata_cmd640.c +++ b/drivers/ata/pata_cmd640.c | |||
@@ -107,7 +107,7 @@ static void cmd640_set_piomode(struct ata_port *ap, struct ata_device *adev) | |||
107 | pci_write_config_byte(pdev, arttim + 1, (t.active << 4) | t.recover); | 107 | pci_write_config_byte(pdev, arttim + 1, (t.active << 4) | t.recover); |
108 | } else { | 108 | } else { |
109 | /* Save the shared timings for channel, they will be loaded | 109 | /* Save the shared timings for channel, they will be loaded |
110 | by qc_issue_prot. Reloading the setup time is expensive | 110 | by qc_issue_prot. Reloading the setup time is expensive |
111 | so we keep a merged one loaded */ | 111 | so we keep a merged one loaded */ |
112 | pci_read_config_byte(pdev, ARTIM23, ®); | 112 | pci_read_config_byte(pdev, ARTIM23, ®); |
113 | reg &= 0x3F; | 113 | reg &= 0x3F; |
@@ -231,7 +231,7 @@ static void cmd640_hardware_init(struct pci_dev *pdev) | |||
231 | pci_write_config_byte(pdev, CMDTIM, 0); | 231 | pci_write_config_byte(pdev, CMDTIM, 0); |
232 | /* 512 byte bursts (sector) */ | 232 | /* 512 byte bursts (sector) */ |
233 | pci_write_config_byte(pdev, BRST, 0x40); | 233 | pci_write_config_byte(pdev, BRST, 0x40); |
234 | /* | 234 | /* |
235 | * A reporter a long time ago | 235 | * A reporter a long time ago |
236 | * Had problems with the data fifo | 236 | * Had problems with the data fifo |
237 | * So don't run the risk | 237 | * So don't run the risk |
diff --git a/drivers/ata/pata_cmd64x.c b/drivers/ata/pata_cmd64x.c index 2a79b335cfcc..320a5b10aa98 100644 --- a/drivers/ata/pata_cmd64x.c +++ b/drivers/ata/pata_cmd64x.c | |||
@@ -31,7 +31,7 @@ | |||
31 | #include <linux/libata.h> | 31 | #include <linux/libata.h> |
32 | 32 | ||
33 | #define DRV_NAME "pata_cmd64x" | 33 | #define DRV_NAME "pata_cmd64x" |
34 | #define DRV_VERSION "0.2.2" | 34 | #define DRV_VERSION "0.2.3" |
35 | 35 | ||
36 | /* | 36 | /* |
37 | * CMD64x specific registers definition. | 37 | * CMD64x specific registers definition. |
diff --git a/drivers/ata/pata_cs5520.c b/drivers/ata/pata_cs5520.c index 83bcc5b32597..1aabe15ad9d3 100644 --- a/drivers/ata/pata_cs5520.c +++ b/drivers/ata/pata_cs5520.c | |||
@@ -41,7 +41,7 @@ | |||
41 | #include <linux/libata.h> | 41 | #include <linux/libata.h> |
42 | 42 | ||
43 | #define DRV_NAME "pata_cs5520" | 43 | #define DRV_NAME "pata_cs5520" |
44 | #define DRV_VERSION "0.6.4" | 44 | #define DRV_VERSION "0.6.5" |
45 | 45 | ||
46 | struct pio_clocks | 46 | struct pio_clocks |
47 | { | 47 | { |
diff --git a/drivers/ata/pata_cs5530.c b/drivers/ata/pata_cs5530.c index 1b67923d7a4e..848f0309bf03 100644 --- a/drivers/ata/pata_cs5530.c +++ b/drivers/ata/pata_cs5530.c | |||
@@ -35,7 +35,7 @@ | |||
35 | #include <linux/dmi.h> | 35 | #include <linux/dmi.h> |
36 | 36 | ||
37 | #define DRV_NAME "pata_cs5530" | 37 | #define DRV_NAME "pata_cs5530" |
38 | #define DRV_VERSION "0.7.2" | 38 | #define DRV_VERSION "0.7.3" |
39 | 39 | ||
40 | static void __iomem *cs5530_port_base(struct ata_port *ap) | 40 | static void __iomem *cs5530_port_base(struct ata_port *ap) |
41 | { | 41 | { |
diff --git a/drivers/ata/pata_cs5535.c b/drivers/ata/pata_cs5535.c index f37d4cd812a1..aa3256fb9f7a 100644 --- a/drivers/ata/pata_cs5535.c +++ b/drivers/ata/pata_cs5535.c | |||
@@ -39,7 +39,7 @@ | |||
39 | #include <asm/msr.h> | 39 | #include <asm/msr.h> |
40 | 40 | ||
41 | #define DRV_NAME "cs5535" | 41 | #define DRV_NAME "cs5535" |
42 | #define DRV_VERSION "0.2.11" | 42 | #define DRV_VERSION "0.2.12" |
43 | 43 | ||
44 | /* | 44 | /* |
45 | * The Geode (Aka Athlon GX now) uses an internal MSR based | 45 | * The Geode (Aka Athlon GX now) uses an internal MSR based |
diff --git a/drivers/ata/pata_cypress.c b/drivers/ata/pata_cypress.c index 27b9f29c01e3..d41a7691dd8e 100644 --- a/drivers/ata/pata_cypress.c +++ b/drivers/ata/pata_cypress.c | |||
@@ -18,7 +18,7 @@ | |||
18 | #include <linux/libata.h> | 18 | #include <linux/libata.h> |
19 | 19 | ||
20 | #define DRV_NAME "pata_cypress" | 20 | #define DRV_NAME "pata_cypress" |
21 | #define DRV_VERSION "0.1.4" | 21 | #define DRV_VERSION "0.1.5" |
22 | 22 | ||
23 | /* here are the offset definitions for the registers */ | 23 | /* here are the offset definitions for the registers */ |
24 | 24 | ||
diff --git a/drivers/ata/pata_hpt366.c b/drivers/ata/pata_hpt366.c index c6c8a8bb06d0..0c9cb6090711 100644 --- a/drivers/ata/pata_hpt366.c +++ b/drivers/ata/pata_hpt366.c | |||
@@ -220,32 +220,6 @@ static int hpt36x_cable_detect(struct ata_port *ap) | |||
220 | return ATA_CBL_PATA80; | 220 | return ATA_CBL_PATA80; |
221 | } | 221 | } |
222 | 222 | ||
223 | static int hpt36x_pre_reset(struct ata_port *ap, unsigned long deadline) | ||
224 | { | ||
225 | static const struct pci_bits hpt36x_enable_bits[] = { | ||
226 | { 0x50, 1, 0x04, 0x04 }, | ||
227 | { 0x54, 1, 0x04, 0x04 } | ||
228 | }; | ||
229 | struct pci_dev *pdev = to_pci_dev(ap->host->dev); | ||
230 | |||
231 | if (!pci_test_config_bits(pdev, &hpt36x_enable_bits[ap->port_no])) | ||
232 | return -ENOENT; | ||
233 | |||
234 | return ata_std_prereset(ap, deadline); | ||
235 | } | ||
236 | |||
237 | /** | ||
238 | * hpt36x_error_handler - reset the hpt36x bus | ||
239 | * @ap: ATA port to reset | ||
240 | * | ||
241 | * Perform the reset handling for the 366/368 | ||
242 | */ | ||
243 | |||
244 | static void hpt36x_error_handler(struct ata_port *ap) | ||
245 | { | ||
246 | ata_bmdma_drive_eh(ap, hpt36x_pre_reset, ata_std_softreset, NULL, ata_std_postreset); | ||
247 | } | ||
248 | |||
249 | /** | 223 | /** |
250 | * hpt366_set_piomode - PIO setup | 224 | * hpt366_set_piomode - PIO setup |
251 | * @ap: ATA interface | 225 | * @ap: ATA interface |
@@ -351,7 +325,7 @@ static struct ata_port_operations hpt366_port_ops = { | |||
351 | 325 | ||
352 | .freeze = ata_bmdma_freeze, | 326 | .freeze = ata_bmdma_freeze, |
353 | .thaw = ata_bmdma_thaw, | 327 | .thaw = ata_bmdma_thaw, |
354 | .error_handler = hpt36x_error_handler, | 328 | .error_handler = ata_bmdma_error_handler, |
355 | .post_internal_cmd = ata_bmdma_post_internal_cmd, | 329 | .post_internal_cmd = ata_bmdma_post_internal_cmd, |
356 | .cable_detect = hpt36x_cable_detect, | 330 | .cable_detect = hpt36x_cable_detect, |
357 | 331 | ||
diff --git a/drivers/ata/pata_hpt37x.c b/drivers/ata/pata_hpt37x.c index 5a0a410654e2..a54c17433eef 100644 --- a/drivers/ata/pata_hpt37x.c +++ b/drivers/ata/pata_hpt37x.c | |||
@@ -961,7 +961,7 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id) | |||
961 | u8 mcr1; | 961 | u8 mcr1; |
962 | u32 freq; | 962 | u32 freq; |
963 | int prefer_dpll = 1; | 963 | int prefer_dpll = 1; |
964 | 964 | ||
965 | unsigned long iobase = pci_resource_start(dev, 4); | 965 | unsigned long iobase = pci_resource_start(dev, 4); |
966 | 966 | ||
967 | const struct hpt_chip *chip_table; | 967 | const struct hpt_chip *chip_table; |
@@ -1055,7 +1055,7 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id) | |||
1055 | */ | 1055 | */ |
1056 | 1056 | ||
1057 | pci_write_config_byte(dev, 0x5b, 0x23); | 1057 | pci_write_config_byte(dev, 0x5b, 0x23); |
1058 | 1058 | ||
1059 | /* | 1059 | /* |
1060 | * HighPoint does this for HPT372A. | 1060 | * HighPoint does this for HPT372A. |
1061 | * NOTE: This register is only writeable via I/O space. | 1061 | * NOTE: This register is only writeable via I/O space. |
@@ -1088,7 +1088,7 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id) | |||
1088 | * Turn the frequency check into a band and then find a timing | 1088 | * Turn the frequency check into a band and then find a timing |
1089 | * table to match it. | 1089 | * table to match it. |
1090 | */ | 1090 | */ |
1091 | 1091 | ||
1092 | clock_slot = hpt37x_clock_slot(freq, chip_table->base); | 1092 | clock_slot = hpt37x_clock_slot(freq, chip_table->base); |
1093 | if (chip_table->clocks[clock_slot] == NULL || prefer_dpll) { | 1093 | if (chip_table->clocks[clock_slot] == NULL || prefer_dpll) { |
1094 | /* | 1094 | /* |
@@ -1099,11 +1099,11 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id) | |||
1099 | */ | 1099 | */ |
1100 | unsigned int f_low, f_high; | 1100 | unsigned int f_low, f_high; |
1101 | int adjust; | 1101 | int adjust; |
1102 | 1102 | ||
1103 | clock_slot = 2; | 1103 | clock_slot = 2; |
1104 | if (port->udma_mask & 0xE0) | 1104 | if (port->udma_mask & 0xE0) |
1105 | clock_slot = 3; | 1105 | clock_slot = 3; |
1106 | 1106 | ||
1107 | f_low = (MHz[clock_slot] * chip_table->base) / 192; | 1107 | f_low = (MHz[clock_slot] * chip_table->base) / 192; |
1108 | f_high = f_low + 2; | 1108 | f_high = f_low + 2; |
1109 | 1109 | ||
diff --git a/drivers/ata/pata_hpt3x3.c b/drivers/ata/pata_hpt3x3.c index bbabe7902fbb..8ce5e23a5f75 100644 --- a/drivers/ata/pata_hpt3x3.c +++ b/drivers/ata/pata_hpt3x3.c | |||
@@ -23,7 +23,7 @@ | |||
23 | #include <linux/libata.h> | 23 | #include <linux/libata.h> |
24 | 24 | ||
25 | #define DRV_NAME "pata_hpt3x3" | 25 | #define DRV_NAME "pata_hpt3x3" |
26 | #define DRV_VERSION "0.4.2" | 26 | #define DRV_VERSION "0.4.3" |
27 | 27 | ||
28 | /** | 28 | /** |
29 | * hpt3x3_set_piomode - PIO setup | 29 | * hpt3x3_set_piomode - PIO setup |
diff --git a/drivers/ata/pata_isapnp.c b/drivers/ata/pata_isapnp.c index d042efdfbac4..1f647b648204 100644 --- a/drivers/ata/pata_isapnp.c +++ b/drivers/ata/pata_isapnp.c | |||
@@ -17,7 +17,7 @@ | |||
17 | #include <linux/libata.h> | 17 | #include <linux/libata.h> |
18 | 18 | ||
19 | #define DRV_NAME "pata_isapnp" | 19 | #define DRV_NAME "pata_isapnp" |
20 | #define DRV_VERSION "0.2.0" | 20 | #define DRV_VERSION "0.2.1" |
21 | 21 | ||
22 | static struct scsi_host_template isapnp_sht = { | 22 | static struct scsi_host_template isapnp_sht = { |
23 | .module = THIS_MODULE, | 23 | .module = THIS_MODULE, |
diff --git a/drivers/ata/pata_it8213.c b/drivers/ata/pata_it8213.c index a769952646e1..95b0bb61788b 100644 --- a/drivers/ata/pata_it8213.c +++ b/drivers/ata/pata_it8213.c | |||
@@ -19,7 +19,7 @@ | |||
19 | #include <linux/ata.h> | 19 | #include <linux/ata.h> |
20 | 20 | ||
21 | #define DRV_NAME "pata_it8213" | 21 | #define DRV_NAME "pata_it8213" |
22 | #define DRV_VERSION "0.0.2" | 22 | #define DRV_VERSION "0.0.3" |
23 | 23 | ||
24 | /** | 24 | /** |
25 | * it8213_pre_reset - check for 40/80 pin | 25 | * it8213_pre_reset - check for 40/80 pin |
diff --git a/drivers/ata/pata_ixp4xx_cf.c b/drivers/ata/pata_ixp4xx_cf.c index b994351fbcd0..8d2bc1e9e871 100644 --- a/drivers/ata/pata_ixp4xx_cf.c +++ b/drivers/ata/pata_ixp4xx_cf.c | |||
@@ -23,7 +23,7 @@ | |||
23 | #include <scsi/scsi_host.h> | 23 | #include <scsi/scsi_host.h> |
24 | 24 | ||
25 | #define DRV_NAME "pata_ixp4xx_cf" | 25 | #define DRV_NAME "pata_ixp4xx_cf" |
26 | #define DRV_VERSION "0.1.2" | 26 | #define DRV_VERSION "0.1.3" |
27 | 27 | ||
28 | static int ixp4xx_set_mode(struct ata_port *ap, struct ata_device **error) | 28 | static int ixp4xx_set_mode(struct ata_port *ap, struct ata_device **error) |
29 | { | 29 | { |
diff --git a/drivers/ata/pata_jmicron.c b/drivers/ata/pata_jmicron.c index 8d799e87f752..2af7ff8256ca 100644 --- a/drivers/ata/pata_jmicron.c +++ b/drivers/ata/pata_jmicron.c | |||
@@ -19,7 +19,7 @@ | |||
19 | #include <linux/ata.h> | 19 | #include <linux/ata.h> |
20 | 20 | ||
21 | #define DRV_NAME "pata_jmicron" | 21 | #define DRV_NAME "pata_jmicron" |
22 | #define DRV_VERSION "0.1.4" | 22 | #define DRV_VERSION "0.1.5" |
23 | 23 | ||
24 | typedef enum { | 24 | typedef enum { |
25 | PORT_PATA0 = 0, | 25 | PORT_PATA0 = 0, |
diff --git a/drivers/ata/pata_legacy.c b/drivers/ata/pata_legacy.c index 707099291e01..edffc25d2d3f 100644 --- a/drivers/ata/pata_legacy.c +++ b/drivers/ata/pata_legacy.c | |||
@@ -64,7 +64,7 @@ | |||
64 | #include <linux/platform_device.h> | 64 | #include <linux/platform_device.h> |
65 | 65 | ||
66 | #define DRV_NAME "pata_legacy" | 66 | #define DRV_NAME "pata_legacy" |
67 | #define DRV_VERSION "0.5.4" | 67 | #define DRV_VERSION "0.5.5" |
68 | 68 | ||
69 | #define NR_HOST 6 | 69 | #define NR_HOST 6 |
70 | 70 | ||
diff --git a/drivers/ata/pata_platform.c b/drivers/ata/pata_platform.c index 1f6384895a4f..cbb7866940d6 100644 --- a/drivers/ata/pata_platform.c +++ b/drivers/ata/pata_platform.c | |||
@@ -22,7 +22,7 @@ | |||
22 | #include <linux/pata_platform.h> | 22 | #include <linux/pata_platform.h> |
23 | 23 | ||
24 | #define DRV_NAME "pata_platform" | 24 | #define DRV_NAME "pata_platform" |
25 | #define DRV_VERSION "0.1.2" | 25 | #define DRV_VERSION "1.0" |
26 | 26 | ||
27 | static int pio_mask = 1; | 27 | static int pio_mask = 1; |
28 | 28 | ||
diff --git a/drivers/ata/pata_qdi.c b/drivers/ata/pata_qdi.c index fb8c9e14b8d4..1998c19e8743 100644 --- a/drivers/ata/pata_qdi.c +++ b/drivers/ata/pata_qdi.c | |||
@@ -26,7 +26,7 @@ | |||
26 | #include <linux/platform_device.h> | 26 | #include <linux/platform_device.h> |
27 | 27 | ||
28 | #define DRV_NAME "pata_qdi" | 28 | #define DRV_NAME "pata_qdi" |
29 | #define DRV_VERSION "0.3.0" | 29 | #define DRV_VERSION "0.3.1" |
30 | 30 | ||
31 | #define NR_HOST 4 /* Two 6580s */ | 31 | #define NR_HOST 4 /* Two 6580s */ |
32 | 32 | ||
diff --git a/drivers/ata/pata_rz1000.c b/drivers/ata/pata_rz1000.c index 2bfd7ef42af5..a3488b41ad26 100644 --- a/drivers/ata/pata_rz1000.c +++ b/drivers/ata/pata_rz1000.c | |||
@@ -21,7 +21,7 @@ | |||
21 | #include <linux/libata.h> | 21 | #include <linux/libata.h> |
22 | 22 | ||
23 | #define DRV_NAME "pata_rz1000" | 23 | #define DRV_NAME "pata_rz1000" |
24 | #define DRV_VERSION "0.2.3" | 24 | #define DRV_VERSION "0.2.4" |
25 | 25 | ||
26 | 26 | ||
27 | /** | 27 | /** |
diff --git a/drivers/ata/pata_sc1200.c b/drivers/ata/pata_sc1200.c index 225013ecf4b6..1233063ab9a8 100644 --- a/drivers/ata/pata_sc1200.c +++ b/drivers/ata/pata_sc1200.c | |||
@@ -40,7 +40,7 @@ | |||
40 | #include <linux/libata.h> | 40 | #include <linux/libata.h> |
41 | 41 | ||
42 | #define DRV_NAME "sc1200" | 42 | #define DRV_NAME "sc1200" |
43 | #define DRV_VERSION "0.2.4" | 43 | #define DRV_VERSION "0.2.5" |
44 | 44 | ||
45 | #define SC1200_REV_A 0x00 | 45 | #define SC1200_REV_A 0x00 |
46 | #define SC1200_REV_B1 0x01 | 46 | #define SC1200_REV_B1 0x01 |
diff --git a/drivers/ata/pata_scc.c b/drivers/ata/pata_scc.c index 844e53b280c7..aa138d211b09 100644 --- a/drivers/ata/pata_scc.c +++ b/drivers/ata/pata_scc.c | |||
@@ -43,7 +43,7 @@ | |||
43 | #include <linux/libata.h> | 43 | #include <linux/libata.h> |
44 | 44 | ||
45 | #define DRV_NAME "pata_scc" | 45 | #define DRV_NAME "pata_scc" |
46 | #define DRV_VERSION "0.1" | 46 | #define DRV_VERSION "0.2" |
47 | 47 | ||
48 | #define PCI_DEVICE_ID_TOSHIBA_SCC_ATA 0x01b4 | 48 | #define PCI_DEVICE_ID_TOSHIBA_SCC_ATA 0x01b4 |
49 | 49 | ||
diff --git a/drivers/ata/pata_serverworks.c b/drivers/ata/pata_serverworks.c index dee6e211949d..1e8f421963c7 100644 --- a/drivers/ata/pata_serverworks.c +++ b/drivers/ata/pata_serverworks.c | |||
@@ -41,7 +41,7 @@ | |||
41 | #include <linux/libata.h> | 41 | #include <linux/libata.h> |
42 | 42 | ||
43 | #define DRV_NAME "pata_serverworks" | 43 | #define DRV_NAME "pata_serverworks" |
44 | #define DRV_VERSION "0.4.0" | 44 | #define DRV_VERSION "0.4.1" |
45 | 45 | ||
46 | #define SVWKS_CSB5_REVISION_NEW 0x92 /* min PCI_REVISION_ID for UDMA5 (A2.0) */ | 46 | #define SVWKS_CSB5_REVISION_NEW 0x92 /* min PCI_REVISION_ID for UDMA5 (A2.0) */ |
47 | #define SVWKS_CSB6_REVISION 0xa0 /* min PCI_REVISION_ID for UDMA4 (A1.0) */ | 47 | #define SVWKS_CSB6_REVISION 0xa0 /* min PCI_REVISION_ID for UDMA4 (A1.0) */ |
diff --git a/drivers/ata/pata_sl82c105.c b/drivers/ata/pata_sl82c105.c index f48491ad5f3a..e5aaec43694d 100644 --- a/drivers/ata/pata_sl82c105.c +++ b/drivers/ata/pata_sl82c105.c | |||
@@ -26,7 +26,7 @@ | |||
26 | #include <linux/libata.h> | 26 | #include <linux/libata.h> |
27 | 27 | ||
28 | #define DRV_NAME "pata_sl82c105" | 28 | #define DRV_NAME "pata_sl82c105" |
29 | #define DRV_VERSION "0.3.0" | 29 | #define DRV_VERSION "0.3.1" |
30 | 30 | ||
31 | enum { | 31 | enum { |
32 | /* | 32 | /* |
diff --git a/drivers/ata/pata_winbond.c b/drivers/ata/pata_winbond.c index cc4ad271afb5..83abfeca4057 100644 --- a/drivers/ata/pata_winbond.c +++ b/drivers/ata/pata_winbond.c | |||
@@ -16,7 +16,7 @@ | |||
16 | #include <linux/platform_device.h> | 16 | #include <linux/platform_device.h> |
17 | 17 | ||
18 | #define DRV_NAME "pata_winbond" | 18 | #define DRV_NAME "pata_winbond" |
19 | #define DRV_VERSION "0.0.2" | 19 | #define DRV_VERSION "0.0.3" |
20 | 20 | ||
21 | #define NR_HOST 4 /* Two winbond controllers, two channels each */ | 21 | #define NR_HOST 4 /* Two winbond controllers, two channels each */ |
22 | 22 | ||
diff --git a/drivers/ata/pdc_adma.c b/drivers/ata/pdc_adma.c index 52b69530ab29..f12c2b6ac08e 100644 --- a/drivers/ata/pdc_adma.c +++ b/drivers/ata/pdc_adma.c | |||
@@ -44,7 +44,7 @@ | |||
44 | #include <linux/libata.h> | 44 | #include <linux/libata.h> |
45 | 45 | ||
46 | #define DRV_NAME "pdc_adma" | 46 | #define DRV_NAME "pdc_adma" |
47 | #define DRV_VERSION "0.05" | 47 | #define DRV_VERSION "0.06" |
48 | 48 | ||
49 | /* macro to calculate base address for ATA regs */ | 49 | /* macro to calculate base address for ATA regs */ |
50 | #define ADMA_ATA_REGS(base,port_no) ((base) + ((port_no) * 0x40)) | 50 | #define ADMA_ATA_REGS(base,port_no) ((base) + ((port_no) * 0x40)) |
diff --git a/drivers/ata/sata_inic162x.c b/drivers/ata/sata_inic162x.c index bda5e7747c21..2d80c9d95e95 100644 --- a/drivers/ata/sata_inic162x.c +++ b/drivers/ata/sata_inic162x.c | |||
@@ -28,7 +28,7 @@ | |||
28 | #include <scsi/scsi_device.h> | 28 | #include <scsi/scsi_device.h> |
29 | 29 | ||
30 | #define DRV_NAME "sata_inic162x" | 30 | #define DRV_NAME "sata_inic162x" |
31 | #define DRV_VERSION "0.1" | 31 | #define DRV_VERSION "0.2" |
32 | 32 | ||
33 | enum { | 33 | enum { |
34 | MMIO_BAR = 5, | 34 | MMIO_BAR = 5, |
diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c index cb9b9ac12b4c..705a020e1597 100644 --- a/drivers/ata/sata_mv.c +++ b/drivers/ata/sata_mv.c | |||
@@ -35,7 +35,7 @@ | |||
35 | #include <linux/libata.h> | 35 | #include <linux/libata.h> |
36 | 36 | ||
37 | #define DRV_NAME "sata_mv" | 37 | #define DRV_NAME "sata_mv" |
38 | #define DRV_VERSION "0.8" | 38 | #define DRV_VERSION "0.81" |
39 | 39 | ||
40 | enum { | 40 | enum { |
41 | /* BAR's are enumerated in terms of pci_resource_start() terms */ | 41 | /* BAR's are enumerated in terms of pci_resource_start() terms */ |
diff --git a/drivers/ata/sata_nv.c b/drivers/ata/sata_nv.c index 1a49c777fa6a..adfa693db53d 100644 --- a/drivers/ata/sata_nv.c +++ b/drivers/ata/sata_nv.c | |||
@@ -49,7 +49,7 @@ | |||
49 | #include <linux/libata.h> | 49 | #include <linux/libata.h> |
50 | 50 | ||
51 | #define DRV_NAME "sata_nv" | 51 | #define DRV_NAME "sata_nv" |
52 | #define DRV_VERSION "3.3" | 52 | #define DRV_VERSION "3.4" |
53 | 53 | ||
54 | #define NV_ADMA_DMA_BOUNDARY 0xffffffffUL | 54 | #define NV_ADMA_DMA_BOUNDARY 0xffffffffUL |
55 | 55 | ||
@@ -802,7 +802,7 @@ static irqreturn_t nv_adma_interrupt(int irq, void *dev_instance) | |||
802 | u16 status; | 802 | u16 status; |
803 | u32 gen_ctl; | 803 | u32 gen_ctl; |
804 | u32 notifier, notifier_error; | 804 | u32 notifier, notifier_error; |
805 | 805 | ||
806 | /* if ADMA is disabled, use standard ata interrupt handler */ | 806 | /* if ADMA is disabled, use standard ata interrupt handler */ |
807 | if (pp->flags & NV_ADMA_ATAPI_SETUP_COMPLETE) { | 807 | if (pp->flags & NV_ADMA_ATAPI_SETUP_COMPLETE) { |
808 | u8 irq_stat = readb(host->iomap[NV_MMIO_BAR] + NV_INT_STATUS_CK804) | 808 | u8 irq_stat = readb(host->iomap[NV_MMIO_BAR] + NV_INT_STATUS_CK804) |
@@ -963,7 +963,7 @@ static void nv_adma_irq_clear(struct ata_port *ap) | |||
963 | 963 | ||
964 | /* clear ADMA status */ | 964 | /* clear ADMA status */ |
965 | writew(0xffff, mmio + NV_ADMA_STAT); | 965 | writew(0xffff, mmio + NV_ADMA_STAT); |
966 | 966 | ||
967 | /* clear notifiers - note both ports need to be written with | 967 | /* clear notifiers - note both ports need to be written with |
968 | something even though we are only clearing on one */ | 968 | something even though we are only clearing on one */ |
969 | if (ap->port_no == 0) { | 969 | if (ap->port_no == 0) { |
diff --git a/drivers/ata/sata_qstor.c b/drivers/ata/sata_qstor.c index f5a05de0093d..6688ccb66320 100644 --- a/drivers/ata/sata_qstor.c +++ b/drivers/ata/sata_qstor.c | |||
@@ -39,7 +39,7 @@ | |||
39 | #include <linux/libata.h> | 39 | #include <linux/libata.h> |
40 | 40 | ||
41 | #define DRV_NAME "sata_qstor" | 41 | #define DRV_NAME "sata_qstor" |
42 | #define DRV_VERSION "0.07" | 42 | #define DRV_VERSION "0.08" |
43 | 43 | ||
44 | enum { | 44 | enum { |
45 | QS_MMIO_BAR = 4, | 45 | QS_MMIO_BAR = 4, |
diff --git a/drivers/ata/sata_sil.c b/drivers/ata/sata_sil.c index e8483aadd11b..a3b339bcf3cf 100644 --- a/drivers/ata/sata_sil.c +++ b/drivers/ata/sata_sil.c | |||
@@ -305,7 +305,7 @@ static int sil_set_mode (struct ata_port *ap, struct ata_device **r_failed) | |||
305 | u32 tmp, dev_mode[2]; | 305 | u32 tmp, dev_mode[2]; |
306 | unsigned int i; | 306 | unsigned int i; |
307 | int rc; | 307 | int rc; |
308 | 308 | ||
309 | rc = ata_do_set_mode(ap, r_failed); | 309 | rc = ata_do_set_mode(ap, r_failed); |
310 | if (rc) | 310 | if (rc) |
311 | return rc; | 311 | return rc; |
diff --git a/drivers/ata/sata_sil24.c b/drivers/ata/sata_sil24.c index 0cb6618935b1..0ddfae9911cd 100644 --- a/drivers/ata/sata_sil24.c +++ b/drivers/ata/sata_sil24.c | |||
@@ -30,7 +30,7 @@ | |||
30 | #include <linux/libata.h> | 30 | #include <linux/libata.h> |
31 | 31 | ||
32 | #define DRV_NAME "sata_sil24" | 32 | #define DRV_NAME "sata_sil24" |
33 | #define DRV_VERSION "0.8" | 33 | #define DRV_VERSION "0.9" |
34 | 34 | ||
35 | /* | 35 | /* |
36 | * Port request block (PRB) 32 bytes | 36 | * Port request block (PRB) 32 bytes |
diff --git a/drivers/ata/sata_sis.c b/drivers/ata/sata_sis.c index ee66c5fa7ac8..51d9251b0898 100644 --- a/drivers/ata/sata_sis.c +++ b/drivers/ata/sata_sis.c | |||
@@ -43,7 +43,7 @@ | |||
43 | #include "sis.h" | 43 | #include "sis.h" |
44 | 44 | ||
45 | #define DRV_NAME "sata_sis" | 45 | #define DRV_NAME "sata_sis" |
46 | #define DRV_VERSION "0.7" | 46 | #define DRV_VERSION "0.8" |
47 | 47 | ||
48 | enum { | 48 | enum { |
49 | sis_180 = 0, | 49 | sis_180 = 0, |
diff --git a/drivers/ata/sata_svw.c b/drivers/ata/sata_svw.c index 17246734fe76..bcb2cd8b063d 100644 --- a/drivers/ata/sata_svw.c +++ b/drivers/ata/sata_svw.c | |||
@@ -53,7 +53,7 @@ | |||
53 | #endif /* CONFIG_PPC_OF */ | 53 | #endif /* CONFIG_PPC_OF */ |
54 | 54 | ||
55 | #define DRV_NAME "sata_svw" | 55 | #define DRV_NAME "sata_svw" |
56 | #define DRV_VERSION "2.1" | 56 | #define DRV_VERSION "2.2" |
57 | 57 | ||
58 | enum { | 58 | enum { |
59 | /* ap->flags bits */ | 59 | /* ap->flags bits */ |
diff --git a/drivers/ata/sata_sx4.c b/drivers/ata/sata_sx4.c index 3a4f44559d0a..2d14f3d56d92 100644 --- a/drivers/ata/sata_sx4.c +++ b/drivers/ata/sata_sx4.c | |||
@@ -44,7 +44,7 @@ | |||
44 | #include "sata_promise.h" | 44 | #include "sata_promise.h" |
45 | 45 | ||
46 | #define DRV_NAME "sata_sx4" | 46 | #define DRV_NAME "sata_sx4" |
47 | #define DRV_VERSION "0.10" | 47 | #define DRV_VERSION "0.11" |
48 | 48 | ||
49 | 49 | ||
50 | enum { | 50 | enum { |
diff --git a/drivers/ata/sata_uli.c b/drivers/ata/sata_uli.c index 006f5e352658..6815de7cca79 100644 --- a/drivers/ata/sata_uli.c +++ b/drivers/ata/sata_uli.c | |||
@@ -36,7 +36,7 @@ | |||
36 | #include <linux/libata.h> | 36 | #include <linux/libata.h> |
37 | 37 | ||
38 | #define DRV_NAME "sata_uli" | 38 | #define DRV_NAME "sata_uli" |
39 | #define DRV_VERSION "1.1" | 39 | #define DRV_VERSION "1.2" |
40 | 40 | ||
41 | enum { | 41 | enum { |
42 | uli_5289 = 0, | 42 | uli_5289 = 0, |
diff --git a/drivers/ata/sata_via.c b/drivers/ata/sata_via.c index ac4f43c4993f..01bba26d8d1a 100644 --- a/drivers/ata/sata_via.c +++ b/drivers/ata/sata_via.c | |||
@@ -46,7 +46,7 @@ | |||
46 | #include <linux/libata.h> | 46 | #include <linux/libata.h> |
47 | 47 | ||
48 | #define DRV_NAME "sata_via" | 48 | #define DRV_NAME "sata_via" |
49 | #define DRV_VERSION "2.1" | 49 | #define DRV_VERSION "2.2" |
50 | 50 | ||
51 | enum board_ids_enum { | 51 | enum board_ids_enum { |
52 | vt6420, | 52 | vt6420, |
diff --git a/drivers/ata/sata_vsc.c b/drivers/ata/sata_vsc.c index 80126f835d32..81330175fc89 100644 --- a/drivers/ata/sata_vsc.c +++ b/drivers/ata/sata_vsc.c | |||
@@ -47,7 +47,7 @@ | |||
47 | #include <linux/libata.h> | 47 | #include <linux/libata.h> |
48 | 48 | ||
49 | #define DRV_NAME "sata_vsc" | 49 | #define DRV_NAME "sata_vsc" |
50 | #define DRV_VERSION "2.1" | 50 | #define DRV_VERSION "2.2" |
51 | 51 | ||
52 | enum { | 52 | enum { |
53 | VSC_MMIO_BAR = 0, | 53 | VSC_MMIO_BAR = 0, |
diff --git a/drivers/base/dmapool.c b/drivers/base/dmapool.c index 9406259754ad..91970e9bb05e 100644 --- a/drivers/base/dmapool.c +++ b/drivers/base/dmapool.c | |||
@@ -8,6 +8,7 @@ | |||
8 | #include <linux/slab.h> | 8 | #include <linux/slab.h> |
9 | #include <linux/module.h> | 9 | #include <linux/module.h> |
10 | #include <linux/poison.h> | 10 | #include <linux/poison.h> |
11 | #include <linux/sched.h> | ||
11 | 12 | ||
12 | /* | 13 | /* |
13 | * Pool allocator ... wraps the dma_alloc_coherent page allocator, so | 14 | * Pool allocator ... wraps the dma_alloc_coherent page allocator, so |
diff --git a/drivers/char/agp/frontend.c b/drivers/char/agp/frontend.c index 679d7f972439..c7ed617aa7ff 100644 --- a/drivers/char/agp/frontend.c +++ b/drivers/char/agp/frontend.c | |||
@@ -37,6 +37,7 @@ | |||
37 | #include <linux/agpgart.h> | 37 | #include <linux/agpgart.h> |
38 | #include <linux/slab.h> | 38 | #include <linux/slab.h> |
39 | #include <linux/mm.h> | 39 | #include <linux/mm.h> |
40 | #include <linux/sched.h> | ||
40 | #include <asm/uaccess.h> | 41 | #include <asm/uaccess.h> |
41 | #include <asm/pgtable.h> | 42 | #include <asm/pgtable.h> |
42 | #include "agp.h" | 43 | #include "agp.h" |
diff --git a/drivers/char/agp/generic.c b/drivers/char/agp/generic.c index 45aeb917ec63..d535c406b319 100644 --- a/drivers/char/agp/generic.c +++ b/drivers/char/agp/generic.c | |||
@@ -37,6 +37,7 @@ | |||
37 | #include <linux/vmalloc.h> | 37 | #include <linux/vmalloc.h> |
38 | #include <linux/dma-mapping.h> | 38 | #include <linux/dma-mapping.h> |
39 | #include <linux/mm.h> | 39 | #include <linux/mm.h> |
40 | #include <linux/sched.h> | ||
40 | #include <asm/io.h> | 41 | #include <asm/io.h> |
41 | #include <asm/cacheflush.h> | 42 | #include <asm/cacheflush.h> |
42 | #include <asm/pgtable.h> | 43 | #include <asm/pgtable.h> |
diff --git a/drivers/char/hangcheck-timer.c b/drivers/char/hangcheck-timer.c index f0e7263dfcde..0e8ceea5ea78 100644 --- a/drivers/char/hangcheck-timer.c +++ b/drivers/char/hangcheck-timer.c | |||
@@ -48,7 +48,7 @@ | |||
48 | #include <linux/delay.h> | 48 | #include <linux/delay.h> |
49 | #include <asm/uaccess.h> | 49 | #include <asm/uaccess.h> |
50 | #include <linux/sysrq.h> | 50 | #include <linux/sysrq.h> |
51 | 51 | #include <linux/timer.h> | |
52 | 52 | ||
53 | #define VERSION_STR "0.9.0" | 53 | #define VERSION_STR "0.9.0" |
54 | 54 | ||
diff --git a/drivers/infiniband/core/cache.c b/drivers/infiniband/core/cache.c index 558c9a0fc8b9..e85f7013de57 100644 --- a/drivers/infiniband/core/cache.c +++ b/drivers/infiniband/core/cache.c | |||
@@ -38,6 +38,7 @@ | |||
38 | #include <linux/module.h> | 38 | #include <linux/module.h> |
39 | #include <linux/errno.h> | 39 | #include <linux/errno.h> |
40 | #include <linux/slab.h> | 40 | #include <linux/slab.h> |
41 | #include <linux/workqueue.h> | ||
41 | 42 | ||
42 | #include <rdma/ib_cache.h> | 43 | #include <rdma/ib_cache.h> |
43 | 44 | ||
diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c index eff591deeb46..e840434a96d8 100644 --- a/drivers/infiniband/core/cm.c +++ b/drivers/infiniband/core/cm.c | |||
@@ -306,7 +306,9 @@ static int cm_alloc_id(struct cm_id_private *cm_id_priv) | |||
306 | do { | 306 | do { |
307 | spin_lock_irqsave(&cm.lock, flags); | 307 | spin_lock_irqsave(&cm.lock, flags); |
308 | ret = idr_get_new_above(&cm.local_id_table, cm_id_priv, | 308 | ret = idr_get_new_above(&cm.local_id_table, cm_id_priv, |
309 | next_id++, &id); | 309 | next_id, &id); |
310 | if (!ret) | ||
311 | next_id = ((unsigned) id + 1) & MAX_ID_MASK; | ||
310 | spin_unlock_irqrestore(&cm.lock, flags); | 312 | spin_unlock_irqrestore(&cm.lock, flags); |
311 | } while( (ret == -EAGAIN) && idr_pre_get(&cm.local_id_table, GFP_KERNEL) ); | 313 | } while( (ret == -EAGAIN) && idr_pre_get(&cm.local_id_table, GFP_KERNEL) ); |
312 | 314 | ||
diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c index 592c90aa3183..3ada17c0f239 100644 --- a/drivers/infiniband/core/device.c +++ b/drivers/infiniband/core/device.c | |||
@@ -40,6 +40,7 @@ | |||
40 | #include <linux/slab.h> | 40 | #include <linux/slab.h> |
41 | #include <linux/init.h> | 41 | #include <linux/init.h> |
42 | #include <linux/mutex.h> | 42 | #include <linux/mutex.h> |
43 | #include <linux/workqueue.h> | ||
43 | 44 | ||
44 | #include "core_priv.h" | 45 | #include "core_priv.h" |
45 | 46 | ||
@@ -149,6 +150,18 @@ static int alloc_name(char *name) | |||
149 | return 0; | 150 | return 0; |
150 | } | 151 | } |
151 | 152 | ||
153 | static int start_port(struct ib_device *device) | ||
154 | { | ||
155 | return (device->node_type == RDMA_NODE_IB_SWITCH) ? 0 : 1; | ||
156 | } | ||
157 | |||
158 | |||
159 | static int end_port(struct ib_device *device) | ||
160 | { | ||
161 | return (device->node_type == RDMA_NODE_IB_SWITCH) ? | ||
162 | 0 : device->phys_port_cnt; | ||
163 | } | ||
164 | |||
152 | /** | 165 | /** |
153 | * ib_alloc_device - allocate an IB device struct | 166 | * ib_alloc_device - allocate an IB device struct |
154 | * @size:size of structure to allocate | 167 | * @size:size of structure to allocate |
@@ -208,6 +221,45 @@ static int add_client_context(struct ib_device *device, struct ib_client *client | |||
208 | return 0; | 221 | return 0; |
209 | } | 222 | } |
210 | 223 | ||
224 | static int read_port_table_lengths(struct ib_device *device) | ||
225 | { | ||
226 | struct ib_port_attr *tprops = NULL; | ||
227 | int num_ports, ret = -ENOMEM; | ||
228 | u8 port_index; | ||
229 | |||
230 | tprops = kmalloc(sizeof *tprops, GFP_KERNEL); | ||
231 | if (!tprops) | ||
232 | goto out; | ||
233 | |||
234 | num_ports = end_port(device) - start_port(device) + 1; | ||
235 | |||
236 | device->pkey_tbl_len = kmalloc(sizeof *device->pkey_tbl_len * num_ports, | ||
237 | GFP_KERNEL); | ||
238 | device->gid_tbl_len = kmalloc(sizeof *device->gid_tbl_len * num_ports, | ||
239 | GFP_KERNEL); | ||
240 | if (!device->pkey_tbl_len || !device->gid_tbl_len) | ||
241 | goto err; | ||
242 | |||
243 | for (port_index = 0; port_index < num_ports; ++port_index) { | ||
244 | ret = ib_query_port(device, port_index + start_port(device), | ||
245 | tprops); | ||
246 | if (ret) | ||
247 | goto err; | ||
248 | device->pkey_tbl_len[port_index] = tprops->pkey_tbl_len; | ||
249 | device->gid_tbl_len[port_index] = tprops->gid_tbl_len; | ||
250 | } | ||
251 | |||
252 | ret = 0; | ||
253 | goto out; | ||
254 | |||
255 | err: | ||
256 | kfree(device->gid_tbl_len); | ||
257 | kfree(device->pkey_tbl_len); | ||
258 | out: | ||
259 | kfree(tprops); | ||
260 | return ret; | ||
261 | } | ||
262 | |||
211 | /** | 263 | /** |
212 | * ib_register_device - Register an IB device with IB core | 264 | * ib_register_device - Register an IB device with IB core |
213 | * @device:Device to register | 265 | * @device:Device to register |
@@ -239,10 +291,19 @@ int ib_register_device(struct ib_device *device) | |||
239 | spin_lock_init(&device->event_handler_lock); | 291 | spin_lock_init(&device->event_handler_lock); |
240 | spin_lock_init(&device->client_data_lock); | 292 | spin_lock_init(&device->client_data_lock); |
241 | 293 | ||
294 | ret = read_port_table_lengths(device); | ||
295 | if (ret) { | ||
296 | printk(KERN_WARNING "Couldn't create table lengths cache for device %s\n", | ||
297 | device->name); | ||
298 | goto out; | ||
299 | } | ||
300 | |||
242 | ret = ib_device_register_sysfs(device); | 301 | ret = ib_device_register_sysfs(device); |
243 | if (ret) { | 302 | if (ret) { |
244 | printk(KERN_WARNING "Couldn't register device %s with driver model\n", | 303 | printk(KERN_WARNING "Couldn't register device %s with driver model\n", |
245 | device->name); | 304 | device->name); |
305 | kfree(device->gid_tbl_len); | ||
306 | kfree(device->pkey_tbl_len); | ||
246 | goto out; | 307 | goto out; |
247 | } | 308 | } |
248 | 309 | ||
@@ -284,6 +345,9 @@ void ib_unregister_device(struct ib_device *device) | |||
284 | 345 | ||
285 | list_del(&device->core_list); | 346 | list_del(&device->core_list); |
286 | 347 | ||
348 | kfree(device->gid_tbl_len); | ||
349 | kfree(device->pkey_tbl_len); | ||
350 | |||
287 | mutex_unlock(&device_mutex); | 351 | mutex_unlock(&device_mutex); |
288 | 352 | ||
289 | spin_lock_irqsave(&device->client_data_lock, flags); | 353 | spin_lock_irqsave(&device->client_data_lock, flags); |
@@ -506,10 +570,7 @@ int ib_query_port(struct ib_device *device, | |||
506 | u8 port_num, | 570 | u8 port_num, |
507 | struct ib_port_attr *port_attr) | 571 | struct ib_port_attr *port_attr) |
508 | { | 572 | { |
509 | if (device->node_type == RDMA_NODE_IB_SWITCH) { | 573 | if (port_num < start_port(device) || port_num > end_port(device)) |
510 | if (port_num) | ||
511 | return -EINVAL; | ||
512 | } else if (port_num < 1 || port_num > device->phys_port_cnt) | ||
513 | return -EINVAL; | 574 | return -EINVAL; |
514 | 575 | ||
515 | return device->query_port(device, port_num, port_attr); | 576 | return device->query_port(device, port_num, port_attr); |
@@ -581,10 +642,7 @@ int ib_modify_port(struct ib_device *device, | |||
581 | u8 port_num, int port_modify_mask, | 642 | u8 port_num, int port_modify_mask, |
582 | struct ib_port_modify *port_modify) | 643 | struct ib_port_modify *port_modify) |
583 | { | 644 | { |
584 | if (device->node_type == RDMA_NODE_IB_SWITCH) { | 645 | if (port_num < start_port(device) || port_num > end_port(device)) |
585 | if (port_num) | ||
586 | return -EINVAL; | ||
587 | } else if (port_num < 1 || port_num > device->phys_port_cnt) | ||
588 | return -EINVAL; | 646 | return -EINVAL; |
589 | 647 | ||
590 | return device->modify_port(device, port_num, port_modify_mask, | 648 | return device->modify_port(device, port_num, port_modify_mask, |
@@ -592,6 +650,68 @@ int ib_modify_port(struct ib_device *device, | |||
592 | } | 650 | } |
593 | EXPORT_SYMBOL(ib_modify_port); | 651 | EXPORT_SYMBOL(ib_modify_port); |
594 | 652 | ||
653 | /** | ||
654 | * ib_find_gid - Returns the port number and GID table index where | ||
655 | * a specified GID value occurs. | ||
656 | * @device: The device to query. | ||
657 | * @gid: The GID value to search for. | ||
658 | * @port_num: The port number of the device where the GID value was found. | ||
659 | * @index: The index into the GID table where the GID was found. This | ||
660 | * parameter may be NULL. | ||
661 | */ | ||
662 | int ib_find_gid(struct ib_device *device, union ib_gid *gid, | ||
663 | u8 *port_num, u16 *index) | ||
664 | { | ||
665 | union ib_gid tmp_gid; | ||
666 | int ret, port, i; | ||
667 | |||
668 | for (port = start_port(device); port <= end_port(device); ++port) { | ||
669 | for (i = 0; i < device->gid_tbl_len[port - start_port(device)]; ++i) { | ||
670 | ret = ib_query_gid(device, port, i, &tmp_gid); | ||
671 | if (ret) | ||
672 | return ret; | ||
673 | if (!memcmp(&tmp_gid, gid, sizeof *gid)) { | ||
674 | *port_num = port; | ||
675 | if (index) | ||
676 | *index = i; | ||
677 | return 0; | ||
678 | } | ||
679 | } | ||
680 | } | ||
681 | |||
682 | return -ENOENT; | ||
683 | } | ||
684 | EXPORT_SYMBOL(ib_find_gid); | ||
685 | |||
686 | /** | ||
687 | * ib_find_pkey - Returns the PKey table index where a specified | ||
688 | * PKey value occurs. | ||
689 | * @device: The device to query. | ||
690 | * @port_num: The port number of the device to search for the PKey. | ||
691 | * @pkey: The PKey value to search for. | ||
692 | * @index: The index into the PKey table where the PKey was found. | ||
693 | */ | ||
694 | int ib_find_pkey(struct ib_device *device, | ||
695 | u8 port_num, u16 pkey, u16 *index) | ||
696 | { | ||
697 | int ret, i; | ||
698 | u16 tmp_pkey; | ||
699 | |||
700 | for (i = 0; i < device->pkey_tbl_len[port_num - start_port(device)]; ++i) { | ||
701 | ret = ib_query_pkey(device, port_num, i, &tmp_pkey); | ||
702 | if (ret) | ||
703 | return ret; | ||
704 | |||
705 | if (pkey == tmp_pkey) { | ||
706 | *index = i; | ||
707 | return 0; | ||
708 | } | ||
709 | } | ||
710 | |||
711 | return -ENOENT; | ||
712 | } | ||
713 | EXPORT_SYMBOL(ib_find_pkey); | ||
714 | |||
595 | static int __init ib_core_init(void) | 715 | static int __init ib_core_init(void) |
596 | { | 716 | { |
597 | int ret; | 717 | int ret; |
diff --git a/drivers/infiniband/core/umem.c b/drivers/infiniband/core/umem.c index f32ca5fbb26b..b4aec5103c99 100644 --- a/drivers/infiniband/core/umem.c +++ b/drivers/infiniband/core/umem.c | |||
@@ -36,6 +36,7 @@ | |||
36 | 36 | ||
37 | #include <linux/mm.h> | 37 | #include <linux/mm.h> |
38 | #include <linux/dma-mapping.h> | 38 | #include <linux/dma-mapping.h> |
39 | #include <linux/sched.h> | ||
39 | 40 | ||
40 | #include "uverbs.h" | 41 | #include "uverbs.h" |
41 | 42 | ||
@@ -209,8 +210,10 @@ void ib_umem_release(struct ib_umem *umem) | |||
209 | __ib_umem_release(umem->context->device, umem, 1); | 210 | __ib_umem_release(umem->context->device, umem, 1); |
210 | 211 | ||
211 | mm = get_task_mm(current); | 212 | mm = get_task_mm(current); |
212 | if (!mm) | 213 | if (!mm) { |
214 | kfree(umem); | ||
213 | return; | 215 | return; |
216 | } | ||
214 | 217 | ||
215 | diff = PAGE_ALIGN(umem->length + umem->offset) >> PAGE_SHIFT; | 218 | diff = PAGE_ALIGN(umem->length + umem->offset) >> PAGE_SHIFT; |
216 | 219 | ||
diff --git a/drivers/infiniband/hw/ehca/ehca_mrmw.c b/drivers/infiniband/hw/ehca/ehca_mrmw.c index 84c5bb498563..add79bd44e39 100644 --- a/drivers/infiniband/hw/ehca/ehca_mrmw.c +++ b/drivers/infiniband/hw/ehca/ehca_mrmw.c | |||
@@ -2050,13 +2050,10 @@ int ehca_mrmw_map_hrc_alloc(const u64 hipz_rc) | |||
2050 | switch (hipz_rc) { | 2050 | switch (hipz_rc) { |
2051 | case H_SUCCESS: /* successful completion */ | 2051 | case H_SUCCESS: /* successful completion */ |
2052 | return 0; | 2052 | return 0; |
2053 | case H_ADAPTER_PARM: /* invalid adapter handle */ | ||
2054 | case H_RT_PARM: /* invalid resource type */ | ||
2055 | case H_NOT_ENOUGH_RESOURCES: /* insufficient resources */ | 2053 | case H_NOT_ENOUGH_RESOURCES: /* insufficient resources */ |
2056 | case H_MLENGTH_PARM: /* invalid memory length */ | ||
2057 | case H_MEM_ACCESS_PARM: /* invalid access controls */ | ||
2058 | case H_CONSTRAINED: /* resource constraint */ | 2054 | case H_CONSTRAINED: /* resource constraint */ |
2059 | return -EINVAL; | 2055 | case H_NO_MEM: |
2056 | return -ENOMEM; | ||
2060 | case H_BUSY: /* long busy */ | 2057 | case H_BUSY: /* long busy */ |
2061 | return -EBUSY; | 2058 | return -EBUSY; |
2062 | default: | 2059 | default: |
diff --git a/drivers/infiniband/hw/ipath/ipath_verbs_mcast.c b/drivers/infiniband/hw/ipath/ipath_verbs_mcast.c index 085e28b939ec..dd691cfa5079 100644 --- a/drivers/infiniband/hw/ipath/ipath_verbs_mcast.c +++ b/drivers/infiniband/hw/ipath/ipath_verbs_mcast.c | |||
@@ -165,10 +165,9 @@ static int ipath_mcast_add(struct ipath_ibdev *dev, | |||
165 | { | 165 | { |
166 | struct rb_node **n = &mcast_tree.rb_node; | 166 | struct rb_node **n = &mcast_tree.rb_node; |
167 | struct rb_node *pn = NULL; | 167 | struct rb_node *pn = NULL; |
168 | unsigned long flags; | ||
169 | int ret; | 168 | int ret; |
170 | 169 | ||
171 | spin_lock_irqsave(&mcast_lock, flags); | 170 | spin_lock_irq(&mcast_lock); |
172 | 171 | ||
173 | while (*n) { | 172 | while (*n) { |
174 | struct ipath_mcast *tmcast; | 173 | struct ipath_mcast *tmcast; |
@@ -228,7 +227,7 @@ static int ipath_mcast_add(struct ipath_ibdev *dev, | |||
228 | ret = 0; | 227 | ret = 0; |
229 | 228 | ||
230 | bail: | 229 | bail: |
231 | spin_unlock_irqrestore(&mcast_lock, flags); | 230 | spin_unlock_irq(&mcast_lock); |
232 | 231 | ||
233 | return ret; | 232 | return ret; |
234 | } | 233 | } |
@@ -289,17 +288,16 @@ int ipath_multicast_detach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid) | |||
289 | struct ipath_mcast *mcast = NULL; | 288 | struct ipath_mcast *mcast = NULL; |
290 | struct ipath_mcast_qp *p, *tmp; | 289 | struct ipath_mcast_qp *p, *tmp; |
291 | struct rb_node *n; | 290 | struct rb_node *n; |
292 | unsigned long flags; | ||
293 | int last = 0; | 291 | int last = 0; |
294 | int ret; | 292 | int ret; |
295 | 293 | ||
296 | spin_lock_irqsave(&mcast_lock, flags); | 294 | spin_lock_irq(&mcast_lock); |
297 | 295 | ||
298 | /* Find the GID in the mcast table. */ | 296 | /* Find the GID in the mcast table. */ |
299 | n = mcast_tree.rb_node; | 297 | n = mcast_tree.rb_node; |
300 | while (1) { | 298 | while (1) { |
301 | if (n == NULL) { | 299 | if (n == NULL) { |
302 | spin_unlock_irqrestore(&mcast_lock, flags); | 300 | spin_unlock_irq(&mcast_lock); |
303 | ret = -EINVAL; | 301 | ret = -EINVAL; |
304 | goto bail; | 302 | goto bail; |
305 | } | 303 | } |
@@ -334,7 +332,7 @@ int ipath_multicast_detach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid) | |||
334 | break; | 332 | break; |
335 | } | 333 | } |
336 | 334 | ||
337 | spin_unlock_irqrestore(&mcast_lock, flags); | 335 | spin_unlock_irq(&mcast_lock); |
338 | 336 | ||
339 | if (p) { | 337 | if (p) { |
340 | /* | 338 | /* |
@@ -348,9 +346,9 @@ int ipath_multicast_detach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid) | |||
348 | atomic_dec(&mcast->refcount); | 346 | atomic_dec(&mcast->refcount); |
349 | wait_event(mcast->wait, !atomic_read(&mcast->refcount)); | 347 | wait_event(mcast->wait, !atomic_read(&mcast->refcount)); |
350 | ipath_mcast_free(mcast); | 348 | ipath_mcast_free(mcast); |
351 | spin_lock(&dev->n_mcast_grps_lock); | 349 | spin_lock_irq(&dev->n_mcast_grps_lock); |
352 | dev->n_mcast_grps_allocated--; | 350 | dev->n_mcast_grps_allocated--; |
353 | spin_unlock(&dev->n_mcast_grps_lock); | 351 | spin_unlock_irq(&dev->n_mcast_grps_lock); |
354 | } | 352 | } |
355 | 353 | ||
356 | ret = 0; | 354 | ret = 0; |
diff --git a/drivers/infiniband/hw/mlx4/qp.c b/drivers/infiniband/hw/mlx4/qp.c index 5cd706908450..a824bc5f79fd 100644 --- a/drivers/infiniband/hw/mlx4/qp.c +++ b/drivers/infiniband/hw/mlx4/qp.c | |||
@@ -188,14 +188,32 @@ static int send_wqe_overhead(enum ib_qp_type type) | |||
188 | } | 188 | } |
189 | } | 189 | } |
190 | 190 | ||
191 | static int set_qp_size(struct mlx4_ib_dev *dev, struct ib_qp_cap *cap, | 191 | static int set_rq_size(struct mlx4_ib_dev *dev, struct ib_qp_cap *cap, |
192 | enum ib_qp_type type, struct mlx4_ib_qp *qp) | 192 | struct mlx4_ib_qp *qp) |
193 | { | 193 | { |
194 | /* Sanity check QP size before proceeding */ | 194 | /* Sanity check RQ size before proceeding */ |
195 | if (cap->max_recv_wr > dev->dev->caps.max_wqes || | ||
196 | cap->max_recv_sge > dev->dev->caps.max_rq_sg) | ||
197 | return -EINVAL; | ||
198 | |||
199 | qp->rq.max = cap->max_recv_wr ? roundup_pow_of_two(cap->max_recv_wr) : 0; | ||
200 | |||
201 | qp->rq.wqe_shift = ilog2(roundup_pow_of_two(cap->max_recv_sge * | ||
202 | sizeof (struct mlx4_wqe_data_seg))); | ||
203 | qp->rq.max_gs = (1 << qp->rq.wqe_shift) / sizeof (struct mlx4_wqe_data_seg); | ||
204 | |||
205 | cap->max_recv_wr = qp->rq.max; | ||
206 | cap->max_recv_sge = qp->rq.max_gs; | ||
207 | |||
208 | return 0; | ||
209 | } | ||
210 | |||
211 | static int set_kernel_sq_size(struct mlx4_ib_dev *dev, struct ib_qp_cap *cap, | ||
212 | enum ib_qp_type type, struct mlx4_ib_qp *qp) | ||
213 | { | ||
214 | /* Sanity check SQ size before proceeding */ | ||
195 | if (cap->max_send_wr > dev->dev->caps.max_wqes || | 215 | if (cap->max_send_wr > dev->dev->caps.max_wqes || |
196 | cap->max_recv_wr > dev->dev->caps.max_wqes || | ||
197 | cap->max_send_sge > dev->dev->caps.max_sq_sg || | 216 | cap->max_send_sge > dev->dev->caps.max_sq_sg || |
198 | cap->max_recv_sge > dev->dev->caps.max_rq_sg || | ||
199 | cap->max_inline_data + send_wqe_overhead(type) + | 217 | cap->max_inline_data + send_wqe_overhead(type) + |
200 | sizeof (struct mlx4_wqe_inline_seg) > dev->dev->caps.max_sq_desc_sz) | 218 | sizeof (struct mlx4_wqe_inline_seg) > dev->dev->caps.max_sq_desc_sz) |
201 | return -EINVAL; | 219 | return -EINVAL; |
@@ -208,12 +226,7 @@ static int set_qp_size(struct mlx4_ib_dev *dev, struct ib_qp_cap *cap, | |||
208 | cap->max_send_sge + 2 > dev->dev->caps.max_sq_sg) | 226 | cap->max_send_sge + 2 > dev->dev->caps.max_sq_sg) |
209 | return -EINVAL; | 227 | return -EINVAL; |
210 | 228 | ||
211 | qp->rq.max = cap->max_recv_wr ? roundup_pow_of_two(cap->max_recv_wr) : 0; | 229 | qp->sq.max = cap->max_send_wr ? roundup_pow_of_two(cap->max_send_wr) : 1; |
212 | qp->sq.max = cap->max_send_wr ? roundup_pow_of_two(cap->max_send_wr) : 0; | ||
213 | |||
214 | qp->rq.wqe_shift = ilog2(roundup_pow_of_two(cap->max_recv_sge * | ||
215 | sizeof (struct mlx4_wqe_data_seg))); | ||
216 | qp->rq.max_gs = (1 << qp->rq.wqe_shift) / sizeof (struct mlx4_wqe_data_seg); | ||
217 | 230 | ||
218 | qp->sq.wqe_shift = ilog2(roundup_pow_of_two(max(cap->max_send_sge * | 231 | qp->sq.wqe_shift = ilog2(roundup_pow_of_two(max(cap->max_send_sge * |
219 | sizeof (struct mlx4_wqe_data_seg), | 232 | sizeof (struct mlx4_wqe_data_seg), |
@@ -233,16 +246,26 @@ static int set_qp_size(struct mlx4_ib_dev *dev, struct ib_qp_cap *cap, | |||
233 | qp->sq.offset = 0; | 246 | qp->sq.offset = 0; |
234 | } | 247 | } |
235 | 248 | ||
236 | cap->max_send_wr = qp->sq.max; | 249 | cap->max_send_wr = qp->sq.max; |
237 | cap->max_recv_wr = qp->rq.max; | 250 | cap->max_send_sge = qp->sq.max_gs; |
238 | cap->max_send_sge = qp->sq.max_gs; | ||
239 | cap->max_recv_sge = qp->rq.max_gs; | ||
240 | cap->max_inline_data = (1 << qp->sq.wqe_shift) - send_wqe_overhead(type) - | 251 | cap->max_inline_data = (1 << qp->sq.wqe_shift) - send_wqe_overhead(type) - |
241 | sizeof (struct mlx4_wqe_inline_seg); | 252 | sizeof (struct mlx4_wqe_inline_seg); |
242 | 253 | ||
243 | return 0; | 254 | return 0; |
244 | } | 255 | } |
245 | 256 | ||
257 | static int set_user_sq_size(struct mlx4_ib_qp *qp, | ||
258 | struct mlx4_ib_create_qp *ucmd) | ||
259 | { | ||
260 | qp->sq.max = 1 << ucmd->log_sq_bb_count; | ||
261 | qp->sq.wqe_shift = ucmd->log_sq_stride; | ||
262 | |||
263 | qp->buf_size = (qp->rq.max << qp->rq.wqe_shift) + | ||
264 | (qp->sq.max << qp->sq.wqe_shift); | ||
265 | |||
266 | return 0; | ||
267 | } | ||
268 | |||
246 | static int create_qp_common(struct mlx4_ib_dev *dev, struct ib_pd *pd, | 269 | static int create_qp_common(struct mlx4_ib_dev *dev, struct ib_pd *pd, |
247 | struct ib_qp_init_attr *init_attr, | 270 | struct ib_qp_init_attr *init_attr, |
248 | struct ib_udata *udata, int sqpn, struct mlx4_ib_qp *qp) | 271 | struct ib_udata *udata, int sqpn, struct mlx4_ib_qp *qp) |
@@ -264,7 +287,7 @@ static int create_qp_common(struct mlx4_ib_dev *dev, struct ib_pd *pd, | |||
264 | qp->sq.head = 0; | 287 | qp->sq.head = 0; |
265 | qp->sq.tail = 0; | 288 | qp->sq.tail = 0; |
266 | 289 | ||
267 | err = set_qp_size(dev, &init_attr->cap, init_attr->qp_type, qp); | 290 | err = set_rq_size(dev, &init_attr->cap, qp); |
268 | if (err) | 291 | if (err) |
269 | goto err; | 292 | goto err; |
270 | 293 | ||
@@ -276,6 +299,10 @@ static int create_qp_common(struct mlx4_ib_dev *dev, struct ib_pd *pd, | |||
276 | goto err; | 299 | goto err; |
277 | } | 300 | } |
278 | 301 | ||
302 | err = set_user_sq_size(qp, &ucmd); | ||
303 | if (err) | ||
304 | goto err; | ||
305 | |||
279 | qp->umem = ib_umem_get(pd->uobject->context, ucmd.buf_addr, | 306 | qp->umem = ib_umem_get(pd->uobject->context, ucmd.buf_addr, |
280 | qp->buf_size, 0); | 307 | qp->buf_size, 0); |
281 | if (IS_ERR(qp->umem)) { | 308 | if (IS_ERR(qp->umem)) { |
@@ -297,6 +324,10 @@ static int create_qp_common(struct mlx4_ib_dev *dev, struct ib_pd *pd, | |||
297 | if (err) | 324 | if (err) |
298 | goto err_mtt; | 325 | goto err_mtt; |
299 | } else { | 326 | } else { |
327 | err = set_kernel_sq_size(dev, &init_attr->cap, init_attr->qp_type, qp); | ||
328 | if (err) | ||
329 | goto err; | ||
330 | |||
300 | err = mlx4_ib_db_alloc(dev, &qp->db, 0); | 331 | err = mlx4_ib_db_alloc(dev, &qp->db, 0); |
301 | if (err) | 332 | if (err) |
302 | goto err; | 333 | goto err; |
@@ -573,7 +604,7 @@ static int to_mlx4_st(enum ib_qp_type type) | |||
573 | } | 604 | } |
574 | } | 605 | } |
575 | 606 | ||
576 | static __be32 to_mlx4_access_flags(struct mlx4_ib_qp *qp, struct ib_qp_attr *attr, | 607 | static __be32 to_mlx4_access_flags(struct mlx4_ib_qp *qp, const struct ib_qp_attr *attr, |
577 | int attr_mask) | 608 | int attr_mask) |
578 | { | 609 | { |
579 | u8 dest_rd_atomic; | 610 | u8 dest_rd_atomic; |
@@ -603,7 +634,7 @@ static __be32 to_mlx4_access_flags(struct mlx4_ib_qp *qp, struct ib_qp_attr *att | |||
603 | return cpu_to_be32(hw_access_flags); | 634 | return cpu_to_be32(hw_access_flags); |
604 | } | 635 | } |
605 | 636 | ||
606 | static void store_sqp_attrs(struct mlx4_ib_sqp *sqp, struct ib_qp_attr *attr, | 637 | static void store_sqp_attrs(struct mlx4_ib_sqp *sqp, const struct ib_qp_attr *attr, |
607 | int attr_mask) | 638 | int attr_mask) |
608 | { | 639 | { |
609 | if (attr_mask & IB_QP_PKEY_INDEX) | 640 | if (attr_mask & IB_QP_PKEY_INDEX) |
@@ -619,7 +650,7 @@ static void mlx4_set_sched(struct mlx4_qp_path *path, u8 port) | |||
619 | path->sched_queue = (path->sched_queue & 0xbf) | ((port - 1) << 6); | 650 | path->sched_queue = (path->sched_queue & 0xbf) | ((port - 1) << 6); |
620 | } | 651 | } |
621 | 652 | ||
622 | static int mlx4_set_path(struct mlx4_ib_dev *dev, struct ib_ah_attr *ah, | 653 | static int mlx4_set_path(struct mlx4_ib_dev *dev, const struct ib_ah_attr *ah, |
623 | struct mlx4_qp_path *path, u8 port) | 654 | struct mlx4_qp_path *path, u8 port) |
624 | { | 655 | { |
625 | path->grh_mylmc = ah->src_path_bits & 0x7f; | 656 | path->grh_mylmc = ah->src_path_bits & 0x7f; |
@@ -655,14 +686,14 @@ static int mlx4_set_path(struct mlx4_ib_dev *dev, struct ib_ah_attr *ah, | |||
655 | return 0; | 686 | return 0; |
656 | } | 687 | } |
657 | 688 | ||
658 | int mlx4_ib_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, | 689 | static int __mlx4_ib_modify_qp(struct ib_qp *ibqp, |
659 | int attr_mask, struct ib_udata *udata) | 690 | const struct ib_qp_attr *attr, int attr_mask, |
691 | enum ib_qp_state cur_state, enum ib_qp_state new_state) | ||
660 | { | 692 | { |
661 | struct mlx4_ib_dev *dev = to_mdev(ibqp->device); | 693 | struct mlx4_ib_dev *dev = to_mdev(ibqp->device); |
662 | struct mlx4_ib_qp *qp = to_mqp(ibqp); | 694 | struct mlx4_ib_qp *qp = to_mqp(ibqp); |
663 | struct mlx4_qp_context *context; | 695 | struct mlx4_qp_context *context; |
664 | enum mlx4_qp_optpar optpar = 0; | 696 | enum mlx4_qp_optpar optpar = 0; |
665 | enum ib_qp_state cur_state, new_state; | ||
666 | int sqd_event; | 697 | int sqd_event; |
667 | int err = -EINVAL; | 698 | int err = -EINVAL; |
668 | 699 | ||
@@ -670,34 +701,6 @@ int mlx4_ib_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, | |||
670 | if (!context) | 701 | if (!context) |
671 | return -ENOMEM; | 702 | return -ENOMEM; |
672 | 703 | ||
673 | mutex_lock(&qp->mutex); | ||
674 | |||
675 | cur_state = attr_mask & IB_QP_CUR_STATE ? attr->cur_qp_state : qp->state; | ||
676 | new_state = attr_mask & IB_QP_STATE ? attr->qp_state : cur_state; | ||
677 | |||
678 | if (!ib_modify_qp_is_ok(cur_state, new_state, ibqp->qp_type, attr_mask)) | ||
679 | goto out; | ||
680 | |||
681 | if ((attr_mask & IB_QP_PKEY_INDEX) && | ||
682 | attr->pkey_index >= dev->dev->caps.pkey_table_len) { | ||
683 | goto out; | ||
684 | } | ||
685 | |||
686 | if ((attr_mask & IB_QP_PORT) && | ||
687 | (attr->port_num == 0 || attr->port_num > dev->dev->caps.num_ports)) { | ||
688 | goto out; | ||
689 | } | ||
690 | |||
691 | if (attr_mask & IB_QP_MAX_QP_RD_ATOMIC && | ||
692 | attr->max_rd_atomic > dev->dev->caps.max_qp_init_rdma) { | ||
693 | goto out; | ||
694 | } | ||
695 | |||
696 | if (attr_mask & IB_QP_MAX_DEST_RD_ATOMIC && | ||
697 | attr->max_dest_rd_atomic > 1 << dev->dev->caps.max_qp_dest_rdma) { | ||
698 | goto out; | ||
699 | } | ||
700 | |||
701 | context->flags = cpu_to_be32((to_mlx4_state(new_state) << 28) | | 704 | context->flags = cpu_to_be32((to_mlx4_state(new_state) << 28) | |
702 | (to_mlx4_st(ibqp->qp_type) << 16)); | 705 | (to_mlx4_st(ibqp->qp_type) << 16)); |
703 | context->flags |= cpu_to_be32(1 << 8); /* DE? */ | 706 | context->flags |= cpu_to_be32(1 << 8); /* DE? */ |
@@ -920,11 +923,84 @@ int mlx4_ib_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, | |||
920 | } | 923 | } |
921 | 924 | ||
922 | out: | 925 | out: |
923 | mutex_unlock(&qp->mutex); | ||
924 | kfree(context); | 926 | kfree(context); |
925 | return err; | 927 | return err; |
926 | } | 928 | } |
927 | 929 | ||
930 | static const struct ib_qp_attr mlx4_ib_qp_attr = { .port_num = 1 }; | ||
931 | static const int mlx4_ib_qp_attr_mask_table[IB_QPT_UD + 1] = { | ||
932 | [IB_QPT_UD] = (IB_QP_PKEY_INDEX | | ||
933 | IB_QP_PORT | | ||
934 | IB_QP_QKEY), | ||
935 | [IB_QPT_UC] = (IB_QP_PKEY_INDEX | | ||
936 | IB_QP_PORT | | ||
937 | IB_QP_ACCESS_FLAGS), | ||
938 | [IB_QPT_RC] = (IB_QP_PKEY_INDEX | | ||
939 | IB_QP_PORT | | ||
940 | IB_QP_ACCESS_FLAGS), | ||
941 | [IB_QPT_SMI] = (IB_QP_PKEY_INDEX | | ||
942 | IB_QP_QKEY), | ||
943 | [IB_QPT_GSI] = (IB_QP_PKEY_INDEX | | ||
944 | IB_QP_QKEY), | ||
945 | }; | ||
946 | |||
947 | int mlx4_ib_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, | ||
948 | int attr_mask, struct ib_udata *udata) | ||
949 | { | ||
950 | struct mlx4_ib_dev *dev = to_mdev(ibqp->device); | ||
951 | struct mlx4_ib_qp *qp = to_mqp(ibqp); | ||
952 | enum ib_qp_state cur_state, new_state; | ||
953 | int err = -EINVAL; | ||
954 | |||
955 | mutex_lock(&qp->mutex); | ||
956 | |||
957 | cur_state = attr_mask & IB_QP_CUR_STATE ? attr->cur_qp_state : qp->state; | ||
958 | new_state = attr_mask & IB_QP_STATE ? attr->qp_state : cur_state; | ||
959 | |||
960 | if (!ib_modify_qp_is_ok(cur_state, new_state, ibqp->qp_type, attr_mask)) | ||
961 | goto out; | ||
962 | |||
963 | if ((attr_mask & IB_QP_PKEY_INDEX) && | ||
964 | attr->pkey_index >= dev->dev->caps.pkey_table_len) { | ||
965 | goto out; | ||
966 | } | ||
967 | |||
968 | if ((attr_mask & IB_QP_PORT) && | ||
969 | (attr->port_num == 0 || attr->port_num > dev->dev->caps.num_ports)) { | ||
970 | goto out; | ||
971 | } | ||
972 | |||
973 | if (attr_mask & IB_QP_MAX_QP_RD_ATOMIC && | ||
974 | attr->max_rd_atomic > dev->dev->caps.max_qp_init_rdma) { | ||
975 | goto out; | ||
976 | } | ||
977 | |||
978 | if (attr_mask & IB_QP_MAX_DEST_RD_ATOMIC && | ||
979 | attr->max_dest_rd_atomic > dev->dev->caps.max_qp_dest_rdma) { | ||
980 | goto out; | ||
981 | } | ||
982 | |||
983 | if (cur_state == new_state && cur_state == IB_QPS_RESET) { | ||
984 | err = 0; | ||
985 | goto out; | ||
986 | } | ||
987 | |||
988 | if (cur_state == IB_QPS_RESET && new_state == IB_QPS_ERR) { | ||
989 | err = __mlx4_ib_modify_qp(ibqp, &mlx4_ib_qp_attr, | ||
990 | mlx4_ib_qp_attr_mask_table[ibqp->qp_type], | ||
991 | IB_QPS_RESET, IB_QPS_INIT); | ||
992 | if (err) | ||
993 | goto out; | ||
994 | cur_state = IB_QPS_INIT; | ||
995 | } | ||
996 | |||
997 | err = __mlx4_ib_modify_qp(ibqp, attr, attr_mask, cur_state, new_state); | ||
998 | |||
999 | out: | ||
1000 | mutex_unlock(&qp->mutex); | ||
1001 | return err; | ||
1002 | } | ||
1003 | |||
928 | static int build_mlx_header(struct mlx4_ib_sqp *sqp, struct ib_send_wr *wr, | 1004 | static int build_mlx_header(struct mlx4_ib_sqp *sqp, struct ib_send_wr *wr, |
929 | void *wqe) | 1005 | void *wqe) |
930 | { | 1006 | { |
@@ -952,6 +1028,7 @@ static int build_mlx_header(struct mlx4_ib_sqp *sqp, struct ib_send_wr *wr, | |||
952 | (be32_to_cpu(ah->av.sl_tclass_flowlabel) >> 20) & 0xff; | 1028 | (be32_to_cpu(ah->av.sl_tclass_flowlabel) >> 20) & 0xff; |
953 | sqp->ud_header.grh.flow_label = | 1029 | sqp->ud_header.grh.flow_label = |
954 | ah->av.sl_tclass_flowlabel & cpu_to_be32(0xfffff); | 1030 | ah->av.sl_tclass_flowlabel & cpu_to_be32(0xfffff); |
1031 | sqp->ud_header.grh.hop_limit = ah->av.hop_limit; | ||
955 | ib_get_cached_gid(ib_dev, be32_to_cpu(ah->av.port_pd) >> 24, | 1032 | ib_get_cached_gid(ib_dev, be32_to_cpu(ah->av.port_pd) >> 24, |
956 | ah->av.gid_index, &sqp->ud_header.grh.source_gid); | 1033 | ah->av.gid_index, &sqp->ud_header.grh.source_gid); |
957 | memcpy(sqp->ud_header.grh.destination_gid.raw, | 1034 | memcpy(sqp->ud_header.grh.destination_gid.raw, |
@@ -1192,7 +1269,7 @@ int mlx4_ib_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr, | |||
1192 | */ | 1269 | */ |
1193 | wmb(); | 1270 | wmb(); |
1194 | 1271 | ||
1195 | if (wr->opcode < 0 || wr->opcode > ARRAY_SIZE(mlx4_ib_opcode)) { | 1272 | if (wr->opcode < 0 || wr->opcode >= ARRAY_SIZE(mlx4_ib_opcode)) { |
1196 | err = -EINVAL; | 1273 | err = -EINVAL; |
1197 | goto out; | 1274 | goto out; |
1198 | } | 1275 | } |
diff --git a/drivers/infiniband/hw/mlx4/srq.c b/drivers/infiniband/hw/mlx4/srq.c index 42ab4a801d6a..12fac1c8989d 100644 --- a/drivers/infiniband/hw/mlx4/srq.c +++ b/drivers/infiniband/hw/mlx4/srq.c | |||
@@ -297,6 +297,12 @@ int mlx4_ib_post_srq_recv(struct ib_srq *ibsrq, struct ib_recv_wr *wr, | |||
297 | break; | 297 | break; |
298 | } | 298 | } |
299 | 299 | ||
300 | if (unlikely(srq->head == srq->tail)) { | ||
301 | err = -ENOMEM; | ||
302 | *bad_wr = wr; | ||
303 | break; | ||
304 | } | ||
305 | |||
300 | srq->wrid[srq->head] = wr->wr_id; | 306 | srq->wrid[srq->head] = wr->wr_id; |
301 | 307 | ||
302 | next = get_wqe(srq, srq->head); | 308 | next = get_wqe(srq, srq->head); |
diff --git a/drivers/infiniband/hw/mlx4/user.h b/drivers/infiniband/hw/mlx4/user.h index 5b8eddc9fa83..88c72d56368b 100644 --- a/drivers/infiniband/hw/mlx4/user.h +++ b/drivers/infiniband/hw/mlx4/user.h | |||
@@ -39,7 +39,7 @@ | |||
39 | * Increment this value if any changes that break userspace ABI | 39 | * Increment this value if any changes that break userspace ABI |
40 | * compatibility are made. | 40 | * compatibility are made. |
41 | */ | 41 | */ |
42 | #define MLX4_IB_UVERBS_ABI_VERSION 1 | 42 | #define MLX4_IB_UVERBS_ABI_VERSION 2 |
43 | 43 | ||
44 | /* | 44 | /* |
45 | * Make sure that all structs defined in this file remain laid out so | 45 | * Make sure that all structs defined in this file remain laid out so |
@@ -87,6 +87,9 @@ struct mlx4_ib_create_srq_resp { | |||
87 | struct mlx4_ib_create_qp { | 87 | struct mlx4_ib_create_qp { |
88 | __u64 buf_addr; | 88 | __u64 buf_addr; |
89 | __u64 db_addr; | 89 | __u64 db_addr; |
90 | __u8 log_sq_bb_count; | ||
91 | __u8 log_sq_stride; | ||
92 | __u8 reserved[6]; | ||
90 | }; | 93 | }; |
91 | 94 | ||
92 | #endif /* MLX4_IB_USER_H */ | 95 | #endif /* MLX4_IB_USER_H */ |
diff --git a/drivers/infiniband/hw/mthca/mthca_av.c b/drivers/infiniband/hw/mthca/mthca_av.c index 27caf3b0648a..4b111a852ff6 100644 --- a/drivers/infiniband/hw/mthca/mthca_av.c +++ b/drivers/infiniband/hw/mthca/mthca_av.c | |||
@@ -279,6 +279,7 @@ int mthca_read_ah(struct mthca_dev *dev, struct mthca_ah *ah, | |||
279 | (be32_to_cpu(ah->av->sl_tclass_flowlabel) >> 20) & 0xff; | 279 | (be32_to_cpu(ah->av->sl_tclass_flowlabel) >> 20) & 0xff; |
280 | header->grh.flow_label = | 280 | header->grh.flow_label = |
281 | ah->av->sl_tclass_flowlabel & cpu_to_be32(0xfffff); | 281 | ah->av->sl_tclass_flowlabel & cpu_to_be32(0xfffff); |
282 | header->grh.hop_limit = ah->av->hop_limit; | ||
282 | ib_get_cached_gid(&dev->ib_dev, | 283 | ib_get_cached_gid(&dev->ib_dev, |
283 | be32_to_cpu(ah->av->port_pd) >> 24, | 284 | be32_to_cpu(ah->av->port_pd) >> 24, |
284 | ah->av->gid_index % dev->limits.gid_table_len, | 285 | ah->av->gid_index % dev->limits.gid_table_len, |
diff --git a/drivers/infiniband/hw/mthca/mthca_cmd.c b/drivers/infiniband/hw/mthca/mthca_cmd.c index 71314460b11e..38102520ffb3 100644 --- a/drivers/infiniband/hw/mthca/mthca_cmd.c +++ b/drivers/infiniband/hw/mthca/mthca_cmd.c | |||
@@ -37,6 +37,7 @@ | |||
37 | #include <linux/completion.h> | 37 | #include <linux/completion.h> |
38 | #include <linux/pci.h> | 38 | #include <linux/pci.h> |
39 | #include <linux/errno.h> | 39 | #include <linux/errno.h> |
40 | #include <linux/sched.h> | ||
40 | #include <asm/io.h> | 41 | #include <asm/io.h> |
41 | #include <rdma/ib_mad.h> | 42 | #include <rdma/ib_mad.h> |
42 | 43 | ||
diff --git a/drivers/infiniband/hw/mthca/mthca_cq.c b/drivers/infiniband/hw/mthca/mthca_cq.c index ca224d018af2..be6e1e03bdab 100644 --- a/drivers/infiniband/hw/mthca/mthca_cq.c +++ b/drivers/infiniband/hw/mthca/mthca_cq.c | |||
@@ -37,6 +37,7 @@ | |||
37 | */ | 37 | */ |
38 | 38 | ||
39 | #include <linux/hardirq.h> | 39 | #include <linux/hardirq.h> |
40 | #include <linux/sched.h> | ||
40 | 41 | ||
41 | #include <asm/io.h> | 42 | #include <asm/io.h> |
42 | 43 | ||
diff --git a/drivers/infiniband/hw/mthca/mthca_main.c b/drivers/infiniband/hw/mthca/mthca_main.c index 773145e29947..aa563e61de65 100644 --- a/drivers/infiniband/hw/mthca/mthca_main.c +++ b/drivers/infiniband/hw/mthca/mthca_main.c | |||
@@ -1250,12 +1250,14 @@ static void __mthca_remove_one(struct pci_dev *pdev) | |||
1250 | int __mthca_restart_one(struct pci_dev *pdev) | 1250 | int __mthca_restart_one(struct pci_dev *pdev) |
1251 | { | 1251 | { |
1252 | struct mthca_dev *mdev; | 1252 | struct mthca_dev *mdev; |
1253 | int hca_type; | ||
1253 | 1254 | ||
1254 | mdev = pci_get_drvdata(pdev); | 1255 | mdev = pci_get_drvdata(pdev); |
1255 | if (!mdev) | 1256 | if (!mdev) |
1256 | return -ENODEV; | 1257 | return -ENODEV; |
1258 | hca_type = mdev->hca_type; | ||
1257 | __mthca_remove_one(pdev); | 1259 | __mthca_remove_one(pdev); |
1258 | return __mthca_init_one(pdev, mdev->hca_type); | 1260 | return __mthca_init_one(pdev, hca_type); |
1259 | } | 1261 | } |
1260 | 1262 | ||
1261 | static int __devinit mthca_init_one(struct pci_dev *pdev, | 1263 | static int __devinit mthca_init_one(struct pci_dev *pdev, |
diff --git a/drivers/infiniband/hw/mthca/mthca_memfree.c b/drivers/infiniband/hw/mthca/mthca_memfree.c index 48f7c65e9aed..e61f3e626980 100644 --- a/drivers/infiniband/hw/mthca/mthca_memfree.c +++ b/drivers/infiniband/hw/mthca/mthca_memfree.c | |||
@@ -36,6 +36,7 @@ | |||
36 | 36 | ||
37 | #include <linux/mm.h> | 37 | #include <linux/mm.h> |
38 | #include <linux/scatterlist.h> | 38 | #include <linux/scatterlist.h> |
39 | #include <linux/sched.h> | ||
39 | 40 | ||
40 | #include <asm/page.h> | 41 | #include <asm/page.h> |
41 | 42 | ||
diff --git a/drivers/infiniband/hw/mthca/mthca_qp.c b/drivers/infiniband/hw/mthca/mthca_qp.c index 72fabb822f1c..027664979fe2 100644 --- a/drivers/infiniband/hw/mthca/mthca_qp.c +++ b/drivers/infiniband/hw/mthca/mthca_qp.c | |||
@@ -37,6 +37,7 @@ | |||
37 | 37 | ||
38 | #include <linux/string.h> | 38 | #include <linux/string.h> |
39 | #include <linux/slab.h> | 39 | #include <linux/slab.h> |
40 | #include <linux/sched.h> | ||
40 | 41 | ||
41 | #include <asm/io.h> | 42 | #include <asm/io.h> |
42 | 43 | ||
@@ -295,7 +296,7 @@ static int to_mthca_st(int transport) | |||
295 | } | 296 | } |
296 | } | 297 | } |
297 | 298 | ||
298 | static void store_attrs(struct mthca_sqp *sqp, struct ib_qp_attr *attr, | 299 | static void store_attrs(struct mthca_sqp *sqp, const struct ib_qp_attr *attr, |
299 | int attr_mask) | 300 | int attr_mask) |
300 | { | 301 | { |
301 | if (attr_mask & IB_QP_PKEY_INDEX) | 302 | if (attr_mask & IB_QP_PKEY_INDEX) |
@@ -327,7 +328,7 @@ static void init_port(struct mthca_dev *dev, int port) | |||
327 | mthca_warn(dev, "INIT_IB returned status %02x.\n", status); | 328 | mthca_warn(dev, "INIT_IB returned status %02x.\n", status); |
328 | } | 329 | } |
329 | 330 | ||
330 | static __be32 get_hw_access_flags(struct mthca_qp *qp, struct ib_qp_attr *attr, | 331 | static __be32 get_hw_access_flags(struct mthca_qp *qp, const struct ib_qp_attr *attr, |
331 | int attr_mask) | 332 | int attr_mask) |
332 | { | 333 | { |
333 | u8 dest_rd_atomic; | 334 | u8 dest_rd_atomic; |
@@ -510,7 +511,7 @@ out: | |||
510 | return err; | 511 | return err; |
511 | } | 512 | } |
512 | 513 | ||
513 | static int mthca_path_set(struct mthca_dev *dev, struct ib_ah_attr *ah, | 514 | static int mthca_path_set(struct mthca_dev *dev, const struct ib_ah_attr *ah, |
514 | struct mthca_qp_path *path, u8 port) | 515 | struct mthca_qp_path *path, u8 port) |
515 | { | 516 | { |
516 | path->g_mylmc = ah->src_path_bits & 0x7f; | 517 | path->g_mylmc = ah->src_path_bits & 0x7f; |
@@ -538,12 +539,12 @@ static int mthca_path_set(struct mthca_dev *dev, struct ib_ah_attr *ah, | |||
538 | return 0; | 539 | return 0; |
539 | } | 540 | } |
540 | 541 | ||
541 | int mthca_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, int attr_mask, | 542 | static int __mthca_modify_qp(struct ib_qp *ibqp, |
542 | struct ib_udata *udata) | 543 | const struct ib_qp_attr *attr, int attr_mask, |
544 | enum ib_qp_state cur_state, enum ib_qp_state new_state) | ||
543 | { | 545 | { |
544 | struct mthca_dev *dev = to_mdev(ibqp->device); | 546 | struct mthca_dev *dev = to_mdev(ibqp->device); |
545 | struct mthca_qp *qp = to_mqp(ibqp); | 547 | struct mthca_qp *qp = to_mqp(ibqp); |
546 | enum ib_qp_state cur_state, new_state; | ||
547 | struct mthca_mailbox *mailbox; | 548 | struct mthca_mailbox *mailbox; |
548 | struct mthca_qp_param *qp_param; | 549 | struct mthca_qp_param *qp_param; |
549 | struct mthca_qp_context *qp_context; | 550 | struct mthca_qp_context *qp_context; |
@@ -551,60 +552,6 @@ int mthca_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, int attr_mask, | |||
551 | u8 status; | 552 | u8 status; |
552 | int err = -EINVAL; | 553 | int err = -EINVAL; |
553 | 554 | ||
554 | mutex_lock(&qp->mutex); | ||
555 | |||
556 | if (attr_mask & IB_QP_CUR_STATE) { | ||
557 | cur_state = attr->cur_qp_state; | ||
558 | } else { | ||
559 | spin_lock_irq(&qp->sq.lock); | ||
560 | spin_lock(&qp->rq.lock); | ||
561 | cur_state = qp->state; | ||
562 | spin_unlock(&qp->rq.lock); | ||
563 | spin_unlock_irq(&qp->sq.lock); | ||
564 | } | ||
565 | |||
566 | new_state = attr_mask & IB_QP_STATE ? attr->qp_state : cur_state; | ||
567 | |||
568 | if (!ib_modify_qp_is_ok(cur_state, new_state, ibqp->qp_type, attr_mask)) { | ||
569 | mthca_dbg(dev, "Bad QP transition (transport %d) " | ||
570 | "%d->%d with attr 0x%08x\n", | ||
571 | qp->transport, cur_state, new_state, | ||
572 | attr_mask); | ||
573 | goto out; | ||
574 | } | ||
575 | |||
576 | if (cur_state == new_state && cur_state == IB_QPS_RESET) { | ||
577 | err = 0; | ||
578 | goto out; | ||
579 | } | ||
580 | |||
581 | if ((attr_mask & IB_QP_PKEY_INDEX) && | ||
582 | attr->pkey_index >= dev->limits.pkey_table_len) { | ||
583 | mthca_dbg(dev, "P_Key index (%u) too large. max is %d\n", | ||
584 | attr->pkey_index, dev->limits.pkey_table_len-1); | ||
585 | goto out; | ||
586 | } | ||
587 | |||
588 | if ((attr_mask & IB_QP_PORT) && | ||
589 | (attr->port_num == 0 || attr->port_num > dev->limits.num_ports)) { | ||
590 | mthca_dbg(dev, "Port number (%u) is invalid\n", attr->port_num); | ||
591 | goto out; | ||
592 | } | ||
593 | |||
594 | if (attr_mask & IB_QP_MAX_QP_RD_ATOMIC && | ||
595 | attr->max_rd_atomic > dev->limits.max_qp_init_rdma) { | ||
596 | mthca_dbg(dev, "Max rdma_atomic as initiator %u too large (max is %d)\n", | ||
597 | attr->max_rd_atomic, dev->limits.max_qp_init_rdma); | ||
598 | goto out; | ||
599 | } | ||
600 | |||
601 | if (attr_mask & IB_QP_MAX_DEST_RD_ATOMIC && | ||
602 | attr->max_dest_rd_atomic > 1 << dev->qp_table.rdb_shift) { | ||
603 | mthca_dbg(dev, "Max rdma_atomic as responder %u too large (max %d)\n", | ||
604 | attr->max_dest_rd_atomic, 1 << dev->qp_table.rdb_shift); | ||
605 | goto out; | ||
606 | } | ||
607 | |||
608 | mailbox = mthca_alloc_mailbox(dev, GFP_KERNEL); | 555 | mailbox = mthca_alloc_mailbox(dev, GFP_KERNEL); |
609 | if (IS_ERR(mailbox)) { | 556 | if (IS_ERR(mailbox)) { |
610 | err = PTR_ERR(mailbox); | 557 | err = PTR_ERR(mailbox); |
@@ -891,6 +838,98 @@ int mthca_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, int attr_mask, | |||
891 | 838 | ||
892 | out_mailbox: | 839 | out_mailbox: |
893 | mthca_free_mailbox(dev, mailbox); | 840 | mthca_free_mailbox(dev, mailbox); |
841 | out: | ||
842 | return err; | ||
843 | } | ||
844 | |||
845 | static const struct ib_qp_attr dummy_init_attr = { .port_num = 1 }; | ||
846 | static const int dummy_init_attr_mask[] = { | ||
847 | [IB_QPT_UD] = (IB_QP_PKEY_INDEX | | ||
848 | IB_QP_PORT | | ||
849 | IB_QP_QKEY), | ||
850 | [IB_QPT_UC] = (IB_QP_PKEY_INDEX | | ||
851 | IB_QP_PORT | | ||
852 | IB_QP_ACCESS_FLAGS), | ||
853 | [IB_QPT_RC] = (IB_QP_PKEY_INDEX | | ||
854 | IB_QP_PORT | | ||
855 | IB_QP_ACCESS_FLAGS), | ||
856 | [IB_QPT_SMI] = (IB_QP_PKEY_INDEX | | ||
857 | IB_QP_QKEY), | ||
858 | [IB_QPT_GSI] = (IB_QP_PKEY_INDEX | | ||
859 | IB_QP_QKEY), | ||
860 | }; | ||
861 | |||
862 | int mthca_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, int attr_mask, | ||
863 | struct ib_udata *udata) | ||
864 | { | ||
865 | struct mthca_dev *dev = to_mdev(ibqp->device); | ||
866 | struct mthca_qp *qp = to_mqp(ibqp); | ||
867 | enum ib_qp_state cur_state, new_state; | ||
868 | int err = -EINVAL; | ||
869 | |||
870 | mutex_lock(&qp->mutex); | ||
871 | if (attr_mask & IB_QP_CUR_STATE) { | ||
872 | cur_state = attr->cur_qp_state; | ||
873 | } else { | ||
874 | spin_lock_irq(&qp->sq.lock); | ||
875 | spin_lock(&qp->rq.lock); | ||
876 | cur_state = qp->state; | ||
877 | spin_unlock(&qp->rq.lock); | ||
878 | spin_unlock_irq(&qp->sq.lock); | ||
879 | } | ||
880 | |||
881 | new_state = attr_mask & IB_QP_STATE ? attr->qp_state : cur_state; | ||
882 | |||
883 | if (!ib_modify_qp_is_ok(cur_state, new_state, ibqp->qp_type, attr_mask)) { | ||
884 | mthca_dbg(dev, "Bad QP transition (transport %d) " | ||
885 | "%d->%d with attr 0x%08x\n", | ||
886 | qp->transport, cur_state, new_state, | ||
887 | attr_mask); | ||
888 | goto out; | ||
889 | } | ||
890 | |||
891 | if ((attr_mask & IB_QP_PKEY_INDEX) && | ||
892 | attr->pkey_index >= dev->limits.pkey_table_len) { | ||
893 | mthca_dbg(dev, "P_Key index (%u) too large. max is %d\n", | ||
894 | attr->pkey_index, dev->limits.pkey_table_len-1); | ||
895 | goto out; | ||
896 | } | ||
897 | |||
898 | if ((attr_mask & IB_QP_PORT) && | ||
899 | (attr->port_num == 0 || attr->port_num > dev->limits.num_ports)) { | ||
900 | mthca_dbg(dev, "Port number (%u) is invalid\n", attr->port_num); | ||
901 | goto out; | ||
902 | } | ||
903 | |||
904 | if (attr_mask & IB_QP_MAX_QP_RD_ATOMIC && | ||
905 | attr->max_rd_atomic > dev->limits.max_qp_init_rdma) { | ||
906 | mthca_dbg(dev, "Max rdma_atomic as initiator %u too large (max is %d)\n", | ||
907 | attr->max_rd_atomic, dev->limits.max_qp_init_rdma); | ||
908 | goto out; | ||
909 | } | ||
910 | |||
911 | if (attr_mask & IB_QP_MAX_DEST_RD_ATOMIC && | ||
912 | attr->max_dest_rd_atomic > 1 << dev->qp_table.rdb_shift) { | ||
913 | mthca_dbg(dev, "Max rdma_atomic as responder %u too large (max %d)\n", | ||
914 | attr->max_dest_rd_atomic, 1 << dev->qp_table.rdb_shift); | ||
915 | goto out; | ||
916 | } | ||
917 | |||
918 | if (cur_state == new_state && cur_state == IB_QPS_RESET) { | ||
919 | err = 0; | ||
920 | goto out; | ||
921 | } | ||
922 | |||
923 | if (cur_state == IB_QPS_RESET && new_state == IB_QPS_ERR) { | ||
924 | err = __mthca_modify_qp(ibqp, &dummy_init_attr, | ||
925 | dummy_init_attr_mask[ibqp->qp_type], | ||
926 | IB_QPS_RESET, IB_QPS_INIT); | ||
927 | if (err) | ||
928 | goto out; | ||
929 | cur_state = IB_QPS_INIT; | ||
930 | } | ||
931 | |||
932 | err = __mthca_modify_qp(ibqp, attr, attr_mask, cur_state, new_state); | ||
894 | 933 | ||
895 | out: | 934 | out: |
896 | mutex_unlock(&qp->mutex); | 935 | mutex_unlock(&qp->mutex); |
diff --git a/drivers/infiniband/hw/mthca/mthca_srq.c b/drivers/infiniband/hw/mthca/mthca_srq.c index 61974b0296ca..b8f05a526673 100644 --- a/drivers/infiniband/hw/mthca/mthca_srq.c +++ b/drivers/infiniband/hw/mthca/mthca_srq.c | |||
@@ -34,6 +34,7 @@ | |||
34 | 34 | ||
35 | #include <linux/slab.h> | 35 | #include <linux/slab.h> |
36 | #include <linux/string.h> | 36 | #include <linux/string.h> |
37 | #include <linux/sched.h> | ||
37 | 38 | ||
38 | #include <asm/io.h> | 39 | #include <asm/io.h> |
39 | 40 | ||
diff --git a/drivers/infiniband/ulp/ipoib/ipoib.h b/drivers/infiniband/ulp/ipoib/ipoib.h index 87310eeb6df0..a0b3782c7625 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib.h +++ b/drivers/infiniband/ulp/ipoib/ipoib.h | |||
@@ -132,12 +132,46 @@ struct ipoib_cm_data { | |||
132 | __be32 mtu; | 132 | __be32 mtu; |
133 | }; | 133 | }; |
134 | 134 | ||
135 | /* | ||
136 | * Quoting 10.3.1 Queue Pair and EE Context States: | ||
137 | * | ||
138 | * Note, for QPs that are associated with an SRQ, the Consumer should take the | ||
139 | * QP through the Error State before invoking a Destroy QP or a Modify QP to the | ||
140 | * Reset State. The Consumer may invoke the Destroy QP without first performing | ||
141 | * a Modify QP to the Error State and waiting for the Affiliated Asynchronous | ||
142 | * Last WQE Reached Event. However, if the Consumer does not wait for the | ||
143 | * Affiliated Asynchronous Last WQE Reached Event, then WQE and Data Segment | ||
144 | * leakage may occur. Therefore, it is good programming practice to tear down a | ||
145 | * QP that is associated with an SRQ by using the following process: | ||
146 | * | ||
147 | * - Put the QP in the Error State | ||
148 | * - Wait for the Affiliated Asynchronous Last WQE Reached Event; | ||
149 | * - either: | ||
150 | * drain the CQ by invoking the Poll CQ verb and either wait for CQ | ||
151 | * to be empty or the number of Poll CQ operations has exceeded | ||
152 | * CQ capacity size; | ||
153 | * - or | ||
154 | * post another WR that completes on the same CQ and wait for this | ||
155 | * WR to return as a WC; | ||
156 | * - and then invoke a Destroy QP or Reset QP. | ||
157 | * | ||
158 | * We use the second option and wait for a completion on the | ||
159 | * rx_drain_qp before destroying QPs attached to our SRQ. | ||
160 | */ | ||
161 | |||
162 | enum ipoib_cm_state { | ||
163 | IPOIB_CM_RX_LIVE, | ||
164 | IPOIB_CM_RX_ERROR, /* Ignored by stale task */ | ||
165 | IPOIB_CM_RX_FLUSH /* Last WQE Reached event observed */ | ||
166 | }; | ||
167 | |||
135 | struct ipoib_cm_rx { | 168 | struct ipoib_cm_rx { |
136 | struct ib_cm_id *id; | 169 | struct ib_cm_id *id; |
137 | struct ib_qp *qp; | 170 | struct ib_qp *qp; |
138 | struct list_head list; | 171 | struct list_head list; |
139 | struct net_device *dev; | 172 | struct net_device *dev; |
140 | unsigned long jiffies; | 173 | unsigned long jiffies; |
174 | enum ipoib_cm_state state; | ||
141 | }; | 175 | }; |
142 | 176 | ||
143 | struct ipoib_cm_tx { | 177 | struct ipoib_cm_tx { |
@@ -165,10 +199,16 @@ struct ipoib_cm_dev_priv { | |||
165 | struct ib_srq *srq; | 199 | struct ib_srq *srq; |
166 | struct ipoib_cm_rx_buf *srq_ring; | 200 | struct ipoib_cm_rx_buf *srq_ring; |
167 | struct ib_cm_id *id; | 201 | struct ib_cm_id *id; |
168 | struct list_head passive_ids; | 202 | struct ib_qp *rx_drain_qp; /* generates WR described in 10.3.1 */ |
203 | struct list_head passive_ids; /* state: LIVE */ | ||
204 | struct list_head rx_error_list; /* state: ERROR */ | ||
205 | struct list_head rx_flush_list; /* state: FLUSH, drain not started */ | ||
206 | struct list_head rx_drain_list; /* state: FLUSH, drain started */ | ||
207 | struct list_head rx_reap_list; /* state: FLUSH, drain done */ | ||
169 | struct work_struct start_task; | 208 | struct work_struct start_task; |
170 | struct work_struct reap_task; | 209 | struct work_struct reap_task; |
171 | struct work_struct skb_task; | 210 | struct work_struct skb_task; |
211 | struct work_struct rx_reap_task; | ||
172 | struct delayed_work stale_task; | 212 | struct delayed_work stale_task; |
173 | struct sk_buff_head skb_queue; | 213 | struct sk_buff_head skb_queue; |
174 | struct list_head start_list; | 214 | struct list_head start_list; |
@@ -201,15 +241,17 @@ struct ipoib_dev_priv { | |||
201 | struct list_head multicast_list; | 241 | struct list_head multicast_list; |
202 | struct rb_root multicast_tree; | 242 | struct rb_root multicast_tree; |
203 | 243 | ||
204 | struct delayed_work pkey_task; | 244 | struct delayed_work pkey_poll_task; |
205 | struct delayed_work mcast_task; | 245 | struct delayed_work mcast_task; |
206 | struct work_struct flush_task; | 246 | struct work_struct flush_task; |
207 | struct work_struct restart_task; | 247 | struct work_struct restart_task; |
208 | struct delayed_work ah_reap_task; | 248 | struct delayed_work ah_reap_task; |
249 | struct work_struct pkey_event_task; | ||
209 | 250 | ||
210 | struct ib_device *ca; | 251 | struct ib_device *ca; |
211 | u8 port; | 252 | u8 port; |
212 | u16 pkey; | 253 | u16 pkey; |
254 | u16 pkey_index; | ||
213 | struct ib_pd *pd; | 255 | struct ib_pd *pd; |
214 | struct ib_mr *mr; | 256 | struct ib_mr *mr; |
215 | struct ib_cq *cq; | 257 | struct ib_cq *cq; |
@@ -333,12 +375,13 @@ struct ipoib_dev_priv *ipoib_intf_alloc(const char *format); | |||
333 | 375 | ||
334 | int ipoib_ib_dev_init(struct net_device *dev, struct ib_device *ca, int port); | 376 | int ipoib_ib_dev_init(struct net_device *dev, struct ib_device *ca, int port); |
335 | void ipoib_ib_dev_flush(struct work_struct *work); | 377 | void ipoib_ib_dev_flush(struct work_struct *work); |
378 | void ipoib_pkey_event(struct work_struct *work); | ||
336 | void ipoib_ib_dev_cleanup(struct net_device *dev); | 379 | void ipoib_ib_dev_cleanup(struct net_device *dev); |
337 | 380 | ||
338 | int ipoib_ib_dev_open(struct net_device *dev); | 381 | int ipoib_ib_dev_open(struct net_device *dev); |
339 | int ipoib_ib_dev_up(struct net_device *dev); | 382 | int ipoib_ib_dev_up(struct net_device *dev); |
340 | int ipoib_ib_dev_down(struct net_device *dev, int flush); | 383 | int ipoib_ib_dev_down(struct net_device *dev, int flush); |
341 | int ipoib_ib_dev_stop(struct net_device *dev); | 384 | int ipoib_ib_dev_stop(struct net_device *dev, int flush); |
342 | 385 | ||
343 | int ipoib_dev_init(struct net_device *dev, struct ib_device *ca, int port); | 386 | int ipoib_dev_init(struct net_device *dev, struct ib_device *ca, int port); |
344 | void ipoib_dev_cleanup(struct net_device *dev); | 387 | void ipoib_dev_cleanup(struct net_device *dev); |
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_cm.c b/drivers/infiniband/ulp/ipoib/ipoib_cm.c index eec833b81e9b..ffec794b7913 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_cm.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_cm.c | |||
@@ -37,6 +37,7 @@ | |||
37 | #include <net/dst.h> | 37 | #include <net/dst.h> |
38 | #include <net/icmp.h> | 38 | #include <net/icmp.h> |
39 | #include <linux/icmpv6.h> | 39 | #include <linux/icmpv6.h> |
40 | #include <linux/delay.h> | ||
40 | 41 | ||
41 | #ifdef CONFIG_INFINIBAND_IPOIB_DEBUG_DATA | 42 | #ifdef CONFIG_INFINIBAND_IPOIB_DEBUG_DATA |
42 | static int data_debug_level; | 43 | static int data_debug_level; |
@@ -62,6 +63,16 @@ struct ipoib_cm_id { | |||
62 | u32 remote_mtu; | 63 | u32 remote_mtu; |
63 | }; | 64 | }; |
64 | 65 | ||
66 | static struct ib_qp_attr ipoib_cm_err_attr = { | ||
67 | .qp_state = IB_QPS_ERR | ||
68 | }; | ||
69 | |||
70 | #define IPOIB_CM_RX_DRAIN_WRID 0x7fffffff | ||
71 | |||
72 | static struct ib_recv_wr ipoib_cm_rx_drain_wr = { | ||
73 | .wr_id = IPOIB_CM_RX_DRAIN_WRID | ||
74 | }; | ||
75 | |||
65 | static int ipoib_cm_tx_handler(struct ib_cm_id *cm_id, | 76 | static int ipoib_cm_tx_handler(struct ib_cm_id *cm_id, |
66 | struct ib_cm_event *event); | 77 | struct ib_cm_event *event); |
67 | 78 | ||
@@ -150,11 +161,44 @@ partial_error: | |||
150 | return NULL; | 161 | return NULL; |
151 | } | 162 | } |
152 | 163 | ||
164 | static void ipoib_cm_start_rx_drain(struct ipoib_dev_priv* priv) | ||
165 | { | ||
166 | struct ib_recv_wr *bad_wr; | ||
167 | |||
168 | /* rx_drain_qp send queue depth is 1, so | ||
169 | * make sure we have at most 1 outstanding WR. */ | ||
170 | if (list_empty(&priv->cm.rx_flush_list) || | ||
171 | !list_empty(&priv->cm.rx_drain_list)) | ||
172 | return; | ||
173 | |||
174 | if (ib_post_recv(priv->cm.rx_drain_qp, &ipoib_cm_rx_drain_wr, &bad_wr)) | ||
175 | ipoib_warn(priv, "failed to post rx_drain wr\n"); | ||
176 | |||
177 | list_splice_init(&priv->cm.rx_flush_list, &priv->cm.rx_drain_list); | ||
178 | } | ||
179 | |||
180 | static void ipoib_cm_rx_event_handler(struct ib_event *event, void *ctx) | ||
181 | { | ||
182 | struct ipoib_cm_rx *p = ctx; | ||
183 | struct ipoib_dev_priv *priv = netdev_priv(p->dev); | ||
184 | unsigned long flags; | ||
185 | |||
186 | if (event->event != IB_EVENT_QP_LAST_WQE_REACHED) | ||
187 | return; | ||
188 | |||
189 | spin_lock_irqsave(&priv->lock, flags); | ||
190 | list_move(&p->list, &priv->cm.rx_flush_list); | ||
191 | p->state = IPOIB_CM_RX_FLUSH; | ||
192 | ipoib_cm_start_rx_drain(priv); | ||
193 | spin_unlock_irqrestore(&priv->lock, flags); | ||
194 | } | ||
195 | |||
153 | static struct ib_qp *ipoib_cm_create_rx_qp(struct net_device *dev, | 196 | static struct ib_qp *ipoib_cm_create_rx_qp(struct net_device *dev, |
154 | struct ipoib_cm_rx *p) | 197 | struct ipoib_cm_rx *p) |
155 | { | 198 | { |
156 | struct ipoib_dev_priv *priv = netdev_priv(dev); | 199 | struct ipoib_dev_priv *priv = netdev_priv(dev); |
157 | struct ib_qp_init_attr attr = { | 200 | struct ib_qp_init_attr attr = { |
201 | .event_handler = ipoib_cm_rx_event_handler, | ||
158 | .send_cq = priv->cq, /* does not matter, we never send anything */ | 202 | .send_cq = priv->cq, /* does not matter, we never send anything */ |
159 | .recv_cq = priv->cq, | 203 | .recv_cq = priv->cq, |
160 | .srq = priv->cm.srq, | 204 | .srq = priv->cm.srq, |
@@ -256,6 +300,7 @@ static int ipoib_cm_req_handler(struct ib_cm_id *cm_id, struct ib_cm_event *even | |||
256 | 300 | ||
257 | cm_id->context = p; | 301 | cm_id->context = p; |
258 | p->jiffies = jiffies; | 302 | p->jiffies = jiffies; |
303 | p->state = IPOIB_CM_RX_LIVE; | ||
259 | spin_lock_irq(&priv->lock); | 304 | spin_lock_irq(&priv->lock); |
260 | if (list_empty(&priv->cm.passive_ids)) | 305 | if (list_empty(&priv->cm.passive_ids)) |
261 | queue_delayed_work(ipoib_workqueue, | 306 | queue_delayed_work(ipoib_workqueue, |
@@ -277,7 +322,6 @@ static int ipoib_cm_rx_handler(struct ib_cm_id *cm_id, | |||
277 | { | 322 | { |
278 | struct ipoib_cm_rx *p; | 323 | struct ipoib_cm_rx *p; |
279 | struct ipoib_dev_priv *priv; | 324 | struct ipoib_dev_priv *priv; |
280 | int ret; | ||
281 | 325 | ||
282 | switch (event->event) { | 326 | switch (event->event) { |
283 | case IB_CM_REQ_RECEIVED: | 327 | case IB_CM_REQ_RECEIVED: |
@@ -289,20 +333,9 @@ static int ipoib_cm_rx_handler(struct ib_cm_id *cm_id, | |||
289 | case IB_CM_REJ_RECEIVED: | 333 | case IB_CM_REJ_RECEIVED: |
290 | p = cm_id->context; | 334 | p = cm_id->context; |
291 | priv = netdev_priv(p->dev); | 335 | priv = netdev_priv(p->dev); |
292 | spin_lock_irq(&priv->lock); | 336 | if (ib_modify_qp(p->qp, &ipoib_cm_err_attr, IB_QP_STATE)) |
293 | if (list_empty(&p->list)) | 337 | ipoib_warn(priv, "unable to move qp to error state\n"); |
294 | ret = 0; /* Connection is going away already. */ | 338 | /* Fall through */ |
295 | else { | ||
296 | list_del_init(&p->list); | ||
297 | ret = -ECONNRESET; | ||
298 | } | ||
299 | spin_unlock_irq(&priv->lock); | ||
300 | if (ret) { | ||
301 | ib_destroy_qp(p->qp); | ||
302 | kfree(p); | ||
303 | return ret; | ||
304 | } | ||
305 | return 0; | ||
306 | default: | 339 | default: |
307 | return 0; | 340 | return 0; |
308 | } | 341 | } |
@@ -354,8 +387,15 @@ void ipoib_cm_handle_rx_wc(struct net_device *dev, struct ib_wc *wc) | |||
354 | wr_id, wc->status); | 387 | wr_id, wc->status); |
355 | 388 | ||
356 | if (unlikely(wr_id >= ipoib_recvq_size)) { | 389 | if (unlikely(wr_id >= ipoib_recvq_size)) { |
357 | ipoib_warn(priv, "cm recv completion event with wrid %d (> %d)\n", | 390 | if (wr_id == (IPOIB_CM_RX_DRAIN_WRID & ~IPOIB_CM_OP_SRQ)) { |
358 | wr_id, ipoib_recvq_size); | 391 | spin_lock_irqsave(&priv->lock, flags); |
392 | list_splice_init(&priv->cm.rx_drain_list, &priv->cm.rx_reap_list); | ||
393 | ipoib_cm_start_rx_drain(priv); | ||
394 | queue_work(ipoib_workqueue, &priv->cm.rx_reap_task); | ||
395 | spin_unlock_irqrestore(&priv->lock, flags); | ||
396 | } else | ||
397 | ipoib_warn(priv, "cm recv completion event with wrid %d (> %d)\n", | ||
398 | wr_id, ipoib_recvq_size); | ||
359 | return; | 399 | return; |
360 | } | 400 | } |
361 | 401 | ||
@@ -374,9 +414,9 @@ void ipoib_cm_handle_rx_wc(struct net_device *dev, struct ib_wc *wc) | |||
374 | if (p && time_after_eq(jiffies, p->jiffies + IPOIB_CM_RX_UPDATE_TIME)) { | 414 | if (p && time_after_eq(jiffies, p->jiffies + IPOIB_CM_RX_UPDATE_TIME)) { |
375 | spin_lock_irqsave(&priv->lock, flags); | 415 | spin_lock_irqsave(&priv->lock, flags); |
376 | p->jiffies = jiffies; | 416 | p->jiffies = jiffies; |
377 | /* Move this entry to list head, but do | 417 | /* Move this entry to list head, but do not re-add it |
378 | * not re-add it if it has been removed. */ | 418 | * if it has been moved out of list. */ |
379 | if (!list_empty(&p->list)) | 419 | if (p->state == IPOIB_CM_RX_LIVE) |
380 | list_move(&p->list, &priv->cm.passive_ids); | 420 | list_move(&p->list, &priv->cm.passive_ids); |
381 | spin_unlock_irqrestore(&priv->lock, flags); | 421 | spin_unlock_irqrestore(&priv->lock, flags); |
382 | } | 422 | } |
@@ -583,17 +623,43 @@ static void ipoib_cm_tx_completion(struct ib_cq *cq, void *tx_ptr) | |||
583 | int ipoib_cm_dev_open(struct net_device *dev) | 623 | int ipoib_cm_dev_open(struct net_device *dev) |
584 | { | 624 | { |
585 | struct ipoib_dev_priv *priv = netdev_priv(dev); | 625 | struct ipoib_dev_priv *priv = netdev_priv(dev); |
626 | struct ib_qp_init_attr qp_init_attr = { | ||
627 | .send_cq = priv->cq, /* does not matter, we never send anything */ | ||
628 | .recv_cq = priv->cq, | ||
629 | .cap.max_send_wr = 1, /* FIXME: 0 Seems not to work */ | ||
630 | .cap.max_send_sge = 1, /* FIXME: 0 Seems not to work */ | ||
631 | .cap.max_recv_wr = 1, | ||
632 | .cap.max_recv_sge = 1, /* FIXME: 0 Seems not to work */ | ||
633 | .sq_sig_type = IB_SIGNAL_ALL_WR, | ||
634 | .qp_type = IB_QPT_UC, | ||
635 | }; | ||
586 | int ret; | 636 | int ret; |
587 | 637 | ||
588 | if (!IPOIB_CM_SUPPORTED(dev->dev_addr)) | 638 | if (!IPOIB_CM_SUPPORTED(dev->dev_addr)) |
589 | return 0; | 639 | return 0; |
590 | 640 | ||
641 | priv->cm.rx_drain_qp = ib_create_qp(priv->pd, &qp_init_attr); | ||
642 | if (IS_ERR(priv->cm.rx_drain_qp)) { | ||
643 | printk(KERN_WARNING "%s: failed to create CM ID\n", priv->ca->name); | ||
644 | ret = PTR_ERR(priv->cm.rx_drain_qp); | ||
645 | return ret; | ||
646 | } | ||
647 | |||
648 | /* | ||
649 | * We put the QP in error state directly. This way, a "flush | ||
650 | * error" WC will be immediately generated for each WR we post. | ||
651 | */ | ||
652 | ret = ib_modify_qp(priv->cm.rx_drain_qp, &ipoib_cm_err_attr, IB_QP_STATE); | ||
653 | if (ret) { | ||
654 | ipoib_warn(priv, "failed to modify drain QP to error: %d\n", ret); | ||
655 | goto err_qp; | ||
656 | } | ||
657 | |||
591 | priv->cm.id = ib_create_cm_id(priv->ca, ipoib_cm_rx_handler, dev); | 658 | priv->cm.id = ib_create_cm_id(priv->ca, ipoib_cm_rx_handler, dev); |
592 | if (IS_ERR(priv->cm.id)) { | 659 | if (IS_ERR(priv->cm.id)) { |
593 | printk(KERN_WARNING "%s: failed to create CM ID\n", priv->ca->name); | 660 | printk(KERN_WARNING "%s: failed to create CM ID\n", priv->ca->name); |
594 | ret = PTR_ERR(priv->cm.id); | 661 | ret = PTR_ERR(priv->cm.id); |
595 | priv->cm.id = NULL; | 662 | goto err_cm; |
596 | return ret; | ||
597 | } | 663 | } |
598 | 664 | ||
599 | ret = ib_cm_listen(priv->cm.id, cpu_to_be64(IPOIB_CM_IETF_ID | priv->qp->qp_num), | 665 | ret = ib_cm_listen(priv->cm.id, cpu_to_be64(IPOIB_CM_IETF_ID | priv->qp->qp_num), |
@@ -601,35 +667,79 @@ int ipoib_cm_dev_open(struct net_device *dev) | |||
601 | if (ret) { | 667 | if (ret) { |
602 | printk(KERN_WARNING "%s: failed to listen on ID 0x%llx\n", priv->ca->name, | 668 | printk(KERN_WARNING "%s: failed to listen on ID 0x%llx\n", priv->ca->name, |
603 | IPOIB_CM_IETF_ID | priv->qp->qp_num); | 669 | IPOIB_CM_IETF_ID | priv->qp->qp_num); |
604 | ib_destroy_cm_id(priv->cm.id); | 670 | goto err_listen; |
605 | priv->cm.id = NULL; | ||
606 | return ret; | ||
607 | } | 671 | } |
672 | |||
608 | return 0; | 673 | return 0; |
674 | |||
675 | err_listen: | ||
676 | ib_destroy_cm_id(priv->cm.id); | ||
677 | err_cm: | ||
678 | priv->cm.id = NULL; | ||
679 | err_qp: | ||
680 | ib_destroy_qp(priv->cm.rx_drain_qp); | ||
681 | return ret; | ||
609 | } | 682 | } |
610 | 683 | ||
611 | void ipoib_cm_dev_stop(struct net_device *dev) | 684 | void ipoib_cm_dev_stop(struct net_device *dev) |
612 | { | 685 | { |
613 | struct ipoib_dev_priv *priv = netdev_priv(dev); | 686 | struct ipoib_dev_priv *priv = netdev_priv(dev); |
614 | struct ipoib_cm_rx *p; | 687 | struct ipoib_cm_rx *p, *n; |
688 | unsigned long begin; | ||
689 | LIST_HEAD(list); | ||
690 | int ret; | ||
615 | 691 | ||
616 | if (!IPOIB_CM_SUPPORTED(dev->dev_addr) || !priv->cm.id) | 692 | if (!IPOIB_CM_SUPPORTED(dev->dev_addr) || !priv->cm.id) |
617 | return; | 693 | return; |
618 | 694 | ||
619 | ib_destroy_cm_id(priv->cm.id); | 695 | ib_destroy_cm_id(priv->cm.id); |
620 | priv->cm.id = NULL; | 696 | priv->cm.id = NULL; |
697 | |||
621 | spin_lock_irq(&priv->lock); | 698 | spin_lock_irq(&priv->lock); |
622 | while (!list_empty(&priv->cm.passive_ids)) { | 699 | while (!list_empty(&priv->cm.passive_ids)) { |
623 | p = list_entry(priv->cm.passive_ids.next, typeof(*p), list); | 700 | p = list_entry(priv->cm.passive_ids.next, typeof(*p), list); |
624 | list_del_init(&p->list); | 701 | list_move(&p->list, &priv->cm.rx_error_list); |
702 | p->state = IPOIB_CM_RX_ERROR; | ||
625 | spin_unlock_irq(&priv->lock); | 703 | spin_unlock_irq(&priv->lock); |
704 | ret = ib_modify_qp(p->qp, &ipoib_cm_err_attr, IB_QP_STATE); | ||
705 | if (ret) | ||
706 | ipoib_warn(priv, "unable to move qp to error state: %d\n", ret); | ||
707 | spin_lock_irq(&priv->lock); | ||
708 | } | ||
709 | |||
710 | /* Wait for all RX to be drained */ | ||
711 | begin = jiffies; | ||
712 | |||
713 | while (!list_empty(&priv->cm.rx_error_list) || | ||
714 | !list_empty(&priv->cm.rx_flush_list) || | ||
715 | !list_empty(&priv->cm.rx_drain_list)) { | ||
716 | if (!time_after(jiffies, begin + 5 * HZ)) { | ||
717 | ipoib_warn(priv, "RX drain timing out\n"); | ||
718 | |||
719 | /* | ||
720 | * assume the HW is wedged and just free up everything. | ||
721 | */ | ||
722 | list_splice_init(&priv->cm.rx_flush_list, &list); | ||
723 | list_splice_init(&priv->cm.rx_error_list, &list); | ||
724 | list_splice_init(&priv->cm.rx_drain_list, &list); | ||
725 | break; | ||
726 | } | ||
727 | spin_unlock_irq(&priv->lock); | ||
728 | msleep(1); | ||
729 | spin_lock_irq(&priv->lock); | ||
730 | } | ||
731 | |||
732 | list_splice_init(&priv->cm.rx_reap_list, &list); | ||
733 | |||
734 | spin_unlock_irq(&priv->lock); | ||
735 | |||
736 | list_for_each_entry_safe(p, n, &list, list) { | ||
626 | ib_destroy_cm_id(p->id); | 737 | ib_destroy_cm_id(p->id); |
627 | ib_destroy_qp(p->qp); | 738 | ib_destroy_qp(p->qp); |
628 | kfree(p); | 739 | kfree(p); |
629 | spin_lock_irq(&priv->lock); | ||
630 | } | 740 | } |
631 | spin_unlock_irq(&priv->lock); | ||
632 | 741 | ||
742 | ib_destroy_qp(priv->cm.rx_drain_qp); | ||
633 | cancel_delayed_work(&priv->cm.stale_task); | 743 | cancel_delayed_work(&priv->cm.stale_task); |
634 | } | 744 | } |
635 | 745 | ||
@@ -1079,24 +1189,44 @@ void ipoib_cm_skb_too_long(struct net_device* dev, struct sk_buff *skb, | |||
1079 | queue_work(ipoib_workqueue, &priv->cm.skb_task); | 1189 | queue_work(ipoib_workqueue, &priv->cm.skb_task); |
1080 | } | 1190 | } |
1081 | 1191 | ||
1192 | static void ipoib_cm_rx_reap(struct work_struct *work) | ||
1193 | { | ||
1194 | struct ipoib_dev_priv *priv = container_of(work, struct ipoib_dev_priv, | ||
1195 | cm.rx_reap_task); | ||
1196 | struct ipoib_cm_rx *p, *n; | ||
1197 | LIST_HEAD(list); | ||
1198 | |||
1199 | spin_lock_irq(&priv->lock); | ||
1200 | list_splice_init(&priv->cm.rx_reap_list, &list); | ||
1201 | spin_unlock_irq(&priv->lock); | ||
1202 | |||
1203 | list_for_each_entry_safe(p, n, &list, list) { | ||
1204 | ib_destroy_cm_id(p->id); | ||
1205 | ib_destroy_qp(p->qp); | ||
1206 | kfree(p); | ||
1207 | } | ||
1208 | } | ||
1209 | |||
1082 | static void ipoib_cm_stale_task(struct work_struct *work) | 1210 | static void ipoib_cm_stale_task(struct work_struct *work) |
1083 | { | 1211 | { |
1084 | struct ipoib_dev_priv *priv = container_of(work, struct ipoib_dev_priv, | 1212 | struct ipoib_dev_priv *priv = container_of(work, struct ipoib_dev_priv, |
1085 | cm.stale_task.work); | 1213 | cm.stale_task.work); |
1086 | struct ipoib_cm_rx *p; | 1214 | struct ipoib_cm_rx *p; |
1215 | int ret; | ||
1087 | 1216 | ||
1088 | spin_lock_irq(&priv->lock); | 1217 | spin_lock_irq(&priv->lock); |
1089 | while (!list_empty(&priv->cm.passive_ids)) { | 1218 | while (!list_empty(&priv->cm.passive_ids)) { |
1090 | /* List if sorted by LRU, start from tail, | 1219 | /* List is sorted by LRU, start from tail, |
1091 | * stop when we see a recently used entry */ | 1220 | * stop when we see a recently used entry */ |
1092 | p = list_entry(priv->cm.passive_ids.prev, typeof(*p), list); | 1221 | p = list_entry(priv->cm.passive_ids.prev, typeof(*p), list); |
1093 | if (time_before_eq(jiffies, p->jiffies + IPOIB_CM_RX_TIMEOUT)) | 1222 | if (time_before_eq(jiffies, p->jiffies + IPOIB_CM_RX_TIMEOUT)) |
1094 | break; | 1223 | break; |
1095 | list_del_init(&p->list); | 1224 | list_move(&p->list, &priv->cm.rx_error_list); |
1225 | p->state = IPOIB_CM_RX_ERROR; | ||
1096 | spin_unlock_irq(&priv->lock); | 1226 | spin_unlock_irq(&priv->lock); |
1097 | ib_destroy_cm_id(p->id); | 1227 | ret = ib_modify_qp(p->qp, &ipoib_cm_err_attr, IB_QP_STATE); |
1098 | ib_destroy_qp(p->qp); | 1228 | if (ret) |
1099 | kfree(p); | 1229 | ipoib_warn(priv, "unable to move qp to error state: %d\n", ret); |
1100 | spin_lock_irq(&priv->lock); | 1230 | spin_lock_irq(&priv->lock); |
1101 | } | 1231 | } |
1102 | 1232 | ||
@@ -1164,9 +1294,14 @@ int ipoib_cm_dev_init(struct net_device *dev) | |||
1164 | INIT_LIST_HEAD(&priv->cm.passive_ids); | 1294 | INIT_LIST_HEAD(&priv->cm.passive_ids); |
1165 | INIT_LIST_HEAD(&priv->cm.reap_list); | 1295 | INIT_LIST_HEAD(&priv->cm.reap_list); |
1166 | INIT_LIST_HEAD(&priv->cm.start_list); | 1296 | INIT_LIST_HEAD(&priv->cm.start_list); |
1297 | INIT_LIST_HEAD(&priv->cm.rx_error_list); | ||
1298 | INIT_LIST_HEAD(&priv->cm.rx_flush_list); | ||
1299 | INIT_LIST_HEAD(&priv->cm.rx_drain_list); | ||
1300 | INIT_LIST_HEAD(&priv->cm.rx_reap_list); | ||
1167 | INIT_WORK(&priv->cm.start_task, ipoib_cm_tx_start); | 1301 | INIT_WORK(&priv->cm.start_task, ipoib_cm_tx_start); |
1168 | INIT_WORK(&priv->cm.reap_task, ipoib_cm_tx_reap); | 1302 | INIT_WORK(&priv->cm.reap_task, ipoib_cm_tx_reap); |
1169 | INIT_WORK(&priv->cm.skb_task, ipoib_cm_skb_reap); | 1303 | INIT_WORK(&priv->cm.skb_task, ipoib_cm_skb_reap); |
1304 | INIT_WORK(&priv->cm.rx_reap_task, ipoib_cm_rx_reap); | ||
1170 | INIT_DELAYED_WORK(&priv->cm.stale_task, ipoib_cm_stale_task); | 1305 | INIT_DELAYED_WORK(&priv->cm.stale_task, ipoib_cm_stale_task); |
1171 | 1306 | ||
1172 | skb_queue_head_init(&priv->cm.skb_queue); | 1307 | skb_queue_head_init(&priv->cm.skb_queue); |
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_ib.c b/drivers/infiniband/ulp/ipoib/ipoib_ib.c index 68d72c6f7ffb..c1aad06eb4e9 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_ib.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_ib.c | |||
@@ -448,6 +448,13 @@ int ipoib_ib_dev_open(struct net_device *dev) | |||
448 | struct ipoib_dev_priv *priv = netdev_priv(dev); | 448 | struct ipoib_dev_priv *priv = netdev_priv(dev); |
449 | int ret; | 449 | int ret; |
450 | 450 | ||
451 | if (ib_find_pkey(priv->ca, priv->port, priv->pkey, &priv->pkey_index)) { | ||
452 | ipoib_warn(priv, "P_Key 0x%04x not found\n", priv->pkey); | ||
453 | clear_bit(IPOIB_PKEY_ASSIGNED, &priv->flags); | ||
454 | return -1; | ||
455 | } | ||
456 | set_bit(IPOIB_PKEY_ASSIGNED, &priv->flags); | ||
457 | |||
451 | ret = ipoib_init_qp(dev); | 458 | ret = ipoib_init_qp(dev); |
452 | if (ret) { | 459 | if (ret) { |
453 | ipoib_warn(priv, "ipoib_init_qp returned %d\n", ret); | 460 | ipoib_warn(priv, "ipoib_init_qp returned %d\n", ret); |
@@ -457,14 +464,14 @@ int ipoib_ib_dev_open(struct net_device *dev) | |||
457 | ret = ipoib_ib_post_receives(dev); | 464 | ret = ipoib_ib_post_receives(dev); |
458 | if (ret) { | 465 | if (ret) { |
459 | ipoib_warn(priv, "ipoib_ib_post_receives returned %d\n", ret); | 466 | ipoib_warn(priv, "ipoib_ib_post_receives returned %d\n", ret); |
460 | ipoib_ib_dev_stop(dev); | 467 | ipoib_ib_dev_stop(dev, 1); |
461 | return -1; | 468 | return -1; |
462 | } | 469 | } |
463 | 470 | ||
464 | ret = ipoib_cm_dev_open(dev); | 471 | ret = ipoib_cm_dev_open(dev); |
465 | if (ret) { | 472 | if (ret) { |
466 | ipoib_warn(priv, "ipoib_ib_post_receives returned %d\n", ret); | 473 | ipoib_warn(priv, "ipoib_cm_dev_open returned %d\n", ret); |
467 | ipoib_ib_dev_stop(dev); | 474 | ipoib_ib_dev_stop(dev, 1); |
468 | return -1; | 475 | return -1; |
469 | } | 476 | } |
470 | 477 | ||
@@ -516,7 +523,7 @@ int ipoib_ib_dev_down(struct net_device *dev, int flush) | |||
516 | if (!test_bit(IPOIB_PKEY_ASSIGNED, &priv->flags)) { | 523 | if (!test_bit(IPOIB_PKEY_ASSIGNED, &priv->flags)) { |
517 | mutex_lock(&pkey_mutex); | 524 | mutex_lock(&pkey_mutex); |
518 | set_bit(IPOIB_PKEY_STOP, &priv->flags); | 525 | set_bit(IPOIB_PKEY_STOP, &priv->flags); |
519 | cancel_delayed_work(&priv->pkey_task); | 526 | cancel_delayed_work(&priv->pkey_poll_task); |
520 | mutex_unlock(&pkey_mutex); | 527 | mutex_unlock(&pkey_mutex); |
521 | if (flush) | 528 | if (flush) |
522 | flush_workqueue(ipoib_workqueue); | 529 | flush_workqueue(ipoib_workqueue); |
@@ -543,7 +550,7 @@ static int recvs_pending(struct net_device *dev) | |||
543 | return pending; | 550 | return pending; |
544 | } | 551 | } |
545 | 552 | ||
546 | int ipoib_ib_dev_stop(struct net_device *dev) | 553 | int ipoib_ib_dev_stop(struct net_device *dev, int flush) |
547 | { | 554 | { |
548 | struct ipoib_dev_priv *priv = netdev_priv(dev); | 555 | struct ipoib_dev_priv *priv = netdev_priv(dev); |
549 | struct ib_qp_attr qp_attr; | 556 | struct ib_qp_attr qp_attr; |
@@ -629,7 +636,8 @@ timeout: | |||
629 | /* Wait for all AHs to be reaped */ | 636 | /* Wait for all AHs to be reaped */ |
630 | set_bit(IPOIB_STOP_REAPER, &priv->flags); | 637 | set_bit(IPOIB_STOP_REAPER, &priv->flags); |
631 | cancel_delayed_work(&priv->ah_reap_task); | 638 | cancel_delayed_work(&priv->ah_reap_task); |
632 | flush_workqueue(ipoib_workqueue); | 639 | if (flush) |
640 | flush_workqueue(ipoib_workqueue); | ||
633 | 641 | ||
634 | begin = jiffies; | 642 | begin = jiffies; |
635 | 643 | ||
@@ -673,13 +681,24 @@ int ipoib_ib_dev_init(struct net_device *dev, struct ib_device *ca, int port) | |||
673 | return 0; | 681 | return 0; |
674 | } | 682 | } |
675 | 683 | ||
676 | void ipoib_ib_dev_flush(struct work_struct *work) | 684 | static void __ipoib_ib_dev_flush(struct ipoib_dev_priv *priv, int pkey_event) |
677 | { | 685 | { |
678 | struct ipoib_dev_priv *cpriv, *priv = | 686 | struct ipoib_dev_priv *cpriv; |
679 | container_of(work, struct ipoib_dev_priv, flush_task); | ||
680 | struct net_device *dev = priv->dev; | 687 | struct net_device *dev = priv->dev; |
688 | u16 new_index; | ||
689 | |||
690 | mutex_lock(&priv->vlan_mutex); | ||
681 | 691 | ||
682 | if (!test_bit(IPOIB_FLAG_INITIALIZED, &priv->flags) ) { | 692 | /* |
693 | * Flush any child interfaces too -- they might be up even if | ||
694 | * the parent is down. | ||
695 | */ | ||
696 | list_for_each_entry(cpriv, &priv->child_intfs, list) | ||
697 | __ipoib_ib_dev_flush(cpriv, pkey_event); | ||
698 | |||
699 | mutex_unlock(&priv->vlan_mutex); | ||
700 | |||
701 | if (!test_bit(IPOIB_FLAG_INITIALIZED, &priv->flags)) { | ||
683 | ipoib_dbg(priv, "Not flushing - IPOIB_FLAG_INITIALIZED not set.\n"); | 702 | ipoib_dbg(priv, "Not flushing - IPOIB_FLAG_INITIALIZED not set.\n"); |
684 | return; | 703 | return; |
685 | } | 704 | } |
@@ -689,10 +708,32 @@ void ipoib_ib_dev_flush(struct work_struct *work) | |||
689 | return; | 708 | return; |
690 | } | 709 | } |
691 | 710 | ||
711 | if (pkey_event) { | ||
712 | if (ib_find_pkey(priv->ca, priv->port, priv->pkey, &new_index)) { | ||
713 | clear_bit(IPOIB_PKEY_ASSIGNED, &priv->flags); | ||
714 | ipoib_ib_dev_down(dev, 0); | ||
715 | ipoib_pkey_dev_delay_open(dev); | ||
716 | return; | ||
717 | } | ||
718 | set_bit(IPOIB_PKEY_ASSIGNED, &priv->flags); | ||
719 | |||
720 | /* restart QP only if P_Key index is changed */ | ||
721 | if (new_index == priv->pkey_index) { | ||
722 | ipoib_dbg(priv, "Not flushing - P_Key index not changed.\n"); | ||
723 | return; | ||
724 | } | ||
725 | priv->pkey_index = new_index; | ||
726 | } | ||
727 | |||
692 | ipoib_dbg(priv, "flushing\n"); | 728 | ipoib_dbg(priv, "flushing\n"); |
693 | 729 | ||
694 | ipoib_ib_dev_down(dev, 0); | 730 | ipoib_ib_dev_down(dev, 0); |
695 | 731 | ||
732 | if (pkey_event) { | ||
733 | ipoib_ib_dev_stop(dev, 0); | ||
734 | ipoib_ib_dev_open(dev); | ||
735 | } | ||
736 | |||
696 | /* | 737 | /* |
697 | * The device could have been brought down between the start and when | 738 | * The device could have been brought down between the start and when |
698 | * we get here, don't bring it back up if it's not configured up | 739 | * we get here, don't bring it back up if it's not configured up |
@@ -701,14 +742,24 @@ void ipoib_ib_dev_flush(struct work_struct *work) | |||
701 | ipoib_ib_dev_up(dev); | 742 | ipoib_ib_dev_up(dev); |
702 | ipoib_mcast_restart_task(&priv->restart_task); | 743 | ipoib_mcast_restart_task(&priv->restart_task); |
703 | } | 744 | } |
745 | } | ||
704 | 746 | ||
705 | mutex_lock(&priv->vlan_mutex); | 747 | void ipoib_ib_dev_flush(struct work_struct *work) |
748 | { | ||
749 | struct ipoib_dev_priv *priv = | ||
750 | container_of(work, struct ipoib_dev_priv, flush_task); | ||
706 | 751 | ||
707 | /* Flush any child interfaces too */ | 752 | ipoib_dbg(priv, "Flushing %s\n", priv->dev->name); |
708 | list_for_each_entry(cpriv, &priv->child_intfs, list) | 753 | __ipoib_ib_dev_flush(priv, 0); |
709 | ipoib_ib_dev_flush(&cpriv->flush_task); | 754 | } |
710 | 755 | ||
711 | mutex_unlock(&priv->vlan_mutex); | 756 | void ipoib_pkey_event(struct work_struct *work) |
757 | { | ||
758 | struct ipoib_dev_priv *priv = | ||
759 | container_of(work, struct ipoib_dev_priv, pkey_event_task); | ||
760 | |||
761 | ipoib_dbg(priv, "Flushing %s and restarting its QP\n", priv->dev->name); | ||
762 | __ipoib_ib_dev_flush(priv, 1); | ||
712 | } | 763 | } |
713 | 764 | ||
714 | void ipoib_ib_dev_cleanup(struct net_device *dev) | 765 | void ipoib_ib_dev_cleanup(struct net_device *dev) |
@@ -736,7 +787,7 @@ void ipoib_ib_dev_cleanup(struct net_device *dev) | |||
736 | void ipoib_pkey_poll(struct work_struct *work) | 787 | void ipoib_pkey_poll(struct work_struct *work) |
737 | { | 788 | { |
738 | struct ipoib_dev_priv *priv = | 789 | struct ipoib_dev_priv *priv = |
739 | container_of(work, struct ipoib_dev_priv, pkey_task.work); | 790 | container_of(work, struct ipoib_dev_priv, pkey_poll_task.work); |
740 | struct net_device *dev = priv->dev; | 791 | struct net_device *dev = priv->dev; |
741 | 792 | ||
742 | ipoib_pkey_dev_check_presence(dev); | 793 | ipoib_pkey_dev_check_presence(dev); |
@@ -747,7 +798,7 @@ void ipoib_pkey_poll(struct work_struct *work) | |||
747 | mutex_lock(&pkey_mutex); | 798 | mutex_lock(&pkey_mutex); |
748 | if (!test_bit(IPOIB_PKEY_STOP, &priv->flags)) | 799 | if (!test_bit(IPOIB_PKEY_STOP, &priv->flags)) |
749 | queue_delayed_work(ipoib_workqueue, | 800 | queue_delayed_work(ipoib_workqueue, |
750 | &priv->pkey_task, | 801 | &priv->pkey_poll_task, |
751 | HZ); | 802 | HZ); |
752 | mutex_unlock(&pkey_mutex); | 803 | mutex_unlock(&pkey_mutex); |
753 | } | 804 | } |
@@ -766,7 +817,7 @@ int ipoib_pkey_dev_delay_open(struct net_device *dev) | |||
766 | mutex_lock(&pkey_mutex); | 817 | mutex_lock(&pkey_mutex); |
767 | clear_bit(IPOIB_PKEY_STOP, &priv->flags); | 818 | clear_bit(IPOIB_PKEY_STOP, &priv->flags); |
768 | queue_delayed_work(ipoib_workqueue, | 819 | queue_delayed_work(ipoib_workqueue, |
769 | &priv->pkey_task, | 820 | &priv->pkey_poll_task, |
770 | HZ); | 821 | HZ); |
771 | mutex_unlock(&pkey_mutex); | 822 | mutex_unlock(&pkey_mutex); |
772 | return 1; | 823 | return 1; |
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c index 0a428f2b05c7..894b1dcdf3eb 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_main.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c | |||
@@ -107,7 +107,7 @@ int ipoib_open(struct net_device *dev) | |||
107 | return -EINVAL; | 107 | return -EINVAL; |
108 | 108 | ||
109 | if (ipoib_ib_dev_up(dev)) { | 109 | if (ipoib_ib_dev_up(dev)) { |
110 | ipoib_ib_dev_stop(dev); | 110 | ipoib_ib_dev_stop(dev, 1); |
111 | return -EINVAL; | 111 | return -EINVAL; |
112 | } | 112 | } |
113 | 113 | ||
@@ -152,7 +152,7 @@ static int ipoib_stop(struct net_device *dev) | |||
152 | flush_workqueue(ipoib_workqueue); | 152 | flush_workqueue(ipoib_workqueue); |
153 | 153 | ||
154 | ipoib_ib_dev_down(dev, 1); | 154 | ipoib_ib_dev_down(dev, 1); |
155 | ipoib_ib_dev_stop(dev); | 155 | ipoib_ib_dev_stop(dev, 1); |
156 | 156 | ||
157 | if (!test_bit(IPOIB_FLAG_SUBINTERFACE, &priv->flags)) { | 157 | if (!test_bit(IPOIB_FLAG_SUBINTERFACE, &priv->flags)) { |
158 | struct ipoib_dev_priv *cpriv; | 158 | struct ipoib_dev_priv *cpriv; |
@@ -988,7 +988,8 @@ static void ipoib_setup(struct net_device *dev) | |||
988 | INIT_LIST_HEAD(&priv->dead_ahs); | 988 | INIT_LIST_HEAD(&priv->dead_ahs); |
989 | INIT_LIST_HEAD(&priv->multicast_list); | 989 | INIT_LIST_HEAD(&priv->multicast_list); |
990 | 990 | ||
991 | INIT_DELAYED_WORK(&priv->pkey_task, ipoib_pkey_poll); | 991 | INIT_DELAYED_WORK(&priv->pkey_poll_task, ipoib_pkey_poll); |
992 | INIT_WORK(&priv->pkey_event_task, ipoib_pkey_event); | ||
992 | INIT_DELAYED_WORK(&priv->mcast_task, ipoib_mcast_join_task); | 993 | INIT_DELAYED_WORK(&priv->mcast_task, ipoib_mcast_join_task); |
993 | INIT_WORK(&priv->flush_task, ipoib_ib_dev_flush); | 994 | INIT_WORK(&priv->flush_task, ipoib_ib_dev_flush); |
994 | INIT_WORK(&priv->restart_task, ipoib_mcast_restart_task); | 995 | INIT_WORK(&priv->restart_task, ipoib_mcast_restart_task); |
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c index 54fbead4de01..aae367057a56 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c | |||
@@ -524,7 +524,7 @@ void ipoib_mcast_join_task(struct work_struct *work) | |||
524 | return; | 524 | return; |
525 | 525 | ||
526 | if (ib_query_gid(priv->ca, priv->port, 0, &priv->local_gid)) | 526 | if (ib_query_gid(priv->ca, priv->port, 0, &priv->local_gid)) |
527 | ipoib_warn(priv, "ib_gid_entry_get() failed\n"); | 527 | ipoib_warn(priv, "ib_query_gid() failed\n"); |
528 | else | 528 | else |
529 | memcpy(priv->dev->dev_addr + 4, priv->local_gid.raw, sizeof (union ib_gid)); | 529 | memcpy(priv->dev->dev_addr + 4, priv->local_gid.raw, sizeof (union ib_gid)); |
530 | 530 | ||
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_verbs.c b/drivers/infiniband/ulp/ipoib/ipoib_verbs.c index 5c3c6a43a52b..982eb88e27ec 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_verbs.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_verbs.c | |||
@@ -33,8 +33,6 @@ | |||
33 | * $Id: ipoib_verbs.c 1349 2004-12-16 21:09:43Z roland $ | 33 | * $Id: ipoib_verbs.c 1349 2004-12-16 21:09:43Z roland $ |
34 | */ | 34 | */ |
35 | 35 | ||
36 | #include <rdma/ib_cache.h> | ||
37 | |||
38 | #include "ipoib.h" | 36 | #include "ipoib.h" |
39 | 37 | ||
40 | int ipoib_mcast_attach(struct net_device *dev, u16 mlid, union ib_gid *mgid) | 38 | int ipoib_mcast_attach(struct net_device *dev, u16 mlid, union ib_gid *mgid) |
@@ -49,7 +47,7 @@ int ipoib_mcast_attach(struct net_device *dev, u16 mlid, union ib_gid *mgid) | |||
49 | if (!qp_attr) | 47 | if (!qp_attr) |
50 | goto out; | 48 | goto out; |
51 | 49 | ||
52 | if (ib_find_cached_pkey(priv->ca, priv->port, priv->pkey, &pkey_index)) { | 50 | if (ib_find_pkey(priv->ca, priv->port, priv->pkey, &pkey_index)) { |
53 | clear_bit(IPOIB_PKEY_ASSIGNED, &priv->flags); | 51 | clear_bit(IPOIB_PKEY_ASSIGNED, &priv->flags); |
54 | ret = -ENXIO; | 52 | ret = -ENXIO; |
55 | goto out; | 53 | goto out; |
@@ -94,26 +92,16 @@ int ipoib_init_qp(struct net_device *dev) | |||
94 | { | 92 | { |
95 | struct ipoib_dev_priv *priv = netdev_priv(dev); | 93 | struct ipoib_dev_priv *priv = netdev_priv(dev); |
96 | int ret; | 94 | int ret; |
97 | u16 pkey_index; | ||
98 | struct ib_qp_attr qp_attr; | 95 | struct ib_qp_attr qp_attr; |
99 | int attr_mask; | 96 | int attr_mask; |
100 | 97 | ||
101 | /* | 98 | if (!test_bit(IPOIB_PKEY_ASSIGNED, &priv->flags)) |
102 | * Search through the port P_Key table for the requested pkey value. | 99 | return -1; |
103 | * The port has to be assigned to the respective IB partition in | ||
104 | * advance. | ||
105 | */ | ||
106 | ret = ib_find_cached_pkey(priv->ca, priv->port, priv->pkey, &pkey_index); | ||
107 | if (ret) { | ||
108 | clear_bit(IPOIB_PKEY_ASSIGNED, &priv->flags); | ||
109 | return ret; | ||
110 | } | ||
111 | set_bit(IPOIB_PKEY_ASSIGNED, &priv->flags); | ||
112 | 100 | ||
113 | qp_attr.qp_state = IB_QPS_INIT; | 101 | qp_attr.qp_state = IB_QPS_INIT; |
114 | qp_attr.qkey = 0; | 102 | qp_attr.qkey = 0; |
115 | qp_attr.port_num = priv->port; | 103 | qp_attr.port_num = priv->port; |
116 | qp_attr.pkey_index = pkey_index; | 104 | qp_attr.pkey_index = priv->pkey_index; |
117 | attr_mask = | 105 | attr_mask = |
118 | IB_QP_QKEY | | 106 | IB_QP_QKEY | |
119 | IB_QP_PORT | | 107 | IB_QP_PORT | |
@@ -185,7 +173,7 @@ int ipoib_transport_dev_init(struct net_device *dev, struct ib_device *ca) | |||
185 | size = ipoib_sendq_size + ipoib_recvq_size + 1; | 173 | size = ipoib_sendq_size + ipoib_recvq_size + 1; |
186 | ret = ipoib_cm_dev_init(dev); | 174 | ret = ipoib_cm_dev_init(dev); |
187 | if (!ret) | 175 | if (!ret) |
188 | size += ipoib_recvq_size; | 176 | size += ipoib_recvq_size + 1 /* 1 extra for rx_drain_qp */; |
189 | 177 | ||
190 | priv->cq = ib_create_cq(priv->ca, ipoib_ib_completion, NULL, dev, size, 0); | 178 | priv->cq = ib_create_cq(priv->ca, ipoib_ib_completion, NULL, dev, size, 0); |
191 | if (IS_ERR(priv->cq)) { | 179 | if (IS_ERR(priv->cq)) { |
@@ -259,14 +247,18 @@ void ipoib_event(struct ib_event_handler *handler, | |||
259 | struct ipoib_dev_priv *priv = | 247 | struct ipoib_dev_priv *priv = |
260 | container_of(handler, struct ipoib_dev_priv, event_handler); | 248 | container_of(handler, struct ipoib_dev_priv, event_handler); |
261 | 249 | ||
262 | if ((record->event == IB_EVENT_PORT_ERR || | 250 | if (record->element.port_num != priv->port) |
263 | record->event == IB_EVENT_PKEY_CHANGE || | 251 | return; |
264 | record->event == IB_EVENT_PORT_ACTIVE || | 252 | |
265 | record->event == IB_EVENT_LID_CHANGE || | 253 | if (record->event == IB_EVENT_PORT_ERR || |
266 | record->event == IB_EVENT_SM_CHANGE || | 254 | record->event == IB_EVENT_PORT_ACTIVE || |
267 | record->event == IB_EVENT_CLIENT_REREGISTER) && | 255 | record->event == IB_EVENT_LID_CHANGE || |
268 | record->element.port_num == priv->port) { | 256 | record->event == IB_EVENT_SM_CHANGE || |
257 | record->event == IB_EVENT_CLIENT_REREGISTER) { | ||
269 | ipoib_dbg(priv, "Port state change event\n"); | 258 | ipoib_dbg(priv, "Port state change event\n"); |
270 | queue_work(ipoib_workqueue, &priv->flush_task); | 259 | queue_work(ipoib_workqueue, &priv->flush_task); |
260 | } else if (record->event == IB_EVENT_PKEY_CHANGE) { | ||
261 | ipoib_dbg(priv, "P_Key change event on port:%d\n", priv->port); | ||
262 | queue_work(ipoib_workqueue, &priv->pkey_event_task); | ||
271 | } | 263 | } |
272 | } | 264 | } |
diff --git a/drivers/isdn/icn/icn.c b/drivers/isdn/icn/icn.c index 1e699bcaba0f..82d957bde299 100644 --- a/drivers/isdn/icn/icn.c +++ b/drivers/isdn/icn/icn.c | |||
@@ -12,6 +12,7 @@ | |||
12 | #include "icn.h" | 12 | #include "icn.h" |
13 | #include <linux/module.h> | 13 | #include <linux/module.h> |
14 | #include <linux/init.h> | 14 | #include <linux/init.h> |
15 | #include <linux/sched.h> | ||
15 | 16 | ||
16 | static int portbase = ICN_BASEADDR; | 17 | static int portbase = ICN_BASEADDR; |
17 | static unsigned long membase = ICN_MEMADDR; | 18 | static unsigned long membase = ICN_MEMADDR; |
diff --git a/drivers/isdn/sc/message.c b/drivers/isdn/sc/message.c index c5a307e3c496..0b4c4f15abdd 100644 --- a/drivers/isdn/sc/message.c +++ b/drivers/isdn/sc/message.c | |||
@@ -16,7 +16,7 @@ | |||
16 | * +1 (416) 297-8565 | 16 | * +1 (416) 297-8565 |
17 | * +1 (416) 297-6433 Facsimile | 17 | * +1 (416) 297-6433 Facsimile |
18 | */ | 18 | */ |
19 | 19 | #include <linux/sched.h> | |
20 | #include "includes.h" | 20 | #include "includes.h" |
21 | #include "hardware.h" | 21 | #include "hardware.h" |
22 | #include "message.h" | 22 | #include "message.h" |
diff --git a/drivers/kvm/kvm.h b/drivers/kvm/kvm.h index 41634fde8e13..1c040d80c641 100644 --- a/drivers/kvm/kvm.h +++ b/drivers/kvm/kvm.h | |||
@@ -11,6 +11,7 @@ | |||
11 | #include <linux/mutex.h> | 11 | #include <linux/mutex.h> |
12 | #include <linux/spinlock.h> | 12 | #include <linux/spinlock.h> |
13 | #include <linux/mm.h> | 13 | #include <linux/mm.h> |
14 | #include <asm/signal.h> | ||
14 | 15 | ||
15 | #include "vmx.h" | 16 | #include "vmx.h" |
16 | #include <linux/kvm.h> | 17 | #include <linux/kvm.h> |
diff --git a/drivers/kvm/kvm_main.c b/drivers/kvm/kvm_main.c index 0d892600ff00..da985b31b17e 100644 --- a/drivers/kvm/kvm_main.c +++ b/drivers/kvm/kvm_main.c | |||
@@ -40,6 +40,7 @@ | |||
40 | #include <linux/file.h> | 40 | #include <linux/file.h> |
41 | #include <linux/fs.h> | 41 | #include <linux/fs.h> |
42 | #include <linux/mount.h> | 42 | #include <linux/mount.h> |
43 | #include <linux/sched.h> | ||
43 | 44 | ||
44 | #include "x86_emulate.h" | 45 | #include "x86_emulate.h" |
45 | #include "segment_descriptor.h" | 46 | #include "segment_descriptor.h" |
diff --git a/drivers/kvm/svm.c b/drivers/kvm/svm.c index 9c15f32eea18..fa17d6d4f0cb 100644 --- a/drivers/kvm/svm.c +++ b/drivers/kvm/svm.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/vmalloc.h> | 19 | #include <linux/vmalloc.h> |
20 | #include <linux/highmem.h> | 20 | #include <linux/highmem.h> |
21 | #include <linux/profile.h> | 21 | #include <linux/profile.h> |
22 | #include <linux/sched.h> | ||
22 | #include <asm/desc.h> | 23 | #include <asm/desc.h> |
23 | 24 | ||
24 | #include "kvm_svm.h" | 25 | #include "kvm_svm.h" |
diff --git a/drivers/kvm/vmx.c b/drivers/kvm/vmx.c index 724db0027f00..e6e4d240b2a6 100644 --- a/drivers/kvm/vmx.c +++ b/drivers/kvm/vmx.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <linux/mm.h> | 22 | #include <linux/mm.h> |
23 | #include <linux/highmem.h> | 23 | #include <linux/highmem.h> |
24 | #include <linux/profile.h> | 24 | #include <linux/profile.h> |
25 | #include <linux/sched.h> | ||
25 | #include <asm/io.h> | 26 | #include <asm/io.h> |
26 | #include <asm/desc.h> | 27 | #include <asm/desc.h> |
27 | 28 | ||
diff --git a/drivers/net/declance.c b/drivers/net/declance.c index 95d854e2295c..b2577f40124e 100644 --- a/drivers/net/declance.c +++ b/drivers/net/declance.c | |||
@@ -932,8 +932,6 @@ static int lance_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
932 | /* Kick the lance: transmit now */ | 932 | /* Kick the lance: transmit now */ |
933 | writereg(&ll->rdp, LE_C0_INEA | LE_C0_TDMD); | 933 | writereg(&ll->rdp, LE_C0_INEA | LE_C0_TDMD); |
934 | 934 | ||
935 | spin_unlock_irq(&lp->lock); | ||
936 | |||
937 | dev->trans_start = jiffies; | 935 | dev->trans_start = jiffies; |
938 | dev_kfree_skb(skb); | 936 | dev_kfree_skb(skb); |
939 | 937 | ||
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c index 49be393e1c1d..cbc7febe9cdc 100644 --- a/drivers/net/e1000/e1000_main.c +++ b/drivers/net/e1000/e1000_main.c | |||
@@ -1431,10 +1431,6 @@ e1000_open(struct net_device *netdev) | |||
1431 | /* From here on the code is the same as e1000_up() */ | 1431 | /* From here on the code is the same as e1000_up() */ |
1432 | clear_bit(__E1000_DOWN, &adapter->flags); | 1432 | clear_bit(__E1000_DOWN, &adapter->flags); |
1433 | 1433 | ||
1434 | #ifdef CONFIG_E1000_NAPI | ||
1435 | netif_poll_enable(netdev); | ||
1436 | #endif | ||
1437 | |||
1438 | e1000_irq_enable(adapter); | 1434 | e1000_irq_enable(adapter); |
1439 | 1435 | ||
1440 | /* fire a link status change interrupt to start the watchdog */ | 1436 | /* fire a link status change interrupt to start the watchdog */ |
diff --git a/drivers/net/mlx4/fw.c b/drivers/net/mlx4/fw.c index c42717313663..cfa5cc072339 100644 --- a/drivers/net/mlx4/fw.c +++ b/drivers/net/mlx4/fw.c | |||
@@ -90,7 +90,7 @@ static void dump_dev_cap_flags(struct mlx4_dev *dev, u32 flags) | |||
90 | int i; | 90 | int i; |
91 | 91 | ||
92 | mlx4_dbg(dev, "DEV_CAP flags:\n"); | 92 | mlx4_dbg(dev, "DEV_CAP flags:\n"); |
93 | for (i = 0; i < 32; ++i) | 93 | for (i = 0; i < ARRAY_SIZE(fname); ++i) |
94 | if (fname[i] && (flags & (1 << i))) | 94 | if (fname[i] && (flags & (1 << i))) |
95 | mlx4_dbg(dev, " %s\n", fname[i]); | 95 | mlx4_dbg(dev, " %s\n", fname[i]); |
96 | } | 96 | } |
diff --git a/drivers/oprofile/buffer_sync.c b/drivers/oprofile/buffer_sync.c index 78c2e6e4b42e..edd6de995726 100644 --- a/drivers/oprofile/buffer_sync.c +++ b/drivers/oprofile/buffer_sync.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/profile.h> | 26 | #include <linux/profile.h> |
27 | #include <linux/module.h> | 27 | #include <linux/module.h> |
28 | #include <linux/fs.h> | 28 | #include <linux/fs.h> |
29 | #include <linux/sched.h> | ||
29 | 30 | ||
30 | #include "oprofile_stats.h" | 31 | #include "oprofile_stats.h" |
31 | #include "event_buffer.h" | 32 | #include "event_buffer.h" |
diff --git a/drivers/pci/hotplug/ibmphp_hpc.c b/drivers/pci/hotplug/ibmphp_hpc.c index 46abaa8c41f1..d06ccb69e411 100644 --- a/drivers/pci/hotplug/ibmphp_hpc.c +++ b/drivers/pci/hotplug/ibmphp_hpc.c | |||
@@ -34,6 +34,7 @@ | |||
34 | #include <linux/pci.h> | 34 | #include <linux/pci.h> |
35 | #include <linux/init.h> | 35 | #include <linux/init.h> |
36 | #include <linux/mutex.h> | 36 | #include <linux/mutex.h> |
37 | #include <linux/sched.h> | ||
37 | 38 | ||
38 | #include "ibmphp.h" | 39 | #include "ibmphp.h" |
39 | 40 | ||
diff --git a/drivers/pci/pcie/aer/aerdrv.h b/drivers/pci/pcie/aer/aerdrv.h index bf655dbaf8e2..5cca394d5999 100644 --- a/drivers/pci/pcie/aer/aerdrv.h +++ b/drivers/pci/pcie/aer/aerdrv.h | |||
@@ -8,6 +8,7 @@ | |||
8 | #ifndef _AERDRV_H_ | 8 | #ifndef _AERDRV_H_ |
9 | #define _AERDRV_H_ | 9 | #define _AERDRV_H_ |
10 | 10 | ||
11 | #include <linux/workqueue.h> | ||
11 | #include <linux/pcieport_if.h> | 12 | #include <linux/pcieport_if.h> |
12 | #include <linux/aer.h> | 13 | #include <linux/aer.h> |
13 | 14 | ||
diff --git a/drivers/scsi/megaraid/megaraid_mm.c b/drivers/scsi/megaraid/megaraid_mm.c index e075a52ac104..84d9c27133d4 100644 --- a/drivers/scsi/megaraid/megaraid_mm.c +++ b/drivers/scsi/megaraid/megaraid_mm.c | |||
@@ -14,7 +14,7 @@ | |||
14 | * | 14 | * |
15 | * Common management module | 15 | * Common management module |
16 | */ | 16 | */ |
17 | 17 | #include <linux/sched.h> | |
18 | #include "megaraid_mm.h" | 18 | #include "megaraid_mm.h" |
19 | 19 | ||
20 | 20 | ||
diff --git a/drivers/serial/bfin_5xx.c b/drivers/serial/bfin_5xx.c index 408390f93db9..787dc7168f3e 100644 --- a/drivers/serial/bfin_5xx.c +++ b/drivers/serial/bfin_5xx.c | |||
@@ -6,8 +6,6 @@ | |||
6 | * Created: | 6 | * Created: |
7 | * Description: Driver for blackfin 5xx serial ports | 7 | * Description: Driver for blackfin 5xx serial ports |
8 | * | 8 | * |
9 | * Rev: $Id: bfin_5xx.c,v 1.19 2006/09/24 02:33:53 aubrey Exp $ | ||
10 | * | ||
11 | * Modified: | 9 | * Modified: |
12 | * Copyright 2006 Analog Devices Inc. | 10 | * Copyright 2006 Analog Devices Inc. |
13 | * | 11 | * |
@@ -152,7 +150,7 @@ static void local_put_char(struct bfin_serial_port *uart, char ch) | |||
152 | 150 | ||
153 | static void bfin_serial_rx_chars(struct bfin_serial_port *uart) | 151 | static void bfin_serial_rx_chars(struct bfin_serial_port *uart) |
154 | { | 152 | { |
155 | struct tty_struct *tty = uart->port.info?uart->port.info->tty:0; | 153 | struct tty_struct *tty = uart->port.info->tty; |
156 | unsigned int status, ch, flg; | 154 | unsigned int status, ch, flg; |
157 | #ifdef BF533_FAMILY | 155 | #ifdef BF533_FAMILY |
158 | static int in_break = 0; | 156 | static int in_break = 0; |
@@ -173,8 +171,10 @@ static void bfin_serial_rx_chars(struct bfin_serial_port *uart) | |||
173 | if (ch != 0) { | 171 | if (ch != 0) { |
174 | in_break = 0; | 172 | in_break = 0; |
175 | ch = UART_GET_CHAR(uart); | 173 | ch = UART_GET_CHAR(uart); |
176 | } | 174 | if (bfin_revid() < 5) |
177 | return; | 175 | return; |
176 | } else | ||
177 | return; | ||
178 | } | 178 | } |
179 | #endif | 179 | #endif |
180 | 180 | ||
@@ -185,27 +185,32 @@ static void bfin_serial_rx_chars(struct bfin_serial_port *uart) | |||
185 | uart->port.icount.brk++; | 185 | uart->port.icount.brk++; |
186 | if (uart_handle_break(&uart->port)) | 186 | if (uart_handle_break(&uart->port)) |
187 | goto ignore_char; | 187 | goto ignore_char; |
188 | flg = TTY_BREAK; | 188 | } |
189 | } else if (status & PE) { | 189 | if (status & PE) |
190 | flg = TTY_PARITY; | ||
191 | uart->port.icount.parity++; | 190 | uart->port.icount.parity++; |
192 | } else if (status & OE) { | 191 | if (status & OE) |
193 | flg = TTY_OVERRUN; | ||
194 | uart->port.icount.overrun++; | 192 | uart->port.icount.overrun++; |
195 | } else if (status & FE) { | 193 | if (status & FE) |
196 | flg = TTY_FRAME; | ||
197 | uart->port.icount.frame++; | 194 | uart->port.icount.frame++; |
198 | } else | 195 | |
196 | status &= uart->port.read_status_mask; | ||
197 | |||
198 | if (status & BI) | ||
199 | flg = TTY_BREAK; | ||
200 | else if (status & PE) | ||
201 | flg = TTY_PARITY; | ||
202 | else if (status & FE) | ||
203 | flg = TTY_FRAME; | ||
204 | else | ||
199 | flg = TTY_NORMAL; | 205 | flg = TTY_NORMAL; |
200 | 206 | ||
201 | if (uart_handle_sysrq_char(&uart->port, ch)) | 207 | if (uart_handle_sysrq_char(&uart->port, ch)) |
202 | goto ignore_char; | 208 | goto ignore_char; |
203 | if (tty) | ||
204 | uart_insert_char(&uart->port, status, 2, ch, flg); | ||
205 | 209 | ||
206 | ignore_char: | 210 | uart_insert_char(&uart->port, status, OE, ch, flg); |
207 | if (tty) | 211 | |
208 | tty_flip_buffer_push(tty); | 212 | ignore_char: |
213 | tty_flip_buffer_push(tty); | ||
209 | } | 214 | } |
210 | 215 | ||
211 | static void bfin_serial_tx_chars(struct bfin_serial_port *uart) | 216 | static void bfin_serial_tx_chars(struct bfin_serial_port *uart) |
@@ -240,24 +245,29 @@ static void bfin_serial_tx_chars(struct bfin_serial_port *uart) | |||
240 | bfin_serial_stop_tx(&uart->port); | 245 | bfin_serial_stop_tx(&uart->port); |
241 | } | 246 | } |
242 | 247 | ||
243 | static irqreturn_t bfin_serial_int(int irq, void *dev_id) | 248 | static irqreturn_t bfin_serial_rx_int(int irq, void *dev_id) |
244 | { | 249 | { |
245 | struct bfin_serial_port *uart = dev_id; | 250 | struct bfin_serial_port *uart = dev_id; |
246 | unsigned short status; | ||
247 | 251 | ||
248 | spin_lock(&uart->port.lock); | 252 | spin_lock(&uart->port.lock); |
249 | status = UART_GET_IIR(uart); | 253 | while ((UART_GET_IIR(uart) & IIR_STATUS) == IIR_RX_READY) |
250 | do { | 254 | bfin_serial_rx_chars(uart); |
251 | if ((status & IIR_STATUS) == IIR_TX_READY) | ||
252 | bfin_serial_tx_chars(uart); | ||
253 | if ((status & IIR_STATUS) == IIR_RX_READY) | ||
254 | bfin_serial_rx_chars(uart); | ||
255 | status = UART_GET_IIR(uart); | ||
256 | } while (status & (IIR_TX_READY | IIR_RX_READY)); | ||
257 | spin_unlock(&uart->port.lock); | 255 | spin_unlock(&uart->port.lock); |
258 | return IRQ_HANDLED; | 256 | return IRQ_HANDLED; |
259 | } | 257 | } |
260 | 258 | ||
259 | static irqreturn_t bfin_serial_tx_int(int irq, void *dev_id) | ||
260 | { | ||
261 | struct bfin_serial_port *uart = dev_id; | ||
262 | |||
263 | spin_lock(&uart->port.lock); | ||
264 | while ((UART_GET_IIR(uart) & IIR_STATUS) == IIR_TX_READY) | ||
265 | bfin_serial_tx_chars(uart); | ||
266 | spin_unlock(&uart->port.lock); | ||
267 | return IRQ_HANDLED; | ||
268 | } | ||
269 | |||
270 | |||
261 | static void bfin_serial_do_work(struct work_struct *work) | 271 | static void bfin_serial_do_work(struct work_struct *work) |
262 | { | 272 | { |
263 | struct bfin_serial_port *uart = container_of(work, struct bfin_serial_port, cts_workqueue); | 273 | struct bfin_serial_port *uart = container_of(work, struct bfin_serial_port, cts_workqueue); |
@@ -319,7 +329,7 @@ static void bfin_serial_dma_tx_chars(struct bfin_serial_port *uart) | |||
319 | spin_unlock_irqrestore(&uart->port.lock, flags); | 329 | spin_unlock_irqrestore(&uart->port.lock, flags); |
320 | } | 330 | } |
321 | 331 | ||
322 | static void bfin_serial_dma_rx_chars(struct bfin_serial_port * uart) | 332 | static void bfin_serial_dma_rx_chars(struct bfin_serial_port *uart) |
323 | { | 333 | { |
324 | struct tty_struct *tty = uart->port.info->tty; | 334 | struct tty_struct *tty = uart->port.info->tty; |
325 | int i, flg, status; | 335 | int i, flg, status; |
@@ -331,25 +341,32 @@ static void bfin_serial_dma_rx_chars(struct bfin_serial_port * uart) | |||
331 | uart->port.icount.brk++; | 341 | uart->port.icount.brk++; |
332 | if (uart_handle_break(&uart->port)) | 342 | if (uart_handle_break(&uart->port)) |
333 | goto dma_ignore_char; | 343 | goto dma_ignore_char; |
334 | flg = TTY_BREAK; | 344 | } |
335 | } else if (status & PE) { | 345 | if (status & PE) |
336 | flg = TTY_PARITY; | ||
337 | uart->port.icount.parity++; | 346 | uart->port.icount.parity++; |
338 | } else if (status & OE) { | 347 | if (status & OE) |
339 | flg = TTY_OVERRUN; | ||
340 | uart->port.icount.overrun++; | 348 | uart->port.icount.overrun++; |
341 | } else if (status & FE) { | 349 | if (status & FE) |
342 | flg = TTY_FRAME; | ||
343 | uart->port.icount.frame++; | 350 | uart->port.icount.frame++; |
344 | } else | 351 | |
352 | status &= uart->port.read_status_mask; | ||
353 | |||
354 | if (status & BI) | ||
355 | flg = TTY_BREAK; | ||
356 | else if (status & PE) | ||
357 | flg = TTY_PARITY; | ||
358 | else if (status & FE) | ||
359 | flg = TTY_FRAME; | ||
360 | else | ||
345 | flg = TTY_NORMAL; | 361 | flg = TTY_NORMAL; |
346 | 362 | ||
347 | for (i = uart->rx_dma_buf.head; i < uart->rx_dma_buf.tail; i++) { | 363 | for (i = uart->rx_dma_buf.head; i < uart->rx_dma_buf.tail; i++) { |
348 | if (uart_handle_sysrq_char(&uart->port, uart->rx_dma_buf.buf[i])) | 364 | if (uart_handle_sysrq_char(&uart->port, uart->rx_dma_buf.buf[i])) |
349 | goto dma_ignore_char; | 365 | goto dma_ignore_char; |
350 | uart_insert_char(&uart->port, status, 2, uart->rx_dma_buf.buf[i], flg); | 366 | uart_insert_char(&uart->port, status, OE, uart->rx_dma_buf.buf[i], flg); |
351 | } | 367 | } |
352 | dma_ignore_char: | 368 | |
369 | dma_ignore_char: | ||
353 | tty_flip_buffer_push(tty); | 370 | tty_flip_buffer_push(tty); |
354 | } | 371 | } |
355 | 372 | ||
@@ -545,14 +562,14 @@ static int bfin_serial_startup(struct uart_port *port) | |||
545 | add_timer(&(uart->rx_dma_timer)); | 562 | add_timer(&(uart->rx_dma_timer)); |
546 | #else | 563 | #else |
547 | if (request_irq | 564 | if (request_irq |
548 | (uart->port.irq, bfin_serial_int, IRQF_DISABLED, | 565 | (uart->port.irq, bfin_serial_rx_int, IRQF_DISABLED, |
549 | "BFIN_UART_RX", uart)) { | 566 | "BFIN_UART_RX", uart)) { |
550 | printk(KERN_NOTICE "Unable to attach BlackFin UART RX interrupt\n"); | 567 | printk(KERN_NOTICE "Unable to attach BlackFin UART RX interrupt\n"); |
551 | return -EBUSY; | 568 | return -EBUSY; |
552 | } | 569 | } |
553 | 570 | ||
554 | if (request_irq | 571 | if (request_irq |
555 | (uart->port.irq+1, bfin_serial_int, IRQF_DISABLED, | 572 | (uart->port.irq+1, bfin_serial_tx_int, IRQF_DISABLED, |
556 | "BFIN_UART_TX", uart)) { | 573 | "BFIN_UART_TX", uart)) { |
557 | printk(KERN_NOTICE "Unable to attach BlackFin UART TX interrupt\n"); | 574 | printk(KERN_NOTICE "Unable to attach BlackFin UART TX interrupt\n"); |
558 | free_irq(uart->port.irq, uart); | 575 | free_irq(uart->port.irq, uart); |
@@ -614,13 +631,27 @@ bfin_serial_set_termios(struct uart_port *port, struct ktermios *termios, | |||
614 | lcr |= EPS; | 631 | lcr |= EPS; |
615 | } | 632 | } |
616 | 633 | ||
617 | /* These controls are not implemented for this port */ | 634 | port->read_status_mask = OE; |
618 | termios->c_iflag |= INPCK | BRKINT | PARMRK; | 635 | if (termios->c_iflag & INPCK) |
619 | termios->c_iflag &= ~(IGNPAR | IGNBRK); | 636 | port->read_status_mask |= (FE | PE); |
637 | if (termios->c_iflag & (BRKINT | PARMRK)) | ||
638 | port->read_status_mask |= BI; | ||
620 | 639 | ||
621 | /* These controls are not implemented for this port */ | 640 | /* |
622 | termios->c_iflag |= INPCK | BRKINT | PARMRK; | 641 | * Characters to ignore |
623 | termios->c_iflag &= ~(IGNPAR | IGNBRK); | 642 | */ |
643 | port->ignore_status_mask = 0; | ||
644 | if (termios->c_iflag & IGNPAR) | ||
645 | port->ignore_status_mask |= FE | PE; | ||
646 | if (termios->c_iflag & IGNBRK) { | ||
647 | port->ignore_status_mask |= BI; | ||
648 | /* | ||
649 | * If we're ignoring parity and break indicators, | ||
650 | * ignore overruns too (for real raw support). | ||
651 | */ | ||
652 | if (termios->c_iflag & IGNPAR) | ||
653 | port->ignore_status_mask |= OE; | ||
654 | } | ||
624 | 655 | ||
625 | baud = uart_get_baud_rate(port, termios, old, 0, port->uartclk/16); | 656 | baud = uart_get_baud_rate(port, termios, old, 0, port->uartclk/16); |
626 | quot = uart_get_divisor(port, baud); | 657 | quot = uart_get_divisor(port, baud); |
diff --git a/drivers/serial/serial_ks8695.c b/drivers/serial/serial_ks8695.c index c5346d677315..698763b28ddd 100644 --- a/drivers/serial/serial_ks8695.c +++ b/drivers/serial/serial_ks8695.c | |||
@@ -301,11 +301,11 @@ static int ks8695uart_startup(struct uart_port *port) | |||
301 | 301 | ||
302 | retval = request_irq(KS8695_IRQ_UART_LINE_STATUS, ks8695uart_rx_chars, IRQF_DISABLED, "UART LineStatus", port); | 302 | retval = request_irq(KS8695_IRQ_UART_LINE_STATUS, ks8695uart_rx_chars, IRQF_DISABLED, "UART LineStatus", port); |
303 | if (retval) | 303 | if (retval) |
304 | return err_ls; | 304 | goto err_ls; |
305 | 305 | ||
306 | retval = request_irq(KS8695_IRQ_UART_MODEM_STATUS, ks8695uart_modem_status, IRQF_DISABLED, "UART ModemStatus", port); | 306 | retval = request_irq(KS8695_IRQ_UART_MODEM_STATUS, ks8695uart_modem_status, IRQF_DISABLED, "UART ModemStatus", port); |
307 | if (retval) | 307 | if (retval) |
308 | return err_ms; | 308 | goto err_ms; |
309 | 309 | ||
310 | return 0; | 310 | return 0; |
311 | 311 | ||
diff --git a/drivers/spi/spi_bfin5xx.c b/drivers/spi/spi_bfin5xx.c index ce3c0ce2316e..7d2d9ec6cac3 100644 --- a/drivers/spi/spi_bfin5xx.c +++ b/drivers/spi/spi_bfin5xx.c | |||
@@ -126,7 +126,7 @@ struct chip_data { | |||
126 | 126 | ||
127 | u8 chip_select_num; | 127 | u8 chip_select_num; |
128 | u8 n_bytes; | 128 | u8 n_bytes; |
129 | u32 width; /* 0 or 1 */ | 129 | u8 width; /* 0 or 1 */ |
130 | u8 enable_dma; | 130 | u8 enable_dma; |
131 | u8 bits_per_word; /* 8 or 16 */ | 131 | u8 bits_per_word; /* 8 or 16 */ |
132 | u8 cs_change_per_word; | 132 | u8 cs_change_per_word; |
@@ -136,7 +136,7 @@ struct chip_data { | |||
136 | void (*duplex) (struct driver_data *); | 136 | void (*duplex) (struct driver_data *); |
137 | }; | 137 | }; |
138 | 138 | ||
139 | void bfin_spi_enable(struct driver_data *drv_data) | 139 | static void bfin_spi_enable(struct driver_data *drv_data) |
140 | { | 140 | { |
141 | u16 cr; | 141 | u16 cr; |
142 | 142 | ||
@@ -145,7 +145,7 @@ void bfin_spi_enable(struct driver_data *drv_data) | |||
145 | SSYNC(); | 145 | SSYNC(); |
146 | } | 146 | } |
147 | 147 | ||
148 | void bfin_spi_disable(struct driver_data *drv_data) | 148 | static void bfin_spi_disable(struct driver_data *drv_data) |
149 | { | 149 | { |
150 | u16 cr; | 150 | u16 cr; |
151 | 151 | ||
@@ -163,9 +163,6 @@ static u16 hz_to_spi_baud(u32 speed_hz) | |||
163 | if ((sclk % (2 * speed_hz)) > 0) | 163 | if ((sclk % (2 * speed_hz)) > 0) |
164 | spi_baud++; | 164 | spi_baud++; |
165 | 165 | ||
166 | pr_debug("sclk = %ld, speed_hz = %d, spi_baud = %d\n", sclk, speed_hz, | ||
167 | spi_baud); | ||
168 | |||
169 | return spi_baud; | 166 | return spi_baud; |
170 | } | 167 | } |
171 | 168 | ||
@@ -190,11 +187,12 @@ static void restore_state(struct driver_data *drv_data) | |||
190 | /* Clear status and disable clock */ | 187 | /* Clear status and disable clock */ |
191 | write_STAT(BIT_STAT_CLR); | 188 | write_STAT(BIT_STAT_CLR); |
192 | bfin_spi_disable(drv_data); | 189 | bfin_spi_disable(drv_data); |
193 | pr_debug("restoring spi ctl state\n"); | 190 | dev_dbg(&drv_data->pdev->dev, "restoring spi ctl state\n"); |
194 | 191 | ||
195 | #if defined(CONFIG_BF534) || defined(CONFIG_BF536) || defined(CONFIG_BF537) | 192 | #if defined(CONFIG_BF534) || defined(CONFIG_BF536) || defined(CONFIG_BF537) |
196 | pr_debug("chip select number is %d\n", chip->chip_select_num); | 193 | dev_dbg(&drv_data->pdev->dev, |
197 | 194 | "chip select number is %d\n", chip->chip_select_num); | |
195 | |||
198 | switch (chip->chip_select_num) { | 196 | switch (chip->chip_select_num) { |
199 | case 1: | 197 | case 1: |
200 | bfin_write_PORTF_FER(bfin_read_PORTF_FER() | 0x3c00); | 198 | bfin_write_PORTF_FER(bfin_read_PORTF_FER() | 0x3c00); |
@@ -280,7 +278,8 @@ static void null_reader(struct driver_data *drv_data) | |||
280 | 278 | ||
281 | static void u8_writer(struct driver_data *drv_data) | 279 | static void u8_writer(struct driver_data *drv_data) |
282 | { | 280 | { |
283 | pr_debug("cr8-s is 0x%x\n", read_STAT()); | 281 | dev_dbg(&drv_data->pdev->dev, |
282 | "cr8-s is 0x%x\n", read_STAT()); | ||
284 | while (drv_data->tx < drv_data->tx_end) { | 283 | while (drv_data->tx < drv_data->tx_end) { |
285 | write_TDBR(*(u8 *) (drv_data->tx)); | 284 | write_TDBR(*(u8 *) (drv_data->tx)); |
286 | while (read_STAT() & BIT_STAT_TXS) | 285 | while (read_STAT() & BIT_STAT_TXS) |
@@ -318,7 +317,8 @@ static void u8_cs_chg_writer(struct driver_data *drv_data) | |||
318 | 317 | ||
319 | static void u8_reader(struct driver_data *drv_data) | 318 | static void u8_reader(struct driver_data *drv_data) |
320 | { | 319 | { |
321 | pr_debug("cr-8 is 0x%x\n", read_STAT()); | 320 | dev_dbg(&drv_data->pdev->dev, |
321 | "cr-8 is 0x%x\n", read_STAT()); | ||
322 | 322 | ||
323 | /* clear TDBR buffer before read(else it will be shifted out) */ | 323 | /* clear TDBR buffer before read(else it will be shifted out) */ |
324 | write_TDBR(0xFFFF); | 324 | write_TDBR(0xFFFF); |
@@ -404,7 +404,9 @@ static void u8_cs_chg_duplex(struct driver_data *drv_data) | |||
404 | 404 | ||
405 | static void u16_writer(struct driver_data *drv_data) | 405 | static void u16_writer(struct driver_data *drv_data) |
406 | { | 406 | { |
407 | pr_debug("cr16 is 0x%x\n", read_STAT()); | 407 | dev_dbg(&drv_data->pdev->dev, |
408 | "cr16 is 0x%x\n", read_STAT()); | ||
409 | |||
408 | while (drv_data->tx < drv_data->tx_end) { | 410 | while (drv_data->tx < drv_data->tx_end) { |
409 | write_TDBR(*(u16 *) (drv_data->tx)); | 411 | write_TDBR(*(u16 *) (drv_data->tx)); |
410 | while ((read_STAT() & BIT_STAT_TXS)) | 412 | while ((read_STAT() & BIT_STAT_TXS)) |
@@ -442,7 +444,8 @@ static void u16_cs_chg_writer(struct driver_data *drv_data) | |||
442 | 444 | ||
443 | static void u16_reader(struct driver_data *drv_data) | 445 | static void u16_reader(struct driver_data *drv_data) |
444 | { | 446 | { |
445 | pr_debug("cr-16 is 0x%x\n", read_STAT()); | 447 | dev_dbg(&drv_data->pdev->dev, |
448 | "cr-16 is 0x%x\n", read_STAT()); | ||
446 | dummy_read(); | 449 | dummy_read(); |
447 | 450 | ||
448 | while (drv_data->rx < (drv_data->rx_end - 2)) { | 451 | while (drv_data->rx < (drv_data->rx_end - 2)) { |
@@ -571,12 +574,12 @@ static void giveback(struct driver_data *drv_data) | |||
571 | msg->complete(msg->context); | 574 | msg->complete(msg->context); |
572 | } | 575 | } |
573 | 576 | ||
574 | static irqreturn_t dma_irq_handler(int irq, void *dev_id, struct pt_regs *regs) | 577 | static irqreturn_t dma_irq_handler(int irq, void *dev_id) |
575 | { | 578 | { |
576 | struct driver_data *drv_data = (struct driver_data *)dev_id; | 579 | struct driver_data *drv_data = (struct driver_data *)dev_id; |
577 | struct spi_message *msg = drv_data->cur_msg; | 580 | struct spi_message *msg = drv_data->cur_msg; |
578 | 581 | ||
579 | pr_debug("in dma_irq_handler\n"); | 582 | dev_dbg(&drv_data->pdev->dev, "in dma_irq_handler\n"); |
580 | clear_dma_irqstat(CH_SPI); | 583 | clear_dma_irqstat(CH_SPI); |
581 | 584 | ||
582 | /* | 585 | /* |
@@ -604,7 +607,9 @@ static irqreturn_t dma_irq_handler(int irq, void *dev_id, struct pt_regs *regs) | |||
604 | tasklet_schedule(&drv_data->pump_transfers); | 607 | tasklet_schedule(&drv_data->pump_transfers); |
605 | 608 | ||
606 | /* free the irq handler before next transfer */ | 609 | /* free the irq handler before next transfer */ |
607 | pr_debug("disable dma channel irq%d\n", CH_SPI); | 610 | dev_dbg(&drv_data->pdev->dev, |
611 | "disable dma channel irq%d\n", | ||
612 | CH_SPI); | ||
608 | dma_disable_irq(CH_SPI); | 613 | dma_disable_irq(CH_SPI); |
609 | 614 | ||
610 | return IRQ_HANDLED; | 615 | return IRQ_HANDLED; |
@@ -617,7 +622,8 @@ static void pump_transfers(unsigned long data) | |||
617 | struct spi_transfer *transfer = NULL; | 622 | struct spi_transfer *transfer = NULL; |
618 | struct spi_transfer *previous = NULL; | 623 | struct spi_transfer *previous = NULL; |
619 | struct chip_data *chip = NULL; | 624 | struct chip_data *chip = NULL; |
620 | u16 cr, width, dma_width, dma_config; | 625 | u8 width; |
626 | u16 cr, dma_width, dma_config; | ||
621 | u32 tranf_success = 1; | 627 | u32 tranf_success = 1; |
622 | 628 | ||
623 | /* Get current state information */ | 629 | /* Get current state information */ |
@@ -662,8 +668,8 @@ static void pump_transfers(unsigned long data) | |||
662 | if (transfer->tx_buf != NULL) { | 668 | if (transfer->tx_buf != NULL) { |
663 | drv_data->tx = (void *)transfer->tx_buf; | 669 | drv_data->tx = (void *)transfer->tx_buf; |
664 | drv_data->tx_end = drv_data->tx + transfer->len; | 670 | drv_data->tx_end = drv_data->tx + transfer->len; |
665 | pr_debug("tx_buf is %p, tx_end is %p\n", transfer->tx_buf, | 671 | dev_dbg(&drv_data->pdev->dev, "tx_buf is %p, tx_end is %p\n", |
666 | drv_data->tx_end); | 672 | transfer->tx_buf, drv_data->tx_end); |
667 | } else { | 673 | } else { |
668 | drv_data->tx = NULL; | 674 | drv_data->tx = NULL; |
669 | } | 675 | } |
@@ -671,8 +677,8 @@ static void pump_transfers(unsigned long data) | |||
671 | if (transfer->rx_buf != NULL) { | 677 | if (transfer->rx_buf != NULL) { |
672 | drv_data->rx = transfer->rx_buf; | 678 | drv_data->rx = transfer->rx_buf; |
673 | drv_data->rx_end = drv_data->rx + transfer->len; | 679 | drv_data->rx_end = drv_data->rx + transfer->len; |
674 | pr_debug("rx_buf is %p, rx_end is %p\n", transfer->rx_buf, | 680 | dev_dbg(&drv_data->pdev->dev, "rx_buf is %p, rx_end is %p\n", |
675 | drv_data->rx_end); | 681 | transfer->rx_buf, drv_data->rx_end); |
676 | } else { | 682 | } else { |
677 | drv_data->rx = NULL; | 683 | drv_data->rx = NULL; |
678 | } | 684 | } |
@@ -690,9 +696,9 @@ static void pump_transfers(unsigned long data) | |||
690 | drv_data->write = drv_data->tx ? chip->write : null_writer; | 696 | drv_data->write = drv_data->tx ? chip->write : null_writer; |
691 | drv_data->read = drv_data->rx ? chip->read : null_reader; | 697 | drv_data->read = drv_data->rx ? chip->read : null_reader; |
692 | drv_data->duplex = chip->duplex ? chip->duplex : null_writer; | 698 | drv_data->duplex = chip->duplex ? chip->duplex : null_writer; |
693 | pr_debug | 699 | dev_dbg(&drv_data->pdev->dev, |
694 | ("transfer: drv_data->write is %p, chip->write is %p, null_wr is %p\n", | 700 | "transfer: drv_data->write is %p, chip->write is %p, null_wr is %p\n", |
695 | drv_data->write, chip->write, null_writer); | 701 | drv_data->write, chip->write, null_writer); |
696 | 702 | ||
697 | /* speed and width has been set on per message */ | 703 | /* speed and width has been set on per message */ |
698 | message->state = RUNNING_STATE; | 704 | message->state = RUNNING_STATE; |
@@ -706,8 +712,9 @@ static void pump_transfers(unsigned long data) | |||
706 | } | 712 | } |
707 | write_FLAG(chip->flag); | 713 | write_FLAG(chip->flag); |
708 | 714 | ||
709 | pr_debug("now pumping a transfer: width is %d, len is %d\n", width, | 715 | dev_dbg(&drv_data->pdev->dev, |
710 | transfer->len); | 716 | "now pumping a transfer: width is %d, len is %d\n", |
717 | width, transfer->len); | ||
711 | 718 | ||
712 | /* | 719 | /* |
713 | * Try to map dma buffer and do a dma transfer if | 720 | * Try to map dma buffer and do a dma transfer if |
@@ -722,7 +729,7 @@ static void pump_transfers(unsigned long data) | |||
722 | bfin_spi_disable(drv_data); | 729 | bfin_spi_disable(drv_data); |
723 | 730 | ||
724 | /* config dma channel */ | 731 | /* config dma channel */ |
725 | pr_debug("doing dma transfer\n"); | 732 | dev_dbg(&drv_data->pdev->dev, "doing dma transfer\n"); |
726 | if (width == CFG_SPI_WORDSIZE16) { | 733 | if (width == CFG_SPI_WORDSIZE16) { |
727 | set_dma_x_count(CH_SPI, drv_data->len); | 734 | set_dma_x_count(CH_SPI, drv_data->len); |
728 | set_dma_x_modify(CH_SPI, 2); | 735 | set_dma_x_modify(CH_SPI, 2); |
@@ -738,7 +745,8 @@ static void pump_transfers(unsigned long data) | |||
738 | 745 | ||
739 | /* dirty hack for autobuffer DMA mode */ | 746 | /* dirty hack for autobuffer DMA mode */ |
740 | if (drv_data->tx_dma == 0xFFFF) { | 747 | if (drv_data->tx_dma == 0xFFFF) { |
741 | pr_debug("doing autobuffer DMA out.\n"); | 748 | dev_dbg(&drv_data->pdev->dev, |
749 | "doing autobuffer DMA out.\n"); | ||
742 | 750 | ||
743 | /* no irq in autobuffer mode */ | 751 | /* no irq in autobuffer mode */ |
744 | dma_config = | 752 | dma_config = |
@@ -758,7 +766,7 @@ static void pump_transfers(unsigned long data) | |||
758 | /* In dma mode, rx or tx must be NULL in one transfer */ | 766 | /* In dma mode, rx or tx must be NULL in one transfer */ |
759 | if (drv_data->rx != NULL) { | 767 | if (drv_data->rx != NULL) { |
760 | /* set transfer mode, and enable SPI */ | 768 | /* set transfer mode, and enable SPI */ |
761 | pr_debug("doing DMA in.\n"); | 769 | dev_dbg(&drv_data->pdev->dev, "doing DMA in.\n"); |
762 | 770 | ||
763 | /* disable SPI before write to TDBR */ | 771 | /* disable SPI before write to TDBR */ |
764 | write_CTRL(cr & ~BIT_CTL_ENABLE); | 772 | write_CTRL(cr & ~BIT_CTL_ENABLE); |
@@ -781,7 +789,7 @@ static void pump_transfers(unsigned long data) | |||
781 | /* set transfer mode, and enable SPI */ | 789 | /* set transfer mode, and enable SPI */ |
782 | write_CTRL(cr); | 790 | write_CTRL(cr); |
783 | } else if (drv_data->tx != NULL) { | 791 | } else if (drv_data->tx != NULL) { |
784 | pr_debug("doing DMA out.\n"); | 792 | dev_dbg(&drv_data->pdev->dev, "doing DMA out.\n"); |
785 | 793 | ||
786 | /* start dma */ | 794 | /* start dma */ |
787 | dma_enable_irq(CH_SPI); | 795 | dma_enable_irq(CH_SPI); |
@@ -796,7 +804,7 @@ static void pump_transfers(unsigned long data) | |||
796 | } | 804 | } |
797 | } else { | 805 | } else { |
798 | /* IO mode write then read */ | 806 | /* IO mode write then read */ |
799 | pr_debug("doing IO transfer\n"); | 807 | dev_dbg(&drv_data->pdev->dev, "doing IO transfer\n"); |
800 | 808 | ||
801 | write_STAT(BIT_STAT_CLR); | 809 | write_STAT(BIT_STAT_CLR); |
802 | 810 | ||
@@ -804,11 +812,11 @@ static void pump_transfers(unsigned long data) | |||
804 | /* full duplex mode */ | 812 | /* full duplex mode */ |
805 | BUG_ON((drv_data->tx_end - drv_data->tx) != | 813 | BUG_ON((drv_data->tx_end - drv_data->tx) != |
806 | (drv_data->rx_end - drv_data->rx)); | 814 | (drv_data->rx_end - drv_data->rx)); |
807 | cr = (read_CTRL() & (~BIT_CTL_TIMOD)); /* clear the TIMOD bits */ | 815 | cr = (read_CTRL() & (~BIT_CTL_TIMOD)); |
808 | cr |= | 816 | cr |= CFG_SPI_WRITE | (width << 8) | |
809 | CFG_SPI_WRITE | (width << 8) | (CFG_SPI_ENABLE << | 817 | (CFG_SPI_ENABLE << 14); |
810 | 14); | 818 | dev_dbg(&drv_data->pdev->dev, |
811 | pr_debug("IO duplex: cr is 0x%x\n", cr); | 819 | "IO duplex: cr is 0x%x\n", cr); |
812 | 820 | ||
813 | write_CTRL(cr); | 821 | write_CTRL(cr); |
814 | SSYNC(); | 822 | SSYNC(); |
@@ -819,11 +827,11 @@ static void pump_transfers(unsigned long data) | |||
819 | tranf_success = 0; | 827 | tranf_success = 0; |
820 | } else if (drv_data->tx != NULL) { | 828 | } else if (drv_data->tx != NULL) { |
821 | /* write only half duplex */ | 829 | /* write only half duplex */ |
822 | cr = (read_CTRL() & (~BIT_CTL_TIMOD)); /* clear the TIMOD bits */ | 830 | cr = (read_CTRL() & (~BIT_CTL_TIMOD)); |
823 | cr |= | 831 | cr |= CFG_SPI_WRITE | (width << 8) | |
824 | CFG_SPI_WRITE | (width << 8) | (CFG_SPI_ENABLE << | 832 | (CFG_SPI_ENABLE << 14); |
825 | 14); | 833 | dev_dbg(&drv_data->pdev->dev, |
826 | pr_debug("IO write: cr is 0x%x\n", cr); | 834 | "IO write: cr is 0x%x\n", cr); |
827 | 835 | ||
828 | write_CTRL(cr); | 836 | write_CTRL(cr); |
829 | SSYNC(); | 837 | SSYNC(); |
@@ -834,11 +842,11 @@ static void pump_transfers(unsigned long data) | |||
834 | tranf_success = 0; | 842 | tranf_success = 0; |
835 | } else if (drv_data->rx != NULL) { | 843 | } else if (drv_data->rx != NULL) { |
836 | /* read only half duplex */ | 844 | /* read only half duplex */ |
837 | cr = (read_CTRL() & (~BIT_CTL_TIMOD)); /* cleare the TIMOD bits */ | 845 | cr = (read_CTRL() & (~BIT_CTL_TIMOD)); |
838 | cr |= | 846 | cr |= CFG_SPI_READ | (width << 8) | |
839 | CFG_SPI_READ | (width << 8) | (CFG_SPI_ENABLE << | 847 | (CFG_SPI_ENABLE << 14); |
840 | 14); | 848 | dev_dbg(&drv_data->pdev->dev, |
841 | pr_debug("IO read: cr is 0x%x\n", cr); | 849 | "IO read: cr is 0x%x\n", cr); |
842 | 850 | ||
843 | write_CTRL(cr); | 851 | write_CTRL(cr); |
844 | SSYNC(); | 852 | SSYNC(); |
@@ -849,7 +857,8 @@ static void pump_transfers(unsigned long data) | |||
849 | } | 857 | } |
850 | 858 | ||
851 | if (!tranf_success) { | 859 | if (!tranf_success) { |
852 | pr_debug("IO write error!\n"); | 860 | dev_dbg(&drv_data->pdev->dev, |
861 | "IO write error!\n"); | ||
853 | message->state = ERROR_STATE; | 862 | message->state = ERROR_STATE; |
854 | } else { | 863 | } else { |
855 | /* Update total byte transfered */ | 864 | /* Update total byte transfered */ |
@@ -899,11 +908,14 @@ static void pump_messages(struct work_struct *work) | |||
899 | /* Setup the SSP using the per chip configuration */ | 908 | /* Setup the SSP using the per chip configuration */ |
900 | drv_data->cur_chip = spi_get_ctldata(drv_data->cur_msg->spi); | 909 | drv_data->cur_chip = spi_get_ctldata(drv_data->cur_msg->spi); |
901 | restore_state(drv_data); | 910 | restore_state(drv_data); |
902 | pr_debug | 911 | dev_dbg(&drv_data->pdev->dev, |
903 | ("got a message to pump, state is set to: baud %d, flag 0x%x, ctl 0x%x\n", | 912 | "got a message to pump, state is set to: baud %d, flag 0x%x, ctl 0x%x\n", |
904 | drv_data->cur_chip->baud, drv_data->cur_chip->flag, | 913 | drv_data->cur_chip->baud, drv_data->cur_chip->flag, |
905 | drv_data->cur_chip->ctl_reg); | 914 | drv_data->cur_chip->ctl_reg); |
906 | pr_debug("the first transfer len is %d\n", drv_data->cur_transfer->len); | 915 | |
916 | dev_dbg(&drv_data->pdev->dev, | ||
917 | "the first transfer len is %d\n", | ||
918 | drv_data->cur_transfer->len); | ||
907 | 919 | ||
908 | /* Mark as busy and launch transfers */ | 920 | /* Mark as busy and launch transfers */ |
909 | tasklet_schedule(&drv_data->pump_transfers); | 921 | tasklet_schedule(&drv_data->pump_transfers); |
@@ -932,7 +944,7 @@ static int transfer(struct spi_device *spi, struct spi_message *msg) | |||
932 | msg->status = -EINPROGRESS; | 944 | msg->status = -EINPROGRESS; |
933 | msg->state = START_STATE; | 945 | msg->state = START_STATE; |
934 | 946 | ||
935 | pr_debug("adding an msg in transfer() \n"); | 947 | dev_dbg(&spi->dev, "adding an msg in transfer() \n"); |
936 | list_add_tail(&msg->queue, &drv_data->queue); | 948 | list_add_tail(&msg->queue, &drv_data->queue); |
937 | 949 | ||
938 | if (drv_data->run == QUEUE_RUNNING && !drv_data->busy) | 950 | if (drv_data->run == QUEUE_RUNNING && !drv_data->busy) |
@@ -1002,13 +1014,13 @@ static int setup(struct spi_device *spi) | |||
1002 | if (chip->enable_dma && !dma_requested) { | 1014 | if (chip->enable_dma && !dma_requested) { |
1003 | /* register dma irq handler */ | 1015 | /* register dma irq handler */ |
1004 | if (request_dma(CH_SPI, "BF53x_SPI_DMA") < 0) { | 1016 | if (request_dma(CH_SPI, "BF53x_SPI_DMA") < 0) { |
1005 | pr_debug | 1017 | dev_dbg(&spi->dev, |
1006 | ("Unable to request BlackFin SPI DMA channel\n"); | 1018 | "Unable to request BlackFin SPI DMA channel\n"); |
1007 | return -ENODEV; | 1019 | return -ENODEV; |
1008 | } | 1020 | } |
1009 | if (set_dma_callback(CH_SPI, (void *)dma_irq_handler, drv_data) | 1021 | if (set_dma_callback(CH_SPI, (void *)dma_irq_handler, drv_data) |
1010 | < 0) { | 1022 | < 0) { |
1011 | pr_debug("Unable to set dma callback\n"); | 1023 | dev_dbg(&spi->dev, "Unable to set dma callback\n"); |
1012 | return -EPERM; | 1024 | return -EPERM; |
1013 | } | 1025 | } |
1014 | dma_disable_irq(CH_SPI); | 1026 | dma_disable_irq(CH_SPI); |
@@ -1054,9 +1066,9 @@ static int setup(struct spi_device *spi) | |||
1054 | return -ENODEV; | 1066 | return -ENODEV; |
1055 | } | 1067 | } |
1056 | 1068 | ||
1057 | pr_debug("setup spi chip %s, width is %d, dma is %d,", | 1069 | dev_dbg(&spi->dev, "setup spi chip %s, width is %d, dma is %d,", |
1058 | spi->modalias, chip->width, chip->enable_dma); | 1070 | spi->modalias, chip->width, chip->enable_dma); |
1059 | pr_debug("ctl_reg is 0x%x, flag_reg is 0x%x\n", | 1071 | dev_dbg(&spi->dev, "ctl_reg is 0x%x, flag_reg is 0x%x\n", |
1060 | chip->ctl_reg, chip->flag); | 1072 | chip->ctl_reg, chip->flag); |
1061 | 1073 | ||
1062 | spi_set_ctldata(spi, chip); | 1074 | spi_set_ctldata(spi, chip); |
@@ -1068,7 +1080,7 @@ static int setup(struct spi_device *spi) | |||
1068 | * callback for spi framework. | 1080 | * callback for spi framework. |
1069 | * clean driver specific data | 1081 | * clean driver specific data |
1070 | */ | 1082 | */ |
1071 | static void cleanup(const struct spi_device *spi) | 1083 | static void cleanup(struct spi_device *spi) |
1072 | { | 1084 | { |
1073 | struct chip_data *chip = spi_get_ctldata((struct spi_device *)spi); | 1085 | struct chip_data *chip = spi_get_ctldata((struct spi_device *)spi); |
1074 | 1086 | ||
@@ -1207,7 +1219,7 @@ static int __init bfin5xx_spi_probe(struct platform_device *pdev) | |||
1207 | dev_err(&pdev->dev, "problem registering spi master\n"); | 1219 | dev_err(&pdev->dev, "problem registering spi master\n"); |
1208 | goto out_error_queue_alloc; | 1220 | goto out_error_queue_alloc; |
1209 | } | 1221 | } |
1210 | pr_debug("controller probe successfully\n"); | 1222 | dev_dbg(&pdev->dev, "controller probe successfully\n"); |
1211 | return status; | 1223 | return status; |
1212 | 1224 | ||
1213 | out_error_queue_alloc: | 1225 | out_error_queue_alloc: |
@@ -1287,27 +1299,23 @@ static int bfin5xx_spi_resume(struct platform_device *pdev) | |||
1287 | #endif /* CONFIG_PM */ | 1299 | #endif /* CONFIG_PM */ |
1288 | 1300 | ||
1289 | static struct platform_driver bfin5xx_spi_driver = { | 1301 | static struct platform_driver bfin5xx_spi_driver = { |
1290 | .driver = { | 1302 | .driver = { |
1291 | .name = "bfin-spi-master", | 1303 | .name = "bfin-spi-master", |
1292 | .bus = &platform_bus_type, | 1304 | .owner = THIS_MODULE, |
1293 | .owner = THIS_MODULE, | 1305 | }, |
1294 | }, | 1306 | .suspend = bfin5xx_spi_suspend, |
1295 | .probe = bfin5xx_spi_probe, | 1307 | .resume = bfin5xx_spi_resume, |
1296 | .remove = __devexit_p(bfin5xx_spi_remove), | 1308 | .remove = __devexit_p(bfin5xx_spi_remove), |
1297 | .suspend = bfin5xx_spi_suspend, | ||
1298 | .resume = bfin5xx_spi_resume, | ||
1299 | }; | 1309 | }; |
1300 | 1310 | ||
1301 | static int __init bfin5xx_spi_init(void) | 1311 | static int __init bfin5xx_spi_init(void) |
1302 | { | 1312 | { |
1303 | return platform_driver_register(&bfin5xx_spi_driver); | 1313 | return platform_driver_probe(&bfin5xx_spi_driver, bfin5xx_spi_probe); |
1304 | } | 1314 | } |
1305 | |||
1306 | module_init(bfin5xx_spi_init); | 1315 | module_init(bfin5xx_spi_init); |
1307 | 1316 | ||
1308 | static void __exit bfin5xx_spi_exit(void) | 1317 | static void __exit bfin5xx_spi_exit(void) |
1309 | { | 1318 | { |
1310 | platform_driver_unregister(&bfin5xx_spi_driver); | 1319 | platform_driver_unregister(&bfin5xx_spi_driver); |
1311 | } | 1320 | } |
1312 | |||
1313 | module_exit(bfin5xx_spi_exit); | 1321 | module_exit(bfin5xx_spi_exit); |