2626 MODULE_FIRMWARE("intel/ipts/" X "/vendor_desc.bin"); \
2727 MODULE_FIRMWARE("intel/ipts/" X "/vendor_kernel.bin")
2828
29- struct ipts_surface_data {
30- const char * hid ;
31- unsigned int quirks ;
32- };
33-
34- // Surface Book 1 / Surface Studio
35- static const struct ipts_surface_data ipts_surface_mshw0076 = {
36- .hid = "MSHW0076" ,
37- .quirks = IPTS_QUIRK_NONE ,
38- };
39-
40- // Surface Pro 4
41- static const struct ipts_surface_data ipts_surface_mshw0078 = {
42- .hid = "MSHW0078" ,
43- .quirks = IPTS_QUIRK_NONE ,
44- };
45-
46- // Surface Laptop 1 / 2
47- static const struct ipts_surface_data ipts_surface_mshw0079 = {
48- .hid = "MSHW0079" ,
49- .quirks = IPTS_QUIRK_NONE ,
50- };
51-
52- // Surface Pro 5 / 6
53- static const struct ipts_surface_data ipts_surface_mshw0101 = {
54- .hid = "MSHW0101" ,
55- .quirks = IPTS_QUIRK_NONE ,
56- };
57-
58- // Surface Book 2 15"
59- static const struct ipts_surface_data ipts_surface_mshw0102 = {
60- .hid = "MSHW0102" ,
61- .quirks = IPTS_QUIRK_NONE ,
62- };
63-
64- // Unknown, but firmware exists
65- static const struct ipts_surface_data ipts_surface_mshw0103 = {
66- .hid = "MSHW0103" ,
67- .quirks = IPTS_QUIRK_NONE ,
68- };
69-
70- // Surface Book 2 13"
71- static const struct ipts_surface_data ipts_surface_mshw0137 = {
72- .hid = "MSHW0137" ,
73- .quirks = IPTS_QUIRK_NONE ,
74- };
75-
7629/*
7730 * Checkpatch complains about the following lines because it sees them as
7831 * header files mixed with .c files. However, forward declaration is perfectly
@@ -119,7 +72,6 @@ static struct ipts_bin_fw_info *ipts_surface_fw_config[] = {
11972static struct ipts_companion ipts_surface_companion = {
12073 .firmware_request = & ipts_surface_request_firmware ,
12174 .firmware_config = ipts_surface_fw_config ,
122- .get_quirks = & ipts_surface_get_quirks ,
12375 .name = "ipts_surface" ,
12476};
12577
@@ -128,44 +80,26 @@ int ipts_surface_request_firmware(struct ipts_companion *companion,
12880 struct device * device )
12981{
13082 char fw_path [MAX_IOCL_FILE_PATH_LEN ];
131- struct ipts_surface_data * data ;
13283
13384 if (companion == NULL || companion -> data == NULL )
13485 return - ENOENT ;
13586
136- data = (struct ipts_surface_data * )companion -> data ;
137-
13887 snprintf (fw_path , MAX_IOCL_FILE_PATH_LEN , IPTS_SURFACE_FW_PATH_FMT ,
139- data -> hid , name );
88+ ( const char * ) companion -> data , name );
14089 return request_firmware (fw , fw_path , device );
14190}
14291
143- unsigned int ipts_surface_get_quirks (struct ipts_companion * companion )
144- {
145- struct ipts_surface_data * data ;
146-
147- // In case something went wrong, assume that the
148- // device doesn't have any quirks
149- if (companion == NULL || companion -> data == NULL )
150- return IPTS_QUIRK_NONE ;
151-
152- data = (struct ipts_surface_data * )companion -> data ;
153-
154- return data -> quirks ;
155- }
156-
15792static int ipts_surface_probe (struct platform_device * pdev )
15893{
15994 int r ;
160- const struct ipts_surface_data * data =
161- acpi_device_get_match_data (& pdev -> dev );
95+ struct acpi_device * adev = ACPI_COMPANION (& pdev -> dev );
16296
163- if (!data ) {
97+ if (!adev ) {
16498 dev_err (& pdev -> dev , "Unable to find ACPI info for device\n" );
16599 return - ENODEV ;
166100 }
167101
168- ipts_surface_companion .data = (void * )data ;
102+ ipts_surface_companion .data = (void * )acpi_device_hid ( adev ) ;
169103
170104 r = ipts_add_companion (& ipts_surface_companion );
171105 if (r ) {
@@ -189,13 +123,13 @@ static int ipts_surface_remove(struct platform_device *pdev)
189123}
190124
191125static const struct acpi_device_id ipts_surface_acpi_match [] = {
192- { "MSHW0076" , ( unsigned long ) & ipts_surface_mshw0076 },
193- { "MSHW0078" , ( unsigned long ) & ipts_surface_mshw0078 },
194- { "MSHW0079" , ( unsigned long ) & ipts_surface_mshw0079 },
195- { "MSHW0101" , ( unsigned long ) & ipts_surface_mshw0101 },
196- { "MSHW0102" , ( unsigned long ) & ipts_surface_mshw0102 },
197- { "MSHW0103" , ( unsigned long ) & ipts_surface_mshw0103 },
198- { "MSHW0137" , ( unsigned long ) & ipts_surface_mshw0137 },
126+ { "MSHW0076" , 0 }, // Surface Book 1 / Surface Studio
127+ { "MSHW0078" , 0 }, // Surface Pro 4
128+ { "MSHW0079" , 0 }, // Surface Laptop 1 / 2
129+ { "MSHW0101" , 0 }, // Surface Book 2 15"
130+ { "MSHW0102" , 0 }, // Surface Pro 5 / 6
131+ { "MSHW0103" , 0 }, // Unknown
132+ { "MSHW0137" , 0 }, // Surface Book 2
199133 { },
200134};
201135MODULE_DEVICE_TABLE (acpi , ipts_surface_acpi_match );
@@ -220,5 +154,4 @@ IPTS_SURFACE_FIRMWARE("MSHW0079");
220154IPTS_SURFACE_FIRMWARE ("MSHW0101" );
221155IPTS_SURFACE_FIRMWARE ("MSHW0102" );
222156IPTS_SURFACE_FIRMWARE ("MSHW0103" );
223-
224157IPTS_SURFACE_FIRMWARE ("MSHW0137" );
0 commit comments