[PATCH 2/9] firmware: meson: simplify getting .driver_data

Wolfram Sang wsa+renesas at sang-engineering.com
Mon Sep 20 02:05:14 PDT 2021


We should get 'driver_data' from 'struct device' directly. Going via
platform_device is an unneeded step back and forth.

Signed-off-by: Wolfram Sang <wsa+renesas at sang-engineering.com>
---

Build tested only. buildbot is happy.

 drivers/firmware/meson/meson_sm.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/firmware/meson/meson_sm.c b/drivers/firmware/meson/meson_sm.c
index 77aa5c6398aa..714016e3aab3 100644
--- a/drivers/firmware/meson/meson_sm.c
+++ b/drivers/firmware/meson/meson_sm.c
@@ -240,12 +240,11 @@ EXPORT_SYMBOL_GPL(meson_sm_get);
 static ssize_t serial_show(struct device *dev, struct device_attribute *attr,
 			 char *buf)
 {
-	struct platform_device *pdev = to_platform_device(dev);
 	struct meson_sm_firmware *fw;
 	uint8_t *id_buf;
 	int ret;
 
-	fw = platform_get_drvdata(pdev);
+	fw = dev_get_drvdata(dev);
 
 	id_buf = kmalloc(SM_CHIP_ID_LENGTH, GFP_KERNEL);
 	if (!id_buf)
-- 
2.30.2




More information about the linux-amlogic mailing list