Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1327621

Re: [PATCH v3 3/3] portman2x4 - use new parport device model

Path csiph.com!goblin3!goblin1!goblin.stu.neva.ru!nntpspool01.opticnetworks.net!aioe.org!bofh.it!news.nic.it!robomod
From Takashi Iwai <tiwai@suse.de>
Newsgroups linux.kernel
Subject Re: [PATCH v3 3/3] portman2x4 - use new parport device model
Date Fri, 05 Feb 2016 13:00:02 +0100
Message-ID <qYNdo-85k-19@gated-at.bofh.it> (permalink)
References <qYv6O-4s9-3@gated-at.bofh.it> <qYv6P-4s9-21@gated-at.bofh.it> <qYvqb-4Ad-31@gated-at.bofh.it> <qYHUl-4Th-1@gated-at.bofh.it>
X-Original-To Sudip Mukherjee <sudipm.mukherjee@gmail.com>
User-Agent Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (Gojō) APEL/10.8 Emacs/24.5 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO)
MIME-Version 1.0 (generated by SEMI 1.14.6 - "Maruoka")
Content-Type text/plain; charset=US-ASCII
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 81
Organization linux.* mail to news gateway
X-Original-Cc Jaroslav Kysela <perex@perex.cz>, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org
X-Original-Date Fri, 05 Feb 2016 12:55:13 +0100
X-Original-Message-ID <s5hbn7ve5i6.wl-tiwai@suse.de>
X-Original-References <1454603903-15967-1-git-send-email-sudipm.mukherjee@gmail.com> <1454603903-15967-3-git-send-email-sudipm.mukherjee@gmail.com> <s5hr3gse7wk.wl-tiwai@suse.de> <20160205061706.GA6374@sudip-pc>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1327621

Show key headers only | View raw


On Fri, 05 Feb 2016 07:17:06 +0100,
Sudip Mukherjee wrote:
> 
> On Thu, Feb 04, 2016 at 05:51:07PM +0100, Takashi Iwai wrote:
> > On Thu, 04 Feb 2016 17:38:23 +0100,
> > Sudip Mukherjee wrote:
> > > 
> > > Modify portman driver to use the new parallel port device model.
> > > The advantage of using the device model is that the device gets binded
> > > to the hardware, we get the feature of hotplug, we can bind/unbind
> > > the driver at runtime.
> > > The only change is in the way the driver gets registered with the
> > > parallel port subsystem and so as a result there is no user visible
> > > change or any chance of regression.
> > > 
> > > Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
> > > ---
> > > 
> > > v3: changed commit message
> > > v2:
> > >  1. pardev_cb is initialized while declaring, thus removing the use of
> > > memset.
> > >  2. used pdev->id.
> > >  3. v1 did not have the parport probe callback, but
> > > we will need the probe callback for binding as the name of the driver
> > > and the name of the device is different.
> > >  4. in v1 I missed modifying snd_portman_probe_port().
> > > 
> > >  sound/drivers/portman2x4.c | 53 ++++++++++++++++++++++++++++++++++------------
> > >  1 file changed, 39 insertions(+), 14 deletions(-)
> > > 
> > > diff --git a/sound/drivers/portman2x4.c b/sound/drivers/portman2x4.c
> > > index 172685d..a22f56c 100644
> > > --- a/sound/drivers/portman2x4.c
> > > +++ b/sound/drivers/portman2x4.c
> > > @@ -650,10 +650,21 @@ static int snd_portman_probe_port(struct parport *p)
> > >  {
> > >  	struct pardevice *pardev;
> > >  	int res;
> > > -
> > > -	pardev = parport_register_device(p, DRIVER_NAME,
> > > -					 NULL, NULL, NULL,
> > > -					 0, NULL);
> > > +	struct pardev_cb pdev_cb = {
> > > +		.preempt = NULL,
> > > +		.wakeup = NULL,
> > > +		.private = NULL,
> > > +		.irq_func = NULL,
> > > +		.flags = 0,
> > > +	};
> > > +
> > > +	/*
> > > +	 * Specify the device number as SNDRV_CARDS + 1 so that the
> > > +	 * device id alloted to this temporary device will never clash
> > > +	 * with an actual device already registered.
> > > +	 */
> > > +	pardev = parport_register_dev_model(p, DRIVER_NAME, &pdev_cb,
> > > +					    SNDRV_CARDS + 1);
> > 
> > Hmm, doesn't this result in a device name like "xxx.33" ?
> 
> yes, it will. But this is a temoporary device just to check if the
> sound card is connected to that particular parallel port or not. After
> checking this device is immediately unregistered. My idea here was to
> have a device number which will never clash with another device number.
> And we can never have a device like "xxx.33", so no conflict. :)

Ah, this is the temporary one.  If so, does it make sense to convert
this to dev_model one?  This means that the device will be notified to
udev even though this is a temporary one to be removed immediately.
It's what we'd want to avoid.  The function serves just as probing the
availability of the given port, not really registering anything
there.

That is, we need to change the registration flow itself if we really
want to move dev_model for the whole.


thanks,

Takashi

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v3 1/3] portman2x4 - whitespace fixes Sudip Mukherjee <sudipm.mukherjee@gmail.com> - 2016-02-04 17:40 +0100
  [PATCH v3 2/3] portman2x4 - assignment in if Sudip Mukherjee <sudipm.mukherjee@gmail.com> - 2016-02-04 17:40 +0100
  [PATCH v3 3/3] portman2x4 - use new parport device model Sudip Mukherjee <sudipm.mukherjee@gmail.com> - 2016-02-04 17:40 +0100
    Re: [PATCH v3 3/3] portman2x4 - use new parport device model Takashi Iwai <tiwai@suse.de> - 2016-02-04 18:00 +0100
      Re: [PATCH v3 3/3] portman2x4 - use new parport device model Sudip Mukherjee <sudipm.mukherjee@gmail.com> - 2016-02-05 07:20 +0100
        Re: [PATCH v3 3/3] portman2x4 - use new parport device model Takashi Iwai <tiwai@suse.de> - 2016-02-05 13:00 +0100
          Re: [PATCH v3 3/3] portman2x4 - use new parport device model Sudip Mukherjee <sudipm.mukherjee@gmail.com> - 2016-02-05 18:00 +0100
            Re: [PATCH v3 3/3] portman2x4 - use new parport device model Sudip Mukherjee <sudipm.mukherjee@gmail.com> - 2016-02-05 18:10 +0100
            Re: [PATCH v3 3/3] portman2x4 - use new parport device model Takashi Iwai <tiwai@suse.de> - 2016-02-05 18:10 +0100
              Re: [PATCH v3 3/3] portman2x4 - use new parport device model Sudip Mukherjee <sudipm.mukherjee@gmail.com> - 2016-02-05 18:30 +0100
                Re: [PATCH v3 3/3] portman2x4 - use new parport device model Takashi Iwai <tiwai@suse.de> - 2016-02-05 20:20 +0100
                Re: [PATCH v3 3/3] portman2x4 - use new parport device model Sudip Mukherjee <sudipm.mukherjee@gmail.com> - 2016-02-07 16:00 +0100
            Re: [PATCH v3 3/3] portman2x4 - use new parport device model Takashi Iwai <tiwai@suse.de> - 2016-02-05 18:10 +0100

csiph-web