From patchwork Sat Jan 30 10:18:25 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudip Mukherjee X-Patchwork-Id: 8170591 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 083AE9FCD9 for ; Sat, 30 Jan 2016 10:19:51 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1774820398 for ; Sat, 30 Jan 2016 10:19:50 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 4CF3C203A1 for ; Sat, 30 Jan 2016 10:19:48 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id F2BA226606C; Sat, 30 Jan 2016 11:19:46 +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, NO_DNS_FOR_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 2B8CC261B14; Sat, 30 Jan 2016 11:18:48 +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 A189F261B01; Sat, 30 Jan 2016 11:18:46 +0100 (CET) Received: from mail-pf0-f193.google.com (mail-pf0-f193.google.com [209.85.192.193]) by alsa0.perex.cz (Postfix) with ESMTP id D01C12619D0 for ; Sat, 30 Jan 2016 11:18:40 +0100 (CET) Received: by mail-pf0-f193.google.com with SMTP id x125so5020612pfb.0 for ; Sat, 30 Jan 2016 02:18:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=OYl5fzUlL6kDiP4A8Kn3tNhR02PLuJuWHMbNcWume/M=; b=BwodEzM/VzqXle7YBHOYYflmuWtCCBN7PcGEGjcYfzYdd2H67bCFWJiJbW68j4FrRp 2tzWGe0z8r1evfn5Z3bSwGTwAGLAGZ4HQPEFSvDnAMLFF2DVg7YN0xc1ejctS8Ndt5az xFYDjbZCPRm++qkPXtVb3mNWbvrqHs0OQLANoggKbFokBiuVuaPZuktORqXSDX2yizxJ bWVKXzs69bRnV8wKD5xlXYTtHY5h0z2Z8D5XihonKIoIK+FOeYbpH8uqw+sXfF5DmIc3 d9SJa8MGqIb4VYZE1Vrq4oP+JMWamcieEpOEFKnjeHyo8Fb+82Ik7x16CSlfuA28TlLV 5/Fw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=OYl5fzUlL6kDiP4A8Kn3tNhR02PLuJuWHMbNcWume/M=; b=hRHXZW5fU1caoRg3ZxLIQL2uLyBeNw2AGQF4AN5AzpHdmU/oMkoGaQNJtxe/2SccHw bA/nAzqYzr98d8afKas035CqlJZoDQjUBqZjVKmSSZVa1S5hzOZQgaY49fjuucr5GKIK 9dZqLk5pHcYN0+EWp49OnZbV51I/s2L+bt4izjjUD9SnKoSp14PrBAnLoeSx1XIqEVmp 8F94ZxlkKi0Ll6Tp6RPeLSZ0HU1oI5feNhgP+eu5jgBh5CBPDNZ4tNVITl0MRYyRyZHy w5/eqhffMryb6wqKehwqhBdaNThUutKi2u7DT7gh253vziU9BJwj3e+ji3CLvJdh0Xqx 1NlQ== X-Gm-Message-State: AG10YOQPuTIn8lWeWhM5myWGFUIlLBZTgcZiLRE8DB/qCsuqUXDw9hcl0w8+uJYEdRjDiA== X-Received: by 10.98.16.27 with SMTP id y27mr21003628pfi.33.1454149120201; Sat, 30 Jan 2016 02:18:40 -0800 (PST) Received: from sudip-pc.vectortproxy.org ([183.82.228.136]) by smtp.gmail.com with ESMTPSA id s19sm29335561pfs.62.2016.01.30.02.18.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 30 Jan 2016 02:18:39 -0800 (PST) From: Sudip Mukherjee To: Jaroslav Kysela , Takashi Iwai Date: Sat, 30 Jan 2016 15:48:25 +0530 Message-Id: <1454149105-17474-3-git-send-email-sudipm.mukherjee@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1454149105-17474-1-git-send-email-sudipm.mukherjee@gmail.com> References: <1454149105-17474-1-git-send-email-sudipm.mukherjee@gmail.com> Cc: alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Sudip Mukherjee Subject: [alsa-devel] [PATCH v2 3/3] ALSA: mts64: 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: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP Modify mts64 driver to use the new parallel port device model. Signed-off-by: Sudip Mukherjee --- 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_mts64_dev_probe(). sound/drivers/mts64.c | 52 ++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 39 insertions(+), 13 deletions(-) diff --git a/sound/drivers/mts64.c b/sound/drivers/mts64.c index ee6a87f..01da990 100644 --- a/sound/drivers/mts64.c +++ b/sound/drivers/mts64.c @@ -851,10 +851,21 @@ static int snd_mts64_probe_port(struct parport *p) { struct pardevice *pardev; int res; + struct pardev_cb pdev_cb = { + .preempt = NULL, + .wakeup = NULL, + .private = NULL, + .irq_func = NULL, + .flags = 0, + }; - pardev = parport_register_device(p, DRIVER_NAME, - NULL, NULL, NULL, - 0, NULL); + /* + * 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); if (!pardev) return -EIO; @@ -904,10 +915,20 @@ static void snd_mts64_detach(struct parport *p) /* nothing to do here */ } +static int snd_mts64_dev_probe(struct pardevice *pardev) +{ + if (strcmp(pardev->name, DRIVER_NAME)) + return -ENODEV; + + return 0; +} + static struct parport_driver mts64_parport_driver = { - .name = "mts64", - .attach = snd_mts64_attach, - .detach = snd_mts64_detach + .name = "mts64", + .probe = snd_mts64_dev_probe, + .match_port = snd_mts64_attach, + .detach = snd_mts64_detach, + .devmodel = true, }; /********************************************************************* @@ -935,6 +956,12 @@ static int snd_mts64_probe(struct platform_device *pdev) struct snd_card *card = NULL; struct mts64 *mts = NULL; int err; + struct pardev_cb mts64_cb = { + .preempt = NULL, + .wakeup = NULL, + .irq_func = snd_mts64_interrupt, /* ISR */ + .flags = PARPORT_DEV_EXCL, /* flags */ + }; p = platform_get_drvdata(pdev); platform_set_drvdata(pdev, NULL); @@ -959,13 +986,12 @@ static int snd_mts64_probe(struct platform_device *pdev) sprintf(card->longname, "%s at 0x%lx, irq %i", card->shortname, p->base, p->irq); - pardev = parport_register_device(p, /* port */ - DRIVER_NAME, /* name */ - NULL, /* preempt */ - NULL, /* wakeup */ - snd_mts64_interrupt, /* ISR */ - PARPORT_DEV_EXCL, /* flags */ - (void *)card); /* private */ + mts64_cb.private = card; /* private */ + + pardev = parport_register_dev_model(p, /* port */ + DRIVER_NAME, /* name */ + &mts64_cb, /* callbacks */ + pdev->id); /* device number */ if (pardev == NULL) { snd_printd("Cannot register pardevice\n"); err = -EIO;