alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
To: Takashi Iwai <tiwai@suse.de>
Cc: Jaroslav Kysela <perex@perex.cz>,
	alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org
Subject: Re: [alsa-devel] [PATCH 6/6] [ALSA] portman2x4 - use new parport device	model
Date: Thu, 7 Jan 2016 16:49:36 +0530	[thread overview]
Message-ID: <20160107111936.GA13389@sudip-pc> (raw)
In-Reply-To: <20160107110127.GA11477@sudip-pc>

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

  reply	other threads:[~2016-01-07 11:19 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-07  7:15 [PATCH 1/6] [ALSA] portman2x4 - fix trailing whitespace Sudip Mukherjee
2016-01-07  7:15 ` [PATCH 2/6] [ALSA] portman2x4 - fix blanklines Sudip Mukherjee
2016-01-07  7:15 ` [PATCH 3/6] [ALSA] portman2x4 - remove space Sudip Mukherjee
2016-01-07  7:15 ` [PATCH 4/6] [ALSA] portman2x4 - NULL check Sudip Mukherjee
2016-01-07  7:15 ` [PATCH 5/6] [ALSA] portman2x4 - assignment in if Sudip Mukherjee
2016-01-07  7:15 ` [PATCH 6/6] [ALSA] portman2x4 - use new parport device model Sudip Mukherjee
2016-01-07 10:26   ` Takashi Iwai
2016-01-07 10:44     ` [alsa-devel] " Sudip Mukherjee
2016-01-07 10:50       ` Takashi Iwai
2016-01-07 11:01         ` Sudip Mukherjee
2016-01-07 11:19           ` Sudip Mukherjee [this message]
2016-01-07 11:45             ` Takashi Iwai

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=20160107111936.GA13389@sudip-pc \
    --to=sudipm.mukherjee@gmail.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=tiwai@suse.de \
    /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;
as well as URLs for NNTP newsgroup(s).