From patchwork Thu Jul 26 01:51:08 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Chia-Lin Kao (AceLan)" X-Patchwork-Id: 1240091 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id BB2F33FDFB for ; Thu, 26 Jul 2012 01:51:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751507Ab2GZBvP (ORCPT ); Wed, 25 Jul 2012 21:51:15 -0400 Received: from mail-gg0-f174.google.com ([209.85.161.174]:52781 "EHLO mail-gg0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751338Ab2GZBvO (ORCPT ); Wed, 25 Jul 2012 21:51:14 -0400 Received: by gglu4 with SMTP id u4so1430439ggl.19 for ; Wed, 25 Jul 2012 18:51:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:subject:date:message-id:x-mailer; bh=LsViZr4GWF2wDc8URjeIr+i0qAagG0ZEhdfWobornDM=; b=rMPjSmk9Li6Tamid2v68CU30hyvb6JmeWG8/Ty65Ff47Ok5oq+s9GHr20GUDWfc0OE 8Zu9A2ZlfZWc8ZIogDEjSfi72AMZcqvzkynr2TB0Lo+b25FzmD2VOzMj43jy1/We6+EE q06axyPIMSI9ZPZlapU0SfzLPXq2G3m8fyqbDiu3q83Bd5vrUpIhDxC0deWQv3zzwBOM 9NmS+Jzbti33YtmlPKf3/s2ArN9q48rxa4+IyFHwllQh3QsTYlOJ20fMffJXMeYTucuR GrSCF7K4IoMcK6Sid71DUqHQPTKSwJu/sh2uDMUHrglFTyfaVJIXJWyYcqadV9pzXGLA +i3g== Received: by 10.50.191.163 with SMTP id gz3mr330023igc.30.1343267473657; Wed, 25 Jul 2012 18:51:13 -0700 (PDT) Received: from localhost ([210.242.151.101]) by mx.google.com with ESMTPS id bj4sm2211942igc.16.2012.07.25.18.51.11 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 25 Jul 2012 18:51:12 -0700 (PDT) From: AceLan Kao To: Johannes Berg , linux-wireless@vger.kernel.org, Corentin Chary Subject: [PATCH] Revert "rfkill: remove dead code" Date: Thu, 26 Jul 2012 09:51:08 +0800 Message-Id: <1343267468-9986-1-git-send-email-acelan.kao@canonical.com> X-Mailer: git-send-email 1.7.9.5 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org This reverts commit 2e48928d8a0f38c1b5c81eb3f1294de8a6382c68. Those functions are needed and should not be removed, or there is no way to set the rfkill led trigger name. Signed-off-by: AceLan Kao --- include/linux/rfkill.h | 31 +++++++++++++++++++++++++++++++ net/rfkill/core.c | 14 ++++++++++++++ 2 files changed, 45 insertions(+) diff --git a/include/linux/rfkill.h b/include/linux/rfkill.h index 6fdf027..0ec590b 100644 --- a/include/linux/rfkill.h +++ b/include/linux/rfkill.h @@ -354,6 +354,37 @@ static inline bool rfkill_blocked(struct rfkill *rfkill) } #endif /* RFKILL || RFKILL_MODULE */ + +#ifdef CONFIG_RFKILL_LEDS +/** + * rfkill_get_led_trigger_name - Get the LED trigger name for the button's LED. + * This function might return a NULL pointer if registering of the + * LED trigger failed. Use this as "default_trigger" for the LED. + */ +const char *rfkill_get_led_trigger_name(struct rfkill *rfkill); + +/** + * rfkill_set_led_trigger_name -- set the LED trigger name + * @rfkill: rfkill struct + * @name: LED trigger name + * + * This function sets the LED trigger name of the radio LED + * trigger that rfkill creates. It is optional, but if called + * must be called before rfkill_register() to be effective. + */ +void rfkill_set_led_trigger_name(struct rfkill *rfkill, const char *name); +#else +static inline const char *rfkill_get_led_trigger_name(struct rfkill *rfkill) +{ + return NULL; +} + +static inline void +rfkill_set_led_trigger_name(struct rfkill *rfkill, const char *name) +{ +} +#endif + #endif /* __KERNEL__ */ #endif /* RFKILL_H */ diff --git a/net/rfkill/core.c b/net/rfkill/core.c index f974961..2364064 100644 --- a/net/rfkill/core.c +++ b/net/rfkill/core.c @@ -150,6 +150,20 @@ static void rfkill_led_trigger_activate(struct led_classdev *led) rfkill_led_trigger_event(rfkill); } +const char *rfkill_get_led_trigger_name(struct rfkill *rfkill) +{ + return rfkill->led_trigger.name; +} +EXPORT_SYMBOL(rfkill_get_led_trigger_name); + +void rfkill_set_led_trigger_name(struct rfkill *rfkill, const char *name) +{ + BUG_ON(!rfkill); + + rfkill->ledtrigname = name; +} +EXPORT_SYMBOL(rfkill_set_led_trigger_name); + static int rfkill_led_trigger_register(struct rfkill *rfkill) { rfkill->led_trigger.name = rfkill->ledtrigname