Initial commit.

Initial commit.

--- finddups.c
+++ finddups.c
@@ -0,0 +1,407 @@
+/* finddups - recursively search for duplicate files in one or more specified directories
+ *            Can help deduplication efforts.
+ *
+ * Copyright 2012, Alex Stangl
+ * License: OpenBSD/ISC.  See file LICENSE for full text of license.
+ */
+
+#include <assert.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <ftw.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <syslog.h>
+#include <sys/stat.h>
+
+/*@-exitarg@*/
+
+/* buffer size default value; override when compiling with -DBUFSIZE=... */
+#if !defined(BUFSIZE)
+#define BUFSIZE 1024
+#endif
+
+/* change DEBUG to 1 on next line to enable debug printing */
+#define DEBUG 0
+
+#if DEBUG
+#define DEBUG_PRINT(...) printf(__VA_ARGS__)
+#else
+#define DEBUG_PRINT(...)
+#endif
+
+#define EX_USAGE 64
+
+struct fe {const char *name; struct fe *next; dev_t dev; ino_t inode;};
+struct dupNode {long size; struct fe *files; struct dupNode *next;};
+struct Node {long size,c; struct fe *files; struct Node *left, *right;int color;} *root;
+
+void error_exit(char *errorMsg, const char *parm)
+{
+	char *msg = errorMsg;
+	if (parm) {
+		msg = malloc(strlen(errorMsg) + strlen(parm) + 1);
+		strcpy(msg, errorMsg);
+		strcat(msg, parm);
+	}
+
+	syslog(LOG_USER, msg);
+	if (parm)
+		free(msg);
+
+	exit(1);
+}
+
+static void *Malloc(size_t bytes)
+{
+	void *retval = malloc(bytes);
+	if (retval == 0)
+		exit(2);
+	return retval;
+}
+
+static char *copystr(const char *from)
+{
+	size_t l = strlen(from);
+	char *retval = Malloc((l+1) * sizeof(char));
+	strcpy(retval, from);
+	return retval;
+}
+
+static int isRed(struct Node *n) {
+	return n != NULL && n->color;
+}
+
+static void colorFlip(struct Node *n) {
+	assert(n->color == 0);
+	assert(n->left->color == 1);
+	assert(n->right->color == 1);
+	n->color = 1;
+	n->left->color = n->right->color = 0;
+}
+
+static struct Node *rotateLeft(struct Node *h) {
+	struct Node *x = h->right;
+	h->right = x->left;
+	x->left = h;
+	x->color = h->color;
+	h->color = 1;
+	return x;
+}
+
+static struct Node *rotateRight(struct Node *h) {
+	struct Node *x = h->left;
+	h->left = x->right;
+	x->right = h;
+	x->color = h->color;
+	h->color = 1;
+	return x;
+}
+
+static struct fe *newFileNode(const char *name, const struct stat *st)
+{
+	struct fe *retval = malloc(sizeof (struct fe));
+	retval->name = copystr(name);
+	retval->next = NULL;
+	retval->dev = st->st_dev;
+	retval->inode = st->st_ino;
+	return retval;
+}
+
+static struct fe *copyFileNode(struct fe *old)
+{
+	struct fe *retval = malloc(sizeof (struct fe));
+	retval->name = copystr(old->name);
+	retval->next = NULL;
+	retval->dev = old->dev;
+	retval->inode = old->inode;
+	return retval;
+}
+
+
+/* recursive insert called during traversal
+ * can optimize later by putting *name and *st into globals
+ */
+static struct Node *insertR(struct Node *node, const char *name, const struct stat *st)
+{
+	struct fe *fp;
+	if (!node) {
+		node = malloc(sizeof (struct Node));
+		node->size = st->st_size;
+		node->c = 1;
+		node->left = node->right = NULL;
+		node->files = newFileNode(name, st);
+		node->color = 1;
+	} else if (st->st_size == node->size) {
+		/* traverse file list to see if we have same dev/inode as an existing file (e.g., hard link)
+		 * if so, just return existing node unmodified (no need to add this redundant file)
+		 */
+		for (fp = node->files; fp; fp=fp->next) {
+			if (fp->dev == st->st_dev && fp->inode == st->st_ino)
+				return node;
+		}
+		fp = newFileNode(name, st);
+		fp->next = node->files;
+		node->files = fp;
+	} else {
+		if (isRed(node->left) && isRed(node->right))
+			colorFlip(node);
+
+		if (st->st_size < node->size) {
+			node->left = insertR(node->left, name, st);
+		} else {
+			node->right = insertR(node->right, name, st);
+		}
+
+		if (isRed(node->right) && !isRed(node->left))
+			node = rotateLeft(node);
+
+		if (isRed(node->left) && isRed(node->left->left))
+			node = rotateRight(node);
+	}
+	return node;
+}
+
+/* main entry point for insert, inserting at root */
+static void insert(const char *name, const struct stat *st) {
+	/*
+	DEBUG_PRINT("Inserting %s with size %ld\n", name, st->st_size);
+	*/
+	root = insertR(root, name, st);
+	root->color = 0;
+}
+
+static int visit(const char *name, const struct stat *st, int flag, struct FTW *ftw) {
+	/*
+	DEBUG_PRINT("name = %s, flag = %d, st = %ld\n", name, flag, st);
+	DEBUG_PRINT("visiting %s with size %ld\n", name, st->st_size);
+	*/
+	if (flag == FTW_F)
+		insert(name, st);
+	return 0;
+}
+
+static struct dupNode *addDupNode(int size, struct fe *file, struct dupNode *retval) {
+	struct fe *fp = copyFileNode(file);
+	if (!retval) {
+		retval = malloc(sizeof (struct dupNode));
+		retval->size = size;
+		retval->files = NULL;
+		retval->next = NULL;
+	}
+	fp->next = retval->files;
+	retval->files = fp;
+	return retval;
+}
+
+/* return possibly-null chain of duplicates, based on scanning files in
+ * specified (sub)tree and possibly-null existing chain
+ * should free all nodes, and file entries, except those returned
+ */
+static struct dupNode *chkForDups(struct Node *node, struct dupNode *retval) {
+	int cnt, i, j, fdi, fdj, nri, nrj, *fflags, pr;
+	struct fe *fp, *fi, *fj;
+	struct dupNode *dn = 0, *pn = 0;
+	long *ar, ari, arj, maxToSkip;
+	char *ibuff, *jbuff;
+	off_t lsi, lsj;
+	if (node) {
+
+		/* do left subbranch, then process this node, then right subbranch
+		 * this way chain gets built up so that it starts with largest first
+		 */
+		retval = chkForDups(node->left, retval);
+
+		/* check for duplicates in this current node. First, degenerate cases:
+		 * If less than 2 files, then no dups
+		 * else if size == 0, all considered dups
+		 */
+		/* DEBUG_PRINT("Checking dups of size %ld\n", node->size); */
+		for (cnt=0, fp = node->files; fp != NULL; fp = fp->next, ++cnt);
+		if (cnt < 2) {
+			/* free all file entries */
+			for (fp = node->files; fp != NULL; fp = fp->next)
+				free(fp);
+		} else {
+			/* TODO If general case handles size == 0 case efficiently, get rid
+			 *     of this special case
+			 */
+			if (node->size) {
+				ibuff = Malloc(BUFSIZE);
+				jbuff = Malloc(BUFSIZE);
+				fflags = calloc(cnt, sizeof(int));
+				/* General case, two or more non-empty files.
+				 * allocate N x N array for bookkeeping to keep track of how
+				 * many blocks files A and B have in common
+				 */
+				ar = calloc(cnt * cnt, sizeof(long));
+				for (i = 0, fi = node->files; i < cnt - 1; ++i, fi = fi->next) {
+					/* DEBUG_PRINT("i = %d, file = %s, fflags[i] = %d\n", i, fi->name, fflags[i]); */
+					if (fflags[i])
+						continue;      /* i already output as a dup */
+
+					for (j = i + 1, fj = fi->next; fj; ++j, fj = fj->next) {
+						/* DEBUG_PRINT("j = %d, file = %s, fflags[j] = %d\n", j, fj->name, fflags[j]); */
+						if (fflags[j])
+							continue;  /* j already output as a dup */
+
+						/* Look in past rows of ar at column values for i & j.
+						 * If any rows have diff. values for these, we infer they don't match.
+						 * Otherwise, find max value for these in the prev. rows.
+						 * We know that these many blocks for the 2 files are identical, so
+						 * we can skip those.
+						 */
+						maxToSkip = 0;
+						/* DEBUG_PRINT("i = %d, cnt = %d\n", i, cnt); */
+						for (pr = 0; pr < i; ++pr) {
+							ari = ar[pr*cnt + i];
+							/* DEBUG_PRINT("ar[%d] = %ld, ar[%d] = %ld\n", pr*cnt + i, ari, pr*cnt + j, ar[pr*cnt + j]); */
+							if (ari != ar[pr*cnt + j]) {
+								DEBUG_PRINT("Skipping comparison of %s and %s because of prefix length diff\n",
+										fi->name, fj->name);
+								maxToSkip = -1;
+								break;
+							}
+							if (ari > maxToSkip)
+								maxToSkip = ari;
+						}
+
+						/* DEBUG_PRINT("maxToSkip = %ld\n", maxToSkip); */
+
+						if (maxToSkip < 0)
+							continue;         /* inferred these differ due to prefix length differences */
+
+						/* TODO  optimize open/closing of fi, maybe use a rewind */
+						if ((fdi = open(fi->name, O_RDONLY)) < 0) {
+							printf("Error opening %s\n", fi->name);
+							error_exit("Error opening ", fi->name);
+						}
+
+						/* error_exit("Error opening ", fi->name); */
+						if ((fdj = open(fj->name, O_RDONLY)) < 0)
+							error_exit("Error opening ", fj->name);
+
+						if (maxToSkip > 0) {
+							DEBUG_PRINT("Skipping ahead %ld in %s and %s because of prefix inferences\n",
+									maxToSkip, fi->name, fj->name);
+							lsi = lseek(fdi, maxToSkip, SEEK_SET);
+							lsj = lseek(fdj, maxToSkip, SEEK_SET);
+							if (lsi < 0 || lsj < 0) {
+								free(ibuff);
+								free(jbuff);
+								free(fflags);
+								free(ar);
+								close(fdj);
+								close(fdi);
+								error_exit("Error seeking in ",
+									lsi < 0 ? fi->name : fj->name);
+							}
+						}
+
+						for (;;) {
+							nri = read(fdi, ibuff, BUFSIZE);
+							nrj = read(fdj, jbuff, BUFSIZE);
+							if (nri < 0 || nrj < 0) {
+								free(ibuff);
+								free(jbuff);
+								free(fflags);
+								free(ar);
+								close(fdj);
+								close(fdi);
+								error_exit("Error reading ",
+									nri < 0 ? fi->name : fj->name);
+							}
+
+							/* check for files being diff, by length or by value */
+							if (nri != nrj)
+								break;
+
+							if (memcmp(ibuff, jbuff, nri))
+								break;
+
+							/* custom memcmp so we know where mismatch occurred */
+
+							/* note that we've successfully compared another block */
+							ar[i*cnt + j] += nri;
+							/* DEBUG_PRINT("ar[%d] = %ld\n", i*cnt + j, ar[i*cnt + j]); */
+
+							/* if we've reached end of file, these are dups */
+							if (!nri) {
+								/* DEBUG_PRINT("We found dups!\n"); */
+								/* make sure we only add fi once */
+								if (! fflags[i])
+									dn = addDupNode(node->size, fi, dn);
+								dn = addDupNode(node->size, fj, dn);
+								fflags[i] = fflags[j] = 1;
+								/* DEBUG_PRINT("setting fflags[%d] and fflags[%d]\n", i, j); */
+								break;
+							}
+						}
+						close(fdj);
+						close(fdi);
+					}
+
+					/* If we created a chain of dups of fi, then add this to the chain of dups & reset */
+					if (dn) {
+						dn->next = retval;
+						retval = dn;
+						dn = 0;
+					}
+				}
+				free(ibuff);
+				free(jbuff);
+				free(fflags);
+				free(ar);
+			} else {
+				/* size == 0, so we trivially consider them all dups */
+				dn = malloc(sizeof (struct dupNode));
+				dn->size = 0;
+				dn->files = node->files;
+				dn->next = retval;
+				retval = dn;
+			}
+		}
+
+		/* we can only have duplicates if this node has more than 1 file */
+
+		/*
+		for (fp = node->files; fp; fp=fp->next)
+			DEBUG_PRINT("Checking for duplicate in file %s of size %ld\n", fp->name, node->size);
+		*/
+		retval = chkForDups(node->right, retval);
+
+		free(node);
+	}
+	return retval;
+}
+
+int main(int argc, char **argv)
+{
+	int i, j;
+	struct dupNode *dups;
+	struct fe *fp;
+
+	if (argc < 1) {
+		fprintf(stderr, "usage: finddups dir1 [dir2 ... [dirN]]");
+		exit(EX_USAGE);
+	}
+
+	for (i = 1; i < argc; ++i) {
+		j = nftw(argv[i], visit, 64, FTW_PHYS);
+		if (j == -1) {
+			DEBUG_PRINT("returned %d, errno = %d\n", j, errno);
+		}
+	}
+
+	DEBUG_PRINT("Done scanning directory tree. Now starting duplicate checks.\n");
+
+	for (dups = chkForDups(root, NULL); dups; dups = dups->next) {
+		printf("duplicates of size %ld\n", dups->size);
+		for (fp = dups->files; fp; fp = fp->next) {
+			printf("%s\n", fp->name);
+		}
+	}
+	return 0;
+}
+


Typo.

Typo.

--- src/client/net/NetworkWorker.h
+++ src/client/net/NetworkWorker.h
@@ -52,7 +52,7 @@
   signals:
     /**
      * Emitted when a new measure of the latency between the server and the
-     * client is available. THis value has already been pre-processed and can be
+     * client is available. This value has already been pre-processed and can be
      * consumed without any further checks or modifications (this is not a raw
      * value).
      */


