summaryrefslogtreecommitdiff
path: root/drivers/misc/cardreader/rts5249.c
diff options
context:
space:
mode:
authorBjorn Helgaas <bhelgaas@google.com>2020-07-21 16:23:35 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-07-22 13:34:27 +0200
commited86a9877d05b99088a409a7603828b818a433dc (patch)
tree436f0f9618360dd11ed87d858ea4292988fac325 /drivers/misc/cardreader/rts5249.c
parent22bf3251d7b7da0339f41ec27f2c3d4e0ec02255 (diff)
downloadlwn-ed86a9877d05b99088a409a7603828b818a433dc.tar.gz
lwn-ed86a9877d05b99088a409a7603828b818a433dc.zip
misc: rtsx: Find L1 PM Substates capability instead of hard-coding
Instead of hard-coding the location of the L1 PM Substates capability based on the Device ID, search for it in the extended capabilities list. This works for any device, as long as it implements the L1 PM Substates capability correctly, so it doesn't require maintenance as new devices are added. No functional change intended. Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Acked-by: Arnd Bergmann <arnd@arndb.de> Link: https://lore.kernel.org/r/20200721212336.1159079-5-helgaas@kernel.org [ minor addition due to differences in my tree - gregkh] Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/misc/cardreader/rts5249.c')
-rw-r--r--drivers/misc/cardreader/rts5249.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/misc/cardreader/rts5249.c b/drivers/misc/cardreader/rts5249.c
index 665472d05993..1b8149e806c1 100644
--- a/drivers/misc/cardreader/rts5249.c
+++ b/drivers/misc/cardreader/rts5249.c
@@ -95,15 +95,15 @@ static void rtsx_base_force_power_down(struct rtsx_pcr *pcr, u8 pm_state)
static void rts5249_init_from_cfg(struct rtsx_pcr *pcr)
{
struct pci_dev *pdev = pcr->pci;
+ int l1ss;
struct rtsx_cr_option *option = &(pcr->option);
u32 lval;
- if (CHK_PCI_PID(pcr, PID_524A))
- pci_read_config_dword(pdev,
- PCR_ASPM_SETTING_REG1, &lval);
- else
- pci_read_config_dword(pdev,
- PCR_ASPM_SETTING_REG2, &lval);
+ l1ss = pci_find_ext_capability(pdev, PCI_EXT_CAP_ID_L1SS);
+ if (!l1ss)
+ return;
+
+ pci_read_config_dword(pdev, l1ss + PCI_L1SS_CTL1, &lval);
if (lval & ASPM_L1_1_EN_MASK)
rtsx_set_dev_flag(pcr, ASPM_L1_1_EN);