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

drm/ast: Rework definition of I/O read and write helpers

Ast defines a number of I/O helpers for accessing hardware. Only 4 of
the many generated functions are actually used. Replace the respective
generator macros with those 4 functions. No functional changes.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230221155745.27484-3-tzimmermann@suse.de

+14 -34
+14 -34
drivers/gpu/drm/ast/ast_drv.h
··· 238 238 #define AST_IO_VGACRCB_HWC_ENABLED BIT(1) 239 239 #define AST_IO_VGACRCB_HWC_16BPP BIT(0) /* set: ARGB4444, cleared: 2bpp palette */ 240 240 241 - #define __ast_read(x) \ 242 - static inline u##x ast_read##x(struct ast_private *ast, u32 reg) { \ 243 - u##x val = 0;\ 244 - val = ioread##x(ast->regs + reg); \ 245 - return val;\ 241 + static inline u32 ast_read32(struct ast_private *ast, u32 reg) 242 + { 243 + return ioread32(ast->regs + reg); 246 244 } 247 245 248 - __ast_read(8); 249 - __ast_read(16); 250 - __ast_read(32) 251 - 252 - #define __ast_io_read(x) \ 253 - static inline u##x ast_io_read##x(struct ast_private *ast, u32 reg) { \ 254 - u##x val = 0;\ 255 - val = ioread##x(ast->ioregs + reg); \ 256 - return val;\ 246 + static inline void ast_write32(struct ast_private *ast, u32 reg, u32 val) 247 + { 248 + iowrite32(val, ast->regs + reg); 257 249 } 258 250 259 - __ast_io_read(8); 260 - __ast_io_read(16); 261 - __ast_io_read(32); 251 + static inline u8 ast_io_read8(struct ast_private *ast, u32 reg) 252 + { 253 + return ioread8(ast->ioregs + reg); 254 + } 262 255 263 - #define __ast_write(x) \ 264 - static inline void ast_write##x(struct ast_private *ast, u32 reg, u##x val) {\ 265 - iowrite##x(val, ast->regs + reg);\ 266 - } 267 - 268 - __ast_write(8); 269 - __ast_write(16); 270 - __ast_write(32); 271 - 272 - #define __ast_io_write(x) \ 273 - static inline void ast_io_write##x(struct ast_private *ast, u32 reg, u##x val) {\ 274 - iowrite##x(val, ast->ioregs + reg);\ 275 - } 276 - 277 - __ast_io_write(8); 278 - __ast_io_write(16); 279 - #undef __ast_io_write 256 + static inline void ast_io_write8(struct ast_private *ast, u32 reg, u8 val) 257 + { 258 + iowrite8(val, ast->ioregs + reg); 259 + } 280 260 281 261 static inline void ast_set_index_reg(struct ast_private *ast, 282 262 uint32_t base, uint8_t index,