Skip to content

Commit 2c6cbdd

Browse files
marvintwentyfourgregkh
authored andcommitted
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>
1 parent 2b8d5e5 commit 2c6cbdd

2 files changed

Lines changed: 14 additions & 44 deletions

File tree

‎drivers/staging/nvec/nvec.c‎

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
#include <linux/mfd/core.h>
3434
#include <linux/mutex.h>
3535
#include <linux/notifier.h>
36-
#include <linux/platform_device.h>
3736
#include <linux/slab.h>
3837
#include <linux/spinlock.h>
3938
#include <linux/workqueue.h>
@@ -776,7 +775,6 @@ static int tegra_nvec_probe(struct platform_device *pdev)
776775
{
777776
int err, ret;
778777
struct clk *i2c_clk;
779-
struct nvec_platform_data *pdata = pdev->dev.platform_data;
780778
struct nvec_chip *nvec;
781779
struct nvec_msg *msg;
782780
struct resource *res;
@@ -785,6 +783,11 @@ static int tegra_nvec_probe(struct platform_device *pdev)
785783
unmute_speakers[] = { NVEC_OEM0, 0x10, 0x59, 0x95 },
786784
enable_event[7] = { NVEC_SYS, CNF_EVENT_REPORTING, true };
787785

786+
if(!pdev->dev.of_node) {
787+
dev_err(&pdev->dev, "must be instantiated using device tree\n");
788+
return -ENODEV;
789+
}
790+
788791
nvec = devm_kzalloc(&pdev->dev, sizeof(struct nvec_chip), GFP_KERNEL);
789792
if (nvec == NULL) {
790793
dev_err(&pdev->dev, "failed to reserve memory\n");
@@ -793,23 +796,15 @@ static int tegra_nvec_probe(struct platform_device *pdev)
793796
platform_set_drvdata(pdev, nvec);
794797
nvec->dev = &pdev->dev;
795798

796-
if (pdata) {
797-
nvec->gpio = pdata->gpio;
798-
nvec->i2c_addr = pdata->i2c_addr;
799-
} else if (nvec->dev->of_node) {
800-
nvec->gpio = of_get_named_gpio(nvec->dev->of_node,
801-
"request-gpios", 0);
802-
if (nvec->gpio < 0) {
803-
dev_err(&pdev->dev, "no gpio specified");
804-
return -ENODEV;
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");
799+
nvec->gpio = of_get_named_gpio(nvec->dev->of_node, "request-gpios", 0);
800+
if (nvec->gpio < 0) {
801+
dev_err(&pdev->dev, "no gpio specified");
802+
return -ENODEV;
803+
}
804+
805+
if (of_property_read_u32(nvec->dev->of_node, "slave-addr",
806+
&nvec->i2c_addr)) {
807+
dev_err(&pdev->dev, "no i2c address specified");
813808
return -ENODEV;
814809
}
815810

‎drivers/staging/nvec/nvec.h‎

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -102,31 +102,6 @@ struct nvec_msg {
102102
atomic_t used;
103103
};
104104

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-
*/
111-
struct 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-
*/
125-
struct nvec_platform_data {
126-
int i2c_addr;
127-
int gpio;
128-
};
129-
130105
/**
131106
* struct nvec_chip - A single connection to an NVIDIA Embedded controller
132107
* @dev: The device

0 commit comments

Comments
 (0)