aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Dietrich <marvin24@gmx.de>2013-06-21 04:28:54 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-06-24 18:59:03 -0400
commit2c6cbdd0ef966cdf5e93ea17475a577dacf44dd7 (patch)
tree6560cc9b718638671669ba2c05607d7588d24f51
parent2b8d5e5b39a251b99a42cac8eccb268190ff3baf (diff)
staging: nvec: remove instantiating via platform device
Tegra has been converted to support device tree only. Remove support for instantiating via platform device. Signed-off-by: Leon Romanovsky <leon@leon.nu> Signed-off-by: Marc Dietrich <marvin24@gmx.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/staging/nvec/nvec.c33
-rw-r--r--drivers/staging/nvec/nvec.h25
2 files changed, 14 insertions, 44 deletions
diff --git a/drivers/staging/nvec/nvec.c b/drivers/staging/nvec/nvec.c
index 197c393c4ca7..8e935a4aafe2 100644
--- a/drivers/staging/nvec/nvec.c
+++ b/drivers/staging/nvec/nvec.c
@@ -33,7 +33,6 @@
33#include <linux/mfd/core.h> 33#include <linux/mfd/core.h>
34#include <linux/mutex.h> 34#include <linux/mutex.h>
35#include <linux/notifier.h> 35#include <linux/notifier.h>
36#include <linux/platform_device.h>
37#include <linux/slab.h> 36#include <linux/slab.h>
38#include <linux/spinlock.h> 37#include <linux/spinlock.h>
39#include <linux/workqueue.h> 38#include <linux/workqueue.h>
@@ -776,7 +775,6 @@ static int tegra_nvec_probe(struct platform_device *pdev)
776{ 775{
777 int err, ret; 776 int err, ret;
778 struct clk *i2c_clk; 777 struct clk *i2c_clk;
779 struct nvec_platform_data *pdata = pdev->dev.platform_data;
780 struct nvec_chip *nvec; 778 struct nvec_chip *nvec;
781 struct nvec_msg *msg; 779 struct nvec_msg *msg;
782 struct resource *res; 780 struct resource *res;
@@ -785,6 +783,11 @@ static int tegra_nvec_probe(struct platform_device *pdev)
785 unmute_speakers[] = { NVEC_OEM0, 0x10, 0x59, 0x95 }, 783 unmute_speakers[] = { NVEC_OEM0, 0x10, 0x59, 0x95 },
786 enable_event[7] = { NVEC_SYS, CNF_EVENT_REPORTING, true }; 784 enable_event[7] = { NVEC_SYS, CNF_EVENT_REPORTING, true };
787 785
786 if(!pdev->dev.of_node) {
787 dev_err(&pdev->dev, "must be instantiated using device tree\n");
788 return -ENODEV;
789 }
790
788 nvec = devm_kzalloc(&pdev->dev, sizeof(struct nvec_chip), GFP_KERNEL); 791 nvec = devm_kzalloc(&pdev->dev, sizeof(struct nvec_chip), GFP_KERNEL);
789 if (nvec == NULL) { 792 if (nvec == NULL) {
790 dev_err(&pdev->dev, "failed to reserve memory\n"); 793 dev_err(&pdev->dev, "failed to reserve memory\n");
@@ -793,23 +796,15 @@ static int tegra_nvec_probe(struct platform_device *pdev)
793 platform_set_drvdata(pdev, nvec); 796 platform_set_drvdata(pdev, nvec);
794 nvec->dev = &pdev->dev; 797 nvec->dev = &pdev->dev;
795 798
796 if (pdata) { 799 nvec->gpio = of_get_named_gpio(nvec->dev->of_node, "request-gpios", 0);
797 nvec->gpio = pdata->gpio; 800 if (nvec->gpio < 0) {
798 nvec->i2c_addr = pdata->i2c_addr; 801 dev_err(&pdev->dev, "no gpio specified");
799 } else if (nvec->dev->of_node) { 802 return -ENODEV;
800 nvec->gpio = of_get_named_gpio(nvec->dev->of_node, 803 }
801 "request-gpios", 0); 804
802 if (nvec->gpio < 0) { 805 if (of_property_read_u32(nvec->dev->of_node, "slave-addr",
803 dev_err(&pdev->dev, "no gpio specified"); 806 &nvec->i2c_addr)) {
804 return -ENODEV; 807 dev_err(&pdev->dev, "no i2c address specified");
805 }
806 if (of_property_read_u32(nvec->dev->of_node,
807 "slave-addr", &nvec->i2c_addr)) {
808 dev_err(&pdev->dev, "no i2c address specified");
809 return -ENODEV;
810 }
811 } else {
812 dev_err(&pdev->dev, "no platform data\n");
813 return -ENODEV; 808 return -ENODEV;
814 } 809 }
815 810
diff --git a/drivers/staging/nvec/nvec.h b/drivers/staging/nvec/nvec.h
index 2b1316d87470..e880518935fb 100644
--- a/drivers/staging/nvec/nvec.h
+++ b/drivers/staging/nvec/nvec.h
@@ -103,31 +103,6 @@ struct nvec_msg {
103}; 103};
104 104
105/** 105/**
106 * struct nvec_subdev - A subdevice of nvec, such as nvec_kbd
107 * @name: The name of the sub device
108 * @platform_data: Platform data
109 * @id: Identifier of the sub device
110 */
111struct nvec_subdev {
112 const char *name;
113 void *platform_data;
114 int id;
115};
116
117/**
118 * struct nvec_platform_data - platform data for a tegra slave controller
119 * @i2c_addr: number of i2c slave adapter the ec is connected to
120 * @gpio: gpio number for the ec request line
121 *
122 * Platform data, to be used in board definitions. For an example, take a
123 * look at the paz00 board in arch/arm/mach-tegra/board-paz00.c
124 */
125struct nvec_platform_data {
126 int i2c_addr;
127 int gpio;
128};
129
130/**
131 * struct nvec_chip - A single connection to an NVIDIA Embedded controller 106 * struct nvec_chip - A single connection to an NVIDIA Embedded controller
132 * @dev: The device 107 * @dev: The device
133 * @gpio: The same as for &struct nvec_platform_data 108 * @gpio: The same as for &struct nvec_platform_data