Bug 701180: Fix memory overwrite.

Bug 701180: Fix memory overwrite.

Templated function was overrunning buffer in the "no destination
alpha" case by stepping too many bytes.

--- source/fitz/draw-affine.c
+++ source/fitz/draw-affine.c
@@ -171,7 +171,7 @@
 					gp[0] = ya + fz_mul255(gp[0], t);
 			}
 		}
-		dp += 4;
+		dp += 3+da;
 		if (hp)
 			hp++;
 		if (gp)


fm10k: support Xen domain0

fm10k: support Xen domain0

fm10k was failing to run in XEN domain0, as the physical
memory for DMA should be allocated and translated
in a different way for XEN domain0. So
rte_memzone_reserve_bounded() should be used for DMA
memory allocation, and rte_mem_phy2mch() should be used
for DMA memory address translation to support running
fm10k PMD in XEN domain0.

Signed-off-by: Shaopeng He <870b5c1b507b39dc4c03732837d23d1b46787697@intel.com>
Acked-by: Jijiang Liu <10b95deab7df654d0c21c8c98b54c9a1ecf2a5c0@intel.com>

--- drivers/net/fm10k/fm10k_ethdev.c
+++ drivers/net/fm10k/fm10k_ethdev.c
@@ -1302,7 +1302,11 @@
 		return (-ENOMEM);
 	}
 	q->hw_ring = mz->addr;
+#ifdef RTE_LIBRTE_XEN_DOM0
+	q->hw_ring_phys_addr = rte_mem_phy2mch(mz->memseg_id, mz->phys_addr);
+#else
 	q->hw_ring_phys_addr = mz->phys_addr;
+#endif

 	dev->data->rx_queues[queue_id] = q;
 	return 0;
@@ -1448,7 +1452,11 @@
 		return (-ENOMEM);
 	}
 	q->hw_ring = mz->addr;
+#ifdef RTE_LIBRTE_XEN_DOM0
+	q->hw_ring_phys_addr = rte_mem_phy2mch(mz->memseg_id, mz->phys_addr);
+#else
 	q->hw_ring_phys_addr = mz->phys_addr;
+#endif

 	/*
 	 * allocate memory for the RS bit tracker. Enough slots to hold the


algorithms/classic-rational-reconstruction.h:         implements classic rational reconstruction by extended euclidean algorithm,         in ClassicRationalReconstruction Wang's bounds [Wang 1981] are used as default         in ClassicMaxQRationalReconstruction MQRR Alg. of Monagan [Monagan2004] is used

--- linbox/linbox/algorithms/classic-rational-reconstruction.h
+++ linbox/linbox/algorithms/classic-rational-reconstruction.h
@@ -1,4 +1,25 @@
-/* -*- mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/* -*- mode: C++/; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/* linbox/blackbox/classic-rational-reconstruction.h
+ * Copyright (C) 2009 Anna Marszalek
+ *
+ * Written by Anna Marszalek <aniau@astronet.pl>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+

 #ifndef __LINBOXX__CLASSIC_RECONSTRUCTION_H__
 #define __LINBOXX__CLASSIC_RECONSTRUCTION_H__
@@ -10,36 +31,41 @@
 using namespace std;

 namespace LinBox {
+
+	/*
+	 * implements classic rational reconstruction by extended euclidean algorithm,
+	 * Wang's bounds [Wang 1981] are used as default
+	 */

 	template <class Ring>
-	class ClassicRationalReconstruction: public RationalReconstructionBase<Ring>
+	class ClassicRationalReconstruction: public RReconstructionBase<Ring>
 	{
 	protected:
-		bool _reduce;
-		bool _recursive;
+		const bool _reduce;
+		const bool _recursive;
 	public:
-		//Ring _Z;
+		const Ring _Z;
 		typedef typename Ring::Element Element;

-		ClassicRationalReconstruction(const Ring& Z, const bool reduce = true, const bool recursive = false): RationalReconstructionBase<Ring>(Z) {
-			_reduce = reduce; _recursive = recursive;
-		}
-
-		ClassicRationalReconstruction<Ring> (const ClassicRationalReconstruction<Ring>& RR): RationalReconstructionBase<Ring>(RR._Z) {
-			_reduce = RR._reduce; _recursive = RR._recursive;
-		}
+		ClassicRationalReconstruction(const Ring& Z, const bool reduce = true, const bool recursive = false): RReconstructionBase<Ring>(Z),
+			_reduce(reduce), _recursive (recursive)
+		{}
+
+		ClassicRationalReconstruction<Ring> (const ClassicRationalReconstruction<Ring>& RR): RReconstructionBase<Ring>(RR._Z),
+			_reduce(RR._reduce), _recursive(RR._recursive)
+		{}

 		~ClassicRationalReconstruction() {}

 		//Wang method
-		bool reconstructRational(Element& a, Element& b, const Element& x, const Element& m) {
+		bool reconstructRational(Element& a, Element& b, const Element& x, const Element& m) const {
 			Element a_bound; _Z.sqrt(a_bound, m/2);
 			bool res = reconstructRational(a,b,x,m,a_bound);
 			res = res && (b <= a_bound);
 			return res;
 		}

-		bool reconstructRational(Element& a, Element& b, const Element& x, const Element& m, const Element& a_bound) {
+		bool reconstructRational(Element& a, Element& b, const Element& x, const Element& m, const Element& a_bound) const{
 			bool res=false;

 			if (x == 0) {
@@ -65,49 +91,57 @@

 	protected:

-		bool ratrecon(Element& a,Element& b,const Element& x,const Element& m,const Element& a_bound) {
+		bool ratrecon(Element& a,Element& b,const Element& x,const Element& m,const Element& a_bound) const {

 			Element  r0, t0, q, u;
 			r0=m;
 			t0=0;
 			a=x;
 			b=1;
-			//Element s0,s; s0=1,s=0;//test time gcdex;
+			//Element s0,s1; s0=1,s1=0;//test time gcdex;
 			while(a>=a_bound)
+			//while (t0 <= b_bound)
 			{

 				q = r0;
 				_Z.divin(q,a);        // r0/num
-				++this->C.div_counter;
+				//++this->C.div_counter;

 				u = a;
 				a = r0;
 				r0 = u;	// r0 <-- num

 				_Z.axmyin(a,u,q); // num <-- r0-q*num
-				++this->C.mul_counter;
+				//++this->C.mul_counter;
 				//if (a == 0) return false;

 				u = b;
 				b = t0;
 				t0 = u;	// t0 <-- den
-
+
 				_Z.axmyin(b,u,q); // den <-- t0-q*den
-				++this->C.mul_counter;
+				//++this->C.mul_counter;
+
+				//u = s1;
+				//s1 = s0;
+				//s0 = u;
+
+				//_Z.axmyin(s0,u,q);
+				//++this->C.mul_counter;

 			}

-			//                        if (den < 0) {
-			//                                _Z.negin(num);
-			//                                _Z.negin(den);
-			//                        }
+			//if (den < 0) {
+			//	_Z.negin(num);
+			//      _Z.negin(den);
+			//}

 			if ((a>0) && (_reduce)) {

 				// [GG, MCA, 1999] Theorem 5.26
 				// (ii)
 				Element gg;
-				++this->C.gcd_counter;
+				//++this->C.gcd_counter;
 				if (_Z.gcd(gg,a,b) != 1) {

 					Element ganum, gar2;
@@ -119,7 +153,7 @@
 					//_Z.axmyin(r0,q,a);
 					r0 = ganum;
 					_Z.axmyin(t0,q,b);
-					++this->C.mul_counter;++this->C.mul_counter;
+					//++this->C.mul_counter;++this->C.mul_counter;
 					if (t0 < 0) {
 						a = -r0;
 						b = -t0;
@@ -176,9 +210,15 @@
 		}
 	};

+	/*
+	 * implements classic rational reconstruction by extended euclidean algorithm,
+	 * reconstructed pair corresponds to the maximal (or large enough) quotient, see MQRR Alg. of Monagan [Monagan2004] is used
+	 */
+
 	template <class Ring>
 	class ClassicMaxQRationalReconstruction:public ClassicRationalReconstruction<Ring> {
 	public:
+		const Ring _Z;
 		typedef typename Ring::Element Element;

 		ClassicMaxQRationalReconstruction(const Ring& Z, const bool reduce = true, const bool recursive = false):ClassicRationalReconstruction<Ring>(Z,reduce,recursive) {}
@@ -187,18 +227,18 @@

 		~ClassicMaxQRationalReconstruction() {}

-		bool reconstructRational(Element& a, Element& b, const Element& x, const Element& m) {
+		bool reconstructRational(Element& a, Element& b, const Element& x, const Element& m) const {
 			bool res = maxEEA(a,b,x,m);
 			return res;
 		}

-		bool reconstructRational(Element& a, Element& b, const Element& x, const Element& m, const Element& a_bound) {
+		bool reconstructRational(Element& a, Element& b, const Element& x, const Element& m, const Element& a_bound) const{
 			bool res= false;
 			return res = ClassicRationalReconstruction<Ring>::reconstructRational(a,b,x,m,a_bound);
 		}

 	protected:
-		bool maxEEA(Element& a, Element& b, const Element& x, const Element& m) {
+		bool maxEEA(Element& a, Element& b, const Element& x, const Element& m) const{

 			Element qmax = 0, amax=x, bmax =1;

@@ -208,17 +248,20 @@
 			a=x;
 			b=1;
 			//Element s0,s; s0=1,s=0;//test time gcdex;
-			while(a>0)
+
+			Element T = m.bitsize();
+                        int c = 5;	//should be changed here to enhance probability of correctness
+
+			while((a>0) && (r0.bitsize() > T.bitsize() + c))
 			{
 				q = r0;
 				_Z.divin(q,a);        // r0/num
-				++this->C.div_counter;
-				//cout << r0<< " " << a << " " <<  q << ",";
+				//++this->C.div_counter;
 				if (q > qmax) {
-					//cout << r0<< " " << a << " " <<  q << ",";
 					amax = a;
 					bmax = b;
 					qmax = q;
+					if (qmax.bitsize() > T.bitsize() + c) break;
 				}

 				u = a;
@@ -226,16 +269,15 @@
 				r0 = u;	// r0 <-- num

 				_Z.axmyin(a,u,q); // num <-- r0-q*num
-				++this->C.mul_counter;
-	//if (a == 0) return false;
+				//++this->C.mul_counter;
+				//if (a == 0) return false;

 				u = b;
 				b = t0;
 				t0 = u;	// t0 <-- den

 				_Z.axmyin(b,u,q); // den <-- t0-q*den
-				++this->C.mul_counter;
-
+				//++this->C.mul_counter;
 			}

 			a = amax;
@@ -248,12 +290,21 @@

 			Element gg;
 			_Z.gcd(gg,a,b);
-			++this->C.gcd_counter;
-			if (gg > 1) return false;
-			else return true;
+			//++this->C.gcd_counter;
+
+			//if (q > T)
+			//Element T = m.bitsize();
+			//int c = 20;
+			//T=0;c=0;
+			if (qmax.bitsize() > T.bitsize() + c) {
+				return true;
+			}
+			else return false;
+
+			//if (gg > 1) return false;
+			//else return true;
 		}
 	};

 }
 #endif
-


don't reset the clipping rectangle for accumulated text

FZ_CMD_CLIP_TEXT behaves quite differently whether the accumulate flag
is set or not (see fz_list_clip_text). fz_run_display_list handles this
correctly but fz_append_display_node doesn't do so yet.

--- source/fitz/list-device.c
+++ source/fitz/list-device.c
@@ -115,8 +115,12 @@
 		}
 		list->top++;
 		break;
+	case FZ_CMD_CLIP_TEXT:
+		/* don't reset the clip rect for accumulated text */
+		if (node->flag == 2)
+			break;
+		/* fallthrough */
 	case FZ_CMD_END_MASK:
-	case FZ_CMD_CLIP_TEXT:
 	case FZ_CMD_CLIP_STROKE_TEXT:
 		if (list->top < STACK_SIZE)
 		{


i40e/base: add checks for CEE APP priority validity

The firmware has added additional status information to allow software
to determine if the APP priority for FCoE/iSCSI/FIP is valid or not in
CEE DCBX mode.

This patch adds to support those additional checks and will only add
applications to the software table that have oper and sync bits set
without any error.

Signed-off-by: Jingjing Wu <64d28b617c3b4840f5ded1bfa611cba7fadfe5c7@intel.com>
Acked-by: Helin Zhang <aba9dfdb1a6ec8bf1ff66b95272c029f8dfde1b1@intel.com>
Tested-by: Huilong Xu <66b391ba07b4e1e575c4888dad46879fa332fb22@intel.com>

--- drivers/net/i40e/base/i40e_dcb.c
+++ drivers/net/i40e/base/i40e_dcb.c
@@ -697,14 +697,17 @@
 	/* CEE PG data to ETS config */
 	dcbcfg->etscfg.maxtcs = cee_cfg->oper_num_tc;

+	/* Note that the FW creates the oper_prio_tc nibbles reversed
+	 * from those in the CEE Priority Group sub-TLV.
+	 */
 	for (i = 0; i < 4; i++) {
+		tc = (u8)((cee_cfg->oper_prio_tc[i] &
+			 I40E_CEE_PGID_PRIO_0_MASK) >>
+			 I40E_CEE_PGID_PRIO_0_SHIFT);
+		dcbcfg->etscfg.prioritytable[i*2] =  tc;
 		tc = (u8)((cee_cfg->oper_prio_tc[i] &
 			 I40E_CEE_PGID_PRIO_1_MASK) >>
 			 I40E_CEE_PGID_PRIO_1_SHIFT);
-		dcbcfg->etscfg.prioritytable[i*2] =  tc;
-		tc = (u8)((cee_cfg->oper_prio_tc[i] &
-			 I40E_CEE_PGID_PRIO_0_MASK) >>
-			 I40E_CEE_PGID_PRIO_0_SHIFT);
 		dcbcfg->etscfg.prioritytable[i*2 + 1] = tc;
 	}

@@ -726,37 +729,55 @@
 	dcbcfg->pfc.pfcenable = cee_cfg->oper_pfc_en;
 	dcbcfg->pfc.pfccap = I40E_MAX_TRAFFIC_CLASS;

-	status = (tlv_status & I40E_AQC_CEE_APP_STATUS_MASK) >>
-		  I40E_AQC_CEE_APP_STATUS_SHIFT;
+	i = 0;
+	status = (tlv_status & I40E_AQC_CEE_FCOE_STATUS_MASK) >>
+		  I40E_AQC_CEE_FCOE_STATUS_SHIFT;
 	err = (status & I40E_TLV_STATUS_ERR) ? 1 : 0;
 	sync = (status & I40E_TLV_STATUS_SYNC) ? 1 : 0;
 	oper = (status & I40E_TLV_STATUS_OPER) ? 1 : 0;
-	/* Add APPs if Error is False and Oper/Sync is True */
+	/* Add FCoE APP if Error is False and Oper/Sync is True */
 	if (!err && sync && oper) {
-		/* CEE operating configuration supports FCoE/iSCSI/FIP only */
-		dcbcfg->numapps = I40E_CEE_OPER_MAX_APPS;
-
 		/* FCoE APP */
-		dcbcfg->app[0].priority =
+		dcbcfg->app[i].priority =
 			(app_prio & I40E_AQC_CEE_APP_FCOE_MASK) >>
 			 I40E_AQC_CEE_APP_FCOE_SHIFT;
-		dcbcfg->app[0].selector = I40E_APP_SEL_ETHTYPE;
-		dcbcfg->app[0].protocolid = I40E_APP_PROTOID_FCOE;
-
+		dcbcfg->app[i].selector = I40E_APP_SEL_ETHTYPE;
+		dcbcfg->app[i].protocolid = I40E_APP_PROTOID_FCOE;
+		i++;
+	}
+
+	status = (tlv_status & I40E_AQC_CEE_ISCSI_STATUS_MASK) >>
+		  I40E_AQC_CEE_ISCSI_STATUS_SHIFT;
+	err = (status & I40E_TLV_STATUS_ERR) ? 1 : 0;
+	sync = (status & I40E_TLV_STATUS_SYNC) ? 1 : 0;
+	oper = (status & I40E_TLV_STATUS_OPER) ? 1 : 0;
+	/* Add iSCSI APP if Error is False and Oper/Sync is True */
+	if (!err && sync && oper) {
 		/* iSCSI APP */
-		dcbcfg->app[1].priority =
+		dcbcfg->app[i].priority =
 			(app_prio & I40E_AQC_CEE_APP_ISCSI_MASK) >>
 			 I40E_AQC_CEE_APP_ISCSI_SHIFT;
-		dcbcfg->app[1].selector = I40E_APP_SEL_TCPIP;
-		dcbcfg->app[1].protocolid = I40E_APP_PROTOID_ISCSI;
-
+		dcbcfg->app[i].selector = I40E_APP_SEL_TCPIP;
+		dcbcfg->app[i].protocolid = I40E_APP_PROTOID_ISCSI;
+		i++;
+	}
+
+	status = (tlv_status & I40E_AQC_CEE_FIP_STATUS_MASK) >>
+		  I40E_AQC_CEE_FIP_STATUS_SHIFT;
+	err = (status & I40E_TLV_STATUS_ERR) ? 1 : 0;
+	sync = (status & I40E_TLV_STATUS_SYNC) ? 1 : 0;
+	oper = (status & I40E_TLV_STATUS_OPER) ? 1 : 0;
+	/* Add FIP APP if Error is False and Oper/Sync is True */
+	if (!err && sync && oper) {
 		/* FIP APP */
-		dcbcfg->app[2].priority =
+		dcbcfg->app[i].priority =
 			(app_prio & I40E_AQC_CEE_APP_FIP_MASK) >>
 			 I40E_AQC_CEE_APP_FIP_SHIFT;
-		dcbcfg->app[2].selector = I40E_APP_SEL_ETHTYPE;
-		dcbcfg->app[2].protocolid = I40E_APP_PROTOID_FIP;
-	}
+		dcbcfg->app[i].selector = I40E_APP_SEL_ETHTYPE;
+		dcbcfg->app[i].protocolid = I40E_APP_PROTOID_FIP;
+		i++;
+	}
+	dcbcfg->numapps = i;
 }

 /**


net/i40e/base: add EEPROM checksum verification

This patch ensures PFs mutually exclusive access to NVM.

Signed-off-by: Jingjing Wu <64d28b617c3b4840f5ded1bfa611cba7fadfe5c7@intel.com>

--- drivers/net/i40e/base/i40e_nvm.c
+++ drivers/net/i40e/base/i40e_nvm.c
@@ -749,12 +749,18 @@

 	DEBUGFUNC("i40e_validate_nvm_checksum");

-	if (hw->flags & I40E_HW_FLAG_AQ_SRCTL_ACCESS_ENABLE)
-		ret_code = i40e_acquire_nvm(hw, I40E_RESOURCE_READ);
+	/* acquire_nvm provides exclusive NVM lock to synchronize access across
+	 * PFs. X710 uses i40e_read_nvm_word_srctl which polls for done bit
+	 * twice (first time to be able to write address to I40E_GLNVM_SRCTL
+	 * register, second to read data from I40E_GLNVM_SRDATA. One PF can see
+	 * done bit and try to write address, while another one will interpret
+	 * it as a good time to read data. It will cause invalid data to be
+	 * read.
+	 */
+	ret_code = i40e_acquire_nvm(hw, I40E_RESOURCE_READ);
 	if (!ret_code) {
 		ret_code = i40e_calc_nvm_checksum(hw, &checksum_local);
-		if (hw->flags & I40E_HW_FLAG_AQ_SRCTL_ACCESS_ENABLE)
-			i40e_release_nvm(hw);
+	i40e_release_nvm(hw);
 		if (ret_code != I40E_SUCCESS)
 			goto i40e_validate_nvm_checksum_exit;
 	} else {


Fix doc markup

Fix doc markup

--- ports/raspberrypi/bindings/rp2pio/StateMachine.c
+++ ports/raspberrypi/bindings/rp2pio/StateMachine.c
@@ -139,8 +139,8 @@
 //|             that causes an infinite loop, you will be able to interrupt the loop.
 //|             However, if you are writing to a device that can get into a bad state if a read or write
 //|             is interrupted, you may want to set this to False after your program has been vetted.
-//|         :param int wrap_target The target instruction number of automatic wrap. Defaults to the first instruction of the program.
-//|         :param int wrap The instruction after which to wrap to the ``wrap``
+//|         :param int wrap_target: The target instruction number of automatic wrap. Defaults to the first instruction of the program.
+//|         :param int wrap: The instruction after which to wrap to the ``wrap``
 //|             instruction. As a special case, -1 (the default) indicates the
 //|             last instruction of the program.
 //|         """


net/ixgbe: fix Rx errors statistics for UDP checksum

Restrict the "remove l3_l4_xsum_errors from rx_errors" to 82599 only for
hardware errata.

Fixes: 256ff05a9cae ("ixgbe: fix Rx errors statistics for UDP checksum")
Cc: stable@dpdk.org

Signed-off-by: Haiyue Wang <037d5f2d0d83548aebdad8ba0c69c0b30ec44c86@intel.com>
Acked-by: Qi Zhang <9e9e58ffa71a29bb7b87766b362515be648fcbe0@intel.com>

--- drivers/net/ixgbe/ixgbe_ethdev.c
+++ drivers/net/ixgbe/ixgbe_ethdev.c
@@ -3344,6 +3344,13 @@
 			  hw_stats->fccrc +
 			  hw_stats->fclast;

+	/*
+	 * 82599 errata, UDP frames with a 0 checksum can be marked as checksum
+	 * errors.
+	 */
+	if (hw->mac.type != ixgbe_mac_82599EB)
+		stats->ierrors += hw_stats->xec;
+
 	/* Tx Errors */
 	stats->oerrors  = 0;
 	return 0;


continuing on hashmaps implementation

continuing on hashmaps implementation

--- ex37/liblcthw/src/hashmap.c
+++ ex37/liblcthw/src/hashmap.c
@@ -34,4 +34,7 @@
   return hash;
 }

-Hashmap *Hashmap_create(
+Hashmap *Hashmap_create(Hashmap_compare compare, Hashmap_hash hash)
+{
+  Hashmap *map = calloc(1, sizeof(Hashmap));
+


stm32/boards/NUCLEO_L476RG: Add 5 remaining UARTs.

STM32L476RG MCU of NUCLEO_L476RG board has 6 UART/USART units in total
(USART1, USART2, USART3, UART4, UART5 and LPUART1), but only UART2,
connected to REPL, was defined and available in Python code.
Defined are all 5 remaining UART/USART units including LPUART1.

Signed-off-by: 16affbfdf8cf4eb03afe4541fc6717a2aa092a30@googlemail.com

--- ports/stm32/boards/NUCLEO_L476RG/mpconfigboard.h
+++ ports/stm32/boards/NUCLEO_L476RG/mpconfigboard.h
@@ -9,45 +9,64 @@
 #define MICROPY_HW_ENABLE_DAC       (1)

 // MSI is used and is 4MHz
-#define MICROPY_HW_CLK_PLLM (1)
-#define MICROPY_HW_CLK_PLLN (40)
-#define MICROPY_HW_CLK_PLLP (RCC_PLLP_DIV7)
-#define MICROPY_HW_CLK_PLLQ (RCC_PLLQ_DIV2)
-#define MICROPY_HW_CLK_PLLR (RCC_PLLR_DIV2)
+#define MICROPY_HW_CLK_PLLM         (1)
+#define MICROPY_HW_CLK_PLLN         (40)
+#define MICROPY_HW_CLK_PLLP         (RCC_PLLP_DIV7)
+#define MICROPY_HW_CLK_PLLQ         (RCC_PLLQ_DIV2)
+#define MICROPY_HW_CLK_PLLR         (RCC_PLLR_DIV2)
+
+#define MICROPY_HW_FLASH_LATENCY    FLASH_LATENCY_4

 // The board has an external 32kHz crystal
 #define MICROPY_HW_RTC_USE_LSE      (1)

-// UART config
-#define MICROPY_HW_UART2_TX     (pin_A2)
-#define MICROPY_HW_UART2_RX     (pin_A3)
-
+// USART1 config
+#define MICROPY_HW_UART1_TX         (pin_A9)
+#define MICROPY_HW_UART1_RX         (pin_A10)
+// USART2 config. Connected to ST-Link
+#define MICROPY_HW_UART2_TX         (pin_A2)
+#define MICROPY_HW_UART2_RX         (pin_A3)
+#define MICROPY_HW_UART2_RTS        (pin_A1)
+#define MICROPY_HW_UART2_CTS        (pin_A0)
+// USART3 config
+#define MICROPY_HW_UART3_TX         (pin_C4)
+#define MICROPY_HW_UART3_RX         (pin_C5)
+#define MICROPY_HW_UART3_RTS        (pin_B14)
+#define MICROPY_HW_UART3_CTS        (pin_B13)
+// UART4 config
+#define MICROPY_HW_UART4_TX         (pin_A0)
+#define MICROPY_HW_UART4_RX         (pin_A1)
+// UART5 config
+#define MICROPY_HW_UART5_TX         (pin_C12)
+#define MICROPY_HW_UART5_RX         (pin_D2)
+// LPUART config
+#define MICROPY_HW_LPUART1_TX       (pin_C1)
+#define MICROPY_HW_LPUART1_RX       (pin_C0)
+// USART2 is connected to the virtual com port on the ST-Link
 #define MICROPY_HW_UART_REPL        PYB_UART_2
 #define MICROPY_HW_UART_REPL_BAUD   115200

-#define MICROPY_HW_FLASH_LATENCY    FLASH_LATENCY_4
-
 // I2C busses
-#define MICROPY_HW_I2C1_SCL (pin_B8)
-#define MICROPY_HW_I2C1_SDA (pin_B9)
-#define MICROPY_HW_I2C2_SCL (pin_B10)
-#define MICROPY_HW_I2C2_SDA (pin_B11)
-#define MICROPY_HW_I2C3_SCL (pin_C0)
-#define MICROPY_HW_I2C3_SDA (pin_C1)
+#define MICROPY_HW_I2C1_SCL         (pin_B8)
+#define MICROPY_HW_I2C1_SDA         (pin_B9)
+#define MICROPY_HW_I2C2_SCL         (pin_B10)
+#define MICROPY_HW_I2C2_SDA         (pin_B11)
+#define MICROPY_HW_I2C3_SCL         (pin_C0)
+#define MICROPY_HW_I2C3_SDA         (pin_C1)

 // SPI busses
-#define MICROPY_HW_SPI1_NSS     (pin_A4)
-#define MICROPY_HW_SPI1_SCK     (pin_B3)
-#define MICROPY_HW_SPI1_MISO    (pin_B4)
-#define MICROPY_HW_SPI1_MOSI    (pin_B5)
-#define MICROPY_HW_SPI2_NSS     (pin_B12)
-#define MICROPY_HW_SPI2_SCK     (pin_B13)
-#define MICROPY_HW_SPI2_MISO    (pin_B14)
-#define MICROPY_HW_SPI2_MOSI    (pin_B15)
+#define MICROPY_HW_SPI1_NSS         (pin_A4)
+#define MICROPY_HW_SPI1_SCK         (pin_B3)
+#define MICROPY_HW_SPI1_MISO        (pin_B4)
+#define MICROPY_HW_SPI1_MOSI        (pin_B5)
+#define MICROPY_HW_SPI2_NSS         (pin_B12)
+#define MICROPY_HW_SPI2_SCK         (pin_B13)
+#define MICROPY_HW_SPI2_MISO        (pin_B14)
+#define MICROPY_HW_SPI2_MOSI        (pin_B15)

 // CAN bus
-#define MICROPY_HW_CAN1_TX (pin_A12)
-#define MICROPY_HW_CAN1_RX (pin_A11)
+#define MICROPY_HW_CAN1_TX          (pin_A12)
+#define MICROPY_HW_CAN1_RX          (pin_A11)

 // USRSW is pulled low. Pressing the button makes the input go high.
 #define MICROPY_HW_USRSW_PIN        (pin_C13)
@@ -61,4 +80,4 @@
 #define MICROPY_HW_LED_OFF(pin)     (mp_hal_pin_low(pin))

 // USB config
-#define MICROPY_HW_USB_FS (1)
+#define MICROPY_HW_USB_FS           (1)


fix split doesn't convert context to string if no argument is passed

--- jsstring.c
+++ jsstring.c
@@ -665,7 +665,7 @@
 {
 	if (js_isundefined(J, 1)) {
 		js_newarray(J);
-		js_copy(J, 0);
+		js_pushstring(J, js_tostring(J, 0));
 		js_setindex(J, -2, 0);
 	} else if (js_isregexp(J, 1)) {
 		Sp_split_regexp(J);


u-boot: Add support for bootcount in env_resin.h

U-boot has its own bootcount framework. However, that will require
handling in each device type. We will use u-boot shell commands
env import -t, env export -t, fatload, fatwrite
to read/write/increment bootcount in env_resin.h.

This will allow us to scale to lots of devices.

A flag os_bootcount_skip is left for devices that are unable to support
fatwrite in u-boot (in some rare cases). This will allow a device to
not support rollback-altboot and still function.

This patch requires that CMD_SETEXPR be enabled in u-boot config
options.

Change-type: minor
Changelog-entry: Devices using u-boot. Enable rollback-altboot by handling bootcount via meta-balena.
Signed-off-by: Zubair Lutfullah Kakakhel <0e069c2b28e50c7879834cb1889890ac34260249@balena.io>

--- meta-balena-common/recipes-bsp/u-boot/patches/env_resin.h
+++ meta-balena-common/recipes-bsp/u-boot/patches/env_resin.h
@@ -22,12 +22,21 @@
  *     resin_kernel_root      - the root kernel argument
  *     resin_dev_type         - device type from where we boot (e.g. mmc, usb etc.)
  *     resin_dev_index        - device index to be used at boot
+ * Other notes:
+ *     os_bc_wr_sz            - The exact size of 'bootcount=X' to fatwrite
+ *
  */

 #include <config_resin.h>

 #define RESIN_ENV \
        "resin_env_file=" __stringify(RESIN_ENV_FILE) "\0" \
+       "os_bc_file=" __stringify(OS_BOOTCOUNT_FILE) "\0" \
+       "os_bc_skip=" __stringify(OS_BOOTCOUNT_SKIP) "\0" \
+       "os_bc_inced=0 \0" \
+       "os_bc_lim=" __stringify(OS_BOOTCOUNT_LIMIT) "\0" \
+       "os_bc_wr_sz=0xd \0" \
+       "upgrade_available=0 \0" \
        "resin_flasher_flag_file=" __stringify(RESIN_FLASHER_FLAG_FILE) "\0" \
        "resin_image_flag_file=" __stringify(RESIN_IMAGE_FLAG_FILE) "\0" \
        "resin_uboot_devices=" __stringify(RESIN_UBOOT_DEVICES) "\0" \
@@ -43,10 +52,27 @@
        "resin_load_env_file=" \
                "echo Loading ${resin_env_file} from ${resin_dev_type} device ${resin_dev_index} partition ${resin_boot_part};" \
                "fatload ${resin_dev_type} ${resin_dev_index}:${resin_boot_part} ${resin_kernel_load_addr} ${resin_env_file};\0" \
+       "os_load_bootcount_file=" \
+               "echo Loading ${os_bc_file} from ${resin_dev_type} device ${resin_dev_index} partition ${resin_boot_part};" \
+               "fatload ${resin_dev_type} ${resin_dev_index}:${resin_boot_part} ${resin_kernel_load_addr} ${os_bc_file};\0" \
        \
        "resin_import_env_file=" \
                "echo Import ${resin_env_file} in environment;" \
                "env import -t ${resin_kernel_load_addr} ${filesize}\0" \
+       \
+       "os_import_bootcount_file=" \
+               "echo Import ${os_bc_file} in environment;" \
+               "env import -t ${resin_kernel_load_addr} ${filesize}\0" \
+       \
+       "os_inc_bc_save=" \
+              "if test ${os_bc_skip} = 0 && test ${os_bc_inced} = 0 && test ${upgrade_available} = 1; then " \
+                     "setexpr bootcount ${bootcount} + 1;" \
+                     "env set os_bc_inced 1;" \
+                     "echo bootcount=${bootcount} now;" \
+                     "env export -t ${resin_kernel_load_addr} bootcount;" \
+                     "fatwrite ${resin_dev_type} ${resin_dev_index}:${resin_boot_part} ${resin_kernel_load_addr} ${os_bc_file} ${os_bc_wr_sz};" \
+                     "echo bootcount=${bootcount} written to ${resin_dev_type} ${resin_dev_index}:${resin_boot_part} ${os_bc_file};" \
+              "fi;\0" \
        \
        "resin_flasher_detect=" \
                "if test \"${resin_scan_dev_type}\" = usb ; then " \
@@ -97,19 +123,28 @@
        "resin_inject_env_file=" \
                "if run resin_load_env_file; then " \
                        "run resin_import_env_file;" \
+               "fi;" \
+               "if run os_load_bootcount_file; then " \
+                       "run os_import_bootcount_file;" \
+               "else; " \
+                       "echo No bootcount.env file. Setting bootcount=0 in environment;" \
+                       "env set bootcount 0;" \
                "fi;\0" \
        \
        "resin_check_altroot=" \
               "setexpr resin_roota ${resin_boot_part} + 1; " \
               "setexpr resin_rootb ${resin_boot_part} + 2; " \
-              "if test -n ${bootlimit}; then " \
-                      "if test ${bootcount} -gt ${bootlimit}; then " \
-                               "echo WARNING! BOOTLIMIT EXCEEDED. SWITCHING TO PREVIOUS ROOTFS; " \
-                               "if test ${resin_root_part} -eq ${resin_roota}; then "\
+              "run os_inc_bc_save;" \
+              "if test -n ${os_bc_lim}; then " \
+                      "if test ${bootcount} -gt ${os_bc_lim}; then " \
+                               "echo WARNING! BOOTLIMIT EXCEEDED. SWITCHING TO PREVIOUS ROOT;" \
+                               "echo WARNING! was: resin_root_part=${resin_root_part};" \
+                               "if test ${resin_root_part} = ${resin_roota}; then "\
                                        "env set resin_root_part ${resin_rootb}; " \
-                                "else; "\
+                               "else; "\
                                        "env set resin_root_part ${resin_roota}; " \
-                                "fi;" \
+                               "fi;" \
+                               "echo WARNING! now: resin_root_part=${resin_root_part};" \
                       "fi;" \
               "fi;\0" \
        \


qlcnic: remove usage of vlan_group_get_device

Signed-off-by: Jiri Pirko <fa978af6b66b63204eae0f383d59a9477a8acf5e@redhat.com>
Signed-off-by: David S. Miller <fe08d3c717adf2ae63592e4c9aec6e3e404d8e3e@davemloft.net>

--- drivers/net/qlcnic/qlcnic_main.c
+++ drivers/net/qlcnic/qlcnic_main.c
@@ -4198,18 +4198,13 @@
 qlcnic_restore_indev_addr(struct net_device *netdev, unsigned long event)
 {
 	struct qlcnic_adapter *adapter = netdev_priv(netdev);
-	struct vlan_group *grp;
 	struct net_device *dev;
 	u16 vid;

 	qlcnic_config_indev_addr(adapter, netdev, event);

-	grp = rcu_dereference_rtnl(netdev->vlgrp);
-	if (!grp)
-		return;
-
 	for_each_set_bit(vid, adapter->vlans, VLAN_N_VID) {
-		dev = vlan_group_get_device(grp, vid);
+		dev = __vlan_find_dev_deep(netdev, vid);
 		if (!dev)
 			continue;
 		qlcnic_config_indev_addr(adapter, dev, event);


net/virtio: use any layout for version 1.0

Current virtio driver advertises VERSION_1 support,
but does not handle device's VERSION_1 support when
sending packets (it looks for ANY_LAYOUT feature,
which is absent).

This patch enables 'can_push' in tx path when VERSION_1
is advertised by the device.

This significantly improves small packets forwarding rate
towards devices advertising VERSION_1 feature.

Signed-off-by: Pierre Pfister <e31bfcc197987a594da168a19bf32d37137e11a7@cisco.com>
Acked-by: Yuanhan Liu <5dcef21195e64c9c08aa779bb62b25e9133eaa33@linux.intel.com>

--- drivers/net/virtio/virtio_rxtx.c
+++ drivers/net/virtio/virtio_rxtx.c
@@ -1015,7 +1015,8 @@
 		}

 		/* optimize ring usage */
-		if (vtpci_with_feature(hw, VIRTIO_F_ANY_LAYOUT) &&
+		if ((vtpci_with_feature(hw, VIRTIO_F_ANY_LAYOUT) ||
+		      vtpci_with_feature(hw, VIRTIO_F_VERSION_1)) &&
 		    rte_mbuf_refcnt_read(txm) == 1 &&
 		    RTE_MBUF_DIRECT(txm) &&
 		    txm->nb_segs == 1 &&


PERF: fix Cppcheck report: Possible inefficient checking for 'extensions' emptiness.

--- src/Common/OpenCL/ITKimprovements/itkOpenCLPlatform.h
+++ src/Common/OpenCL/ITKimprovements/itkOpenCLPlatform.h
@@ -186,7 +186,7 @@
   const std::list< std::string > extensions     = platform.GetExtensions();
   const std::size_t              extensionsSize = extensions.size();
   strm << indent << "Extensions(" << extensionsSize << "): ";
-  if( extensions.size() == 0 )
+  if( extensions.empty() )
   {
     strm << "none";
   }


b43: N-PHY: trivial: change save&rest order in RSSI polling

Signed-off-by: Rafał Miłecki <dced371c11179e2cb83b1e305b9d7b15f379452b@gmail.com>
Signed-off-by: John W. Linville <2a53bac7a5d324865ef46ec4c38b2c0fba1456b4@tuxdriver.com>

--- drivers/net/wireless/b43/phy_n.c
+++ drivers/net/wireless/b43/phy_n.c
@@ -1220,12 +1220,12 @@
 	u16 s[2];

 	if (dev->phy.rev >= 3) {
-		save_regs_phy[0] = b43_phy_read(dev,
+		save_regs_phy[0] = b43_phy_read(dev, B43_NPHY_AFECTL_C1);
+		save_regs_phy[1] = b43_phy_read(dev, B43_NPHY_AFECTL_C2);
+		save_regs_phy[2] = b43_phy_read(dev,
 						B43_NPHY_RFCTL_LUT_TRSW_UP1);
-		save_regs_phy[1] = b43_phy_read(dev,
+		save_regs_phy[3] = b43_phy_read(dev,
 						B43_NPHY_RFCTL_LUT_TRSW_UP2);
-		save_regs_phy[2] = b43_phy_read(dev, B43_NPHY_AFECTL_C1);
-		save_regs_phy[3] = b43_phy_read(dev, B43_NPHY_AFECTL_C2);
 		save_regs_phy[4] = b43_phy_read(dev, B43_NPHY_AFECTL_OVER1);
 		save_regs_phy[5] = b43_phy_read(dev, B43_NPHY_AFECTL_OVER);
 		save_regs_phy[6] = b43_phy_read(dev, B43_NPHY_TXF_40CO_B1S0);
@@ -1274,12 +1274,12 @@
 		b43_phy_write(dev, B43_NPHY_GPIO_SEL, save_regs_phy[8]);

 	if (dev->phy.rev >= 3) {
+		b43_phy_write(dev, B43_NPHY_AFECTL_C1, save_regs_phy[0]);
+		b43_phy_write(dev, B43_NPHY_AFECTL_C2, save_regs_phy[1]);
 		b43_phy_write(dev, B43_NPHY_RFCTL_LUT_TRSW_UP1,
-				save_regs_phy[0]);
+				save_regs_phy[2]);
 		b43_phy_write(dev, B43_NPHY_RFCTL_LUT_TRSW_UP2,
-				save_regs_phy[1]);
-		b43_phy_write(dev, B43_NPHY_AFECTL_C1, save_regs_phy[2]);
-		b43_phy_write(dev, B43_NPHY_AFECTL_C2, save_regs_phy[3]);
+				save_regs_phy[3]);
 		b43_phy_write(dev, B43_NPHY_AFECTL_OVER1, save_regs_phy[4]);
 		b43_phy_write(dev, B43_NPHY_AFECTL_OVER, save_regs_phy[5]);
 		b43_phy_write(dev, B43_NPHY_TXF_40CO_B1S0, save_regs_phy[6]);


Doc update and use the GeometryInfo<dim> class in two places to enhance readability.

git-svn-id: 31d9d2f6432a47c86a3640814024c107794ea77c@363 0785d39b-7218-0410-832d-ea1e28bc413d

--- deal.II/deal.II/include/fe/fe.h
+++ deal.II/deal.II/include/fe/fe.h
@@ -7,6 +7,7 @@
 #include <base/exceptions.h>
 #include <grid/point.h>
 #include <grid/dof.h>
+#include <grid/geometry_info.h>
 #include <lac/dfmatrix.h>

@@ -290,7 +291,7 @@
 				      * matrix are discarded and will not fill
 				      * up the transfer matrix.
 				      */
-    dFMatrix restriction[(1<<dim)];
+    dFMatrix restriction[GeometryInfo<dim>::children_per_cell];

     				     /**
 				      * Have #N=2^dim# matrices keeping the
@@ -303,7 +304,12 @@
 				      * to the destination cell, i.e. the
 				      * refined one, while the column indices
 				      * are for the unrefined cell's degrees of
-				      * freedom.
+				      * freedom. Thus, if #u0# is the vector
+				      * of values of degrees of freedom on the
+				      * coarse cell, * #prolongation[i]*u0#
+				      * yields the vector of values of the
+				      * degrees of freedom on the #i#th child
+				      * cell.
 				      *
 				      * Upon assembling the transfer matrix
 				      * between cells using this matrix array,
@@ -311,7 +317,7 @@
 				      * matrix are discarded and will not fill
 				      * up the transfer matrix.
 				      */
-    dFMatrix prolongation[(1<<dim)];
+    dFMatrix prolongation[GeometryInfo<dim>::children_per_cell];

     				     /**
 				      * Specify the constraints which the


p54: fix sparse warnings

p54: fix sparse warnings

This fixes a few sparse warnings in p54.

Signed-off-by: Johannes Berg <8398eb9892c5ab2ff439ca0b5e4b0706dd9ebef9@sipsolutions.net>
Signed-off-by: John W. Linville <2a53bac7a5d324865ef46ec4c38b2c0fba1456b4@tuxdriver.com>

--- drivers/net/wireless/p54common.c
+++ drivers/net/wireless/p54common.c
@@ -59,7 +59,7 @@
 	{ .center_freq = 2484, .hw_value = 14, },
 };

-struct ieee80211_supported_band band_2GHz = {
+static struct ieee80211_supported_band band_2GHz = {
 	.channels = p54_channels,
 	.n_channels = ARRAY_SIZE(p54_channels),
 	.bitrates = p54_rates,
@@ -389,7 +389,7 @@
 	while (entry != (struct sk_buff *)&priv->tx_queue) {
 		range = (struct memrecord *)&entry->cb;
 		if (range->start_addr == addr) {
-			struct ieee80211_tx_status status = {{0}};
+			struct ieee80211_tx_status status;
 			struct p54_control_hdr *entry_hdr;
 			struct p54_tx_control_allocdata *entry_data;
 			int pad = 0;
@@ -405,6 +405,7 @@
 				kfree_skb(entry);
 				break;
 			}
+			memset(&status, 0, sizeof(status));
 			memcpy(&status.control, range->control,
 			       sizeof(status.control));
 			kfree(range->control);


removed an Epak Reference.

removed an Epak Reference.

--- demos/programs/Tree/tree.c
+++ demos/programs/Tree/tree.c
@@ -390,7 +390,7 @@
     xmstring = XmStringCreateLtoR(
 "The OpenMotif Tree Widget displays hierarchical data in a tree layout with a Motif\n\
 look and feel. The Tree widget displayed below contains entries corresponding\n\
-to EPak widgets. The nodes are XmPushButtons, but the tree can accept any type of widget.\n\
+to OpenMotif widgets. The nodes are XmPushButtons, but the tree can accept any type of widget.\n\
 \n\
 The Tree Widget uses \"constraints\" to arrange the children with the right layout.\n\
 To see the code to generate the tree below, press \"Show Layout Code...\".\n\


forgot to rip out a printf

git-svn-id: 03f0f1727258f1959b7b485b30a676bafdb78148@457 0101bb08-14d6-0310-b084-bc0e0c8e3800


oprofile, ARM: Rework op_create_counter()

This patch simplifies op_create_counter(). Removing if/else if paths
and return code variable by direct returning from function.

Acked-by: Will Deacon <b913f13ef92ac157955c954ccaaff7be065faba4@arm.com>
Signed-off-by: Robert Richter <22a70fd9773e4de05b12c05075e9bcd605577f4d@amd.com>

--- drivers/oprofile/oprofile_perf.c
+++ drivers/oprofile/oprofile_perf.c
@@ -71,28 +71,28 @@

 static int op_create_counter(int cpu, int event)
 {
-	int ret = 0;
 	struct perf_event *pevent;

-	if (!counter_config[event].enabled || (perf_events[cpu][event] != NULL))
-		return ret;
+	if (!counter_config[event].enabled || perf_events[cpu][event])
+		return 0;

 	pevent = perf_event_create_kernel_counter(&counter_config[event].attr,
 						  cpu, -1,
 						  op_overflow_handler);

-	if (IS_ERR(pevent)) {
-		ret = PTR_ERR(pevent);
-	} else if (pevent->state != PERF_EVENT_STATE_ACTIVE) {
+	if (IS_ERR(pevent))
+		return PTR_ERR(pevent);
+
+	if (pevent->state != PERF_EVENT_STATE_ACTIVE) {
 		perf_event_release_kernel(pevent);
 		pr_warning("oprofile: failed to enable event %d "
 				"on CPU %d\n", event, cpu);
-		ret = -EBUSY;
-	} else {
-		perf_events[cpu][event] = pevent;
-	}
-
-	return ret;
+		return -EBUSY;
+	}
+
+	perf_events[cpu][event] = pevent;
+
+	return 0;
 }

 static void op_destroy_counter(int cpu, int event)


pinctrl: abx500: fix abx500_pin_config_set()

- Update abx500_pin_config_set() in order to take in
account PIN_CONFIG_BIAS_DISABLE state to disable
pull up or pull down.

- Rework error path.

Signed-off-by: Patrice Chotard <d719ec623d33f81f80f0590564803dead94a5492@st.com>
Signed-off-by: Linus Walleij <9cd9d802d23c0ed5e224beabf4ae4a5c478746ef@linaro.org>

--- drivers/pinctrl/pinctrl-abx500.c
+++ drivers/pinctrl/pinctrl-abx500.c
@@ -33,6 +33,7 @@
 #include <linux/pinctrl/machine.h>

 #include "pinctrl-abx500.h"
+#include "core.h"
 #include "pinconf.h"

 /*
@@ -963,7 +964,7 @@
 	struct pullud *pullud = pct->soc->pullud;
 	struct gpio_chip *chip = &pct->chip;
 	unsigned offset;
-	int ret = 0;
+	int ret = -EINVAL;
 	enum pin_config_param param = pinconf_to_config_param(config);
 	enum pin_config_param argument = pinconf_to_config_argument(config);

@@ -976,13 +977,32 @@
 	offset = pin - 1;

 	switch (param) {
+	case PIN_CONFIG_BIAS_DISABLE:
+		ret = abx500_gpio_direction_input(chip, offset);
+		/*
+		 * Some chips only support pull down, while some actually
+		 * support both pull up and pull down. Such chips have
+		 * a "pullud" range specified for the pins that support
+		 * both features. If the pin is not within that range, we
+		 * fall back to the old bit set that only support pull down.
+		 */
+		if (pullud &&
+		    pin >= pullud->first_pin &&
+		    pin <= pullud->last_pin)
+			ret = abx500_set_pull_updown(pct,
+				pin,
+				ABX500_GPIO_PULL_NONE);
+		else
+			/* Chip only supports pull down */
+			ret = abx500_gpio_set_bits(chip, AB8500_GPIO_PUD1_REG,
+				offset, ABX500_GPIO_PULL_NONE);
+		break;
+
 	case PIN_CONFIG_BIAS_PULL_DOWN:
+		ret = abx500_gpio_direction_input(chip, offset);
 		/*
 		 * if argument = 1 set the pull down
 		 * else clear the pull down
-		 */
-		ret = abx500_gpio_direction_input(chip, offset);
-		/*
 		 * Some chips only support pull down, while some actually
 		 * support both pull up and pull down. Such chips have
 		 * a "pullud" range specified for the pins that support
@@ -1002,6 +1022,7 @@
 		break;

 	case PIN_CONFIG_BIAS_PULL_UP:
+		ret = abx500_gpio_direction_input(chip, offset);
 		/*
 		 * if argument = 1 set the pull up
 		 * else clear the pull up
@@ -1030,8 +1051,6 @@

 	default:
 		dev_err(chip->dev, "illegal configuration requested\n");
-
-		return -EINVAL;
 	}

 	return ret;


bsd: provide a utility function which fills the kinfo_proc structure avoiding code redundancy.

--- psutil/_psutil_bsd.c
+++ psutil/_psutil_bsd.c
@@ -120,6 +120,40 @@
 }

+
+/*
+ * Utility function which fills a kinfo_proc struct based on process pid
+ */
+static int
+get_kinfo_proc(const pid_t pid, struct kinfo_proc *proc)
+{
+    int mib[4];
+    size_t size;
+    mib[0] = CTL_KERN;
+    mib[1] = KERN_PROC;
+    mib[2] = KERN_PROC_PID;
+    mib[3] = pid;
+
+    size = sizeof(struct kinfo_proc);
+
+    if (sysctl((int*)mib, 4, proc, &size, NULL, 0) == -1) {
+        PyErr_SetFromErrno(PyExc_OSError);
+        return -1;
+    }
+
+    /*
+     * sysctl stores 0 in the size if we can't find the process information.
+     * Set errno to ESRCH which will be translated in NoSuchProcess later on.
+     */
+    if (size == 0) {
+        errno = ESRCH;
+        PyErr_SetFromErrno(PyExc_OSError);
+        return -1;
+    }
+    return 0;
+}
+
+
 /*
  * Return a Python list of all the PIDs running on the system.
  */
@@ -159,9 +193,6 @@
  */
 static PyObject* get_process_info(PyObject* self, PyObject* args)
 {
-
-    int mib[4];
-    size_t len;
     struct kinfo_proc kp;
     long pid;
     PyObject* arglist = NULL;
@@ -169,49 +200,33 @@
     if (! PyArg_ParseTuple(args, "l", &pid)) {
         return NULL;
     }
-
+
     if (0 == pid) {
         // USER   PID %CPU %MEM   VSZ   RSS  TT  STAT STARTED      TIME COMMAND
         // root     0  0.0  0.0     0     0  ??  DLs  12:22AM   0:00.13 [swapper]
         return Py_BuildValue("llssNll", pid, 0, "swapper", "", Py_BuildValue("[]"), 0, 0);
     }

-    // build the mib to pass to sysctl to tell it what PID and what info we want
-    len = 4;
-    sysctlnametomib("kern.proc.pid", mib, &len);
-    mib[0] = CTL_KERN;
-    mib[1] = KERN_PROC;
-    mib[2] = KERN_PROC_PID;
-    mib[3] = pid;
-
-    // fetch the info with sysctl()
-    len = sizeof(kp);
-    if (sysctl(mib, 4, &kp, &len, NULL, 0) == -1) {
-        // raise an exception if it failed, since we won't get any data
+    // get kinfo_proc to retrieve ppid, uid and gid later
+    if (get_kinfo_proc(pid, &kp) == -1) {
+        return NULL;
+    }
+
+    // get the commandline
+    arglist = get_arg_list(pid);
+
+    // get_arg_list() returns NULL only if getcmdargs failed with ESRCH
+    // (no process with that PID)
+    if (NULL == arglist) {
         return PyErr_SetFromErrno(PyExc_OSError);
     }

-    if (len > 0) { // if 0 then no data was retrieved
-
-        // get the commandline, since we got everything else
-        arglist = get_arg_list(pid);
-
-        // get_arg_list() returns NULL only if getcmdargs failed with ESRCH
-        // (no process with that PID)
-        if (NULL == arglist) {
-            return PyErr_SetFromErrno(PyExc_OSError);
-        }
-
-        // hooray, we got all the data, so return it as a tuple to be
-        // passed to ProcessInfo() constructor
-        return Py_BuildValue("llssNll", pid, (long)kp.ki_ppid, kp.ki_comm, "",
-                              arglist, (long)kp.ki_ruid, (long)kp.ki_rgid);
-    }
-
-    // something went wrong, throw an error
-    return PyErr_Format(PyExc_RuntimeError,
-                        "Failed to retrieve process information.");
-}
+    // hooray, we got all the data, so return it as a tuple to be
+    // passed to ProcessInfo() constructor
+    return Py_BuildValue("llssNll", pid, (long)kp.ki_ppid, kp.ki_comm, "",
+                          arglist, (long)kp.ki_ruid, (long)kp.ki_rgid);
+}
+

 // convert a timeval struct to a double
 #define TV2DOUBLE(t)    ((t).tv_sec + (t).tv_usec / 1000000.0)
@@ -222,43 +237,19 @@
  */
 static PyObject* get_cpu_times(PyObject* self, PyObject* args)
 {
-
-    int mib[4];
-    size_t len;
-    struct kinfo_proc kp;
     long pid;
     double user_t, sys_t;
-
+    struct kinfo_proc kp;
     if (! PyArg_ParseTuple(args, "l", &pid)) {
         return NULL;
     }
-
-    // build the mib to pass to sysctl to tell it what PID and what info we want
-    len = 4;
-    sysctlnametomib("kern.proc.pid", mib, &len);
-    mib[0] = CTL_KERN;
-    mib[1] = KERN_PROC;
-    mib[2] = KERN_PROC_PID;
-    mib[3] = pid;
-
-    // fetch the info with sysctl()
-    len = sizeof(kp);
-    if (sysctl(mib, 4, &kp, &len, NULL, 0) == -1) {
-        // raise an exception if it failed, since we won't get any data
-        return PyErr_SetFromErrno(PyExc_OSError);
-    }
-
-    if (len > 0) { // if 0 then no data was retrieved
-        user_t = TV2DOUBLE(kp.ki_rusage.ru_utime);
-        sys_t = TV2DOUBLE(kp.ki_rusage.ru_stime);
-
-        // convert from microseconds to seconds
-        return Py_BuildValue("(dd)", user_t, sys_t);
-    }
-
-    // something went wrong, throw an error
-    return PyErr_Format(PyExc_RuntimeError,
-                        "Failed to retrieve process CPU times.");
+    if (get_kinfo_proc(pid, &kp) == -1) {
+        return NULL;
+    }
+    // convert from microseconds to seconds
+    user_t = TV2DOUBLE(kp.ki_rusage.ru_utime);
+    sys_t = TV2DOUBLE(kp.ki_rusage.ru_stime);
+    return Py_BuildValue("(dd)", user_t, sys_t);
 }

@@ -267,7 +258,6 @@
  */
 static PyObject* get_num_cpus(PyObject* self, PyObject* args)
 {
-
     int mib[2];
     int ncpu;
     size_t len;
@@ -291,32 +281,16 @@
  */
 static PyObject* get_process_create_time(PyObject* self, PyObject* args)
 {
-    int mib[4];
     long pid;
-    size_t len;
     struct kinfo_proc kp;
-
     if (! PyArg_ParseTuple(args, "l", &pid)) {
         return NULL;
     }
-
-    len = 4;
-    mib[0] = CTL_KERN;
-    mib[1] = KERN_PROC;
-    mib[2] = KERN_PROC_PID;
-    mib[3] = pid;
-    len = sizeof(kp);
-
-    if (sysctl(mib, 4, &kp, &len, NULL, 0) == -1) {
-        return PyErr_SetFromErrno(PyExc_OSError);
-    }
-
-    if (len > 0) {
-        return Py_BuildValue("d", TV2DOUBLE(kp.ki_start));
-    }
-
-    return PyErr_Format(PyExc_RuntimeError, "Unable to read process start time.");
-}
+    if (get_kinfo_proc(pid, &kp) == -1) {
+        return NULL;
+    }
+    return Py_BuildValue("d", TV2DOUBLE(kp.ki_start));
+}

 /*
@@ -324,30 +298,15 @@
  */
 static PyObject* get_memory_info(PyObject* self, PyObject* args)
 {
-    int mib[4];
     long pid;
-    size_t len;
     struct kinfo_proc kp;
-
     if (! PyArg_ParseTuple(args, "l", &pid)) {
         return NULL;
     }
-
-    len = 4;
-    mib[0] = CTL_KERN;
-    mib[1] = KERN_PROC;
-    mib[2] = KERN_PROC_PID;
-    mib[3] = pid;
-    len = sizeof(kp);
-    if (sysctl(mib, 4, &kp, &len, NULL, 0) == -1) {
-        return PyErr_SetFromErrno(PyExc_OSError);
-    }
-
-    if (len > 0) {
-        return Py_BuildValue("(ll)", ptoa(kp.ki_rssize), (long)kp.ki_size);
-    }
-
-    return PyErr_Format(PyExc_RuntimeError, "Unable to read process start time.");
+    if (get_kinfo_proc(pid, &kp) == -1) {
+        return NULL;
+    }
+    return Py_BuildValue("(ll)", ptoa(kp.ki_rssize), (long)kp.ki_size);
 }


Add comment about not closing/reopening DB.

--- src/SLNSessionCache.c
+++ src/SLNSessionCache.c
@@ -170,6 +170,10 @@

 	db_txn_abort(txn); txn = NULL;
 	SLNRepoDBClose(repo, &db);
+	// TODO: We shouldn't need to close and reopen the DB.
+	// However, async_random currently isn't thread-safe.
+	// Or it might be, but we sure ensure it instead of just
+	// counting on LibreSSL.

 	if(!mode) {
 		FREE(&passhash);


Issue #230 - testing changes to fix memory leak in get_connections() and also adding brackets to all if statements

--- psutil/_psutil_osx.c
+++ psutil/_psutil_osx.c
@@ -854,13 +854,18 @@
     return retList;

 error:
-    if (errno != 0)
+    if (errno != 0) {
         return PyErr_SetFromErrno(PyExc_OSError);
-    else if (! pid_exists(pid) )
+    }
+
+    else if (! pid_exists(pid) ) {
         return NoSuchProcess();
-    else
+    }
+
+    else {
         return PyErr_Format(PyExc_RuntimeError,
                             "proc_pidinfo(PROC_PIDLISTFDS) failed");
+    }
 }

@@ -989,25 +994,39 @@
             char lip[200], rip[200];
             char *state;
             int inseq;
+            PyObject* _family;
+            PyObject* _type;

             fd = (int)fdp_pointer->proc_fd;
             family = si.psi.soi_family;
             type = si.psi.soi_kind;

-            if (type == 2)
+            if (type == 2) {
                 type = SOCK_STREAM;
-            else if (type == 1)
+            }
+
+            else if (type == 1) {
                 type = SOCK_DGRAM;
-            else
+            }
+
+            else {
                 continue;
+            }

             // apply filters
-            inseq = PySequence_Contains(af_filter, PyLong_FromLong((long)family));
-            if (inseq == 0)
+            _family = PyLong_FromLong((long)family);
+            inseq = PySequence_Contains(af_filter, _family);
+            Py_DECREF(_family);
+            if (inseq == 0) {
                 continue;
-            inseq = PySequence_Contains(type_filter, PyLong_FromLong((long)type));
-            if (inseq == 0)
+            }
+
+            _type = PyLong_FromLong((long)type);
+            inseq = PySequence_Contains(type_filter, _type);
+            Py_DECREF(_type);
+            if (inseq == 0) {
                 continue;
+            }

             if (errno != 0) {
                 return PyErr_SetFromErrno(PyExc_OSError);
@@ -1023,6 +1042,7 @@
                           rip,
                           sizeof(lip));
             }
+
             else {
                 inet_ntop(AF_INET6,
                           &si.psi.soi_proto.pri_tcp.tcpsi_ini.insi_laddr.ina_6,
@@ -1039,16 +1059,22 @@

             lport = ntohs(si.psi.soi_proto.pri_tcp.tcpsi_ini.insi_lport);
             rport = ntohs(si.psi.soi_proto.pri_tcp.tcpsi_ini.insi_fport);
-            if (type == SOCK_STREAM)
+            if (type == SOCK_STREAM) {
                 state = get_connection_status((int)si.psi.soi_proto.pri_tcp.tcpsi_state);
-            else
+            }
+
+            else {
                 state = "";
+            }

             laddr = Py_BuildValue("(si)", lip, lport);
-            if (rport != 0)
+            if (rport != 0) {
                 raddr = Py_BuildValue("(si)", rip, rport);
-            else
+            }
+
+            else {
                 raddr = PyTuple_New(0);
+            }

             // --- construct python list
             tuple = Py_BuildValue("(iiiNNs)", fd, family, type, laddr, raddr,
@@ -1062,13 +1088,18 @@
     return retList;

 error:
-    if (errno != 0)
+    if (errno != 0) {
         return PyErr_SetFromErrno(PyExc_OSError);
-    else if (! pid_exists(pid) )
+    }
+
+    else if (! pid_exists(pid) ) {
         return NoSuchProcess();
-    else
+    }
+
+    else {
         return PyErr_Format(PyExc_RuntimeError,
                             "proc_pidinfo(PROC_PIDLISTFDS) failed");
+    }
 }


Oops

Oops

--- jversion.h
+++ jversion.h
@@ -32,5 +32,5 @@

 #define LJTCOPYRIGHT	"Copyright (C) 1999-2006 MIYASAKA Masaru\n" \
 			"Copyright (C) 2009 Pierre Ossman for Cendio AB\n" \
-			"Copyright (C) 2009-2011 D. R. Commander"
+			"Copyright (C) 2009-2011 D. R. Commander\n" \
 			"Copyright (C) 2009-2011 Nokia Corporation and/or its subsidiary(-ies)"


fix include guard

fix include guard

svn path=/trunk/kdesupport/akonadi/; revision=929675

--- server/src/exception.h
+++ server/src/exception.h
@@ -18,6 +18,7 @@
 */

 #ifndef AKONADI_EXCEPTION_H
+#define AKONADI_EXCEPTION_H

 #include <QByteArray>
 #include <exception>


regulator: of: Add support for parsing regulator_state for suspend state

The regulation_constraints structure includes specific field to support
suspend state for global PMIC SUSPEND/HIBERNATE mode. This patch add support
for parsing regulator_state for suspend state.

Signed-off-by: Chanwoo Choi <42eed19c0f56a8d487deac90c6d19d6364b7ba73@samsung.com>
Acked-by: Kyungmin Park <504c23c4986a3760712724894be3105092c27331@samsung.com>
Signed-off-by: Mark Brown <b51b9a92386687a9ac927cebfa0f978adeb8cea5@kernel.org>

--- drivers/regulator/of_regulator.c
+++ drivers/regulator/of_regulator.c
@@ -19,12 +19,19 @@

 #include "internal.h"

+const char *const regulator_states[PM_SUSPEND_MAX + 1] = {
+	[PM_SUSPEND_MEM]	= "regulator-state-mem",
+	[PM_SUSPEND_MAX]	= "regulator-state-disk",
+};
+
 static void of_get_regulation_constraints(struct device_node *np,
 					struct regulator_init_data **init_data)
 {
 	const __be32 *min_uV, *max_uV;
 	struct regulation_constraints *constraints = &(*init_data)->constraints;
-	int ret;
+	struct regulator_state *suspend_state;
+	struct device_node *suspend_np;
+	int ret, i;
 	u32 pval;

 	constraints->name = of_get_property(np, "regulator-name", NULL);
@@ -73,6 +80,36 @@
 	ret = of_property_read_u32(np, "regulator-enable-ramp-delay", &pval);
 	if (!ret)
 		constraints->enable_time = pval;
+
+	for (i = 0; i < ARRAY_SIZE(regulator_states); i++) {
+		switch (i) {
+		case PM_SUSPEND_MEM:
+			suspend_state = &constraints->state_mem;
+			break;
+		case PM_SUSPEND_MAX:
+			suspend_state = &constraints->state_disk;
+			break;
+		case PM_SUSPEND_ON:
+		case PM_SUSPEND_FREEZE:
+		case PM_SUSPEND_STANDBY:
+		default:
+			continue;
+		};
+
+		suspend_np = of_get_child_by_name(np, regulator_states[i]);
+		if (!suspend_np || !suspend_state)
+			continue;
+
+		if (of_property_read_bool(suspend_np,
+					"regulator-on-in-suspend"))
+			suspend_state->enabled = true;
+		else if (of_property_read_bool(suspend_np,
+					"regulator-off-in-suspend"))
+			suspend_state->disabled = true;
+
+		suspend_state = NULL;
+		suspend_np = NULL;
+	}
 }

 /**


[SCSI] ibmvscsi compatibility fix

[SCSI] ibmvscsi compatibility fix

Linda Xie ever so gently pointed out that she had a patch
to preserve compatibility with older SLES targets, and I told
her we didn't need to push it to mainline.

This patch explicitly checks the version of the IBMVSCSI target
and ensures that large scatterlists are not sent to older
targets.

Signed-off-by: Linda Xie <facd9396e74e31b73ff651909db93ad76497dd72@us.ibm.com>
Signed-off-by: Dave Boutcher <375f348aa924245771a029ae10c50487d64f917b@us.ibm.com>
Signed-off-by: James Bottomley <407b36959ca09543ccda8f8e06721c791bc53435@SteelEye.com>

--- drivers/scsi/ibmvscsi/ibmvscsi.c
+++ drivers/scsi/ibmvscsi/ibmvscsi.c
@@ -727,6 +727,16 @@
 		if (hostdata->madapter_info.port_max_txu[0])
 			hostdata->host->max_sectors =
 				hostdata->madapter_info.port_max_txu[0] >> 9;
+
+		if (hostdata->madapter_info.os_type == 3 &&
+		    strcmp(hostdata->madapter_info.srp_version, "1.6a") <= 0) {
+			printk("ibmvscsi: host (Ver. %s) doesn't support large"
+			       "transfers\n",
+			       hostdata->madapter_info.srp_version);
+			printk("ibmvscsi: limiting scatterlists to %d\n",
+			       MAX_INDIRECT_BUFS);
+			hostdata->host->sg_tablesize = MAX_INDIRECT_BUFS;
+		}
 	}
 }


[SCSI] lpfc 8.3.32: Fix CQ and EQ dump failure for debugfs

Fixed debug helper routine failed to dump CQ and EQ entries in non-MSI-X mode

Signed-off-by: Alex Iannicelli <27783c6032c813c36520e38fd0f30b0ab89e2df4@emulex.com>
Signed-off-by: James Smart <2b041da073ece526f0738329b43a4ebfc495c725@emulex.com>
Signed-off-by: James Bottomley <1acebbdca565c7b6b638bdc23b58b5610d1a56b8@Parallels.com>

--- drivers/scsi/lpfc/lpfc_debugfs.h
+++ drivers/scsi/lpfc/lpfc_debugfs.h
@@ -395,8 +395,13 @@
 	for (fcp_cqidx = 0; fcp_cqidx < phba->cfg_fcp_eq_count; fcp_cqidx++)
 		if (phba->sli4_hba.fcp_cq[fcp_cqidx]->queue_id == fcp_cqid)
 			break;
-	if (fcp_cqidx >= phba->cfg_fcp_eq_count)
-		return;
+	if (phba->intr_type == MSIX) {
+		if (fcp_cqidx >= phba->cfg_fcp_eq_count)
+			return;
+	} else {
+		if (fcp_cqidx > 0)
+			return;
+	}

 	printk(KERN_ERR "FCP CQ: WQ[Idx:%d|Qid%d]->CQ[Idx%d|Qid%d]:\n",
 		fcp_wqidx, phba->sli4_hba.fcp_wq[fcp_wqidx]->queue_id,
@@ -426,8 +431,13 @@
 	for (fcp_cqidx = 0; fcp_cqidx < phba->cfg_fcp_eq_count; fcp_cqidx++)
 		if (phba->sli4_hba.fcp_cq[fcp_cqidx]->queue_id == fcp_cqid)
 			break;
-	if (fcp_cqidx >= phba->cfg_fcp_eq_count)
-		return;
+	if (phba->intr_type == MSIX) {
+		if (fcp_cqidx >= phba->cfg_fcp_eq_count)
+			return;
+	} else {
+		if (fcp_cqidx > 0)
+			return;
+	}

 	if (phba->cfg_fcp_eq_count == 0) {
 		fcp_eqidx = -1;


[SCSI] lpfc driver 8.0.30 : fix lip/cablepull panic

Fix panic on lip and cable pull

Symptoms: Panic on lip or cable pull

Cause: Use after free of nlp in lpfc_nlp_remove()

Fix: Do not make FC transport calls after a node is removed. Transport
calls are disabled by ignoring the initial delete transition.

Signed-off-by: James Smart <662b34f26b29c45c7ee4f84b6fca46f06a668477@emulex.com>
Signed-off-by: James Bottomley <407b36959ca09543ccda8f8e06721c791bc53435@SteelEye.com>

--- drivers/scsi/lpfc/lpfc_hbadisc.c
+++ drivers/scsi/lpfc/lpfc_hbadisc.c
@@ -1135,6 +1135,8 @@
 	switch(list) {
 	case NLP_NO_LIST: /* No list, just remove it */
 		lpfc_nlp_remove(phba, nlp);
+		/* as node removed - stop further transport calls */
+		rport_del = none;
 		break;
 	case NLP_UNUSED_LIST:
 		spin_lock_irq(phba->host->host_lock);


drivers/serial/bfin_sport_uart.c: remove wrong and unneeded memset

dcb314@hotmail.com notes that this memset has its args reversed.

It's unneeded anyway, so remove it.

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

Signed-off-by: Andrew Morton <5c1e68b099950c134891f0b6e179498a8ebe9cf9@linux-foundation.org>
Signed-off-by: Alan Cox <91e38e63b890fbb214c8914809fde03c73e7f24d@lxorguk.ukuu.org.uk>
Signed-off-by: Linus Torvalds <69652caca27c8b940640ad396ab71f93cacec34f@linux-foundation.org>

--- drivers/serial/bfin_sport_uart.c
+++ drivers/serial/bfin_sport_uart.c
@@ -236,7 +236,6 @@
 	int retval;

 	pr_debug("%s enter\n", __func__);
-	memset(buffer, 20, '\0');
 	snprintf(buffer, 20, "%s rx", up->name);
 	retval = request_irq(up->rx_irq, sport_uart_rx_irq, IRQF_SAMPLE_RANDOM, buffer, up);
 	if (retval) {


drivers: nrf: Trigger STOP RX event and wait before disabling UARTE

Without first triggering TASKS_STOP{RX,TX}, I observed that the UARTE
was never disabled when using device_set_power_state which resulted in
the HFCLK never being shut down and several hundred microamps in
unnecessary current consumption when idle. This seems to fix the issue.

Also added special treatment of uarte if CONFIG_UART_ASYNC_API is
selected. Note that the #ifdef isn't enough, since it's possible that
the option is set, but only one of the UARTs uses it.

Signed-off-by: Benjamin Lindqvist <7629fd8b37cd591c8f190c83e53e232d0c037383@endian.se>

--- drivers/serial/uart_nrfx_uarte.c
+++ drivers/serial/uart_nrfx_uarte.c
@@ -1189,6 +1189,21 @@
 		assert(new_state == DEVICE_PM_LOW_POWER_STATE ||
 		       new_state == DEVICE_PM_SUSPEND_STATE ||
 		       new_state == DEVICE_PM_OFF_STATE);
+
+		/* Disabling UART requires stopping RX, but stop RX event is
+		 * only sent after each RX if async UART API is used.
+		 */
+#ifdef CONFIG_UART_ASYNC_API
+		if (get_dev_data(dev)->async) {
+			nrf_uarte_disable(uarte);
+			return;
+		}
+#endif
+		nrf_uarte_task_trigger(uarte, NRF_UARTE_TASK_STOPRX);
+		while (!nrf_uarte_event_check(uarte, NRF_UARTE_EVENT_RXTO)) {
+			/* Busy wait for event to register */
+		}
+		nrf_uarte_event_clear(uarte, NRF_UARTE_EVENT_RXTO);
 		nrf_uarte_disable(uarte);
 	}
 }


staging: binder: fix coding style issues

Fix coding style issues:
* put braces in all if-else branches;
* limit the length of changed lines to 80 columns.
checkpatch.pl warning count reduces by 3.

Signed-off-by: Dmitry Voytik <4a9ce36bc8a227a4c464212bd6836022f48f6348@gmail.com>
Signed-off-by: Greg Kroah-Hartman <4645f7897fd33786a2ee1264d590b3c400559d85@linuxfoundation.org>

--- drivers/staging/android/binder.c
+++ drivers/staging/android/binder.c
@@ -2199,12 +2199,16 @@
 		struct binder_work *w;
 		struct binder_transaction *t = NULL;

-		if (!list_empty(&thread->todo))
-			w = list_first_entry(&thread->todo, struct binder_work, entry);
-		else if (!list_empty(&proc->todo) && wait_for_proc_work)
-			w = list_first_entry(&proc->todo, struct binder_work, entry);
-		else {
-			if (ptr - buffer == 4 && !(thread->looper & BINDER_LOOPER_STATE_NEED_RETURN)) /* no data added */
+		if (!list_empty(&thread->todo)) {
+			w = list_first_entry(&thread->todo, struct binder_work,
+					     entry);
+		} else if (!list_empty(&proc->todo) && wait_for_proc_work) {
+			w = list_first_entry(&proc->todo, struct binder_work,
+					     entry);
+		} else {
+			/* no data added */
+			if (ptr - buffer == 4 &&
+			    !(thread->looper & BINDER_LOOPER_STATE_NEED_RETURN))
 				goto retry;
 			break;
 		}


plugin: refactor the initialization code.

Remove references to global python objects from the initialization code. This
makes it possible to avoid linking to libpython.

--- plugin/gstpythonplugin.c
+++ plugin/gstpythonplugin.c
@@ -25,6 +25,7 @@
 /* include this first, before NO_IMPORT_PYGOBJECT is defined */
 #include <pygobject.h>
 #include <gst/gst.h>
+#include <Python.h>

 PyTypeObject *_PyGstElement_Type;
 #define PyGstElement_Type (*_PyGstElement_Type)
@@ -40,35 +41,46 @@
 static inline gboolean
 np_init_pygobject (void)
 {
-  PyObject *gobject = PyImport_ImportModule ("gobject");
-  gboolean res = TRUE;
-
-  if (gobject != NULL) {
-    PyObject *mdict = PyModule_GetDict (gobject);
-    PyObject *cobject = PyDict_GetItemString (mdict, "_PyGObject_API");
-    if (PyCObject_Check (cobject)) {
-      _PyGObject_API =
-          (struct _PyGObject_Functions *) PyCObject_AsVoidPtr (cobject);
-    } else {
-      PyErr_SetString (PyExc_RuntimeError,
-          "could not find _PyGObject_API object");
-      PyErr_Print ();
-      res = FALSE;
-      goto beach;
-    }
-    if (!(PyObject_CallMethod (gobject, "threads_init", NULL, NULL))) {
-      PyErr_SetString (PyExc_RuntimeError, "Could not initialize threads");
-      PyErr_Print ();
-      res = FALSE;
-      goto beach;
-    }
-  } else {
+  gboolean res = FALSE;
+  PyObject *gobject = NULL;
+  PyObject *main_module = NULL;
+  PyObject *mdict = NULL;
+
+  gobject = PyImport_ImportModule ("gobject");
+  if (gobject == NULL) {
     PyErr_Print ();
     GST_WARNING ("could not import gobject");
-    res = FALSE;
-  }
+    goto beach;
+  }
+
+  main_module = PyImport_AddModule ("__main__");
+  mdict = PyModule_GetDict (gobject);
+
+  PyObject *cobject = PyDict_GetItemString (mdict, "_PyGObject_API");
+  if (cobject == NULL) {
+    GST_WARNING ("could not find _PyGObject_API");
+    goto beach;
+  }
+
+  _PyGObject_API =
+      (struct _PyGObject_Functions *) PyCObject_AsVoidPtr (cobject);
+  if (_PyGObject_API == NULL) {
+    PyErr_Print ();
+    GST_WARNING ("_PyGObject_API is not a valid CObject");
+    goto beach;
+  }
+
+  if (!(PyObject_CallMethod (gobject, "threads_init", NULL, NULL))) {
+    PyErr_Print ();
+    GST_WARNING ("could not initialize threads");
+    goto beach;
+  }
+
+  res = TRUE;

 beach:
+  Py_XDECREF (gobject);
+
   return res;
 }


version keeps fucking it up wtf

version keeps fucking it up wtf

--- year3/cis2750/A1TestHarness/studentCode/CalendarParser.c
+++ year3/cis2750/A1TestHarness/studentCode/CalendarParser.c
@@ -160,7 +160,7 @@
                     if(lineStorage[i][j] == ':')
                     {
                         j++;
-                        while(lineStorage[i][j+1] != '\0')
+                        while(lineStorage[i][j] != '\0')
                         {
                                 tempStorage[tempSize] = lineStorage[i][j];
                                 tempSize++;
@@ -183,7 +183,7 @@
                 // }
                 tempVersion = atof(VersionStorage);
                 printf("8.3.5\n");
-                printf("atofuck is %.1f\n", atof(VersionStorage));
+                printf("atofuck is %.1f, tempSize is %d\n", atof(VersionStorage), tempSize);
                 parseCalendar->version = atof(VersionStorage);
                 printf("versionStorage = %f\n", parseCalendar->version);
                 // strcpy(parseCalendar->version,(versionStorage));


Staging: android: binder: partial checkpatch cleanup

Clean up 3 or so checkpatch errors from one of my prior patches.

Signed-off-by: Daniel Walker <664f14bf9af4dadf8666a74e4a7425b312868d0d@fifo99.com>
Cc: Arve Hjønnevåg <203686835f49d1750fcbb70065cda5c503139a61@android.com>
Cc: Brian Swetland <59621ccc00d6b5a4203fcb7bcc3be3d6b35f3ac0@google.com>
Signed-off-by: Greg Kroah-Hartman <4645f7897fd33786a2ee1264d590b3c400559d85@suse.de>

--- drivers/staging/android/binder.c
+++ drivers/staging/android/binder.c
@@ -785,8 +785,8 @@
 	if (is_async) {
 		proc->free_async_space -= size + sizeof(struct binder_buffer);
 		binder_debug(BINDER_DEBUG_BUFFER_ALLOC_ASYNC,
-		             "binder: %d: binder_alloc_buf size %zd "
-		             "async free %zd\n", proc->pid, size,
+			     "binder: %d: binder_alloc_buf size %zd "
+			     "async free %zd\n", proc->pid, size,
 			     proc->free_async_space);
 	}

@@ -1146,7 +1146,7 @@
 		binder_debug(BINDER_DEBUG_DEAD_BINDER,
 			     "binder: %d delete ref %d desc %d "
 			     "has death notification\n", ref->proc->pid,
-		             ref->debug_id, ref->desc);
+			     ref->debug_id, ref->desc);
 		list_del(&ref->death->work.entry);
 		kfree(ref->death);
 		binder_stats_deleted(BINDER_STAT_DEATH);
@@ -2331,7 +2331,7 @@
 				if (!weak && !strong) {
 					binder_debug(BINDER_DEBUG_INTERNAL_REFS,
 						     "binder: %d:%d node %d u%p c%p deleted\n",
-					    	     proc->pid, thread->pid, node->debug_id,
+						     proc->pid, thread->pid, node->debug_id,
 						     node->ptr, node->cookie);
 					rb_erase(&node->rb_node, &proc->nodes);
 					kfree(node);


python: Don't call Py_DECREF() on NULL

python: Don't call Py_DECREF() on NULL

CID 1320703

--- plugin/gstpythonplugin.c
+++ plugin/gstpythonplugin.c
@@ -290,7 +290,8 @@
     pyplugin = pygobject_new (G_OBJECT (plugin));
     if (!pyplugin || PyModule_AddObject (gst, "__plugin__", pyplugin) != 0) {
       g_critical ("Couldn't set __plugin__ attribute");
-      Py_DECREF (pyplugin);
+      if (pyplugin)
+        Py_DECREF (pyplugin);
       return FALSE;
     }
   }


Restore commented out tests

Restore commented out tests

This restores the commented out tests (even though they're slow)
and fixes some trailing whitespace.

--- tests-clar/diff/rename.c
+++ tests-clar/diff/rename.c
@@ -871,7 +871,7 @@
 struct rename_expected
 {
 	size_t len;
-
+
 	unsigned int *status;
 	const char **sources;
 	const char **targets;
@@ -1129,7 +1129,7 @@

 	cl_git_pass(
 		git_diff_tree_to_index(&diff, g_repo, tree, index, &diffopts));
-
+
 	findopts.flags |= GIT_DIFF_FIND_AND_BREAK_REWRITES |
 		GIT_DIFF_FIND_REWRITES |
 		GIT_DIFF_FIND_RENAMES_FROM_REWRITES;
@@ -1333,8 +1333,6 @@
 	char tmp[64];
 	int i, j;
 	git_buf b = GIT_BUF_INIT;
-
-/*

 	cl_git_pass(git_repository_index(&index, g_repo));

@@ -1354,7 +1352,6 @@
 	git_index_free(index);

 	test_with_many(100);
-*/
 }

 void test_diff_rename__again_many_files(void)
@@ -1363,8 +1360,6 @@
 	char tmp[64];
 	int i;
 	git_buf b = GIT_BUF_INIT;
-
-/*

 	cl_git_pass(git_repository_index(&index, g_repo));

@@ -1386,5 +1381,4 @@
 	git_index_free(index);

 	test_with_many(2500);
-*/
-}
+}


fix up the open flag translation

fix up the open flag translation

git-svn-id: a2d12f8ba5efd9a6cf770ee2a6d40c767093e4df@9617 3eda493b-6a19-0410-b2e0-ec8ea4dd8fda

--- zfs-fuse-0.5.0_slash/src/zfs-fuse/zfs_operations_slash.c
+++ zfs-fuse-0.5.0_slash/src/zfs-fuse/zfs_operations_slash.c
@@ -610,17 +610,16 @@
 	ZFS_ENTER(zfsvfs);

 	/* Map flags */
-	int mode, flags;
-
-	if(fflags & O_WRONLY) {
+	int mode=0, flags=0;
+
+	if (fflags & SLF_WRITE) {
 		mode = VWRITE;
 		flags = FWRITE;
-	} else if(fflags & O_RDWR) {
-		mode = VREAD | VWRITE;
-		flags = FREAD | FWRITE;
-	} else {
-		mode = VREAD;
-		flags = FREAD;
+	}
+
+	if (fflags & SLF_READ) {
+		mode  |= VREAD;
+		flags |= FREAD;
 	}

 	fflags |= O_DSYNC;


Fixedtime sched (fail version)

Fixedtime sched (fail version)

--- src/kernel/thread/sched_strategy/fixedtime_sched.c
+++ src/kernel/thread/sched_strategy/fixedtime_sched.c
@@ -9,6 +9,9 @@
 #include <kernel/thread/api.h>
 #include <kernel/thread/sched_strategy.h>
 #include <kernel/thread/state.h>
+#include <kernel/prom_printf.h>
+
+#define USEC_PRIORITY_MULTIPLIER 1000

 static int wakeup_resumed_thread(struct runq *runq, struct sleepq *sleepq);
 static void wakeup_suspended_thread(struct runq *runq, struct sleepq *sleepq);
@@ -61,7 +64,9 @@

 	thread = list_entry(sleepq->rq.next, struct thread, sched.l_link);
 	assert(thread);
-	list_del(&thread->sched.l_link);
+	list_del_init(&thread->sched.l_link);
+
+	prom_printf("\n!Wakeup resumed thread: %8x, sleepq: %8x!\n", (unsigned int)thread, (unsigned int) sleepq);

 	thread->state = thread_state_do_wake(thread->state);
 	assert(thread_state_running(thread->state));
@@ -120,6 +125,8 @@

 	list_add_tail(&current->sched.l_link, &sleepq->rq);

+	prom_printf("\n!Sleep thread: %8x, sleepq: %8x!\n", (unsigned int)current, (unsigned int) sleepq);
+
 	current->sleepq = sleepq;
 	current->state = thread_state_do_sleep(current->state);
 }
@@ -137,7 +144,7 @@

 /* Calculate execution time for thread  */
 static useconds_t get_exec_time(struct thread *thread) {
-	return 10 * thread->priority; // TODO: make it with const
+	return USEC_PRIORITY_MULTIPLIER * thread->priority;
 }

 int runq_switch(struct runq *runq) {
@@ -151,7 +158,7 @@
 	runq->last_upd = cur_time;

 	if ((runq->timeleft > diff) &&
-		thread_state_running(runq->current->state)) {  /* We still have time */
+			thread_state_running(runq->current->state)) { /* Time isn't over */
 		runq->timeleft -= diff;
 		return 0;
 	}


staging: dgap: mgmt.c: removes unused variable

This patch removes the unused variable page
in mgmt.c.

Signed-off-by: Lidza Louina <c2e90c0f9f424f9062e7f891bbe155a992aa9370@gmail.com>
Signed-off-by: Greg Kroah-Hartman <4645f7897fd33786a2ee1264d590b3c400559d85@linuxfoundation.org>

--- drivers/staging/dgap/dgap_mgmt.c
+++ drivers/staging/dgap/dgap_mgmt.c
@@ -607,7 +607,6 @@

 		/* If the concentrator number is 0... */
 		if (kme.rw_conc == 0 && kme.rw_addr < 0x100000) {
-			int page = 0;
 			int addr = kme.rw_addr;
 			int size = kme.rw_size;
 			caddr_t data = (caddr_t) kme.rw_data;


correct printf format

correct printf format

--- dev/externals/mctools/channel.c
+++ dev/externals/mctools/channel.c
@@ -247,7 +247,7 @@
         }
     }

-    printf("Extracting %d channels from '%s':\n%ld sample frames\n",numchans,filename,nframes);
+    printf("Extracting %d channels from '%s':\n%d sample frames\n",numchans,filename,nframes);

     //stopwatch(1);
     for(i=0;i < nframes; i++){


Consistent header guard naming

Consistent header guard naming

--- src/bc_handling/include/grins/heat_transfer_bc_handling.h
+++ src/bc_handling/include/grins/heat_transfer_bc_handling.h
@@ -21,8 +21,8 @@
 //
 //-----------------------------------------------------------------------el-

-#ifndef HEAT_TRANSFER_BC_HANDLING_H
-#define HEAT_TRANSFER_BC_HANDLING_H
+#ifndef GRINS_HEAT_TRANSFER_BC_HANDLING_H
+#define GRINS_HEAT_TRANSFER_BC_HANDLING_H

 //GRINS
 #include "grins/bc_handling_base.h"
@@ -77,4 +77,4 @@

   };
 }
-#endif // HEAT_TRANSFER_BC_HANDLING_H
+#endif // GRINS_HEAT_TRANSFER_BC_HANDLING_H


Rename test for rename from rewrite

Rename test for rename from rewrite

A rename test that illustrates a rename from a rewrite.

--- tests-clar/diff/rename.c
+++ tests-clar/diff/rename.c
@@ -1096,6 +1096,56 @@
 	git_reference_free(selfsimilar);
 }

+void test_diff_rename__can_rename_from_rewrite(void)
+{
+	git_index *index;
+	git_tree *tree;
+	git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT;
+	git_diff_list *diff;
+	git_diff_options diffopts = GIT_DIFF_OPTIONS_INIT;
+	git_diff_find_options findopts = GIT_DIFF_FIND_OPTIONS_INIT;
+
+	unsigned int status[] = { GIT_DELTA_RENAMED, GIT_DELTA_RENAMED };
+	const char *sources[] = { "ikeepsix.txt", "songof7cities.txt" };
+	const char *targets[] = { "songof7cities.txt", "this-is-a-rename.txt" };
+	struct rename_expected expect = { 2, status, sources, targets };
+
+	opts.checkout_strategy = GIT_CHECKOUT_FORCE;
+
+	cl_git_pass(git_repository_index(&index, g_repo));
+
+	cl_git_pass(p_rename("renames/songof7cities.txt", "renames/this-is-a-rename.txt"));
+	cl_git_pass(p_rename("renames/ikeepsix.txt", "renames/songof7cities.txt"));
+
+	cl_git_pass(git_index_remove_bypath(index, "ikeepsix.txt"));
+
+	cl_git_pass(git_index_add_bypath(index, "songof7cities.txt"));
+	cl_git_pass(git_index_add_bypath(index, "this-is-a-rename.txt"));
+
+	cl_git_pass(git_index_write(index));
+
+	cl_git_pass(
+		git_revparse_single((git_object **)&tree, g_repo, "HEAD^{tree}"));
+
+	cl_git_pass(
+		git_diff_tree_to_index(&diff, g_repo, tree, index, &diffopts));
+
+	findopts.flags |= GIT_DIFF_FIND_AND_BREAK_REWRITES |
+		GIT_DIFF_FIND_REWRITES |
+		GIT_DIFF_FIND_RENAMES_FROM_REWRITES;
+
+	cl_git_pass(git_diff_find_similar(diff, &findopts));
+
+	cl_git_pass(
+		git_diff_foreach(diff, test_names_expected, NULL, NULL, &expect));
+
+	cl_assert(expect.idx == expect.len);
+
+	git_diff_list_free(diff);
+	git_tree_free(tree);
+	git_index_free(index);
+}
+
 void test_diff_rename__case_changes_are_split(void)
 {
 	git_index *index;
@@ -1283,6 +1333,8 @@
 	char tmp[64];
 	int i, j;
 	git_buf b = GIT_BUF_INIT;
+
+/*

 	cl_git_pass(git_repository_index(&index, g_repo));

@@ -1302,6 +1354,7 @@
 	git_index_free(index);

 	test_with_many(100);
+*/
 }

 void test_diff_rename__again_many_files(void)
@@ -1310,6 +1363,8 @@
 	char tmp[64];
 	int i;
 	git_buf b = GIT_BUF_INIT;
+
+/*

 	cl_git_pass(git_repository_index(&index, g_repo));

@@ -1331,4 +1386,5 @@
 	git_index_free(index);

 	test_with_many(2500);
-}
+*/
+}


comment

comment

git-svn-id: a2d12f8ba5efd9a6cf770ee2a6d40c767093e4df@10179 3eda493b-6a19-0410-b2e0-ec8ea4dd8fda

--- zfs-fuse-0.5.0_slash/src/zfs-fuse/zfs_operations_slash.c
+++ zfs-fuse-0.5.0_slash/src/zfs-fuse/zfs_operations_slash.c
@@ -913,6 +913,7 @@

 	ASSERT(vp != NULL);

+	/* we only suppress fid link when called from mds_repl_scandir() */
 	if (suppress_fidlink == 0)
 		error = zfsslash2_fidlink(zfsvfs, vp, 0);