On Sat, Mar 21, 2009 at 06:10:32PM +0800, fangxiaozhi 00110321 wrote: > Dear Greg KH, > > I am sorry, I must trouble you again. > > I am now developing a new CDC-ECM driver for our device, based on > cdc_ether.c (drivers/net/usb/cdc_ether.c). Why not just add a few changes to the existing cdc-ether driver instead of writing a totally new one? > And in our requirement, we want the driver can notify the application > in user space with asynchronous notification, while the > USB_CDC_NOTIFY_RESPONSE_AVAILABLE occurs. Why not just modify the existing driver to provide such notification. It should be a simple change, right? > So I want to implement it with the fasync feature in the 'struct > file_operations'. I declare them in our CDC-ECM driver as follows: > > static struct fasync_struct *hw_irq_fasync = NULL; > static int hw_ether_fasync(int fd, struct file* filp, int on){ > int retval = 0; > retval = fasync_helper(fd, filp, on, &hw_ether_fasync); > if (0 > retval) > return retval; > return 0; > } > static const struct file_operations hw_ether_ops = { > .owner = THIS_MODULE, > .fasync = hw_ether_fasync, > }; > > But unfortunately, I don't know how to register 'hw_ether_ops' in our driver, > static struct usb_driver hw_cdc_driver = { > .name = "huawei_driver", > .id_table = hw_products, > .probe = usbnet_probe, > .disconnect = usbnet_disconnect, > .suspend = usbnet_suspend, > .resume = usbnet_resume, > }; > > Can you tell me how to register it in our driver? You don't register file_ops with usb drivers, unless you are willing to use the USB major number now. As this is a network device, why not just use the existing kernel interfaces to provide notifications for network drivers? Don't create a char device, no userspace code is expecting that for a network device. > By the way, I also heard that, this asynchronous notification > mechanism is used for Char drivers, not for ether drivers. Is it > true? Then how to implement the asynchronous notification in the ether > drivers? Us the existing network driver interface for this kind of functionality :) thanks, greg k-h -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html