From: Puranjay Mohan <puranjay12@gmail.com> To: bjorn@helgaas.com Cc: Puranjay Mohan <puranjay12@gmail.com>, linux-pci@vger.kernel.org, linux-kernel-mentees@lists.linuxfoundation.org, skhan@linuxfoundation.org Subject: [PATCH v1] PCI: Return u8 from pci_find_capability() Date: Sun, 29 Nov 2020 22:16:26 +0530 [thread overview] Message-ID: <20201129164626.12887-1-puranjay12@gmail.com> (raw) PCI Capabilities are linked in a list that must appear in the first 256 bytes of config space. The pointer to capabilities is of 8 bits. Change the return type of pci_find_capability() and supporting functions from int to u8 to match the specification. Signed-off-by: Puranjay Mohan <puranjay12@gmail.com> --- v1 - change return types of supporting functions of pci_find_capability. --- drivers/pci/pci.c | 8 ++++---- include/linux/pci.h | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index e578d34095e9..5caae09e0d20 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -399,7 +399,7 @@ static int pci_dev_str_match(struct pci_dev *dev, const char *p, return 1; } -static int __pci_find_next_cap_ttl(struct pci_bus *bus, unsigned int devfn, +static u8 __pci_find_next_cap_ttl(struct pci_bus *bus, unsigned int devfn, u8 pos, int cap, int *ttl) { u8 id; @@ -438,7 +438,7 @@ int pci_find_next_capability(struct pci_dev *dev, u8 pos, int cap) } EXPORT_SYMBOL_GPL(pci_find_next_capability); -static int __pci_bus_find_cap_start(struct pci_bus *bus, +static u8 __pci_bus_find_cap_start(struct pci_bus *bus, unsigned int devfn, u8 hdr_type) { u16 status; @@ -477,9 +477,9 @@ static int __pci_bus_find_cap_start(struct pci_bus *bus, * %PCI_CAP_ID_PCIX PCI-X * %PCI_CAP_ID_EXP PCI Express */ -int pci_find_capability(struct pci_dev *dev, int cap) +u8 pci_find_capability(struct pci_dev *dev, int cap) { - int pos; + u8 pos; pos = __pci_bus_find_cap_start(dev->bus, dev->devfn, dev->hdr_type); if (pos) diff --git a/include/linux/pci.h b/include/linux/pci.h index 22207a79762c..19a817702ea9 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -1063,7 +1063,7 @@ void pci_sort_breadthfirst(void); /* Generic PCI functions exported to card drivers */ -int pci_find_capability(struct pci_dev *dev, int cap); +u8 pci_find_capability(struct pci_dev *dev, int cap); int pci_find_next_capability(struct pci_dev *dev, u8 pos, int cap); int pci_find_ext_capability(struct pci_dev *dev, int cap); int pci_find_next_ext_capability(struct pci_dev *dev, int pos, int cap); @@ -1719,7 +1719,7 @@ static inline int __pci_register_driver(struct pci_driver *drv, static inline int pci_register_driver(struct pci_driver *drv) { return 0; } static inline void pci_unregister_driver(struct pci_driver *drv) { } -static inline int pci_find_capability(struct pci_dev *dev, int cap) +static inline u8 pci_find_capability(struct pci_dev *dev, int cap) { return 0; } static inline int pci_find_next_capability(struct pci_dev *dev, u8 post, int cap) -- 2.27.0
WARNING: multiple messages have this Message-ID (diff)
From: Puranjay Mohan <puranjay12@gmail.com> To: bjorn@helgaas.com Cc: linux-pci@vger.kernel.org, linux-kernel-mentees@lists.linuxfoundation.org, Puranjay Mohan <puranjay12@gmail.com> Subject: [Linux-kernel-mentees] [PATCH v1] PCI: Return u8 from pci_find_capability() Date: Sun, 29 Nov 2020 22:16:26 +0530 [thread overview] Message-ID: <20201129164626.12887-1-puranjay12@gmail.com> (raw) PCI Capabilities are linked in a list that must appear in the first 256 bytes of config space. The pointer to capabilities is of 8 bits. Change the return type of pci_find_capability() and supporting functions from int to u8 to match the specification. Signed-off-by: Puranjay Mohan <puranjay12@gmail.com> --- v1 - change return types of supporting functions of pci_find_capability. --- drivers/pci/pci.c | 8 ++++---- include/linux/pci.h | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index e578d34095e9..5caae09e0d20 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -399,7 +399,7 @@ static int pci_dev_str_match(struct pci_dev *dev, const char *p, return 1; } -static int __pci_find_next_cap_ttl(struct pci_bus *bus, unsigned int devfn, +static u8 __pci_find_next_cap_ttl(struct pci_bus *bus, unsigned int devfn, u8 pos, int cap, int *ttl) { u8 id; @@ -438,7 +438,7 @@ int pci_find_next_capability(struct pci_dev *dev, u8 pos, int cap) } EXPORT_SYMBOL_GPL(pci_find_next_capability); -static int __pci_bus_find_cap_start(struct pci_bus *bus, +static u8 __pci_bus_find_cap_start(struct pci_bus *bus, unsigned int devfn, u8 hdr_type) { u16 status; @@ -477,9 +477,9 @@ static int __pci_bus_find_cap_start(struct pci_bus *bus, * %PCI_CAP_ID_PCIX PCI-X * %PCI_CAP_ID_EXP PCI Express */ -int pci_find_capability(struct pci_dev *dev, int cap) +u8 pci_find_capability(struct pci_dev *dev, int cap) { - int pos; + u8 pos; pos = __pci_bus_find_cap_start(dev->bus, dev->devfn, dev->hdr_type); if (pos) diff --git a/include/linux/pci.h b/include/linux/pci.h index 22207a79762c..19a817702ea9 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -1063,7 +1063,7 @@ void pci_sort_breadthfirst(void); /* Generic PCI functions exported to card drivers */ -int pci_find_capability(struct pci_dev *dev, int cap); +u8 pci_find_capability(struct pci_dev *dev, int cap); int pci_find_next_capability(struct pci_dev *dev, u8 pos, int cap); int pci_find_ext_capability(struct pci_dev *dev, int cap); int pci_find_next_ext_capability(struct pci_dev *dev, int pos, int cap); @@ -1719,7 +1719,7 @@ static inline int __pci_register_driver(struct pci_driver *drv, static inline int pci_register_driver(struct pci_driver *drv) { return 0; } static inline void pci_unregister_driver(struct pci_driver *drv) { } -static inline int pci_find_capability(struct pci_dev *dev, int cap) +static inline u8 pci_find_capability(struct pci_dev *dev, int cap) { return 0; } static inline int pci_find_next_capability(struct pci_dev *dev, u8 post, int cap) -- 2.27.0 _______________________________________________ Linux-kernel-mentees mailing list Linux-kernel-mentees@lists.linuxfoundation.org https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees
next reply other threads:[~2020-11-29 16:47 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-11-29 16:46 Puranjay Mohan [this message] 2020-11-29 16:46 ` [Linux-kernel-mentees] [PATCH v1] PCI: Return u8 from pci_find_capability() Puranjay Mohan 2020-12-04 21:21 ` Bjorn Helgaas 2020-12-04 21:21 ` [Linux-kernel-mentees] " Bjorn Helgaas 2020-12-04 21:22 ` Bjorn Helgaas 2020-12-04 21:22 ` [Linux-kernel-mentees] " Bjorn Helgaas
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=20201129164626.12887-1-puranjay12@gmail.com \ --to=puranjay12@gmail.com \ --cc=bjorn@helgaas.com \ --cc=linux-kernel-mentees@lists.linuxfoundation.org \ --cc=linux-pci@vger.kernel.org \ --cc=skhan@linuxfoundation.org \ /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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.