[PATCH 06/26] Input: maplecontrol - simplify maple_device retrieval in open/close
From: Dmitry Torokhov
Date: Sat Jul 04 2026 - 01:58:08 EST
Instead of passing the dc_pad structure via platform_data to the
input device to retrieve the maple_device in open/close, store the
maple_device pointer in the input device's private data (drvdata)
and use input_get_drvdata() to retrieve it.
This allows us to remove the platform_data assignment in probe.
Assisted-by: Antigravity:gemini-3.5-flash
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@xxxxxxxxx>
---
drivers/input/joystick/maplecontrol.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/input/joystick/maplecontrol.c b/drivers/input/joystick/maplecontrol.c
index c66b2614e298..9d623c9e8f22 100644
--- a/drivers/input/joystick/maplecontrol.c
+++ b/drivers/input/joystick/maplecontrol.c
@@ -62,19 +62,19 @@ static void dc_pad_callback(struct mapleq *mq)
static int dc_pad_open(struct input_dev *dev)
{
- struct dc_pad *pad = dev_get_platdata(&dev->dev);
+ struct maple_device *mdev = input_get_drvdata(dev);
- maple_getcond_callback(pad->mdev, dc_pad_callback, HZ/20,
- MAPLE_FUNC_CONTROLLER);
+ maple_getcond_callback(mdev, dc_pad_callback, HZ / 20,
+ MAPLE_FUNC_CONTROLLER);
return 0;
}
static void dc_pad_close(struct input_dev *dev)
{
- struct dc_pad *pad = dev_get_platdata(&dev->dev);
+ struct maple_device *mdev = input_get_drvdata(dev);
- maple_getcond_callback(pad->mdev, NULL, 0, MAPLE_FUNC_CONTROLLER);
+ maple_getcond_callback(mdev, NULL, 0, MAPLE_FUNC_CONTROLLER);
}
/* allow the controller to be used */
@@ -112,6 +112,7 @@ static int probe_maple_controller(struct device *dev)
pad->mdev = mdev;
maple_set_drvdata(mdev, pad);
+ input_set_drvdata(idev, mdev);
idev->open = dc_pad_open;
idev->close = dc_pad_close;
@@ -130,7 +131,6 @@ static int probe_maple_controller(struct device *dev)
if (idev->keybit[BIT_WORD(BTN_JOYSTICK)])
idev->evbit[0] |= BIT_MASK(EV_KEY);
- idev->dev.platform_data = pad;
idev->dev.parent = &mdev->dev;
idev->name = mdev->product_name;
idev->id.bustype = BUS_HOST;
--
2.55.0.rc0.799.gd6f94ed593-goog