mtd: Standardising prints in onenand_base.c

This patch resolves all the prints present in onenand_base.c
Primarily, it replaces the hard-coded function names in the prints,
and makes use of __func__.

Signed-off-by: Amul Kumar Saha <d37079819aeaba6d3f3c68a4fe472c6d0ac45e63@samsung.com>
Signed-off-by: David Woodhouse <b460d66aaf00c296a3db1c1d9eeafc081d5f7d70@intel.com>

--- drivers/mtd/onenand/onenand_base.c
+++ drivers/mtd/onenand/onenand_base.c
@@ -500,25 +500,28 @@
 		int ecc = onenand_read_ecc(this);
 		if (ecc) {
 			if (ecc & ONENAND_ECC_2BIT_ALL) {
-				printk(KERN_ERR "onenand_wait: ECC error = 0x%04x\n", ecc);
+				printk(KERN_ERR "%s: ECC error = 0x%04x\n",
+					__func__, ecc);
 				mtd->ecc_stats.failed++;
 				return -EBADMSG;
 			} else if (ecc & ONENAND_ECC_1BIT_ALL) {
-				printk(KERN_DEBUG "onenand_wait: correctable ECC error = 0x%04x\n", ecc);
+				printk(KERN_DEBUG "%s: correctable ECC error = 0x%04x\n",
+					__func__, ecc);
 				mtd->ecc_stats.corrected++;
 			}
 		}
 	} else if (state == FL_READING) {
-		printk(KERN_ERR "onenand_wait: read timeout! ctrl=0x%04x intr=0x%04x\n", ctrl, interrupt);
+		printk(KERN_ERR "%s: read timeout! ctrl=0x%04x intr=0x%04x\n",
+			__func__, ctrl, interrupt);
 		return -EIO;
 	}

 	/* If there's controller error, it's a real error */
 	if (ctrl & ONENAND_CTRL_ERROR) {
-		printk(KERN_ERR "onenand_wait: controller error = 0x%04x\n",
-			ctrl);
+		printk(KERN_ERR "%s: controller error = 0x%04x\n",
+			__func__, ctrl);
 		if (ctrl & ONENAND_CTRL_LOCK)
-			printk(KERN_ERR "onenand_wait: it's locked error.\n");
+			printk(KERN_ERR "%s: it's locked error.\n", __func__);
 		return -EIO;
 	}

@@ -1015,7 +1018,8 @@
 	/* We are attempting to reread, so decrement stats.failed
 	 * which was incremented by onenand_wait due to read failure
 	 */
-	printk(KERN_INFO "onenand_recover_lsb: Attempting to recover from uncorrectable read\n");
+	printk(KERN_INFO "%s: Attempting to recover from uncorrectable read\n",
+		__func__);
 	mtd->ecc_stats.failed--;

 	/* Issue the LSB page recovery command */
@@ -1046,7 +1050,8 @@
 	int ret = 0;
 	int writesize = this->writesize;

-	DEBUG(MTD_DEBUG_LEVEL3, "onenand_mlc_read_ops_nolock: from = 0x%08x, len = %i\n", (unsigned int) from, (int) len);
+	DEBUG(MTD_DEBUG_LEVEL3, "%s: from = 0x%08x, len = %i\n",
+		(unsigned int) from, (int) len);

 	if (ops->mode == MTD_OOB_AUTO)
 		oobsize = this->ecclayout->oobavail;
@@ -1057,7 +1062,8 @@

 	/* Do not allow reads past end of device */
 	if (from + len > mtd->size) {
-		printk(KERN_ERR "onenand_mlc_read_ops_nolock: Attempt read beyond end of device\n");
+		printk(KERN_ERR "%s: Attempt read beyond end of device\n",
+			__func__);
 		ops->retlen = 0;
 		ops->oobretlen = 0;
 		return -EINVAL;
@@ -1146,7 +1152,8 @@
 	int ret = 0, boundary = 0;
 	int writesize = this->writesize;

-	DEBUG(MTD_DEBUG_LEVEL3, "onenand_read_ops_nolock: from = 0x%08x, len = %i\n", (unsigned int) from, (int) len);
+	DEBUG(MTD_DEBUG_LEVEL3, "%s: from = 0x%08x, len = %i\n",
+			__func__, (unsigned int) from, (int) len);

 	if (ops->mode == MTD_OOB_AUTO)
 		oobsize = this->ecclayout->oobavail;
@@ -1157,7 +1164,8 @@

 	/* Do not allow reads past end of device */
 	if ((from + len) > mtd->size) {
-		printk(KERN_ERR "onenand_read_ops_nolock: Attempt read beyond end of device\n");
+		printk(KERN_ERR "%s: Attempt read beyond end of device\n",
+			__func__);
 		ops->retlen = 0;
 		ops->oobretlen = 0;
 		return -EINVAL;
@@ -1275,7 +1283,8 @@

 	from += ops->ooboffs;

-	DEBUG(MTD_DEBUG_LEVEL3, "onenand_read_oob_nolock: from = 0x%08x, len = %i\n", (unsigned int) from, (int) len);
+	DEBUG(MTD_DEBUG_LEVEL3, "%s: from = 0x%08x, len = %i\n",
+		__func__, (unsigned int) from, (int) len);

 	/* Initialize return length value */
 	ops->oobretlen = 0;
@@ -1288,7 +1297,8 @@
 	column = from & (mtd->oobsize - 1);

 	if (unlikely(column >= oobsize)) {
-		printk(KERN_ERR "onenand_read_oob_nolock: Attempted to start read outside oob\n");
+		printk(KERN_ERR "%s: Attempted to start read outside oob\n",
+			__func__);
 		return -EINVAL;
 	}

@@ -1296,7 +1306,8 @@
 	if (unlikely(from >= mtd->size ||
 		     column + len > ((mtd->size >> this->page_shift) -
 				     (from >> this->page_shift)) * oobsize)) {
-		printk(KERN_ERR "onenand_read_oob_nolock: Attempted to read beyond end of device\n");
+		printk(KERN_ERR "%s: Attempted to read beyond end of device\n",
+			__func__);
 		return -EINVAL;
 	}

@@ -1319,7 +1330,8 @@
 			ret = onenand_recover_lsb(mtd, from, ret);

 		if (ret && ret != -EBADMSG) {
-			printk(KERN_ERR "onenand_read_oob_nolock: read failed = 0x%x\n", ret);
+			printk(KERN_ERR "%s: read failed = 0x%x\n",
+				__func__, ret);
 			break;
 		}

@@ -1450,20 +1462,21 @@
 	if (interrupt & ONENAND_INT_READ) {
 		int ecc = onenand_read_ecc(this);
 		if (ecc & ONENAND_ECC_2BIT_ALL) {
-			printk(KERN_INFO "onenand_bbt_wait: ecc error = 0x%04x"
-				", controller error 0x%04x\n", ecc, ctrl);
+			printk(KERN_WARNING "%s: ecc error = 0x%04x, "
+				"controller error 0x%04x\n",
+				__func__, ecc, ctrl);
 			return ONENAND_BBT_READ_ECC_ERROR;
 		}
 	} else {
-		printk(KERN_ERR "onenand_bbt_wait: read timeout!"
-			"ctrl=0x%04x intr=0x%04x\n", ctrl, interrupt);
+		printk(KERN_ERR "%s: read timeout! ctrl=0x%04x intr=0x%04x\n",
+			__func__, ctrl, interrupt);
 		return ONENAND_BBT_READ_FATAL_ERROR;
 	}

 	/* Initial bad block case: 0x2400 or 0x0400 */
 	if (ctrl & ONENAND_CTRL_ERROR) {
-		printk(KERN_DEBUG "onenand_bbt_wait: "
-			"controller error = 0x%04x\n", ctrl);
+		printk(KERN_DEBUG "%s: controller error = 0x%04x\n",
+			__func__, ctrl);
 		return ONENAND_BBT_READ_ERROR;
 	}

@@ -1487,14 +1500,16 @@
 	size_t len = ops->ooblen;
 	u_char *buf = ops->oobbuf;

-	DEBUG(MTD_DEBUG_LEVEL3, "onenand_bbt_read_oob: from = 0x%08x, len = %zi\n", (unsigned int) from, len);
+	DEBUG(MTD_DEBUG_LEVEL3, "%s: from = 0x%08x, len = %zi\n",
+		__func__, (unsigned int) from, len);

 	/* Initialize return value */
 	ops->oobretlen = 0;

 	/* Do not allow reads past end of device */
 	if (unlikely((from + len) > mtd->size)) {
-		printk(KERN_ERR "onenand_bbt_read_oob: Attempt read beyond end of device\n");
+		printk(KERN_ERR "%s: Attempt read beyond end of device\n",
+			__func__);
 		return ONENAND_BBT_READ_FATAL_ERROR;
 	}

@@ -1661,21 +1676,23 @@
 	/* Wait for any existing operation to clear */
 	onenand_panic_wait(mtd);

-	DEBUG(MTD_DEBUG_LEVEL3, "onenand_panic_write: to = 0x%08x, len = %i\n",
-	      (unsigned int) to, (int) len);
+	DEBUG(MTD_DEBUG_LEVEL3, "%s: to = 0x%08x, len = %i\n",
+		__func__, (unsigned int) to, (int) len);

 	/* Initialize retlen, in case of early exit */
 	*retlen = 0;

 	/* Do not allow writes past end of device */
 	if (unlikely((to + len) > mtd->size)) {
-		printk(KERN_ERR "onenand_panic_write: Attempt write to past end of device\n");
+		printk(KERN_ERR "%s: Attempt write to past end of device\n",
+			__func__);
 		return -EINVAL;
 	}

 	/* Reject writes, which are not page aligned */
         if (unlikely(NOTALIGNED(to) || NOTALIGNED(len))) {
-                printk(KERN_ERR "onenand_panic_write: Attempt to write not page aligned data\n");
+		printk(KERN_ERR "%s: Attempt to write not page aligned data\n",
+			__func__);
                 return -EINVAL;
         }

@@ -1711,7 +1728,7 @@
 		}

 		if (ret) {
-			printk(KERN_ERR "onenand_panic_write: write failed %d\n", ret);
+			printk(KERN_ERR "%s: write failed %d\n", __func__, ret);
 			break;
 		}

@@ -1792,7 +1809,8 @@
 	u_char *oobbuf;
 	int ret = 0;

-	DEBUG(MTD_DEBUG_LEVEL3, "onenand_write_ops_nolock: to = 0x%08x, len = %i\n", (unsigned int) to, (int) len);
+	DEBUG(MTD_DEBUG_LEVEL3, "%s: to = 0x%08x, len = %i\n",
+		__func__, (unsigned int) to, (int) len);

 	/* Initialize retlen, in case of early exit */
 	ops->retlen = 0;
@@ -1800,13 +1818,15 @@

 	/* Do not allow writes past end of device */
 	if (unlikely((to + len) > mtd->size)) {
-		printk(KERN_ERR "onenand_write_ops_nolock: Attempt write to past end of device\n");
+		printk(KERN_ERR "%s: Attempt write to past end of device\n",
+			__func__);
 		return -EINVAL;
 	}

 	/* Reject writes, which are not page aligned */
         if (unlikely(NOTALIGNED(to) || NOTALIGNED(len))) {
-                printk(KERN_ERR "onenand_write_ops_nolock: Attempt to write not page aligned data\n");
+		printk(KERN_ERR "%s: Attempt to write not page aligned data\n",
+			__func__);
                 return -EINVAL;
         }

@@ -1879,7 +1899,8 @@
 			onenand_update_bufferram(mtd, prev, !ret && !prev_subpage);
 			if (ret) {
 				written -= prevlen;
-				printk(KERN_ERR "onenand_write_ops_nolock: write failed %d\n", ret);
+				printk(KERN_ERR "%s: write failed %d\n",
+					__func__, ret);
 				break;
 			}

@@ -1887,7 +1908,8 @@
 				/* Only check verify write turn on */
 				ret = onenand_verify(mtd, buf - len, to - len, len);
 				if (ret)
-					printk(KERN_ERR "onenand_write_ops_nolock: verify failed %d\n", ret);
+					printk(KERN_ERR "%s: verify failed %d\n",
+						__func__, ret);
 				break;
 			}

@@ -1905,14 +1927,16 @@
 			/* In partial page write we don't update bufferram */
 			onenand_update_bufferram(mtd, to, !ret && !subpage);
 			if (ret) {
-				printk(KERN_ERR "onenand_write_ops_nolock: write failed %d\n", ret);
+				printk(KERN_ERR "%s: write failed %d\n",
+					__func__, ret);
 				break;
 			}

 			/* Only check verify write turn on */
 			ret = onenand_verify(mtd, buf, to, thislen);
 			if (ret) {
-				printk(KERN_ERR "onenand_write_ops_nolock: verify failed %d\n", ret);
+				printk(KERN_ERR "%s: verify failed %d\n",
+					__func__, ret);
 				break;
 			}

@@ -1968,7 +1992,8 @@

 	to += ops->ooboffs;

-	DEBUG(MTD_DEBUG_LEVEL3, "onenand_write_oob_nolock: to = 0x%08x, len = %i\n", (unsigned int) to, (int) len);
+	DEBUG(MTD_DEBUG_LEVEL3, "%s: to = 0x%08x, len = %i\n",
+		__func__, (unsigned int) to, (int) len);

 	/* Initialize retlen, in case of early exit */
 	ops->oobretlen = 0;
@@ -1981,14 +2006,15 @@
 	column = to & (mtd->oobsize - 1);

 	if (unlikely(column >= oobsize)) {
-		printk(KERN_ERR "onenand_write_oob_nolock: Attempted to start write outside oob\n");
+		printk(KERN_ERR "%s: Attempted to start write outside oob\n",
+			__func__);
 		return -EINVAL;
 	}

 	/* For compatibility with NAND: Do not allow write past end of page */
 	if (unlikely(column + len > oobsize)) {
-		printk(KERN_ERR "onenand_write_oob_nolock: "
-		      "Attempt to write past end of page\n");
+		printk(KERN_ERR "%s: Attempt to write past end of page\n",
+			__func__);
 		return -EINVAL;
 	}

@@ -1996,7 +2022,8 @@
 	if (unlikely(to >= mtd->size ||
 		     column + len > ((mtd->size >> this->page_shift) -
 				     (to >> this->page_shift)) * oobsize)) {
-		printk(KERN_ERR "onenand_write_oob_nolock: Attempted to write past end of device\n");
+		printk(KERN_ERR "%s: Attempted to write past end of device\n"
+			__func__);
 		return -EINVAL;
 	}

@@ -2038,13 +2065,14 @@

 		ret = this->wait(mtd, FL_WRITING);
 		if (ret) {
-			printk(KERN_ERR "onenand_write_oob_nolock: write failed %d\n", ret);
+			printk(KERN_ERR "%s: write failed %d\n", __func__, ret);
 			break;
 		}

 		ret = onenand_verify_oob(mtd, oobbuf, to);
 		if (ret) {
-			printk(KERN_ERR "onenand_write_oob_nolock: verify failed %d\n", ret);
+			printk(KERN_ERR "%s: verify failed %d\n",
+				__func__, ret);
 			break;
 		}

@@ -2161,7 +2189,7 @@

 	/* Do not allow erase past end of device */
 	if (unlikely((len + addr) > mtd->size)) {
-		printk(KERN_ERR "onenand_erase: Erase past end of device\n");
+		printk(KERN_ERR "%s: Erase past end of device\n", __func__);
 		return -EINVAL;
 	}