Compile time clang compatibility issues

Compile time clang compatibility issues

--- impl/op/vtm/SegmentManager.h
+++ impl/op/vtm/SegmentManager.h
@@ -274,13 +274,13 @@
                 return MemoryChunk(ro.count(), std::move(addr), std::move(ro.segment()));
             }
             /** Shorthand for \code
-                readonly_block(pos, sizeof(T)).at<T>(0)
+                writable_block(pos, sizeof(T)).at<T>(0)
             \endcode
             */
             template <class T>
             T* wr_at(FarAddress pos, WritableBlockHint hint = WritableBlockHint::update_c)
             {
-                return this->writable_block(pos, OP::utils::memory_requirement<T>::requirement, hint).at<T>(0);
+                return this->writable_block(pos, OP::utils::memory_requirement<T>::requirement, hint).template at<T>(0);
             }
             /**
             *  By the given memory pointer tries to restore origin far-pos.


Updated copyright to OpenGEE Contributors instead of Google Inc

--- earth_enterprise/src/common/verref_storage_io.h
+++ earth_enterprise/src/common/verref_storage_io.h
@@ -1,5 +1,5 @@
 /*
- * Copyright 2018 Google Inc.
+ * Copyright 2018 the OpenGEE Contributors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.


astyle

astyle


fiddling with constants

fiddling with constants

--- Demo/Balance.c
+++ Demo/Balance.c
@@ -52,7 +52,7 @@

 	cpFloat torque = cpConstraintGetImpulse(motor)/cpSpaceGetCurrentTimeStep(space);
 	cpFloat max_torque = cpConstraintGetMaxForce(motor);
-	ChipmunkDemoPrintString("torque: %3.0f%% ", 100.0*torque/max_torque);
+//	ChipmunkDemoPrintString("torque: %3.0f%% ", 100.0*torque/max_torque);

 //	cpFloat v = balance_body->v.x;
 //	ChipmunkDemoPrintString("a/sin: %5.2f\n", (v - last_v)/dt/(balance_body->a));
@@ -62,19 +62,18 @@
 	cpFloat target_x = ChipmunkDemoMouse.x;
 	ChipmunkDebugDrawSegment(cpv(target_x, -1000.0), cpv(target_x, 1000.0), RGBAColor(1.0, 0.0, 0.0, 1.0));

-	cpFloat target_v = bias_coef(0.5, dt/1.2)*(target_x - balance_body->p.x)/dt;
+	cpFloat max_v = 500.0;
+	cpFloat target_v = cpfclamp(bias_coef(0.5, dt/1.2)*(target_x - balance_body->p.x)/dt, -max_v, max_v);
 	cpFloat error_v = (target_v - balance_body->v.x);
 	cpFloat target_sin = 3.0e-3*bias_coef(0.1, dt)*error_v/dt;
-	ChipmunkDemoPrintString("v: %5.2f target_v: %5.2f\n", balance_body->v.x, target_v);
-
-	cpFloat max_balance = 0.6;
-	balance_sin = cpfclamp(balance_sin - 6.0e-5*bias_coef(0.2, dt)*error_v/dt, -max_balance, max_balance);
+//	ChipmunkDemoPrintString("v: %5.2f target_v: %5.2f\n", balance_body->v.x, target_v);

 	cpFloat max_sin = cpfsin(0.6);
+	balance_sin = cpfclamp(balance_sin - 6.0e-5*bias_coef(0.2, dt)*error_v/dt, -max_sin, max_sin);
 	cpFloat target_a = asin(cpfclamp(-target_sin + balance_sin, -max_sin, max_sin));
 	cpFloat angular_diff = asin(cpvcross(balance_body->rot, cpvforangle(target_a)));
 	cpFloat target_w = bias_coef(0.1, dt/0.4)*(angular_diff)/dt;
-	ChipmunkDemoPrintString("a: %.7f target_a: %.7f balance_sin: %.7f\n", balance_body->a, target_a, balance_sin);
+//	ChipmunkDemoPrintString("a: %.7f target_a: %.7f balance_sin: %.7f\n", balance_body->a, target_a, balance_sin);

 	cpFloat max_rate = 50.0;
 	cpFloat rate = cpfclamp(wheel_body->w + balance_body->w - target_w, -max_rate, max_rate);
@@ -122,12 +121,12 @@
 		cpShapeSetFriction(shape, 1.0f);
 		cpShapeSetLayers(shape, NOT_GRABABLE_MASK);

-		shape = cpSpaceAddShape(space, cpSegmentShapeNew(staticBody, cpv(0,-240), cpv(320,-200), 0.0f));
+		shape = cpSpaceAddShape(space, cpSegmentShapeNew(staticBody, cpv(0,-200), cpv(240,-240), 0.0f));
 		cpShapeSetElasticity(shape, 1.0f);
 		cpShapeSetFriction(shape, 1.0f);
 		cpShapeSetLayers(shape, NOT_GRABABLE_MASK);

-		shape = cpSpaceAddShape(space, cpSegmentShapeNew(staticBody, cpv(160,-240), cpv(320,-160), 0.0f));
+		shape = cpSpaceAddShape(space, cpSegmentShapeNew(staticBody, cpv(-240,-240), cpv(0,-200), 0.0f));
 		cpShapeSetElasticity(shape, 1.0f);
 		cpShapeSetFriction(shape, 1.0f);
 		cpShapeSetLayers(shape, NOT_GRABABLE_MASK);
@@ -150,10 +149,10 @@
 	{
 		cpFloat cog_offset = 30.0;

-		cpBB bb1 = cpBBNew(-5.0, 0.0 - cog_offset, 5.0, 40.0 - cog_offset);
+		cpBB bb1 = cpBBNew(-5.0, 0.0 - cog_offset, 5.0, cog_offset*1.2 - cog_offset);
 		cpBB bb2 = cpBBNew(-25.0, bb1.t, 25.0, bb1.t + 10.0);

-		cpFloat mass = 10.0;
+		cpFloat mass = 3.0;
 		cpFloat moment = cpMomentForBox2(mass, bb1) + cpMomentForBox2(mass, bb2);

 		balance_body = cpSpaceAddBody(space, cpBodyNew(mass, moment));
@@ -180,13 +179,14 @@
 	motor->preSolve = motor_preSolve;

 	{
-		cpFloat size = 20.0;
+		cpFloat width = 100.0;
+		cpFloat height = 20.0;
 		cpFloat mass = 3.0;

-		cpBody *boxBody = cpSpaceAddBody(space, cpBodyNew(mass, cpMomentForBox(mass, size, size)));
+		cpBody *boxBody = cpSpaceAddBody(space, cpBodyNew(mass, cpMomentForBox(mass, width, height)));
 		cpBodySetPos(boxBody, cpv(200, -100));

-		cpShape *shape = cpSpaceAddShape(space, cpBoxShapeNew(boxBody, 50, 50));
+		cpShape *shape = cpSpaceAddShape(space, cpBoxShapeNew(boxBody, width, height));
 		cpShapeSetFriction(shape, 0.7);
 	}


rtc/mc13xxx: use MODULE_DEVICE_TABLE instead of MODULE_ALIAS

This allows automatic driver loading for all supported device types.

Signed-off-by: Uwe Kleine-König <181323dd666a182bc2d953e52d0ac3ab54cd8391@pengutronix.de>
Cc: Alessandro Zummo <f0b9bd96bf07bfecc189c62159960134588fafe5@towertech.it>
Signed-off-by: Andrew Morton <5c1e68b099950c134891f0b6e179498a8ebe9cf9@linux-foundation.org>
Signed-off-by: Linus Torvalds <69652caca27c8b940640ad396ab71f93cacec34f@linux-foundation.org>

--- drivers/rtc/rtc-mc13xxx.c
+++ drivers/rtc/rtc-mc13xxx.c
@@ -405,8 +405,9 @@
 	}, {
 		.name = "mc13892-rtc",
 	},
-	{ }
+	{ /* sentinel */ }
 };
+MODULE_DEVICE_TABLE(platform, mc13xxx_rtc_idtable);

 static struct platform_driver mc13xxx_rtc_driver = {
 	.id_table = mc13xxx_rtc_idtable,
@@ -432,4 +433,3 @@
 MODULE_AUTHOR("Sascha Hauer <s.hauer@pengutronix.de>");
 MODULE_DESCRIPTION("RTC driver for Freescale MC13XXX PMIC");
 MODULE_LICENSE("GPL v2");
-MODULE_ALIAS("platform:" DRIVER_NAME);


Make FindBrowserWrapper public - preferable to using friend which

--- CefSharp.BrowserSubprocess.Core/CefAppUnmanagedWrapper.h
+++ CefSharp.BrowserSubprocess.Core/CefAppUnmanagedWrapper.h
@@ -14,24 +14,19 @@
 #include "../CefSharp.Core/Internals/Messaging/ProcessMessageDelegate.h"

 using namespace System::Collections::Generic;
+using namespace CefSharp::Internals::Messaging;

 namespace CefSharp
 {
-    using namespace Internals::Messaging;
-
     // This class is the native subprocess level CEF object wrapper.
     private class CefAppUnmanagedWrapper : CefApp, CefRenderProcessHandler
     {
     private:
-        friend EvaluateScriptDelegate;
-
         ProcessMessageDelegateSet _processMessageDelegates;

         gcroot<Action<CefBrowserWrapper^>^> _onBrowserCreated;
         gcroot<Action<CefBrowserWrapper^>^> _onBrowserDestroyed;
         gcroot<Dictionary<int, CefBrowserWrapper^>^> _browserWrappers;
-
-        CefBrowserWrapper^ FindBrowserWrapper(int browserId, bool mustExist);
     public:

         CefAppUnmanagedWrapper(Action<CefBrowserWrapper^>^ onBrowserCreated, Action<CefBrowserWrapper^>^ onBrowserDestoryed)
@@ -51,6 +46,8 @@
             delete _onBrowserDestroyed;
         }

+        CefBrowserWrapper^ FindBrowserWrapper(int browserId, bool mustExist);
+
         virtual DECL CefRefPtr<CefRenderProcessHandler> GetRenderProcessHandler() OVERRIDE;
         virtual DECL void OnBrowserCreated(CefRefPtr<CefBrowser> browser) OVERRIDE;
         virtual DECL void OnBrowserDestroyed(CefRefPtr<CefBrowser> browser) OVERRIDE;


Remove some dead code

Remove some dead code

--- liblouis/compileTranslationTable.c
+++ liblouis/compileTranslationTable.c
@@ -582,10 +582,9 @@
 }

 static int
-passFindCharacters(FileInfo *nested, int actionPart, widechar *instructions, int end,
+passFindCharacters(FileInfo *nested, widechar *instructions, int end,
 		widechar **characters, int *length) {
 	int IC = 0;
-	int finding = !actionPart;

 	*characters = NULL;
 	*length = 0;
@@ -598,15 +597,9 @@
 		case pass_dots: {
 			int count = instructions[IC + 1];
 			IC += 2;
-
-			if (finding) {
-				*characters = &instructions[IC];
-				*length = count;
-				return 1;
-			}
-
-			IC += count;
-			continue;
+			*characters = &instructions[IC];
+			*length = count;
+			return 1;
 		}

 		case pass_attributes:
@@ -614,8 +607,7 @@
 			goto NO_CHARACTERS;

 		case pass_swap:
-			/* swap has a range in the test part but not in the action part */
-			if (!actionPart != !finding) IC += 2;
+			IC += 2;
 		/* fall through */

 		case pass_groupstart:
@@ -623,10 +615,7 @@
 		case pass_groupreplace:
 			IC += 3;

-		NO_CHARACTERS : {
-			if (finding) return 1;
-			continue;
-		}
+		NO_CHARACTERS : { return 1; }

 		case pass_eq:
 		case pass_lt:
@@ -653,22 +642,17 @@
 			continue;

 		case pass_endTest:
-			if (finding) goto NOT_FOUND;
-			finding = 1;
-			IC += 1;
-			continue;
+			goto NOT_FOUND;

 		default:
-			compileError(nested, "unhandled %s suboperand: \\x%02x",
-					getPartName(actionPart), instruction);
+			compileError(nested, "unhandled test suboperand: \\x%02x", instruction);
 			return 0;
 		}
 	}

 NOT_FOUND:
-	compileError(nested,
-			"characters, dots, attributes, or class swap not found in %s part",
-			getPartName(actionPart));
+	compileError(
+			nested, "characters, dots, attributes, or class swap not found in test part");

 	return 0;
 }
@@ -2648,8 +2632,8 @@
 	{
 		widechar *characters;
 		int length;
-		int found = passFindCharacters(passNested, 0, passInstructions,
-				passRuleDots.length, &characters, &length);
+		int found = passFindCharacters(
+				passNested, passInstructions, passRuleDots.length, &characters, &length);

 		if (!found) return 0;


[S390] dasd: Correct retry counter for terminated I/O.

In case the DASD driver needs to term a running I/O the retry counter
is decreased twice.
Remove the unnecessary retry counter decrease in das_term_IO.

Signed-off-by: Stefan Haberland <9e6a0bb809a7918e8f27f36fc1281e79ae9e5bd0@de.ibm.com>
Signed-off-by: Martin Schwidefsky <52616596d8f5df0d597e85ab515377f92f939c68@de.ibm.com>

--- drivers/s390/block/dasd.c
+++ drivers/s390/block/dasd.c
@@ -855,7 +855,6 @@
 		rc = ccw_device_clear(device->cdev, (long) cqr);
 		switch (rc) {
 		case 0:	/* termination successful */
-			cqr->retries--;
 			cqr->status = DASD_CQR_CLEAR_PENDING;
 			cqr->stopclk = get_clock();
 			cqr->starttime = 0;


[ARM] 3057/1: Add memory control method to support OneNAND sync burst read

Patch from Kyungmin Park

This patch is required for OneNAND MTD to passing the OneNAND sync. burst read

Signed-off-by: Kyungmin Park
Signed-off-by: Russell King <f6aa0246ff943bfa8602cdf60d40c481b38ed232@arm.linux.org.uk>

--- include/asm-arm/mach/flash.h
+++ include/asm-arm/mach/flash.h
@@ -11,6 +11,7 @@
 #define ASMARM_MACH_FLASH_H

 struct mtd_partition;
+struct mtd_info;

 /*
  * map_name:	the map probe function name
@@ -19,6 +20,7 @@
  * init:	method called at driver/device initialisation
  * exit:	method called at driver/device removal
  * set_vpp:	method called to enable or disable VPP
+ * mmcontrol:	method called to enable or disable Sync. Burst Read in OneNAND
  * parts:	optional array of mtd_partitions for static partitioning
  * nr_parts:	number of mtd_partitions for static partitoning
  */
@@ -29,6 +31,7 @@
 	int		(*init)(void);
 	void		(*exit)(void);
 	void		(*set_vpp)(int on);
+	void		(*mmcontrol)(struct mtd_info *mtd, int sync_read);
 	struct mtd_partition *parts;
 	unsigned int	nr_parts;
 };


forgot

forgot

--- src/codegen/LLVM/LLVMcodegen.c
+++ src/codegen/LLVM/LLVMcodegen.c
@@ -230,7 +230,7 @@
 }

 LLVMValueRef genVariableDecl(LLVMCodeGenerator *self, VariableDecl *decl) {
-
+
 }

 LLVMValueRef genDeclaration(LLVMCodeGenerator *self, Declaration *decl) {


cosmetics: Fix typo in variable name, numSkiped --> numSkipped.

git-svn-id: a4d7c1866f8397a4106e0b57fc4fbf792bbdaaaf@12553 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b

--- libpostproc/postprocess_template.c
+++ libpostproc/postprocess_template.c
@@ -1439,7 +1439,7 @@
 //                    if((max-min)*QP < 500)
 //                    if(max-min<QP/2)
                     if(max-min < 20){
-                        static int numSkiped=0;
+                        static int numSkipped=0;
                         static int errorSum=0;
                         static int worstQP=0;
                         static int worstRange=0;
@@ -1450,7 +1450,7 @@

                         if(x==1 || x==8 || y==1 || y==8) continue;

-                        numSkiped++;
+                        numSkipped++;
                         if(absDiff > worstDiff){
                             worstDiff= absDiff;
                             worstQP= QP;
@@ -1458,11 +1458,11 @@
                         }
                         errorSum+= error;

-                        if(1024LL*1024LL*1024LL % numSkiped == 0){
+                        if(1024LL*1024LL*1024LL % numSkipped == 0){
                             av_log(c, AV_LOG_INFO, "sum:%1.3f, skip:%d, wQP:%d, "
                                    "wRange:%d, wDiff:%d, relSkip:%1.3f\n",
-                                   (float)errorSum/numSkiped, numSkiped, worstQP, worstRange,
-                                   worstDiff, (float)numSkiped/numPixels);
+                                   (float)errorSum/numSkipped, numSkipped, worstQP, worstRange,
+                                   worstDiff, (float)numSkipped/numPixels);
                         }
                     }
                     }


Change the time output to use localtime_r rather than gmtime_r as it seems to
be applied twice

git-svn-id: 798f9e0ce1eefcecf757a5f2b692a26d86a9651c@168 c66dcb5a-e80b-0410-ab0e-bb6a4f3ddef9

--- bot/src/plugins/rssfeed.c
+++ bot/src/plugins/rssfeed.c
@@ -338,7 +338,7 @@
             feed    = itemData->feed;
             pubTime = itemData->pubTime;

-            gmtime_r( &pubTime, &tm );
+            localtime_r( &pubTime, &tm );
             strftime( buf, sizeof(buf), "%d %b %Y %H:%M %z (%Z)", &tm );
             sprintf( message, "RSS: [%s] \"%s\" at %s", feed->prefix,
                               itemData->title, buf );


Add necessary interfaces Add optional delegate methods

--- CollapsibleTable/GWCollapsibleTable/GWCollapsibleTable.h
+++ CollapsibleTable/GWCollapsibleTable/GWCollapsibleTable.h
@@ -5,6 +5,9 @@
 //  Created by Greg Wang on 13-1-3.
 //  Copyright (c) 2013年 Greg Wang. All rights reserved.
 //
+
+#import "NSObject+GWCollapsibleTable.h"
+#import "UITableView+GWCollapsibleTable.h"

 @protocol GWCollapsibleTableDataSource <NSObject>

@@ -20,6 +23,11 @@
 @protocol GWCollapsibleTableDelegate <NSObject>

 - (void)tableView:(UITableView *)tableView didSelectBodyRowAtIndexPath:(NSIndexPath *)indexPath;
+
+@optional
+- (void)tableView:(UITableView *)tableView willExpandSection:(NSInteger)section;
+- (void)tableView:(UITableView *)tableView willCollapseSection:(NSInteger)section;
+
 // TODO: Support Extra Selection Management Methods

 // TODO: Support Editing & Reordering Methods


scsi_debug: fix compare and write errors

Kernel build tools pointed out a memory leak so that has been
fixed and its error paths strengthened with a goto. Testing
showed compare and write was only working for lba=0; correcting
the length of the LBA field fixed that.

Signed-off-by: Douglas Gilbert <54dff2264884c355ed5584a3b7f1530b4b26921e@interlog.com>
Reviewed-by: Ewan D. Milne <2c554d25b86cf1e2efb352de0d4bd0940eeebcf1@redhat.com>
Signed-off-by: Christoph Hellwig <923f7720577207a44b32e59bbfbea59d27f1ae8e@lst.de>


[AST] Add a comment for ObjCMethodDecl::getSendResultType() function.

git-svn-id: ffe668792ed300d6c2daa1f6eba2e0aa28d7ec6c@241562 91177308-0d34-0410-b5e6-96231b3b80d8

--- include/clang/AST/DeclObjC.h
+++ include/clang/AST/DeclObjC.h
@@ -332,7 +332,9 @@
   SourceRange getReturnTypeSourceRange() const;

   /// \brief Determine the type of an expression that sends a message to this
-  /// function.
+  /// function. This replaces the type parameters with the types they would
+  /// get if the receiver was parameterless (e.g. it may replace the type
+  /// parameter with 'id').
   QualType getSendResultType() const;

   /// Determine the type of an expression that sends a message to this


Missed include in last commit.

Missed include in last commit.

--- FrameBuffer.c
+++ FrameBuffer.c
@@ -21,6 +21,7 @@

 #include "FrameBuffer.h"
 #include "avcodec.h"
+#include "CommonUtils.h"
 #include <sys/param.h>

 void FFusionDataSetup(FFusionData *data, int dataSize, int bufferSize)


trying mutex on auxallocasync

trying mutex on auxallocasync

--- Engine/auxfd.c
+++ Engine/auxfd.c
@@ -61,8 +61,10 @@
   AUXASYNC *pp = (AUXASYNC *) p;
   CSOUND *csound = pp->csound;
   AUXCH new;
+  csoundLockMutex(csound->API_lock);
   csoundAuxAlloc(csound, pp->nbytes, &new);
   pp->notify(pp->userData, &new);
+  csoundUnlockMutex(csound->API_lock);
   return 0;
 }


[SCSI] scsi_debug: fix Thin provisioning support

While testing scsi_debug with these patches I found a
problem with the Block Limits VPD page function. The
length returned by the inquiry_evpd_b0() function was
too short. A patch to fix that and a cosmetic change
(that the form factor of scsi_debug is less than 1.8
inches) is attached.

Signed-off-by: Douglas Gilbert <54dff2264884c355ed5584a3b7f1530b4b26921e@interlog.com>
Signed-off-by: James Bottomley <407b36959ca09543ccda8f8e06721c791bc53435@suse.de>


Make this SourceLocation getter const LLVM_READONLY like others in the same file.

git-svn-id: ffe668792ed300d6c2daa1f6eba2e0aa28d7ec6c@269625 91177308-0d34-0410-b5e6-96231b3b80d8

--- include/clang/AST/StmtObjC.h
+++ include/clang/AST/StmtObjC.h
@@ -326,7 +326,7 @@
   Expr *getThrowExpr() { return reinterpret_cast<Expr*>(Throw); }
   void setThrowExpr(Stmt *S) { Throw = S; }

-  SourceLocation getThrowLoc() { return AtThrowLoc; }
+  SourceLocation getThrowLoc() const LLVM_READONLY { return AtThrowLoc; }
   void setThrowLoc(SourceLocation Loc) { AtThrowLoc = Loc; }

   SourceLocation getLocStart() const LLVM_READONLY { return AtThrowLoc; }


<?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"          "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">      <title>403 - Forbidden</title>
403 - Forbidden


Use our own parse for the image description extensions.

Fixes #103

--- FFusionCodec.c
+++ FFusionCodec.c
@@ -38,6 +38,25 @@
 #include "Codecprintf.h"
 #include "ColorConversions.h"

+int isImageDescriptionExtensionPresent(ImageDescriptionHandle desc, long type)
+{
+	ImageDescriptionPtr d = *desc;
+	int offset = sizeof(ImageDescription);
+	uint8_t *p = (uint8_t *)d;
+
+	//read next description, need 8 bytes for size and type
+	while(offset < d->idSize - 8)
+	{
+		long len = *(p+offset) << 24 | *(p+offset+1) << 16 | *(p+offset+2) << 8 | *(p+offset+3);
+		offset += 4;
+		long rtype = *(p+offset) << 24 | *(p+offset+1) << 16 | *(p+offset+2) << 8 | *(p+offset+3);
+		if(rtype == type && offset + len - 4 <= d->idSize)
+			return 1;
+		offset += len;
+	}
+	return 0;
+}
+
 void inline swapFrame(AVFrame * *a, AVFrame * *b)
 {
 	AVFrame *t = *a;
@@ -600,7 +619,7 @@

 		// avc1 requires the avcC extension
 		if (glob->componentType == 'avc1') {
-			CountImageDescriptionExtensionType(p->imageDescription, 'avcC', &count);
+			count = isImageDescriptionExtensionPresent(p->imageDescription, 'avcC');

 			if (count >= 1) {
 				imgDescExt = NewHandle(0);
@@ -613,7 +632,7 @@
 				DisposeHandle(imgDescExt);
 			}
 		} else if (glob->componentType == 'mp4v') {
-			CountImageDescriptionExtensionType(p->imageDescription, 'esds', &count);
+			count = isImageDescriptionExtensionPresent(p->imageDescription, 'esds');

 			if (count >= 1) {
 				imgDescExt = NewHandle(0);
@@ -624,7 +643,7 @@
 				DisposeHandle(imgDescExt);
 			}
 		} else {
-			CountImageDescriptionExtensionType(p->imageDescription, 'strf', &count);
+			count = isImageDescriptionExtensionPresent(p->imageDescription, 'strf');

 			if (count >= 1) {
 				imgDescExt = NewHandle(0);


different error handling

different error handling

--- galpy/actionAngle_src/actionAngle_c_ext/actionAngleStaeckel.c
+++ galpy/actionAngle_src/actionAngle_c_ext/actionAngleStaeckel.c
@@ -332,6 +332,10 @@
   gsl_integration_glfixed_table * T= gsl_integration_glfixed_table_alloc (order);
   JRInt.function = &JRStaeckelIntegrand;
   for (ii=0; ii < ndata; ii++){
+    if ( *(umin+ii) == -9999.99 || *(umax+ii) == -9999.99 ){
+      *(jr+ii)= 9999.99;
+      continue;
+    }
     if ( (*(umax+ii) - *(umin+ii)) / *(umax+ii) < 0.000001 ){//circular
       *(jr+ii) = 0.;
       continue;
@@ -376,6 +380,10 @@
   gsl_integration_glfixed_table * T= gsl_integration_glfixed_table_alloc (order);
   JzInt.function = &JzStaeckelIntegrand;
   for (ii=0; ii < ndata; ii++){
+    if ( *(vmin+ii) == -9999.99 ){
+      *(jz+ii)= 9999.99;
+      continue;
+    }
     if ( (0.5 * M_PI - *(vmin+ii)) / M_PI * 2. < 0.000001 ){//circular
       *(jz+ii) = 0.;
       continue;
@@ -455,17 +463,13 @@
 	  u_lo*= 0.9;
 	}
 	//Find root
-	//gsl_set_error_handler_off();
+	gsl_set_error_handler_off();
 	status = gsl_root_fsolver_set (s, &JRRoot, u_lo, u_hi);
-	//if (status == GSL_EINVAL) {
-	//  printf("Error in uminmax\n");
-	//printf("%f,%f,%f,%f,%f,%f,%f\n",u_lo,GSL_FN_EVAL(&JRRoot,u_lo),
-	//	 u_hi,GSL_FN_EVAL(&JRRoot,u_hi),
-	//	 *(pux+ii),peps,meps);
-	//  fflush(stdout);
-	//  continue;
-	//}
-	//gsl_set_error_handler (NULL);
+	if (status == GSL_EINVAL) {
+	  *(umin+ii) = -9999.99;
+	  continue;
+	}
+	gsl_set_error_handler (NULL);
 	iter= 0;
 	do
 	  {
@@ -489,7 +493,13 @@
 	  u_hi*= 1.1;
 	}
 	//Find root
+	gsl_set_error_handler_off();
 	status = gsl_root_fsolver_set (s, &JRRoot, u_lo, u_hi);
+	if (status == GSL_EINVAL) {
+	  *(umax+ii) = -9999.99;
+	  continue;
+	}
+	gsl_set_error_handler (NULL);
 	iter= 0;
 	do
 	  {
@@ -514,7 +524,14 @@
       }
       u_hi= (u_lo < 0.9 * *(ux+ii)) ? u_lo / 0.9 / 0.9: *(ux+ii);
       //Find root
+      gsl_set_error_handler_off();
       status = gsl_root_fsolver_set (s, &JRRoot, u_lo, u_hi);
+      if (status == GSL_EINVAL) {
+	*(umin+ii) = -9999.99;
+	*(umax+ii) = -9999.99;
+	continue;
+      }
+      gsl_set_error_handler (NULL);
       iter= 0;
       do
 	{
@@ -606,7 +623,13 @@
 	v_lo*= 0.9;
       }
       //Find root
+      gsl_set_error_handler_off();
       status = gsl_root_fsolver_set (s, &JzRoot, v_lo, v_hi);
+      if (status == GSL_EINVAL) {
+	*(vmin+ii) = -9999.99;
+	continue;
+      }
+      gsl_set_error_handler (NULL);
       iter= 0;
       do
 	{


[SCSI] scsi_debug: use sg buffer copy helper functions

Signed-off-by: FUJITA Tomonori <93dac1fe9c4b2a3957982200319981492ad4976e@lab.ntt.co.jp>
Cc: Douglas Gilbert <963f268e7a1bdc4d8e33d801712bc4fd67ee1d46@torque.net>
Signed-off-by: James Bottomley <407b36959ca09543ccda8f8e06721c791bc53435@HansenPartnership.com>

--- drivers/scsi/scsi_debug.c
+++ drivers/scsi/scsi_debug.c
@@ -591,81 +591,37 @@
 }

 /* Returns 0 if ok else (DID_ERROR << 16). Sets scp->resid . */
-static int fill_from_dev_buffer(struct scsi_cmnd * scp, unsigned char * arr,
+static int fill_from_dev_buffer(struct scsi_cmnd *scp, unsigned char *arr,
 				int arr_len)
 {
-	int k, req_len, act_len, len, active;
-	void * kaddr;
-	void * kaddr_off;
-	struct scatterlist *sg;
+	int act_len;
 	struct scsi_data_buffer *sdb = scsi_in(scp);

 	if (!sdb->length)
 		return 0;
-	if (!sdb->table.sgl)
-		return (DID_ERROR << 16);
 	if (!(scsi_bidi_cmnd(scp) || scp->sc_data_direction == DMA_FROM_DEVICE))
 		return (DID_ERROR << 16);
-	active = 1;
-	req_len = act_len = 0;
-	for_each_sg(sdb->table.sgl, sg, sdb->table.nents, k) {
-		if (active) {
-			kaddr = (unsigned char *)
-				kmap_atomic(sg_page(sg), KM_USER0);
-			if (NULL == kaddr)
-				return (DID_ERROR << 16);
-			kaddr_off = (unsigned char *)kaddr + sg->offset;
-			len = sg->length;
-			if ((req_len + len) > arr_len) {
-				active = 0;
-				len = arr_len - req_len;
-			}
-			memcpy(kaddr_off, arr + req_len, len);
-			kunmap_atomic(kaddr, KM_USER0);
-			act_len += len;
-		}
-		req_len += sg->length;
-	}
+
+	act_len = sg_copy_from_buffer(sdb->table.sgl, sdb->table.nents,
+				      arr, arr_len);
 	if (sdb->resid)
 		sdb->resid -= act_len;
 	else
-		sdb->resid = req_len - act_len;
+		sdb->resid = scsi_bufflen(scp) - act_len;
+
 	return 0;
 }

 /* Returns number of bytes fetched into 'arr' or -1 if error. */
-static int fetch_to_dev_buffer(struct scsi_cmnd * scp, unsigned char * arr,
-			       int max_arr_len)
-{
-	int k, req_len, len, fin;
-	void * kaddr;
-	void * kaddr_off;
-	struct scatterlist * sg;
-
-	if (0 == scsi_bufflen(scp))
+static int fetch_to_dev_buffer(struct scsi_cmnd *scp, unsigned char *arr,
+			       int arr_len)
+{
+	if (!scsi_bufflen(scp))
 		return 0;
-	if (NULL == scsi_sglist(scp))
-		return -1;
 	if (!(scsi_bidi_cmnd(scp) || scp->sc_data_direction == DMA_TO_DEVICE))
 		return -1;
-	req_len = fin = 0;
-	scsi_for_each_sg(scp, sg, scsi_sg_count(scp), k) {
-		kaddr = (unsigned char *)kmap_atomic(sg_page(sg), KM_USER0);
-		if (NULL == kaddr)
-			return -1;
-		kaddr_off = (unsigned char *)kaddr + sg->offset;
-		len = sg->length;
-		if ((req_len + len) > max_arr_len) {
-			len = max_arr_len - req_len;
-			fin = 1;
-		}
-		memcpy(arr + req_len, kaddr_off, len);
-		kunmap_atomic(kaddr, KM_USER0);
-		if (fin)
-			return req_len + len;
-		req_len += sg->length;
-	}
-	return req_len;
+
+	return scsi_sg_copy_to_buffer(scp, arr, arr_len);
 }

@@ -1965,16 +1921,7 @@
 	if (!buf)
 		return ret;

-	offset = 0;
-	scsi_for_each_sg(scp, sg, scsi_sg_count(scp), i) {
-		kaddr = (unsigned char *)kmap_atomic(sg_page(sg), KM_USER0);
-		if (!kaddr)
-			goto out;
-
-		memcpy(buf + offset, kaddr + sg->offset, sg->length);
-		offset += sg->length;
-		kunmap_atomic(kaddr, KM_USER0);
-	}
+	scsi_sg_copy_to_buffer(scp, buf, scsi_bufflen(scp));

 	offset = 0;
 	for_each_sg(sdb->table.sgl, sg, sdb->table.nents, i) {


Actually call GetHomeDirectory()

Actually call GetHomeDirectory()

git-svn-id: d8f21eb7283bfb39ebab2f8f9b4a259b233f9348@735 621663c8-3916-0410-8f58-edc14a8543d5

--- FFusionCodec.c
+++ FFusionCodec.c
@@ -176,7 +176,7 @@

     //Two places to check, home dir and /

-    CFStringRef home = (CFStringRef)NSHomeDirectory();
+    CFStringRef home = (CFStringRef)GetHomeDirectory();
     CFMutableStringRef location = CFStringCreateMutableCopy(NULL, 0, home);
     CFStringAppend(location, CFSTR("/Library/PreferencePanes/Perian.prefPane/Contents/Resources/PerianUpdateChecker.app"));


wrap result namespace into Fixpp namespace as result can collide with third party libs (e.g fmt)

--- include/fixpp/utils/result.h
+++ include/fixpp/utils/result.h
@@ -14,6 +14,7 @@
 #include <functional>
 #include <type_traits>

+namespace Fixpp {
 namespace result {

 namespace types {
@@ -899,7 +900,8 @@
     return lhs.storage().template get<E>() == err.val;
 }

-}
+} // namespace result
+} // namespace Fixpp

 #define TRY(...)                                                   \
     ({                                                             \


[SCSI] vmw_pvscsi: fix signedness warning with newer compilers

pvscsi_setup_msix() expects 'irq' argument to be an int but is being
passed unsigned int. Unsigned int is more proper type for IRQ number
so let's use it. This shuts off a compile warning with recent
compilers.

Signed-off-by: Dmitry Torokhov <10a8c465cefc9bdd6c925e26964d23c90f1141cc@vmware.com>
Acked-by: Alok Kataria <cc926cf5b90d92ca08b99da90949c190e7ec8fa9@vmware.com>
Signed-off-by: James Bottomley <407b36959ca09543ccda8f8e06721c791bc53435@suse.de>

--- drivers/scsi/vmw_pvscsi.c
+++ drivers/scsi/vmw_pvscsi.c
@@ -1069,7 +1069,8 @@
 		free_pages((unsigned long)ctx->sgl, get_order(SGL_SIZE));
 }

-static int pvscsi_setup_msix(const struct pvscsi_adapter *adapter, int *irq)
+static int pvscsi_setup_msix(const struct pvscsi_adapter *adapter,
+			     unsigned int *irq)
 {
 	struct msix_entry entry = { 0, PVSCSI_VECTOR_COMPLETION };
 	int ret;


Pointer-specialization operators now reutrn with getter applied

--- FTL/Property.h
+++ FTL/Property.h
@@ -152,22 +152,22 @@

 		decltype(*Type()) operator*()
 		{
-			return *value;
-		}
-
-		Type operator->()
-		{
-			return value;
+			return *getter(value);
+		}
+
+		InterfaceType operator->()
+		{
+			return getter(value);
 		}

 		const decltype(*Type()) operator*() const
 		{
-			return *value;
-		}
-
-		const Type operator->() const
-		{
-			return value;
+			return *getter(value);
+		}
+
+		const InterfaceType operator->() const
+		{
+			return getter(value);
 		}

 	private:


- propagate failure of begin_paint_info calls

--- Drawable.c
+++ Drawable.c
@@ -53,7 +53,7 @@
 #define var (( PDrawable) self)

 #define gpARGS            Bool inPaint = opt_InPaint
-#define gpENTER           if ( !inPaint) my-> begin_paint_info( self)
+#define gpENTER(fail)     if ( !inPaint) if ( !my-> begin_paint_info( self)) return (fail)
 #define gpLEAVE           if ( !inPaint) my-> end_paint_info( self)

 void
@@ -278,7 +278,7 @@
 {
    gpARGS;
    int ret;
-   gpENTER;
+   gpENTER(0);
    ret = apc_gp_get_bpp( self);
    gpLEAVE;
    return ret;
@@ -304,7 +304,7 @@
 Drawable_get_nearest_color( Handle self, Color color)
 {
    gpARGS;
-   gpENTER;
+   gpENTER(clInvalid);
    color = apc_gp_get_nearest_color( self, color);
    gpLEAVE;
    return color;
@@ -327,7 +327,7 @@
    AV * av = newAV();
    PRGBColor r;

-   gpENTER;
+   gpENTER(newRV_noinc(( SV *) av));
    r = apc_gp_get_physical_palette( self, &nCol);
    gpLEAVE;

@@ -344,7 +344,7 @@
 Drawable_get_font_abc( Handle self, int first, int last, Bool unicode)
 {
    int i;
-   AV * av = newAV();
+   AV * av;
    PFontABC abc;

    if ( first < 0) first = 0;
@@ -358,11 +358,12 @@
      abc = nil;
    else {
      gpARGS;
-     gpENTER;
+     gpENTER( newRV_noinc(( SV *) newAV()));
      abc = apc_gp_get_font_abc( self, first, last, unicode );
      gpLEAVE;
    }

+   av = newAV();
    if ( abc != nil) {
       for ( i = 0; i <= last - first; i++) {
          av_push( av, newSVnv( abc[ i]. a));
@@ -381,7 +382,8 @@
    unsigned long * ret;
    AV * av = newAV();
    gpARGS;
-   gpENTER;
+
+   gpENTER(newRV_noinc(( SV *) av));
    ret = apc_gp_get_font_ranges( self, &count);
    gpLEAVE;
    if ( ret) {
@@ -838,7 +840,7 @@
    Bool   utf8 = SvUTF8( text);
    if ( utf8) dlen = utf8_length(( U8*) c_text, ( U8*) c_text + dlen);
    if ( len < 0 || len > dlen) len = dlen;
-   gpENTER;
+   gpENTER(0);
    res = apc_gp_get_text_width( self, c_text, len, addOverhang, utf8);
    gpLEAVE;
    return res;
@@ -856,7 +858,7 @@
    Bool   utf8 = SvUTF8( text);
    if ( utf8) dlen = utf8_length(( U8*) c_text, ( U8*) c_text + dlen);
    if ( len < 0 || len > dlen) len = dlen;
-   gpENTER;
+   gpENTER( newRV_noinc(( SV *) newAV()));
    p = apc_gp_get_text_box( self, c_text, len, utf8);
    gpLEAVE;

@@ -895,7 +897,7 @@
       if ( !abc) return nil;
    } else if ( my-> get_font_abc == Drawable_get_font_abc) {
       gpARGS;
-      gpENTER;
+      gpENTER(nil);
       abc = apc_gp_get_font_abc( self, base * 256, base * 256 + 255, t-> utf8_text);
       gpLEAVE;
       if ( !abc) return nil;


Disable dllimport declaration on Windows with gcc

The declaration as it is used now produces compiler errors on MinGW.

--- engine/include/methcla/common.h
+++ engine/include/methcla/common.h
@@ -32,19 +32,23 @@

 #if defined _WIN32 || defined __CYGWIN__
 #    if defined(BUILDING_DLL)
-#        define METHCLA_VISIBLE __declspec(dllexport)
+#        define METHCLA_VISIBILITY __declspec(dllexport)
 #    else
-#        define METHCLA_VISIBLE __declspec(dllimport)
+#        if __GNUC__
+#            define METHCLA_VISIBILITY
+#        else
+#            define METHCLA_VISIBILITY __declspec(dllimport)
+#        endif
 #    endif
 #else
 #    if (__GNUC__ >= 4) || (defined(__clang__) && (__clang_major__ >= 4))
-#        define METHCLA_VISIBLE __attribute__ ((visibility ("default")))
+#        define METHCLA_VISIBILITY __attribute__ ((visibility ("default")))
 #    else
-#        define METHCLA_VISIBLE
+#        define METHCLA_VISIBILITY
 #    endif
 #endif

-#define METHCLA_EXPORT METHCLA_C_LINKAGE METHCLA_VISIBLE
+#define METHCLA_EXPORT METHCLA_C_LINKAGE METHCLA_VISIBILITY

 //* Time in seconds.
 typedef double Methcla_Time;


spi/fsl_spi: fix CPM spi driver

spi/fsl_spi: fix CPM spi driver

This patch fixes the freescale spi driver for CPM. Without this
patch SPI on CPM failed because cpm_muram_alloc_fixed tries to
allocate muram in an preserved area. The error reported was:

mpc8xxx_spi f0011a80.spi: can't allocate spi parameter ram
mpc8xxx_spi: probe of f0011a80.spi failed with error -12

Now the driver uses of_iomap to get access to this area
similar to i2c driver driver in the i2c-cpm.c which has a
similar device tree node. This is tested on a MPC8247 with CPM2.

Signed-off-by: Holger Brunck <f51e8295e03bd42d85fb6868bb600d0abe56464f@keymile.com>
Signed-off-by: Grant Likely <9069e6f5a2b566e2674a0ba1e2bf39c12c195fad@secretlab.ca>

--- drivers/spi/spi-fsl-spi.c
+++ drivers/spi/spi-fsl-spi.c
@@ -684,7 +684,7 @@
 	struct device_node *np = dev->of_node;
 	const u32 *iprop;
 	int size;
-	unsigned long spi_base_ofs;
+	void __iomem *spi_base;
 	unsigned long pram_ofs = -ENOMEM;

 	/* Can't use of_address_to_resource(), QE muram isn't at 0. */
@@ -702,33 +702,27 @@
 		return pram_ofs;
 	}

-	/* CPM1 and CPM2 pram must be at a fixed addr. */
-	if (!iprop || size != sizeof(*iprop) * 4)
-		return -ENOMEM;
-
-	spi_base_ofs = cpm_muram_alloc_fixed(iprop[2], 2);
-	if (IS_ERR_VALUE(spi_base_ofs))
-		return -ENOMEM;
+	spi_base = of_iomap(np, 1);
+	if (spi_base == NULL)
+		return -EINVAL;

 	if (mspi->flags & SPI_CPM2) {
 		pram_ofs = cpm_muram_alloc(SPI_PRAM_SIZE, 64);
-		if (!IS_ERR_VALUE(pram_ofs)) {
-			u16 __iomem *spi_base = cpm_muram_addr(spi_base_ofs);
-
-			out_be16(spi_base, pram_ofs);
-		}
+		out_be16(spi_base, pram_ofs);
 	} else {
-		struct spi_pram __iomem *pram = cpm_muram_addr(spi_base_ofs);
+		struct spi_pram __iomem *pram = spi_base;
 		u16 rpbase = in_be16(&pram->rpbase);

 		/* Microcode relocation patch applied? */
 		if (rpbase)
 			pram_ofs = rpbase;
-		else
-			return spi_base_ofs;
-	}
-
-	cpm_muram_free(spi_base_ofs);
+		else {
+			pram_ofs = cpm_muram_alloc(SPI_PRAM_SIZE, 64);
+			out_be16(spi_base, pram_ofs);
+		}
+	}
+
+	iounmap(spi_base);
 	return pram_ofs;
 }


- removed commented out code
- indentation

[r25783]

--- include/libfirm/irtypeinfo.h
+++ include/libfirm/irtypeinfo.h
@@ -61,20 +61,13 @@

 /* ------------ Irgraph state handling. ------------------------------- */

-/*
-#define irg_typeinfo_none         ir_typeinfo_none
-#define irg_typeinfo_consistent   ir_typeinfo_consistent
-#define irg_typeinfo_inconsistent ir_typeinfo_inconsistent
-#define irg_typeinfo_state        ir_typeinfo_state
-*/
-
 typedef enum {
-  ir_typeinfo_none,         /**< No typeinfo computed, calls to set/get_irn_typeinfo_type()
-  				  are invalid. */
-  ir_typeinfo_consistent,   /**< Type info valid, calls to set/get_irn_typeinfo_type() return
-				  the proper type. */
-  ir_typeinfo_inconsistent  /**< Type info can be accessed, but it can be invalid
-				  because of other transformations. */
+	ir_typeinfo_none,        /**< No typeinfo computed, calls to set/get_irn_typeinfo_type()
+	                              are invalid. */
+	ir_typeinfo_consistent,  /**< Type info valid, calls to set/get_irn_typeinfo_type() return
+	                              the proper type. */
+	ir_typeinfo_inconsistent /**< Type info can be accessed, but it can be invalid
+	                              because of other transformations. */
 } ir_typeinfo_state;

 void              set_irg_typeinfo_state(ir_graph *irg, ir_typeinfo_state s);


fixed bug improving accuracy of orientation assignment (thanks to KinMan). Changed default corner_thresh to 0.4 to give a similar number of keypoints as before the bug fix. Also fixed bug with writing keypoint coordinates to a file (thanks to v8korb)

--- sift3d/sift.c
+++ sift3d/sift.c
@@ -1366,7 +1366,7 @@

     Cvec v[2];
     Mat_rm A, L, Q;
-    Cvec vd, vd_win, vdisp, vr;
+    Cvec vd_win, vdisp, vr;
     double d, cos_ang, abs_cos_ang, corner_score;
     float weight, sq_dist, sgn;
     int i, x, y, z, m;
@@ -1403,7 +1403,10 @@
     vd_win.y = 0.0f;
     vd_win.z = 0.0f;
     IM_LOOP_SPHERE_START(im, x, y, z, vcenter, win_radius, &vdisp, sq_dist)
-	// Compute Gaussian weighting, ignoring constant factor
+
+        Cvec vd;
+
+	// Compute Gaussian weighting, ignoring the constant factor
 	weight = expf(-0.5 * sq_dist / (sigma * sigma));

 	// Get the gradient
@@ -1420,6 +1423,7 @@
 	// Update the window gradient
         SIFT3D_CVEC_SCALE(&vd, weight);
 	SIFT3D_CVEC_OP(&vd_win, &vd, +, &vd_win);
+
     IM_LOOP_SPHERE_END

     // Fill in the remaining elements
@@ -1460,13 +1464,13 @@
 	vr.z = (float) SIFT3D_MAT_RM_GET(&Q, 2, eig_idx, double);

 	// Get the directional derivative
-	d = SIFT3D_CVEC_DOT(&vd, &vr);
+	d = SIFT3D_CVEC_DOT(&vd_win, &vr);

         // Get the cosine of the angle between the eigenvector and the gradient
-        cos_ang = d / (SIFT3D_CVEC_L2_NORM(&vr) * SIFT3D_CVEC_L2_NORM(&vd));
+        cos_ang = d / (SIFT3D_CVEC_L2_NORM(&vr) * SIFT3D_CVEC_L2_NORM(&vd_win));
         abs_cos_ang = fabs(cos_ang);

-        // Reject points not meeting the corner score
+        // Compute the corner confidence score
         corner_score = SIFT3D_MIN(corner_score, abs_cos_ang);

 	// Get the sign of the derivative
@@ -3160,10 +3164,15 @@
                 const Keypoint *const key = kp->buf + i;
                 const Mat_rm *const R = &key->R;

+                const double coord_factor = pow(2.0, key->o);
+
                 // Write the coordinates
-                SIFT3D_MAT_RM_GET(&mat, i, kp_x, double) = key->xd;
-                SIFT3D_MAT_RM_GET(&mat, i, kp_y, double) = key->yd;
-                SIFT3D_MAT_RM_GET(&mat, i, kp_z, double) = key->zd;
+                SIFT3D_MAT_RM_GET(&mat, i, kp_x, double) = key->xd *
+                        coord_factor;
+                SIFT3D_MAT_RM_GET(&mat, i, kp_y, double) = key->yd *
+                        coord_factor;
+                SIFT3D_MAT_RM_GET(&mat, i, kp_z, double) = key->zd *
+                        coord_factor;
                 SIFT3D_MAT_RM_GET(&mat, i, kp_s, double) = key->sd;

                 // Write the orientation matrix


TTY: hvc_dcc: probe for a JTAG connection before registering

Enabling the ARM DCC console and using without a JTAG connection will
simply hang the system. Since distros like to turn on all options, this
is a reoccurring problem to debug. We can do better by checking if
anything is attached and handling characters. There is no way to probe
this, so send a newline and check that it is handled.

Cc: Paolo Pisati <c0e555b7ae00100ef072952f15005aa529deac41@canonical.com>
Cc: Tim Gardner <c65a040f7f664378353fb65fc3553df208a14f68@canonical.com>
Cc: Greg Kroah-Hartman <4645f7897fd33786a2ee1264d590b3c400559d85@linuxfoundation.org>
Cc: Jiri Slaby <dfbf39eb5bf303a3db5454d815cb8c8888cbadf9@suse.cz>
Signed-off-by: Rob Herring <aa00819e304141d872f2e4b1c4be422ea3abbfe1@calxeda.com>
Signed-off-by: Greg Kroah-Hartman <4645f7897fd33786a2ee1264d590b3c400559d85@linuxfoundation.org>


usb: Add device quirk for Logitech HD Pro Webcams C920 and C930e

We've encountered a rare issue when enumerating two Logitech webcams
after a reboot that doesn't power cycle the USB ports. They are spewing
random data (possibly some leftover UVC buffers) on the second
(full-sized) Get Configuration request of the enumeration phase. Since
the data is random this can potentially cause all kinds of odd behavior,
and since it occasionally happens multiple times (after the kernel
issues another reset due to the garbled configuration descriptor), it is
not always recoverable. Set the USB_DELAY_INIT quirk that seems to work
around the issue.

Signed-off-by: Julius Werner <4d12f06cff3725783b352157673a720bc67c4afe@chromium.org>
Cc: stable <4fbacc2fa0ffdbb11bf1ad6925b886ebd08dd15f@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <4645f7897fd33786a2ee1264d590b3c400559d85@linuxfoundation.org>


clk: Fix typo in comment

clk: Fix typo in comment

CLK_MUX_INDEX_BIT is mistakenly written as CLK_MUX_INDEX_BITWISE in comment. Fix
it.

CLK_GATE_SET_TO_DISABLE is mistakenly written as CLK_GATE_SET_DISABLE in
comment. Fix it.

Signed-off-by: Viresh Kumar <5ff32272b3d9f86512eddc8e0af523fc6f7924e5@st.com>
Signed-off-by: Mike Turquette <6dab61939fc5e23761050a66932f032dceda5ebf@linaro.org>

--- include/linux/clk-provider.h
+++ include/linux/clk-provider.h
@@ -159,7 +159,7 @@
  * Clock which can gate its output.  Implements .enable & .disable
  *
  * Flags:
- * CLK_GATE_SET_DISABLE - by default this clock sets the bit at bit_idx to
+ * CLK_GATE_SET_TO_DISABLE - by default this clock sets the bit at bit_idx to
  * 	enable the clock.  Setting this flag does the opposite: setting the bit
  * 	disable the clock and clearing it enables the clock
  */
@@ -232,7 +232,7 @@
  *
  * Flags:
  * CLK_MUX_INDEX_ONE - register index starts at 1, not 0
- * CLK_MUX_INDEX_BITWISE - register index is a single bit (power of two)
+ * CLK_MUX_INDEX_BIT - register index is a single bit (power of two)
  */
 struct clk_mux {
 	struct clk_hw	hw;


Prova

Prova


usb: dwc2: remove early return on clock query

Since we have assigned clk=NULL, which is a valid clk, we should not
be returning when a clock node is not provide. Instead, we should return
only when we cannot enable the clock.

Signed-off-by: Dinh Nguyen <a48724738fc762a7f206428dfcaf7ede2fd84d0f@opensource.altera.com>
Signed-off-by: Felipe Balbi <94dddeeef08b001e003cce128ddc162a4e2c6cd2@ti.com>


Fix yet another typo

Fix yet another typo

git-svn-id: 0ff597fd157e6f4fc38580e8d64ab130330d2411@197821 91177308-0d34-0410-b5e6-96231b3b80d8

--- include/llvm/MC/MCStreamer.h
+++ include/llvm/MC/MCStreamer.h
@@ -413,7 +413,7 @@

   /// EmitCOFFSecRel32 - Emits a COFF section relative relocation.
   ///
-  /// @param Symbol - Symbol the section relative realocation should point to.
+  /// @param Symbol - Symbol the section relative relocation should point to.
   virtual void EmitCOFFSecRel32(MCSymbol const *Symbol);

   /// EmitELFSize - Emit an ELF .size directive.


png: convert _openslide_png_read to g_autoptr

png_read() has some allocations that aren't conducive to g_autoptr, so
leave it alone for now.

Signed-off-by: Benjamin Gilbert <55d1d0083477f6dd5757d8929dd3b9e09d80bd84@cs.cmu.edu>

--- src/openslide-decode-png.c
+++ src/openslide-decode-png.c
@@ -175,18 +175,15 @@
                          uint32_t *dest,
                          int64_t w, int64_t h,
                          GError **err) {
-  struct _openslide_file *f = _openslide_fopen(filename, err);
+  g_autoptr(_openslide_file) f = _openslide_fopen(filename, err);
   if (!f) {
     return false;
   }
   if (!_openslide_fseek(f, offset, SEEK_SET, err)) {
     g_prefix_error(err, "Couldn't fseek %s: ", filename);
-    _openslide_fclose(f);
     return false;
   }
-  bool ret = png_read(file_read_callback, f, dest, w, h, err);
-  _openslide_fclose(f);
-  return ret;
+  return png_read(file_read_callback, f, dest, w, h, err);
 }

 struct mem {


usb: dwc3: gadget: disable U1/U2 on disconnect

If we get a disconnect IRQ, we should take
the core out of low power mode so we can
reconnect afterwards.

Signed-off-by: Felipe Balbi <94dddeeef08b001e003cce128ddc162a4e2c6cd2@ti.com>

--- drivers/usb/dwc3/gadget.c
+++ drivers/usb/dwc3/gadget.c
@@ -1906,11 +1906,9 @@

 static void dwc3_gadget_disconnect_interrupt(struct dwc3 *dwc)
 {
+	int			reg;
+
 	dev_vdbg(dwc->dev, "%s\n", __func__);
-#if 0
-	XXX
-	U1/U2 is powersave optimization. Skip it for now. Anyway we need to
-	enable it before we can disable it.

 	reg = dwc3_readl(dwc->regs, DWC3_DCTL);
 	reg &= ~DWC3_DCTL_INITU1ENA;
@@ -1918,7 +1916,6 @@

 	reg &= ~DWC3_DCTL_INITU2ENA;
 	dwc3_writel(dwc->regs, DWC3_DCTL, reg);
-#endif

 	dwc3_stop_active_transfers(dwc);
 	dwc3_disconnect_gadget(dwc);


CRC32 no longer restricted to ARM64

CRC32 no longer restricted to ARM64

On a simple benchmark the CRC32 version is about 3x faster on
ARM Cortex A57 (Aarch32) than the Murmur3 scalar version.

BUG=skia:

Change-Id: I71515e8463a33924998b837ff9f32202690dd2fe
Reviewed-on: https://skia-review.googlesource.com/15480
Reviewed-by: Mike Klein <14574f09dfa9b4e14759b88c3426a495a0e627b0@chromium.org>
Commit-Queue: Mike Klein <14574f09dfa9b4e14759b88c3426a495a0e627b0@chromium.org>

--- src/opts/SkChecksum_opts.h
+++ src/opts/SkChecksum_opts.h
@@ -13,7 +13,7 @@

 #if SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSE42
     #include <immintrin.h>
-#elif defined(SK_CPU_ARM64) && defined(SK_ARM_HAS_CRC32)
+#elif defined(SK_ARM_HAS_CRC32)
     #include <arm_acle.h>
 #endif

@@ -127,7 +127,7 @@
         return hash;
     }

-#elif defined(SK_CPU_ARM64) && defined(SK_ARM_HAS_CRC32)
+#elif defined(SK_ARM_HAS_CRC32)
     static uint32_t hash_fn(const void* vdata, size_t bytes, uint32_t hash) {
         auto data = (const uint8_t*)vdata;
         if (bytes >= 24) {


usb: dwc3: gadget: use TRB type 6 for ISOC transfers

Type 6 should be used for the first transfer during an interval. This is
also what the reference driver is using. Type 7 seems to be for following
or additional transfers within the same interval.

Signed-off-by: Sebastian Andrzej Siewior <265264fed90bdf8e813a354375ec16f47ebdb1c5@linutronix.de>
Signed-off-by: Felipe Balbi <94dddeeef08b001e003cce128ddc162a4e2c6cd2@ti.com>

--- drivers/usb/dwc3/gadget.c
+++ drivers/usb/dwc3/gadget.c
@@ -632,7 +632,7 @@
 			break;

 		case USB_ENDPOINT_XFER_ISOC:
-			trb.trbctl = DWC3_TRBCTL_ISOCHRONOUS;
+			trb.trbctl = DWC3_TRBCTL_ISOCHRONOUS_FIRST;

 			/* IOC every DWC3_TRB_NUM / 4 so we can refill */
 			if (!(cur_slot % (DWC3_TRB_NUM / 4)))


USB: gadget: f_fs: use usb_string_ids_n()

Use usb_string_ids_n() function to simplify string ids
registeration.

Signed-off-by: Michal Nazarewicz <fad68416efb2dcf953403756bf832194ca95d084@samsung.com>
Signed-off-by: Kyungmin Park <504c23c4986a3760712724894be3105092c27331@samsung.com>
Signed-off-by: Greg Kroah-Hartman <4645f7897fd33786a2ee1264d590b3c400559d85@suse.de>


functionfs: unfuck failure exits on mount

* if you do dput() of root dentry, do *not* follow that with iput() of root
inode.
* while we are at it, don't do that dput() at all - you are leaving the pointer
in ->s_root and your ->kill_sb() will be very unhappy with that.  It will do
proper dput(), though, so the easiest way is to leave that to it entirely.
* freeing ->s_fs_info is also best left to ->kill_sb() (which will do it
anyway), especially since we leave the pointer in place.
* that xchg() in ->kill_sb() is not a bug per se, but it's a plain and simple
masturbation with fewer excuses than Onan had...

Signed-off-by: Al Viro <de609eb4d5d70b1d38ec6642adbfc33a2781f63c@zeniv.linux.org.uk>


USB: misc: adtux: clean up urb->status usage

This done in anticipation of removal of urb->status, which will make
that patch easier to review and apply in the future.

Signed-off-by: Greg Kroah-Hartman <4645f7897fd33786a2ee1264d590b3c400559d85@suse.de>

--- drivers/usb/misc/adutux.c
+++ drivers/usb/misc/adutux.c
@@ -179,17 +179,18 @@
 static void adu_interrupt_in_callback(struct urb *urb)
 {
 	struct adu_device *dev = urb->context;
-
-	dbg(4," %s : enter, status %d", __FUNCTION__, urb->status);
+	int status = urb->status;
+
+	dbg(4," %s : enter, status %d", __FUNCTION__, status);
 	adu_debug_data(5, __FUNCTION__, urb->actual_length,
 		       urb->transfer_buffer);

 	spin_lock(&dev->buflock);

-	if (urb->status != 0) {
-		if ((urb->status != -ENOENT) && (urb->status != -ECONNRESET)) {
+	if (status != 0) {
+		if ((status != -ENOENT) && (status != -ECONNRESET)) {
 			dbg(1," %s : nonzero status received: %d",
-			    __FUNCTION__, urb->status);
+			    __FUNCTION__, status);
 		}
 		goto exit;
 	}
@@ -217,21 +218,22 @@
 	wake_up_interruptible(&dev->read_wait);
 	adu_debug_data(5, __FUNCTION__, urb->actual_length,
 		       urb->transfer_buffer);
-	dbg(4," %s : leave, status %d", __FUNCTION__, urb->status);
+	dbg(4," %s : leave, status %d", __FUNCTION__, status);
 }

 static void adu_interrupt_out_callback(struct urb *urb)
 {
 	struct adu_device *dev = urb->context;
-
-	dbg(4," %s : enter, status %d", __FUNCTION__, urb->status);
+	int status = urb->status;
+
+	dbg(4," %s : enter, status %d", __FUNCTION__, status);
 	adu_debug_data(5,__FUNCTION__, urb->actual_length, urb->transfer_buffer);

-	if (urb->status != 0) {
-		if ((urb->status != -ENOENT) &&
-		    (urb->status != -ECONNRESET)) {
+	if (status != 0) {
+		if ((status != -ENOENT) &&
+		    (status != -ECONNRESET)) {
 			dbg(1, " %s :nonzero status received: %d",
-			    __FUNCTION__, urb->status);
+			    __FUNCTION__, status);
 		}
 		goto exit;
 	}
@@ -241,7 +243,7 @@

 	adu_debug_data(5, __FUNCTION__, urb->actual_length,
 		       urb->transfer_buffer);
-	dbg(4," %s : leave, status %d", __FUNCTION__, urb->status);
+	dbg(4," %s : leave, status %d", __FUNCTION__, status);
 }

 static int adu_open(struct inode *inode, struct file *file)


tcm_vhost: Use vq->private_data to indicate if the endpoint is setup

Currently, vs->vs_endpoint is used indicate if the endpoint is setup or
not. It is set or cleared in vhost_scsi_set_endpoint() or
vhost_scsi_clear_endpoint() under the vs->dev.mutex lock. However, when
we check it in vhost_scsi_handle_vq(), we ignored the lock.

Instead of using the vs->vs_endpoint and the vs->dev.mutex lock to
indicate the status of the endpoint, we use per virtqueue
vq->private_data to indicate it. In this way, we can only take the
vq->mutex lock which is per queue and make the concurrent multiqueue
process having less lock contention. Further, in the read side of
vq->private_data, we can even do not take the lock if it is accessed in
the vhost worker thread, because it is protected by "vhost rcu".

(nab: Do s/VHOST_FEATURES/~VHOST_SCSI_FEATURES)

Signed-off-by: Asias He <7487d0432e24c09ba3f2ff7de44b9eb030d5ae18@redhat.com>
Acked-by: Michael S. Tsirkin <255103e50249e3d658441816e0597170ebfc16ef@redhat.com>
Signed-off-by: Nicholas Bellinger <978acd1567d5598152161fdf8bf3ca568f950c9b@linux-iscsi.org>

--- drivers/vhost/tcm_vhost.c
+++ drivers/vhost/tcm_vhost.c
@@ -74,9 +74,8 @@

 struct vhost_scsi {
 	/* Protected by vhost_scsi->dev.mutex */
-	struct tcm_vhost_tpg *vs_tpg[VHOST_SCSI_MAX_TARGET];
+	struct tcm_vhost_tpg **vs_tpg;
 	char vs_vhost_wwpn[TRANSPORT_IQN_LEN];
-	bool vs_endpoint;

 	struct vhost_dev dev;
 	struct vhost_virtqueue vqs[VHOST_SCSI_MAX_VQ];
@@ -582,6 +581,7 @@
 static void vhost_scsi_handle_vq(struct vhost_scsi *vs,
 	struct vhost_virtqueue *vq)
 {
+	struct tcm_vhost_tpg **vs_tpg;
 	struct virtio_scsi_cmd_req v_req;
 	struct tcm_vhost_tpg *tv_tpg;
 	struct tcm_vhost_cmd *tv_cmd;
@@ -590,8 +590,16 @@
 	int head, ret;
 	u8 target;

-	/* Must use ioctl VHOST_SCSI_SET_ENDPOINT */
-	if (unlikely(!vs->vs_endpoint))
+	/*
+	 * We can handle the vq only after the endpoint is setup by calling the
+	 * VHOST_SCSI_SET_ENDPOINT ioctl.
+	 *
+	 * TODO: Check that we are running from vhost_worker which acts
+	 * as read-side critical section for vhost kind of RCU.
+	 * See the comments in struct vhost_virtqueue in drivers/vhost/vhost.h
+	 */
+	vs_tpg = rcu_dereference_check(vq->private_data, 1);
+	if (!vs_tpg)
 		return;

 	mutex_lock(&vq->mutex);
@@ -661,7 +669,7 @@

 		/* Extract the tpgt */
 		target = v_req.lun[1];
-		tv_tpg = ACCESS_ONCE(vs->vs_tpg[target]);
+		tv_tpg = ACCESS_ONCE(vs_tpg[target]);

 		/* Target does not exist, fail the request */
 		if (unlikely(!tv_tpg)) {
@@ -780,6 +788,20 @@
 	vhost_scsi_handle_vq(vs, vq);
 }

+static void vhost_scsi_flush_vq(struct vhost_scsi *vs, int index)
+{
+	vhost_poll_flush(&vs->dev.vqs[index].poll);
+}
+
+static void vhost_scsi_flush(struct vhost_scsi *vs)
+{
+	int i;
+
+	for (i = 0; i < VHOST_SCSI_MAX_VQ; i++)
+		vhost_scsi_flush_vq(vs, i);
+	vhost_work_flush(&vs->dev, &vs->vs_completion_work);
+}
+
 /*
  * Called from vhost_scsi_ioctl() context to walk the list of available
  * tcm_vhost_tpg with an active struct tcm_vhost_nexus
@@ -790,8 +812,10 @@
 {
 	struct tcm_vhost_tport *tv_tport;
 	struct tcm_vhost_tpg *tv_tpg;
+	struct tcm_vhost_tpg **vs_tpg;
+	struct vhost_virtqueue *vq;
+	int index, ret, i, len;
 	bool match = false;
-	int index, ret;

 	mutex_lock(&vs->dev.mutex);
 	/* Verify that ring has been setup correctly. */
@@ -803,6 +827,15 @@
 		}
 	}

+	len = sizeof(vs_tpg[0]) * VHOST_SCSI_MAX_TARGET;
+	vs_tpg = kzalloc(len, GFP_KERNEL);
+	if (!vs_tpg) {
+		mutex_unlock(&vs->dev.mutex);
+		return -ENOMEM;
+	}
+	if (vs->vs_tpg)
+		memcpy(vs_tpg, vs->vs_tpg, len);
+
 	mutex_lock(&tcm_vhost_mutex);
 	list_for_each_entry(tv_tpg, &tcm_vhost_list, tv_tpg_list) {
 		mutex_lock(&tv_tpg->tv_tpg_mutex);
@@ -817,14 +850,15 @@
 		tv_tport = tv_tpg->tport;

 		if (!strcmp(tv_tport->tport_name, t->vhost_wwpn)) {
-			if (vs->vs_tpg[tv_tpg->tport_tpgt]) {
+			if (vs->vs_tpg && vs->vs_tpg[tv_tpg->tport_tpgt]) {
 				mutex_unlock(&tv_tpg->tv_tpg_mutex);
 				mutex_unlock(&tcm_vhost_mutex);
 				mutex_unlock(&vs->dev.mutex);
+				kfree(vs_tpg);
 				return -EEXIST;
 			}
 			tv_tpg->tv_tpg_vhost_count++;
-			vs->vs_tpg[tv_tpg->tport_tpgt] = tv_tpg;
+			vs_tpg[tv_tpg->tport_tpgt] = tv_tpg;
 			smp_mb__after_atomic_inc();
 			match = true;
 		}
@@ -835,12 +869,26 @@
 	if (match) {
 		memcpy(vs->vs_vhost_wwpn, t->vhost_wwpn,
 		       sizeof(vs->vs_vhost_wwpn));
-		vs->vs_endpoint = true;
+		for (i = 0; i < VHOST_SCSI_MAX_VQ; i++) {
+			vq = &vs->vqs[i];
+			/* Flushing the vhost_work acts as synchronize_rcu */
+			mutex_lock(&vq->mutex);
+			rcu_assign_pointer(vq->private_data, vs_tpg);
+			mutex_unlock(&vq->mutex);
+		}
 		ret = 0;
 	} else {
 		ret = -EEXIST;
 	}

+	/*
+	 * Act as synchronize_rcu to make sure access to
+	 * old vs->vs_tpg is finished.
+	 */
+	vhost_scsi_flush(vs);
+	kfree(vs->vs_tpg);
+	vs->vs_tpg = vs_tpg;
+
 	mutex_unlock(&vs->dev.mutex);
 	return ret;
 }
@@ -851,6 +899,8 @@
 {
 	struct tcm_vhost_tport *tv_tport;
 	struct tcm_vhost_tpg *tv_tpg;
+	struct vhost_virtqueue *vq;
+	bool match = false;
 	int index, ret, i;
 	u8 target;

@@ -862,9 +912,14 @@
 			goto err_dev;
 		}
 	}
+
+	if (!vs->vs_tpg) {
+		mutex_unlock(&vs->dev.mutex);
+		return 0;
+	}
+
 	for (i = 0; i < VHOST_SCSI_MAX_TARGET; i++) {
 		target = i;
-
 		tv_tpg = vs->vs_tpg[target];
 		if (!tv_tpg)
 			continue;
@@ -886,10 +941,27 @@
 		}
 		tv_tpg->tv_tpg_vhost_count--;
 		vs->vs_tpg[target] = NULL;
-		vs->vs_endpoint = false;
+		match = true;
 		mutex_unlock(&tv_tpg->tv_tpg_mutex);
 	}
+	if (match) {
+		for (i = 0; i < VHOST_SCSI_MAX_VQ; i++) {
+			vq = &vs->vqs[i];
+			/* Flushing the vhost_work acts as synchronize_rcu */
+			mutex_lock(&vq->mutex);
+			rcu_assign_pointer(vq->private_data, NULL);
+			mutex_unlock(&vq->mutex);
+		}
+	}
+	/*
+	 * Act as synchronize_rcu to make sure access to
+	 * old vs->vs_tpg is finished.
+	 */
+	vhost_scsi_flush(vs);
+	kfree(vs->vs_tpg);
+	vs->vs_tpg = NULL;
 	mutex_unlock(&vs->dev.mutex);
+
 	return 0;

 err_tpg:
@@ -897,6 +969,24 @@
 err_dev:
 	mutex_unlock(&vs->dev.mutex);
 	return ret;
+}
+
+static int vhost_scsi_set_features(struct vhost_scsi *vs, u64 features)
+{
+	if (features & ~VHOST_SCSI_FEATURES)
+		return -EOPNOTSUPP;
+
+	mutex_lock(&vs->dev.mutex);
+	if ((features & (1 << VHOST_F_LOG_ALL)) &&
+	    !vhost_log_access_ok(&vs->dev)) {
+		mutex_unlock(&vs->dev.mutex);
+		return -EFAULT;
+	}
+	vs->dev.acked_features = features;
+	smp_wmb();
+	vhost_scsi_flush(vs);
+	mutex_unlock(&vs->dev.mutex);
+	return 0;
 }

 static int vhost_scsi_open(struct inode *inode, struct file *f)
@@ -936,38 +1026,6 @@
 	vhost_dev_stop(&s->dev);
 	vhost_dev_cleanup(&s->dev, false);
 	kfree(s);
-	return 0;
-}
-
-static void vhost_scsi_flush_vq(struct vhost_scsi *vs, int index)
-{
-	vhost_poll_flush(&vs->dev.vqs[index].poll);
-}
-
-static void vhost_scsi_flush(struct vhost_scsi *vs)
-{
-	int i;
-
-	for (i = 0; i < VHOST_SCSI_MAX_VQ; i++)
-		vhost_scsi_flush_vq(vs, i);
-	vhost_work_flush(&vs->dev, &vs->vs_completion_work);
-}
-
-static int vhost_scsi_set_features(struct vhost_scsi *vs, u64 features)
-{
-	if (features & ~VHOST_SCSI_FEATURES)
-		return -EOPNOTSUPP;
-
-	mutex_lock(&vs->dev.mutex);
-	if ((features & (1 << VHOST_F_LOG_ALL)) &&
-	    !vhost_log_access_ok(&vs->dev)) {
-		mutex_unlock(&vs->dev.mutex);
-		return -EFAULT;
-	}
-	vs->dev.acked_features = features;
-	smp_wmb();
-	vhost_scsi_flush(vs);
-	mutex_unlock(&vs->dev.mutex);
 	return 0;
 }


cleanup endpoint checks in the mmap file operation in the driver

git-svn-id: 29c1264a5cf5e3532df57b06678e7347571c1a3c@707 f1ba3bf5-cb5c-402b-92a9-7c6bdc83a356

--- driver/linux/omx_dev.c
+++ driver/linux/omx_dev.c
@@ -582,9 +582,7 @@
 	unsigned long offset = vma->vm_pgoff << PAGE_SHIFT;
 	unsigned long size = vma->vm_end - vma->vm_start;

-	if (endpoint == NULL)
-		return -EINVAL;
-
+	/* endpoint-less ioctl */
 	if (offset == OMX_DRIVER_DESC_FILE_OFFSET && size == PAGE_ALIGN(OMX_DRIVER_DESC_SIZE)) {
 		if (vma->vm_flags & (VM_WRITE|VM_MAYWRITE))
 			return -EPERM;
@@ -592,7 +590,13 @@
 		return omx_remap_vmalloc_range(vma, omx_driver_desc, 0);
 	}

-	else if (offset == OMX_SENDQ_FILE_OFFSET && size == OMX_SENDQ_SIZE)
+	/* the other ioctl require the endpoint to be open */
+	if (endpoint->status != OMX_ENDPOINT_STATUS_OK) {
+		printk(KERN_INFO "Open-MX: Cannot map endpoint resources from a closed endpoint\n");
+		return -EINVAL;
+	}
+
+	if (offset == OMX_SENDQ_FILE_OFFSET && size == OMX_SENDQ_SIZE)
 		return omx_remap_vmalloc_range(vma, endpoint->sendq,
 					       0);
 	else if (offset == OMX_RECVQ_FILE_OFFSET && size == OMX_RECVQ_SIZE)


increment region refcount by default so that we don't wakeup the closer uselessly

git-svn-id: 29c1264a5cf5e3532df57b06678e7347571c1a3c@472 f1ba3bf5-cb5c-402b-92a9-7c6bdc83a356

--- driver/linux/omx_reg.c
+++ driver/linux/omx_reg.c
@@ -143,7 +143,7 @@

 	rwlock_init(&region->lock);
 	region->status = OMX_USER_REGION_STATUS_OK;
-	atomic_set(&region->refcount, 0);
+	atomic_set(&region->refcount, 1);
 	init_waitqueue_head(&region->noref_queue);
 	region->total_length = 0;

@@ -228,6 +228,8 @@

 	/* mark it as closing so that nobody may use it again */
 	region->status = OMX_USER_REGION_STATUS_CLOSING;
+	/* release our refcount now that other users cannot use again */
+	atomic_dec(&region->refcount);

 	write_unlock_bh(&region->lock);
 	write_unlock_bh(&endpoint->user_regions_lock);


Typo fix

Typo fix

git-svn-id: ffc1bc5b3feaf8644044862cc38c386ade156493@2810 434f946d-2f3d-0410-ba4c-cb9f52fb0dbf

--- include/mesh/parallel_mesh.h
+++ include/mesh/parallel_mesh.h
@@ -144,7 +144,6 @@
    * Deletes all nonlocal elements of the mesh
    * except for "ghosts" which touch a local element, and deletes
    * all nodes which are not part of a local or ghost element
-   *
    */
   virtual void delete_remote_elements();


- fix error when returning abc values

- fix error when returning abc values

--- Drawable.c
+++ Drawable.c
@@ -313,14 +313,13 @@
    }

    if ( abc != nil) {
-      for ( i = 0; i <= first - last; i++) {
+      for ( i = 0; i <= last - first; i++) {
          av_push( av, newSVnv( abc[ i]. a));
          av_push( av, newSVnv( abc[ i]. b));
          av_push( av, newSVnv( abc[ i]. c));
       }
       free( abc);
    }
-
    return newRV_noinc(( SV *) av);
 }


check rdma_id before acquire a user region

git-svn-id: 29c1264a5cf5e3532df57b06678e7347571c1a3c@386 f1ba3bf5-cb5c-402b-92a9-7c6bdc83a356

--- driver/linux/omx_reg.c
+++ driver/linux/omx_reg.c
@@ -195,6 +195,8 @@
 	struct omx_user_region * region;

 	spin_lock(&endpoint->user_regions_lock);
+	if (rdma_id >= OMX_USER_REGION_MAX)
+		goto out_with_endpoint_lock;
 	region = endpoint->user_regions[rdma_id];
 	if (!region)
 		goto out_with_endpoint_lock;


slightly more logical client_raise() when client is not in current_tag

--- goomwwm.c
+++ goomwwm.c
@@ -1268,12 +1268,13 @@
 				&& client_has_state(o, netatoms[_NET_WM_STATE_STICKY]))
 					client_stack_family(o, stack);
 		}
-		// locate windows in one of our tags with _NET_WM_STATE_ABOVE
+		// locate windows in the current_tag with _NET_WM_STATE_ABOVE
+		// untagged windows with _NET_WM_STATE_ABOVE are effectively sticky
 		winlist_descend(inplay, i, w)
 		{
 			if (winlist_find(stack, w) < 0 && (o = window_client(w)) && o && o->visible
 				&& o->trans == None && client_has_state(o, netatoms[_NET_WM_STATE_ABOVE])
-				&& (!c->cache->tags || c->cache->tags & o->cache->tags))
+				&& (!c->cache->tags || current_tag & o->cache->tags))
 					client_stack_family(o, stack);
 		}
 		// locate _NET_WM_WINDOW_TYPE_DOCK windows


remove one excess printf()

remove one excess printf()

--- grabber.c
+++ grabber.c
@@ -43,7 +43,6 @@
   setitimer(ITIMER_REAL, &tmr, NULL);

   if(SETUP_STREAMS & SETUP_STREAM_RGB) {
-    printf("RGB\n");
     test_frame_rgb = malloc(SETUP_IMAGE_SIZE_RAW_RGB);
     memset(test_frame_rgb, 0, SETUP_IMAGE_SIZE_RAW_RGB);
   }


Added SetDirected

Added SetDirected

--- environments/GraphEnvironment.h
+++ environments/GraphEnvironment.h
@@ -121,6 +121,8 @@
 	void ApplyAction(graphState &s, graphMove a);
 	bool InvertAction(graphMove &a);

+	void SetDirected(bool b) {directed = b;}
+
 	OccupancyInterface<graphState, graphMove> *GetOccupancyInfo() { return 0; }
 	double HCost(graphState &state1, graphState &state2);
 	double GCost(graphState &state1, graphState &state2);


slightly longer health/mana bars

slightly longer health/mana bars

--- include/metaquest/terminal.h
+++ include/metaquest/terminal.h
@@ -94,7 +94,7 @@
                         out.to(-50, i)
                            .bar2c(h["HP/Current"], h["HP/Total"],
                                   h["MP/Current"], h["MP/Total"],
-                                  49,
+                                  50,
                                   1, 4)
                            .x(0)
                            .write(h.name.full(), 30);
@@ -107,7 +107,7 @@
                         out.to(-50, i)
                            .bar2c(p["HP/Current"], p["HP/Total"],
                                   p["MP/Current"], p["MP/Total"],
-                                  49,
+                                  50,
                                   1, 4)
                            .x(0)
                            .write(p.name.full(), 30);


drivers/acpi/thermal.c: fix build with CONFIG_DMI=n

drivers/acpi/thermal.c: In function 'acpi_thermal_init':
drivers/acpi/thermal.c:1794: error: 'thermal_dmi_table' undeclared (first use in this function)
drivers/acpi/thermal.c:1794: error: (Each undeclared identifier is reported only once
drivers/acpi/thermal.c:1794: error: for each function it appears in.)

Signed-off-by: Andrew Morton <5c1e68b099950c134891f0b6e179498a8ebe9cf9@linux-foundation.org>
Signed-off-by: Linus Torvalds <69652caca27c8b940640ad396ab71f93cacec34f@linux-foundation.org>

--- drivers/acpi/thermal.c
+++ drivers/acpi/thermal.c
@@ -1710,7 +1710,6 @@
 	return AE_OK;
 }

-#ifdef CONFIG_DMI
 static int thermal_act(const struct dmi_system_id *d) {

 	if (act == 0) {
@@ -1785,7 +1784,6 @@
 	},
 	{}
 };
-#endif /* CONFIG_DMI */

 static int __init acpi_thermal_init(void)
 {


WIP: Implement matrix stacks.

WIP: Implement matrix stacks.

--- include/pangolin/gl2engine.h
+++ include/pangolin/gl2engine.h
@@ -28,6 +28,8 @@
 #ifndef PANGOLIN_GL2ENGINE_H
 #define PANGOLIN_GL2ENGINE_H

+#include <stack>
+
 #include <pangolin/opengl_render_state.h>
 #include <pangolin/glsl.h>

@@ -69,8 +71,8 @@
     GlEngine()
     {
         // Initialise default state
-        projection = IdentityMatrix();
-        modelview = IdentityMatrix();
+        projection.push(IdentityMatrix());
+        modelview.push(IdentityMatrix());
         currentmatrix = &modelview;

         // Compile and link shaders
@@ -98,11 +100,11 @@

     void UpdateMatrices()
     {
-        OpenGlMatrix pmv = projection * modelview;
+        OpenGlMatrix pmv = projection.top() * modelview.top();
         GLint curprog;
         glGetIntegerv(GL_CURRENT_PROGRAM, &curprog);
         prog_fixed.Bind();
-        glUniformMatrix4fv( prog_fixed.GetUniformHandle("u_modelViewMatrix"), 1, false, modelview.m );
+        glUniformMatrix4fv( prog_fixed.GetUniformHandle("u_modelViewMatrix"), 1, false, modelview.top().m );
         glUniformMatrix4fv( prog_fixed.GetUniformHandle("u_modelViewProjectionMatrix"), 1, false, pmv.m );
         glUseProgram(curprog);
     }
@@ -117,9 +119,9 @@
     }

 //protected:
-    OpenGlMatrix projection;
-    OpenGlMatrix modelview;
-    OpenGlMatrix* currentmatrix;
+    std::stack<OpenGlMatrix> projection;
+    std::stack<OpenGlMatrix> modelview;
+    std::stack<OpenGlMatrix>* currentmatrix;

     GLenum matrixmode;

@@ -181,9 +183,9 @@
     if(cap == GL_VERTEX_ARRAY) {
         glEnableVertexAttribArray(0);
     }else if(cap == GL_COLOR_ARRAY) {
-        glEnableVertexAttribArray(3);
+        glEnableVertexAttribArray(1);
     }else if(cap == GL_NORMAL_ARRAY) {
-        glEnableVertexAttribArray(3);
+        glEnableVertexAttribArray(2);
     }else if(cap == GL_TEXTURE_COORD_ARRAY) {
         glEnableVertexAttribArray(3);
     }else{
@@ -196,9 +198,9 @@
     if(cap == GL_VERTEX_ARRAY) {
         glDisableVertexAttribArray(0);
     }else if(cap == GL_COLOR_ARRAY) {
-        glDisableVertexAttribArray(3);
+        glDisableVertexAttribArray(1);
     }else if(cap == GL_NORMAL_ARRAY) {
-        glDisableVertexAttribArray(3);
+        glDisableVertexAttribArray(2);
     }else if(cap == GL_TEXTURE_COORD_ARRAY) {
         glDisableVertexAttribArray(3);
     }else{
@@ -225,14 +227,14 @@
 inline void glLoadIdentity()
 {
     pangolin::GlEngine& gl = pangolin::glEngine();
-    *gl.currentmatrix = pangolin::IdentityMatrix();
+    gl.currentmatrix->top() = pangolin::IdentityMatrix();
     gl.UpdateMatrices();
 }

 inline void glLoadMatrixf(const GLfloat* m)
 {
     pangolin::GlEngine& gl = pangolin::glEngine();
-    pangolin::GLprecision* cm = gl.currentmatrix->m;
+    pangolin::GLprecision* cm = gl.currentmatrix->top().m;
     for(int i=0; i<16; ++i) cm[i] = (pangolin::GLprecision)m[i];
     gl.UpdateMatrices();
 }
@@ -240,7 +242,7 @@
 inline void glLoadMatrixd(const GLdouble* m)
 {
     pangolin::GlEngine& gl = pangolin::glEngine();
-    pangolin::GLprecision* cm = gl.currentmatrix->m;
+    pangolin::GLprecision* cm = gl.currentmatrix->top().m;
     for(int i=0; i<16; ++i) cm[i] = (pangolin::GLprecision)m[i];
     gl.UpdateMatrices();
 }
@@ -259,16 +261,36 @@
     print_error("Not Implemented: %s, %s, %d", __FUNCTION__, __FILE__, __LINE__);
 }

+inline void glPushMatrix(void)
+{
+    pangolin::GlEngine& gl = pangolin::glEngine();
+    gl.currentmatrix->push(gl.currentmatrix->top());
+}
+
+inline void glPopMatrix(void)
+{
+    pangolin::GlEngine& gl = pangolin::glEngine();
+    gl.currentmatrix->pop();
+    gl.UpdateMatrices();
+}
+
+inline void glTranslatef(GLfloat x, GLfloat y, GLfloat z )
+{
+    pangolin::GlEngine& gl = pangolin::glEngine();
+    pangolin::GLprecision* cm = gl.currentmatrix->top().m;
+    cm[3] += x;
+    cm[7] += y;
+    cm[11] += z;
+    gl.UpdateMatrices();
+}
+
 inline void glOrtho(
-    GLdouble l,
-    GLdouble r,
-    GLdouble b,
-    GLdouble t,
-    GLdouble n,
-    GLdouble f)
-{
-    pangolin::GlEngine& gl = pangolin::glEngine();
-    *gl.currentmatrix = pangolin::ProjectionMatrixOrthographic(l,r,b,t,b,f);
+    GLdouble l, GLdouble r,
+    GLdouble b, GLdouble t,
+    GLdouble n, GLdouble f)
+{
+    pangolin::GlEngine& gl = pangolin::glEngine();
+    gl.currentmatrix->top() = pangolin::ProjectionMatrixOrthographic(l,r,b,t,n,f);
     gl.UpdateMatrices();
 }

@@ -292,21 +314,6 @@
     print_error("Not Implemented: %s, %s, %d", __FUNCTION__, __FILE__, __LINE__);
 }

-inline void glPushMatrix(void)
-{
-    print_error("Not Implemented: %s, %s, %d", __FUNCTION__, __FILE__, __LINE__);
-}
-
-inline void glPopMatrix(void)
-{
-    print_error("Not Implemented: %s, %s, %d", __FUNCTION__, __FILE__, __LINE__);
-}
-
-inline void glTranslatef(GLfloat x, GLfloat y, GLfloat z )
-{
-    print_error("Not Implemented: %s, %s, %d", __FUNCTION__, __FILE__, __LINE__);
-}
-
 inline void glTexEnvf(	GLenum target,
     GLenum pname,
     GLfloat param)
@@ -314,14 +321,11 @@
     print_error("Not Implemented: %s, %s, %d", __FUNCTION__, __FILE__, __LINE__);
 }

+const GLubyte gNotErrorLookup[] = "XX";
 inline const GLubyte* gluErrorString(GLenum error)
 {
-    print_error("Not Implemented: %s, %s, %d", __FUNCTION__, __FILE__, __LINE__);
-    return 0;
-}
-
-
-
+    return gNotErrorLookup;
+}

 static void __gluMultMatrixVecf(const GLfloat matrix[16], const GLfloat in[4],
                                 GLfloat out[4])


drivers: dma: sam0: fix DMA to peripheral transfer on SAMD5x

We need to select TRIGACT_BLOCK for DMA to peripheral to work.

Signed-off-by: Benjamin Valentin <1876e1c5468f589edaf83253d033ba94c5f15c80@ml-pa.com>

--- drivers/dma/dma_sam0.c
+++ drivers/dma/dma_sam0.c
@@ -149,7 +149,7 @@
 				     DMAC_CHCTRLA_TRIGSRC(config->dma_slot);
 	} else {
 		/* One peripheral trigger per beat */
-		chcfg->CHCTRLA.reg = DMAC_CHCTRLA_TRIGACT_BURST |
+		chcfg->CHCTRLA.reg = DMAC_CHCTRLA_TRIGACT_BLOCK |
 				     DMAC_CHCTRLA_TRIGSRC(config->dma_slot);
 	}

@@ -160,22 +160,6 @@
 	}

 	chcfg->CHPRILVL.bit.PRILVL = config->channel_priority;
-
-	/* Set the burst length */
-	if (config->source_burst_length != config->dest_burst_length) {
-		LOG_ERR("Source and destination burst lengths must be equal");
-		goto inval;
-	}
-
-	if (config->source_burst_length > 16U) {
-		LOG_ERR("Invalid burst length");
-		goto inval;
-	}
-
-	if (config->source_burst_length > 0U) {
-		chcfg->CHCTRLA.reg |= DMAC_CHCTRLA_BURSTLEN(
-			config->source_burst_length - 1U);
-	}

 	/* Enable the interrupts */
 	chcfg->CHINTENSET.reg = DMAC_CHINTENSET_TCMPL;


GenericValue: add Erase function for object members

--- include/rapidjson/document.h
+++ include/rapidjson/document.h
@@ -850,6 +850,7 @@
 	/*! \param m member iterator (obtained by FindMember() or MemberBegin()).
 		\return the new iterator after removal.
 		\note Removing member is implemented by moving the last member. So the ordering of members is changed.
+		\note Use \ref Erase(ConstMemberIterator) instead, if you need to rely on a stable member ordering.
 	*/
 	MemberIterator RemoveMember(MemberIterator m) {
 		RAPIDJSON_ASSERT(IsObject());
@@ -868,6 +869,40 @@
 		}
 		--data_.o.size;
 		return m;
+	}
+
+	//! Remove a member from an object by iterator.
+	/*! \param pos iterator to the member to remove
+		\pre IsObject() == true && \ref MemberBegin() <= \c pos < \ref MemberEnd()
+		\return Iterator following the removed element.
+			If the iterator \c pos refers to the last element, the \ref MemberEnd() iterator is returned.
+		\note Other than \ref RemoveMember(MemberIterator), this function preserves the ordering of the members.
+	*/
+	MemberIterator Erase(ConstMemberIterator pos) {
+		return Erase(pos, pos +1);
+	}
+
+	//! Remove members in the range [first, last) from an object.
+	/*! \param first iterator to the first member to remove
+		\param last  iterator following the last member to remove
+		\pre IsObject() == true && \ref MemberBegin() <= \c first <= \c last <= \ref MemberEnd()
+		\return Iterator following the last removed element.
+		\note Other than \ref RemoveMember(MemberIterator), this function preserves the ordering of the members.
+	*/
+	MemberIterator Erase(ConstMemberIterator first, ConstMemberIterator last) {
+		RAPIDJSON_ASSERT(IsObject());
+		RAPIDJSON_ASSERT(data_.o.size > 0);
+		RAPIDJSON_ASSERT(data_.o.members != 0);
+		RAPIDJSON_ASSERT(first >= MemberBegin());
+		RAPIDJSON_ASSERT(first <= last);
+		RAPIDJSON_ASSERT(last <= MemberEnd());
+
+		MemberIterator pos = MemberBegin() + (first - MemberBegin());
+		for (MemberIterator itr = pos; ConstMemberIterator(itr) != last; ++itr)
+			itr->~Member();
+		memmove(&*pos, &*last, (ConstMemberIterator(MemberEnd()) - last) * sizeof(Member));
+		data_.o.size -= (last - first);
+		return pos;
 	}

 	//@}


dmaengine: omap: Split device_control

dmaengine: omap: Split device_control

Split the device_control callback of the TI OMAP DMA driver to make use
of the newly introduced callbacks, that will eventually be used to retrieve
slave capabilities.

Signed-off-by: Maxime Ripard <2d324f4ca95610bde432fa2af2f28cd21110687d@free-electrons.com>
Signed-off-by: Vinod Koul <5cf69c63beb17bf38d63aa0e923ee8256af0e205@intel.com>

--- drivers/dma/omap-dma.c
+++ drivers/dma/omap-dma.c
@@ -948,8 +948,10 @@
 	return vchan_tx_prep(&c->vc, &d->vd, flags);
 }

-static int omap_dma_slave_config(struct omap_chan *c, struct dma_slave_config *cfg)
-{
+static int omap_dma_slave_config(struct dma_chan *chan, struct dma_slave_config *cfg)
+{
+	struct omap_chan *c = to_omap_dma_chan(chan);
+
 	if (cfg->src_addr_width == DMA_SLAVE_BUSWIDTH_8_BYTES ||
 	    cfg->dst_addr_width == DMA_SLAVE_BUSWIDTH_8_BYTES)
 		return -EINVAL;
@@ -959,8 +961,9 @@
 	return 0;
 }

-static int omap_dma_terminate_all(struct omap_chan *c)
-{
+static int omap_dma_terminate_all(struct dma_chan *chan)
+{
+	struct omap_chan *c = to_omap_dma_chan(chan);
 	struct omap_dmadev *d = to_omap_dma_dev(c->vc.chan.device);
 	unsigned long flags;
 	LIST_HEAD(head);
@@ -996,8 +999,10 @@
 	return 0;
 }

-static int omap_dma_pause(struct omap_chan *c)
-{
+static int omap_dma_pause(struct dma_chan *chan)
+{
+	struct omap_chan *c = to_omap_dma_chan(chan);
+
 	/* Pause/Resume only allowed with cyclic mode */
 	if (!c->cyclic)
 		return -EINVAL;
@@ -1010,8 +1015,10 @@
 	return 0;
 }

-static int omap_dma_resume(struct omap_chan *c)
-{
+static int omap_dma_resume(struct dma_chan *chan)
+{
+	struct omap_chan *c = to_omap_dma_chan(chan);
+
 	/* Pause/Resume only allowed with cyclic mode */
 	if (!c->cyclic)
 		return -EINVAL;
@@ -1027,37 +1034,6 @@
 	}

 	return 0;
-}
-
-static int omap_dma_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd,
-	unsigned long arg)
-{
-	struct omap_chan *c = to_omap_dma_chan(chan);
-	int ret;
-
-	switch (cmd) {
-	case DMA_SLAVE_CONFIG:
-		ret = omap_dma_slave_config(c, (struct dma_slave_config *)arg);
-		break;
-
-	case DMA_TERMINATE_ALL:
-		ret = omap_dma_terminate_all(c);
-		break;
-
-	case DMA_PAUSE:
-		ret = omap_dma_pause(c);
-		break;
-
-	case DMA_RESUME:
-		ret = omap_dma_resume(c);
-		break;
-
-	default:
-		ret = -ENXIO;
-		break;
-	}
-
-	return ret;
 }

 static int omap_dma_chan_init(struct omap_dmadev *od, int dma_sig)
@@ -1136,7 +1112,10 @@
 	od->ddev.device_issue_pending = omap_dma_issue_pending;
 	od->ddev.device_prep_slave_sg = omap_dma_prep_slave_sg;
 	od->ddev.device_prep_dma_cyclic = omap_dma_prep_dma_cyclic;
-	od->ddev.device_control = omap_dma_control;
+	od->ddev.device_config = omap_dma_config;
+	od->ddev.device_pause = omap_dma_pause;
+	od->ddev.device_resume = omap_dma_resume;
+	od->ddev.device_terminate_all = omap_dma_terminate_all;
 	od->ddev.device_slave_caps = omap_dma_device_slave_caps;
 	od->ddev.dev = &pdev->dev;
 	INIT_LIST_HEAD(&od->ddev.channels);