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


Groups > linux.kernel > #1303489

Re: [alsa-devel] [PATCH 6/6] [ALSA] portman2x4 - use new parport device model

From Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Newsgroups linux.kernel
Subject Re: [alsa-devel] [PATCH 6/6] [ALSA] portman2x4 - use new parport device model
Date 2016-01-07 12:20 +0100
Message-ID <qOgLM-7kJ-13@gated-at.bofh.it> (permalink)
References (1 earlier) <qOd1w-4IS-19@gated-at.bofh.it> <qOfZo-6MT-13@gated-at.bofh.it> <qOgiK-6Tx-11@gated-at.bofh.it> <qOgsq-6Yo-21@gated-at.bofh.it> <qOgC6-7hc-21@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Thu, Jan 07, 2016 at 04:31:27PM +0530, Sudip Mukherjee wrote:
> On Thu, Jan 07, 2016 at 11:50:15AM +0100, Takashi Iwai wrote:
> > On Thu, 07 Jan 2016 11:44:34 +0100,
> > Sudip Mukherjee wrote:
> > > 
> > > On Thu, Jan 07, 2016 at 11:26:44AM +0100, Takashi Iwai wrote:
> > > > On Thu, 07 Jan 2016 08:15:51 +0100,
> > > > Sudip Mukherjee wrote:
> > > > > 
<snip>
> > > > 
> > > > > +
> > > > > +	pardev = parport_register_dev_model(p,		   /* port */
> > > > > +					    DRIVER_NAME,   /* name */
> > > > > +					    &portman_cb,   /* callbacks */
> > > > > +					    device_count); /* device number */
> > > > 
> > > > Does device_count really work similarly for
> > > > parport_register_dev_model()?  I supposed the argument being the
> > > > device id number while you're passing the number of devices to
> > > > create.
> > > 
> > > This device_count is actually used for the device name in
> > > /sys/bus/parport/devices. Something like DRIVER_NAME.device_count.
> > 
> > Well, but device_count is incremented in snd_portman_attach().  The
> > management of device_count should be moved around the caller side, if
> > we use this as the id (and use the assigned id instead of device_count
> > in snd_portman_attach()).

did you mean something like this: (on top of my patch)

diff --git a/sound/drivers/portman2x4.c b/sound/drivers/portman2x4.c
index 88b25ca..d749786 100644
--- a/sound/drivers/portman2x4.c
+++ b/sound/drivers/portman2x4.c
@@ -688,14 +688,8 @@ static void snd_portman_attach(struct parport *p)
 
 	/* Since we dont get the return value of probe
 	 * We need to check if device probing succeeded or not */
-	if (!platform_get_drvdata(device)) {
+	if (!platform_get_drvdata(device))
 		platform_device_unregister(device);
-		return;
-	}
-
-	/* register device in global table */
-	platform_devices[device_count] = device;
-	device_count++;
 }
 
 static void snd_portman_detach(struct parport *p)
@@ -768,7 +762,7 @@ static int snd_portman_probe(struct platform_device *pdev)
 	pardev = parport_register_dev_model(p,		   /* port */
 					    DRIVER_NAME,   /* name */
 					    &portman_cb,   /* callbacks */
-					    device_count); /* device number */
+					    pdev->id);	   /* device number */
 	if (!pardev) {
 		snd_printd("Cannot register pardevice\n");
 		err = -EIO;
@@ -812,6 +806,10 @@ static int snd_portman_probe(struct platform_device *pdev)
 		goto __err;
 	}
 
+	/* register device in global table */
+	platform_devices[device_count] = device;
+	device_count++;
+
 	snd_printk(KERN_INFO "Portman 2x4 on 0x%lx\n", p->base);
 	return 0;
 

regards
sudip
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

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


Thread

[PATCH 6/6] [ALSA] portman2x4 - use new parport device model Sudip Mukherjee <sudipm.mukherjee@gmail.com> - 2016-01-07 08:20 +0100
  Re: [alsa-devel] [PATCH 6/6] [ALSA] portman2x4 - use new parport device model Takashi Iwai <tiwai@suse.de> - 2016-01-07 11:30 +0100
    Re: [alsa-devel] [PATCH 6/6] [ALSA] portman2x4 - use new parport  device model Sudip Mukherjee <sudipm.mukherjee@gmail.com> - 2016-01-07 11:50 +0100
      Re: [alsa-devel] [PATCH 6/6] [ALSA] portman2x4 - use new parport device model Takashi Iwai <tiwai@suse.de> - 2016-01-07 12:00 +0100
        Re: [alsa-devel] [PATCH 6/6] [ALSA] portman2x4 - use new parport  device model Sudip Mukherjee <sudipm.mukherjee@gmail.com> - 2016-01-07 12:10 +0100
          Re: [alsa-devel] [PATCH 6/6] [ALSA] portman2x4 - use new parport  device model Sudip Mukherjee <sudipm.mukherjee@gmail.com> - 2016-01-07 12:20 +0100
            Re: [alsa-devel] [PATCH 6/6] [ALSA] portman2x4 - use new parport device model Takashi Iwai <tiwai@suse.de> - 2016-01-07 12:50 +0100

csiph-web