nvbios/pll_limits: parse log2P_min in table versions 20/21/30

--- nvbios/nvbios.c
+++ nvbios/nvbios.c
@@ -1002,8 +1002,8 @@
 						ref_clk = 25000;
 						break;
 					}
-				printf("-- log2P_max [%d](XXX: must be less than 8), log2P_bias [%d], ref_clk %dkHz --\n",
-					bios->data[soff+29], bios->data[soff+30], ref_clk);
+				printf("-- log2P_min [%d], log2P_max [%d](XXX: must be less than 8), log2P_bias [%d], ref_clk %dkHz --\n",
+					bios->data[soff+28], bios->data[soff+29], bios->data[soff+30], ref_clk);
 				printhex(soff, rlen);
 				printf("\n");
 			} else if (ver == 0x30) {
@@ -1044,8 +1044,8 @@
 							break;
 						}

-					printf("-- log2P_max [%d], log2P_bias [%d], ref_clk %dkHz --\n",
-						bios->data[rec_ptr+25], bios->data[rec_ptr+27], ref_clk);
+					printf("-- log2P_min [%d], log2P_max [%d], log2P_UNK [%d], log2P_bias [%d], ref_clk %dkHz --\n",
+						bios->data[rec_ptr+24], bios->data[rec_ptr+25], bios->data[rec_ptr+26], bios->data[rec_ptr+27], ref_clk);
 					printhex(rec_ptr, 32);
 					printf("\n");
 				}


fix voltage table version 0x40 parsing slightly

I've disabled the GPIO map for now since I haven't confirmed this to be true.

--- nvbios/nvbios.c
+++ nvbios/nvbios.c
@@ -1459,9 +1459,8 @@
 		int16_t step_uv = 0;
 		uint32_t volt_uv = 0, volt;
 		uint8_t shift = 0;
-		const int vidtag[] =  { 0x04, 0x05, 0x06, 0x1a, 0x73 };
+		const int vidtag[] =  { 0x04, 0x05, 0x06, 0x1a, 0x73, 0x74, 0x75, 0x76 };
 		int nr_vidtag = sizeof(vidtag) / sizeof(vidtag[0]);
-

 		version = bios->data[start+0];
 		if (version == 0x10 || version == 0x12) {
@@ -1536,9 +1535,64 @@

 				start += entry_length;
 			}
+		} else if (version == 0x40) {
+			int realtag[8];
+			int max_uv_used = le32(start+14);
+
+			printf("-- Maximum voltage %d µV, voltage step %d µV, Maximum voltage to be used %d µV --\n",
+					volt_uv, step_uv, max_uv_used);
+			printf ("-- Voltage range = %u-%u µV, step = %i µV --\n\n",
+				volt_uv, volt_uv + step_uv * mask, step_uv);
+			start += header_length;
+
+			memcpy(realtag, vidtag, sizeof(realtag));
+
+			for (i = 0; i < entry_count; i++) {
+#if 0
+				// Speculation, not confirmed in any way
+				// Nvidia seems to have 8 1-byte entries for v40:
+				// 00 11 22 33 44 58 68 78
+
+				uint8_t bit = bios->data[start] >> 4;
+				uint8_t gpio = bios->data[start] & 0xf;
+
+				if (gpio < 8)
+					realtag[bit] = vidtag[gpio];
+				else
+					realtag[bit] = 0;
+
+				printf("-- bit %u mapped to GPIO tag 0x%x(VID)\n", bit, realtag[bit]);
+#endif
+				printcmd(start, entry_length); printf("\n\n");
+				start += entry_length;
+			}
+
+			for (i = 0; i <= mask; ++i, volt_uv += step_uv) {
+				int j;
+
+				printf("-- Vid %d, voltage %d µV --\n", i, volt_uv);
+				if (i & ~mask) {
+					printf("-- Voltage unused/overridden by voltage mask --\n\n");
+					continue;
+				}
+
+				if (volt_uv > max_uv_used) {
+					printf("-- Voltage unused: higher than limit --\n\n");
+					continue;
+				}
+
+				for (j = 0; j < nr_vidtag; j++) {
+					if ((1 << j) & ~mask)
+						continue;
+					printf("-- GPIO tag 0x%x(VID) data (logic %d) --\n", realtag[j], (!!(i & (1 << j))));
+				}
+				printf("\n");
+			}
 		} else {
 			printf("-- Maximum voltage %d µV, voltage step %d µV, Maximum voltage to be used %d µV --\n",
 					volt_uv, step_uv, le32(start+14));
+//			printf ("-- Voltage range = %u-%u µV, step = %i µV --\n\n",
+//				volt_uv, volt_uv + step_uv * mask, step_uv);
 			start += header_length;

 			for (i = 0; i < entry_count; i++) {
@@ -1551,17 +1605,15 @@
 					if (!(mask & (1 << j))) {
 					/*	printf("-- Voltage unused/overridden by voltage mask --\n");*/
 						continue;
-	 				}
+					}
 					printf("-- GPIO tag 0x%x(VID) data (logic %d) --\n", vidtag[j], (!!(i & (1 << j))));
 				}
-				printcmd(start + (i * entry_length), entry_length); printf("\n");
+				printcmd(start, entry_length); printf("\n");
 				printf("\n");
 				start += entry_length;
 			}
-
-//			printf ("-- Voltage range = %u-%u µV, step = %u µV--\n",
-//				volt_uv, volt_uv + volt_uv * mask, step_uv);
-		}
+		}
+
 		printf("\n");
 	}
 	if (bios->power.therm.offset && (printmask & ENVY_BIOS_PRINT_PERF)) {


ReflectionProbe_Common - infoCB에 range, near , dummy 추가 #13

--- SOCEngine/SOCEngine/ShaderCodes/ReflectionProbe_Common.h
+++ SOCEngine/SOCEngine/ShaderCodes/ReflectionProbe_Common.h
@@ -15,6 +15,10 @@

 	uint	rpInfo_packedNumOfLights;
 	float3	rpInfo_camWorldPos;
+
+	float	rpInfo_range;
+	float	rpInfo_near;
+	float2	dummy;
 };

 SamplerState		defaultSampler			: register( s0 );


Corrected the documentation: the field is named isSticky, not sticky.

--- GrowlApplicationBridge-Carbon.h
+++ GrowlApplicationBridge-Carbon.h
@@ -289,7 +289,7 @@
 	 */
 	unsigned reserved: 31;

-	/*!	@field	sticky
+	/*!	@field	isSticky
 	 *	@abstract	Requests that a notification stay on-screen until dismissed
 	 *	 explicitly.
 	 *	@discussion	When the sticky bit is clear, in most displays,


nvbios/perf: set pcie speed index 3 to speed 2.5 GT/s

--- nvbios/nvbios.c
+++ nvbios/nvbios.c
@@ -1530,16 +1530,12 @@
 				case 0:
 					pcie_gt = 50;
 					break;
+				case 3:
 				case 1:
 					pcie_gt = 25;
 					break;
 				case 2:
 					pcie_gt = 80;
-					break;
-				default:
-					pcie_gt = 00;
-					printf("Unknown PCIe bus speed value %i\n",
-						bios->data[start+11] & 0x3);
 					break;
 				}


fix swap of pointers

fix swap of pointers

git-svn-id: 5648d1bec6962b0a6d1d1b40eba8cf5cdb62da3d@8585 6f19259b-4bc3-4df7-8a09-765794883524

--- ShellPkg/Library/UefiShellCEntryLib/UefiShellCEntryLib.c
+++ ShellPkg/Library/UefiShellCEntryLib/UefiShellCEntryLib.c
@@ -68,8 +68,8 @@
     // use shell 2.0 interface
     //
     ReturnFromMain = ShellAppMain (
-                       EfiShellInterface->Argc,
-                       EfiShellInterface->Argv
+                       EfiShellParametersProtocol->Argc,
+                       EfiShellParametersProtocol->Argv
                        );
   } else {
     //
@@ -87,8 +87,8 @@
       // use shell 1.0 interface
       //
       ReturnFromMain = ShellAppMain (
-                         EfiShellParametersProtocol->Argc,
-                         EfiShellParametersProtocol->Argv
+                         EfiShellInterface->Argc,
+                         EfiShellInterface->Argv
                          );
     } else {
       ASSERT(FALSE);


compile fix

compile fix

git-svn-id: a0a066a1d7ce87c7a04dae20f169ad0cd8bda35d@1371 04231f92-3938-0410-9931-e931ac552b4f

--- virvo/virvo/vvibrclient.h
+++ virvo/virvo/vvibrclient.h
@@ -25,6 +25,7 @@
 #include "vvopengl.h"
 #include "vvremoteclient.h"
 #include "vvpthread.h"
+#include "vvgltools.h"

 #include <vector>


Don't `else' after return.  Simplify control flow.

--- uip/picksbr.c
+++ uip/picksbr.c
@@ -916,11 +916,12 @@
 	if ((i -= tw->tw_wday) > 0)
 	    i -= 7;
     }
-    else
+    else {
 	if (*ap != '-')
 	    return NULL;
-	else			/* -ddd days ago */
-	    i = atoi (ap);	/* we should error check this */
+	/* -ddd days ago */
+	i = atoi (ap);	/* we should error check this */
+    }

     clock += (long) ((60 * 60 * 24) * i);
     return dlocaltime (&clock);


replsbr.c: In parent, free child's argv[] built before fork().

Fixes ccafa1944.

--- uip/replsbr.c
+++ uip/replsbr.c
@@ -476,6 +476,7 @@
 	    if (pidXwait (pid, mhl))
 		done (1);
 	    fseek (out, 0L, SEEK_END);
+            arglist_free(mhl, arglist);
 	    break;
     }
 }


- refactored code before made IPI global

--- l0/EventMgrPrimImp.c
+++ l0/EventMgrPrimImp.c
@@ -422,7 +422,7 @@

 // this is done under protection of the master's lock
 static EBBRC
-lockedreplicateHandler(CObjEBBRootMultiRef root, uintptr_t eventNo,
+lockedReplicateHandler(CObjEBBRootMultiRef root, uintptr_t eventNo,
 		       EventHandlerId handler)
 {
   RepListNode *node;
@@ -440,41 +440,51 @@

 static EBBRC
-EventMgrPrim_registerHandler(void *_self, uintptr_t eventNo,
-			     EventHandlerId handler,
-			     uintptr_t isrc)
-{
-  EventMgrPrimImpRef self = (EventMgrPrimImpRef)_self;
-  EventMgrPrimImpRef master = self->master;
-
+lockedRegisterHandler(EventMgrPrimImpRef master, uintptr_t eventNo,
+		 EventHandlerId handler)
+{
   if ( (eventNo >= MAXEVENTS) || (eventNo<0) ){
     return EBBRC_BADPARAMETER;
   };

-  spin_lock(&master->lock);
   if (master->handlerInfo[eventNo].id != NULL) {
     // for now, if its not null, assume error, should we ever be able
     // to change the handler for an event?
-    spin_unlock(&master->lock);
     return EBBRC_BADPARAMETER;
   };

   // install handler in event table
   master->handlerInfo[eventNo].id = handler;

+  lockedReplicateHandler(master->theRoot, eventNo, handler);
+
+  return 0;
+}
+
+static EBBRC
+EventMgrPrim_registerHandler(void *_self, uintptr_t eventNo,
+			     EventHandlerId handler,
+			     uintptr_t isrc)
+{
+  EventMgrPrimImpRef self = (EventMgrPrimImpRef)_self;
+  EventMgrPrimImpRef master = self->master;
+  EBBRC rc = EBBRC_OK;
+
+  spin_lock(&master->lock);
+  rc = lockedRegisterHandler(self->master, eventNo, handler);
+  if (!EBBRC_SUCCESS(rc)) goto done;
+
   // map vector in pic
   if (lrt_pic_mapvec_all((lrt_pic_src)isrc, eventNo, vfTbl[eventNo])<0) {
-    master->handlerInfo[eventNo].id = NULL;
-    spin_unlock(&master->lock);
-    return EBBRC_BADPARAMETER;
+    // FAILED unmap from all the tables
+    lockedReplicateHandler(self->theRoot, eventNo, NULL);
+    rc = EBBRC_BADPARAMETER;
+    goto done;
   }

-  lockedreplicateHandler(master->theRoot, eventNo, handler);
-
+ done:
   spin_unlock(&master->lock);
-
-
-  return 0;
+  return rc;
 }

 static EBBRC


Removing unused code from vp9_onyx_if.c.

Change-Id: I0462bf1ca1b4e5a1c06259979b4daff949b8a2c6

--- vp9/encoder/vp9_onyx_if.c
+++ vp9/encoder/vp9_onyx_if.c
@@ -80,8 +80,6 @@
 FILE *kf_list;
 FILE *keyfile;
 #endif
-
-void vp9_init_quantizer(VP9_COMP *cpi);

 static INLINE void Scale2Ratio(VPX_SCALING mode, int *hr, int *hs) {
   switch (mode) {
@@ -365,27 +363,6 @@
       seg->update_data = 0;
     }
   }
-}
-
-// DEBUG: Print out the segment id of each MB in the current frame.
-static void print_seg_map(VP9_COMP *cpi) {
-  VP9_COMMON *cm = &cpi->common;
-  int row, col;
-  int map_index = 0;
-  FILE *statsfile = fopen("segmap.stt", "a");
-
-  fprintf(statsfile, "%10d\n", cm->current_video_frame);
-
-  for (row = 0; row < cpi->common.mi_rows; row++) {
-    for (col = 0; col < cpi->common.mi_cols; col++) {
-      fprintf(statsfile, "%10d", cpi->segmentation_map[map_index]);
-      map_index++;
-    }
-    fprintf(statsfile, "\n");
-  }
-  fprintf(statsfile, "\n");
-
-  fclose(statsfile);
 }

 static void update_reference_segmentation_map(VP9_COMP *cpi) {


[svc] Fix "possible loss of data", "division by zero" and
"index 5 out of bounds for type" compiler warings

Change-Id: I414d39198cb02d1b8e2330002ed5fe062aaea95e

--- vpx/src/svc_encodeframe.c
+++ vpx/src/svc_encodeframe.c
@@ -548,15 +548,20 @@

     for (i = 0; i < si->layers; ++i) {
       int pos = i + VPX_SS_MAX_LAYERS - svc_ctx->spatial_layers;
-      alloc_ratio[i] = si->scaling_factor_num[pos] * 1.0 /
-                       si->scaling_factor_den[pos];
-      alloc_ratio[i] *= alloc_ratio[i];
-      total += alloc_ratio[i];
+      if (pos < VPX_SS_MAX_LAYERS && si->scaling_factor_den[pos] > 0) {
+        alloc_ratio[i] = (float)(si->scaling_factor_num[pos] * 1.0 /
+            si->scaling_factor_den[pos]);
+
+        alloc_ratio[i] *= alloc_ratio[i];
+        total += alloc_ratio[i];
+      }
     }

     for (i = 0; i < si->layers; ++i) {
-      enc_cfg->ss_target_bitrate[i] = enc_cfg->rc_target_bitrate *
-          alloc_ratio[i] / total;
+      if (total > 0) {
+        enc_cfg->ss_target_bitrate[i] = (unsigned int)
+            (enc_cfg->rc_target_bitrate * alloc_ratio[i] / total);
+      }
     }
   }


CogVM source as per VMMaker.oscog-eem.1407

Implement the relevant implicitReceiveCacheAt: for the ARM Cogits.
Eliminate compile-time warnings from Newspeak ARM Cogit.

git-svn-id: http://squeakvm.org/svn/squeak/branches/Cog@3399 fa1542d4-bde8-0310-ad64-8ed1123d492a

Former-commit-id: 657da9867f5305237aaa910556912113d133dd18

--- nsspursrc/vm/cogitARMv5.c
+++ nsspursrc/vm/cogitARMv5.c
@@ -1,9 +1,9 @@
 /* Automatically generated by
-	CCodeGenerator VMMaker.oscog-eem.1401 uuid: 036f0933-639a-49dd-8a1d-a03bcdcb0a0a
+	CCodeGenerator VMMaker.oscog-eem.1407 uuid: cc7c9003-2145-44b0-a3bd-937c285968bb
    from
-	StackToRegisterMappingCogit VMMaker.oscog-eem.1401 uuid: 036f0933-639a-49dd-8a1d-a03bcdcb0a0a
+	StackToRegisterMappingCogit VMMaker.oscog-eem.1407 uuid: cc7c9003-2145-44b0-a3bd-937c285968bb
  */
-static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.1401 uuid: 036f0933-639a-49dd-8a1d-a03bcdcb0a0a " __DATE__ ;
+static char __buildInfo[] = "StackToRegisterMappingCogit VMMaker.oscog-eem.1407 uuid: cc7c9003-2145-44b0-a3bd-937c285968bb " __DATE__ ;
 char *__cogitBuildInfo = __buildInfo;

@@ -912,7 +912,8 @@
 static sqInt slotOffsetOfInstVarIndex(sqInt index) NoDbgRegParms;
 static sqInt smallIntegerIsOnlyImmediateType(void);
 static AbstractInstruction * concretizeLiteral(AbstractInstruction * self_in_concretizeLiteral) NoDbgRegParms;
-static sqInt inlineCacheTagAt(AbstractInstruction * self_in_inlineCacheTagAt, sqInt followingAddress) NoDbgRegParms;
+static sqInt implicitReceiveCacheAt(AbstractInstruction * self_in_implicitReceiveCacheAt, sqInt callSiteReturnAddress) NoDbgRegParms;
+static sqInt inlineCacheTagAt(AbstractInstruction * self_in_inlineCacheTagAt, sqInt callSiteReturnAddress) NoDbgRegParms;
 static sqInt isPCDependent(AbstractInstruction * self_in_isPCDependent) NoDbgRegParms;
 static usqInt isSharable(AbstractInstruction * self_in_isSharable) NoDbgRegParms;
 static sqInt literalLoadInstructionBytes(AbstractInstruction * self_in_literalLoadInstructionBytes) NoDbgRegParms;
@@ -8044,7 +8045,7 @@
 		return ceSendFromInLineCacheMiss(cPIC);
 	}
 	cogExtendPICCaseNMethodtagisMNUCase(cPIC, newTargetMethodOrNil, cacheTag, errorSelectorOrNil == SelectorDoesNotUnderstand);
-	executeCogPICfromLinkedSendWithReceiverandCacheTag(cPIC, receiver, inlineCacheTagAt(backEnd, outerReturn));
+	executeCogPICfromLinkedSendWithReceiverandCacheTag(cPIC, receiver, longAt(pcRelativeAddressAt(backEnd, ((usqInt)(outerReturn - 8)))));
 	return null;
 }

@@ -8163,7 +8164,7 @@
 	cacheTag = inlineCacheTagForInstance(receiver);
 	if (((errorSelectorOrNil != null)
 	 && (errorSelectorOrNil != SelectorDoesNotUnderstand))
-	 || (((inlineCacheTagAt(backEnd, outerReturn)) == 0)
+	 || (((longAt(pcRelativeAddressAt(backEnd, ((usqInt)(outerReturn - 8))))) == 0)
 	 || ((newTargetMethodOrNil == null)
 	 || (isYoung(newTargetMethodOrNil))))) {
 		result = patchToOpenPICFornumArgsreceiver((targetMethod->selector), (targetMethod->cmNumArgs), receiver);
@@ -8192,7 +8193,7 @@
 		? rewriteInlineCacheAttagtarget(backEnd, outerReturn, (targetMethod->selector), (((sqInt)pic)) + cmEntryOffset)
 		: rewriteCallAttarget(backEnd, outerReturn, (((sqInt)pic)) + cmEntryOffset));
 	flushICacheFromto(processor, (((usqInt)outerReturn)) - extent, ((usqInt)outerReturn));
-	executeCogPICfromLinkedSendWithReceiverandCacheTag(pic, receiver, inlineCacheTagAt(backEnd, outerReturn));
+	executeCogPICfromLinkedSendWithReceiverandCacheTag(pic, receiver, longAt(pcRelativeAddressAt(backEnd, ((usqInt)(outerReturn - 8)))));
 	return null;
 }

@@ -8251,7 +8252,7 @@
 		mcpc1 = ((char *) (((sqInt)mcpc)));
 		entryPoint1 = callTargetFromReturnAddress(backEnd, ((sqInt)mcpc1));
 		assert(entryPoint1 < methodZoneBase);
-		cacheAddress = ((usqInt)(implicitReceiveCacheAt(backEnd, mcpc1)));
+		cacheAddress = ((usqInt)(longAt(pcRelativeAddressAt(backEnd, ((usqInt)(mcpc1 - 8))))));
 		assert(isInOldSpace(cacheAddress));
 		nsSendCache = ((NSSendCache *) cacheAddress);
 		if (!(asserta(checkValidOopReference((nsSendCache->selector))))) {
@@ -8281,7 +8282,7 @@
 			return 3;
 		}
 		/* begin offsetCacheTagAndCouldBeObjectAt:annotation:into: */
-		cacheTag1 = inlineCacheTagAt(backEnd, ((sqInt)mcpc));
+		cacheTag1 = longAt(pcRelativeAddressAt(backEnd, ((usqInt)((((sqInt)mcpc)) - 8))));

 		/* in-line cache tags are the selectors of sends if sends are unlinked,
 		   the selectors of super sends (entry offset = cmNoCheckEntryOffset),
@@ -8396,7 +8397,7 @@
 		mcpc1 = ((char *) (((sqInt)mcpc)));
 		entryPoint1 = callTargetFromReturnAddress(backEnd, ((sqInt)mcpc1));
 		assert(entryPoint1 < methodZoneBase);
-		cacheAddress = ((usqInt)(implicitReceiveCacheAt(backEnd, mcpc1)));
+		cacheAddress = ((usqInt)(longAt(pcRelativeAddressAt(backEnd, ((usqInt)(mcpc1 - 8))))));
 		assert(isInOldSpace(cacheAddress));
 		nsSendCache = ((NSSendCache *) cacheAddress);
 		if (!(checkValidOopReference((nsSendCache->selector)))) {
@@ -8451,7 +8452,7 @@
 			offset = offset1;

 		}
-		selectorOrCacheTag = inlineCacheTagAt(backEnd, ((sqInt)mcpc));
+		selectorOrCacheTag = longAt(pcRelativeAddressAt(backEnd, ((usqInt)((((sqInt)mcpc)) - 8))));
 		if ((entryPoint > methodZoneBase)
 		 && ((offset != cmNoCheckEntryOffset)
 		 && ((((((CogMethod *) (entryPoint - offset)))->cmType)) != CMOpenPIC))) {
@@ -9848,7 +9849,7 @@
 {
     sqInt classIndex;
     sqInt i;
-    sqInt pc;
+    usqInt pc;

 	pc = (((((usqInt)cPIC)) + firstCPICCaseOffset) + cPICCaseSize) - (jumpLongConditionalByteSize(backEnd));
 	for (i = 2; i <= ((cPIC->cPICNumCases)); i += 1) {
@@ -10824,12 +10825,12 @@
 generateMapAtstart(sqInt addressOrNull, sqInt startAddress)
 {
     unsigned char annotation;
-    usqInt delta;
+    sqInt delta;
     sqInt i;
     AbstractInstruction *instruction;
     sqInt length;
-    usqInt location;
-    usqInt mapEntry;
+    sqInt location;
+    sqInt mapEntry;
     sqInt maxDelta;
     usqInt mcpc;

@@ -11507,7 +11508,7 @@
 		mcpc1 = ((char *) (((sqInt)mcpc)));
 		entryPoint1 = callTargetFromReturnAddress(backEnd, ((sqInt)mcpc1));
 		assert(entryPoint1 < methodZoneBase);
-		cacheAddress = ((usqInt)(implicitReceiveCacheAt(backEnd, mcpc1)));
+		cacheAddress = ((usqInt)(longAt(pcRelativeAddressAt(backEnd, ((usqInt)(mcpc1 - 8))))));
 		assert(isInOldSpace(cacheAddress));
 		nsSendCache = ((NSSendCache *) cacheAddress);
 		if (((nsSendCache->classTag)) != 2) {
@@ -12704,7 +12705,7 @@
     sqInt *sendTable1;
     sqInt tagCouldBeObj;
     sqInt tagCouldBeObj1;
-    sqInt targetMethod;
+    CogMethod * targetMethod;
     CogMethod *targetMethod1;
     sqInt unlinkedRoutine;
     sqInt val;
@@ -12722,7 +12723,7 @@
 		mcpc1 = ((char *) (((sqInt)mcpc)));
 		entryPoint1 = callTargetFromReturnAddress(backEnd, ((sqInt)mcpc1));
 		assert(entryPoint1 < methodZoneBase);
-		cacheAddress = ((usqInt)(implicitReceiveCacheAt(backEnd, mcpc1)));
+		cacheAddress = ((usqInt)(longAt(pcRelativeAddressAt(backEnd, ((usqInt)(mcpc1 - 8))))));
 		assert(isInOldSpace(cacheAddress));
 		nsSendCache = ((NSSendCache *) cacheAddress);
 		entryPoint = (nsSendCache->target);
@@ -12730,7 +12731,7 @@

 			/* Send is linked */

-			targetMethod = entryPoint - cmNoCheckEntryOffset;
+			targetMethod = ((CogMethod *) (entryPoint - cmNoCheckEntryOffset));
 			if (markAndTraceOrFreeCogMethodfirstVisit(targetMethod, (((usqInt)targetMethod)) > (((usqInt)mcpc)))) {
 				/* begin voidNSSendCache: */
 				(nsSendCache->classTag = 2);
@@ -12762,7 +12763,7 @@

 	if (annotation >= IsSendCall) {
 		/* begin offsetCacheTagAndCouldBeObjectAt:annotation:into: */
-		cacheTag1 = inlineCacheTagAt(backEnd, ((sqInt)mcpc));
+		cacheTag1 = longAt(pcRelativeAddressAt(backEnd, ((usqInt)((((sqInt)mcpc)) - 8))));

 		/* in-line cache tags are the selectors of sends if sends are unlinked,
 		   the selectors of super sends (entry offset = cmNoCheckEntryOffset),
@@ -12866,7 +12867,7 @@
 		mcpc1 = ((char *) (((sqInt)mcpc)));
 		entryPoint1 = callTargetFromReturnAddress(backEnd, ((sqInt)mcpc1));
 		assert(entryPoint1 < methodZoneBase);
-		cacheAddress = ((usqInt)(implicitReceiveCacheAt(backEnd, mcpc1)));
+		cacheAddress = ((usqInt)(longAt(pcRelativeAddressAt(backEnd, ((usqInt)(mcpc1 - 8))))));
 		assert(isInOldSpace(cacheAddress));
 		nsSendCache = ((NSSendCache *) cacheAddress);
 		sel = (nsSendCache->selector);
@@ -12893,7 +12894,7 @@

 	if (annotation >= IsSendCall) {
 		/* begin offsetCacheTagAndCouldBeObjectAt:annotation:into: */
-		cacheTag1 = inlineCacheTagAt(backEnd, ((sqInt)mcpc));
+		cacheTag1 = longAt(pcRelativeAddressAt(backEnd, ((usqInt)((((sqInt)mcpc)) - 8))));

 		/* in-line cache tags are the selectors of sends if sends are unlinked,
 		   the selectors of super sends (entry offset = cmNoCheckEntryOffset),
@@ -14046,7 +14047,7 @@
 		mcpc1 = ((char *) (((sqInt)mcpc)));
 		entryPoint1 = callTargetFromReturnAddress(backEnd, ((sqInt)mcpc1));
 		assert(entryPoint1 < methodZoneBase);
-		cacheAddress = ((usqInt)(implicitReceiveCacheAt(backEnd, mcpc1)));
+		cacheAddress = ((usqInt)(longAt(pcRelativeAddressAt(backEnd, ((usqInt)(mcpc1 - 8))))));
 		assert(isInOldSpace(cacheAddress));
 		nsSendCache = ((NSSendCache *) cacheAddress);
 		relocateCallBeforeReturnPCby(backEnd, ((sqInt)mcpc), -delta);
@@ -14176,7 +14177,7 @@
 		/* begin nsSendCacheFromReturnAddress: */
 		entryPoint1 = callTargetFromReturnAddress(backEnd, ((sqInt)mcpc));
 		assert(entryPoint1 < methodZoneBase);
-		cacheAddress = ((usqInt)(implicitReceiveCacheAt(backEnd, mcpc)));
+		cacheAddress = ((usqInt)(longAt(pcRelativeAddressAt(backEnd, ((usqInt)(mcpc - 8))))));
 		assert(isInOldSpace(cacheAddress));
 		nsSendCache = ((NSSendCache *) cacheAddress);
 		oop = (nsSendCache->selector);
@@ -14204,7 +14205,7 @@

 	if (annotation >= IsSendCall) {
 		/* begin offsetCacheTagAndCouldBeObjectAt:annotation:into: */
-		cacheTag1 = inlineCacheTagAt(backEnd, ((sqInt)mcpc));
+		cacheTag1 = longAt(pcRelativeAddressAt(backEnd, ((usqInt)((((sqInt)mcpc)) - 8))));

 		/* in-line cache tags are the selectors of sends if sends are unlinked,
 		   the selectors of super sends (entry offset = cmNoCheckEntryOffset),
@@ -14494,7 +14495,7 @@
 		mcpc1 = ((char *) (((sqInt)mcpc)));
 		entryPoint1 = callTargetFromReturnAddress(backEnd, ((sqInt)mcpc1));
 		assert(entryPoint1 < methodZoneBase);
-		cacheAddress = ((usqInt)(implicitReceiveCacheAt(backEnd, mcpc1)));
+		cacheAddress = ((usqInt)(longAt(pcRelativeAddressAt(backEnd, ((usqInt)(mcpc1 - 8))))));
 		assert(isInOldSpace(cacheAddress));
 		nsSendCache = ((NSSendCache *) cacheAddress);
 		if (((entryPoint = (nsSendCache->target))) != 0) {
@@ -14572,7 +14573,7 @@
 		mcpc1 = ((char *) (((sqInt)mcpc)));
 		entryPoint1 = callTargetFromReturnAddress(backEnd, ((sqInt)mcpc1));
 		assert(entryPoint1 < methodZoneBase);
-		cacheAddress = ((usqInt)(implicitReceiveCacheAt(backEnd, mcpc1)));
+		cacheAddress = ((usqInt)(longAt(pcRelativeAddressAt(backEnd, ((usqInt)(mcpc1 - 8))))));
 		assert(isInOldSpace(cacheAddress));
 		nsSendCache = ((NSSendCache *) cacheAddress);
 		if ((((nsSendCache->classTag)) != 2)
@@ -14617,7 +14618,7 @@
 			if (!(((annotation == IsSuperSend)
 				 || (0))
 				 || (((targetMethod1->cmType)) == CMOpenPIC))) {
-				if (!(isValidClassTag(inlineCacheTagAt(backEnd, ((sqInt)mcpc))))) {
+				if (!(isValidClassTag(longAt(pcRelativeAddressAt(backEnd, ((usqInt)((((sqInt)mcpc)) - 8))))))) {
 					/* begin unlinkSendAt:targetMethod:sendTable: */
 					unlinkedRoutine = sendTable1[((((targetMethod1->cmNumArgs)) < (NumSendTrampolines - 1)) ? ((targetMethod1->cmNumArgs)) : (NumSendTrampolines - 1))];
 					rewriteInlineCacheAttagtarget(backEnd, ((sqInt)mcpc), (targetMethod1->selector), unlinkedRoutine);
@@ -14651,7 +14652,7 @@
 		mcpc1 = ((char *) (((sqInt)mcpc)));
 		entryPoint1 = callTargetFromReturnAddress(backEnd, ((sqInt)mcpc1));
 		assert(entryPoint1 < methodZoneBase);
-		cacheAddress = ((usqInt)(implicitReceiveCacheAt(backEnd, mcpc1)));
+		cacheAddress = ((usqInt)(longAt(pcRelativeAddressAt(backEnd, ((usqInt)(mcpc1 - 8))))));
 		assert(isInOldSpace(cacheAddress));
 		nsSendCache = ((NSSendCache *) cacheAddress);
 		if (((entryPoint = (nsSendCache->target))) != 0) {
@@ -14730,7 +14731,7 @@
 		mcpc1 = ((char *) (((sqInt)mcpc)));
 		entryPoint1 = callTargetFromReturnAddress(backEnd, ((sqInt)mcpc1));
 		assert(entryPoint1 < methodZoneBase);
-		cacheAddress = ((usqInt)(implicitReceiveCacheAt(backEnd, mcpc1)));
+		cacheAddress = ((usqInt)(longAt(pcRelativeAddressAt(backEnd, ((usqInt)(mcpc1 - 8))))));
 		assert(isInOldSpace(cacheAddress));
 		nsSendCache = ((NSSendCache *) cacheAddress);
 		if (((nsSendCache->classTag)) != 2) {
@@ -14804,7 +14805,7 @@
 		mcpc1 = ((char *) (((sqInt)mcpc)));
 		entryPoint1 = callTargetFromReturnAddress(backEnd, ((sqInt)mcpc1));
 		assert(entryPoint1 < methodZoneBase);
-		cacheAddress = ((usqInt)(implicitReceiveCacheAt(backEnd, mcpc1)));
+		cacheAddress = ((usqInt)(longAt(pcRelativeAddressAt(backEnd, ((usqInt)(mcpc1 - 8))))));
 		assert(isInOldSpace(cacheAddress));
 		nsSendCache = ((NSSendCache *) cacheAddress);
 		if (((entryPoint = (nsSendCache->target))) != 0) {
@@ -19775,11 +19776,22 @@
 	return self_in_concretizeLiteral;
 }

+
+/*	Answer the implicit receiver cache for the return address
+	of a call to one of the ceImplicitReceiver... trampolines. */
+
+	/* CogOutOfLineLiteralsARMCompiler>>#implicitReceiveCacheAt: */
+static sqInt
+implicitReceiveCacheAt(AbstractInstruction * self_in_implicitReceiveCacheAt, sqInt callSiteReturnAddress)
+{
+	return longAt(pcRelativeAddressAt(self_in_implicitReceiveCacheAt, ((usqInt)(callSiteReturnAddress - 8))));
+}
+
 	/* CogOutOfLineLiteralsARMCompiler>>#inlineCacheTagAt: */
 static sqInt
-inlineCacheTagAt(AbstractInstruction * self_in_inlineCacheTagAt, sqInt followingAddress)
-{
-	return longAt(pcRelativeAddressAt(self_in_inlineCacheTagAt, followingAddress - 8));
+inlineCacheTagAt(AbstractInstruction * self_in_inlineCacheTagAt, sqInt callSiteReturnAddress)
+{
+	return longAt(pcRelativeAddressAt(self_in_inlineCacheTagAt, ((usqInt)(callSiteReturnAddress - 8))));
 }


add missing <array> include

add missing <array> include

--- mtp/backend/linux/usb/BufferAllocator.h
+++ mtp/backend/linux/usb/BufferAllocator.h
@@ -24,6 +24,8 @@
 #include <mtp/types.h>
 #include <mtp/log.h>
 #include <Exception.h>
+#include <array>
+
 #include <sys/mman.h>
 #include <unistd.h>


unix/modjni: Convert to mp_rom_map_elem_t.

--- unix/modjni.c
+++ unix/modjni.c
@@ -168,9 +168,9 @@
     return call_method(self->cls, NULL, methods, true, n_args, args);
 }

-STATIC const mp_map_elem_t jclass_locals_dict_table[] = {
-//    { MP_OBJ_NEW_QSTR(MP_QSTR_get), (mp_obj_t)&ffivar_get_obj },
-//    { MP_OBJ_NEW_QSTR(MP_QSTR_set), (mp_obj_t)&ffivar_set_obj },
+STATIC const mp_rom_map_elem_t jclass_locals_dict_table[] = {
+//    { MP_ROM_QSTR(MP_QSTR_get), MP_ROM_PTR(&ffivar_get_obj) },
+//    { MP_ROM_QSTR(MP_QSTR_set), MP_ROM_PTR(&ffivar_set_obj) },
 };

 STATIC MP_DEFINE_CONST_DICT(jclass_locals_dict, jclass_locals_dict_table);
@@ -181,7 +181,7 @@
     .print = jclass_print,
     .attr = jclass_attr,
     .call = jclass_call,
-    .locals_dict = (mp_obj_t)&jclass_locals_dict,
+    .locals_dict = (mp_obj_dict_t*)&jclass_locals_dict,
 };

 STATIC mp_obj_t new_jclass(jclass jc) {
@@ -331,7 +331,7 @@
     .attr = jobject_attr,
     .subscr = jobject_subscr,
     .getiter = subscr_getiter,
-//    .locals_dict = (mp_obj_t)&jobject_locals_dict,
+//    .locals_dict = (mp_obj_dict_t*)&jobject_locals_dict,
 };

 STATIC mp_obj_t new_jobject(jobject jo) {
@@ -578,7 +578,7 @@
     .print = jmethod_print,
     .call = jmethod_call,
 //    .attr = jobject_attr,
-//    .locals_dict = (mp_obj_t)&jobject_locals_dict,
+//    .locals_dict = (mp_obj_dict_t*)&jobject_locals_dict,
 };

 #ifdef __ANDROID__
@@ -707,11 +707,11 @@
 }
 MP_DEFINE_CONST_FUN_OBJ_0(mod_jni_env_obj, mod_jni_env);

-STATIC const mp_map_elem_t mp_module_jni_globals_table[] = {
-    { MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_jni) },
-    { MP_OBJ_NEW_QSTR(MP_QSTR_cls), (mp_obj_t)&mod_jni_cls_obj },
-    { MP_OBJ_NEW_QSTR(MP_QSTR_array), (mp_obj_t)&mod_jni_array_obj },
-    { MP_OBJ_NEW_QSTR(MP_QSTR_env), (mp_obj_t)&mod_jni_env_obj },
+STATIC const mp_rom_map_elem_t mp_module_jni_globals_table[] = {
+    { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_jni) },
+    { MP_ROM_QSTR(MP_QSTR_cls), MP_ROM_PTR(&mod_jni_cls_obj) },
+    { MP_ROM_QSTR(MP_QSTR_array), MP_ROM_PTR(&mod_jni_array_obj) },
+    { MP_ROM_QSTR(MP_QSTR_env), MP_ROM_PTR(&mod_jni_env_obj) },
 };

 STATIC MP_DEFINE_CONST_DICT(mp_module_jni_globals, mp_module_jni_globals_table);


Fixed a typo!

Fixed a typo!

--- mcc/PrintLineWithStyles.c
+++ mcc/PrintLineWithStyles.c
@@ -360,8 +360,8 @@
     o_width  = (flow > data->xpos ? 0 : data->xpos - flow);
     maxwidth = data->WrapMode == MUIV_TextEditor_WrapMode_NoWrap ?
               (MIN((_mwidth(data->object) + data->xpos - flow + rp->TxHeight), TextLengthNew(rp, text+x, c_length, data->TabSizePixels))) + 1 :
-                    _mwidth(data->object) - flow;
-
+                    _mwidth(data->object) - flow;
+
     while(c_length > 0)
     {
       LONG p_length = c_length;


ALSA: hda - don't create dysfunctional mixer controls for ca0132

It's possible that these amps are settable somehow, e g through
secret codec verbs, but for now, don't create the controls (as
they won't be working anyway, and cause errors in amixer).

Cc: 4fbacc2fa0ffdbb11bf1ad6925b886ebd08dd15f@kernel.org
BugLink: https://bugs.launchpad.net/bugs/1038651
Signed-off-by: David Henningsson <9fb354e0a5603a0331399c18f4aa5aab2f9d9c5b@canonical.com>
Signed-off-by: Takashi Iwai <4596b3305151c7ee743192a95d394341e3d3b644@suse.de>

--- sound/pci/hda/patch_ca0132.c
+++ sound/pci/hda/patch_ca0132.c
@@ -275,6 +275,10 @@
 	int type = dir ? HDA_INPUT : HDA_OUTPUT;
 	struct snd_kcontrol_new knew =
 		HDA_CODEC_MUTE_MONO(namestr, nid, chan, 0, type);
+	if ((query_amp_caps(codec, nid, type) & AC_AMPCAP_MUTE) == 0) {
+		snd_printdd("Skipping '%s %s Switch' (no mute on node 0x%x)\n", pfx, dirstr[dir], nid);
+		return 0;
+	}
 	sprintf(namestr, "%s %s Switch", pfx, dirstr[dir]);
 	return snd_hda_ctl_add(codec, nid, snd_ctl_new1(&knew, codec));
 }
@@ -286,6 +290,10 @@
 	int type = dir ? HDA_INPUT : HDA_OUTPUT;
 	struct snd_kcontrol_new knew =
 		HDA_CODEC_VOLUME_MONO(namestr, nid, chan, 0, type);
+	if ((query_amp_caps(codec, nid, type) & AC_AMPCAP_NUM_STEPS) == 0) {
+		snd_printdd("Skipping '%s %s Volume' (no amp on node 0x%x)\n", pfx, dirstr[dir], nid);
+		return 0;
+	}
 	sprintf(namestr, "%s %s Volume", pfx, dirstr[dir]);
 	return snd_hda_ctl_add(codec, nid, snd_ctl_new1(&knew, codec));
 }


unix/modjni: py2jvalue: Handle both int and long java types (with TODO for long).

--- unix/modjni.c
+++ unix/modjni.c
@@ -218,8 +218,12 @@
             return false;
         }
     } else if (type == &mp_type_int) {
-        CHECK_TYPE("long");
-        out->j = mp_obj_get_int(arg);
+        if (IMATCH(arg_type, "int") || IMATCH(arg_type, "long")) {
+            // TODO: Java long is 64-bit actually
+            out->j = mp_obj_get_int(arg);
+        } else {
+            return false;
+        }
     } else {
         nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_TypeError, "arg type not supported"));
     }


Fix the PropertyChanged arguments

Fix the PropertyChanged arguments

--- mojito/mojito-online.c
+++ mojito/mojito-online.c
@@ -184,7 +184,8 @@
   proxy = dbus_g_proxy_new_for_name (conn, "org.moblin.connman",
                                      "/", "org.moblin.connman.Manager");

-  dbus_g_proxy_add_signal (proxy, "PropertyChanged", STRING_VARIANT_HASHTABLE, NULL);
+  dbus_g_proxy_add_signal (proxy, "PropertyChanged",
+                           G_TYPE_STRING, G_TYPE_VALUE, NULL);
   dbus_g_proxy_connect_signal (proxy, "PropertyChanged",
                                (GCallback)props_changed, NULL, NULL);
   return TRUE;


Increased size of a string buffer for safety.

svn path=/trunk/; revision=5110

--- drivers/xwin.c
+++ drivers/xwin.c
@@ -1042,7 +1042,7 @@
     XSizeHints hint;
     int x, y;
     U_INT width, height, border, depth;
-    char header[80];
+    char header[1024];

     dbug_enter("InitMain");


poll support multiple fds

poll support multiple fds

--- libgreenify.c
+++ libgreenify.c
@@ -25,187 +25,191 @@
 static int
 set_nonblock(int fd, int *old_flags)
 {
-	*old_flags = fcntl(fd, F_GETFL, 0);
-	if ((*old_flags) & O_NONBLOCK) {
-		return 0;
-	} else {
-		fcntl(fd, F_SETFL, *old_flags | O_NONBLOCK);
-		return 1;
-	}
+    *old_flags = fcntl(fd, F_GETFL, 0);
+    if ((*old_flags) & O_NONBLOCK) {
+        return 0;
+    } else {
+        fcntl(fd, F_SETFL, *old_flags | O_NONBLOCK);
+        return 1;
+    }
 }

 static void
 restore_flags(int fd, int flags)
 {
-	fcntl(fd, F_SETFL, flags);
+    fcntl(fd, F_SETFL, flags);
 }

 void greenify_set_wait_callback(greenify_wait_callback_func_t callback)
 {
-	g_wait_callback = callback;
-}
-
-int callback_multiple_watchers(int* fds, int events, int timeout)
-{
-
+    g_wait_callback = callback;
+}
+
+int callback_multiple_watchers(struct greenify_watcher* watchers, int nfds, int timeout)
+{
+    int retval;
+    assert(g_wait_callback != NULL);
+    retval = g_wait_callback(watchers, nfds, timeout)
+    free(watchers)
+    return retval
 }

 int callback_single_watcher(int fd, int events, int timeout)
 {
-	struct greenify_watcher watchers[1];
-	int retval;
-
-	assert(g_wait_callback != NULL);
-
-	watchers[0].fd = fd;
-	watchers[0].events = events;
-	retval = g_wait_callback(watchers, 1, timeout);
-	return retval;
+    struct greenify_watcher watchers[1];
+    int retval;
+
+    assert(g_wait_callback != NULL);
+
+    watchers[0].fd = fd;
+    watchers[0].events = events;
+    retval = g_wait_callback(watchers, 1, timeout);
+    return retval;
 }

 int
 green_connect(int socket, const struct sockaddr *address, socklen_t address_len)
 {
-	int flags_changed, flags, s_err, retval;
-
-	debug("green_connect, callback=%016"PRIxPTR"\n", (uintptr_t)g_wait_callback);
-
-	if (g_wait_callback == NULL || !set_nonblock(socket, &flags)) {
-		retval = connect(socket, address, address_len);
-		return retval;
-	}
-
-	retval = connect(socket, address, address_len);
-	s_err = errno;
-	if (retval < 0 && (s_err == EWOULDBLOCK || s_err == EALREADY || s_err == EINPROGRESS)) {
-		callback_single_watcher(socket, EVENT_READ, 0);
-		getsockopt(socket, SOL_SOCKET, SO_ERROR, &s_err, &address_len);
-		retval = s_err ? -1 : 0;
-	}
-
-	restore_flags(socket, flags);
-	errno = s_err;
-	return retval;
+    int flags_changed, flags, s_err, retval;
+
+    debug("green_connect, callback=%016"PRIxPTR"\n", (uintptr_t)g_wait_callback);
+
+    if (g_wait_callback == NULL || !set_nonblock(socket, &flags)) {
+        retval = connect(socket, address, address_len);
+        return retval;
+    }
+
+    retval = connect(socket, address, address_len);
+    s_err = errno;
+    if (retval < 0 && (s_err == EWOULDBLOCK || s_err == EALREADY || s_err == EINPROGRESS)) {
+        callback_single_watcher(socket, EVENT_READ, 0);
+        getsockopt(socket, SOL_SOCKET, SO_ERROR, &s_err, &address_len);
+        retval = s_err ? -1 : 0;
+    }
+
+    restore_flags(socket, flags);
+    errno = s_err;
+    return retval;
 }

 ssize_t
 green_read(int fildes, void *buf, size_t nbyte)
 {
-	int flags_changed, flags, s_err;
-	ssize_t retval;
-
-	debug("green_read\n");
-
-	if (g_wait_callback == NULL || !set_nonblock(fildes, &flags))
-		return read(fildes, buf, nbyte);
-
-	do {
-		retval = read(fildes, buf, nbyte);
-		s_err = errno;
-	} while(retval < 0 && (s_err == EWOULDBLOCK || s_err == EAGAIN)
-			&& !(retval = callback_single_watcher(fildes, EVENT_READ, 0)));
-
-	restore_flags(fildes, flags);
-	errno = s_err;
-	return retval;
+    int flags_changed, flags, s_err;
+    ssize_t retval;
+
+    debug("green_read\n");
+
+    if (g_wait_callback == NULL || !set_nonblock(fildes, &flags))
+        return read(fildes, buf, nbyte);
+
+    do {
+        retval = read(fildes, buf, nbyte);
+        s_err = errno;
+    } while(retval < 0 && (s_err == EWOULDBLOCK || s_err == EAGAIN)
+            && !(retval = callback_single_watcher(fildes, EVENT_READ, 0)));
+
+    restore_flags(fildes, flags);
+    errno = s_err;
+    return retval;
 }

 ssize_t
 green_write(int fildes, const void *buf, size_t nbyte)
 {
-	int flags, flags_changed, s_err;
-	ssize_t retval;
+    int flags, flags_changed, s_err;
+    ssize_t retval;

         debug("green_write\n");

-	if (g_wait_callback == NULL || !set_nonblock(fildes, &flags))
-		return write(fildes, buf, nbyte);
-
-	do {
-		retval = write(fildes, buf, nbyte);
-		s_err = errno;
-	} while(retval < 0 && (s_err == EWOULDBLOCK || s_err == EAGAIN)
-			&& !(retval = callback_single_watcher(fildes, EVENT_WRITE, 0)));
-
-	restore_flags(fildes, flags);
-	errno = s_err;
-	return retval;
+    if (g_wait_callback == NULL || !set_nonblock(fildes, &flags))
+        return write(fildes, buf, nbyte);
+
+    do {
+        retval = write(fildes, buf, nbyte);
+        s_err = errno;
+    } while(retval < 0 && (s_err == EWOULDBLOCK || s_err == EAGAIN)
+            && !(retval = callback_single_watcher(fildes, EVENT_WRITE, 0)));
+
+    restore_flags(fildes, flags);
+    errno = s_err;
+    return retval;
 }

 ssize_t
 green_recv(int socket, void *buffer, size_t length, int flags)
 {
-	int sock_flags, sock_flags_changed, s_err;
-	ssize_t retval;
-
-	if (g_wait_callback == NULL || !set_nonblock(socket, &sock_flags))
-		return recv(socket, buffer, length, flags);
-
-	do {
-		retval = recv(socket, buffer, length, flags);
-		s_err = errno;
-	} while(retval < 0 && (s_err == EWOULDBLOCK || s_err == EAGAIN)
-			&& !(retval = callback_single_watcher(socket, EVENT_READ, 0)));
-
-	restore_flags(socket, sock_flags);
-	errno = s_err;
-	return retval;
+    int sock_flags, sock_flags_changed, s_err;
+    ssize_t retval;
+
+    if (g_wait_callback == NULL || !set_nonblock(socket, &sock_flags))
+        return recv(socket, buffer, length, flags);
+
+    do {
+        retval = recv(socket, buffer, length, flags);
+        s_err = errno;
+    } while(retval < 0 && (s_err == EWOULDBLOCK || s_err == EAGAIN)
+            && !(retval = callback_single_watcher(socket, EVENT_READ, 0)));
+
+    restore_flags(socket, sock_flags);
+    errno = s_err;
+    return retval;
 }

 ssize_t
 green_send(int socket, const void *buffer, size_t length, int flags)
 {
-	int sock_flags, sock_flags_changed, s_err;
-	ssize_t retval;
-
-	if (g_wait_callback == NULL || !set_nonblock(socket, &sock_flags))
-		return send(socket, buffer, length, flags);
-
-	do {
-		retval = send(socket, buffer, length, flags);
-		s_err = errno;
-	} while(retval < 0 && (s_err == EWOULDBLOCK || s_err == EAGAIN)
-			&& !(retval = callback_single_watcher(socket, EVENT_WRITE, 0)));
-
-	restore_flags(socket, sock_flags);
-	errno = s_err;
-	return retval;
+    int sock_flags, sock_flags_changed, s_err;
+    ssize_t retval;
+
+    if (g_wait_callback == NULL || !set_nonblock(socket, &sock_flags))
+        return send(socket, buffer, length, flags);
+
+    do {
+        retval = send(socket, buffer, length, flags);
+        s_err = errno;
+    } while(retval < 0 && (s_err == EWOULDBLOCK || s_err == EAGAIN)
+            && !(retval = callback_single_watcher(socket, EVENT_WRITE, 0)));
+
+    restore_flags(socket, sock_flags);
+    errno = s_err;
+    return retval;
 }

 #ifdef HAVE_POLL
 int
 green_poll(struct pollfd *fds, nfds_t nfds, int timeout)
 {
-	int retval;
-	int events = 0;
-	struct pollfd *fd;
-
-	debug("green_poll\n");
-
-	if (g_wait_callback == NULL || timeout == 0)
-		return poll(fds, nfds, timeout);
-
-	if (nfds != 1) {
-		fprintf(stderr, "[greenify] currently only support 1 fd.  May block.\n");
-		return poll(fds, nfds, timeout);
-	}
-
-	fd = &fds[0];
-
-	if (fd->events & ~(POLLIN | POLLPRI | POLLOUT)) {
-		fprintf(stderr, "[greenify] support POLLIN|POLLPRI|POLLOUT only, got 0x%x, may block.\n",
-				fd->events);
-		return poll(fds, nfds, timeout);
-	}
-
-	if (fd->events & POLLIN || fd->events & POLLPRI) {
-		events |= EVENT_READ;
-	}
-	if (fd->events & POLLOUT) {
-		events |= EVENT_WRITE;
-	}
-
-	callback_single_watcher(fd->fd, events, timeout);
-	return poll(fds, nfds, 0);
+    int retval;
+    int events = 0;
+    struct greenify_watcher* watchers;
+    watchers = (struct greenify_watcher*)malloc(sizeof(struct greenify_watcher)*nfds);
+
+    debug("green_poll\n");
+
+    if (g_wait_callback == NULL || timeout == 0)
+        return poll(fds, nfds, timeout);
+
+    for (nfds_t i = 0; i < nfds; i++) {
+        if (fds[i].events & ~(POLLIN | POLLPRI | POLLOUT)) {
+            fprintf(stderr, "[greenify] support POLLIN|POLLPRI|POLLOUT only, got 0x%x, may block.\n",
+                    fds[i].events);
+            return poll(fds, nfds, timeout);
+        }
+
+        watchers[i].fd = fds[i].fd;
+        watchers[i].events = fds[i].events;
+
+        if (fds[i].events & POLLIN || fds[i].events & POLLPRI) {
+            watchers[i].events |= EVENT_READ;
+        }
+
+        if (fds[i].events & POLLOUT) {
+            watchers[i].events |= EVENT_WRITE;
+        }
+    }
+
+    callback_multiple_watchers(watchers, nfds, timeout);
+    return poll(fds, nfds, 0);
 }
 #endif


samples: bluetooth: hci_uart: Improve RX path

Receiver part reworked to not block in interrupt and rely on assumption
that uart_fifo_read is capable of reading incoming data from the HW.

Signed-off-by: Krzysztof Chruscinski <9b6dc988558c51b0405b49b55c8e66862969844b@nordicsemi.no>

--- samples/bluetooth/hci_uart/src/main.c
+++ samples/bluetooth/hci_uart/src/main.c
@@ -42,6 +42,12 @@
 #define H4_ACL 0x02
 #define H4_SCO 0x03
 #define H4_EVT 0x04
+
+/* Receiver states. */
+#define ST_IDLE 0	/* Waiting for packet type. */
+#define ST_HDR 1	/* Receiving packet header. */
+#define ST_PAYLOAD 2	/* Receiving packet payload. */
+#define ST_DISCARD 3	/* Dropping packet. */

 /* Length of a discard/flush buffer.
  * This is sized to align with a BLE HCI packet:
@@ -52,65 +58,129 @@
  */
 #define H4_DISCARD_LEN 33

-static int h4_read(const struct device *uart, uint8_t *buf,
-		   size_t len, size_t min)
-{
-	int total = 0;
-
-	while (len) {
-		int rx;
-
-		rx = uart_fifo_read(uart, buf, len);
-		if (rx == 0) {
-			LOG_DBG("Got zero bytes from UART");
-			if (total < min) {
-				continue;
-			}
-			break;
-		}
-
-		LOG_DBG("read %d remaining %d", rx, len - rx);
-		len -= rx;
-		total += rx;
-		buf += rx;
-	}
-
-	return total;
-}
-
-static size_t h4_discard(const struct device *uart, size_t len)
-{
-	uint8_t buf[H4_DISCARD_LEN];
-
-	return uart_fifo_read(uart, buf, MIN(len, sizeof(buf)));
-}
-
-static void h4_cmd_recv(struct net_buf *buf, int *remaining)
-{
-	struct bt_hci_cmd_hdr hdr;
-
-	/* We can ignore the return value since we pass len == min */
-	h4_read(hci_uart_dev, (void *)&hdr, sizeof(hdr), sizeof(hdr));
-
-	*remaining = hdr.param_len;
-
-	net_buf_add_mem(buf, &hdr, sizeof(hdr));
-
-	LOG_DBG("len %u", hdr.param_len);
-}
-
-static void h4_acl_recv(struct net_buf *buf, int *remaining)
-{
-	struct bt_hci_acl_hdr hdr;
-
-	/* We can ignore the return value since we pass len == min */
-	h4_read(hci_uart_dev, (void *)&hdr, sizeof(hdr), sizeof(hdr));
-
-	net_buf_add_mem(buf, &hdr, sizeof(hdr));
-
-	*remaining = sys_le16_to_cpu(hdr.len);
-
-	LOG_DBG("len %u", *remaining);
+static int h4_read(const struct device *uart, uint8_t *buf, size_t len)
+{
+	int rx = uart_fifo_read(uart, buf, len);
+
+	LOG_DBG("read %d req %d", rx, len);
+
+	return rx;
+}
+
+static bool valid_type(uint8_t type)
+{
+	return (type == H4_CMD) | (type == H4_ACL);
+}
+
+/* Function assumes that type is validated and only CMD or ACL will be used. */
+static uint32_t get_len(const uint8_t *hdr_buf, uint8_t type)
+{
+	return (type == BT_BUF_CMD) ?
+		((const struct bt_hci_cmd_hdr *)hdr_buf)->param_len :
+		sys_le16_to_cpu(((const struct bt_hci_acl_hdr *)hdr_buf)->len);
+}
+
+/* Function assumes that type is validated and only CMD or ACL will be used. */
+static int hdr_len(uint8_t type)
+{
+	return (type == H4_CMD) ?
+		sizeof(struct bt_hci_cmd_hdr) : sizeof(struct bt_hci_acl_hdr);
+}
+
+static void rx_isr(void)
+{
+	static struct net_buf *buf;
+	static int remaining;
+	static uint8_t state;
+	static uint8_t type;
+	static uint8_t hdr_buf[MAX(sizeof(struct bt_hci_cmd_hdr),
+			sizeof(struct bt_hci_acl_hdr))];
+	int read;
+
+	do {
+		switch (state) {
+		case ST_IDLE:
+			/* Get packet type */
+			read = h4_read(hci_uart_dev, &type, sizeof(type));
+			/* since we read in loop until no data is in the fifo,
+			 * it is possible that read = 0.
+			 */
+			if (read) {
+				if (valid_type(type)) {
+					/* Get expected header size and switch
+					 * to receiving header.
+					 */
+					remaining = hdr_len(type);
+					state = ST_HDR;
+				} else {
+					LOG_WRN("Unknown header %d", type);
+				}
+			}
+			break;
+		case ST_HDR:
+			read = h4_read(hci_uart_dev,
+				       &hdr_buf[hdr_len(type) - remaining],
+				       remaining);
+			remaining -= read;
+			if (remaining == 0) {
+				/* Header received. Allocate buffer and get
+				 * payload length. If allocation fails leave
+				 * interrupt. On failed allocation state machine
+				 * is reset.
+				 */
+				buf = bt_buf_get_tx(BT_BUF_H4, K_NO_WAIT,
+						    &type, sizeof(type));
+				if (!buf) {
+					state = ST_IDLE;
+					return;
+				}
+
+				remaining = get_len(hdr_buf, type);
+
+				net_buf_add_mem(buf, hdr_buf, hdr_len(type));
+				if (remaining > net_buf_tailroom(buf)) {
+					LOG_ERR("Not enough space in buffer");
+					net_buf_unref(buf);
+					state = ST_DISCARD;
+				} else {
+					state = ST_PAYLOAD;
+				}
+
+			}
+			break;
+		case ST_PAYLOAD:
+			read = h4_read(hci_uart_dev, net_buf_tail(buf),
+				       remaining);
+			buf->len += read;
+			remaining -= read;
+			if (remaining == 0) {
+				/* Packet received */
+				LOG_DBG("putting RX packet in queue.");
+				net_buf_put(&tx_queue, buf);
+				state = ST_IDLE;
+			}
+			break;
+		case ST_DISCARD:
+		{
+			uint8_t discard[H4_DISCARD_LEN];
+			size_t to_read = MIN(remaining, sizeof(discard));
+
+			read = h4_read(hci_uart_dev, discard, to_read);
+			remaining -= read;
+			if (remaining == 0) {
+				state = ST_IDLE;
+			}
+
+			break;
+
+		}
+		default:
+			read = 0;
+			__ASSERT_NO_MSG(0);
+			break;
+
+		}
+	} while (read);
 }

 static void tx_isr(void)
@@ -136,83 +206,20 @@

 static void bt_uart_isr(const struct device *unused, void *user_data)
 {
-	static struct net_buf *buf;
-	static int remaining;
-
 	ARG_UNUSED(unused);
 	ARG_UNUSED(user_data);

-	while (uart_irq_update(hci_uart_dev) &&
-	       uart_irq_is_pending(hci_uart_dev)) {
-		int read;
-
-		if (uart_irq_tx_ready(hci_uart_dev)) {
-			tx_isr();
-		} else if (!uart_irq_rx_ready(hci_uart_dev)) {
-			/* Only the UART TX and RX path are interrupt-enabled */
-			LOG_DBG("spurious interrupt");
-			break;
-		}
-
-		/* Beginning of a new packet */
-		if (!remaining) {
-			uint8_t type;
-
-			/* Get packet type */
-			read = h4_read(hci_uart_dev, &type, sizeof(type), 0);
-			if (read != sizeof(type)) {
-				LOG_WRN("Unable to read H4 packet type");
-				continue;
-			}
-
-			buf = bt_buf_get_tx(BT_BUF_H4, K_NO_WAIT, &type,
-					    sizeof(type));
-			if (!buf) {
-				return;
-			}
-
-			switch (bt_buf_get_type(buf)) {
-			case BT_BUF_CMD:
-				h4_cmd_recv(buf, &remaining);
-				break;
-			case BT_BUF_ACL_OUT:
-				h4_acl_recv(buf, &remaining);
-				break;
-			default:
-				LOG_ERR("Unknown H4 type %u", type);
-				return;
-			}
-
-			LOG_DBG("need to get %u bytes", remaining);
-
-			if (remaining > net_buf_tailroom(buf)) {
-				LOG_ERR("Not enough space in buffer");
-				net_buf_unref(buf);
-				buf = NULL;
-			}
-		}
-
-		if (!buf) {
-			read = h4_discard(hci_uart_dev, remaining);
-			LOG_WRN("Discarded %d bytes", read);
-			remaining -= read;
-			continue;
-		}
-
-		read = h4_read(hci_uart_dev, net_buf_tail(buf), remaining, 0);
-
-		buf->len += read;
-		remaining -= read;
-
-		LOG_DBG("received %d bytes", read);
-
-		if (!remaining) {
-			LOG_DBG("full packet received");
-
-			/* Put buffer into TX queue, thread will dequeue */
-			net_buf_put(&tx_queue, buf);
-			buf = NULL;
-		}
+	if (!(uart_irq_rx_ready(hci_uart_dev) ||
+	      uart_irq_tx_ready(hci_uart_dev))) {
+		LOG_DBG("spurious interrupt");
+	}
+
+	if (uart_irq_tx_ready(hci_uart_dev)) {
+		tx_isr();
+	}
+
+	if (uart_irq_rx_ready(hci_uart_dev)) {
+		rx_isr();
 	}
 }


Cleanup Unused Includes

Cleanup Unused Includes

BUG=none
TEST=none

Review URL: http://codereview.chromium.org/173210

git-svn-id: http://src.chromium.org/svn/trunk/src@23993 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

Former-commit-id: 33cd7a6fd4f3dc85dc759b5ff21a7c79be61ccc6


Make code not have a -Warray-parameter warning.

PiperOrigin-RevId: 467842322
Change-Id: Ic262a3f98fa823ef524ac02d08b2f5b8f4adf71d

--- sandboxed_api/sandbox2/syscall_defs.h
+++ sandboxed_api/sandbox2/syscall_defs.h
@@ -30,8 +30,9 @@

   absl::string_view GetName(int syscall) const;

-  std::vector<std::string> GetArgumentsDescription(
-      int syscall, const uint64_t values[syscalls::kMaxArgs], pid_t pid) const;
+  std::vector<std::string> GetArgumentsDescription(int syscall,
+                                                   const uint64_t values[],
+                                                   pid_t pid) const;

  private:
   constexpr SyscallTable() = default;


small improvement

small improvement

--- source/crazygaze/spas/spas.h
+++ source/crazygaze/spas/spas.h
@@ -220,6 +220,7 @@
 	}

 	Code code;
+private:
 	std::shared_ptr<std::string> optionalMsg;
 };


stream: use ETIMEDOUT instead of ETIME.

stream: use ETIMEDOUT instead of ETIME.

--- mongoc/mongoc-stream.c
+++ mongoc/mongoc-stream.c
@@ -274,7 +274,7 @@

       /*
        * Block on poll() until data is available or timeout. Upont timeout,
-       * synthesize an errno of ETIME.
+       * synthesize an errno of ETIMEDOUT.
        */
       errno = 0;
       fds.revents = 0;
@@ -282,7 +282,7 @@
       if (r == -1) {
          return -1;
       } else if (r == 0) {
-         errno = ETIME;
+         errno = ETIMEDOUT;
          return -1;
       }
    }
@@ -407,7 +407,7 @@

       /*
        * Block on poll() until data is available or timeout. Upont timeout,
-       * synthesize an errno of ETIME.
+       * synthesize an errno of ETIMEDOUT.
        */
       errno = 0;
       fds.revents = 0;
@@ -415,7 +415,7 @@
       if (r == -1) {
          return -1;
       } else if (r == 0) {
-         errno = ETIME;
+         errno = ETIMEDOUT;
          return -1;
       }
    }


Improve comments.

Improve comments.

--- example/ex08.c
+++ example/ex08.c
@@ -29,20 +29,21 @@

 int main()
 {
-  M_LET(z, INTEGER_OPLIST)            /* Define & init & clear a variant of integer */
-    M_LET(dict, MY_DICT_OPLIST)       /* Define & init & clear a dictionary of variant */
-    M_LET(array, MY_ARRAY_OPLIST)     /* Define & init & clear an array of dictionary of variant */
+  M_LET(z, INTEGER_OPLIST)            /* Define & init & clear an instance of a variant of integer */
+    M_LET(dict, MY_DICT_OPLIST)       /* Define & init & clear an instance of a dictionary of variant */
+    M_LET(array, MY_ARRAY_OPLIST)     /* Define & init & clear an intance of an array of dictionary of variant */
     M_LET(gmp, M_CLASSIC_OPLIST(mpz)) /* M_LET allows even with non container type */
     {
-      integer_set_n (z, 17LL);        // Set z as the long long 17
+      integer_set_n (z, 17LL);                   // Set z as the long long 17
       dict_my_set_at(dict, STRING_CTE("n1"), z); // Push it in the dictionary
-      mpz_set_str(gmp, "25446846874687468746874687468746874686874", 10);
-      integer_set_z (z, gmp);         // Set z as the mpz_t variable
+      mpz_set_str(gmp, "25446846874687468746874687468746874686874", 10); // Set gmp to a very long integer.
+      integer_set_z (z, gmp);                    // Set z as the mpz_t variable
       dict_my_set_at(dict, STRING_CTE("n2"), z); // Push it in the dictionary
-      array_my_push_back (array, dict); // Push the dictionary in the array
+      array_my_push_back (array, dict);          // Push the dictionary in the array

-      // Iterate over the container
+      // Iterate over the array container
       for M_EACH(item, array, MY_ARRAY_OPLIST) {
+          // Iterate over the dictionary container
           for M_EACH(p, *item, MY_DICT_OPLIST) {
               // Dictionary iterator are pair (key,value)
               if (integer_n_p((*p)->value)) {
@@ -56,5 +57,5 @@
               }
             }
         }
-    } /* All variables are automaticaly cleared beyond this point */
+    } /* All variables are automatically cleared beyond this point */
 }


add code to see the transfer speeds for each thread as implemented in the previous commit

--- example/main.c
+++ example/main.c
@@ -8,6 +8,9 @@

 #ifdef WIN32
 #	include "compat/win32.h"
+#       define PATH_SEP '\\'
+#else
+#       define PATH_SEP '/'
 #endif

 void file_complete(nzb_file_info *file);
@@ -17,12 +20,17 @@
     nzb_fetch *fetcher;
     nzb_file *nzb_file;
     nzb_file_info **files;
-
+    nzb_connections **connections;
+

     int num_files;
+    int num_connections;
     int i;
-
-
+    int ret;
+    float rate;
+    int major;
+    char qualifiers[3][4] = {"B", "KiB", "MiB"};
+
     if (argc < 4)
     {
         printf("Usage: \n");
@@ -35,28 +43,39 @@
     fetcher = nzb_fetch_init();

     nzb_fetch_add_server(fetcher, argv[2], 119,
-                        argv[3], argv[4], 2, 0);
+                        argv[3], argv[4], 3, 0, 0);

     nzb_fetch_connect(fetcher);
-	nzb_fetch_add_callback(fetcher, FILE_COMPLETE, file_complete);
+
+
+
+    nzb_fetch_add_callback(fetcher, FILE_COMPLETE, file_complete);
     nzb_file = nzb_fetch_parse( argv[1]);
-
-    nzb_fetch_storage_path(nzb_file, strdup("tmp\\complete\\"));
-    nzb_fetch_temporary_path(nzb_file, strdup("tmp\\chunks\\"));

-
+    ret = nzb_fetch_storage_path(nzb_file, "tmp/complete/");
+    if (ret != 0)
+    {
+            printf("Incorrect storage path\n");
+            return -1;
+    }
+
+    ret = nzb_fetch_temporary_path(nzb_file, "tmp/chunks/");
+    if (ret != 0)
+    {
+            printf("Incorrect storage path\n");
+            return -1;
+    }
+
     num_files = nzb_fetch_list_files(nzb_file, &files);

-
-
-    for (i = 0; i < 4; i++)
+    for (i = 0; i < num_files; i++)
     {
         nzb_fetch_download(fetcher, files[i]);
-        if (strstr(files[i]->filename, ".rar") != NULL)
-        {
-            printf("nzb_fetch_download(%s)\n", files[i]->filename);
-        }
+        //if (strstr(files[i]->filename, ".rar") != NULL)
+        //{
+        //    printf("nzb_fetch_download(%s)\n", files[i]->filename);
+        //}
     }

@@ -64,16 +83,32 @@
     {
         sleep(1);

-        printf(".\n");
+        num_connections = nzb_fetch_list_connections(fetcher, &connections);
+
+
+        for(i = 0; i < num_connections; i++)
+        {
+            rate = connections[i]->transfer_rate;
+
+            major = 0;
+            while (rate > 1024)
+            {
+                rate /= 1024.0;
+                major++;
+
+            }
+
+            printf("%d. %-20s: %f %s/sec\n", i, connections[i]->address,
+                   rate, qualifiers[major]);
+        }
+        printf("\n");
     }
-
-

     return 0;
 }

-void file_complete(nzb_file_info *file)
-{
-    printf("Completed download of %s (%d bytes)\n", file->filename, 0);
-}
-   +void file_complete(nzb_file_info *file)
+{
+    printf("Completed download of %s (%d bytes)\n", file->filename, 0);
+}
+


Text strings output with glyph_sets are now quoted using backslash
escape characters before special characters - notably quotes themselves.

git-svn-id: 4705079bc6b8aadf675e3696f5c015a6aa4916e3@1661 3c1deb5b-d424-0410-962d-aba41a686d42

--- source/graphics/rendervrml.c
+++ source/graphics/rendervrml.c
@@ -1,7 +1,7 @@
 /*******************************************************************************
 FILE : rendervrml.c

-LAST MODIFIED : 27 November 2001
+LAST MODIFIED : 16 January 2002

 DESCRIPTION :
 Renders gtObjects to VRML file
@@ -14,6 +14,7 @@
 #include "general/list.h"
 #include "general/list_private.h"
 #include "general/object.h"
+#include "general/mystring.h"
 #include "graphics/graphics_object.h"
 #if defined (OLD_CODE)
 #include "graphics/light.h"
@@ -563,7 +564,7 @@
 	struct Graphical_material *material, struct Spectrum *spectrum, float time,
 	struct LIST(VRML_prototype) *vrml_prototype_list)
 /*******************************************************************************
-LAST MODIFIED : 30 August 2001
+LAST MODIFIED : 16 January 2002

 DESCRIPTION :
 Defines an object for the <glyph> and then draws that at <number_of_points>
@@ -571,7 +572,7 @@
 <axis1_list>, <axis2_list> and <axis3_list>.
 ==============================================================================*/
 {
-	char **label;
+	char **label, *label_token;
 	float a1, a2, a3, a_angle, a_magnitude, ax1, ax2, ax3, b1, b2, b3, b_angle,
 		bx1, bx2, bx3, c1, c2, c3, cx1, cx2, cx3, dp, f, f0, f1, j1, j2, j3,
 		c_magnitude, s1, s2, s3, x, y, z;
@@ -1180,7 +1181,19 @@
 					}
 					fprintf(vrml_file,"  geometry Text {\n");
 					fprintf(vrml_file,"    string [\n");
-					fprintf(vrml_file,"      \"%s\"\n",*label);
+					if (label_token = duplicate_string(*label))
+					{
+						make_valid_token(&label_token);
+						if (('\"' == label_token[0]) || ('\'' == label_token[0]))
+						{
+							fprintf(vrml_file,"      %s\n", label_token);
+						}
+						else
+						{
+							fprintf(vrml_file,"      \"%s\"\n", label_token);
+						}
+						DEALLOCATE(label_token);
+					}
 					fprintf(vrml_file,"    ]\n");
 					fprintf(vrml_file,"  } #Text\n");
 					fprintf(vrml_file,"} #Shape\n");


version 0.1.12

version 0.1.12

--- version.h
+++ version.h
@@ -3,7 +3,7 @@

 #define FMPLAYER_VERSION_0 "0"
 #define FMPLAYER_VERSION_1 "1"
-#define FMPLAYER_VERSION_2 "11"
+#define FMPLAYER_VERSION_2 "12"

 #define FMPLAYER_VERSION_STR FMPLAYER_VERSION_0 "." FMPLAYER_VERSION_1 "." FMPLAYER_VERSION_2


Bump version to 1.0.2

Bump version to 1.0.2

--- version.h
+++ version.h
@@ -1,7 +1,7 @@
 // These 3 lines are read by gradle for android builds using regex.
 #define VERSION_MAJOR 1
 #define VERSION_MINOR 0
-#define VERSION_PATCH 1
+#define VERSION_PATCH 2

 // This is just for the C++ compiler.
 #define STRINGIFY(x) STRINGIFY_PRE(x)


xwm: find a seat for all the surface's views

This allows to move or resize a xwayland client by acting on all
its views.

--- xwayland/window-manager.c
+++ xwayland/window-manager.c
@@ -1214,8 +1214,8 @@

 	seat = NULL;
 	wl_list_for_each(s, &wm->server->compositor->seat_list, link) {
-		if (s->pointer != NULL &&
-		    s->pointer->focus == window->view &&
+		if (s->pointer != NULL && s->pointer->focus &&
+		    s->pointer->focus->surface == window->surface &&
 		    s->pointer->button_count > 0 &&
 		    (seat == NULL ||
 		     s->pointer->grab_serial -
@@ -1248,7 +1248,8 @@
 		&wm->server->compositor->shell_interface;

 	if (seat == NULL || seat->pointer->button_count != 1
-	    || !window->view || seat->pointer->focus != window->view)
+	    || !seat->pointer->focus
+	    || seat->pointer->focus->surface != window->surface)
 		return;

 	detail = client_message->data.data32[2];


Updated Windows Version

Updated Windows Version

--- version.h
+++ version.h
@@ -1,11 +1,11 @@
 #ifndef VERSION_H
 #define VERSION_H

-#define VER_FILEVERSION             1,3,0,0
-#define VER_FILEVERSION_STR         "1.3\0"
+#define VER_FILEVERSION             1,4,0,0
+#define VER_FILEVERSION_STR         "1.4\0"

-#define VER_PRODUCTVERSION          1,3,0,0
-#define VER_PRODUCTVERSION_STR      "1.3\0"
+#define VER_PRODUCTVERSION          1,4,0,0
+#define VER_PRODUCTVERSION_STR      "1.4\0"

 #define VER_COMPANYNAME_STR         ""
 #define VER_FILEDESCRIPTION_STR     "A Reversi implementation"


Finished implementing Part B. Fixing bug with reading request message.

--- serverFork.c
+++ serverFork.c
@@ -15,6 +15,7 @@
 #include <string>
 #include <assert.h>
 #include <iostream>
+#include <sstream>
 #include <fstream>
 #include <ctime>
 #include <sys/stat.h>
@@ -28,8 +29,8 @@
 std::string getContentType (const std::string&);
 std::string getCurrentTime();
 std::string getLastModified(const std::string&);
-int writeHTML(const std::string&, int);
-
+std::string writeHTML(const std::string&, int);
+std::string writePic(const std::string&, int);

 void sigchld_handler(int s)
 {
@@ -210,7 +211,7 @@
 */
 std::string getContentType (const std::string& file) {
   FILE * stream;
-  std::string content, temp_content;
+  std::string temp_content, content;
   const int max_size = 256;
   char buffer[max_size];

@@ -223,10 +224,8 @@
     }
         pclose(stream);
   }
-  int s = temp_content.find(";");
-  content = temp_content.substr(0, s);
-
-  //std::cout << "Print Content: " << content << std::endl;
+
+  content = temp_content.substr(0, temp_content.length() - 1);
   return content;
 }

@@ -236,8 +235,9 @@
 */
 std::string getCurrentTime() {
   time_t raw_current_time = time(0);
-
-  return ctime(&raw_current_time);
+  std::string temp(ctime(&raw_current_time));
+  std::string curr_time = temp.substr(0, temp.length() - 1);
+  return curr_time;
 }

 /*
@@ -254,11 +254,49 @@
   }

   time_t raw_modified_time = attributes.st_mtime;   // Get modified time from the attributes
-
-  return ctime(&raw_modified_time);
-}
-
-int writeHTML(const std::string& filepath, int sock) {
+  std::string temp(ctime(&raw_modified_time));
+  std::string lmtime = temp.substr(0, temp.length() - 1);
+  return lmtime;
+}
+
+int writeResponse (const std::string& filepath, int sock) {
+  std::string response, contentLength, lastModified;
+  std::stringstream sstm;
+  std::string responseError = "HTTP/1.1 404 Not Found\r\n\r\n";
+
+  lastModified = getLastModified(filepath);
+  if (lastModified == "") {
+    std::cout << "I'm here" << std::endl;
+    return write(sock, responseError.c_str(), responseError.length());
+  }
+
+  response += "HTTP/1.1 200 OK\r\nConnection: close\r\n";
+  response = response + "Date: " + getCurrentTime() + "\r\n";
+  response = response + + "Last-Modified: " + lastModified + "\r\n";
+  sstm << getContentLength(filepath);
+  contentLength = sstm.str();
+  response = response + "Content-Length: " + contentLength + "\r\n";
+  response = response + "Content-Type: " + getContentType(filepath) + "\r\n\r\n";
+  std::string fileType = getFileType(filepath);
+
+  if (fileType == "html") {
+    response += writeHTML(filepath, sock);
+    return write(sock, response.c_str(), response.length());
+  }
+
+  else if (fileType == "jpeg" || "gif") {
+    response += writePic(filepath, sock);
+    return write(sock, response.c_str(), response.length());
+  }
+
+  else {
+    // File type not supported
+    std::cout << "Not supported" << std::endl;
+    return write(sock, responseError.c_str(), responseError.length());
+  }
+}
+
+std::string writeHTML(const std::string& filepath, int sock) {
   std::string response, line;

   // std::cout << "File: " << filepath << std::endl;
@@ -275,12 +313,10 @@

   request.close();
   }
-
-  std::cout << "Response: " << response << std::endl;
-  return write(sock, response.c_str(), response.length());
-}
-
-int writePic (const std::string& filepath, int sock) {
+  return response;
+}
+
+std::string writePic (const std::string& filepath, int sock) {
   std::string response, line;

   // std::cout << "File: " << filepath << std::endl;
@@ -296,9 +332,7 @@

   request.close();
   }
-
-  // std::cout << "Response: " << response << std::endl;
-  return write(sock, response.c_str(), response.length());
+  return response;
 }

 /******** DOSTUFF() *********************
@@ -308,9 +342,10 @@
  *****************************************/
 void dostuff (int sock)
 {
-   int n;
+   int n, end;
    char buffer[256];
    std::string message, response;
+   std::string end_string = "\r\n\r\n";

    // Reads 255 bytes of the entire input at a time
    while (1) {
@@ -318,19 +353,23 @@
       if (n < 0) error("ERROR reading from socket");
       std::string temp = std::string(buffer);
       message += temp;
-      // std::cout << temp << std::endl;
-
-      if (n != 256) {
+      //std::cout << temp << std::endl;
+
+      end = message.find(end_string);
+      if (end != std::string::npos) {
+        message.erase(end, end_string.size());
         break;
       }
       bzero(buffer, 256);
    }

    std::cout << "Here is the message: " << message << std::endl;
+
    std::string file = parseMessage(message);
    std::string fileType = getFileType(file);

    /* Testing things */
+   /*
    int length = getContentLength(file);

    std::cout << "Print file: " << file << std::endl;
@@ -345,21 +384,9 @@

    std::string modified_time = getLastModified(file);
    std::cout << "Last Modified Time: " << modified_time << std::endl;
+   */
    /******************/

-   if (fileType == "html") {
-      n = writeHTML(file, sock);
-   }
-
-   else if (fileType == "jpeg" || fileType == "gif") {
-    n = writePic(file, sock);
-   }
-
-   else {
-      // File type not supported
-      std::cout << "Not supported" << std::endl;
-      n = write(sock, "HTTP/1.1 404 Not Found", 22);
-   }
-
+   n = writeResponse(file, sock);
    if (n < 0) error("ERROR writing to socket");
 }


agent: Fix D-Bus reply memory leaks

agent: Fix D-Bus reply memory leaks

--- test/agent.c
+++ test/agent.c
@@ -504,6 +504,7 @@
 			fprintf(stderr, "%s\n", err.message);
 			dbus_error_free(&err);
 		}
+		dbus_message_unref(reply);
 		return NULL;
 	}

@@ -562,6 +563,7 @@
 			fprintf(stderr, "%s\n", err.message);
 			dbus_error_free(&err);
 		}
+		dbus_message_unref(reply);
 		return NULL;
 	}


optimization: Fix interpretation of certain "division" operations (issue #5)

The following command (with default -O2 optimization) would incorrectly not match anything:
regex -t0..10000 -nx '((xx)\2*)(?=\1$)'
But with "-O1" added to the command line, it worked properly.

--- matcher-optimization.h
+++ matcher-optimization.h
@@ -323,13 +323,14 @@
                                             return true;
                                         }
                                         Uint64 spaceLeft = target - groupStackTop->position;
-                                        currentMatch = spaceLeft / (multiple * (1 + currentSymbol->minCount));
+                                        currentMatch = spaceLeft / (1 + currentSymbol->minCount);
                                         if (currentMatch < position - groupStackTop->position)
                                         {
                                             nonMatch();
                                             return true;
                                         }
                                         currentMatch -= position - groupStackTop->position;
+                                        currentMatch /= multiple;
                                         if (currentMatch < thisSymbol->minCount)
                                         {
                                             nonMatch();


[AUDIT] clean up audit_receive_msg()

[AUDIT] clean up audit_receive_msg()

generally clean up audit_receive_msg() don't free random memory if
selinux_sid_to_string fails for some reason.  Move generic auditing
to a helper function

Signed-off-by: Eric Paris <b0b36e3cd9ea4e5739ff430a3056fabf2fdb0376@redhat.com>

--- kernel/audit.c
+++ kernel/audit.c
@@ -152,8 +152,10 @@

 static void audit_set_pid(struct audit_buffer *ab, pid_t pid)
 {
-	struct nlmsghdr *nlh = nlmsg_hdr(ab->skb);
-	nlh->nlmsg_pid = pid;
+	if (ab) {
+		struct nlmsghdr *nlh = nlmsg_hdr(ab->skb);
+		nlh->nlmsg_pid = pid;
+	}
 }

 void audit_panic(const char *message)
@@ -511,6 +513,33 @@
 	return err;
 }

+static int audit_log_common_recv_msg(struct audit_buffer **ab, u16 msg_type,
+				     u32 pid, u32 uid, uid_t auid, u32 sid)
+{
+	int rc = 0;
+	char *ctx = NULL;
+	u32 len;
+
+	if (!audit_enabled) {
+		*ab = NULL;
+		return rc;
+	}
+
+	*ab = audit_log_start(NULL, GFP_KERNEL, msg_type);
+	audit_log_format(*ab, "user pid=%d uid=%u auid=%u",
+			 pid, uid, auid);
+	if (sid) {
+		rc = selinux_sid_to_string(sid, &ctx, &len);
+		if (rc)
+			audit_log_format(*ab, " ssid=%u", sid);
+		else
+			audit_log_format(*ab, " subj=%s", ctx);
+		kfree(ctx);
+	}
+
+	return rc;
+}
+
 static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
 {
 	u32			uid, pid, seq, sid;
@@ -521,7 +550,7 @@
 	u16			msg_type = nlh->nlmsg_type;
 	uid_t			loginuid; /* loginuid of sender */
 	struct audit_sig_info   *sig_data;
-	char			*ctx;
+	char			*ctx = NULL;
 	u32			len;

 	err = audit_netlink_ok(skb, msg_type);
@@ -602,36 +631,22 @@
 				if (err)
 					break;
 			}
-			ab = audit_log_start(NULL, GFP_KERNEL, msg_type);
-			if (ab) {
-				audit_log_format(ab,
-						 "user pid=%d uid=%u auid=%u",
-						 pid, uid, loginuid);
-				if (sid) {
-					if (selinux_sid_to_string(
-							sid, &ctx, &len)) {
-						audit_log_format(ab,
-							" ssid=%u", sid);
-						/* Maybe call audit_panic? */
-					} else
-						audit_log_format(ab,
-							" subj=%s", ctx);
-					kfree(ctx);
-				}
-				if (msg_type != AUDIT_USER_TTY)
-					audit_log_format(ab, " msg='%.1024s'",
-							 (char *)data);
-				else {
-					int size;
-
-					audit_log_format(ab, " msg=");
-					size = nlmsg_len(nlh);
-					audit_log_n_untrustedstring(ab, size,
-								    data);
-				}
-				audit_set_pid(ab, pid);
-				audit_log_end(ab);
+			audit_log_common_recv_msg(&ab, msg_type, pid, uid,
+						  loginuid, sid);
+
+			if (msg_type != AUDIT_USER_TTY)
+				audit_log_format(ab, " msg='%.1024s'",
+						 (char *)data);
+			else {
+				int size;
+
+				audit_log_format(ab, " msg=");
+				size = nlmsg_len(nlh);
+				audit_log_n_untrustedstring(ab, size,
+							    data);
 			}
+			audit_set_pid(ab, pid);
+			audit_log_end(ab);
 		}
 		break;
 	case AUDIT_ADD:
@@ -639,27 +654,12 @@
 		if (nlmsg_len(nlh) < sizeof(struct audit_rule))
 			return -EINVAL;
 		if (audit_enabled == AUDIT_LOCKED) {
-			ab = audit_log_start(NULL, GFP_KERNEL,
-					AUDIT_CONFIG_CHANGE);
-			if (ab) {
-				audit_log_format(ab,
-						 "pid=%d uid=%u auid=%u",
-						 pid, uid, loginuid);
-				if (sid) {
-					if (selinux_sid_to_string(
-							sid, &ctx, &len)) {
-						audit_log_format(ab,
-							" ssid=%u", sid);
-						/* Maybe call audit_panic? */
-					} else
-						audit_log_format(ab,
-							" subj=%s", ctx);
-					kfree(ctx);
-				}
-				audit_log_format(ab, " audit_enabled=%d res=0",
-					audit_enabled);
-				audit_log_end(ab);
-			}
+			audit_log_common_recv_msg(&ab, AUDIT_CONFIG_CHANGE, pid,
+						  uid, loginuid, sid);
+
+			audit_log_format(ab, " audit_enabled=%d res=0",
+					 audit_enabled);
+			audit_log_end(ab);
 			return -EPERM;
 		}
 		/* fallthrough */
@@ -673,27 +673,12 @@
 		if (nlmsg_len(nlh) < sizeof(struct audit_rule_data))
 			return -EINVAL;
 		if (audit_enabled == AUDIT_LOCKED) {
-			ab = audit_log_start(NULL, GFP_KERNEL,
-					AUDIT_CONFIG_CHANGE);
-			if (ab) {
-				audit_log_format(ab,
-						 "pid=%d uid=%u auid=%u",
-						 pid, uid, loginuid);
-				if (sid) {
-					if (selinux_sid_to_string(
-							sid, &ctx, &len)) {
-						audit_log_format(ab,
-							" ssid=%u", sid);
-						/* Maybe call audit_panic? */
-					} else
-						audit_log_format(ab,
-							" subj=%s", ctx);
-					kfree(ctx);
-				}
-				audit_log_format(ab, " audit_enabled=%d res=0",
-					audit_enabled);
-				audit_log_end(ab);
-			}
+			audit_log_common_recv_msg(&ab, AUDIT_CONFIG_CHANGE, pid,
+						  uid, loginuid, sid);
+
+			audit_log_format(ab, " audit_enabled=%d res=0",
+					 audit_enabled);
+			audit_log_end(ab);
 			return -EPERM;
 		}
 		/* fallthrough */
@@ -704,19 +689,10 @@
 		break;
 	case AUDIT_TRIM:
 		audit_trim_trees();
-		ab = audit_log_start(NULL, GFP_KERNEL, AUDIT_CONFIG_CHANGE);
-		if (!ab)
-			break;
-		audit_log_format(ab, "auid=%u", loginuid);
-		if (sid) {
-			u32 len;
-			ctx = NULL;
-			if (selinux_sid_to_string(sid, &ctx, &len))
-				audit_log_format(ab, " ssid=%u", sid);
-			else
-				audit_log_format(ab, " subj=%s", ctx);
-			kfree(ctx);
-		}
+
+		audit_log_common_recv_msg(&ab, AUDIT_CONFIG_CHANGE, pid,
+					  uid, loginuid, sid);
+
 		audit_log_format(ab, " op=trim res=1");
 		audit_log_end(ab);
 		break;
@@ -746,22 +722,9 @@
 		/* OK, here comes... */
 		err = audit_tag_tree(old, new);

-		ab = audit_log_start(NULL, GFP_KERNEL, AUDIT_CONFIG_CHANGE);
-		if (!ab) {
-			kfree(old);
-			kfree(new);
-			break;
-		}
-		audit_log_format(ab, "auid=%u", loginuid);
-		if (sid) {
-			u32 len;
-			ctx = NULL;
-			if (selinux_sid_to_string(sid, &ctx, &len))
-				audit_log_format(ab, " ssid=%u", sid);
-			else
-				audit_log_format(ab, " subj=%s", ctx);
-			kfree(ctx);
-		}
+		audit_log_common_recv_msg(&ab, AUDIT_CONFIG_CHANGE, pid,
+					  uid, loginuid, sid);
+
 		audit_log_format(ab, " op=make_equiv old=");
 		audit_log_untrustedstring(ab, old);
 		audit_log_format(ab, " new=");


kernel: mutex: when thread is waiting, request sched

--- kernel/mutex.c
+++ kernel/mutex.c
@@ -122,6 +122,7 @@

 				remove_waiting_thread(mutex, thread);
 				insert_runnable_thread(thread);
+				arch_system_call(SVC_THREAD_SWITCH, NULL, NULL);
 			}
 		}


kernel: mutex: Copy assertions to assertions to syscall handler

Always ensure that the mutex owner is the current thread and that the
count is sane.

Signed-off-by: Leandro Pereira <51c7437a02b34df685e6b4ecb2e9bca23efe2e1a@intel.com>

--- kernel/mutex.c
+++ kernel/mutex.c
@@ -256,5 +256,12 @@
 }

 #ifdef CONFIG_USERSPACE
-_SYSCALL_HANDLER1_SIMPLE_VOID(k_mutex_unlock, K_OBJ_MUTEX, struct k_mutex *);
+_SYSCALL_HANDLER(k_mutex_unlock, mutex)
+{
+	_SYSCALL_OBJ(mutex, K_OBJ_MUTEX);
+	_SYSCALL_VERIFY(((struct k_mutex *)mutex)->lock_count > 0);
+	_SYSCALL_VERIFY(((struct k_mutex *)mutex)->owner == _current);
+	_impl_k_mutex_unlock((struct k_mutex *)mutex);
+	return 0;
+}
 #endif


Typo fixes in cell->*Param() API

Typo fixes in cell->*Param() API

--- kernel/rtlil.h
+++ kernel/rtlil.h
@@ -848,10 +848,10 @@
 	const std::map<RTLIL::IdString, RTLIL::SigSpec> &connections() const;

 	// access cell parameters
-	bool hasParam(RTLIL::IdString portname) const;
-	void unsetParam(RTLIL::IdString portname);
-	void setParam(RTLIL::IdString portname, RTLIL::Const value);
-	const RTLIL::Const &getParam(RTLIL::IdString portname) const;
+	bool hasParam(RTLIL::IdString paramname) const;
+	void unsetParam(RTLIL::IdString paramname);
+	void setParam(RTLIL::IdString paramname, RTLIL::Const value);
+	const RTLIL::Const &getParam(RTLIL::IdString paramname) const;

 	void check();
 	void fixup_parameters(bool set_a_signed = false, bool set_b_signed = false);


[Matrix]: remove dependency to FlashGraph.

--- matrix/matrix_config.h
+++ matrix/matrix_config.h
@@ -23,8 +23,6 @@
 #include "common.h"
 #include "log.h"
 #include "config_map.h"
-
-#include "graph_exception.h"

 namespace fm
 {


sched: Drop all load weight manipulation for RT tasks

Load weights are for the CFS, they do not belong in the RT task. This makes all
RT scheduling classes leave the CFS weights alone.

This fixes a real bug as well: I noticed the following phonomena: a process
elevated to SCHED_RR forks with SCHED_RESET_ON_FORK set, and the child is
indeed SCHED_OTHER, and the niceval is indeed reset to 0. However the weight
inserted by set_load_weight() remains at 0, giving the task insignificat
priority.

With this fix, the weight is reset to what the task had before being elevated
to SCHED_RR/SCHED_FIFO.

Cc: Lennart Poettering <9bb3d23d041c1d0454e62fec951f9aa4dfa2787f@poettering.net>
Cc: 4fbacc2fa0ffdbb11bf1ad6925b886ebd08dd15f@kernel.org
Signed-off-by: Linus Walleij <9cd9d802d23c0ed5e224beabf4ae4a5c478746ef@stericsson.com>
Signed-off-by: Peter Zijlstra <645ca7d3a8d3d4f60557176cd361ea8351edc32b@chello.nl>
LKML-Reference: <1286807811-10568-1-git-send-email-9cd9d802d23c0ed5e224beabf4ae4a5c478746ef@stericsson.com>
Signed-off-by: Ingo Molnar <9dbbbf0688fedc85ad4da37637f1a64b8c718ee2@elte.hu>


sched: Merge cpu_to_core_group functions

Merge and simplify the two cpu_to_core_group variants so that the
resulting function follows the same pattern like cpu_to_phys_group.

Signed-off-by: Heiko Carstens <8dcf0f69152f32f23184f83357a3731522e56b9c@de.ibm.com>
Signed-off-by: Peter Zijlstra <645ca7d3a8d3d4f60557176cd361ea8351edc32b@chello.nl>
LKML-Reference: <5b6d69698aea12696b74186570cd54c5ed9318f7@de.ibm.com>
Signed-off-by: Ingo Molnar <9dbbbf0688fedc85ad4da37637f1a64b8c718ee2@elte.hu>


sched: rt-group: clean up the ifdeffery

sched: rt-group: clean up the ifdeffery

Clean up some of the excessive ifdeffery introduces in the last patch.

Signed-off-by: Peter Zijlstra <645ca7d3a8d3d4f60557176cd361ea8351edc32b@chello.nl>
Signed-off-by: Ingo Molnar <9dbbbf0688fedc85ad4da37637f1a64b8c718ee2@elte.hu>


[PATCH] sys_sched_getaffinity() & hotplug

Change sched_getaffinity() so that it returns a bitmap that indicates the
legally schedulable cpus that a task is allowed to run on.

Without this patch, if CONFIG_HOTPLUG_CPU is enabled, sched_getaffinity()
unconditionally returns (at least on IA64) a mask with NR_CPUS bits set.
This conveys no useful infornmation except for a kernel compile option.

This fixes a breakage we obseved running recent kernels. We have MPI jobs
that use sched_getaffinity() to determine where to place their threads.
Placing them on non-existant cpus is problematic :-)

Signed-off-by: Jack Steiner <9fc09c92f9d4898dd6e5af3e81679b627e939258@sgi.com>
Acked-by: Ingo Molnar <9dbbbf0688fedc85ad4da37637f1a64b8c718ee2@elte.hu>
Cc: Nathan Lynch <e04de97a81056a5c7ecb3646886e1cc27299320d@pobox.com>
Cc: Paul Jackson <223b7f0fa34cb01a774d1d81d388f8c5f831b7fc@sgi.com>
Signed-off-by: Andrew Morton <5c1e68b099950c134891f0b6e179498a8ebe9cf9@osdl.org>
Signed-off-by: Linus Torvalds <69652caca27c8b940640ad396ab71f93cacec34f@osdl.org>


sched, trivial: Initialize root cgroup's sibling list

Even though there are no siblings, the list should be
initialized to not contain bogus values.

Signed-off-by: Glauber Costa <f8b79557d19b40666ebe336545a0b6178af65685@parallels.com>
Acked-by: Paul Menage <a027184a55211cd23e3f3094f1fdc728df5e0500@paulmenage.org>
Acked-by: Paul Turner <56b59ac50e86208fd62726b53c1d890b9a8ff058@google.com>
Signed-off-by: Peter Zijlstra <645ca7d3a8d3d4f60557176cd361ea8351edc32b@chello.nl>
Link: http://lkml.kernel.org/r/1320182360-20043-2-git-send-email-f8b79557d19b40666ebe336545a0b6178af65685@parallels.com
Signed-off-by: Ingo Molnar <9dbbbf0688fedc85ad4da37637f1a64b8c718ee2@elte.hu>


sched: Serialize p->cpus_allowed and ttwu() using p->pi_lock

Currently p->pi_lock already serializes p->sched_class, also put
p->cpus_allowed and try_to_wake_up() under it, this prepares the way
to do the first part of ttwu() without holding rq->lock.

By having p->sched_class and p->cpus_allowed serialized by p->pi_lock,
we prepare the way to call select_task_rq() without holding rq->lock.

Reviewed-by: Frank Rowand <964289eda363137c5cb6fd2bdcdba711c4b6176d@am.sony.com>
Signed-off-by: Peter Zijlstra <645ca7d3a8d3d4f60557176cd361ea8351edc32b@chello.nl>
Cc: Mike Galbraith <3cfa3897b7f55b5396b7a47c83b66325184bc9b4@gmx.de>
Cc: Nick Piggin <24829078df5003d9dd1dd871ca2aeb0b1cf95ef4@kernel.dk>
Cc: Linus Torvalds <69652caca27c8b940640ad396ab71f93cacec34f@linux-foundation.org>
Cc: Andrew Morton <5c1e68b099950c134891f0b6e179498a8ebe9cf9@linux-foundation.org>
Link: fd52d0bda75dd858afbb600044cfdb5d1ce11af2@chello.nl
Signed-off-by: Ingo Molnar <9dbbbf0688fedc85ad4da37637f1a64b8c718ee2@elte.hu>


dvbsubdec: handle and send GAP event

dvbsubdec: handle and send GAP event

... in stead of update newsegment event.

--- gst/dvdsub/gstdvdsubdec.c
+++ gst/dvdsub/gstdvdsubdec.c
@@ -664,16 +664,11 @@
 gst_send_empty_fill (GstDvdSubDec * dec, GstClockTime ts)
 {
   if (dec->next_ts < ts) {
-    GstSegment seg;
-
-    GST_LOG_OBJECT (dec, "Sending newsegment update to advance time to %"
+    GST_LOG_OBJECT (dec, "Sending GAP event update to advance time to %"
         GST_TIME_FORMAT, GST_TIME_ARGS (ts));

-    gst_segment_init (&seg, GST_FORMAT_TIME);
-    seg.start = ts;
-    seg.time = ts;
-
-    gst_pad_push_event (dec->srcpad, gst_event_new_segment (&seg));
+    gst_pad_push_event (dec->srcpad,
+        gst_event_new_gap (dec->next_ts, ts - dec->next_ts));
   }
   dec->next_ts = ts;
 }
@@ -971,31 +966,36 @@
       ret = gst_pad_event_default (pad, parent, event);
       break;
     }
+    case GST_EVENT_GAP:
+    {
+      GstClockTime start, duration;
+
+      gst_event_parse_gap (event, &start, &duration);
+      if (GST_CLOCK_TIME_IS_VALID (start)) {
+        if (GST_CLOCK_TIME_IS_VALID (duration))
+          start += duration;
+        /* we do not expect another buffer until after gap,
+         * so that is our position now */
+        GST_DEBUG_OBJECT (dec, "Got GAP event, advancing time from %"
+            GST_TIME_FORMAT " to %" GST_TIME_FORMAT,
+            GST_TIME_ARGS (dec->next_ts), GST_TIME_ARGS (start));
+
+        gst_dvd_sub_dec_advance_time (dec, start);
+      } else {
+        GST_WARNING_OBJECT (dec, "Got GAP event with invalid position");
+      }
+
+      gst_event_unref (event);
+      ret = TRUE;
+      break;
+    }
     case GST_EVENT_SEGMENT:
     {
       GstSegment seg;

       gst_event_copy_segment (event, &seg);

-#if 0
-      if (update) {
-        /* update ... advance time */
-        if (GST_CLOCK_TIME_IS_VALID (pos)) {
-          GST_DEBUG_OBJECT (dec, "Got segment update, advancing time from %"
-              GST_TIME_FORMAT " to %" GST_TIME_FORMAT,
-              GST_TIME_ARGS (dec->next_ts), GST_TIME_ARGS (pos));
-
-          gst_dvd_sub_dec_advance_time (dec, pos);
-        } else {
-          GST_WARNING_OBJECT (dec, "Got segment update with invalid position");
-        }
-        gst_event_unref (event);
-        ret = TRUE;
-      } else
-#endif
       {
-        /* not just an update ... */
-
 #if 0
         /* Turn off forced highlight display */
         dec->forced_display = 0;


sched: introduce SCHED_FEAT_SYNC_WAKEUPS, turn it off

turn off sync wakeups by default. They are not needed anymore - the
buddy logic should be smart enough to keep the system from
overscheduling.

Signed-off-by: Ingo Molnar <9dbbbf0688fedc85ad4da37637f1a64b8c718ee2@elte.hu>


rtph265depay: Factor out the code that push

This will be needed to implement draining on EOS.

--- gst/rtp/gstrtph265depay.c
+++ gst/rtp/gstrtph265depay.c
@@ -1058,6 +1058,35 @@
 #define NAL_TYPE_IS_KEY(nt) (NAL_TYPE_IS_PARAMETER_SET(nt) || NAL_TYPE_IS_IRAP(nt))

 static void
+gst_rtp_h265_depay_push (GstRtpH265Depay * rtph265depay, GstBuffer * outbuf,
+    gboolean keyframe, GstClockTime timestamp, gboolean marker)
+{
+  /* prepend codec_data */
+  if (rtph265depay->codec_data) {
+    GST_DEBUG_OBJECT (rtph265depay, "prepending codec_data");
+    gst_rtp_copy_video_meta (rtph265depay, rtph265depay->codec_data, outbuf);
+    outbuf = gst_buffer_append (rtph265depay->codec_data, outbuf);
+    rtph265depay->codec_data = NULL;
+    keyframe = TRUE;
+  }
+  outbuf = gst_buffer_make_writable (outbuf);
+
+  gst_rtp_drop_non_video_meta (rtph265depay, outbuf);
+
+  GST_BUFFER_PTS (outbuf) = timestamp;
+
+  if (keyframe)
+    GST_BUFFER_FLAG_UNSET (outbuf, GST_BUFFER_FLAG_DELTA_UNIT);
+  else
+    GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_FLAG_DELTA_UNIT);
+
+  if (marker)
+    GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_FLAG_MARKER);
+
+  gst_rtp_base_depayload_push (GST_RTP_BASE_DEPAYLOAD (rtph265depay), outbuf);
+}
+
+static void
 gst_rtp_h265_depay_handle_nal (GstRtpH265Depay * rtph265depay, GstBuffer * nal,
     GstClockTime in_timestamp, gboolean marker)
 {
@@ -1151,29 +1180,8 @@
   }

   if (outbuf) {
-    /* prepend codec_data */
-    if (rtph265depay->codec_data) {
-      GST_DEBUG_OBJECT (depayload, "prepending codec_data");
-      gst_rtp_copy_video_meta (rtph265depay, rtph265depay->codec_data, outbuf);
-      outbuf = gst_buffer_append (rtph265depay->codec_data, outbuf);
-      rtph265depay->codec_data = NULL;
-      out_keyframe = TRUE;
-    }
-    outbuf = gst_buffer_make_writable (outbuf);
-
-    gst_rtp_drop_non_video_meta (rtph265depay, outbuf);
-
-    GST_BUFFER_PTS (outbuf) = out_timestamp;
-
-    if (out_keyframe)
-      GST_BUFFER_FLAG_UNSET (outbuf, GST_BUFFER_FLAG_DELTA_UNIT);
-    else
-      GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_FLAG_DELTA_UNIT);
-
-    if (marker)
-      GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_FLAG_MARKER);
-
-    gst_rtp_base_depayload_push (depayload, outbuf);
+    gst_rtp_h265_depay_push (rtph265depay, outbuf, out_keyframe, out_timestamp,
+        marker);
   }

   return;


task switch test

task switch test

--- kernel/start.c
+++ kernel/start.c
@@ -1,4 +1,5 @@
 #include <kernel/page_alloc.h>
+#include <kernel/task.h>
 #include <kernel/kernel.h>
 #include <kernel/debug.h>

@@ -19,7 +20,8 @@
 			++total;
 		}

-		debug("There are %d blocks of order %d\n", total, i);
+		if (total)
+			debug("There are %d blocks of order %d\n", total, i);
 	}
 }

@@ -29,11 +31,20 @@
 		zone_stat(&nodes[0].zones[i]);
 }

+static void init(void)
+{
+	panic("Task Switched!!!\n");
+}
+
 void start_kernel(void *bootstrap)
 {
 	setup_arch(bootstrap);
+
+	stat();

-	stat();
+	struct task *task = alloc_task();
+	task_init(task, &init);
+	task_switch(task);

 	while (1);
 }


smptealpha: Correctly detect property changes and update properties

--- gst/smpte/gstsmptealpha.c
+++ gst/smpte/gstsmptealpha.c
@@ -253,18 +253,24 @@
       return TRUE;
   }

-  newmask = gst_mask_factory_new (type, depth, width, height);
-  if (!newmask)
-    goto mask_failed;
-
-  if (smpte->mask)
-    gst_mask_destroy (smpte->mask);
-
-  smpte->mask = newmask;
   smpte->type = type;
   smpte->depth = depth;
   smpte->width = width;
   smpte->height = height;
+
+  /* Not negotiated yet */
+  if (width == 0 || height == 0) {
+    return TRUE;
+  }
+
+  newmask = gst_mask_factory_new (type, depth, width, height);
+  if (!newmask)
+    goto mask_failed;
+
+  if (smpte->mask)
+    gst_mask_destroy (smpte->mask);
+
+  smpte->mask = newmask;

   return TRUE;

@@ -376,6 +382,7 @@
   smpte->type = DEFAULT_PROP_TYPE;
   smpte->border = DEFAULT_PROP_BORDER;
   smpte->depth = DEFAULT_PROP_DEPTH;
+  smpte->position = DEFAULT_PROP_POSITION;
 }

 static void
@@ -557,33 +564,41 @@
   smpte = GST_SMPTE_ALPHA (object);

   switch (prop_id) {
-    case PROP_TYPE:
+    case PROP_TYPE:{
+      gint type;
+
+      type = g_value_get_enum (value);
+
       GST_BASE_TRANSFORM_LOCK (smpte);
       /* also lock with the object lock so that reading the property doesn't
        * have to wait for the transform lock */
       GST_OBJECT_LOCK (smpte);
-      smpte->type = g_value_get_enum (value);
-      GST_OBJECT_UNLOCK (smpte);
-      gst_smpte_alpha_update_mask (smpte, smpte->type, smpte->depth,
-          smpte->width, smpte->height);
+      GST_OBJECT_UNLOCK (smpte);
+      gst_smpte_alpha_update_mask (smpte, type,
+          smpte->depth, smpte->width, smpte->height);
       GST_BASE_TRANSFORM_UNLOCK (smpte);
       break;
+    }
     case PROP_BORDER:
       GST_OBJECT_LOCK (smpte);
       smpte->border = g_value_get_int (value);
       GST_OBJECT_UNLOCK (smpte);
       break;
-    case PROP_DEPTH:
+    case PROP_DEPTH:{
+      gint depth;
+
+      depth = g_value_get_int (value);
+
       GST_BASE_TRANSFORM_LOCK (smpte);
       /* also lock with the object lock so that reading the property doesn't
        * have to wait for the transform lock */
       GST_OBJECT_LOCK (smpte);
-      smpte->depth = g_value_get_int (value);
-      GST_OBJECT_UNLOCK (smpte);
-      gst_smpte_alpha_update_mask (smpte, smpte->type, smpte->depth,
-          smpte->width, smpte->height);
+      GST_OBJECT_UNLOCK (smpte);
+      gst_smpte_alpha_update_mask (smpte, smpte->type,
+          depth, smpte->width, smpte->height);
       GST_BASE_TRANSFORM_UNLOCK (smpte);
       break;
+    }
     case PROP_POSITION:
       GST_OBJECT_LOCK (smpte);
       smpte->position = g_value_get_double (value);


implregex: handle additional GRegex flags

We want to use G_REGEX_OPTIMIZE to enable our JIT so that different
subsystems can use different values here. For example, when porting the
search context to use PCRE2, we will probably want to avoid using the JIT
as some match options would not be available.

--- gtksourceview/implregex.c
+++ gtksourceview/implregex.c
@@ -75,6 +75,9 @@
 	if (flags & G_REGEX_DUPNAMES)
 		ret |= PCRE2_DUPNAMES;

+	if (flags & G_REGEX_MULTILINE)
+		ret |= PCRE2_MULTILINE;
+
 	ret |= PCRE2_UCP;

 	if (~flags & G_REGEX_BSR_ANYCRLF)
@@ -90,6 +93,14 @@

 	if (flags & G_REGEX_MATCH_ANCHORED)
 		ret |= PCRE2_ANCHORED;
+	if (flags & G_REGEX_MATCH_NOTBOL)
+		ret |= PCRE2_NOTBOL;
+	if (flags & G_REGEX_MATCH_NOTEOL)
+		ret |= PCRE2_NOTEOL;
+	if (flags & G_REGEX_MATCH_PARTIAL_HARD)
+		ret |= PCRE2_PARTIAL_HARD;
+	if (flags & G_REGEX_MATCH_NOTEMPTY)
+		ret |= PCRE2_NOTEMPTY;

 	return ret;
 }
@@ -183,7 +194,10 @@
 	}

 	/* Now try to JIT the pattern for faster execution time */
-	regex->has_jit = pcre2_jit_compile (regex->code, PCRE2_JIT_COMPLETE) == 0;
+	if (compile_options & G_REGEX_OPTIMIZE)
+	{
+		regex->has_jit = pcre2_jit_compile (regex->code, PCRE2_JIT_COMPLETE) == 0;
+	}

 #ifdef GTK_SOURCE_PROFILER_ENABLED
 	if (GTK_SOURCE_PROFILER_ACTIVE)
@@ -432,7 +446,6 @@

 	g_return_val_if_fail (regex != NULL, FALSE);
 	g_return_val_if_fail (regex->code != NULL, FALSE);
-	g_return_val_if_fail (match_options == 0, FALSE);
 	g_return_val_if_fail (string != NULL, FALSE);

 	if (string_len < 0)


Fix potential memory leak in EC multiplication

Signed-off-by: Jonas <dfe471be8db3fdab245c5ce0191c462fe51526b7@gmail.com>

--- library/ecp.c
+++ library/ecp.c
@@ -1544,7 +1544,10 @@
             MBEDTLS_MPI_CHK( mbedtls_mpi_shift_r( &l, 1 ) );

         if( count++ > 10 )
-            return( MBEDTLS_ERR_ECP_RANDOM_FAILED );
+        {
+            ret = MBEDTLS_ERR_ECP_RANDOM_FAILED;
+            goto cleanup;
+        }
     }
     while( mbedtls_mpi_cmp_int( &l, 1 ) <= 0 );

@@ -2278,7 +2281,10 @@
             MBEDTLS_MPI_CHK( mbedtls_mpi_shift_r( &l, 1 ) );

         if( count++ > 10 )
-            return( MBEDTLS_ERR_ECP_RANDOM_FAILED );
+        {
+            ret = MBEDTLS_ERR_ECP_RANDOM_FAILED;
+            goto cleanup;
+        }
     }
     while( mbedtls_mpi_cmp_int( &l, 1 ) <= 0 );


Fix ECC hardware double initialization

Fix ECC hardware double initialization

We initialized the ECC hardware before calling
mbedtls_ecp_mul_shortcuts(). This in turn calls
mbedtls_ecp_mul_restartable(), which initializes and frees the hardware
too. This issue has been introduced by recent changes and caused some
accelerators to hang.

We move the initialization after the mbedtle_ecp_mul_shortcuts() calls
to avoid double initialization.

--- library/ecp.c
+++ library/ecp.c
@@ -2393,11 +2393,6 @@

     mbedtls_ecp_point_init( &mP );

-#if defined(MBEDTLS_ECP_INTERNAL_ALT)
-    if( ( is_grp_capable = mbedtls_internal_ecp_grp_capable( grp ) ) )
-        MBEDTLS_MPI_CHK( mbedtls_internal_ecp_init( grp ) );
-#endif /* MBEDTLS_ECP_INTERNAL_ALT */
-
     ECP_RS_ENTER( ma );

 #if defined(MBEDTLS_ECP_RESTARTABLE)
@@ -2425,6 +2420,12 @@
 mul2:
 #endif
     MBEDTLS_MPI_CHK( mbedtls_ecp_mul_shortcuts( grp, pR,  n, Q, rs_ctx ) );
+
+#if defined(MBEDTLS_ECP_INTERNAL_ALT)
+    if( ( is_grp_capable = mbedtls_internal_ecp_grp_capable( grp ) ) )
+        MBEDTLS_MPI_CHK( mbedtls_internal_ecp_init( grp ) );
+#endif /* MBEDTLS_ECP_INTERNAL_ALT */
+
 #if defined(MBEDTLS_ECP_RESTARTABLE)
     if( rs_ctx != NULL && rs_ctx->ma != NULL )
         rs_ctx->ma->state = ecp_rsma_add;


Fix missing error checking in gcm

Fix missing error checking in gcm

--- library/gcm.c
+++ library/gcm.c
@@ -439,11 +439,17 @@
                       const unsigned char *input,
                       unsigned char *output )
 {
+    int ret;
     unsigned char check_tag[16];
     size_t i;
     int diff;

-    gcm_crypt_and_tag( ctx, GCM_DECRYPT, length, iv, iv_len, add, add_len, input, output, tag_len, check_tag );
+    if( ( ret = gcm_crypt_and_tag( ctx, GCM_DECRYPT, length,
+                                   iv, iv_len, add, add_len,
+                                   input, output, tag_len, check_tag ) ) != 0 )
+    {
+        return( ret );
+    }

     /* Check tag in "constant-time" */
     for( diff = 0, i = 0; i < tag_len; i++ )


runtime: fix build for nacl

runtime: fix build for nacl

R=lvd
CC=golang-dev
http://codereview.appspot.com/3391044

--- src/pkg/runtime/nacl/386/closure.c
+++ src/pkg/runtime/nacl/386/closure.c
@@ -38,7 +38,7 @@
 #include "malloc.h"

 // NaCl system call to copy data into text segment.
-extern int32 dyncode_copy(void*, void*, int32);
+extern int32 runtime·dyncode_copy(void*, void*, int32);

 enum{
 	// Allocate chunks of 4096 bytes worth of closures:
@@ -168,8 +168,8 @@
 			// segment and beginning of data.
 			clos.code = (byte*)(((uintptr)etext + 65535) & ~65535);
 			clos.ecode = clos.code;
-			mheap.closure_min = clos.code;
-			mheap.closure_max = rodata;
+			runtime·mheap.closure_min = clos.code;
+			runtime·mheap.closure_max = rodata;
 		}
 		if(clos.ecode+ClosureChunk > rodata) {
 			// Last ditch effort: garbage collect and hope.
@@ -218,7 +218,7 @@

 		e = runtime·dyncode_copy(clos.ecode, clos.buf, ClosureChunk);
 		if(e != 0) {
-			fd = 2;
+			runtime·fd = 2;
 			if(e == -22)
 				runtime·throw("NaCl running with dyncode_copy disabled; export NACLDYNCODE=1 in your environment");
 			runtime·printf("dyncode_copy: error %d\n", e);
@@ -240,7 +240,7 @@
 	d->siz = siz;
 	runtime·mcpy((byte*)(d+1), (byte*)&arg0, siz);
 	*codeptr(p) = d;
-	runtime·addfinalizer(f, finclosure, 0);
+	runtime·addfinalizer(f, runtime·finclosure, 0);
 	runtime·unlock(&clos);

 	*ret = p;


Increasing buffer sizes

Increasing buffer sizes

--- fastq_pair/index_fastq.h
+++ fastq_pair/index_fastq.h
@@ -18,11 +18,11 @@
     struct idloc *id;
 };

-// how long should our lines be
-#define MAXLINELEN 1000
+// how long should our lines be. This is a 64k buffer
+#define MAXLINELEN 65536
 // what is our hash table size. This should probably approach the size
 // of our fastq file
-#define HASHSIZE 20000
+#define HASHSIZE 2000000

 /*


Add more API docs

Add more API docs

--- rest/rest-proxy-call.c
+++ rest/rest-proxy-call.c
@@ -690,6 +690,14 @@
   return res;
 }

+/**
+ * rest_proxy_call_get_payload_length:
+ * @call: The #RestProxyCall
+ *
+ * Get the length of the return payload.
+ *
+ * Returns: the length of the payload in bytes.
+ */
 goffset
 rest_proxy_call_get_payload_length (RestProxyCall *call)
 {
@@ -697,6 +705,15 @@
   return priv->length;
 }

+/**
+ * rest_proxy_call_get_payload:
+ * @call: The #RestProxyCall
+ *
+ * Get the return payload.
+ *
+ * Returns: A pointer to the payload. This is owned by #RestProxyCall and should
+ * not be freed.
+ */
 const gchar *
 rest_proxy_call_get_payload (RestProxyCall *call)
 {


mppa: pktio/eth: split recv function in two

Signed-off-by: Nicolas Morey-Chaisemartin <7188b998d7bb37a035517aa285fa3f5a95344e80@kalray.eu>


Bluetooth: controller: PA/LNA use NRF_P0/P1 define

For PA/LNA implementation use NRF_P0/P1 defines instead of
the deprecated NRF_GPIO to reference GPIO Port 0 registers.

Signed-off-by: Vinayak Kariappa Chettimada <e780c9f87dc729ad454f47292ad82c8652353064@nordicsemi.no>

--- subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio.c
+++ subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio.c
@@ -26,7 +26,7 @@
 #define NRF_GPIO_PA     NRF_P1
 #define NRF_GPIO_PA_PIN ((CONFIG_BT_CTLR_GPIO_PA_PIN) - 32)
 #else
-#define NRF_GPIO_PA     NRF_GPIO
+#define NRF_GPIO_PA     NRF_P0
 #define NRF_GPIO_PA_PIN CONFIG_BT_CTLR_GPIO_PA_PIN
 #endif
 #endif /* CONFIG_BT_CTLR_GPIO_PA_PIN */
@@ -36,7 +36,7 @@
 #define NRF_GPIO_LNA     NRF_P1
 #define NRF_GPIO_LNA_PIN ((CONFIG_BT_CTLR_GPIO_LNA_PIN) - 32)
 #else
-#define NRF_GPIO_LNA     NRF_GPIO
+#define NRF_GPIO_LNA     NRF_P0
 #define NRF_GPIO_LNA_PIN CONFIG_BT_CTLR_GPIO_LNA_PIN
 #endif
 #endif /* CONFIG_BT_CTLR_GPIO_LNA_PIN */


filter_rewrite_tag: fix missing extra argument (CID 304449)

Signed-off-by: Eduardo Silva <81f705dc2ce1a61a2621e0e4b442a9474e1d0c70@treasure-data.com>

--- plugins/filter_rewrite_tag/rewrite_tag.c
+++ plugins/filter_rewrite_tag/rewrite_tag.c
@@ -163,7 +163,7 @@
         rule->ra_tag = flb_ra_create(entry->str, FLB_FALSE);

         if (!rule->ra_tag) {
-            flb_plg_error(ctx->ins, "could not compose tag", entry->str);
+            flb_plg_error(ctx->ins, "could not compose tag: %s", entry->str);
             flb_ra_destroy(rule->ra_key);
             flb_regex_destroy(rule->regex);
             flb_free(rule);


defaultvolume.c: don't check whether the audio device has the volume property we want to alter: in several cases, AudioObjectHasProperty() returns 0 for a short time after the jack has been plugged/unplugged but setting the volume succeeds anyway.

--- RightVolume/defaultvolume.c
+++ RightVolume/defaultvolume.c
@@ -23,15 +23,8 @@
         kAudioDevicePropertyScopeOutput,
         kAudioObjectPropertyElementMaster
     };
-    if (AudioObjectHasProperty(deviceID, &prop))
-    {
-        UInt32 dataSize = sizeof(volume);
-        verify_noerr(AudioObjectSetPropertyData(deviceID, &prop, 0, NULL, dataSize, &volume));
-    }
-    else
-    {
-        fprintf(stderr, "Error: the audio device does not support volume control\n");
-    }
+    UInt32 dataSize = sizeof(volume);
+    AudioObjectSetPropertyData(deviceID, &prop, 0, NULL, dataSize, &volume);
 }

 static OSStatus onDataSourceChanged(AudioObjectID                       inObjectID,


Enable interrupts on odroidc2

Enable interrupts on odroidc2

--- src/platform/hardkernel/odroidc2.c
+++ src/platform/hardkernel/odroidc2.c
@@ -65,7 +65,7 @@
 			92,				 	 -1,				102,				 96
 };

-static int irq[28] = { -1 };
+static int irq[sizeof(map)/sizeof(map[0])];

 static int odroidc2ValidGPIO(int pin) {
 	if(pin >= 0 && pin < (sizeof(map)/sizeof(map[0]))) {
@@ -78,27 +78,20 @@
 	}
 }

-static int odroidc2ISR(int i, enum isr_mode_t mode) {
-	// if(irq[i] == -1) {
-		wiringXLog(LOG_ERR, "Interrupts are not supported on the %s", odroidc2->name[0]);
-		// return -1;
-	// }
-	// return odroidc2->soc->isr(i, mode);
-	return -1;
-}
-
 static int odroidc2Setup(void) {
 	int i = 0;
 	odroidc2->soc->setup();
 	odroidc2->soc->setMap(map);
-	/*
+
 	for(i=0;i<(sizeof(map)/sizeof(map[0]));i++) {
 		if(map[i] != -1) {
 			irq[i] = map[i]+122;
+		} else {
+			irq[i] = -1;
 		}
 	}
 	odroidc2->soc->setIRQ(irq);
-	*/
+
 	return 0;
 }

@@ -116,7 +109,6 @@
 	odroidc2->isr = odroidc2->soc->isr;
 	odroidc2->waitForInterrupt = odroidc2->soc->waitForInterrupt;

-	odroidc2->isr = &odroidc2ISR;
 	odroidc2->selectableFd = odroidc2->soc->selectableFd;
 	odroidc2->gc = odroidc2->soc->gc;