[WATCHDOG] pcwd.c control status patch

[WATCHDOG] pcwd.c control status patch

Clean-up the control status code (insert tabs where relevant),
Add new Control Status defines, Make sure that the R2DS bit
stays the same.

Signed-off-by: Wim Van Sebroeck <5f65f6985de1ebf15dde04e0dc4668211868bafa@iguana.be>

--- drivers/char/watchdog/pcwd.c
+++ drivers/char/watchdog/pcwd.c
@@ -73,8 +73,8 @@
 #include <asm/io.h>		/* For inb/outb/... */

 /* Module and version information */
-#define WATCHDOG_VERSION "1.16"
-#define WATCHDOG_DATE "03 Jan 2006"
+#define WATCHDOG_VERSION "1.17"
+#define WATCHDOG_DATE "12 Feb 2006"
 #define WATCHDOG_DRIVER_NAME "ISA-PC Watchdog"
 #define WATCHDOG_NAME "pcwd"
 #define PFX WATCHDOG_NAME ": "
@@ -96,15 +96,19 @@
  * PCI-PC Watchdog card.
 */
 /* Port 1 : Control Status #1 for the PC Watchdog card, revision A. */
-#define WD_WDRST                0x01	/* Previously reset state */
-#define WD_T110                 0x02	/* Temperature overheat sense */
-#define WD_HRTBT                0x04	/* Heartbeat sense */
-#define WD_RLY2                 0x08	/* External relay triggered */
-#define WD_SRLY2                0x80	/* Software external relay triggered */
+#define WD_WDRST		0x01	/* Previously reset state */
+#define WD_T110			0x02	/* Temperature overheat sense */
+#define WD_HRTBT		0x04	/* Heartbeat sense */
+#define WD_RLY2			0x08	/* External relay triggered */
+#define WD_SRLY2		0x80	/* Software external relay triggered */
 /* Port 1 : Control Status #1 for the PC Watchdog card, revision C. */
-#define WD_REVC_WTRP            0x01	/* Watchdog Trip status */
-#define WD_REVC_HRBT            0x02	/* Watchdog Heartbeat */
-#define WD_REVC_TTRP            0x04	/* Temperature Trip status */
+#define WD_REVC_WTRP		0x01	/* Watchdog Trip status */
+#define WD_REVC_HRBT		0x02	/* Watchdog Heartbeat */
+#define WD_REVC_TTRP		0x04	/* Temperature Trip status */
+#define WD_REVC_RL2A		0x08	/* Relay 2 activated by on-board processor */
+#define WD_REVC_RL1A		0x10	/* Relay 1 active */
+#define WD_REVC_R2DS		0x40	/* Relay 2 disable */
+#define WD_REVC_RLY2		0x80	/* Relay 2 activated? */
 /* Port 2 : Control Status #2 */
 #define WD_WDIS			0x10	/* Watchdog Disabled */
 #define WD_ENTP			0x20	/* Watchdog Enable Temperature Trip */
