BSD: Handle RTM_MISS

BSD: Handle RTM_MISS

RTM_MISS is sent when an address is not resolvable.
This means that we want to use it but don't know how to reach it
and thus is neighbour unreachable.
If it's the address a RA came from and we don't have any others
on that interface, solicit a new RA.

We still handle RTM_DELETE as RTM_MISS as the address llentry
could have been gc'ed or manually deleted and is thus
unreachable.

--- src/if-bsd.c
+++ src/if-bsd.c
@@ -141,7 +141,7 @@
 #ifdef RTM_IFANNOUNCE
 	    RTM_IFANNOUNCE,
 #endif
-	    RTM_ADD, RTM_CHANGE, RTM_DELETE,
+	    RTM_ADD, RTM_CHANGE, RTM_DELETE, RTM_MISS,
 #ifdef RTM_CHGADDR
 	    RTM_CHGADDR,
 #endif
@@ -639,7 +639,11 @@
 {
 	const struct sockaddr *rti_info[RTAX_MAX];

-	if (~rtm->rtm_addrs & (RTA_DST | RTA_GATEWAY)) {
+	if (!(rtm->rtm_addrs & RTA_DST)) {
+		errno = EINVAL;
+		return -1;
+	}
+	if (rtm->rtm_type != RTM_MISS && !(rtm->rtm_addrs & RTA_GATEWAY)) {
 		errno = EINVAL;
 		return -1;
 	}
@@ -674,19 +678,24 @@
 		if (rt->rt_netmask.sa_family == 255) /* Why? */
 			rt->rt_netmask.sa_family = rt->rt_dest.sa_family;
 	}
+
 	/* dhcpcd likes an unspecified gateway to indicate via the link.
 	 * However we need to know if gateway was a link with an address. */
-	if (rti_info[RTAX_GATEWAY]->sa_family == AF_LINK) {
-		const struct sockaddr_dl *sdl;
-
-		sdl = (const struct sockaddr_dl*)
-			(const void *)rti_info[RTAX_GATEWAY];
-		if (sdl->sdl_alen != 0)
-			rt->rt_dflags |= RTDF_GATELINK;
-	} else if (rtm->rtm_flags & RTF_GATEWAY)
-		if_copysa(&rt->rt_gateway, rti_info[RTAX_GATEWAY]);
+	if (rtm->rtm_addrs & RTA_GATEWAY) {
+		if (rti_info[RTAX_GATEWAY]->sa_family == AF_LINK) {
+			const struct sockaddr_dl *sdl;
+
+			sdl = (const struct sockaddr_dl*)
+			    (const void *)rti_info[RTAX_GATEWAY];
+			if (sdl->sdl_alen != 0)
+				rt->rt_dflags |= RTDF_GATELINK;
+		} else if (rtm->rtm_flags & RTF_GATEWAY)
+			if_copysa(&rt->rt_gateway, rti_info[RTAX_GATEWAY]);
+	}
+
 	if (rtm->rtm_addrs & RTA_IFA)
 		if_copysa(&rt->rt_ifa, rti_info[RTAX_IFA]);
+
 	rt->rt_mtu = (unsigned int)rtm->rtm_rmx.rmx_mtu;

 	if (rtm->rtm_index)
@@ -1077,7 +1086,7 @@
 		return 0;

 	if (if_copyrt(ctx, &rt, rtm) == -1)
-		return -1;
+		return errno == ENOTSUP ? 0 : -1;

 #ifdef INET6
 	/*
@@ -1087,18 +1096,20 @@
 	 * Ensure we don't call this for a newly incomplete state.
 	 */
 	if (rt.rt_dest.sa_family == AF_INET6 &&
-	    rt.rt_flags & RTF_HOST &&
+	    (rt.rt_flags & RTF_HOST || rtm->rtm_type == RTM_MISS) &&
 	    !(rtm->rtm_type == RTM_ADD && !(rt.rt_dflags & RTDF_GATELINK)))
 	{
 		bool reachable;

-		reachable = rtm->rtm_type != RTM_DELETE &&
+		reachable = (rtm->rtm_type == RTM_ADD ||
+		    rtm->rtm_type == RTM_CHANGE) &&
 		    rt.rt_dflags & RTDF_GATELINK;
 		ipv6nd_neighbour(ctx, &rt.rt_ss_dest.sin6.sin6_addr, reachable);
 	}
 #endif

-	rt_recvrt(rtm->rtm_type, &rt, rtm->rtm_pid);
+	if (rtm->rtm_type != RTM_MISS)
+		rt_recvrt(rtm->rtm_type, &rt, rtm->rtm_pid);
 	return 0;
 }

@@ -1304,7 +1315,8 @@
 		return if_ifinfo(ctx, (const void *)rtm);
 	case RTM_ADD:		/* FALLTHROUGH */
 	case RTM_CHANGE:	/* FALLTHROUGH */
-	case RTM_DELETE:
+	case RTM_DELETE:	/* FALLTHROUGH */
+	case RTM_MISS:
 		return if_rtm(ctx, (const void *)rtm);
 #ifdef RTM_CHGADDR
 	case RTM_CHGADDR:	/* FALLTHROUGH */


fix only half of the data being transmitted over usart

--- Project/softScope/usart.c
+++ Project/softScope/usart.c
@@ -81,13 +81,13 @@
 	usartDMA.DMA_PeripheralBaseAddr = (uint32_t) &(USART1->DR);
 	usartDMA.DMA_Memory0BaseAddr    = (uint32_t) usartBuffer;
 	usartDMA.DMA_DIR                = DMA_DIR_MemoryToPeripheral;
-	usartDMA.DMA_BufferSize         = samples;
+	usartDMA.DMA_BufferSize         = samples * sizeof(uint16_t);
 	usartDMA.DMA_PeripheralInc      = DMA_PeripheralInc_Disable;
 	usartDMA.DMA_MemoryInc          = DMA_MemoryInc_Enable;
 	usartDMA.DMA_PeripheralDataSize = DMA_PeripheralDataSize_Byte;
-	usartDMA.DMA_MemoryDataSize     = DMA_MemoryDataSize_HalfWord;
+	usartDMA.DMA_MemoryDataSize     = DMA_MemoryDataSize_Byte; // for some reason HalfWord does not work
 	usartDMA.DMA_Mode               = DMA_Mode_Normal;
-	usartDMA.DMA_Priority           = DMA_Priority_Low;       // This DMA is shared with the ADC, which has priority ofcourse
+	usartDMA.DMA_Priority           = DMA_Priority_Low;        // This DMA is shared with the ADC, which has priority ofcourse
 	usartDMA.DMA_FIFOMode           = DMA_FIFOMode_Disable;
 	usartDMA.DMA_MemoryBurst        = DMA_MemoryBurst_Single;
 	usartDMA.DMA_PeripheralBurst    = DMA_PeripheralBurst_Single;


expose control & ui show slots in EC_WebView for custom app logic / control coding

--- src/Application/SceneWidgetComponents/EC_WebView.h
+++ src/Application/SceneWidgetComponents/EC_WebView.h
@@ -145,8 +145,18 @@
     /// \note If you do custom menu handling set the 'interactive' boolean to false so we wont try to double popup QMenus.
     QMenu *GetInteractionMenu(bool createSubmenu = true);

+    //public
     /// Enables/disables the QWebView scrollbars.
     void EnableScrollbars(bool enabled);
+
+    /// Handles request to show the QWebView
+    void InteractShowRequest();
+
+    /// Handles requests to take control of sharing
+    void InteractControlRequest();
+
+    /// Handles requests to release control of sharing
+    void InteractControlReleaseRequest();

 private slots:
     /// Server side handler for user disconnects.
@@ -220,15 +230,6 @@

     /// Monitors entity mouse clicks.
     void EntityClicked(Entity *entity, Qt::MouseButton button, RaycastResult *raycastResult);
-
-    /// Handles request to show the QWebView
-    void InteractShowRequest();
-
-    /// Handles requests to take control of sharing
-    void InteractControlRequest();
-
-    /// Handles requests to release control of sharing
-    void InteractControlReleaseRequest();

     /// Handles entity action WebViewControllerChanged
     /// \note The action signature is (string)"WebViewControllerChanged", (int)"id", (string)"name"


Make 'svn propget -R' sort by path when printing path:propval pairs.
Avoids random output ordering with APR-1.4.6.

* subversion/svn/propget-cmd.c
  (print_properties, print_properties_xml): Iterate over a sorted array of hash
   table keys instead of iterating over the hash table itself. The hash maps
   paths to prop values, so use svn_sort_compare_items_as_paths for sorting.

--- subversion/svn/propget-cmd.c
+++ subversion/svn/propget-cmd.c
@@ -35,6 +35,7 @@
 #include "svn_error_codes.h"
 #include "svn_error.h"
 #include "svn_utf.h"
+#include "svn_sorts.h"
 #include "svn_subst.h"
 #include "svn_dirent_uri.h"
 #include "svn_path.h"
@@ -73,13 +74,16 @@
                      apr_hash_t *props,
                      apr_pool_t *pool)
 {
-  apr_hash_index_t *hi;
+  apr_array_header_t *sorted_props;
+  int i;
   apr_pool_t *iterpool = svn_pool_create(pool);

-  for (hi = apr_hash_first(pool, props); hi; hi = apr_hash_next(hi))
+  sorted_props = svn_sort__hash(props, svn_sort_compare_items_as_paths, pool);
+  for (i = 0; i < sorted_props->nelts; i++)
     {
-      const char *filename = svn__apr_hash_index_key(hi);
-      svn_string_t *propval = svn__apr_hash_index_val(hi);
+      svn_sort__item_t item = APR_ARRAY_IDX(sorted_props, i, svn_sort__item_t);
+      const char *filename = item.key;
+      svn_string_t *propval = item.value;
       svn_stringbuf_t *sb = NULL;

       svn_pool_clear(iterpool);
@@ -117,16 +121,19 @@
                  svn_boolean_t like_proplist,
                  apr_pool_t *pool)
 {
-  apr_hash_index_t *hi;
+  apr_array_header_t *sorted_props;
+  int i;
   apr_pool_t *iterpool = svn_pool_create(pool);
   const char *path_prefix;

   SVN_ERR(svn_dirent_get_absolute(&path_prefix, "", pool));

-  for (hi = apr_hash_first(pool, props); hi; hi = apr_hash_next(hi))
+  sorted_props = svn_sort__hash(props, svn_sort_compare_items_as_paths, pool);
+  for (i = 0; i < sorted_props->nelts; i++)
     {
-      const char *filename = svn__apr_hash_index_key(hi);
-      svn_string_t *propval = svn__apr_hash_index_val(hi);
+      svn_sort__item_t item = APR_ARRAY_IDX(sorted_props, i, svn_sort__item_t);
+      const char *filename = item.key;
+      svn_string_t *propval = item.value;

       svn_pool_clear(iterpool);


OFConnectionManager: remove unused _TRY macro

--- modules/OFConnectionManager/module/src/ofconnectionmanager_int.h
+++ modules/OFConnectionManager/module/src/ofconnectionmanager_int.h
@@ -41,17 +41,6 @@
 #else
 #define LOG_OBJECT(obj)
 #endif
-
-/**
- * Try an operation and return the error code on failure.
- */
-#define _TRY(op) do {                                                   \
-        int _rv;                                                        \
-        if ((_rv = (op)) < 0) {                                         \
-            AIM_LOG_ERROR("ERROR %d at %s:%d\n", _rv, __FILE__, __LINE__); \
-            return _rv;                                                 \
-        }                                                               \
-    } while (0)

 /**
  * Default value for the aux connections echo period in milliseconds


cosmetic

cosmetic

--- Library/Sources/Stroika/Foundation/Characters/String.h
+++ Library/Sources/Stroika/Foundation/Characters/String.h
@@ -814,7 +814,6 @@
                  */
                 nonvirtual  void    CopyTo (Character* bufFrom, Character* bufTo) const;
                 nonvirtual  void    CopyTo (wchar_t* bufFrom, wchar_t* bufTo) const;
-

             public:
                 /**


driver/battery/bq27621_g1.c: Format with clang-format

BUG=b:236386294
BRANCH=none
TEST=none

Change-Id: Idf76d53dacf66ac6f9f81682bd7f5b3a4337222a
Signed-off-by: Jack Rosenthal <d3f605bef1867f59845d4ce6e4f83b8dc9e4e0ae@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3729948
Reviewed-by: Jeremy Bettis <4df7b5147fee087dca33c181f288ee7dbf56e022@chromium.org>

--- driver/battery/bq27621_g1.c
+++ driver/battery/bq27621_g1.c
@@ -13,95 +13,95 @@
 #include "util.h"
 #include "timer.h"

-#define BQ27621_ADDR_FLAGS                  0x55
-#define BQ27621_TYPE_ID                     0x0621
-
-#define REG_CTRL                            0x00
-#define REG_TEMPERATURE                     0x02
-#define REG_VOLTAGE                         0x04
-#define REG_FLAGS                           0x06
-#define REG_NOMINAL_CAPACITY                0x08
-#define REG_FULL_AVAILABLE_CAPACITY         0x0a
-#define REG_REMAINING_CAPACITY              0x0c
-#define REG_FULL_CHARGE_CAPACITY            0x0e
-#define REG_EFFECTIVE_CURRENT               0x10
-#define REG_AVERAGE_POWER                   0x18
-#define REG_STATE_OF_CHARGE                 0x1c
-#define REG_INTERNAL_TEMPERATURE            0x1e
-#define REG_REMAINING_CAPACITY_UNFILTERED   0x28
-#define REG_REMAINING_CAPACITY_FILTERED     0x2a
+#define BQ27621_ADDR_FLAGS 0x55
+#define BQ27621_TYPE_ID 0x0621
+
+#define REG_CTRL 0x00
+#define REG_TEMPERATURE 0x02
+#define REG_VOLTAGE 0x04
+#define REG_FLAGS 0x06
+#define REG_NOMINAL_CAPACITY 0x08
+#define REG_FULL_AVAILABLE_CAPACITY 0x0a
+#define REG_REMAINING_CAPACITY 0x0c
+#define REG_FULL_CHARGE_CAPACITY 0x0e
+#define REG_EFFECTIVE_CURRENT 0x10
+#define REG_AVERAGE_POWER 0x18
+#define REG_STATE_OF_CHARGE 0x1c
+#define REG_INTERNAL_TEMPERATURE 0x1e
+#define REG_REMAINING_CAPACITY_UNFILTERED 0x28
+#define REG_REMAINING_CAPACITY_FILTERED 0x2a
 #define REG_FULL_CHARGE_CAPACITY_UNFILTERED 0x28
-#define REG_FULL_CHARGE_CAPACITY_FILTERED   0x2a
-#define REG_STATE_OF_CHARGE_UNFILTERED      0x30
-#define REG_OP_CONFIG                       0x3a
-#define REG_DESIGN_CAPACITY                 0x3c
-#define REG_DATA_CLASS                      0x3e
-#define REG_DATA_BLOCK                      0x3f
-#define REG_BLOCK_DATA_CHECKSUM             0x60
-#define REG_BLOCK_DATA_CONTROL              0x61
-
-#define REGISTERS_BLOCK_OFFSET                64
-#define REGISTERS_BLOCK_OP_CONFIG           0x40
-#define REGISTERS_BLOCK_OP_CONFIG_B         0x42
-#define REGISTERS_BLOCK_DF_VERSION          0x43
+#define REG_FULL_CHARGE_CAPACITY_FILTERED 0x2a
+#define REG_STATE_OF_CHARGE_UNFILTERED 0x30
+#define REG_OP_CONFIG 0x3a
+#define REG_DESIGN_CAPACITY 0x3c
+#define REG_DATA_CLASS 0x3e
+#define REG_DATA_BLOCK 0x3f
+#define REG_BLOCK_DATA_CHECKSUM 0x60
+#define REG_BLOCK_DATA_CONTROL 0x61
+
+#define REGISTERS_BLOCK_OFFSET 64
+#define REGISTERS_BLOCK_OP_CONFIG 0x40
+#define REGISTERS_BLOCK_OP_CONFIG_B 0x42
+#define REGISTERS_BLOCK_DF_VERSION 0x43

 /* State block */
-#define STATE_BLOCK_OFFSET                    82
-#define STATE_BLOCK_DESIGN_CAPACITY         0x43
-#define STATE_BLOCK_DESIGN_ENERGY           0x45
-#define STATE_BLOCK_TERMINATE_VOLTAGE       0x49
-#define STATE_BLOCK_TAPER_RATE              0x54
+#define STATE_BLOCK_OFFSET 82
+#define STATE_BLOCK_DESIGN_CAPACITY 0x43
+#define STATE_BLOCK_DESIGN_ENERGY 0x45
+#define STATE_BLOCK_TERMINATE_VOLTAGE 0x49
+#define STATE_BLOCK_TAPER_RATE 0x54

 /* BQ27621 Control subcommands */
-#define CONTROL_CONTROL_STATUS   0x00
-#define CONTROL_DEVICE_TYPE      0x01
-#define CONTROL_FW_VERSION       0x02
-#define CONTROL_PREV_MACWRITE    0x07
-#define CONTROL_CHEM_ID          0x08
-#define CONTROL_BAT_INSERT       0x0C
-#define CONTROL_BAT_REMOVE       0x0D
-#define CONTROL_TOGGLE_POWERMIN  0x10
-#define CONTROL_SET_HIBERNATE    0x11
-#define CONTROL_CLEAR_HIBERNATE  0x12
-#define CONTROL_SET_CFGUPDATE    0x13
-#define CONTROL_SHUTDOWN_ENABLE  0x1B
-#define CONTROL_SHUTDOWN         0x1C
-#define CONTROL_SEALED           0x20
-#define CONTROL_TOGGLE_GPOUT     0x23
-#define CONTROL_ALT_CHEM1        0x31
-#define CONTROL_ALT_CHEM2        0x32
-#define CONTROL_RESET            0x41
-#define CONTROL_SOFT_RESET       0x42
-#define CONTROL_EXIT_CFGUPDATE   0x43
-#define CONTROL_EXIT_RESIM       0x44
-#define CONTROL_UNSEAL           0x8000
+#define CONTROL_CONTROL_STATUS 0x00
+#define CONTROL_DEVICE_TYPE 0x01
+#define CONTROL_FW_VERSION 0x02
+#define CONTROL_PREV_MACWRITE 0x07
+#define CONTROL_CHEM_ID 0x08
+#define CONTROL_BAT_INSERT 0x0C
+#define CONTROL_BAT_REMOVE 0x0D
+#define CONTROL_TOGGLE_POWERMIN 0x10
+#define CONTROL_SET_HIBERNATE 0x11
+#define CONTROL_CLEAR_HIBERNATE 0x12
+#define CONTROL_SET_CFGUPDATE 0x13
+#define CONTROL_SHUTDOWN_ENABLE 0x1B
+#define CONTROL_SHUTDOWN 0x1C
+#define CONTROL_SEALED 0x20
+#define CONTROL_TOGGLE_GPOUT 0x23
+#define CONTROL_ALT_CHEM1 0x31
+#define CONTROL_ALT_CHEM2 0x32
+#define CONTROL_RESET 0x41
+#define CONTROL_SOFT_RESET 0x42
+#define CONTROL_EXIT_CFGUPDATE 0x43
+#define CONTROL_EXIT_RESIM 0x44
+#define CONTROL_UNSEAL 0x8000

 /* BQ27621 Status bits */
-#define STATUS_SHUTDOWNEN        0x8000
-#define STATUS_WDRESET           0x4000
-#define STATUS_SS                0x2000
-#define STATUS_CALMODE           0x1000
-#define STATUS_OCVCMDCOMP        0x0200
-#define STATUS_OCVFAIL           0x0100
-#define STATUS_INITCOMP          0x0080
-#define STATUS_HIBERNATE         0x0040
-#define STATUS_POWERMIN          0x0020
-#define STATUS_SLEEP             0x0010
-#define STATUS_LDMD              0x0008
-#define STATUS_CHEMCHNG          0x0001
+#define STATUS_SHUTDOWNEN 0x8000
+#define STATUS_WDRESET 0x4000
+#define STATUS_SS 0x2000
+#define STATUS_CALMODE 0x1000
+#define STATUS_OCVCMDCOMP 0x0200
+#define STATUS_OCVFAIL 0x0100
+#define STATUS_INITCOMP 0x0080
+#define STATUS_HIBERNATE 0x0040
+#define STATUS_POWERMIN 0x0020
+#define STATUS_SLEEP 0x0010
+#define STATUS_LDMD 0x0008
+#define STATUS_CHEMCHNG 0x0001

 /* BQ27621 Flags bits */
-#define FLAGS_OT                 0x8000
-#define FLAGS_UT                 0x4000
-#define FLAGS_FC                 0x0200
-#define FLAGS_CHG                0x0100
-#define FLAGS_OCVTAKEN           0x0080
-#define FLAGS_ITPOR              0x0020
-#define FLAGS_CFGUPD             0x0010
-#define FLAGS_BAT_DET            0x0008
-#define FLAGS_SOC1               0x0004
-#define FLAGS_SOCF               0x0002
-#define FLAGS_DSG                0x0001
+#define FLAGS_OT 0x8000
+#define FLAGS_UT 0x4000
+#define FLAGS_FC 0x0200
+#define FLAGS_CHG 0x0100
+#define FLAGS_OCVTAKEN 0x0080
+#define FLAGS_ITPOR 0x0020
+#define FLAGS_CFGUPD 0x0010
+#define FLAGS_BAT_DET 0x0008
+#define FLAGS_SOC1 0x0004
+#define FLAGS_SOCF 0x0002
+#define FLAGS_DSG 0x0001

 /*
  * There are some parameters that need to be defined in the board file:
@@ -119,19 +119,23 @@
  *
  */

-#define BQ27621_SCALE_FACTOR (BQ27621_DESIGN_CAPACITY < 150 ? 10.0 : \
-				(BQ27621_DESIGN_CAPACITY > 6000 ? 0.1 : 1))
-
-#define BQ27621_UNSCALE(x)   (BQ27621_SCALE_FACTOR == 10 ? (x) / 10 : \
-				(BQ27621_SCALE_FACTOR == 0.1 ? (x) * 10 : (x)))
-
-#define BQ27621_TAPER_RATE  ((int)(BQ27621_DESIGN_CAPACITY/    \
-				(0.1 * BQ27621_TAPER_CURRENT)))
-
-#define BQ27621_SCALED_DESIGN_CAPACITY ((int)(BQ27621_DESIGN_CAPACITY *   \
-					BQ27621_SCALE_FACTOR))
-#define BQ27621_SCALED_DESIGN_ENERGY   ((int)(BQ27621_DESIGN_CAPACITY *   \
-					BQ27621_SCALE_FACTOR))
+#define BQ27621_SCALE_FACTOR             \
+	(BQ27621_DESIGN_CAPACITY < 150 ? \
+		 10.0 :                  \
+		 (BQ27621_DESIGN_CAPACITY > 6000 ? 0.1 : 1))
+
+#define BQ27621_UNSCALE(x)            \
+	(BQ27621_SCALE_FACTOR == 10 ? \
+		 (x) / 10 :           \
+		 (BQ27621_SCALE_FACTOR == 0.1 ? (x)*10 : (x)))
+
+#define BQ27621_TAPER_RATE \
+	((int)(BQ27621_DESIGN_CAPACITY / (0.1 * BQ27621_TAPER_CURRENT)))
+
+#define BQ27621_SCALED_DESIGN_CAPACITY \
+	((int)(BQ27621_DESIGN_CAPACITY * BQ27621_SCALE_FACTOR))
+#define BQ27621_SCALED_DESIGN_ENERGY \
+	((int)(BQ27621_DESIGN_CAPACITY * BQ27621_SCALE_FACTOR))

 /*
  *Everything is LSB first.  Parameters need to be converted.
@@ -139,11 +143,11 @@
  * The values from the data sheet are already LSB-first.
  */

-#define ENDIAN_SWAP_2B(x)     ((((x) & 0xff) << 8) | (((x) & 0xff00) >> 8))
-#define DESIGN_CAPACITY       ENDIAN_SWAP_2B(BQ27621_SCALED_DESIGN_CAPACITY)
-#define DESIGN_ENERGY         ENDIAN_SWAP_2B(BQ27621_SCALED_DESIGN_ENERGY)
-#define TAPER_RATE            ENDIAN_SWAP_2B(BQ27621_TAPER_RATE)
-#define TERMINATE_VOLTAGE     ENDIAN_SWAP_2B(BQ27621_TERMINATE_VOLTAGE)
+#define ENDIAN_SWAP_2B(x) ((((x)&0xff) << 8) | (((x)&0xff00) >> 8))
+#define DESIGN_CAPACITY ENDIAN_SWAP_2B(BQ27621_SCALED_DESIGN_CAPACITY)
+#define DESIGN_ENERGY ENDIAN_SWAP_2B(BQ27621_SCALED_DESIGN_ENERGY)
+#define TAPER_RATE ENDIAN_SWAP_2B(BQ27621_TAPER_RATE)
+#define TERMINATE_VOLTAGE ENDIAN_SWAP_2B(BQ27621_TERMINATE_VOLTAGE)

 struct battery_info battery_params;

@@ -192,7 +196,7 @@
 static inline int bq27621_unseal(void)
 {
 	return bq27621_write(REG_CTRL, CONTROL_UNSEAL) |
-				bq27621_write(REG_CTRL, CONTROL_UNSEAL);
+	       bq27621_write(REG_CTRL, CONTROL_UNSEAL);
 }

 static int bq27621_enter_config_update(void)
@@ -200,8 +204,9 @@
 	int tries, flags = 0, rv = EC_SUCCESS;

 	/* Enter Config Update Mode (Can take up to a second) */
-	for (tries = 2000; tries > 0 && !(flags & FLAGS_CFGUPD) &&
-					(rv == EC_SUCCESS); tries--) {
+	for (tries = 2000;
+	     tries > 0 && !(flags & FLAGS_CFGUPD) && (rv == EC_SUCCESS);
+	     tries--) {
 		rv |= bq27621_write(REG_CTRL, CONTROL_SET_CFGUPDATE);
 		rv |= bq27621_read(REG_FLAGS, &flags);
 	}
@@ -255,7 +260,7 @@
 	rv = bq27621_read8(REGISTERS_BLOCK_OP_CONFIG_B, &param);
 	checksum -= param; /* 1B */

-	param |= 1<<5; /* Set DEF_SEAL */
+	param |= 1 << 5; /* Set DEF_SEAL */

 	rv = bq27621_write8(REGISTERS_BLOCK_OP_CONFIG_B, param);
 	checksum += param; /* 1B */
@@ -273,7 +278,7 @@
 	return rv;
 }

-#define CHECKSUM_2B(x) ((x & 0xff) + ((x>>8) & 0xff))
+#define CHECKSUM_2B(x) ((x & 0xff) + ((x >> 8) & 0xff))

 static int bq27621_init(void)
 {
@@ -308,18 +313,18 @@

 			if (BQ27621_CHEM_ID == 0x1210)
 				rv |= bq27621_write(REG_CTRL,
-					CONTROL_ALT_CHEM1);
+						    CONTROL_ALT_CHEM1);
 			if (BQ27621_CHEM_ID == 0x0354)
 				rv |= bq27621_write(REG_CTRL,
-					CONTROL_ALT_CHEM2);
-
-		/*
-		 * The datasheet recommends checking the status here.
-		 *
-		 * If the CHEMCHG is active, it wasn't successful.
-		 *
-		 * There's no recommendation for what to do if it isn't.
-		 */
+						    CONTROL_ALT_CHEM2);
+
+			/*
+			 * The datasheet recommends checking the status here.
+			 *
+			 * If the CHEMCHG is active, it wasn't successful.
+			 *
+			 * There's no recommendation for what to do if it isn't.
+			 */

 			rv |= bq27621_write(REG_CTRL, CONTROL_EXIT_CFGUPDATE);
 		}
@@ -374,7 +379,6 @@

 	checksum = 0xff - (0xff & checksum);

-
 	if (rv)
 		return rv;

@@ -403,7 +407,7 @@

 	if (rv) { /* Try it once more */
 		rv = bq27621_write(REG_CTRL, CONTROL_RESET);
-	  rv |= bq27621_init();
+		rv |= bq27621_init();
 	}
 }

@@ -555,9 +559,9 @@
 }

 #ifdef CONFIG_CMD_BATDEBUG
-	#define CPRINTF(format, args...) cprintf(CC_I2C, format, ## args)
+#define CPRINTF(format, args...) cprintf(CC_I2C, format, ##args)
 #else
-	#define CPRINTF(format, args...)
+#define CPRINTF(format, args...)
 #endif

 #ifdef CONFIG_CMD_BATDEBUG
@@ -574,9 +578,7 @@
 	return rv;
 }

-DECLARE_CONSOLE_COMMAND(fgunseal, command_fgunseal,
-			"",
-			"Unseal the fg");
+DECLARE_CONSOLE_COMMAND(fgunseal, command_fgunseal, "", "Unseal the fg");

 static int command_fgseal(int argc, char **argv)
 {
@@ -590,9 +592,7 @@
 	return rv;
 }

-DECLARE_CONSOLE_COMMAND(fgseal, command_fgseal,
-			"",
-			"Seal the fg");
+DECLARE_CONSOLE_COMMAND(fgseal, command_fgseal, "", "Seal the fg");

 static int command_fginit(int argc, char **argv)
 {
@@ -625,9 +625,7 @@
 	return rv;
 }

-DECLARE_CONSOLE_COMMAND(fginit, command_fginit,
-			"[force]",
-			"Initialize the fg");
+DECLARE_CONSOLE_COMMAND(fginit, command_fginit, "[force]", "Initialize the fg");

 static int command_fgprobe(int argc, char **argv)
 {
@@ -641,9 +639,7 @@
 	return rv;
 }

-DECLARE_CONSOLE_COMMAND(fgprobe, command_fgprobe,
-			"",
-			"Probe the fg");
+DECLARE_CONSOLE_COMMAND(fgprobe, command_fgprobe, "", "Probe the fg");

 static int command_fgrd(int argc, char **argv)
 {
@@ -675,8 +671,7 @@
 	return rv;
 }

-DECLARE_CONSOLE_COMMAND(fgrd, command_fgrd,
-			"cmd len",
+DECLARE_CONSOLE_COMMAND(fgrd, command_fgrd, "cmd len",
 			"Read _len_ words from the fg");

 static int command_fgcmd(int argc, char **argv)
@@ -708,11 +703,9 @@
 		CPRINTF("Write 2 bytes @0xaa %0x: 0x%0x\n", cmd, data);
 		return bq27621_write(cmd, data);
 	}
-
-}
-
-DECLARE_CONSOLE_COMMAND(fgcmd, command_fgcmd,
-			"cmd data [byte]",
+}
+
+DECLARE_CONSOLE_COMMAND(fgcmd, command_fgcmd, "cmd data [byte]",
 			"Send a cmd to the fg");

 static int command_fgcmdrd(int argc, char **argv)
@@ -739,8 +732,8 @@
 	return rv;
 }

-DECLARE_CONSOLE_COMMAND(fgcmdrd, command_fgcmdrd,
-			"cmd data",
-			"Send a 2-byte cmd to the fg, read back the 2-byte result");
+DECLARE_CONSOLE_COMMAND(
+	fgcmdrd, command_fgcmdrd, "cmd data",
+	"Send a 2-byte cmd to the fg, read back the 2-byte result");

 #endif /* CONFIG_CMD_BATDEBUG */


Changed getFormattedTime() to make "localtime" the default.

--- log4cplus/include/log4cplus/helpers/timehelper.h
+++ log4cplus/include/log4cplus/helpers/timehelper.h
@@ -102,7 +102,7 @@
              * milliseconds.
              */
             log4cplus::tstring getFormattedTime(const log4cplus::tstring& fmt,
-                                                bool use_gmtime = true) const;
+                                                bool use_gmtime = false) const;

           // Operators
             Time& operator+=(const Time& rhs);


HELPER stuff.

HELPER stuff.

--- C/predefined.c
+++ C/predefined.c
@@ -4,14 +4,451 @@
 #include "internal.h"

-INTERNAL struct modern_node *modern_node_make
-    (struct modern_allocator *allocator)
+HELPER void helper_finalize_int8
+  (struct modern_library *library, void *retainable);
+HELPER modern *modern_node_make_int16
+    (modern_library *library_in,
+     int16_t value);
+HELPER void helper_finalize_int16
+  (struct modern_library *library, void *retainable);
+HELPER modern *modern_node_make_int32
+    (modern_library *library_in,
+     int32_t value);
+HELPER void helper_finalize_int32
+  (struct modern_library *library, void *retainable);
+HELPER modern *modern_node_make_int64
+    (modern_library *library_in,
+     int64_t value);
+HELPER void helper_finalize_int64
+  (struct modern_library *library, void *retainable);
+HELPER modern *modern_node_make_nat8
+    (modern_library *library_in,
+     uint8_t value);
+HELPER void helper_finalize_nat8
+  (struct modern_library *library, void *retainable);
+HELPER modern *modern_node_make_nat16
+    (modern_library *library_in,
+     uint16_t value);
+HELPER void helper_finalize_nat16
+  (struct modern_library *library, void *retainable);
+HELPER modern *modern_node_make_nat32
+    (modern_library *library_in,
+     uint32_t value);
+HELPER void helper_finalize_nat32
+  (struct modern_library *library, void *retainable);
+HELPER modern *modern_node_make_nat64
+    (modern_library *library_in,
+     uint64_t value);
+HELPER void helper_finalize_nat64
+  (struct modern_library *library, void *retainable);
+HELPER modern *modern_node_make_float32
+    (modern_library *library_in,
+     float value);
+HELPER void helper_finalize_float32
+  (struct modern_library *library, void *retainable);
+HELPER modern *modern_node_make_float64
+    (modern_library *library_in,
+     double value);
+HELPER void helper_finalize_float64
+  (struct modern_library *library, void *retainable);
+HELPER modern *modern_node_make_utf8
+    (modern_library *library_in,
+     uint8_t *data);
+HELPER void helper_finalize_utf8
+  (struct modern_library *library, void *retainable);
+HELPER modern *modern_node_make_blob
+    (modern_library *library_in,
+     uint8_t *data, size_t bytes);
+HELPER void helper_finalize_blob
+  (struct modern_library *library, void *retainable);
+HELPER modern *modern_node_make_sigma
+    (modern_library *library_in,
+     modern *type_in,
+     modern *field_value_in,
+     modern *successor_in);
+HELPER void helper_finalize_sigma_value
+  (struct modern_library *library, void *retainable);
+HELPER modern *modern_node_make_named_value
+    (modern_library *library_in,
+     modern *type_in, modern *value_in);
+HELPER void helper_finalize_named_value
+  (struct modern_library *library, void *retainable);
+HELPER modern *modern_node_make_bool_type
+    (modern_library *library_in);
+HELPER void helper_finalize_bool_type
+  (struct modern_library *library, void *retainable);
+HELPER modern *modern_node_make_ordering_type
+    (modern_library *library_in);
+HELPER void helper_finalize_ordering_type
+  (struct modern_library *library, void *retainable);
+HELPER modern *modern_node_make_maybe_type
+    (modern_library *library_in,
+     modern *content_type);
+HELPER void helper_finalize_maybe_type
+  (struct modern_library *library, void *retainable);
+HELPER void helper_finalize_maybe_type
+  (struct modern_library *library, void *retainable);
+HELPER modern *modern_node_make_int8_type
+    (modern_library *library_in);
+HELPER void helper_finalize_int8_type
+  (struct modern_library *library, void *retainable);
+HELPER modern *modern_node_make_int16_type
+    (modern_library *library_in);
+HELPER void helper_finalize_int16_type
+  (struct modern_library *library, void *retainable);
+HELPER modern *modern_node_make_int32_type
+    (modern_library *library_in);
+HELPER void helper_finalize_int32_type
+  (struct modern_library *library, void *retainable);
+HELPER modern *modern_node_make_int64_type
+    (modern_library *library_in);
+HELPER void helper_finalize_int64_type
+  (struct modern_library *library, void *retainable);
+HELPER modern *modern_node_make_nat8_type
+    (modern_library *library_in);
+HELPER void helper_finalize_nat8_type
+  (struct modern_library *library, void *retainable);
+HELPER modern *modern_node_make_nat16_type
+    (modern_library *library_in);
+HELPER void helper_finalize_nat16_type
+  (struct modern_library *library, void *retainable);
+HELPER modern *modern_node_make_nat32_type
+    (modern_library *library_in);
+HELPER void helper_finalize_nat32_type
+  (struct modern_library *library, void *retainable);
+HELPER modern *modern_node_make_nat64_type
+    (modern_library *library_in);
+HELPER void helper_finalize_nat64_type
+  (struct modern_library *library, void *retainable);
+HELPER modern *modern_node_make_float32_type
+    (modern_library *library_in);
+HELPER void helper_finalize_float32_type
+  (struct modern_library *library, void *retainable);
+HELPER modern *modern_node_make_float64_type
+    (modern_library *library_in);
+HELPER void helper_finalize_float64_type
+  (struct modern_library *library, void *retainable);
+HELPER modern *modern_node_make_utf8_type
+    (modern_library *library_in);
+HELPER void helper_finalize_utf8_type
+  (struct modern_library *library, void *retainable);
+HELPER modern *modern_node_make_blob_type
+    (modern_library *library_in);
+HELPER void helper_finalize_blob_type
+  (struct modern_library *library, void *retainable);
+HELPER modern *modern_node_make_function_type
+    (modern_library *library_in,
+     modern *left_in, modern *right_in);
+HELPER void helper_finalize_function_type
+  (struct modern_library *library, void *retainable);
+HELPER modern *modern_node_make_sigma_type
+    (modern_library *library_in,
+     modern *field_type, modern *successor);
+HELPER void helper_finalize_sigma_type
+  (struct modern_library *library, void *retainable);
+HELPER modern *modern_node_make_name_type
+    (modern_library *library_in);
+HELPER void helper_finalize_name_type
+  (struct modern_library *library, void *retainable);
+HELPER modern *modern_node_make_named_type
+    (modern_library *library_in,
+     struct modern_hash name, modern *content_type);
+HELPER void helper_finalize_named_type
+  (struct modern_library *library, void *retainable);
+HELPER modern *modern_node_make_universe_type
+    (modern_library *library_in,
+     uint64_t level);
+HELPER void helper_finalize_universe_type
+  (struct modern_library *library, void *retainable);
+HELPER modern *modern_node_make_lambda
+    (modern_library *library_in,
+     modern *content_in);
+HELPER void helper_finalize_lambda
+  (struct modern_library *library, void *retainable);
+HELPER modern *modern_node_make_apply
+    (modern_library *library_in,
+     modern *left_in, modern *right_in);
+HELPER void helper_finalize_apply
+  (struct modern_library *library, void *retainable);
+HELPER modern *modern_node_make_type_family
+    (modern_library *library_in,
+     uint64_t n_items, modern **types_in);
+HELPER void helper_finalize_type_family
+  (struct modern_library *library, void *retainable);
+HELPER modern *modern_node_make_let
+    (modern_library *library_in,
+     uint64_t n_items, modern **values_in, modern *content_in);
+HELPER void helper_finalize_let
+  (struct modern_library *library, void *retainable);
+HELPER modern *modern_node_make_backreference
+    (modern_library *library_in,
+     uint64_t index);
+HELPER void helper_finalize_backreference
+  (struct modern_library *library, void *retainable);
+HELPER modern *modern_node_make_builtin
+    (modern_library *library_in,
+     uint16_t identifier);
+HELPER void helper_finalize_builtin
+  (struct modern_library *library, void *retainable);
+
+
+struct modern_node *modern_node_make
+  (struct modern_allocator *allocator,
+   void *client_state)
 {
     struct modern_node *result =
         allocator->modern_allocator_alloc
-            (library->client_state, result_size);
-
-    // TODO
+            (client_state, sizeof(struct modern_node));
+    if(!result) return NULL;
+
+    result->modern_node_node_type_get =
+        modern_node_node_type_get;
+    result->modern_node_value_type_get =
+        modern_node_value_type_get;
+    result->modern_node_mutable_get =
+        modern_node_mutable_get;
+    result->modern_node_canonical_hash_get =
+        modern_node_canonical_hash_get;
+    result->modern_node_maybe_just_content_get =
+        modern_node_maybe_just_content_get;
+    result->modern_node_int8_get =
+        modern_node_int8_get;
+    result->modern_node_int16_get =
+        modern_node_int16_get;
+    result->modern_node_int32_get =
+        modern_node_int32_get;
+    result->modern_node_int64_get =
+        modern_node_int64_get;
+    result->modern_node_nat8_get =
+        modern_node_nat8_get;
+    result->modern_node_nat16_get =
+        modern_node_nat16_get;
+    result->modern_node_nat32_get =
+        modern_node_nat32_get;
+    result->modern_node_nat64_get =
+        modern_node_nat64_get;
+    result->modern_node_float32_get =
+        modern_node_float32_get;
+    result->modern_node_float64_get =
+        modern_node_float64_get;
+    result->modern_node_utf8_bytes_get =
+        modern_node_utf8_bytes_get;
+    result->modern_node_utf8_data_piece_get =
+        modern_node_utf8_data_piece_get;
+    result->modern_node_blob_bytes_get =
+        modern_node_blob_bytes_get;
+    result->modern_node_blob_data_piece_get =
+        modern_node_blob_data_piece_get;
+    result->modern_node_sigma_field_value_get =
+        modern_node_sigma_field_value_get;
+    result->modern_node_sigma_successor_get =
+        modern_node_sigma_successor_get;
+    result->modern_node_get_name_hash =
+        modern_node_get_name_hash;
+    result->modern_node_named_value_get =
+        modern_node_named_value_get;
+    result->modern_node_maybe_type_content_type_get =
+        modern_node_maybe_type_content_type_get;
+    result->modern_node_function_type_left_get =
+        modern_node_function_type_left_get;
+    result->modern_node_function_type_right_get =
+        modern_node_function_type_right_get;
+    result->modern_node_sigma_type_field_type_get =
+        modern_node_sigma_type_field_type_get;
+    result->modern_node_sigma_type_successor_get =
+        modern_node_sigma_type_successor_get;
+    result->modern_node_named_type_name_get =
+        modern_node_named_type_name_get;
+    result->modern_node_named_type_content_type_get =
+        modern_node_named_type_content_type_get;
+    result->modern_node_universe_type_level_get =
+        modern_node_universe_type_level_get;
+    result->modern_node_lambda_content_get =
+        modern_node_lambda_content_get;
+    result->modern_node_apply_left_get =
+        modern_node_apply_left_get;
+    result->modern_node_apply_right_get =
+        modern_node_apply_right_get;
+    result->modern_node_type_family_count_get =
+        modern_node_type_family_count_get;
+    result->modern_node_type_family_item_get =
+        modern_node_type_family_item_get;
+    result->modern_node_let_count_get =
+        modern_node_let_count_get;
+    result->modern_node_let_item_get =
+        modern_node_let_item_get;
+    result->modern_node_let_content_get =
+        modern_node_let_content_get;
+    result->modern_node_backreference_index_get =
+        modern_node_backreference_index_get;
+    result->modern_node_builtin_identifier_get =
+        modern_node_builtin_identifier_get;
+    result->modern_node_bool_false_make =
+        modern_node_bool_false_make;
+    result->modern_node_bool_true_make =
+        modern_node_bool_true_make;
+    result->modern_node_ordering_less_make =
+        modern_node_ordering_less_make;
+    result->modern_node_ordering_equal_make =
+        modern_node_ordering_equal_make;
+    result->modern_node_ordering_greater_make =
+        modern_node_ordering_greater_make;
+    result->modern_node_maybe_nothing_make =
+        modern_node_maybe_nothing_make;
+    result->modern_node_maybe_just_make =
+        modern_node_maybe_just_make;
+    result->modern_node_int8_make =
+        modern_node_int8_make;
+    result->modern_node_int16_make =
+        modern_node_int16_make;
+    result->modern_node_int32_make =
+        modern_node_int32_make;
+    result->modern_node_int64_make =
+        modern_node_int64_make;
+    result->modern_node_nat8_make =
+        modern_node_nat8_make;
+    result->modern_node_nat16_make =
+        modern_node_nat16_make;
+    result->modern_node_nat32_make =
+        modern_node_nat32_make;
+    result->modern_node_nat64_make =
+        modern_node_nat64_make;
+    result->modern_node_float32_make =
+        modern_node_float32_make;
+    result->modern_node_float64_make =
+        modern_node_float64_make;
+    result->modern_node_utf8_make =
+        modern_node_utf8_make;
+    result->modern_node_blob_make =
+        modern_node_blob_make;
+    result->modern_node_sigma_make =
+        modern_node_sigma_make;
+    result->modern_node_name_make =
+        modern_node_name_make;
+    result->modern_node_named_value_make =
+        modern_node_named_value_make;
+    result->modern_node_bool_type_make =
+        modern_node_bool_type_make;
+    result->modern_node_ordering_type_make =
+        modern_node_ordering_type_make;
+    result->modern_node_maybe_type_make =
+        modern_node_maybe_type_make;
+    result->modern_node_int8_type_make =
+        modern_node_int8_type_make;
+    result->modern_node_int16_type_make =
+        modern_node_int16_type_make;
+    result->modern_node_int32_type_make =
+        modern_node_int32_type_make;
+    result->modern_node_int64_type_make =
+        modern_node_int64_type_make;
+    result->modern_node_nat8_type_make =
+        modern_node_nat8_type_make;
+    result->modern_node_nat16_type_make =
+        modern_node_nat16_type_make;
+    result->modern_node_nat32_type_make =
+        modern_node_nat32_type_make;
+    result->modern_node_nat64_type_make =
+        modern_node_nat64_type_make;
+    result->modern_node_float32_type_make =
+        modern_node_float32_type_make;
+    result->modern_node_float64_type_make =
+        modern_node_float64_type_make;
+    result->modern_node_utf8_type_make =
+        modern_node_utf8_type_make;
+    result->modern_node_blob_type_make =
+        modern_node_blob_type_make;
+    result->modern_node_function_type_make =
+        modern_node_function_type_make;
+    result->modern_node_sigma_type_make =
+        modern_node_sigma_type_make;
+    result->modern_node_name_type_make =
+        modern_node_name_type_make;
+    result->modern_node_named_type_make =
+        modern_node_named_type_make;
+    result->modern_node_universe_type_make =
+        modern_node_universe_type_make;
+    result->modern_node_lambda_make =
+        modern_node_lambda_make;
+    result->modern_node_apply_make =
+        modern_node_apply_make;
+    result->modern_node_type_family_make =
+        modern_node_type_family_make;
+    result->modern_node_let_make =
+        modern_node_let_make;
+    result->modern_node_backreference_make =
+        modern_node_backreference_make;
+    result->modern_node_builtin_make =
+        modern_node_builtin_make;
+    result->modern_node_immutable_set =
+        modern_node_immutable_set;
+    result->modern_node_canonical_hash_set =
+        modern_node_canonical_hash_set;
+    result->modern_node_maybe_just_content_set =
+        modern_node_maybe_just_content_set;
+    result->modern_node_int8_set =
+        modern_node_int8_set;
+    result->modern_node_int16_set =
+        modern_node_int16_set;
+    result->modern_node_int32_set =
+        modern_node_int32_set;
+    result->modern_node_int64_set =
+        modern_node_int64_set;
+    result->modern_node_nat8_set =
+        modern_node_nat8_set;
+    result->modern_node_nat16_set =
+        modern_node_nat16_set;
+    result->modern_node_nat32_set =
+        modern_node_nat32_set;
+    result->modern_node_nat64_set =
+        modern_node_nat64_set;
+    result->modern_node_float32_set =
+        modern_node_float32_set;
+    result->modern_node_float64_set =
+        modern_node_float64_set;
+    result->modern_node_utf8_data_piece_set =
+        modern_node_utf8_data_piece_set;
+    result->modern_node_blob_data_piece_set =
+        modern_node_blob_data_piece_set;
+    result->modern_node_sigma_set =
+        modern_node_sigma_set;
+    result->modern_node_named_value_set =
+        modern_node_named_value_set;
+    result->modern_node_maybe_type_content_type_set =
+        modern_node_maybe_type_content_type_set;
+    result->modern_node_function_type_left_set =
+        modern_node_function_type_left_set;
+    result->modern_node_function_type_right_set =
+        modern_node_function_type_right_set;
+    result->modern_node_sigma_type_field_type_set =
+        modern_node_sigma_type_field_type_set;
+    result->modern_node_sigma_type_successor_set =
+        modern_node_sigma_type_successor_set;
+    result->modern_node_named_type_name_set =
+        modern_node_named_type_name_set;
+    result->modern_node_named_type_content_type_set =
+        modern_node_named_type_content_type_set;
+    result->modern_node_universe_type_level_set =
+        modern_node_universe_type_level_set;
+    result->modern_node_lambda_content_set =
+        modern_node_lambda_content_set;
+    result->modern_node_apply_left_set =
+        modern_node_apply_left_set;
+    result->modern_node_apply_right_set =
+        modern_node_apply_right_set;
+    result->modern_node_set_type_family_item_add =
+        modern_node_set_type_family_item_add;
+    result->modern_node_set_type_family_item_remove =
+        modern_node_set_type_family_item_remove;
+    result->modern_node_set_let_item_add =
+        modern_node_set_let_item_add;
+    result->modern_node_set_let_item_remove =
+        modern_node_set_let_item_remove;
+    result->modern_node_let_content_set =
+        modern_node_let_content_set;
+    result->modern_node_backreference_index_set =
+        modern_node_backreference_index_set;
+    result->modern_node_builtin_identifier_set =
+        modern_node_builtin_identifier_set;

     return result;
 }
