From nobody Mon Feb 9 00:54:59 2026 Received: from mail-qk1-f181.google.com (mail-qk1-f181.google.com [209.85.222.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1EACD3A35AC for ; Tue, 20 Jan 2026 20:02:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768939333; cv=none; b=Kku/rOPeCAT/kytlqpSMKwWFqKjT1f/5HaYEJlret+VKzoBOOjN9zzS3ZxbnAX7fSTwl+d7f3fKu7XL1773qPGe3UovpXGcFKHYxGKjcqh+fqqRCkuSYcu1tO54u1EOhGyEjAX2lC/haUxX8yq61qgzTN78Ie6Lx7EqZl5rQxLE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768939333; c=relaxed/simple; bh=s3MFiEXE/Shhm2XnisHmzrG0GP1tx5iDWolDoOrDhu0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=NaKdvIoWGguugfdjrRTtxF7uP+cH+sVHmqOBetVxeWHWxCNhlX0K57wqalDXBIplJ1tKE8O/pik7vOXM2olAk0KT13j15MKUZCvyrVT2UhGv4quaVwZRo0ARjASv77WZCykvcB3QzpguP15gsxXePuz1/0P34LOjVvwee782eEo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=H4PIdRx1; arc=none smtp.client-ip=209.85.222.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="H4PIdRx1" Received: by mail-qk1-f181.google.com with SMTP id af79cd13be357-8c5265d06c3so20604385a.1 for ; Tue, 20 Jan 2026 12:02:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1768939328; x=1769544128; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=eOI2obtzi7kytuUVUqjlq8TnMN+hzrsORj4dJl4sJSc=; b=H4PIdRx1RgvxV9KPM3OFJWx+S+8mIkhp4Rj2L/pJvMdvpKi1Amn5NQotggTh649R15 noe5N/JRuqKAzhYmCfo4J32d+d+6W1Hb1N2ptUn5A53dHx5L/LwSrYIYprbLfLjQvDOw ySfnGUVkmzd6S4OoNsEAwLCScNadT8cPz/PHAZrfWowwREjiTjbBwnOaPxj5ve8Wr7Qr qCZnUz6dVni0aPyyqN2/S1Yhs2h1akSEmPThUVAlAGnxe2vUh3VCSMJN07Wzloc/21FV EpJPzP4WBwLhhqUs9jwYV92ea5AnNAqBf/NjYDNtEF1yKCJegb4nyW6C2wUV/C8kOfBT 7xnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1768939328; x=1769544128; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=eOI2obtzi7kytuUVUqjlq8TnMN+hzrsORj4dJl4sJSc=; b=eq6TmyaapZUFoq6iCNkaI2KpyDMPOxa0OOR1Ay9zmVqWwPL16deJCy33TL9LfsydVL 2gbh5tK20Air5JKx71fY29R2eQZI7bbO4JaINbzMo8/G4kcoKrlNuHxopHv/KPIWLWm9 XcimEbO5DorvBo3ZQk522n1evXTvxMtIoa3dzDTRGOV94aS9bst+tUX0yfPqeSuVgN4O vxenFAk7Wdsk5mSms3yqTTYmGh6d0LsINf460uwk8RsI2eQRnevV4nUMjiqzodbtwpf2 QKivZNiMdwaRJCUftNpCBbp9PeD8jJcNWRhPXRmKA7xfCF5b++QzfrPlUIkdIpp6PtuR QLOA== X-Forwarded-Encrypted: i=1; AJvYcCUp7QBYu0iCtP2csBqQvJey/m8euWTNfcRXpq5jfgJO2ii41sGMVz0E/EjokFZtydQ0R2YseFsSeN7OetA=@vger.kernel.org X-Gm-Message-State: AOJu0YxJPoLqKTwUOGg8cgy6bDGjKX6TtoPcZqTV30KDA0PxhLbduEgx AZJDYh+xVvUXAz6iUEwVwTkTacgQvtrMA3chZ3XYpXxgcK7xs0htrOzYU5QJ0g== X-Gm-Gg: AY/fxX5PC7uvvidS3bDRtvT3v8WMk5luFt3CN53YW/0Scn8M+d82XT1jVeSOejgNbcp RzD5fqNfGG5uv0rvwC5iYsBz1u161OLew138r4I5FPeAHpeDfPYaPsNasLn9HSI67IcY2O/yfLD BdE+nrZpurW1rfxpu8Q4NHSGTVC3tzFG9JmMDOXMEYqw/KB8oYYvupl3DWocCdOr6TR2lHx6QRW TmC1OmkuclIjAZLmiPc5mCe4ZdY5b5Z9M4ffsVeCvV0RYEDfUxKGw7v7MBjOXvrj1xs969EzYbx IK4GjuFdj78L+5gma6xtw96OawrbSCECyxT7h023XsllgqLuLPkVluRV0ykNEKyfNr1oHVJjJQT iR7PtM5WAsPfdRrA75wohElJEbAUFMlKMmXmhZ77BuWMcy+ebhhydHqpKpqTjaIeIpqrhAJXkUt ayaPbDbpSRkKkL+ux6ve5Tx11ZVRQkeB50U2e5mjb3+a/3Pfanz8JenplF9kfPo5pLh3TgXg== X-Received: by 2002:a05:620a:7103:b0:8c5:36be:7c20 with SMTP id af79cd13be357-8c589b84dadmr2456896585a.3.1768939327680; Tue, 20 Jan 2026 12:02:07 -0800 (PST) Received: from benjamin-desktop-fedora.mynetworksettings.com ([141.154.77.127]) by smtp.gmail.com with ESMTPSA id af79cd13be357-8c6a7298472sm1112863585a.53.2026.01.20.12.02.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Jan 2026 12:02:07 -0800 (PST) From: Benjamin Wheeler 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 Message-ID: <20260120200202.1225216-4-benjaminwheeler0510@gmail.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260120200202.1225216-1-benjaminwheeler0510@gmail.com> References: <20260112041941.40531-1-srimanachanta@gmail.com> <20260120200202.1225216-1-benjaminwheeler0510@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 --- 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[] =3D { POWER_SUPPLY_PROP_CAPACITY_LEVEL, }; =20 -/* 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 *hd= ev); -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 *h= dev); -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); =20 -static int steelseries_request_battery(struct hid_device *hdev) +static int +steelseries_request_battery(const struct steelseries_device *const sd) { - u16 product =3D hdev->product; - - /* Route to device-specific battery request handler */ - if (product =3D=3D USB_DEVICE_ID_STEELSERIES_ARCTIS_1 || - product =3D=3D USB_DEVICE_ID_STEELSERIES_ARCTIS_1_X || - product =3D=3D USB_DEVICE_ID_STEELSERIES_ARCTIS_7_P || - product =3D=3D USB_DEVICE_ID_STEELSERIES_ARCTIS_7_X) - return steelseries_arctis_1_request_battery(hdev); - - if (product =3D=3D USB_DEVICE_ID_STEELSERIES_ARCTIS_7_PLUS || - product =3D=3D USB_DEVICE_ID_STEELSERIES_ARCTIS_7_PLUS_P || - product =3D=3D USB_DEVICE_ID_STEELSERIES_ARCTIS_7_PLUS_X || - product =3D=3D USB_DEVICE_ID_STEELSERIES_ARCTIS_7_PLUS_DESTINY) - return steelseries_arctis_7_plus_request_battery(hdev); - - if (product =3D=3D USB_DEVICE_ID_STEELSERIES_ARCTIS_9) - return steelseries_arctis_9_request_battery(hdev); - - if (product =3D=3D USB_DEVICE_ID_STEELSERIES_ARCTIS_PRO) - return steelseries_arctis_pro_wireless_request_battery(hdev); - - if (product =3D=3D USB_DEVICE_ID_STEELSERIES_ARCTIS_NOVA_3_P || - product =3D=3D 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 =3D + sd->info->report_data; // Alias + return __steelseries_send_report(sd->hdev, report_data->data, + report_data->len, report_data->type); } =20 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 =3D container_of( work, struct steelseries_device, battery_work.work); =20 - steelseries_request_battery(sd->hdev); + steelseries_request_battery(sd); } =20 static int steelseries_battery_register(struct steelseries_device *sd) @@ -895,7 +868,7 @@ static int steelseries_battery_register(struct steelser= ies_device *sd) power_supply_powers(sd->battery, &sd->hdev->dev); =20 INIT_DELAYED_WORK(&sd->battery_work, steelseries_battery_timer_tick); - steelseries_request_battery(sd->hdev); + steelseries_request_battery(sd); =20 /* Arctis 9 may need a retry */ if (sd->hdev->product =3D=3D USB_DEVICE_ID_STEELSERIES_ARCTIS_9) { @@ -1685,50 +1658,6 @@ static const struct attribute_group steelseries_attr= _group =3D { .is_visible =3D steelseries_attr_is_visible, }; =20 -static int steelseries_arctis_1_request_battery(struct hid_device *hdev) -{ - const u8 data[] =3D { 0x06, 0x12 }; - - return steelseries_send_feature_report(hdev, data, sizeof(data)); -} - -static int steelseries_arctis_7_plus_request_battery(struct hid_device *hd= ev) -{ - const u8 data[] =3D { 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[] =3D { 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[] =3D { 0x00, 0xb0 }; - - return steelseries_send_output_report(hdev, data, sizeof(data)); -} - -static int steelseries_arctis_nova_3p_request_battery(struct hid_device *h= dev) -{ - const u8 data[] =3D { 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[] =3D { 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) { --=20 2.52.0