Hello,

The pcmcia_request_window() is postponed a little, as some flags must be
set before this call (I believe). It is a small change, but with some
noise in the patch.
Same with softing_card_irq()

The netif_start_queue() is omitted, as softing_cycle() does a
netif_wake_queue()

I ran a recent net-next-2.6 kernel, with config:
CONFIG_DEBUG_RT_MUTEXES=y
CONFIG_DEBUG_PI_LIST=y
# CONFIG_RT_MUTEX_TESTER is not set
CONFIG_DEBUG_SPINLOCK=y
CONFIG_DEBUG_MUTEXES=y
CONFIG_DEBUG_LOCK_ALLOC=y
CONFIG_PROVE_LOCKING=y
CONFIG_LOCKDEP=y
# CONFIG_LOCK_STAT is not set
CONFIG_DEBUG_LOCKDEP=y
CONFIG_TRACE_IRQFLAGS=y
CONFIG_DEBUG_SPINLOCK_SLEEP=y
# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
CONFIG_STACKTRACE=y

I did not encounter locking problems (related to networking or pcmcia, I
have an issue with cpufreq :-) )

Signed-off-by: Kurt Van Dijck <[email protected]>
---
Index: drivers/net/can/softing/softing_cs.c
===================================================================
--- drivers/net/can/softing/softing_cs.c        (revision 1144)
+++ drivers/net/can/softing/softing_cs.c        (working copy)
@@ -356,21 +356,26 @@
                csdev->win.Base = mem->win[0].host_addr;
                csdev->win.Size = mem->win[0].len;
                csdev->win.AccessSpeed = 0;
-               ret = pcmcia_request_window(&pdev, &csdev->win, &pdev->win);
-               if (ret) {
-                       dev_alert(&pdev->dev,
-                               "pcmcia_request_window() mismatch\n");
-                       goto do_next;
-               }
                /* softing specific: choose slower access for old cards */
                if (sdev->desc->generation < 2) {
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 33)
                        pdev->win->ctl.flags
                                = MAP_ACTIVE | MAP_USE_WAIT;
                        pdev->win->ctl.speed = 3;
+#else
+                       csdev->win.Attributes |= WIN_USE_WAIT;
+                       csdev->win.AccessSpeed = 3;
+#endif
                }
+               ret = pcmcia_request_window(pdev, &csdev->win, &pdev->win);
+               if (ret) {
+                       dev_alert(&pdev->dev,
+                               "pcmcia_request_window() mismatch\n");
+                       goto do_next;
+               }
                map.Page = 0;
                map.CardOffset = mem->win[0].card_addr;
-               if (pcmcia_map_mem_page(pdev->win, &map)) {
+               if (pcmcia_map_mem_page(pdev, pdev->win, &map)) {
                        dev_alert(&pdev->dev,
                                "pcmcia_map_mem_page() mismatch\n");
                        goto do_next_win;
@@ -435,7 +440,9 @@
        card->nbus = 2;
        /* pcmcia presets */
        pcmcia->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 33)
        pcmcia->irq.IRQInfo1 = IRQ_LEVEL_ID;
+#endif
        pcmcia->irq.Handler     = 0;
        pcmcia->conf.Attributes = 0;
        pcmcia->conf.IntType = INT_MEMORY_AND_IO;
Index: drivers/net/can/softing/softing_fw.c
===================================================================
--- drivers/net/can/softing/softing_fw.c        (revision 1144)
+++ drivers/net/can/softing/softing_fw.c        (working copy)
@@ -597,13 +597,6 @@
 
        softing_initialize_timestamp(card);
 
-       /*run once */
-       /*the bottom halve will start flushing the tx-queue too */
-       /*tasklet_schedule(&card->irq.bh);*/
-       ret = softing_card_irq(card, 1);
-       if (ret)
-               goto failed;
-
        /*
         * do socketcan notifications/status changes
         * from here, no errors should occur, or the failed: part
@@ -627,6 +620,11 @@
                }
                netif_wake_queue(pbus->netdev);
        }
+
+       /* enable interrupts */
+       ret = softing_card_irq(card, 1);
+       if (ret)
+               goto failed;
 card_done:
        mutex_unlock(&card->fw.lock);
        return 0;
Index: drivers/net/can/softing/softing_main.c
===================================================================
--- drivers/net/can/softing/softing_main.c      (revision 1144)
+++ drivers/net/can/softing/softing_main.c      (working copy)
@@ -427,7 +427,6 @@
        ret = softing_cycle(card, priv, 1);
        if (ret)
                goto failed;
-       netif_start_queue(ndev);
        return 0;
 failed:
        return ret;
@@ -478,12 +477,11 @@
        }
        if (!card->irq.requested && (card->irq.nr)) {
                irqreturn_t(*fn) (int, void *);
-               unsigned int flags;
-               flags = IRQF_DISABLED | IRQF_SHARED;/*| IRQF_TRIGGER_LOW; */
                fn = dev_interrupt_nshared;
                if (card->desc->generation >= 2)
                        fn = dev_interrupt_shared;
-               ret = request_irq(card->irq.nr, fn, flags, card->id.name, card);
+               ret = request_irq(card->irq.nr, fn, IRQF_SHARED,
+                               card->id.name, card);
                if (ret) {
                        dev_alert(card->dev, "%s, request_irq(%u) failed\n",
                                card->id.name, card->irq.nr);
_______________________________________________
Socketcan-core mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/socketcan-core

Reply via email to