From: Samuel Holland <samuel@sholland.org>
To: linux-kernel@vger.kernel.org,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: coreboot@coreboot.org,
Thierry Escande <thierry.escande@collabora.com>,
Wei-Ning Huang <wnhuang@google.com>,
Julius Werner <jwerner@chromium.org>,
Dmitry Torokhov <dmitry.torokhov@gmail.com>,
Guenter Roeck <linux@roeck-us.net>,
Samuel Holland <samuel@sholland.org>
Subject: [PATCH 3/5] firmware: vpd: Probe via coreboot bus
Date: Wed, 24 Jan 2018 19:41:18 -0600 [thread overview]
Message-ID: <20180125014120.20851-4-samuel@sholland.org> (raw)
In-Reply-To: <20180125014120.20851-1-samuel@sholland.org>
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>
---
drivers/firmware/google/vpd.c | 43 ++++++++++++-------------------------------
1 file changed, 12 insertions(+), 31 deletions(-)
diff --git a/drivers/firmware/google/vpd.c b/drivers/firmware/google/vpd.c
index e4b40f2b4627..e9db895916c3 100644
--- a/drivers/firmware/google/vpd.c
+++ b/drivers/firmware/google/vpd.c
@@ -286,20 +286,15 @@ static int vpd_sections_init(phys_addr_t physaddr)
return 0;
}
-static int vpd_probe(struct platform_device *pdev)
+static int vpd_probe(struct coreboot_device *dev)
{
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);
if (!vpd_kobj)
return -ENOMEM;
- ret = vpd_sections_init(entry.cbmem_addr);
+ ret = vpd_sections_init(dev->cbmem_ref.cbmem_addr);
if (ret) {
kobject_put(vpd_kobj);
return ret;
@@ -308,7 +303,7 @@ static int vpd_probe(struct platform_device *pdev)
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(&rw_vpd);
@@ -318,41 +313,27 @@ static int vpd_remove(struct platform_device *pdev)
return 0;
}
-static struct platform_driver vpd_driver = {
+static struct coreboot_driver vpd_driver = {
.probe = vpd_probe,
.remove = vpd_remove,
- .driver = {
+ .drv = {
.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_LICENSE("GPL");
--
2.13.6
next prev parent reply other threads:[~2018-01-25 1:41 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-25 1:41 [PATCH 0/5] coreboot table bus and framebuffer driver Samuel Holland
2018-01-25 1:41 ` [PATCH 1/5] firmware: coreboot: Expose the coreboot table as a bus Samuel Holland
2018-01-25 1:41 ` [PATCH 2/5] firmware: memconsole: Probe via coreboot bus Samuel Holland
2018-01-25 1:41 ` Samuel Holland [this message]
2018-01-25 1:41 ` [PATCH 4/5] firmware: coreboot: Remove unused coreboot_table_find Samuel Holland
2018-01-25 1:41 ` [PATCH 5/5] firmware: coreboot: Add coreboot framebuffer driver Samuel Holland
2018-03-14 18:08 ` [PATCH 0/5] coreboot table bus and " Greg Kroah-Hartman
2018-03-14 21:18 ` Julius Werner
2018-03-14 21:22 ` Julius Werner
2018-04-23 11:37 ` Greg Kroah-Hartman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180125014120.20851-4-samuel@sholland.org \
--to=samuel@sholland.org \
--cc=coreboot@coreboot.org \
--cc=dmitry.torokhov@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=jwerner@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=thierry.escande@collabora.com \
--cc=wnhuang@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®