From: Takashi Iwai Subject: Re: [PATCH]snd_usb_usx2y: use request_firmware() instead of snd_hw based firmware loading Date: Wed, 08 Mar 2006 13:40:04 +0100 Message-ID: References: <200603071656.23637.annabellesgarden@yahoo.de> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Return-path: In-Reply-To: <200603071656.23637.annabellesgarden@yahoo.de> 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: Karsten Wiese Cc: alsa-devel@lists.sourceforge.net List-Id: alsa-devel@alsa-project.org At Tue, 7 Mar 2006 16:56:23 +0100, Karsten Wiese wrote: > > Hi Takashi > > This is one step to make hotplug work here on FC4 again. > other things needed are updated firmwareloader, hotplug-scripts and > us428control. > > The new firmwareloader actually only needs to run once to > unpack the firmware. The "make install" in alsa-firmware/usx2yloader > puts the firmware into /lib/firmware then. > > I got it here, but before submission: > Would you like to change and keep the alsa-tools/usx2yloader for that? > Alternatively there could be a new "usx2y-fw-unpack" binary > in alsa-firmware/usx2yloader and alsa-tools/usx2yloader would vanish. It's a good question. Currently, request_firmware() isn't perfect since it doesn't work when the driver is built-in. Also, old kernels don't support firmware interface, too. So, it's not so bad to keep the old hwdep loader. If the size metters, we can ifdef them. > +static int usX2Y_create_alsa_devices(struct snd_card *card) > +{ > + int err; > + > + do { > + if ((err = usX2Y_create_usbmidi(card)) < 0) { > + snd_printk(KERN_ERR "usX2Y_create_alsa_devices: usX2Y_create_usbmidi error %i \n", err); > + break; > + } > + if ((err = usX2Y_audio_create(card)) < 0) > + break; > + if ((err = usX2Y_hwdep_pcm_new(card)) < 0) > + break; > + if ((err = snd_card_register(card)) < 0) > + break; > + } while (0); This do-while should be removed. It's used for macros but not suitable for plain codes. Replace break with a simple "return err". > +static int usX2Y_fw_load(struct usb_device* device, struct usb_interface *intf, int type_id, const char *fmt) > +{ > + char buf[32]; > + const struct firmware *fw; > + int lret, err; > + > + sprintf(buf, fmt, usX2Y_type_ids[type_id]); Any reason to use a temporary buffer for the same string? > + > + if ((err = request_firmware(&fw, buf, &intf->dev))) { > + printk(KERN_ERR > + "%s: Firmware %s not available\n", __FUNCTION__, buf); > + return err; > + } > + { > + char *buf = kmalloc(fw->size, GFP_KERNEL); Avoid unnecessary block, and don't use the same variable name... Thanks, Takashi ------------------------------------------------------- This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory! http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642