Page MenuHomeFreeBSD

LinuxKPI: pci: properly define PCI_ANY_ID
Needs ReviewPublic

Authored by bz on Thu, Apr 24, 2:34 PM.
Tags
None
Referenced Files
F115646607: D50008.id.diff
Sat, Apr 26, 12:28 PM
F115641353: D50008.id154226.diff
Sat, Apr 26, 10:35 AM
F115635409: D50008.diff
Sat, Apr 26, 8:23 AM
F115628650: D50008.id154226.diff
Sat, Apr 26, 5:54 AM
Unknown Object (File)
Fri, Apr 25, 11:44 AM
Unknown Object (File)
Fri, Apr 25, 11:33 AM
Unknown Object (File)
Fri, Apr 25, 4:21 AM
Subscribers

Details

Reviewers
None
Group Reviewers
linuxkpi
Summary

PCI vendor/device/subvendor/subdevice IDs are all uint16_t.
If we pass PCI_ANY_ID to a properly typed function we get a warning
given -1U is an unsigned int and that is a different constant value
than uint16_t -1. Add the cast to avoid this problem.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 63710
Build 60594: arc lint + arc unit

Event Timeline

bz requested review of this revision.Thu, Apr 24, 2:34 PM

Hmm, Linux struct pci_device_id has a __u32 vendor, device
Do we use this in any context that would have a 32-bit var?

Hmm, Linux struct pci_device_id has a __u32 vendor, device
Do we use this in any context that would have a 32-bit var?

Grml. I was passing it to [lkpi_]pci_get_device() but that's likely u_int on Linux too? So maybe I need to fix that instead.? But then struct pci_dev also has them as uint16_t in LinuxKPI? Did we go too BSD here and Linux was doing other things beyond the namespace? @jhb knows lots of PCI. Any reason some/all of Linux may have them as uint32_t rather than uint16_t?