in r8169_main driver they have variable for registers as void pointer..
On this page
The kernel normally uses virtual addresses. Any address returned by kmalloc(), vmalloc(), and similar interfaces is a virtual address and can be stored in a void *.
The virtual memory system (TLB, page tables, etc.) translates virtual addresses to CPU physical addresses, which are stored as “phys_addr_t” or “resource_size_t”. The kernel manages device resources like registers as physical addresses<-[so its physical address for registers why rtl8169 driver used void * <-Q
so to handle with registers we use physical address can be phys_addr_t or resource_size_t. But I am confused as to why in r8168 Ethernet driver they did like this
void __iomem *mmio_addr;
with void pointer
#define RTL_W8(tp, reg, val8) writeb((val8), tp->mmio_addr + (reg));
void pointer normally used in virtual address but registers are not Virtual address. so what might be the reason of using void pointer for registers
Or is it because void pointer can contain anything.
int i=100;
void *p=&i;
printf("%d ",*(int*)p);
return 0;
its re-usability. it can point any thing and substituted for anything means I can use void pointer in place of physical address data type with register which needs resource_size_t or phys_addr_t
void __iomem *mmio_addr;
or is it because in memory mapped IO all registers are placed on Memory area that driver and device also has it.