@@ -26,7 +463,7 @@
 }

-modern *modern_node_make_int16
+HELPER modern *modern_node_make_int16
     (modern_library *library_in,
      int16_t value)
 {
@@ -63,7 +500,7 @@
 }

-modern *modern_node_make_int32
+HELPER modern *modern_node_make_int32
     (modern_library *library_in,
      int32_t value)
 {
@@ -100,7 +537,7 @@
 }

-modern *modern_node_make_int64
+HELPER modern *modern_node_make_int64
     (modern_library *library_in,
      int64_t value)
 {
@@ -137,7 +574,7 @@
 }

-modern *modern_node_make_nat8
+HELPER modern *modern_node_make_nat8
     (modern_library *library_in,
      uint8_t value)
 {
@@ -174,7 +611,7 @@
 }

-modern *modern_node_make_nat16
+HELPER modern *modern_node_make_nat16
     (modern_library *library_in,
      uint16_t value)
 {
@@ -211,7 +648,7 @@
 }

-modern *modern_node_make_nat32
+HELPER modern *modern_node_make_nat32
     (modern_library *library_in,
      uint32_t value)
 {
@@ -248,7 +685,7 @@
 }

-modern *modern_node_make_nat64
+HELPER modern *modern_node_make_nat64
     (modern_library *library_in,
      uint64_t value)
 {
@@ -285,7 +722,7 @@
 }

-modern *modern_node_make_float32
+HELPER modern *modern_node_make_float32
     (modern_library *library_in,
      float value)
 {
@@ -342,7 +779,7 @@
 }

-modern *modern_node_make_float64
+HELPER modern *modern_node_make_float64
     (modern_library *library_in,
      double value)
 {
@@ -399,7 +836,7 @@
 }

-modern *modern_node_make_utf8
+HELPER modern *modern_node_make_utf8
     (modern_library *library_in,
      uint8_t *data)
 {
@@ -453,7 +890,7 @@
 }

-modern *modern_node_make_blob
+HELPER modern *modern_node_make_blob
     (modern_library *library_in,
      uint8_t *data, size_t bytes)
 {
@@ -506,7 +943,7 @@
 }

-modern *modern_node_make_sigma
+HELPER modern *modern_node_make_sigma
     (modern_library *library_in,
      modern *type_in,
      modern *field_value_in,
@@ -562,7 +999,7 @@
 }

-modern *modern_node_make_named_value
+HELPER modern *modern_node_make_named_value
     (modern_library *library_in,
      modern *type_in, modern *value_in)
 {
@@ -606,7 +1043,7 @@
 }

-modern *modern_node_make_bool_type
+HELPER modern *modern_node_make_bool_type
     (modern_library *library_in)
 {
     struct modern_library *library = (struct modern_library *) library_in;
@@ -641,7 +1078,7 @@
 }

-modern *modern_node_make_ordering_type
+HELPER modern *modern_node_make_ordering_type
     (modern_library *library_in)
 {
     struct modern_library *library = (struct modern_library *) library_in;
@@ -676,10 +1113,10 @@
 }

-modern *modern_node_make_maybe_type
+HELPER modern *modern_node_make_maybe_type
     (modern_library *library_in,
      modern *content_type)
