public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Stefani Seibold <stefani@seibold.net>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: linux-kernel@vger.kernel.org, gregkh@linuxfoundation.org,
	oneukum@suse.de, alan@lxorguk.ukuu.org.uk,
	linux-usb@vger.kernel.org
Subject: Re: [PATCH] fix usb skeleton driver
Date: Wed, 06 Jun 2012 22:19:46 +0200	[thread overview]
Message-ID: <1339013986.3437.20.camel@wall-e> (raw)
In-Reply-To: <Pine.LNX.4.44L0.1206061406500.1788-100000@iolanthe.rowland.org>

Am Mittwoch, den 06.06.2012, 14:16 -0400 schrieb Alan Stern:
> On Wed, 6 Jun 2012, Stefani Seibold wrote:
> 
> > Am Mittwoch, den 06.06.2012, 12:55 -0400 schrieb Alan Stern:
> > > On Wed, 6 Jun 2012 stefani@seibold.net wrote:
> > > 
> > > > From: Stefani Seibold <stefani@seibold.net>
> > > > 
> > > > This is a fix for the USB skeleton driver to bring it in shape.
> > > > 
> > > > - The usb_interface structure pointer will be no longer stored 
> > > > - Every access to the USB will be handled trought the usb_interface pointer
> > > 
> > 
> > Sorry, missed to fix. Should be:
> > 
> > Every access to the USB will be handled through the usb_device pointer
> 
> But that's wrong -- the accesses should go through the interface 
> pointer.  After all, the driver is bound to the interface, not to the 
> device.
> 

Not really true, in whole driver only the open() and close() use the
interface pointer.

In the open path the interface is already determinate by
usb_find_interface(), so it was reasonable to do this also in the close
path.

> > > > - Introduced fsync
> > > > - Single user mode
> > > > - Eliminated dead code
> > > > - Save some bytes in the dev structure
> > > 
> > > How about simplifying the code so that it can be read by somebody who's 
> > > not already an expert?
> > > 
> > > Alan Stern
> > > 
> > 
> > Hey, i thought i get a little thank you for the voluntary work, what a
> > nice job. Not a demand for more work to do.
> 
> Have you submitted many kernel patches in the past?  :-)  This is the 
> way it usually works out...
> 

Yes i did (kfifo, superio, procfs, udpcp, nrpz, mtd nand, framebuffer
and so on). And i know the way it works ;-) But i do this mostly in my
spear time.

> In this case, I really think it's worthwhile to look for ways to
> simplify usb-skeleton.c.  For example, does supporting fsync really
> help somebody who's trying to learn how to write a USB device driver?  
> I suspect it doesn't.
> 

The reason to fix the skeleton driver was about the complains for my
NRPZ driver, which was based on the design of the usb skeleton driver.

> Going even farther, I'm not so sure it's a good idea for usb-skeleton
> to try supporting both synchronous and asynchronous accesses.  This
> adds a layer of complexity that people just don't need.  IMO it would 
> be better to have two separate example drivers, an easy one that is 
> purely synchronous and a more advanced one that is purely async.
> 

Agree, i think this would be a good idea to have to separate drivers.
Both should be also working drivers, for really simple hardware.

The best way for me to do this is to shrink later this to a simplified
driver. 

> Now, things like the race between disconnect and open are good for
> teaching, because they crop up in every driver and have to be handled.  
> Other things aren't so clear (such as the autosuspend support).
> 

I think it is important to have a clean and working example. It would
save a lot of time for everybody and shrinks the number of round trips.

Greetings,
Stefani



  reply	other threads:[~2012-06-06 20:19 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-06 16:27 [PATCH] fix usb skeleton driver stefani
2012-06-06 16:27 ` [PATCH 01/11] fix wrong label in skel_open stefani
2012-06-06 18:52   ` Oliver Neukum
2012-06-06 19:59     ` Stefani Seibold
2012-06-06 16:27 ` [PATCH 02/11] code cleanup stefani
2012-06-06 18:57   ` Oliver Neukum
2012-06-06 16:27 ` [PATCH 03/11] remove dead code stefani
2012-06-06 16:27 ` [PATCH 04/11] remove usb_interface pointer stefani
2012-06-06 18:59   ` Oliver Neukum
2012-06-06 20:04     ` Stefani Seibold
2012-06-06 20:19       ` Alan Stern
2012-06-06 22:54   ` Greg KH
2012-06-07  8:07     ` Stefani Seibold
2012-06-07 11:51     ` Stefani Seibold
2012-06-07 14:28       ` Alan Stern
2012-06-07 15:03         ` Stefani Seibold
2012-06-07 15:27           ` Alan Stern
2012-06-07 19:50             ` Stefani Seibold
2012-06-07 20:42               ` Alan Stern
2012-06-08  7:18               ` RFC: remove usb_device pointer from usb_skeleton.c Stefani Seibold
2012-06-08  8:28                 ` Oliver Neukum
2012-06-08 13:46                 ` Alan Stern
2012-06-06 16:27 ` [PATCH 05/11] remove unneeded forward declaration stefani
2012-06-06 16:27 ` [PATCH 06/11] introduce fsync function stefani
2012-06-06 16:27 ` [PATCH 07/11] remove pr_err() noise in skel_open stefani
2012-06-06 16:27 ` [PATCH 08/11] Handle a non blocking read without blocking stefani
2012-06-06 16:27 ` [PATCH 09/11] Synchronize disconnect() handler with open() and release(), to fix races stefani
2012-06-06 16:27 ` [PATCH 10/11] Introduce single user mode stefani
2012-06-06 16:27 ` [PATCH 11/11] Bump version number and add aditional author stefani
2012-06-06 16:55 ` [PATCH] fix usb skeleton driver Alan Stern
2012-06-06 17:53   ` Stefani Seibold
2012-06-06 18:16     ` Alan Stern
2012-06-06 20:19       ` Stefani Seibold [this message]
2012-06-06 20:22         ` Alan Stern
2012-06-07  8:13           ` Stefani Seibold
2012-06-07  7:10         ` Bjørn Mork
  -- strict thread matches above, loose matches on Subject: below --
2012-06-07  8:20 stefani
2012-06-06 13:23 stefani
2012-06-06 13:50 ` Oliver Neukum
2012-06-06 14:28 ` Ming Lei
2012-06-06 15:05   ` Stefani Seibold
2012-06-07  1:05     ` Ming Lei
2012-06-06 15:06   ` Alan Stern
2012-06-06 18:37     ` Oliver Neukum
2012-06-06  7:00 stefani
2012-06-06  7:29 ` Oliver Neukum
2012-06-06  7:46   ` Stefani Seibold
2012-06-06  7:44     ` Oliver Neukum
2012-06-06  7:32 ` Oliver Neukum
2012-06-06 12:18   ` Stefani Seibold
2012-06-06  8:11 ` 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=1339013986.3437.20.camel@wall-e \
    --to=stefani@seibold.net \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=oneukum@suse.de \
    --cc=stern@rowland.harvard.edu \
    /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