From patchwork Thu Jun 8 10:03:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Binoy Jayan X-Patchwork-Id: 103367 Delivered-To: patch@linaro.org Received: by 10.140.91.77 with SMTP id y71csp2359799qgd; Thu, 8 Jun 2017 03:04:11 -0700 (PDT) X-Received: by 10.98.101.6 with SMTP id z6mr36178260pfb.221.1496916251501; Thu, 08 Jun 2017 03:04:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1496916251; cv=none; d=google.com; s=arc-20160816; b=ikk86fn0G6aEGJEspgb2VTVF7UhMeoOMMvpS5D81Bfc56IMeUZRLJLqek0VDTBw1mg 0ud/Z7K39EMQf+IMdI2PXquqw1scmoTOcVYXabaBMvIQgLeTSudJy01AUznkAQJfumut /LUAeRztP9qneB+DUyfAzOV7OkUGkk88HRG056OshSW5UeW1FziGCNxwKnCt42sZWayq Laz64IFfUfzpR30eX0Et8WH1MoL4g7OLtiUfKhrEFsFn/2Igk0poMGS0ODLHozOFLOho ks14WDUK6V8OxflBdCjvY8WfsL9gcT7KjtHn9uANUikpdp0kf2HfwG7Qfkqgt86NN0dF DRpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=RAndwr8SYhv72IkMBElVlp9MxDFr1LFKXR6OX049cFg=; b=j452uriaB1msnTfThI8SnS45Sgn9H90xpUugKbfrlfrCXJPnp47njgueLJ7SSgMw4x aK2JHiZYpufnQ11vyLNKcLp8ZNCMXQtYpDL7bg/h89iQ0emHuMEiuAhKo9n4jLJUtDk4 K/zjhyGaDFTxUOj9tBpc0V6gEmWRYF6gvgKjIP+MEtk+r4tWToD4l7+fBtB51s2RlMkm DRJQNMglnNNndpO41qWvA/DZyaxbyPvf8z1X2bW/9w19bkapFVPaBX9sBwyXhWj//iea TSmRuurawqUVisE59jzeTszfMlMEmop8KivEuF6HkegrB+s/0Op7wuJFVZQa1DV376zf 5yWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f32si4021897plf.393.2017.06.08.03.04.11; Thu, 08 Jun 2017 03:04:11 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751643AbdFHKED (ORCPT + 25 others); Thu, 8 Jun 2017 06:04:03 -0400 Received: from mail-pg0-f48.google.com ([74.125.83.48]:35387 "EHLO mail-pg0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750937AbdFHKEC (ORCPT ); Thu, 8 Jun 2017 06:04:02 -0400 Received: by mail-pg0-f48.google.com with SMTP id k71so14569803pgd.2 for ; Thu, 08 Jun 2017 03:04:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=RAndwr8SYhv72IkMBElVlp9MxDFr1LFKXR6OX049cFg=; b=hNHijOVCo7cRf8s6Y/0FD7/yO6bCHXUqMU90vLxKEBSG02He8isWHfA0fjtHhoFspK oAI38Ri9qJnd9qHiT9SbTUgx6jzT73X1Yenmf4aGHxLZVtEQegZ0bt8KWq0JcmU7zhlW Nq+hDvCsmja21iMSrJhmHaLLioVqtdmeXQ78g= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=RAndwr8SYhv72IkMBElVlp9MxDFr1LFKXR6OX049cFg=; b=EzwAAZQhfiJHouNaTbIvOLusM1xtlHjmEzywMo7IqgX3CgmJ05IFLqFhMbwZhgJ7ei 48v5qfit3go0ynjLARzRfjt6DoP9UWPdJqO+Hb0BdIalQWfq3mf+UV57yO361USCZmeW zM4rT7zy30jre8COziEpyXuWyWb3Gv+qYmJOHPdUTXYvCy2CI5QFhecNTBJDn/PPyFjT zo+EF6RxmKSmy5ftXgPgSG09TTUyY8Kr1Ls+PM3GoXAGGRNen/e7/srXVtLmxPdqcoq8 lajyVMKe8T8K3M6nmRkrjF3hd3g+/xwdTvOPEx2LXUqi/6UhoMduzjzEWLIG3qnlJfU8 3uMA== X-Gm-Message-State: AODbwcCcrvxB1HMVWFRbeSi7UWPPZGaS37dqe4hZbpEIsw8RPN9uKsgv LSb0I0kc3+OUCVRz08wtBQ== X-Received: by 10.84.169.3 with SMTP id g3mr33509393plb.37.1496916241698; Thu, 08 Jun 2017 03:04:01 -0700 (PDT) Received: from blr-ubuntu-59.ap.qualcomm.com (blr-bdr-fw-01_globalnat_allzones-outside.qualcomm.com. [103.229.18.19]) by smtp.gmail.com with ESMTPSA id y66sm4786844pfa.54.2017.06.08.03.03.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 08 Jun 2017 03:04:01 -0700 (PDT) From: Binoy Jayan To: Binoy Jayan Cc: linux-kernel@vger.kernel.org, Arnd Bergmann , Rajendra , Mark Brown , "David S. Miller" , Jarod Wilson , Masahiro Yamada Subject: [PATCH] net: ethernet: micrel: ksz884x: Replace semaphore proc_sem with mutex Date: Thu, 8 Jun 2017 15:33:47 +0530 Message-Id: <1496916227-4509-1-git-send-email-binoy.jayan@linaro.org> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The semaphore 'proc_sem' is used as a simple mutex, so it should be written as one. Semaphores are going away in the future. Signed-off-by: Binoy Jayan --- This patch is part of a bigger effort to eliminate unwanted semaphores from the linux kernel. drivers/net/ethernet/micrel/ksz884x.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) -- Binoy Jayan Reviewed-by: Arnd Bergmann diff --git a/drivers/net/ethernet/micrel/ksz884x.c b/drivers/net/ethernet/micrel/ksz884x.c index ee1c78a..9664666 100644 --- a/drivers/net/ethernet/micrel/ksz884x.c +++ b/drivers/net/ethernet/micrel/ksz884x.c @@ -1456,7 +1456,7 @@ struct dev_info { * @adapter: Adapter device information. * @port: Port information. * @monitor_time_info: Timer to monitor ports. - * @proc_sem: Semaphore for proc accessing. + * @proc_mutex: Mutex for proc accessing. * @id: Device ID. * @mii_if: MII interface information. * @advertising: Temporary variable to store advertised settings. @@ -1470,7 +1470,7 @@ struct dev_priv { struct ksz_port port; struct ksz_timer_info monitor_timer_info; - struct semaphore proc_sem; + struct mutex proc_mutex; int id; struct mii_if_info mii_if; @@ -5842,7 +5842,7 @@ static int netdev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) int result = 0; struct mii_ioctl_data *data = if_mii(ifr); - if (down_interruptible(&priv->proc_sem)) + if (mutex_lock_interruptible(&priv->proc_mutex)) return -ERESTARTSYS; switch (cmd) { @@ -5876,7 +5876,7 @@ static int netdev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) result = -EOPNOTSUPP; } - up(&priv->proc_sem); + mutex_unlock(&priv->proc_mutex); return result; } @@ -6805,7 +6805,7 @@ static int __init netdev_init(struct net_device *dev) dev->features |= dev->hw_features; - sema_init(&priv->proc_sem, 1); + mutex_init(&priv->proc_mutex); priv->mii_if.phy_id_mask = 0x1; priv->mii_if.reg_num_mask = 0x7;