linux-mmc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Aaron Lu <aaron.lu@intel.com>
To: Jackey Shen <jackey.shen@amd.com>
Cc: alexander.stein@systec-electronic.com,
	manuel.lauss@googlemail.com, hanfi@spahan.ch,
	linux-mmc@vger.kernel.org, mcuos.com@gmail.com,
	Ray.Huang@amd.com
Subject: Re: [PATCH V2] mmc: sdhci: supporting PCI MSI
Date: Wed, 13 Nov 2013 21:40:06 +0800	[thread overview]
Message-ID: <52838136.1090509@intel.com> (raw)
In-Reply-To: <20131113060011.GB3755@ubuntu.amd.com>

On 11/13/2013 02:00 PM, Jackey Shen wrote:
> On Wed, Nov 13, 2013 at 01:55:08PM +0800, Jackey Shen wrote:
>>>>> What about we only call pci_enable_msi in sdhci-pci.c and then assign
>>>>> host->irq appropriately before calling sdhci_add_host, will that work?
>>>>> The only difference would be, request_irq will have SHARED flag, but I
>>>>> suppose that's not a problem.
>>>>>
>>>> There are 2 points for this part:
>>>> 1. fall back to legacy interrupt right after MSI request fails;
>>>
>>> If we call pci_enable_msi somewhere in sdhci_pci_probe_slot, then if it
>>> failed, we can also fall back I suppose?
>>>
>> Yes, it is. 
>> But, sdhci_pci_disable_msi should be kept since pci_disable_msi is
>> pci bus releted and better not used in sdhci.c.
>> So, enable msi and disable msi are NOT symmetric in style.
>> What's your opinion?
> 
> Sorry for missing word.
> So, enable msi and disable msi are NOT symmetric in style.
>

I meant something like this:

diff --git a/drivers/mmc/host/sdhci-pci.c b/drivers/mmc/host/sdhci-pci.c
index d7d6bc8..96461a3 100644
--- a/drivers/mmc/host/sdhci-pci.c
+++ b/drivers/mmc/host/sdhci-pci.c
@@ -1339,12 +1339,17 @@ static struct sdhci_pci_slot *sdhci_pci_probe_slot(
 	host->quirks = chip->quirks;
 	host->quirks2 = chip->quirks2;

+	ret = pci_enable_msi(pdev);
+	if (ret) {
+		dev_err(&pdev->dev, "cannot enable msi\n");
+		goto cleanup;
+	}
 	host->irq = pdev->irq;

 	ret = pci_request_region(pdev, bar, mmc_hostname(host->mmc));
 	if (ret) {
 		dev_err(&pdev->dev, "cannot request region\n");
-		goto cleanup;
+		goto disable_msi;
 	}

 	host->ioaddr = pci_ioremap_bar(pdev, bar);
@@ -1396,6 +1401,9 @@ unmap:
 release:
 	pci_release_region(pdev, bar);

+disable_msi:
+	pci_disable_msi(pdev);
+
 cleanup:
 	if (slot->data && slot->data->cleanup)
 		slot->data->cleanup(slot->data);
@@ -1431,6 +1439,8 @@ static void sdhci_pci_remove_slot(struct sdhci_pci_slot *slot)

 	pci_release_region(slot->chip->pdev, slot->pci_bar);

+	pci_disable_msi(slot->chip->pdev);
+
 	sdhci_free_host(slot->host);
 }


We can do all these MSI stuffs in sdhci-pci.c, but I'm not sure if this
is correct.

Thanks,
Aaron

      reply	other threads:[~2013-11-13 13:40 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-12  6:56 [PATCH V2] mmc: sdhci: supporting PCI MSI Jackey Shen
2013-11-12  7:44 ` Aaron Lu
2013-11-12  9:27   ` Jackey Shen
2013-11-12 10:35     ` Jackey Shen
2013-11-13  0:54     ` Aaron Lu
2013-11-13  5:55       ` Jackey Shen
2013-11-13  6:00         ` Jackey Shen
2013-11-13 13:40           ` Aaron Lu [this message]

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=52838136.1090509@intel.com \
    --to=aaron.lu@intel.com \
    --cc=Ray.Huang@amd.com \
    --cc=alexander.stein@systec-electronic.com \
    --cc=hanfi@spahan.ch \
    --cc=jackey.shen@amd.com \
    --cc=linux-mmc@vger.kernel.org \
    --cc=manuel.lauss@googlemail.com \
    --cc=mcuos.com@gmail.com \
    /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).