public inbox for linux-mmc@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mmc: sdhci-pci: add flag for devices that can support runtime PM
@ 2011-10-17  7:52 Adrian Hunter
  2011-10-17 12:56 ` Chris Ball
  0 siblings, 1 reply; 4+ messages in thread
From: Adrian Hunter @ 2011-10-17  7:52 UTC (permalink / raw)
  To: Chris Ball; +Cc: linux-mmc, Adrian Hunter

Only allow runtime PM for devices that specifically indicate
that they support it.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
---
 drivers/mmc/host/sdhci-pci.c |   17 +++++++++++++----
 1 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/drivers/mmc/host/sdhci-pci.c b/drivers/mmc/host/sdhci-pci.c
index f49b184..c22d810 100644
--- a/drivers/mmc/host/sdhci-pci.c
+++ b/drivers/mmc/host/sdhci-pci.c
@@ -47,6 +47,7 @@ struct sdhci_pci_slot;
 
 struct sdhci_pci_fixes {
 	unsigned int		quirks;
+	unsigned int		allow_runtime_pm:1;
 
 	int			(*probe) (struct sdhci_pci_chip *);
 
@@ -72,6 +73,7 @@ struct sdhci_pci_chip {
 	struct pci_dev		*pdev;
 
 	unsigned int		quirks;
+	unsigned int		allow_runtime_pm:1;
 	const struct sdhci_pci_fixes *fixes;
 
 	int			num_slots;	/* Slots on controller */
@@ -305,16 +307,19 @@ static const struct sdhci_pci_fixes sdhci_intel_mrst_hc1_hc2 = {
 
 static const struct sdhci_pci_fixes sdhci_intel_mfd_sd = {
 	.quirks		= SDHCI_QUIRK_NO_ENDATTR_IN_NOPDESC,
+	.allow_runtime_pm = 1,
 	.probe_slot	= mfd_sd_probe_slot,
 	.remove_slot	= mfd_sd_remove_slot,
 };
 
 static const struct sdhci_pci_fixes sdhci_intel_mfd_sdio = {
 	.quirks		= SDHCI_QUIRK_NO_ENDATTR_IN_NOPDESC,
+	.allow_runtime_pm = 1,
 };
 
 static const struct sdhci_pci_fixes sdhci_intel_mfd_emmc = {
 	.quirks		= SDHCI_QUIRK_NO_ENDATTR_IN_NOPDESC,
+	.allow_runtime_pm = 1,
 	.probe_slot	= mfd_emmc_probe_slot,
 	.remove_slot	= mfd_emmc_remove_slot,
 };
@@ -1355,8 +1360,10 @@ static int __devinit sdhci_pci_probe(struct pci_dev *pdev,
 
 	chip->pdev = pdev;
 	chip->fixes = (const struct sdhci_pci_fixes *)ent->driver_data;
-	if (chip->fixes)
+	if (chip->fixes) {
 		chip->quirks = chip->fixes->quirks;
+		chip->allow_runtime_pm = chip->fixes->allow_runtime_pm;
+	}
 	chip->num_slots = slots;
 
 	pci_set_drvdata(pdev, chip);
@@ -1381,7 +1388,8 @@ static int __devinit sdhci_pci_probe(struct pci_dev *pdev,
 		chip->slots[i] = slot;
 	}
 
-	sdhci_pci_runtime_pm_allow(&pdev->dev);
+	if (chip->allow_runtime_pm)
+		sdhci_pci_runtime_pm_allow(&pdev->dev);
 
 	return 0;
 
@@ -1399,11 +1407,12 @@ static void __devexit sdhci_pci_remove(struct pci_dev *pdev)
 	int i;
 	struct sdhci_pci_chip *chip;
 
-	sdhci_pci_runtime_pm_forbid(&pdev->dev);
-
 	chip = pci_get_drvdata(pdev);
 
 	if (chip) {
+		if (chip->allow_runtime_pm)
+			sdhci_pci_runtime_pm_forbid(&pdev->dev);
+
 		for (i = 0; i < chip->num_slots; i++)
 			sdhci_pci_remove_slot(chip->slots[i]);
 
-- 
1.7.6.4


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] mmc: sdhci-pci: add flag for devices that can support runtime PM
  2011-10-17  7:52 [PATCH] mmc: sdhci-pci: add flag for devices that can support runtime PM Adrian Hunter
@ 2011-10-17 12:56 ` Chris Ball
  2011-10-17 13:59   ` Adrian Hunter
  0 siblings, 1 reply; 4+ messages in thread
From: Chris Ball @ 2011-10-17 12:56 UTC (permalink / raw)
  To: Adrian Hunter; +Cc: linux-mmc

Hi Adrian,

On Mon, Oct 17 2011, Adrian Hunter wrote:
> Only allow runtime PM for devices that specifically indicate
> that they support it.
>
> Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
>  drivers/mmc/host/sdhci-pci.c |   17 +++++++++++++----
>  1 files changed, 13 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/mmc/host/sdhci-pci.c b/drivers/mmc/host/sdhci-pci.c
> index f49b184..c22d810 100644
> --- a/drivers/mmc/host/sdhci-pci.c
> +++ b/drivers/mmc/host/sdhci-pci.c
> @@ -47,6 +47,7 @@ struct sdhci_pci_slot;
>  
>  struct sdhci_pci_fixes {
>  	unsigned int		quirks;
> +	unsigned int		allow_runtime_pm:1;

Thanks -- any objection to using a bool type instead for allow_runtime_pm?

-- 
Chris Ball   <cjb@laptop.org>   <http://printf.net/>
One Laptop Per Child

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] mmc: sdhci-pci: add flag for devices that can support runtime PM
  2011-10-17 12:56 ` Chris Ball
