Explorar o código

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>
Samuel Holland %!s(int64=7) %!d(string=hai) anos
pai
achega
a43eb6b340
Modificáronse 1 ficheiros con 12 adicións e 31 borrados
  1. 12 31
      drivers/firmware/google/vpd.c

+ 12 - 31
drivers/firmware/google/vpd.c

@@ -286,20 +286,15 @@ static int vpd_sections_init(phys_addr_t physaddr)
 	return 0;
 	return 0;
 }
 }
 
 
-static int vpd_probe(struct platform_device *pdev)
+static int vpd_probe(struct coreboot_device *dev)
 {
 {
 	int ret;
 	int ret;
-	struct lb_cbmem_ref entry;
-
-	ret = coreboot_table_find(CB_TAG_VPD, &entry, sizeof(entry));
-	if (ret)
-		return ret;
 
 
 	vpd_kobj = kobject_create_and_add("vpd", firmware_kobj);
 	vpd_kobj = kobject_create_and_add("vpd", firmware_kobj);
 	if (!vpd_kobj)
 	if (!vpd_kobj)
 		return -ENOMEM;
 		return -ENOMEM;
 
 
-	ret = vpd_sections_init(entry.cbmem_addr);
+	ret = vpd_sections_init(dev->cbmem_ref.cbmem_addr);
 	if (ret) {
 	if (ret) {
 		kobject_put(vpd_kobj);
 		kobject_put(vpd_kobj);
 		return ret;
 		return ret;
@@ -308,7 +303,7 @@ static int vpd_probe(struct platform_device *pdev)
 	return 0;
 	return 0;
 }
 }
 
 
-static int vpd_remove(struct platform_device *pdev)
+static int vpd_remove(struct coreboot_device *dev)
 {
 {
 	vpd_section_destroy(&ro_vpd);
 	vpd_section_destroy(&ro_vpd);
 	vpd_section_destroy(&rw_vpd);
 	vpd_section_destroy(&rw_vpd);
@@ -318,41 +313,27 @@ static int vpd_remove(struct platform_device *pdev)
 	return 0;
 	return 0;
 }
 }
 
 
-static struct platform_driver vpd_driver = {
+static struct coreboot_driver vpd_driver = {
 	.probe = vpd_probe,
 	.probe = vpd_probe,
 	.remove = vpd_remove,
 	.remove = vpd_remove,
-	.driver = {
+	.drv = {
 		.name = "vpd",
 		.name = "vpd",
 	},
 	},
+	.tag = CB_TAG_VPD,
 };
 };
 
 
-static struct platform_device *vpd_pdev;
-
-static int __init vpd_platform_init(void)
+static int __init coreboot_vpd_init(void)
 {
 {
-	int ret;
-
-	ret = platform_driver_register(&vpd_driver);
-	if (ret)
-		return ret;
-
-	vpd_pdev = platform_device_register_simple("vpd", -1, NULL, 0);
-	if (IS_ERR(vpd_pdev)) {
-		platform_driver_unregister(&vpd_driver);
-		return PTR_ERR(vpd_pdev);
-	}
-
-	return 0;
+	return coreboot_driver_register(&vpd_driver);
 }
 }
 
 
-static void __exit vpd_platform_exit(void)
+static void __exit coreboot_vpd_exit(void)
 {
 {
-	platform_device_unregister(vpd_pdev);
-	platform_driver_unregister(&vpd_driver);
+	coreboot_driver_unregister(&vpd_driver);
 }
 }
 
 
-module_init(vpd_platform_init);
-module_exit(vpd_platform_exit);
+module_init(coreboot_vpd_init);
+module_exit(coreboot_vpd_exit);
 
 
 MODULE_AUTHOR("Google, Inc.");
 MODULE_AUTHOR("Google, Inc.");
 MODULE_LICENSE("GPL");
 MODULE_LICENSE("GPL");