|  | 
 
| I am debugging a module like below. I can get the printk output in /var/log/messages when i insmod and rmmmod. But when i try to open or
 ioctl the device, the output of printk doesn't appear in
 /var/log/messages.
 
 What did i do wrong? Thanks ahead!
 Shu
 
 Below is the code:
 
 ...
 
 #define ix_ossl_message_log(arg_pFmtString,args...)
 (printk(arg_pFmtString, ## args),IX_SUCCESS)
 
 ...
 
 static struct file_operations ix_sa_fops = {
 ioctl: ix_sa_ioctl,
 open: ix_sa_open,
 release: ix_sa_close,
 };
 
 int majorNumber = DEV_NUMBER_SAUTIL;
 
 int init_module(void)
 {
 
 ix_uint32 s_Result;
 
 #ifdef IX_DEBUG
 ix_ossl_message_log("Loading sysapp_common module.\n");
 #endif
 
 
 s_Result = register_chrdev(majorNumber, DEV_NAME_SAUTIL,
 &ix_sa_fops );
 if(s_Result == 0)
 {
 ix_ossl_message_log("UtilDrv Module is registered with
 major:%d\n",majorNumber);
 ix_ossl_message_log ("USAGE:\n");
 ix_ossl_message_log ("mknod /dev/%s c %d <minor>\n",
 DEV_NAME_SAUTIL, majorNumber);
 ix_ossl_message_log ("with different minor numbers.\n\n");
 
 }
 else
 {
 ix_ossl_message_log( "sysapp_common module cannot be
 registered!!!!.\n");
 ix_ossl_message_log("Registered to number
 %d\n",majorNumber);
 return -1;
 }
 
 return 0;
 }
 
 void cleanup_module(void)
 {
 ix_uint32 s_Result;
 
 #ifdef IX_DEBUG
 ix_ossl_message_log("Unloading sysapp_common module.\n");
 #endif
 
 s_Result = unregister_chrdev(majorNumber, DEV_NAME_SAUTIL);
 if(s_Result == 0)
 {
 ix_ossl_message_log("sysapp_common module cleaned
 successfully...\n");
 }
 else
 {
 ix_ossl_message_log("sysapp_common Module COULD NOT BE CLEANED
 UP !!!\n");
 }
 
 return;
 }
 
 
 
 int ix_sa_open(
 struct inode *sa_inode,
 struct file *sa_file)
 {
 #ifdef IX_DEBUG
 ix_ossl_message_log("ix_sa_open called.\n");
 #endif
 return 0;
 
 }
 
 
 
 
 int ix_sa_close(
 struct inode *sa_inode,
 struct file *sa_file)
 {
 #ifdef IX_DEBUG
 ix_ossl_message_log("ix_sa_close called.\n");
 #endif
 return 0;
 }
 
 
 
 int ix_sa_ioctl(
 struct inode *sa_inode,
 struct file * sa_file,
 unsigned int cmd,
 unsigned long arg_IoctlPtr)
 {
 ix_uint32 s_Result;
 
 #ifdef IX_DEBUG
 ix_ossl_message_log("ix_sa_ioctl called.\n");
 #endif
 
 if (sa_inode == NULL)
 {
 #ifdef IX_DEBUG
 ix_ossl_message_log("ix_sa_inode is NULL.\n");
 #endif
 return -1;
 }
 
 if (sa_file == NULL)
 {
 #ifdef IX_DEBUG
 ix_ossl_message_log("ix_sa_file is NULL.\n");
 #endif
 return -1;
 }
 
 switch(cmd)
 {
 case SA_START:
 s_Result = _ix_sa_entry((void *)arg_IoctlPtr);
 break;
 case SA_STOP:
 s_Result = ix_sa_shutdown(0);
 break;
 
 default:
 #ifdef IX_DEBUG
 ix_ossl_message_log("Undefined ioctl command %d.\n", cmd);
 #endif
 s_Result = -1;
 break;
 }
 
 if (s_Result != 0)
 {
 #ifdef IX_DEBUG
 ix_ossl_message_log("ix_sa_ioctl failed.\n");
 #endif
 }
 else
 {
 #ifdef IX_DEBUG
 ix_ossl_message_log("ix_sa_ioctl succeeded.\n");
 #endif
 }
 
 return s_Result;
 
 }
 | 
 |