@ 2011-10-17 13:59   ` Adrian Hunter
  2011-10-17 14:09     ` Chris Ball
  0 siblings, 1 reply; 4+ messages in thread
From: Adrian Hunter @ 2011-10-17 13:59 UTC (permalink / raw)
  To: Chris Ball; +Cc: linux-mmc

On 17/10/11 15:56, Chris Ball wrote:
> Hi Adrian,
> 
> On Mon, Oct 17 2011, Adrian Hunter wrote:
>> Only allow runtime PM for devices that specifically indicate
>> that they support it.
>>
>> Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
>>  drivers/mmc/host/sdhci-pci.c |   17 +++++++++++++----
>>  1 files changed, 13 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/mmc/host/sdhci-pci.c b/drivers/mmc/host/sdhci-pci.c
>> index f49b184..c22d810 100644
>> --- a/drivers/mmc/host/sdhci-pci.c
>> +++ b/drivers/mmc/host/sdhci-pci.c
>> @@ -47,6 +47,7 @@ struct sdhci_pci_slot;
>>  
>>  struct sdhci_pci_fixes {
>>  	unsigned int		quirks;
>> +	unsigned int		allow_runtime_pm:1;
> 
> Thanks -- any objection to using a bool type instead for allow_runtime_pm?

None at all



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] mmc: sdhci-pci: add flag for devices that can support runtime PM
  2011-10-17 13:59   ` Adrian Hunter
@ 2011-10-17 14:09     ` Chris Ball
  0 siblings, 0 replies; 4+ messages in thread
From: Chris Ball @ 2011-10-17 14:09 UTC (permalink / raw)
  To: Adrian Hunter; +Cc: linux-mmc

Hi,

On Mon, Oct 17 2011, Adrian Hunter wrote:
>> Thanks -- any objection to using a bool type instead for allow_runtime_pm?
>
> None at all

Pushed to mmc-next for 3.2 with a conversion to bool, thanks:

diff --git a/drivers/mmc/host/sdhci-pci.c b/drivers/mmc/host/sdhci-pci.c
index c22d810..d833d9c 100644
--- a/drivers/mmc/host/sdhci-pci.c
+++ b/drivers/mmc/host/sdhci-pci.c
@@ -47,7 +47,7 @@ struct sdhci_pci_slot;
 
 struct sdhci_pci_fixes {
 	unsigned int		quirks;
-	unsigned int		allow_runtime_pm:1;
+	bool			allow_runtime_pm;
 
 	int			(*probe) (struct sdhci_pci_chip *);
 
@@ -73,7 +73,7 @@ struct sdhci_pci_chip {
 	struct pci_dev		*pdev;
 
 	unsigned int		quirks;
-	unsigned int		allow_runtime_pm:1;
+	bool			allow_runtime_pm;
 	const struct sdhci_pci_fixes *fixes;
 
 	int			num_slots;	/* Slots on controller */
@@ -307,19 +307,19 @@ static const struct sdhci_pci_fixes sdhci_intel_mrst_hc1_hc2 = {
 
 static const struct sdhci_pci_fixes sdhci_intel_mfd_sd = {
 	.quirks		= SDHCI_QUIRK_NO_ENDATTR_IN_NOPDESC,
-	.allow_runtime_pm = 1,
+	.allow_runtime_pm = true,
 	.probe_slot	= mfd_sd_probe_slot,
 	.remove_slot	= mfd_sd_remove_slot,
 };
 
 static const struct sdhci_pci_fixes sdhci_intel_mfd_sdio = {
 	.quirks		= SDHCI_QUIRK_NO_ENDATTR_IN_NOPDESC,
-	.allow_runtime_pm = 1,
+	.allow_runtime_pm = true,
 };
 
 static const struct sdhci_pci_fixes sdhci_intel_mfd_emmc = {
 	.quirks		= SDHCI_QUIRK_NO_ENDATTR_IN_NOPDESC,
-	.allow_runtime_pm = 1,
+	.allow_runtime_pm = true,
 	.probe_slot	= mfd_emmc_probe_slot,
 	.remove_slot	= mfd_emmc_remove_slot,
 };

-- 
Chris Ball   <cjb@laptop.org>   <http://printf.net/>
One Laptop Per Child

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-10-17 14:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-17  7:52 [PATCH] mmc: sdhci-pci: add flag for devices that can support runtime PM Adrian Hunter
2011-10-17 12:56 ` Chris Ball
2011-10-17 13:59   ` Adrian Hunter
2011-10-17 14:09     ` Chris Ball

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox