me8100.c
changeset 9 ed7a768ff898
parent 8 12065fad228b
child 10 b560de13b236
equal deleted inserted replaced
8:12065fad228b 9:ed7a768ff898
   569  *   On success the return value is 0 else failure.
   569  *   On success the return value is 0 else failure.
   570  *--------------------------------------------------------------------------
   570  *--------------------------------------------------------------------------
   571  * Author: GG                                                               
   571  * Author: GG                                                               
   572  */
   572  */
   573 static int me8100_open(struct inode *inode_ptr, struct file *file_ptr){
   573 static int me8100_open(struct inode *inode_ptr, struct file *file_ptr){
   574   int device,subdevice;
   574   int device, subdevice;
   575   me8100_info_type *info;
   575   me8100_info_type *info;
   576   struct me8100_subinfo *subinfo;
   576   struct me8100_subinfo *subinfo;
   577 
   577 
   578   PDEBUG("*** me8100_open() is executed\n");
   578   PDEBUG("*** me8100_open() is executed\n");
   579 
   579 
   581   subdevice = SUBDEVICE(MINOR(inode_ptr->i_rdev));
   581   subdevice = SUBDEVICE(MINOR(inode_ptr->i_rdev));
   582   PDEBUG("*** device: %d, subdevice %d\n", device, subdevice);
   582   PDEBUG("*** device: %d, subdevice %d\n", device, subdevice);
   583 
   583 
   584   info = &info_vec[device];
   584   info = &info_vec[device];
   585   subinfo = &info->subinfo[subdevice];
   585   subinfo = &info->subinfo[subdevice];
       
   586 
       
   587   /* Currently we can't support the old style minor numbers. */
       
   588   if (subinfo < 0) {
       
   589     printk(KERN_ERR "ME8100:me8100_open(): Bad subdevice %d\n", subdevice);
       
   590     return -ENODEV;
       
   591   }
   586 
   592 
   587 
   593 
   588   if(device >= me8100_board_count){
   594   if(device >= me8100_board_count){
   589     printk(KERN_ERR"ME8100:me8100_open():Board %d doesn't exist\n", device);
   595     printk(KERN_ERR"ME8100:me8100_open():Board %d doesn't exist\n", device);
   590     return -ENODEV;
   596     return -ENODEV;