From patchwork Thu Feb 1 11:53:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 13540929 X-Patchwork-Delegate: jikos@jikos.cz Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0B18615D5D3; Thu, 1 Feb 2024 11:53:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706788407; cv=none; b=NPA58JAfAED8npPL3F74wJ5Ms5MVtaMdpBz4xwlbCSRvI95tgXUuRBedF3fZJ+50mQlDiZRBWAqCngZoGA5lfRQ7zqdsHu7XQjndz+QCT30g92lszC+3MYFjBIWr1DV1N1bTYoiAm443V7vIukvIRtxxQ93dwdlfxNyznbJ2W9c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706788407; c=relaxed/simple; bh=PDYxQCUZCAsEiRe/Tu00xGBkJEs17Kao85ABA/4E6Lk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=H6KfrL2sJdgtyahgP0r6tqiLFFQrTsqE7NnmHyh+tD9JBXBx0fu/SiJzY7fcLdpF7bX8wZGx44kQlOKNuhxc+5IoaiYnvoLnHZ9ROVTBVIqGXurOWEMQQCPVY6upod55HMfVWQYw/NychkNhSe7EY4a6V//S/DX9mJKtXW1rZpA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=aY6gtS1i; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="aY6gtS1i" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B83DEC43394; Thu, 1 Feb 2024 11:53:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1706788406; bh=PDYxQCUZCAsEiRe/Tu00xGBkJEs17Kao85ABA/4E6Lk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aY6gtS1iITIj11OBDRVD94Kzzg1MjAWqHY/VKBiof1s45yUxpxM+qv8lociQJ2ywy tEC/2K7eiesQsqFoyPVnAJv9NKEhLc/iPy6niD6pdwAHZvBLRiubp97DYpSLc1uhRs 5Fl8dLCj7SYRcagcaP8EJ6W20VpFs3ipoNhDnxLTO7XfispCGKfKOp5f197UJkhCr0 L//Y0LMrPmfBdijQSZoNt5uvCtLFc9VKn3DmLnLxuYjeBF8aSeDsh+2niLpfs/si9N cwR0W+PCgg3ZTMSnv6scrBLWjxNqLKrRHyncOn6zAvrnRvTTRHdZV4BRVYtngGSK+C cipiSuxNcOl2Q== From: "Jiri Slaby (SUSE)" To: jikos@kernel.org Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, "Jiri Slaby (SUSE)" , Paul Pawlowski , Aun-Ali Zaidi , Aditya Garg , Benjamin Tissoires Subject: [PATCH 1/7] HID: apple: remove unused members from struct apple_sc_backlight Date: Thu, 1 Feb 2024 12:53:14 +0100 Message-ID: <20240201115320.684-2-jirislaby@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240201115320.684-1-jirislaby@kernel.org> References: <20240201115320.684-1-jirislaby@kernel.org> Precedence: bulk X-Mailing-List: linux-input@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The backlight members in struct apple_sc_backlight are unused. They were added in commit 9018eacbe623 (HID: apple: Add support for keyboard backlight on certain T2 Macs.), but never used. As this is not a struct to communicate with the HW, remove these. Found by https://github.com/jirislaby/clang-struct. Signed-off-by: Jiri Slaby (SUSE) Cc: Paul Pawlowski Cc: Aun-Ali Zaidi Cc: Aditya Garg Cc: Jiri Kosina Cc: Benjamin Tissoires --- drivers/hid/hid-apple.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/hid/hid-apple.c b/drivers/hid/hid-apple.c index b9c7c0ed7bcc..bd022e004356 100644 --- a/drivers/hid/hid-apple.c +++ b/drivers/hid/hid-apple.c @@ -79,7 +79,6 @@ struct apple_non_apple_keyboard { struct apple_sc_backlight { struct led_classdev cdev; struct hid_device *hdev; - unsigned short backlight_off, backlight_on_min, backlight_on_max; }; struct apple_sc { From patchwork Thu Feb 1 11:53:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 13540930 X-Patchwork-Delegate: jikos@jikos.cz Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1046C15DBB5; Thu, 1 Feb 2024 11:53:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706788409; cv=none; b=tHk3Pf41QR7hz0mFJ/p7SQ2W2Z9Fuw/wg+WPyDlSw7XJYIdMcQOTX/JXzZ6K8s/zaQcV8tgjn83vGVCdaBnv1vxd6BnwGqtn59um0WsdWEmKNS/NHSh+p9y+zFzoKe9ER4rPr8rMjMsa4QUqXxafx6kxB8Vj08FliDz3KD4gBN4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706788409; c=relaxed/simple; bh=xwCxROJx6BTu8Xiy2MItJhGUPUJPgxHfmZNp5V9yd+8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=IjkO7j4uQ7Z7lARoFPIBzMun2/OpmPcZZjbfZlpnVVI59NIrzGivm+/p/zCkBeYPMFpStzNFUFuceNTdK19nxUP1R5AqrwD52tFhzhjX/LKdsTm2/GOzTASfcDcSVP6GZWgQWf8X0HQLqCnyD4ncMDHDzLDl5tztV2UjiTT8Xxg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=HlFjP2OQ; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="HlFjP2OQ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id EBFD5C43390; Thu, 1 Feb 2024 11:53:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1706788408; bh=xwCxROJx6BTu8Xiy2MItJhGUPUJPgxHfmZNp5V9yd+8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HlFjP2OQLDmLrfJsg0whXAVlV1xn0/yUniabZMEmxjXL4al4CquZM2uNcGrCz0dYx Xc54nBxg9+nhEv85g+B2mHcPJ6gFh6g78bkCgSBs3npFVJ7qruLuU2W3R9WjCDEkns dnmchPRH3i9z/E2degffIXzOzAEolhhQdvA+bNl7baVXTGkEGWa65AyhWZzPljBR6L nXDtHNMmJa3CcLVWjHf/BWXRizFmu+8sjC0qi6Zp0H1co7Rst+CF2GdsRiwZ8AA+Eu 1QSHG4Ez6frUDDR5Ql0Cz40iH6vGJXghYojyYl8ZRxvqMGv4NqReMXnCBPTnu1esCB EmvCIPuAOBAdg== From: "Jiri Slaby (SUSE)" To: jikos@kernel.org Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, "Jiri Slaby (SUSE)" , Ping Cheng , Jason Gerecke , Benjamin Tissoires Subject: [PATCH 2/7] HID: wacom: remove unused hid_data::pressure Date: Thu, 1 Feb 2024 12:53:15 +0100 Message-ID: <20240201115320.684-3-jirislaby@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240201115320.684-1-jirislaby@kernel.org> References: <20240201115320.684-1-jirislaby@kernel.org> Precedence: bulk X-Mailing-List: linux-input@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The pressure member in struct hid_data is unused. It was added in commit 5ae6e89f7409 (HID: wacom: implement the finger part of the HID generic handling), but never used. As this is not a struct to communicate with the HW, remove that member. Found by https://github.com/jirislaby/clang-struct. Signed-off-by: Jiri Slaby (SUSE) Cc: Ping Cheng Cc: Jason Gerecke Cc: Jiri Kosina Cc: Benjamin Tissoires Acked-by: Ping Cheng --- drivers/hid/wacom_wac.h | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/hid/wacom_wac.h b/drivers/hid/wacom_wac.h index e63b1e806e34..6ec499841f70 100644 --- a/drivers/hid/wacom_wac.h +++ b/drivers/hid/wacom_wac.h @@ -309,7 +309,6 @@ struct hid_data { bool confidence; int x; int y; - int pressure; int width; int height; int id; From patchwork Thu Feb 1 11:53:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 13540931 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A195415DBD1; Thu, 1 Feb 2024 11:53:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706788410; cv=none; b=gY14VRitLsFObEl31yYs9WZE/UIHrqJcikGn9xtXKI+XHjCLkxIhFZN2JBZCZ5WDQ+6rz1MFVG1GXTrj/oMoWeY+2aEAs1yxnQjOoXBUry3JShm91dDp6ODuLk/sopXlh8BVJ/EwqoMVfHJGGgy1qz4ZF7nlau6v9QtI+t2tjb0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706788410; c=relaxed/simple; bh=R9mqcGZb3HMeav7eRqumn5/IPLY4C5cuLq+LnSwMoPg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=X8Bg0TgOM3OUyQYvlNIn7CFKuFXZ0EnzyWG13I7KJslPPldGFMdsfTLzlJmcqpBzXzrTk04s/8AB2DtWegQIRkMW860zVCjV2XBt4vy7zciYFyi8r0tYBZZpmbwYh+0cYEJC3MhECdkZjTKLiyPLHo3C3eBuyja1GBhp7sZjyMk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=VHZ5XMxG; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="VHZ5XMxG" Received: by smtp.kernel.org (Postfix) with ESMTPSA id F40E2C43394; Thu, 1 Feb 2024 11:53:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1706788410; bh=R9mqcGZb3HMeav7eRqumn5/IPLY4C5cuLq+LnSwMoPg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VHZ5XMxGtA8VGFAHELiWxWp1TYfwdLGudPaHlCjFVRz6z97iIb4EHBwiChbXjoVSf Yinshu6Xpsu/owG2i4xIYTn6T1QCdBMvZuYMkzyjcOANW8e4+KQ1ZwTjca5FvISyeZ LbjDcYRfKDsdQ7gOlbOhsS7xKM70i8gbo2Vj31sBDrYwyDbZqa1R5j3bdolgM5VPzV nHSY4YKkowuGhVDG8zhxS5gcGeMiemlARIOvSqTkMf9ezirZZdSjQdur5LK5o/cZDN YWaJkky8uL0KhusM24069OvlmlwPJPOYEXplCQyxmEGU3tdriWjORLtaJ71NKpPZ1X FKdHqN65Qzocw== From: "Jiri Slaby (SUSE)" To: jikos@kernel.org Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, "Jiri Slaby (SUSE)" , Benjamin Tissoires Subject: [PATCH 3/7] HID: protect hid_device::bpf by CONFIG_HID_BPF Date: Thu, 1 Feb 2024 12:53:16 +0100 Message-ID: <20240201115320.684-4-jirislaby@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240201115320.684-1-jirislaby@kernel.org> References: <20240201115320.684-1-jirislaby@kernel.org> Precedence: bulk X-Mailing-List: linux-input@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 And not by CONFIG_BPF. BPF can be selected while HID_BPF does not have to. It actually cannot be on some platforms due to Kconfig dependences. This saves quite some bytes on those setups. Found by https://github.com/jirislaby/clang-struct. Signed-off-by: Jiri Slaby (SUSE) Cc: Jiri Kosina Cc: Benjamin Tissoires --- include/linux/hid.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/linux/hid.h b/include/linux/hid.h index 7c26db874ff0..b12cb1c8e682 100644 --- a/include/linux/hid.h +++ b/include/linux/hid.h @@ -683,9 +683,9 @@ struct hid_device { /* device report descriptor */ unsigned int id; /* system unique id */ -#ifdef CONFIG_BPF +#ifdef CONFIG_HID_BPF struct hid_bpf bpf; /* hid-bpf data */ -#endif /* CONFIG_BPF */ +#endif /* CONFIG_HID_BPF */ }; void hiddev_free(struct kref *ref); From patchwork Thu Feb 1 11:53:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 13540932 X-Patchwork-Delegate: jikos@jikos.cz Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 978D115F313; Thu, 1 Feb 2024 11:53:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706788412; cv=none; b=Lm5Pivo5Dc4Y5mY8ZfEQvcRPRUSbWkcTyentAWnr/YHmL8it8D3/P7u5QXoNYdweh2nbW5Y+bm2KmXdZR2KBVreWGxfJ+ZDvL1JPRLC/m3qErO2/X5Cgc0kgaB/05F1MlQAtwFrVQUKSKIYcFq1mVqRPQbrVzZ4yVlgxwopYTwc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706788412; c=relaxed/simple; bh=+uVdvJGsc8lGb6YyNtoRve9i5Z0FqJFy9u1zLI/NIAg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tvO1xjtSomZHHi3CHiCzG+mvpPFx43d1xohbFWSRkwy1WaeL3tVqzWSCM5xzPf0PfCKUjy1mtuuZOhM9N/sdxE+ut+DGpcTtuckXQtkQN8tlhvb98T6L/tjHqoywGv+evimDbgddidZ1I6Fn0uRzz5LxqZ9LjS+MCcD7eyN2As8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Hyig5QNm; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Hyig5QNm" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A441CC43399; Thu, 1 Feb 2024 11:53:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1706788412; bh=+uVdvJGsc8lGb6YyNtoRve9i5Z0FqJFy9u1zLI/NIAg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Hyig5QNmLrPTECu94ugQSjEwP01vifZIkEi9RiqpwxC+MlWfnD6EqvT00Qr5Gnw1G ReR+GN9u3Kr0tZj+OQ8t8cY+92ctBglpPzJRxqMBOJzwrxAjvcSkfTTH6vUv6P5c21 E3cspd+wUUQy70nTvdCwQVykgBJFHkb7oW5dcE7aCjdnp481BwYGuAfUewvNNqdH9M dGMuy/IhWsgJwRMuGkk6zwF8XF45b2Rnf8+jm9ZYAgYpsE8wNCM95vMTDNobKjC6Hv UZcOhYzw+fjA9UvwvPFmNBKdhwuofXPrcc3KhXCG7CiuoE6zX6b+qGMxMsvTQ2+Reu d2VtJ59ZJx9ow== From: "Jiri Slaby (SUSE)" To: jikos@kernel.org Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, "Jiri Slaby (SUSE)" , Gary Stein , Benjamin Tissoires Subject: [PATCH 4/7] HID: hid-lg3ff: remove unused struct lg3ff_device Date: Thu, 1 Feb 2024 12:53:17 +0100 Message-ID: <20240201115320.684-5-jirislaby@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240201115320.684-1-jirislaby@kernel.org> References: <20240201115320.684-1-jirislaby@kernel.org> Precedence: bulk X-Mailing-List: linux-input@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 struct lg3ff_device is present in the driver since its addition by commit 74f292ca8c7a (HID: add driver for the Logitech Flight System G940). But it was never used, remove it. Found by https://github.com/jirislaby/clang-struct. Signed-off-by: Jiri Slaby (SUSE) Cc: Gary Stein Cc: Jiri Kosina Cc: Benjamin Tissoires --- drivers/hid/hid-lg3ff.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/hid/hid-lg3ff.c b/drivers/hid/hid-lg3ff.c index b7e1949f3cf7..109735b89b7a 100644 --- a/drivers/hid/hid-lg3ff.c +++ b/drivers/hid/hid-lg3ff.c @@ -41,10 +41,6 @@ * I'm sure these are effects that I don't know enough about them */ -struct lg3ff_device { - struct hid_report *report; -}; - static int hid_lg3ff_play(struct input_dev *dev, void *data, struct ff_effect *effect) { From patchwork Thu Feb 1 11:53:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 13540933 X-Patchwork-Delegate: jikos@jikos.cz Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3A74215F339; Thu, 1 Feb 2024 11:53:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706788414; cv=none; b=B6C8xo57lPbfoD8OEOpp7B2dptyiUg/BYvA05hDrjaqP8tjlDke/4h5ryFhPBOAbftAhIOBhrDPRj98nOUrTfhfLdr3fNTo4K+iTLJ7Vxi6GFHH9q374qTFc+FRWErPrED3l56DLVb3hy4AR/x2BM3v9mIsDmpygQwtWF/1BbrU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706788414; c=relaxed/simple; bh=xj3qUE/KEdqABtcoeVjEuTxwjoHowTvkvWDSQecj28k=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=FYfl3IxO8pe7yE6kFEJHUzZ4VLOsWypsu1geMzTdcwkk4lb1AwhoLJRekorAE224Jx1tmXxCIILc9Sl4i6xbL9ImVisccwe4Z9FvkJdQykZ3hoxmpj2QNR70tY8rYCGCJKd3Al33I5VXp8keHOt3G6df9PcyM4YoyMyQu7FhnEI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Wiwtn9q+; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Wiwtn9q+" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 80F03C433C7; Thu, 1 Feb 2024 11:53:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1706788413; bh=xj3qUE/KEdqABtcoeVjEuTxwjoHowTvkvWDSQecj28k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Wiwtn9q+tmDnGWBNvHwI9GkzNorSTByoJV/kLjOL+BVe/8qxuwfPSbJ1cNUiPZScK IBmSCSwBnCf/sUQ3KY78stSi3ZUuBfMnnePmWSlTg4GwjJbjIGLC6l9w0pmP3hc+we p7s4Zyvw77Z9xUQGf3EATRP951drJF5tXDleYWFjS9JA6rkB+hlq+ny4kVQ0Bj8ByE 4VPhGfvubGzQ7F1WQw9luY9u49QaY9IW7b4SIpVrph0kj5J7BOo8Exrz4h4lVztrk0 SXKbR2w27vOBccoaEXBoEo91nrF3qTsv2C+YOfBXKSPZ+J+Z55z1zhCPyPj1VbN5X8 UEBEkVWnwoIXg== From: "Jiri Slaby (SUSE)" To: jikos@kernel.org Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, "Jiri Slaby (SUSE)" , Benjamin Tissoires Subject: [PATCH 5/7] HID: hid-multitouch: remove unused mt_application::dev_time Date: Thu, 1 Feb 2024 12:53:18 +0100 Message-ID: <20240201115320.684-6-jirislaby@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240201115320.684-1-jirislaby@kernel.org> References: <20240201115320.684-1-jirislaby@kernel.org> Precedence: bulk X-Mailing-List: linux-input@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 dev_time was moved to struct mt_application in commit f146d1c4d7ea (HID: multitouch: Store per collection multitouch data), but is not used since then. Remove it. Found by https://github.com/jirislaby/clang-struct. Signed-off-by: Jiri Slaby (SUSE) Cc: Jiri Kosina Cc: Benjamin Tissoires --- drivers/hid/hid-multitouch.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c index fd5b0637dad6..40475c42b9f6 100644 --- a/drivers/hid/hid-multitouch.c +++ b/drivers/hid/hid-multitouch.c @@ -130,7 +130,6 @@ struct mt_application { * > 1 means hybrid (multitouch) protocol */ - __s32 dev_time; /* the scan time provided by the device */ unsigned long jiffies; /* the frame's jiffies */ int timestamp; /* the timestamp to be sent */ int prev_scantime; /* scantime reported previously */ From patchwork Thu Feb 1 11:53:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 13540934 X-Patchwork-Delegate: jikos@jikos.cz Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E78B316087C; Thu, 1 Feb 2024 11:53:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706788416; cv=none; b=pooCKNWg5F9e2PAaqqZ+/Tcta+OP5aCsJBUW6hYn585KovafUsYbfSy+o3IzYiWH0ZI5BWPANuaj9kEMHcil+SUVtoWIiBJc89zVXXGFCMzuYUZhiVyuv6LDtn5Evgj/7uZWbaa7O8vRmLaxRh8d/rQTPdSEufKDGI8RhJO1bkU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706788416; c=relaxed/simple; bh=KC8IA2sZ4Q6/pjsCkvWOZBM/6wtRJa6iv38OQYpmdNo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=PaXTkGC1lthaYK2mOaJJF1gOpNDqcbFZJ9TUTymniMmD4PjYU0siPak95ZbrdQTWhvgxCXgZB23VTmhnnLq0DHQADvo8ndpTNaQ5OzcRAQVs2PV5Gdn5Dc+tyxVS5UtJUxjF8wahbntki99OrpJHUc8lmHJq9CO1yvURmQiYV24= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=RYzKW59E; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="RYzKW59E" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 301B6C43390; Thu, 1 Feb 2024 11:53:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1706788415; bh=KC8IA2sZ4Q6/pjsCkvWOZBM/6wtRJa6iv38OQYpmdNo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RYzKW59Ev2DvITPm48/8Wp5sZkRd6+6PW6VCkoM7Sa6PnY/ZZobqgjdAEVhzCVQEI RNxV9LhRc2A2CQe5uN7cFi2+JXIc4JbbjIdkaKHd7Xo8XvEjWMmTSCuJ+XTWjJYJ3c WQVPlwe9IhMCxR7zqcGQ8QXpqRtXHmIym0G1KiuvoFmtvmuNXgCX79LIcdoiA4IZfI olN8dy/MpA6COL3FS/7XzR9K+IM/bCoMrfJgdVo7BoU/zdPQGDZ4K36DETn8NCs/tN mNiGx5DdxwBqWMVi3Pcf5rLfhS64bEKJhSobWhJzHge+lK9Lp7ix+m7mQc+l57Pr62 bVIH4IlGV2ZYQ== From: "Jiri Slaby (SUSE)" To: jikos@kernel.org Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, "Jiri Slaby (SUSE)" , Benjamin Tissoires Subject: [PATCH 6/7] HID: hid-prodikeys: remove unused struct pcmidi_snd members Date: Thu, 1 Feb 2024 12:53:19 +0100 Message-ID: <20240201115320.684-7-jirislaby@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240201115320.684-1-jirislaby@kernel.org> References: <20240201115320.684-1-jirislaby@kernel.org> Precedence: bulk X-Mailing-List: linux-input@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 struct pcmidi_snd contains two unused members: out_substream and out_active. They were added along the driver in commit 3a370ca1dcf8 (HID: Prodikeys PC-MIDI HID Driver), but not used. Drop them. Found by https://github.com/jirislaby/clang-struct. Signed-off-by: Jiri Slaby (SUSE) Cc: Jiri Kosina Cc: Benjamin Tissoires --- drivers/hid/hid-prodikeys.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/hid/hid-prodikeys.c b/drivers/hid/hid-prodikeys.c index c16d2ba6ea16..439f4320f1d2 100644 --- a/drivers/hid/hid-prodikeys.c +++ b/drivers/hid/hid-prodikeys.c @@ -66,9 +66,7 @@ struct pcmidi_snd { struct snd_card *card; struct snd_rawmidi *rwmidi; struct snd_rawmidi_substream *in_substream; - struct snd_rawmidi_substream *out_substream; unsigned long in_triggered; - unsigned long out_active; }; #define PK_QUIRK_NOGET 0x00010000 From patchwork Thu Feb 1 11:53:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 13540935 X-Patchwork-Delegate: jikos@jikos.cz Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8C24516089D; Thu, 1 Feb 2024 11:53:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706788417; cv=none; b=ZuUGS2/eBi9wHaX8YCB3+yAjocoV14eoEJ6JSkVXALpQFfHcajmpRIeSWI/pMr1Ir3HPUvfRJeO6Sf8A3SqQ7fGxR5Q/F0BjBmAAGhwFgFRp+akCh7e+B0bW94Rh0uyVTRe6Ro67UjhYVxg1E9/JjLP02JgGrRZNoXnXuZD74j8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706788417; c=relaxed/simple; bh=NF/WyNz8fSJXXP6Kn7H5YvVfKOqkIoj0xrHRvaRo2mw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=gJ4IUcxe0ytbNcaY8o8h4YpixqXEPtGKu7qm/96Vmtkx/AgLPNGUjckPBfSkx/cYvpGDYqUCrAiV2dNFS/W/xPVA0GuSZSVLj1MtVzvvLXGJc6UF9CkhfgonCPinwB1Wd8wBNpERzddHIJIj998noml7qJtU5Am/Jixo3H/G14k= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=NNGHT2ex; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="NNGHT2ex" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D3B98C433C7; Thu, 1 Feb 2024 11:53:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1706788417; bh=NF/WyNz8fSJXXP6Kn7H5YvVfKOqkIoj0xrHRvaRo2mw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NNGHT2exEp4W0nJRU3r+k4NHUJ4UbMrAnlMHIWY7IedIvpUjmfMfxlFNlOm1i6w5W tfV61ZlxLQeDsjEBqgyFeKy4PmZ3pwLcjZ59lhnFAAyO9tAR9pKuIUBwCe6TSo4sZA rQJbhUmLUTTRDcvu17Vitnsf6PcEJmkwLK8KDynl6C326JvkX6nBRSCV621eHc6D4O JLad5znyo94r+VxbMSlbZJ466YdSYmVYV1mK81NxOqXPC7VVSxC473LTF1FyG/MUq3 69v7Iwy43en8QVn+ncbyLHSyWhmZG3RR3HcrVKqPSC+48ogC9AaO6y+9qcZ0YrtznP j7TPvlr5DVqqQ== From: "Jiri Slaby (SUSE)" To: jikos@kernel.org Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, "Jiri Slaby (SUSE)" , Benjamin Tissoires Subject: [PATCH 7/7] HID: hid-prodikeys: remove struct pk_device Date: Thu, 1 Feb 2024 12:53:20 +0100 Message-ID: <20240201115320.684-8-jirislaby@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240201115320.684-1-jirislaby@kernel.org> References: <20240201115320.684-1-jirislaby@kernel.org> Precedence: bulk X-Mailing-List: linux-input@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 First, quirks was unused in struct pk_device. And I see no reason for this additional level of indirection. struct pcmidi_snd is far enough for the driver. Unless I am missing something? So drop struct pk_device and convert all the users to use struct pcmidi_snd directly. No need for doubled kmalloc+kfrees now. Found by https://github.com/jirislaby/clang-struct. Signed-off-by: Jiri Slaby (SUSE) Cc: Jiri Kosina Cc: Benjamin Tissoires --- drivers/hid/hid-prodikeys.c | 113 +++++++++++++----------------------- 1 file changed, 40 insertions(+), 73 deletions(-) diff --git a/drivers/hid/hid-prodikeys.c b/drivers/hid/hid-prodikeys.c index 439f4320f1d2..a593ed62c969 100644 --- a/drivers/hid/hid-prodikeys.c +++ b/drivers/hid/hid-prodikeys.c @@ -32,13 +32,6 @@ struct pcmidi_snd; -struct pk_device { - unsigned long quirks; - - struct hid_device *hdev; - struct pcmidi_snd *pm; /* pcmidi device context */ -}; - struct pcmidi_sustain { unsigned long in_use; struct pcmidi_snd *pm; @@ -50,7 +43,7 @@ struct pcmidi_sustain { #define PCMIDI_SUSTAINED_MAX 32 struct pcmidi_snd { - struct pk_device *pk; + struct hid_device *hdev; unsigned short ifnum; struct hid_report *pcmidi_report6; struct input_dev *input_ep82; @@ -98,11 +91,11 @@ static ssize_t show_channel(struct device *dev, struct device_attribute *attr, char *buf) { struct hid_device *hdev = to_hid_device(dev); - struct pk_device *pk = hid_get_drvdata(hdev); + struct pcmidi_snd *pm = hid_get_drvdata(hdev); - dbg_hid("pcmidi sysfs read channel=%u\n", pk->pm->midi_channel); + dbg_hid("pcmidi sysfs read channel=%u\n", pm->midi_channel); - return sprintf(buf, "%u (min:%u, max:%u)\n", pk->pm->midi_channel, + return sprintf(buf, "%u (min:%u, max:%u)\n", pm->midi_channel, PCMIDI_CHANNEL_MIN, PCMIDI_CHANNEL_MAX); } @@ -111,13 +104,13 @@ static ssize_t store_channel(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct hid_device *hdev = to_hid_device(dev); - struct pk_device *pk = hid_get_drvdata(hdev); + struct pcmidi_snd *pm = hid_get_drvdata(hdev); unsigned channel = 0; if (sscanf(buf, "%u", &channel) > 0 && channel <= PCMIDI_CHANNEL_MAX) { dbg_hid("pcmidi sysfs write channel=%u\n", channel); - pk->pm->midi_channel = channel; + pm->midi_channel = channel; return strlen(buf); } return -EINVAL; @@ -135,11 +128,11 @@ static ssize_t show_sustain(struct device *dev, struct device_attribute *attr, char *buf) { struct hid_device *hdev = to_hid_device(dev); - struct pk_device *pk = hid_get_drvdata(hdev); + struct pcmidi_snd *pm = hid_get_drvdata(hdev); - dbg_hid("pcmidi sysfs read sustain=%u\n", pk->pm->midi_sustain); + dbg_hid("pcmidi sysfs read sustain=%u\n", pm->midi_sustain); - return sprintf(buf, "%u (off:%u, max:%u (ms))\n", pk->pm->midi_sustain, + return sprintf(buf, "%u (off:%u, max:%u (ms))\n", pm->midi_sustain, PCMIDI_SUSTAIN_MIN, PCMIDI_SUSTAIN_MAX); } @@ -148,15 +141,14 @@ static ssize_t store_sustain(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct hid_device *hdev = to_hid_device(dev); - struct pk_device *pk = hid_get_drvdata(hdev); + struct pcmidi_snd *pm = hid_get_drvdata(hdev); unsigned sustain = 0; if (sscanf(buf, "%u", &sustain) > 0 && sustain <= PCMIDI_SUSTAIN_MAX) { dbg_hid("pcmidi sysfs write sustain=%u\n", sustain); - pk->pm->midi_sustain = sustain; - pk->pm->midi_sustain_mode = - (0 == sustain || !pk->pm->midi_mode) ? 0 : 1; + pm->midi_sustain = sustain; + pm->midi_sustain_mode = (0 == sustain || !pm->midi_mode) ? 0 : 1; return strlen(buf); } return -EINVAL; @@ -174,11 +166,11 @@ static ssize_t show_octave(struct device *dev, struct device_attribute *attr, char *buf) { struct hid_device *hdev = to_hid_device(dev); - struct pk_device *pk = hid_get_drvdata(hdev); + struct pcmidi_snd *pm = hid_get_drvdata(hdev); - dbg_hid("pcmidi sysfs read octave=%d\n", pk->pm->midi_octave); + dbg_hid("pcmidi sysfs read octave=%d\n", pm->midi_octave); - return sprintf(buf, "%d (min:%d, max:%d)\n", pk->pm->midi_octave, + return sprintf(buf, "%d (min:%d, max:%d)\n", pm->midi_octave, PCMIDI_OCTAVE_MIN, PCMIDI_OCTAVE_MAX); } @@ -187,14 +179,14 @@ static ssize_t store_octave(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct hid_device *hdev = to_hid_device(dev); - struct pk_device *pk = hid_get_drvdata(hdev); + struct pcmidi_snd *pm = hid_get_drvdata(hdev); int octave = 0; if (sscanf(buf, "%d", &octave) > 0 && octave >= PCMIDI_OCTAVE_MIN && octave <= PCMIDI_OCTAVE_MAX) { dbg_hid("pcmidi sysfs write octave=%d\n", octave); - pk->pm->midi_octave = octave; + pm->midi_octave = octave; return strlen(buf); } return -EINVAL; @@ -268,7 +260,7 @@ static void stop_sustain_timers(struct pcmidi_snd *pm) static int pcmidi_get_output_report(struct pcmidi_snd *pm) { - struct hid_device *hdev = pm->pk->hdev; + struct hid_device *hdev = pm->hdev; struct hid_report *report; list_for_each_entry(report, @@ -293,7 +285,7 @@ static int pcmidi_get_output_report(struct pcmidi_snd *pm) static void pcmidi_submit_output_report(struct pcmidi_snd *pm, int state) { - struct hid_device *hdev = pm->pk->hdev; + struct hid_device *hdev = pm->hdev; struct hid_report *report = pm->pcmidi_report6; report->field[0]->value[0] = 0x01; report->field[0]->value[1] = state; @@ -620,7 +612,7 @@ static int pcmidi_snd_initialise(struct pcmidi_snd *pm) /* Setup sound card */ - err = snd_card_new(&pm->pk->hdev->dev, index[dev], id[dev], + err = snd_card_new(&pm->hdev->dev, index[dev], id[dev], THIS_MODULE, 0, &card); if (err < 0) { pk_error("failed to create pc-midi sound card\n"); @@ -658,7 +650,7 @@ static int pcmidi_snd_initialise(struct pcmidi_snd *pm) &pcmidi_in_ops); /* create sysfs variables */ - err = device_create_file(&pm->pk->hdev->dev, + err = device_create_file(&pm->hdev->dev, sysfs_device_attr_channel); if (err < 0) { pk_error("failed to create sysfs attribute channel: error %d\n", @@ -666,7 +658,7 @@ static int pcmidi_snd_initialise(struct pcmidi_snd *pm) goto fail; } - err = device_create_file(&pm->pk->hdev->dev, + err = device_create_file(&pm->hdev->dev, sysfs_device_attr_sustain); if (err < 0) { pk_error("failed to create sysfs attribute sustain: error %d\n", @@ -674,7 +666,7 @@ static int pcmidi_snd_initialise(struct pcmidi_snd *pm) goto fail_attr_sustain; } - err = device_create_file(&pm->pk->hdev->dev, + err = device_create_file(&pm->hdev->dev, sysfs_device_attr_octave); if (err < 0) { pk_error("failed to create sysfs attribute octave: error %d\n", @@ -704,11 +696,11 @@ static int pcmidi_snd_initialise(struct pcmidi_snd *pm) fail_register: stop_sustain_timers(pm); - device_remove_file(&pm->pk->hdev->dev, sysfs_device_attr_octave); + device_remove_file(&pm->hdev->dev, sysfs_device_attr_octave); fail_attr_octave: - device_remove_file(&pm->pk->hdev->dev, sysfs_device_attr_sustain); + device_remove_file(&pm->hdev->dev, sysfs_device_attr_sustain); fail_attr_sustain: - device_remove_file(&pm->pk->hdev->dev, sysfs_device_attr_channel); + device_remove_file(&pm->hdev->dev, sysfs_device_attr_channel); fail: if (pm->card) { snd_card_free(pm->card); @@ -722,12 +714,9 @@ static int pcmidi_snd_terminate(struct pcmidi_snd *pm) if (pm->card) { stop_sustain_timers(pm); - device_remove_file(&pm->pk->hdev->dev, - sysfs_device_attr_channel); - device_remove_file(&pm->pk->hdev->dev, - sysfs_device_attr_sustain); - device_remove_file(&pm->pk->hdev->dev, - sysfs_device_attr_octave); + device_remove_file(&pm->hdev->dev, sysfs_device_attr_channel); + device_remove_file(&pm->hdev->dev, sysfs_device_attr_sustain); + device_remove_file(&pm->hdev->dev, sysfs_device_attr_octave); snd_card_disconnect(pm->card); snd_card_free_when_closed(pm->card); @@ -757,10 +746,7 @@ static int pk_input_mapping(struct hid_device *hdev, struct hid_input *hi, struct hid_field *field, struct hid_usage *usage, unsigned long **bit, int *max) { - struct pk_device *pk = hid_get_drvdata(hdev); - struct pcmidi_snd *pm; - - pm = pk->pm; + struct pcmidi_snd *pm = hid_get_drvdata(hdev); if (HID_UP_MSVENDOR == (usage->hid & HID_USAGE_PAGE) && 1 == pm->ifnum) { @@ -775,16 +761,16 @@ static int pk_input_mapping(struct hid_device *hdev, struct hid_input *hi, static int pk_raw_event(struct hid_device *hdev, struct hid_report *report, u8 *data, int size) { - struct pk_device *pk = hid_get_drvdata(hdev); + struct pcmidi_snd *pm = hid_get_drvdata(hdev); int ret = 0; - if (1 == pk->pm->ifnum) { + if (1 == pm->ifnum) { if (report->id == data[0]) switch (report->id) { case 0x01: /* midi keys (qwerty)*/ case 0x03: /* midi keyboard (musical)*/ case 0x04: /* extra/midi keys (qwerty)*/ - ret = pcmidi_handle_report(pk->pm, + ret = pcmidi_handle_report(pm, report->id, data, size); break; } @@ -799,8 +785,7 @@ static int pk_probe(struct hid_device *hdev, const struct hid_device_id *id) struct usb_interface *intf; unsigned short ifnum; unsigned long quirks = id->driver_data; - struct pk_device *pk; - struct pcmidi_snd *pm = NULL; + struct pcmidi_snd *pm; if (!hid_is_usb(hdev)) return -EINVAL; @@ -808,26 +793,16 @@ static int pk_probe(struct hid_device *hdev, const struct hid_device_id *id) intf = to_usb_interface(hdev->dev.parent); ifnum = intf->cur_altsetting->desc.bInterfaceNumber; - pk = kzalloc(sizeof(*pk), GFP_KERNEL); - if (pk == NULL) { - hid_err(hdev, "can't alloc descriptor\n"); - return -ENOMEM; - } - - pk->hdev = hdev; - pm = kzalloc(sizeof(*pm), GFP_KERNEL); if (pm == NULL) { hid_err(hdev, "can't alloc descriptor\n"); - ret = -ENOMEM; - goto err_free_pk; + return -ENOMEM; } - pm->pk = pk; - pk->pm = pm; + pm->hdev = hdev; pm->ifnum = ifnum; - hid_set_drvdata(hdev, pk); + hid_set_drvdata(hdev, pm); ret = hid_parse(hdev); if (ret) { @@ -854,26 +829,18 @@ static int pk_probe(struct hid_device *hdev, const struct hid_device_id *id) hid_hw_stop(hdev); err_free: kfree(pm); -err_free_pk: - kfree(pk); return ret; } static void pk_remove(struct hid_device *hdev) { - struct pk_device *pk = hid_get_drvdata(hdev); - struct pcmidi_snd *pm; - - pm = pk->pm; - if (pm) { - pcmidi_snd_terminate(pm); - kfree(pm); - } + struct pcmidi_snd *pm = hid_get_drvdata(hdev); + pcmidi_snd_terminate(pm); hid_hw_stop(hdev); - kfree(pk); + kfree(pm); } static const struct hid_device_id pk_devices[] = {