- {
+{
     struct modern_library *library = (struct modern_library *) library_in;

     if(!content_type) {
@@ -722,7 +1159,7 @@
 }

-modern *modern_node_make_int8_type
+HELPER modern *modern_node_make_int8_type
     (modern_library *library_in)
 {
     struct modern_library *library = (struct modern_library *) library_in;
@@ -757,7 +1194,7 @@
 }

-modern *modern_node_make_int16_type
+HELPER modern *modern_node_make_int16_type
     (modern_library *library_in)
 {
     struct modern_library *library = (struct modern_library *) library_in;
@@ -792,7 +1229,7 @@
 }

-modern *modern_node_make_int32_type
+HELPER modern *modern_node_make_int32_type
     (modern_library *library_in)
 {
     struct modern_library *library = (struct modern_library *) library_in;
@@ -827,7 +1264,7 @@
 }

-modern *modern_node_make_int64_type
+HELPER modern *modern_node_make_int64_type
     (modern_library *library_in)
 {
     struct modern_library *library = (struct modern_library *) library_in;
@@ -862,7 +1299,7 @@
 }

-modern *modern_node_make_nat8_type
+HELPER modern *modern_node_make_nat8_type
     (modern_library *library_in)
 {
     struct modern_library *library = (struct modern_library *) library_in;
@@ -897,7 +1334,7 @@
 }

-modern *modern_node_make_nat16_type
+HELPER modern *modern_node_make_nat16_type
     (modern_library *library_in)
 {
     struct modern_library *library = (struct modern_library *) library_in;
@@ -932,7 +1369,7 @@
 }

-modern *modern_node_make_nat32_type
+HELPER modern *modern_node_make_nat32_type
     (modern_library *library_in)
 {
     struct modern_library *library = (struct modern_library *) library_in;
@@ -967,7 +1404,7 @@
 }

-modern *modern_node_make_nat64_type
+HELPER modern *modern_node_make_nat64_type
     (modern_library *library_in)
 {
     struct modern_library *library = (struct modern_library *) library_in;
@@ -1002,7 +1439,7 @@
 }

-modern *modern_node_make_float32_type
+HELPER modern *modern_node_make_float32_type
     (modern_library *library_in)
 {
     struct modern_library *library = (struct modern_library *) library_in;
@@ -1037,7 +1474,7 @@
 }

-modern *modern_node_make_float64_type
+HELPER modern *modern_node_make_float64_type
     (modern_library *library_in)
 {
     struct modern_library *library = (struct modern_library *) library_in;
@@ -1072,7 +1509,7 @@
 }

-modern *modern_node_make_utf8_type
+HELPER modern *modern_node_make_utf8_type
     (modern_library *library_in)
 {
     struct modern_library *library = (struct modern_library *) library_in;
@@ -1107,7 +1544,7 @@
 }

-modern *modern_node_make_blob_type
+HELPER modern *modern_node_make_blob_type
     (modern_library *library_in)
 {
     struct modern_library *library = (struct modern_library *) library_in;
@@ -1142,7 +1579,7 @@
 }

-modern *modern_node_make_function_type
+HELPER modern *modern_node_make_function_type
     (modern_library *library_in,
      modern *left_in, modern *right_in)
 {
@@ -1189,7 +1626,7 @@
 }

-modern *modern_node_make_sigma_type
+HELPER modern *modern_node_make_sigma_type
     (modern_library *library_in,
      modern *field_type, modern *successor)
 {
@@ -1234,7 +1671,7 @@
 }

-modern *modern_node_make_name_type
+HELPER modern *modern_node_make_name_type
     (modern_library *library_in)
 {
     struct modern_library *library = (struct modern_library *) library_in;
@@ -1269,7 +1706,7 @@
 }

-modern *modern_node_make_named_type
+HELPER modern *modern_node_make_named_type
     (modern_library *library_in,
      struct modern_hash name, modern *content_type)
 {
@@ -1309,7 +1746,7 @@
 }

-modern *modern_node_make_universe_type
+HELPER modern *modern_node_make_universe_type
     (modern_library *library_in,
      uint64_t level)
 {
@@ -1346,7 +1783,7 @@
 }

-modern *modern_node_make_lambda
+HELPER modern *modern_node_make_lambda
     (modern_library *library_in,
      modern *content_in)
 {
@@ -1386,7 +1823,7 @@
 }

-modern *modern_node_make_apply
+HELPER modern *modern_node_make_apply
     (modern_library *library_in,
      modern *left_in, modern *right_in)
 {
@@ -1429,7 +1866,7 @@
 }

-modern *modern_node_make_type_family
+HELPER modern *modern_node_make_type_family
     (modern_library *library_in,
      uint64_t n_items, modern **types_in)
 {
@@ -1490,7 +1927,7 @@
 }

-modern *modern_node_make_let
+HELPER modern *modern_node_make_let
     (modern_library *library_in,
      uint64_t n_items, modern **values_in, modern *content_in)
 {
@@ -1556,7 +1993,7 @@
 }

-modern *modern_node_make_backreference
+HELPER modern *modern_node_make_backreference
     (modern_library *library_in,
      uint64_t index)
 {
@@ -1593,7 +2030,7 @@
 }

-modern *modern_node_make_builtin
+HELPER modern *modern_node_make_builtin
     (modern_library *library_in,
      uint16_t identifier)
 {


- example for the Unknown problem

- example for the Unknown problem

[r23129]

error: pathspec 'ir/be/test/unknown_combo2.c' did not match any file(s) known to git

--- ir/be/test/unknown_combo2.c
+++ ir/be/test/unknown_combo2.c
@@ -0,0 +1,26 @@
+/*$ -fcombo $*/
+
+/*
+ * This is a example for the 'Top reaches if first'
+ * problem.
+ *
+ * If the Cond is evaluated BEFORE the Phi(Unknown, 1)
+ * gets the Const 1, we decide for != and cannot revert
+ * this decision...
+ */
+int main(int argc) {
+	int x;
+
+	if (argc) {
+		x = 1;
+	} else {
+		++argc;
+	}
+
+	if (x == 1) {
+		printf("x == 1\n");
+	} else {
+		printf("x != 1\n");
+	}
+	return 0;
+}


Fixed segmentation fault

Fixed segmentation fault

--- src/ignore.c
+++ src/ignore.c
@@ -72,9 +72,7 @@
     }

     if (hash == NULL) {
-        ignore_hash *new_hash = (ignore_hash *)tc_malloc(sizeof(ignore_hash));
-        new_hash->glob = NULL;
-        new_hash->accept = NULL;
+        ignore_hash *new_hash = (ignore_hash *)tc_calloc(1, sizeof(ignore_hash));
         hash = new_hash;
     }


* subversion/svnlook/svnlook.c
  (print_diff_tree): Enable cancellation support when outputting a unified
    diff and thereby resolve an obsolete function usage warning.

git-svn-id: f8a4e5e023278da1e04e203c7fe051e3c4285d88@1582455 13f79535-47bb-0310-9956-ffa450edef68

--- subversion/svnlook/svnlook.c
+++ subversion/svnlook/svnlook.c
@@ -1063,11 +1063,12 @@
                     SVN_ERR(generate_label(&orig_label, base_root,
                                            base_path, pool));
                   SVN_ERR(generate_label(&new_label, root, path, pool));
-                  SVN_ERR(svn_diff_file_output_unified3
-                          (out_stream, diff, orig_path, new_path,
+                  SVN_ERR(svn_diff_file_output_unified4(
+                           out_stream, diff, orig_path, new_path,
                            orig_label, new_label,
                            svn_cmdline_output_encoding(pool), NULL,
-                           opts->show_c_function, pool));
+                           opts->show_c_function,
+                           check_cancel, NULL, pool));
                   SVN_ERR(svn_stream_printf_from_utf8(out_stream, encoding, pool,
                                                       "\n"));
                   diff_header_printed = TRUE;


Linux style function braces.

Linux style function braces.

--- agglomerate.c
+++ agglomerate.c
@@ -68,12 +68,14 @@
         char label[MAX_LABEL_LEN]; /* label of the input data point */
 };

-float euclidean_distance(const coord_t *a, const coord_t *b) {
+float euclidean_distance(const coord_t *a, const coord_t *b)
+{
         return sqrt(pow(a->x - b->x, 2) + pow(a->y - b->y, 2));
 }

 void fill_euclidean_distances(float **matrix, int num_items,
-                              const item_t items[]) {
+                              const item_t items[])
+{
         for (int i = 0; i < num_items; ++i)
                 for (int j = 0; j < num_items; ++j) {
                         matrix[i][j] =
@@ -83,7 +85,8 @@
                 }
 }

-float **generate_distance_matrix(int num_items, const item_t items[]) {
+float **generate_distance_matrix(int num_items, const item_t items[])
+{
         float **matrix = alloc_mem(num_items, float *);
         if (matrix) {
                 for (int i = 0; i < num_items; ++i) {
@@ -106,7 +109,8 @@
 }

 float single_linkage(float **distances, const int a[],
-                     const int b[], int m, int n) {
+                     const int b[], int m, int n)
+{
         float min = FLT_MAX, d;
         for (int i = 0; i < m; ++i)
                 for (int j = 0; j < n; ++j) {
@@ -118,7 +122,8 @@
 }

 float complete_linkage(float **distances, const int a[],
-                       const int b[], int m, int n) {
+                       const int b[], int m, int n)
+{
         float d, max = 0.0 /* assuming distances are positive */;
         for (int i = 0; i < m; ++i)
                 for (int j = 0; j < n; ++j) {
@@ -130,7 +135,8 @@
 }

 float average_linkage(float **distances, const int a[],
-                      const int b[], int m, int n) {
+                      const int b[], int m, int n)
+{
         float total = 0.0;
         for (int i = 0; i < m; ++i)
                 for (int j = 0; j < n; ++j)
@@ -139,11 +145,13 @@
 }

 float centroid_linkage(float **distances, const int a[],
-                       const int b[], int m, int n) {
+                       const int b[], int m, int n)
+{
         return 0; /* empty function */
 }

-float get_distance(cluster_t *cluster, int index, int target) {
+float get_distance(cluster_t *cluster, int index, int target)
+{
         /* if both are leaves, just use the distances matrix */
         if (index < cluster->num_items && target < cluster->num_items)
                 return cluster->distances[index][target];
@@ -159,7 +167,8 @@
         }
 }

-void free_neighbours(neighbour_t *node) {
+void free_neighbours(neighbour_t *node)
+{
         neighbour_t *t;
         while (node) {
                 t = node->next;
@@ -168,7 +177,8 @@
         }
 }

-void free_cluster_nodes(cluster_t *cluster) {
+void free_cluster_nodes(cluster_t *cluster)
+{
         for (int i = 0; i < cluster->num_nodes; ++i) {
                 cluster_node_t *node = &(cluster->nodes[i]);
                 if (node->label)
@@ -183,7 +193,8 @@
         free(cluster->nodes);
 }

-void free_cluster(cluster_t * cluster) {
+void free_cluster(cluster_t * cluster)
+{
         if (cluster) {
                 if (cluster->nodes)
                         free_cluster_nodes(cluster);
@@ -197,7 +208,8 @@
 }

 void insert_before(neighbour_t *current, neighbour_t *neighbours,
-                   cluster_node_t *node) {
+                   cluster_node_t *node)
+{
         neighbours->next = current;
         if (current->prev) {
                 current->prev->next = neighbours;
@@ -207,12 +219,14 @@
         current->prev = neighbours;
 }

-void insert_after(neighbour_t *current, neighbour_t *neighbours) {
+void insert_after(neighbour_t *current, neighbour_t *neighbours)
+{
         neighbours->prev = current;
         current->next = neighbours;
 }

-void insert_sorted(cluster_node_t *node, neighbour_t *neighbours) {
+void insert_sorted(cluster_node_t *node, neighbour_t *neighbours)
+{
         neighbour_t *temp = node->neighbours;
         while (temp->next) {
                 if (temp->distance >= neighbours->distance) {
@@ -228,7 +242,8 @@
 }

-neighbour_t *add_neighbour(cluster_t *cluster, int index, int target) {
+neighbour_t *add_neighbour(cluster_t *cluster, int index, int target)
+{
         neighbour_t *neighbour = alloc_mem(1, neighbour_t);
         if (neighbour) {
                 neighbour->target = target;
@@ -243,7 +258,8 @@
         return neighbour;
 }

-cluster_t *update_neighbours(cluster_t *cluster, int index) {
+cluster_t *update_neighbours(cluster_t *cluster, int index)
+{
         cluster_node_t *node = &(cluster->nodes[index]);
         if (node->type == NOT_USED) {
                 invalid_node(index);
@@ -266,7 +282,8 @@
         return cluster;
 }

-cluster_node_t *add_leaf(cluster_t *cluster, const item_t *item) {
+cluster_node_t *add_leaf(cluster_t *cluster, const item_t *item)
+{
         cluster_node_t *t = &(cluster->nodes[cluster->num_nodes]);
         int len = strlen(item->label) + 1;
         t->label = alloc_mem(len, char);
@@ -293,7 +310,8 @@
         return t;
 }

-cluster_t *add_leaves(cluster_t *cluster, item_t *items) {
+cluster_t *add_leaves(cluster_t *cluster, item_t *items)
+{
         for (int i = 0; i < cluster->num_items; ++i) {
                 if (add_leaf(cluster, &items[i]))
                         update_neighbours(cluster, i);
@@ -305,7 +323,8 @@
         return cluster;
 }

-void print_cluster_items(cluster_t *cluster, int index) {
+void print_cluster_items(cluster_t *cluster, int index)
+{
         cluster_node_t *node = &(cluster->nodes[index]);
         fprintf(stdout, "Items: ");
         if (node->num_items > 0) {
@@ -317,7 +336,8 @@
         fprintf(stdout, "\n");
 }

-void print_cluster_node(cluster_t *cluster, int index) {
+void print_cluster_node(cluster_t *cluster, int index)
+{
         cluster_node_t *node = &(cluster->nodes[index]);
         fprintf(stdout, "Node %d - height: %d, centroid: (%5.3f, %5.3f)\n",
                 index, node->height, node->centroid.x, node->centroid.y);
@@ -337,7 +357,8 @@
 }

 void merge_items(cluster_t *cluster, cluster_node_t *node,
-                 cluster_node_t **to_merge) {
+                 cluster_node_t **to_merge)
+{
         node->type = A_MERGER;
         node->is_root = 1;
         node->height = -1;
@@ -367,7 +388,8 @@
         node->height++;
 }

-cluster_node_t *merge(cluster_t *cluster, int first, int second) {
+cluster_node_t *merge(cluster_t *cluster, int first, int second)
+{
         int new_idx = cluster->num_nodes;
         cluster_node_t *node = &(cluster->nodes[new_idx]);
         node->merged = alloc_mem(2, int);
@@ -407,7 +429,8 @@
                                   int node_idx,
                                   neighbour_t *neighbour,
                                   float *best_distance,
-                                  int *first, int *second) {
+                                  int *first, int *second)
+{
         while (neighbour) {
                 if (nodes[neighbour->target].is_root) {
                         if (*first == -1 ||
@@ -423,7 +446,8 @@
 }

-int find_clusters_to_merge(cluster_t *cluster, int *first, int *second) {
+int find_clusters_to_merge(cluster_t *cluster, int *first, int *second)
+{
         float best_distance = 0.0;
         int root_clusters_seen = 0;
         int j = cluster->num_nodes; /* traverse hierarchy top-down */
@@ -441,7 +465,8 @@
         return *first;
 }

-cluster_t *merge_clusters(cluster_t *cluster) {
+cluster_t *merge_clusters(cluster_t *cluster)
+{
         int first, second;
         while (cluster->num_clusters > 1) {
                 if (find_clusters_to_merge(cluster, &first, &second) != -1)
@@ -450,7 +475,8 @@
         return cluster;
 }

-cluster_t *agglomerate(int num_items, item_t *items) {
+cluster_t *agglomerate(int num_items, item_t *items)
+{
         cluster_t *cluster = alloc_mem(1, cluster_t);
         if (cluster) {
                 cluster->nodes = alloc_mem(2 * num_items - 1, cluster_node_t);
@@ -482,7 +508,8 @@
         return cluster;
 }

-int print_root_children(cluster_t *cluster, int i, int nodes_to_discard) {
+int print_root_children(cluster_t *cluster, int i, int nodes_to_discard)
+{
         cluster_node_t *node = &(cluster->nodes[i]);
         int roots_found = 0;
         if (node->type == A_MERGER) {
@@ -497,7 +524,8 @@
         return roots_found;
 }

-void get_k_clusters(cluster_t *cluster, int k) {
+void get_k_clusters(cluster_t *cluster, int k)
+{
         if (k < 1)
                 return;
         if (k > cluster->num_items)
@@ -518,12 +546,14 @@
         }
 }

-void print_cluster(cluster_t *cluster) {
+void print_cluster(cluster_t *cluster)
+{
         for (int i = 0; i < cluster->num_nodes; ++i)
                 print_cluster_node(cluster, i);
 }

-int read_items(int count, item_t *items, FILE *f) {
+int read_items(int count, item_t *items, FILE *f)
+{
         for (int i = 0; i < count; ++i) {
                 item_t *t = &(items[i]);
                 if (fscanf(f, "%[^|]| %10f %10f\n",
@@ -536,7 +566,8 @@
         return count;
 }

-int read_items_from_file(item_t **items, FILE *f) {
+int read_items_from_file(item_t **items, FILE *f)
+{
         int count, r;
         r = fscanf(f, "%5d\n", &count);
         if (r == 0) {
@@ -554,7 +585,8 @@
         return count;
 }

-void set_linkage(char linkage_type) {
+void set_linkage(char linkage_type)
+{
         switch (linkage_type) {
         case AVERAGE_LINKAGE:
                 distance_fptr = average_linkage;
@@ -570,7 +602,8 @@
         }
 }

-int process_input(item_t **items, const char *fname) {
+int process_input(item_t **items, const char *fname)
+{
         int count = 0;
         FILE *f = fopen(fname, "r");
         if (f) {
@@ -581,7 +614,8 @@
         return count;
 }

-int main(int argc, char **argv) {
+int main(int argc, char **argv)
+{
         if (argc != 4) {
                 fprintf(stderr, "Usage: %s <input file> <num clusters> "
                         "<linkage type>\n", argv[0]);


ACPI / video: Add HP EliteBook Revolve 810 to the blacklist

On HP EliteBook Revolve 810 the ACPI backlight device doesn't work as
expected. For example when resuming from system sleep, it seems to lose
backlight settings.

Forcing Intel driver fixes the problem so add this machine the ACPI
video detect blacklist.

Signed-off-by: Mika Westerberg <afb75201fb002d7fdd2b0b231e006999e00db8a9@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <27ffc44a8ec6a212fba98cfc3246c6ce8ab131e0@intel.com>


[Docs] Fix typo.

[Docs] Fix typo.

Signed-off-by: Guilherme Iscaro <cb2533f884a82b148f26e9601523457e695503d6@intel.com>

--- sml/include/sml_ann.h
+++ sml/include/sml_ann.h
@@ -123,7 +123,7 @@
 bool sml_is_ann(struct sml_object *sml);

 /**
- * @brief Check if SML was built with neural networks support support.
+ * @brief Check if SML was built with neural networks support.
  *
  * @return @c true If it has neural network support.
  * @return @c false If it is has not neural network support.
@@ -147,7 +147,7 @@
  *
  * Activation functions resides inside the neurons and they are responsible for producing the
  * neuron output value. As choosing the correct activation functions may required a
- * lot of trail and error tests, the SML uses an algorithm that tries to suit the best
+ * lot of trial and error tests, the SML uses an algorithm that tries to suit the best
  * activiation functions for a given problem.
  *
  * @remark By default all ::sml_ann_activation_function are used as candidates.


Heh. why not? let's have a .dsignore

Heh. why not? let's have a .dsignore

--- src/ignore.c
+++ src/ignore.c
@@ -20,6 +20,7 @@
 /* Warning: changing the first string will break skip_vcs_ignores. */
 const char *ignore_pattern_files[] = {
     ".agignore",
+    ".dsignore",
     ".gitignore",
     ".git/info/exclude",
     ".hgignore",


Correct comment in svnserve internal header file.

Patch by: David Mahakian <tmoli42@gmx.net>

* subversion/svnserve/server.h
  (serve_params_t): Data member read_only is no longer deprecrated.

git-svn-id: f8a4e5e023278da1e04e203c7fe051e3c4285d88@859798 13f79535-47bb-0310-9956-ffa450edef68

--- subversion/svnserve/server.h
+++ subversion/svnserve/server.h
@@ -2,7 +2,7 @@
  * svn_server.h :  declarations for the svn server
  *
  * ====================================================================
- * Copyright (c) 2000-2004 CollabNet.  All rights reserved.
+ * Copyright (c) 2000-2006 CollabNet.  All rights reserved.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution.  The terms
@@ -43,8 +43,8 @@
      identity EXTERNAL authenticates as. */
   const char *tunnel_user;

-  /* True if the deprecated read-only flag was specified on the
-     command-line, which forces all connections to be read-only. */
+  /* True if the read-only flag was specified on the command-line,
+     which forces all connections to be read-only. */
   svn_boolean_t read_only;
 } serve_params_t;


Enable minimal per-device resume tracing

This is the minimal resume trace code to find which device resume (if
any) results in problems.  Usually, you'd use the information this
generates as a starting point to adding more fine-grained trace event
points.

Signed-off-by: Linus Torvalds <69652caca27c8b940640ad396ab71f93cacec34f@osdl.org>

--- drivers/base/power/resume.c
+++ drivers/base/power/resume.c
@@ -9,6 +9,7 @@
  */

 #include <linux/device.h>
+#include <linux/resume-trace.h>
 #include "../base.h"
 #include "power.h"

@@ -23,6 +24,8 @@
 {
 	int error = 0;

+	TRACE_DEVICE(dev);
+	TRACE_RESUME(0);
 	down(&dev->sem);
 	if (dev->power.pm_parent
 			&& dev->power.pm_parent->power.power_state.event) {
@@ -36,6 +39,7 @@
 		error = dev->bus->resume(dev);
 	}
 	up(&dev->sem);
+	TRACE_RESUME(error);
 	return error;
 }


Expand PGPE optrace to Main Mem - No fnctl coreq rqmt image build vs hcode

Key_Cronus_Test=PM_REGRESS

Change-Id: I4d9cff7b32930161b91024dcab179d799e5d137c
Original-Change-Id: I823b350ffe1e07108fbadd4b0456c7188839932f
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/46480
Tested-by: HWSV CI <ae069ce3805842f4ed79e0ef7868baadb5df0a6b@us.ibm.com>
Tested-by: PPE CI <dc75934ba5befb9221434e67a247b93aec46b36b@us.ibm.com>
Tested-by: Jenkins Server <8e3f934e4c44875bc48d33da3ea13d93ba9a233f@us.ibm.com>
Tested-by: Hostboot CI <52521565bd8ea18a2b112942dce4f4220a97c2c8@us.ibm.com>
Tested-by: Cronus HW CI <a731a82009671cd8b97b45874b464801949fbbb7@us.ibm.com>
Tested-by: FSP CI Jenkins <aa9e4d9ac7cd25905e9c0dd36d4150516e73dd86@us.ibm.com>
Reviewed-by: Michael S. Floyd <fe74c9a922ad1b821954b2cbd8912f02d8d2c303@us.ibm.com>
Reviewed-by: Prem Shanker Jha <3a412e33a2e075117b5262bcf2504c145441bf2a@in.ibm.com>
Reviewed-by: Jennifer A. Stofer <ab93eca12e43608f33daa16a67357cd7b7e867ab@us.ibm.com>

--- src/import/chips/p9/procedures/hwp/lib/p9_pm_hcd_flags.h
+++ src/import/chips/p9/procedures/hwp/lib/p9_pm_hcd_flags.h
@@ -83,8 +83,7 @@
     L3_CONTAINED_MODE                       = 11,
     PGPE_SAFE_MODE_ERROR                    = 12,
     PGPE_OP_TRACE_DISABLE                   = 24,
-    PGPE_OP_TRACE_MEM_MODE_START            = 25,
-    PGPE_OP_TRACE_MEM_MODE_LENGTH           = 2
+    PGPE_OP_TRACE_MEM_MODE                  = 25
 };

 //


Bluetooth: hci_bcm: Add wake-up capability

Retrieve the Interruption used by BCM device, which can be declared
as Interruption or GpioInt in the ACPI table.
Retrieve IRQ polarity from the ACPI table to use it for host_wake_active
parameter of Setup Sleep vendor specific command.
Configure BCM device to wake-up the host.
Enable IRQ wake while suspended.

Signed-off-by: Frederic Danis <11ff228d40829526b224da8cbdff66853ab964a6@linux.intel.com>
Signed-off-by: Marcel Holtmann <44592b4eea36663c86b994bb0ea99d15309c1c7d@holtmann.org>

--- drivers/bluetooth/hci_bcm.c
+++ drivers/bluetooth/hci_bcm.c
@@ -31,6 +31,7 @@
 #include <linux/clk.h>
 #include <linux/gpio/consumer.h>
 #include <linux/tty.h>
+#include <linux/interrupt.h>

 #include <net/bluetooth/bluetooth.h>
 #include <net/bluetooth/hci_core.h>
@@ -51,6 +52,8 @@
 	bool			clk_enabled;

 	u32			init_speed;
+	int			irq;
+	u8			irq_polarity;

 #ifdef CONFIG_PM_SLEEP
 	struct hci_uart		*hu;
@@ -149,6 +152,86 @@
 	return 0;
 }

+#ifdef CONFIG_PM_SLEEP
+static irqreturn_t bcm_host_wake(int irq, void *data)
+{
+	struct bcm_device *bdev = data;
+
+	bt_dev_dbg(bdev, "Host wake IRQ");
+
+	return IRQ_HANDLED;
+}
+
+static int bcm_request_irq(struct bcm_data *bcm)
+{
+	struct bcm_device *bdev = bcm->dev;
+	int err = 0;
+
+	/* If this is not a platform device, do not enable PM functionalities */
+	mutex_lock(&bcm_device_lock);
+	if (!bcm_device_exists(bdev)) {
+		err = -ENODEV;
+		goto unlock;
+	}
+
+	if (bdev->irq > 0) {
+		err = devm_request_irq(&bdev->pdev->dev, bdev->irq,
+				       bcm_host_wake, IRQF_TRIGGER_RISING,
+				       "host_wake", bdev);
+		if (err)
+			goto unlock;
+
+		device_init_wakeup(&bdev->pdev->dev, true);
+	}
+
+unlock:
+	mutex_unlock(&bcm_device_lock);
+
+	return err;
+}
+
+static const struct bcm_set_sleep_mode default_sleep_params = {
+	.sleep_mode = 1,	/* 0=Disabled, 1=UART, 2=Reserved, 3=USB */
+	.idle_host = 2,		/* idle threshold HOST, in 300ms */
+	.idle_dev = 2,		/* idle threshold device, in 300ms */
+	.bt_wake_active = 1,	/* BT_WAKE active mode: 1 = high, 0 = low */
+	.host_wake_active = 0,	/* HOST_WAKE active mode: 1 = high, 0 = low */
+	.allow_host_sleep = 1,	/* Allow host sleep in SCO flag */
+	.combine_modes = 0,	/* Combine sleep and LPM flag */
+	.tristate_control = 0,	/* Allow tri-state control of UART tx flag */
+	/* Irrelevant USB flags */
+	.usb_auto_sleep = 0,
+	.usb_resume_timeout = 0,
+	.pulsed_host_wake = 0,
+	.break_to_host = 0
+};
+
+static int bcm_setup_sleep(struct hci_uart *hu)
+{
+	struct bcm_data *bcm = hu->priv;
+	struct sk_buff *skb;
+	struct bcm_set_sleep_mode sleep_params = default_sleep_params;
+
+	sleep_params.host_wake_active = !bcm->dev->irq_polarity;
+
+	skb = __hci_cmd_sync(hu->hdev, 0xfc27, sizeof(sleep_params),
+			     &sleep_params, HCI_INIT_TIMEOUT);
+	if (IS_ERR(skb)) {
+		int err = PTR_ERR(skb);
+		bt_dev_err(hu->hdev, "Sleep VSC failed (%d)", err);
+		return err;
+	}
+	kfree_skb(skb);
+
+	bt_dev_dbg(hu->hdev, "Set Sleep Parameters VSC succeeded");
+
+	return 0;
+}
+#else
+static inline int bcm_request_irq(struct bcm_data *bcm) { return 0; }
+static inline int bcm_setup_sleep(struct hci_uart *hu) { return 0; }
+#endif
+
 static int bcm_open(struct hci_uart *hu)
 {
 	struct bcm_data *bcm;
@@ -178,13 +261,11 @@
 #ifdef CONFIG_PM_SLEEP
 			dev->hu = hu;
 #endif
+			bcm_gpio_set_power(bcm->dev, true);
 			break;
 		}
 	}

-	if (bcm->dev)
-		bcm_gpio_set_power(bcm->dev, true);
-
 	mutex_unlock(&bcm_device_lock);

 	return 0;
@@ -193,15 +274,21 @@
 static int bcm_close(struct hci_uart *hu)
 {
 	struct bcm_data *bcm = hu->priv;
+	struct bcm_device *bdev = bcm->dev;

 	bt_dev_dbg(hu->hdev, "hu %p", hu);

 	/* Protect bcm->dev against removal of the device or driver */
 	mutex_lock(&bcm_device_lock);
-	if (bcm_device_exists(bcm->dev)) {
-		bcm_gpio_set_power(bcm->dev, false);
+	if (bcm_device_exists(bdev)) {
+		bcm_gpio_set_power(bdev, false);
 #ifdef CONFIG_PM_SLEEP
-		bcm->dev->hu = NULL;
+		if (device_can_wakeup(&bdev->pdev->dev)) {
+			devm_free_irq(&bdev->pdev->dev, bdev->irq, bdev);
+			device_init_wakeup(&bdev->pdev->dev, false);
+		}
+
+		bdev->hu = NULL;
 #endif
 	}
 	mutex_unlock(&bcm_device_lock);
@@ -227,6 +314,7 @@

 static int bcm_setup(struct hci_uart *hu)
 {
+	struct bcm_data *bcm = hu->priv;
 	char fw_name[64];
 	const struct firmware *fw;
 	unsigned int speed;
@@ -281,6 +369,12 @@
 	release_firmware(fw);

 	err = btbcm_finalize(hu->hdev);
+	if (err)
+		return err;
+
+	err = bcm_request_irq(bcm);
+	if (!err)
+		err = bcm_setup_sleep(hu);

 	return err;
 }
@@ -335,6 +429,7 @@
 static int bcm_suspend(struct device *dev)
 {
 	struct bcm_device *bdev = platform_get_drvdata(to_platform_device(dev));
+	int error;

 	bt_dev_dbg(bdev, "suspend: is_suspended %d", bdev->is_suspended);

@@ -357,6 +452,12 @@
 		mdelay(15);
 	}

+	if (device_may_wakeup(&bdev->pdev->dev)) {
+		error = enable_irq_wake(bdev->irq);
+		if (!error)
+			bt_dev_dbg(bdev, "BCM irq: enabled");
+	}
+
 unlock:
 	mutex_unlock(&bcm_device_lock);

@@ -374,6 +475,11 @@

 	if (!bdev->hu)
 		goto unlock;
+
+	if (device_may_wakeup(&bdev->pdev->dev)) {
+		disable_irq_wake(bdev->irq);
+		bt_dev_dbg(bdev, "BCM irq: disabled");
+	}

 	if (bdev->device_wakeup) {
 		gpiod_set_value(bdev->device_wakeup, true);
@@ -397,10 +503,12 @@

 static const struct acpi_gpio_params device_wakeup_gpios = { 0, 0, false };
 static const struct acpi_gpio_params shutdown_gpios = { 1, 0, false };
+static const struct acpi_gpio_params host_wakeup_gpios = { 2, 0, false };

 static const struct acpi_gpio_mapping acpi_bcm_default_gpios[] = {
 	{ "device-wakeup-gpios", &device_wakeup_gpios, 1 },
 	{ "shutdown-gpios", &shutdown_gpios, 1 },
+	{ "host-wakeup-gpios", &host_wakeup_gpios, 1 },
 	{ },
 };

@@ -408,13 +516,30 @@
 static int bcm_resource(struct acpi_resource *ares, void *data)
 {
 	struct bcm_device *dev = data;
-
-	if (ares->type == ACPI_RESOURCE_TYPE_SERIAL_BUS) {
-		struct acpi_resource_uart_serialbus *sb;
-
+	struct acpi_resource_extended_irq *irq;
+	struct acpi_resource_gpio *gpio;
+	struct acpi_resource_uart_serialbus *sb;
+
+	switch (ares->type) {
+	case ACPI_RESOURCE_TYPE_EXTENDED_IRQ:
+		irq = &ares->data.extended_irq;
+		dev->irq_polarity = irq->polarity;
+		break;
+
+	case ACPI_RESOURCE_TYPE_GPIO:
+		gpio = &ares->data.gpio;
+		if (gpio->connection_type == ACPI_RESOURCE_GPIO_TYPE_INT)
+			dev->irq_polarity = gpio->polarity;
+		break;
+
+	case ACPI_RESOURCE_TYPE_SERIAL_BUS:
 		sb = &ares->data.uart_serial_bus;
 		if (sb->type == ACPI_RESOURCE_SERIAL_TYPE_UART)
 			dev->init_speed = sb->default_baud_rate;
+		break;
+
+	default:
+		break;
 	}

 	/* Always tell the ACPI core to skip this resource */
@@ -452,6 +577,21 @@
 						GPIOD_OUT_LOW);
 	if (IS_ERR(dev->shutdown))
 		return PTR_ERR(dev->shutdown);
+
+	/* IRQ can be declared in ACPI table as Interrupt or GpioInt */
+	dev->irq = platform_get_irq(pdev, 0);
+	if (dev->irq <= 0) {
+		struct gpio_desc *gpio;
+
+		gpio = devm_gpiod_get_optional(&pdev->dev, "host-wakeup",
+					       GPIOD_IN);
+		if (IS_ERR(gpio))
+			return PTR_ERR(gpio);
+
+		dev->irq = gpiod_to_irq(gpio);
+	}
+
+	dev_info(&pdev->dev, "BCM irq: %d\n", dev->irq);

 	/* Make sure at-least one of the GPIO is defined and that
 	 * a name is specified for this instance


tpm: Do not dereference NULL pointer if acpi_os_map_memory() fails.

In drivers/char/tpm/tpm_acpi.c::read_log() we call
acpi_os_map_memory(). That call may fail for a number of reasons
(invalid address, out of memory etc). If the call fails it returns
NULL and we just pass that to memcpy() unconditionally, which will go
bad when it tries to dereference the pointer.

Unfortunately we just get NULL back, so we can't really tell the user
exactely what went wrong, but we can at least avoid crashing and
return an error (-EIO seemed more generic and more suitable here than
-ENOMEM or something else, so I picked that).

Signed-off-by: Jesper Juhl <7323a5431d1c31072983a6a5bf23745b655ddf59@chaosbits.net>
Signed-off-by: Kent Yoder <a62f2225bf70bfaccbc7f1ef2a397836717377de@linux.vnet.ibm.com>

--- drivers/char/tpm/tpm_acpi.c
+++ drivers/char/tpm/tpm_acpi.c
@@ -96,6 +96,11 @@
 	log->bios_event_log_end = log->bios_event_log + len;

 	virt = acpi_os_map_memory(start, len);
+	if (!virt) {
+		kfree(log->bios_event_log);
+		printk("%s: ERROR - Unable to map memory\n", __func__);
+		return -EIO;
+	}

 	memcpy(log->bios_event_log, virt, len);


clk: imx27: retain early UART clocks during kernel init

Make sure to keep UART clocks enabled during kernel init if
earlyprintk or earlycon are active.

Signed-off-by: Lucas Stach <48c9e973d8f86eb0cdae200124c5925db7587c4e@pengutronix.de>
Signed-off-by: Shawn Guo <63670015a35b5e259a12af9c49179087023f8740@kernel.org>


firmware: dmi_scan: Fix dmi scan to handle "End of Table" structure

The dmi-sysfs should create "End of Table" entry, that is type 127. But
after adding initial SMBIOS v3 support fc43026278b2 ("dmi: add support
for SMBIOS 3.0 64-bit entry point") the 127-0 entry is not handled any
more, as result it's not created in dmi sysfs for instance. This is
important because the size of whole DMI table must correspond to sum of
all DMI entry sizes.

So move the end-of-table check after it's handled by dmi_table.

Reviewed-by: Ard Biesheuvel <b0aa78e2e96de8e8dd0708772d4b6bad167c33bc@linaro.org>
Signed-off-by: Ivan Khoronzhuk <15ad2a232c436ab54d1b78ef06a09c4cd03911f0@linaro.org>
Cc: <4fbacc2fa0ffdbb11bf1ad6925b886ebd08dd15f@vger.kernel.org> # v3.19
Signed-off-by: Matt Fleming <b02f0790d66a0f0a6b369873bf6df37420fbe5dd@intel.com>

--- drivers/firmware/dmi_scan.c
+++ drivers/firmware/dmi_scan.c
@@ -93,12 +93,6 @@
 		const struct dmi_header *dm = (const struct dmi_header *)data;

 		/*
-		 * 7.45 End-of-Table (Type 127) [SMBIOS reference spec v3.0.0]
-		 */
-		if (dm->type == DMI_ENTRY_END_OF_TABLE)
-			break;
-
-		/*
 		 *  We want to know the total length (formatted area and
 		 *  strings) before decoding to make sure we won't run off the
 		 *  table in dmi_decode or dmi_string
@@ -108,6 +102,13 @@
 			data++;
 		if (data - buf < len - 1)
 			decode(dm, private_data);
+
+		/*
+		 * 7.45 End-of-Table (Type 127) [SMBIOS reference spec v3.0.0]
+		 */
+		if (dm->type == DMI_ENTRY_END_OF_TABLE)
+			break;
+
 		data += 2;
 		i++;
 	}


Add TI TCA9554 to supported devices table

Signed-off-by: Nikolay Balandin <5f20d3583081a9ebcfc87f08974215600267ff97@dev.rtsoft.ru>
Acked-by: Kuninori Morimoto <a3b51ccb87d18302c1692defcfbf83319d1737eb@renesas.com>
Signed-off-by: Linus Walleij <9cd9d802d23c0ed5e224beabf4ae4a5c478746ef@linaro.org>


drm/modes: Print the mode status in human readable form

Currently when a mode is rejected the reason is printed as a raw number.
Having to manually decode that to a enum drm_mode_status value is
tiresome. Have the code do the decoding instead and print the result
in a human readable format.

Just having an array of strings indexed with the mode status doesn't
work since the enum includes negative values. So we offset the status
by +3 which makes all the indexes non-negative. Also add a bit of
paranoia into the code to catch out of bounds accesses in case
someone adds more enum values but forgets to update the code.

Signed-off-by: Ville Syrjälä <cd6e8d405ca90be3a03d5427c5b24fbd2d68dcc4@linux.intel.com>
Reviewed-by: Alex Deucher <08dc22c6156113f2deff178e35e3ed9b24d6af9e@amd.com>
Signed-off-by: Daniel Vetter <c1b6782c4af8f0673da8923a0702a1832e5940f4@ffwll.ch>


ide-cs: Add additional id string (corsair, 1GB)

This patch adds id strings for Corsair 1GB (identified as Hyperstone Model1)
inside legacy/ide-cs.c.

It also includes some minor whitespace cleanups.

Signed-off-by: Kristoffer Ericson <aa612af59a96f3eb9dbe4c12cd763177da6414ff@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <248de9df611a028e5eceb9d893a2ed6c24c89ef4@gmail.com>

--- drivers/ide/legacy/ide-cs.c
+++ drivers/ide/legacy/ide-cs.c
@@ -28,7 +28,7 @@
     and other provisions required by the GPL.  If you do not delete
     the provisions above, a recipient may use your version of this
     file under either the MPL or the GPL.
-
+
 ======================================================================*/

 #include <linux/module.h>
@@ -327,13 +327,13 @@
     After a card is removed, ide_release() will unregister the net
     device, and release the PCMCIA configuration.  If the device is
     still open, this will be postponed until it is closed.
-
+
 ======================================================================*/

 void ide_release(struct pcmcia_device *link)
 {
     ide_info_t *info = link->priv;
-
+
     DEBUG(0, "ide_release(0x%p)\n", link);

     if (info->ndev) {
@@ -353,11 +353,12 @@
     stuff to run after an event is received.  A CARD_REMOVAL event
     also sets some flags to discourage the ide drivers from
     talking to the ports.
-
+
 ======================================================================*/

 static struct pcmcia_device_id ide_ids[] = {
 	PCMCIA_DEVICE_FUNC_ID(4),
+	PCMCIA_DEVICE_MANF_CARD(0x0000, 0x0000),	/* Corsair */
 	PCMCIA_DEVICE_MANF_CARD(0x0007, 0x0000),	/* Hitachi */
 	PCMCIA_DEVICE_MANF_CARD(0x000a, 0x0000),	/* I-O Data CFA */
 	PCMCIA_DEVICE_MANF_CARD(0x001c, 0x0001),	/* Mitsubishi CFA */
@@ -366,7 +367,7 @@
 	PCMCIA_DEVICE_MANF_CARD(0x0098, 0x0000),	/* Toshiba */
 	PCMCIA_DEVICE_MANF_CARD(0x00a4, 0x002d),
 	PCMCIA_DEVICE_MANF_CARD(0x00ce, 0x0000),	/* Samsung */
- 	PCMCIA_DEVICE_MANF_CARD(0x0319, 0x0000),	/* Hitachi */
+	PCMCIA_DEVICE_MANF_CARD(0x0319, 0x0000),	/* Hitachi */
 	PCMCIA_DEVICE_MANF_CARD(0x2080, 0x0001),
 	PCMCIA_DEVICE_MANF_CARD(0x4e01, 0x0100),	/* Viking CFA */
 	PCMCIA_DEVICE_MANF_CARD(0x4e01, 0x0200),	/* Lexar, Viking CFA */
@@ -384,6 +385,7 @@
 	PCMCIA_DEVICE_PROD_ID12("FREECOM", "PCCARD-IDE", 0x5714cbf7, 0x48e0ab8e),
 	PCMCIA_DEVICE_PROD_ID12("HITACHI", "FLASH", 0xf4f43949, 0x9eb86aae),
 	PCMCIA_DEVICE_PROD_ID12("HITACHI", "microdrive", 0xf4f43949, 0xa6d76178),
+	PCMCIA_DEVICE_PROD_ID12("Hyperstone", "Model1", 0x3d5b9ef5, 0xca6ab420),
 	PCMCIA_DEVICE_PROD_ID12("IBM", "microdrive", 0xb569a6e5, 0xa6d76178),
 	PCMCIA_DEVICE_PROD_ID12("IBM", "IBM17JSSFP20", 0xb569a6e5, 0xf2508753),
 	PCMCIA_DEVICE_PROD_ID12("KINGSTON", "CF8GB", 0x2e6d1829, 0xacbe682e),


iio:accel:mma8452: check values to be written

Check values to be written to the device for valid lower and upper bounds.

Signed-off-by: Hartmut Knaack <4bccb8448924141fc676c25eb657b52ee47a361d@gmx.de>
Signed-off-by: Jonathan Cameron <09f65b71b7655725897b2fd41a09a0cefe2e1ace@kernel.org>


drivers/lc709203f: fix typo 'Invlid' -> 'Invalid'

--- drivers/include/lc709203f.h
+++ drivers/include/lc709203f.h
@@ -311,7 +311,7 @@
  * @param[in] *dev		pointer to lc709203f_t struct containing the i2c device and the address
  * @param[in] value		temp in 0.1K 0xAAC=0°C
  *
- * @return              LC709203F_CELL_TEMP_INVALID Invlid cell temp
+ * @return              LC709203F_CELL_TEMP_INVALID Invalid cell temp

  */
 int8_t lc709203f_set_cell_temp(const lc709203f_t *dev, const unsigned int value);


Rationalise error handling. dbi_conn_error() now works correctly.

--- drivers/ingres/dbd_ingres.c
+++ drivers/ingres/dbd_ingres.c
@@ -17,7 +17,7 @@
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
- * $Id: dbd_ingres.c,v 1.7 2006/06/01 20:11:08 qu1j0t3 Exp $
+ * $Id: dbd_ingres.c,v 1.8 2006/06/02 07:44:13 qu1j0t3 Exp $
  */

 #ifdef HAVE_CONFIG_H
@@ -69,11 +69,16 @@

 #define AUTOCOMMIT_ON(C) (((ingres_conn_t*)C->connection)->autoTranHandle != NULL)

+#define SAVE_ERROR(C,E) ingres_error(E, 0, &((ingres_conn_t*)C->connection)->errorCode, \
+										   &((ingres_conn_t*)C->connection)->errorMsg)
+
 typedef struct {
 	II_PTR connHandle;
 	II_PTR autoTranHandle;
 	II_LONG sizeAdvise; // advised buffer size for blob (long) types
 	dbi_conn_t *sysConn; // used for querying system catalogs
+	II_LONG errorCode;
+	char *errorMsg;
 } ingres_conn_t;

 typedef struct {
@@ -86,7 +91,7 @@
 static void ingres_classify_field(IIAPI_DESCRIPTOR *ds, unsigned short *type, unsigned int *attribs);
 static int ingres_connect(dbi_conn_t *conn, const char *db, const char *autocommit);
 static dbi_result_t *ingres_query(dbi_conn_t *conn, const char *statement, II_PTR *tranHandle);
-void ingres_error(dbi_conn_t *conn, II_PTR errorHandle);
+void ingres_error(II_PTR errorHandle, int print, int *errno, char **errmsg);

 // months.gperf.c
 struct month *in_word_set (register const char *str, register unsigned int len);
@@ -96,19 +101,18 @@

 	for( waitParm.wt_timeout = -1 ; ! pgp->gp_completed ; )
 		IIapi_wait(&waitParm);
-	ingres_error(conn, pgp->gp_errorHandle);
 	return pgp->gp_status;
 }

-static void ingres_close(II_PTR hdl) {
+static void ingres_close(dbi_conn_t *conn, II_PTR hdl) {
 	IIAPI_STATUS status;
 	IIAPI_CLOSEPARM closeParm = {{NULL, NULL}};

 	if(hdl){
 		closeParm.cl_stmtHandle = hdl;
-		_verbose_handler(NULL, "closing stmtHandle %#x...\n", hdl);
+		_verbose_handler(conn, "closing stmtHandle %#x...\n", hdl);
 		IIapi_close(&closeParm);
-		ingres_wait(NULL, &closeParm.cl_genParm);
+		ingres_wait(conn, &closeParm.cl_genParm);
 	}
 }

@@ -219,36 +223,44 @@
 	return ingres_connect(conn, NULL, dbi_conn_get_option(conn, "ingres_autocommit"));
 }

-#define ERRMAX 1024
-void ingres_error(dbi_conn_t *conn, II_PTR errorHandle){
+void ingres_error(II_PTR errorHandle, int print, int *errno, char **errmsg){
 	static char *typestr[] = {"0","ERROR","WARNING","MESSAGE"};
-	char *msg, *p, buf[0x100];
-	int count, n;
+	char *p, buf[0x200];
+	int count, n, size=0x200;
 	IIAPI_GETEINFOPARM eiParm;

-	if( errorHandle /*&& (msg = malloc(ERRMAX))*/ ){
-		eiParm.ge_errorHandle = errorHandle;
-		for(p = msg, count = 0;;){
+	if(errmsg){
+		if(*errmsg) free(*errmsg);
+		*errmsg = malloc(size);
+	}
+	if( (eiParm.ge_errorHandle = errorHandle) ){
+		for(count = 0;;){
 			IIapi_getErrorInfo(&eiParm);
 			if(eiParm.ge_status == IIAPI_ST_SUCCESS){
 				n = snprintf(buf, sizeof(buf), "%s-%s-%08X  %s\n",
 							 typestr[eiParm.ge_type], eiParm.ge_SQLSTATE,
 							 eiParm.ge_errorCode, eiParm.ge_message);
-				_verbose_handler(conn, buf);
-				//n = strlen(eiParm.ge_message);
-				/*if(count+n < ERRMAX){
-					memcpy(p, buf, n);
-					p += n;
-					count += n;
-					*p++ = '\n';
-				}*/
+				/*if(print)*/ _verbose_handler(NULL, buf);
+				if(errno) *errno = eiParm.ge_errorCode; // store last error
+				if(errmsg){
+					if(count+n >= size){
+						size += n + 0x200;
+						if( (p = realloc(*errmsg, size)) )
+							*errmsg = p;
+					}else
+						p = *errmsg;
+					if(p){
+						memcpy(p+count, buf, n);
+						p[n] = 0;
+						count += n;
+					}
+				}
 			}else
 				break;
 		}
-		/*if(conn){
-			if(conn->error_message) free(conn->error_message);
-			conn->error_message = msg;
-		}*/
+	}else{
+		if(errmsg) *errmsg = NULL;
+		if(errno) *errno = 0;
 	}
 }

@@ -284,6 +296,15 @@
 	IIAPI_AUTOPARM acParm = {{NULL, NULL}};
 	IIAPI_STATUS status;

+	// we need this structure whether connection succeeds or not,
+	// at least to track the error handle.
+	conn->connection = iconn = malloc(sizeof(ingres_conn_t));
+	iconn->connHandle = NULL;
+	iconn->autoTranHandle = NULL;
+	iconn->sysConn = NULL;
+	iconn->errorCode = 0;
+	iconn->errorMsg = NULL;
+
 	scParm.sc_connHandle = NULL; // later, envHandle, but currently that causes connect to fail (?!)

 	//_verbose_handler(NULL, "ingres_connect: envHandle=%#x\n",envHandle);
@@ -311,15 +332,12 @@

 	IIapi_connect(&connParm);
 	status = ingres_wait(conn, &connParm.co_genParm);
-
+	SAVE_ERROR(conn, connParm.co_genParm.gp_errorHandle);
 	if(status >= IIAPI_ST_SUCCESS && status < IIAPI_ST_ERROR){
 		_verbose_handler(conn, "connected, target='%s', API level=%d\n",
 						 connParm.co_target, connParm.co_apiLevel);
-		conn->connection = iconn = malloc(sizeof(ingres_conn_t));
 		iconn->connHandle = connParm.co_connHandle;
-		iconn->autoTranHandle = NULL;
 		iconn->sizeAdvise = connParm.co_sizeAdvise;
-		iconn->sysConn = NULL;
 		if(!autocommit || atoi(autocommit)){ // enable auto-commit by default
 			// set autocommit mode
 			acParm.ac_connHandle = connParm.co_connHandle;
@@ -364,7 +382,6 @@
 		_verbose_handler(conn, "disconnecting...\n");
 		IIapi_disconnect( &disconnParm );
 		ingres_wait(conn, &disconnParm.dc_genParm);
-
 		free(conn->connection);
 		conn->connection = NULL;
 	}
@@ -427,6 +444,7 @@
 			retval = 1;
 			break;
 		}else if ( status > IIAPI_ST_NO_DATA ){
+			SAVE_ERROR(result->conn, gcParm.gc_genParm.gp_errorHandle);
 			_verbose_handler(result->conn,"getColumns returned status %d; aborting\n",status);
 			break;
 		}else if(gcParm.gc_moreSegments){
@@ -520,6 +538,7 @@
 						// getColumns already copied data
 						//_verbose_handler(result->conn,"  [%d] copying %d bytes\n",i,databuf[i].dv_length);
 						memcpy(&row->field_values[i], databuf[i].dv_value, databuf[i].dv_length);
+						// memcpy() isn't particularly efficient for this. even a switch on length would probably be faster...
 						break;
 					default:
 						_verbose_handler(result->conn,"can't handle column type = %d\n",desc[i].ds_dataType);
@@ -533,7 +552,7 @@
 	}

 	// Don't need this handle any more.
-	ingres_close(pres->stmtHandle);
+	ingres_close(result->conn, pres->stmtHandle);
 	pres->stmtHandle = NULL;

 	result->numrows_matched = count;
@@ -556,7 +575,7 @@

 int dbd_free_query(dbi_result_t *result) {
 	if(result->result_handle){
-		ingres_close(((ingres_result_t*)result->result_handle)->stmtHandle);
+		ingres_close(result->conn, ((ingres_result_t*)result->result_handle)->stmtHandle);
 		free(result->result_handle);
 		result->result_handle = NULL;
 	}
@@ -736,6 +755,8 @@
 	queryParm.qy_stmtHandle = NULL;
 	IIapi_query( &queryParm );
 	status = ingres_wait(conn, &queryParm.qy_genParm);
+	SAVE_ERROR(conn, queryParm.qy_genParm.gp_errorHandle);
+
 	if(tranHandle) *tranHandle = queryParm.qy_tranHandle;

 	if(status == IIAPI_ST_NO_DATA)
@@ -746,6 +767,7 @@
 		gdParm.gd_stmtHandle = queryParm.qy_stmtHandle;
 		IIapi_getDescriptor(&gdParm);
     	status = ingres_wait(conn, &gdParm.gd_genParm);
+    	SAVE_ERROR(conn, gdParm.gd_genParm.gp_errorHandle);
 		if(status >= IIAPI_ST_SUCCESS && status < IIAPI_ST_ERROR){
 			// if descriptorCount is zero, no data can be expected
 			// create result struct anyway
@@ -755,7 +777,7 @@
 				gqParm.gq_stmtHandle = queryParm.qy_stmtHandle;
 				IIapi_getQueryInfo(&gqParm);
 				status = ingres_wait(conn, &gqParm.gq_genParm);
-
+				SAVE_ERROR(conn, gqParm.gq_genParm.gp_errorHandle);
 				if(status >= IIAPI_ST_SUCCESS && status < IIAPI_ST_ERROR && (gqParm.gq_mask & IIAPI_GQ_ROW_COUNT)){
 					affectedRows = gqParm.gq_rowCount;
 					_verbose_handler(conn,"getQueryInfo: row count = %d\n",affectedRows);
@@ -764,7 +786,7 @@

 				res = _dbd_result_create(conn, NULL, 0, affectedRows);
 				_verbose_handler(conn,"no descriptors\n");
-				ingres_close(queryParm.qy_stmtHandle);
+				ingres_close(conn, queryParm.qy_stmtHandle);
 			}else{
 				_verbose_handler(conn,"new result set, stmtHandle = %#x\n",queryParm.qy_stmtHandle);
 				pres = malloc(sizeof(ingres_result_t));
@@ -795,7 +817,7 @@
 	}
 	// must have been an error.
 	if(!res)
-		ingres_close(queryParm.qy_stmtHandle);
+		ingres_close(conn, queryParm.qy_stmtHandle);
 	return res;
 }

@@ -804,7 +826,7 @@
 }

 dbi_result_t *dbd_query_null(dbi_conn_t *conn, const unsigned char *statement, size_t st_length) {
-	_verbose_handler(conn, "dbd_query_null() not implemented\n");
+	_verbose_handler(conn, "dbd_query_null() not implemented\n"); //FIXME: use internal error handler (fix other instances too!)
 	return NULL;
 }

@@ -825,9 +847,12 @@
 int dbd_geterror(dbi_conn_t *conn, int *errno, char **errstr) {
 	/* put error number into errno, error string into errstr
 	 * return 0 if error, 1 if errno filled, 2 if errstr filled, 3 if both errno and errstr filled */
-	// for now, just assume errstr was set up by a ingres_error call
-	// FIXME: we really need to be able to stash an errorhandle instead (after each API call), and use it here
-	return 2;
+	if(conn && conn->connection && ((ingres_conn_t*)conn->connection)->errorMsg){
+		*errno = ((ingres_conn_t*)conn->connection)->errorCode;
+		*errstr = strdup( ((ingres_conn_t*)conn->connection)->errorMsg );
+		return 3;
+	}
+	return 0;
 }

 unsigned long long dbd_get_seq_last(dbi_conn_t *conn, const char *sequence) {
@@ -848,6 +873,7 @@

 	asprintf(&sql, "SELECT CURRENT VALUE FOR %s", sequence);
 	res = ingres_query(conn, sql, NULL);
+	free(sql);
 	if(res && dbi_result_next_row(res))
 		seq = dbi_result_get_int_idx(res,1);
 	else if(AUTOCOMMIT_ON(conn))
@@ -867,6 +893,7 @@

 	asprintf(&sql, "SELECT NEXT VALUE FOR %s", sequence);
 	res = ingres_query(conn, sql, &tran);
+	free(sql);
 	if(res && dbi_result_next_row(res))
 		seq = dbi_result_get_int_idx(res,1);
 	if(res) dbi_result_free(res);


Fix release mode compile error.

Fix release mode compile error.

odbgstream must always be included before hrtext.

Change-Id: I184e8e9ec61c51b8f7e3f5d38135dfa85405d69e

--- client_encoder/win/dshow_util.h
+++ client_encoder/win/dshow_util.h
@@ -10,8 +10,9 @@

 #include <ios>

+#include "webmdshow/common/odbgstream.hpp"  // NOLINT
+// Above include NOLINT'd because it *must always* come before hrtext.
 #include "webmdshow/common/hrtext.hpp"
-#include "webmdshow/common/odbgstream.hpp"

 // Extracts error from the HRESULT, and outputs its hex and decimal values.
 #define HRLOG(X) \


isdn/capi: unregister capictr notifier after init failure

capidrv_init() could leave capictr notifier dangling after init
failure.  Fix it.

Signed-off-by: Tejun Heo <546b05909706652891a87f7bfe385ae147f61f91@kernel.org>
Acked-by: Jan Kiszka <a5b45c9af271d077f30d36aa7d9b988eed9d56eb@web.de>

--- drivers/isdn/capi/capidrv.c
+++ drivers/isdn/capi/capidrv.c
@@ -2297,6 +2297,7 @@

 	errcode = capi20_get_profile(0, &profile);
 	if (errcode != CAPI_NOERROR) {
+		unregister_capictr_notifier(&capictr_nb);
 		capi20_release(&global.ap);
 		return -EIO;
 	}


isdn: Fix typo in isdn_ppp.c

isdn: Fix typo in isdn_ppp.c

Correct spelling "reseting" to "resetting" in
drivers/isdn/i4l/isdn_ppp.c

Signed-off-by: Masanari Iida <f31bb8ac2957d045575b3081e813605474613a21@gmail.com>
Signed-off-by: David S. Miller <fe08d3c717adf2ae63592e4c9aec6e3e404d8e3e@davemloft.net>

--- drivers/isdn/i4l/isdn_ppp.c
+++ drivers/isdn/i4l/isdn_ppp.c
@@ -1156,7 +1156,7 @@
 	if (!(is->active_filter
 	      && sk_run_filter(skb, is->active_filter) == 0)) {
 		if (is->debug & 0x2)
-			printk(KERN_DEBUG "IPPP: link-active filter: reseting huptimer.\n");
+			printk(KERN_DEBUG "IPPP: link-active filter: resetting huptimer.\n");
 		lp->huptimer = 0;
 		if (mlp)
 			mlp->huptimer = 0;
@@ -1302,7 +1302,7 @@
 	if (!(ipt->active_filter
 	      && sk_run_filter(skb, ipt->active_filter) == 0)) {
 		if (ipt->debug & 0x4)
-			printk(KERN_DEBUG "IPPP: link-active filter: reseting huptimer.\n");
+			printk(KERN_DEBUG "IPPP: link-active filter: resetting huptimer.\n");
 		lp->huptimer = 0;
 	}
 	skb_pull(skb, 4);


Add modified version of hal_priv.h

Add modified version of hal_priv.h

Signed-off-by: Mick <42e9b8d49a07279cb832caaba75ae62c3ee30fbb@mgware.co.uk>

--- src/hal/lib/hal_priv.h
+++ src/hal/lib/hal_priv.h
@@ -357,7 +357,7 @@

 } hal_param_t;

-hal_param_t MK_DEPRECATED;
+//hal_param_t MK_DEPRECATED;

 static inline const hal_type_t sig_type(const hal_sig_t *sig) {


leds: convert Sun Fire LED driver to devm_kzalloc() and cleanup error exit path

Cc: David S. Miller <fe08d3c717adf2ae63592e4c9aec6e3e404d8e3e@davemloft.net>
Signed-off-by: Bryan Wu <465f0e91e61585f5bc1128e7fe63296c33a56926@canonical.com>

--- drivers/leds/leds-sunfire.c
+++ drivers/leds/leds-sunfire.c
@@ -132,15 +132,13 @@
 	if (pdev->num_resources != 1) {
 		printk(KERN_ERR PFX "Wrong number of resources %d, should be 1\n",
 		       pdev->num_resources);
-		err = -EINVAL;
-		goto out;
-	}
-
-	p = kzalloc(sizeof(*p), GFP_KERNEL);
+		return -EINVAL;
+	}
+
+	p = devm_kzalloc(&pdev->dev, sizeof(*p), GFP_KERNEL);
 	if (!p) {
 		printk(KERN_ERR PFX "Could not allocate struct sunfire_drvdata\n");
-		err = -ENOMEM;
-		goto out;
+		return -ENOMEM;
 	}

 	for (i = 0; i < NUM_LEDS_PER_BOARD; i++) {
@@ -156,20 +154,15 @@
 		if (err) {
 			printk(KERN_ERR PFX "Could not register %s LED\n",
 			       lp->name);
-			goto out_unregister_led_cdevs;
+			for (i--; i >= 0; i--)
+				led_classdev_unregister(&p->leds[i].led_cdev);
+			return err;
 		}
 	}

 	dev_set_drvdata(&pdev->dev, p);

 	return 0;
-
-out_unregister_led_cdevs:
-	for (i--; i >= 0; i--)
-		led_classdev_unregister(&p->leds[i].led_cdev);
-	kfree(p);
-out:
-	return err;
 }

 static int __devexit sunfire_led_generic_remove(struct platform_device *pdev)
@@ -179,8 +172,6 @@

 	for (i = 0; i < NUM_LEDS_PER_BOARD; i++)
 		led_classdev_unregister(&p->leds[i].led_cdev);
-
-	kfree(p);

 	return 0;
 }


[media] adv7604: initialize timings to CEA 640x480p59.94

This timing must be supported by all HDMI equipment, so that's a
reasonable default.

Signed-off-by: Hans Verkuil <3a513708f73c27e7d36ebc496aa41dad6a3153ea@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <0cae1d1e981e84d16b82ca3d17be8a7f826608d3@samsung.com>

--- drivers/media/i2c/adv7604.c
+++ drivers/media/i2c/adv7604.c
@@ -2207,6 +2207,8 @@
 static int adv7604_probe(struct i2c_client *client,
 			 const struct i2c_device_id *id)
 {
+	static const struct v4l2_dv_timings cea640x480 =
+		V4L2_DV_BT_CEA_640X480P59_94;
 	struct adv7604_state *state;
 	struct adv7604_platform_data *pdata = client->dev.platform_data;
 	struct v4l2_ctrl_handler *hdl;
@@ -2234,7 +2236,8 @@
 		v4l_err(client, "No platform data!\n");
 		return -ENODEV;
 	}
-	memcpy(&state->pdata, pdata, sizeof(state->pdata));
+	state->pdata = *pdata;
+	state->timings = cea640x480;

 	sd = &state->sd;
 	v4l2_i2c_subdev_init(sd, client, &adv7604_ops);


mmc: sdhci-st: Do cleanup while mmc_of_parse() return an error

At errors, balance sdhci_pltfm_init() with sdhci_pltfm_free(), to make
sure all data is freed properly.

Cc: Srinivas Kandagatla <e9a3fcd7365f8e6a430ada3b68b984cb4aaf0c3e@gmail.com>
Cc: Maxime Coquelin <9a2667dee3b90866bbc9c2696cff2b7d5616c95a@st.com>
Cc: Patrice Chotard <d719ec623d33f81f80f0590564803dead94a5492@st.com>
Signed-off-by: Ulf Hansson <fe47b31f388f85ce6ddf64bf3a0cf6b46077d0e6@linaro.org>
Acked-by: Maxime Coquelin <9a2667dee3b90866bbc9c2696cff2b7d5616c95a@st.com>


introduce bmapflushwaitq

introduce bmapflushwaitq

git-svn-id: ae92b08b608af1c8cefa3e10d2325ea527204e07@13777 3eda493b-6a19-0410-b2e0-ec8ea4dd8fda

--- mount_slash/bmap_flush.c
+++ mount_slash/bmap_flush.c
@@ -59,6 +59,8 @@
 #define pndgReqsLock()		spinlock(&pndgReqLock)
 #define pndgReqsUlock()		freelock(&pndgReqLock)

+struct psc_waitq		bmapflushwaitq = PSC_WAITQ_INIT;
+
 __static void
 bmap_flush_reap_rpcs(void)
 {
@@ -992,11 +994,13 @@
 msbmapflushthr_main(__unusedx struct psc_thread *thr)
 {
 	int nrpcs;
+	struct timespec ts = { 0, 2048000 };
+
 	while (pscthr_run()) {
 		nrpcs = MAX_OUTSTANDING_RPCS - atomic_read(&outstandingRpcCnt);
 		if (nrpcs > 0)
 			bmap_flush(nrpcs);
-		usleep(2048);
+		psc_waitq_waitrel(&bmapflushwaitq, NULL, &ts);
 	}
 }

@@ -1022,6 +1026,7 @@
 	atomic_set(&outstandingRpcCnt, 0);
 	atomic_set(&completedRpcCnt, 0);
 	psc_waitq_init(&rpcCompletion);
+	psc_waitq_init(&bmapflushwaitq);

 	lc_reginit(&bmapFlushQ, struct bmapc_memb,
 	    bcm_lentry, "bmapflush");


mtd: mxc_nand: Remove duplicate NAND_CMD_RESET case value

This reverts commit 66803762 ("mtd: mxc_nand: add RESET command support").
Support for NAND_CMD_RESET was added separately in commit d4840180
("mtd: mxc_nand: set NFC registers after reset"), causing a build error:

drivers/mtd/nand/mxc_nand.c: In function 'mxc_nand_command':
drivers/mtd/nand/mxc_nand.c:689: error: duplicate case value
drivers/mtd/nand/mxc_nand.c:606: error: previously used here

Signed-off-by: David Woodhouse <b460d66aaf00c296a3db1c1d9eeafc081d5f7d70@intel.com>

--- drivers/mtd/nand/mxc_nand.c
+++ drivers/mtd/nand/mxc_nand.c
@@ -686,7 +686,6 @@

 	case NAND_CMD_ERASE1:
 	case NAND_CMD_ERASE2:
-	case NAND_CMD_RESET:
 		send_cmd(host, command, false);
 		mxc_do_addr_cycle(mtd, column, page_addr);