Upon some conditions, I want to schedule a timer (struct timer_list) that works on custom data. The function field of this structure holds the actual function that will be triggered, and is defined as below :
void (*function)(unsigned long);
The thing is I want to pass a pointer instead of the unsigned long. I know that depending on the architecture, the int-ptr conversion may or may not be safe, but I could not find if all the architectures align long integers with pointers so here is my question (in fact, a two-in-one) :
Is it safe to perform a long to void* cast ? If no, how should I handle the unsigned long argument to get the data pointer I want in the timer function ?
You could use the passed number to be an index into an array that contains your custom data structure.