From: Meng Li <meng...@windriver.com> In original code, the static spinlock variable is only used to implement sync strategy. So, it is not necessary to protect code with atomic environment, mutex is enough. In this way, it can avoid causing issue if some code in the protected range may enter sleeping status.
Signed-off-by: Meng Li <meng...@windriver.com> --- drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth_common.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth_common.c b/drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth_common.c index 5bb6964bc562..c895a12de9c0 100644 --- a/drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth_common.c +++ b/drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth_common.c @@ -968,18 +968,18 @@ int dpa_fq_probe_mac(struct device *dev, struct list_head *list, EXPORT_SYMBOL(dpa_fq_probe_mac); static u32 rx_pool_channel; -static DEFINE_SPINLOCK(rx_pool_channel_init); +static DEFINE_MUTEX(rx_pool_channel_init); int dpa_get_channel(void) { - spin_lock(&rx_pool_channel_init); + mutex_lock(&rx_pool_channel_init); if (!rx_pool_channel) { u32 pool; int ret = qman_alloc_pool(&pool); if (!ret) rx_pool_channel = pool; } - spin_unlock(&rx_pool_channel_init); + mutex_unlock(&rx_pool_channel_init); if (!rx_pool_channel) return -ENOMEM; return rx_pool_channel; -- 2.17.1
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#10505): https://lists.yoctoproject.org/g/linux-yocto/message/10505 Mute This Topic: https://lists.yoctoproject.org/mt/85967381/21656 Group Owner: linux-yocto+ow...@lists.yoctoproject.org Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-