From patchwork Mon Feb 8 15:41:36 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: 8251301 X-Patchwork-Delegate: johannes@sipsolutions.net Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id B52F99F3CD for ; Mon, 8 Feb 2016 15:42:34 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D663B203DA for ; Mon, 8 Feb 2016 15:42:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 954E7203DF for ; Mon, 8 Feb 2016 15:42:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755113AbcBHPmH (ORCPT ); Mon, 8 Feb 2016 10:42:07 -0500 Received: from mail-qg0-f68.google.com ([209.85.192.68]:35309 "EHLO mail-qg0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755022AbcBHPlt (ORCPT ); Mon, 8 Feb 2016 10:41:49 -0500 Received: by mail-qg0-f68.google.com with SMTP id b35so8625345qge.2; Mon, 08 Feb 2016 07:41:48 -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=tNxjlM7Wh7CSVE1qCOfkP6T5z3ep4gejRjy1vEJWYpI=; b=wF/YS/5vOmUD7wedOeH9mgqe5v+JBvxb/aTFfSmRqI2fh/cZFQ9An2al/q7BOkRi0o RmPaN7kPDJ07BATLOJ+hdRjcF3PX8U3MMJSG8PXy+qyYrBCGD15sJK6K5hZ9SFFOojjg YiUwU42k5fl7AQkSddi6I9Bn2pMxXwmY8N6jQDfe3bl9KoNOxXgD37B5IXBQB0dkrave qgqTPIHC13uvRQBc7UbQPMEa7G6Ru+BAMwWDW6wrIZvOmrvmwuDp/gv1HJTtJ0esgMH0 5pkNvZYkKlsVu4r2P0eRhNI1muXIgERCe8jl5rtKxqbB7sgd8MJTxINh0SasC3y1JZLx C9+Q== 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=tNxjlM7Wh7CSVE1qCOfkP6T5z3ep4gejRjy1vEJWYpI=; b=URrlwGxlSG1SjEdeswSGjvl1tSNVeWQpWLpr+xbHeR01cyI58qpQfR9zjsnIbGIgwf z3VgmLU4XJY48bZezDkWn0HQXdyfB5q02PzT//RN7n7FrW8uKJWJh+oBwieamOZzfRit YKPOvSuYofW12ypqoxWz1e3NO/L78LOnuES/c6wxabYgXWoGmwoqDQlyWn2hCXoBqQDi 7tpqhTTE0eABgNLpJ+48HJKFq9e8XpxorsEV5kwezPZtf09140PhDJUBYkNl875NqWcB pVHu6PmPtSfLrOvBWHWihmrYjOX4O4xXjjVFA3Ak0aehDAEb0QoTpafPRhvcbOEdkL/1 trjQ== X-Gm-Message-State: AG10YOSJIzAzemAxrDU/ddHS3S+iqD0ENReVPmfNA31001xCSA+lhwrDw+EOQ40xbm2IKw== X-Received: by 10.141.28.149 with SMTP id f143mr36714919qhe.66.1454946108427; Mon, 08 Feb 2016 07:41:48 -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 p188sm14000390qhb.34.2016.02.08.07.41.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 08 Feb 2016 07:41:47 -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 Berg Cc: "David S. Miller" , Darren Hart , linux-wireless@vger.kernel.org, netdev@vger.kernel.org, platform-driver-x86@vger.kernel.org, linux-api@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux@endlessm.com, =?UTF-8?q?Jo=C3=A3o=20Paulo=20Rechi=20Vita?= Subject: [PATCH 9/9] rfkill: Notify userspace of airplane-mode state changes Date: Mon, 8 Feb 2016 10:41:36 -0500 Message-Id: <1454946096-9752-10-git-send-email-jprvita@endlessm.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1454946096-9752-1-git-send-email-jprvita@endlessm.com> References: <1454946096-9752-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=-7.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 Signed-off-by: João Paulo Rechi Vita --- Documentation/rfkill.txt | 3 +++ net/rfkill/core.c | 13 +++++++++++++ 2 files changed, 16 insertions(+) diff --git a/Documentation/rfkill.txt b/Documentation/rfkill.txt index aa6e014..5248812 100644 --- a/Documentation/rfkill.txt +++ b/Documentation/rfkill.txt @@ -133,5 +133,8 @@ it available for other applications to take control. Changes to the airplane-mode indicator state can be made using RFKILL_OP_AIRPLANE_MODE_CHANGE, passing the new value in the 'soft' field of 'struct rfkill_event'. +This same API is also used to provide userspace with notifications of changes +to airplane-mode indicator state. + For further details consult Documentation/ABI/stable/sysfs-class-rfkill. diff --git a/net/rfkill/core.c b/net/rfkill/core.c index 8067701..abbb8f7 100644 --- a/net/rfkill/core.c +++ b/net/rfkill/core.c @@ -131,7 +131,20 @@ static struct led_trigger rfkill_apm_led_trigger; static void rfkill_apm_led_trigger_event(bool state) { + struct rfkill_data *data; + struct rfkill_int_event *ev; + led_trigger_event(&rfkill_apm_led_trigger, state ? LED_FULL : LED_OFF); + + list_for_each_entry(data, &rfkill_fds, list) { + ev = kzalloc(sizeof(*ev), GFP_KERNEL); + if (!ev) + continue; + ev->ev.op = RFKILL_OP_AIRPLANE_MODE_CHANGE; + ev->ev.soft = state; + list_add_tail(&ev->list, &data->events); + wake_up_interruptible(&data->read_wait); + } } static void rfkill_apm_led_trigger_activate(struct led_classdev *led)