All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
To: Heikki Krogerus <heikki.krogerus@linux.intel.com>,
	 Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	 Guenter Roeck <linux@roeck-us.net>,
	Bjorn Andersson <andersson@kernel.org>,
	 Neil Armstrong <neil.armstrong@linaro.org>,
	 Konrad Dybcio <konrad.dybcio@linaro.org>
Cc: Johan Hovold <johan+linaro@kernel.org>,
	linux-usb@vger.kernel.org,  linux-arm-msm@vger.kernel.org,
	 Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Subject: [PATCH v2 08/11] usb: typec: ucsi_glink: rework quirks implementation
Date: Fri, 29 Mar 2024 08:15:40 +0200	[thread overview]
Message-ID: <20240329-qcom-ucsi-fixes-v2-8-0f5d37ed04db@linaro.org> (raw)
In-Reply-To: <20240329-qcom-ucsi-fixes-v2-0-0f5d37ed04db@linaro.org>

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>
---
 drivers/usb/typec/ucsi/ucsi_glink.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/usb/typec/ucsi/ucsi_glink.c b/drivers/usb/typec/ucsi/ucsi_glink.c
index 932e7bf69447..d7a18950faab 100644
--- a/drivers/usb/typec/ucsi/ucsi_glink.c
+++ b/drivers/usb/typec/ucsi/ucsi_glink.c
@@ -297,12 +297,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, },
 	{}
 };
 
@@ -340,7 +342,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);
 

-- 
2.39.2


  parent reply	other threads:[~2024-03-29  6:15 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-29  6:15 [PATCH v2 00/11] usb: typec: ucsi: fix several issues manifesting on Qualcomm platforms Dmitry Baryshkov
2024-03-29  6:15 ` [PATCH v2 01/11] usb: typec: ucsi: allow non-partner GET_PDOS for Qualcomm devices Dmitry Baryshkov
2024-03-29  6:15 ` [PATCH v2 02/11] usb: typec: ucsi: limit the UCSI_NO_PARTNER_PDOS even further Dmitry Baryshkov
2024-03-29  6:15 ` [PATCH v2 03/11] usb: typec: ucsi: properly register partner's PD device Dmitry Baryshkov
2024-03-29  6:15 ` [PATCH v2 04/11] usb: typec: ucsi: always register a link to USB " Dmitry Baryshkov
2024-04-02 10:38   ` Heikki Krogerus
2024-03-29  6:15 ` [PATCH v2 05/11] usb: typec: ucsi: simplify partner's PD caps registration Dmitry Baryshkov
2024-04-02 10:40   ` Heikki Krogerus
2024-03-29  6:15 ` [PATCH v2 06/11] usb: typec: ucsi: extract code to read PD caps Dmitry Baryshkov
2024-04-02 10:41   ` Heikki Krogerus
2024-03-29  6:15 ` [PATCH v2 07/11] usb: typec: ucsi: support delaying GET_PDOS for device Dmitry Baryshkov
2024-04-02 11:04   ` Heikki Krogerus
2024-03-29  6:15 ` Dmitry Baryshkov [this message]
2024-04-02 11:06   ` [PATCH v2 08/11] usb: typec: ucsi_glink: rework quirks implementation Heikki Krogerus
2024-03-29  6:15 ` [PATCH v2 09/11] usb: typec: ucsi_glink: enable the UCSI_DELAY_DEVICE_PDOS quirk Dmitry Baryshkov
2024-04-02 11:07   ` Heikki Krogerus
2024-03-29  6:15 ` [PATCH v2 10/11] soc: qcom: pmic_glink: reenable UCSI on sc8280xp Dmitry Baryshkov
2024-03-29  6:15 ` [PATCH v2 11/11] soc: qcom: pmic_glink: enable UCSI on sc8180x Dmitry Baryshkov
2024-04-02 11:07   ` Heikki Krogerus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240329-qcom-ucsi-fixes-v2-8-0f5d37ed04db@linaro.org \
    --to=dmitry.baryshkov@linaro.org \
    --cc=andersson@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=johan+linaro@kernel.org \
    --cc=konrad.dybcio@linaro.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=neil.armstrong@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.