diff options
Diffstat (limited to 'drivers/input/misc/soc_button_array.c')
-rw-r--r-- | drivers/input/misc/soc_button_array.c | 60 |
1 files changed, 31 insertions, 29 deletions
diff --git a/drivers/input/misc/soc_button_array.c b/drivers/input/misc/soc_button_array.c index e34dfc29beb3..735604753568 100644 --- a/drivers/input/misc/soc_button_array.c +++ b/drivers/input/misc/soc_button_array.c | |||
@@ -18,7 +18,7 @@ | |||
18 | #include <linux/gpio/consumer.h> | 18 | #include <linux/gpio/consumer.h> |
19 | #include <linux/gpio_keys.h> | 19 | #include <linux/gpio_keys.h> |
20 | #include <linux/platform_device.h> | 20 | #include <linux/platform_device.h> |
21 | #include <linux/pnp.h> | 21 | #include <linux/acpi.h> |
22 | 22 | ||
23 | /* | 23 | /* |
24 | * Definition of buttons on the tablet. The ACPI index of each button | 24 | * Definition of buttons on the tablet. The ACPI index of each button |
@@ -67,7 +67,7 @@ static int soc_button_lookup_gpio(struct device *dev, int acpi_index) | |||
67 | } | 67 | } |
68 | 68 | ||
69 | static struct platform_device * | 69 | static struct platform_device * |
70 | soc_button_device_create(struct pnp_dev *pdev, | 70 | soc_button_device_create(struct platform_device *pdev, |
71 | const struct soc_button_info *button_info, | 71 | const struct soc_button_info *button_info, |
72 | bool autorepeat) | 72 | bool autorepeat) |
73 | { | 73 | { |
@@ -138,30 +138,40 @@ err_free_mem: | |||
138 | return ERR_PTR(error); | 138 | return ERR_PTR(error); |
139 | } | 139 | } |
140 | 140 | ||
141 | static void soc_button_remove(struct pnp_dev *pdev) | 141 | static int soc_button_remove(struct platform_device *pdev) |
142 | { | 142 | { |
143 | struct soc_button_data *priv = pnp_get_drvdata(pdev); | 143 | struct soc_button_data *priv = platform_get_drvdata(pdev); |
144 | |||
144 | int i; | 145 | int i; |
145 | 146 | ||
146 | for (i = 0; i < BUTTON_TYPES; i++) | 147 | for (i = 0; i < BUTTON_TYPES; i++) |
147 | if (priv->children[i]) | 148 | if (priv->children[i]) |
148 | platform_device_unregister(priv->children[i]); | 149 | platform_device_unregister(priv->children[i]); |
150 | |||
151 | return 0; | ||
149 | } | 152 | } |
150 | 153 | ||
151 | static int soc_button_pnp_probe(struct pnp_dev *pdev, | 154 | static int soc_button_probe(struct platform_device *pdev) |
152 | const struct pnp_device_id *id) | ||
153 | { | 155 | { |
154 | const struct soc_button_info *button_info = (void *)id->driver_data; | 156 | struct device *dev = &pdev->dev; |
157 | const struct acpi_device_id *id; | ||
158 | struct soc_button_info *button_info; | ||
155 | struct soc_button_data *priv; | 159 | struct soc_button_data *priv; |
156 | struct platform_device *pd; | 160 | struct platform_device *pd; |
157 | int i; | 161 | int i; |
158 | int error; | 162 | int error; |
159 | 163 | ||
164 | id = acpi_match_device(dev->driver->acpi_match_table, dev); | ||
165 | if (!id) | ||
166 | return -ENODEV; | ||
167 | |||
168 | button_info = (struct soc_button_info *)id->driver_data; | ||
169 | |||
160 | priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); | 170 | priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); |
161 | if (!priv) | 171 | if (!priv) |
162 | return -ENOMEM; | 172 | return -ENOMEM; |
163 | 173 | ||
164 | pnp_set_drvdata(pdev, priv); | 174 | platform_set_drvdata(pdev, priv); |
165 | 175 | ||
166 | for (i = 0; i < BUTTON_TYPES; i++) { | 176 | for (i = 0; i < BUTTON_TYPES; i++) { |
167 | pd = soc_button_device_create(pdev, button_info, i == 0); | 177 | pd = soc_button_device_create(pdev, button_info, i == 0); |
@@ -192,30 +202,22 @@ static struct soc_button_info soc_button_PNP0C40[] = { | |||
192 | { } | 202 | { } |
193 | }; | 203 | }; |
194 | 204 | ||
195 | static const struct pnp_device_id soc_button_pnp_match[] = { | 205 | static const struct acpi_device_id soc_button_acpi_match[] = { |
196 | { .id = "PNP0C40", .driver_data = (long)soc_button_PNP0C40 }, | 206 | { "PNP0C40", (unsigned long)soc_button_PNP0C40 }, |
197 | { .id = "" } | 207 | { } |
198 | }; | 208 | }; |
199 | MODULE_DEVICE_TABLE(pnp, soc_button_pnp_match); | ||
200 | 209 | ||
201 | static struct pnp_driver soc_button_pnp_driver = { | 210 | MODULE_DEVICE_TABLE(acpi, soc_button_acpi_match); |
202 | .name = KBUILD_MODNAME, | 211 | |
203 | .id_table = soc_button_pnp_match, | 212 | static struct platform_driver soc_button_driver = { |
204 | .probe = soc_button_pnp_probe, | 213 | .probe = soc_button_probe, |
205 | .remove = soc_button_remove, | 214 | .remove = soc_button_remove, |
215 | .driver = { | ||
216 | .name = KBUILD_MODNAME, | ||
217 | .owner = THIS_MODULE, | ||
218 | .acpi_match_table = ACPI_PTR(soc_button_acpi_match), | ||
219 | }, | ||
206 | }; | 220 | }; |
207 | 221 | module_platform_driver(soc_button_driver); | |
208 | static int __init soc_button_init(void) | ||
209 | { | ||
210 | return pnp_register_driver(&soc_button_pnp_driver); | ||
211 | } | ||
212 | |||
213 | static void __exit soc_button_exit(void) | ||
214 | { | ||
215 | pnp_unregister_driver(&soc_button_pnp_driver); | ||
216 | } | ||
217 | |||
218 | module_init(soc_button_init); | ||
219 | module_exit(soc_button_exit); | ||
220 | 222 | ||
221 | MODULE_LICENSE("GPL"); | 223 | MODULE_LICENSE("GPL"); |