@@ -407,7 +411,7 @@

 static int pcwd_get_status(int *status)
 {
-	int card_status;
+	int control_status;

 	*status=0;
 	spin_lock(&pcwd_private.io_lock);
@@ -415,22 +419,22 @@
 		/* Rev A cards return status information from
 		 * the base register, which is used for the
 		 * temperature in other cards. */
-		card_status = inb(pcwd_private.io_addr);
+		control_status = inb(pcwd_private.io_addr);
 	else {
 		/* Rev C cards return card status in the base
 		 * address + 1 register. And use different bits
 		 * to indicate a card initiated reset, and an
 		 * over-temperature condition. And the reboot
 		 * status can be reset. */
-		card_status = inb(pcwd_private.io_addr + 1);
+		control_status = inb(pcwd_private.io_addr + 1);
 	}
 	spin_unlock(&pcwd_private.io_lock);

 	if (pcwd_private.revision == PCWD_REVISION_A) {
-		if (card_status & WD_WDRST)
+		if (control_status & WD_WDRST)
 			*status |= WDIOF_CARDRESET;

-		if (card_status & WD_T110) {
+		if (control_status & WD_T110) {
 			*status |= WDIOF_OVERHEAT;
 			if (temp_panic) {
 				printk (KERN_INFO PFX "Temperature overheat trip!\n");
@@ -438,10 +442,10 @@
 			}
 		}
 	} else {
-		if (card_status & WD_REVC_WTRP)
+		if (control_status & WD_REVC_WTRP)
 			*status |= WDIOF_CARDRESET;

-		if (card_status & WD_REVC_TTRP) {
+		if (control_status & WD_REVC_TTRP) {
 			*status |= WDIOF_OVERHEAT;
 			if (temp_panic) {
 				printk (KERN_INFO PFX "Temperature overheat trip!\n");
@@ -455,9 +459,16 @@

 static int pcwd_clear_status(void)
 {
+	int control_status;
+
 	if (pcwd_private.revision == PCWD_REVISION_C) {
 		spin_lock(&pcwd_private.io_lock);
-		outb_p(0x00, pcwd_private.io_addr + 1); /* clear reset status */
+
+		control_status = inb_p(pcwd_private.io_addr + 1);
+
+		/* clear reset status & Keep Relay 2 disable state as it is */
+		outb_p((control_status & WD_REVC_R2DS), pcwd_private.io_addr + 1);
+
 		spin_unlock(&pcwd_private.io_lock);
 	}
 	return 0;


clocksource: sh_cmt: Remove unnecessary OOM messages

The site-specific OOM messages are unnecessary, because they
duplicate the MM subsystem generic OOM message.

[dlezcano] : refreshed against latest modifications: kmalloc -> kzalloc

Signed-off-by: Jingoo Han <fc379137a64feb86ce38ec5811a14280acc1ccfc@samsung.com>
Signed-off-by: Daniel Lezcano <e9fa45941f2ebe89c1b9d6c5f339ab42eadb8567@linaro.org>

--- drivers/clocksource/sh_cmt.c
+++ drivers/clocksource/sh_cmt.c
@@ -1106,10 +1106,8 @@
 	}

 	cmt = kzalloc(sizeof(*cmt), GFP_KERNEL);
-	if (cmt == NULL) {
-		dev_err(&pdev->dev, "failed to allocate driver data\n");
+	if (cmt == NULL)
 		return -ENOMEM;
-	}

 	ret = sh_cmt_setup(cmt, pdev);
 	if (ret) {


gpio: mcp23s08: Eliminates redundant checking.

Unnecessary checking was added during the merge of the gpio branch.
This patch removes the extra unnecessary checking.

Signed-off-by: Michael Welling <0be6b46d22db2f730b2107511aee020d642b52a4@ieee.org>
Signed-off-by: Linus Walleij <9cd9d802d23c0ed5e224beabf4ae4a5c478746ef@linaro.org>

--- drivers/gpio/gpio-mcp23s08.c
+++ drivers/gpio/gpio-mcp23s08.c
@@ -900,8 +900,6 @@
 			if (spi_present_mask & (1 << addr))
 				chips++;
 		}
-		if (!chips)
-			return -ENODEV;
 	} else {
 		type = spi_get_device_id(spi)->driver_data;
 		pdata = dev_get_platdata(&spi->dev);
@@ -940,10 +938,6 @@
 		if (!(spi_present_mask & (1 << addr)))
 			continue;
 		chips--;
-		if (chips < 0) {
-			dev_err(&spi->dev, "FATAL: invalid negative chip id\n");
-			goto fail;
-		}
 		data->mcp[addr] = &data->chip[chips];
 		status = mcp23s08_probe_one(data->mcp[addr], &spi->dev, spi,
 					    0x40 | (addr << 1), type, base,


drm/ttm: handle OOM in ttm_tt_swapout

drm/ttm: handle OOM in ttm_tt_swapout

- Without this change I get a general protection fault.
- Also use PTR_ERR where applicable.

Signed-off-by: Maarten Maathuis <1b771fd801ced5cd2f084249253ddbe77757dff5@gmail.com>
Reviewed-by: Dave Airlie <f2295d84e358395675bc8031be58672073ae065e@redhat.com>
Acked-by: Thomas Hellstrom <a26490dfbee4be3d38287ad6448444504f58193c@vmware.com>
Cc: 4fbacc2fa0ffdbb11bf1ad6925b886ebd08dd15f@kernel.org
Signed-off-by: Dave Airlie <f2295d84e358395675bc8031be58672073ae065e@redhat.com>

--- drivers/gpu/drm/ttm/ttm_tt.c
+++ drivers/gpu/drm/ttm/ttm_tt.c
@@ -476,7 +476,7 @@
 	void *from_virtual;
 	void *to_virtual;
 	int i;
-	int ret;
+	int ret = -ENOMEM;

 	if (ttm->page_flags & TTM_PAGE_FLAG_USER) {
 		ret = ttm_tt_set_user(ttm, ttm->tsk, ttm->start,
@@ -495,8 +495,10 @@

 	for (i = 0; i < ttm->num_pages; ++i) {
 		from_page = read_mapping_page(swap_space, i, NULL);
-		if (IS_ERR(from_page))
+		if (IS_ERR(from_page)) {
+			ret = PTR_ERR(from_page);
 			goto out_err;
+		}
 		to_page = __ttm_tt_get_page(ttm, i);
 		if (unlikely(to_page == NULL))
 			goto out_err;
@@ -519,7 +521,7 @@
 	return 0;
 out_err:
 	ttm_tt_free_alloced_pages(ttm);
-	return -ENOMEM;
+	return ret;
 }

 int ttm_tt_swapout(struct ttm_tt *ttm, struct file *persistant_swap_storage)
@@ -531,6 +533,7 @@
 	void *from_virtual;
 	void *to_virtual;
 	int i;
+	int ret = -ENOMEM;

 	BUG_ON(ttm->state != tt_unbound && ttm->state != tt_unpopulated);
 	BUG_ON(ttm->caching_state != tt_cached);
@@ -553,7 +556,7 @@
 						0);
 		if (unlikely(IS_ERR(swap_storage))) {
 			printk(KERN_ERR "Failed allocating swap storage.\n");
-			return -ENOMEM;
+			return PTR_ERR(swap_storage);
 		}
 	} else
 		swap_storage = persistant_swap_storage;
@@ -565,9 +568,10 @@
 		if (unlikely(from_page == NULL))
 			continue;
 		to_page = read_mapping_page(swap_space, i, NULL);
-		if (unlikely(to_page == NULL))
+		if (unlikely(IS_ERR(to_page))) {
+			ret = PTR_ERR(to_page);
 			goto out_err;
-
+		}
 		preempt_disable();
 		from_virtual = kmap_atomic(from_page, KM_USER0);
 		to_virtual = kmap_atomic(to_page, KM_USER1);
@@ -591,5 +595,5 @@
 	if (!persistant_swap_storage)
 		fput(swap_storage);

-	return -ENOMEM;
-}
+	return ret;
+}


i2c-pxa.c: timeouts off by 1

i2c-pxa.c: timeouts off by 1

With `while (timeout--)' timeout reaches -1 after the loop, so the tests
below are off by one.

Signed-off-by: Roel Kluin <aa9c6213291cec1ff07688554fb7b904b9ffe4e3@gmail.com>
Acked-by: Wolfram Sang <3883f8aab0424a154a3bcb43ff874b819786efbe@pengutronix.de>
Signed-off-by: Ben Dooks <1177f64998f284a7348354b8e91cbbe575d9858a@fluff.org>

--- drivers/i2c/busses/i2c-pxa.c
+++ drivers/i2c/busses/i2c-pxa.c
@@ -265,10 +265,10 @@
 		show_state(i2c);
 	}

-	if (timeout <= 0)
+	if (timeout < 0)
 		show_state(i2c);

-	return timeout <= 0 ? I2C_RETRY : 0;
+	return timeout < 0 ? I2C_RETRY : 0;
 }

 static int i2c_pxa_wait_master(struct pxa_i2c *i2c)
@@ -612,7 +612,7 @@
 		show_state(i2c);
 	}

-	if (timeout <= 0) {
+	if (timeout < 0) {
 		show_state(i2c);
 		dev_err(&i2c->adap.dev,
 			"i2c_pxa: timeout waiting for bus free\n");


Input: ims-pcu - fix a memory leak on error

Reported-by: Dan Carpenter <ff341aa343d564f9e53e9dcb6996be8c04859a66@oracle.com>
Signed-off-by: Dmitry Torokhov <6b8646d310837fed93a129ed3c979b90c7f2674f@gmail.com>

--- drivers/input/misc/ims-pcu.c
+++ drivers/input/misc/ims-pcu.c
@@ -292,7 +292,8 @@
 	if (!gamepad || !input) {
 		dev_err(pcu->dev,
 			"Not enough memory for gamepad device\n");
-		return -ENOMEM;
+		error = -ENOMEM;
+		goto err_free_mem;
 	}

 	gamepad->input = input;
@@ -1156,7 +1157,7 @@
 {
 	struct usb_interface *intf = to_usb_interface(dev);
 	struct ims_pcu *pcu = usb_get_intfdata(intf);
-	const struct firmware *fw;
+	const struct firmware *fw = NULL;
 	int value;
 	int error;


ACPI: thinkpad-acpi: trivial fix of error message

Trivial fix makes the error message match the code before it (ibm->driver
vs ibm->acpi-driver) better.

Signed-off-by: Mariusz Kozlowski <5702b3f6ed7bf13b13f30a976dbb318af82515c3@tuxland.pl>
Acked-by: Henrique de Moraes Holschuh <1416ae054606eb9be8fa0d7696a4ddff667a3601@hmh.eng.br>
Signed-off-by: Len Brown <b060cfa1096cc6e8be83699ddb4ed8a77dd63af5@intel.com>

--- drivers/misc/thinkpad_acpi.c
+++ drivers/misc/thinkpad_acpi.c
@@ -582,7 +582,8 @@

 	ibm->acpi->driver = kzalloc(sizeof(struct acpi_driver), GFP_KERNEL);
 	if (!ibm->acpi->driver) {
-		printk(TPACPI_ERR "kzalloc(ibm->driver) failed\n");
+		printk(TPACPI_ERR
+		       "failed to allocate memory for ibm->acpi->driver\n");
 		return -ENOMEM;
 	}


atmel-mci: Implement tasklet as a state machine

With the current system of completed/pending events, things may get
handled in different order depending on which event triggers first. For
example, if the data transfer is complete before the command, the stop
command must be sent after the command is complete, not the data. This
creates a bit of complexity around the stop command.

By having the tasklet go through a sequence of clearly defined states,
things always happen in a certain order even if the events come at
different times, so the stop command can simply be sent when we exit the
"sending data" state because we will never enter that state before the
command has been sent successfully.

Signed-off-by: Haavard Skinnemoen <af8c0cf3411930951fa86926b241df32af99fdb9@atmel.com>

--- drivers/mmc/host/atmel-mci.c
+++ drivers/mmc/host/atmel-mci.c
@@ -36,11 +36,17 @@

 enum {
 	EVENT_CMD_COMPLETE = 0,
+	EVENT_XFER_COMPLETE,
+	EVENT_DATA_COMPLETE,
 	EVENT_DATA_ERROR,
-	EVENT_DATA_COMPLETE,
-	EVENT_STOP_SENT,
-	EVENT_STOP_COMPLETE,
-	EVENT_XFER_COMPLETE,
+};
+
+enum atmel_mci_state {
+	STATE_SENDING_CMD = 0,
+	STATE_SENDING_DATA,
+	STATE_DATA_BUSY,
+	STATE_SENDING_STOP,
+	STATE_DATA_ERROR,
 };

 struct atmel_mci {
@@ -56,7 +62,6 @@

 	u32			cmd_status;
 	u32			data_status;
-	u32			stop_status;
 	u32			stop_cmdr;

 	u32			mode_reg;
@@ -65,6 +70,7 @@
 	struct tasklet_struct	tasklet;
 	unsigned long		pending_events;
 	unsigned long		completed_events;
+	enum atmel_mci_state	state;

 	int			present;
 	int			detect_pin;
@@ -79,18 +85,12 @@
 	struct platform_device	*pdev;
 };

-#define atmci_is_completed(host, event)				\
-	test_bit(event, &host->completed_events)
 #define atmci_test_and_clear_pending(host, event)		\
 	test_and_clear_bit(event, &host->pending_events)
-#define atmci_test_and_set_completed(host, event)		\
-	test_and_set_bit(event, &host->completed_events)
 #define atmci_set_completed(host, event)			\
 	set_bit(event, &host->completed_events)
 #define atmci_set_pending(host, event)				\
 	set_bit(event, &host->pending_events)
-#define atmci_clear_pending(host, event)			\
-	clear_bit(event, &host->pending_events)

 /*
  * The debugfs stuff below is mostly optimized away when
@@ -258,6 +258,10 @@
 	if (!node)
 		goto err;

+	node = debugfs_create_u32("state", S_IRUSR, root, (u32 *)&host->state);
+	if (!node)
+		goto err;
+
 	node = debugfs_create_x32("pending_events", S_IRUSR, root,
 				     (u32 *)&host->pending_events);
 	if (!node)
@@ -378,8 +382,6 @@
 				struct mmc_command *cmd,
 				u32 cmd_flags)
 {
-	/* Must read host->cmd after testing event flags */
-	smp_rmb();
 	WARN_ON(host->cmd);
 	host->cmd = cmd;

@@ -472,6 +474,7 @@
 	host->mrq = mrq;
 	host->pending_events = 0;
 	host->completed_events = 0;
+	host->state = STATE_SENDING_CMD;

 	atmci_enable(host);

@@ -596,8 +599,10 @@
 };

 static void atmci_command_complete(struct atmel_mci *host,
-			struct mmc_command *cmd, u32 status)
-{
+			struct mmc_command *cmd)
+{
+	u32		status = host->cmd_status;
+
 	/* Read the response from the card (up to 16 bytes) */
 	cmd->resp[0] = mci_readl(host, RSPR);
 	cmd->resp[1] = mci_readl(host, RSPR);
@@ -666,20 +671,32 @@
 			 * commands or data transfers.
 			 */
 			mci_writel(host, CR, MCI_CR_SWRST);
-
-			if (!atmci_is_completed(host, EVENT_CMD_COMPLETE))
+			mci_readl(host, SR);
+
+			host->data = NULL;
+			host->cmd = NULL;
+
+			switch (host->state) {
+			case STATE_SENDING_CMD:
 				mrq->cmd->error = -ENOMEDIUM;
-
-			if (mrq->data && !atmci_is_completed(host,
-						EVENT_DATA_COMPLETE)) {
-				host->data = NULL;
+				if (!mrq->data)
+					break;
+				/* fall through */
+			case STATE_SENDING_DATA:
 				mrq->data->error = -ENOMEDIUM;
+				break;
+			case STATE_DATA_BUSY:
+			case STATE_DATA_ERROR:
+				if (mrq->data->error == -EINPROGRESS)
+					mrq->data->error = -ENOMEDIUM;
+				if (!mrq->stop)
+					break;
+				/* fall through */
+			case STATE_SENDING_STOP:
+				mrq->stop->error = -ENOMEDIUM;
+				break;
 			}
-			if (mrq->stop && !atmci_is_completed(host,
-						EVENT_STOP_COMPLETE))
-				mrq->stop->error = -ENOMEDIUM;
-
-			host->cmd = NULL;
+
 			atmci_request_end(host->mmc, mrq);
 		}

@@ -693,81 +710,116 @@
 	struct atmel_mci	*host = mmc_priv(mmc);
 	struct mmc_request	*mrq = host->mrq;
 	struct mmc_data		*data = host->data;
+	struct mmc_command	*cmd = host->cmd;
+	enum atmel_mci_state	state = host->state;
+	enum atmel_mci_state	prev_state;
+	u32			status;
+
+	state = host->state;

 	dev_vdbg(&mmc->class_dev,
-		"tasklet: pending/completed/mask %lx/%lx/%x\n",
-		host->pending_events, host->completed_events,
+		"tasklet: state %u pending/completed/mask %lx/%lx/%x\n",
+		state, host->pending_events, host->completed_events,
 		mci_readl(host, IMR));

-	if (atmci_test_and_clear_pending(host, EVENT_CMD_COMPLETE)) {
-		/*
-		 * host->cmd must be set to NULL before the interrupt
-		 * handler sees EVENT_CMD_COMPLETE
-		 */
-		host->cmd = NULL;
-		smp_wmb();
-		atmci_set_completed(host, EVENT_CMD_COMPLETE);
-		atmci_command_complete(host, mrq->cmd, host->cmd_status);
-
-		if (!mrq->cmd->error && mrq->stop
-				&& atmci_is_completed(host, EVENT_XFER_COMPLETE)
-				&& !atmci_test_and_set_completed(host,
-					EVENT_STOP_SENT))
-			send_stop_cmd(host->mmc, mrq->data);
-	}
-	if (atmci_test_and_clear_pending(host, EVENT_STOP_COMPLETE)) {
-		/*
-		 * host->cmd must be set to NULL before the interrupt
-		 * handler sees EVENT_STOP_COMPLETE
-		 */
-		host->cmd = NULL;
-		smp_wmb();
-		atmci_set_completed(host, EVENT_STOP_COMPLETE);
-		atmci_command_complete(host, mrq->stop, host->stop_status);
-	}
-	if (atmci_test_and_clear_pending(host, EVENT_DATA_ERROR)) {
-		u32 status = host->data_status;
-
-		dev_vdbg(&mmc->class_dev, "data error: status=%08x\n", status);
-
-		atmci_set_completed(host, EVENT_DATA_ERROR);
-		atmci_set_completed(host, EVENT_DATA_COMPLETE);
-
-		if (status & MCI_DTOE) {
-			dev_dbg(&mmc->class_dev,
-					"data timeout error\n");
-			data->error = -ETIMEDOUT;
-		} else if (status & MCI_DCRCE) {
-			dev_dbg(&mmc->class_dev, "data CRC error\n");
-			data->error = -EILSEQ;
-		} else {
-			dev_dbg(&mmc->class_dev,
-					"data FIFO error (status=%08x)\n",
-					status);
-			data->error = -EIO;
-		}
-
-		if (host->present && data->stop
-				&& atmci_is_completed(host, EVENT_CMD_COMPLETE)
-				&& !atmci_test_and_set_completed(
-					host, EVENT_STOP_SENT))
-			send_stop_cmd(host->mmc, data);
-
-		host->data = NULL;
-	}
-	if (atmci_test_and_clear_pending(host, EVENT_DATA_COMPLETE)) {
-		atmci_set_completed(host, EVENT_DATA_COMPLETE);
-
-		if (!atmci_is_completed(host, EVENT_DATA_ERROR)) {
-			data->bytes_xfered = data->blocks * data->blksz;
-			data->error = 0;
-		}
-
-		host->data = NULL;
-	}
-
-	if (host->mrq && !host->cmd && !host->data)
-		atmci_request_end(mmc, host->mrq);
+	do {
+		prev_state = state;
+
+		switch (state) {
+		case STATE_SENDING_CMD:
+			if (!atmci_test_and_clear_pending(host,
+						EVENT_CMD_COMPLETE))
+				break;
+
+			host->cmd = NULL;
+			atmci_set_completed(host, EVENT_CMD_COMPLETE);
+			atmci_command_complete(host, mrq->cmd);
+			if (!mrq->data || cmd->error) {
+				atmci_request_end(mmc, host->mrq);
+				break;
+			}
+
+			prev_state = state = STATE_SENDING_DATA;
+			/* fall through */
+
+		case STATE_SENDING_DATA:
+			if (atmci_test_and_clear_pending(host,
+						EVENT_DATA_ERROR)) {
+				if (data->stop)
+					send_stop_cmd(host->mmc, data);
+				state = STATE_DATA_ERROR;
+				break;
+			}
+
+			if (!atmci_test_and_clear_pending(host,
+						EVENT_XFER_COMPLETE))
+				break;
+
+			atmci_set_completed(host, EVENT_XFER_COMPLETE);
+			prev_state = state = STATE_DATA_BUSY;
+			/* fall through */
+
+		case STATE_DATA_BUSY:
+			if (!atmci_test_and_clear_pending(host,
+						EVENT_DATA_COMPLETE))
+				break;
+
+			host->data = NULL;
+			atmci_set_completed(host, EVENT_DATA_COMPLETE);
+			status = host->data_status;
+			if (unlikely(status & ATMCI_DATA_ERROR_FLAGS)) {
+				if (status & MCI_DTOE) {
+					dev_dbg(&mmc->class_dev,
+							"data timeout error\n");
+					data->error = -ETIMEDOUT;
+				} else if (status & MCI_DCRCE) {
+					dev_dbg(&mmc->class_dev,
+							"data CRC error\n");
+					data->error = -EILSEQ;
+				} else {
+					dev_dbg(&mmc->class_dev,
+						"data FIFO error (status=%08x)\n",
+						status);
+					data->error = -EIO;
+				}
+			} else {
+				data->bytes_xfered = data->blocks * data->blksz;
+				data->error = 0;
+			}
+
+			if (!data->stop) {
+				atmci_request_end(mmc, host->mrq);
+				prev_state = state;
+				break;
+			}
+
+			prev_state = state = STATE_SENDING_STOP;
+			if (!data->error)
+				send_stop_cmd(host->mmc, data);
+			/* fall through */
+
+		case STATE_SENDING_STOP:
+			if (!atmci_test_and_clear_pending(host,
+						EVENT_CMD_COMPLETE))
+				break;
+
+			host->cmd = NULL;
+			atmci_command_complete(host, mrq->stop);
+			atmci_request_end(mmc, host->mrq);
+			prev_state = state;
+			break;
+
+		case STATE_DATA_ERROR:
+			if (!atmci_test_and_clear_pending(host,
+						EVENT_XFER_COMPLETE))
+				break;
+
+			state = STATE_DATA_BUSY;
+			break;
+		}
+	} while (state != prev_state);
+
+	host->state = state;
 }

 static void atmci_read_data_pio(struct atmel_mci *host)
@@ -832,10 +884,7 @@
 	mci_writel(host, IDR, MCI_RXRDY);
 	mci_writel(host, IER, MCI_NOTBUSY);
 	data->bytes_xfered += nbytes;
-	atmci_set_completed(host, EVENT_XFER_COMPLETE);
-	if (data->stop && atmci_is_completed(host, EVENT_CMD_COMPLETE)
-			&& !atmci_test_and_set_completed(host, EVENT_STOP_SENT))
-		send_stop_cmd(host->mmc, data);
+	atmci_set_pending(host, EVENT_XFER_COMPLETE);
 }

 static void atmci_write_data_pio(struct atmel_mci *host)
@@ -903,10 +952,7 @@
 	mci_writel(host, IDR, MCI_TXRDY);
 	mci_writel(host, IER, MCI_NOTBUSY);
 	data->bytes_xfered += nbytes;
-	atmci_set_completed(host, EVENT_XFER_COMPLETE);
-	if (data->stop && atmci_is_completed(host, EVENT_CMD_COMPLETE)
-			&& !atmci_test_and_set_completed(host, EVENT_STOP_SENT))
-		send_stop_cmd(host->mmc, data);
+	atmci_set_pending(host, EVENT_XFER_COMPLETE);
 }

 static void atmci_cmd_interrupt(struct mmc_host *mmc, u32 status)
@@ -915,14 +961,8 @@

 	mci_writel(host, IDR, MCI_CMDRDY);

-	if (atmci_is_completed(host, EVENT_STOP_SENT)) {
-		host->stop_status = status;
-		atmci_set_pending(host, EVENT_STOP_COMPLETE);
-	} else {
-		host->cmd_status = status;
-		atmci_set_pending(host, EVENT_CMD_COMPLETE);
-	}
-
+	host->cmd_status = status;
+	atmci_set_pending(host, EVENT_CMD_COMPLETE);
 	tasklet_schedule(&host->tasklet);
 }

@@ -951,8 +991,9 @@
 			tasklet_schedule(&host->tasklet);
 		}
 		if (pending & MCI_NOTBUSY) {
-			mci_writel(host, IDR, (MCI_NOTBUSY
-					       | ATMCI_DATA_ERROR_FLAGS));
+			mci_writel(host, IDR,
+					ATMCI_DATA_ERROR_FLAGS | MCI_NOTBUSY);
+			host->data_status = status;
 			atmci_set_pending(host, EVENT_DATA_COMPLETE);
 			tasklet_schedule(&host->tasklet);
 		}


mmc: sdhci-pci: Fix checkpatch.pl errors

This patch fixes 21 errors and 6 warnings reported by checkpatch.pl.

Signed-off-by: Ameya Palande <1ec51643a46aeb92a9c63dec12e2f70df0866c25@gmail.com>
Reviewed-by: Wolfram Sang <3883f8aab0424a154a3bcb43ff874b819786efbe@pengutronix.de>
Signed-off-by: Chris Ball <6ca7faee6ca9a094b1ee341f11b840a5608a8746@laptop.org>

--- drivers/mmc/host/sdhci-pci.c
+++ drivers/mmc/host/sdhci-pci.c
@@ -18,11 +18,9 @@
 #include <linux/dma-mapping.h>
 #include <linux/slab.h>
 #include <linux/device.h>
-
 #include <linux/mmc/host.h>
-
-#include <asm/scatterlist.h>
-#include <asm/io.h>
+#include <linux/scatterlist.h>
+#include <linux/io.h>

 #include "sdhci.h"

@@ -46,14 +44,14 @@
 struct sdhci_pci_fixes {
 	unsigned int		quirks;

-	int			(*probe)(struct sdhci_pci_chip*);
-
-	int			(*probe_slot)(struct sdhci_pci_slot*);
-	void			(*remove_slot)(struct sdhci_pci_slot*, int);
-
-	int			(*suspend)(struct sdhci_pci_chip*,
+	int			(*probe) (struct sdhci_pci_chip *);
+
+	int			(*probe_slot) (struct sdhci_pci_slot *);
+	void			(*remove_slot) (struct sdhci_pci_slot *, int);
+
+	int			(*suspend) (struct sdhci_pci_chip *,
 					pm_message_t);
-	int			(*resume)(struct sdhci_pci_chip*);
+	int			(*resume) (struct sdhci_pci_chip *);
 };

 struct sdhci_pci_slot {
@@ -402,7 +400,7 @@

 	if (chip->pdev->device == PCI_DEVICE_ID_JMICRON_JMB38X_MMC ||
 	    chip->pdev->device == PCI_DEVICE_ID_JMICRON_JMB388_ESD) {
-		for (i = 0;i < chip->num_slots;i++)
+		for (i = 0; i < chip->num_slots; i++)
 			jmicron_enable_mmc(chip->slots[i]->host, 0);
 	}

@@ -415,7 +413,7 @@

 	if (chip->pdev->device == PCI_DEVICE_ID_JMICRON_JMB38X_MMC ||
 	    chip->pdev->device == PCI_DEVICE_ID_JMICRON_JMB388_ESD) {
-		for (i = 0;i < chip->num_slots;i++)
+		for (i = 0; i < chip->num_slots; i++)
 			jmicron_enable_mmc(chip->slots[i]->host, 1);
 	}

@@ -798,7 +796,7 @@

 #ifdef CONFIG_PM

-static int sdhci_pci_suspend (struct pci_dev *pdev, pm_message_t state)
+static int sdhci_pci_suspend(struct pci_dev *pdev, pm_message_t state)
 {
 	struct sdhci_pci_chip *chip;
 	struct sdhci_pci_slot *slot;
@@ -810,7 +808,7 @@
 	if (!chip)
 		return 0;

-	for (i = 0;i < chip->num_slots;i++) {
+	for (i = 0; i < chip->num_slots; i++) {
 		slot = chip->slots[i];
 		if (!slot)
 			continue;
@@ -818,7 +816,7 @@
 		ret = sdhci_suspend_host(slot->host, state);

 		if (ret) {
-			for (i--;i >= 0;i--)
+			for (i--; i >= 0; i--)
 				sdhci_resume_host(chip->slots[i]->host);
 			return ret;
 		}
@@ -833,7 +831,7 @@
 	if (chip->fixes && chip->fixes->suspend) {
 		ret = chip->fixes->suspend(chip, state);
 		if (ret) {
-			for (i = chip->num_slots - 1;i >= 0;i--)
+			for (i = chip->num_slots - 1; i >= 0; i--)
 				sdhci_resume_host(chip->slots[i]->host);
 			return ret;
 		}
@@ -855,7 +853,7 @@
 	return 0;
 }

-static int sdhci_pci_resume (struct pci_dev *pdev)
+static int sdhci_pci_resume(struct pci_dev *pdev)
 {
 	struct sdhci_pci_chip *chip;
 	struct sdhci_pci_slot *slot;
@@ -877,7 +875,7 @@
 			return ret;
 	}

-	for (i = 0;i < chip->num_slots;i++) {
+	for (i = 0; i < chip->num_slots; i++) {
 		slot = chip->slots[i];
 		if (!slot)
 			continue;
@@ -1059,7 +1057,7 @@
 	}

 	chip->pdev = pdev;
-	chip->fixes = (const struct sdhci_pci_fixes*)ent->driver_data;
+	chip->fixes = (const struct sdhci_pci_fixes *)ent->driver_data;
 	if (chip->fixes)
 		chip->quirks = chip->fixes->quirks;
 	chip->num_slots = slots;
@@ -1074,10 +1072,10 @@

 	slots = chip->num_slots;	/* Quirk may have changed this */

-	for (i = 0;i < slots;i++) {
+	for (i = 0; i < slots; i++) {
 		slot = sdhci_pci_probe_slot(pdev, chip, first_bar + i);
 		if (IS_ERR(slot)) {
-			for (i--;i >= 0;i--)
+			for (i--; i >= 0; i--)
 				sdhci_pci_remove_slot(chip->slots[i]);
 			ret = PTR_ERR(slot);
 			goto free;
@@ -1105,7 +1103,7 @@
 	chip = pci_get_drvdata(pdev);

 	if (chip) {
-		for (i = 0;i < chip->num_slots; i++)
+		for (i = 0; i < chip->num_slots; i++)
 			sdhci_pci_remove_slot(chip->slots[i]);

 		pci_set_drvdata(pdev, NULL);
@@ -1116,9 +1114,9 @@
 }

 static struct pci_driver sdhci_driver = {
-	.name = 	"sdhci-pci",
+	.name =		"sdhci-pci",
 	.id_table =	pci_ids,
-	.probe = 	sdhci_pci_probe,
+	.probe =	sdhci_pci_probe,
 	.remove =	__devexit_p(sdhci_pci_remove),
 	.suspend =	sdhci_pci_suspend,
 	.resume	=	sdhci_pci_resume,


mmc: sdhci-pci: allow 8-bit bus width for Intel PCH

Signed-off-by: Alexander Stein <dbef83f64948dc68aad31596bbf6991154a9d730@systec-electronic.com>
Signed-off-by: Chris Ball <6ca7faee6ca9a094b1ee341f11b840a5608a8746@laptop.org>

--- drivers/mmc/host/sdhci-pci.c
+++ drivers/mmc/host/sdhci-pci.c
@@ -29,6 +29,12 @@
 #include "sdhci.h"

 /*
+ * PCI device IDs
+ */
+#define PCI_DEVICE_ID_INTEL_PCH_SDIO0	0x8809
+#define PCI_DEVICE_ID_INTEL_PCH_SDIO1	0x880a
+
+/*
  * PCI registers
  */

@@ -174,6 +180,12 @@
 	return 0;
 }

+static int pch_hc_probe_slot(struct sdhci_pci_slot *slot)
+{
+	slot->host->mmc->caps |= MMC_CAP_8_BIT_DATA;
+	return 0;
+}
+
 #ifdef CONFIG_PM_RUNTIME

 static irqreturn_t sdhci_pci_sd_cd(int irq, void *dev_id)
@@ -283,6 +295,11 @@
 	.quirks		= SDHCI_QUIRK_NO_ENDATTR_IN_NOPDESC,
 	.allow_runtime_pm = true,
 	.probe_slot	= mfd_emmc_probe_slot,
+};
+
+static const struct sdhci_pci_fixes sdhci_intel_pch_sdio = {
+	.quirks		= SDHCI_QUIRK_BROKEN_ADMA,
+	.probe_slot	= pch_hc_probe_slot,
 };

 /* O2Micro extra registers */
@@ -821,6 +838,22 @@
 	},

 	{
+		.vendor		= PCI_VENDOR_ID_INTEL,
+		.device		= PCI_DEVICE_ID_INTEL_PCH_SDIO0,
+		.subvendor	= PCI_ANY_ID,
+		.subdevice	= PCI_ANY_ID,
+		.driver_data	= (kernel_ulong_t)&sdhci_intel_pch_sdio,
+	},
+
+	{
+		.vendor		= PCI_VENDOR_ID_INTEL,
+		.device		= PCI_DEVICE_ID_INTEL_PCH_SDIO1,
+		.subvendor	= PCI_ANY_ID,
+		.subdevice	= PCI_ANY_ID,
+		.driver_data	= (kernel_ulong_t)&sdhci_intel_pch_sdio,
+	},
+
+	{
 		.vendor		= PCI_VENDOR_ID_O2,
 		.device		= PCI_DEVICE_ID_O2_8120,
 		.subvendor	= PCI_ANY_ID,


mtd: chips: Add support for GigaDevice GD25Q32/GD25Q64 SPI Flash in m25p80.c

Add support for GigaDevice GD25Q32 32 Mbit (4 MB) SPI Flash (see datasheet:
http://www.gigadevice.com/UserFiles/GD25Q32_Rev0.2(1).pdf) used in Hame MPR-A1
and clones, and for GigaDevice GD25Q64 64 Mbit (8 MB) SPI Flash used in
Hame MPR-A2 devices (datasheet: http://www.gigadevice.com/UserFiles/GD25Q64.pdf).

Signed-off-by: Michel Stempin <2708fb3aa6588b54aa4021e2cea13b53012e4fb6@wanadoo.fr>
Signed-off-by: Artem Bityutskiy <2f96f8cd3e2780a209d0ab27d1b44624d0019d3f@linux.intel.com>


mtd: m25p80: use ofpart through generic parsing

Convert the driver to use ofpart partitions parsing through the generic
parse_mtd_partitions().

Signed-off-by: Dmitry Eremin-Solenikov <b6edad08270b2e4ffbcb0879e25a0e29a48c5275@gmail.com>
Signed-off-by: Artem Bityutskiy <47df67c0fd8cbe8b1012edad99e6694575a29d40@gmail.com>

--- drivers/mtd/devices/m25p80.c
+++ drivers/mtd/devices/m25p80.c
@@ -827,6 +827,7 @@
 	unsigned			i;
 	struct mtd_partition		*parts = NULL;
 	int				nr_parts = 0;
+	struct mtd_part_parser_data	ppdata;

 	/* Platform data helps sort out which chip type we have, as
 	 * well as how this board partitions it.  If we don't have
@@ -928,6 +929,7 @@
 	if (info->flags & M25P_NO_ERASE)
 		flash->mtd.flags |= MTD_NO_ERASE;

+	ppdata.of_node = spi->dev.of_node;
 	flash->mtd.dev.parent = &spi->dev;
 	flash->page_size = info->page_size;

@@ -968,19 +970,12 @@
 	/* partitions should match sector boundaries; and it may be good to
 	 * use readonly partitions for writeprotected sectors (BP2..BP0).
 	 */
-	nr_parts = parse_mtd_partitions(&flash->mtd, NULL, &parts, 0);
+	nr_parts = parse_mtd_partitions(&flash->mtd, NULL, &parts, &ppdata);

 	if (nr_parts <= 0 && data && data->parts) {
 		parts = data->parts;
 		nr_parts = data->nr_parts;
 	}
-
-#ifdef CONFIG_MTD_OF_PARTS
-	if (nr_parts <= 0 && spi->dev.of_node) {
-		nr_parts = of_mtd_parse_partitions(&spi->dev,
-						   spi->dev.of_node, &parts);
-	}
-#endif

 	if (nr_parts > 0) {
 		for (i = 0; i < nr_parts; i++) {


mtd: m25p80: add Macronix mx66l1g55g 1Gbit SPI flash

Signed-off-by: Brian Norris <ac73eed4b8a8c9127255a2696c52b2e7503720b8@gmail.com>
Acked-by: Marek Vasut <f40600653b33f5282fa4c5daf377dfc444fb4625@denx.de>


mtd: vmu-flash: Use hweight_long

mtd: vmu-flash: Use hweight_long

Use hweight_long instead of Brian Kernighan's/Peter Wegner's method

Signed-off-by: Akinobu Mita <3807cf899f217da549814bf6c330d3b6e6819ccf@gmail.com>
Signed-off-by: David Woodhouse <b460d66aaf00c296a3db1c1d9eeafc081d5f7d70@intel.com>

--- drivers/mtd/maps/vmu-flash.c
+++ drivers/mtd/maps/vmu-flash.c
@@ -612,10 +612,9 @@

 	test_flash_data = be32_to_cpu(mdev->devinfo.function);
 	/* Need to count how many bits are set - to find out which
-	 * function_data element has details of the memory card:
-	 * using Brian Kernighan's/Peter Wegner's method */
-	for (c = 0; test_flash_data; c++)
-		test_flash_data &= test_flash_data - 1;
+	 * function_data element has details of the memory card
+	 */
+	c = hweight_long(test_flash_data);

 	basic_flash_data = be32_to_cpu(mdev->devinfo.function_data[c - 1]);


arcnet: capmode: remove extra function

arcnet: capmode: remove extra function

This patch cleans the capmode protocol module. It removes the obsolete
function arcnet_cap_init and replaces printk with pr_info.

Signed-off-by: Michael Grzeschik <56a917ffddddef251f53499c2bdc20635fcae7f7@pengutronix.de>

--- drivers/net/arcnet/capmode.c
+++ drivers/net/arcnet/capmode.c
@@ -238,9 +238,11 @@
 	.ack_tx		= ack_tx
 };

-static void arcnet_cap_init(void)
+static int __init capmode_module_init(void)
 {
 	int count;
+
+	pr_info("cap mode (`c') encapsulation support loaded\n");

 	for (count = 1; count <= 8; count++)
 		if (arc_proto_map[count] == arc_proto_default)
@@ -252,12 +254,7 @@

 	arc_proto_default = &capmode_proto;
 	arc_raw_proto = &capmode_proto;
-}
-
-static int __init capmode_module_init(void)
-{
-	pr_info("%s\n", "cap mode (`c') encapsulation support loaded");
-	arcnet_cap_init();
+
 	return 0;
 }


[PATCH] AT91RM9200 Ethernet: Use dev_alloc_skb()

Use dev_alloc_skb() instead of alloc_skb().

It is also not necessary to adjust skb->len manually since that's
already done by skb_put().

Signed-off-by: Andrew Victor <02e0a999c50b1f88df7a8f5a04e1b76b35ea6a88@sanpeople.com>
Signed-off-by: Jeff Garzik <f3e731dfa293c7a83119d8aacfa41b5d2d780be9@garzik.org>

--- drivers/net/arm/at91_ether.c
+++ drivers/net/arm/at91_ether.c
@@ -853,14 +853,13 @@
 	while (dlist->descriptors[lp->rxBuffIndex].addr & EMAC_DESC_DONE) {
 		p_recv = dlist->recv_buf[lp->rxBuffIndex];
 		pktlen = dlist->descriptors[lp->rxBuffIndex].size & 0x7ff;	/* Length of frame including FCS */
-		skb = alloc_skb(pktlen + 2, GFP_ATOMIC);
+		skb = dev_alloc_skb(pktlen + 2);
 		if (skb != NULL) {
 			skb_reserve(skb, 2);
 			memcpy(skb_put(skb, pktlen), p_recv, pktlen);

 			skb->dev = dev;
 			skb->protocol = eth_type_trans(skb, dev);
-			skb->len = pktlen;
 			dev->last_rx = jiffies;
 			lp->stats.rx_bytes += pktlen;
 			netif_rx(skb);


drivers/net/atl1/atl1_main.c: remove unused variable

The variable update_rx is initialized but never used otherwise.

The semantic patch that makes this change is as follows:
(http://www.emn.fr/x-info/coccinelle/)

// <smpl>
@@
type T;
identifier i;
constant C;
@@

(
extern T i;
|
- T i;
  <+... when != i
- i = C;
  ...+>
)
// </smpl>

Signed-off-by: Julia Lawall <b43b0ad1e8108e7ab870d7a54feac93ae8b8600e@diku.dk>
Acked-by: Jay Cliburn <d11bee250b03481f44fa3a0535527d169f2738a9@bellsouth.net>
Signed-off-by: Jeff Garzik <f3e731dfa293c7a83119d8aacfa41b5d2d780be9@garzik.org>

--- drivers/net/atl1/atl1_main.c
+++ drivers/net/atl1/atl1_main.c
@@ -1765,14 +1765,11 @@
 {
 	struct atl1_adapter *adapter = netdev_priv(data);
 	u32 status;
-	u8 update_rx;
 	int max_ints = 10;

 	status = adapter->cmb.cmb->int_stats;
 	if (!status)
 		return IRQ_NONE;
-
-	update_rx = 0;

 	do {
 		/* clear CMB interrupt status at once */


net/enic: fix Rx queue init after restarting a device

If you stop, then start a port that had already received some packets,
the NIC could fetch discriptors from the wrong location. This could
effectivly reduce the size of the Rx queue by a random amount and
cause packet drop or reduced performance.

Reset the NIC fetch index to 0 when allocating and posting mbuf
addresses to the NIC.

Fixes: 947d860c821f ("enic: improve Rx performance")

Signed-off-by: John Daley <097981eb5abe5dbeac3142a4f5a88742d916de86@cisco.com>
Reviewed-by: Nelson Escobar <921f6477015852c9d60fa5cb7e6a106f68b238db@cisco.com>

--- drivers/net/enic/enic_main.c
+++ drivers/net/enic/enic_main.c
@@ -334,6 +334,7 @@
 	dev_debug(enic, "port=%u, qidx=%u, Write %u posted idx, %u sw held\n",
 		enic->port_id, rq->index, rq->posted_index, rq->rx_nb_hold);
 	iowrite32(rq->posted_index, &rq->ctrl->posted_index);
+	iowrite32(0, &rq->ctrl->fetch_index);
 	rte_rmb();

 	return 0;


enic: bug fix: check for zero port MTU before posting warning

Nic firmware can return zero for port MTU, so check for non-zero value
before checking for change in port MTU.

Signed-off-by: Scott Feldman <449bf119f7579fb76e3031d058c77d976b1c4652@cisco.com>
Signed-off-by: David S. Miller <fe08d3c717adf2ae63592e4c9aec6e3e404d8e3e@davemloft.net>

--- drivers/net/enic/enic_main.c
+++ drivers/net/enic/enic_main.c
@@ -362,7 +362,7 @@
 {
 	u32 mtu = vnic_dev_mtu(enic->vdev);

-	if (mtu != enic->port_mtu) {
+	if (mtu && mtu != enic->port_mtu) {
 		if (mtu < enic->netdev->mtu)
 			printk(KERN_WARNING PFX
 				"%s: interface MTU (%d) set higher "


net/i40e: parse tunnel filter

net/i40e: parse tunnel filter

This patch adds i40e_flow_parse_tunnel_filter to check
if a rule is a tunnel rule according to items of the
flow pattern, and the function also gets the tunnel info.

Signed-off-by: Beilei Xing <7fb7e49de6d75fb4140bfcdada52e66859d93ebd@intel.com>
Acked-by: Jingjing Wu <64d28b617c3b4840f5ded1bfa611cba7fadfe5c7@intel.com>

--- drivers/net/i40e/i40e_flow.c
+++ drivers/net/i40e/i40e_flow.c
@@ -55,6 +55,8 @@
 #define I40E_IPV4_TC_SHIFT	4
 #define I40E_IPV6_TC_MASK	(0x00FF << I40E_IPV4_TC_SHIFT)
 #define I40E_IPV6_FRAG_HEADER	44
+#define I40E_TENANT_ARRAY_NUM	3
+#define I40E_TCI_MASK		0xFFFF

 static int i40e_flow_validate(struct rte_eth_dev *dev,
 			      const struct rte_flow_attr *attr,
@@ -78,6 +80,14 @@
 				       const struct rte_flow_action *actions,
 				       struct rte_flow_error *error,
 				       struct rte_eth_fdir_filter *filter);
+static int i40e_flow_parse_tunnel_pattern(__rte_unused struct rte_eth_dev *dev,
+				  const struct rte_flow_item *pattern,
+				  struct rte_flow_error *error,
+				  struct rte_eth_tunnel_filter_conf *filter);
+static int i40e_flow_parse_tunnel_action(struct rte_eth_dev *dev,
+				 const struct rte_flow_action *actions,
+				 struct rte_flow_error *error,
+				 struct rte_eth_tunnel_filter_conf *filter);
 static int i40e_flow_parse_attr(const struct rte_flow_attr *attr,
 				struct rte_flow_error *error);
 static int i40e_flow_parse_ethertype_filter(struct rte_eth_dev *dev,
@@ -92,6 +102,12 @@
 				       const struct rte_flow_action actions[],
 				       struct rte_flow_error *error,
 				       union i40e_filter_t *filter);
+static int i40e_flow_parse_tunnel_filter(struct rte_eth_dev *dev,
+					 const struct rte_flow_attr *attr,
+					 const struct rte_flow_item pattern[],
+					 const struct rte_flow_action actions[],
+					 struct rte_flow_error *error,
+					 union i40e_filter_t *filter);

 const struct rte_flow_ops i40e_flow_ops = {
 	.validate = i40e_flow_validate,
@@ -203,6 +219,45 @@
 	RTE_FLOW_ITEM_TYPE_ETH,
 	RTE_FLOW_ITEM_TYPE_IPV6,
 	RTE_FLOW_ITEM_TYPE_SCTP,
+	RTE_FLOW_ITEM_TYPE_END,
+};
+
+/* Pattern matched tunnel filter */
+static enum rte_flow_item_type pattern_vxlan_1[] = {
+	RTE_FLOW_ITEM_TYPE_ETH,
+	RTE_FLOW_ITEM_TYPE_IPV4,
+	RTE_FLOW_ITEM_TYPE_UDP,
+	RTE_FLOW_ITEM_TYPE_VXLAN,
+	RTE_FLOW_ITEM_TYPE_ETH,
+	RTE_FLOW_ITEM_TYPE_END,
+};
+
+static enum rte_flow_item_type pattern_vxlan_2[] = {
+	RTE_FLOW_ITEM_TYPE_ETH,
+	RTE_FLOW_ITEM_TYPE_IPV6,
+	RTE_FLOW_ITEM_TYPE_UDP,
+	RTE_FLOW_ITEM_TYPE_VXLAN,
+	RTE_FLOW_ITEM_TYPE_ETH,
+	RTE_FLOW_ITEM_TYPE_END,
+};
+
+static enum rte_flow_item_type pattern_vxlan_3[] = {
+	RTE_FLOW_ITEM_TYPE_ETH,
+	RTE_FLOW_ITEM_TYPE_IPV4,
+	RTE_FLOW_ITEM_TYPE_UDP,
+	RTE_FLOW_ITEM_TYPE_VXLAN,
+	RTE_FLOW_ITEM_TYPE_ETH,
+	RTE_FLOW_ITEM_TYPE_VLAN,
+	RTE_FLOW_ITEM_TYPE_END,
+};
+
+static enum rte_flow_item_type pattern_vxlan_4[] = {
+	RTE_FLOW_ITEM_TYPE_ETH,
+	RTE_FLOW_ITEM_TYPE_IPV6,
+	RTE_FLOW_ITEM_TYPE_UDP,
+	RTE_FLOW_ITEM_TYPE_VXLAN,
+	RTE_FLOW_ITEM_TYPE_ETH,
+	RTE_FLOW_ITEM_TYPE_VLAN,
 	RTE_FLOW_ITEM_TYPE_END,
 };

@@ -226,6 +281,11 @@
 	{ pattern_fdir_ipv6_tcp_ext, i40e_flow_parse_fdir_filter },
 	{ pattern_fdir_ipv6_sctp, i40e_flow_parse_fdir_filter },
 	{ pattern_fdir_ipv6_sctp_ext, i40e_flow_parse_fdir_filter },
+	/* tunnel */
+	{ pattern_vxlan_1, i40e_flow_parse_tunnel_filter },
+	{ pattern_vxlan_2, i40e_flow_parse_tunnel_filter },
+	{ pattern_vxlan_3, i40e_flow_parse_tunnel_filter },
+	{ pattern_vxlan_4, i40e_flow_parse_tunnel_filter },
 };

 #define NEXT_ITEM_OF_ACTION(act, actions, index)                        \
@@ -1045,6 +1105,358 @@
 	return 0;
 }

+/* Parse to get the action info of a tunnle filter
+ * Tunnel action only supports QUEUE.
+ */
+static int
+i40e_flow_parse_tunnel_action(struct rte_eth_dev *dev,
+			      const struct rte_flow_action *actions,
+			      struct rte_flow_error *error,
+			      struct rte_eth_tunnel_filter_conf *filter)
+{
+	struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+	const struct rte_flow_action *act;
+	const struct rte_flow_action_queue *act_q;
+	uint32_t index = 0;
+
+	/* Check if the first non-void action is QUEUE. */
+	NEXT_ITEM_OF_ACTION(act, actions, index);
+	if (act->type != RTE_FLOW_ACTION_TYPE_QUEUE) {
+		rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION,
+				   act, "Not supported action.");
+		return -rte_errno;
+	}
+
+	act_q = (const struct rte_flow_action_queue *)act->conf;
+	filter->queue_id = act_q->index;
+	if (filter->queue_id >= pf->dev_data->nb_rx_queues) {
+		rte_flow_error_set(error, EINVAL,
+				   RTE_FLOW_ERROR_TYPE_ACTION,
+				   act, "Invalid queue ID for tunnel filter");
+		return -rte_errno;
+	}
+
+	/* Check if the next non-void item is END */
+	index++;
+	NEXT_ITEM_OF_ACTION(act, actions, index);
+	if (act->type != RTE_FLOW_ACTION_TYPE_END) {
+		rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION,
+				   act, "Not supported action.");
+		return -rte_errno;
+	}
+
+	return 0;
+}
+
+static int
+i40e_check_tenant_id_mask(const uint8_t *mask)
+{
+	uint32_t j;
+	int is_masked = 0;
+
+	for (j = 0; j < I40E_TENANT_ARRAY_NUM; j++) {
+		if (*(mask + j) == UINT8_MAX) {
+			if (j > 0 && (*(mask + j) != *(mask + j - 1)))
+				return -EINVAL;
+			is_masked = 0;
+		} else if (*(mask + j) == 0) {
+			if (j > 0 && (*(mask + j) != *(mask + j - 1)))
+				return -EINVAL;
+			is_masked = 1;
+		} else {
+			return -EINVAL;
+		}
+	}
+
+	return is_masked;
+}
+
+/* 1. Last in item should be NULL as range is not supported.
+ * 2. Supported filter types: IMAC_IVLAN_TENID, IMAC_IVLAN,
+ *    IMAC_TENID, OMAC_TENID_IMAC and IMAC.
+ * 3. Mask of fields which need to be matched should be
+ *    filled with 1.
+ * 4. Mask of fields which needn't to be matched should be
+ *    filled with 0.
+ */
+static int
+i40e_flow_parse_vxlan_pattern(const struct rte_flow_item *pattern,
+			      struct rte_flow_error *error,
+			      struct rte_eth_tunnel_filter_conf *filter)
+{
+	const struct rte_flow_item *item = pattern;
+	const struct rte_flow_item_eth *eth_spec;
+	const struct rte_flow_item_eth *eth_mask;
+	const struct rte_flow_item_eth *o_eth_spec = NULL;
+	const struct rte_flow_item_eth *o_eth_mask = NULL;
+	const struct rte_flow_item_vxlan *vxlan_spec = NULL;
+	const struct rte_flow_item_vxlan *vxlan_mask = NULL;
+	const struct rte_flow_item_eth *i_eth_spec = NULL;
+	const struct rte_flow_item_eth *i_eth_mask = NULL;
+	const struct rte_flow_item_vlan *vlan_spec = NULL;
+	const struct rte_flow_item_vlan *vlan_mask = NULL;
+	bool is_vni_masked = 0;
+	enum rte_flow_item_type item_type;
+	bool vxlan_flag = 0;
+
+	for (; item->type != RTE_FLOW_ITEM_TYPE_END; item++) {
+		if (item->last) {
+			rte_flow_error_set(error, EINVAL,
+					   RTE_FLOW_ERROR_TYPE_ITEM,
+					   item,
+					   "Not support range");
+			return -rte_errno;
+		}
+		item_type = item->type;
+		switch (item_type) {
+		case RTE_FLOW_ITEM_TYPE_ETH:
+			eth_spec = (const struct rte_flow_item_eth *)item->spec;
+			eth_mask = (const struct rte_flow_item_eth *)item->mask;
+			if ((!eth_spec && eth_mask) ||
+			    (eth_spec && !eth_mask)) {
+				rte_flow_error_set(error, EINVAL,
+						   RTE_FLOW_ERROR_TYPE_ITEM,
+						   item,
+						   "Invalid ether spec/mask");
+				return -rte_errno;
+			}
+
+			if (eth_spec && eth_mask) {
+				/* DST address of inner MAC shouldn't be masked.
+				 * SRC address of Inner MAC should be masked.
+				 */
+				if (!is_broadcast_ether_addr(&eth_mask->dst) ||
+				    !is_zero_ether_addr(&eth_mask->src) ||
+				    eth_mask->type) {
+					rte_flow_error_set(error, EINVAL,
+						   RTE_FLOW_ERROR_TYPE_ITEM,
+						   item,
+						   "Invalid ether spec/mask");
+					return -rte_errno;
+				}
+
+				if (!vxlan_flag)
+					rte_memcpy(&filter->outer_mac,
+						   &eth_spec->dst,
+						   ETHER_ADDR_LEN);
+				else
+					rte_memcpy(&filter->inner_mac,
+						   &eth_spec->dst,
+						   ETHER_ADDR_LEN);
+			}
+
+			if (!vxlan_flag) {
+				o_eth_spec = eth_spec;
+				o_eth_mask = eth_mask;
+			} else {
+				i_eth_spec = eth_spec;
+				i_eth_mask = eth_mask;
+			}
+
+			break;
+		case RTE_FLOW_ITEM_TYPE_VLAN:
+			vlan_spec =
+				(const struct rte_flow_item_vlan *)item->spec;
+			vlan_mask =
+				(const struct rte_flow_item_vlan *)item->mask;
+			if (vxlan_flag) {
+				vlan_spec =
+				(const struct rte_flow_item_vlan *)item->spec;
+				vlan_mask =
+				(const struct rte_flow_item_vlan *)item->mask;
+				if (!(vlan_spec && vlan_mask)) {
+					rte_flow_error_set(error, EINVAL,
+						   RTE_FLOW_ERROR_TYPE_ITEM,
+						   item,
+						   "Invalid vlan item");
+					return -rte_errno;
+				}
+			} else {
+				if (vlan_spec || vlan_mask)
+					rte_flow_error_set(error, EINVAL,
+						   RTE_FLOW_ERROR_TYPE_ITEM,
+						   item,
+						   "Invalid vlan item");
+				return -rte_errno;
+			}
+			break;
+		case RTE_FLOW_ITEM_TYPE_IPV4:
+		case RTE_FLOW_ITEM_TYPE_IPV6:
+		case RTE_FLOW_ITEM_TYPE_UDP:
+			/* IPv4/IPv6/UDP are used to describe protocol,
+			 * spec amd mask should be NULL.
+			 */
+			if (item->spec || item->mask) {
+				rte_flow_error_set(error, EINVAL,
+					   RTE_FLOW_ERROR_TYPE_ITEM,
+					   item,
+					   "Invalid IPv4 item");
+				return -rte_errno;
+			}
+			break;
+		case RTE_FLOW_ITEM_TYPE_VXLAN:
+			vxlan_spec =
+				(const struct rte_flow_item_vxlan *)item->spec;
+			vxlan_mask =
+				(const struct rte_flow_item_vxlan *)item->mask;
+			/* Check if VXLAN item is used to describe protocol.
+			 * If yes, both spec and mask should be NULL.
+			 * If no, either spec or mask shouldn't be NULL.
+			 */
+			if ((!vxlan_spec && vxlan_mask) ||
+			    (vxlan_spec && !vxlan_mask)) {
+				rte_flow_error_set(error, EINVAL,
+					   RTE_FLOW_ERROR_TYPE_ITEM,
+					   item,
+					   "Invalid VXLAN item");
+				return -rte_errno;
+			}
+
+			/* Check if VNI is masked. */
+			if (vxlan_mask) {
+				is_vni_masked =
+				i40e_check_tenant_id_mask(vxlan_mask->vni);
+				if (is_vni_masked < 0) {
+					rte_flow_error_set(error, EINVAL,
+						   RTE_FLOW_ERROR_TYPE_ITEM,
+						   item,
+						   "Invalid VNI mask");
+					return -rte_errno;
+				}
+			}
+			vxlan_flag = 1;
+			break;
+		default:
+			break;
+		}
+	}
+
+	/* Check specification and mask to get the filter type */
+	if (vlan_spec && vlan_mask &&
+	    (vlan_mask->tci == rte_cpu_to_be_16(I40E_TCI_MASK))) {
+		/* If there's inner vlan */
+		filter->inner_vlan = rte_be_to_cpu_16(vlan_spec->tci)
+			& I40E_TCI_MASK;
+		if (vxlan_spec && vxlan_mask && !is_vni_masked) {
+			/* If there's vxlan */
+			rte_memcpy(&filter->tenant_id, vxlan_spec->vni,
+				   RTE_DIM(vxlan_spec->vni));
+			if (!o_eth_spec && !o_eth_mask &&
+				i_eth_spec && i_eth_mask)
+				filter->filter_type =
+					RTE_TUNNEL_FILTER_IMAC_IVLAN_TENID;
+			else {
+				rte_flow_error_set(error, EINVAL,
+						   RTE_FLOW_ERROR_TYPE_ITEM,
+						   NULL,
+						   "Invalid filter type");
+				return -rte_errno;
+			}
+		} else if (!vxlan_spec && !vxlan_mask) {
+			/* If there's no vxlan */
+			if (!o_eth_spec && !o_eth_mask &&
+				i_eth_spec && i_eth_mask)
+				filter->filter_type =
+					RTE_TUNNEL_FILTER_IMAC_IVLAN;
+			else {
+				rte_flow_error_set(error, EINVAL,
+						   RTE_FLOW_ERROR_TYPE_ITEM,
+						   NULL,
+						   "Invalid filter type");
+				return -rte_errno;
+			}
+		} else {
+			rte_flow_error_set(error, EINVAL,
+					   RTE_FLOW_ERROR_TYPE_ITEM,
+					   NULL,
+					   "Invalid filter type");
+			return -rte_errno;
+		}
+	} else if ((!vlan_spec && !vlan_mask) ||
+		   (vlan_spec && vlan_mask && vlan_mask->tci == 0x0)) {
+		/* If there's no inner vlan */
+		if (vxlan_spec && vxlan_mask && !is_vni_masked) {
+			/* If there's vxlan */
+			rte_memcpy(&filter->tenant_id, vxlan_spec->vni,
+				   RTE_DIM(vxlan_spec->vni));
+			if (!o_eth_spec && !o_eth_mask &&
+				i_eth_spec && i_eth_mask)
+				filter->filter_type =
+					RTE_TUNNEL_FILTER_IMAC_TENID;
+			else if (o_eth_spec && o_eth_mask &&
+				i_eth_spec && i_eth_mask)
+				filter->filter_type =
+					RTE_TUNNEL_FILTER_OMAC_TENID_IMAC;
+		} else if (!vxlan_spec && !vxlan_mask) {
+			/* If there's no vxlan */
+			if (!o_eth_spec && !o_eth_mask &&
+				i_eth_spec && i_eth_mask) {
+				filter->filter_type = ETH_TUNNEL_FILTER_IMAC;
+			} else {
+				rte_flow_error_set(error, EINVAL,
+					   RTE_FLOW_ERROR_TYPE_ITEM, NULL,
+					   "Invalid filter type");
+				return -rte_errno;
+			}
+		} else {
+			rte_flow_error_set(error, EINVAL,
+					   RTE_FLOW_ERROR_TYPE_ITEM, NULL,
+					   "Invalid filter type");
+			return -rte_errno;
+		}
+	} else {
+		rte_flow_error_set(error, EINVAL,
+				   RTE_FLOW_ERROR_TYPE_ITEM, NULL,
+				   "Not supported by tunnel filter.");
+		return -rte_errno;
+	}
+
+	filter->tunnel_type = RTE_TUNNEL_TYPE_VXLAN;
+
+	return 0;
+}
+
+static int
+i40e_flow_parse_tunnel_pattern(__rte_unused struct rte_eth_dev *dev,
+			       const struct rte_flow_item *pattern,
+			       struct rte_flow_error *error,
+			       struct rte_eth_tunnel_filter_conf *filter)
+{
+	int ret;
+
+	ret = i40e_flow_parse_vxlan_pattern(pattern, error, filter);
+
+	return ret;
+}
+
+static int
+i40e_flow_parse_tunnel_filter(struct rte_eth_dev *dev,
+			      const struct rte_flow_attr *attr,
+			      const struct rte_flow_item pattern[],
+			      const struct rte_flow_action actions[],
+			      struct rte_flow_error *error,
+			      union i40e_filter_t *filter)
+{
+	struct rte_eth_tunnel_filter_conf *tunnel_filter =
+		&filter->tunnel_filter;
+	int ret;
+
+	ret = i40e_flow_parse_tunnel_pattern(dev, pattern,
+					     error, tunnel_filter);
+	if (ret)
+		return ret;
+
+	ret = i40e_flow_parse_tunnel_action(dev, actions, error, tunnel_filter);
+	if (ret)
+		return ret;
+
+	ret = i40e_flow_parse_attr(attr, error);
+	if (ret)
+		return ret;
+
+	return ret;
+}
+
 static int
 i40e_flow_validate(struct rte_eth_dev *dev,
 		   const struct rte_flow_attr *attr,


[1] Yet another minor improvement to coodinates unit test. PASSED

--- Hazer/tst/unittest-coordinates.c
+++ Hazer/tst/unittest-coordinates.c
@@ -56,9 +56,9 @@
     }

     {
-        fprintf(stderr, "COORDINATES_SCANF_HPP: " COORDINATES_SCANF_HPP "\n", 359.999999999 );
-        fprintf(stderr, "COORDINATES_SCANF_NGS: " COORDINATES_SCANF_NGS "\n", 359, 59, 59.999999, 'W');
-        fprintf(stderr, "COORDINATES_SCANF_POS: " COORDINATES_SCANF_POS "\n", 359, 59, 59.999999, 'W');
+        fprintf(stderr, "COORDINATES_SCANF_HPP: " COORDINATES_SCANF_HPP "\n", -179.999999 );
+        fprintf(stderr, "COORDINATES_SCANF_NGS: " COORDINATES_SCANF_NGS "\n", 179, 59, 59.999999, 'W');
+        fprintf(stderr, "COORDINATES_SCANF_POS: " COORDINATES_SCANF_POS "\n", 179, 59, 59.999999, 'W');
     }

     {


net/mlx5: fix metering with flow ID 0

net/mlx5: fix metering with flow ID 0

When getting meter flow_id bits, there's an issue that not handling
correctly if flow_id is 0.

This fix this issue that when flow_id is 0, treat it as 1 bit.

Fixes: 83306d6c465a ("net/mlx5: fix meter statistics")
Cc: stable@dpdk.org

Signed-off-by: Shun Hao <d613c48229277bdb7e9f738ef1a173c538830b27@nvidia.com>
Acked-by: Matan Azrad <6969f5f553ad7652679a585a85d7321babc90464@nvidia.com>

--- drivers/net/mlx5/mlx5_flow.c
+++ drivers/net/mlx5/mlx5_flow.c
@@ -4802,8 +4802,8 @@
 					RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL,
 					"Failed to allocate meter flow id.");
 		flow_id = tag_id - 1;
-		flow_id_bits = MLX5_REG_BITS - __builtin_clz(flow_id);
-		flow_id_bits = flow_id_bits ? flow_id_bits : 1;
+		flow_id_bits = (!flow_id) ? 1 :
+				(MLX5_REG_BITS - __builtin_clz(flow_id));
 		if ((flow_id_bits + priv->sh->mtrmng->max_mtr_bits) >
 		    mtr_reg_bits) {
 			mlx5_ipool_free(fm->flow_ipool, tag_id);


qlge: Drop inbound error frames.

qlge: Drop inbound error frames.

Signed-off-by: Ron Mercer <4e7391ea092af2dfd5c2acda9e15f3b1d8ab5e88@qlogic.com>
Signed-off-by: David S. Miller <fe08d3c717adf2ae63592e4c9aec6e3e404d8e3e@davemloft.net>

--- drivers/net/qlge/qlge_main.c
+++ drivers/net/qlge/qlge_main.c
@@ -1525,6 +1525,13 @@
 		return;
 	}

+	/* Frame error, so drop the packet. */
+	if (ib_mac_rsp->flags2 & IB_MAC_IOCB_RSP_ERR_MASK) {
+		QPRINTK(qdev, DRV, ERR, "Receive error, flags2 = 0x%x\n",
+					ib_mac_rsp->flags2);
+		dev_kfree_skb_any(skb);
+		return;
+	}
 	prefetch(skb->data);
 	skb->dev = ndev;
 	if (ib_mac_rsp->flags1 & IB_MAC_IOCB_RSP_M_MASK) {
@@ -1547,7 +1554,6 @@
 	 * csum or frame errors.
 	 */
 	if (qdev->rx_csum &&
-		!(ib_mac_rsp->flags2 & IB_MAC_IOCB_RSP_ERR_MASK) &&
 		!(ib_mac_rsp->flags1 & IB_MAC_CSUM_ERR_MASK)) {
 		/* TCP frame. */
 		if (ib_mac_rsp->flags2 & IB_MAC_IOCB_RSP_T) {


Use ifdefs around Libbraille attrirbutes that are logged for debugging. (st)

git-svn-id: 30a5f035a20f1bc647618dbad7eea2a951b61b7c@3948 91a5dbb7-01b9-0310-9b5f-b28072856b6e

--- BrailleDrivers/Libbraille/braille.c
+++ BrailleDrivers/Libbraille/braille.c
@@ -75,10 +75,21 @@
     {
       LogPrint(LOG_INFO, "Libbraille Version: %s", braille_info(BRL_VERSION));

+#ifdef BRL_PATH
       LogPrint(LOG_DEBUG, "Libbraille Installation Directory: %s", braille_info(BRL_PATH));
+#endif /* BRL_PATH */
+
+#ifdef BRL_PATHCONF
       LogPrint(LOG_DEBUG, "Libbraille Configuration Directory: %s", braille_info(BRL_PATHCONF));
+#endif /* BRL_PATHCONF */
+
+#ifdef BRL_PATHTBL
       LogPrint(LOG_DEBUG, "Libbraille Tables Directory: %s", braille_info(BRL_PATHTBL));
+#endif /* BRL_PATHTBL */
+
+#ifdef BRL_PATHDRV
       LogPrint(LOG_DEBUG, "Libbraille Drivers Directory: %s", braille_info(BRL_PATHDRV));
+#endif /* BRL_PATHDRV */

       LogPrint(LOG_INFO, "Libbraille Table: %s", braille_info(BRL_TABLE));
       LogPrint(LOG_INFO, "Libbraille Driver: %s", braille_info(BRL_DRIVER));


sfc: Make efx_for_each_channel_rx_queue() more efficient

Currently each channel can have at most one RX queue, so go straight to
that one.

Signed-off-by: Ben Hutchings <0672176982fbc629cc374f31a7a45ae1671abf90@solarflare.com>
Signed-off-by: Jeff Garzik <15f615bf7d20c2937c7eb5aa759110fd6768848c@redhat.com>

--- drivers/net/sfc/net_driver.h
+++ drivers/net/sfc/net_driver.h
@@ -853,9 +853,9 @@

 /* Iterate over all RX queues belonging to a channel */
 #define efx_for_each_channel_rx_queue(_rx_queue, _channel)		\
-	for (_rx_queue = &_channel->efx->rx_queue[0];			\
-	     _rx_queue < &_channel->efx->rx_queue[EFX_MAX_RX_QUEUES];	\
-	     _rx_queue++)						\
+	for (_rx_queue = &_channel->efx->rx_queue[_channel->channel];	\
+	     _rx_queue;							\
+	     _rx_queue = NULL)						\
 		if (_rx_queue->channel != _channel)			\
 			continue;					\
 		else


net/sfc: fix generic byte statistics to exclude FCS bytes

Generic byte statistics should not include Ethernet FCS bytes.

Fixes: 1caab2f1e684 ("net/sfc: add basic statistics")
Cc: stable@dpdk.org

Signed-off-by: Viacheslav Galaktionov <3b972c7ef5fe537152d23909a916cdcda27c5dc7@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <4155e7bf8e0185127625dac6d84336299844982f@oktetlabs.ru>

--- drivers/net/sfc/sfc_ethdev.c
+++ drivers/net/sfc/sfc_ethdev.c
@@ -640,10 +640,19 @@
 			mac_stats[EFX_MAC_VADAPTER_TX_BROADCAST_BYTES];
 		stats->imissed = mac_stats[EFX_MAC_VADAPTER_RX_BAD_PACKETS];
 		stats->oerrors = mac_stats[EFX_MAC_VADAPTER_TX_BAD_PACKETS];
+
+		/* CRC is included in these stats, but shouldn't be */
+		stats->ibytes -= stats->ipackets * RTE_ETHER_CRC_LEN;
+		stats->obytes -= stats->opackets * RTE_ETHER_CRC_LEN;
 	} else {
 		stats->opackets = mac_stats[EFX_MAC_TX_PKTS];
 		stats->ibytes = mac_stats[EFX_MAC_RX_OCTETS];
 		stats->obytes = mac_stats[EFX_MAC_TX_OCTETS];
+
+		/* CRC is included in these stats, but shouldn't be */
+		stats->ibytes -= mac_stats[EFX_MAC_RX_PKTS] * RTE_ETHER_CRC_LEN;
+		stats->obytes -= mac_stats[EFX_MAC_TX_PKTS] * RTE_ETHER_CRC_LEN;
+
 		/*
 		 * Take into account stats which are whenever supported
 		 * on EF10. If some stat is not supported by current


net/sfc: fix setting empty multicast list

The patch is to fix sfc_set_mc_addr_list() behaviour in order
to make it accept an empty multicast address list thus making
it possible to remove multicast addresses inserted previously

Fixes: 0fa0070e4391 ("net/sfc: support multicast addresses list controls")

Signed-off-by: Ivan Malov <436a2feb05eb79a6862681e66bd0193220e8fb2d@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <ac94ab2a8fe9a9a087f6e24dcbc16626b52c07e8@solarflare.com>

--- drivers/net/sfc/sfc_ethdev.c
+++ drivers/net/sfc/sfc_ethdev.c
@@ -805,8 +805,7 @@
 		     uint32_t nb_mc_addr)
 {
 	struct sfc_adapter *sa = dev->data->dev_private;
-	uint8_t *mc_addrs_p;
-	uint8_t *mc_addrs;
+	uint8_t *mc_addrs_p = NULL;
 	int rc;
 	unsigned int i;

@@ -816,16 +815,20 @@
 		return -EINVAL;
 	}

-	mc_addrs_p = rte_calloc("mc-addrs", nb_mc_addr, EFX_MAC_ADDR_LEN, 0);
-	if (mc_addrs_p == NULL)
-		return -ENOMEM;
-
-	mc_addrs = mc_addrs_p;
-
-	for (i = 0; i < nb_mc_addr; ++i) {
-		(void)rte_memcpy(mc_addrs, mc_addr_set[i].addr_bytes,
-				 EFX_MAC_ADDR_LEN);
-		mc_addrs += EFX_MAC_ADDR_LEN;
+	if (nb_mc_addr != 0) {
+		uint8_t *mc_addrs;
+
+		mc_addrs_p = rte_calloc("mc-addrs", nb_mc_addr,
+					EFX_MAC_ADDR_LEN, 0);
+		if (mc_addrs_p == NULL)
+			return -ENOMEM;
+
+		mc_addrs = mc_addrs_p;
+		for (i = 0; i < nb_mc_addr; ++i) {
+			(void)rte_memcpy(mc_addrs, mc_addr_set[i].addr_bytes,
+					 EFX_MAC_ADDR_LEN);
+			mc_addrs += EFX_MAC_ADDR_LEN;
+		}
 	}

 	rc = efx_mac_multicast_list_set(sa->nic, mc_addrs_p, nb_mc_addr);


PCI: mvebu: Save MSI controller in pci_sys_data

Save MSI controller in pci_sys_data instead of assigning MSI controller
pointer to every PCI bus in .add_bus().

Signed-off-by: Yijing Wang <ac442ed3e729ed4f09d087e9c319e1c47c72d6f1@huawei.com>
Signed-off-by: Bjorn Helgaas <f10ec01be0c6b54271af5c550cd257810bdf3268@google.com>

--- drivers/pci/host/pci-mvebu.c
+++ drivers/pci/host/pci-mvebu.c
@@ -774,12 +774,6 @@
 	return bus;
 }

-static void mvebu_pcie_add_bus(struct pci_bus *bus)
-{
-	struct mvebu_pcie *pcie = sys_to_pcie(bus->sysdata);
-	bus->msi = pcie->msi;
-}
-
 static resource_size_t mvebu_pcie_align_resource(struct pci_dev *dev,
 						 const struct resource *res,
 						 resource_size_t start,
@@ -816,6 +810,10 @@

 	memset(&hw, 0, sizeof(hw));

+#ifdef CONFIG_PCI_MSI
+	hw.msi_ctrl = pcie->msi;
+#endif
+
 	hw.nr_controllers = 1;
 	hw.private_data   = (void **)&pcie;
 	hw.setup          = mvebu_pcie_setup;
@@ -823,7 +821,6 @@
 	hw.map_irq        = of_irq_parse_and_map_pci;
 	hw.ops            = &mvebu_pcie_ops;
 	hw.align_resource = mvebu_pcie_align_resource;
-	hw.add_bus        = mvebu_pcie_add_bus;

 	pci_common_init(&hw);
 }


PCI: tegra: Convert to use generic config accessors

Convert the Tegra host PCI driver to use the generic config access
functions.

Tested-by: Thierry Reding <3055038c414aef68bf32c33b8118623e7554e0f2@nvidia.com>
Signed-off-by: Rob Herring <fbb37eacae100e13076d5c4b46f06cfa4d6fa9f8@kernel.org>
Signed-off-by: Bjorn Helgaas <f10ec01be0c6b54271af5c550cd257810bdf3268@google.com>
Acked-by: Thierry Reding <3055038c414aef68bf32c33b8118623e7554e0f2@nvidia.com>
CC: Stephen Warren <5ef2a23ba3aff51d1cfc8c113c1ec34b608b3b13@wwwdotorg.org>
CC: Alexandre Courbot <65cb6c989b5ca9e749bdf49f881cbebafb9afedc@gmail.com>
CC: 23442b6bd48a500a3603c4e1363de123f831c954@vger.kernel.org

--- drivers/pci/host/pci-tegra.c
+++ drivers/pci/host/pci-tegra.c
@@ -480,59 +480,10 @@
 	return addr;
 }

-static int tegra_pcie_read_conf(struct pci_bus *bus, unsigned int devfn,
-				int where, int size, u32 *value)
-{
-	void __iomem *addr;
-
-	addr = tegra_pcie_conf_address(bus, devfn, where);
-	if (!addr) {
-		*value = 0xffffffff;
-		return PCIBIOS_DEVICE_NOT_FOUND;
-	}
-
-	*value = readl(addr);
-
-	if (size == 1)
-		*value = (*value >> (8 * (where & 3))) & 0xff;
-	else if (size == 2)
-		*value = (*value >> (8 * (where & 3))) & 0xffff;
-
-	return PCIBIOS_SUCCESSFUL;
-}
-
-static int tegra_pcie_write_conf(struct pci_bus *bus, unsigned int devfn,
-				 int where, int size, u32 value)
-{
-	void __iomem *addr;
-	u32 mask, tmp;
-
-	addr = tegra_pcie_conf_address(bus, devfn, where);
-	if (!addr)
-		return PCIBIOS_DEVICE_NOT_FOUND;
-
-	if (size == 4) {
-		writel(value, addr);
-		return PCIBIOS_SUCCESSFUL;
-	}
-
-	if (size == 2)
-		mask = ~(0xffff << ((where & 0x3) * 8));
-	else if (size == 1)
-		mask = ~(0xff << ((where & 0x3) * 8));
-	else
-		return PCIBIOS_BAD_REGISTER_NUMBER;
-
-	tmp = readl(addr) & mask;
-	tmp |= value << ((where & 0x3) * 8);
-	writel(tmp, addr);
-
-	return PCIBIOS_SUCCESSFUL;
-}
-
 static struct pci_ops tegra_pcie_ops = {
-	.read = tegra_pcie_read_conf,
-	.write = tegra_pcie_write_conf,
+	.map_bus = tegra_pcie_conf_address,
+	.read = pci_generic_config_read32,
+	.write = pci_generic_config_write32,
 };

 static unsigned long tegra_pcie_port_get_pex_ctrl(struct tegra_pcie_port *port)


pci: xgene: do not use clk-private.h

pci: xgene: do not use clk-private.h

The X-Gene PCIe driver consumes clocks and does not provide them.
Replace usage of clk-private.h with clk.h.

Cc: Tanmay Inamdar <94fb1b00a5527ce6d5176a5dabd0cd73b0c22875@apm.com>
Signed-off-by: Michael Turquette <6dab61939fc5e23761050a66932f032dceda5ebf@linaro.org>

--- drivers/pci/host/pci-xgene.c
+++ drivers/pci/host/pci-xgene.c
@@ -16,7 +16,7 @@
  * GNU General Public License for more details.
  *
  */
-#include <linux/clk-private.h>
+#include <linux/clk.h>
 #include <linux/delay.h>
 #include <linux/io.h>
 #include <linux/jiffies.h>


PM: Fix misuse of wakeup flag accessors in serial core

This patch (as1059) fixes a mistake in the way the serial core
initializes a device's wakeup settings.  It should use the accessor
routine instead of relying on a macro producing an lvalue.

Signed-off-by: Alan Stern <75ea6bb7bfc1186f92d26164de5f9268c9a45b59@rowland.harvard.edu>
Signed-off-by: Rafael J. Wysocki <a11f87183a953ab11f50fbafff689c5a7fa3506c@sisk.pl>
Signed-off-by: Greg Kroah-Hartman <4645f7897fd33786a2ee1264d590b3c400559d85@suse.de>

--- drivers/serial/serial_core.c
+++ drivers/serial/serial_core.c
@@ -2422,7 +2422,7 @@
 	 */
 	tty_dev = tty_register_device(drv->tty_driver, port->line, port->dev);
 	if (likely(!IS_ERR(tty_dev))) {
-		device_can_wakeup(tty_dev) = 1;
+		device_init_wakeup(tty_dev, 1);
 		device_set_wakeup_enable(tty_dev, 0);
 	} else
 		printk(KERN_ERR "Cannot register tty device on line %d\n",


Staging: bcm: Shortened lines and replaced member accessing in CopyIpAddrToClassifier()

Signed-off-by: Matthias Beyer <1d6e1cf70ec6f9ab28d3ea4b27a49a77654d370e@beyermatthias.de>
Signed-off-by: Greg Kroah-Hartman <4645f7897fd33786a2ee1264d590b3c400559d85@linuxfoundation.org>


thermal: fair_share: use the weight from the thermal instance

The fair share governor is not usable with thermal zones that use the
bind op and don't populate thermal_zone_parameters, the majority of
them.  Now that the weight is in the thermal instance, we can use that
in the fair share governor to allow every thermal zone to trivially use
this governor.  Furthermore, this simplifies the code.

Cc: Zhang Rui <f2a4cf793007be8f81a774dc7806c1ffea7b4a2c@intel.com>
Cc: Eduardo Valentin <19583d7f5a73f900a77b3924aabdcb631a4c7608@gmail.com>
Cc: Durgadoss R <673e0e5f8c3c626a7af9597f488cfee48e05bd21@intel.com>
Reviewed-by: Durgadoss R <673e0e5f8c3c626a7af9597f488cfee48e05bd21@intel.com>
Signed-off-by: Javi Merino <cc0c468e3dcd5ee425259d298d905a60f8330bcf@arm.com>
Signed-off-by: Eduardo Valentin <19583d7f5a73f900a77b3924aabdcb631a4c7608@gmail.com>


serial: samsung: fix serial console break

This patch fixes problems with serial console break. When function
s3c64xx_serial_startup() was started while serial console has been working,
it caused lose of characters written to TX FIFO. This effect was particularly
observable with systemd, which closes serial port every time when it's
not currently needed, hence function s3c64xx_serial_startup() is called
quite often there. To fix this problem we avoid resetting TX FIFO if port is
used as serial console.

Example of broken console log:

[ 1086.7         Expecting device dev-ttySAC1.device...
[ 1086.[  OK  ] Reached target Paths.
[ 1086.756416] s[  OK  ] Reached target Swap.
[ 1086.776413] systemd[1]: Reached target Swap.
[ 1086.776642] systemd[1]: Starting Root Slice.
[    5.53403[  OK  ] Created slice Root Slice.
[    5.548433] systemd[1]: Create[  OK  ] Created slice User and Session Slice.
[    5.568414] sys[  OK  ] Listening on /dev/initctl Compatibility Named Pipe.
[    5.588388] s[  OK  ] Listening on Delayed Shutdown Socket.
[    5.608376] sy[  OK  ] Listening on Journal Socket (/dev/log).
[    5.628361] [  OK  ] Listening on udev Kernel Socket.
[    5.648357] s[  OK  ] Listening on udev Control Socket.
[    5.668353] s[  OK  ] Listening on Journal Socket.
[    5.688366] systemd[1]: Listeni[  OK  ] Created slice System Slice.
[    5.708393]          Mounting Temporary Directory...
[ 7139.067436]          Starting prepare device daemon...
[ 7139.091726] sy         Starting Generate environment from /etc/profile.d...
[    5.792867] system         Starting Create Static Device Nodes in /dev...
[ 7848.718         Mounting Debug File System...
[ 7848.7384         Mounting Configuration File System...
[    5.852         Starting Apply Kernel Variables...
[    5.8720         Starting Setup Virtual Console...
[ 7848.798         Starting udev Coldplug all Devices...
[ 7848.817         Starting Journal Service...
[  OK  ] Started Journal Service.
[ 7848.854222] s[  OK  ] Reached target Slices.
         Starting Remount Root and Kernel File Systems...
[  OK  ] Mounted Configuration File System.

Reported-by: Chanwoo Choi <42eed19c0f56a8d487deac90c6d19d6364b7ba73@samsung.com>
Signed-off-by: Robert Baldyga <72b1db3d98bf139199de36aba5da00140727c571@samsung.com>
Reviewed-by: Peter Hurley <4b8373d016f277527198385ba72fda0feb5da015@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <4645f7897fd33786a2ee1264d590b3c400559d85@linuxfoundation.org>

--- drivers/tty/serial/samsung.c
+++ drivers/tty/serial/samsung.c
@@ -1068,8 +1068,9 @@
 	spin_lock_irqsave(&port->lock, flags);

 	ufcon = rd_regl(port, S3C2410_UFCON);
-	ufcon |= S3C2410_UFCON_RESETRX | S3C2410_UFCON_RESETTX |
-			S5PV210_UFCON_RXTRIG8;
+	ufcon |= S3C2410_UFCON_RESETRX | S5PV210_UFCON_RXTRIG8;
+	if (!uart_console(port))
+		ufcon |= S3C2410_UFCON_RESETTX;
 	wr_regl(port, S3C2410_UFCON, ufcon);

 	enable_rx_pio(ourport);


usb: dwc2: handle the Host Port Interrupt when it occurs in device mode

According to the spec for the DWC2 controller, when the PRTINT interrupt fires,
the application must clear the appropriate status bit in the Host Port Control
and Status register to clear this bit.

When disconnecting an A-cable when the dwc2 host driver, the PRTINT fires, but
only the GINTSTS_PRTINT status is cleared, no action is done with the HPRT0
register. The HPRT0_ENACHG bit in the HPRT0 must also be poked to correctly
clear the GINTSTS_PRTINT interrupt.

I am seeing this behavoir on v2.93 of the DWC2 IP. When I disconnect an OTG
A-cable adapter, the PRTINT interrupt fires when the DWC2 is in device mode
and is never cleared.

This patch adds the function to read the HPRT0 register when the PRTINT fires
and the dwc2 IP has already transitioned to device mode. This function is only
clearing the HPRT0_ENACHG bit for now, but can be modified to handle more.

Signed-off-by: Dinh Nguyen <a48724738fc762a7f206428dfcaf7ede2fd84d0f@altera.com>
[ paulz: modified patch to preserve HPRT0_ENA bit ]
Signed-off-by: Paul Zimmerman <e1f0d1b12051c0d55589ba9a6d7c10e383763d34@synopsys.com>
Signed-off-by: Greg Kroah-Hartman <4645f7897fd33786a2ee1264d590b3c400559d85@linuxfoundation.org>


[PATCH] USB: add LD devices to hid blacklist

below you will find one patch to hid-core.c, which lets usbhid ignore
our HID devices. It would be nice, if you can apply it.

Signed-off-by: Michael Hund <946ef0fb889f2ec312af8a5f19f9ad15e491077b@ld-didactic.de>
Signed-off-by: Greg Kroah-Hartman <4645f7897fd33786a2ee1264d590b3c400559d85@suse.de>

--- drivers/usb/input/hid-core.c
+++ drivers/usb/input/hid-core.c
@@ -1427,6 +1427,19 @@
 #define USB_DEVICE_ID_VERNIER_GOTEMP	0x0002
 #define USB_DEVICE_ID_VERNIER_SKIP	0x0003
 #define USB_DEVICE_ID_VERNIER_CYCLOPS	0x0004
+
+#define USB_VENDOR_ID_LD		0x0f11
+#define USB_DEVICE_ID_CASSY        	0x1000
+#define USB_DEVICE_ID_POCKETCASSY	0x1010
+#define USB_DEVICE_ID_MOBILECASSY	0x1020
+#define USB_DEVICE_ID_JWM		0x1080
+#define USB_DEVICE_ID_DMMP		0x1081
+#define USB_DEVICE_ID_UMIP		0x1090
+#define USB_DEVICE_ID_VIDEOCOM		0x1200
+#define USB_DEVICE_ID_COM3LAB		0x2000
+#define USB_DEVICE_ID_TELEPORT		0x2010
+#define USB_DEVICE_ID_NETWORKANALYSER	0x2020
+#define USB_DEVICE_ID_POWERCONTROL	0x2030

 /*
@@ -1463,6 +1476,17 @@
 	{ USB_VENDOR_ID_GRIFFIN, USB_DEVICE_ID_POWERMATE, HID_QUIRK_IGNORE },
 	{ USB_VENDOR_ID_GRIFFIN, USB_DEVICE_ID_SOUNDKNOB, HID_QUIRK_IGNORE },
 	{ USB_VENDOR_ID_KBGEAR, USB_DEVICE_ID_KBGEAR_JAMSTUDIO, HID_QUIRK_IGNORE },
+	{ USB_VENDOR_ID_LD, USB_DEVICE_ID_CASSY, HID_QUIRK_IGNORE },
+	{ USB_VENDOR_ID_LD, USB_DEVICE_ID_POCKETCASSY, HID_QUIRK_IGNORE },
+	{ USB_VENDOR_ID_LD, USB_DEVICE_ID_MOBILECASSY, HID_QUIRK_IGNORE },
+	{ USB_VENDOR_ID_LD, USB_DEVICE_ID_JWM, HID_QUIRK_IGNORE },
+	{ USB_VENDOR_ID_LD, USB_DEVICE_ID_DMMP, HID_QUIRK_IGNORE },
+	{ USB_VENDOR_ID_LD, USB_DEVICE_ID_UMIP, HID_QUIRK_IGNORE },
+	{ USB_VENDOR_ID_LD, USB_DEVICE_ID_VIDEOCOM, HID_QUIRK_IGNORE },
+	{ USB_VENDOR_ID_LD, USB_DEVICE_ID_COM3LAB, HID_QUIRK_IGNORE },
+	{ USB_VENDOR_ID_LD, USB_DEVICE_ID_TELEPORT, HID_QUIRK_IGNORE },
+	{ USB_VENDOR_ID_LD, USB_DEVICE_ID_NETWORKANALYSER, HID_QUIRK_IGNORE },
+	{ USB_VENDOR_ID_LD, USB_DEVICE_ID_POWERCONTROL, HID_QUIRK_IGNORE },
 	{ USB_VENDOR_ID_MCC, USB_DEVICE_ID_MCC_PMD1024LS, HID_QUIRK_IGNORE },
 	{ USB_VENDOR_ID_MCC, USB_DEVICE_ID_MCC_PMD1208LS, HID_QUIRK_IGNORE },
 	{ USB_VENDOR_ID_MGE, USB_DEVICE_ID_MGE_UPS, HID_QUIRK_IGNORE },


usb: musb: Remove ifdefs for musb_host_rx in musb_host.c part2

Remove ifdefs for musb_host_rx to get closer to building in
all the DMA drivers.

Signed-off-by: Tony Lindgren <1001e8702733cced254345e193c88aaa47a4f5de@atomide.com>
Signed-off-by: Felipe Balbi <94dddeeef08b001e003cce128ddc162a4e2c6cd2@ti.com>


USB: keyspan: fix null-deref at disconnect and release

Make sure to fail properly if the device is not accepted during attach
in order to avoid null-pointer derefs (of missing interface private
data) at disconnect or release.

Cc: 4fbacc2fa0ffdbb11bf1ad6925b886ebd08dd15f@vger.kernel.org
Signed-off-by: Johan Hovold <6a430eed381e126d51a8cce8db662f765ce314bc@gmail.com>
Signed-off-by: Greg Kroah-Hartman <4645f7897fd33786a2ee1264d590b3c400559d85@linuxfoundation.org>

--- drivers/usb/serial/keyspan.c
+++ drivers/usb/serial/keyspan.c
@@ -2303,7 +2303,7 @@
 	if (d_details == NULL) {
 		dev_err(&serial->dev->dev, "%s - unknown product id %x\n",
 		    __func__, le16_to_cpu(serial->dev->descriptor.idProduct));
-		return 1;
+		return -ENODEV;
 	}

 	/* Setup private data for serial driver */


USB: mos7840: fix DMA to stack

USB: mos7840: fix DMA to stack

Fix regression introduced by commit 0eafe4de1a ("USB: serial: mos7840:
add support for MCS7810 devices") which used stack-allocated buffers for
control messages.

Cc: 4fbacc2fa0ffdbb11bf1ad6925b886ebd08dd15f@vger.kernel.org
Signed-off-by: Johan Hovold <6a430eed381e126d51a8cce8db662f765ce314bc@gmail.com>
Signed-off-by: Greg Kroah-Hartman <4645f7897fd33786a2ee1264d590b3c400559d85@linuxfoundation.org>

--- drivers/usb/serial/mos7840.c
+++ drivers/usb/serial/mos7840.c
@@ -2142,13 +2142,21 @@
 static int mos7810_check(struct usb_serial *serial)
 {
 	int i, pass_count = 0;
+	u8 *buf;
 	__u16 data = 0, mcr_data = 0;
 	__u16 test_pattern = 0x55AA;
+	int res;
+
+	buf = kmalloc(VENDOR_READ_LENGTH, GFP_KERNEL);
+	if (!buf)
+		return 0;	/* failed to identify 7810 */

 	/* Store MCR setting */
-	usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0),
+	res = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0),
 		MCS_RDREQ, MCS_RD_RTYPE, 0x0300, MODEM_CONTROL_REGISTER,
-		&mcr_data, VENDOR_READ_LENGTH, MOS_WDR_TIMEOUT);
+		buf, VENDOR_READ_LENGTH, MOS_WDR_TIMEOUT);
+	if (res == VENDOR_READ_LENGTH)
+		mcr_data = *buf;

 	for (i = 0; i < 16; i++) {
 		/* Send the 1-bit test pattern out to MCS7810 test pin */
@@ -2158,9 +2166,12 @@
 			MODEM_CONTROL_REGISTER, NULL, 0, MOS_WDR_TIMEOUT);

 		/* Read the test pattern back */
-		usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0),
-			MCS_RDREQ, MCS_RD_RTYPE, 0, GPIO_REGISTER, &data,
-			VENDOR_READ_LENGTH, MOS_WDR_TIMEOUT);
+		res = usb_control_msg(serial->dev,
+				usb_rcvctrlpipe(serial->dev, 0), MCS_RDREQ,
+				MCS_RD_RTYPE, 0, GPIO_REGISTER, buf,
+				VENDOR_READ_LENGTH, MOS_WDR_TIMEOUT);
+		if (res == VENDOR_READ_LENGTH)
+			data = *buf;

 		/* If this is a MCS7810 device, both test patterns must match */
 		if (((test_pattern >> i) ^ (~data >> 1)) & 0x0001)
@@ -2174,6 +2185,8 @@
 		MCS_WR_RTYPE, 0x0300 | mcr_data, MODEM_CONTROL_REGISTER, NULL,
 		0, MOS_WDR_TIMEOUT);

+	kfree(buf);
+
 	if (pass_count == 16)
 		return 1;

@@ -2183,11 +2196,17 @@
 static int mos7840_calc_num_ports(struct usb_serial *serial)
 {
 	__u16 data = 0x00;
+	u8 *buf;
 	int mos7840_num_ports;

-	usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0),
-		MCS_RDREQ, MCS_RD_RTYPE, 0, GPIO_REGISTER, &data,
-		VENDOR_READ_LENGTH, MOS_WDR_TIMEOUT);
+	buf = kzalloc(VENDOR_READ_LENGTH, GFP_KERNEL);
+	if (buf) {
+		usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0),
+			MCS_RDREQ, MCS_RD_RTYPE, 0, GPIO_REGISTER, buf,
+			VENDOR_READ_LENGTH, MOS_WDR_TIMEOUT);
+		data = *buf;
+		kfree(buf);
+	}

 	if (serial->dev->descriptor.idProduct == MOSCHIP_DEVICE_ID_7810 ||
 		serial->dev->descriptor.idProduct == MOSCHIP_DEVICE_ID_7820) {


Add some docs to mojito_web_make_sync_session

--- mojito/mojito-web.c
+++ mojito/mojito-web.c
@@ -24,6 +24,10 @@

 #include "mojito-web.h"

+/*
+ * Helper to make a known sync SoupSession with environment support.
+ * TODO: should this return a ref on a singleton session?
+ */
 SoupSession *
 mojito_web_make_sync_session (void)
 {


Build process.c with _GNU_SOURCE (#363)

Build process.c with _GNU_SOURCE (#363)

Otherwise the build will fail on glibc 2.29 and later because
posix_spawn_file_actions_addchdir_np is not declared.

Starting with glibc 2.37, posix_spawn_file_actions_addchdir_np
will be available with the default feature flags; see glibc
commit 2ff48a4025515e93d722947a9eabb114f4a65b22 ("posix: Make
posix_spawn extensions available by default").

--- Sources/TSCclibc/process.c
+++ Sources/TSCclibc/process.c
@@ -1,4 +1,8 @@
 #if defined(__linux__)
+
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE /* for posix_spawn_file_actions_addchdir_np */
+#endif

 #include <errno.h>


Whoops

Whoops


sdffont line height

sdffont line height

--- core/include/mmcore/utility/SDFFont.h
+++ core/include/mmcore/utility/SDFFont.h
@@ -392,7 +392,7 @@
          * @return The height of a single line in logical units.
          */
         float LineHeight(float size) const {
-            return size;
+            return std::max(0.0f, size);
         }

         /**


Minor changes

Minor changes

--- Tudat/Mathematics/Interpolators/multiLinearInterpolator.h
+++ Tudat/Mathematics/Interpolators/multiLinearInterpolator.h
@@ -96,7 +96,7 @@
         dependentData_.resize( reinterpret_cast< boost::array< size_t,
                                boost::multi_array< DependentVariableType,
                                static_cast< size_t >( NumberOfDimensions ) >::dimensionality > const& >(
-                                   *dependentData.shape( ) ) );
+                                   *dependentData.shape( ) ) ); // resize dependent data container
         dependentData_ = dependentData;

         // Check consistency of template arguments and input variables.


Change location of trace files and disable remote trace file change feature.

--- sbin/routed/pathnames.h
+++ sbin/routed/pathnames.h
@@ -47,4 +47,6 @@
  * Leave this undefined, and only the trace file originally specified
  * when routed was started, if any, will be appended to.
  */
-#define _PATH_TRACE	"/etc/routed.trace"
+#if 0
+#define _PATH_TRACE	"/var/log/routed.trace"
+#endif


Added links to the documentation index page.

--- Source/AppAuth.h
+++ Source/AppAuth.h
@@ -55,4 +55,8 @@
     extensions (standard or otherwise) with the ability to handle additional params
     in all protocol requests and responses.

+    Homepage: http://openid.github.io/AppAuth-iOS/

+    API Documentation: http://openid.github.io/AppAuth-iOS/docs/latest

+    Git Repository: https://github.com/openid/AppAuth-iOS

+
  */


BUG: Allow legacy dtypes to cast to datetime again

This constraint was added out of a caution with the thought that nobody
uses it.  Turns out ora does use it.
In practice, this only affects cast to and from datetimes (or possibly
strings but that seems even less likely).

Tested via ora (see gh-21365) the paths are not particularly special,
but the parametric dtype resolution is in principle missing.
This is not particularly problematic, since NumPy barely exposes that
though, and it never worked.

Closes gh-21365

--- numpy/core/src/multiarray/convert_datatype.c
+++ numpy/core/src/multiarray/convert_datatype.c
@@ -106,9 +106,6 @@
         return NULL;
     }
     else {
-        if (NPY_DT_is_parametric(from) || NPY_DT_is_parametric(to)) {
-            Py_RETURN_NONE;
-        }
         /* Reject non-legacy dtypes (they need to use the new API) */
         if (!NPY_DT_is_legacy(from) || !NPY_DT_is_legacy(to)) {
             Py_RETURN_NONE;


[UIViewController+VENTouchLock] Add documentation

--- VENTouchLock/Categories/UIViewController+VENTouchLock.h
+++ VENTouchLock/Categories/UIViewController+VENTouchLock.h
@@ -2,8 +2,14 @@

 @interface UIViewController (VENTouchLock)

+/**
+ * @return The highest modally presented view controller of the app's root view controller.
+ */
++ (UIViewController*)ventouchlock_topMostController;
+
+/**
+ * @return A navigation controller that contains the reciever as its root view controller.
+ */
 - (UINavigationController *)ventouchlock_embeddedInNavigationController;

-+ (UIViewController*)ventouchlock_topMostController;
-
 @end


Update clientversion.h

Update clientversion.h


acpi throttling: Use this_cpu_has and simplify code current cpu

With the this_cpu_xx we no longer need to pass an acpi
structure to the msr management code. Simplifies code and improves
performance.

NOTE: This code is x86 specific (see #ifdef CONFIG_X86) but not under
      arch/x86.

Signed-off-by: Christoph Lameter <ef3ecccf258fa062c5c6521a4887d40541963af7@linux.com>
Acked-by: Tejun Heo <546b05909706652891a87f7bfe385ae147f61f91@kernel.org>
Signed-off-by: Tejun Heo <546b05909706652891a87f7bfe385ae147f61f91@kernel.org>

--- drivers/acpi/processor_throttling.c
+++ drivers/acpi/processor_throttling.c
@@ -710,20 +710,14 @@
 }

 #ifdef CONFIG_X86
-static int acpi_throttling_rdmsr(struct acpi_processor *pr,
-					u64 *value)
-{
-	struct cpuinfo_x86 *c;
+static int acpi_throttling_rdmsr(u64 *value)
+{
 	u64 msr_high, msr_low;
-	unsigned int cpu;
 	u64 msr = 0;
 	int ret = -1;

-	cpu = pr->id;
-	c = &cpu_data(cpu);
-
-	if ((c->x86_vendor != X86_VENDOR_INTEL) ||
-		!cpu_has(c, X86_FEATURE_ACPI)) {
+	if ((this_cpu_read(cpu_info.x86_vendor) != X86_VENDOR_INTEL) ||
+		!this_cpu_has(X86_FEATURE_ACPI)) {
 		printk(KERN_ERR PREFIX
 			"HARDWARE addr space,NOT supported yet\n");
 	} else {
@@ -738,18 +732,13 @@
 	return ret;
 }

-static int acpi_throttling_wrmsr(struct acpi_processor *pr, u64 value)
-{
-	struct cpuinfo_x86 *c;
-	unsigned int cpu;
+static int acpi_throttling_wrmsr(u64 value)
+{
 	int ret = -1;
 	u64 msr;

-	cpu = pr->id;
-	c = &cpu_data(cpu);
-
-	if ((c->x86_vendor != X86_VENDOR_INTEL) ||
-		!cpu_has(c, X86_FEATURE_ACPI)) {
+	if ((this_cpu_read(cpu_info.x86_vendor) != X86_VENDOR_INTEL) ||
+		!this_cpu_has(X86_FEATURE_ACPI)) {
 		printk(KERN_ERR PREFIX
 			"HARDWARE addr space,NOT supported yet\n");
 	} else {
@@ -761,15 +750,14 @@
 	return ret;
 }
 #else
-static int acpi_throttling_rdmsr(struct acpi_processor *pr,
-				u64 *value)
+static int acpi_throttling_rdmsr(u64 *value)
 {
 	printk(KERN_ERR PREFIX
 		"HARDWARE addr space,NOT supported yet\n");
 	return -1;
 }

-static int acpi_throttling_wrmsr(struct acpi_processor *pr, u64 value)
+static int acpi_throttling_wrmsr(u64 value)
 {
 	printk(KERN_ERR PREFIX
 		"HARDWARE addr space,NOT supported yet\n");
@@ -801,7 +789,7 @@
 		ret = 0;
 		break;
 	case ACPI_ADR_SPACE_FIXED_HARDWARE:
-		ret = acpi_throttling_rdmsr(pr, value);
+		ret = acpi_throttling_rdmsr(value);
 		break;
 	default:
 		printk(KERN_ERR PREFIX "Unknown addr space %d\n",
@@ -834,7 +822,7 @@
 		ret = 0;
 		break;
 	case ACPI_ADR_SPACE_FIXED_HARDWARE:
-		ret = acpi_throttling_wrmsr(pr, value);
+		ret = acpi_throttling_wrmsr(value);
 		break;
 	default:
 		printk(KERN_ERR PREFIX "Unknown addr space %d\n",


- Swap order of "S4B" and "S5" in sleep_state_names.  They already   changed in ACPICA actypes.h. - Use ACPI_S_STATES_MAX instead of ACPI_STATE_S5.

--- sys/dev/acpica/acpi.c
+++ sys/dev/acpica/acpi.c
@@ -86,7 +86,7 @@
 };

 static const char* sleep_state_names[] = {
-    "S0", "S1", "S2", "S3", "S4", "S4B", "S5" };
+    "S0", "S1", "S2", "S3", "S4", "S5", "S4B" };

 /* this has to be static, as the softc is gone when we need it */
 static int acpi_off_state = ACPI_STATE_S5;
@@ -1008,7 +1008,7 @@
 {
     FUNCTION_TRACE_U32(__func__, state);

-    if (state >= ACPI_STATE_S0 && state <= ACPI_STATE_S5)
+    if (state >= ACPI_STATE_S0 && state <= ACPI_S_STATES_MAX)
 	acpi_SetSleepState((struct acpi_softc *)arg, state);
     return_VOID;
 }
@@ -1287,7 +1287,7 @@
 	    break;
 	}
 	state = *(int *)addr;
-	if (state >= ACPI_STATE_S0  && state <= ACPI_STATE_S5) {
+	if (state >= ACPI_STATE_S0  && state <= ACPI_S_STATES_MAX) {
 	    acpi_SetSleepState(sc, state);
 	} else {
 	    error = EINVAL;
@@ -1312,18 +1312,18 @@
     u_int new_state, old_state;

     old_state = *(u_int *)oidp->oid_arg1;
-    if (old_state > ACPI_STATE_S5)
+    if (old_state > ACPI_S_STATES_MAX)
 	strcpy(sleep_state, "unknown");
     else
 	strncpy(sleep_state, sleep_state_names[old_state],
 	    sizeof(sleep_state_names[old_state]));
     error = sysctl_handle_string(oidp, sleep_state, sizeof(sleep_state), req);
     if (error == 0 && req->newptr != NULL) {
-	for (new_state = ACPI_STATE_S0; new_state <= ACPI_STATE_S5; new_state++)
+	for (new_state = ACPI_STATE_S0; new_state <= ACPI_S_STATES_MAX; new_state++)
 	    if (strncmp(sleep_state, sleep_state_names[new_state],
 		sizeof(sleep_state)) == 0)
 		break;
-	if (new_state != old_state && new_state <= ACPI_STATE_S5)
+	if (new_state != old_state && new_state <= ACPI_S_STATES_MAX)
 	    *(u_int *)oidp->oid_arg1 = new_state;
 	else
 	    error = EINVAL;


Put destructor to private according to chromium style

--- base/message_pump_uv.h
+++ base/message_pump_uv.h
@@ -16,7 +16,6 @@
 class BASE_EXPORT MessagePumpUV : public MessagePump {
  public:
   MessagePumpUV();
-  virtual ~MessagePumpUV();

   // MessagePump methods:
   virtual void Run(Delegate* delegate) OVERRIDE;
@@ -25,6 +24,8 @@
   virtual void ScheduleDelayedWork(const TimeTicks& delayed_work_time) OVERRIDE;

  private:
+  virtual ~MessagePumpUV();
+
   // This flag is set to false when Run should return.
   bool keep_running_;


backend/drm: use wlr_texture_from_buffer

--- backend/drm/renderer.c
+++ backend/drm/renderer.c
@@ -18,6 +18,7 @@
 #include "render/pixel_format.h"
 #include "render/swapchain.h"
 #include "render/wlr_renderer.h"
+#include "render/wlr_texture.h"

 bool init_drm_renderer(struct wlr_drm_backend *drm,
 		struct wlr_drm_renderer *renderer) {
@@ -135,12 +136,7 @@
 		return NULL;
 	}

-	struct wlr_dmabuf_attributes attribs = {0};
-	if (!wlr_buffer_get_dmabuf(buffer, &attribs)) {
-		return NULL;
-	}
-
-	struct wlr_texture *tex = wlr_texture_from_dmabuf(renderer, &attribs);
+	struct wlr_texture *tex = wlr_texture_from_buffer(renderer, buffer);
 	if (tex == NULL) {
 		return NULL;
 	}


minimal diff to let if_art compile; claudio ok

--- dev/pci/musycc_obsd.c
+++ dev/pci/musycc_obsd.c
@@ -1,4 +1,4 @@
-/*	$OpenBSD: musycc_obsd.c,v 1.2 2005/08/13 23:52:49 claudio Exp $ */
+/*	$OpenBSD: musycc_obsd.c,v 1.3 2005/08/14 11:43:46 deraadt Exp $ */

 /*
  * Copyright (c) 2004,2005  Internet Business Solutions AG, Zurich, Switzerland
@@ -41,24 +41,24 @@
 #include <dev/pci/pcidevs.h>

 int	musycc_match(struct device *, void *, void *);
-int	ebus_match(struct device *, void *, void *);
+int	musyccbus_match(struct device *, void *, void *);
 void	musycc_softc_attach(struct device *, struct device *, void *);
-void	ebus_softc_attach(struct device *, struct device *, void *);
-int	ebus_print(void *, const char *);
+void	musyccbus_softc_attach(struct device *, struct device *, void *);
+int	musyccbus_print(void *, const char *);

 struct cfattach musycc_ca = {
 	sizeof(struct musycc_softc), musycc_match, musycc_softc_attach
 };

-struct cfattach ebus_ca = {
-	sizeof(struct ebus_softc), ebus_match, ebus_softc_attach
+struct cfattach musyccbus_ca = {
+	sizeof(struct ebus_softc), musyccbus_match, musyccbus_softc_attach
 };

 struct cfdriver musycc_cd = {
 	NULL, "musycc", DV_DULL
 };

-struct cfdriver ebus_cd = {
+struct cfdriver musyccbus_cd = {
 	NULL, "ebus", DV_DULL
 };

@@ -85,7 +85,7 @@
 }

 int
-ebus_match(struct device *parent, void *match, void *aux)
+musyccbus_match(struct device *parent, void *match, void *aux)
 {
 	int			 rv;
 	struct pci_attach_args  *pa = aux;
@@ -163,7 +163,7 @@
 }

 void
-ebus_softc_attach(struct device *parent, struct device *self, void *aux)
+musyccbus_softc_attach(struct device *parent, struct device *self, void *aux)
 {
 	struct ebus_dev			 rom;
 	struct musycc_attach_args	 ma;
@@ -284,7 +284,7 @@
 }

 int
-ebus_print(void *aux, const char *pnp)
+musyccbus_print(void *aux, const char *pnp)
 {
 	struct musycc_attach_args *ma = aux;


Add missing file.

Add missing file.

error: pathspec 'Includes/libARDiscovery/ARDiscovery.h' did not match any file(s) known to git

--- Includes/libARDiscovery/ARDiscovery.h
+++ Includes/libARDiscovery/ARDiscovery.h
@@ -0,0 +1,8 @@
+#ifndef _ARDISCOVERY_H_
+#define _ARDISCOVERY_H_
+
+#include <libARDiscovery/ARDISCOVERY_Connection.h>
+#include <libARDiscovery/ARDISCOVERY_Discovery.h>
+#include <libARDiscovery/ARDISCOVERY_Error.h>
+
+#endif /* _ARDISCOVERY_H_ */


[C] Add missing space after = for assignfrom

Cosmetic change to generated code.

--- compiler/generator.c
+++ compiler/generator.c
@@ -927,7 +927,7 @@
     int keep_c = p->mode == m_forward; /* like 'attach' */
     writef(g, "~{int ret;~N", p);
     if (keep_c) writef(g, "~{int saved_c = z->c;~N", p);
-    w(g, "~Mret =");
+    w(g, "~Mret = ");
     writef(g, keep_c ? "insert_~$(z, z->c, z->l, ~a);~C" : "insert_~$(z, z->lb, z->c, ~a);~C", p);
     if (keep_c) w(g, "~Mz->c = saved_c;~N~}");
     writef(g, "~Mif (ret < 0) return ret;~N"


LRTableModel doesn't need to be concerned with UITableViewDataSource; you shouldn't *have* to have your table model be the table view datasource if you don't want to.

--- Classes/LRTableModel/LRTableModel.h
+++ Classes/LRTableModel/LRTableModel.h
@@ -10,7 +10,7 @@
 #import "LRTableModelEventListener.h"
 #import "LRTableModelCellProvider.h"

-@protocol LRTableModel <UITableViewDataSource>
+@protocol LRTableModel <NSObject>

 - (NSInteger)numberOfSections;
 - (NSInteger)numberOfRows;


remove typeo

remove typeo

git-svn-id: c2a6dc05b59792ac1d7cd7e25aca3109ecd10b86@253 7ffbcff5-ea86-4e99-a76d-b9f7f6476058

--- X11/xf_keyboard.c
+++ X11/xf_keyboard.c
@@ -19,7 +19,7 @@
    FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
    DEALINGS IN THE SOFTWARE.
 */
-s
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>


fix build error

fix build error

--- inc/core/Reflection.h
+++ inc/core/Reflection.h
@@ -22,5 +22,5 @@
 	template<typename T, typename... Args>                                                                             \
 	using HasFuncion##funcName##_t = typename HasFuncion##funcName<T, void, Args...>::type;                            \
 	template<typename T, typename... Args>                                                                             \
-	constexpr bool HasFuncion##funcName##_v = typename HasFuncion##funcName##_t<T, Args...>::value;
+	constexpr bool HasFuncion##funcName##_v = HasFuncion##funcName##_t<T, Args...>::value;
 }


ARM: S5P: Remove unused s3c_pm_check_resume_pin

The s3c_pm_check_resume_pin() is not being used and can be safely
removed to fix the build warning.

Signed-off-by: Abhilash Kesavan <78e4b9094d315c2a033ce0d3abcfa0b8525cd2b4@samsung.com>
Signed-off-by: Kukjin Kim <3fc711f4e08bc570a586748633ff7c76d0e1e253@samsung.com>

--- arch/arm/plat-s5p/pm.c
+++ arch/arm/plat-s5p/pm.c
@@ -19,17 +19,6 @@

 #define PFX "s5p pm: "

-/* s3c_pm_check_resume_pin
- *
- * check to see if the pin is configured correctly for sleep mode, and
- * make any necessary adjustments if it is not
-*/
-
-static void s3c_pm_check_resume_pin(unsigned int pin, unsigned int irqoffs)
-{
-	/* nothing here yet */
-}
-
 /* s3c_pm_configure_extint
  *
  * configure all external interrupt pins


viafb: Add OLPC XO-1.5 port configs

viafb: Add OLPC XO-1.5 port configs

The OLPC XO-1.5 does not use the standard port wiring suggested
in the viafb driver.

This is required for the upcoming OLPC DCON and via-camera drivers,
to be submitted soon.

Signed-off-by: Daniel Drake <83b0c3d63e8a11eb6e40077030b59e95bfe31ffa@laptop.org>
[fts: removed useless ifdef's and corrected comment]
Signed-off-by: Florian Tobias Schandinat <9843642cd7809d7c6d8c25ac9e4b0e2f1b5283bf@gmx.de>

--- drivers/video/via/via-core.c
+++ drivers/video/via/via-core.c
@@ -17,6 +17,7 @@
 #include <linux/platform_device.h>
 #include <linux/list.h>
 #include <linux/pm.h>
+#include <asm/olpc.h>

 /*
  * The default port config.
@@ -26,6 +27,19 @@
 	[VIA_PORT_31]	= { VIA_PORT_I2C,  VIA_MODE_I2C, VIASR, 0x31 },
 	[VIA_PORT_25]	= { VIA_PORT_GPIO, VIA_MODE_GPIO, VIASR, 0x25 },
 	[VIA_PORT_2C]	= { VIA_PORT_GPIO, VIA_MODE_I2C, VIASR, 0x2c },
+	[VIA_PORT_3D]	= { VIA_PORT_GPIO, VIA_MODE_GPIO, VIASR, 0x3d },
+	{ 0, 0, 0, 0 }
+};
+
+/*
+ * The OLPC XO-1.5 puts the camera power and reset lines onto
+ * GPIO 2C.
+ */
+static const struct via_port_cfg olpc_adap_configs[] = {
+	[VIA_PORT_26]	= { VIA_PORT_I2C,  VIA_MODE_I2C, VIASR, 0x26 },
+	[VIA_PORT_31]	= { VIA_PORT_I2C,  VIA_MODE_I2C, VIASR, 0x31 },
+	[VIA_PORT_25]	= { VIA_PORT_GPIO, VIA_MODE_GPIO, VIASR, 0x25 },
+	[VIA_PORT_2C]	= { VIA_PORT_GPIO, VIA_MODE_GPIO, VIASR, 0x2c },
 	[VIA_PORT_3D]	= { VIA_PORT_GPIO, VIA_MODE_GPIO, VIASR, 0x3d },
 	{ 0, 0, 0, 0 }
 };
@@ -654,6 +668,9 @@
 	global_dev.pdev = pdev;
 	global_dev.chip_type = ent->driver_data;
 	global_dev.port_cfg = adap_configs;
+	if (machine_is_olpc())
+		global_dev.port_cfg = olpc_adap_configs;
+
 	spin_lock_init(&global_dev.reg_lock);
 	ret = via_pci_setup_mmio(&global_dev);
 	if (ret)


Modifica interfaz

Modifica interfaz

Se cambio la orientacion del grupo de botones a horizontal.

--- src/Interfaz_2.c
+++ src/Interfaz_2.c
@@ -1,93 +1,54 @@
 #include <gtk/gtk.h>
 #include <libintl.h>
 #include <locale.h>
-#define _(cadena) gettext (cadena)
+#define _(String) gettext(String)

-static void
-print_hello (GtkWidget *widget,
-             gpointer   data)
-{
-  g_print ("Hello World\n");
-}
+int main(int argc, char *argv[]){
+  bind_textdomain_codeset("Point-Store", "UTF-8");
+  setlocale(LC_ALL, "");
+  bindtextdomain("Point-Store", "idioma");
+  textdomain("Point-Store");
+  GtkWidget *window;
+  GtkWidget *frame;
+  GtkWidget *box1;
+  GtkWidget *box2;
+  GtkWidget *button1;
+  GtkWidget *button2;
+  GtkWidget *button3;
+  GtkWidget *button4;

-static void
-activate (GtkApplication *app,
-          gpointer        user_data)
-{
-  GtkWidget *window;
-  GtkWidget *grid;
-  GtkWidget *button;
-
-  /* create a new window, and set its title */
-  window = gtk_application_window_new (app);
-  gtk_window_set_title (GTK_WINDOW (window), _("Ventana"));
-  gtk_container_set_border_width (GTK_CONTAINER (window), 10);
-
-  /* Here we construct the container that is going pack our buttons */
-  grid = gtk_grid_new ();
-
-  /* Pack the container in the window */
-  gtk_container_add (GTK_CONTAINER (window), grid);
-
-  button = gtk_button_new_with_label (_("Inventario"));
-  g_signal_connect (button, "clicked", G_CALLBACK (print_hello), NULL);
-
-  /* Place the first button in the grid cell (0, 0), and make it fill
-   * just 1 cell horizontally and vertically (ie no spanning)
-   */
-  gtk_grid_attach (GTK_GRID (grid), button, 0, 0, 4, 1);
-
-  button = gtk_button_new_with_label (_("Facturas"));
-  g_signal_connect (button, "clicked", G_CALLBACK (print_hello), NULL);
-
-  /* Place the second button in the grid cell (1, 0), and make it fill
-   * just 1 cell horizontally and vertically (ie no spanning)
-   */
-  gtk_grid_attach (GTK_GRID (grid), button, 0, 1, 4, 1);
-
-  button = gtk_button_new_with_label (_("Clientes"));
-  g_signal_connect (button, "clicked", G_CALLBACK (print_hello), NULL);
-
-  /* Place the first button in the grid cell (0, 0), and make it fill
-   * just 1 cell horizontally and vertically (ie no spanning)
-   */
-  gtk_grid_attach (GTK_GRID (grid), button, 0, 2, 4, 1);
-
-  button = gtk_button_new_with_label (_("Ventas"));
-  g_signal_connect (button, "clicked", G_CALLBACK (print_hello), NULL);
-
-  /* Place the second button in the grid cell (1, 0), and make it fill
-   * just 1 cell horizontally and vertically (ie no spanning)
-   */
-  gtk_grid_attach (GTK_GRID (grid), button, 0, 3, 4, 1);
-
-
-  /* Now that we are done packing our widgets, we show them all
-   * in one go, by calling gtk_widget_show_all() on the window.
-   * This call recursively calls gtk_widget_show() on all widgets
-   * that are contained in the window, directly or indirectly.
-   */
-  gtk_widget_show_all (window);
-
-}
-
-int
-main (int    argc,
-      char **argv)
-{
-
-	bind_textdomain_codeset ("Point-Store", "UTF-8");
-	setlocale(LC_ALL, "");
-	bindtextdomain("Point-Store", "idioma");
-	textdomain("Point-Store");
-
-	GtkApplication *app;
-  int status;
-
-  app = gtk_application_new ("org.gtk.example", G_APPLICATION_FLAGS_NONE);
-  g_signal_connect (app, "activate", G_CALLBACK (activate), NULL);
-  status = g_application_run (G_APPLICATION (app), argc, argv);
-  g_object_unref (app);
-
-  return status;
-}
+  gtk_init(&argc, &argv);
+
+  window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
+  gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
+  gtk_window_set_title(GTK_WINDOW(window), "PointStore");
+  gtk_container_set_border_width(GTK_CONTAINER(window), 10);
+
+  frame = gtk_frame_new(_("Interfaz_2"));
+  box1 = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
+
+  gtk_container_add(GTK_CONTAINER(window), frame);
+  gtk_container_add(GTK_CONTAINER(frame),box1);
+
+  box2 = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
+  button1 = gtk_button_new_with_label(_("Inventario"));
+  button2 = gtk_button_new_with_label(_("Facturas"));
+  button3 = gtk_button_new_with_label(_("Clientes"));
+  button4 = gtk_button_new_with_label(_("Ventas"));
+
+  gtk_box_pack_start(GTK_BOX(box1), box2, FALSE, FALSE, 10);
+  gtk_box_pack_start(GTK_BOX(box2), button1, FALSE, TRUE, 10);
+  gtk_box_pack_start(GTK_BOX(box2), button2, FALSE, TRUE, 10);
+  gtk_box_pack_start(GTK_BOX(box2), button3, FALSE, TRUE, 10);
+  gtk_box_pack_start(GTK_BOX(box2), button4, FALSE, TRUE, 10);
+
+  gtk_box_set_homogeneous(GTK_BOX(box2), TRUE);
+
+  gtk_widget_show_all(window);
+
+  g_signal_connect(window, "destroy", G_CALLBACK(gtk_main_quit),NULL);
+
+  gtk_main();
+
+  return 0;
+}


[DOC] Improved dox for class Align.

[DOC] Improved dox for class Align.

--- core/include/seqan/align/align_base.h
+++ core/include/seqan/align/align_base.h
@@ -293,7 +293,7 @@
  * @mfn Align#Source
  * @brief Return the type of the underlying sequence.
  *
- * @signature Rows<TAlign>::Type
+ * @signature Rows<TAlign>::Type;
  *
  * @tparam TAlign The Align object to get the underlying sequence type for.
  *
@@ -365,9 +365,9 @@
  *
  * @signature TRows rows(align);
  *
- * @param align The Align object to get the rows for.
- *
- * @signature TRows A container with the Gaps of the Align object.
+ * @param[in] align The Align object to get the rows for.
+ *
+ * @return TRows A container with the Gaps of the Align object.
  */

 /**
@@ -408,10 +408,10 @@
  *
  * @signature TRow row(align, pos);
  *
- * @param align The Align object to get the row of.
- * @param pos   The number of the row to get.
- *
- * @signature TRow Reference to the given row of align  (Type: @link Gap#Row @endlink).
+ * @param[in] align The Align object to get the row of.
+ * @param[in] pos   The number of the row to get.
+ *
+ * @return TRow Reference to the given row of align  (Metafunction: @link Align#Row @endlink).
  */

 /**
@@ -457,9 +457,9 @@
  *
  * @signature TCols cols(align);
  *
- * @param align The Align object to get the cols of.
- *
- * @signature TCols The columns of the Align object (type @link Align#Cols @endlink).
+ * @param[in] align The Align object to get the cols of.
+ *
+ * @return TCols The columns of the Align object (Metafunction: @link Align#Cols @endlink).
  */

 /**
@@ -499,9 +499,9 @@
  *
  * @signature TCol col(align);
  *
- * @param align The Align object to get the cols of.
- *
- * @signature TCol The column of the Align object (type @link Align#Col @endlink).
+ * @param[in] align The Align object to get the cols of.
+ *
+ * @return TCol The column of the Align object (Metafunction: @link Align#Col @endlink).
  */

 /**
@@ -571,9 +571,9 @@
  *
  * @signature void write(stream, align, id, Raw());
  *
- * @param stream The Stream to write to.
- * @param align  The Align object to write out.
- * @param id     ID string (ignored).
+ * @param[in,out] stream The Stream to write to.
+ * @param[in]     align  The Align object to write out.
+ * @param[in]     id     ID string (ignored).
  */

 // TODO(holtgrew): Part of the old I/O system. Undocumented. Rename Raw() to HumanReadable() or OnScreen()?
@@ -673,7 +673,7 @@
  *
  * @signature void clearClipping(align);
  *
- * @param align Align object to clear clippings of.
+ * @param[in,out] align Align object to clear clippings of.
  */

 // TODO(holtgrew): Undocumented.
@@ -699,8 +699,8 @@
  *
  * @signature TStream operator<<(stream, align);
  *
- * @param stream std::ostream to write to.
- * @param align  Align object to write out.
+ * @param[in,out] stream <tt>std::ostream</tt> to write to.
+ * @param[in]     align  Align object to write out.
  *
  * @return TStream Reference to stream after output of align.
  */
@@ -726,8 +726,8 @@
  *
  * @signature void setStrings(align, stringSet);
  *
- * @param align     Align object to set underlying sequence of.
- * @param stringSet The source of the data.
+ * @param[in,out] align     Align object to set underlying sequence of.
+ * @param[in]     stringSet The @link StringSet @endlink with the data.
  */

 /**
@@ -777,7 +777,7 @@
  *
  * @signature void clearGaps(align);
  *
- * @param align The Align object to clear all all gaps from.
+ * @param[in] align The Align object to clear all all gaps from.
  */

 template <typename TSource, typename TSpec>
@@ -802,9 +802,9 @@
  *
  * @signature TStringSet stringSet(align);
  *
- * @param align Align object to get sequences of.
- *
- * @return TStringSet The set of ungapped sequences.  Get type with Gaps#StringSetType.
+ * @param[in] align Align object to get sequences of.
+ *
+ * @return TStringSet The set of ungapped sequences (Metafunction: @link Align#StringSetType @endlink).
  */

 /**


rpc: copy NUL byte in cstring.

rpc: copy NUL byte in cstring.

--- mongoc/mongoc-rpc.c
+++ mongoc/mongoc-rpc.c
@@ -283,7 +283,7 @@
       bson_bool_t found = FALSE; \
       for (__i = 0; __i < buflen && __i < sizeof(rpc->_name); __i++) { \
          if (!buf[__i]) { \
-            memcpy(rpc->_name, buf, __i); \
+            memcpy(rpc->_name, buf, __i + 1); \
             buflen -= __i + 1; \
             buf += __i + 1; \
             found = TRUE; \