@@ -2177,7 +2205,7 @@
 		 * Erase region's start offset is always block start address.
 		 */
 		if (unlikely((addr - region->offset) & (block_size - 1))) {
-			printk(KERN_ERR "onenand_erase: Unaligned address\n");
+			printk(KERN_ERR "%s: Unaligned address\n", __func__);
 			return -EINVAL;
 		}
 	} else {
@@ -2185,14 +2213,14 @@

 		/* Start address must align on block boundary */
 		if (unlikely(addr & (block_size - 1))) {
-			printk(KERN_ERR "onenand_erase: Unaligned address\n");
+			printk(KERN_ERR "%s: Unaligned address\n", __func__);
 			return -EINVAL;
 		}
 	}

 	/* Length must align on block boundary */
 	if (unlikely(len & (block_size - 1))) {
-		printk(KERN_ERR "onenand_erase: Length not block aligned\n");
+		printk(KERN_ERR "%s: Length not block aligned\n", __func__);
 		return -EINVAL;
 	}

@@ -2209,7 +2237,9 @@

 		/* Check if we have a bad block, we do not erase bad blocks */
 		if (onenand_block_isbad_nolock(mtd, addr, 0)) {
-			printk (KERN_WARNING "onenand_erase: attempt to erase a bad block at addr 0x%012llx\n", (unsigned long long) addr);
+			printk(KERN_WARNING "%s: attempt to erase a bad block "
+					"at addr 0x%012llx\n",
+					__func__, (unsigned long long) addr);
 			instr->state = MTD_ERASE_FAILED;
 			goto erase_exit;
 		}
@@ -2221,8 +2251,8 @@
 		ret = this->wait(mtd, FL_ERASING);
 		/* Check, if it is write protected */
 		if (ret) {
-			printk(KERN_ERR "onenand_erase: Failed erase, block %d\n",
-						 onenand_block(this, addr));
+			printk(KERN_ERR "%s: Failed erase, block %d\n",
+				__func__, onenand_block(this, addr));
 			instr->state = MTD_ERASE_FAILED;
 			instr->fail_addr = addr;
 			goto erase_exit;
@@ -2241,7 +2271,8 @@

 			if (len & (block_size - 1)) {
 				/* FIXME: This should be handled at MTD partitioning level. */
-				printk(KERN_ERR "onenand_erase: Unaligned address\n");
+				printk(KERN_ERR "%s: Unaligned address\n",
+					__func__);
 				goto erase_exit;
 			}
 		}
@@ -2272,7 +2303,7 @@
  */
 static void onenand_sync(struct mtd_info *mtd)
 {
-	DEBUG(MTD_DEBUG_LEVEL3, "onenand_sync: called\n");
+	DEBUG(MTD_DEBUG_LEVEL3, "%s: called\n", __func__);

 	/* Grab the lock and see if the device is available */
 	onenand_get_device(mtd, FL_SYNCING);
@@ -2406,7 +2437,8 @@
 		/* Check lock status */
 		status = this->read_word(this->base + ONENAND_REG_WP_STATUS);
 		if (!(status & wp_status_mask))
-			printk(KERN_ERR "wp status = 0x%x\n", status);
+			printk(KERN_ERR "%s: wp status = 0x%x\n",
+				__func__, status);

 		return 0;
 	}
@@ -2435,7 +2467,8 @@
 		/* Check lock status */
 		status = this->read_word(this->base + ONENAND_REG_WP_STATUS);
 		if (!(status & wp_status_mask))
-			printk(KERN_ERR "block = %d, wp status = 0x%x\n", block, status);
+			printk(KERN_ERR "%s: block = %d, wp status = 0x%x\n",
+				__func__, block, status);
 	}

 	return 0;
@@ -2502,7 +2535,8 @@
 		/* Check lock status */
 		status = this->read_word(this->base + ONENAND_REG_WP_STATUS);
 		if (!(status & ONENAND_WP_US)) {
-			printk(KERN_ERR "block = %d, wp status = 0x%x\n", block, status);
+			printk(KERN_ERR "%s: block = %d, wp status = 0x%x\n",
+				__func__, block, status);
 			return 0;
 		}
 	}
@@ -3172,7 +3206,8 @@
 				break;

 		if (i != mtd->oobsize) {
-			printk(KERN_WARNING "Block %d not erased.\n", block);
+			printk(KERN_WARNING "%s: Block %d not erased.\n",
+				__func__, block);
 			return 1;
 		}
 	}
@@ -3204,8 +3239,8 @@
 	blksperdie >>= ONENAND_IS_DDP(this) ? 1 : 0;

 	if (boundary >= blksperdie) {
-		printk(KERN_ERR "flexonenand_set_boundary: Invalid boundary value. "
-				"Boundary not changed.\n");
+		printk(KERN_ERR "%s: Invalid boundary value. "
+				"Boundary not changed.\n", __func__);
 		return -EINVAL;
 	}

@@ -3214,7 +3249,8 @@
 	new = boundary + (die * this->density_mask);
 	ret = flexonenand_check_blocks_erased(mtd, min(old, new) + 1, max(old, new));
 	if (ret) {
-		printk(KERN_ERR "flexonenand_set_boundary: Please erase blocks before boundary change\n");
+		printk(KERN_ERR "%s: Please erase blocks "
+				"before boundary change\n", __func__);
 		return ret;
 	}

@@ -3227,12 +3263,12 @@

 	thisboundary = this->read_word(this->base + ONENAND_DATARAM);
 	if ((thisboundary >> FLEXONENAND_PI_UNLOCK_SHIFT) != 3) {
-		printk(KERN_ERR "flexonenand_set_boundary: boundary locked\n");
+		printk(KERN_ERR "%s: boundary locked\n", __func__);
 		ret = 1;
 		goto out;
 	}

-	printk(KERN_INFO "flexonenand_set_boundary: Changing die %d boundary: %d%s\n",
+	printk(KERN_INFO "Changing die %d boundary: %d%s\n",
 			die, boundary, lock ? "(Locked)" : "(Unlocked)");

 	addr = die ? this->diesize[0] : 0;
@@ -3243,7 +3279,8 @@
 	this->command(mtd, ONENAND_CMD_ERASE, addr, 0);
 	ret = this->wait(mtd, FL_ERASING);
 	if (ret) {
-		printk(KERN_ERR "flexonenand_set_boundary: Failed PI erase for Die %d\n", die);
+		printk(KERN_ERR "%s: flexonenand_set_boundary: "
+				"Failed PI erase for Die %d\n", __func__, die);
 		goto out;
 	}

@@ -3251,7 +3288,8 @@
 	this->command(mtd, ONENAND_CMD_PROG, addr, 0);
 	ret = this->wait(mtd, FL_WRITING);
 	if (ret) {
-		printk(KERN_ERR "flexonenand_set_boundary: Failed PI write for Die %d\n", die);
+		printk(KERN_ERR "%s: Failed PI write for Die %d\n",
+			__func__, die);
 		goto out;
 	}

@@ -3408,8 +3446,8 @@
 	if (this->state == FL_PM_SUSPENDED)
 		onenand_release_device(mtd);
 	else
-		printk(KERN_ERR "resume() called for the chip which is not"
-				"in suspended state\n");
+		printk(KERN_ERR "%s: resume() called for the chip which is not "
+				"in suspended state\n", __func__);
 }

 /**
@@ -3464,7 +3502,8 @@
 	if (!this->page_buf) {
 		this->page_buf = kzalloc(mtd->writesize, GFP_KERNEL);
 		if (!this->page_buf) {
-			printk(KERN_ERR "onenand_scan(): Can't allocate page_buf\n");
+			printk(KERN_ERR "%s: Can't allocate page_buf\n",
+				__func__);
 			return -ENOMEM;
 		}
 		this->options |= ONENAND_PAGEBUF_ALLOC;
@@ -3472,7 +3511,8 @@
 	if (!this->oob_buf) {
 		this->oob_buf = kzalloc(mtd->oobsize, GFP_KERNEL);
 		if (!this->oob_buf) {
-			printk(KERN_ERR "onenand_scan(): Can't allocate oob_buf\n");
+			printk(KERN_ERR "%s: Can't allocate oob_buf\n",
+				__func__);
 			if (this->options & ONENAND_PAGEBUF_ALLOC) {
 				this->options &= ~ONENAND_PAGEBUF_ALLOC;
 				kfree(this->page_buf);
@@ -3505,8 +3545,8 @@
 		break;

 	default:
-		printk(KERN_WARNING "No OOB scheme defined for oobsize %d\n",
-			mtd->oobsize);
+		printk(KERN_WARNING "%s: No OOB scheme defined for oobsize %d\n",
+			__func__, mtd->oobsize);
 		mtd->subpage_sft = 0;
 		/* To prevent kernel oops */
 		this->ecclayout = &onenand_oob_32;


add clear

add clear

--- components/finsh/cmd.c
+++ components/finsh/cmd.c
@@ -29,6 +29,7 @@
  * 2018-11-22     Jesven       list_thread add smp support
  * 2018-12-27     Jesven       Fix the problem that disable interrupt too long in list_thread
  *                             Provide protection for the "first layer of objects" when list_*
+ * 2020-04-07     chenhui      add clear
  */

 #include <rthw.h>
@@ -47,6 +48,15 @@
     return 0;
 }
 FINSH_FUNCTION_EXPORT(hello, say hello world);
+
+long clear(void)
+{
+    rt_kprintf("\x1b[2J\x1b[H");
+
+    return 0;
+}
+FINSH_FUNCTION_EXPORT(clear,clear the terminal screen);
+MSH_CMD_EXPORT(clear,clear the terminal screen);

 extern void rt_show_version(void);
 long version(void)


cxgb4vf: Ingress Queue Entry Size needs to be 64 bytes

Was using L1_CACHE_BYTES for the Ingress Queue Entry Size but it really
needs to be 64 bytes in order to support the largest message sizes.

Signed-off-by: Casey Leedom <dcfbcb54931b10a0f02f8363358ec242f10c17f5@chelsio.com>
Signed-off-by: David S. Miller <fe08d3c717adf2ae63592e4c9aec6e3e404d8e3e@davemloft.net>

--- drivers/net/cxgb4vf/cxgb4vf_main.c
+++ drivers/net/cxgb4vf/cxgb4vf_main.c
@@ -2269,6 +2269,7 @@
 {
 	struct sge *s = &adapter->sge;
 	int q10g, n10g, qidx, pidx, qs;
+	size_t iqe_size;

 	/*
 	 * We should not be called till we know how many Queue Sets we can
@@ -2313,6 +2314,13 @@
 	s->ethqsets = qidx;

 	/*
+	 * The Ingress Queue Entry Size for our various Response Queues needs
+	 * to be big enough to accommodate the largest message we can receive
+	 * from the chip/firmware; which is 64 bytes ...
+	 */
+	iqe_size = 64;
+
+	/*
 	 * Set up default Queue Set parameters ...  Start off with the
 	 * shortest interrupt holdoff timer.
 	 */
@@ -2320,7 +2328,7 @@
 		struct sge_eth_rxq *rxq = &s->ethrxq[qs];
 		struct sge_eth_txq *txq = &s->ethtxq[qs];

-		init_rspq(&rxq->rspq, 0, 0, 1024, L1_CACHE_BYTES);
+		init_rspq(&rxq->rspq, 0, 0, 1024, iqe_size);
 		rxq->fl.size = 72;
 		txq->q.size = 1024;
 	}
@@ -2329,8 +2337,7 @@
 	 * The firmware event queue is used for link state changes and
 	 * notifications of TX DMA completions.
 	 */
-	init_rspq(&s->fw_evtq, SGE_TIMER_RSTRT_CNTR, 0, 512,
-		  L1_CACHE_BYTES);
+	init_rspq(&s->fw_evtq, SGE_TIMER_RSTRT_CNTR, 0, 512, iqe_size);

 	/*
 	 * The forwarded interrupt queue is used when we're in MSI interrupt
@@ -2346,7 +2353,7 @@
 	 * any time ...
 	 */
 	init_rspq(&s->intrq, SGE_TIMER_RSTRT_CNTR, 0, MSIX_ENTRIES + 1,
-		  L1_CACHE_BYTES);
+		  iqe_size);
 }

 /*


Add assign operator from ClonotypePtr

Add assign operator from ClonotypePtr

--- Ymir/src/clonotype.h
+++ Ymir/src/clonotype.h
@@ -35,6 +35,10 @@
     #define CLONOTYPEBUILDER_VSEG_DEFAULT_RESERVE_SIZE 9
     #define CLONOTYPEBUILDER_JSEG_DEFAULT_RESERVE_SIZE 6
     #define CLONOTYPEBUILDER_DSEG_DEFAULT_RESERVE_SIZE 30
+
+
+
+    typedef unique_ptr<Clonotype> ClonotypePtr;

     /**
@@ -123,6 +127,39 @@
         }

+        Clonotype& operator=(const ClonotypePtr &other) {
+            _sequence = other->_sequence;
+            _recomb = other->_recomb;
+
+            _segments = new seg_index_t[3 + other->_segments[0] + other->_segments[1] + other->_segments[2]];
+            _segments[0] = other->_segments[0];
+            _segments[1] = other->_segments[1];
+            _segments[2] = other->_segments[2];
+            for (int i = 0; i < _segments[0] + _segments[1] + _segments[2]; ++i) {
+                _segments[i + 3] = other->_segments[i + 3];
+            }
+
+            int sum_align = 3*_segments[0] + 3*_segments[1];
+            if (_segments[2]) {
+                _n_D_alignments = new seq_len_t[_segments[2]];
+                for  (int i = 0; i < _segments[2]; ++i) {
+                    _n_D_alignments[i] = other->_n_D_alignments[i];
+                }
+                for  (int i = 0; i < _segments[2]; ++i) {
+                    sum_align += _n_D_alignments[i] * 3;
+                }
+
+            } else {
+                _n_D_alignments = nullptr;
+            }
+
+            _alignments = new seq_len_t[sum_align];
+            for (int i = 0; i < sum_align; ++i) {
+                _alignments[i] = other->_alignments[i];
+            }
+        }
+
+
         virtual ~Clonotype() {
             if (_segments) {
                 delete [] _segments;


b43: LCN-PHY: implement more PHY ops before radio init

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


wl12xx: AP-mode - prevent Tx to stale/invalid stations

Don't pollute the queues with Tx directed to invalid stations. This
can happen during recovery.

Signed-off-by: Arik Nemtsov <1a5d131848a166677cc209f94fa988cee9378c32@wizery.com>
Signed-off-by: Eliad Peller <fdf5551f20996bc0613832b4b54eb06eecaffd38@wizery.com>
Signed-off-by: Luciano Coelho <d1ef580865f8eb2e1d1c65bc406aba322cc98f3e@ti.com>

--- drivers/net/wireless/wl12xx/main.c
+++ drivers/net/wireless/wl12xx/main.c
@@ -779,7 +779,13 @@

 bool wl1271_is_active_sta(struct wl1271 *wl, u8 hlid)
 {
-	int id = hlid - WL1271_AP_STA_HLID_START;
+	int id;
+
+	/* global/broadcast "stations" are always active */
+	if (hlid < WL1271_AP_STA_HLID_START)
+		return true;
+
+	id = hlid - WL1271_AP_STA_HLID_START;
 	return test_bit(id, wl->ap_hlid_map);
 }

