File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -56,6 +56,11 @@ static struct uclogic_raw_event_hook_test test_events[] = {
5656 },
5757};
5858
59+ static void fake_work (struct work_struct * work )
60+ {
61+
62+ }
63+
5964static void hid_test_uclogic_exec_event_hook_test (struct kunit * test )
6065{
6166 struct uclogic_params p = {0 , };
@@ -77,6 +82,8 @@ static void hid_test_uclogic_exec_event_hook_test(struct kunit *test)
7782 KUNIT_ASSERT_NOT_ERR_OR_NULL (test , filter -> event );
7883 memcpy (filter -> event , & hook_events [n ].event [0 ], filter -> size );
7984
85+ INIT_WORK (& filter -> work , fake_work );
86+
8087 list_add_tail (& filter -> list , & p .event_hooks -> list );
8188 }
8289
Original file line number Diff line number Diff line change @@ -174,12 +174,26 @@ static void hid_test_uclogic_parse_ugee_v2_desc(struct kunit *test)
174174 KUNIT_EXPECT_EQ (test , params -> frame_type , frame_type );
175175}
176176
177+ struct fake_device {
178+ unsigned long quirks ;
179+ };
180+
177181static void hid_test_uclogic_params_cleanup_event_hooks (struct kunit * test )
178182{
179183 int res , n ;
184+ struct hid_device * hdev ;
185+ struct fake_device * fake_dev ;
180186 struct uclogic_params p = {0 , };
181187
182- res = uclogic_params_ugee_v2_init_event_hooks (NULL , & p );
188+ hdev = kunit_kzalloc (test , sizeof (struct hid_device ), GFP_KERNEL );
189+ KUNIT_ASSERT_NOT_ERR_OR_NULL (test , hdev );
190+
191+ fake_dev = kunit_kzalloc (test , sizeof (struct fake_device ), GFP_KERNEL );
192+ KUNIT_ASSERT_NOT_ERR_OR_NULL (test , fake_dev );
193+
194+ hid_set_drvdata (hdev , fake_dev );
195+
196+ res = uclogic_params_ugee_v2_init_event_hooks (hdev , & p );
183197 KUNIT_ASSERT_EQ (test , res , 0 );
184198
185199 /* Check that the function can be called repeatedly */
You can’t perform that action at this time.
0 commit comments