diff options
author | Ron Mercer <ron.mercer@qlogic.com> | 2009-10-05 07:46:49 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-10-06 20:33:37 -0400 |
commit | 86aaf9ad8276160312c09771c0f8e64646996e4c (patch) | |
tree | c1516a6658a9593f288c0f328d4de9a3485407db /drivers/net | |
parent | 5ee22a5aa9cd85527b93b24402db9ae2567d5aa6 (diff) |
qlge: Fix lock/mutex warnings.
Get rid of spinlock and private mutex usage for exclusive access to the
HW semaphore register. rtnl_lock already creates exclusive access to
this register in all driver API.
Add rtnl to firmware worker threads that also use the HW semaphore register.
Signed-off-by: Ron Mercer <ron.mercer@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/qlge/qlge.h | 2 | ||||
-rw-r--r-- | drivers/net/qlge/qlge_ethtool.c | 2 | ||||
-rw-r--r-- | drivers/net/qlge/qlge_main.c | 10 | ||||
-rw-r--r-- | drivers/net/qlge/qlge_mpi.c | 12 |
4 files changed, 9 insertions, 17 deletions
diff --git a/drivers/net/qlge/qlge.h b/drivers/net/qlge/qlge.h index f470fb9c4e02..3ec6e85587a2 100644 --- a/drivers/net/qlge/qlge.h +++ b/drivers/net/qlge/qlge.h | |||
@@ -9,6 +9,7 @@ | |||
9 | 9 | ||
10 | #include <linux/pci.h> | 10 | #include <linux/pci.h> |
11 | #include <linux/netdevice.h> | 11 | #include <linux/netdevice.h> |
12 | #include <linux/rtnetlink.h> | ||
12 | 13 | ||
13 | /* | 14 | /* |
14 | * General definitions... | 15 | * General definitions... |
@@ -1477,7 +1478,6 @@ struct ql_adapter { | |||
1477 | u32 mailbox_in; | 1478 | u32 mailbox_in; |
1478 | u32 mailbox_out; | 1479 | u32 mailbox_out; |
1479 | struct mbox_params idc_mbc; | 1480 | struct mbox_params idc_mbc; |
1480 | struct mutex mpi_mutex; | ||
1481 | 1481 | ||
1482 | int tx_ring_size; | 1482 | int tx_ring_size; |
1483 | int rx_ring_size; | 1483 | int rx_ring_size; |
diff --git a/drivers/net/qlge/qlge_ethtool.c b/drivers/net/qlge/qlge_ethtool.c index 68f9bd280f86..52073946bce3 100644 --- a/drivers/net/qlge/qlge_ethtool.c +++ b/drivers/net/qlge/qlge_ethtool.c | |||
@@ -45,7 +45,6 @@ static int ql_update_ring_coalescing(struct ql_adapter *qdev) | |||
45 | if (!netif_running(qdev->ndev)) | 45 | if (!netif_running(qdev->ndev)) |
46 | return status; | 46 | return status; |
47 | 47 | ||
48 | spin_lock(&qdev->hw_lock); | ||
49 | /* Skip the default queue, and update the outbound handler | 48 | /* Skip the default queue, and update the outbound handler |
50 | * queues if they changed. | 49 | * queues if they changed. |
51 | */ | 50 | */ |
@@ -92,7 +91,6 @@ static int ql_update_ring_coalescing(struct ql_adapter *qdev) | |||
92 | } | 91 | } |
93 | } | 92 | } |
94 | exit: | 93 | exit: |
95 | spin_unlock(&qdev->hw_lock); | ||
96 | return status; | 94 | return status; |
97 | } | 95 | } |
98 | 96 | ||
diff --git a/drivers/net/qlge/qlge_main.c b/drivers/net/qlge/qlge_main.c index c21eda03fa5a..61680715cde0 100644 --- a/drivers/net/qlge/qlge_main.c +++ b/drivers/net/qlge/qlge_main.c | |||
@@ -34,7 +34,6 @@ | |||
34 | #include <linux/etherdevice.h> | 34 | #include <linux/etherdevice.h> |
35 | #include <linux/ethtool.h> | 35 | #include <linux/ethtool.h> |
36 | #include <linux/skbuff.h> | 36 | #include <linux/skbuff.h> |
37 | #include <linux/rtnetlink.h> | ||
38 | #include <linux/if_vlan.h> | 37 | #include <linux/if_vlan.h> |
39 | #include <linux/delay.h> | 38 | #include <linux/delay.h> |
40 | #include <linux/mm.h> | 39 | #include <linux/mm.h> |
@@ -1926,12 +1925,10 @@ static void ql_vlan_rx_add_vid(struct net_device *ndev, u16 vid) | |||
1926 | status = ql_sem_spinlock(qdev, SEM_MAC_ADDR_MASK); | 1925 | status = ql_sem_spinlock(qdev, SEM_MAC_ADDR_MASK); |
1927 | if (status) | 1926 | if (status) |
1928 | return; | 1927 | return; |
1929 | spin_lock(&qdev->hw_lock); | ||
1930 | if (ql_set_mac_addr_reg | 1928 | if (ql_set_mac_addr_reg |
1931 | (qdev, (u8 *) &enable_bit, MAC_ADDR_TYPE_VLAN, vid)) { | 1929 | (qdev, (u8 *) &enable_bit, MAC_ADDR_TYPE_VLAN, vid)) { |
1932 | QPRINTK(qdev, IFUP, ERR, "Failed to init vlan address.\n"); | 1930 | QPRINTK(qdev, IFUP, ERR, "Failed to init vlan address.\n"); |
1933 | } | 1931 | } |
1934 | spin_unlock(&qdev->hw_lock); | ||
1935 | ql_sem_unlock(qdev, SEM_MAC_ADDR_MASK); | 1932 | ql_sem_unlock(qdev, SEM_MAC_ADDR_MASK); |
1936 | } | 1933 | } |
1937 | 1934 | ||
@@ -1945,12 +1942,10 @@ static void ql_vlan_rx_kill_vid(struct net_device *ndev, u16 vid) | |||
1945 | if (status) | 1942 | if (status) |
1946 | return; | 1943 | return; |
1947 | 1944 | ||
1948 | spin_lock(&qdev->hw_lock); | ||
1949 | if (ql_set_mac_addr_reg | 1945 | if (ql_set_mac_addr_reg |
1950 | (qdev, (u8 *) &enable_bit, MAC_ADDR_TYPE_VLAN, vid)) { | 1946 | (qdev, (u8 *) &enable_bit, MAC_ADDR_TYPE_VLAN, vid)) { |
1951 | QPRINTK(qdev, IFUP, ERR, "Failed to clear vlan address.\n"); | 1947 | QPRINTK(qdev, IFUP, ERR, "Failed to clear vlan address.\n"); |
1952 | } | 1948 | } |
1953 | spin_unlock(&qdev->hw_lock); | ||
1954 | ql_sem_unlock(qdev, SEM_MAC_ADDR_MASK); | 1949 | ql_sem_unlock(qdev, SEM_MAC_ADDR_MASK); |
1955 | 1950 | ||
1956 | } | 1951 | } |
@@ -3587,7 +3582,6 @@ static void qlge_set_multicast_list(struct net_device *ndev) | |||
3587 | status = ql_sem_spinlock(qdev, SEM_RT_IDX_MASK); | 3582 | status = ql_sem_spinlock(qdev, SEM_RT_IDX_MASK); |
3588 | if (status) | 3583 | if (status) |
3589 | return; | 3584 | return; |
3590 | spin_lock(&qdev->hw_lock); | ||
3591 | /* | 3585 | /* |
3592 | * Set or clear promiscuous mode if a | 3586 | * Set or clear promiscuous mode if a |
3593 | * transition is taking place. | 3587 | * transition is taking place. |
@@ -3664,7 +3658,6 @@ static void qlge_set_multicast_list(struct net_device *ndev) | |||
3664 | } | 3658 | } |
3665 | } | 3659 | } |
3666 | exit: | 3660 | exit: |
3667 | spin_unlock(&qdev->hw_lock); | ||
3668 | ql_sem_unlock(qdev, SEM_RT_IDX_MASK); | 3661 | ql_sem_unlock(qdev, SEM_RT_IDX_MASK); |
3669 | } | 3662 | } |
3670 | 3663 | ||
@@ -3684,10 +3677,8 @@ static int qlge_set_mac_address(struct net_device *ndev, void *p) | |||
3684 | status = ql_sem_spinlock(qdev, SEM_MAC_ADDR_MASK); | 3677 | status = ql_sem_spinlock(qdev, SEM_MAC_ADDR_MASK); |
3685 | if (status) | 3678 | if (status) |
3686 | return status; | 3679 | return status; |
3687 | spin_lock(&qdev->hw_lock); | ||
3688 | status = ql_set_mac_addr_reg(qdev, (u8 *) ndev->dev_addr, | 3680 | status = ql_set_mac_addr_reg(qdev, (u8 *) ndev->dev_addr, |
3689 | MAC_ADDR_TYPE_CAM_MAC, qdev->func * MAX_CQ); | 3681 | MAC_ADDR_TYPE_CAM_MAC, qdev->func * MAX_CQ); |
3690 | spin_unlock(&qdev->hw_lock); | ||
3691 | if (status) | 3682 | if (status) |
3692 | QPRINTK(qdev, HW, ERR, "Failed to load MAC address.\n"); | 3683 | QPRINTK(qdev, HW, ERR, "Failed to load MAC address.\n"); |
3693 | ql_sem_unlock(qdev, SEM_MAC_ADDR_MASK); | 3684 | ql_sem_unlock(qdev, SEM_MAC_ADDR_MASK); |
@@ -3930,7 +3921,6 @@ static int __devinit ql_init_device(struct pci_dev *pdev, | |||
3930 | INIT_DELAYED_WORK(&qdev->mpi_work, ql_mpi_work); | 3921 | INIT_DELAYED_WORK(&qdev->mpi_work, ql_mpi_work); |
3931 | INIT_DELAYED_WORK(&qdev->mpi_port_cfg_work, ql_mpi_port_cfg_work); | 3922 | INIT_DELAYED_WORK(&qdev->mpi_port_cfg_work, ql_mpi_port_cfg_work); |
3932 | INIT_DELAYED_WORK(&qdev->mpi_idc_work, ql_mpi_idc_work); | 3923 | INIT_DELAYED_WORK(&qdev->mpi_idc_work, ql_mpi_idc_work); |
3933 | mutex_init(&qdev->mpi_mutex); | ||
3934 | init_completion(&qdev->ide_completion); | 3924 | init_completion(&qdev->ide_completion); |
3935 | 3925 | ||
3936 | if (!cards_found) { | 3926 | if (!cards_found) { |
diff --git a/drivers/net/qlge/qlge_mpi.c b/drivers/net/qlge/qlge_mpi.c index 6685bd97da91..c2e43073047e 100644 --- a/drivers/net/qlge/qlge_mpi.c +++ b/drivers/net/qlge/qlge_mpi.c | |||
@@ -472,7 +472,6 @@ static int ql_mailbox_command(struct ql_adapter *qdev, struct mbox_params *mbcp) | |||
472 | { | 472 | { |
473 | int status, count; | 473 | int status, count; |
474 | 474 | ||
475 | mutex_lock(&qdev->mpi_mutex); | ||
476 | 475 | ||
477 | /* Begin polled mode for MPI */ | 476 | /* Begin polled mode for MPI */ |
478 | ql_write32(qdev, INTR_MASK, (INTR_MASK_PI << 16)); | 477 | ql_write32(qdev, INTR_MASK, (INTR_MASK_PI << 16)); |
@@ -541,7 +540,6 @@ static int ql_mailbox_command(struct ql_adapter *qdev, struct mbox_params *mbcp) | |||
541 | status = -EIO; | 540 | status = -EIO; |
542 | } | 541 | } |
543 | end: | 542 | end: |
544 | mutex_unlock(&qdev->mpi_mutex); | ||
545 | /* End polled mode for MPI */ | 543 | /* End polled mode for MPI */ |
546 | ql_write32(qdev, INTR_MASK, (INTR_MASK_PI << 16) | INTR_MASK_PI); | 544 | ql_write32(qdev, INTR_MASK, (INTR_MASK_PI << 16) | INTR_MASK_PI); |
547 | return status; | 545 | return status; |
@@ -776,7 +774,9 @@ static int ql_idc_wait(struct ql_adapter *qdev) | |||
776 | static int ql_set_port_cfg(struct ql_adapter *qdev) | 774 | static int ql_set_port_cfg(struct ql_adapter *qdev) |
777 | { | 775 | { |
778 | int status; | 776 | int status; |
777 | rtnl_lock(); | ||
779 | status = ql_mb_set_port_cfg(qdev); | 778 | status = ql_mb_set_port_cfg(qdev); |
779 | rtnl_unlock(); | ||
780 | if (status) | 780 | if (status) |
781 | return status; | 781 | return status; |
782 | status = ql_idc_wait(qdev); | 782 | status = ql_idc_wait(qdev); |
@@ -797,7 +797,9 @@ void ql_mpi_port_cfg_work(struct work_struct *work) | |||
797 | container_of(work, struct ql_adapter, mpi_port_cfg_work.work); | 797 | container_of(work, struct ql_adapter, mpi_port_cfg_work.work); |
798 | int status; | 798 | int status; |
799 | 799 | ||
800 | rtnl_lock(); | ||
800 | status = ql_mb_get_port_cfg(qdev); | 801 | status = ql_mb_get_port_cfg(qdev); |
802 | rtnl_unlock(); | ||
801 | if (status) { | 803 | if (status) { |
802 | QPRINTK(qdev, DRV, ERR, | 804 | QPRINTK(qdev, DRV, ERR, |
803 | "Bug: Failed to get port config data.\n"); | 805 | "Bug: Failed to get port config data.\n"); |
@@ -855,7 +857,9 @@ void ql_mpi_idc_work(struct work_struct *work) | |||
855 | * needs to be set. | 857 | * needs to be set. |
856 | * */ | 858 | * */ |
857 | set_bit(QL_CAM_RT_SET, &qdev->flags); | 859 | set_bit(QL_CAM_RT_SET, &qdev->flags); |
860 | rtnl_lock(); | ||
858 | status = ql_mb_idc_ack(qdev); | 861 | status = ql_mb_idc_ack(qdev); |
862 | rtnl_unlock(); | ||
859 | if (status) { | 863 | if (status) { |
860 | QPRINTK(qdev, DRV, ERR, | 864 | QPRINTK(qdev, DRV, ERR, |
861 | "Bug: No pending IDC!\n"); | 865 | "Bug: No pending IDC!\n"); |
@@ -871,7 +875,7 @@ void ql_mpi_work(struct work_struct *work) | |||
871 | struct mbox_params *mbcp = &mbc; | 875 | struct mbox_params *mbcp = &mbc; |
872 | int err = 0; | 876 | int err = 0; |
873 | 877 | ||
874 | mutex_lock(&qdev->mpi_mutex); | 878 | rtnl_lock(); |
875 | 879 | ||
876 | while (ql_read32(qdev, STS) & STS_PI) { | 880 | while (ql_read32(qdev, STS) & STS_PI) { |
877 | memset(mbcp, 0, sizeof(struct mbox_params)); | 881 | memset(mbcp, 0, sizeof(struct mbox_params)); |
@@ -884,7 +888,7 @@ void ql_mpi_work(struct work_struct *work) | |||
884 | break; | 888 | break; |
885 | } | 889 | } |
886 | 890 | ||
887 | mutex_unlock(&qdev->mpi_mutex); | 891 | rtnl_unlock(); |
888 | ql_enable_completion_interrupt(qdev, 0); | 892 | ql_enable_completion_interrupt(qdev, 0); |
889 | } | 893 | } |
890 | 894 | ||