Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

video: Handle HAS_IOPORT dependencies

In a future patch HAS_IOPORT=n will disable inb()/outb() and friends at
compile time. We thus need to #ifdef functions and their callsites which
unconditionally use these I/O accessors. In the include/video/vga.h
these are conveniently all those functions with the vga_io_* prefix.

Co-developed-by: Arnd Bergmann <arnd@kernel.org>
Signed-off-by: Arnd Bergmann <arnd@kernel.org>
Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
Signed-off-by: Helge Deller <deller@gmx.de>

authored by

Niklas Schnelle and committed by
Helge Deller
8423895d 8400291e

+42 -16
+42 -16
include/video/vga.h
··· 197 197 extern int save_vga(struct vgastate *state); 198 198 extern int restore_vga(struct vgastate *state); 199 199 200 + static inline unsigned char vga_mm_r (void __iomem *regbase, unsigned short port) 201 + { 202 + return readb (regbase + port); 203 + } 204 + 205 + static inline void vga_mm_w (void __iomem *regbase, unsigned short port, unsigned char val) 206 + { 207 + writeb (val, regbase + port); 208 + } 209 + 210 + static inline void vga_mm_w_fast (void __iomem *regbase, unsigned short port, 211 + unsigned char reg, unsigned char val) 212 + { 213 + writew (VGA_OUT16VAL (val, reg), regbase + port); 214 + } 215 + 200 216 /* 201 217 * generic VGA port read/write 202 218 */ 219 + #ifdef CONFIG_HAS_IOPORT 203 220 204 221 static inline unsigned char vga_io_r (unsigned short port) 205 222 { ··· 232 215 unsigned char val) 233 216 { 234 217 outw(VGA_OUT16VAL (val, reg), port); 235 - } 236 - 237 - static inline unsigned char vga_mm_r (void __iomem *regbase, unsigned short port) 238 - { 239 - return readb (regbase + port); 240 - } 241 - 242 - static inline void vga_mm_w (void __iomem *regbase, unsigned short port, unsigned char val) 243 - { 244 - writeb (val, regbase + port); 245 - } 246 - 247 - static inline void vga_mm_w_fast (void __iomem *regbase, unsigned short port, 248 - unsigned char reg, unsigned char val) 249 - { 250 - writew (VGA_OUT16VAL (val, reg), regbase + port); 251 218 } 252 219 253 220 static inline unsigned char vga_r (void __iomem *regbase, unsigned short port) ··· 259 258 else 260 259 vga_io_w_fast (port, reg, val); 261 260 } 261 + #else /* CONFIG_HAS_IOPORT */ 262 + static inline unsigned char vga_r (void __iomem *regbase, unsigned short port) 263 + { 264 + return vga_mm_r (regbase, port); 265 + } 262 266 267 + static inline void vga_w (void __iomem *regbase, unsigned short port, unsigned char val) 268 + { 269 + vga_mm_w (regbase, port, val); 270 + } 271 + 272 + 273 + static inline void vga_w_fast (void __iomem *regbase, unsigned short port, 274 + unsigned char reg, unsigned char val) 275 + { 276 + vga_mm_w_fast (regbase, port, reg, val); 277 + } 278 + #endif /* CONFIG_HAS_IOPORT */ 263 279 264 280 /* 265 281 * VGA CRTC register read/write ··· 298 280 #endif /* VGA_OUTW_WRITE */ 299 281 } 300 282 283 + #ifdef CONFIG_HAS_IOPORT 301 284 static inline unsigned char vga_io_rcrt (unsigned char reg) 302 285 { 303 286 vga_io_w (VGA_CRT_IC, reg); ··· 314 295 vga_io_w (VGA_CRT_DC, val); 315 296 #endif /* VGA_OUTW_WRITE */ 316 297 } 298 + #endif /* CONFIG_HAS_IOPORT */ 317 299 318 300 static inline unsigned char vga_mm_rcrt (void __iomem *regbase, unsigned char reg) 319 301 { ··· 353 333 #endif /* VGA_OUTW_WRITE */ 354 334 } 355 335 336 + #ifdef CONFIG_HAS_IOPORT 356 337 static inline unsigned char vga_io_rseq (unsigned char reg) 357 338 { 358 339 vga_io_w (VGA_SEQ_I, reg); ··· 369 348 vga_io_w (VGA_SEQ_D, val); 370 349 #endif /* VGA_OUTW_WRITE */ 371 350 } 351 + #endif /* CONFIG_HAS_IOPORT */ 372 352 373 353 static inline unsigned char vga_mm_rseq (void __iomem *regbase, unsigned char reg) 374 354 { ··· 407 385 #endif /* VGA_OUTW_WRITE */ 408 386 } 409 387 388 + #ifdef CONFIG_HAS_IOPORT 410 389 static inline unsigned char vga_io_rgfx (unsigned char reg) 411 390 { 412 391 vga_io_w (VGA_GFX_I, reg); ··· 423 400 vga_io_w (VGA_GFX_D, val); 424 401 #endif /* VGA_OUTW_WRITE */ 425 402 } 403 + #endif /* CONFIG_HAS_IOPORT */ 426 404 427 405 static inline unsigned char vga_mm_rgfx (void __iomem *regbase, unsigned char reg) 428 406 { ··· 458 434 vga_w (regbase, VGA_ATT_W, val); 459 435 } 460 436 437 + #ifdef CONFIG_HAS_IOPORT 461 438 static inline unsigned char vga_io_rattr (unsigned char reg) 462 439 { 463 440 vga_io_w (VGA_ATT_IW, reg); ··· 470 445 vga_io_w (VGA_ATT_IW, reg); 471 446 vga_io_w (VGA_ATT_W, val); 472 447 } 448 + #endif /* CONFIG_HAS_IOPORT */ 473 449 474 450 static inline unsigned char vga_mm_rattr (void __iomem *regbase, unsigned char reg) 475 451 {