From patchwork Thu Jan 7 11:19:36 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudip Mukherjee X-Patchwork-Id: 7976041 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 679AA9F38D for ; Thu, 7 Jan 2016 11:20:07 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 948D02015E for ; Thu, 7 Jan 2016 11:20:06 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 4EFF420149 for ; Thu, 7 Jan 2016 11:20:05 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 24E11265379; Thu, 7 Jan 2016 12:20:04 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=no version=3.3.1 Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id A30E5260421; Thu, 7 Jan 2016 12:19:55 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 487AE260417; Thu, 7 Jan 2016 12:19:55 +0100 (CET) Received: from mail-pa0-f50.google.com (mail-pa0-f50.google.com [209.85.220.50]) by alsa0.perex.cz (Postfix) with ESMTP id 7DE4A260417 for ; Thu, 7 Jan 2016 12:19:47 +0100 (CET) Received: by mail-pa0-f50.google.com with SMTP id yy13so164091529pab.3 for ; Thu, 07 Jan 2016 03:19:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=jjvh0ySR137LRjVfpkcrhrWd00Ut5KXqKZk6YUd846s=; b=vGKO3J3b7OhcAGt9R4TZb1Rn7TBuFz/zOnDmoImFTmNGyGMLREgWxyhGslRuCJ+ZdE 9C5IPzjtdgULNexawjh1/bmuiVcHwd8ae6RlFhW708S2mFAm8iTlrlYAAb0zS2sBt4Wn 1XZuUGkpAaFY9Xbed6pL8t/JkLnKac7GFrdnnyy4tITd5AfvJMI3yLKbrUT0WjJIKTDY xCLOgUhFUIxg08x9krh2akWj6kXpnbQ4Es9OzbjqTzZaEu+P1AmrCV9qT5W1gK8vuGWl 3ATyCnuo1QvJK2QKHoqGopDKlzCGY7tj9mDKM8ETXjlHe5rngFzJdxVm4fdf6zJZSySs cvjQ== X-Received: by 10.67.7.200 with SMTP id de8mr4965697pad.28.1452165586334; Thu, 07 Jan 2016 03:19:46 -0800 (PST) Received: from sudip-pc ([183.82.228.160]) by smtp.gmail.com with ESMTPSA id tb8sm154269691pab.22.2016.01.07.03.19.43 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Thu, 07 Jan 2016 03:19:45 -0800 (PST) Date: Thu, 7 Jan 2016 16:49:36 +0530 From: Sudip Mukherjee To: Takashi Iwai Message-ID: <20160107111936.GA13389@sudip-pc> References: <1452150951-1571-1-git-send-email-sudipm.mukherjee@gmail.com> <1452150951-1571-6-git-send-email-sudipm.mukherjee@gmail.com> <20160107104434.GA9809@sudip-pc> <20160107110127.GA11477@sudip-pc> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20160107110127.GA11477@sudip-pc> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Subject: Re: [alsa-devel] [PATCH 6/6] [ALSA] portman2x4 - use new parport device model X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP 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: > > > > > > > > > > > > > > + > > > > > + 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) regards sudip 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;