Re: [RFC] HID bus design overview.

Li Yu <[email protected]>
Newsgroups gmane.linux.usb.devel,gmane.linux.kernel
Message-ID <[email protected]>
Dmitry Torokhov wrote:
>>> +int hid_open(struct hid_device *hid)
>>> +{
>>> +	struct hid_transport *tl;
>>> +	int ret;
>>> +
>>> +	if (hid->driver->open)
>>> +		return hid->driver->open(hid);
>>> +	ret = 0;
>>> +	spin_lock(&hid_lock);
>>> +	tl =  hid_transports[hid->bus];
>>> +	if (tl->open)
>>> +		ret = tl->open(hid);
>>> +	spin_unlock(&hid_lock);
>>> +	return ret;
>>> +}
>>>     
>>>       
>> Spinlock is not the best choise here, I'd expect most ->open()
>> implementation wait on some IO.
>>
>>   
>>     
> Yes, I agree! Also, there have another code access hid_transports[]
> without spin it!
>
>   
I think I found out the resolve means for this: using the refcnt of
hid_transport->module,
so we can read access hid_transports[] safely without any lock protection.







-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.