From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Wei-Ning Huang <wnhuang@google.com>,
Julius Werner <jwerner@chromium.org>,
Guenter Roeck <groeck@chromium.org>,
linux-kernel@vger.kernel.org
Subject: [PATCH 7/8] firmware: vpd: remove platform driver
Date: Tue, 23 May 2017 17:07:47 -0700 [thread overview]
Message-ID: <20170524000748.39310-7-dmitry.torokhov@gmail.com> (raw)
In-Reply-To: <20170524000748.39310-1-dmitry.torokhov@gmail.com>
There is no reason why VPD should register platform device and driver,
given that we do not use their respective kobjects to attach attributes,
nor do we need suspend/resume hooks, or any other features of device
core.
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
drivers/firmware/google/vpd.c | 44 ++++++++++++++++---------------------------
1 file changed, 16 insertions(+), 28 deletions(-)
diff --git a/drivers/firmware/google/vpd.c b/drivers/firmware/google/vpd.c
index 78945729388e..f4766bf6785a 100644
--- a/drivers/firmware/google/vpd.c
+++ b/drivers/firmware/google/vpd.c
@@ -22,8 +22,6 @@
#include <linux/kobject.h>
#include <linux/list.h>
#include <linux/module.h>
-#include <linux/of_address.h>
-#include <linux/platform_device.h>
#include <linux/slab.h>
#include <linux/sysfs.h>
@@ -279,47 +277,37 @@ static int vpd_sections_init(phys_addr_t physaddr)
ret = vpd_section_init("rw", &rw_vpd,
physaddr + sizeof(struct vpd_cbmem) +
header.ro_size, header.rw_size);
- if (ret)
+ if (ret) {
+ vpd_section_destroy(&ro_vpd);
return ret;
+ }
}
return 0;
}
-static int vpd_probe(struct platform_device *pdev)
-{
- int ret;
- struct lb_cbmem_ref entry;
-
- 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);
+ struct lb_cbmem_ref entry;
+ int err;
vpd_kobj = kobject_create_and_add("vpd", firmware_kobj);
if (!vpd_kobj)
return -ENOMEM;
- platform_driver_register(&vpd_driver);
+ err = coreboot_table_find(CB_TAG_VPD, &entry, sizeof(entry));
+ if (err)
+ goto err_kobject_put;
+
+ err = vpd_sections_init(entry.cbmem_addr);
+ if (err)
+ goto err_kobject_put;
return 0;
+
+err_kobject_put:
+ kobject_put(vpd_kobj);
+ return err;
}
static void __exit vpd_platform_exit(void)
--
2.13.0.219.gdb65acc882-goog
next prev parent reply other threads:[~2017-05-24 0:08 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-24 0:07 [PATCH 1/8] firmware: vpd: do not leave freed section attributes to the list Dmitry Torokhov
2017-05-24 0:07 ` [PATCH 2/8] firmware: vpd: use kdtrndup when copying section key Dmitry Torokhov
2017-05-24 17:13 ` Guenter Roeck
2017-05-24 0:07 ` [PATCH 3/8] firmware: vpd: avoid potential use-after-free when destroying section Dmitry Torokhov
2017-05-24 17:15 ` Guenter Roeck
2017-05-24 0:07 ` [PATCH 4/8] firmware: vpd: do not leak kobjects Dmitry Torokhov
2017-05-24 17:16 ` Guenter Roeck
2017-05-24 0:07 ` [PATCH 5/8] firmware: vpd: use kasprintf() when forming name of 'raw' attribute Dmitry Torokhov
2017-05-24 17:18 ` Guenter Roeck
2017-05-24 0:07 ` [PATCH 6/8] firmware: vpd: do not clear statically allocated data Dmitry Torokhov
2017-05-24 17:19 ` Guenter Roeck
2017-05-24 0:07 ` Dmitry Torokhov [this message]
2017-05-24 17:22 ` [PATCH 7/8] firmware: vpd: remove platform driver Guenter Roeck
2017-05-25 0:04 ` Julius Werner
2017-05-25 2:38 ` Dmitry Torokhov
2017-05-24 0:07 ` [PATCH 8/8] firmware: vpd: fix confusion between memremap and iounmap Dmitry Torokhov
2017-05-24 17:23 ` Guenter Roeck
2017-05-25 13:41 ` Greg Kroah-Hartman
2017-05-24 17:13 ` [PATCH 1/8] firmware: vpd: do not leave freed section attributes to the list Guenter Roeck
2017-05-25 13:40 ` Greg Kroah-Hartman
2017-05-25 16:35 ` Dmitry Torokhov
2017-05-25 16:50 ` 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=20170524000748.39310-7-dmitry.torokhov@gmail.com \
--to=dmitry.torokhov@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=groeck@chromium.org \
--cc=jwerner@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--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
Powered by JetHome