Skip to content

Commit 1f40d32

Browse files
StollDqzed
authored andcommitted
ipts: Remove quirk implementation
Since there are no users for quirks anymore, the quirk stuff is just dead code. So remove it to keep the code as simple as possible. In case it is required to readd quirks in the future this commit can simply be reverted. Signed-off-by: Dorian Stoll <dorian.stoll@tmsp.io>
1 parent bb0abfa commit 1f40d32

File tree

4 files changed

+11
-99
lines changed

4 files changed

+11
-99
lines changed

drivers/misc/ipts/companion.c

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -209,22 +209,3 @@ int ipts_request_firmware_config(struct ipts_info *ipts,
209209
return ret;
210210

211211
}
212-
213-
unsigned int ipts_get_quirks(void)
214-
{
215-
unsigned int ret;
216-
217-
// Make sure that access to the companion is synchronized
218-
mutex_lock(&ipts_companion_lock);
219-
220-
// If the companion is ignored, or doesn't exist, assume that
221-
// the device doesn't have any quirks
222-
if (ipts_modparams.ignore_companion || ipts_companion == NULL)
223-
ret = IPTS_QUIRK_NONE;
224-
else
225-
ret = ipts_companion->get_quirks(ipts_companion);
226-
227-
mutex_unlock(&ipts_companion_lock);
228-
229-
return ret;
230-
}

drivers/misc/ipts/companion.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
#include "ipts.h"
1616

1717
bool ipts_companion_available(void);
18-
unsigned int ipts_get_quirks(void);
1918

2019
int ipts_request_firmware(const struct firmware **fw, const char *name,
2120
struct device *device);

drivers/misc/ipts/companion/ipts-surface.c

Lines changed: 11 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -26,53 +26,6 @@
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[] = {
11972
static 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-
15792
static 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

191125
static 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
};
201135
MODULE_DEVICE_TABLE(acpi, ipts_surface_acpi_match);
@@ -220,5 +154,4 @@ IPTS_SURFACE_FIRMWARE("MSHW0079");
220154
IPTS_SURFACE_FIRMWARE("MSHW0101");
221155
IPTS_SURFACE_FIRMWARE("MSHW0102");
222156
IPTS_SURFACE_FIRMWARE("MSHW0103");
223-
224157
IPTS_SURFACE_FIRMWARE("MSHW0137");

include/linux/ipts-companion.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
#include <linux/ipts-binary.h>
1515

1616
struct ipts_companion {
17-
unsigned int (*get_quirks)(struct ipts_companion *companion);
1817
int (*firmware_request)(struct ipts_companion *companion,
1918
const struct firmware **fw,
2019
const char *name, struct device *device);

0 commit comments

Comments
 (0)