From: "Matti Linnanvuori" <mattilinn@gmail.com>
To: "Krzysztof Halasa" <khc@pm.waw.pl>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1.2.26] wan: new driver retina
Date: Sun, 1 Jun 2008 08:59:55 +0300 [thread overview]
Message-ID: <ca0148c30805312259v4d6a9344le94050ea9295eed8@mail.gmail.com> (raw)
In-Reply-To: <m3lk1rhio4.fsf@maximus.localdomain>
2008/5/30 Krzysztof Halasa <khc@pm.waw.pl>:
> "Matti Linnanvuori" <mattilinn@gmail.com> writes:
>>>> +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.
I don't think the module can finish getting unloaded while in that
function because the module cleanup function unregisters the
character device.
> Yes, I thought stream mode = character device but now I see it's
> another flavour of network device(?), which is never up and exists
> only for the ability to receive netdev ioctls (though it also uses
> char dev ioctls).
>
> Did I get this right?
Yeah.
> Why not simply use a character device, with normal read, write etc?
It would make more sense to use a character device. Read and write
system calls consume more CPU time, though.
next prev parent reply other threads:[~2008-06-01 5:59 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-28 10:42 [PATCH v1.2.26] wan: new driver retina Matti Linnanvuori
2008-05-28 12:30 ` Krzysztof Halasa
2008-05-30 12:52 ` Matti Linnanvuori
2008-05-30 16:15 ` Krzysztof Halasa
2008-06-01 5:59 ` Matti Linnanvuori [this message]
2008-06-03 12:08 ` Matti Linnanvuori
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ca0148c30805312259v4d6a9344le94050ea9295eed8@mail.gmail.com \
--to=mattilinn@gmail.com \
--cc=khc@pm.waw.pl \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox