diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2018-06-05 19:20:22 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2018-06-05 19:20:22 -0400 |
commit | abf7dba7c4f77d781f6df50fefb19a64c5dc331f (patch) | |
tree | 38648731b502d5aec508f3b33f6616190e598eb6 /drivers/firmware/google/memconsole-coreboot.c | |
parent | 07c4dd3435aa387d3b58f4e941dc516513f14507 (diff) | |
parent | b23220fe054e92f616b82450fae8cd3ab176cc60 (diff) |
Merge tag 'char-misc-4.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc
Pull char/misc driver updates from Greg KH:
"Here is the "big" char and misc driver patches for 4.18-rc1.
It's not a lot of stuff here, but there are some highlights:
- coreboot driver updates
- soundwire driver updates
- android binder updates
- fpga big sync, mostly documentation
- lots of minor driver updates
All of these have been in linux-next for a while with no reported
issues"
* tag 'char-misc-4.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: (81 commits)
vmw_balloon: fixing double free when batching mode is off
MAINTAINERS: Add driver-api/fpga path
fpga: clarify that unregister functions also free
documentation: fpga: move fpga-region.txt to driver-api
documentation: fpga: add bridge document to driver-api
documentation: fpga: move fpga-mgr.txt to driver-api
Documentation: fpga: move fpga overview to driver-api
fpga: region: kernel-doc fixes
fpga: bridge: kernel-doc fixes
fpga: mgr: kernel-doc fixes
fpga: use SPDX
fpga: region: change api, add fpga_region_create/free
fpga: bridge: change api, don't use drvdata
fpga: manager: change api, don't use drvdata
fpga: region: don't use drvdata in common fpga code
Drivers: hv: vmbus: Removed an unnecessary cast from void *
ver_linux: Drop redundant calls to system() to test if file is readable
ver_linux: Move stderr redirection from function parameter to function body
misc: IBM Virtual Management Channel Driver (VMC)
rpmsg: Correct support for MODULE_DEVICE_TABLE()
...
Diffstat (limited to 'drivers/firmware/google/memconsole-coreboot.c')
-rw-r--r-- | drivers/firmware/google/memconsole-coreboot.c | 49 |
1 files changed, 17 insertions, 32 deletions
diff --git a/drivers/firmware/google/memconsole-coreboot.c b/drivers/firmware/google/memconsole-coreboot.c index 52738887735c..b29e10757bfb 100644 --- a/drivers/firmware/google/memconsole-coreboot.c +++ b/drivers/firmware/google/memconsole-coreboot.c | |||
@@ -15,9 +15,9 @@ | |||
15 | * GNU General Public License for more details. | 15 | * GNU General Public License for more details. |
16 | */ | 16 | */ |
17 | 17 | ||
18 | #include <linux/device.h> | ||
18 | #include <linux/kernel.h> | 19 | #include <linux/kernel.h> |
19 | #include <linux/module.h> | 20 | #include <linux/module.h> |
20 | #include <linux/platform_device.h> | ||
21 | 21 | ||
22 | #include "memconsole.h" | 22 | #include "memconsole.h" |
23 | #include "coreboot_table.h" | 23 | #include "coreboot_table.h" |
@@ -73,18 +73,19 @@ static ssize_t memconsole_coreboot_read(char *buf, loff_t pos, size_t count) | |||
73 | return done; | 73 | return done; |
74 | } | 74 | } |
75 | 75 | ||
76 | static int memconsole_coreboot_init(phys_addr_t physaddr) | 76 | static int memconsole_probe(struct coreboot_device *dev) |
77 | { | 77 | { |
78 | struct cbmem_cons __iomem *tmp_cbmc; | 78 | struct cbmem_cons __iomem *tmp_cbmc; |
79 | 79 | ||
80 | tmp_cbmc = memremap(physaddr, sizeof(*tmp_cbmc), MEMREMAP_WB); | 80 | tmp_cbmc = memremap(dev->cbmem_ref.cbmem_addr, |
81 | sizeof(*tmp_cbmc), MEMREMAP_WB); | ||
81 | 82 | ||
82 | if (!tmp_cbmc) | 83 | if (!tmp_cbmc) |
83 | return -ENOMEM; | 84 | return -ENOMEM; |
84 | 85 | ||
85 | /* Read size only once to prevent overrun attack through /dev/mem. */ | 86 | /* Read size only once to prevent overrun attack through /dev/mem. */ |
86 | cbmem_console_size = tmp_cbmc->size_dont_access_after_boot; | 87 | cbmem_console_size = tmp_cbmc->size_dont_access_after_boot; |
87 | cbmem_console = memremap(physaddr, | 88 | cbmem_console = memremap(dev->cbmem_ref.cbmem_addr, |
88 | cbmem_console_size + sizeof(*cbmem_console), | 89 | cbmem_console_size + sizeof(*cbmem_console), |
89 | MEMREMAP_WB); | 90 | MEMREMAP_WB); |
90 | memunmap(tmp_cbmc); | 91 | memunmap(tmp_cbmc); |
@@ -93,26 +94,11 @@ static int memconsole_coreboot_init(phys_addr_t physaddr) | |||
93 | return -ENOMEM; | 94 | return -ENOMEM; |
94 | 95 | ||
95 | memconsole_setup(memconsole_coreboot_read); | 96 | memconsole_setup(memconsole_coreboot_read); |
96 | return 0; | ||
97 | } | ||
98 | |||
99 | static int memconsole_probe(struct platform_device *pdev) | ||
100 | { | ||
101 | int ret; | ||
102 | struct lb_cbmem_ref entry; | ||
103 | |||
104 | ret = coreboot_table_find(CB_TAG_CBMEM_CONSOLE, &entry, sizeof(entry)); | ||
105 | if (ret) | ||
106 | return ret; | ||
107 | |||
108 | ret = memconsole_coreboot_init(entry.cbmem_addr); | ||
109 | if (ret) | ||
110 | return ret; | ||
111 | 97 | ||
112 | return memconsole_sysfs_init(); | 98 | return memconsole_sysfs_init(); |
113 | } | 99 | } |
114 | 100 | ||
115 | static int memconsole_remove(struct platform_device *pdev) | 101 | static int memconsole_remove(struct coreboot_device *dev) |
116 | { | 102 | { |
117 | memconsole_exit(); | 103 | memconsole_exit(); |
118 | 104 | ||
@@ -122,28 +108,27 @@ static int memconsole_remove(struct platform_device *pdev) | |||
122 | return 0; | 108 | return 0; |
123 | } | 109 | } |
124 | 110 | ||
125 | static struct platform_driver memconsole_driver = { | 111 | static struct coreboot_driver memconsole_driver = { |
126 | .probe = memconsole_probe, | 112 | .probe = memconsole_probe, |
127 | .remove = memconsole_remove, | 113 | .remove = memconsole_remove, |
128 | .driver = { | 114 | .drv = { |
129 | .name = "memconsole", | 115 | .name = "memconsole", |
130 | }, | 116 | }, |
117 | .tag = CB_TAG_CBMEM_CONSOLE, | ||
131 | }; | 118 | }; |
132 | 119 | ||
133 | static int __init platform_memconsole_init(void) | 120 | static void coreboot_memconsole_exit(void) |
134 | { | 121 | { |
135 | struct platform_device *pdev; | 122 | coreboot_driver_unregister(&memconsole_driver); |
136 | 123 | } | |
137 | pdev = platform_device_register_simple("memconsole", -1, NULL, 0); | ||
138 | if (IS_ERR(pdev)) | ||
139 | return PTR_ERR(pdev); | ||
140 | |||
141 | platform_driver_register(&memconsole_driver); | ||
142 | 124 | ||
143 | return 0; | 125 | static int __init coreboot_memconsole_init(void) |
126 | { | ||
127 | return coreboot_driver_register(&memconsole_driver); | ||
144 | } | 128 | } |
145 | 129 | ||
146 | module_init(platform_memconsole_init); | 130 | module_exit(coreboot_memconsole_exit); |
131 | module_init(coreboot_memconsole_init); | ||
147 | 132 | ||
148 | MODULE_AUTHOR("Google, Inc."); | 133 | MODULE_AUTHOR("Google, Inc."); |
149 | MODULE_LICENSE("GPL"); | 134 | MODULE_LICENSE("GPL"); |