Re: [PATCH v2 08/11] usb: typec: ucsi_glink: rework quirks implementation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Mar 29, 2024 at 08:15:40AM +0200, Dmitry Baryshkov wrote:
> 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@xxxxxxxxxx>

Reviewed-by: Heikki Krogerus <heikki.krogerus@xxxxxxxxxxxxxxx>

> ---
>  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

-- 
heikki




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux