mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Binoy Jayan <binoy.jayan@linaro.org>
To: Binoy Jayan <binoy.jayan@linaro.org>
Cc: linux-kernel@vger.kernel.org, Arnd Bergmann <arnd@arndb.de>,
	Rajendra <rnayak@codeaurora.org>, Mark Brown <broonie@kernel.org>,
	"David S. Miller" <davem@davemloft.net>,
	Jarod Wilson <jarod@redhat.com>,
	Masahiro Yamada <yamada.masahiro@socionext.com>
Subject: [PATCH] net: ethernet: micrel: ksz884x: Replace semaphore proc_sem with mutex
Date: Thu,  8 Jun 2017 15:33:47 +0530	[thread overview]
Message-ID: <1496916227-4509-1-git-send-email-binoy.jayan@linaro.org> (raw)

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 <binoy.jayan@linaro.org>
---

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(-)

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;
-- 
Binoy Jayan

             reply	other threads:[~2017-06-08 10:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-08 10:03 Binoy Jayan [this message]
2017-06-08 14:59 ` Arnd Bergmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1496916227-4509-1-git-send-email-binoy.jayan@linaro.org \
    --to=binoy.jayan@linaro.org \
    --cc=arnd@arndb.de \
    --cc=broonie@kernel.org \
    --cc=davem@davemloft.net \
    --cc=jarod@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rnayak@codeaurora.org \
    --cc=yamada.masahiro@socionext.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®