@@ -45,14 +45,7 @@ impl PciAddress {
4545
4646impl fmt:: Display for PciAddress {
4747 fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
48- write ! (
49- f,
50- "{:02x}-{:02x}:{:02x}.{}" ,
51- self . segment( ) ,
52- self . bus( ) ,
53- self . device( ) ,
54- self . function( )
55- )
48+ write ! ( f, "{:02x}-{:02x}:{:02x}.{}" , self . segment( ) , self . bus( ) , self . device( ) , self . function( ) )
5649 }
5750}
5851
@@ -133,32 +126,27 @@ pub trait ConfigRegionAccess: Send {
133126/// | | | line | line |
134127/// +--------------+--------------+--------------+--------------+
135128/// ```
136- pub struct PciHeader < A > ( PciAddress , PhantomData < A > )
137- where
138- A : ConfigRegionAccess ;
139-
140- impl < A > PciHeader < A >
141- where
142- A : ConfigRegionAccess ,
143- {
144- pub fn new ( address : PciAddress ) -> PciHeader < A > {
145- PciHeader ( address, PhantomData )
129+ pub struct PciHeader ( PciAddress ) ;
130+
131+ impl PciHeader {
132+ pub fn new ( address : PciAddress ) -> PciHeader {
133+ PciHeader ( address)
146134 }
147135
148- pub fn id ( & self , access : & A ) -> ( VendorId , DeviceId ) {
136+ pub fn id ( & self , access : & impl ConfigRegionAccess ) -> ( VendorId , DeviceId ) {
149137 let id = unsafe { access. read ( self . 0 , 0x00 ) } ;
150138 ( id. get_bits ( 0 ..16 ) as u16 , id. get_bits ( 16 ..32 ) as u16 )
151139 }
152140
153- pub fn header_type ( & self , access : & A ) -> u8 {
141+ pub fn header_type ( & self , access : & impl ConfigRegionAccess ) -> u8 {
154142 /*
155143 * Read bits 0..=6 of the Header Type. Bit 7 dictates whether the device has multiple functions and so
156144 * isn't read here.
157145 */
158146 unsafe { access. read ( self . 0 , 0x0c ) } . get_bits ( 16 ..23 ) as u8
159147 }
160148
161- pub fn has_multiple_functions ( & self , access : & A ) -> bool {
149+ pub fn has_multiple_functions ( & self , access : & impl ConfigRegionAccess ) -> bool {
162150 /*
163151 * Reads bit 7 of the Header Type, which is 1 if the device has multiple functions.
164152 */
@@ -167,7 +155,7 @@ where
167155
168156 pub fn revision_and_class (
169157 & self ,
170- access : & A ,
158+ access : & impl ConfigRegionAccess ,
171159 ) -> ( DeviceRevision , BaseClass , SubClass , Interface ) {
172160 let field = unsafe { access. read ( self . 0 , 0x08 ) } ;
173161 (
0 commit comments