diff options
author | Johannes Berg <johannes.berg@intel.com> | 2017-01-02 10:01:57 -0500 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2017-01-24 05:07:35 -0500 |
commit | 1331b62c97217459780e040e8a66bb609f2acd20 (patch) | |
tree | f06688ed329f86dcfaa462582681f9156fca16f3 /net/rfkill | |
parent | 57eeb2086d6477968990e1790a9d8d0ec7ee8a4d (diff) |
rfkill: remove rfkill-regulator
There are no users of this ("vrfkill") in the tree, so it's just
dead code - remove it.
This also isn't really how rfkill is supposed to be used - it's
intended as a signalling mechanism to/from the device, which the
driver (and partially cfg80211) will handle - having a separate
rfkill instance for a regulator is confusing, the driver should
use the regulator instead to turn off the device when requested.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/rfkill')
-rw-r--r-- | net/rfkill/Kconfig | 11 | ||||
-rw-r--r-- | net/rfkill/Makefile | 1 | ||||
-rw-r--r-- | net/rfkill/rfkill-regulator.c | 154 |
3 files changed, 0 insertions, 166 deletions
diff --git a/net/rfkill/Kconfig b/net/rfkill/Kconfig index 868f1ad0415a..060600b03fad 100644 --- a/net/rfkill/Kconfig +++ b/net/rfkill/Kconfig | |||
@@ -23,17 +23,6 @@ config RFKILL_INPUT | |||
23 | depends on INPUT = y || RFKILL = INPUT | 23 | depends on INPUT = y || RFKILL = INPUT |
24 | default y if !EXPERT | 24 | default y if !EXPERT |
25 | 25 | ||
26 | config RFKILL_REGULATOR | ||
27 | tristate "Generic rfkill regulator driver" | ||
28 | depends on RFKILL || !RFKILL | ||
29 | depends on REGULATOR | ||
30 | help | ||
31 | This options enable controlling radio transmitters connected to | ||
32 | voltage regulator using the regulator framework. | ||
33 | |||
34 | To compile this driver as a module, choose M here: the module will | ||
35 | be called rfkill-regulator. | ||
36 | |||
37 | config RFKILL_GPIO | 26 | config RFKILL_GPIO |
38 | tristate "GPIO RFKILL driver" | 27 | tristate "GPIO RFKILL driver" |
39 | depends on RFKILL | 28 | depends on RFKILL |
diff --git a/net/rfkill/Makefile b/net/rfkill/Makefile index 311768783f4a..87a80aded0b3 100644 --- a/net/rfkill/Makefile +++ b/net/rfkill/Makefile | |||
@@ -5,5 +5,4 @@ | |||
5 | rfkill-y += core.o | 5 | rfkill-y += core.o |
6 | rfkill-$(CONFIG_RFKILL_INPUT) += input.o | 6 | rfkill-$(CONFIG_RFKILL_INPUT) += input.o |
7 | obj-$(CONFIG_RFKILL) += rfkill.o | 7 | obj-$(CONFIG_RFKILL) += rfkill.o |
8 | obj-$(CONFIG_RFKILL_REGULATOR) += rfkill-regulator.o | ||
9 | obj-$(CONFIG_RFKILL_GPIO) += rfkill-gpio.o | 8 | obj-$(CONFIG_RFKILL_GPIO) += rfkill-gpio.o |
diff --git a/net/rfkill/rfkill-regulator.c b/net/rfkill/rfkill-regulator.c deleted file mode 100644 index 50cd26a48e87..000000000000 --- a/net/rfkill/rfkill-regulator.c +++ /dev/null | |||
@@ -1,154 +0,0 @@ | |||
1 | /* | ||
2 | * rfkill-regulator.c - Regulator consumer driver for rfkill | ||
3 | * | ||
4 | * Copyright (C) 2009 Guiming Zhuo <gmzhuo@gmail.com> | ||
5 | * Copyright (C) 2011 Antonio Ospite <ospite@studenti.unina.it> | ||
6 | * | ||
7 | * Implementation inspired by leds-regulator driver. | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify | ||
10 | * it under the terms of the GNU General Public License version 2 as | ||
11 | * published by the Free Software Foundation. | ||
12 | * | ||
13 | */ | ||
14 | |||
15 | #include <linux/module.h> | ||
16 | #include <linux/err.h> | ||
17 | #include <linux/slab.h> | ||
18 | #include <linux/platform_device.h> | ||
19 | #include <linux/regulator/consumer.h> | ||
20 | #include <linux/rfkill.h> | ||
21 | #include <linux/rfkill-regulator.h> | ||
22 | |||
23 | struct rfkill_regulator_data { | ||
24 | struct rfkill *rf_kill; | ||
25 | bool reg_enabled; | ||
26 | |||
27 | struct regulator *vcc; | ||
28 | }; | ||
29 | |||
30 | static int rfkill_regulator_set_block(void *data, bool blocked) | ||
31 | { | ||
32 | struct rfkill_regulator_data *rfkill_data = data; | ||
33 | int ret = 0; | ||
34 | |||
35 | pr_debug("%s: blocked: %d\n", __func__, blocked); | ||
36 | |||
37 | if (blocked) { | ||
38 | if (rfkill_data->reg_enabled) { | ||
39 | regulator_disable(rfkill_data->vcc); | ||
40 | rfkill_data->reg_enabled = false; | ||
41 | } | ||
42 | } else { | ||
43 | if (!rfkill_data->reg_enabled) { | ||
44 | ret = regulator_enable(rfkill_data->vcc); | ||
45 | if (!ret) | ||
46 | rfkill_data->reg_enabled = true; | ||
47 | } | ||
48 | } | ||
49 | |||
50 | pr_debug("%s: regulator_is_enabled after set_block: %d\n", __func__, | ||
51 | regulator_is_enabled(rfkill_data->vcc)); | ||
52 | |||
53 | return ret; | ||
54 | } | ||
55 | |||
56 | static struct rfkill_ops rfkill_regulator_ops = { | ||
57 | .set_block = rfkill_regulator_set_block, | ||
58 | }; | ||
59 | |||
60 | static int rfkill_regulator_probe(struct platform_device *pdev) | ||
61 | { | ||
62 | struct rfkill_regulator_platform_data *pdata = pdev->dev.platform_data; | ||
63 | struct rfkill_regulator_data *rfkill_data; | ||
64 | struct regulator *vcc; | ||
65 | struct rfkill *rf_kill; | ||
66 | int ret = 0; | ||
67 | |||
68 | if (pdata == NULL) { | ||
69 | dev_err(&pdev->dev, "no platform data\n"); | ||
70 | return -ENODEV; | ||
71 | } | ||
72 | |||
73 | if (pdata->name == NULL || pdata->type == 0) { | ||
74 | dev_err(&pdev->dev, "invalid name or type in platform data\n"); | ||
75 | return -EINVAL; | ||
76 | } | ||
77 | |||
78 | vcc = regulator_get_exclusive(&pdev->dev, "vrfkill"); | ||
79 | if (IS_ERR(vcc)) { | ||
80 | dev_err(&pdev->dev, "Cannot get vcc for %s\n", pdata->name); | ||
81 | ret = PTR_ERR(vcc); | ||
82 | goto out; | ||
83 | } | ||
84 | |||
85 | rfkill_data = kzalloc(sizeof(*rfkill_data), GFP_KERNEL); | ||
86 | if (rfkill_data == NULL) { | ||
87 | ret = -ENOMEM; | ||
88 | goto err_data_alloc; | ||
89 | } | ||
90 | |||
91 | rf_kill = rfkill_alloc(pdata->name, &pdev->dev, | ||
92 | pdata->type, | ||
93 | &rfkill_regulator_ops, rfkill_data); | ||
94 | if (rf_kill == NULL) { | ||
95 | ret = -ENOMEM; | ||
96 | goto err_rfkill_alloc; | ||
97 | } | ||
98 | |||
99 | if (regulator_is_enabled(vcc)) { | ||
100 | dev_dbg(&pdev->dev, "Regulator already enabled\n"); | ||
101 | rfkill_data->reg_enabled = true; | ||
102 | } | ||
103 | rfkill_data->vcc = vcc; | ||
104 | rfkill_data->rf_kill = rf_kill; | ||
105 | |||
106 | ret = rfkill_register(rf_kill); | ||
107 | if (ret) { | ||
108 | dev_err(&pdev->dev, "Cannot register rfkill device\n"); | ||
109 | goto err_rfkill_register; | ||
110 | } | ||
111 | |||
112 | platform_set_drvdata(pdev, rfkill_data); | ||
113 | dev_info(&pdev->dev, "%s initialized\n", pdata->name); | ||
114 | |||
115 | return 0; | ||
116 | |||
117 | err_rfkill_register: | ||
118 | rfkill_destroy(rf_kill); | ||
119 | err_rfkill_alloc: | ||
120 | kfree(rfkill_data); | ||
121 | err_data_alloc: | ||
122 | regulator_put(vcc); | ||
123 | out: | ||
124 | return ret; | ||
125 | } | ||
126 | |||
127 | static int rfkill_regulator_remove(struct platform_device *pdev) | ||
128 | { | ||
129 | struct rfkill_regulator_data *rfkill_data = platform_get_drvdata(pdev); | ||
130 | struct rfkill *rf_kill = rfkill_data->rf_kill; | ||
131 | |||
132 | rfkill_unregister(rf_kill); | ||
133 | rfkill_destroy(rf_kill); | ||
134 | regulator_put(rfkill_data->vcc); | ||
135 | kfree(rfkill_data); | ||
136 | |||
137 | return 0; | ||
138 | } | ||
139 | |||
140 | static struct platform_driver rfkill_regulator_driver = { | ||
141 | .probe = rfkill_regulator_probe, | ||
142 | .remove = rfkill_regulator_remove, | ||
143 | .driver = { | ||
144 | .name = "rfkill-regulator", | ||
145 | }, | ||
146 | }; | ||
147 | |||
148 | module_platform_driver(rfkill_regulator_driver); | ||
149 | |||
150 | MODULE_AUTHOR("Guiming Zhuo <gmzhuo@gmail.com>"); | ||
151 | MODULE_AUTHOR("Antonio Ospite <ospite@studenti.unina.it>"); | ||
152 | MODULE_DESCRIPTION("Regulator consumer driver for rfkill"); | ||
153 | MODULE_LICENSE("GPL"); | ||
154 | MODULE_ALIAS("platform:rfkill-regulator"); | ||