public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Hans J. Koch" <hjk@linutronix.de>
To: "Tom Spink" <tspink@gmail.com>
Cc: "Uwe Kleine-König" <Uwe.Kleine-Koenig@digi.com>,
	linux-kernel@vger.kernel.org,
	"Greg Kroah-Hartman" <gregkh@suse.de>,
	"Jan Altenberg" <jan.altenberg@linutronix.de>,
	"Thomas Gleixner" <tglx@linutronix.de>,
	"Magnus Damm" <magnus.damm@gmail.com>
Subject: Re: [PATCH 1/1] UIO: Add a write() function to enable/disable interrupts
Date: Fri, 23 May 2008 15:01:29 +0200	[thread overview]
Message-ID: <20080523150129.2d6972dd@bluebox.local> (raw)
In-Reply-To: <7b9198260805230520t46d79d9bqceabf4691388e89d@mail.gmail.com>

Am Fri, 23 May 2008 13:20:50 +0100
schrieb "Tom Spink" <tspink@gmail.com>:

> 2008/5/23 Hans J. Koch <hjk@linutronix.de>:
> > Am Fri, 23 May 2008 13:00:17 +0100
> > schrieb "Tom Spink" <tspink@gmail.com>:
> >
> >> My initial idea was just a thought anyway, just to
> >> maintain a bit of extensibility if .write is ever needed for
> >> something else. :-)
> >
> > Hi Tom,
> > thanks for your contribution, but for me it's just the other way
> > round: I'm glad write() gets a defined purpose before people do
> > something stupid with it. It's good to remember that all data
> > exchange with the device has to be done through the mapped memory.
> > If this is not possible, the hardware is no candidate for a UIO
> > driver.
> >
> > BTW, I wait for the first UIO driver which abuses this write()
> > function to write many different values to trigger different
> > actions. I wonder if I should restrict write() to the value 0 and
> > 1...
> >
> > Thanks,
> > Hans
> 
> Hi Hans,
> 
> Thanks for your explanation.  Another thing, I noticed then, is that
> in your return statement, you blindly return the the value of
> irqcontrol if it's non-zero, and if it's zero, then the length of the
> data written.  However, if irqcontrol returns a value that's > 0, it
> could potentially confuse writers.  I guess it's up to the implementer
> of irqcontrol to ensure they stick to -EXXX and 0

True. And it's not even worth fixing this by checking retval<0, because
if irqcontrol returns values>0, it's broken anyway. It is supposed to
return zero if successful, and negative errors otherwise. This is
common practice in the kernel, and people frequently use if (ret)... to
detect errors without checking if ret is a legal negative error number.

Thanks,
Hans

  reply	other threads:[~2008-05-23 13:01 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-22 19:22 [PATCH 0/1] UIO: Add a write() function to enable/disable interrupts Hans J. Koch
2008-05-22 19:26 ` [PATCH 1/1] " Hans J. Koch
2008-05-22 19:47   ` Tom Spink
2008-05-22 20:08     ` Hans J. Koch
2008-05-22 20:26       ` Tom Spink
2008-05-23  5:41         ` Uwe Kleine-König
2008-05-23  8:51           ` Hans J. Koch
2008-05-23 11:48           ` Tom Spink
2008-05-23 11:58             ` Uwe Kleine-König
2008-05-23 12:00               ` Tom Spink
2008-05-23 12:14                 ` Hans J. Koch
2008-05-23 12:20                   ` Tom Spink
2008-05-23 13:01                     ` Hans J. Koch [this message]
2008-05-23  5:55   ` Uwe Kleine-König
2008-05-23  8:44     ` Hans J. Koch
2008-05-23  9:10       ` Uwe Kleine-König
2008-05-23 10:03         ` Hans J. Koch
2008-05-23 10:56           ` Uwe Kleine-König
2008-05-23 11:55             ` Hans J. Koch
2008-05-23 12:03               ` Uwe Kleine-König
2008-05-23 18:36               ` Randy Dunlap
2008-05-23 22:49                 ` Hans-Jürgen Koch
2008-06-04  6:30                   ` Uwe Kleine-König
2008-06-04  7:05                     ` Thomas Gleixner
2008-05-23 20:44               ` Leon Woestenberg
2008-05-23 22:43                 ` Hans J. Koch
2008-05-24  0:02                   ` Leon Woestenberg
2008-05-24  4:43               ` Greg KH
2008-05-24 22:20                 ` Hans J. Koch
2008-05-24 22:22                 ` Thomas Gleixner
2008-05-24 22:34                   ` Tom Spink
2008-05-24 22:46                     ` Thomas Gleixner
2008-05-24 23:00                       ` Tom Spink
2008-05-27 17:55                   ` Greg KH

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=20080523150129.2d6972dd@bluebox.local \
    --to=hjk@linutronix.de \
    --cc=Uwe.Kleine-Koenig@digi.com \
    --cc=gregkh@suse.de \
    --cc=jan.altenberg@linutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=magnus.damm@gmail.com \
    --cc=tglx@linutronix.de \
    --cc=tspink@gmail.com \
    /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