Skip to content

Commit a43eb6b

Browse files
smaeulgregkh
authored andcommitted
firmware: vpd: Probe via coreboot bus
Remove the ad-hoc coreboot table search. Now the driver will only be probed when the necessary coreboot table entry has already been found. Furthermore, since the coreboot bus takes care of creating the device, a separate platform device is no longer needed. Signed-off-by: Samuel Holland <samuel@sholland.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 294b2a9 commit a43eb6b

1 file changed

Lines changed: 12 additions & 31 deletions

File tree

  • drivers/firmware/google

‎drivers/firmware/google/vpd.c‎

Lines changed: 12 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -286,20 +286,15 @@ static int vpd_sections_init(phys_addr_t physaddr)
286286
return 0;
287287
}
288288

289-
static int vpd_probe(struct platform_device *pdev)
289+
static int vpd_probe(struct coreboot_device *dev)
290290
{
291291
int ret;
292-
struct lb_cbmem_ref entry;
293-
294-
ret = coreboot_table_find(CB_TAG_VPD, &entry, sizeof(entry));
295-
if (ret)
296-
return ret;
297292

298293
vpd_kobj = kobject_create_and_add("vpd", firmware_kobj);
299294
if (!vpd_kobj)
300295
return -ENOMEM;
301296

302-
ret = vpd_sections_init(entry.cbmem_addr);
297+
ret = vpd_sections_init(dev->cbmem_ref.cbmem_addr);
303298
if (ret) {
304299
kobject_put(vpd_kobj);
305300
return ret;
@@ -308,7 +303,7 @@ static int vpd_probe(struct platform_device *pdev)
308303
return 0;
309304
}
310305

311-
static int vpd_remove(struct platform_device *pdev)
306+
static int vpd_remove(struct coreboot_device *dev)
312307
{
313308
vpd_section_destroy(&ro_vpd);
314309
vpd_section_destroy(&rw_vpd);
@@ -318,41 +313,27 @@ static int vpd_remove(struct platform_device *pdev)
318313
return 0;
319314
}
320315

321-
static struct platform_driver vpd_driver = {
316+
static struct coreboot_driver vpd_driver = {
322317
.probe = vpd_probe,
323318
.remove = vpd_remove,
324-
.driver = {
319+
.drv = {
325320
.name = "vpd",
326321
},
322+
.tag = CB_TAG_VPD,
327323
};
328324

329-
static struct platform_device *vpd_pdev;
330-
331-
static int __init vpd_platform_init(void)
325+
static int __init coreboot_vpd_init(void)
332326
{
333-
int ret;
334-
335-
ret = platform_driver_register(&vpd_driver);
336-
if (ret)
337-
return ret;
338-
339-
vpd_pdev = platform_device_register_simple("vpd", -1, NULL, 0);
340-
if (IS_ERR(vpd_pdev)) {
341-
platform_driver_unregister(&vpd_driver);
342-
return PTR_ERR(vpd_pdev);
343-
}
344-
345-
return 0;
327+
return coreboot_driver_register(&vpd_driver);
346328
}
347329

348-
static void __exit vpd_platform_exit(void)
330+
static void __exit coreboot_vpd_exit(void)
349331
{
350-
platform_device_unregister(vpd_pdev);
351-
platform_driver_unregister(&vpd_driver);
332+
coreboot_driver_unregister(&vpd_driver);
352333
}
353334

354-
module_init(vpd_platform_init);
355-
module_exit(vpd_platform_exit);
335+
module_init(coreboot_vpd_init);
336+
module_exit(coreboot_vpd_exit);
356337

357338
MODULE_AUTHOR("Google, Inc.");
358339
MODULE_LICENSE("GPL");

0 commit comments

Comments
 (0)