[linux-usb-devel] Another question about writing a USB driver

2003-07-14 Thread Gary Ng
Hi all, I'm currently writing a very simple USB driver for a printer. I've a few rookie questions that I hope you guys can give me some pointers. First of all, I decide not to use MOD_INC_USE_COUNT/MOD_DEC_USE_COUNT coz I read it somewhere that it's no longer necessary if I define

Re: [linux-usb-devel] Another question about writing a USB driver

2003-07-14 Thread Alan Stern
On Mon, 14 Jul 2003, Gary Ng wrote: Hi all, I'm currently writing a very simple USB driver for a printer. I've a few rookie questions that I hope you guys can give me some pointers. Okay. But bear in mind that there already is a USB printer driver. First of all, I decide not to use

Re: [linux-usb-devel] Another question about writing a USB driver

2003-07-14 Thread Gary Ng
Thank you so much for such a detail explaination. If I understand correctly, after I open() a device and then unplug the device, I should still have the device structure hanging around somewhere in the memory and that should be disallocated upon close() called on the same fd. In this case, if I

Re: [linux-usb-devel] Another question about writing a USB driver

2003-07-14 Thread Oliver Neukum
Note that on SMP architectures there is a race between open() and disconnect(). You will have to use a static semaphore to prevent the possibility of someone calling open() (thereby trying to access your data structures) at the same time a disconnect() occurs (thereby freeing those same

Re: [linux-usb-devel] Another question about writing a USB driver

2003-07-14 Thread Oliver Neukum
Am Montag, 14. Juli 2003 22:54 schrieb Gary Ng: Thank you so much for such a detail explaination. If I understand correctly, after I open() a device and then unplug the device, I should still have the device structure hanging around somewhere in the memory and that should be disallocated

Re: [linux-usb-devel] Another question about writing a USB driver

2003-07-14 Thread Gary Ng
I see! Thanks for your help! Regards, Gary --- Oliver Neukum [EMAIL PROTECTED] wrote: Am Montag, 14. Juli 2003 22:54 schrieb Gary Ng: Thank you so much for such a detail explaination. If I understand correctly, after I open() a device and then unplug the device, I should still have