...but there's no need for the struct, just pass two arguments to the function, the event and either the substream or the direction. The substream is probably easier since otherwise all the callers will need to parse the direction.
Finally, I decide to place the callback function in struct s3c2410_dma_client instead of add a new struct:
struct s3c2410_dma_client {
....
/* callback funtion from client to generate the DMA REQ signal */ int (*gen_request)(void *);
/* callback funtion from client to end the DMA request */ int (*end_request)(void *);
/* argument for the callback function */ void *private_data; };
I think the callback function should have only one argument. If we have more than one argument to pass, just embbed them into a internal struct known to the callback funtions and pass the pointer to the object of this struct to the callback function.
If not, more filed will be needed in struct s3c2410_dma_client to place the arguments. I think it's redundant for the generic DMA driver.
I've posted five new patches which regist the callback functions either in the I2S/AC97 probe phase or by directly assiged in the source code depended by whether the callback functions and the object of struct s3c2410_dma_client are in the same source file.
Look forward for further comments on these patches. There should be some defects in them.
Thanks.