@@ -1493,6 +1499,13 @@

 	/* queue the packet */
 	if (wl->bss_type == BSS_TYPE_AP_BSS) {
+		if (!wl1271_is_active_sta(wl, hlid)) {
+			wl1271_debug(DEBUG_TX, "DROP skb hlid %d q %d",
+				     hlid, q);
+			dev_kfree_skb(skb);
+			goto out;
+		}
+
 		wl1271_debug(DEBUG_TX, "queue skb hlid %d q %d", hlid, q);
 		skb_queue_tail(&wl->links[hlid].tx_queue[q], skb);
 	} else {
@@ -1508,6 +1521,7 @@
 	    !test_bit(WL1271_FLAG_TX_PENDING, &wl->flags))
 		ieee80211_queue_work(wl->hw, &wl->tx_work);

+out:
 	spin_unlock_irqrestore(&wl->wl_lock, flags);
 }

@@ -3695,7 +3709,7 @@
 	}

 	wl_sta = (struct wl1271_station *)sta->drv_priv;
-	__set_bit(id, wl->ap_hlid_map);
+	set_bit(id, wl->ap_hlid_map);
 	wl_sta->hlid = WL1271_AP_STA_HLID_START + id;
 	*hlid = wl_sta->hlid;
 	memcpy(wl->links[wl_sta->hlid].addr, sta->addr, ETH_ALEN);
@@ -3709,7 +3723,7 @@
 	if (WARN_ON(!test_bit(id, wl->ap_hlid_map)))
 		return;

-	__clear_bit(id, wl->ap_hlid_map);
+	clear_bit(id, wl->ap_hlid_map);
 	memset(wl->links[hlid].addr, 0, ETH_ALEN);
 	wl->links[hlid].ba_bitmap = 0;
 	wl1271_tx_reset_link_queues(wl, hlid);


wl12xx: fix SG BT load value to reflect its new meaning

The Soft Gemini BT load ratio value has changed its meaning with FW
version 6.1.0.0.310.  It now means the passive scan compensation
percentage during A2DP EDR.  Instead of 50, we need to use 200.

Fix the SG configuration accordingly.

Signed-off-by: Luciano Coelho <d1ef580865f8eb2e1d1c65bc406aba322cc98f3e@ti.com>

--- drivers/net/wireless/wl12xx/main.c
+++ drivers/net/wireless/wl12xx/main.c
@@ -54,7 +54,7 @@
 			[CONF_SG_BT_PER_THRESHOLD]                  = 7500,
 			[CONF_SG_HV3_MAX_OVERRIDE]                  = 0,
 			[CONF_SG_BT_NFS_SAMPLE_INTERVAL]            = 400,
-			[CONF_SG_BT_LOAD_RATIO]                     = 50,
+			[CONF_SG_BT_LOAD_RATIO]                     = 200,
 			[CONF_SG_AUTO_PS_MODE]                      = 1,
 			[CONF_SG_AUTO_SCAN_PROBE_REQ]               = 170,
 			[CONF_SG_ACTIVE_SCAN_DURATION_FACTOR_HV3]   = 50,


OVSDriver: close file descriptors after forking upcall processes

We don't want upcall processes to hang on to file descriptors like OpenFlow TCP
connections, since a close() in the main process wouldn't cause the sockets/etc
to get cleaned up.

--- modules/OVSDriver/module/src/upcall.c
+++ modules/OVSDriver/module/src/upcall.c
@@ -526,6 +526,15 @@
         AIM_DIE("failed to create epoll set: %s", strerror(errno));
     }

+    /* Create a bitmap of file descriptors we want to keep */
+    int max_fds = sysconf(_SC_OPEN_MAX);
+    aim_bitmap_t *fds = aim_bitmap_alloc(NULL, max_fds);
+    AIM_BITMAP_SET(fds, STDIN_FILENO);
+    AIM_BITMAP_SET(fds, STDOUT_FILENO);
+    AIM_BITMAP_SET(fds, STDERR_FILENO);
+    AIM_BITMAP_SET(fds, thread->kflow_sock_wr);
+    AIM_BITMAP_SET(fds, thread->epfd);
+
     int i;
     for (i = 0; i < IND_OVS_MAX_PORTS; i++) {
         struct ind_ovs_port *port = ind_ovs_ports[i];
@@ -536,6 +545,16 @@
                         nl_socket_get_fd(port->notify_socket), &evt) < 0) {
                 AIM_DIE("failed to add to epoll set: %s", strerror(errno));
             }
-        }
-    }
-}
+            AIM_BITMAP_SET(fds, nl_socket_get_fd(port->notify_socket));
+        }
+    }
+
+    /* Close all other file descriptors */
+    for (i = 0; i < max_fds; i++) {
+        if (!AIM_BITMAP_GET(fds, i)) {
+            close(i);
+        }
+    }
+
+    aim_bitmap_free(fds);
+}


Fix sky-websense compilation issue

Fix sky-websense compilation issue

--- examples/6lbr-demo/apps/webserver/sky-websense.c
+++ examples/6lbr-demo/apps/webserver/sky-websense.c
@@ -40,7 +40,7 @@

 #include "contiki.h"
 #include "httpd-simple.h"
-#include "dev/sht11-sensor.h"
+#include "dev/sht11/sht11-sensor.h"
 #include "dev/light-sensor.h"
 #include "dev/leds.h"
 #include <stdio.h>


#75 remove extra qualification

#75 remove extra qualification

--- bouncer/src/repo/manipulator/repo_manipulator.h
+++ bouncer/src/repo/manipulator/repo_manipulator.h
@@ -271,7 +271,7 @@
 			* @return returns true upon success
 			*/

-			bool RepoManipulator::generateAndCommitGLTFBuffer(
+			bool generateAndCommitGLTFBuffer(
 				const std::string                             &databaseAd,
 				const repo::core::model::RepoBSON	          *cred,
 				const repo::core::model::RepoScene            *scene);


Fix fpset*() to not trap if there is a currently unmasked exception.
Unmasked exceptions (which can be fixed up using fpset*() before they
trap) are very rare, especially on amd64 since SSE exceptions trap
synchronously, but I want to merge the faster amd64 implementations of
fpset*() back to i386 without introducing the bug on i386.

The i386 implementation has always avoided the trap automatically by
changing things using load/store of the FP environment, but this is
very slow.  Most changes only affect the control word, so they can
usually be done much more efficiently, and amd64 has always done this,
but loading the control word can trap.

This version use the fast method only in the usual case where it will
not trap.  This only costs a couple of integer instructions (including
one branch which I haven't optimized carefully yet) in the usual case,
but bloats the inlines a lot.  The inlines were already a bit too large
to handle both the FPU and SSE.

--- sys/amd64/include/ieeefp.h
+++ sys/amd64/include/ieeefp.h
@@ -125,10 +125,40 @@
 #ifdef __GNUCLIKE_ASM

 #define	__fldcw(addr)	__asm __volatile("fldcw %0" : : "m" (*(addr)))
+#define	__fldenv(addr)	__asm __volatile("fldenv %0" : : "m" (*(addr)))
 #define	__fnstcw(addr)	__asm __volatile("fnstcw %0" : "=m" (*(addr)))
+#define	__fnstenv(addr)	__asm __volatile("fnstenv %0" : "=m" (*(addr)))
 #define	__fnstsw(addr)	__asm __volatile("fnstsw %0" : "=m" (*(addr)))
 #define	__ldmxcsr(addr)	__asm __volatile("ldmxcsr %0" : : "m" (*(addr)))
 #define	__stmxcsr(addr)	__asm __volatile("stmxcsr %0" : "=m" (*(addr)))
+
+/*
+ * Load the control word.  Be careful not to trap if there is a currently
+ * unmasked exception (ones that will become freshly unmasked are not a
+ * problem).  This case must be handled by a save/restore of the
+ * environment or even of the full x87 state.  Accessing the environment
+ * is very inefficient, so only do it when necessary.
+ */
+static __inline void
+__fnldcw(unsigned short _cw, unsigned short _newcw)
+{
+	struct {
+		unsigned _cw;
+		unsigned _other[6];
+	} _env;
+	unsigned short _sw;
+
+	if ((_cw & FP_MSKS_FLD) != FP_MSKS_FLD) {
+		__fnstsw(&_sw);
+		if (((_sw & ~_cw) & FP_STKY_FLD) != 0) {
+			__fnstenv(&_env);
+			_env._cw = _newcw;
+			__fldenv(&_env);
+			return;
+		}
+	}
+	__fldcw(&_newcw);
+}

 /*
  * General notes about conflicting SSE vs FP status bits.
@@ -155,13 +185,13 @@
 {
 	fp_rnd_t _p;
 	unsigned _mxcsr;
-	unsigned short _cw;
+	unsigned short _cw, _newcw;

 	__fnstcw(&_cw);
 	_p = (fp_rnd_t)((_cw & FP_RND_FLD) >> FP_RND_OFF);
-	_cw &= ~FP_RND_FLD;
-	_cw |= (_m << FP_RND_OFF) & FP_RND_FLD;
-	__fldcw(&_cw);
+	_newcw = _cw & ~FP_RND_FLD;
+	_newcw |= (_m << FP_RND_OFF) & FP_RND_FLD;
+	__fnldcw(_cw, _newcw);
 	__stmxcsr(&_mxcsr);
 	_mxcsr &= ~SSE_RND_FLD;
 	_mxcsr |= (_m << SSE_RND_OFF) & SSE_RND_FLD;
@@ -187,13 +217,13 @@
 __fpsetprec(fp_prec_t _m)
 {
 	fp_prec_t _p;
-	unsigned short _cw;
+	unsigned short _cw, _newcw;

 	__fnstcw(&_cw);
 	_p = (fp_prec_t)((_cw & FP_PRC_FLD) >> FP_PRC_OFF);
-	_cw &= ~FP_PRC_FLD;
-	_cw |= (_m << FP_PRC_OFF) & FP_PRC_FLD;
-	__fldcw(&_cw);
+	_newcw = _cw & ~FP_PRC_FLD;
+	_newcw |= (_m << FP_PRC_OFF) & FP_PRC_FLD;
+	__fnldcw(_cw, _newcw);
 	return (_p);
 }

@@ -217,13 +247,13 @@
 {
 	fp_except_t _p;
 	unsigned _mxcsr;
-	unsigned short _cw;
+	unsigned short _cw, _newcw;

 	__fnstcw(&_cw);
 	_p = (~_cw & FP_MSKS_FLD) >> FP_MSKS_OFF;
-	_cw &= ~FP_MSKS_FLD;
-	_cw |= (~_m << FP_MSKS_OFF) & FP_MSKS_FLD;
-	__fldcw(&_cw);
+	_newcw = _cw & ~FP_MSKS_FLD;
+	_newcw |= (~_m << FP_MSKS_OFF) & FP_MSKS_FLD;
+	__fnldcw(_cw, _newcw);
 	__stmxcsr(&_mxcsr);
 	/* XXX should we clear non-ieee SSE_DAZ_FLD and SSE_FZ_FLD ? */
 	_mxcsr &= ~SSE_MSKS_FLD;


Make rdf_reachable(_,_,literal(...)) fail silently instead of raising an instantiation error.

--- packages/semweb/rdf_db.c
+++ packages/semweb/rdf_db.c
@@ -6086,7 +6086,7 @@
 	}
 	is_det = PL_is_ground(obj);
 	target_term = obj;
-      } else if ( PL_is_atom(obj) )		/* obj .... subj */
+      } else if ( !PL_is_variable(obj) )	/* obj .... subj */
       {	switch(get_partial_triple(db, 0, pred, obj, 0, &a.pattern))
 	{ case 0:
 	    return directly_attached(pred, obj, subj);


Undoing the previous change.

Undoing the previous change.

git-svn-id: fbb392d5347ebc45c06187f72dfd8bab02595dbf@540514 13f79535-47bb-0310-9956-ffa450edef68

--- samples/server/echo/echo.c
+++ samples/server/echo/echo.c
@@ -84,15 +84,15 @@
 {
     axiom_node_t *echo_om_node = NULL;
     axiom_element_t* echo_om_ele = NULL;
-    /*axiom_node_t* text_om_node = NULL;
-    axiom_element_t * text_om_ele = NULL;*/
+    axiom_node_t* text_om_node = NULL;
+    axiom_element_t * text_om_ele = NULL;
     axiom_namespace_t *ns1 = NULL;

     ns1 = axiom_namespace_create(env, "http://ws.apache.org/axis2/c/samples", "ns1");

     echo_om_ele = axiom_element_create(env, NULL, "echoString", ns1, &echo_om_node);

-    /*text_om_ele = axiom_element_create(env, echo_om_node, "text", NULL, &text_om_node);*/
+    text_om_ele = axiom_element_create(env, echo_om_node, "text", NULL, &text_om_node);

     axiom_element_set_text(echo_om_ele, env, text, echo_om_node);


Generator: make sure that we have only one variable of integration.

--- src/api/libcellml/entity.h
+++ src/api/libcellml/entity.h
@@ -69,7 +69,20 @@
      */
     void *getParent() const;

+    /**
+     * @brief Returns the parent component of the CellML Entity.
+     *
+     * @return A pointer to the entities parent component if it has one,
+     * otherwise the null pointer.
+     */
     Component *getParentComponent() const;
+
+    /**
+     * @brief Returns the parent model of the CellML Entity.
+     *
+     * @return A pointer to the entities parent model if it has one,
+     * otherwise the null pointer.
+     */
     Model *getParentModel() const;

     /**


batman-adv: avoid NULL dereferences and fix if check

Gateway having bandwidth_down equal to zero are not accepted
at all and so never added to the Gateway list.
For this reason checking the bandwidth_down member in
batadv_gw_out_of_range() is useless.

This is probably a copy/paste error and this check was supposed
to be "!gw_node" only. Moreover, the way the check is written
now may also lead to a NULL dereference.

Fix this by rewriting the if-condition properly.

Introduced by 414254e342a0d58144de40c3da777521ebaeeb07
("batman-adv: tvlv - gateway download/upload bandwidth container")

Signed-off-by: Antonio Quartulli <a08f08bac39aeae6c9580ade7aa8387b5a0e7428@meshcoding.com>
Reported-by: David Binderman <b6d239d25020cc5e235b79047ed71f02d7363ad6@hotmail.com>
Signed-off-by: Marek Lindner <5760fd64db566c47bfb7ce809fea1d3e512880cf@neomailbox.ch>
Signed-off-by: David S. Miller <fe08d3c717adf2ae63592e4c9aec6e3e404d8e3e@davemloft.net>

--- net/batman-adv/gateway_client.c
+++ net/batman-adv/gateway_client.c
@@ -810,7 +810,7 @@
 		goto out;

 	gw_node = batadv_gw_node_get(bat_priv, orig_dst_node);
-	if (!gw_node->bandwidth_down == 0)
+	if (!gw_node)
 		goto out;

 	switch (atomic_read(&bat_priv->gw_mode)) {


extract https://github.com/kazuho/mruby-digest @ 67b734f () at deps/mruby-digest

--- deps/mruby-digest/src/picohash.h
+++ deps/mruby-digest/src/picohash.h
@@ -25,7 +25,7 @@
 #if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
 #define _PICOHASH_BIG_ENDIAN
 #endif
-#else               // ! defined __LITTLE_ENDIAN__
+#elif !defined(_WIN32)
 #include <endian.h> // machine/endian.h
 #if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
 #define _PICOHASH_BIG_ENDIAN
@@ -35,11 +35,12 @@
 #define PICOHASH_MD5_BLOCK_LENGTH 64
 #define PICOHASH_MD5_DIGEST_LENGTH 16

-typedef struct {
+typedef struct _picohash_md5_ctx_t {
     uint_fast32_t lo, hi;
     uint_fast32_t a, b, c, d;
     unsigned char buffer[64];
     uint_fast32_t block[PICOHASH_MD5_DIGEST_LENGTH];
+    const void *(*_body)(struct _picohash_md5_ctx_t *ctx, const void *data, size_t size);
 } _picohash_md5_ctx_t;

 static void _picohash_md5_init(_picohash_md5_ctx_t *ctx);
@@ -268,6 +269,8 @@

     ctx->lo = 0;
     ctx->hi = 0;
+
+    ctx->_body = _picohash_md5_body;
 }

 inline void _picohash_md5_update(_picohash_md5_ctx_t *ctx, const void *data, size_t size)
@@ -293,11 +296,11 @@
         memcpy(&ctx->buffer[used], data, free);
         data = (const unsigned char *)data + free;
         size -= free;
-        _picohash_md5_body(ctx, ctx->buffer, 64);
+        ctx->_body(ctx, ctx->buffer, 64);
     }

     if (size >= 64) {
-        data = _picohash_md5_body(ctx, data, size & ~(unsigned long)0x3f);
+        data = ctx->_body(ctx, data, size & ~(unsigned long)0x3f);
         size &= 0x3f;
     }

@@ -317,7 +320,7 @@

     if (free < 8) {
         memset(&ctx->buffer[used], 0, free);
-        _picohash_md5_body(ctx, ctx->buffer, 64);
+        ctx->_body(ctx, ctx->buffer, 64);
         used = 0;
         free = 64;
     }
@@ -334,7 +337,7 @@
     ctx->buffer[62] = ctx->hi >> 16;
     ctx->buffer[63] = ctx->hi >> 24;

-    _picohash_md5_body(ctx, ctx->buffer, 64);
+    ctx->_body(ctx, ctx->buffer, 64);

     digest[0] = ctx->a;
     digest[1] = ctx->a >> 8;


improve comments of metapopulation::dominates

--- opencog/learning/moses/moses/metapopulation.h
+++ opencog/learning/moses/moses/metapopulation.h
@@ -563,9 +563,13 @@
     void merge_nondominated_iter(bscored_combo_tree_set& bcs);

     /**
-     * return true if x dominates y
-     *        false if y dominates x
-     *        indeterminate otherwise
+     * x dominates y if
+     *
+     * for all i x_i >= y_i and there exists i such that x_i > y_i
+     *
+     * this function returns true if x dominates y
+     *                       false if y dominates x
+     *                       indeterminate otherwise
      */
     static inline tribool dominates(const behavioral_score& x,
                                     const behavioral_score& y)
@@ -581,7 +585,7 @@

         tribool res = indeterminate;
         for (behavioral_score::const_iterator xit = x.begin(), yit = y.begin();
-             xit != x.end();++xit, ++yit)
+             xit != x.end(); ++xit, ++yit)
         {
             if (*xit > *yit) {
                 if (!res)


wl12xx: minor fix in sched_scan_ssid_list

The user can pass broadcast SSID (ssid="") in the list of SSIDs for active scan.
In this case the loop was attempting to match SSIDs in the filter
list to this empty entry and marking them as HIDDEN (sending probe
request) by mistake

Signed-off-by: Eyal Shapira <3479a0d7b15002d26d6793122e309097153caf7e@wizery.com>
Signed-off-by: Luciano Coelho <d1ef580865f8eb2e1d1c65bc406aba322cc98f3e@ti.com>

--- drivers/net/wireless/wl12xx/scan.c
+++ drivers/net/wireless/wl12xx/scan.c
@@ -572,6 +572,9 @@
 			 * so they're used in probe requests.
 			 */
 			for (i = 0; i < req->n_ssids; i++) {
+				if (!req->ssids[i].ssid_len)
+					continue;
+
 				for (j = 0; j < cmd->n_ssids; j++)
 					if (!memcmp(req->ssids[i].ssid,
 						   cmd->ssids[j].ssid,


restart upcall processes on termination

restart upcall processes on termination

--- modules/OVSDriver/module/src/upcall.c
+++ modules/OVSDriver/module/src/upcall.c
@@ -40,6 +40,7 @@
 #include <sys/mman.h>
 #include <pwd.h>
 #include <sys/capability.h>
+#include <sys/signalfd.h>

 #define DEFAULT_NUM_UPCALL_THREADS 4
 #define MAX_UPCALL_THREADS 16
@@ -107,10 +108,12 @@
 static bool ind_ovs_upcall_seen_key(struct ind_ovs_upcall_thread *thread, struct nlattr *key);
 static void ind_ovs_upcall_request_kflow(struct ind_ovs_upcall_thread *thread, struct nlattr *key);
 static void ind_ovs_upcall_thread_init(struct ind_ovs_upcall_thread *thread, int parent_pid);
+static void ind_ovs_upcall_respawn_child(struct ind_ovs_upcall_thread *thread);

 static int ind_ovs_num_upcall_threads;
 static struct ind_ovs_upcall_thread *ind_ovs_upcall_threads[MAX_UPCALL_THREADS];
 static int nobody_uid;
+static int sigfd;

 DEBUG_COUNTER(kflow_request, "ovsdriver.upcall.kflow_request", "Kernel flow requested by upcall process");
 DEBUG_COUNTER(kflow_request_error, "ovsdriver.upcall.kflow_request_error", "Error on kernel flow request socket");
@@ -419,6 +422,50 @@
     ind_ovs_kflow_add(key);
 }

+static void
+signalfd_sock_ready(int fd, void *cookie,
+                    int ready_ready, int write_ready, int error_seen)
+{
+    struct signalfd_siginfo siginfo;
+
+    ssize_t nbytes = read(sigfd, &siginfo, sizeof(siginfo));
+    if (nbytes < 0) {
+        AIM_LOG_ERROR("Error on signalfd socket: %s", strerror(errno));
+        return;
+    }
+
+    AIM_ASSERT(nbytes == sizeof(siginfo));
+
+    if (siginfo.ssi_signo != SIGCHLD) {
+        AIM_LOG_ERROR("Received unhandled signal");
+        return;
+    }
+
+    /*
+     * Multiple children terminating before we read a SIGCHLD with signalfd()
+     * will be compressed into a single SIGCHLD.
+     * So we need to check which upcall children have been terminated.
+     */
+    while (1) {
+        int status;
+        pid_t pid = waitpid(-1, &status, WNOHANG);
+        if (pid <= 0) {
+            break;
+        }
+
+        /* Respawn upcall thread with child 'pid' */
+        int i;
+        for (i = 0; i < ind_ovs_num_upcall_threads; i++) {
+            struct ind_ovs_upcall_thread *thread = ind_ovs_upcall_threads[i];
+            if (thread->pid == pid) {
+                AIM_LOG_VERBOSE("Upcall process %d terminated, Respawning", i);
+                ind_ovs_upcall_respawn_child(thread);
+                break;
+            }
+        }
+    }
+}
+
 void
 ind_ovs_upcall_init(void)
 {
@@ -476,6 +523,32 @@
     } else {
         AIM_DIE("no user named \"nobody\" found");
     }
+
+    /* build the list of signals that we're interested in (just SIGCHLD) */
+    sigset_t mask;
+    sigemptyset(&mask);
+    sigaddset(&mask, SIGCHLD);
+
+    /*
+     * block SIGCHLD from being handled in the normal way
+     * otherwise, the signalfd does not work
+     */
+    if (sigprocmask(SIG_BLOCK, &mask, NULL) < 0) {
+        AIM_DIE("sigprocmask failed to block SIGCHLD");
+    }
+
+    /*
+     * create the file descriptor that will be readable when
+     * SIGCHLD happens, i.e. when a child upcall process terminates
+     */
+    sigfd = signalfd(-1, &mask, SFD_NONBLOCK);
+    if (sigfd < 0) {
+        AIM_DIE("Failed to create signalfd: %s", strerror(errno));
+    }
+
+    if (ind_soc_socket_register(sigfd, signalfd_sock_ready, NULL) < 0) {
+        AIM_DIE("Failed to register signalfd socket with SocketManager");
+    }
 }

 void
@@ -487,8 +560,10 @@
 void
 ind_ovs_upcall_finish(void)
 {
+    ind_soc_socket_unregister(sigfd);
+    close(sigfd);
+
     int i, j;
-
     for (i = 0; i < ind_ovs_num_upcall_threads; i++) {
         struct ind_ovs_upcall_thread *thread = ind_ovs_upcall_threads[i];
         close(thread->epfd);
@@ -506,6 +581,22 @@
     }
 }

+static void
+ind_ovs_upcall_respawn_child(struct ind_ovs_upcall_thread *thread)
+{
+    int parent_pid = getpid();
+    int child_pid = fork();
+    if (child_pid < 0) {
+        AIM_DIE("Failed to spawn upcall process: %s", strerror(errno));
+    } else if (child_pid == 0) {
+        ind_ovs_upcall_thread_init(thread, parent_pid);
+        ind_ovs_upcall_thread_main(thread);
+        exit(0);
+    }
+
+    thread->pid = child_pid;
+}
+
 void
 ind_ovs_upcall_respawn(void)
 {
@@ -519,25 +610,14 @@

         if (thread->pid != 0) {
             AIM_LOG_VERBOSE("Killing upcall process %d pid %d", i, thread->pid);
-            kill(thread->pid, SIGKILL);
-            waitpid(thread->pid, NULL, 0);
+            int pid = thread->pid;
             thread->pid = 0;
+            kill(pid, SIGKILL);
+            waitpid(pid, NULL, 0);
         }

         AIM_LOG_VERBOSE("Spawning upcall process %d", i);
-
-        int parent_pid = getpid();
-        int child_pid = fork();
-        if (child_pid < 0) {
-            AIM_DIE("Failed to spawn upcall process: %s", strerror(errno));
-        } else if (child_pid == 0) {
-            ind_ovs_upcall_thread_init(thread, parent_pid);
-            ind_ovs_upcall_thread_main(thread);
-            AIM_LOG_INFO("Upcall process %d exiting", i);
-            exit(0);
-        }
-
-        thread->pid = child_pid;
+        ind_ovs_upcall_respawn_child(thread);
     }

     uint64_t elapsed = monotonic_us() - start_time;


iox-#252 added waitset doxygen docu

iox-#252 added waitset doxygen docu

Signed-off-by: Christian Eltzschig <5fe47766f2ae0978f8c0e6338f33674858b5ab51@de.bosch.com>

--- iceoryx_binding_c/include/iceoryx_binding_c/wait_set.h
+++ iceoryx_binding_c/include/iceoryx_binding_c/wait_set.h
@@ -24,21 +24,57 @@
 /// @brief wait set handle
 typedef struct WaitSet* iox_wait_set_t;

+/// @brief initialize wait set handle
+/// @param[in] self pointer to preallocated memory of size = sizeof(iox_wait_set_storage_t)
+/// @return handle to wait set
 iox_wait_set_t iox_wait_set_init(iox_wait_set_storage_t* self);
+
+/// @brief deinitialize wait set handle
+/// @param[in] self the handle which should be deinitialized
 void iox_wait_set_deinit(iox_wait_set_t const self);

+/// @brief Attach a condition to your wait set. If you would like to destroy the condition
+///         you have to detach it first from the wait set.
+/// @param[in] self handle to the wait set
+/// @param[in] condition the condition you would like to attach
+/// @return if the attachment was successful it returns WaitSetResult_SUCCESS, otherwise
+///          an enum which describes the error
 ENUM iox_WaitSetResult iox_wait_set_attach_condition(iox_wait_set_t const self, iox_cond_t const condition);

+/// @brief detaches a condition.
+/// @param[in] self handle to the wait set
+/// @param[in] condition the condition you would like to detach
+/// @return true if the condition could be detached, otherwise false for instance when the
+///         condition was not attached before
 bool iox_wait_set_detach_condition(iox_wait_set_t const self, iox_cond_t const condition);

+/// @brief detaches all conditions
+/// @param[in] self handle to the wait set
 void iox_wait_set_detach_all_conditions(iox_wait_set_t const self);

+/// @brief waits until a condition was triggered or the timeout was reached
+/// @param[in] self handle to the wait set
+/// @param[in] timeout duration how long this method should wait
+/// @param[in] conditionArray preallocated memory to an array of iox_cond_t in which
+///             the conditions which were triggered can be written to
+/// @param[in] conditionArrayCapacity the capacity of the preallocated conditionArray
+/// @param[in] missedElements if the conditionArray has insufficient size the number of missed elements
+///             which could not be written into the array are stored here
+/// @return number of elements which were written into the conditionArray
 uint64_t iox_wait_set_timed_wait(iox_wait_set_t const self,
                                  struct timespec timeout,
                                  iox_cond_t* const conditionArray,
                                  const uint64_t conditionArrayCapacity,
                                  uint64_t* missedElements);

+/// @brief waits until a condition was triggered
+/// @param[in] self handle to the wait set
+/// @param[in] conditionArray preallocated memory to an array of iox_cond_t in which
+///             the conditions which were triggered can be written to
+/// @param[in] conditionArrayCapacity the capacity of the preallocated conditionArray
+/// @param[in] missedElements if the conditionArray has insufficient size the number of missed elements
+///             which could not be written into the array are stored here
+/// @return number of elements which were written into the conditionArray
 uint64_t iox_wait_set_wait(iox_wait_set_t const self,
                            iox_cond_t* const conditionArray,
                            const uint64_t conditionArrayCapacity,


o Modify generic specfs device open access control checks to use
  securelevel_ge() instead of direct securelevel variable checks.

Obtained from:	TrustedBSD Project

--- sys/fs/specfs/spec_vnops.c
+++ sys/fs/specfs/spec_vnops.c
@@ -176,15 +176,19 @@
 		 * When running in secure mode, do not allow opens
 		 * for writing if the device is mounted
 		 */
-		if (securelevel >= 1 && vfs_mountedon(vp))
-			return (EPERM);
+		if (vfs_mountedon(vp)) {
+			error = securelevel_ge(td->td_proc->p_ucred, 1);
+			if (error)
+				return (error);
+		}

 		/*
 		 * When running in very secure mode, do not allow
 		 * opens for writing of any devices.
 		 */
-		if (securelevel >= 2)
-			return (EPERM);
+		error = securelevel_ge(td->td_proc->p_ucred, 2);
+		if (error)
+			return (error);
 	}

 	/* XXX: Special casing of ttys for deadfs.  Probably redundant */


ipvs: create ip_vs_defrag_user

ipvs: create ip_vs_defrag_user

 	Create new function ip_vs_defrag_user to return correct
IP_DEFRAG_xxx user depending on the hooknum. It will be needed
when we add handlers in LOCAL_OUT.

Signed-off-by: Julian Anastasov <84572ef2253ef81e2d8cd8c65849f4d9a3881f47@ssi.bg>
Signed-off-by: Simon Horman <a105fd58f578dea0be108941d4c59d15396e1855@verge.net.au>

--- net/netfilter/ipvs/ip_vs_core.c
+++ net/netfilter/ipvs/ip_vs_core.c
@@ -543,6 +543,15 @@
 	return csum_fold(skb_checksum(skb, offset, skb->len - offset, 0));
 }

+static inline enum ip_defrag_users ip_vs_defrag_user(unsigned int hooknum)
+{
+	if (NF_INET_LOCAL_IN == hooknum)
+		return IP_DEFRAG_VS_IN;
+	if (NF_INET_FORWARD == hooknum)
+		return IP_DEFRAG_VS_FWD;
+	return IP_DEFRAG_VS_OUT;
+}
+
 static inline int ip_vs_gather_frags(struct sk_buff *skb, u_int32_t user)
 {
 	int err = ip_defrag(skb, user);
@@ -714,7 +723,8 @@
  *	Find any that might be relevant, check against existing connections.
  *	Currently handles error types - unreachable, quench, ttl exceeded.
  */
-static int ip_vs_out_icmp(struct sk_buff *skb, int *related)
+static int ip_vs_out_icmp(struct sk_buff *skb, int *related,
+			  unsigned int hooknum)
 {
 	struct iphdr *iph;
 	struct icmphdr	_icmph, *ic;
@@ -729,7 +739,7 @@

 	/* reassemble IP fragments */
 	if (ip_hdr(skb)->frag_off & htons(IP_MF | IP_OFFSET)) {
-		if (ip_vs_gather_frags(skb, IP_DEFRAG_VS_OUT))
+		if (ip_vs_gather_frags(skb, ip_vs_defrag_user(hooknum)))
 			return NF_STOLEN;
 	}

@@ -788,7 +798,8 @@
 }

 #ifdef CONFIG_IP_VS_IPV6
-static int ip_vs_out_icmp_v6(struct sk_buff *skb, int *related)
+static int ip_vs_out_icmp_v6(struct sk_buff *skb, int *related,
+			     unsigned int hooknum)
 {
 	struct ipv6hdr *iph;
 	struct icmp6hdr	_icmph, *ic;
@@ -804,7 +815,7 @@

 	/* reassemble IP fragments */
 	if (ipv6_hdr(skb)->nexthdr == IPPROTO_FRAGMENT) {
-		if (ip_vs_gather_frags_v6(skb, IP_DEFRAG_VS_OUT))
+		if (ip_vs_gather_frags_v6(skb, ip_vs_defrag_user(hooknum)))
 			return NF_STOLEN;
 	}

@@ -986,7 +997,9 @@
 #ifdef CONFIG_IP_VS_IPV6
 	if (af == AF_INET6) {
 		if (unlikely(iph.protocol == IPPROTO_ICMPV6)) {
-			int related, verdict = ip_vs_out_icmp_v6(skb, &related);
+			int related;
+			int verdict = ip_vs_out_icmp_v6(skb, &related,
+							hooknum);

 			if (related) {
 				if (sysctl_ip_vs_snat_reroute &&
@@ -1000,7 +1013,8 @@
 	} else
 #endif
 		if (unlikely(iph.protocol == IPPROTO_ICMP)) {
-			int related, verdict = ip_vs_out_icmp(skb, &related);
+			int related;
+			int verdict = ip_vs_out_icmp(skb, &related, hooknum);

 			if (related) {
 				if (sysctl_ip_vs_snat_reroute &&
@@ -1019,19 +1033,19 @@
 	/* reassemble IP fragments */
 #ifdef CONFIG_IP_VS_IPV6
 	if (af == AF_INET6) {
-		if (unlikely(iph.protocol == IPPROTO_ICMPV6)) {
-			int related, verdict = ip_vs_out_icmp_v6(skb, &related);
-
-			if (related)
-				return verdict;
-
-			ip_vs_fill_iphdr(af, skb_network_header(skb), &iph);
+		if (ipv6_hdr(skb)->nexthdr == IPPROTO_FRAGMENT) {
+			if (ip_vs_gather_frags_v6(skb,
+						  ip_vs_defrag_user(hooknum)))
+				return NF_STOLEN;
 		}
+
+		ip_vs_fill_iphdr(af, skb_network_header(skb), &iph);
 	} else
 #endif
 		if (unlikely(ip_hdr(skb)->frag_off & htons(IP_MF|IP_OFFSET) &&
 			     !pp->dont_defrag)) {
-			if (ip_vs_gather_frags(skb, IP_DEFRAG_VS_OUT))
+			if (ip_vs_gather_frags(skb,
+					       ip_vs_defrag_user(hooknum)))
 				return NF_STOLEN;

 			ip_vs_fill_iphdr(af, skb_network_header(skb), &iph);
@@ -1114,8 +1128,7 @@

 	/* reassemble IP fragments */
 	if (ip_hdr(skb)->frag_off & htons(IP_MF | IP_OFFSET)) {
-		if (ip_vs_gather_frags(skb, hooknum == NF_INET_LOCAL_IN ?
-					    IP_DEFRAG_VS_IN : IP_DEFRAG_VS_FWD))
+		if (ip_vs_gather_frags(skb, ip_vs_defrag_user(hooknum)))
 			return NF_STOLEN;
 	}

@@ -1226,9 +1239,7 @@

 	/* reassemble IP fragments */
 	if (ipv6_hdr(skb)->nexthdr == IPPROTO_FRAGMENT) {
-		if (ip_vs_gather_frags_v6(skb, hooknum == NF_INET_LOCAL_IN ?
-					       IP_DEFRAG_VS_IN :
-					       IP_DEFRAG_VS_FWD))
+		if (ip_vs_gather_frags_v6(skb, ip_vs_defrag_user(hooknum)))
 			return NF_STOLEN;
 	}

@@ -1349,7 +1360,8 @@
 #ifdef CONFIG_IP_VS_IPV6
 	if (af == AF_INET6) {
 		if (unlikely(iph.protocol == IPPROTO_ICMPV6)) {
-			int related, verdict = ip_vs_in_icmp_v6(skb, &related, hooknum);
+			int related;
+			int verdict = ip_vs_in_icmp_v6(skb, &related, hooknum);

 			if (related)
 				return verdict;
@@ -1358,7 +1370,8 @@
 	} else
 #endif
 		if (unlikely(iph.protocol == IPPROTO_ICMP)) {
-			int related, verdict = ip_vs_in_icmp(skb, &related, hooknum);
+			int related;
+			int verdict = ip_vs_in_icmp(skb, &related, hooknum);

 			if (related)
 				return verdict;


pinctrl: rockchip: generalize perpin driver-strength setting

The upcoming support for the RK3368 ARM64 SoC also supports perpin
drive strength settings (at different register positions), so generalize
the register and offset calculation to easily support this one too.

Signed-off-by: Heiko Stuebner <9ab5f52a1ca0bcf4f70d6d9008e02f6134b5b8f2@sntech.de>
Signed-off-by: Linus Walleij <9cd9d802d23c0ed5e224beabf4ae4a5c478746ef@linaro.org>

--- drivers/pinctrl/pinctrl-rockchip.c
+++ drivers/pinctrl/pinctrl-rockchip.c
@@ -163,6 +163,9 @@
 	void	(*pull_calc_reg)(struct rockchip_pin_bank *bank,
 				    int pin_num, struct regmap **regmap,
 				    int *reg, u8 *bit);
+	void	(*drv_calc_reg)(struct rockchip_pin_bank *bank,
+				    int pin_num, struct regmap **regmap,
+				    int *reg, u8 *bit);
 };

 struct rockchip_pin_config {
@@ -581,7 +584,6 @@
 #define RK3288_DRV_BITS_PER_PIN		2
 #define RK3288_DRV_PINS_PER_REG		8
 #define RK3288_DRV_BANK_STRIDE		16
-static int rk3288_drv_list[] = { 2, 4, 8, 12 };

 static void rk3288_calc_drv_reg_and_bit(struct rockchip_pin_bank *bank,
 				    int pin_num, struct regmap **regmap,
@@ -611,14 +613,19 @@
 	}
 }

-static int rk3288_get_drive(struct rockchip_pin_bank *bank, int pin_num)
-{
+static int rockchip_perpin_drv_list[] = { 2, 4, 8, 12 };
+
+static int rockchip_get_drive_perpin(struct rockchip_pin_bank *bank,
+				     int pin_num)
+{
+	struct rockchip_pinctrl *info = bank->drvdata;
+	struct rockchip_pin_ctrl *ctrl = info->ctrl;
 	struct regmap *regmap;
 	int reg, ret;
 	u32 data;
 	u8 bit;

-	rk3288_calc_drv_reg_and_bit(bank, pin_num, &regmap, &reg, &bit);
+	ctrl->drv_calc_reg(bank, pin_num, &regmap, &reg, &bit);

 	ret = regmap_read(regmap, reg, &data);
 	if (ret)
@@ -627,24 +634,25 @@
 	data >>= bit;
 	data &= (1 << RK3288_DRV_BITS_PER_PIN) - 1;

-	return rk3288_drv_list[data];
-}
-
-static int rk3288_set_drive(struct rockchip_pin_bank *bank, int pin_num,
-			    int strength)
+	return rockchip_perpin_drv_list[data];
+}
+
+static int rockchip_set_drive_perpin(struct rockchip_pin_bank *bank,
+				     int pin_num, int strength)
 {
 	struct rockchip_pinctrl *info = bank->drvdata;
+	struct rockchip_pin_ctrl *ctrl = info->ctrl;
 	struct regmap *regmap;
 	unsigned long flags;
 	int reg, ret, i;
 	u32 data, rmask;
 	u8 bit;

-	rk3288_calc_drv_reg_and_bit(bank, pin_num, &regmap, &reg, &bit);
+	ctrl->drv_calc_reg(bank, pin_num, &regmap, &reg, &bit);

 	ret = -EINVAL;
-	for (i = 0; i < ARRAY_SIZE(rk3288_drv_list); i++) {
-		if (rk3288_drv_list[i] == strength) {
+	for (i = 0; i < ARRAY_SIZE(rockchip_perpin_drv_list); i++) {
+		if (rockchip_perpin_drv_list[i] == strength) {
 			ret = i;
 			break;
 		}
@@ -983,10 +991,11 @@
 			break;
 		case PIN_CONFIG_DRIVE_STRENGTH:
 			/* rk3288 is the first with per-pin drive-strength */
-			if (info->ctrl->type != RK3288)
+			if (!info->ctrl->drv_calc_reg)
 				return -ENOTSUPP;

-			rc = rk3288_set_drive(bank, pin - bank->pin_base, arg);
+			rc = rockchip_set_drive_perpin(bank,
+						pin - bank->pin_base, arg);
 			if (rc < 0)
 				return rc;
 			break;
@@ -1041,10 +1050,10 @@
 		break;
 	case PIN_CONFIG_DRIVE_STRENGTH:
 		/* rk3288 is the first with per-pin drive-strength */
-		if (info->ctrl->type != RK3288)
+		if (!info->ctrl->drv_calc_reg)
 			return -ENOTSUPP;

-		rc = rk3288_get_drive(bank, pin - bank->pin_base);
+		rc = rockchip_get_drive_perpin(bank, pin - bank->pin_base);
 		if (rc < 0)
 			return rc;

@@ -2056,6 +2065,7 @@
 		.grf_mux_offset		= 0x0,
 		.pmu_mux_offset		= 0x84,
 		.pull_calc_reg		= rk3288_calc_pull_reg_and_bit,
+		.drv_calc_reg		= rk3288_calc_drv_reg_and_bit,
 };

 static const struct of_device_id rockchip_pinctrl_dt_match[] = {


Don't use 'bp' after its destruction!

Don't use 'bp' after its destruction!

--- sys/geom/mirror/g_mirror.c
+++ sys/geom/mirror/g_mirror.c
@@ -984,10 +984,9 @@
 			return;
 		}
 		G_MIRROR_LOGREQ(3, bp, "Synchronization request finished.");
+		disk->d_sync.ds_offset_done = bp->bio_offset + bp->bio_length;
 		g_destroy_bio(bp);
-		disk->d_sync.ds_offset_done = bp->bio_offset + bp->bio_length;
-		if (bp->bio_offset + bp->bio_length ==
-		    sc->sc_provider->mediasize) {
+		if (disk->d_sync.ds_offset_done == sc->sc_provider->mediasize) {
 			/*
 			 * Disk up-to-date, activate it.
 			 */


sony-laptop: potential null dereference

sony-laptop: potential null dereference

In the original code, if "device_enum" was NULL then it would
dereference it when it printed the error message.

Signed-off-by: Dan Carpenter <72501f147b2753e6660fdce744d9ac3084854f5e@gmail.com>
Signed-off-by: Matthew Garrett <4cf8d479716eba9bc68e0146d95320fcb138b96b@redhat.com>

--- drivers/platform/x86/sony-laptop.c
+++ drivers/platform/x86/sony-laptop.c
@@ -1311,7 +1311,11 @@
 	}

 	device_enum = (union acpi_object *) buffer.pointer;
-	if (!device_enum || device_enum->type != ACPI_TYPE_BUFFER) {
+	if (!device_enum) {
+		pr_err(DRV_PFX "No SN06 return object.");
+		goto out_no_enum;
+	}
+	if (device_enum->type != ACPI_TYPE_BUFFER) {
 		pr_err(DRV_PFX "Invalid SN06 return object 0x%.2x\n",
 				device_enum->type);
 		goto out_no_enum;


Remove unused field.

Remove unused field.

--- sys/geom/mirror/g_mirror.h
+++ sys/geom/mirror/g_mirror.h
@@ -116,7 +116,6 @@
 	uint32_t	 d_id;		/* Disk ID. */
 	struct g_consumer *d_consumer;	/* Consumer. */
 	struct g_mirror_softc	*d_softc; /* Back-pointer to softc. */
-	struct proc	*d_worker;
 	int		 d_state;	/* Disk state. */
 	u_int		 d_priority;	/* Disk priority. */
 	struct bintime	 d_delay;	/* Disk delay. */


sony-laptop: input initialization should be done before SNC

SNC needs input devices so better have those ready before starting
handle events.

Signed-off-by: Mattia Dongili <564ea3fba55f6e029e83434fb6b3f3b9c7ed334e@linux.it>
Signed-off-by: Matthew Garrett <4cf8d479716eba9bc68e0146d95320fcb138b96b@redhat.com>

--- drivers/platform/x86/sony-laptop.c
+++ drivers/platform/x86/sony-laptop.c
@@ -2642,6 +2642,12 @@
 		}
 	}

+	result = sony_laptop_setup_input(device);
+	if (result) {
+		pr_err("Unable to create input devices\n");
+		goto outplatform;
+	}
+
 	if (ACPI_SUCCESS(acpi_get_handle(sony_nc_acpi_handle, "ECON",
 					 &handle))) {
 		int arg = 1;
@@ -2659,12 +2665,6 @@
 	}

 	/* setup input devices and helper fifo */
-	result = sony_laptop_setup_input(device);
-	if (result) {
-		pr_err("Unable to create input devices\n");
-		goto outsnc;
-	}
-
 	if (acpi_video_backlight_support()) {
 		pr_info("brightness ignored, must be controlled by ACPI video driver\n");
 	} else {
@@ -2712,22 +2712,21 @@

 	return 0;

-      out_sysfs:
+out_sysfs:
 	for (item = sony_nc_values; item->name; ++item) {
 		device_remove_file(&sony_pf_device->dev, &item->devattr);
 	}
 	sony_nc_backlight_cleanup();
-
-	sony_laptop_remove_input();
-
-      outsnc:
 	sony_nc_function_cleanup(sony_pf_device);
 	sony_nc_handles_cleanup(sony_pf_device);

-      outpresent:
+outplatform:
+	sony_laptop_remove_input();
+
+outpresent:
 	sony_pf_remove();

-      outwalk:
+outwalk:
 	sony_nc_rfkill_cleanup();
 	return result;
 }


Remove unused includes.

Remove unused includes.

--- sys/i4b/driver/i4b_isppp.c
+++ sys/i4b/driver/i4b_isppp.c
@@ -64,13 +64,6 @@

 #include <net/if.h>
 #include <net/if_types.h>
-
-#include <netinet/in.h>
-#include <netinet/in_systm.h>
-#include <netinet/ip.h>
-
-#include <net/slcompress.h>
-
 #include <net/if_sppp.h>


drivers: regulator: pmic: remove unneeded NULL check

Remove unneeded NULL check in pmic init function. Not required as
device_is_ready() will handle NULL device structs.

Signed-off-by: Daniel DeGrasse <002dd1d4ac44ebb71088aae93501e62b784ed821@nxp.com>

--- drivers/regulator/regulator_pmic.c
+++ drivers/regulator/regulator_pmic.c
@@ -301,7 +301,7 @@
 	/* Do the same cast for current limit ranges */
 	data->current_levels = (struct current_range *)config->current_array;
 	/* Check to verify we have a valid I2C device */
-	if (config->i2c_dev == NULL || !device_is_ready(config->i2c_dev)) {
+	if (!device_is_ready(config->i2c_dev)) {
 		return -ENODEV;
 	}
 	return 0;


Fix N32 compilation again for XLP.

Fix N32 compilation again for XLP.

Disable DDB/KDB related options for N32, and add back a cast that was
lost during the last set of updates.

Reported by:	gonzo, bz

--- sys/mips/nlm/xlp_machdep.c
+++ sys/mips/nlm/xlp_machdep.c
@@ -278,7 +278,7 @@
 	phandle_t chosen;
 	ihandle_t mask;

-	dtbp = (void *)arg;
+	dtbp = (void *)(intptr_t)arg;
 #if defined(FDT_DTB_STATIC)
 	/*
 	 * In case the device tree blob was not passed as argument try


libfcoe: Fix meaningless log statement

libfcoe: Fix meaningless log statement

ctlr_dev was initialized to NULL, and never re-assigned. This
caused the log statement to always report failure. This patch
removes the unused variable and fixes the log statement to always
report 'success', as that is what should be logged if the code
reaches this point.

Signed-off-by: Robert Love <ae32029cc3b561e3768d1db8669e99f5bdf25e4b@intel.com>
Tested-by: Jack Morgan <fd24bf0a0b9dc96c8b1c20333913148c0ca5492f@intel.com>
Acked-by: Neil Horman <3316dc2d77df57653443c0391a5296176d6ca9c3@tuxdriver.com>

--- drivers/scsi/fcoe/fcoe_transport.c
+++ drivers/scsi/fcoe/fcoe_transport.c
@@ -707,7 +707,6 @@
 {
 	struct net_device *netdev = NULL;
 	struct fcoe_transport *ft = NULL;
-	struct fcoe_ctlr_device *ctlr_dev = NULL;
 	int rc = 0;
 	int err;

@@ -754,9 +753,8 @@
 		goto out_putdev;
 	}

-	LIBFCOE_TRANSPORT_DBG("transport %s %s to create fcoe on %s.\n",
-			      ft->name, (ctlr_dev) ? "succeeded" : "failed",
-			      netdev->name);
+	LIBFCOE_TRANSPORT_DBG("transport %s succeeded to create fcoe on %s.\n",
+			      ft->name, netdev->name);

 out_putdev:
 	dev_put(netdev);


Unbreak IPv6 after consolidation of TCP options insertion.

Submitted by:	tegge

--- sys/netinet/tcp_syncache.c
+++ sys/netinet/tcp_syncache.c
@@ -1227,16 +1227,15 @@
 			ip6->ip6_plen = htons(ntohs(ip6->ip6_plen) + optlen);
 		else
 #endif
-		{
 			ip->ip_len += optlen;
-		}
 	} else
 		optlen = 0;

 #ifdef INET6
 	if (sc->sc_inc.inc_isipv6) {
 		th->th_sum = 0;
-		th->th_sum = in6_cksum(m, IPPROTO_TCP, hlen, tlen - hlen);
+		th->th_sum = in6_cksum(m, IPPROTO_TCP, hlen,
+				       tlen + optlen - hlen);
 		ip6->ip6_hlim = in6_selecthlim(NULL, NULL);
 		error = ip6_output(m, NULL, NULL, 0, NULL, NULL, NULL);
 	} else


[SCSI] libsas: fix bug for vacant phy

[SCSI] libsas: fix bug for vacant phy

This patch fix bug reported by Chuck. And this new version incorporate comments
from Hannes. Please consider to include it into mainline.

Signed-off-by: Jack Wang <b8206e8949faccb6bda319c49287e0957f79d731@usish.com>
Signed-off-by: Lindar Liu <c8f8581f8215180488b97867082e2ccae68c43de@usish.com>
Tested-by: Chuck Tuffli <99574605b19626031f9345fb0c3452cb17d4f79b@pmc-sierra.com>
Signed-off-by: James Bottomley <407b36959ca09543ccda8f8e06721c791bc53435@suse.de>

--- drivers/scsi/libsas/sas_expander.c
+++ drivers/scsi/libsas/sas_expander.c
@@ -175,10 +175,10 @@
 	switch (resp->result) {
 	case SMP_RESP_PHY_VACANT:
 		phy->phy_state = PHY_VACANT;
-		return;
+		break;
 	default:
 		phy->phy_state = PHY_NOT_PRESENT;
-		return;
+		break;
 	case SMP_RESP_FUNC_ACC:
 		phy->phy_state = PHY_EMPTY; /* do not know yet */
 		break;
@@ -209,7 +209,10 @@
 	phy->phy->negotiated_linkrate = phy->linkrate;

 	if (!rediscover)
-		sas_phy_add(phy->phy);
+		if (sas_phy_add(phy->phy)) {
+			sas_phy_free(phy->phy);
+			return;
+		}

 	SAS_DPRINTK("ex %016llx phy%02d:%c attached: %016llx\n",
 		    SAS_ADDR(dev->sas_addr), phy->phy_id,


staging: dgnc: remove initialization of global

globals variable will be initialied to 0 and the global pointers will be
to NULL. No need to initialize them separately.

Signed-off-by: Sudip Mukherjee <8ebcb270388efeefbc3b674e2d51f150dd6e6b25@vectorindia.org>
Signed-off-by: Greg Kroah-Hartman <4645f7897fd33786a2ee1264d590b3c400559d85@linuxfoundation.org>

--- drivers/staging/dgnc/dgnc_driver.c
+++ drivers/staging/dgnc/dgnc_driver.c
@@ -708,13 +708,6 @@
  */
 static void dgnc_init_globals(void)
 {
-	int i = 0;
-
-	dgnc_NumBoards		= 0;
-
-	for (i = 0; i < MAXBOARDS; i++)
-		dgnc_Board[i] = NULL;
-
 	init_timer(&dgnc_poll_timer);
 }


OMAPDRM: Remove manager->device references

With the introduction of output entities, managers will now connect to outputs.
Use the helper op for managers named get_device. This will abstract away the
information on how to get the device from an overlay manager.

Using the helper function will reduce the number of pointer dereferences a user
of OMAPDSS needs to do and reduce risk of a NULL dereference.

Signed-off-by: Archit Taneja <49f60fff7e48ce8acf4d32f930e8060f85030a2d@ti.com>

--- drivers/staging/omapdrm/omap_drv.c
+++ drivers/staging/omapdrm/omap_drv.c
@@ -106,7 +106,8 @@
 	for (i = 0; i < omap_dss_get_num_overlays(); i++) {
 		struct omap_overlay *ovl = omap_dss_get_overlay(i);
 		struct omap_overlay_manager *mgr = ovl->manager;
-		struct omap_dss_device *dssdev = mgr ? mgr->device : NULL;
+		struct omap_dss_device *dssdev = mgr ?
+					mgr->get_device(mgr) : NULL;
 		if (dssdev) {
 			DBG("%d: %s -> %s -> %s", i, ovl->name, mgr->name,
 						dssdev->name);
@@ -185,7 +186,7 @@
 	for (j = 0; j < priv->num_encoders; j++) {
 		struct omap_overlay_manager *mgr =
 			omap_encoder_get_manager(priv->encoders[j]);
-		if (mgr->device == dssdev) {
+		if (mgr->get_device(mgr) == dssdev) {
 			drm_mode_connector_attach_encoder(connector,
 					priv->encoders[j]);
 		}


staging: r8712u: Fix memory leak in firmware loading

The error path leaks the firmware struct.

Signed-off-by: Larry Finger <ed0f1d78b8c21b2970494a178da4bdfa8beba2a7@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <4645f7897fd33786a2ee1264d590b3c400559d85@suse.de>

--- drivers/staging/rtl8712/hal_init.c
+++ drivers/staging/rtl8712/hal_init.c
@@ -128,12 +128,13 @@
 	u8 *ptmpchar = NULL, *ppayload, *ptr;
 	struct tx_desc *ptx_desc;
 	u32 txdscp_sz = sizeof(struct tx_desc);
+	u8 ret = _FAIL;

 	ulfilelength = rtl871x_open_fw(padapter, &phfwfile_hdl, &pmappedfw);
 	if (pmappedfw && (ulfilelength > 0)) {
 		update_fwhdr(&fwhdr, pmappedfw);
 		if (chk_fwhdr(&fwhdr, ulfilelength) == _FAIL)
-			goto exit_fail;
+			goto firmware_rel;
 		fill_fwpriv(padapter, &fwhdr.fwpriv);
 		/* firmware check ok */
 		maxlen = (fwhdr.img_IMEM_size > fwhdr.img_SRAM_size) ?
@@ -141,7 +142,7 @@
 		maxlen += txdscp_sz;
 		ptmpchar = _malloc(maxlen + FWBUFF_ALIGN_SZ);
 		if (ptmpchar == NULL)
-			return _FAIL;
+			goto firmware_rel;

 		ptx_desc = (struct tx_desc *)(ptmpchar + FWBUFF_ALIGN_SZ -
 			    ((addr_t)(ptmpchar) & (FWBUFF_ALIGN_SZ - 1)));
@@ -273,11 +274,13 @@
 			goto exit_fail;
 	} else
 		goto exit_fail;
-	return _SUCCESS;
+	ret = _SUCCESS;

 exit_fail:
 	kfree(ptmpchar);
-	return _FAIL;
+firmware_rel:
+	release_firmware((struct firmware *)phfwfile_hdl);
+	return ret;
 }

 uint rtl8712_hal_init(struct _adapter *padapter)


tls: handle PEM files without an ending newline (rh #507315)

--- properties/auth-helpers.c
+++ properties/auth-helpers.c
@@ -308,7 +308,7 @@
 	if (len < taglen)
 		return NULL;

-	for (i = 0; i < len - taglen; i++) {
+	for (i = 0; i < len - taglen + 1; i++) {
 		if (memcmp (buf + i, tag, taglen) == 0)
 			return buf + i;
 	}


Staging: wl_cs.c: fixed space style issues in wl_cs.c

This is a patch to the wl_cs.c file that fixes the space
style issues found by the checkpatch.pl tool.

Signed-off-by: Prashant P. Shah <80f978b5ac27fb318171799f0fb6a277863f2bf5@gmail.com>
Signed-off-by: Greg Kroah-Hartman <4645f7897fd33786a2ee1264d590b3c400559d85@suse.de>

--- drivers/staging/wlags49_h2/wl_cs.c
+++ drivers/staging/wlags49_h2/wl_cs.c
@@ -137,12 +137,12 @@
     struct wl_private	*lp;
     /*------------------------------------------------------------------------*/

-    DBG_FUNC( "wl_adapter_attach" );
-    DBG_ENTER( DbgInfo );
+    DBG_FUNC("wl_adapter_attach");
+    DBG_ENTER(DbgInfo);

     dev = wl_device_alloc();
-    if(dev == NULL) {
-        DBG_ERROR( DbgInfo, "wl_device_alloc returned NULL\n");
+    if (dev == NULL) {
+        DBG_ERROR(DbgInfo, "wl_device_alloc returned NULL\n");
 	return -ENOMEM;
     }

@@ -160,7 +160,7 @@

     wl_adapter_insert(link);

-    DBG_LEAVE( DbgInfo );
+    DBG_LEAVE(DbgInfo);
     return 0;
 } // wl_adapter_attach
 /*============================================================================*/
@@ -194,9 +194,9 @@
     /*------------------------------------------------------------------------*/

-    DBG_FUNC( "wl_adapter_detach" );
-    DBG_ENTER( DbgInfo );
-    DBG_PARAM( DbgInfo, "link", "0x%p", link );
+    DBG_FUNC("wl_adapter_detach");
+    DBG_ENTER(DbgInfo);
+    DBG_PARAM(DbgInfo, "link", "0x%p", link);

     wl_adapter_release(link);

@@ -207,7 +207,7 @@

     wl_device_dealloc(dev);

-    DBG_LEAVE( DbgInfo );
+    DBG_LEAVE(DbgInfo);
 } // wl_adapter_detach
 /*============================================================================*/

@@ -232,18 +232,18 @@
  *      N/A
  *
  ******************************************************************************/
-void wl_adapter_release( struct pcmcia_device *link )
-{
-    DBG_FUNC( "wl_adapter_release" );
-    DBG_ENTER( DbgInfo );
-    DBG_PARAM( DbgInfo, "link", "0x%p", link);
+void wl_adapter_release(struct pcmcia_device *link)
+{
+    DBG_FUNC("wl_adapter_release");
+    DBG_ENTER(DbgInfo);
+    DBG_PARAM(DbgInfo, "link", "0x%p", link);

     /* Stop hardware */
     wl_remove(link->priv);

     pcmcia_disable_device(link);

-    DBG_LEAVE( DbgInfo );
+    DBG_LEAVE(DbgInfo);
 } // wl_adapter_release
 /*============================================================================*/

@@ -266,7 +266,7 @@

 	wl_resume(dev);

-	netif_device_attach( dev );
+	netif_device_attach(dev);

 	return 0;
 } // wl_adapter_resume
@@ -291,16 +291,16 @@
  *      N/A
  *
  ******************************************************************************/
-void wl_adapter_insert( struct pcmcia_device *link )
+void wl_adapter_insert(struct pcmcia_device *link)
 {
     struct net_device       *dev;
     int i;
     int                     ret;
     /*------------------------------------------------------------------------*/

-    DBG_FUNC( "wl_adapter_insert" );
-    DBG_ENTER( DbgInfo );
-    DBG_PARAM( DbgInfo, "link", "0x%p", link );
+    DBG_FUNC("wl_adapter_insert");
+    DBG_ENTER(DbgInfo);
+    DBG_PARAM(DbgInfo, "link", "0x%p", link);

     dev     = link->priv;

@@ -332,15 +332,15 @@

     printk(KERN_INFO "%s: Wireless, io_addr %#03lx, irq %d, ""mac_address ",
                dev->name, dev->base_addr, dev->irq);
-    for( i = 0; i < ETH_ALEN; i++ ) {
+    for (i = 0; i < ETH_ALEN; i++) {
         printk("%02X%c", dev->dev_addr[i], ((i < (ETH_ALEN-1)) ? ':' : '\n'));
     }

-    DBG_LEAVE( DbgInfo );
+    DBG_LEAVE(DbgInfo);
     return;

 failed:
-    wl_adapter_release( link );
+    wl_adapter_release(link);

     DBG_LEAVE(DbgInfo);
     return;
@@ -367,7 +367,7 @@
  *      errno value otherwise
  *
  ******************************************************************************/
-int wl_adapter_open( struct net_device *dev )
+int wl_adapter_open(struct net_device *dev)
 {
     struct wl_private *lp = wl_priv(dev);
     struct pcmcia_device *link = lp->link;
@@ -376,27 +376,27 @@
     /*------------------------------------------------------------------------*/

-    DBG_FUNC( "wl_adapter_open" );
-    DBG_ENTER( DbgInfo );
-	DBG_PRINT( "%s\n", VERSION_INFO );
-    DBG_PARAM( DbgInfo, "dev", "%s (0x%p)", dev->name, dev );
-
-    if(!pcmcia_dev_present(link))
+    DBG_FUNC("wl_adapter_open");
+    DBG_ENTER(DbgInfo);
+	DBG_PRINT("%s\n", VERSION_INFO);
+    DBG_PARAM(DbgInfo, "dev", "%s (0x%p)", dev->name, dev);
+
+    if (!pcmcia_dev_present(link))
     {
-        DBG_LEAVE( DbgInfo );
+        DBG_LEAVE(DbgInfo);
         return -ENODEV;
     }

     link->open++;

-    hcf_status = wl_open( dev );
-
-    if( hcf_status != HCF_SUCCESS ) {
+    hcf_status = wl_open(dev);
+
+    if (hcf_status != HCF_SUCCESS) {
         link->open--;
         result = -ENODEV;
     }

-    DBG_LEAVE( DbgInfo );
+    DBG_LEAVE(DbgInfo);
     return result;
 } // wl_adapter_open
 /*============================================================================*/
@@ -421,28 +421,28 @@
  *      errno value otherwise
  *
  ******************************************************************************/
-int wl_adapter_close( struct net_device *dev )
+int wl_adapter_close(struct net_device *dev)
 {
     struct wl_private *lp = wl_priv(dev);
     struct pcmcia_device *link = lp->link;
     /*------------------------------------------------------------------------*/

-    DBG_FUNC( "wl_adapter_close" );
-    DBG_ENTER( DbgInfo );
-    DBG_PARAM( DbgInfo, "dev", "%s (0x%p)", dev->name, dev );
-
-    if( link == NULL ) {
-        DBG_LEAVE( DbgInfo );
+    DBG_FUNC("wl_adapter_close");
+    DBG_ENTER(DbgInfo);
+    DBG_PARAM(DbgInfo, "dev", "%s (0x%p)", dev->name, dev);
+
+    if (link == NULL) {
+        DBG_LEAVE(DbgInfo);
         return -ENODEV;
     }

-    DBG_TRACE( DbgInfo, "%s: Shutting down adapter.\n", dev->name );
-    wl_close( dev );
+    DBG_TRACE(DbgInfo, "%s: Shutting down adapter.\n", dev->name);
+    wl_close(dev);

     link->open--;

-    DBG_LEAVE( DbgInfo );
+    DBG_LEAVE(DbgInfo);
     return 0;
 } // wl_adapter_close
 /*============================================================================*/
@@ -493,19 +493,19 @@
  *      -1 on error
  *
  ******************************************************************************/
-int wl_adapter_init_module( void )
+int wl_adapter_init_module(void)
 {
     int ret;
     /*------------------------------------------------------------------------*/

-    DBG_FUNC( "wl_adapter_init_module" );
-    DBG_ENTER( DbgInfo );
-    DBG_TRACE( DbgInfo, "wl_adapter_init_module() -- PCMCIA\n" );
+    DBG_FUNC("wl_adapter_init_module");
+    DBG_ENTER(DbgInfo);
+    DBG_TRACE(DbgInfo, "wl_adapter_init_module() -- PCMCIA\n");

     ret = pcmcia_register_driver(&wlags49_driver);

-    DBG_LEAVE( DbgInfo );
+    DBG_LEAVE(DbgInfo);
     return ret;
 } // wl_adapter_init_module
 /*============================================================================*/
@@ -528,16 +528,16 @@
  *      N/A
  *
  ******************************************************************************/
-void wl_adapter_cleanup_module( void )
-{
-    DBG_FUNC( "wl_adapter_cleanup_module" );
-    DBG_ENTER( DbgInfo );
-    DBG_TRACE( DbgInfo, "wl_adapter_cleanup_module() -- PCMCIA\n" );
+void wl_adapter_cleanup_module(void)
+{
+    DBG_FUNC("wl_adapter_cleanup_module");
+    DBG_ENTER(DbgInfo);
+    DBG_TRACE(DbgInfo, "wl_adapter_cleanup_module() -- PCMCIA\n");

     pcmcia_unregister_driver(&wlags49_driver);

-    DBG_LEAVE( DbgInfo );
+    DBG_LEAVE(DbgInfo);
     return;
 } // wl_adapter_cleanup_module
 /*============================================================================*/
@@ -562,16 +562,16 @@
  *      0 otherwise
  *
  ******************************************************************************/
-int wl_adapter_is_open( struct net_device *dev )
+int wl_adapter_is_open(struct net_device *dev)
 {
     struct wl_private *lp = wl_priv(dev);
     struct pcmcia_device *link = lp->link;

-    if(!pcmcia_dev_present(link)) {
+    if (!pcmcia_dev_present(link)) {
         return 0;
     }

-    return( link->open );
+    return(link->open);
 } // wl_adapter_is_open
 /*============================================================================*/

@@ -596,7 +596,7 @@
  *      a pointer to a string describing the error(s)
  *
  ******************************************************************************/
-const char* DbgEvent( int mask )
+const char* DbgEvent(int mask)
 {
     static char DbgBuffer[256];
     char *pBuf;
@@ -607,81 +607,81 @@
     *pBuf   = '\0';

-    if( mask & CS_EVENT_WRITE_PROTECT )
-        strcat( pBuf, "WRITE_PROTECT " );
-
-    if(mask & CS_EVENT_CARD_LOCK)
-        strcat( pBuf, "CARD_LOCK " );
-
-    if(mask & CS_EVENT_CARD_INSERTION)
-        strcat( pBuf, "CARD_INSERTION " );
-
-    if(mask & CS_EVENT_CARD_REMOVAL)
-        strcat( pBuf, "CARD_REMOVAL " );
-
-    if(mask & CS_EVENT_BATTERY_DEAD)
-        strcat( pBuf, "BATTERY_DEAD " );
-
-    if(mask & CS_EVENT_BATTERY_LOW)
-        strcat( pBuf, "BATTERY_LOW " );
-
-    if(mask & CS_EVENT_READY_CHANGE)
-        strcat( pBuf, "READY_CHANGE " );
-
-    if(mask & CS_EVENT_CARD_DETECT)
-        strcat( pBuf, "CARD_DETECT " );
-
-    if(mask & CS_EVENT_RESET_REQUEST)
-        strcat( pBuf, "RESET_REQUEST " );
-
-    if(mask & CS_EVENT_RESET_PHYSICAL)
-        strcat( pBuf, "RESET_PHYSICAL " );
-
-    if(mask & CS_EVENT_CARD_RESET)
-        strcat( pBuf, "CARD_RESET " );
-
-    if(mask & CS_EVENT_REGISTRATION_COMPLETE)
-        strcat( pBuf, "REGISTRATION_COMPLETE " );
+    if (mask & CS_EVENT_WRITE_PROTECT)
+        strcat(pBuf, "WRITE_PROTECT ");
+
+    if (mask & CS_EVENT_CARD_LOCK)
+        strcat(pBuf, "CARD_LOCK ");
+
+    if (mask & CS_EVENT_CARD_INSERTION)
+        strcat(pBuf, "CARD_INSERTION ");
+
+    if (mask & CS_EVENT_CARD_REMOVAL)
+        strcat(pBuf, "CARD_REMOVAL ");
+
+    if (mask & CS_EVENT_BATTERY_DEAD)
+        strcat(pBuf, "BATTERY_DEAD ");
+
+    if (mask & CS_EVENT_BATTERY_LOW)
+        strcat(pBuf, "BATTERY_LOW ");
+
+    if (mask & CS_EVENT_READY_CHANGE)
+        strcat(pBuf, "READY_CHANGE ");
+
+    if (mask & CS_EVENT_CARD_DETECT)
+        strcat(pBuf, "CARD_DETECT ");
+
+    if (mask & CS_EVENT_RESET_REQUEST)
+        strcat(pBuf, "RESET_REQUEST ");
+
+    if (mask & CS_EVENT_RESET_PHYSICAL)
+        strcat(pBuf, "RESET_PHYSICAL ");
+
+    if (mask & CS_EVENT_CARD_RESET)
+        strcat(pBuf, "CARD_RESET ");
+
+    if (mask & CS_EVENT_REGISTRATION_COMPLETE)
+        strcat(pBuf, "REGISTRATION_COMPLETE ");

     // if(mask & CS_EVENT_RESET_COMPLETE)
     //     strcat( pBuf, "RESET_COMPLETE " );

-    if(mask & CS_EVENT_PM_SUSPEND)
-        strcat( pBuf, "PM_SUSPEND " );
-
-    if(mask & CS_EVENT_PM_RESUME)
-        strcat( pBuf, "PM_RESUME " );
-
-    if(mask & CS_EVENT_INSERTION_REQUEST)
-        strcat( pBuf, "INSERTION_REQUEST " );
-
-    if(mask & CS_EVENT_EJECTION_REQUEST)
-        strcat( pBuf, "EJECTION_REQUEST " );
-
-    if(mask & CS_EVENT_MTD_REQUEST)
-        strcat( pBuf, "MTD_REQUEST " );
-
-    if(mask & CS_EVENT_ERASE_COMPLETE)
-        strcat( pBuf, "ERASE_COMPLETE " );
-
-    if(mask & CS_EVENT_REQUEST_ATTENTION)
-        strcat( pBuf, "REQUEST_ATTENTION " );
-
-    if(mask & CS_EVENT_CB_DETECT)
-        strcat( pBuf, "CB_DETECT " );
-
-    if(mask & CS_EVENT_3VCARD)
-        strcat( pBuf, "3VCARD " );
-
-    if(mask & CS_EVENT_XVCARD)
-        strcat( pBuf, "XVCARD " );
-
-
-    if( *pBuf ) {
+    if (mask & CS_EVENT_PM_SUSPEND)
+        strcat(pBuf, "PM_SUSPEND ");
+
+    if (mask & CS_EVENT_PM_RESUME)
+        strcat(pBuf, "PM_RESUME ");
+
+    if (mask & CS_EVENT_INSERTION_REQUEST)
+        strcat(pBuf, "INSERTION_REQUEST ");
+
+    if (mask & CS_EVENT_EJECTION_REQUEST)
+        strcat(pBuf, "EJECTION_REQUEST ");
+
+    if (mask & CS_EVENT_MTD_REQUEST)
+        strcat(pBuf, "MTD_REQUEST ");
+
+    if (mask & CS_EVENT_ERASE_COMPLETE)
+        strcat(pBuf, "ERASE_COMPLETE ");
+
+    if (mask & CS_EVENT_REQUEST_ATTENTION)
+        strcat(pBuf, "REQUEST_ATTENTION ");
+
+    if (mask & CS_EVENT_CB_DETECT)
+        strcat(pBuf, "CB_DETECT ");
+
+    if (mask & CS_EVENT_3VCARD)
+        strcat(pBuf, "3VCARD ");
+
+    if (mask & CS_EVENT_XVCARD)
+        strcat(pBuf, "XVCARD ");
+
+
+    if (*pBuf) {
         pBuf[strlen(pBuf) - 1] = '\0';
     } else {
-        if( mask != 0x0 ) {
-            sprintf( pBuf, "<<0x%08x>>", mask );
+        if (mask != 0x0) {
+            sprintf(pBuf, "<<0x%08x>>", mask);
         }
     }


staging/wlan-ng: prsim2fw.c coding style cleanup

this patch fixes the coding style problems found by using checkpatch.pl

drivers/staging/wlan-ng/prism2fw.c:175: ERROR: "foo * bar" should be "foo *bar"
drivers/staging/wlan-ng/prism2fw.c:210: WARNING: line over 80 characters
drivers/staging/wlan-ng/prism2fw.c:596: WARNING: line over 80 characters
drivers/staging/wlan-ng/prism2fw.c:658: ERROR: "foo * bar" should be "foo *bar"

Signed-off-by: Devendra Naga <97fdf9fb34d40445b99f4e064a18057cd6e2bccb@gmail.com>
Signed-off-by: Greg Kroah-Hartman <4645f7897fd33786a2ee1264d590b3c400559d85@linuxfoundation.org>

--- drivers/staging/wlan-ng/prism2fw.c
+++ drivers/staging/wlan-ng/prism2fw.c
@@ -172,7 +172,7 @@
 static int mkpdrlist(struct pda *pda);

 static int plugimage(struct imgchunk *fchunk, unsigned int nfchunks,
-	      struct s3plugrec *s3plug, unsigned int ns3plug, struct pda * pda);
+	      struct s3plugrec *s3plug, unsigned int ns3plug, struct pda *pda);

 static int crcimage(struct imgchunk *fchunk, unsigned int nfchunks,
 	     struct s3crcrec *s3crc, unsigned int ns3crc);
@@ -207,7 +207,8 @@

 	printk(KERN_INFO "prism2_usb: Checking for firmware %s\n",
 	       PRISM2_USB_FWFILE);
-	if (request_ihex_firmware(&fw_entry, PRISM2_USB_FWFILE, &udev->dev) != 0) {
+	if (request_ihex_firmware(&fw_entry,
+				  PRISM2_USB_FWFILE, &udev->dev) != 0) {
 		printk(KERN_INFO
 		       "prism2_usb: Firmware not available, but not essential\n");
 		printk(KERN_INFO
@@ -593,7 +594,8 @@
 	       le16_to_cpu(pda16[curroff + 1]) != HFA384x_PDR_END_OF_PDA) {
 		pda->rec[pda->nrec] = (hfa384x_pdrec_t *) &(pda16[curroff]);

-		if (le16_to_cpu(pda->rec[pda->nrec]->code) == HFA384x_PDR_NICID) {
+		if (le16_to_cpu(pda->rec[pda->nrec]->code) ==
+		    HFA384x_PDR_NICID) {
 			memcpy(&nicid, &pda->rec[pda->nrec]->data.nicid,
 			       sizeof(nicid));
 			nicid.id = le16_to_cpu(nicid.id);
@@ -655,7 +657,7 @@
 *	~0	failure
 ----------------------------------------------------------------*/
 int plugimage(struct imgchunk *fchunk, unsigned int nfchunks,
-	      struct s3plugrec *s3plug, unsigned int ns3plug, struct pda * pda)
+	      struct s3plugrec *s3plug, unsigned int ns3plug, struct pda *pda)
 {
 	int result = 0;
 	int i;			/* plug index */


intel_powerclamp: Fix cstate counter detection.

Having all zero cstate count doesn't necesserily mean the cstate
counter is no functional.

Signed-off-by: Yuxuan Shui <7f7e1535bcd10fa942d56a3436533af20f33203f@gmail.com>
Signed-off-by: Zhang Rui <f2a4cf793007be8f81a774dc7806c1ffea7b4a2c@intel.com>

--- drivers/thermal/intel_powerclamp.c
+++ drivers/thermal/intel_powerclamp.c
@@ -204,6 +204,15 @@
 	target_mwait = (highest_cstate << MWAIT_SUBSTATE_SIZE) |
 		(highest_subcstate - 1);

+}
+
+static bool has_pkg_state_counter(void)
+{
+	u64 tmp;
+	return !rdmsrl_safe(MSR_PKG_C2_RESIDENCY, &tmp) ||
+	       !rdmsrl_safe(MSR_PKG_C3_RESIDENCY, &tmp) ||
+	       !rdmsrl_safe(MSR_PKG_C6_RESIDENCY, &tmp) ||
+	       !rdmsrl_safe(MSR_PKG_C7_RESIDENCY, &tmp);
 }

 static u64 pkg_state_counter(void)
@@ -500,7 +509,7 @@
 	struct task_struct *thread;

 	/* check if pkg cstate counter is completely 0, abort in this case */
-	if (!pkg_state_counter()) {
+	if (!has_pkg_state_counter()) {
 		pr_err("pkg cstate counter not functional, abort\n");
 		return -EINVAL;
 	}


usb: gadget: dummy_hcd: fix rescan logic for transfer

transfer() schedules a rescan for transfers larger than
maxpacket, which is wrong for transfers that are multiples
of maxpacket.

Rewrite to fix and clarify packet multiple / remainder
transfer logic.

Signed-off-by: Igor Kotrasinski <5db3caed0e9bdd29b00baebff0d6fcd719efbc6c@samsung.com>
Signed-off-by: Felipe Balbi <94dddeeef08b001e003cce128ddc162a4e2c6cd2@ti.com>

--- drivers/usb/gadget/udc/dummy_hcd.c
+++ drivers/usb/gadget/udc/dummy_hcd.c
@@ -1385,12 +1385,15 @@
 			if (len == 0)
 				break;

-			/* use an extra pass for the final short packet */
-			if (len > ep->ep.maxpacket) {
-				rescan = 1;
-				len -= (len % ep->ep.maxpacket);
+			/* send multiple of maxpacket first, then remainder */
+			if (len >= ep->ep.maxpacket) {
+				is_short = 0;
+				if (len % ep->ep.maxpacket)
+					rescan = 1;
+				len -= len % ep->ep.maxpacket;
+			} else {
+				is_short = 1;
 			}
-			is_short = (len % ep->ep.maxpacket) != 0;

 			len = dummy_perform_transfer(urb, req, len);


usb: renesas: use dev_get_platdata()

usb: renesas: use dev_get_platdata()

Use the wrapper function for retrieving the platform data instead of
accessing dev->platform_data directly.

Signed-off-by: Jingoo Han <fc379137a64feb86ce38ec5811a14280acc1ccfc@samsung.com>
Signed-off-by: Greg Kroah-Hartman <4645f7897fd33786a2ee1264d590b3c400559d85@linuxfoundation.org>

--- drivers/usb/renesas_usbhs/common.c
+++ drivers/usb/renesas_usbhs/common.c
@@ -416,7 +416,7 @@
  */
 static int usbhs_probe(struct platform_device *pdev)
 {
-	struct renesas_usbhs_platform_info *info = pdev->dev.platform_data;
+	struct renesas_usbhs_platform_info *info = dev_get_platdata(&pdev->dev);
 	struct renesas_usbhs_driver_callback *dfunc;
 	struct usbhs_priv *priv;
 	struct resource *res, *irq_res;
@@ -558,7 +558,7 @@
 static int usbhs_remove(struct platform_device *pdev)
 {
 	struct usbhs_priv *priv = usbhs_pdev_to_priv(pdev);
-	struct renesas_usbhs_platform_info *info = pdev->dev.platform_data;
+	struct renesas_usbhs_platform_info *info = dev_get_platdata(&pdev->dev);
 	struct renesas_usbhs_driver_callback *dfunc = &info->driver_callback;

 	dev_dbg(&pdev->dev, "usb remove\n");


[PATCH] USB: unusual_devs entry for Nokia E61

This patch (as748) adds an unusual_devs entry for the Nokia E61 mobile
phone.

Signed-off-by: Alan Stern <75ea6bb7bfc1186f92d26164de5f9268c9a45b59@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <4645f7897fd33786a2ee1264d590b3c400559d85@suse.de>

--- drivers/usb/storage/unusual_devs.h
+++ drivers/usb/storage/unusual_devs.h
@@ -155,6 +155,13 @@
 		US_SC_DEVICE, US_PR_DEVICE, NULL,
 		US_FL_IGNORE_RESIDUE | US_FL_FIX_CAPACITY ),

+/* Reported by Matthew Bloch <matthew@bytemark.co.uk> */
+UNUSUAL_DEV(  0x0421, 0x044e, 0x0100, 0x0100,
+		"Nokia",
+		"E61",
+		US_SC_DEVICE, US_PR_DEVICE, NULL,
+		US_FL_IGNORE_RESIDUE | US_FL_FIX_CAPACITY ),
+
 /* Reported by Olaf Hering <olh@suse.de> from novell bug #105878 */
 UNUSUAL_DEV(  0x0424, 0x0fdc, 0x0210, 0x0210,
 		"SMSC",


Fixed compilation with clang w/o tr1::unorderd_map

--- include/BALL/VIEW/RENDERING/RENDERERS/rtfactRenderer.h
+++ include/BALL/VIEW/RENDERING/RENDERERS/rtfactRenderer.h
@@ -23,8 +23,11 @@
 #include <RTfact/Model/Image/BasicImage2D.hpp>
 #include <RTfact/Model/Framebuffer/Image2DFramebuffer.hpp>

-namespace std { namespace tr1
+#ifdef BALL_HAS_TR1_UNORDERED_MAP
+namespace std
 {
+	namespace tr1
+	{
     template <>
     struct hash< RTpieCpp::InstanceHandle > : public unary_function<RTpieCpp::InstanceHandle, size_t> {
     public:
@@ -39,7 +42,9 @@
             return c.s;
         }
     };
-}}
+	}
+}
+#endif // BALL_HAS_TR1_UNORDERED_MAP

 namespace BALL
 {


better fix for Issue 62

better fix for Issue 62

--- src/apps/relay/mainrelay.c
+++ src/apps/relay/mainrelay.c
@@ -1379,6 +1379,9 @@
 		TURN_LOG_FUNC(TURN_LOG_LEVEL_INFO, "===========Discovering listener addresses: =========\n");
 		for (ifa = ifs; ifa != NULL; ifa = ifa->ifa_next) {

+			if(!(ifa->ifa_flags & IFF_UP))
+				continue;
+
 			if(!(ifa->ifa_addr))
 				continue;

@@ -1423,12 +1426,15 @@
 		TURN_LOG_FUNC(TURN_LOG_LEVEL_INFO, "===========Discovering relay addresses: =============\n");
 		for (ifa = ifs; ifa != NULL; ifa = ifa->ifa_next) {

+			if(!(ifa->ifa_flags & IFF_UP))
+				continue;
+
 			if(!(ifa->ifa_name))
 				continue;
 			if(!(ifa ->ifa_addr))
 				continue;

-			if(!allow_local && (strstr(ifa->ifa_name,"lo") == ifa->ifa_name))
+			if(!allow_local && (ifa->ifa_flags & IFF_LOOPBACK))
 				continue;

 			if (ifa ->ifa_addr->sa_family == AF_INET) {
@@ -1439,8 +1445,6 @@
 					continue;
 				if(!strcmp(saddr,"0.0.0.0"))
 				  continue;
-				if(strstr(saddr,"127") == saddr)
-					continue;
 			} else if (ifa->ifa_addr->sa_family == AF_INET6) {
 				if(!inet_ntop(AF_INET6, &((struct sockaddr_in6 *) ifa->ifa_addr)->sin6_addr, saddr,
 								INET6_ADDRSTRLEN))
@@ -1449,8 +1453,6 @@
 					continue;
 				if(!strcmp(saddr,"::"))
 				  continue;
-				if(strstr(saddr,"::1") == saddr)
-					continue;
 			} else
 				continue;


Adjust to #include movage

Adjust to #include movage

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

--- include/llvm/Analysis/DataStructure/EquivClassGraphs.h
+++ include/llvm/Analysis/DataStructure/EquivClassGraphs.h
@@ -17,8 +17,8 @@

 #include "llvm/Analysis/DataStructure/DataStructure.h"
 #include "llvm/Analysis/DataStructure/DSGraph.h"
-#include "Support/EquivalenceClasses.h"
-#include "Support/STLExtras.h"
+#include "llvm/ADT/EquivalenceClasses.h"
+#include "llvm/ADT/STLExtras.h"
 #include <vector>
 #include <map>
 #include <ext/hash_map>


Remove unused Http2Stream destructor

Remove unused Http2Stream destructor

--- proxy/http2/Http2Stream.h
+++ proxy/http2/Http2Stream.h
@@ -59,7 +59,6 @@
     response_header.create(HTTP_TYPE_RESPONSE);
   }

-  ~Http2Stream() { this->destroy(); }
   int main_event_handler(int event, void *edata);

   void destroy() override;


[mpi] notes

[mpi] notes

--- kernels/mpi/include/readdy/kernel/mpi/model/MPINeighborList.h
+++ kernels/mpi/include/readdy/kernel/mpi/model/MPINeighborList.h
@@ -102,6 +102,16 @@
                 _cellNeighbors = readdy::util::Index2D(_cellIndex.size(), 1 + nAdjacentCells);
                 _cellNeighborsContent.resize(_cellNeighbors.size());
                 {
+                    // todo
+                    auto pbc = _context.get().periodicBoundaryConditions();
+                    auto fixBoxIx = [&](auto cix, auto boxIx, std::uint8_t axis) {
+                        auto nCells = static_cast<int>(_cellIndex[axis]);
+                        if (pbc[axis] && nCells > 2) {
+                            return (boxIx % nCells + nCells) % nCells;
+                        }
+                        return boxIx;
+                    };
+
                     int r = _radius;
                     // local adjacency
                     std::vector<std::size_t> adj;
@@ -134,6 +144,16 @@
                                             {{i + 1, j + 1, k + 0}},
                                             {{i + 1, j + 1, k + 1}},
                                     };
+
+                                    // todo wrap around
+                                    std::transform(boxCoords.begin(), boxCoords.end(), boxCoords.begin(),
+                                                   [&](auto arr) {
+                                                       for (std::uint8_t d = 0; d < 3; ++d) {
+                                                           arr.at(d) = fixBoxIx(ijk[d], arr.at(d), d);
+                                                       }
+                                                       return arr;
+                                                   }
+                                    );

                                     for (auto boxCoord : boxCoords) {
                                         if (boxCoord[0] >= 0 && boxCoord[1] >= 0 && boxCoord[2] >= 0
@@ -319,7 +339,9 @@

     Vec3 _cellSize{0, 0, 0};

+    // todo instead of mapping to a linear vector, this should index a map (because cells are sparse)
     readdy::util::Index3D _cellIndex;
+
     // index of size (n_cells x (1 + nAdjacentCells)), where the first element tells how many adj cells are stored
     readdy::util::Index2D _cellNeighbors;
     // backing vector of _cellNeighbors index of size (n_cells x (1 + nAdjacentCells))


Suppress bogus statistics when pgbench failed to complete any transactions.

Code added in 9.4 would attempt to divide by zero in such cases.
Noted while testing fix for missing-pclose problem.

--- contrib/pgbench/pgbench.c
+++ contrib/pgbench/pgbench.c
@@ -2298,6 +2298,10 @@
 		printf("number of transactions actually processed: " INT64_FORMAT "\n",
 			   normal_xacts);
 	}
+
+	/* Remaining stats are nonsensical if we failed to execute any xacts */
+	if (normal_xacts <= 0)
+		return;

 	if (throttle_delay || progress)
 	{


#11452 fixes a bug in releasing fdf context.

in FDFOpenContainer() error path, there is a possiblity of not
releasing fdf context on certain condition, which will inhibit
further fdf context locking and endup blewing an assert.

regression by r1963

TESTS_RAN: reproducer, unittest, devtest #716

git-svn-id: a0db35f042a950d73592b5822876875cf57db3ee@2176 01a69087-22d5-4a29-8152-8a1d5e10e5e9

--- api/fdf.c
+++ api/fdf.c
@@ -2685,7 +2685,8 @@
 		uint64_t vdc_size = ((uint64_t)getProperty_Int("FDF_FLASH_SIZE", FDF_MIN_FLASH_SIZE)) * 1024 * 1024 -
                                                                        (2 * FDF_DEFAULT_CONTAINER_SIZE_KB);
 		if (!properties) {
-			return FDF_INVALID_PARAMETER;
+            status = FDF_INVALID_PARAMETER;
+            goto out;
 		}
 		if( properties->size_kb >  vdc_size) {
 			plat_log_msg(80063, LOG_CAT, LOG_DBG,


Uninitialized variable. Do not assume certain endianess.

--- contrib/pnpinfo/pnpinfo.c
+++ contrib/pnpinfo/pnpinfo.c
@@ -23,7 +23,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- *      $Id: pnpinfo.c,v 1.2 1997/11/12 08:48:13 jmg Exp $
+ *      $Id: pnpinfo.c,v 1.3 1998/09/13 22:15:44 eivind Exp $
  */

 #include <sys/time.h>
@@ -501,9 +501,10 @@
 	    free(resinfo);
 	} else {
 	    /* Handle large resouce data types */
-
-	    if (!get_resource_info((char *) &large_len, 2))
-		break;
+	    u_char buf[2];
+	    if (!get_resource_info((char *)buf, 2))
+		break;
+	    large_len = (buf[1] << 8) + buf[0];

 	    resinfo = malloc(large_len);
 	    if (!get_resource_info(resinfo, large_len))


Disabling automatic --same-owner option when running as uid 0 along with
the --same-permissions was an overkill, so put it back. This is consistent
with what our old tar did.

Suggested by:	dillon

--- contrib/tar/src/extract.c
+++ contrib/tar/src/extract.c
@@ -114,8 +114,8 @@
   we_are_root = geteuid () == 0;
 #ifndef __FreeBSD__
   same_permissions_option += we_are_root;
+#endif
   same_owner_option += we_are_root;
-#endif
   xalloc_fail_func = extract_finish;

   /* Option -p clears the kernel umask, so it does not affect proper


ecalclient: Fix uninitialized list

ecalclient: Fix uninitialized list

This would likely crash.

--- calendar/libecal/e-cal-client.c
+++ calendar/libecal/e-cal-client.c
@@ -5773,7 +5773,7 @@
 		(!success && (uris == NULL)), FALSE);

 	if (uris != NULL) {
-		GSList *tmp;
+		GSList *tmp = NULL;
 		gint ii;

 		for (ii = 0; uris[ii] != NULL; ii++) {


Compile with WDCDEBUG.

Compile with WDCDEBUG.

--- dev/atapiscsi/atapiscsi.c
+++ dev/atapiscsi/atapiscsi.c
@@ -1,4 +1,4 @@
-/*      $OpenBSD: atapiscsi.c,v 1.45 2001/06/25 22:31:29 csapuntz Exp $     */
+/*      $OpenBSD: atapiscsi.c,v 1.46 2001/07/02 04:58:52 ho Exp $     */

 /*
  * This code is derived from code with the copyright below.
@@ -314,7 +314,7 @@
 	int s, ret;

 	WDCDEBUG_PRINT(("wdc_atapi_send_cmd %s:%d:%d\n",
-	    chp->wdc->sc_dev.dv_xname, chp->channel, drive), DEBUG_XFERS);
+	    chp->wdc->sc_dev.dv_xname, chp->channel, as->drive), DEBUG_XFERS);

 	if (sc_xfer->sc_link->target != 0) {
 		sc_xfer->error = XS_DRIVER_STUFFUP;


Reinitialize conf to NULL whenver ca application is started. Submitted by: Lennart Bang

--- apps/ca.c
+++ apps/ca.c
@@ -206,7 +206,7 @@
 	X509_REQ *req, char *ext_sect, LHASH *conf);
 static int do_revoke(X509 *x509, TXT_DB *db);
 static int check_time_format(char *str);
-static LHASH *conf;
+static LHASH *conf=NULL;
 static char *key=NULL;
 static char *section=NULL;

@@ -273,6 +273,7 @@

 	apps_startup();

+	conf = NULL;
 	key = NULL;
 	section = NULL;