From 87206d5001a835c5d2be677650eb40d9388a10ae Mon Sep 17 00:00:00 2001 From: Henrique de Moraes Holschuh Date: Mon, 23 Jun 2008 17:23:04 -0300 Subject: [PATCH] --- yaml --- r: 103145 b: refs/heads/master c: 99c632e5a304e1f76350eb9e8b2493514de8b60c h: refs/heads/master i: 103143: 13dfa40852ceaa1cb2112c2f53c1219dea9b0c0c v: v3 --- [refs] | 2 +- trunk/net/rfkill/rfkill.c | 33 +++++++++++++++------------------ 2 files changed, 16 insertions(+), 19 deletions(-) diff --git a/[refs] b/[refs] index 3126697454ea..23e087f3aa40 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 79399a8d1908f6a406e82d23c5a9937e1722ed3a +refs/heads/master: 99c632e5a304e1f76350eb9e8b2493514de8b60c diff --git a/trunk/net/rfkill/rfkill.c b/trunk/net/rfkill/rfkill.c index a561e350a70a..3c7773475ea6 100644 --- a/trunk/net/rfkill/rfkill.c +++ b/trunk/net/rfkill/rfkill.c @@ -224,34 +224,31 @@ static ssize_t rfkill_name_show(struct device *dev, return sprintf(buf, "%s\n", rfkill->name); } -static ssize_t rfkill_type_show(struct device *dev, - struct device_attribute *attr, - char *buf) +static const char *rfkill_get_type_str(enum rfkill_type type) { - struct rfkill *rfkill = to_rfkill(dev); - const char *type; - - switch (rfkill->type) { + switch (type) { case RFKILL_TYPE_WLAN: - type = "wlan"; - break; + return "wlan"; case RFKILL_TYPE_BLUETOOTH: - type = "bluetooth"; - break; + return "bluetooth"; case RFKILL_TYPE_UWB: - type = "ultrawideband"; - break; + return "ultrawideband"; case RFKILL_TYPE_WIMAX: - type = "wimax"; - break; + return "wimax"; case RFKILL_TYPE_WWAN: - type = "wwan"; - break; + return "wwan"; default: BUG(); } +} + +static ssize_t rfkill_type_show(struct device *dev, + struct device_attribute *attr, + char *buf) +{ + struct rfkill *rfkill = to_rfkill(dev); - return sprintf(buf, "%s\n", type); + return sprintf(buf, "%s\n", rfkill_get_type_str(rfkill->type)); } static ssize_t rfkill_state_show(struct device *dev,