[PATCH 6/8] rfkill: Move user_state_from_blocked() close to its user
From: JoÃo Paulo Rechi Vita
Date: Tue Jan 19 2016 - 10:45:56 EST
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@xxxxxxxxxxxx>
---
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