From patchwork Tue Jan 19 15:42:41 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Jo=C3=A3o_Paulo_Rechi_Vita?= X-Patchwork-Id: 8063511 X-Patchwork-Delegate: johannes@sipsolutions.net Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 8954EBEEE5 for ; Tue, 19 Jan 2016 15:47:13 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AE059203A1 for ; Tue, 19 Jan 2016 15:47:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 07D92203A0 for ; Tue, 19 Jan 2016 15:47:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756979AbcASPpi (ORCPT ); Tue, 19 Jan 2016 10:45:38 -0500 Received: from mail-qg0-f68.google.com ([209.85.192.68]:34185 "EHLO mail-qg0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756345AbcASPoJ (ORCPT ); Tue, 19 Jan 2016 10:44:09 -0500 Received: by mail-qg0-f68.google.com with SMTP id 94so65239891qgt.1; Tue, 19 Jan 2016 07:44:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; bh=fyPHdSt1sU8v6tDuyyfr22065sSuQzWe2/A9lc+pJWY=; b=BylTTXO7qidKEGmThDDo9VnYWnBtAxICQxHnO6HtQQEw2jCioVqGObTof0UWNssNOL Gdc2biEuLAHLAnWouyfSbZRym0ZIUIIQdyzlhAZLj+67/mZE+GyGIXQaBwkIf7ZQ67gT PtUJ1O2G+d6TREW3UqFcon/zhMpikddayJxOrEJlM8BH+pMivLbHRjA0Be9HFjKrcWni hmubATpv9YAPxkIVI0yA2O/XvayOtyWcSKYimGXQxt1jEdVfYVAfIgPYBvLn0fV+wFjV us3Vpacn8OgR5VrelhhjhGQ2pNsQkiaZ6b6xLBL+UZRAF6FtMA0KXNdjHrlsf3PalmR2 pvaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-type:content-transfer-encoding; bh=fyPHdSt1sU8v6tDuyyfr22065sSuQzWe2/A9lc+pJWY=; b=ISZzskuvgny23baGtiYqMab3k7V9fwHCvcRSjTGh2c7UOGjf0rD6EdTTOmkzl3BzKS IT2NxBYVmBlQckZ6olavuarwKZUs66WqeTm4wYEqxV+UK6dEIKGQ6okwW8UUgiXLZ2Hc R4C4NKfyKEmGyQeD6Tjd5rLvjQo5qzrHzTL342RQN1gGoyOj40nbGmxDsSXroVK+rD82 Vx3debcp9G4B0HZkGpRDbdYU0Lj5NhIYS9jatL0J1ruMbLTqRa0dN23a09jG1XzJ6F6v 5WCv6d8iYy3BzWKpwVE6jme+QeJge/tmVSVlrbb/zYcyoP7JIFGzZG7c/wvR48IYk3nj LUPQ== X-Gm-Message-State: AG10YOR4yKuMOjm8jWWPZJ/UH/fZCGIW/qqTz+E9d+IT09+IfotYDHE4IJAwPggOAiF0Og== X-Received: by 10.140.226.8 with SMTP id w8mr29321587qhb.83.1453218248153; Tue, 19 Jan 2016 07:44:08 -0800 (PST) Received: from localhost.localdomain (c-98-239-150-235.hsd1.wv.comcast.net. [98.239.150.235]) by smtp.gmail.com with ESMTPSA id z10sm12336759qhz.5.2016.01.19.07.44.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 19 Jan 2016 07:44:07 -0800 (PST) From: "=?UTF-8?q?Jo=C3=A3o=20Paulo=20Rechi=20Vita?=" X-Google-Original-From: =?UTF-8?q?Jo=C3=A3o=20Paulo=20Rechi=20Vita?= 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 Message-Id: <1453218163-31998-7-git-send-email-jprvita@endlessm.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1453218163-31998-1-git-send-email-jprvita@endlessm.com> References: <1453218163-31998-1-git-send-email-jprvita@endlessm.com> MIME-Version: 1.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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);