Obsolete, now that xdrlib.py uses the new-and-improved struct module.

--- Modules/_xdrmodule.c
+++ Modules/_xdrmodule.c
@@ -1,193 +0,0 @@
-/* This module exports part of the C API to the XDR routines into Python.
- * XDR is Sun's eXternal Data Representation, as described in RFC 1014.
- * This module is used by xdrlib.py to support the float and double data
- * types which are too much of a pain to support in Python directly.  It is
- * not required by xdrlib.py -- when not available, these types aren't
- * supported at the Python layer.  Note that representations that can be
- * implemented solely in Python, are *not* reproduced here.
- *
- * Module version number: 1.0
- *
- * See xdrlib.py for usage notes.
- *
- * Note: this has so far, only been tested on Solaris 2.5 and IRIX 5.3.  On
- * these systems, you will need to link with -lnsl for these symbols to be
- * defined.
- */
-
-#include "Python.h"
-
-#include <rpc/rpc.h>
-#include <rpc/xdr.h>
-
-static PyObject* xdr_error;
-
-
--
-static PyObject*
-pack_float(self, args)
-        PyObject* self;
-        PyObject* args;
-{
-        XDR xdr;
-        float value;
-        union {                              /* guarantees proper alignment */
-                long dummy;
-                char buffer[4];
-        } addr;
-        PyObject* rtn = NULL;
-
-        if (!PyArg_ParseTuple(args, "f", &value))
-                return NULL;
-
-        xdr.x_ops = NULL;
-        xdrmem_create(&xdr, addr.buffer, 4, XDR_ENCODE);
-        if (xdr.x_ops == NULL)
-                PyErr_SetString(xdr_error,
-                                "XDR stream initialization failed.");
-        else if (xdr_float(&xdr, &value))
-                rtn = PyString_FromStringAndSize(addr.buffer, 4);
-        else
-                PyErr_SetString(xdr_error, "conversion from float failed");
-
-        xdr_destroy(&xdr);
-        return rtn;
-}
-
-
--
-static PyObject*
-pack_double(self, args)
-        PyObject* self;
-        PyObject* args;
-{
-        XDR xdr;
-        double value;
-        union {                              /* guarantees proper alignment */
-                long dummy;
-                char buffer[8];
-        } addr;
-        PyObject* rtn = NULL;
-
-        if (!PyArg_ParseTuple(args, "d", &value))
-                return NULL;
-
-        xdr.x_ops = NULL;
-        xdrmem_create(&xdr, addr.buffer, 8, XDR_ENCODE);
-        if (xdr.x_ops == NULL)
-                PyErr_SetString(xdr_error,
-                                "XDR stream initialization failed.");
-        else if (xdr_double(&xdr, &value))
-                rtn = PyString_FromStringAndSize(addr.buffer, 8);
-        else
-                PyErr_SetString(xdr_error, "conversion from double failed");
-
-        xdr_destroy(&xdr);
-        return rtn;
-}
-
-
--
-static PyObject*
-unpack_float(self, args)
-        PyObject* self;
-        PyObject* args;
-{
-        XDR xdr;
-        float value;
-        char* string;
-        int strlen;
-        PyObject* rtn = NULL;
-
-        if (!PyArg_ParseTuple(args, "s#", &string, &strlen))
-                return NULL;
-
-        if (strlen != 4) {
-                PyErr_SetString(PyExc_ValueError, "4 byte string expected");
-                return NULL;
-        }
-
-        /* Python guarantees that the string is 4 byte aligned */
-        xdr.x_ops = NULL;
-        xdrmem_create(&xdr, (caddr_t)string, 4, XDR_DECODE);
-        if (xdr.x_ops == NULL)
-                PyErr_SetString(xdr_error,
-                                "XDR stream initialization failed.");
-        else if (xdr_float(&xdr, &value))
-                rtn = Py_BuildValue("f", value);
-        else
-                PyErr_SetString(xdr_error, "conversion to float failed");
-
-        xdr_destroy(&xdr);
-        return rtn;
-}
-
-
--
-static PyObject*
-unpack_double(self, args)
-        PyObject* self;
-        PyObject* args;
-{
-        XDR xdr;
-        double value;
-        char* string;
-        int strlen;
-        PyObject* rtn = NULL;
-
-        if (!PyArg_ParseTuple(args, "s#", &string, &strlen))
-                return NULL;
-
-        if (strlen != 8) {
-                PyErr_SetString(PyExc_ValueError, "8 byte string expected");
-                return NULL;
-        }
-
-        /* Python guarantees that the string is 4 byte aligned */
-        xdr.x_ops = NULL;
-        xdrmem_create(&xdr, (caddr_t)string, 8, XDR_DECODE);
-        if (xdr.x_ops == NULL)
-                PyErr_SetString(xdr_error,
-                                "XDR stream initialization failed.");
-        else if (xdr_double(&xdr, &value))
-                rtn = Py_BuildValue("d", value);
-        else
-                PyErr_SetString(xdr_error, "conversion to double failed");
-
-        xdr_destroy(&xdr);
-        return rtn;
-}
-
-
--
-static struct PyMethodDef
-xdr_methods[] = {
-        {"pack_float",    pack_float,    1},
-        {"pack_double",   pack_double,   1},
-        {"unpack_float",  unpack_float,  1},
-        {"unpack_double", unpack_double, 1},
-        {NULL,          NULL,       0}           /* sentinel */
-};
-
-
--
-void
-init_xdr()
-{
-        PyObject* module;
-        PyObject* dict;
-
-        module = Py_InitModule("_xdr", xdr_methods);
-        dict = PyModule_GetDict(module);
-
-        xdr_error = PyString_FromString("_xdr.error");
-        PyDict_SetItemString(dict, "error", xdr_error);
-        if (PyErr_Occurred())
-                Py_FatalError("can't initialize module _xdr");
-}


fix pwm all command

fix pwm all command

--- firmware-src/sources/commands/pwm_cmd.c
+++ firmware-src/sources/commands/pwm_cmd.c
@@ -21,7 +21,7 @@
 	gpio_command_params info;
 	ALLOWED_FIELDS fields = 0;
 	const char *err_msg = parse_params_pins_set(params, params_len,
-			&info, DH_ADC_SUITABLE_PINS, 0,
+			&info, DH_GPIO_SUITABLE_PINS, 0,
 			AF_VALUES | AF_PERIOD | AF_COUNT, &fields);

 	if (err_msg != 0) {


tests/rbwriter: don't ignore write failure

Here's another fix.
In adjusting the printf, I added a cast and switched to %5ld.
I would have preferred to use %5jd as the printf format (i.e., then no
cast is needed), but saw no other uses of the "j" directive, so perhaps
you do not yet depend on printf with such support.

From 6d5d3af35d1f6851537f7af8996d1106c1ebe435 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering@redhat.com>
Date: Wed, 18 Jul 2012 17:54:38 +0200
Subject: [PATCH] tests/rbwriter: don't ignore write failure

Spotted by coverity:
This less-than-zero comparison of an unsigned value is never true.
"res < 0U".
http://libqb.org/html/0.14.1/coverity/1/7rbwriter.c.html#error

Signed-off-by: Angus Salkeld <86b65304d27d8de73dd7d624c33df7e088f8d94b@redhat.com>

--- tests/rbwriter.c
+++ tests/rbwriter.c
@@ -65,10 +65,10 @@
 }

 static void
-_benchmark(int write_size)
+_benchmark(ssize_t write_size)
 {
 	struct timeval tv1, tv2, tv_elapsed;
-	unsigned int res;
+	ssize_t res;
 	int write_count = 0;

 	alarm_notice = 0;
@@ -89,7 +89,7 @@
 	timersub (&tv2, &tv1, &tv_elapsed);

 	printf ("%5d messages sent ", write_count);
-	printf ("%5d bytes per write ", write_size);
+	printf ("%5ld bytes per write ", (long int) write_size);
 	printf ("%7.3f Seconds runtime ",
 		(tv_elapsed.tv_sec + (tv_elapsed.tv_usec / 1000000.0)));
 	printf ("%9.3f TP/s ",


tests: Add return value check in checkUserInfo

Commit 1c8113f9c added the call to virTypedParamsGetString without
a return value check which caused Coverity to complain especially
since other checks for the same function are made.

Found by Coverity

Signed-off-by: John Ferlan <87558058f6f829e5ec976c8ef960720af4ff9c7d@redhat.com>
Reviewed-by: Daniel P. Berrangé <bb938cf255e055ff3507f2627d214e8e62118fcf@redhat.com>

--- tests/qemuagenttest.c
+++ tests/qemuagenttest.c
@@ -1127,7 +1127,9 @@

     snprintf(param_name, VIR_TYPED_PARAM_FIELD_LENGTH,
              "user.%zu.domain", nth);
-    virTypedParamsGetString(params, nparams, param_name, &domain);
+    if (virTypedParamsGetString(params, nparams, param_name, &domain) < 0)
+        return -1;
+
     if (STRNEQ_NULLABLE(expDomain, domain)) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
                        "Expected domain '%s', got '%s'",


tests: skip qemublocktest if building without YAJL

If no JSON parser is available qemublocktest fails, so skip its execution.

Signed-off-by: Daniel P. Berrangé <bb938cf255e055ff3507f2627d214e8e62118fcf@redhat.com>

--- tests/qemublocktest.c
+++ tests/qemublocktest.c
@@ -19,17 +19,19 @@
 #include <stdlib.h>

 #include "testutils.h"
-#include "testutilsqemu.h"
-#include "testutilsqemuschema.h"
-#include "virstoragefile.h"
-#include "virstring.h"
-#include "virlog.h"
-#include "qemu/qemu_block.h"
-#include "qemu/qemu_qapi.h"
-
-#include "qemu/qemu_command.h"
-
-#define VIR_FROM_THIS VIR_FROM_NONE
+
+#if WITH_YAJL
+# include "testutilsqemu.h"
+# include "testutilsqemuschema.h"
+# include "virstoragefile.h"
+# include "virstring.h"
+# include "virlog.h"
+# include "qemu/qemu_block.h"
+# include "qemu/qemu_qapi.h"
+
+# include "qemu/qemu_command.h"
+
+# define VIR_FROM_THIS VIR_FROM_NONE

 VIR_LOG_INIT("tests.storagetest");

@@ -355,7 +357,7 @@

     virTestCounterReset("qemu storage source xml->json->xml ");

-#define TEST_JSON_FORMAT(tpe, xmlstr) \
+# define TEST_JSON_FORMAT(tpe, xmlstr) \
     do { \
         xmljsonxmldata.type = tpe; \
         xmljsonxmldata.xml = xmlstr; \
@@ -364,7 +366,7 @@
             ret = -1; \
     } while (0)

-#define TEST_JSON_FORMAT_NET(xmlstr)\
+# define TEST_JSON_FORMAT_NET(xmlstr) \
     TEST_JSON_FORMAT(VIR_STORAGE_TYPE_NETWORK, xmlstr)

     TEST_JSON_FORMAT(VIR_STORAGE_TYPE_FILE, "<source file='/path/to/file'/>\n");
@@ -417,7 +419,7 @@
                          "  <host name='example.com' port='9999'/>\n"
                          "</source>\n");

-#define TEST_DISK_TO_JSON_FULL(nme, fl) \
+# define TEST_DISK_TO_JSON_FULL(nme, fl) \
     do { \
         diskxmljsondata.name = nme; \
         diskxmljsondata.props = NULL; \
@@ -435,7 +437,7 @@
         testQemuDiskXMLToPropsClear(&diskxmljsondata); \
     } while (0)

-#define TEST_DISK_TO_JSON(nme) TEST_DISK_TO_JSON_FULL(nme, false)
+# define TEST_DISK_TO_JSON(nme) TEST_DISK_TO_JSON_FULL(nme, false)

     if (!(diskxmljsondata.schema = testQEMUSchemaLoad())) {
         ret = -1;
@@ -500,4 +502,12 @@
     return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
 }

+#else
+static int
+mymain(void)
+{
+    return EXIT_AM_SKIP;
+}
+#endif
+
 VIR_TEST_MAIN(mymain)


Add a test case for the improper reporting of a failure of the "Entity Declared" WFC fixed in lib/xmlparse.c 1.65.

--- tests/runtests.c
+++ tests/runtests.c
@@ -503,6 +503,19 @@
         "<test a='&foo;'/>";

     XML_SetUnknownEncodingHandler(parser, UnknownEncodingHandler, NULL);
+    if (XML_Parse(parser, text, strlen(text), 1) == XML_STATUS_ERROR)
+        xml_failure(parser);
+}
+END_TEST
+
+/* Test that no error is reported for unknown entities if we don't
+   read an external subset.  This was fixed in Expat 1.95.5.
+*/
+START_TEST(test_wfc_declared_entity_unread_external_subset) {
+    char *text =
+        "<!DOCTYPE doc SYSTEM 'foo'>\n"
+        "<doc>&entity;</doc>";
+
     if (XML_Parse(parser, text, strlen(text), 1) == XML_STATUS_ERROR)
         xml_failure(parser);
 }
@@ -690,6 +703,7 @@
     tcase_add_test(tc_basic, test_attr_whitespace_normalization);
     tcase_add_test(tc_basic, test_xmldecl_misplaced);
     tcase_add_test(tc_basic, test_unknown_encoding_internal_entity);
