[svn-commits] sruffell: branch linux/sruffell/dahdi-linux-stackreduction r7076 - /linux/tea...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Tue Aug 25 13:36:32 CDT 2009


Author: sruffell
Date: Tue Aug 25 13:36:28 2009
New Revision: 7076

URL: http://svn.asterisk.org/svn-view/dahdi?view=rev&rev=7076
Log:
wctdm24xxp: Reduce stack usage of wctdm_locate_modules.

Modified:
    linux/team/sruffell/dahdi-linux-stackreduction/drivers/dahdi/wctdm24xxp/base.c

Modified: linux/team/sruffell/dahdi-linux-stackreduction/drivers/dahdi/wctdm24xxp/base.c
URL: http://svn.asterisk.org/svn-view/dahdi/linux/team/sruffell/dahdi-linux-stackreduction/drivers/dahdi/wctdm24xxp/base.c?view=diff&rev=7076&r1=7075&r2=7076
==============================================================================
--- linux/team/sruffell/dahdi-linux-stackreduction/drivers/dahdi/wctdm24xxp/base.c (original)
+++ linux/team/sruffell/dahdi-linux-stackreduction/drivers/dahdi/wctdm24xxp/base.c Tue Aug 25 13:36:28 2009
@@ -340,81 +340,86 @@
 static int config_vpmadt032(struct vpmadt032 *vpm)
 {
 	int res, i;
-	GpakPortConfig_t portconfig = {0};
+	GpakPortConfig_t *portconfig;
 	gpakConfigPortStatus_t configportstatus;
 	GPAK_PortConfigStat_t pstatus;
 	GpakChannelConfig_t chanconfig;
 	GPAK_ChannelConfigStat_t cstatus;
 	GPAK_AlgControlStat_t algstatus;
 
+	portconfig = kzalloc(sizeof(*portconfig), GFP_KERNEL);
+	if (!portconfig)
+		return -ENOMEM;
+
 	/* First Serial Port config */
-	portconfig.SlotsSelect1 = SlotCfgNone;
-	portconfig.FirstBlockNum1 = 0;
-	portconfig.FirstSlotMask1 = 0x0000;
-	portconfig.SecBlockNum1 = 1;
-	portconfig.SecSlotMask1 = 0x0000;
-	portconfig.SerialWordSize1 = SerWordSize8;
-	portconfig.CompandingMode1 = cmpNone;
-	portconfig.TxFrameSyncPolarity1 = FrameSyncActHigh;
-	portconfig.RxFrameSyncPolarity1 = FrameSyncActHigh;
-	portconfig.TxClockPolarity1 = SerClockActHigh;
-	portconfig.RxClockPolarity1 = SerClockActHigh;
-	portconfig.TxDataDelay1 = DataDelay0;
-	portconfig.RxDataDelay1 = DataDelay0;
-	portconfig.DxDelay1 = Disabled;
-	portconfig.ThirdSlotMask1 = 0x0000;
-	portconfig.FouthSlotMask1 = 0x0000;
-	portconfig.FifthSlotMask1 = 0x0000;
-	portconfig.SixthSlotMask1 = 0x0000;
-	portconfig.SevenSlotMask1 = 0x0000;
-	portconfig.EightSlotMask1 = 0x0000;
+	portconfig->SlotsSelect1 = SlotCfgNone;
+	portconfig->FirstBlockNum1 = 0;
+	portconfig->FirstSlotMask1 = 0x0000;
+	portconfig->SecBlockNum1 = 1;
+	portconfig->SecSlotMask1 = 0x0000;
+	portconfig->SerialWordSize1 = SerWordSize8;
+	portconfig->CompandingMode1 = cmpNone;
+	portconfig->TxFrameSyncPolarity1 = FrameSyncActHigh;
+	portconfig->RxFrameSyncPolarity1 = FrameSyncActHigh;
+	portconfig->TxClockPolarity1 = SerClockActHigh;
+	portconfig->RxClockPolarity1 = SerClockActHigh;
+	portconfig->TxDataDelay1 = DataDelay0;
+	portconfig->RxDataDelay1 = DataDelay0;
+	portconfig->DxDelay1 = Disabled;
+	portconfig->ThirdSlotMask1 = 0x0000;
+	portconfig->FouthSlotMask1 = 0x0000;
+	portconfig->FifthSlotMask1 = 0x0000;
+	portconfig->SixthSlotMask1 = 0x0000;
+	portconfig->SevenSlotMask1 = 0x0000;
+	portconfig->EightSlotMask1 = 0x0000;
 
 	/* Second Serial Port config */
-	portconfig.SlotsSelect2 = SlotCfg2Groups;
-	portconfig.FirstBlockNum2 = 0;
-	portconfig.FirstSlotMask2 = 0xffff;
-	portconfig.SecBlockNum2 = 1;
-	portconfig.SecSlotMask2 = 0xffff;
-	portconfig.SerialWordSize2 = SerWordSize8;
-	portconfig.CompandingMode2 = cmpNone;
-	portconfig.TxFrameSyncPolarity2 = FrameSyncActHigh;
-	portconfig.RxFrameSyncPolarity2 = FrameSyncActHigh;
-	portconfig.TxClockPolarity2 = SerClockActHigh;
-	portconfig.RxClockPolarity2 = SerClockActLow;
-	portconfig.TxDataDelay2 = DataDelay0;
-	portconfig.RxDataDelay2 = DataDelay0;
-	portconfig.DxDelay2 = Disabled;
-	portconfig.ThirdSlotMask2 = 0x0000;
-	portconfig.FouthSlotMask2 = 0x0000;
-	portconfig.FifthSlotMask2 = 0x0000;
-	portconfig.SixthSlotMask2 = 0x0000;
-	portconfig.SevenSlotMask2 = 0x0000;
-	portconfig.EightSlotMask2 = 0x0000;
+	portconfig->SlotsSelect2 = SlotCfg2Groups;
+	portconfig->FirstBlockNum2 = 0;
+	portconfig->FirstSlotMask2 = 0xffff;
+	portconfig->SecBlockNum2 = 1;
+	portconfig->SecSlotMask2 = 0xffff;
+	portconfig->SerialWordSize2 = SerWordSize8;
+	portconfig->CompandingMode2 = cmpNone;
+	portconfig->TxFrameSyncPolarity2 = FrameSyncActHigh;
+	portconfig->RxFrameSyncPolarity2 = FrameSyncActHigh;
+	portconfig->TxClockPolarity2 = SerClockActHigh;
+	portconfig->RxClockPolarity2 = SerClockActLow;
+	portconfig->TxDataDelay2 = DataDelay0;
+	portconfig->RxDataDelay2 = DataDelay0;
+	portconfig->DxDelay2 = Disabled;
+	portconfig->ThirdSlotMask2 = 0x0000;
+	portconfig->FouthSlotMask2 = 0x0000;
+	portconfig->FifthSlotMask2 = 0x0000;
+	portconfig->SixthSlotMask2 = 0x0000;
+	portconfig->SevenSlotMask2 = 0x0000;
+	portconfig->EightSlotMask2 = 0x0000;
 
 	/* Third Serial Port Config */
-	portconfig.SlotsSelect3 = SlotCfg2Groups;
-	portconfig.FirstBlockNum3 = 0;
-	portconfig.FirstSlotMask3 = 0xffff;
-	portconfig.SecBlockNum3 = 1;
-	portconfig.SecSlotMask3 = 0xffff;
-	portconfig.SerialWordSize3 = SerWordSize8;
-	portconfig.CompandingMode3 = cmpNone;
-	portconfig.TxFrameSyncPolarity3 = FrameSyncActHigh;
-	portconfig.RxFrameSyncPolarity3 = FrameSyncActHigh;
-	portconfig.TxClockPolarity3 = SerClockActHigh;
-	portconfig.RxClockPolarity3 = SerClockActLow;
-	portconfig.TxDataDelay3 = DataDelay0;
-	portconfig.RxDataDelay3 = DataDelay0;
-	portconfig.DxDelay3 = Disabled;
-	portconfig.ThirdSlotMask3 = 0x0000;
-	portconfig.FouthSlotMask3 = 0x0000;
-	portconfig.FifthSlotMask3 = 0x0000;
-	portconfig.SixthSlotMask3 = 0x0000;
-	portconfig.SevenSlotMask3 = 0x0000;
-	portconfig.EightSlotMask3 = 0x0000;
-
-	if ((configportstatus = gpakConfigurePorts(vpm->dspid, &portconfig, &pstatus))) {
+	portconfig->SlotsSelect3 = SlotCfg2Groups;
+	portconfig->FirstBlockNum3 = 0;
+	portconfig->FirstSlotMask3 = 0xffff;
+	portconfig->SecBlockNum3 = 1;
+	portconfig->SecSlotMask3 = 0xffff;
+	portconfig->SerialWordSize3 = SerWordSize8;
+	portconfig->CompandingMode3 = cmpNone;
+	portconfig->TxFrameSyncPolarity3 = FrameSyncActHigh;
+	portconfig->RxFrameSyncPolarity3 = FrameSyncActHigh;
+	portconfig->TxClockPolarity3 = SerClockActHigh;
+	portconfig->RxClockPolarity3 = SerClockActLow;
+	portconfig->TxDataDelay3 = DataDelay0;
+	portconfig->RxDataDelay3 = DataDelay0;
+	portconfig->DxDelay3 = Disabled;
+	portconfig->ThirdSlotMask3 = 0x0000;
+	portconfig->FouthSlotMask3 = 0x0000;
+	portconfig->FifthSlotMask3 = 0x0000;
+	portconfig->SixthSlotMask3 = 0x0000;
+	portconfig->SevenSlotMask3 = 0x0000;
+	portconfig->EightSlotMask3 = 0x0000;
+
+	if ((configportstatus = gpakConfigurePorts(vpm->dspid, portconfig, &pstatus))) {
 		printk(KERN_NOTICE "Configuration of ports failed (%d)!\n", configportstatus);
+		kfree(portconfig);
 		return -1;
 	} else {
 		if (vpm->options.debug & DEBUG_ECHOCAN)
@@ -423,6 +428,7 @@
 
 	if ((res = gpakPingDsp(vpm->dspid, &vpm->version))) {
 		printk(KERN_NOTICE "Error pinging DSP (%d)\n", res);
+		kfree(portconfig);
 		return -1;
 	}
 
@@ -441,22 +447,26 @@
 				printk(", reason %d", cstatus);
 			}
 			printk("\n");
+			kfree(portconfig);
 			return -1;
 		}
 
 		if ((res = gpakAlgControl(vpm->dspid, i, BypassEcanA, &algstatus))) {
 			printk(KERN_NOTICE "Unable to disable echo can on channel %d (reason %d:%d)\n", i + 1, res, algstatus);
+			kfree(portconfig);
 			return -1;
 		}
 	}
 
 	if ((res = gpakPingDsp(vpm->dspid, &vpm->version))) {
 		printk(KERN_NOTICE "Error pinging DSP (%d)\n", res);
+		kfree(portconfig);
 		return -1;
 	}
 
 	set_bit(VPM150M_ACTIVE, &vpm->control);
 
+	kfree(portconfig);
 	return 0;
 }
 
@@ -3468,77 +3478,6 @@
 	return 0;
 }
 
-static void get_default_portconfig(GpakPortConfig_t *portconfig)
-{
-	memset(portconfig, 0, sizeof(GpakPortConfig_t));
-
-	/* First Serial Port config */
-	portconfig->SlotsSelect1 = SlotCfgNone;
-	portconfig->FirstBlockNum1 = 0;
-	portconfig->FirstSlotMask1 = 0x0000;
-	portconfig->SecBlockNum1 = 1;
-	portconfig->SecSlotMask1 = 0x0000;
-	portconfig->SerialWordSize1 = SerWordSize8;
-	portconfig->CompandingMode1 = cmpNone;
-	portconfig->TxFrameSyncPolarity1 = FrameSyncActHigh;
-	portconfig->RxFrameSyncPolarity1 = FrameSyncActHigh;
-	portconfig->TxClockPolarity1 = SerClockActHigh;
-	portconfig->RxClockPolarity1 = SerClockActHigh;
-	portconfig->TxDataDelay1 = DataDelay0;
-	portconfig->RxDataDelay1 = DataDelay0;
-	portconfig->DxDelay1 = Disabled;
-	portconfig->ThirdSlotMask1 = 0x0000;
-	portconfig->FouthSlotMask1 = 0x0000;
-	portconfig->FifthSlotMask1 = 0x0000;
-	portconfig->SixthSlotMask1 = 0x0000;
-	portconfig->SevenSlotMask1 = 0x0000;
-	portconfig->EightSlotMask1 = 0x0000;
-
-	/* Second Serial Port config */
-	portconfig->SlotsSelect2 = SlotCfg2Groups;
-	portconfig->FirstBlockNum2 = 0;
-	portconfig->FirstSlotMask2 = 0xffff;
-	portconfig->SecBlockNum2 = 1;
-	portconfig->SecSlotMask2 = 0xffff;
-	portconfig->SerialWordSize2 = SerWordSize8;
-	portconfig->CompandingMode2 = cmpNone;
-	portconfig->TxFrameSyncPolarity2 = FrameSyncActHigh;
-	portconfig->RxFrameSyncPolarity2 = FrameSyncActHigh;
-	portconfig->TxClockPolarity2 = SerClockActHigh;
-	portconfig->RxClockPolarity2 = SerClockActLow;
-	portconfig->TxDataDelay2 = DataDelay0;
-	portconfig->RxDataDelay2 = DataDelay0;
-	portconfig->DxDelay2 = Disabled;
-	portconfig->ThirdSlotMask2 = 0x0000;
-	portconfig->FouthSlotMask2 = 0x0000;
-	portconfig->FifthSlotMask2 = 0x0000;
-	portconfig->SixthSlotMask2 = 0x0000;
-	portconfig->SevenSlotMask2 = 0x0000;
-	portconfig->EightSlotMask2 = 0x0000;
-
-	/* Third Serial Port Config */
-	portconfig->SlotsSelect3 = SlotCfg2Groups;
-	portconfig->FirstBlockNum3 = 0;
-	portconfig->FirstSlotMask3 = 0xffff;
-	portconfig->SecBlockNum3 = 1;
-	portconfig->SecSlotMask3 = 0xffff;
-	portconfig->SerialWordSize3 = SerWordSize8;
-	portconfig->CompandingMode3 = cmpNone;
-	portconfig->TxFrameSyncPolarity3 = FrameSyncActHigh;
-	portconfig->RxFrameSyncPolarity3 = FrameSyncActHigh;
-	portconfig->TxClockPolarity3 = SerClockActHigh;
-	portconfig->RxClockPolarity3 = SerClockActLow;
-	portconfig->TxDataDelay3 = DataDelay0;
-	portconfig->RxDataDelay3 = DataDelay0;
-	portconfig->DxDelay3 = Disabled;
-	portconfig->ThirdSlotMask3 = 0x0000;
-	portconfig->FouthSlotMask3 = 0x0000;
-	portconfig->FifthSlotMask3 = 0x0000;
-	portconfig->SixthSlotMask3 = 0x0000;
-	portconfig->SevenSlotMask3 = 0x0000;
-	portconfig->EightSlotMask3 = 0x0000;
-}
-
 static int wctdm_locate_modules(struct wctdm *wc)
 {
 	int x;
@@ -3647,7 +3586,6 @@
 	} else {
 		int res;
 		struct vpmadt032_options options;
-		GpakPortConfig_t portconfig;
 		
 		spin_lock_irqsave(&wc->reglock, flags);
 		for (x = NUM_CARDS; x < NUM_CARDS + NUM_EC; x++)
@@ -3666,7 +3604,6 @@
 		wc->vpmadt032->setchanconfig_from_state = setchanconfig_from_state;
 		wc->vpmadt032->context = wc;
 		wc->vpmadt032->span = &wc->span;
-		get_default_portconfig(&portconfig);
 		res = vpmadt032_init(wc->vpmadt032, wc->vb);
 		/* In case there was an error while we were loading the VPM module. */
 		if (voicebus_current_latency(wc->vb) > startinglatency) {




More information about the svn-commits mailing list