Skip to content

Commit e0f7b19

Browse files
kwilczynskibjorn-helgaas
authored andcommitted
PCI: Use kstrtobool() directly, sans strtobool() wrapper
strtobool() is a wrapper around kstrtobool() that has been added for backward compatibility. There is no reason to use the old API, so use kstrtobool() directly. Related: ef95159 ("lib: move strtobool() to kstrtobool()") Link: https://lore.kernel.org/r/20210915230127.2495723-3-kw@linux.com Signed-off-by: Krzysztof Wilczyński <kw@linux.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
1 parent 36f354e commit e0f7b19

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

drivers/pci/p2pdma.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -943,7 +943,7 @@ EXPORT_SYMBOL_GPL(pci_p2pdma_unmap_sg_attrs);
943943
*
944944
* Parses an attribute value to decide whether to enable p2pdma.
945945
* The value can select a PCI device (using its full BDF device
946-
* name) or a boolean (in any format strtobool() accepts). A false
946+
* name) or a boolean (in any format kstrtobool() accepts). A false
947947
* value disables p2pdma, a true value expects the caller
948948
* to automatically find a compatible device and specifying a PCI device
949949
* expects the caller to use the specific provider.
@@ -975,11 +975,11 @@ int pci_p2pdma_enable_store(const char *page, struct pci_dev **p2p_dev,
975975
} else if ((page[0] == '0' || page[0] == '1') && !iscntrl(page[1])) {
976976
/*
977977
* If the user enters a PCI device that doesn't exist
978-
* like "0000:01:00.1", we don't want strtobool to think
978+
* like "0000:01:00.1", we don't want kstrtobool to think
979979
* it's a '0' when it's clearly not what the user wanted.
980980
* So we require 0's and 1's to be exactly one character.
981981
*/
982-
} else if (!strtobool(page, use_p2pdma)) {
982+
} else if (!kstrtobool(page, use_p2pdma)) {
983983
return 0;
984984
}
985985

drivers/pci/pcie/aspm.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1219,7 +1219,7 @@ static ssize_t aspm_attr_store_common(struct device *dev,
12191219
struct pcie_link_state *link = pcie_aspm_get_link(pdev);
12201220
bool state_enable;
12211221

1222-
if (strtobool(buf, &state_enable) < 0)
1222+
if (kstrtobool(buf, &state_enable) < 0)
12231223
return -EINVAL;
12241224

12251225
down_read(&pci_bus_sem);
@@ -1276,7 +1276,7 @@ static ssize_t clkpm_store(struct device *dev,
12761276
struct pcie_link_state *link = pcie_aspm_get_link(pdev);
12771277
bool state_enable;
12781278

1279-
if (strtobool(buf, &state_enable) < 0)
1279+
if (kstrtobool(buf, &state_enable) < 0)
12801280
return -EINVAL;
12811281

12821282
down_read(&pci_bus_sem);

0 commit comments

Comments
 (0)