+    tcase_add_test(tc_basic, test_wfc_declared_entity_unread_external_subset);

     suite_add_tcase(s, tc_namespace);
     tcase_add_checked_fixture(tc_namespace,


increase stack size when TSAN is enabled

Reviewed By: meyering

Differential Revision: D5757469

fbshipit-source-id: ad70c47251993c79a502d30f312534e28c9241d4

--- folly/fibers/FiberManagerInternal-inl.h
+++ folly/fibers/FiberManagerInternal-inl.h
@@ -37,8 +37,9 @@
 namespace {

 inline FiberManager::Options preprocessOptions(FiberManager::Options opts) {
-#if defined(FOLLY_SANITIZE_ADDRESS) || defined(UNDEFINED_SANITIZER)
-  /* ASAN/UBSAN needs a lot of extra stack space.
+#if defined(FOLLY_SANITIZE_ADDRESS) || defined(UNDEFINED_SANITIZER) || \
+    defined(FOLLY_SANITIZE_THREAD)
+  /* Sanitizers need a lot of extra stack space.
      16x is a conservative estimate, 8x also worked with tests
      where it mattered.  Note that overallocating here does not necessarily
      increase RSS, since unused memory is pretty much free. */


Revert "MinGW does not provide setenv"

Revert "MinGW does not provide setenv"

This reverts commit b018a362eb45b6ac7854a6d9925586cd8ace52bd.

--- tests/resolve_table.c
+++ tests/resolve_table.c
@@ -20,19 +20,7 @@
     if (!(test))      \
       result = 1;     \
   } while(0)          \
-
-
-static void setTablePath(const char *value) {
-#ifdef HAVE_SETENV
-  setenv("LOUIS_TABLEPATH", value, 1);
-#else
-  int len = strlen("LOUIS_TABLEPATH") + 1 + strlen(value) + 1;
-  char *str = (char *)malloc(len * sizeof(char));
-  sprintf(str, "LOUIS_TABLEPATH=%s", value);
-  putenv(str);
-#endif
-}
-
+
 int
 main(int argc, char **argv)
 {
@@ -70,18 +58,18 @@
   if (chdir(TEST_SRC_DIR)) return 1;

   // Full path
-  setTablePath ("");
+  setenv ("LOUIS_TABLEPATH", "", 1);
   ASSERT (lou_getTable ("tables/resolve_table/table_1"));

   // File name not on LOUIS_TABLEPATH
   ASSERT (!lou_getTable ("table_1"));

   // File name on LOUIS_TABLEPATH
-  setTablePath ("tables/resolve_table");
+  setenv ("LOUIS_TABLEPATH", "tables/resolve_table", 1);
   ASSERT (lou_getTable ("table_1"));

   // First is full path, second is in same directory
-  setTablePath ("");
+  setenv ("LOUIS_TABLEPATH", "", 1);
   ASSERT (lou_getTable ("tables/resolve_table/table_1,"
 			"table_2"));

@@ -95,31 +83,31 @@

   // First is full path, second is on LOUIS_TABLEPATH, third is in same
   // directory as first
-  setTablePath ("tables/resolve_table/dir_2");
+  setenv ("LOUIS_TABLEPATH", "tables/resolve_table/dir_2", 1);
   ASSERT (lou_getTable ("tables/resolve_table/dir_1/table_1.1,"
 			"table_2.1,"
 			"table_1.2"));

   // First is full path, second is in subdirectory
-  setTablePath ("");
+  setenv ("LOUIS_TABLEPATH", "", 1);
   ASSERT (lou_getTable ("tables/resolve_table/table_1,"
 			"dir_1/table_1.1"));

   // Two file names in different directories, but both on LOUIS_TABLEPATH
-  setTablePath ("tables/resolve_table/dir_1,"
-			     "tables/resolve_table/dir_2");
+  setenv ("LOUIS_TABLEPATH", "tables/resolve_table/dir_1,"
+			     "tables/resolve_table/dir_2", 1);
   ASSERT (lou_getTable ("table_1.2,"
 			"table_2.1"));

   // First is file name on LOUIS_TABLEPATH, second is full path, third is in
   // same directory as second
-  setTablePath ("tables/resolve_table");
+  setenv ("LOUIS_TABLEPATH", "tables/resolve_table", 1);
   ASSERT (!lou_getTable ("table_1,"
 			 "tables/resolve_table/dir_1/table_1.1,"
 			 "table_1.2"));

   // Full path, include table in same directory
-  setTablePath ("");
+  setenv ("LOUIS_TABLEPATH", "", 1);
   ASSERT (lou_getTable ("tables/resolve_table/table_3"));

   // Full path, include table in subdirectory
@@ -135,11 +123,11 @@

   // Full path, include table in subdirectory, from there include table on
   // LOUIS_TABLEPATH
-  setTablePath ("tables/resolve_table");
+  setenv ("LOUIS_TABLEPATH", "tables/resolve_table", 1);
   ASSERT (lou_getTable ("tables/resolve_table/table_5"));

   // Full path, include table in subdirectory of LOUIS_TABLEPATH
-  setTablePath ("tables/resolve_table/dir_1");
+  setenv ("LOUIS_TABLEPATH", "tables/resolve_table/dir_1", 1);
   ASSERT (lou_getTable ("tables/resolve_table/table_6"));

   lou_free();


Removed example functions

Removed example functions


when splitting the interleaved data, we need to take care of the _real_ channel layout

--- libambix/src/libambix.c
+++ libambix/src/libambix.c
@@ -309,13 +309,13 @@
     realframes=_ambix_readf_##type(ambix, adaptorbuffer, frames);       \
     switch(ambix->use_matrix) {                                         \
     case 1:                                                             \
-      _ambix_splitAdaptormatrix_##type(adaptorbuffer, ambix->info.ambichannels+ambix->info.extrachannels, &ambix->matrix          , ambidata, otherdata, realframes); \
+      _ambix_splitAdaptormatrix_##type(adaptorbuffer, ambix->realinfo.ambichannels+ambix->realinfo.extrachannels, &ambix->matrix          , ambidata, otherdata, realframes); \
       break;                                                            \
     case 2:                                                             \
-      _ambix_splitAdaptormatrix_##type(adaptorbuffer, ambix->info.ambichannels+ambix->info.extrachannels, &ambix->matrix2         , ambidata, otherdata, realframes); \
+      _ambix_splitAdaptormatrix_##type(adaptorbuffer, ambix->realinfo.ambichannels+ambix->realinfo.extrachannels, &ambix->matrix2         , ambidata, otherdata, realframes); \
       break;                                                            \
     default:                                                            \
-      _ambix_splitAdaptor_##type      (adaptorbuffer, ambix->info.ambichannels+ambix->info.extrachannels, ambix->info.ambichannels, ambidata, otherdata, realframes); \
+      _ambix_splitAdaptor_##type      (adaptorbuffer, ambix->realinfo.ambichannels+ambix->realinfo.extrachannels, ambix->realinfo.ambichannels, ambidata, otherdata, realframes); \
     };                                                                  \
     return realframes;                                                  \
   }


fixed small bug!

fixed small bug!

--- apps/localsensingsearch/FLRTAStar.h
+++ apps/localsensingsearch/FLRTAStar.h
@@ -93,16 +93,16 @@
 			for (typename LearnedStateData::const_iterator it = stateData.begin(); it != stateData.end(); it++)
 			{
 				const learnedStateData<state> *s = &((*it).second);
-				if ((s->dead) && ((s.children->size() > 0) || s.children->size() > 0))
+				if ((s->dead) && ((s->children->size() > 0) || s->children->size() > 0))
 				{
 					std::cout << s->theState << " is dead but has parents and/or children " << std::endl;
 				}
-				for (unsigned int x = 0; x < s.children->size(); x++)
+				for (unsigned int x = 0; x < s->children->size(); x++)
 				{
 					bool found = false;
-					for (int y = 0; y < stateData[m_pEnv->GetStateHash(s.children->at(x))].parents->size(); y++)
+					for (int y = 0; y < stateData[m_pEnv->GetStateHash(s->children->at(x))].parents->size(); y++)
 					{
-						if (stateData[m_pEnv->GetStateHash(s.children->at(x))]->parents[y] == s->theState)
+						if (stateData[m_pEnv->GetStateHash(s->children->at(x))].parents->at(y) == s->theState)
 						{
 							found = true;
 							break;
@@ -110,7 +110,7 @@
 					}
 					if (!found)
 					{
-						std::cout << s->theState << " lists " << s.children->at(x) << " as child, but the child doesn't list the parent" << std::endl;
+						std::cout << s->theState << " lists " << s->children->at(x) << " as child, but the child doesn't list the parent" << std::endl;
 					}
 				}

@@ -146,6 +146,7 @@
 			theState.theState = where;
 			theState.dead = true;
 //			}
+//			VerifyParentChildren();
 		}

 		bool IsDead(const state &where)
@@ -712,30 +713,30 @@
 		for (unsigned int x = 0; x < neighbors->size(); x++)
 		{
 			nodesTouched++;
-			double edgeCost = m_pEnv->GCost(next, (*neighbors)[x]);
+			double edgeCost = m_pEnv->GCost(next, neighbors->at(x));
 			uint64_t childKey;
-			//std::cout << "Hashing state:10 " << std::endl << (*neighbors)[x] << std::endl;
-			dataLocation cLoc = aoc.Lookup(m_pEnv->GetStateHash((*neighbors)[x]), childKey);
+			//std::cout << "Hashing state:10 " << std::endl << neighbors->at(x) << std::endl;
+			dataLocation cLoc = aoc.Lookup(m_pEnv->GetStateHash(neighbors->at(x)), childKey);

 			if (alsoExpand && pLoc != kNotFound)
 			{
 				if (cLoc == kNotFound) // add node even if it is dead!
 				{
-					double cost = min(GCost(next)+edgeCost, GCost((*neighbors)[x]));
-
-					if (verbose) std::cout << "Adding " << (*neighbors)[x] << " to open with f:" <<
-						aoc.Lookat(parentKey).g+edgeCost + HCost((*neighbors)[x], to) << std::endl;
-					aoc.AddOpenNode((*neighbors)[x], m_pEnv->GetStateHash((*neighbors)[x]),
+					double cost = min(GCost(next)+edgeCost, GCost(neighbors->at(x)));
+
+					if (verbose) std::cout << "Adding " << neighbors->at(x) << " to open with f:" <<
+						aoc.Lookat(parentKey).g+edgeCost + HCost(neighbors->at(x), to) << std::endl;
+					aoc.AddOpenNode(neighbors->at(x), m_pEnv->GetStateHash(neighbors->at(x)),
 									aoc.Lookat(parentKey).g+edgeCost,
 									//cost,
-									HCost((*neighbors)[x], to), parentKey);
+									HCost(neighbors->at(x), to), parentKey);
 					cLoc = kOpenList;
 				}
 				else if (cLoc == kOpenList)
 				{   // these are local g costs
 					if (fless(aoc.Lookup(parentKey).g+edgeCost, aoc.Lookup(childKey).g))
 					{
-						if (verbose) std::cout << "Updating " << (*neighbors)[x] << " on open" << std::endl;
+						if (verbose) std::cout << "Updating " << neighbors->at(x) << " on open" << std::endl;
 						aoc.Lookup(childKey).parentID = parentKey;
 						aoc.Lookup(childKey).g = aoc.Lookup(parentKey).g+edgeCost;
 						aoc.KeyChanged(childKey);
@@ -745,7 +746,7 @@
 				{
 					if (fless(aoc.Lookup(parentKey).g+edgeCost, aoc.Lookup(childKey).g))
 					{
-						if (verbose) std::cout << "Reopening " << (*neighbors)[x] << std::endl;
+						if (verbose) std::cout << "Reopening " << neighbors->at(x) << std::endl;
 						aoc.Lookup(childKey).parentID = parentKey;
 						aoc.Lookup(childKey).g = aoc.Lookup(parentKey).g+edgeCost;
 						aoc.Reopen(childKey);
@@ -754,55 +755,56 @@
 				}
 			}

-			// shorter g-cost to (*neighbors)[x] from global search perspective
+			// shorter g-cost to neighbors->at(x) from global search perspective
 			assert(GCost(next) != DBL_MAX);
 			// TODO: handle equal case:
-			if (!IsDead((*neighbors)[x]) && fequal(GCost(next)+edgeCost, GCost((*neighbors)[x])))
-			{
-				AddParent(next, (*neighbors)[x]);
-				AddChild(next, (*neighbors)[x]);
-			}
-			if (fless(GCost(next)+edgeCost, GCost((*neighbors)[x])))
-			{
-				if (verbose) std::cout << "Updating " << (*neighbors)[x] << " from " << GCost((*neighbors)[x]) <<
+			if (!IsDead(neighbors->at(x)) && fequal(GCost(next)+edgeCost, GCost(neighbors->at(x))))
+			{
+				AddParent(next, neighbors->at(x));
+				AddChild(next, neighbors->at(x));
+			}
+			if (fless(GCost(next)+edgeCost, GCost(neighbors->at(x))))
+			{
+				if (verbose) std::cout << "Updating " << neighbors->at(x) << " from " << GCost(neighbors->at(x)) <<
 					" to " << GCost(next) << "(" << next << ") + " << edgeCost << " = " << GCost(next)+edgeCost << std::endl;
-				if (IsDead((*neighbors)[x]) && (cLoc == kClosedList)) // important step in proof!
+				if (IsDead(neighbors->at(x)) && (cLoc == kClosedList)) // important step in proof!
 				{
 					// node was dead. If this is on the optimal path, it needs to be opened
 					cLoc = kOpenList;
 					aoc.Reopen(childKey);
-					SetGCost(m_pEnv, (*neighbors)[x], GCost(next)+edgeCost);
+					SetGCost(m_pEnv, neighbors->at(x), GCost(next)+edgeCost);
 					//TODO:
-					AddParent(next, (*neighbors)[x]);
-					AddChild(next, (*neighbors)[x]);
-					PropagateGCosts((*neighbors)[x], to, true);
+					AddParent(next, neighbors->at(x));
+					AddChild(next, neighbors->at(x));
+					PropagateGCosts(neighbors->at(x), to, true);
 				}
 				else {
-					SetGCost(m_pEnv, (*neighbors)[x], GCost(next)+edgeCost);
+					SetGCost(m_pEnv, neighbors->at(x), GCost(next)+edgeCost);
 					//TODO:
-					AddParent(next, (*neighbors)[x]);
-					AddChild(next, (*neighbors)[x]);
+					AddParent(next, neighbors->at(x));
+					AddChild(next, neighbors->at(x));
 					//if (cLoc == kClosedList)
 					if (alsoExpand || (cLoc == kOpenList || cLoc == kClosedList))
-						PropagateGCosts((*neighbors)[x], to, false);
+						PropagateGCosts(neighbors->at(x), to, false);
 				}
 			}
 //			// shorter g-cost from neighbor to here, reverse search
 //			//std::cout << "GCost state:9 " << std::endl << next << neighbors[x] << std::endl;
-			if (fless(edgeCost+GCost((*neighbors)[x]), GCost(next)))
-			{
-				//assert(!IsDead((*neighbors)[x]));
-				//LivenState((*neighbors)[x]); // would need to put back on open, but happens elsewhere. [simplify later?]
+
+			if (fless(edgeCost+GCost(neighbors->at(x)), GCost(next)) && !IsDead(neighbors->at(x)))
+			{
+				//assert(!IsDead(neighbors->at(x)));
+				//LivenState(neighbors->at(x)); // would need to put back on open, but happens elsewhere. [simplify later?]
 				if (verbose) std::cout << "[Recursing to] Update " << next << " from " << GCost(next) <<
-					" to " << GCost((*neighbors)[x]) << "(" << (*neighbors)[x] << ") + " << edgeCost << " = " << GCost((*neighbors)[x])+edgeCost << std::endl;
-				SetGCost(m_pEnv, next, GCost((*neighbors)[x])+edgeCost);
+					" to " << GCost(neighbors->at(x)) << "(" << neighbors->at(x) << ") + " << edgeCost << " = " << GCost(neighbors->at(x))+edgeCost << std::endl;
+				SetGCost(m_pEnv, next, GCost(neighbors->at(x))+edgeCost);
 				//TODO:
-				if (!IsDead((*neighbors)[x]))
-				{
-					AddParent((*neighbors)[x], next);
-					AddChild((*neighbors)[x], next);
+				if (!IsDead(neighbors->at(x)))
+				{
+					AddParent(neighbors->at(x), next);
+					AddChild(neighbors->at(x), next);
 //					if (cLoc == kOpenList || cLoc == kClosedList)
-//						PropagateGCosts((*neighbors)[x], to, false);
+//						PropagateGCosts(neighbors->at(x), to, false);
 				}
 				if (x != 0) x = -1;
 			}
@@ -814,6 +816,7 @@
 	template <class state, class action, class environment>
 	void FLRTAStar<state, action, environment>::MarkDeadRedundant(environment *env, const state &goal)
 	{
+//		VerifyParentChildren();
 //		std::vector<state> othersToKill;
 //		unsigned int openSize = aoc.size();
 //		for (unsigned int x = 0; x < openSize; x++)


Added code from matgui

Added code from matgui

--- unittest.h
+++ unittest.h
@@ -20,11 +20,32 @@
 extern const char* test_file_name;
 static std::map<std::string, std::string> test_results;

-inline int runTests(){
+inline int runTests(int argc, char **argv){
 	using std::cout;
 	using std::endl;
 	int numFailed = 0;
 	int numSucceded = 0;
+
+	//Let the user choose test from command line
+	if (argc > 1) {
+		if (std::string(argv[1]) == "-l") {
+			cout << "available tests:" << endl;
+			for (auto it: testMap) {
+				cout << it.first << endl;
+			}
+			return 0;
+		}
+
+		auto tmpMap = std::move(testMap);
+		for (auto i = 1; i < argc; ++i) {
+			auto f = tmpMap.find(argv[i]);
+			if (f != tmpMap.end()) {
+				auto testName = argv[i];
+				testMap[testName] = f->second;
+			}
+		}
+	}
+
 	cout << "==== Starts test suit " << test_file_name <<  " ====" << endl << endl;

 	for (auto it: testMap){
@@ -101,7 +122,7 @@
 //Remember to return 0 on success!!!
 #define TEST_CASE(name) ; testMap[name] = []() -> void

-#define TEST_SUIT_END ; } int main() { initTests(); return runTests(); }
+#define TEST_SUIT_END ; } int main(int argc, char **argv) { initTests(); return runTests(argc, argv); }

 #define PRINT_INFO std::cout << __FILE__ << ":" << __LINE__ << ": " ;
 #define ASSERT(x, error) if (!(x)) { PRINT_INFO; test_result ++; std::cout << #x << ": " << error << std::endl; return; }


Check weight and slant validity in font provider

When adding a new font, check that weight and slant are valid. If
they're not, use reasonable defaults.

--- libass/ass_fontselect.c
+++ libass/ass_fontselect.c
@@ -62,7 +62,7 @@
     int n_fullname;

     int slant;
-    int weight;
+    int weight;         // TrueType scale, 100-900

     // how to access this face
     char *path;
@@ -175,10 +175,20 @@
                            unsigned int index, void *data)
 {
     int i;
+    int weight, slant;
     ASS_FontSelector *selector = provider->parent;
     ASS_FontInfo *info;

     // TODO: sanity checks. do we have a path or valid get_face function?
+
+    weight = meta->weight;
+    slant  = meta->slant;
+
+    // check slant/weight for validity, use defaults if they're invalid
+    if (weight < 100 || weight > 900)
+        meta->weight = 400;
+    if (slant < 0 || slant > 110)
+        slant = 0;

     // check size
     if (selector->n_font >= selector->alloc_font) {
@@ -194,8 +204,8 @@
     // set uid
     info->uid = selector->uid++;

-    info->slant       = meta->slant;
-    info->weight      = meta->weight;
+    info->slant       = slant;
+    info->weight      = weight;
     info->family      = strdup(meta->family);
     info->n_fullname  = meta->n_fullname;
     info->fullnames   = calloc(meta->n_fullname, sizeof(char *));


- fix font name parsing routine

- fix font name parsing routine

--- unix/xft.c
+++ unix/xft.c
@@ -35,14 +35,20 @@

 /*

+   USAGE
+   -----
+   To use specific Xft fonts, set Prima font names in your X resource
+   database in fontconfig formats - for example, Palatino-12. Consult
+   'man fontconfig' for the syntax, but be aware that Prima uses only
+   size, weight, and name fields.
+
+   IMPLEMENTATION NOTES
+   --------------------
+
    This implementations doesn't work with non-scalable Xft fonts,
    since their rasterization capabilities are currently ( June 2003) very limited -
    no scaling and no rotation. Plus, the selection of the non-scalable fonts is
    a one big something, and I believe that one in apc_font.c is enough.
-
-   Not implemented features:
-    - the full set of raster operations - not supported by xft ( stupid )
-    - apc_show_message - probably never will

    The following Xft/fontconfig problems, if fixed in th next versions, need to be
    taken into the consideration:
@@ -56,6 +62,15 @@
      - no text strikeout / underline drawing routines
      - produces xlib failures for large polygons - answered to be a Xrender bug;
        the X error handler catches this now.
+
+   TO DO
+   -----
+    - The full set of raster operations - not supported by xft ( stupid )
+    - apc_show_message - probably never will be implemented though
+    - Investigate if ICONV can be replaced by native perl's ENCODE interface
+    - Under some circumstances Xft decides to put antialiasing aside, for
+      example, on the paletted displays. Check, if some heuristics that would
+      govern whether Xft is to be used there, are needed.

  */

@@ -346,7 +361,6 @@
    f = *dest;
    by_size = Drawable_font_add( self, source, &f);
    pixel_size = f. height;
-   /* printf("want %d.%d.%d.%d.%s\n", key.height, key. width, key.style, key.pitch, key.name); */

    if ( guts. xft_disable_large_fonts > 0) {
       /* xft is unable to deal with large polygon requests.
@@ -361,6 +375,7 @@
    /* see if the font is not present in xft - the hashed negative matches
          are stored with width=0, as the width alterations are derived */
    xft_build_font_key( &key, &f, by_size);
+   /* printf("want %d.%d.%d.%d.%s\n", key.height, key. width, key.style, key.pitch, key.name); */

    key. width = 0;
    if ( hash_fetch( mismatch, &key, sizeof( FontKey))) {
@@ -1013,11 +1028,11 @@
                                          guts. visual. visual, guts. defaultColormap);
       XftDrawSetSubwindowMode( XX-> xft_drawable,
          ( self == application) ? IncludeInferiors : ClipByChildren);
-      if ( !XX-> flags. xft_clip) {
-         XftDrawSetClip( XX-> xft_drawable, XX-> current_region);
-         XX-> flags. xft_clip = 1;
-      }
       XCHECKPOINT;
+   }
+   if ( !XX-> flags. xft_clip) {
+      XftDrawSetClip( XX-> xft_drawable, XX-> current_region);
+      XX-> flags. xft_clip = 1;
    }

    /* convert text string to unicode */
@@ -1232,30 +1247,37 @@
 {
    FcPattern * p = FcNameParse( ppFontNameSize);
    FcCharSet * c = nil;
-   bzero( font, sizeof( Font));
-   font-> height = font-> width = font-> size = C_NUMERIC_UNDEF;
-   fcpattern2font( p, font);
-   font-> width = C_NUMERIC_UNDEF;
+   Font f, def = guts. default_font;
+
+   bzero( &f, sizeof( Font));
+   f. height = f. width = f. size = C_NUMERIC_UNDEF;
+   fcpattern2font( p, &f);
+   f. width = C_NUMERIC_UNDEF;
    FcPatternGetCharSet( p, FC_CHARSET, 0, &c);
    if ( c && (FcCharSetCount(c) > 0)) {
       int i;
       for ( i = 0; i < MAX_CHARSET; i++) {
           if ( !std_charsets[i]. enabled) continue;
           if ( FcCharSetIntersectCount( std_charsets[i]. fcs, c) >= std_charsets[i]. glyphs - 1) {
-             strcpy( font-> encoding, std_charsets[i]. name);
+             strcpy( f. encoding, std_charsets[i]. name);
              break;
           }
       }
    }
    FcPatternDestroy( p);
-   prima_xft_font_pick( nilHandle, &guts. default_font, font, nil);
+   if ( ! prima_xft_font_pick( nilHandle, &f, &def, nil)) return false;
+   def. width = 0;
+   *font = def;
    return true;
 }

 void
 prima_xft_set_region( Handle self, Region region)
 {
-   if ( X(self)-> xft_drawable)
-      XftDrawSetClip( X(self)-> xft_drawable, region);
-}
-
+   DEFXX;
+   if ( XX-> xft_drawable) {
+      XftDrawSetClip( XX-> xft_drawable, region);
+      XX-> flags. xft_clip = 1;
+   }
+}
+


r8523/sofa-dev : FIX: MultiVec

r8523/sofa-dev : FIX: MultiVec

--- framework/sofa/core/behavior/MultiVec.h
+++ framework/sofa/core/behavior/MultiVec.h
@@ -129,7 +129,7 @@
     double norm()
     {
         vop->v_dot(v, v);
-        return sqrt( parent->finish() );
+        return sqrt( vop->finish() );
     }

     /// v = a


socketcalls.c: prefer using recvfrom in recv and sendto in send

Make socketcall the last alternative.

Signed-off-by: Peter S. Mazinger <1f4071d9f342c1637b13af9bc258f2ff72e96758@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <ce1ac9e9ad16abccd7821f371ad381197b4768ac@gmail.com>

--- libc/inet/socketcalls.c
+++ libc/inet/socketcalls.c
@@ -267,6 +267,11 @@
 	return result;
 #endif
 }
+#elif defined(__NR_recvfrom)
+ssize_t __libc_recv(int sockfd, __ptr_t buffer, size_t len, int flags)
+{
+	return (recvfrom(sockfd, buffer, len, flags, NULL, NULL));
+}
 #elif defined(__NR_socketcall)
 /* recv, recvfrom added by bir7@leland.stanford.edu */
 ssize_t __libc_recv(int sockfd, __ptr_t buffer, size_t len, int flags)
@@ -287,11 +292,6 @@
 	LIBC_CANCEL_RESET (oldtype);
 	return result;
 #endif
-}
-#elif defined(__NR_recvfrom)
-ssize_t __libc_recv(int sockfd, __ptr_t buffer, size_t len, int flags)
-{
-	return (recvfrom(sockfd, buffer, len, flags, NULL, NULL));
 }
 #endif
 weak_alias(__libc_recv,recv)
@@ -407,6 +407,11 @@
 	return result;
 #endif
 }
+#elif defined(__NR_sendto)
+ssize_t __libc_send(int sockfd, const void *buffer, size_t len, int flags)
+{
+	return (sendto(sockfd, buffer, len, flags, NULL, 0));
+}
 #elif defined(__NR_socketcall)
 /* send, sendto added by bir7@leland.stanford.edu */
 ssize_t __libc_send(int sockfd, const void *buffer, size_t len, int flags)
@@ -429,11 +434,6 @@
 #endif
 }

-#elif defined(__NR_sendto)
-ssize_t __libc_send(int sockfd, const void *buffer, size_t len, int flags)
-{
-	return (sendto(sockfd, buffer, len, flags, NULL, 0));
-}
 #endif
 weak_alias(__libc_send,send)
 libc_hidden_weak(send)


unsocket.c: deal with messages that do not have an fd cmsg

--- unsocket.c
+++ unsocket.c
@@ -119,8 +119,11 @@
 	if((nrd = recvmsg(fd, &msg, 0)) == -1)
 		return -1;

-	cmsg = CMSG_FIRSTHDR(&msg);
-	memcpy(passfdp, CMSG_DATA(cmsg), sizeof *passfdp);
+	if((cmsg = CMSG_FIRSTHDR(&msg)) != NULL){
+		memcpy(passfdp, CMSG_DATA(cmsg), sizeof *passfdp);
+	} else {
+		*passfdp = -1;
+	}

 	return nrd;
 }


Fix some silly bugs and type problems

Fix some silly bugs and type problems

--- libc/inet/socketcalls.c
+++ libc/inet/socketcalls.c
@@ -32,7 +32,6 @@
 #ifdef __NR_accept
 #define __NR___libc_accept  __NR_accept
 _syscall3(int, __libc_accept, int, call, struct sockaddr *, addr, socklen_t *,addrlen);
-weak_alias(__libc_accept, accept);
 #else
 int __libc_accept(int s, struct sockaddr *addr, socklen_t * addrlen)
 {
@@ -83,7 +82,7 @@

 #ifdef L_getpeername
 #ifdef __NR_getpeername
-_syscall3(int, getpeername, int, sockfd, struct, sockaddr *, addr, socklen_t *,paddrlen);
+_syscall3(int, getpeername, int, sockfd, struct sockaddr *, addr, socklen_t *,paddrlen);
 #else
 int getpeername(int sockfd, struct sockaddr *addr, socklen_t * paddrlen)
 {
@@ -99,7 +98,7 @@

 #ifdef L_getsockname
 #ifdef __NR_getsockname
-_syscall3(int, getsockname, int, sockfd, struct, sockaddr *, addr, socklen_t *,paddrlen);
+_syscall3(int, getsockname, int, sockfd, struct sockaddr *, addr, socklen_t *,paddrlen);
 #else
 int getsockname(int sockfd, struct sockaddr *addr, socklen_t * paddrlen)
 {
@@ -150,10 +149,10 @@
 #ifdef L_recv
 #ifdef __NR_recv
 #define __NR___libc_recv __NR_recv
-_syscall4(int, __libc_recv, int, sockfd, __ptr_t, buffer, size_t, len, int, flags);
+_syscall4(ssize_t, __libc_recv, int, sockfd, __ptr_t, buffer, size_t, len, int, flags);
 #else
 /* recv, recvfrom added by bir7@leland.stanford.edu */
-int __libc_recv(int sockfd, __ptr_t buffer, size_t len, int flags)
+ssize_t __libc_recv(int sockfd, __ptr_t buffer, size_t len, int flags)
 {
 	unsigned long args[4];

@@ -170,11 +169,11 @@
 #ifdef L_recvfrom
 #ifdef __NR_recvfrom
 #define __NR___libc_recvfrom __NR_recvfrom
-_syscall6(int, __libc_recvfrom, int, sockfd, __ptr_t, buffer, size_t, len, int, flags,
+_syscall6(ssize_t, __libc_recvfrom, int, sockfd, __ptr_t, buffer, size_t, len, int, flags,
 	struct sockaddr *, to, socklen_t *, tolen);
 #else
 /* recv, recvfrom added by bir7@leland.stanford.edu */
-int __libc_recvfrom(int sockfd, __ptr_t buffer, size_t len, int flags,
+ssize_t __libc_recvfrom(int sockfd, __ptr_t buffer, size_t len, int flags,
 		 struct sockaddr *to, socklen_t * tolen)
 {
 	unsigned long args[6];
@@ -194,9 +193,9 @@
 #ifdef L_recvmsg
 #ifdef __NR_recvmsg
 #define __NR___libc_recvmsg __NR_recvmsg
-_syscall3(int, __libc_recvmsg, int, sockfd, struct msghdr *, msg, int, flags);
-#else
-int __libc_recvmsg(int sockfd, struct msghdr *msg, int flags)
+_syscall3(ssize_t, __libc_recvmsg, int, sockfd, struct msghdr *, msg, int, flags);
+#else
+ssize_t __libc_recvmsg(int sockfd, struct msghdr *msg, int flags)
 {
 	unsigned long args[3];

@@ -212,10 +211,10 @@
 #ifdef L_send
 #ifdef __NR_send
 #define __NR___libc_send    __NR_send
-_syscall4(int, __libc_send, int, sockfd, const void *, buffer, size_t, len, int, flags);
+_syscall4(ssize_t, __libc_send, int, sockfd, const void *, buffer, size_t, len, int, flags);
 #else
 /* send, sendto added by bir7@leland.stanford.edu */
-int __libc_send(int sockfd, const void *buffer, size_t len, int flags)
+ssize_t __libc_send(int sockfd, const void *buffer, size_t len, int flags)
 {
 	unsigned long args[4];

@@ -232,9 +231,9 @@
 #ifdef L_sendmsg
 #ifdef __NR_sendmsg
 #define __NR___libc_sendmsg __NR_sendmsg
-_syscall3(int, __libc_sendmsg, int, sockfd, const struct msghdr *, msg, int, flags);
-#else
-int __libc_sendmsg(int sockfd, const struct msghdr *msg, int flags)
+_syscall3(ssize_t, __libc_sendmsg, int, sockfd, const struct msghdr *, msg, int, flags);
+#else
+ssize_t __libc_sendmsg(int sockfd, const struct msghdr *msg, int flags)
 {
 	unsigned long args[3];

@@ -250,11 +249,11 @@
 #ifdef L_sendto
 #ifdef __NR_sendto
 #define __NR___libc_sendto  __NR_sendto
-_syscall6(int, __libc_sendto, int, sockfd, const void *, buffer, size_t, len,
+_syscall6(ssize_t, __libc_sendto, int, sockfd, const void *, buffer, size_t, len,
 	int, flags, const struct sockaddr *, to, socklen_t, tolen);
 #else
 /* send, sendto added by bir7@leland.stanford.edu */
-int __libc_sendto(int sockfd, const void *buffer, size_t len, int flags,
+ssize_t __libc_sendto(int sockfd, const void *buffer, size_t len, int flags,
 	   const struct sockaddr *to, socklen_t tolen)
 {
 	unsigned long args[6];


Avoid deleting default move constructor of SortedCollectExecutor (#8778)

--- arangod/Aql/SortedCollectExecutor.h
+++ arangod/Aql/SortedCollectExecutor.h
@@ -142,6 +142,7 @@
     bool _shouldDeleteBuilderBuffer;

     CollectGroup() = delete;
+    CollectGroup(CollectGroup&&) = default;
     CollectGroup(CollectGroup const&) = delete;
     CollectGroup& operator=(CollectGroup const&) = delete;


Fix issue with optimization in previous commit

--- libharp/harp-variable.c
+++ libharp/harp-variable.c
@@ -166,7 +166,7 @@
         return -1;
     }

-    needs_shuffle = 0;
+    needs_shuffle = num_dim_elements != variable->dimension[dim_index];
     for (i = 0; i < num_dim_elements; i++)
     {
         if (dim_element_ids[i] < 0 || dim_element_ids[i] >= variable->dimension[dim_index])


libkd: create&use macros for referencing large arrays

--- libkd/kdtree_internal.c
+++ libkd/kdtree_internal.c
@@ -140,6 +140,11 @@

 // Get a pointer to the 'i'-th data point.
 #define KD_DATA(kd, D, i) ((kd)->data.DTYPE + ((size_t)(D)*(size_t)(i)))
+
+// Dereference an array of dimension D at element i, dimension d.
+#define KD_ARRAY_VAL(arr, D, i, d) ((arr)[(((size_t)(D)*(size_t)(i)) + (size_t)(d))])
+
+#define KD_ARRAY_REF(arr, D, i, d) ((arr) + (((size_t)(D)*(size_t)(i)) + (size_t)(d)))

 // Get the 'i'-th element of the permutation vector, or 'i' if there is no permutation vector.
 #define KD_PERM(kd, i) ((kd)->perm ? (kd)->perm[i] : i)
@@ -1510,9 +1515,9 @@
             parr[il] = parr[ir];                        \
             parr[ir] = tmpperm;                         \
             { int d; for (d=0; d<D; d++) {              \
-                    tmpdata[0] = arr[(size_t)(il)*(size_t)D+(size_t)d]; \
-                    arr[(size_t)(il)*(size_t)D+(size_t)d] = arr[(size_t)(ir)*(size_t)D+(size_t)d]; \
-                    arr[(size_t)(il)*(size_t)D+(size_t)d] = tmpdata[0]; }}}}
+                    tmpdata[0] = KD_ARRAY_VAL(arr, D, il, d);           \
+                    *KD_ARRAY_REF(arr, D, il, d) = KD_ARRAY_VAL(arr, D, ir, d); \
+                    *KD_ARRAY_REF(arr, D, ir, d) = tmpdata[0]; }}}}
 #else
 #define ELEM_SWAP(il, ir) {                                     \
         if ((il) != (ir)) {                                     \
@@ -1520,9 +1525,9 @@
             assert(tmpperm != -1);                              \
             parr[il] = parr[ir];                                \
             parr[ir] = tmpperm;                                 \
-            memcpy(tmpdata,    arr+(size_t)(il)*(size_t)D, D*sizeof(dtype));    \
-            memcpy(arr+(size_t)(il)*(size_t)D, arr+(size_t)(ir)*(size_t)D, D*sizeof(dtype));    \
-            memcpy(arr+(size_t)(ir)*(size_t)D, tmpdata,    D*sizeof(dtype)); }}
+            memcpy(tmpdata,                     KD_ARRAY_REF(arr, D, il, 0), D*sizeof(dtype)); \
+            memcpy(KD_ARRAY_REF(arr, D, il, 0), KD_ARRAY_REF(arr, D, ir, 0), D*sizeof(dtype)); \
+            memcpy(KD_ARRAY_REF(arr, D, ir, 0), tmpdata,                     D*sizeof(dtype)); }}
 #endif
 #define ELEM_ROT(iA, iB, iC) {                                  \
         tmpperm  = parr[iC];                                    \
@@ -1530,10 +1535,10 @@
         parr[iB] = parr[iA];                                    \
         parr[iA] = tmpperm;                                     \
         assert(tmpperm != -1);                                  \
-        memcpy(tmpdata,    arr+(size_t)(iC)*(size_t)D, D*sizeof(dtype)); \
-        memcpy(arr+(size_t)(iC)*(size_t)D, arr+(size_t)(iB)*(size_t)D, D*sizeof(dtype));        \
-        memcpy(arr+(size_t)(iB)*(size_t)D, arr+(size_t)(iA)*(size_t)D, D*sizeof(dtype));        \
-        memcpy(arr+(size_t)(iA)*(size_t)D, tmpdata,    D*sizeof(dtype)); }
+        memcpy(tmpdata,                     KD_ARRAY_REF(arr, D, iC, 0), D*sizeof(dtype)); \
+        memcpy(KD_ARRAY_REF(arr, D, iC, 0), KD_ARRAY_REF(arr, D, iB, 0), D*sizeof(dtype)); \
+        memcpy(KD_ARRAY_REF(arr, D, iB, 0), KD_ARRAY_REF(arr, D, iA, 0), D*sizeof(dtype)); \
+        memcpy(KD_ARRAY_REF(arr, D, iA, 0), tmpdata,                     D*sizeof(dtype)); }

 static void kdtree_quickselect_partition(dtype *arr, unsigned int *parr,
                                          int L, int R, int D, int d,
@@ -2356,14 +2361,15 @@
             m = (1+left+right)/2;

             /* Make sure sort works */
-            for(xx=left; xx<=right-1; xx++) {
-                assert(data[D*xx+d] <= data[D*(xx+1)+d]);
+            for(xx=left; xx<=right-1; xx++) {
+                assert(KD_ARRAY_VAL(data, D, xx,   d) <=
+                       KD_ARRAY_VAL(data, D, xx+1, d));
             }

             /* Encode split dimension and value. */
             /* "s" is the location of the splitting plane in the "tree"
              data type. */
-            s = POINT_DT(kd, d, data[D*m+d], KD_ROUND);
+            s = POINT_DT(kd, d, KD_ARRAY_VAL(data, D, m, d), KD_ROUND);

             if (kd->split.any) {
                 /* If we are using the "split" array to store both the
@@ -2379,17 +2385,17 @@
             qsplit = POINT_TD(kd, d, s);

             /* Play games to make sure we properly partition the data */
-            while (m < right && data[D*m+d] < qsplit) m++;
-            while (left < m  && qsplit < data[D*(m-1)+d]) m--;
+            while (m < right && KD_ARRAY_VAL(data, D, m, d) < qsplit) m++;
+            while (left < m  && qsplit < KD_ARRAY_VAL(data, D, m-1, d)) m--;

             /* Even more sanity */
             assert(m >= -1);
             assert(left <= m);
             assert(m <= right);
             for (xx=left; m && xx<=m-1; xx++)
-                assert(data[D*xx+d] <= qsplit);
+                assert(KD_ARRAY_VAL(data, D, xx, d) <= qsplit);
             for (xx=m; xx<=right; xx++)
-                assert(qsplit <= data[D*xx+d]);
+                assert(qsplit <= KD_ARRAY_VAL(data, D, xx, d));

         } else {
             /* "m-1" becomes R of the left child;
@@ -2404,19 +2410,21 @@
             assert(m <= right);
             kdtree_quickselect_partition(data, kd->perm, left, right, D, dim, m);

-            s = POINT_DT(kd, d, data[D*m+d], KD_ROUND);
+            s = POINT_DT(kd, d, KD_ARRAY_VAL(data, D, m, d), KD_ROUND);

             assert(m != 0);
             assert(left <= (m-1));
             assert(m <= right);
             for (xx=left; xx<=m-1; xx++)
-                assert(data[D*xx+d] <= data[D*m+d]);
+                assert(KD_ARRAY_VAL(data, D, xx, d) <=
+                       KD_ARRAY_VAL(data, D, m, d));
             for (xx=left; xx<=m-1; xx++)
-                assert(data[D*xx+d] <= s);
+                assert(KD_ARRAY_VAL(data, D, xx, d) <= s);
             for (xx=m; xx<=right; xx++)
-                assert(data[D*m+d] <= data[D*xx+d]);
+                assert(KD_ARRAY_VAL(data, D, m, d) <=
+                       KD_ARRAY_VAL(data, D, xx, d));
             for (xx=m; xx<=right; xx++)
-                assert(s <= data[D*xx+d]);
+                assert(s <= KD_ARRAY_VAL(data, D, xx, d));
         }

         if (kd->split.any) {


removing a TODO

removing a TODO

TEST= run in chrome.

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

git-svn-id: 721b910a23eff8a86f00c8fd261a7587cddf18f8@3531 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2

--- tests/srpc/srpc_shm.c
+++ tests/srpc/srpc_shm.c
@@ -31,7 +31,9 @@
     map_addr = mmap(0, size, PROT_READ | PROT_WRITE, MAP_SHARED, desc, 0);
     if (MAP_FAILED == map_addr) {
       printf("GetShmHandle: mmap failed\n");
-      /* TODO(sehr): close handle */
+      if (close(desc) < 0) {
+        printf("GetShmHandle: close failed\n");
+      }
       desc = -1;
     }
   } else {
@@ -43,7 +45,7 @@
 }

 /*
- * GetInvalidHandle creates and returns a shared memory region.
+ * GetInvalidHandle returns an invalid shared memory descriptor.
  */
 NaClSrpcError GetInvalidHandle(NaClSrpcChannel *channel,
                                NaClSrpcArg **in_args,


Reimplemented as virtual table

Reimplemented as virtual table

--- uriparse.c
+++ uriparse.c
@@ -1,37 +1,208 @@
-#include <string.h>
-
 #include <uriparser/Uri.h>

 #include <sqlite3ext.h>
 SQLITE_EXTENSION_INIT1

-static void uriparse_host_func(sqlite3_context* context, int argc, sqlite3_value** argv)
-{
-	UriParserStateA state;
-	UriUriA uri;
-	state.uri = &uri;
-	const char* text = sqlite3_value_text(argv[0]);
-	if(uriParseUriA(&state, text) == URI_SUCCESS)
-	{
-		const char* begin = uri.hostText.first, * end = uri.hostText.afterLast;
-		const size_t len = end - begin;
-		char* res = sqlite3_malloc(len + 1);
-		memcpy(res, begin, len);
-		res[len] = '\0';
-		sqlite3_result_text(context, res, -1, sqlite3_free);
-	}
-	else
-		sqlite3_result_null(context);
-	uriFreeUriMembersA(&uri);
-}
+#ifndef SQLITE_OMIT_VIRTUALTABLE
+
+enum Columns {
+    COLUMN_SCHEME = 0,
+    COLUMN_USERINFO = 1,
+    COLUMN_HOST = 2,
+    COLUMN_PORT = 3,
+    COLUMN_PATH = 4,
+    COLUMN_QUERY = 5,
+    COLUMN_FRAGMENT = 6,
+    COLUMN_URI = 7
+};
+
+typedef struct uriparse_cursor uriparse_cursor;
+struct uriparse_cursor
+{
+    sqlite3_vtab_cursor base;
+
+    char* text;
+    UriUriA uri;
+};
+
+
+static int uriparse_connect(sqlite3* db, void* pAux,
+    int argc, const char* const* argv,
+    sqlite3_vtab** ppVTab,
+    char** pzErr)
+{
+    int rc = sqlite3_declare_vtab(db,
+        "create table x (scheme, userinfo, host, port, path, query, fragment, uri hidden)");
+    if(rc == SQLITE_OK)
+    {
+        sqlite3_vtab* pNew = *ppVTab = sqlite3_malloc(sizeof(*pNew));
+        if(!pNew)
+            return SQLITE_NOMEM;
+        memset(pNew, 0, sizeof(*pNew));
+        sqlite3_vtab_config(db, SQLITE_VTAB_INNOCUOUS);
+    }
+    return rc;
+}
+
+static int uriparse_best_index(sqlite3_vtab* tab, sqlite3_index_info* pIdxInfo)
+{
+    for(int i = 0; i < pIdxInfo->nConstraint; ++i)
+    {
+        const struct sqlite3_index_constraint* c = pIdxInfo->aConstraint + i;
+        if(!c->usable)
+            return SQLITE_CONSTRAINT;
+        if(c->iColumn == COLUMN_URI && c->op == SQLITE_INDEX_CONSTRAINT_EQ)
+        {
+            pIdxInfo->aConstraintUsage[i].argvIndex = i + 1;
+            pIdxInfo->aConstraintUsage[i].omit = 1;
+        }
+    }
+#if SQLITE_VERSION_NUMBER >= 3008002
+    pIdxInfo->estimatedRows = 1;
+#endif
+    return SQLITE_OK;
+}
+
+static int uriparse_disconnect(sqlite3_vtab* pVtab)
+{
+    sqlite3_free(pVtab);
+    return SQLITE_OK;
+}
+
+static int uriparse_open(sqlite3_vtab* p, sqlite3_vtab_cursor** ppCursor)
+{
+    uriparse_cursor* pCur = sqlite3_malloc(sizeof(*pCur));
+    if(!pCur)
+        return SQLITE_NOMEM;
+    memset(pCur, 0, sizeof(*pCur));
+    *ppCursor = &pCur->base;
+    pCur->text = NULL;
+    return SQLITE_OK;
+}
+
+static int uriparse_close(sqlite3_vtab_cursor* cur)
+{
+    sqlite3_free(cur);
+    return SQLITE_OK;
+}
+
+static int uriparse_filter(sqlite3_vtab_cursor* pVtabCursor,
+    int idxNum, const char* idxStr, int argc, sqlite3_value** argv)
+{
+    if(argc != 1)
+        return SQLITE_ERROR;
+
+    uriparse_cursor* cursor = (uriparse_cursor*)pVtabCursor;
+    const char* text = sqlite3_value_text(argv[0]);
+    if(uriParseSingleUriA(&cursor->uri, text, NULL) == URI_SUCCESS)
+    {
+        cursor->text = sqlite3_malloc(sqlite3_value_bytes(argv[0]) + 1);
+        strcpy(cursor->text, text);
+    }
+
+    return SQLITE_OK;
+}
+
+static int uriparse_next(sqlite3_vtab_cursor* pCursor)
+{
+    uriparse_cursor* cursor = (uriparse_cursor*)pCursor;
+    if(cursor->text)
+    {
+        sqlite3_free(cursor->text);
+        cursor->text = NULL;
+        uriFreeUriMembersA(&cursor->uri);
+    }
+    return SQLITE_OK;
+}
+
+static int uriparse_eof(sqlite3_vtab_cursor* pCursor)
+{
+    uriparse_cursor* cursor = (uriparse_cursor*)pCursor;
+    return cursor->text == NULL;
+}
+
+static int uriparse_column(sqlite3_vtab_cursor* pCursor, sqlite3_context* ctx, int column)
+{
+    uriparse_cursor* cursor = (uriparse_cursor*)pCursor;
+    UriTextRangeA range = {NULL, NULL};
+    switch(column)
+    {
+        case COLUMN_SCHEME:
+            range = cursor->uri.scheme;
+            break;
+        case COLUMN_USERINFO:
+            range = cursor->uri.userInfo;
+            break;
+        case COLUMN_HOST:
+            range = cursor->uri.hostText;
+            break;
+        case COLUMN_PORT:
+            range = cursor->uri.portText;
+            break;
+        case COLUMN_PATH:
+            if(!cursor->uri.pathHead)
+                break;
+            range.first = range.afterLast = cursor->uri.pathHead->text.first;
+            for(const UriPathSegmentA* s = cursor->uri.pathHead; s != NULL; s = s->next)
+                if(s->text.first != s->text.afterLast)
+                    range.afterLast = s->text.afterLast;
+            if(range.first == range.afterLast)
+                range.first = range.afterLast = NULL;
+            break;
+        case COLUMN_QUERY:
+            range = cursor->uri.query;
+            break;
+        case COLUMN_FRAGMENT:
+            range = cursor->uri.fragment;
+            break;
+    }
+    if(range.first)
+        sqlite3_result_text(ctx, range.first, range.afterLast - range.first, NULL);
+    else
+        sqlite3_result_null(ctx);
+    return SQLITE_OK;
+}
+
+static int uriparse_rowid(sqlite3_vtab_cursor* pCursor, sqlite_int64* pRowid)
+{
+    *pRowid = 1;
+    return SQLITE_OK;
+}
+
+
+static sqlite3_module uriparse_module = {
+    0,                    // iVersion
+    0,                    // xCreate
+    uriparse_connect,     // xConnect
+    uriparse_best_index,  // xBestIndex
+    uriparse_disconnect,  // xDisconnect
+    0,                    // xDestroy
+    uriparse_open,        // xOpen - open a cursor
+    uriparse_close,       // xClose - close a cursor
+    uriparse_filter,      // xFilter - configure scan constraints
+    uriparse_next,        // xNext - advance a cursor
+    uriparse_eof,         // xEof - check for end of scan
+    uriparse_column,      // xColumn - read data
+    uriparse_rowid,       // xRowid - read data
+    0,                    // xUpdate
+    0,                    // xBegin
+    0,                    // xSync
+    0,                    // xCommit
+    0,                    // xRollback
+    0,                    // xFindMethod
+    0,                    // xRename
+};
+
+#endif

 int sqlite3_uriparse_init(sqlite3* db, char** pzErrMsg, const sqlite3_api_routines* pApi)
 {
-	int rc = SQLITE_OK;
-	SQLITE_EXTENSION_INIT2(pApi);
-
-	rc = sqlite3_create_function(db, "uriparse_host", 1, SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, uriparse_host_func, 0, 0);
-	return rc;
-}
+    int rc = SQLITE_OK;
+    SQLITE_EXTENSION_INIT2(pApi);
+#ifndef SQLITE_OMIT_VIRTUALTABLE
+    rc = sqlite3_create_module(db, "uriparse", &uriparse_module, NULL);
+#endif
+    return rc;
+}


msm: krait-regulator: disable mdd when a cpu is offlined

Currently the driver leaves MDD on while a CPU is hotplugged out if
it were operating in LDO mode. Leaving the MDD on while the cpu is
off wastes around 300uA of current.

Fix this by making sure that MDD is turned off while a cpu is hotplugged
out. Note that it is guaranteed that the cpu wont be in retention (which
needs MDD to be on) while hotplugged out, so it is safe to turn off MDD
when a cpu is offline.

While at it, there is another issue where the MDD was not being turned
off while exiting from retention mode. This happens when the CPU was
operating in BHS mode. Fix this.

Change-Id: Ib88ccdda41391bf6edb759be090e5108b062a661
Signed-off-by: Abhijeet Dharmapurikar <98996d53ce579fa37f08d0061abc5355e223c79e@codeaurora.org>

--- arch/arm/mach-msm/krait-regulator.c
+++ arch/arm/mach-msm/krait-regulator.c
@@ -291,6 +291,11 @@

 int krait_power_mdd_enable(int cpu_num, bool on)
 {
+	/*
+	 * Expected to be called when the cpu goes to retention mode as a part
+	 * of idle power collapse. IT is guaranteed that cpu won't be put in
+	 * retention while being hotplugged out
+	 */
 	struct krait_power_vreg *kvreg = per_cpu(krait_vregs, cpu_num);

 	if (!on && kvreg->mode == LDO_MODE) {
@@ -298,7 +303,7 @@
 		return -EINVAL;
 	}

-	if ((on && kvreg->mode == LDO_MODE) || (!on && kvreg->mode == HS_MODE))
+	if (on && kvreg->mode == LDO_MODE)
 		return 0;

 	__krait_power_mdd_enable(kvreg, on);
@@ -801,6 +806,8 @@
 	int rc;

 	mutex_lock(&pvreg->krait_power_vregs_lock);
+	if (kvreg->mode == LDO_MODE)
+		__krait_power_mdd_enable(kvreg, true);
 	kvreg->online = true;
 	rc = _get_optimum_mode(rdev, kvreg->uV, kvreg->uV, kvreg->load_uA);
 	if (rc < 0)
@@ -830,6 +837,8 @@
 		goto dis_err;

 	rc = _set_voltage(rdev, kvreg->uV, kvreg->uV);
+	if (kvreg->mode == LDO_MODE)
+		__krait_power_mdd_enable(kvreg, false);
 dis_err:
 	mutex_unlock(&pvreg->krait_power_vregs_lock);
 	return rc;


ARM: mx51: Add entry for gpc_dvfs_clk

ARM: mx51: Add entry for gpc_dvfs_clk

For MX51 SRPG, we need to turn on the GPC clock in order to set the
SRPG registers.

Signed-off-by: Dinh Nguyen <4684f5c0d3528e170f4ae24f5ead66f7c1fed69b@freescale.com>
Signed-off-by: Sascha Hauer <c00cbc2b736c26791a3822db86f8796fe9efff67@pengutronix.de>

--- arch/arm/mach-mx5/clock-mx51-mx53.c
+++ arch/arm/mach-mx5/clock-mx51-mx53.c
@@ -863,6 +863,13 @@
 	.enable_shift = MXC_CCM_CCGRx_CG13_OFFSET,
 	.enable = _clk_ccgr_enable,
 	.disable = _clk_ccgr_disable_inwait,
+};
+
+static struct clk gpc_dvfs_clk = {
+	.enable_reg = MXC_CCM_CCGR5,
+	.enable_shift = MXC_CCM_CCGRx_CG12_OFFSET,
+	.enable = _clk_ccgr_enable,
+	.disable = _clk_ccgr_disable,
 };

 static struct clk gpt_32k_clk = {
@@ -1448,6 +1455,7 @@
 	_REGISTER_CLOCK("imx-ipuv3", NULL, ipu_clk)
 	_REGISTER_CLOCK("imx-ipuv3", "di0", ipu_di0_clk)
 	_REGISTER_CLOCK("imx-ipuv3", "di1", ipu_di1_clk)
+	_REGISTER_CLOCK(NULL, "gpc_dvfs", gpc_dvfs_clk)
 };

 static struct clk_lookup mx53_lookups[] = {


[ARM] 3733/2: S3C24XX: Remove old IDE registers in Anubis

Patch from Ben Dooks

Remove unused IDE static mapping, now being ioremap()d
by the simtec IDE driver.

Signed-off-by: Ben Dooks <1177f64998f284a7348354b8e91cbbe575d9858a@fluff.org>
Signed-off-by: Russell King <f6aa0246ff943bfa8602cdf60d40c481b38ed232@arm.linux.org.uk>

--- arch/arm/mach-s3c2410/mach-anubis.c
+++ arch/arm/mach-s3c2410/mach-anubis.c
@@ -85,30 +85,6 @@
 	.pfn		= __phys_to_pfn(ANUBIS_PA_CTRL2),
 	.length		= SZ_4K,
 	.type		= MT_DEVICE,
-  },
-
-  /* IDE drives */
-
-  {
-	.virtual	= (u32)ANUBIS_IDEPRI,
-	.pfn		= __phys_to_pfn(S3C2410_CS3),
-	.length		= SZ_1M,
-	.type		= MT_DEVICE
-  }, {
-	.virtual	= (u32)ANUBIS_IDEPRIAUX,
-	.pfn		= __phys_to_pfn(S3C2410_CS3+(1<<26)),
-	.length		= SZ_1M,
-	.type		= MT_DEVICE
-  }, {
-	.virtual	= (u32)ANUBIS_IDESEC,
-	.pfn		= __phys_to_pfn(S3C2410_CS4),
-	.length		= SZ_1M,
-	.type		= MT_DEVICE
-  }, {
-	.virtual	= (u32)ANUBIS_IDESECAUX,
-	.pfn		= __phys_to_pfn(S3C2410_CS4+(1<<26)),
-	.length		= SZ_1M,
-	.type		= MT_DEVICE
   },
 };


Blackfin arch: Check for Anomaly 05000182

IMDMA does not operate to full speed for 600MHz and higher devices

Signed-off-by: Michael Hennerich <38f18d03059a1bc88082b55d7ca2d9b1ebfaffe0@analog.com>
Signed-off-by: Bryan Wu <956b36c0f472d2edb239225c10f7e4411d1efbb9@kernel.org>

--- arch/blackfin/kernel/bfin_dma_5xx.c
+++ arch/blackfin/kernel/bfin_dma_5xx.c
@@ -90,6 +90,17 @@
 {

 	pr_debug("request_dma() : BEGIN \n");
+
+#if defined(CONFIG_BF561) && ANOMALY_05000182
+	if (channel >= CH_IMEM_STREAM0_DEST && channel <= CH_IMEM_STREAM1_DEST) {
+		if (get_cclk() > 500000000) {
+			printk(KERN_WARNING
+			       "Request IMDMA failed due to ANOMALY 05000182\n");
+			return -EFAULT;
+		}
+	}
+#endif
+
 	mutex_lock(&(dma_ch[channel].dmalock));

 	if ((dma_ch[channel].chan_status == DMA_CHANNEL_REQUESTED)


add missing includes

add missing includes

--- libndarray/src/npy_os.h
+++ libndarray/src/npy_os.h
@@ -1,5 +1,8 @@
 #ifndef _NPY_NUMPYOS_H_
 #define _NPY_NUMPYOS_H_
+
+#include <stdlib.h>
+#include <stdio.h>

 int _npy_signbit_d(double x);
@@ -9,7 +12,6 @@
      : _npy_signbit_d((double) x))

-/* TODO: Need definition of NumPyOS_snprintf */
 #define NumPyOS_snprintf snprintf
 #define NumPyOS_strtol strtol
 #define NumPyOS_strtoul strtoul


Fixing unused value

Fixing unused value

--- tests/test_art.c
+++ tests/test_art.c
@@ -195,6 +195,7 @@
 } prefix_data;

 static int test_prefix_cb(void *data, const char *k, uint32_t k_len, void *val) {
+    (void)val;
     prefix_data *p = data;
     fail_unless(p->count < p->max_count);
     fail_unless(memcmp(k, p->expected[p->count], k_len) == 0);


kmp: math.h not needed

kmp: math.h not needed

--- user/kmp.c
+++ user/kmp.c
@@ -83,7 +83,6 @@
 #include <stdint.h>
 #include <stdbool.h>
 #include <string.h>
-#include <math.h>

 #include "ets_sys.h"
 #include "osapi.h"


powerpc: Fix lockdep IRQ tracing bug

powerpc: Fix lockdep IRQ tracing bug

A small bogon sneaked into the ppc64 lockdep support.  A test is
branching slightly off causing a clobbered register value to
overwrite the irq state under some circumstances.

Signed-off-by: Benjamin Herrenschmidt <a7089bb6e7e92505d88aaff006cbdd60cc9120b6@kernel.crashing.org>
Signed-off-by: Paul Mackerras <19a0ba370c443ba08d20b5061586430ab449ee8c@samba.org>

--- arch/powerpc/include/asm/irqflags.h
+++ arch/powerpc/include/asm/irqflags.h
@@ -20,7 +20,7 @@
 #define TRACE_ENABLE_INTS	bl .trace_hardirqs_on
 #define TRACE_DISABLE_INTS	bl .trace_hardirqs_off
 #define TRACE_AND_RESTORE_IRQ_PARTIAL(en,skip)	\
-	cmpdi	en, 0;				\
+	cmpdi	en,0;				\
 	bne	95f;				\
 	stb	en,PACASOFTIRQEN(r13);		\
 	bl	.trace_hardirqs_off;		\
@@ -29,7 +29,8 @@
 	li	en,1;
 #define TRACE_AND_RESTORE_IRQ(en)		\
 	TRACE_AND_RESTORE_IRQ_PARTIAL(en,96f);	\
-96:	stb	en,PACASOFTIRQEN(r13)
+	stb	en,PACASOFTIRQEN(r13);	        \
+96:
 #else
 #define TRACE_ENABLE_INTS
 #define TRACE_DISABLE_INTS


Update led.c

Update led.c

make sure timers are stopped by using a state variable: led_disabled

--- user/led.c
+++ user/led.c
@@ -8,13 +8,14 @@
 static os_timer_t led_double_blink_timer;
 static os_timer_t led_sub_pattern_timer;

+static volatile bool led_disabled = true;
 static volatile bool led_blinker_timer_running = false;
 static volatile bool led_double_blinker_timer_running = false;

 static uint8_t led_sub_pattern_state = 0;

 ICACHE_FLASH_ATTR void static led_blinker_timer_func(void *arg) {
-	if (led_blinker_timer_running == false) {
+	if (led_blinker_timer_running == false || led_disabled) {
 		// stop blinking if asked to stop via state variable led_blinker_timer_running
 		os_timer_disarm(&led_blinker_timer);
 		return;
@@ -35,7 +36,7 @@

 ICACHE_FLASH_ATTR void static led_double_blink_timer_func(void *arg) {
 	// blink fast two times
-	if (led_double_blinker_timer_running == false) {
+	if (led_double_blinker_timer_running == false || led_disabled) {
 		// stop blinking if asked to stop via state variable led_double_blinker_timer_running
 		os_timer_disarm(&led_double_blink_timer);
 		return;
@@ -83,6 +84,8 @@

 	// Set GPIO2 to HIGH (turn blue led off)
 	gpio_output_set(BIT2, 0, BIT2, 0);
+
+	led_disabled = false;
 }

 ICACHE_FLASH_ATTR void led_on(void) {
@@ -97,6 +100,10 @@
 }

 ICACHE_FLASH_ATTR void led_blink(void) {
+	if (led_disabled) {
+		return;
+	}
+
 	led_on();
 	os_timer_disarm(&led_single_blink_off_timer);
 	os_timer_setfn(&led_single_blink_off_timer, (os_timer_func_t *)led_single_blink_off_timer_func, NULL);
@@ -104,6 +111,10 @@
 }

 ICACHE_FLASH_ATTR void led_blink_short(void) {
+	if (led_disabled) {
+		return;
+	}
+
 	led_on();
 	os_timer_disarm(&led_single_blink_off_timer);
 	os_timer_setfn(&led_single_blink_off_timer, (os_timer_func_t *)led_single_blink_off_timer_func, NULL);
@@ -111,6 +122,10 @@
 }

 ICACHE_FLASH_ATTR void led_pattern_a(void) {
+	if (led_disabled) {
+		return;
+	}
+
 	os_timer_disarm(&led_blinker_timer);
 	os_timer_setfn(&led_blinker_timer, (os_timer_func_t *)led_blinker_timer_func, NULL);
 	led_blinker_timer_running = true;	// state variable to control stopping after pattern is done
@@ -118,6 +133,10 @@
 }

 ICACHE_FLASH_ATTR void led_pattern_b(void) {
+	if (led_disabled) {
+		return;
+	}
+
 	os_timer_disarm(&led_blinker_timer);
 	os_timer_setfn(&led_blinker_timer, (os_timer_func_t *)led_blinker_timer_func, NULL);
 	led_blinker_timer_running = true;	// state variable to control stopping after pattern is done
@@ -126,6 +145,10 @@

 ICACHE_FLASH_ATTR void led_pattern_c(void) {
 	// blink fast two times every 5th second
+	if (led_disabled) {
+		return;
+	}
+
 	os_timer_disarm(&led_double_blink_timer);
 	os_timer_setfn(&led_double_blink_timer, (os_timer_func_t *)led_double_blink_timer_func, NULL);
 	led_double_blinker_timer_running = true;	// state variable to control stopping after pattern is done
@@ -139,8 +162,6 @@
 }

 ICACHE_FLASH_ATTR void led_destroy(void) {
-	os_timer_disarm(&led_blinker_timer);
-	os_timer_disarm(&led_single_blink_off_timer);
-	os_timer_disarm(&led_double_blink_timer);
-	os_timer_disarm(&led_sub_pattern_timer);
+	led_disabled = true;
+	led_stop_pattern();
 }


[POWERPC] Convert the cell IOMMU fixed mapping to 16M IOMMU pages

The only tricky part is we need to adjust the PTE insertion loop to
cater for holes in the page table. The PTEs for each segment start on
a 4K boundary, so with 16M pages we have 16 PTEs per segment and then
a gap to the next 4K page boundary.

It might be possible to allocate the PTEs for each segment separately,
saving the memory currently filling the gaps. However we'd need to
check that's OK with the hardware, and that it actually saves memory.

Signed-off-by: Michael Ellerman <17b9e1c64588c7fa6419b4d29dc1f4426279ba01@ellerman.id.au>
Signed-off-by: Arnd Bergmann <f2c659f01951776204a6c5b902787d9019fbeebd@arndb.de>

--- arch/powerpc/platforms/cell/iommu.c
+++ arch/powerpc/platforms/cell/iommu.c
@@ -882,38 +882,45 @@
 	dev_dbg(dev, "iommu: fixed addr = %lx\n", addr);
 }

+static void insert_16M_pte(unsigned long addr, unsigned long *ptab,
+			   unsigned long base_pte)
+{
+	unsigned long segment, offset;
+
+	segment = addr >> IO_SEGMENT_SHIFT;
+	offset = (addr >> 24) - (segment << IO_PAGENO_BITS(24));
+	ptab = ptab + (segment * (1 << 12) / sizeof(unsigned long));
+
+	pr_debug("iommu: addr %lx ptab %p segment %lx offset %lx\n",
+		  addr, ptab, segment, offset);
+
+	ptab[offset] = base_pte | (__pa(addr) & IOPTE_RPN_Mask);
+}
+
 static void cell_iommu_setup_fixed_ptab(struct cbe_iommu *iommu,
 	struct device_node *np, unsigned long dbase, unsigned long dsize,
 	unsigned long fbase, unsigned long fsize)
 {
-	int i;
-	unsigned long base_pte, uaddr, *io_pte, *ptab;
-
-	ptab = cell_iommu_alloc_ptab(iommu, fbase, fsize, dbase, dsize,
-				     IOMMU_PAGE_SHIFT);
+	unsigned long base_pte, uaddr, ioaddr, *ptab;
+
+	ptab = cell_iommu_alloc_ptab(iommu, fbase, fsize, dbase, dsize, 24);

 	dma_iommu_fixed_base = fbase;

-	/* convert from bytes into page table indices */
-	dbase = dbase >> IOMMU_PAGE_SHIFT;
-	dsize = dsize >> IOMMU_PAGE_SHIFT;
-	fbase = fbase >> IOMMU_PAGE_SHIFT;
-	fsize = fsize >> IOMMU_PAGE_SHIFT;
-
 	pr_debug("iommu: mapping 0x%lx pages from 0x%lx\n", fsize, fbase);

-	io_pte = ptab;
 	base_pte = IOPTE_PP_W | IOPTE_PP_R | IOPTE_M | IOPTE_SO_RW
 		    | (cell_iommu_get_ioid(np) & IOPTE_IOID_Mask);

-	uaddr = 0;
-	for (i = fbase; i < fbase + fsize; i++, uaddr += IOMMU_PAGE_SIZE) {
+	for (uaddr = 0; uaddr < fsize; uaddr += (1 << 24)) {
 		/* Don't touch the dynamic region */
-		if (i >= dbase && i < (dbase + dsize)) {
+		ioaddr = uaddr + fbase;
+		if (ioaddr >= dbase && ioaddr < (dbase + dsize)) {
 			pr_debug("iommu: fixed/dynamic overlap, skipping\n");
 			continue;
 		}
-		io_pte[i - fbase] = base_pte | (__pa(uaddr) & IOPTE_RPN_Mask);
+
+		insert_16M_pte(uaddr, ptab, base_pte);
 	}

 	mb();


Added TraceSnow to indicate the minimum depth of new snow required to reset the snow surface albedo from the ablation to the accumulation curve.

--- user_def.h
+++ user_def.h
@@ -38,7 +38,7 @@
 /***** If TRUE VIC binary includes the lake/wetland algorithm.  Lakes
        and wetlands do not need to be defined but code will be
        accessed. *****/
-#define LAKE_MODEL FALSE
+#define LAKE_MODEL TRUE

 /***** If TRUE VIC uses the linear interpolation of the logarithm of the
        matric potential from the two surrounding layers to estimate the
@@ -123,3 +123,7 @@
 #define SNOW_ALB_ACCUM_B	0.58
 #define SNOW_ALB_THAW_A		0.82
 #define SNOW_ALB_THAW_B		0.46
+
+/***** Defines the minimum amount of new snow (mm) which will reset the
+       snowpack albedo to new snow *****/
+#define TraceSnow 0.03


sparc32: fix broken set_pte()

sparc32: fix broken set_pte()

32-bit sparc uses swap instruction to implement set_pte().  It called
using GCC inline assembler.  But it misses the "memory" clobber to
indicate that pte value will be updated in memory.

As result GCC doesn't know that it cannot postpone pte pointer dereference
which occurs before set_pte() to post-set_pte() time.

It leads to real-world bugs -- [1]. In this situation we have code:

	ptent = ptep_modify_prot_start(mm, addr, pte);
	ptent = pte_modify(ptent, newprot);
	...
	ptep_modify_prot_commit(mm, addr, pte, ptent);

ptep_modify_prot_start() in sparc case is just 'pte' dereference plus
pte_clear().  pte_clear() calls broken set_pte().  GCC thinks it's valid
to dereference 'pte' again on pte_modify() and gets cleared pte.
ptep_modify_prot_commit() puts 'pteent' with pfn==0 back to page table,
which eventually leads to the crash.

[1] http://lkml.kernel.org/r/54C06B19.8060305@roeck-us.net

Signed-off-by: Kirill A. Shutemov <eec72676ad9a62f2727dfed6d270d98c0d02adec@linux.intel.com>
Reported-by: Guenter Roeck <ba324ca7b1c77fc20bb970d5aff6eea9377918a5@roeck-us.net>
Tested-by: Guenter Roeck <ba324ca7b1c77fc20bb970d5aff6eea9377918a5@roeck-us.net>
Cc: Paul Moore <88a1d58bf22a647dce58dd91f9595600dceabba9@redhat.com>
Cc: Joonsoo Kim <bb6c8cfe7699e0f11d1bee88022eb563a5f8e881@lge.com>
Cc: David Miller <fe08d3c717adf2ae63592e4c9aec6e3e404d8e3e@davemloft.net>
Signed-off-by: Andrew Morton <5c1e68b099950c134891f0b6e179498a8ebe9cf9@linux-foundation.org>
Signed-off-by: Linus Torvalds <69652caca27c8b940640ad396ab71f93cacec34f@linux-foundation.org>

--- arch/sparc/include/asm/pgtable_32.h
+++ arch/sparc/include/asm/pgtable_32.h
@@ -102,7 +102,8 @@
  */
 static inline unsigned long srmmu_swap(unsigned long *addr, unsigned long value)
 {
-	__asm__ __volatile__("swap [%2], %0" : "=&r" (value) : "0" (value), "r" (addr));
+	__asm__ __volatile__("swap [%2], %0" :
+			"=&r" (value) : "0" (value), "r" (addr) : "memory");
 	return value;
 }


[test-tooltips] remove invalid cast

[test-tooltips] remove invalid cast

Since the tooltips API change, we no longer need case to NbtkButton here

--- tests/test-tooltips.c
+++ tests/test-tooltips.c
@@ -30,20 +30,20 @@
   g_signal_connect (button, "clicked",
                     G_CALLBACK (button_hide),
                     "hello");
-  nbtk_widget_set_tooltip_text (NBTK_BUTTON (button), "Disappear");
+  nbtk_widget_set_tooltip_text (button, "Disappear");
   clutter_container_add_actor (CLUTTER_CONTAINER (stage),
                                CLUTTER_ACTOR (button));
   clutter_actor_set_position (CLUTTER_ACTOR (button), 50, 100);

   button = nbtk_button_new_with_label ("Testing 123");
-  nbtk_widget_set_tooltip_text (NBTK_BUTTON (button), "Testing the Tooltips...");
+  nbtk_widget_set_tooltip_text (button, "Testing the Tooltips...");
   clutter_container_add_actor (CLUTTER_CONTAINER (stage),
                                CLUTTER_ACTOR (button));
   clutter_actor_set_position (CLUTTER_ACTOR (button), 50, 200);

   button = nbtk_button_new_with_label ("Testing Long Text");
-  nbtk_widget_set_tooltip_text (NBTK_BUTTON (button),
+  nbtk_widget_set_tooltip_text (button,
                            "Here is some really"
                            " long text to test the handling in NbtkTooltip");
   clutter_container_add_actor (CLUTTER_CONTAINER (stage),
@@ -51,7 +51,7 @@
   clutter_actor_set_position (CLUTTER_ACTOR (button), 50, 300);

   button = nbtk_button_new_with_label ("Testing Long Text");
-  nbtk_widget_set_tooltip_text (NBTK_BUTTON (button),
+  nbtk_widget_set_tooltip_text (button,
                            "Here is some really"
                            " long text to test the handling in NbtkTooltip");
   clutter_container_add_actor (CLUTTER_CONTAINER (stage),
@@ -59,7 +59,7 @@
   clutter_actor_set_position (CLUTTER_ACTOR (button), 500, 300);

   button = nbtk_button_new_with_label ("Crazy");
-  nbtk_widget_set_tooltip_text (NBTK_BUTTON (button),
+  nbtk_widget_set_tooltip_text (button,
                            "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
                            " aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
                            " aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"


implement FUZZY_COMPARE with the helper class

--- tests/unittest.h
+++ tests/unittest.h
@@ -287,12 +287,10 @@
 };

 #define FUZZY_COMPARE( a, b ) \
-if ( unittest_fuzzyCompareHelper( a, b ) ) {} else { \
-    unitttest_comparePrintHelper(a, b, (a) == (b), #a, #b, __FILE__, __LINE__, unittest_fuzzynessHelper(a)); \
-    _unit_test_global.status = false; \
-    throw _UnitTest_Failure(); \
-    return; \
-}
+    _UnitTest_Compare(unittest_fuzzyCompareHelper(a, b)) \
+        << "at " << __FILE__ << ':' << __LINE__ << ":\n" \
+        << #a << " (" << std::setprecision(10) << (a) << std::setprecision(6) << ") == " << #b << " (" << std::setprecision(10) << (b) << std::setprecision(6) << ") -> " << ((a) == (b)) \
+        << "\nwith fuzzyness " << unittest_fuzzynessHelper(a)

 #define COMPARE( a, b ) \
     _UnitTest_Compare(unittest_compareHelper(a, b)) \


driver: l3gd20h: Fix maximal ODR

driver: l3gd20h: Fix maximal ODR

Be sure EC max frequency is taken into account.
[The component does not seem to be used.]

BUG=chromium:615059,chromium:1059318
BRANCH=none
TEST=Compile

Signed-off-by: Gwendal Grignou <190c5a5edfcf62e0246559bf31fa7548674de3ad@chromium.org>
Change-Id: I00afa72d1642e2a3237e842a73ecc8ed50ec4a69
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2092215
Reviewed-by: Heng-ruey Hsu <08f064b49bdb67b0052d0bc0d9912922c24d590a@chromium.org>

--- driver/gyro_l3gd20h.h
+++ driver/gyro_l3gd20h.h
@@ -73,7 +73,8 @@

 /* Min and Max sampling frequency in mHz */
 #define L3GD20_GYRO_MIN_FREQ     12500
-#define L3GD20_GYRO_MAX_FREQ     800000
+#define L3GD20_GYRO_MAX_FREQ     \
+	MOTION_MAX_SENSOR_FREQUENCY(800000, L3GD20_GYRO_MIN_FREQ)

 /*
  * Register      : STATUS_REG


sata_mv NCQ and SError fixes for mv_err_intr

Sigh.  Undo some earlier changes to mv_port_intr(),
so that we now read/clear SError again in all cases.

Arrange the top of the function to be as close as possible
to what we need for a later update (in this series) for ERR_DEV handling.

Fix things so that libata-eh can attempt a READ_LOG_EXT_10H
in response to a failed NCQ command, by just doing a local
mv_eh_freeze() rather than ata_port_freeze().

This will now fully handle NCQ errors much of the time,
but more fixes are needed for FBS/PMP, and for certain chip errata.

Signed-off-by: Mark Lord <a3587211cfc5fa09c6928d027426e9cd2c992c79@pobox.com>
Signed-off-by: Jeff Garzik <15f615bf7d20c2937c7eb5aa759110fd6768848c@redhat.com>

--- drivers/ata/sata_mv.c
+++ drivers/ata/sata_mv.c
@@ -1627,7 +1627,7 @@
  *      LOCKING:
  *      Inherited from caller.
  */
-static void mv_err_intr(struct ata_port *ap, struct ata_queued_cmd *qc)
+static void mv_err_intr(struct ata_port *ap)
 {
 	void __iomem *port_mmio = mv_ap_base(ap);
 	u32 edma_err_cause, eh_freeze_mask, serr = 0;
@@ -1635,24 +1635,33 @@
 	struct mv_host_priv *hpriv = ap->host->private_data;
 	unsigned int action = 0, err_mask = 0;
 	struct ata_eh_info *ehi = &ap->link.eh_info;
-
-	ata_ehi_clear_desc(ehi);
+	struct ata_queued_cmd *qc;
+	int abort = 0;

 	/*
-	 * Read and clear the err_cause bits.  This won't actually
-	 * clear for some errors (eg. SError), but we will be doing
-	 * a hard reset in those cases regardless, which *will* clear it.
+	 * Read and clear the SError and err_cause bits.
 	 */
+	sata_scr_read(&ap->link, SCR_ERROR, &serr);
+	sata_scr_write_flush(&ap->link, SCR_ERROR, serr);
+
 	edma_err_cause = readl(port_mmio + EDMA_ERR_IRQ_CAUSE_OFS);
 	writelfl(~edma_err_cause, port_mmio + EDMA_ERR_IRQ_CAUSE_OFS);

-	ata_ehi_push_desc(ehi, "edma_err_cause=%08x", edma_err_cause);
-
+	ata_port_printk(ap, KERN_INFO, "%s: err_cause=%08x pp_flags=0x%x\n",
+			__func__, edma_err_cause, pp->pp_flags);
+
+	qc = mv_get_active_qc(ap);
+	ata_ehi_clear_desc(ehi);
+	ata_ehi_push_desc(ehi, "edma_err_cause=%08x pp_flags=%08x",
+			  edma_err_cause, pp->pp_flags);
 	/*
 	 * All generations share these EDMA error cause bits:
 	 */
-	if (edma_err_cause & EDMA_ERR_DEV)
+	if (edma_err_cause & EDMA_ERR_DEV) {
 		err_mask |= AC_ERR_DEV;
+		action |= ATA_EH_RESET;
+		ata_ehi_push_desc(ehi, "dev error");
+	}
 	if (edma_err_cause & (EDMA_ERR_D_PAR | EDMA_ERR_PRD_PAR |
 			EDMA_ERR_CRQB_PAR | EDMA_ERR_CRPB_PAR |
 			EDMA_ERR_INTRL_PAR)) {
@@ -1684,13 +1693,6 @@
 			ata_ehi_push_desc(ehi, "EDMA self-disable");
 		}
 		if (edma_err_cause & EDMA_ERR_SERR) {
-			/*
-			 * Ensure that we read our own SCR, not a pmp link SCR:
-			 */
-			ap->ops->scr_read(ap, SCR_ERROR, &serr);
-			/*
-			 * Don't clear SError here; leave it for libata-eh:
-			 */
 			ata_ehi_push_desc(ehi, "SError=%08x", serr);
 			err_mask |= AC_ERR_ATA_BUS;
 			action |= ATA_EH_RESET;
@@ -1710,10 +1712,29 @@
 	else
 		ehi->err_mask |= err_mask;

-	if (edma_err_cause & eh_freeze_mask)
+	if (err_mask == AC_ERR_DEV) {
+		/*
+		 * Cannot do ata_port_freeze() here,
+		 * because it would kill PIO access,
+		 * which is needed for further diagnosis.
+		 */
+		mv_eh_freeze(ap);
+		abort = 1;
+	} else if (edma_err_cause & eh_freeze_mask) {
+		/*
+		 * Note to self: ata_port_freeze() calls ata_port_abort()
+		 */
 		ata_port_freeze(ap);
-	else
-		ata_port_abort(ap);
+	} else {
+		abort = 1;
+	}
+
+	if (abort) {
+		if (qc)
+			ata_link_abort(qc->dev->link);
+		else
+			ata_port_abort(ap);
+	}
 }

 static void mv_process_crpb_response(struct ata_port *ap,
@@ -1740,8 +1761,9 @@
 			}
 		}
 		ata_status = edma_status >> CRPB_FLAG_STATUS_SHIFT;
-		qc->err_mask |= ac_err_mask(ata_status);
-		ata_qc_complete(qc);
+		if (!ac_err_mask(ata_status))
+			ata_qc_complete(qc);
+		/* else: leave it for mv_err_intr() */
 	} else {
 		ata_port_printk(ap, KERN_ERR, "%s: no qc for tag=%d\n",
 				__func__, tag);
@@ -1845,7 +1867,7 @@
 		 * Handle chip-reported errors, or continue on to handle PIO.
 		 */
 		if (unlikely(port_cause & ERR_IRQ)) {
-			mv_err_intr(ap, mv_get_active_qc(ap));
+			mv_err_intr(ap);
 		} else if (hc_irq_cause & (DEV_IRQ << hardport)) {
 			if (!(pp->pp_flags & MV_PP_FLAG_EDMA_EN)) {
 				struct ata_queued_cmd *qc = mv_get_active_qc(ap);


ATM: horizon, fix hrz_probe fail path

ATM: horizon, fix hrz_probe fail path

One fail path in hrz_probe omitted device disable. Fix it.

Signed-off-by: Jiri Slaby <aeaaaa09d9a5fac7c38743ea79aa4bb8ffb08290@gmail.com>
Signed-off-by: David S. Miller <fe08d3c717adf2ae63592e4c9aec6e3e404d8e3e@davemloft.net>

--- drivers/atm/horizon.c
+++ drivers/atm/horizon.c
@@ -2705,7 +2705,7 @@

 	/* XXX DEV_LABEL is a guess */
 	if (!request_region(iobase, HRZ_IO_EXTENT, DEV_LABEL)) {
-		return -EINVAL;
+		err = -EINVAL;
 		goto out_disable;
 	}


cciss: Clear all sysfs-exposed data for deleted logical drives.

When removing a logical drive, clear all the information that is
now exposed by sysfs (e.g. vendor, model, serial number.)

Signed-off-by: Stephen M. Cameron <fcc9df7f1d62c98ed1e7091f4fa112f895d521f5@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <165ab144a3ccfd9429d5c6466b275f24fafdb114@oracle.com>

--- drivers/block/cciss.c
+++ drivers/block/cciss.c
@@ -2134,6 +2134,25 @@
 	goto freeret;
 }

+static void cciss_clear_drive_info(drive_info_struct *drive_info)
+{
+	/* zero out the disk size info */
+	drive_info->nr_blocks = 0;
+	drive_info->block_size = 0;
+	drive_info->heads = 0;
+	drive_info->sectors = 0;
+	drive_info->cylinders = 0;
+	drive_info->raid_level = -1;
+	memset(drive_info->serial_no, 0, sizeof(drive_info->serial_no));
+	memset(drive_info->model, 0, sizeof(drive_info->model));
+	memset(drive_info->rev, 0, sizeof(drive_info->rev));
+	memset(drive_info->vendor, 0, sizeof(drive_info->vendor));
+	/*
+	 * don't clear the LUNID though, we need to remember which
+	 * one this one is.
+	 */
+}
+
 /* This function will deregister the disk and it's queue from the
  * kernel.  It must be called with the controller lock held and the
  * drv structures busy_configuring flag set.  It's parameters are:
@@ -2212,16 +2231,8 @@
 	}

 	--h->num_luns;
-	/* zero out the disk size info */
-	drv->nr_blocks = 0;
-	drv->block_size = 0;
-	drv->heads = 0;
-	drv->sectors = 0;
-	drv->cylinders = 0;
-	drv->raid_level = -1;	/* This can be used as a flag variable to
-				 * indicate that this element of the drive
-				 * array is free.
-				 */
+	cciss_clear_drive_info(drv);
+
 	if (clear_all) {
 		/* check to see if it was the last disk */
 		if (drv == h->drv + h->highest_lun) {


bus: arm-ccn: Fix node->XP config conversion

Events defined as watchpoints on nodes must have their config values
converted so that they apply to the respective node's XP. The
function setting new values was using wrong mask for the "port" field,
resulting in corrupted value. Fixed now.

Cc: 4fbacc2fa0ffdbb11bf1ad6925b886ebd08dd15f@vger.kernel.org # 3.17+
Signed-off-by: Pawel Moll <9508d67e84a03f69673bee3bb7ec593a47efeb0d@arm.com>


drivers/cdrom/cdrom.c: simplify logic in cdrom_release()

Simplify logic in cdrom_release() without semantic change.

Signed-off-by: Borislav Petkov <2a4d3586fbecbbc9717045e49ffdc69866bad03c@yahoo.de>
Cc: Jens Axboe <165ab144a3ccfd9429d5c6466b275f24fafdb114@oracle.com>
Signed-off-by: Andrew Morton <5c1e68b099950c134891f0b6e179498a8ebe9cf9@linux-foundation.org>
Signed-off-by: Linus Torvalds <69652caca27c8b940640ad396ab71f93cacec34f@linux-foundation.org>

--- drivers/cdrom/cdrom.c
+++ drivers/cdrom/cdrom.c
@@ -1206,25 +1206,26 @@
 	return 0;
 }

-/* Admittedly, the logic below could be performed in a nicer way. */
 int cdrom_release(struct cdrom_device_info *cdi, struct file *fp)
 {
 	struct cdrom_device_ops *cdo = cdi->ops;
 	int opened_for_data;

-	cdinfo(CD_CLOSE, "entering cdrom_release\n");
+	cdinfo(CD_CLOSE, "entering cdrom_release\n");

 	if (cdi->use_count > 0)
 		cdi->use_count--;
-	if (cdi->use_count == 0)
+
+	if (cdi->use_count == 0) {
 		cdinfo(CD_CLOSE, "Use count for \"/dev/%s\" now zero\n", cdi->name);
-	if (cdi->use_count == 0)
 		cdrom_dvd_rw_close_write(cdi);
-	if (cdi->use_count == 0 &&
-	    (cdo->capability & CDC_LOCK) && !keeplocked) {
-		cdinfo(CD_CLOSE, "Unlocking door!\n");
-		cdo->lock_door(cdi, 0);
-	}
+
+		if ((cdo->capability & CDC_LOCK) && !keeplocked) {
+			cdinfo(CD_CLOSE, "Unlocking door!\n");
+			cdo->lock_door(cdi, 0);
+		}
+	}
+
 	opened_for_data = !(cdi->options & CDO_USE_FFLAGS) ||
 		!(fp && fp->f_flags & O_NONBLOCK);


[PATCH] Char: isicom, fix close bug

[PATCH] Char: isicom, fix close bug

port is dereferenced even if it is NULL.  Dereference it _after_ the
check if (!port)...  Thanks Eric <ef87@yahoo.com> for reporting this.

This fixes

	http://bugzilla.kernel.org/show_bug.cgi?id=7527

Signed-off-by: Jiri Slaby <aeaaaa09d9a5fac7c38743ea79aa4bb8ffb08290@gmail.com>
Signed-off-by: Linus Torvalds <69652caca27c8b940640ad396ab71f93cacec34f@osdl.org>

--- drivers/char/isicom.c
+++ drivers/char/isicom.c
@@ -1062,11 +1062,12 @@
 static void isicom_close(struct tty_struct *tty, struct file *filp)
 {
 	struct isi_port *port = tty->driver_data;
-	struct isi_board *card = port->card;
+	struct isi_board *card;
 	unsigned long flags;

 	if (!port)
 		return;
+	card = port->card;
 	if (isicom_paranoia_check(port, tty->name, "isicom_close"))
 		return;


remove is_tty()

remove is_tty()

This patch removes the no longer used is_tty().

Signed-off-by: Adrian Bunk <0b86548ef377da0031a3ff3f0c4e06f016e20105@kernel.org>
Acked-by: Alan Cox <91e38e63b890fbb214c8914809fde03c73e7f24d@redhat.com>
Signed-off-by: Andrew Morton <5c1e68b099950c134891f0b6e179498a8ebe9cf9@linux-foundation.org>
Signed-off-by: Linus Torvalds <69652caca27c8b940640ad396ab71f93cacec34f@linux-foundation.org>

--- drivers/char/tty_io.c
+++ drivers/char/tty_io.c
@@ -1118,19 +1118,6 @@
 }

 EXPORT_SYMBOL(tty_hung_up_p);
-
-/**
- *	is_tty	-	checker whether file is a TTY
- *	@filp:		file handle that may be a tty
- *
- *	Check if the file handle is a tty handle.
- */
-
-int is_tty(struct file *filp)
-{
-	return filp->f_op->read == tty_read
-		|| filp->f_op->read == hung_up_tty_read;
-}

 static void session_clear_tty(struct pid *session)
 {


tty_io: remove casts from void*

tty_io: remove casts from void*

Remove unnesessary casts from void*.

Signed-off-by: Kulikov Vasiliy <bf62e7c380ff4449c5c3c5c39150b7660ee28ecb@gmail.com>
Signed-off-by: Greg Kroah-Hartman <4645f7897fd33786a2ee1264d590b3c400559d85@suse.de>

--- drivers/char/tty_io.c
+++ drivers/char/tty_io.c
@@ -893,7 +893,7 @@
 	struct inode *inode;
 	struct tty_ldisc *ld;

-	tty = (struct tty_struct *)file->private_data;
+	tty = file->private_data;
 	inode = file->f_path.dentry->d_inode;
 	if (tty_paranoia_check(tty, inode, "tty_read"))
 		return -EIO;
@@ -1070,7 +1070,7 @@
 	ssize_t ret;
 	struct tty_ldisc *ld;

-	tty = (struct tty_struct *)file->private_data;
+	tty = file->private_data;
 	if (tty_paranoia_check(tty, inode, "tty_write"))
 		return -EIO;
 	if (!tty || !tty->ops->write ||
@@ -1513,7 +1513,7 @@
 	int	idx;
 	char	buf[64];

-	tty = (struct tty_struct *)filp->private_data;
+	tty = filp->private_data;
 	if (tty_paranoia_check(tty, inode, "tty_release_dev"))
 		return 0;

@@ -1920,7 +1920,7 @@
 	struct tty_ldisc *ld;
 	int ret = 0;

-	tty = (struct tty_struct *)filp->private_data;
+	tty = filp->private_data;
 	if (tty_paranoia_check(tty, filp->f_path.dentry->d_inode, "tty_poll"))
 		return 0;

@@ -1937,7 +1937,7 @@
 	unsigned long flags;
 	int retval = 0;

-	tty = (struct tty_struct *)filp->private_data;
+	tty = filp->private_data;
 	if (tty_paranoia_check(tty, filp->f_path.dentry->d_inode, "tty_fasync"))
 		goto out;

@@ -2497,7 +2497,7 @@
 	struct tty_ldisc *ld;
 	struct inode *inode = file->f_dentry->d_inode;

-	tty = (struct tty_struct *)file->private_data;
+	tty = file->private_data;
 	if (tty_paranoia_check(tty, inode, "tty_ioctl"))
 		return -EINVAL;


pch_dma: fix DMA issue(ch8-ch11)

pch_dma: fix DMA issue(ch8-ch11)

ISSUE: In case PCH_DMA with I2S communications with ch8~ch11, sometimes I2S data
is not send correctly.
CAUSE: The following patch I submitted before was not enough modification for
supporting DMA ch8~ch11. The modification for status register of ch8~11 was not
enough.

pch_dma: Support I2S for ML7213 IOH
author	Tomoya MORINAGA <d1171211b1154da483963a5aecdf2602ee7000da@dsn.okisemi.com>
	Mon, 9 May 2011 07:09:38 +0000 (16:09 +0900)
committer	Vinod Koul <5cf69c63beb17bf38d63aa0e923ee8256af0e205@intel.com>
	Mon, 9 May 2011 11:42:23 +0000 (16:42 +0530)
commit	194f5f2706c7472f9c6bb2d17fa788993606581f
tree	c9d4903ea02b18939a4f390956a48be1a3734517
parent	60092d0bde4c8741198da4a69b693d3709385bf1

This patch fixes the issue.
We can confirm PCH_DMA with I2S communications with ch8~ch11 works well.

Signed-off-by: Tomoya MORINAGA <d1171211b1154da483963a5aecdf2602ee7000da@dsn.okisemi.com>
Signed-off-by: Vinod Koul <5cf69c63beb17bf38d63aa0e923ee8256af0e205@intel.com>

--- drivers/dma/pch_dma.c
+++ drivers/dma/pch_dma.c
@@ -45,7 +45,8 @@
 #define DMA_STATUS_MASK_BITS		0x3
 #define DMA_STATUS_SHIFT_BITS		16
 #define DMA_STATUS_IRQ(x)		(0x1 << (x))
-#define DMA_STATUS_ERR(x)		(0x1 << ((x) + 8))
+#define DMA_STATUS0_ERR(x)		(0x1 << ((x) + 8))
+#define DMA_STATUS2_ERR(x)		(0x1 << (x))

 #define DMA_DESC_WIDTH_SHIFT_BITS	12
 #define DMA_DESC_WIDTH_1_BYTE		(0x3 << DMA_DESC_WIDTH_SHIFT_BITS)
@@ -133,6 +134,7 @@
 #define PCH_DMA_CTL3	0x0C
 #define PCH_DMA_STS0	0x10
 #define PCH_DMA_STS1	0x14
+#define PCH_DMA_STS2	0x18

 #define dma_readl(pd, name) \
 	readl((pd)->membase + PCH_DMA_##name)
@@ -183,13 +185,19 @@
 {
 	struct pch_dma *pd = to_pd(chan->device);
 	u32 val;
+	int pos;
+
+	if (chan->chan_id < 8)
+		pos = chan->chan_id;
+	else
+		pos = chan->chan_id + 8;

 	val = dma_readl(pd, CTL2);

 	if (enable)
-		val |= 0x1 << chan->chan_id;
+		val |= 0x1 << pos;
 	else
-		val &= ~(0x1 << chan->chan_id);
+		val &= ~(0x1 << pos);

 	dma_writel(pd, CTL2, val);

@@ -262,7 +270,7 @@
 		chan->chan_id, val);
 }

-static u32 pdc_get_status(struct pch_dma_chan *pd_chan)
+static u32 pdc_get_status0(struct pch_dma_chan *pd_chan)
 {
 	struct pch_dma *pd = to_pd(pd_chan->chan.device);
 	u32 val;
@@ -272,9 +280,27 @@
 			DMA_STATUS_BITS_PER_CH * pd_chan->chan.chan_id));
 }

+static u32 pdc_get_status2(struct pch_dma_chan *pd_chan)
+{
+	struct pch_dma *pd = to_pd(pd_chan->chan.device);
+	u32 val;
+
+	val = dma_readl(pd, STS2);
+	return DMA_STATUS_MASK_BITS & (val >> (DMA_STATUS_SHIFT_BITS +
+			DMA_STATUS_BITS_PER_CH * (pd_chan->chan.chan_id - 8)));
+}
+
 static bool pdc_is_idle(struct pch_dma_chan *pd_chan)
 {
-	if (pdc_get_status(pd_chan) == DMA_STATUS_IDLE)
+	u32 sts;
+
+	if (pd_chan->chan.chan_id < 8)
+		sts = pdc_get_status0(pd_chan);
+	else
+		sts = pdc_get_status2(pd_chan);
+
+
+	if (sts == DMA_STATUS_IDLE)
 		return true;
 	else
 		return false;
@@ -693,30 +719,45 @@
 	struct pch_dma *pd = (struct pch_dma *)devid;
 	struct pch_dma_chan *pd_chan;
 	u32 sts0;
+	u32 sts2;
 	int i;
-	int ret = IRQ_NONE;
+	int ret0 = IRQ_NONE;
+	int ret2 = IRQ_NONE;

 	sts0 = dma_readl(pd, STS0);
+	sts2 = dma_readl(pd, STS2);

 	dev_dbg(pd->dma.dev, "pd_irq sts0: %x\n", sts0);

 	for (i = 0; i < pd->dma.chancnt; i++) {
 		pd_chan = &pd->channels[i];

-		if (sts0 & DMA_STATUS_IRQ(i)) {
-			if (sts0 & DMA_STATUS_ERR(i))
-				set_bit(0, &pd_chan->err_status);
-
-			tasklet_schedule(&pd_chan->tasklet);
-			ret = IRQ_HANDLED;
+		if (i < 8) {
+			if (sts0 & DMA_STATUS_IRQ(i)) {
+				if (sts0 & DMA_STATUS0_ERR(i))
+					set_bit(0, &pd_chan->err_status);
+
+				tasklet_schedule(&pd_chan->tasklet);
+				ret0 = IRQ_HANDLED;
+			}
+		} else {
+			if (sts2 & DMA_STATUS_IRQ(i - 8)) {
+				if (sts2 & DMA_STATUS2_ERR(i))
+					set_bit(0, &pd_chan->err_status);
+
+				tasklet_schedule(&pd_chan->tasklet);
+				ret2 = IRQ_HANDLED;
+			}
 		}
-
 	}

 	/* clear interrupt bits in status register */
-	dma_writel(pd, STS0, sts0);
-
-	return ret;
+	if (ret0)
+		dma_writel(pd, STS0, sts0);
+	if (ret2)
+		dma_writel(pd, STS2, sts2);
+
+	return ret0 | ret2;
 }

 #ifdef	CONFIG_PM


hwmon: (ds620) Convert to use devm_ functions

Convert to use devm_ functions to reduce code size and simplify the code.

Signed-off-by: Guenter Roeck <ba324ca7b1c77fc20bb970d5aff6eea9377918a5@roeck-us.net>

--- drivers/hwmon/ds620.c
+++ drivers/hwmon/ds620.c
@@ -232,11 +232,10 @@
 	struct ds620_data *data;
 	int err;

-	data = kzalloc(sizeof(struct ds620_data), GFP_KERNEL);
-	if (!data) {
-		err = -ENOMEM;
-		goto exit;
-	}
+	data = devm_kzalloc(&client->dev, sizeof(struct ds620_data),
+			    GFP_KERNEL);
+	if (!data)
+		return -ENOMEM;

 	i2c_set_clientdata(client, data);
 	mutex_init(&data->update_lock);
@@ -247,7 +246,7 @@
 	/* Register sysfs hooks */
 	err = sysfs_create_group(&client->dev.kobj, &ds620_group);
 	if (err)
-		goto exit_free;
+		return err;

 	data->hwmon_dev = hwmon_device_register(&client->dev);
 	if (IS_ERR(data->hwmon_dev)) {
@@ -261,9 +260,6 @@

 exit_remove_files:
 	sysfs_remove_group(&client->dev.kobj, &ds620_group);
-exit_free:
-	kfree(data);
-exit:
 	return err;
 }

@@ -273,8 +269,6 @@

 	hwmon_device_unregister(data->hwmon_dev);
 	sysfs_remove_group(&client->dev.kobj, &ds620_group);
-
-	kfree(data);

 	return 0;
 }


hwmon: (sht15) Constify platform_device_id

The platform_device_id is not modified by the driver and core uses it as
const.

Signed-off-by: Krzysztof Kozlowski <e2fab786eddc0871341d92c5a7126cb6c6b4f7fc@gmail.com>
Signed-off-by: Guenter Roeck <ba324ca7b1c77fc20bb970d5aff6eea9377918a5@roeck-us.net>


lguest: fix out-by-one error in address checking.

This bug has been there since day 1; addresses in the top guest physical
page weren't considered valid.  You could map that page (the check in
check_gpte() is correct), but if a guest tried to put a pagetable there
we'd check that address manually when walking it, and kill the guest.

Signed-off-by: Rusty Russell <df9728c9e5104131c08c7adb03af425394842596@rustcorp.com.au>
Cc: 4fbacc2fa0ffdbb11bf1ad6925b886ebd08dd15f@kernel.org
Signed-off-by: Linus Torvalds <69652caca27c8b940640ad396ab71f93cacec34f@linux-foundation.org>


dm ioctl: only issue uevent on resume if state changed

Only issue a uevent on a resume if the state of the device changed,
i.e. if it was suspended and/or its table was replaced.

Signed-off-by: Dave Wysochanski <a0833abe499a4d6913aa70b5afb52ad32c11edc4@redhat.com>
Signed-off-by: Mike Snitzer <85e533f2e78486213c4d69f71462342ec0c62734@redhat.com>
Cc: 4fbacc2fa0ffdbb11bf1ad6925b886ebd08dd15f@kernel.org
Signed-off-by: Alasdair G Kergon <620085386a2c64ec2f1d43bef997c15003f13da2@redhat.com>

--- drivers/md/dm-ioctl.c
+++ drivers/md/dm-ioctl.c
@@ -897,16 +897,17 @@
 			set_disk_ro(dm_disk(md), 1);
 	}

-	if (dm_suspended_md(md))
+	if (dm_suspended_md(md)) {
 		r = dm_resume(md);
+		if (!r)
+			dm_kobject_uevent(md, KOBJ_CHANGE, param->event_nr);
+	}

 	if (old_map)
 		dm_table_destroy(old_map);

-	if (!r) {
-		dm_kobject_uevent(md, KOBJ_CHANGE, param->event_nr);
+	if (!r)
 		r = __dev_status(md, param);
-	}

 	dm_put(md);
 	return r;


compress/mlx5: add statistics operations

Add support for the next statistics operations:
	- stats_get
	- stats_reset

These statistics are counted by the SW data-path.

Signed-off-by: Matan Azrad <6969f5f553ad7652679a585a85d7321babc90464@nvidia.com>
Acked-by: Viacheslav Ovsiienko <5b8db9bb93a9a9aefc8828f79604d1fe963a53dd@nvidia.com>

--- drivers/compress/mlx5/mlx5_compress.c
+++ drivers/compress/mlx5/mlx5_compress.c
@@ -64,6 +64,7 @@
 	struct mlx5_pmd_mr opaque_mr;
 	struct rte_comp_op **ops;
 	struct mlx5_compress_priv *priv;
+	struct rte_compressdev_stats stats;
 };

 TAILQ_HEAD(mlx5_compress_privs, mlx5_compress_priv) mlx5_compress_priv_list =
@@ -361,14 +362,42 @@
 	return 0;
 }

+static void
+mlx5_compress_stats_get(struct rte_compressdev *dev,
+		struct rte_compressdev_stats *stats)
+{
+	int qp_id;
+
+	for (qp_id = 0; qp_id < dev->data->nb_queue_pairs; qp_id++) {
+		struct mlx5_compress_qp *qp = dev->data->queue_pairs[qp_id];
+
+		stats->enqueued_count += qp->stats.enqueued_count;
+		stats->dequeued_count += qp->stats.dequeued_count;
+		stats->enqueue_err_count += qp->stats.enqueue_err_count;
+		stats->dequeue_err_count += qp->stats.dequeue_err_count;
+	}
+}
+
+static void
+mlx5_compress_stats_reset(struct rte_compressdev *dev)
+{
+	int qp_id;
+
+	for (qp_id = 0; qp_id < dev->data->nb_queue_pairs; qp_id++) {
+		struct mlx5_compress_qp *qp = dev->data->queue_pairs[qp_id];
+
+		memset(&qp->stats, 0, sizeof(qp->stats));
+	}
+}
+
 static struct rte_compressdev_ops mlx5_compress_ops = {
 	.dev_configure		= mlx5_compress_dev_configure,
 	.dev_start		= mlx5_compress_dev_start,
 	.dev_stop		= mlx5_compress_dev_stop,
 	.dev_close		= mlx5_compress_dev_close,
 	.dev_infos_get		= mlx5_compress_dev_info_get,
-	.stats_get		= NULL,
-	.stats_reset		= NULL,
+	.stats_get		= mlx5_compress_stats_get,
+	.stats_reset		= mlx5_compress_stats_reset,
 	.queue_pair_setup	= mlx5_compress_qp_setup,
 	.queue_pair_release	= mlx5_compress_qp_release,
 	.private_xform_create	= mlx5_compress_xform_create,
@@ -452,6 +481,7 @@
 		qp->ops[idx] = op;
 		qp->pi++;
 	} while (--remain);
+	qp->stats.enqueued_count += nb_ops;
 	rte_io_wmb();
 	qp->sq.db_rec[MLX5_SND_DBR] = rte_cpu_to_be_32(qp->pi);
 	rte_wmb();
@@ -500,6 +530,7 @@
 	mlx5_compress_dump_err_objs((volatile uint32_t *)cqe,
 				 (volatile uint32_t *)&wqes[idx],
 				 (volatile uint32_t *)&opaq[idx]);
+	qp->stats.dequeue_err_count++;
 }

 static uint16_t
@@ -570,6 +601,7 @@
 	if (likely(i != 0)) {
 		rte_io_wmb();
 		qp->cq.db_rec[0] = rte_cpu_to_be_32(qp->ci);
+		qp->stats.dequeued_count += i;
 	}
 	return i;
 }


ibmveth: Add ethtool driver stats hooks

ibmveth: Add ethtool driver stats hooks

Add ethtool hooks to ibmveth to retrieve driver statistics.

Signed-off-by: Brian King <bf668d4b220231d97fe248d4ae0ba63a1d887e4c@linux.vnet.ibm.com>
Signed-off-by: Jeff Garzik <f3e731dfa293c7a83119d8aacfa41b5d2d780be9@garzik.org>

--- drivers/net/ibmveth.c
+++ drivers/net/ibmveth.c
@@ -113,6 +113,28 @@
 MODULE_LICENSE("GPL");
 MODULE_VERSION(ibmveth_driver_version);

+struct ibmveth_stat {
+	char name[ETH_GSTRING_LEN];
+	int offset;
+};
+
+#define IBMVETH_STAT_OFF(stat) offsetof(struct ibmveth_adapter, stat)
+#define IBMVETH_GET_STAT(a, off) *((u64 *)(((unsigned long)(a)) + off))
+
+struct ibmveth_stat ibmveth_stats[] = {
+	{ "replenish_task_cycles", IBMVETH_STAT_OFF(replenish_task_cycles) },
+	{ "replenish_no_mem", IBMVETH_STAT_OFF(replenish_no_mem) },
+	{ "replenish_add_buff_failure", IBMVETH_STAT_OFF(replenish_add_buff_failure) },
+	{ "replenish_add_buff_success", IBMVETH_STAT_OFF(replenish_add_buff_success) },
+	{ "rx_invalid_buffer", IBMVETH_STAT_OFF(rx_invalid_buffer) },
+	{ "rx_no_buffer", IBMVETH_STAT_OFF(rx_no_buffer) },
+	{ "tx_multidesc_send", IBMVETH_STAT_OFF(tx_multidesc_send) },
+	{ "tx_linearized", IBMVETH_STAT_OFF(tx_linearized) },
+	{ "tx_linearize_failed", IBMVETH_STAT_OFF(tx_linearize_failed) },
+	{ "tx_map_failed", IBMVETH_STAT_OFF(tx_map_failed) },
+	{ "tx_send_failed", IBMVETH_STAT_OFF(tx_send_failed) },
+};
+
 /* simple methods of getting data from the current rxq entry */
 static inline int ibmveth_rxq_pending_buffer(struct ibmveth_adapter *adapter)
 {
@@ -769,6 +791,32 @@
 	return adapter->rx_csum;
 }

+static void ibmveth_get_strings(struct net_device *dev, u32 stringset, u8 *data)
+{
+	int i;
+
+	if (stringset != ETH_SS_STATS)
+		return;
+
+	for (i = 0; i < ARRAY_SIZE(ibmveth_stats); i++, data += ETH_GSTRING_LEN)
+		memcpy(data, ibmveth_stats[i].name, ETH_GSTRING_LEN);
+}
+
+static int ibmveth_get_stats_count(struct net_device *dev)
+{
+	return ARRAY_SIZE(ibmveth_stats);
+}
+
+static void ibmveth_get_ethtool_stats(struct net_device *dev,
+				      struct ethtool_stats *stats, u64 *data)
+{
+	int i;
+	struct ibmveth_adapter *adapter = dev->priv;
+
+	for (i = 0; i < ARRAY_SIZE(ibmveth_stats); i++)
+		data[i] = IBMVETH_GET_STAT(adapter, ibmveth_stats[i].offset);
+}
+
 static const struct ethtool_ops netdev_ethtool_ops = {
 	.get_drvinfo		= netdev_get_drvinfo,
 	.get_settings		= netdev_get_settings,
@@ -780,6 +828,9 @@
 	.set_rx_csum		= ibmveth_set_rx_csum,
 	.get_tso			= ethtool_op_get_tso,
 	.get_ufo			= ethtool_op_get_ufo,
+	.get_strings		= ibmveth_get_strings,
+	.get_stats_count		= ibmveth_get_stats_count,
+	.get_ethtool_stats	= ibmveth_get_ethtool_stats,
 };

 static int ibmveth_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)


[alsa_out] make ports physical, so portaudio finds em

git-svn-id: 9d792367086e53bac42cb25f723fe47762daf29a@3546 0c269be4-1314-0410-8aa9-9f06e86f4224

--- tools/alsa_out.c
+++ tools/alsa_out.c
@@ -468,7 +468,7 @@

 void alloc_ports( int n_capture, int n_playback ) {

-    int port_flags = JackPortIsOutput;
+    int port_flags = JackPortIsOutput | JackPortIsPhysical | JackPortIsTerminal;
     int chn;
     jack_port_t *port;
     char buf[32];


drm/panel: s6e8aa0: silence array overflow warning

Smatch complains that we are reading beyond the end of the array here:

	drivers/gpu/drm/panel/panel-s6e8aa0.c:852 s6e8aa0_read_mtp_id()
	warn: buffer overflow 's6e8aa0_variants' 4 <= 4

We set the error code, so it's not harmful but it looks like a return
was intended here so lets add that and silence the warning.

Signed-off-by: Dan Carpenter <ff341aa343d564f9e53e9dcb6996be8c04859a66@oracle.com>
Acked-by: Andrzej Hajda <dcc2b772defa18622a340d324a717fd6b8ee2807@samsung.com>
Signed-off-by: Thierry Reding <3055038c414aef68bf32c33b8118623e7554e0f2@nvidia.com>