linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Adrian Hunter <adrian.hunter@intel.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Joerg Roedel <joro@8bytes.org>,
	iommu@lists.linux-foundation.org,
	Ulf Hansson <ulf.hansson@linaro.org>,
	linux-mmc@vger.kernel.org,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>,
	linux-acpi@vger.kernel.org,
	Mika Westerberg <mika.westerberg@linux.intel.com>
Subject: Re: [PATCH v3 5/6] mmc: sdhci-acpi: Switch to use acpi_dev_hid_uid_match()
Date: Wed, 2 Oct 2019 14:16:56 +0300	[thread overview]
Message-ID: <8a0435b1-beee-d84b-aeda-9a38d655d96a@intel.com> (raw)
In-Reply-To: <20191001142725.30857-6-andriy.shevchenko@linux.intel.com>

On 1/10/19 5:27 PM, Andy Shevchenko wrote:
> Since we have a generic helper, drop custom implementation in the driver.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>

Acked-by: Adrian Hunter <adrian.hunter@intel.com>

> ---
>  drivers/mmc/host/sdhci-acpi.c | 49 ++++++++++++-----------------------
>  1 file changed, 16 insertions(+), 33 deletions(-)
> 
> diff --git a/drivers/mmc/host/sdhci-acpi.c b/drivers/mmc/host/sdhci-acpi.c
> index 1604f512c7bd..105e73d4a3b9 100644
> --- a/drivers/mmc/host/sdhci-acpi.c
> +++ b/drivers/mmc/host/sdhci-acpi.c
> @@ -61,7 +61,7 @@ struct sdhci_acpi_slot {
>  	mmc_pm_flag_t	pm_caps;
>  	unsigned int	flags;
>  	size_t		priv_size;
> -	int (*probe_slot)(struct platform_device *, const char *, const char *);
> +	int (*probe_slot)(struct platform_device *, struct acpi_device *);
>  	int (*remove_slot)(struct platform_device *);
>  	int (*free_slot)(struct platform_device *pdev);
>  	int (*setup_host)(struct platform_device *pdev);
> @@ -325,12 +325,10 @@ static bool sdhci_acpi_cht_pci_wifi(unsigned int vendor, unsigned int device,
>   * wifi card in the expected slot with an ACPI companion node, is used to
>   * indicate that acpi_device_fix_up_power() should be avoided.
>   */
> -static inline bool sdhci_acpi_no_fixup_child_power(const char *hid,
> -						   const char *uid)
> +static inline bool sdhci_acpi_no_fixup_child_power(struct acpi_device *adev)
>  {
>  	return sdhci_acpi_cht() &&
> -	       !strcmp(hid, "80860F14") &&
> -	       !strcmp(uid, "2") &&
> +	       acpi_dev_hid_uid_match(adev, "80860F14", "2") &&
>  	       sdhci_acpi_cht_pci_wifi(0x14e4, 0x43ec, 0, 28);
>  }
>  
> @@ -345,8 +343,7 @@ static inline bool sdhci_acpi_byt_defer(struct device *dev)
>  	return false;
>  }
>  
> -static inline bool sdhci_acpi_no_fixup_child_power(const char *hid,
> -						   const char *uid)
> +static inline bool sdhci_acpi_no_fixup_child_power(struct acpi_device *adev)
>  {
>  	return false;
>  }
> @@ -375,19 +372,18 @@ static int bxt_get_cd(struct mmc_host *mmc)
>  	return ret;
>  }
>  
> -static int intel_probe_slot(struct platform_device *pdev, const char *hid,
> -			    const char *uid)
> +static int intel_probe_slot(struct platform_device *pdev, struct acpi_device *adev)
>  {
>  	struct sdhci_acpi_host *c = platform_get_drvdata(pdev);
>  	struct intel_host *intel_host = sdhci_acpi_priv(c);
>  	struct sdhci_host *host = c->host;
>  
> -	if (hid && uid && !strcmp(hid, "80860F14") && !strcmp(uid, "1") &&
> +	if (acpi_dev_hid_uid_match(adev, "80860F14", "1") &&
>  	    sdhci_readl(host, SDHCI_CAPABILITIES) == 0x446cc8b2 &&
>  	    sdhci_readl(host, SDHCI_CAPABILITIES_1) == 0x00000807)
>  		host->timeout_clk = 1000; /* 1000 kHz i.e. 1 MHz */
>  
> -	if (hid && !strcmp(hid, "80865ACA"))
> +	if (acpi_dev_hid_uid_match(adev, "80865ACA", NULL))
>  		host->mmc_host_ops.get_cd = bxt_get_cd;
>  
>  	intel_dsm_init(intel_host, &pdev->dev, host->mmc);
> @@ -473,8 +469,7 @@ static irqreturn_t sdhci_acpi_qcom_handler(int irq, void *ptr)
>  	return IRQ_HANDLED;
>  }
>  
> -static int qcom_probe_slot(struct platform_device *pdev, const char *hid,
> -			   const char *uid)
> +static int qcom_probe_slot(struct platform_device *pdev, struct acpi_device *adev)
>  {
>  	struct sdhci_acpi_host *c = platform_get_drvdata(pdev);
>  	struct sdhci_host *host = c->host;
> @@ -482,7 +477,7 @@ static int qcom_probe_slot(struct platform_device *pdev, const char *hid,
>  
>  	*irq = -EINVAL;
>  
> -	if (strcmp(hid, "QCOM8051"))
> +	if (!acpi_dev_hid_uid_match(adev, "QCOM8051", NULL))
>  		return 0;
>  
>  	*irq = platform_get_irq(pdev, 1);
> @@ -501,14 +496,12 @@ static int qcom_free_slot(struct platform_device *pdev)
>  	struct sdhci_host *host = c->host;
>  	struct acpi_device *adev;
>  	int *irq = sdhci_acpi_priv(c);
> -	const char *hid;
>  
>  	adev = ACPI_COMPANION(dev);
>  	if (!adev)
>  		return -ENODEV;
>  
> -	hid = acpi_device_hid(adev);
> -	if (strcmp(hid, "QCOM8051"))
> +	if (!acpi_dev_hid_uid_match(adev, "QCOM8051", NULL))
>  		return 0;
>  
>  	if (*irq < 0)
> @@ -583,7 +576,7 @@ static const struct sdhci_acpi_chip sdhci_acpi_chip_amd = {
>  };
>  
>  static int sdhci_acpi_emmc_amd_probe_slot(struct platform_device *pdev,
> -					  const char *hid, const char *uid)
> +					  struct acpi_device *adev)
>  {
>  	struct sdhci_acpi_host *c = platform_get_drvdata(pdev);
>  	struct sdhci_host *host   = c->host;
> @@ -654,17 +647,12 @@ static const struct acpi_device_id sdhci_acpi_ids[] = {
>  };
>  MODULE_DEVICE_TABLE(acpi, sdhci_acpi_ids);
>  
> -static const struct sdhci_acpi_slot *sdhci_acpi_get_slot(const char *hid,
> -							 const char *uid)
> +static const struct sdhci_acpi_slot *sdhci_acpi_get_slot(struct acpi_device *adev)
>  {
>  	const struct sdhci_acpi_uid_slot *u;
>  
>  	for (u = sdhci_acpi_uids; u->hid; u++) {
> -		if (strcmp(u->hid, hid))
> -			continue;
> -		if (!u->uid)
> -			return u->slot;
> -		if (uid && !strcmp(u->uid, uid))
> +		if (acpi_dev_hid_uid_match(adev, u->hid, u->uid))
>  			return u->slot;
>  	}
>  	return NULL;
> @@ -680,22 +668,17 @@ static int sdhci_acpi_probe(struct platform_device *pdev)
>  	struct resource *iomem;
>  	resource_size_t len;
>  	size_t priv_size;
> -	const char *hid;
> -	const char *uid;
>  	int err;
>  
>  	device = ACPI_COMPANION(dev);
>  	if (!device)
>  		return -ENODEV;
>  
> -	hid = acpi_device_hid(device);
> -	uid = acpi_device_uid(device);
> -
> -	slot = sdhci_acpi_get_slot(hid, uid);
> +	slot = sdhci_acpi_get_slot(device);
>  
>  	/* Power on the SDHCI controller and its children */
>  	acpi_device_fix_up_power(device);
> -	if (!sdhci_acpi_no_fixup_child_power(hid, uid)) {
> +	if (!sdhci_acpi_no_fixup_child_power(device)) {
>  		list_for_each_entry(child, &device->children, node)
>  			if (child->status.present && child->status.enabled)
>  				acpi_device_fix_up_power(child);
> @@ -745,7 +728,7 @@ static int sdhci_acpi_probe(struct platform_device *pdev)
>  
>  	if (c->slot) {
>  		if (c->slot->probe_slot) {
> -			err = c->slot->probe_slot(pdev, hid, uid);
> +			err = c->slot->probe_slot(pdev, device);
>  			if (err)
>  				goto err_free;
>  		}
> 


  reply	other threads:[~2019-10-02 11:18 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-01 14:27 [PATCH v3 0/6] ACPI / utils: add new helper for HID/UID match Andy Shevchenko
2019-10-01 14:27 ` [PATCH v3 1/6] ACPI / utils: Describe function parameters in kernel-doc Andy Shevchenko
2019-10-01 14:27 ` [PATCH v3 2/6] ACPI / utils: Move acpi_dev_get_first_match_dev() under CONFIG_ACPI Andy Shevchenko
2019-10-01 14:27 ` [PATCH v3 3/6] ACPI / utils: Introduce acpi_dev_hid_uid_match() helper Andy Shevchenko
2019-10-01 14:27 ` [PATCH v3 4/6] ACPI / LPSS: Switch to use acpi_dev_hid_uid_match() Andy Shevchenko
2019-10-01 14:27 ` [PATCH v3 5/6] mmc: sdhci-acpi: " Andy Shevchenko
2019-10-02 11:16   ` Adrian Hunter [this message]
2019-10-01 14:27 ` [PATCH v3 6/6] iommu/amd: " Andy Shevchenko
2019-10-08 21:46   ` Jerry Snitselaar
2019-10-03 10:00 ` [PATCH v3 0/6] ACPI / utils: add new helper for HID/UID match Ulf Hansson
2019-10-03 10:17   ` Andy Shevchenko
2019-10-11  9:16 ` Rafael J. Wysocki

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=8a0435b1-beee-d84b-aeda-9a38d655d96a@intel.com \
    --to=adrian.hunter@intel.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=iommu@lists.linux-foundation.org \
    --cc=joro@8bytes.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=mika.westerberg@linux.intel.com \
    --cc=rjw@rjwysocki.net \
    --cc=ulf.hansson@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).