[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ca0148c30806030508g23bf0f52r2ac847fcc7cb7cbe@mail.gmail.com>
Date: Tue, 3 Jun 2008 15:08:32 +0300
From: "Matti Linnanvuori" <mattilinn@...il.com>
To: "Krzysztof Halasa" <khc@...waw.pl>
Cc: jgarzik@...ox.com, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v1.2.26] wan: new driver retina
2008/5/30 Krzysztof Halasa <khc@...waw.pl>:
> "Matti Linnanvuori" <mattilinn@...il.com> writes:
>
>> I would not like to change a legacy driver much.
>
> But this is a new driver, right? I guess the SIOCDEVPRIVATEs will go
> at some point so the change can't be really avoided.
I posted retina-1.2.29.patch that does not have SIOCDEVPRIVATEs at
http://groups.google.com/group/pcidriver/files.
>>>> +static int fepci_char_open(struct inode *inode, struct file *filp)
>>>> +{
>>>> + unsigned int minor = MINOR(inode->i_rdev);
>>>> + if (unlikely(minor >= find_cnt || card_privates[minor].pci_dev == NULL))
>>>> + return -ENXIO;
>>>> + filp->f_op = &fepci_char_fops;
>>>> + if (unlikely(!try_module_get(THIS_MODULE)))
>>>> + return -EBUSY;
>>>
>>> That won't work race-free, use owner field.
>>
>> You mean the f_op assignment? I have removed that.
>
> Actually I meant try_module_get() from within the driver, for example
> your module may get unloaded while in this function, before this
> try_module_get(), and that would be fatal. If you set the owner field
> the reference count will be incremented by the caller first.
I added the owner field setting to the above mentioned patch.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists