Commit 46505c80 authored by Dmitry Torokhov's avatar Dmitry Torokhov Committed by Greg Kroah-Hartman

Revert "firmware: vpd: remove platform driver"

This reverts commit 7975bd4c, because
VPD relies on driver core to handle deferrals returned by
coreboot_table_find().
Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
Reviewed-by: default avatarGuenter Roeck <groeck@chromium.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 7ae5f10a
...@@ -22,6 +22,8 @@ ...@@ -22,6 +22,8 @@
#include <linux/kobject.h> #include <linux/kobject.h>
#include <linux/list.h> #include <linux/list.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/of_address.h>
#include <linux/platform_device.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/sysfs.h> #include <linux/sysfs.h>
...@@ -277,37 +279,47 @@ static int vpd_sections_init(phys_addr_t physaddr) ...@@ -277,37 +279,47 @@ static int vpd_sections_init(phys_addr_t physaddr)
ret = vpd_section_init("rw", &rw_vpd, ret = vpd_section_init("rw", &rw_vpd,
physaddr + sizeof(struct vpd_cbmem) + physaddr + sizeof(struct vpd_cbmem) +
header.ro_size, header.rw_size); header.ro_size, header.rw_size);
if (ret) { if (ret)
vpd_section_destroy(&ro_vpd);
return ret; return ret;
}
} }
return 0; return 0;
} }
static int __init vpd_platform_init(void) static int vpd_probe(struct platform_device *pdev)
{ {
int ret;
struct lb_cbmem_ref entry; struct lb_cbmem_ref entry;
int err;
ret = coreboot_table_find(CB_TAG_VPD, &entry, sizeof(entry));
if (ret)
return ret;
return vpd_sections_init(entry.cbmem_addr);
}
static struct platform_driver vpd_driver = {
.probe = vpd_probe,
.driver = {
.name = "vpd",
},
};
static int __init vpd_platform_init(void)
{
struct platform_device *pdev;
pdev = platform_device_register_simple("vpd", -1, NULL, 0);
if (IS_ERR(pdev))
return PTR_ERR(pdev);
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;
err = coreboot_table_find(CB_TAG_VPD, &entry, sizeof(entry)); platform_driver_register(&vpd_driver);
if (err)
goto err_kobject_put;
err = vpd_sections_init(entry.cbmem_addr);
if (err)
goto err_kobject_put;
return 0; return 0;
err_kobject_put:
kobject_put(vpd_kobj);
return err;
} }
static void __exit vpd_platform_exit(void) static void __exit vpd_platform_exit(void)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment