summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOliver Endriss <devnull@localhost>2003-12-27 18:07:39 +0000
committerOliver Endriss <devnull@localhost>2003-12-27 18:07:39 +0000
commitd1000cc47d222fd0ceddc2a15faf3cbfe3a2b979 (patch)
treea6123671d2a8a27156a559e795b43d14fffda72d
parent569a34c826a28a028da6547d1a15716d9b69e586 (diff)
downloadmediapointer-dvb-s2-d1000cc47d222fd0ceddc2a15faf3cbfe3a2b979.tar.gz
mediapointer-dvb-s2-d1000cc47d222fd0ceddc2a15faf3cbfe3a2b979.tar.bz2
Memory optimization: do not allocate firmware buffer if firmware is compiled into the driver. Saves 220KB vmem.
-rw-r--r--linux/drivers/media/dvb/ttpci/av7110.c24
1 files changed, 10 insertions, 14 deletions
diff --git a/linux/drivers/media/dvb/ttpci/av7110.c b/linux/drivers/media/dvb/ttpci/av7110.c
index fcb7cdd61..1dd270b43 100644
--- a/linux/drivers/media/dvb/ttpci/av7110.c
+++ b/linux/drivers/media/dvb/ttpci/av7110.c
@@ -4512,8 +4512,6 @@ static int av7110_attach (struct saa7146_dev* dev, struct saa7146_pci_extension_
{
#ifndef CONFIG_DVB_AV7110_FIRMWARE_FILE
const struct firmware *fw;
-#else
- struct firmware *fw;
#endif
struct av7110 *av7110 = NULL;
int ret = 0;
@@ -4529,20 +4527,12 @@ static int av7110_attach (struct saa7146_dev* dev, struct saa7146_pci_extension_
printk("dvb-ttpci: cannot request firmware!\n");
return -EINVAL;
}
-#else
- fw = vmalloc(sizeof(struct firmware));
- if (NULL == fw) {
- printk("dvb-ttpci: not enough memory\n");
- return -ENOMEM;
- }
- fw->size = sizeof(dvb_ttpci_fw);
- fw->data = dvb_ttpci_fw;
-#endif
if (fw->size <= 200000) {
printk("dvb-ttpci: this firmware is way too small.\n");
return -EINVAL;
}
+#endif
/* prepare the av7110 device struct */
if (!(av7110 = kmalloc (sizeof (struct av7110), GFP_KERNEL))) {
@@ -4551,6 +4541,7 @@ static int av7110_attach (struct saa7146_dev* dev, struct saa7146_pci_extension_
}
memset(av7110, 0, sizeof(struct av7110));
+#ifndef CONFIG_DVB_AV7110_FIRMWARE_FILE
/* check if the firmware is available */
av7110->bin_fw = (unsigned char*)vmalloc(fw->size);
if (NULL == av7110->bin_fw) {
@@ -4560,6 +4551,10 @@ static int av7110_attach (struct saa7146_dev* dev, struct saa7146_pci_extension_
}
memcpy(av7110->bin_fw, fw->data, fw->size);
av7110->size_fw = fw->size;
+#else
+ av7110->bin_fw = dvb_ttpci_fw;
+ av7110->size_fw = sizeof dvb_ttpci_fw;
+#endif
/* check for firmware magic */
ptr = av7110->bin_fw;
@@ -4604,9 +4599,6 @@ static int av7110_attach (struct saa7146_dev* dev, struct saa7146_pci_extension_
av7110->bin_root = ptr;
av7110->size_root = len;
-#ifdef CONFIG_DVB_AV7110_FIRMWARE_FILE
- vfree(fw);
-#endif
/* go on with regular device initialization */
av7110->card_name = (char*)pci_ext->ext_priv;
av7110->dev=(struct saa7146_dev *)dev;
@@ -4877,7 +4869,9 @@ err:
return ret;
fw_error:
+#ifndef CONFIG_DVB_AV7110_FIRMWARE_FILE
vfree(av7110->bin_fw);
+#endif
kfree(av7110);
return -EINVAL;
}
@@ -4921,9 +4915,11 @@ static int av7110_detach (struct saa7146_dev* saa)
dvb_unregister_adapter (av7110->dvb_adapter);
av7110_num--;
+#ifndef CONFIG_DVB_AV7110_FIRMWARE_FILE
if (NULL != av7110->bin_fw ) {
vfree(av7110->bin_fw);
}
+#endif
kfree (av7110);
saa->ext_priv = NULL;