--- OZSCR_2.0.3_Kern_2.6/src/ozscrlx-2.6.13/ozscrlx.c +++ OZSCR_2.0.3_Kern_2.6/src/ozscrlx-2.6.13/ozscrlx.c @@ -173,7 +173,7 @@ static irqreturn_t ozscr_interrupt(int i * device driver with appropriate cards, through the card configuration * database. */ -static dev_info_t dev_info = "ozscrlx_cs"; +//static dev_info_t dev_info = "ozscrlx_cs"; /* * A linked list of "instances" of the OZSCR device. Each actual @@ -182,6 +182,9 @@ static dev_info_t dev_info = "ozscrlx_cs */ static struct pcmcia_device *dev_list = NULL; +/* new card-reader class */ +static struct class *o2cr_class; + /* * Private data for OZSCR reader. Need to provide a dev_node_t * structure for the device. @@ -255,7 +258,7 @@ static int ozscr_open(struct inode *inod #undef FUNC_NAME #define FUNC_NAME "ozscr_open: " - int minor = iminor(inode); +// int minor = iminor(inode); struct pcmcia_device *p_dev; #ifdef PCMCIA_DEBUG @@ -292,9 +295,9 @@ static int ozscr_close(struct inode *ino #define FUNC_NAME "ozscr_close: " - int minor = iminor(inode); +// int minor = iminor(inode); struct pcmcia_device *p_dev; - struct ozscr_dev_t *dev; +// struct ozscr_dev_t *dev; #ifdef PCMCIA_DEBUG printk(KERN_INFO MODULE_NAME FUNC_NAME "minor(%d)\n", minor); @@ -331,13 +334,12 @@ static int ozscr_close(struct inode *ino * copy information back to the user fill the reader status bit and * succeed, even if the reader had an error. */ -static int -ozscr_ioctl(struct inode *inode, struct file *file, u_int cmd, u_long arg) +static int ozscr_ioctl(struct inode *inode, struct file *file, u_int cmd, u_long arg) { #undef FUNC_NAME #define FUNC_NAME "ozscr_ioctl: " - int minor = iminor(inode); +// int minor = iminor(inode); struct pcmcia_device *p_dev; struct ozscr_dev_t *dev; int ret = 0; /* return value */ @@ -859,6 +861,7 @@ static int ozscr_attach(struct pcmcia_de // link->next = dev_list; /* build linked to handle multiple instances */ //XXX + dev_list = p_dev; ret = ozscr_config(p_dev); @@ -875,6 +878,10 @@ static int ozscr_attach(struct pcmcia_de printk(KERN_INFO MODULE_NAME FUNC_NAME "function complete\n"); #endif // XXX free pRdrExt ? + + // XXX not sure if p_dev->device_no is ok? + class_device_create(o2cr_class, NULL, MKDEV(OZSCR_MAJOR, p_dev->device_no), NULL, "o2cr%d", p_dev->device_no); + return 0; ErrHandle: @@ -973,10 +980,14 @@ static struct file_operations ozscr_chr_ /* ========================================================================= Entry/Ending point of the driver */ -static int -init_ozscrlx(void) +static int init_ozscrlx(void) { + o2cr_class = class_create(THIS_MODULE, "o2cr"); + if (!o2cr_class) + return -1; + + #undef FUNC_NAME #define FUNC_NAME "init_ozscrlx: " @@ -999,6 +1010,7 @@ init_ozscrlx(void) printk(KERN_INFO MODULE_NAME FUNC_NAME "function complete!\n"); #endif + return 0; } @@ -1019,6 +1031,8 @@ static void exit_ozscrlx(void) ozscr_detach(dev_list); } + class_destroy(o2cr_class); + return; }