All of lore.kernel.org
 help / color / mirror / Atom feed
From: fser@code-libre.org (François)
To: kernelnewbies@lists.kernelnewbies.org
Subject: Char device write repeating
Date: Wed, 5 Oct 2016 14:44:31 +0200	[thread overview]
Message-ID: <20161005124430.GB22768@sith> (raw)
In-Reply-To: <CAF3SDA5qYJWpUfBm7jHaKqUc++RE033dej6-Gj60rAeA5R0MnQ@mail.gmail.com>

On Tue, Oct 04, 2016 at 03:42:52PM -0300, Daniel. wrote:
> Because the libc is calling it again based on what has been passed as
> argument and what was received as return value. Here is one example
> https://gist.github.com/gkos/5479135. I don't really know if this code is
> working since I made it a long time ago.

Your test to check wether the device is already open looks weak to me.
You should rather use atomic operations such as described in [1] or
mutex like in [2].

[1] http://www.oreilly.com/openbook/linuxdrive3/book/ch06.pdf p 40
[2] http://pete.akeo.ie/2011/08/writing-linux-device-driver-for-kernels.html

-- 
Fran?ois

  reply	other threads:[~2016-10-05 12:44 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CAK7rcp8HTmpVDZHDMw75Oep1eGS+efs5EUUh26mFvWmXaFVGCg@mail.gmail.com>
     [not found] ` <CAK7rcp9akHJ4E1Ms9HwsNWTpnDjPyGcf8OE+an2bRDCbVLAO7g@mail.gmail.com>
     [not found]   ` <CAK7rcp-1GfT3M9bNA-STDhgXjO9WX+SCZoAGZgYo_uZZjA-TAA@mail.gmail.com>
     [not found]     ` <CAK7rcp9yVW2m9pRCB=dTFrN6Pey+_1FukP2xfizaKY5_T5RP6Q@mail.gmail.com>
     [not found]       ` <CAK7rcp9BGzQTM0y=kHhqiJru45g1tbusgtkBRaw9jLM=R4UdsQ@mail.gmail.com>
2016-10-04 14:58         ` Char device write repeating Kenneth Adam Miller
2016-10-04 15:05           ` Greg KH
2016-10-04 18:42             ` Daniel.
2016-10-05 12:44               ` François [this message]
2016-10-05  6:29             ` Martin Kletzander
2016-10-05 11:30               ` Kenneth Adam Miller

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=20161005124430.GB22768@sith \
    --to=fser@code-libre.org \
    --cc=kernelnewbies@lists.kernelnewbies.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.