mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "João Paulo Rechi Vita" <jprvita@gmail.com>
To: johannes@sipsolutions.net
Cc: marcel@holtmann.org, linux-wireless@vger.kernel.org,
	davem@davemloft.net, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, jprvita@endlessm.com,
	linux@endlessm.com
Subject: [PATCH 6/8] rfkill: Move user_state_from_blocked() close to its user
Date: Tue, 19 Jan 2016 10:42:41 -0500	[thread overview]
Message-ID: <1453218163-31998-7-git-send-email-jprvita@endlessm.com> (raw)
In-Reply-To: <1453218163-31998-1-git-send-email-jprvita@endlessm.com>

With the removal of the state attribute there is only one user of
user_state_from_blocked() left. Moving this function close to its only
user makes the code more organized and easier to read.

Signed-off-by: João Paulo Rechi Vita <jprvita@endlessm.com>
---
 net/rfkill/core.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/net/rfkill/core.c b/net/rfkill/core.c
index 26da4f0..0b9d5bf 100644
--- a/net/rfkill/core.c
+++ b/net/rfkill/core.c
@@ -673,16 +673,6 @@ static ssize_t soft_store(struct device *dev, struct device_attribute *attr,
 }
 static DEVICE_ATTR_RW(soft);
 
-static u8 user_state_from_blocked(unsigned long state)
-{
-	if (state & RFKILL_BLOCK_HW)
-		return RFKILL_USER_STATE_HARD_BLOCKED;
-	if (state & RFKILL_BLOCK_SW)
-		return RFKILL_USER_STATE_SOFT_BLOCKED;
-
-	return RFKILL_USER_STATE_UNBLOCKED;
-}
-
 static struct attribute *rfkill_dev_attrs[] = {
 	&dev_attr_name.attr,
 	&dev_attr_type.attr,
@@ -701,6 +691,16 @@ static void rfkill_release(struct device *dev)
 	kfree(rfkill);
 }
 
+static u8 user_state_from_blocked(unsigned long state)
+{
+	if (state & RFKILL_BLOCK_HW)
+		return RFKILL_USER_STATE_HARD_BLOCKED;
+	if (state & RFKILL_BLOCK_SW)
+		return RFKILL_USER_STATE_SOFT_BLOCKED;
+
+	return RFKILL_USER_STATE_UNBLOCKED;
+}
+
 static int rfkill_dev_uevent(struct device *dev, struct kobj_uevent_env *env)
 {
 	struct rfkill *rfkill = to_rfkill(dev);
-- 
2.5.0

  parent reply	other threads:[~2016-01-19 15:45 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-19 15:42 [PATCH 0/8] General RFKill improvements João Paulo Rechi Vita
2016-01-19 15:42 ` [PATCH 1/8] rfkill: Documentation and style fixes João Paulo Rechi Vita
2016-01-19 20:11   ` Johannes Berg
2016-01-19 20:19     ` João Paulo Rechi Vita
2016-01-19 15:42 ` [PATCH 2/8] rfkill: Improve code readability João Paulo Rechi Vita
2016-01-19 15:42 ` [PATCH 3/8] " João Paulo Rechi Vita
2016-01-19 15:42 ` [PATCH 4/8] rfkill: Remove obsolete "claim" sysfs interface João Paulo Rechi Vita
2016-01-19 15:42 ` [PATCH 5/8] rfkill: Remove obsolete "state" " João Paulo Rechi Vita
2016-01-19 20:15   ` Johannes Berg
2016-01-19 20:36     ` João Paulo Rechi Vita
2016-01-19 20:44       ` Johannes Berg
2016-01-19 15:42 ` João Paulo Rechi Vita [this message]
2016-01-19 15:42 ` [PATCH 7/8] rfkill: Update userspace API documentation João Paulo Rechi Vita
2016-01-19 15:42 ` [PATCH 8/8] rfkill: Factor common code João Paulo Rechi Vita
2016-01-19 17:39   ` kbuild test robot
2016-01-19 20:32     ` João Paulo Rechi Vita
2016-01-19 18:15   ` kbuild test robot
2016-01-26 13:08 ` [PATCH 0/8] General RFKill improvements Johannes Berg

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=1453218163-31998-7-git-send-email-jprvita@endlessm.com \
    --to=jprvita@gmail.com \
    --cc=davem@davemloft.net \
    --cc=johannes@sipsolutions.net \
    --cc=jprvita@endlessm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linux@endlessm.com \
    --cc=marcel@holtmann.org \
    --cc=netdev@vger.kernel.org \
    /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®