@@ -70,11 +70,8 @@ __syscall void mdio_bus_enable(const struct device *dev);
70
70
71
71
static inline void z_impl_mdio_bus_enable (const struct device * dev )
72
72
{
73
- const struct mdio_driver_api * api =
74
- (const struct mdio_driver_api * )dev -> api ;
75
-
76
- if (api -> bus_enable != NULL ) {
77
- api -> bus_enable (dev );
73
+ if (DEVICE_API_GET (mdio , dev )-> bus_enable != NULL ) {
74
+ DEVICE_API_GET (mdio , dev )-> bus_enable (dev );
78
75
}
79
76
}
80
77
@@ -88,11 +85,8 @@ __syscall void mdio_bus_disable(const struct device *dev);
88
85
89
86
static inline void z_impl_mdio_bus_disable (const struct device * dev )
90
87
{
91
- const struct mdio_driver_api * api =
92
- (const struct mdio_driver_api * )dev -> api ;
93
-
94
- if (api -> bus_disable != NULL ) {
95
- api -> bus_disable (dev );
88
+ if (DEVICE_API_GET (mdio , dev )-> bus_disable != NULL ) {
89
+ DEVICE_API_GET (mdio , dev )-> bus_disable (dev );
96
90
}
97
91
}
98
92
@@ -118,14 +112,11 @@ __syscall int mdio_read(const struct device *dev, uint8_t prtad, uint8_t regad,
118
112
static inline int z_impl_mdio_read (const struct device * dev , uint8_t prtad ,
119
113
uint8_t regad , uint16_t * data )
120
114
{
121
- const struct mdio_driver_api * api =
122
- (const struct mdio_driver_api * )dev -> api ;
123
-
124
- if (api -> read == NULL ) {
115
+ if (DEVICE_API_GET (mdio , dev )-> read == NULL ) {
125
116
return - ENOSYS ;
126
117
}
127
118
128
- return api -> read (dev , prtad , regad , data );
119
+ return DEVICE_API_GET ( mdio , dev ) -> read (dev , prtad , regad , data );
129
120
}
130
121
131
122
@@ -151,14 +142,11 @@ __syscall int mdio_write(const struct device *dev, uint8_t prtad, uint8_t regad,
151
142
static inline int z_impl_mdio_write (const struct device * dev , uint8_t prtad ,
152
143
uint8_t regad , uint16_t data )
153
144
{
154
- const struct mdio_driver_api * api =
155
- (const struct mdio_driver_api * )dev -> api ;
156
-
157
- if (api -> write == NULL ) {
145
+ if (DEVICE_API_GET (mdio , dev )-> write == NULL ) {
158
146
return - ENOSYS ;
159
147
}
160
148
161
- return api -> write (dev , prtad , regad , data );
149
+ return DEVICE_API_GET ( mdio , dev ) -> write (dev , prtad , regad , data );
162
150
}
163
151
164
152
/**
@@ -185,14 +173,11 @@ static inline int z_impl_mdio_read_c45(const struct device *dev, uint8_t prtad,
185
173
uint8_t devad , uint16_t regad ,
186
174
uint16_t * data )
187
175
{
188
- const struct mdio_driver_api * api =
189
- (const struct mdio_driver_api * )dev -> api ;
190
-
191
- if (api -> read_c45 == NULL ) {
176
+ if (DEVICE_API_GET (mdio , dev )-> read_c45 == NULL ) {
192
177
return - ENOSYS ;
193
178
}
194
179
195
- return api -> read_c45 (dev , prtad , devad , regad , data );
180
+ return DEVICE_API_GET ( mdio , dev ) -> read_c45 (dev , prtad , devad , regad , data );
196
181
}
197
182
198
183
/**
@@ -219,14 +204,11 @@ static inline int z_impl_mdio_write_c45(const struct device *dev, uint8_t prtad,
219
204
uint8_t devad , uint16_t regad ,
220
205
uint16_t data )
221
206
{
222
- const struct mdio_driver_api * api =
223
- (const struct mdio_driver_api * )dev -> api ;
224
-
225
- if (api -> write_c45 == NULL ) {
207
+ if (DEVICE_API_GET (mdio , dev )-> write_c45 == NULL ) {
226
208
return - ENOSYS ;
227
209
}
228
210
229
- return api -> write_c45 (dev , prtad , devad , regad , data );
211
+ return DEVICE_API_GET ( mdio , dev ) -> write_c45 (dev , prtad , devad , regad , data );
230
212
}
231
213
232
214
#ifdef __cplusplus
0 commit comments