提交 042e1c79 编写于 作者: J Jin Yao 提交者: Dmitry Torokhov

Input: soc_button_array - convert to platform bus

ACPI device enumeration mechanism changed a lot since 3.16-rc1.
ACPI device objects with _HID will be enumerated to platform bus by default.
For the existing PNP drivers that probe the PNPACPI devices, the device ids
are listed explicitly in drivers/acpi/acpi_pnp.c.
But ACPI folks will continue their effort on shrinking this id list by
converting the PNP drivers to platform drivers, for the devices that don't
belong to PNP bus in nature.
Signed-off-by: NJin Yao <yao.jin@intel.com>
Signed-off-by: NZhang Rui <rui.zhang@intel.com>
Signed-off-by: NDmitry Torokhov <dmitry.torokhov@gmail.com>
上级 05f7588c
...@@ -15,8 +15,6 @@ ...@@ -15,8 +15,6 @@
#include <linux/ctype.h> #include <linux/ctype.h>
static const struct acpi_device_id acpi_pnp_device_ids[] = { static const struct acpi_device_id acpi_pnp_device_ids[] = {
/* soc_button_array */
{"PNP0C40"},
/* pata_isapnp */ /* pata_isapnp */
{"PNP0600"}, /* Generic ESDI/IDE/ATA compatible hard disk controller */ {"PNP0600"}, /* Generic ESDI/IDE/ATA compatible hard disk controller */
/* floppy */ /* floppy */
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
#include <linux/gpio/consumer.h> #include <linux/gpio/consumer.h>
#include <linux/gpio_keys.h> #include <linux/gpio_keys.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/pnp.h> #include <linux/acpi.h>
/* /*
* Definition of buttons on the tablet. The ACPI index of each button * 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,7 +67,7 @@ static int soc_button_lookup_gpio(struct device *dev, int acpi_index)
} }
static struct platform_device * static struct platform_device *
soc_button_device_create(struct pnp_dev *pdev, soc_button_device_create(struct platform_device *pdev,
const struct soc_button_info *button_info, const struct soc_button_info *button_info,
bool autorepeat) bool autorepeat)
{ {
...@@ -138,30 +138,40 @@ soc_button_device_create(struct pnp_dev *pdev, ...@@ -138,30 +138,40 @@ soc_button_device_create(struct pnp_dev *pdev,
return ERR_PTR(error); return ERR_PTR(error);
} }
static void soc_button_remove(struct pnp_dev *pdev) static int soc_button_remove(struct platform_device *pdev)
{ {
struct soc_button_data *priv = pnp_get_drvdata(pdev); struct soc_button_data *priv = platform_get_drvdata(pdev);
int i; int i;
for (i = 0; i < BUTTON_TYPES; i++) for (i = 0; i < BUTTON_TYPES; i++)
if (priv->children[i]) if (priv->children[i])
platform_device_unregister(priv->children[i]); platform_device_unregister(priv->children[i]);
return 0;
} }
static int soc_button_pnp_probe(struct pnp_dev *pdev, static int soc_button_probe(struct platform_device *pdev)
const struct pnp_device_id *id)
{ {
const struct soc_button_info *button_info = (void *)id->driver_data; struct device *dev = &pdev->dev;
const struct acpi_device_id *id;
struct soc_button_info *button_info;
struct soc_button_data *priv; struct soc_button_data *priv;
struct platform_device *pd; struct platform_device *pd;
int i; int i;
int error; int error;
id = acpi_match_device(dev->driver->acpi_match_table, dev);
if (!id)
return -ENODEV;
button_info = (struct soc_button_info *)id->driver_data;
priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
if (!priv) if (!priv)
return -ENOMEM; return -ENOMEM;
pnp_set_drvdata(pdev, priv); platform_set_drvdata(pdev, priv);
for (i = 0; i < BUTTON_TYPES; i++) { for (i = 0; i < BUTTON_TYPES; i++) {
pd = soc_button_device_create(pdev, button_info, i == 0); pd = soc_button_device_create(pdev, button_info, i == 0);
...@@ -192,30 +202,22 @@ static struct soc_button_info soc_button_PNP0C40[] = { ...@@ -192,30 +202,22 @@ static struct soc_button_info soc_button_PNP0C40[] = {
{ } { }
}; };
static const struct pnp_device_id soc_button_pnp_match[] = { static const struct acpi_device_id soc_button_acpi_match[] = {
{ .id = "PNP0C40", .driver_data = (long)soc_button_PNP0C40 }, { "PNP0C40", (unsigned long)soc_button_PNP0C40 },
{ .id = "" } { }
}; };
MODULE_DEVICE_TABLE(pnp, soc_button_pnp_match);
static struct pnp_driver soc_button_pnp_driver = { MODULE_DEVICE_TABLE(acpi, soc_button_acpi_match);
.name = KBUILD_MODNAME,
.id_table = soc_button_pnp_match, static struct platform_driver soc_button_driver = {
.probe = soc_button_pnp_probe, .probe = soc_button_probe,
.remove = soc_button_remove, .remove = soc_button_remove,
.driver = {
.name = KBUILD_MODNAME,
.owner = THIS_MODULE,
.acpi_match_table = ACPI_PTR(soc_button_acpi_match),
},
}; };
module_platform_driver(soc_button_driver);
static int __init soc_button_init(void)
{
return pnp_register_driver(&soc_button_pnp_driver);
}
static void __exit soc_button_exit(void)
{
pnp_unregister_driver(&soc_button_pnp_driver);
}
module_init(soc_button_init);
module_exit(soc_button_exit);
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册