From patchwork Mon Aug 24 16:01:23 2015 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: 7065351 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 37733C05AC for ; Mon, 24 Aug 2015 16:01:37 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6FF9220785 for ; Mon, 24 Aug 2015 16:01:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9655C20772 for ; Mon, 24 Aug 2015 16:01:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754136AbbHXQBd (ORCPT ); Mon, 24 Aug 2015 12:01:33 -0400 Received: from mail-qk0-f173.google.com ([209.85.220.173]:32890 "EHLO mail-qk0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751150AbbHXQBd (ORCPT ); Mon, 24 Aug 2015 12:01:33 -0400 Received: by qkch123 with SMTP id h123so67542306qkc.0 for ; Mon, 24 Aug 2015 09:01:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:mime-version:content-type :content-transfer-encoding; bh=8I2cCl5gFE/eZoaBlqgIsu4S8IpAnN7+7lwrruZ5c0o=; b=lK7/CRj+foYuxmoWB/3Gz8wqnq8TzuAQIEQDC7rcnE4px88G+EUZv6+FKV2uT8hntM x+GPD8Pnwzq7P56PUrP43x9u2aoBE3E+q+O7xJee8oKURyEqb0yRvf395YCo3df/GSlG ILwL/rexB9QYA4gAiopmWTld7QqVvSIT1Y7qK3YH8tOL1TQ1a6jxQRIRLwqelC5izi5h DPsZcVRIME3WSQLqhrbBZc+7RMZmQi69gzjJ5OhokU+65wp9UVPEey7KmQC3d5bPSEBn 2fsip590za6gliFLrhpWo1Rmz5Ls94/Idp8lRfBDMljJ+s/Z9Lesx/vHrQHZ/lmTUe4q PLhw== X-Received: by 10.55.198.66 with SMTP id b63mr53714005qkj.89.1440432092185; Mon, 24 Aug 2015 09:01:32 -0700 (PDT) Received: from localhost.localdomain (c-98-239-150-235.hsd1.wv.comcast.net. [98.239.150.235]) by smtp.gmail.com with ESMTPSA id i142sm11407514qhc.42.2015.08.24.09.01.31 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 24 Aug 2015 09:01:31 -0700 (PDT) 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 Berg , linux-wireless@vger.kernel.org Cc: =?UTF-8?q?Jo=C3=A3o=20Paulo=20Rechi=20Vita?= Subject: [PATCH] rfkill: Copy "all" global state to other types Date: Mon, 24 Aug 2015 12:01:23 -0400 Message-Id: <1440432084-20928-1-git-send-email-jprvita@endlessm.com> X-Mailer: git-send-email 2.1.4 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=-8.2 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 When switching the state of all RFKill switches of type all we need to replicate the RFKILL_TYPE_ALL global state to all the other types global state, so it is used to initialize persistent RFKill switches on register. Signed-off-by: João Paulo Rechi Vita --- net/rfkill/core.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/net/rfkill/core.c b/net/rfkill/core.c index f12149a..1626e26 100644 --- a/net/rfkill/core.c +++ b/net/rfkill/core.c @@ -341,7 +341,14 @@ static void __rfkill_switch_all(const enum rfkill_type type, bool blocked) { struct rfkill *rfkill; - rfkill_global_states[type].cur = blocked; + if (type == RFKILL_TYPE_ALL) { + enum rfkill_type i; + for (i = 0; i < NUM_RFKILL_TYPES; i++) + rfkill_global_states[i].cur = blocked; + } else { + rfkill_global_states[type].cur = blocked; + } + list_for_each_entry(rfkill, &rfkill_list, node) { if (rfkill->type != type && type != RFKILL_TYPE_ALL) continue;