Skip to content

Commit 9649f64

Browse files
committed
mmc: sdhci-pci: Remove dead code (cd_gpio, cd_irq et al)
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2144641 commit 67f7296 Author: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Date: Thu, 14 Oct 2021 16:26:12 +0300 The last user of this struct gone couple of releases ago. Remove the dead code for good and encourage people to use MMC core functionality for that. The removal is dependent on the previous removal of the struct sdhci_pci_data. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Acked-by: Adrian Hunter <adrian.hunter@intel.com> Link: https://lore.kernel.org/r/20211014132613.27861-5-andriy.shevchenko@linux.intel.com Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Signed-off-by: Mark Salter <msalter@redhat.com>
1 parent 7aa9beb commit 9649f64

File tree

2 files changed

+1
-77
lines changed

2 files changed

+1
-77
lines changed

drivers/mmc/host/sdhci-pci-core.c

Lines changed: 1 addition & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -345,73 +345,6 @@ static int pch_hc_probe_slot(struct sdhci_pci_slot *slot)
345345
return 0;
346346
}
347347

348-
#ifdef CONFIG_PM
349-
350-
static irqreturn_t sdhci_pci_sd_cd(int irq, void *dev_id)
351-
{
352-
struct sdhci_pci_slot *slot = dev_id;
353-
struct sdhci_host *host = slot->host;
354-
355-
mmc_detect_change(host->mmc, msecs_to_jiffies(200));
356-
return IRQ_HANDLED;
357-
}
358-
359-
static void sdhci_pci_add_own_cd(struct sdhci_pci_slot *slot)
360-
{
361-
int err, irq, gpio = slot->cd_gpio;
362-
363-
slot->cd_gpio = -EINVAL;
364-
slot->cd_irq = -EINVAL;
365-
366-
if (!gpio_is_valid(gpio))
367-
return;
368-
369-
err = devm_gpio_request(&slot->chip->pdev->dev, gpio, "sd_cd");
370-
if (err < 0)
371-
goto out;
372-
373-
err = gpio_direction_input(gpio);
374-
if (err < 0)
375-
goto out_free;
376-
377-
irq = gpio_to_irq(gpio);
378-
if (irq < 0)
379-
goto out_free;
380-
381-
err = request_irq(irq, sdhci_pci_sd_cd, IRQF_TRIGGER_RISING |
382-
IRQF_TRIGGER_FALLING, "sd_cd", slot);
383-
if (err)
384-
goto out_free;
385-
386-
slot->cd_gpio = gpio;
387-
slot->cd_irq = irq;
388-
389-
return;
390-
391-
out_free:
392-
devm_gpio_free(&slot->chip->pdev->dev, gpio);
393-
out:
394-
dev_warn(&slot->chip->pdev->dev, "failed to setup card detect wake up\n");
395-
}
396-
397-
static void sdhci_pci_remove_own_cd(struct sdhci_pci_slot *slot)
398-
{
399-
if (slot->cd_irq >= 0)
400-
free_irq(slot->cd_irq, slot);
401-
}
402-
403-
#else
404-
405-
static inline void sdhci_pci_add_own_cd(struct sdhci_pci_slot *slot)
406-
{
407-
}
408-
409-
static inline void sdhci_pci_remove_own_cd(struct sdhci_pci_slot *slot)
410-
{
411-
}
412-
413-
#endif
414-
415348
static int mfd_emmc_probe_slot(struct sdhci_pci_slot *slot)
416349
{
417350
slot->host->mmc->caps |= MMC_CAP_8_BIT_DATA | MMC_CAP_NONREMOVABLE;
@@ -2123,7 +2056,6 @@ static struct sdhci_pci_slot *sdhci_pci_probe_slot(
21232056
slot->chip = chip;
21242057
slot->host = host;
21252058
slot->rst_n_gpio = -EINVAL;
2126-
slot->cd_gpio = -EINVAL;
21272059
slot->cd_idx = -1;
21282060

21292061
host->hw_name = "PCI";
@@ -2194,15 +2126,11 @@ static struct sdhci_pci_slot *sdhci_pci_probe_slot(
21942126
if (ret)
21952127
goto remove;
21962128

2197-
sdhci_pci_add_own_cd(slot);
2198-
21992129
/*
22002130
* Check if the chip needs a separate GPIO for card detect to wake up
22012131
* from runtime suspend. If it is not there, don't allow runtime PM.
2202-
* Note sdhci_pci_add_own_cd() sets slot->cd_gpio to -EINVAL on failure.
22032132
*/
2204-
if (chip->fixes && chip->fixes->own_cd_for_runtime_pm &&
2205-
!gpio_is_valid(slot->cd_gpio) && slot->cd_idx < 0)
2133+
if (chip->fixes && chip->fixes->own_cd_for_runtime_pm && slot->cd_idx < 0)
22062134
chip->allow_runtime_pm = false;
22072135

22082136
return slot;
@@ -2222,8 +2150,6 @@ static void sdhci_pci_remove_slot(struct sdhci_pci_slot *slot)
22222150
int dead;
22232151
u32 scratch;
22242152

2225-
sdhci_pci_remove_own_cd(slot);
2226-
22272153
dead = 0;
22282154
scratch = readl(slot->host->ioaddr + SDHCI_INT_STATUS);
22292155
if (scratch == (u32)-1)

drivers/mmc/host/sdhci-pci.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,6 @@ struct sdhci_pci_slot {
158158
struct sdhci_host *host;
159159

160160
int rst_n_gpio;
161-
int cd_gpio;
162-
int cd_irq;
163161

164162
int cd_idx;
165163
bool cd_override_level;

0 commit comments

Comments
 (0)