Commit 2c6cbdd0ef966cdf5e93ea17475a577dacf44dd7
Committed by
Greg Kroah-Hartman
1 parent
2b8d5e5b39
Exists in
smarc-imx_3.14.28_1.0.0_ga
and in
1 other branch
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>
Showing 2 changed files with 14 additions and 44 deletions Side-by-side Diff
drivers/staging/nvec/nvec.c
... | ... | @@ -33,7 +33,6 @@ |
33 | 33 | #include <linux/mfd/core.h> |
34 | 34 | #include <linux/mutex.h> |
35 | 35 | #include <linux/notifier.h> |
36 | -#include <linux/platform_device.h> | |
37 | 36 | #include <linux/slab.h> |
38 | 37 | #include <linux/spinlock.h> |
39 | 38 | #include <linux/workqueue.h> |
... | ... | @@ -776,7 +775,6 @@ |
776 | 775 | { |
777 | 776 | int err, ret; |
778 | 777 | struct clk *i2c_clk; |
779 | - struct nvec_platform_data *pdata = pdev->dev.platform_data; | |
780 | 778 | struct nvec_chip *nvec; |
781 | 779 | struct nvec_msg *msg; |
782 | 780 | struct resource *res; |
... | ... | @@ -785,6 +783,11 @@ |
785 | 783 | unmute_speakers[] = { NVEC_OEM0, 0x10, 0x59, 0x95 }, |
786 | 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 | 791 | nvec = devm_kzalloc(&pdev->dev, sizeof(struct nvec_chip), GFP_KERNEL); |
789 | 792 | if (nvec == NULL) { |
790 | 793 | dev_err(&pdev->dev, "failed to reserve memory\n"); |
... | ... | @@ -793,23 +796,15 @@ |
793 | 796 | platform_set_drvdata(pdev, nvec); |
794 | 797 | nvec->dev = &pdev->dev; |
795 | 798 | |
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"); | |
813 | 808 | return -ENODEV; |
814 | 809 | } |
815 | 810 |
drivers/staging/nvec/nvec.h
... | ... | @@ -103,31 +103,6 @@ |
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 | - */ | |
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 | - | |
130 | -/** | |
131 | 106 | * struct nvec_chip - A single connection to an NVIDIA Embedded controller |
132 | 107 | * @dev: The device |
133 | 108 | * @gpio: The same as for &struct nvec_platform_data |