Commit 78abf1b5 authored by Maximilian Luz's avatar Maximilian Luz Committed by Hans de Goede
Browse files

platform/surface: aggregator: Enforce use of target-ID enum in device ID macros



Similar to the target category (TC), the target ID (TID) can be one
value out of a small number of choices, given in enum ssam_ssh_tid.

In the device ID macros, SSAM_SDEV() and SSAM_VDEV() we already use text
expansion to, both, remove some textual clutter for the target category
values and enforce that the value belongs to the known set. Now that we
know the names for the target IDs, use the same trick for them as well.

Also rename the SSAM_ANY_x macros to SSAM_SSH_x_ANY to better fit in.

Signed-off-by: default avatarMaximilian Luz <luzmaximilian@gmail.com>
Acked-by: default avatarSebastian Reichel <sebastian.reichel@collabora.com>
Link: https://lore.kernel.org/r/20221202223327.690880-9-luzmaximilian@gmail.com


Reviewed-by: default avatarHans de Goede <hdegoede@redhat.com>
Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
parent ea11bf4e
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -230,7 +230,7 @@ static void surface_hid_remove(struct ssam_device *sdev)
}

static const struct ssam_device_id surface_hid_match[] = {
	{ SSAM_SDEV(HID, SSAM_ANY_TID, SSAM_ANY_IID, 0x00) },
	{ SSAM_SDEV(HID, ANY, SSAM_SSH_IID_ANY, 0x00) },
	{ },
};
MODULE_DEVICE_TABLE(ssam, surface_hid_match);
+2 −2
Original line number Diff line number Diff line
@@ -348,8 +348,8 @@ static const struct ssam_hub_desc kip_hub = {
/* -- Driver registration. -------------------------------------------------- */

static const struct ssam_device_id ssam_hub_match[] = {
	{ SSAM_VDEV(HUB, 0x01, SSAM_SSH_TC_KIP, 0x00), (unsigned long)&kip_hub  },
	{ SSAM_VDEV(HUB, 0x02, SSAM_SSH_TC_BAS, 0x00), (unsigned long)&base_hub },
	{ SSAM_VDEV(HUB, SAM, SSAM_SSH_TC_KIP, 0x00), (unsigned long)&kip_hub  },
	{ SSAM_VDEV(HUB, KIP, SSAM_SSH_TC_BAS, 0x00), (unsigned long)&base_hub },
	{ }
};
MODULE_DEVICE_TABLE(ssam, ssam_hub_match);
+2 −2
Original line number Diff line number Diff line
@@ -510,8 +510,8 @@ static const struct ssam_tablet_sw_desc ssam_pos_sw_desc = {
/* -- Driver registration. -------------------------------------------------- */

static const struct ssam_device_id ssam_tablet_sw_match[] = {
	{ SSAM_SDEV(KIP, 0x01, 0x00, 0x01), (unsigned long)&ssam_kip_sw_desc },
	{ SSAM_SDEV(POS, 0x01, 0x00, 0x01), (unsigned long)&ssam_pos_sw_desc },
	{ SSAM_SDEV(KIP, SAM, 0x00, 0x01), (unsigned long)&ssam_kip_sw_desc },
	{ SSAM_SDEV(POS, SAM, 0x00, 0x01), (unsigned long)&ssam_pos_sw_desc },
	{ },
};
MODULE_DEVICE_TABLE(ssam, ssam_tablet_sw_match);
+1 −1
Original line number Diff line number Diff line
@@ -1214,7 +1214,7 @@ static void surface_dtx_ssam_remove(struct ssam_device *sdev)
}

static const struct ssam_device_id surface_dtx_ssam_match[] = {
	{ SSAM_SDEV(BAS, 0x01, 0x00, 0x00) },
	{ SSAM_SDEV(BAS, SAM, 0x00, 0x00) },
	{ },
};
MODULE_DEVICE_TABLE(ssam, surface_dtx_ssam_match);
+1 −1
Original line number Diff line number Diff line
@@ -169,7 +169,7 @@ static void surface_platform_profile_remove(struct ssam_device *sdev)
}

static const struct ssam_device_id ssam_platform_profile_match[] = {
	{ SSAM_SDEV(TMP, 0x01, 0x00, 0x01) },
	{ SSAM_SDEV(TMP, SAM, 0x00, 0x01) },
	{ },
};
MODULE_DEVICE_TABLE(ssam, ssam_platform_profile_match);
Loading