From: Benjamin Wheeler <benjaminwheeler0510@gmail.com>
To: srimanachanta@gmail.com
Cc: bentiss@kernel.org, jikos@kernel.org,
linux-input@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 3/3] HID: steelseries: Use device data for battery requests
Date: Tue, 20 Jan 2026 15:02:02 -0500 [thread overview]
Message-ID: <20260120200202.1225216-4-benjaminwheeler0510@gmail.com> (raw)
In-Reply-To: <20260120200202.1225216-1-benjaminwheeler0510@gmail.com>
This eliminates several functions that are no longer needed.
When making a battery request, the required data to do so is simply
pulled from the device struct.
Signed-off-by: Benjamin Wheeler <benjaminwheeler0510@gmail.com>
---
drivers/hid/hid-steelseries.c | 93 +++++------------------------------
1 file changed, 11 insertions(+), 82 deletions(-)
diff --git a/drivers/hid/hid-steelseries.c b/drivers/hid/hid-steelseries.c
index dabc4763f072..1200213bc8f3 100644
--- a/drivers/hid/hid-steelseries.c
+++ b/drivers/hid/hid-steelseries.c
@@ -809,44 +809,17 @@ static enum power_supply_property steelseries_battery_props[] = {
POWER_SUPPLY_PROP_CAPACITY_LEVEL,
};
-/* Forward declarations for battery request functions */
-static int steelseries_arctis_1_request_battery(struct hid_device *hdev);
-static int steelseries_arctis_7_plus_request_battery(struct hid_device *hdev);
-static int steelseries_arctis_9_request_battery(struct hid_device *hdev);
-static int steelseries_arctis_nova_request_battery(struct hid_device *hdev);
-static int steelseries_arctis_nova_3p_request_battery(struct hid_device *hdev);
-static int
-steelseries_arctis_pro_wireless_request_battery(struct hid_device *hdev);
+static int __steelseries_send_report(struct hid_device *const hdev,
+ const u8 *const data, const size_t len,
+ const enum hid_report_type type);
-static int steelseries_request_battery(struct hid_device *hdev)
+static int
+steelseries_request_battery(const struct steelseries_device *const sd)
{
- u16 product = hdev->product;
-
- /* Route to device-specific battery request handler */
- if (product == USB_DEVICE_ID_STEELSERIES_ARCTIS_1 ||
- product == USB_DEVICE_ID_STEELSERIES_ARCTIS_1_X ||
- product == USB_DEVICE_ID_STEELSERIES_ARCTIS_7_P ||
- product == USB_DEVICE_ID_STEELSERIES_ARCTIS_7_X)
- return steelseries_arctis_1_request_battery(hdev);
-
- if (product == USB_DEVICE_ID_STEELSERIES_ARCTIS_7_PLUS ||
- product == USB_DEVICE_ID_STEELSERIES_ARCTIS_7_PLUS_P ||
- product == USB_DEVICE_ID_STEELSERIES_ARCTIS_7_PLUS_X ||
- product == USB_DEVICE_ID_STEELSERIES_ARCTIS_7_PLUS_DESTINY)
- return steelseries_arctis_7_plus_request_battery(hdev);
-
- if (product == USB_DEVICE_ID_STEELSERIES_ARCTIS_9)
- return steelseries_arctis_9_request_battery(hdev);
-
- if (product == USB_DEVICE_ID_STEELSERIES_ARCTIS_PRO)
- return steelseries_arctis_pro_wireless_request_battery(hdev);
-
- if (product == USB_DEVICE_ID_STEELSERIES_ARCTIS_NOVA_3_P ||
- product == USB_DEVICE_ID_STEELSERIES_ARCTIS_NOVA_3_X)
- return steelseries_arctis_nova_3p_request_battery(hdev);
-
- /* All other Nova series use the same battery request */
- return steelseries_arctis_nova_request_battery(hdev);
+ const struct steelseries_report_data *const report_data =
+ sd->info->report_data; // Alias
+ return __steelseries_send_report(sd->hdev, report_data->data,
+ report_data->len, report_data->type);
}
static void steelseries_battery_timer_tick(struct work_struct *work)
@@ -854,7 +827,7 @@ static void steelseries_battery_timer_tick(struct work_struct *work)
struct steelseries_device *sd = container_of(
work, struct steelseries_device, battery_work.work);
- steelseries_request_battery(sd->hdev);
+ steelseries_request_battery(sd);
}
static int steelseries_battery_register(struct steelseries_device *sd)
@@ -895,7 +868,7 @@ static int steelseries_battery_register(struct steelseries_device *sd)
power_supply_powers(sd->battery, &sd->hdev->dev);
INIT_DELAYED_WORK(&sd->battery_work, steelseries_battery_timer_tick);
- steelseries_request_battery(sd->hdev);
+ steelseries_request_battery(sd);
/* Arctis 9 may need a retry */
if (sd->hdev->product == USB_DEVICE_ID_STEELSERIES_ARCTIS_9) {
@@ -1685,50 +1658,6 @@ static const struct attribute_group steelseries_attr_group = {
.is_visible = steelseries_attr_is_visible,
};
-static int steelseries_arctis_1_request_battery(struct hid_device *hdev)
-{
- const u8 data[] = { 0x06, 0x12 };
-
- return steelseries_send_feature_report(hdev, data, sizeof(data));
-}
-
-static int steelseries_arctis_7_plus_request_battery(struct hid_device *hdev)
-{
- const u8 data[] = { 0x00, 0xb0 };
-
- return steelseries_send_output_report(hdev, data, sizeof(data));
-}
-
-static int steelseries_arctis_9_request_battery(struct hid_device *hdev)
-{
- const u8 data[] = { 0x00, 0x20 };
-
- return steelseries_send_feature_report(hdev, data, sizeof(data));
-}
-
-static int steelseries_arctis_nova_request_battery(struct hid_device *hdev)
-{
- const u8 data[] = { 0x00, 0xb0 };
-
- return steelseries_send_output_report(hdev, data, sizeof(data));
-}
-
-static int steelseries_arctis_nova_3p_request_battery(struct hid_device *hdev)
-{
- const u8 data[] = { 0xb0 };
-
- return steelseries_send_output_report(hdev, data, sizeof(data));
-}
-
-static int
-steelseries_arctis_pro_wireless_request_battery(struct hid_device *hdev)
-{
- /* Request battery - response will arrive asynchronously via raw_event */
- const u8 data[] = { 0x40, 0xAA };
-
- return steelseries_send_output_report(hdev, data, sizeof(data));
-}
-
static int steelseries_raw_event(struct hid_device *hdev,
struct hid_report *report, u8 *data, int size)
{
--
2.52.0
prev parent reply other threads:[~2026-01-20 20:02 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-12 4:19 [PATCH v2 0/4] HID: steelseries: Add support for Arctis headset lineup Sriman Achanta
2026-01-12 4:19 ` [PATCH v2 1/4] HID: hid-ids: Add SteelSeries Arctis headset device IDs Sriman Achanta
2026-01-12 13:08 ` Bastien Nocera
2026-01-12 4:19 ` [PATCH v2 2/4] HID: quirks: Add INPUT_CONFIGURED quirk for SteelSeries Arctis headsets Sriman Achanta
2026-01-12 13:08 ` Bastien Nocera
2026-01-12 4:19 ` [PATCH v2 3/4] Documentation: ABI: Document SteelSeries headset sysfs attributes Sriman Achanta
2026-01-12 13:08 ` Bastien Nocera
2026-01-12 4:19 ` [PATCH v2 4/4] HID: steelseries: Add support for Arctis headset lineup Sriman Achanta
2026-01-12 13:09 ` Bastien Nocera
[not found] ` <CABMjph80yxmXnZjLgUrhFN7cKf2P=VjWF0rfWxG0rYOa42f5eQ@mail.gmail.com>
[not found] ` <e5b256fa8da7fe079f3e3b10a1b0b6a0faf8e913.camel@hadess.net>
[not found] ` <CABMjph9TzmCfks0OEtCx4gFFe0pKOccBwVutq6dVH2DhzSC5vA@mail.gmail.com>
2026-02-26 10:01 ` Bastien Nocera
2026-01-20 19:01 ` [PATCH v2 0/4] " Benjamin Wheeler
2026-01-20 20:01 ` [PATCH 0/3] HID: steelseries: clean up functions, move battery request data to structs Benjamin Wheeler
2026-01-20 20:02 ` [PATCH 1/3] HID: steelseries: Clean up hid send_report functions Benjamin Wheeler
2026-01-20 20:02 ` [PATCH 2/3] HID: steelseries: Add battery request info (byte flags) to device info Benjamin Wheeler
2026-01-20 20:02 ` Benjamin Wheeler [this message]
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=20260120200202.1225216-4-benjaminwheeler0510@gmail.com \
--to=benjaminwheeler0510@gmail.com \
--cc=bentiss@kernel.org \
--cc=jikos@kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=srimanachanta@gmail.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