]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
usb: typec: ucsi_glink: rework quirks implementation
authorDmitry Baryshkov <dmitry.baryshkov@linaro.org>
Fri, 29 Mar 2024 06:15:40 +0000 (08:15 +0200)
committerRoxana Nicolescu <roxana.nicolescu@canonical.com>
Fri, 2 Aug 2024 14:27:27 +0000 (16:27 +0200)
BugLink: https://bugs.launchpad.net/bugs/2075154
[ Upstream commit 3f81cf54c1889eeecbb8d9188f5f2f597622170e ]

In preparation to adding more quirks, extract quirks to the static
variables and reference them through match->data. Otherwise adding
more quirks will add the table really cumbersome.

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Link: https://lore.kernel.org/r/20240329-qcom-ucsi-fixes-v2-8-0f5d37ed04db@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Manuel Diewald <manuel.diewald@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
drivers/usb/typec/ucsi/ucsi_glink.c

index d7113b3d593da5e13f635e79628eab9877da89e5..1d0e2d87e9b3133ede6008b7762a6aa356f52087 100644 (file)
@@ -309,12 +309,14 @@ static void pmic_glink_ucsi_destroy(void *data)
        mutex_unlock(&ucsi->lock);
 }
 
+static unsigned long quirk_sc8180x = UCSI_NO_PARTNER_PDOS;
+
 static const struct of_device_id pmic_glink_ucsi_of_quirks[] = {
-       { .compatible = "qcom,qcm6490-pmic-glink", .data = (void *)UCSI_NO_PARTNER_PDOS, },
-       { .compatible = "qcom,sc8180x-pmic-glink", .data = (void *)UCSI_NO_PARTNER_PDOS, },
-       { .compatible = "qcom,sc8280xp-pmic-glink", .data = (void *)UCSI_NO_PARTNER_PDOS, },
-       { .compatible = "qcom,sm8350-pmic-glink", .data = (void *)UCSI_NO_PARTNER_PDOS, },
-       { .compatible = "qcom,sm8550-pmic-glink", .data = (void *)UCSI_NO_PARTNER_PDOS, },
+       { .compatible = "qcom,qcm6490-pmic-glink", .data = &quirk_sc8180x, },
+       { .compatible = "qcom,sc8180x-pmic-glink", .data = &quirk_sc8180x, },
+       { .compatible = "qcom,sc8280xp-pmic-glink", .data = &quirk_sc8180x, },
+       { .compatible = "qcom,sm8350-pmic-glink", .data = &quirk_sc8180x, },
+       { .compatible = "qcom,sm8550-pmic-glink", .data = &quirk_sc8180x, },
        {}
 };
 
@@ -352,7 +354,7 @@ static int pmic_glink_ucsi_probe(struct auxiliary_device *adev,
 
        match = of_match_device(pmic_glink_ucsi_of_quirks, dev->parent);
        if (match)
-               ucsi->ucsi->quirks = (unsigned long)match->data;
+               ucsi->ucsi->quirks = *(unsigned long *)match->data;
 
        ucsi_set_drvdata(ucsi->ucsi, ucsi);