From patchwork Tue Aug 25 12:56:43 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: 7071201 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 7B90BC05AC for ; Tue, 25 Aug 2015 12:57:00 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4B50420884 for ; Tue, 25 Aug 2015 12:56:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4372620883 for ; Tue, 25 Aug 2015 12:56:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755246AbbHYM4x (ORCPT ); Tue, 25 Aug 2015 08:56:53 -0400 Received: from mail-qk0-f174.google.com ([209.85.220.174]:33400 "EHLO mail-qk0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751726AbbHYM4w (ORCPT ); Tue, 25 Aug 2015 08:56:52 -0400 Received: by qkch123 with SMTP id h123so93587939qkc.0 for ; Tue, 25 Aug 2015 05:56:52 -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:in-reply-to:references :mime-version:content-type:content-transfer-encoding; bh=9P+Efmm8ZWSbD5Ll7ITYeRp9pNqRKxr/9xFnE/4R7qI=; b=eAIglsD/qBh0CyfnXuCSSuVoJZZeZqMWUyiGhi1bOxrbGV67aTQY+aODy8eGbnW+WG o5uAojBkMQu7R+34WZW8TqrDveHEAthXm2IN2JT8iL7ava7KtCnrmlpub6nDGpuR34IB R55CVqTKDNP1HxjI69yKKT4rIV2l7Q2T6aHymn1y1sUuXq+256p1WlNV1txwfa8eZiIz gENVY4/j3g+8jtWAv8C8kIeZUxBZXFKPLD0jeCRITvQlPrgeKIcKkh09YTNjE9O167C4 TbU6GkcSUubzIcEzYFrwUiPQjmiff0Kq8uSMYIy6Z21JZHhNEXqwSdYovOYm5Uins5s5 h9fw== X-Received: by 10.55.50.67 with SMTP id y64mr65213592qky.44.1440507412108; Tue, 25 Aug 2015 05:56:52 -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 77sm13583844qhw.4.2015.08.25.05.56.51 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 25 Aug 2015 05:56:51 -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: linux-wireless@vger.kernel.org Cc: Johannes Berg , Joe Perches , =?UTF-8?q?Jo=C3=A3o=20Paulo=20Rechi=20Vita?= Subject: [PATCH] rfkill: Copy "all" global state to other types Date: Tue, 25 Aug 2015 08:56:43 -0400 Message-Id: <1440507403-9695-1-git-send-email-jprvita@endlessm.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1440462512.2670.83.camel@perches.com> References: <1440462512.2670.83.camel@perches.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=-8.1 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 Acked-by: Marcel Holtmann --- 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..2c1284a 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) { + int 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;