From edfa78b2ba651782d70be6d1fef214e21a26d8cb Mon Sep 17 00:00:00 2001 From: Ivo van Doorn Date: Tue, 3 Jun 2008 20:29:50 +0200 Subject: rt2x00: Don't kill guardian_urb when it wasn't created This fixes a "BUG: unable to handle kernel paging request" bug in rt73usb which was caused by killing the guardian_urb while it had never been allocated for rt73usb. Signed-off-by: Ivo van Doorn Signed-off-by: John W. Linville --- drivers/net/wireless/rt2x00/rt2x00usb.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'drivers') diff --git a/drivers/net/wireless/rt2x00/rt2x00usb.c b/drivers/net/wireless/rt2x00/rt2x00usb.c index 5a331674dcb..e5ceae805b5 100644 --- a/drivers/net/wireless/rt2x00/rt2x00usb.c +++ b/drivers/net/wireless/rt2x00/rt2x00usb.c @@ -362,6 +362,12 @@ void rt2x00usb_disable_radio(struct rt2x00_dev *rt2x00dev) } } + /* + * Kill guardian urb (if required by driver). + */ + if (!test_bit(DRIVER_REQUIRE_BEACON_GUARD, &rt2x00dev->flags)) + return; + for (i = 0; i < rt2x00dev->bcn->limit; i++) { priv_bcn = rt2x00dev->bcn->entries[i].priv_data; usb_kill_urb(priv_bcn->urb); -- cgit v1.2.3 From 051c256f672efa356a4cda1841132dbc86541090 Mon Sep 17 00:00:00 2001 From: Gertjan van Wingerde Date: Tue, 3 Jun 2008 20:29:47 +0200 Subject: rt2x00: Restrict DMA to 32-bit addresses. None of the rt2x00 PCI devices support 64-bit DMA addresses (they all only accept 32-bit buffer addresses). Hence it makes no sense to try to enable 64-bit DMA addresses. Only try to enable 32-bit DMA addresses. Signed-off-by: Gertjan van Wingerde Signed-off-by: Ivo van Doorn Signed-off-by: John W. Linville --- drivers/net/wireless/rt2x00/rt2x00pci.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers') diff --git a/drivers/net/wireless/rt2x00/rt2x00pci.c b/drivers/net/wireless/rt2x00/rt2x00pci.c index 971af2546b5..60893de3bf8 100644 --- a/drivers/net/wireless/rt2x00/rt2x00pci.c +++ b/drivers/net/wireless/rt2x00/rt2x00pci.c @@ -412,8 +412,7 @@ int rt2x00pci_probe(struct pci_dev *pci_dev, const struct pci_device_id *id) if (pci_set_mwi(pci_dev)) ERROR_PROBE("MWI not available.\n"); - if (pci_set_dma_mask(pci_dev, DMA_64BIT_MASK) && - pci_set_dma_mask(pci_dev, DMA_32BIT_MASK)) { + if (pci_set_dma_mask(pci_dev, DMA_32BIT_MASK)) { ERROR_PROBE("PCI DMA not supported.\n"); retval = -EIO; goto exit_disable_device; -- cgit v1.2.3 From 028118a5f09a9c807e6b43e2231efdff9f224c74 Mon Sep 17 00:00:00 2001 From: Michael Buesch Date: Thu, 12 Jun 2008 11:58:56 +0200 Subject: b43: Fix possible NULL pointer dereference in DMA code This fixes a possible NULL pointer dereference in an error path of the DMA allocation error checking code. This is also necessary for a future DMA API change that is on its way into the mainline kernel that adds an additional dev parameter to dma_mapping_error(). This patch moves the whole struct b43_dmaring struct initialization right before any DMA allocation operation. Reported-by: Miles Lane Signed-off-by: Michael Buesch Signed-off-by: John W. Linville --- drivers/net/wireless/b43/dma.c | 65 +++++++++++++++++++++--------------------- 1 file changed, 32 insertions(+), 33 deletions(-) (limited to 'drivers') diff --git a/drivers/net/wireless/b43/dma.c b/drivers/net/wireless/b43/dma.c index 6dcbb3c87e7..e23f2f172bd 100644 --- a/drivers/net/wireless/b43/dma.c +++ b/drivers/net/wireless/b43/dma.c @@ -795,24 +795,49 @@ struct b43_dmaring *b43_setup_dmaring(struct b43_wldev *dev, { struct b43_dmaring *ring; int err; - int nr_slots; dma_addr_t dma_test; ring = kzalloc(sizeof(*ring), GFP_KERNEL); if (!ring) goto out; - ring->type = type; - nr_slots = B43_RXRING_SLOTS; + ring->nr_slots = B43_RXRING_SLOTS; if (for_tx) - nr_slots = B43_TXRING_SLOTS; + ring->nr_slots = B43_TXRING_SLOTS; - ring->meta = kcalloc(nr_slots, sizeof(struct b43_dmadesc_meta), + ring->meta = kcalloc(ring->nr_slots, sizeof(struct b43_dmadesc_meta), GFP_KERNEL); if (!ring->meta) goto err_kfree_ring; + + ring->type = type; + ring->dev = dev; + ring->mmio_base = b43_dmacontroller_base(type, controller_index); + ring->index = controller_index; + if (type == B43_DMA_64BIT) + ring->ops = &dma64_ops; + else + ring->ops = &dma32_ops; if (for_tx) { - ring->txhdr_cache = kcalloc(nr_slots, + ring->tx = 1; + ring->current_slot = -1; + } else { + if (ring->index == 0) { + ring->rx_buffersize = B43_DMA0_RX_BUFFERSIZE; + ring->frameoffset = B43_DMA0_RX_FRAMEOFFSET; + } else if (ring->index == 3) { + ring->rx_buffersize = B43_DMA3_RX_BUFFERSIZE; + ring->frameoffset = B43_DMA3_RX_FRAMEOFFSET; + } else + B43_WARN_ON(1); + } + spin_lock_init(&ring->lock); +#ifdef CONFIG_B43_DEBUG + ring->last_injected_overflow = jiffies; +#endif + + if (for_tx) { + ring->txhdr_cache = kcalloc(ring->nr_slots, b43_txhdr_size(dev), GFP_KERNEL); if (!ring->txhdr_cache) @@ -828,7 +853,7 @@ struct b43_dmaring *b43_setup_dmaring(struct b43_wldev *dev, b43_txhdr_size(dev), 1)) { /* ugh realloc */ kfree(ring->txhdr_cache); - ring->txhdr_cache = kcalloc(nr_slots, + ring->txhdr_cache = kcalloc(ring->nr_slots, b43_txhdr_size(dev), GFP_KERNEL | GFP_DMA); if (!ring->txhdr_cache) @@ -853,32 +878,6 @@ struct b43_dmaring *b43_setup_dmaring(struct b43_wldev *dev, DMA_TO_DEVICE); } - ring->dev = dev; - ring->nr_slots = nr_slots; - ring->mmio_base = b43_dmacontroller_base(type, controller_index); - ring->index = controller_index; - if (type == B43_DMA_64BIT) - ring->ops = &dma64_ops; - else - ring->ops = &dma32_ops; - if (for_tx) { - ring->tx = 1; - ring->current_slot = -1; - } else { - if (ring->index == 0) { - ring->rx_buffersize = B43_DMA0_RX_BUFFERSIZE; - ring->frameoffset = B43_DMA0_RX_FRAMEOFFSET; - } else if (ring->index == 3) { - ring->rx_buffersize = B43_DMA3_RX_BUFFERSIZE; - ring->frameoffset = B43_DMA3_RX_FRAMEOFFSET; - } else - B43_WARN_ON(1); - } - spin_lock_init(&ring->lock); -#ifdef CONFIG_B43_DEBUG - ring->last_injected_overflow = jiffies; -#endif - err = alloc_ringmemory(ring); if (err) goto err_kfree_txhdr_cache; -- cgit v1.2.3 From 98a3b2fe435ae76170936c14f5c9e6a87548e3ef Mon Sep 17 00:00:00 2001 From: Michael Buesch Date: Thu, 12 Jun 2008 12:36:29 +0200 Subject: b43: Fix noise calculation WARN_ON This removes a WARN_ON that is responsible for the following koops: http://www.kerneloops.org/searchweek.php?search=b43_generate_noise_sample The comment in the patch describes why it's safe to simply remove the check. Signed-off-by: Michael Buesch Signed-off-by: John W. Linville --- drivers/net/wireless/b43/b43.h | 1 - drivers/net/wireless/b43/main.c | 16 ++++++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) (limited to 'drivers') diff --git a/drivers/net/wireless/b43/b43.h b/drivers/net/wireless/b43/b43.h index dfa4bdd5597..d3db298c05f 100644 --- a/drivers/net/wireless/b43/b43.h +++ b/drivers/net/wireless/b43/b43.h @@ -630,7 +630,6 @@ struct b43_pio { /* Context information for a noise calculation (Link Quality). */ struct b43_noise_calculation { - u8 channel_at_start; bool calculation_running; u8 nr_samples; s8 samples[8][4]; diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c index 6c3d9ea0a9f..fa4b0d8b74a 100644 --- a/drivers/net/wireless/b43/main.c +++ b/drivers/net/wireless/b43/main.c @@ -1145,7 +1145,6 @@ static void b43_generate_noise_sample(struct b43_wldev *dev) b43_jssi_write(dev, 0x7F7F7F7F); b43_write32(dev, B43_MMIO_MACCMD, b43_read32(dev, B43_MMIO_MACCMD) | B43_MACCMD_BGNOISE); - B43_WARN_ON(dev->noisecalc.channel_at_start != dev->phy.channel); } static void b43_calculate_link_quality(struct b43_wldev *dev) @@ -1154,7 +1153,6 @@ static void b43_calculate_link_quality(struct b43_wldev *dev) if (dev->noisecalc.calculation_running) return; - dev->noisecalc.channel_at_start = dev->phy.channel; dev->noisecalc.calculation_running = 1; dev->noisecalc.nr_samples = 0; @@ -1171,9 +1169,16 @@ static void handle_irq_noise(struct b43_wldev *dev) /* Bottom half of Link Quality calculation. */ + /* Possible race condition: It might be possible that the user + * changed to a different channel in the meantime since we + * started the calculation. We ignore that fact, since it's + * not really that much of a problem. The background noise is + * an estimation only anyway. Slightly wrong results will get damped + * by the averaging of the 8 sample rounds. Additionally the + * value is shortlived. So it will be replaced by the next noise + * calculation round soon. */ + B43_WARN_ON(!dev->noisecalc.calculation_running); - if (dev->noisecalc.channel_at_start != phy->channel) - goto drop_calculation; *((__le32 *)noise) = cpu_to_le32(b43_jssi_read(dev)); if (noise[0] == 0x7F || noise[1] == 0x7F || noise[2] == 0x7F || noise[3] == 0x7F) @@ -1214,11 +1219,10 @@ static void handle_irq_noise(struct b43_wldev *dev) average -= 48; dev->stats.link_noise = average; - drop_calculation: dev->noisecalc.calculation_running = 0; return; } - generate_new: +generate_new: b43_generate_noise_sample(dev); } -- cgit v1.2.3 From e76328e4a8260707fbc29c99773fb5ba4627096c Mon Sep 17 00:00:00 2001 From: Randy Dunlap Date: Wed, 11 Jun 2008 12:57:58 -0700 Subject: rt2x00: INPUT build failure Config symbols that select RFKILL need to depend on INPUT so that undefined symbols are not used in the build. This patch fixes the input_* symbols build errors. (.text+0x174cdc): undefined reference to `input_unregister_device' (.text+0x174d9f): undefined reference to `input_allocate_device' (.text+0x174e2d): undefined reference to `input_register_device' (.text+0x174e53): undefined reference to `input_free_device' rt2x00rfkill.c:(.text+0x176dc4): undefined reference to `input_allocate_polled_device' rt2x00rfkill.c:(.text+0x176e8b): undefined reference to `input_event' rt2x00rfkill.c:(.text+0x176e9f): undefined reference to `input_event' (.text+0x176eca): undefined reference to `input_unregister_polled_device' (.text+0x176efc): undefined reference to `input_free_polled_device' (.text+0x176f37): undefined reference to `input_free_polled_device' (.text+0x176fd8): undefined reference to `input_register_polled_device' (.text+0x1772c0): undefined reference to `led_classdev_resume' (.text+0x1772d4): undefined reference to `led_classdev_resume' (.text+0x1772e8): undefined reference to `led_classdev_resume' (.text+0x17730a): undefined reference to `led_classdev_suspend' (.text+0x17731e): undefined reference to `led_classdev_suspend' (.text+0x17732f): undefined reference to `led_classdev_suspend' rt2x00leds.c:(.text+0x177348): undefined reference to `led_classdev_unregister' rt2x00leds.c:(.text+0x1773c0): undefined reference to `led_classdev_register' rfkill-input.c:(.text+0x209e4c): undefined reference to `input_close_device' rfkill-input.c:(.text+0x209e53): undefined reference to `input_unregister_handle' rfkill-input.c:(.text+0x209ea1): undefined reference to `input_register_handle' rfkill-input.c:(.text+0x209eae): undefined reference to `input_open_device' rfkill-input.c:(.text+0x209ebb): undefined reference to `input_unregister_handle' rfkill-input.c:(.init.text+0x17405): undefined reference to `input_register_handler' rfkill-input.c:(.exit.text+0x194f): undefined reference to `input_unregister_handler' make[1]: *** [vmlinux] Error 1 Signed-off-by: Randy Dunlap Acked-by: Ivo van Doorn Signed-off-by: John W. Linville --- drivers/net/wireless/rt2x00/Kconfig | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'drivers') diff --git a/drivers/net/wireless/rt2x00/Kconfig b/drivers/net/wireless/rt2x00/Kconfig index ab1029e7988..23abef92699 100644 --- a/drivers/net/wireless/rt2x00/Kconfig +++ b/drivers/net/wireless/rt2x00/Kconfig @@ -32,6 +32,7 @@ config RT2X00_LIB_FIRMWARE config RT2X00_LIB_RFKILL boolean depends on RT2X00_LIB + depends on INPUT select RFKILL select INPUT_POLLDEV @@ -51,7 +52,7 @@ config RT2400PCI config RT2400PCI_RFKILL bool "RT2400 rfkill support" - depends on RT2400PCI + depends on RT2400PCI && INPUT select RT2X00_LIB_RFKILL ---help--- This adds support for integrated rt2400 devices that feature a @@ -78,7 +79,7 @@ config RT2500PCI config RT2500PCI_RFKILL bool "RT2500 rfkill support" - depends on RT2500PCI + depends on RT2500PCI && INPUT select RT2X00_LIB_RFKILL ---help--- This adds support for integrated rt2500 devices that feature a @@ -107,7 +108,7 @@ config RT61PCI config RT61PCI_RFKILL bool "RT61 rfkill support" - depends on RT61PCI + depends on RT61PCI && INPUT select RT2X00_LIB_RFKILL ---help--- This adds support for integrated rt61 devices that feature a -- cgit v1.2.3 From 6847aa5cce6e22c3625a243b02909ac46aafa110 Mon Sep 17 00:00:00 2001 From: Randy Dunlap Date: Wed, 11 Jun 2008 13:32:22 -0700 Subject: rt2x00: LEDS build failure Config symbols that select LEDS_CLASS need to depend on NEW_LEDS so that undefined symbols are not used in the build. The alternative is to select NEW_LEDS, which some drivers do. This patch fixes the led_* symbols build errors. (.text+0x174cdc): undefined reference to `input_unregister_device' (.text+0x174d9f): undefined reference to `input_allocate_device' (.text+0x174e2d): undefined reference to `input_register_device' (.text+0x174e53): undefined reference to `input_free_device' rt2x00rfkill.c:(.text+0x176dc4): undefined reference to `input_allocate_polled_device' rt2x00rfkill.c:(.text+0x176e8b): undefined reference to `input_event' rt2x00rfkill.c:(.text+0x176e9f): undefined reference to `input_event' (.text+0x176eca): undefined reference to `input_unregister_polled_device' (.text+0x176efc): undefined reference to `input_free_polled_device' (.text+0x176f37): undefined reference to `input_free_polled_device' (.text+0x176fd8): undefined reference to `input_register_polled_device' (.text+0x1772c0): undefined reference to `led_classdev_resume' (.text+0x1772d4): undefined reference to `led_classdev_resume' (.text+0x1772e8): undefined reference to `led_classdev_resume' (.text+0x17730a): undefined reference to `led_classdev_suspend' (.text+0x17731e): undefined reference to `led_classdev_suspend' (.text+0x17732f): undefined reference to `led_classdev_suspend' rt2x00leds.c:(.text+0x177348): undefined reference to `led_classdev_unregister' rt2x00leds.c:(.text+0x1773c0): undefined reference to `led_classdev_register' rfkill-input.c:(.text+0x209e4c): undefined reference to `input_close_device' rfkill-input.c:(.text+0x209e53): undefined reference to `input_unregister_handle' rfkill-input.c:(.text+0x209ea1): undefined reference to `input_register_handle' rfkill-input.c:(.text+0x209eae): undefined reference to `input_open_device' rfkill-input.c:(.text+0x209ebb): undefined reference to `input_unregister_handle' rfkill-input.c:(.init.text+0x17405): undefined reference to `input_register_handler' rfkill-input.c:(.exit.text+0x194f): undefined reference to `input_unregister_handler' make[1]: *** [vmlinux] Error 1 Signed-off-by: Randy Dunlap Acked-by: Ivo van Doorn Signed-off-by: John W. Linville --- drivers/net/wireless/rt2x00/Kconfig | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'drivers') diff --git a/drivers/net/wireless/rt2x00/Kconfig b/drivers/net/wireless/rt2x00/Kconfig index 23abef92699..2d611876bbe 100644 --- a/drivers/net/wireless/rt2x00/Kconfig +++ b/drivers/net/wireless/rt2x00/Kconfig @@ -38,7 +38,7 @@ config RT2X00_LIB_RFKILL config RT2X00_LIB_LEDS boolean - depends on RT2X00_LIB + depends on RT2X00_LIB && NEW_LEDS config RT2400PCI tristate "Ralink rt2400 pci/pcmcia support" @@ -61,7 +61,7 @@ config RT2400PCI_RFKILL config RT2400PCI_LEDS bool "RT2400 leds support" - depends on RT2400PCI + depends on RT2400PCI && NEW_LEDS select LEDS_CLASS select RT2X00_LIB_LEDS ---help--- @@ -88,7 +88,7 @@ config RT2500PCI_RFKILL config RT2500PCI_LEDS bool "RT2500 leds support" - depends on RT2500PCI + depends on RT2500PCI && NEW_LEDS select LEDS_CLASS select RT2X00_LIB_LEDS ---help--- @@ -117,7 +117,7 @@ config RT61PCI_RFKILL config RT61PCI_LEDS bool "RT61 leds support" - depends on RT61PCI + depends on RT61PCI && NEW_LEDS select LEDS_CLASS select RT2X00_LIB_LEDS ---help--- @@ -134,7 +134,7 @@ config RT2500USB config RT2500USB_LEDS bool "RT2500 leds support" - depends on RT2500USB + depends on RT2500USB && NEW_LEDS select LEDS_CLASS select RT2X00_LIB_LEDS ---help--- @@ -153,7 +153,7 @@ config RT73USB config RT73USB_LEDS bool "RT73 leds support" - depends on RT73USB + depends on RT73USB && NEW_LEDS select LEDS_CLASS select RT2X00_LIB_LEDS ---help--- -- cgit v1.2.3 From e6340361f9c70e84312caed98c6e058ac6234e9b Mon Sep 17 00:00:00 2001 From: Michael Buesch Date: Thu, 12 Jun 2008 15:33:13 +0200 Subject: ssb: Fix coherent DMA mask for PCI devices This fixes setting the coherent DMA mask for PCI devices. Signed-off-by: Michael Buesch Signed-off-by: John W. Linville --- drivers/ssb/main.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'drivers') diff --git a/drivers/ssb/main.c b/drivers/ssb/main.c index 7cf8851286b..d184f2aea78 100644 --- a/drivers/ssb/main.c +++ b/drivers/ssb/main.c @@ -1168,15 +1168,21 @@ EXPORT_SYMBOL(ssb_dma_translation); int ssb_dma_set_mask(struct ssb_device *ssb_dev, u64 mask) { struct device *dma_dev = ssb_dev->dma_dev; + int err = 0; #ifdef CONFIG_SSB_PCIHOST - if (ssb_dev->bus->bustype == SSB_BUSTYPE_PCI) - return dma_set_mask(dma_dev, mask); + if (ssb_dev->bus->bustype == SSB_BUSTYPE_PCI) { + err = pci_set_dma_mask(ssb_dev->bus->host_pci, mask); + if (err) + return err; + err = pci_set_consistent_dma_mask(ssb_dev->bus->host_pci, mask); + return err; + } #endif dma_dev->coherent_dma_mask = mask; dma_dev->dma_mask = &dma_dev->coherent_dma_mask; - return 0; + return err; } EXPORT_SYMBOL(ssb_dma_set_mask); -- cgit v1.2.3 From cb62eccd7d946f7fb92b8beb79988726ec92c227 Mon Sep 17 00:00:00 2001 From: Ivo van Doorn Date: Thu, 12 Jun 2008 20:47:17 +0200 Subject: rt2x00: Add D-link DWA111 support Add new rt73usb USB ID for D-Link DWA111 Signed-off-by: Ivo van Doorn Signed-off-by: John W. Linville --- drivers/net/wireless/rt2x00/rt73usb.c | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers') diff --git a/drivers/net/wireless/rt2x00/rt73usb.c b/drivers/net/wireless/rt2x00/rt73usb.c index da19a3a91f4..fff8386e816 100644 --- a/drivers/net/wireless/rt2x00/rt73usb.c +++ b/drivers/net/wireless/rt2x00/rt73usb.c @@ -2131,6 +2131,7 @@ static struct usb_device_id rt73usb_device_table[] = { /* D-Link */ { USB_DEVICE(0x07d1, 0x3c03), USB_DEVICE_DATA(&rt73usb_ops) }, { USB_DEVICE(0x07d1, 0x3c04), USB_DEVICE_DATA(&rt73usb_ops) }, + { USB_DEVICE(0x07d1, 0x3c06), USB_DEVICE_DATA(&rt73usb_ops) }, { USB_DEVICE(0x07d1, 0x3c07), USB_DEVICE_DATA(&rt73usb_ops) }, /* Gemtek */ { USB_DEVICE(0x15a9, 0x0004), USB_DEVICE_DATA(&rt73usb_ops) }, -- cgit v1.2.3 From c0ed0b60f2c36acfebb53384a3b24d13b3a09309 Mon Sep 17 00:00:00 2001 From: "Jorge Boncompte [DTI2]" Date: Mon, 16 Jun 2008 17:16:04 -0700 Subject: atm: [iphase] set drvdata before enabling interrupts Signed-off-by: Jorge Boncompte [DTI2] Signed-off-by: Chas Williams Signed-off-by: David S. Miller --- drivers/atm/iphase.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers') diff --git a/drivers/atm/iphase.c b/drivers/atm/iphase.c index 5c28ca7380f..800c09e128e 100644 --- a/drivers/atm/iphase.c +++ b/drivers/atm/iphase.c @@ -3198,6 +3198,8 @@ static int __devinit ia_init_one(struct pci_dev *pdev, IF_INIT(printk("dev_id = 0x%x iadev->LineRate = %d \n", (u32)dev, iadev->LineRate);) + pci_set_drvdata(pdev, dev); + ia_dev[iadev_count] = iadev; _ia_dev[iadev_count] = dev; iadev_count++; @@ -3219,8 +3221,6 @@ static int __devinit ia_init_one(struct pci_dev *pdev, iadev->next_board = ia_boards; ia_boards = dev; - pci_set_drvdata(pdev, dev); - return 0; err_out_deregister_dev: -- cgit v1.2.3 From d6c1d704ab5d2e13bebb096e415156a9c54a3d32 Mon Sep 17 00:00:00 2001 From: "Jorge Boncompte [DTI2]" Date: Mon, 16 Jun 2008 17:16:35 -0700 Subject: atm: [iphase] doesn't call phy->start due to a bogus #ifndef This causes the suni driver to oops if you try to use sonetdiag to get the statistics. Also add the corresponding phy->stop call to fix another oops if you try to remove the module. Signed-off-by: Jorge Boncompte [DTI2] Signed-off-by: Chas Williams Signed-off-by: David S. Miller --- drivers/atm/iphase.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) (limited to 'drivers') diff --git a/drivers/atm/iphase.c b/drivers/atm/iphase.c index 800c09e128e..139fce6968a 100644 --- a/drivers/atm/iphase.c +++ b/drivers/atm/iphase.c @@ -2562,17 +2562,11 @@ static int __devinit ia_start(struct atm_dev *dev) error = suni_init(dev); if (error) goto err_free_rx; - /* - * Enable interrupt on loss of signal - * SUNI_RSOP_CIE - 0x10 - * SUNI_RSOP_CIE_LOSE - 0x04 - */ - ia_phy_put(dev, ia_phy_get(dev, 0x10) | 0x04, 0x10); -#ifndef MODULE - error = dev->phy->start(dev); - if (error) - goto err_free_rx; -#endif + if (dev->phy->start) { + error = dev->phy->start(dev); + if (error) + goto err_free_rx; + } /* Get iadev->carrier_detect status */ IaFrontEndIntr(iadev); } @@ -3238,9 +3232,14 @@ static void __devexit ia_remove_one(struct pci_dev *pdev) struct atm_dev *dev = pci_get_drvdata(pdev); IADEV *iadev = INPH_IA_DEV(dev); - ia_phy_put(dev, ia_phy_get(dev,0x10) & ~(0x4), 0x10); + /* Disable phy interrupts */ + ia_phy_put(dev, ia_phy_get(dev, SUNI_RSOP_CIE) & ~(SUNI_RSOP_CIE_LOSE), + SUNI_RSOP_CIE); udelay(1); + if (dev->phy && dev->phy->stop) + dev->phy->stop(dev); + /* De-register device */ free_irq(iadev->irq, dev); iadev_count--; -- cgit v1.2.3 From 059e3779b59527150e1d1942026ec149192cbf77 Mon Sep 17 00:00:00 2001 From: Chas Williams Date: Mon, 16 Jun 2008 17:17:31 -0700 Subject: atm: [he] only support suni driver on multimode interfaces Signed-off-by: Chas Williams Signed-off-by: David S. Miller --- drivers/atm/he.c | 3 ++- drivers/atm/he.h | 13 ++++--------- 2 files changed, 6 insertions(+), 10 deletions(-) (limited to 'drivers') diff --git a/drivers/atm/he.c b/drivers/atm/he.c index ffc4a5a4194..320320e3dfb 100644 --- a/drivers/atm/he.c +++ b/drivers/atm/he.c @@ -1542,7 +1542,8 @@ he_start(struct atm_dev *dev) /* initialize framer */ #ifdef CONFIG_ATM_HE_USE_SUNI - suni_init(he_dev->atm_dev); + if (he_isMM(he_dev)) + suni_init(he_dev->atm_dev); if (he_dev->atm_dev->phy && he_dev->atm_dev->phy->start) he_dev->atm_dev->phy->start(he_dev->atm_dev); #endif /* CONFIG_ATM_HE_USE_SUNI */ diff --git a/drivers/atm/he.h b/drivers/atm/he.h index fe6cd15a78a..b87d6ccabac 100644 --- a/drivers/atm/he.h +++ b/drivers/atm/he.h @@ -267,13 +267,7 @@ struct he_dev { char prod_id[30]; char mac_addr[6]; - int media; /* - * 0x26 = HE155 MM - * 0x27 = HE622 MM - * 0x46 = HE155 SM - * 0x47 = HE622 SM - */ - + int media; unsigned int vcibits, vpibits; unsigned int cells_per_row; @@ -392,6 +386,7 @@ struct he_vcc #define HE_DEV(dev) ((struct he_dev *) (dev)->dev_data) #define he_is622(dev) ((dev)->media & 0x1) +#define he_isMM(dev) ((dev)->media & 0x20) #define HE_REGMAP_SIZE 0x100000 @@ -876,8 +871,8 @@ struct he_vcc #define M_SN 0x3a /* integer */ #define MEDIA 0x3e /* integer */ #define HE155MM 0x26 -#define HE155SM 0x27 -#define HE622MM 0x46 +#define HE622MM 0x27 +#define HE155SM 0x46 #define HE622SM 0x47 #define MAC_ADDR 0x42 /* char[] */ -- cgit v1.2.3 From 28e84ab3abafb0f9c9573993626abe6ca3fa8eb1 Mon Sep 17 00:00:00 2001 From: "Robert T. Johnson" Date: Mon, 16 Jun 2008 17:20:52 -0700 Subject: atm: [he] limit queries to the device's register space From: "Robert T. Johnson" Signed-off-by: Chas Williams --- drivers/atm/he.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/atm/he.c b/drivers/atm/he.c index 320320e3dfb..fc636a3429c 100644 --- a/drivers/atm/he.c +++ b/drivers/atm/he.c @@ -2845,10 +2845,15 @@ he_ioctl(struct atm_dev *atm_dev, unsigned int cmd, void __user *arg) if (copy_from_user(®, arg, sizeof(struct he_ioctl_reg))) return -EFAULT; - + spin_lock_irqsave(&he_dev->global_lock, flags); switch (reg.type) { case HE_REGTYPE_PCI: + if (reg.addr < 0 || reg.addr >= HE_REGMAP_SIZE) { + err = -EINVAL; + break; + } + reg.val = he_readl(he_dev, reg.addr); break; case HE_REGTYPE_RCM: -- cgit v1.2.3 From 65c3e4715b1b934f8dcc002d9f46b4371ca7a9b1 Mon Sep 17 00:00:00 2001 From: Chas Williams Date: Mon, 16 Jun 2008 17:21:27 -0700 Subject: atm: [he] send idle cells instead of unassigned when in SDH mode Signed-off-by: Chas Williams Signed-off-by: David S. Miller --- drivers/atm/he.c | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers') diff --git a/drivers/atm/he.c b/drivers/atm/he.c index fc636a3429c..ea495b21f91 100644 --- a/drivers/atm/he.c +++ b/drivers/atm/he.c @@ -1555,6 +1555,7 @@ he_start(struct atm_dev *dev) val = he_phy_get(he_dev->atm_dev, SUNI_TPOP_APM); val = (val & ~SUNI_TPOP_APM_S) | (SUNI_TPOP_S_SDH << SUNI_TPOP_APM_S_SHIFT); he_phy_put(he_dev->atm_dev, val, SUNI_TPOP_APM); + he_phy_put(he_dev->atm_dev, SUNI_TACP_IUCHP_CLP, SUNI_TACP_IUCHP); } /* 5.1.12 enable transmit and receive */ -- cgit v1.2.3