From: Takashi Iwai Subject: Re: [PATCH] AC97 bus interface for ad-hoc drivers Date: Wed, 27 Jul 2005 13:10:21 +0200 Message-ID: References: <1121775624.14604.14.camel@cearnarfon> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Return-path: In-Reply-To: <1121775624.14604.14.camel@cearnarfon> Sender: alsa-devel-admin@lists.sourceforge.net Errors-To: alsa-devel-admin@lists.sourceforge.net List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , List-Archive: To: Liam Girdwood Cc: alsa-devel@lists.sourceforge.net, Bill Gatliff , Nicolas Pitre List-Id: alsa-devel@alsa-project.org At Tue, 19 Jul 2005 13:20:24 +0100, Liam Girdwood wrote: > > This patch adds support for ad-hoc AC97 device drivers (e.g WM97xx and > UCB touchscreen drivers) and was originally posted to the list by > Nicolas Pitre as an RFC. > > Changes from RFC version :- > > o Now matches codec name within codec group. > o Added ac97_dev_release() to stop kernel complaining about no release > method for device. Thanks for the patch. The idea is fine, and the code looks almost OK except for the below. Could you describe the full changelog (or paste Nicolas' RFC) ? > diff --git a/sound/pci/ac97/Makefile b/sound/pci/ac97/Makefile > --- a/sound/pci/ac97/Makefile > +++ b/sound/pci/ac97/Makefile > @@ -12,7 +12,7 @@ endif > snd-ak4531-codec-objs := ak4531_codec.o > > # Toplevel Module Dependency > -obj-$(CONFIG_SND_AC97_CODEC) += snd-ac97-codec.o > +obj-$(CONFIG_SND_AC97_CODEC) += snd-ac97-codec.o ac97_bus.o Better to keep snd- prefix for ac97_bus module (although it can be used independently from ALSA)...? It's an open question. > diff --git a/sound/pci/ac97/ac97_bus.c b/sound/pci/ac97/ac97_bus.c > new file mode 100644 > --- /dev/null > +++ b/sound/pci/ac97/ac97_bus.c (snip) > +#include > +#include > +#include > +#include > + > +#include > +#include > +#include Don't include unnecessary header files. > diff --git a/sound/pci/ac97/ac97_codec.c b/sound/pci/ac97/ac97_codec.c > --- a/sound/pci/ac97/ac97_codec.c > +++ b/sound/pci/ac97/ac97_codec.c (snip) > @@ -2117,6 +2124,14 @@ int snd_ac97_mixer(ac97_bus_t *bus, ac97 > snd_ac97_free(ac97); > return err; > } > + > + ac97->dev.bus = &ac97_bus_type; > + ac97->dev.parent = ac97->bus->card->dev; > + ac97->dev.platform_data = ac97; > + ac97->dev.release = ac97_dev_release; > + strncpy(ac97->dev.bus_id, snd_ac97_get_short_name(ac97), BUS_ID_SIZE); > + if ((err = device_register(&ac97->dev)) < 0) > + return err; Need to call snd_ac97_free() in the error path (but reset dev.bus to NULL to avoid unregister). Takashi ------------------------------------------------------- SF.Net email is sponsored by: Discover Easy Linux Migration Strategies from IBM. Find simple to follow Roadmaps, straightforward articles, informative Webcasts and more! Get everything you need to get up to speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click