Skip to content

Commit b8904df

Browse files
jannaumarcan
authored andcommitted
drm: apple: epic: Pass full notfiy/report payload to handler
The payload is not necessarily epic_std_service_ap_call. The powerlog service on the system endpoint passes serialized dictionaries as payload. Signed-off-by: Janne Grunau <[email protected]>
1 parent 3c4e00b commit b8904df

2 files changed

Lines changed: 6 additions & 16 deletions

File tree

drivers/gpu/drm/apple/afk.c

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -445,21 +445,9 @@ static void afk_recv_handle_std_service(struct apple_dcp_afkep *ep, u32 channel,
445445
}
446446

447447
if (type == EPIC_TYPE_NOTIFY && eshdr->category == EPIC_CAT_REPORT) {
448-
struct epic_std_service_ap_call *call = payload;
449-
size_t call_size;
450-
451-
if (payload_size < sizeof(*call))
452-
return;
453-
454-
call_size = le32_to_cpu(call->len);
455-
if (payload_size < sizeof(*call) + call_size)
456-
return;
457-
458-
if (!service->ops->report)
459-
return;
460-
461-
service->ops->report(service, le32_to_cpu(call->type),
462-
payload + sizeof(*call), call_size);
448+
if (service->ops->report)
449+
service->ops->report(service, le16_to_cpu(eshdr->type),
450+
payload, payload_size);
463451
return;
464452
}
465453

drivers/gpu/drm/apple/afk.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ struct apple_epic_service {
4949
void *cookie;
5050
};
5151

52+
enum epic_subtype;
53+
5254
struct apple_epic_service_ops {
5355
const char name[32];
5456

@@ -57,7 +59,7 @@ struct apple_epic_service_ops {
5759
int (*call)(struct apple_epic_service *service, u32 idx,
5860
const void *data, size_t data_size, void *reply,
5961
size_t reply_size);
60-
int (*report)(struct apple_epic_service *service, u32 idx,
62+
int (*report)(struct apple_epic_service *service, enum epic_subtype type,
6163
const void *data, size_t data_size);
6264
void (*teardown)(struct apple_epic_service *service);
6365
};

0 commit comments

Comments
 (0)