diff options
Diffstat (limited to 'net/rfkill')
-rw-r--r-- | net/rfkill/rfkill.c | 33 |
1 files changed, 15 insertions, 18 deletions
diff --git a/net/rfkill/rfkill.c b/net/rfkill/rfkill.c index a561e350a70a..3c7773475ea6 100644 --- a/net/rfkill/rfkill.c +++ b/net/rfkill/rfkill.c | |||
@@ -224,34 +224,31 @@ static ssize_t rfkill_name_show(struct device *dev, | |||
224 | return sprintf(buf, "%s\n", rfkill->name); | 224 | return sprintf(buf, "%s\n", rfkill->name); |
225 | } | 225 | } |
226 | 226 | ||
227 | static ssize_t rfkill_type_show(struct device *dev, | 227 | static const char *rfkill_get_type_str(enum rfkill_type type) |
228 | struct device_attribute *attr, | ||
229 | char *buf) | ||
230 | { | 228 | { |
231 | struct rfkill *rfkill = to_rfkill(dev); | 229 | switch (type) { |
232 | const char *type; | ||
233 | |||
234 | switch (rfkill->type) { | ||
235 | case RFKILL_TYPE_WLAN: | 230 | case RFKILL_TYPE_WLAN: |
236 | type = "wlan"; | 231 | return "wlan"; |
237 | break; | ||
238 | case RFKILL_TYPE_BLUETOOTH: | 232 | case RFKILL_TYPE_BLUETOOTH: |
239 | type = "bluetooth"; | 233 | return "bluetooth"; |
240 | break; | ||
241 | case RFKILL_TYPE_UWB: | 234 | case RFKILL_TYPE_UWB: |
242 | type = "ultrawideband"; | 235 | return "ultrawideband"; |
243 | break; | ||
244 | case RFKILL_TYPE_WIMAX: | 236 | case RFKILL_TYPE_WIMAX: |
245 | type = "wimax"; | 237 | return "wimax"; |
246 | break; | ||
247 | case RFKILL_TYPE_WWAN: | 238 | case RFKILL_TYPE_WWAN: |
248 | type = "wwan"; | 239 | return "wwan"; |
249 | break; | ||
250 | default: | 240 | default: |
251 | BUG(); | 241 | BUG(); |
252 | } | 242 | } |
243 | } | ||
244 | |||
245 | static ssize_t rfkill_type_show(struct device *dev, | ||
246 | struct device_attribute *attr, | ||
247 | char *buf) | ||
248 | { | ||
249 | struct rfkill *rfkill = to_rfkill(dev); | ||
253 | 250 | ||
254 | return sprintf(buf, "%s\n", type); | 251 | return sprintf(buf, "%s\n", rfkill_get_type_str(rfkill->type)); |
255 | } | 252 | } |
256 | 253 | ||
257 | static ssize_t rfkill_state_show(struct device *dev, | 254 | static ssize_t rfkill_state_show(struct device *dev, |