From patchwork Thu Jun 17 12:06:53 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 106671 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o5HC7NcE001967 for ; Thu, 17 Jun 2010 12:07:23 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759884Ab0FQMHW (ORCPT ); Thu, 17 Jun 2010 08:07:22 -0400 Received: from mail-wy0-f174.google.com ([74.125.82.174]:60114 "EHLO mail-wy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751918Ab0FQMHV (ORCPT ); Thu, 17 Jun 2010 08:07:21 -0400 Received: by wyf23 with SMTP id 23so50992wyf.19 for ; Thu, 17 Jun 2010 05:07:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:cc:subject :message-id:mime-version:content-type:content-disposition:user-agent; bh=Zu9wNUVQQ7pZ+Hc99w6Kzum0wIMnhPtQTn3TDMuHMvA=; b=nhAg+mOLn2X4k/jGjqNJfLj5u5VKvg+c2xoPTIqfrG2ojlZDEovLWLxRqpANwbd2Ms aBW8EQcbMQtdbODyKql/F9mz9NtADqJ/m11YUwXmLFV1MgxX89MWgH4ooaHRfltVUAK3 6rzJVuS5+h9VWegjp4DBryFn4wsf02RUE7EgA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:mime-version:content-type :content-disposition:user-agent; b=WCj7W77z0K2GXmEj/ueH4pHw/VV0wPzHn/XsFK+6IUPVTpXG1SsP2Mum3jOYZFLcYY 56epC7Vq788GUw78pbR9TdPESpWs1cynjTG2arsPQ+5i/ooBU2ju5SOkBex+vAKFTsNw hYXBTcMS/IhHwQppkaDCeo7dHPi9nXfl+0DSs= Received: by 10.216.89.12 with SMTP id b12mr6368102wef.33.1276776439884; Thu, 17 Jun 2010 05:07:19 -0700 (PDT) Received: from bicker ([205.177.176.130]) by mx.google.com with ESMTPS id w21sm2704687weq.21.2010.06.17.05.06.51 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 17 Jun 2010 05:07:19 -0700 (PDT) Date: Thu, 17 Jun 2010 14:06:53 +0200 From: Dan Carpenter To: linux-media@vger.kernel.org Cc: Stefan Ringel , Mauro Carvalho Chehab Subject: [patch] Staging: tm6000: fix problem in alsa init Message-ID: <20100617120653.GI5483@bicker> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.18 (2008-05-17) Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Thu, 17 Jun 2010 12:07:24 +0000 (UTC) diff --git a/drivers/staging/tm6000/tm6000-alsa.c b/drivers/staging/tm6000/tm6000-alsa.c index ce081cd..94c9f15 100644 --- a/drivers/staging/tm6000/tm6000-alsa.c +++ b/drivers/staging/tm6000/tm6000-alsa.c @@ -337,7 +337,7 @@ static int __devinit snd_tm6000_pcm(struct snd_tm6000_card *chip, * Alsa Constructor - Component probe */ -int tm6000_audio_init(struct tm6000_core *dev, int idx) +static int tm6000_audio_init(struct tm6000_core *dev, int idx) { struct snd_card *card; struct snd_tm6000_card *chip; @@ -411,12 +411,12 @@ error: return rc; } -static int tm6000_audio_fini(struct tm6000_core *dev) +static int tm6000_audio_fini(struct tm6000_core *dev, int idx) { return 0; } -struct tm6000_ops audio_ops = { +static struct tm6000_ops audio_ops = { .id = TM6000_AUDIO, .name = "TM6000 Audio Extension", .init = tm6000_audio_init, diff --git a/drivers/staging/tm6000/tm6000-core.c b/drivers/staging/tm6000/tm6000-core.c index 27f3f55..c71452c 100644 --- a/drivers/staging/tm6000/tm6000-core.c +++ b/drivers/staging/tm6000/tm6000-core.c @@ -661,13 +661,14 @@ static DEFINE_MUTEX(tm6000_extension_devlist_lock); int tm6000_register_extension(struct tm6000_ops *ops) { struct tm6000_core *dev = NULL; + int idx = 0; mutex_lock(&tm6000_devlist_mutex); mutex_lock(&tm6000_extension_devlist_lock); list_add_tail(&ops->next, &tm6000_extension_devlist); list_for_each_entry(dev, &tm6000_devlist, devlist) { - if (dev) - ops->init(dev); + ops->init(dev, idx); + idx++; } printk(KERN_INFO "tm6000: Initialized (%s) extension\n", ops->name); mutex_unlock(&tm6000_extension_devlist_lock); @@ -679,11 +680,12 @@ EXPORT_SYMBOL(tm6000_register_extension); void tm6000_unregister_extension(struct tm6000_ops *ops) { struct tm6000_core *dev = NULL; + int idx = 0; mutex_lock(&tm6000_devlist_mutex); list_for_each_entry(dev, &tm6000_devlist, devlist) { - if (dev) - ops->fini(dev); + ops->fini(dev, idx); + idx++; } mutex_lock(&tm6000_extension_devlist_lock); @@ -697,12 +699,13 @@ EXPORT_SYMBOL(tm6000_unregister_extension); void tm6000_init_extension(struct tm6000_core *dev) { struct tm6000_ops *ops = NULL; + int idx = 0; mutex_lock(&tm6000_extension_devlist_lock); if (!list_empty(&tm6000_extension_devlist)) { list_for_each_entry(ops, &tm6000_extension_devlist, next) { - if (ops->init) - ops->init(dev); + ops->init(dev, idx); + idx++; } } mutex_unlock(&tm6000_extension_devlist_lock); @@ -711,12 +714,13 @@ void tm6000_init_extension(struct tm6000_core *dev) void tm6000_close_extension(struct tm6000_core *dev) { struct tm6000_ops *ops = NULL; + int idx = 0; mutex_lock(&tm6000_extension_devlist_lock); if (!list_empty(&tm6000_extension_devlist)) { list_for_each_entry(ops, &tm6000_extension_devlist, next) { - if (ops->fini) - ops->fini(dev); + ops->fini(dev, idx); + idx++; } } mutex_unlock(&tm6000_extension_devlist_lock); diff --git a/drivers/staging/tm6000/tm6000.h b/drivers/staging/tm6000/tm6000.h index 7bbaf26..971a39a 100644 --- a/drivers/staging/tm6000/tm6000.h +++ b/drivers/staging/tm6000/tm6000.h @@ -213,8 +213,8 @@ struct tm6000_ops { struct list_head next; char *name; int id; - int (*init)(struct tm6000_core *); - int (*fini)(struct tm6000_core *); + int (*init)(struct tm6000_core *, int idx); + int (*fini)(struct tm6000_core *, int idx); }; struct tm6000_fh {