V4L/DVB (10625): ivtv: fix decoder crash regression

The video_ioctl2 conversion of ivtv in kernel 2.6.27 introduced a bug
causing decoder commands to crash. The decoder commands should have been
handled from the video_ioctl2 default handler, ensuring correct mapping
of the argument between user and kernel space. Unfortunately they ended
up before the video_ioctl2 call, causing random crashes.

Thanks to hannes@linus.priv.at for testing and helping me track down the
cause!

Signed-off-by: Hans Verkuil <f625be9dbdcbbd12a043857af148e8fb895d9a1d@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <ad86ba2154032c9f55743a190faa2459a9d61d42@redhat.com>

--- drivers/media/video/ivtv/ivtv-ioctl.c
+++ drivers/media/video/ivtv/ivtv-ioctl.c
@@ -1748,48 +1748,6 @@
 		break;
 	}

-	default:
-		return -EINVAL;
-	}
-	return 0;
-}
-
-static long ivtv_serialized_ioctl(struct ivtv *itv, struct file *filp,
-		unsigned int cmd, unsigned long arg)
-{
-	struct video_device *vfd = video_devdata(filp);
-	struct ivtv_open_id *id = (struct ivtv_open_id *)filp->private_data;
-	long ret;
-
-	/* Filter dvb ioctls that cannot be handled by the v4l ioctl framework */
-	switch (cmd) {
-	case VIDEO_SELECT_SOURCE:
-		IVTV_DEBUG_IOCTL("VIDEO_SELECT_SOURCE\n");
-		if (!(itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT))
-			return -EINVAL;
-		return ivtv_passthrough_mode(itv, arg == VIDEO_SOURCE_DEMUX);
-
-	case AUDIO_SET_MUTE:
-		IVTV_DEBUG_IOCTL("AUDIO_SET_MUTE\n");
-		itv->speed_mute_audio = arg;
-		return 0;
-
-	case AUDIO_CHANNEL_SELECT:
-		IVTV_DEBUG_IOCTL("AUDIO_CHANNEL_SELECT\n");
-		if (arg > AUDIO_STEREO_SWAPPED)
-			return -EINVAL;
-		itv->audio_stereo_mode = arg;
-		ivtv_vapi(itv, CX2341X_DEC_SET_AUDIO_MODE, 2, itv->audio_bilingual_mode, itv->audio_stereo_mode);
-		return 0;
-
-	case AUDIO_BILINGUAL_CHANNEL_SELECT:
-		IVTV_DEBUG_IOCTL("AUDIO_BILINGUAL_CHANNEL_SELECT\n");
-		if (arg > AUDIO_STEREO_SWAPPED)
-			return -EINVAL;
-		itv->audio_bilingual_mode = arg;
-		ivtv_vapi(itv, CX2341X_DEC_SET_AUDIO_MODE, 2, itv->audio_bilingual_mode, itv->audio_stereo_mode);
-		return 0;
-
 	case IVTV_IOC_DMA_FRAME:
 	case VIDEO_GET_PTS:
 	case VIDEO_GET_FRAME_COUNT:
@@ -1800,7 +1758,49 @@
 	case VIDEO_CONTINUE:
 	case VIDEO_COMMAND:
 	case VIDEO_TRY_COMMAND:
-		return ivtv_decoder_ioctls(filp, cmd, (void *)arg);
+		return ivtv_decoder_ioctls(file, cmd, (void *)arg);
+
+	default:
+		return -EINVAL;
+	}
+	return 0;
+}
+
+static long ivtv_serialized_ioctl(struct ivtv *itv, struct file *filp,
+		unsigned int cmd, unsigned long arg)
+{
+	struct video_device *vfd = video_devdata(filp);
+	struct ivtv_open_id *id = (struct ivtv_open_id *)filp->private_data;
+	long ret;
+
+	/* Filter dvb ioctls that cannot be handled by the v4l ioctl framework */
+	switch (cmd) {
+	case VIDEO_SELECT_SOURCE:
+		IVTV_DEBUG_IOCTL("VIDEO_SELECT_SOURCE\n");
+		if (!(itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT))
+			return -EINVAL;
+		return ivtv_passthrough_mode(itv, arg == VIDEO_SOURCE_DEMUX);
+
+	case AUDIO_SET_MUTE:
+		IVTV_DEBUG_IOCTL("AUDIO_SET_MUTE\n");
+		itv->speed_mute_audio = arg;
+		return 0;
+
+	case AUDIO_CHANNEL_SELECT:
+		IVTV_DEBUG_IOCTL("AUDIO_CHANNEL_SELECT\n");
+		if (arg > AUDIO_STEREO_SWAPPED)
+			return -EINVAL;
+		itv->audio_stereo_mode = arg;
+		ivtv_vapi(itv, CX2341X_DEC_SET_AUDIO_MODE, 2, itv->audio_bilingual_mode, itv->audio_stereo_mode);
+		return 0;
+
+	case AUDIO_BILINGUAL_CHANNEL_SELECT:
+		IVTV_DEBUG_IOCTL("AUDIO_BILINGUAL_CHANNEL_SELECT\n");
+		if (arg > AUDIO_STEREO_SWAPPED)
+			return -EINVAL;
+		itv->audio_bilingual_mode = arg;
+		ivtv_vapi(itv, CX2341X_DEC_SET_AUDIO_MODE, 2, itv->audio_bilingual_mode, itv->audio_stereo_mode);
+		return 0;

 	default:
 		break;


drm: include kernel list header file in hashtab header

Signed-off-by: Dave Airlie <f2295d84e358395675bc8031be58672073ae065e@redhat.com>

--- include/drm/drm_hashtab.h
+++ include/drm/drm_hashtab.h
@@ -35,6 +35,8 @@
 #ifndef DRM_HASHTAB_H
 #define DRM_HASHTAB_H

+#include <linux/list.h>
+
 #define drm_hash_entry(_ptr, _type, _member) container_of(_ptr, _type, _member)

 struct drm_hash_item {


Bluetooth: Remove SCO fragments on connection close

SCO packet reassembler may have a fragment of SCO packet, from
previous connection, cached and not removed when SCO connection
is ended. Packets from new SCO connection are then going to be
attached to that fragment, creating an invalid SCO packets.

Controllers like Intel's WilkinsPeak are always fragmenting
SCO packet into 3 parts (#1, #2, #3). Packet #1 contains
SCO header and audio data, others just audio data. if there is
a fragment cached from previous connection, i.e. #1, first
SCO packet from new connection is going to be attached to it
creating packet consisting of fragments #1-#1-#2. This will
be forwarded to upper layers. After that, fragment #3 is going
to be used as a starting point for another SCO packet.
It does not contain a SCO header, but the code expects it,
casts a SCO header structure on it, and reads whatever audio
data happens to be there as SCO packet length and handle.
From that point on, we are assembling random data into SCO
packets. Usually it recovers quickly as initial audio data
contains mostly zeros (muted stream), but setups of over
4 seconds were observed.
Issue manifests itself by printing on the console:
Bluetooth: hci0 SCO packet for unknown connection handle 48
Bluetooth: hci0 SCO packet for unknown connection handle 2560
Bluetooth: hci0 SCO packet for unknown connection handle 12288
It may also show random handles if audio data was non-zeroed.
Hcidump shows SCO packets with random length and handles.

Few messages with handle 0 at connection creation are OK
for some controllers (like WilkinsPeak), as there are SCO packets
with zeroed handle at the beginning (possible controller bug).
Few of such messages at connection end, with a handle looking
sane (around 256, 512, 768 ...) is also OK, as these are last
SCO packets that were assembled and sent up, before connection
was ended, but were not handled in time.

This issue may still manifest itself on WilkinsPeak as it sometimes,
at SCO connection creation, does not send third fragment of first
SCO packet (#1-#2-#1-#2-#3...). This is a firmware bug and this
patch does not address it.

Signed-off-by: Kuba Pawlak <5c207562f826804d3590e200efededa8d451a88c@intel.com>
Signed-off-by: Marcel Holtmann <44592b4eea36663c86b994bb0ea99d15309c1c7d@holtmann.org>


sh_eth: propagate platform_get_irq() error upstream

The driver overrides the error returned by platform_get_irq() with -ENODEV
which e.g. precludes the deferred  probing from working. Propagate the real
error code to the driver core instead.

Signed-off-by: Sergei Shtylyov <d8c69075be49b0738b690ec4af0e9025b8c97c9e@cogentembedded.com>
Acked-by: Geert Uytterhoeven <a1ff81395f7e6bf5b509fe9aab06bf3419493e1d@glider.be>
Signed-off-by: David S. Miller <fe08d3c717adf2ae63592e4c9aec6e3e404d8e3e@davemloft.net>

--- drivers/net/ethernet/renesas/sh_eth.c
+++ drivers/net/ethernet/renesas/sh_eth.c
@@ -3089,10 +3089,8 @@

 	ndev->dma = -1;
 	ret = platform_get_irq(pdev, 0);
-	if (ret < 0) {
-		ret = -ENODEV;
+	if (ret < 0)
 		goto out_release;
-	}
 	ndev->irq = ret;

 	SET_NETDEV_DEV(ndev, &pdev->dev);


[IA64-SGI] snsc_event.c new file

[IA64-SGI] snsc_event.c new file

Forgot the "bk new" to add this file. Part of the patch
from Greg Howard

Signed-off-by: Tony Luck <e7984595ec0368ff920a7b3521dc7093683f6f26@intel.com>

error: pathspec 'drivers/char/snsc_event.c' did not match any file(s) known to git

--- drivers/char/snsc_event.c
+++ drivers/char/snsc_event.c
@@ -0,0 +1,304 @@
+/*
+ * SN Platform system controller communication support
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (C) 2004 Silicon Graphics, Inc. All rights reserved.
+ */
+
+/*
+ * System controller event handler
+ *
+ * These routines deal with environmental events arriving from the
+ * system controllers.
+ */
+
+#include <linux/interrupt.h>
+#include <linux/sched.h>
+#include <linux/byteorder/generic.h>
+#include <asm/sn/sn_sal.h>
+#include "snsc.h"
+
+static struct subch_data_s *event_sd;
+
+void scdrv_event(unsigned long);
+DECLARE_TASKLET(sn_sysctl_event, scdrv_event, 0);
+
+/*
+ * scdrv_event_interrupt
+ *
+ * Pull incoming environmental events off the physical link to the
+ * system controller and put them in a temporary holding area in SAL.
+ * Schedule scdrv_event() to move them along to their ultimate
+ * destination.
+ */
+static irqreturn_t
+scdrv_event_interrupt(int irq, void *subch_data, struct pt_regs *regs)
+{
+	struct subch_data_s *sd = subch_data;
+	unsigned long flags;
+	int status;
+
+	spin_lock_irqsave(&sd->sd_rlock, flags);
+	status = ia64_sn_irtr_intr(sd->sd_nasid, sd->sd_subch);
+
+	if ((status > 0) && (status & SAL_IROUTER_INTR_RECV)) {
+		tasklet_schedule(&sn_sysctl_event);
+	}
+	spin_unlock_irqrestore(&sd->sd_rlock, flags);
+	return IRQ_HANDLED;
+}
+
+
+/*
+ * scdrv_parse_event
+ *
+ * Break an event (as read from SAL) into useful pieces so we can decide
+ * what to do with it.
+ */
+static int
+scdrv_parse_event(char *event, int *src, int *code, int *esp_code, char *desc)
+{
+	char *desc_end;
+
+	/* record event source address */
+	*src = be32_to_cpup((__be32 *)event);
+	event += 4; 			/* move on to event code */
+
+	/* record the system controller's event code */
+	*code = be32_to_cpup((__be32 *)event);
+	event += 4;			/* move on to event arguments */
+
+	/* how many arguments are in the packet? */
+	if (*event++ != 2) {
+		/* if not 2, give up */
+		return -1;
+	}
+
+	/* parse out the ESP code */
+	if (*event++ != IR_ARG_INT) {
+		/* not an integer argument, so give up */
+		return -1;
+	}
+	*esp_code = be32_to_cpup((__be32 *)event);
+	event += 4;
+
+	/* parse out the event description */
+	if (*event++ != IR_ARG_ASCII) {
+		/* not an ASCII string, so give up */
+		return -1;
+	}
+	event[CHUNKSIZE-1] = '\0';	/* ensure this string ends! */
+	event += 2; 			/* skip leading CR/LF */
+	desc_end = desc + sprintf(desc, "%s", event);
+
+	/* strip trailing CR/LF (if any) */
+	for (desc_end--;
+	     (desc_end != desc) && ((*desc_end == 0xd) || (*desc_end == 0xa));
+	     desc_end--) {
+		*desc_end = '\0';
+	}
+
+	return 0;
+}
+
+
+/*
+ * scdrv_event_severity
+ *
+ * Figure out how urgent a message we should write to the console/syslog
+ * via printk.
+ */
+static char *
+scdrv_event_severity(int code)
+{
+	int ev_class = (code & EV_CLASS_MASK);
+	int ev_severity = (code & EV_SEVERITY_MASK);
+	char *pk_severity = KERN_NOTICE;
+
+	switch (ev_class) {
+	case EV_CLASS_POWER:
+		switch (ev_severity) {
+		case EV_SEVERITY_POWER_LOW_WARNING:
+		case EV_SEVERITY_POWER_HIGH_WARNING:
+			pk_severity = KERN_WARNING;
+			break;
+		case EV_SEVERITY_POWER_HIGH_FAULT:
+		case EV_SEVERITY_POWER_LOW_FAULT:
+			pk_severity = KERN_ALERT;
+			break;
+		}
+		break;
+	case EV_CLASS_FAN:
+		switch (ev_severity) {
+		case EV_SEVERITY_FAN_WARNING:
+			pk_severity = KERN_WARNING;
+			break;
+		case EV_SEVERITY_FAN_FAULT:
+			pk_severity = KERN_CRIT;
+			break;
+		}
+		break;
+	case EV_CLASS_TEMP:
+		switch (ev_severity) {
+		case EV_SEVERITY_TEMP_ADVISORY:
+			pk_severity = KERN_WARNING;
+			break;
+		case EV_SEVERITY_TEMP_CRITICAL:
+			pk_severity = KERN_CRIT;
+			break;
+		case EV_SEVERITY_TEMP_FAULT:
+			pk_severity = KERN_ALERT;
+			break;
+		}
+		break;
+	case EV_CLASS_ENV:
+		pk_severity = KERN_ALERT;
+		break;
+	case EV_CLASS_TEST_FAULT:
+		pk_severity = KERN_ALERT;
+		break;
+	case EV_CLASS_TEST_WARNING:
+		pk_severity = KERN_WARNING;
+		break;
+	case EV_CLASS_PWRD_NOTIFY:
+		pk_severity = KERN_ALERT;
+		break;
+	}
+
+	return pk_severity;
+}
+
+
+/*
+ * scdrv_dispatch_event
+ *
+ * Do the right thing with an incoming event.  That's often nothing
+ * more than printing it to the system log.  For power-down notifications
+ * we start a graceful shutdown.
+ */
+static void
+scdrv_dispatch_event(char *event, int len)
+{
+	int code, esp_code, src;
+	char desc[CHUNKSIZE];
+	char *severity;
+
+	if (scdrv_parse_event(event, &src, &code, &esp_code, desc) < 0) {
+		/* ignore uninterpretible event */
+		return;
+	}
+
+	/* how urgent is the message? */
+	severity = scdrv_event_severity(code);
+
+	if ((code & EV_CLASS_MASK) == EV_CLASS_PWRD_NOTIFY) {
+		struct task_struct *p;
+
+		/* give a SIGPWR signal to init proc */
+
+		/* first find init's task */
+		read_lock(&tasklist_lock);
+		for_each_process(p) {
+			if (p->pid == 1)
+				break;
+		}
+		if (p) { /* we found init's task */
+			printk(KERN_EMERG "Power off indication received. Initiating power fail sequence...\n");
+			force_sig(SIGPWR, p);
+		} else { /* failed to find init's task - just give message(s) */
+			printk(KERN_WARNING "Failed to find init proc to handle power off!\n");
+			printk("%s|$(0x%x)%s\n", severity, esp_code, desc);
+		}
+		read_unlock(&tasklist_lock);
+	} else {
+		/* print to system log */
+		printk("%s|$(0x%x)%s\n", severity, esp_code, desc);
+	}
+}
+
+
+/*
+ * scdrv_event
+ *
+ * Called as a tasklet when an event arrives from the L1.  Read the event
+ * from where it's temporarily stored in SAL and call scdrv_dispatch_event()
+ * to send it on its way.  Keep trying to read events until SAL indicates
+ * that there are no more immediately available.
+ */
+void
+scdrv_event(unsigned long dummy)
+{
+	int status;
+	int len;
+	unsigned long flags;
+	struct subch_data_s *sd = event_sd;
+
+	/* anything to read? */
+	len = CHUNKSIZE;
+	spin_lock_irqsave(&sd->sd_rlock, flags);
+	status = ia64_sn_irtr_recv(sd->sd_nasid, sd->sd_subch,
+				   sd->sd_rb, &len);
+
+	while (!(status < 0)) {
+		spin_unlock_irqrestore(&sd->sd_rlock, flags);
+		scdrv_dispatch_event(sd->sd_rb, len);
+		len = CHUNKSIZE;
+		spin_lock_irqsave(&sd->sd_rlock, flags);
+		status = ia64_sn_irtr_recv(sd->sd_nasid, sd->sd_subch,
+					   sd->sd_rb, &len);
+	}
+	spin_unlock_irqrestore(&sd->sd_rlock, flags);
+}
+
+
+/*
+ * scdrv_event_init
+ *
+ * Sets up a system controller subchannel to begin receiving event
+ * messages. This is sort of a specialized version of scdrv_open()
+ * in drivers/char/sn_sysctl.c.
+ */
+void
+scdrv_event_init(struct sysctl_data_s *scd)
+{
+	int rv;
+
+	event_sd = kmalloc(sizeof (struct subch_data_s), GFP_KERNEL);
+	if (event_sd == NULL) {
+		printk(KERN_WARNING "%s: couldn't allocate subchannel info"
+		       " for event monitoring\n", __FUNCTION__);
+		return;
+	}
+
+	/* initialize subch_data_s fields */
+	memset(event_sd, 0, sizeof (struct subch_data_s));
+	event_sd->sd_nasid = scd->scd_nasid;
+	spin_lock_init(&event_sd->sd_rlock);
+
+	/* ask the system controllers to send events to this node */
+	event_sd->sd_subch = ia64_sn_sysctl_event_init(scd->scd_nasid);
+
+	if (event_sd->sd_subch < 0) {
+		kfree(event_sd);
+		printk(KERN_WARNING "%s: couldn't open event subchannel\n",
+		       __FUNCTION__);
+		return;
+	}
+
+	/* hook event subchannel up to the system controller interrupt */
+	rv = request_irq(SGI_UART_VECTOR, scdrv_event_interrupt,
+			 SA_SHIRQ | SA_INTERRUPT,
+			 "system controller events", event_sd);
+	if (rv) {
+		printk(KERN_WARNING "%s: irq request failed (%d)\n",
+		       __FUNCTION__, rv);
+		ia64_sn_irtr_close(event_sd->sd_nasid, event_sd->sd_subch);
+		kfree(event_sd);
+		return;
+	}
+}
+
+


marked iNetworkSocket as deprectaed with a #warning

git-svn-id: 28d9401aa571d5108e51b194aae6f24ca5964c06@14552 8cc4aa7f-3514-0410-904f-f2cc9021211c

--- include/inetwork/socket.h
+++ include/inetwork/socket.h
@@ -23,6 +23,10 @@
 #include "inetwork/driver.h"
 #include "cssys/sockets.h"

+#ifndef COMP_VC
+# warning This file is deprecated please use iNetworkSocket2
+#endif
+
 SCF_VERSION (iNetworkSocket, 0, 0, 1);

 /**


ath5k: review RX descriptor functions

ath5k: review RX descriptor functions

Reviewed RX descriptor functions against the HAL sources. Some minor changes:

  - check size before making changes to the descriptor

  - whitespace

  - add comments about 5210 timestamps. this needs to be adressed later!

  - FIFO overrun error only available on 5210

  - rs_phyerr should not be OR'ed

  - clear the whole ath5k_rx_status structure before using, instead of
    zeroing specific fields.

Signed-off-by: Bruno Randolf <8baeabad365de895ab58ec0d6dd2c1e27b0ff0b4@einfach.org>
Signed-off-by: John W. Linville <2a53bac7a5d324865ef46ec4c38b2c0fba1456b4@tuxdriver.com>

--- drivers/net/wireless/ath/ath5k/desc.c
+++ drivers/net/wireless/ath/ath5k/desc.c
@@ -499,10 +499,11 @@
 	*/
 	memset(&desc->ud.ds_rx, 0, sizeof(struct ath5k_hw_all_rx_desc));

+	if (unlikely(size & ~AR5K_DESC_RX_CTL1_BUF_LEN))
+		return -EINVAL;
+
 	/* Setup descriptor */
 	rx_ctl->rx_control_1 = size & AR5K_DESC_RX_CTL1_BUF_LEN;
-	if (unlikely(rx_ctl->rx_control_1 != size))
-		return -EINVAL;

 	if (flags & AR5K_RXDESC_INTREQ)
 		rx_ctl->rx_control_1 |= AR5K_DESC_RX_CTL1_INTREQ;
@@ -522,8 +523,10 @@

 	/* No frame received / not ready */
 	if (unlikely(!(rx_status->rx_status_1 &
-	AR5K_5210_RX_DESC_STATUS1_DONE)))
+			AR5K_5210_RX_DESC_STATUS1_DONE)))
 		return -EINPROGRESS;
+
+	memset(rs, 0, sizeof(struct ath5k_rx_status));

 	/*
 	 * Frame receive status
@@ -536,7 +539,11 @@
 		AR5K_5210_RX_DESC_STATUS0_RECEIVE_RATE);
 	rs->rs_more = !!(rx_status->rx_status_0 &
 		AR5K_5210_RX_DESC_STATUS0_MORE);
-	/* TODO: this timestamp is 13 bit, later on we assume 15 bit */
+	/* TODO: this timestamp is 13 bit, later on we assume 15 bit!
+	 * also the HAL code for 5210 says the timestamp is bits [10..22] of the
+	 * TSF, and extends the timestamp here to 15 bit.
+	 * we need to check on 5210...
+	 */
 	rs->rs_tstamp = AR5K_REG_MS(rx_status->rx_status_1,
 		AR5K_5210_RX_DESC_STATUS1_RECEIVE_TIMESTAMP);

@@ -548,9 +555,6 @@
 				AR5K_5210_RX_DESC_STATUS0_RECEIVE_ANT_5210)
 				? 2 : 1;

-	rs->rs_status = 0;
-	rs->rs_phyerr = 0;
-
 	/*
 	 * Key table status
 	 */
@@ -564,19 +568,21 @@
 	 * Receive/descriptor errors
 	 */
 	if (!(rx_status->rx_status_1 &
-	AR5K_5210_RX_DESC_STATUS1_FRAME_RECEIVE_OK)) {
+			AR5K_5210_RX_DESC_STATUS1_FRAME_RECEIVE_OK)) {
 		if (rx_status->rx_status_1 &
 				AR5K_5210_RX_DESC_STATUS1_CRC_ERROR)
 			rs->rs_status |= AR5K_RXERR_CRC;

-		if (rx_status->rx_status_1 &
-				AR5K_5210_RX_DESC_STATUS1_FIFO_OVERRUN_5210)
+		/* only on 5210 */
+		if ((ah->ah_version == AR5K_AR5210) &&
+		    (rx_status->rx_status_1 &
+				AR5K_5210_RX_DESC_STATUS1_FIFO_OVERRUN_5210))
 			rs->rs_status |= AR5K_RXERR_FIFO;

 		if (rx_status->rx_status_1 &
 				AR5K_5210_RX_DESC_STATUS1_PHY_ERROR) {
 			rs->rs_status |= AR5K_RXERR_PHY;
-			rs->rs_phyerr |= AR5K_REG_MS(rx_status->rx_status_1,
+			rs->rs_phyerr = AR5K_REG_MS(rx_status->rx_status_1,
 				AR5K_5210_RX_DESC_STATUS1_PHY_ERROR);
 		}

@@ -603,6 +609,8 @@
 	if (unlikely(!(rx_status->rx_status_1 &
 				AR5K_5212_RX_DESC_STATUS1_DONE)))
 		return -EINPROGRESS;
+
+	memset(rs, 0, sizeof(struct ath5k_rx_status));

 	/*
 	 * Frame receive status
@@ -619,8 +627,6 @@
 		AR5K_5212_RX_DESC_STATUS0_MORE);
 	rs->rs_tstamp = AR5K_REG_MS(rx_status->rx_status_1,
 		AR5K_5212_RX_DESC_STATUS1_RECEIVE_TIMESTAMP);
-	rs->rs_status = 0;
-	rs->rs_phyerr = 0;

 	/*
 	 * Key table status
@@ -643,7 +649,7 @@
 		if (rx_status->rx_status_1 &
 				AR5K_5212_RX_DESC_STATUS1_PHY_ERROR) {
 			rs->rs_status |= AR5K_RXERR_PHY;
-			rs->rs_phyerr |= AR5K_REG_MS(rx_status->rx_status_1,
+			rs->rs_phyerr = AR5K_REG_MS(rx_status->rx_status_1,
 				AR5K_5212_RX_DESC_STATUS1_PHY_ERROR_CODE);
 			ath5k_ani_phy_error_report(ah, rs->rs_phyerr);
 		}


proc tty: switch synclinkmp to ->proc_fops

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

--- drivers/char/synclinkmp.c
+++ drivers/char/synclinkmp.c
@@ -50,6 +50,7 @@
 #include <linux/ptrace.h>
 #include <linux/ioport.h>
 #include <linux/mm.h>
+#include <linux/seq_file.h>
 #include <linux/slab.h>
 #include <linux/netdevice.h>
 #include <linux/vmalloc.h>
@@ -520,7 +521,6 @@
 static void tx_release(struct tty_struct *tty);

 static int  ioctl(struct tty_struct *tty, struct file *file, unsigned int cmd, unsigned long arg);
-static int  read_proc(char *page, char **start, off_t off, int count,int *eof, void *data);
 static int  chars_in_buffer(struct tty_struct *tty);
 static void throttle(struct tty_struct * tty);
 static void unthrottle(struct tty_struct * tty);
@@ -1354,13 +1354,12 @@
  * /proc fs routines....
  */

-static inline int line_info(char *buf, SLMP_INFO *info)
+static inline void line_info(struct seq_file *m, SLMP_INFO *info)
 {
 	char	stat_buf[30];
-	int	ret;
 	unsigned long flags;

-	ret = sprintf(buf, "%s: SCABase=%08x Mem=%08X StatusControl=%08x LCR=%08X\n"
+	seq_printf(m, "%s: SCABase=%08x Mem=%08X StatusControl=%08x LCR=%08X\n"
 		       "\tIRQ=%d MaxFrameSize=%u\n",
 		info->device_name,
 		info->phys_sca_base,
@@ -1391,74 +1390,69 @@
 		strcat(stat_buf, "|RI");

 	if (info->params.mode == MGSL_MODE_HDLC) {
-		ret += sprintf(buf+ret, "\tHDLC txok:%d rxok:%d",
+		seq_printf(m, "\tHDLC txok:%d rxok:%d",
 			      info->icount.txok, info->icount.rxok);
 		if (info->icount.txunder)
-			ret += sprintf(buf+ret, " txunder:%d", info->icount.txunder);
+			seq_printf(m, " txunder:%d", info->icount.txunder);
 		if (info->icount.txabort)
-			ret += sprintf(buf+ret, " txabort:%d", info->icount.txabort);
+			seq_printf(m, " txabort:%d", info->icount.txabort);
 		if (info->icount.rxshort)
-			ret += sprintf(buf+ret, " rxshort:%d", info->icount.rxshort);
+			seq_printf(m, " rxshort:%d", info->icount.rxshort);
 		if (info->icount.rxlong)
-			ret += sprintf(buf+ret, " rxlong:%d", info->icount.rxlong);
+			seq_printf(m, " rxlong:%d", info->icount.rxlong);
 		if (info->icount.rxover)
-			ret += sprintf(buf+ret, " rxover:%d", info->icount.rxover);
+			seq_printf(m, " rxover:%d", info->icount.rxover);
 		if (info->icount.rxcrc)
-			ret += sprintf(buf+ret, " rxlong:%d", info->icount.rxcrc);
+			seq_printf(m, " rxlong:%d", info->icount.rxcrc);
 	} else {
-		ret += sprintf(buf+ret, "\tASYNC tx:%d rx:%d",
+		seq_printf(m, "\tASYNC tx:%d rx:%d",
 			      info->icount.tx, info->icount.rx);
 		if (info->icount.frame)
-			ret += sprintf(buf+ret, " fe:%d", info->icount.frame);
+			seq_printf(m, " fe:%d", info->icount.frame);
 		if (info->icount.parity)
-			ret += sprintf(buf+ret, " pe:%d", info->icount.parity);
+			seq_printf(m, " pe:%d", info->icount.parity);
 		if (info->icount.brk)
-			ret += sprintf(buf+ret, " brk:%d", info->icount.brk);
+			seq_printf(m, " brk:%d", info->icount.brk);
 		if (info->icount.overrun)
-			ret += sprintf(buf+ret, " oe:%d", info->icount.overrun);
+			seq_printf(m, " oe:%d", info->icount.overrun);
 	}

 	/* Append serial signal status to end */
-	ret += sprintf(buf+ret, " %s\n", stat_buf+1);
-
-	ret += sprintf(buf+ret, "\ttxactive=%d bh_req=%d bh_run=%d pending_bh=%x\n",
+	seq_printf(m, " %s\n", stat_buf+1);
+
+	seq_printf(m, "\ttxactive=%d bh_req=%d bh_run=%d pending_bh=%x\n",
 	 info->tx_active,info->bh_requested,info->bh_running,
 	 info->pending_bh);
-
-	return ret;
 }

 /* Called to print information about devices
  */
-static int read_proc(char *page, char **start, off_t off, int count,
-	      int *eof, void *data)
-{
-	int len = 0, l;
-	off_t	begin = 0;
+static int synclinkmp_proc_show(struct seq_file *m, void *v)
+{
 	SLMP_INFO *info;

-	len += sprintf(page, "synclinkmp driver:%s\n", driver_version);
+	seq_printf(m, "synclinkmp driver:%s\n", driver_version);

 	info = synclinkmp_device_list;
 	while( info ) {
-		l = line_info(page + len, info);
-		len += l;
-		if (len+begin > off+count)
-			goto done;
-		if (len+begin < off) {
-			begin += len;
-			len = 0;
-		}
+		line_info(m, info);
 		info = info->next_device;
 	}
-
-	*eof = 1;
-done:
-	if (off >= len+begin)
-		return 0;
-	*start = page + (off-begin);
-	return ((count < begin+len-off) ? count : begin+len-off);
-}
+	return 0;
+}
+
+static int synclinkmp_proc_open(struct inode *inode, struct file *file)
+{
+	return single_open(file, synclinkmp_proc_show, NULL);
+}
+
+static const struct file_operations synclinkmp_proc_fops = {
+	.owner		= THIS_MODULE,
+	.open		= synclinkmp_proc_open,
+	.read		= seq_read,
+	.llseek		= seq_lseek,
+	.release	= single_release,
+};

 /* Return the count of bytes in transmit buffer
  */
@@ -3905,13 +3899,13 @@
 	.send_xchar = send_xchar,
 	.break_ctl = set_break,
 	.wait_until_sent = wait_until_sent,
- 	.read_proc = read_proc,
 	.set_termios = set_termios,
 	.stop = tx_hold,
 	.start = tx_release,
 	.hangup = hangup,
 	.tiocmget = tiocmget,
 	.tiocmset = tiocmset,
+	.proc_fops = &synclinkmp_proc_fops,
 };


Fixed compilation with modern GCC

Fixed compilation with modern GCC

--- include/kognac/progargs.h
+++ include/kognac/progargs.h
@@ -7,6 +7,7 @@
 #include <vector>
 #include <set>
 #include <map>
+#include <memory>

 using namespace std;


Remove unnecessary include file.

Remove unnecessary include file.

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

--- deal.II/include/deal.II/lac/trilinos_sparsity_pattern.h
+++ deal.II/include/deal.II/lac/trilinos_sparsity_pattern.h
@@ -27,7 +27,6 @@
 #  include <memory>

 #  include <base/std_cxx1x/shared_ptr.h>
-#  include <boost/scoped_ptr.hpp>

 #  include <Epetra_FECrsGraph.h>
 #  include <Epetra_Map.h>


Signed-off-by: mrlitong <litongtongxue@gmail.com>

error: pathspec 'GameMain.h' did not match any file(s) known to git

--- GameMain.h
+++ GameMain.h
@@ -0,0 +1,2 @@
+#pragma once
+class CGameProcess;


espnow: fix the bug for calling esp_wifi_set_channel(), this function only can be called after Wi-Fi started and sniffer enabled.

--- examples/wifi/espnow/main/espnow_example_main.c
+++ examples/wifi/espnow/main/espnow_example_main.c
@@ -49,12 +49,6 @@
     ESP_ERROR_CHECK( esp_wifi_set_mode(ESPNOW_WIFI_MODE) );
     ESP_ERROR_CHECK( esp_wifi_start());

-    /* In order to simplify example, channel is set after WiFi started.
-     * This is not necessary in real application if the two devices have
-     * been already on the same channel.
-     */
-    ESP_ERROR_CHECK( esp_wifi_set_channel(CONFIG_ESPNOW_CHANNEL, 0) );
-
 #if CONFIG_ESPNOW_ENABLE_LONG_RANGE
     ESP_ERROR_CHECK( esp_wifi_set_protocol(ESPNOW_WIFI_IF, WIFI_PROTOCOL_11B|WIFI_PROTOCOL_11G|WIFI_PROTOCOL_11N|WIFI_PROTOCOL_LR) );
 #endif


replaced several includes by including just firm_types.h
fixed some typos

[r8538]

--- ir/ana/execution_frequency.h
+++ ir/ana/execution_frequency.h
@@ -15,20 +15,19 @@

 /** @file execution_frequency.h
  *
- * Estimate exectution freqencies of blocks.
+ * Estimate exectution frequencies of blocks.
  *
  * @author Goetz Lindenmaier
  *
  * We assume the start block of a procedure is executed once.  Based on this we
  * compute the execution freqency of all blocks.
  *
- * The computation of the freqencies depends on the count of exception control
+ * The computation of the frequencies depends on the count of exception control
  * flow computed during the interval analysis.  The interval analysis again
  * depends on stuff computed here.
  */

-#include "irnode.h"
-#include "irgraph.h"
+#include "firm_types.h"

 /* A proj from a Cond that goes to an exception handler. */
 int is_fragile_Proj(ir_node *n);
@@ -62,7 +61,7 @@
 /** Free occupied memory, reset for all graphs. */
 void free_execution_frequency(void);

-/** State of execution freqencies for graphs and the whole program.
+/** State of execution frequencies for graphs and the whole program.
  *
  * The exec_freq_state in irp is consistent, if the state of all graphs is consistent.
  * It is none, if the state of all graphs is none.  Else it is inconsistent. */


Fixed wrong usage of token pasting operator ##.

--- src/CppParser/CppParser.h
+++ src/CppParser/CppParser.h
@@ -11,7 +11,7 @@

 #define VECTOR_OPTIONS(type, name) \
     std::vector<type> name; \
-    void push##name##(const type& elem) { name.push_back(elem); }
+    void push##name(const type& elem) { name.push_back(elem); }

 namespace CppSharp { namespace CppParser {


Somehow, the version didn't get set to 1.2.1b1 in the header. I must have been more tired than I thought.

--- GrowlVersion.h
+++ GrowlVersion.h
@@ -1,8 +1,8 @@
 #define COMMENT_1 DO NOT EDIT THE VERSION IN THIS FILE! Change the version in Release/Makefile instead, then run make version while in the Release directory.
 #define COMMENT_2 In case you're wondering why we're using #define for comments: This header is #imported into both Objective-C code and XML Info.plist files.

-#define GROWL_VERSION 1.2.1
-#define GROWL_VERSION_STRING "1.2.1"
+#define GROWL_VERSION 1.2.1b1
+#define GROWL_VERSION_STRING "1.2.1b1"

 #define GROWLMAIL_VERSION 1.2.1
 #define GROWLMAIL_VERSION_STRING "1.2.1"


Fix to compile with MinGW

Fix to compile with MinGW

--- H/sysdep.h
+++ H/sysdep.h
@@ -189,7 +189,7 @@
 #define MYFLT2LONG(x) ((long) lrint((double) (x)))
 #define MYFLT2LRND(x) ((long) lrint((double) (x)))
 #endif
-#elif defined(_WIN32) && defined(_MSC_VER)
+#elif defined(_WIN32) && defined(_MSC_VER) && !defined(__GNUC__)
 #ifndef USE_DOUBLE
 static inline long MYFLT2LONG(float fval)
 {


ath9k: validate for non-zero BSSID

ath9k: validate for non-zero BSSID

before concluding that the recieved beacon is for us, let us make sure
that the BSSID is non-zero. when I configured ad-hoc mode as creator and
left it for some time without joining I found we recieved few frames whose
BSSID is zero, which we concluded wrongly as 'my_beacons'

Signed-off-by: Mohammed Shafi Shajakhan <e345ebb5fb15a590b29a075cdaf46eed42e192de@qca.qualcomm.com>
Signed-off-by: John W. Linville <2a53bac7a5d324865ef46ec4c38b2c0fba1456b4@tuxdriver.com>

--- drivers/net/wireless/ath/ath9k/recv.c
+++ drivers/net/wireless/ath/ath9k/recv.c
@@ -1823,6 +1823,7 @@
 		hdr = (struct ieee80211_hdr *) (hdr_skb->data + rx_status_len);
 		rxs = IEEE80211_SKB_RXCB(hdr_skb);
 		if (ieee80211_is_beacon(hdr->frame_control) &&
+		    !is_zero_ether_addr(common->curbssid) &&
 		    !compare_ether_addr(hdr->addr3, common->curbssid))
 			rs.is_mybeacon = true;
 		else


revise documentation of CatalogTraversal<>

--- cvmfs/catalog_traversal.h
+++ cvmfs/catalog_traversal.h
@@ -32,7 +32,7 @@
  * Callback data which has to be implemented by the registered callback
  * functions/methods (see Observable<> for further details)
  * @param catalog             the catalog object which needs to be processed
- * @param catalog_hash        the SHA-1 content hash of the catalog
+ * @param catalog_hash        the content hash of the catalog
  * @param tree_level          the depth in the nested catalog tree
  *                            (starting at zero)
  * @param history_depth       the distance from the current HEAD revision
@@ -99,20 +99,48 @@
 class ObjectFetcher;

 /**
- * This class traverses the complete catalog hierarchy of a CVMFS repository
- * recursively. The user can specify a callback which is called for each catalog
- * on the way.
- * We are doing a BFS, pre-order traversal here. (I.e. if you simply print
- * the catalogs in the provided order you obtain a nice catalog tree.)
+ * This class traverses the catalog hierarchy of a CVMFS repository recursively.
+ * Also historic catalog trees can be traversed. The user needs to specify a
+ * callback which is called for each catalog on the way.
+ *
+ * CatalogTraversal<> can be configured and used in various ways:
+ *   -> Historic catalog traversal
+ *   -> Never traverse a certain catalog twice
+ *   -> Breadth First Traversal or Depth First Traversal
+ *   -> Optional catalog memory management (no_close)
+ *   -> Use all Named Snapshots of a repository as traversal entry point
+ *   -> Traverse starting from a provided catalog
+ *   -> Traverse catalogs that were previously skipped
+ *
+ * Breadth First Traversal Strategy
+ *   Catalogs are handed out to the user identical as they are traversed.
+ *   Say: From top to buttom. When you would simply print each received catalog
+ *        the result would be a nice representation of the catalog tree.
+ *   This method is more efficient, because catalogs are opened, processed and
+ *   thrown away directly afterwards.
+ *
+ * Depth First Traversal Strategy
+ *   The user gets the catalog tree starting from the leaf nodes.
+ *   Say: From bottom to top. A user can assume that he got all children or
+ *        historical ancestors of a catalog before.
+ *   This method climbs down the full catalog tree and hands it out 'in reverse
+ *   order'. Thus, catalogs on the way are opened, checked for their descendants
+ *   and closed. Once all children and historical ancestors are processed, it is
+ *   re-opened and handed out to the user.
+ *   Note: This method needs more disk space to temporarily storage downloaded
+ *         but not yet processed catalogs.
+ *
  * Note: Since all CVMFS catalog files together can grow to several gigabytes in
  *       file size, each catalog is loaded, processed and removed immediately
- *       afterwards.
+ *       afterwards. Except if no_close is specified, which allows the user to
+ *       choose when a catalog should be closed.
  *
  * @param CatalogT        the catalog class that should be used for traversal
  *                        usually this will be either catalog::Catalog or
  *                        catalog::WritableCatalog
  *                        (please consider to use the typedef'ed versions of
  *                        this template i.e. [Readable|Writable]CatalogTraversal)
+ *
  * @param ObjectFetcherT  Strategy Pattern implementation that is supposed to be
  *                        used mainly for unit-testability. Normal usage should
  *                        not bring up the need to actually set this to anything
@@ -172,7 +200,7 @@
     const unsigned      history_depth;
           CatalogT     *parent;

-    // dynamic processing state
+    // dynamic processing state (used internally)
     std::string   catalog_file_path;
     size_t        catalog_file_size;
     bool          ignore;
@@ -187,6 +215,11 @@
    * This struct represents a catalog traversal context. It needs to be re-
    * created for each catalog traversal process and contains information to this
    * specific catalog traversal run.
+   *
+   * @param history_depth   the history traversal threshold
+   * @param traversal_type  either breadth or depth first traversal strategy
+   * @param catalog_stack   the call stack for catalogs to be traversed
+   * @param callback_stack  used in depth first traversal for deferred yielding
    */
   struct TraversalContext {
     TraversalContext(const unsigned       history_depth,
@@ -311,12 +344,39 @@
   size_t pruned_revision_count() const { return pruned_revisions_.size(); }

  protected:
+  /**
+   * This controls the actual traversal. Using a stack to traverse down the
+   * catalog hierarchy. This method implements the traversal itself, but not
+   * in which way catalogs are handed out to the user code.
+   *
+   * Each catalog is processed in these steps:
+   *  1.) Pop the next catalog from the stack
+   *        Catalogs are always traversed from latest to oldest revision and
+   *        from root to leaf nested catalogs
+   *  2.) Fetch the catalog from the repository
+   *        Depending on where the catalog comes from, this might do different
+   *        things (see ObjectFetcherT).
+   *  3.) Open the fetched catalog
+   *        Depending on the catalog this implementation might differ
+   *        (see CatalogT::AttachFreely)
+   *  4.) Find and push referencing catalogs
+   *        This pushes all descendants of the current catalog onto the stack.
+   *        Note that this is dependant on the strategy (depth or breadth first)
+   *        and on the history threshold (see history_depth). Furthermore,
+   *        catalogs might not be pushed again, when seen before (see
+   *        no_repeat_history).
+   *  5.) Hand the catalog out to the user code
+   *        Depending on the traversal strategy (depth of breadths first) this
+   *        might immediately yield zero to N catalogs to the user code.
+   *
+   * Note: If anything unexpected goes wrong during the traversal process, it
+   *       is aborted immediately.
+   *
+   * @param ctx   the traversal context that steers the whole traversal process
+   * @return      true on successful traversal and false on abort
+   */
   bool DoTraverse(TraversalContext &ctx) {

-    // The CatalogTraversal works with a stack, where new nested catalogs are
-    // pushed onto while processing their parent (breadth first traversal).
-    // When all catalogs are processed, this stack will naturally be empty and
-    // the traversal can terminate
     while (! ctx.catalog_stack.empty()) {
       // Get the top most catalog for the next processing step
       CatalogJob job = ctx.catalog_stack.top(); ctx.catalog_stack.pop();
@@ -338,6 +398,8 @@
       if (! successful_yield) return false;
     }

+    // invariant: after the traversal finshed, there should be no more catalogs
+    //            to traverse or to yield!
     assert (ctx.catalog_stack.empty());
     assert (ctx.callback_stack.empty());
     return true;
@@ -347,6 +409,9 @@
     const bool successful_fetch = object_fetcher_.Fetch( job.hash,
                                                         &job.catalog_file_path);

+    // Due to garbage collection, it might be that catalogs are not fetchable
+    // anymore. However, this only counts for root catalogs, since the garbage
+    // collection works on repository revision granularity.
     if (! successful_fetch) {
       if (ignore_load_failure_ && job.IsRootCatalog()) {
         LogCvmfs(kLogCatalogTraversal, kLogDebug, "ignore missing root catalog "
@@ -388,6 +453,16 @@
     assert (ctx.traversal_type == kBreadthFirstTraversal ||
             ctx.traversal_type == kDepthFirstTraversal);

+    // this differs, depending on the traversal strategy.
+    //
+    // Breadths First Traversal
+    //   Catalogs are traversed from top (root catalog) to bottom (leaf catalogs)
+    //   and from more recent (HEAD revision) to older (historic revisions)
+    //
+    // Depth First Traversal
+    //   Catalogs are traversed from oldest revision (depends on the configured
+    //   maximal history depth) to the HEAD revision and from bottom (leafs) to
+    //   top (root catalogs)
     job.referenced_catalogs = (ctx.traversal_type == kBreadthFirstTraversal)
       ?   MightPushPreviousRevision(ctx, job)
         + MightPushNestedCatalogs  (ctx, job)
@@ -411,6 +486,7 @@

     // check if the next deeper history level is actually requested
     // Note: otherwise it is marked to be 'pruned' for possible later traversal
+    //       (see: TraversePruned())
     if (job.history_depth >= ctx.history_depth) {
       pruned_revisions_.insert(previous_revision);
       return 0;
@@ -470,10 +546,13 @@
     // next top of the stack (it's parent CatalogJob waiting for yielding)
     CatalogJobStack &clbs = ctx.callback_stack;
     while (! clbs.empty() && clbs.top().referenced_catalogs == 0) {
+      // yield top-most catalog (certain to have no more references)
       if (! Yield(clbs.top())) {
         return false;
       }

+      // pop the just yielded catalog and decrement new top of stack (if any)
+      // this will (possibly) yield a previously postponed catalog
       clbs.pop();
       if (! clbs.empty()) {
         CatalogJob &parent_job = ctx.callback_stack.top();
@@ -489,13 +568,18 @@
     assert (! job.ignore);
     assert (job.catalog != NULL || job.postponed);

-    if (job.postponed && ! OpenCatalog(job)) {
+    // catalog was pushed on ctx.callback_stack before, it might need to be re-
+    // opened. If CatalogTraversal<> is configured with no_close, it was not
+    // closed before, hence does not need a re-open.
+    if (job.postponed && ! no_close_ && ! OpenCatalog(job)) {
       return false;
     }

+    // hand the catalog out to the user code (see Observable<>)
     assert (job.catalog != NULL);
     this->NotifyListeners(job.GetCallbackData());

+    // close the catalog again after it was processed
     if (! no_close_) {
       delete job.catalog; job.catalog = NULL;
       unlink(job.catalog_file_path.c_str());
@@ -504,6 +588,10 @@
     return true;
   }

+  /**
+   * Pushes a catalog to the callback_stack for later yielding
+   * Note: this is only used for the Depth First Traversal strategy!
+   */
   void PostponeYield(TraversalContext &ctx, CatalogJob &job) {
     if (! no_close_ && job.referenced_catalogs > 0) {
       delete job.catalog; job.catalog = NULL;


add checking: data_type and index_type should be the same length in bytes

--- next/include/multiverso/util/quantization_util.h
+++ next/include/multiverso/util/quantization_util.h
@@ -64,6 +64,7 @@

     protected:
         bool try_compress(const multiverso::Blob& in_blob, multiverso::Blob& out_blob) {
+            CHECK(sizeof(data_type) == sizeof(index_type));
             auto data_count = in_blob.size<data_type>();
             auto non_zero_count = 0;
             for (auto i = 0; i < data_count; ++i){
@@ -102,6 +103,7 @@
         }

         Blob de_compress(const multiverso::Blob& in_blob, size_t size) {
+            CHECK(sizeof(data_type) == sizeof(index_type));
             CHECK(size % sizeof(data_type) == 0);
             auto original_data_count = size / sizeof(data_type);
             Blob result(size);


Add missing err() format string.

Add missing err() format string.

--- tools/tools/ath/ath_prom_read/ath_prom_read.c
+++ tools/tools/ath/ath_prom_read/ath_prom_read.c
@@ -123,7 +123,7 @@
 	atd.ad_out_data = (caddr_t) eep;
 	atd.ad_out_size = sizeof(eep);
 	if (ioctl(s, SIOCGATHDIAG, &atd) < 0)
-		err(1, atd.ad_name);
+		err(1, "ioctl: %s", atd.ad_name);

 	/* Dump file? Then just write to it */
 	if (dumpname != NULL) {


id10t planetary gravity fix. Thanks James.

git-svn-id: d9d6db7128765a3d84cbcddf81cbe31dc48065ee@477 f928779d-404e-0410-9e50-157fa1f9005b

--- Demo/Planet.c
+++ Demo/Planet.c
@@ -30,6 +30,8 @@
 static cpSpace *space;
 static cpBody *staticBody;

+static cpFloat gravityStrength = 5.0e6f;
+
 static void
 update(int ticks)
 {
@@ -47,8 +49,12 @@
 static void
 planetGravityVelocityFunc(cpBody *body, cpVect gravity, cpFloat damping, cpFloat dt)
 {
+	// Gravitational acceleration is proportional to the inverse square of
+	// distance, and directed toward the origin. The central planet is assumed
+	// to be massive enough that it affects the satellites but not vice versa.
 	cpVect p = body->p;
-	cpVect g = cpvmult(p, -50000.0f/cpvdot(p, p));
+	cpFloat sqdist = cpvlengthsq(p);
+	cpVect g = cpvmult(p, -gravityStrength / (sqdist * cpfsqrt(sqdist)));

 	cpBodyUpdateVelocity(body, g, damping, dt);
 }
@@ -59,7 +65,7 @@
 	cpVect v;
 	do {
 		v = cpv(frand()*(640 - 2*radius) - (320 - radius), frand()*(480 - 2*radius) - (240 - radius));
-	} while(cpvlength(v) < 100.0f);
+	} while(cpvlength(v) < 85.0f);

 	return v;
 }
@@ -82,7 +88,17 @@
 	cpBody *body = cpSpaceAddBody(space, cpBodyNew(mass, cpMomentForPoly(mass, 4, verts, cpvzero)));
 	body->velocity_func = planetGravityVelocityFunc;
 	body->p = rand_pos(radius);
-	body->v = cpvmult(cpv(2*frand() - 1, 2*frand() - 1), 200);
+
+	// Set the box's velocity to put it into a circular orbit from its
+	// starting position.
+	cpFloat r = cpvlength(body->p);
+	cpFloat v = cpfsqrt(gravityStrength / r) / r;
+	body->v = cpvmult(cpvperp(body->p), v);
+
+	// Set the box's angular velocity to match its orbital period and
+	// align its initial angle with its position.
+	body->w = v;
+	cpBodySetAngle(body, cpfatan2(body->p.y, body->p.x));

 	cpShape *shape = cpSpaceAddShape(space, cpPolyShapeNew(body, 4, verts, cpvzero));
 	shape->e = 0.0f; shape->u = 0.7f;


tpm_ibmvtpm: remove unneccessary message level.

KERN_ERR is implicitely declared in pr_err()

Signed-off-by: Fabian Frederick <3efd2a027b14fd890cd23a9ef6d1134b4e5ad850@skynet.be>
Signed-off-by: Peter Huewe <014f16385c5a8ff1646b588a3d5169b595c0f10e@gmx.de>


markdownlinkconverter feedback changes

markdownlinkconverter feedback changes

--- doc/markdownlinkconverter/markdownlinkconverter.c
+++ doc/markdownlinkconverter/markdownlinkconverter.c
@@ -4,6 +4,8 @@
 #include <stdbool.h>
 #include <string.h>

+#define UNUSED __attribute__ ((unused))
+
 #if defined(WIN32)
 #define FOLDER_DELIMITER '\\'
 #else
@@ -28,16 +30,16 @@
 #define TEMP_FILENAME "temp"

 // Link Blacklist: do not convert links with the following starting and ending
-char * ignoreTargetEnd [] = { ".h", ".c" , ".cpp" , ".hpp" , "\0"};
+const char * const ignoreTargetEnd [] = { ".h", ".c" , ".cpp" , ".hpp" , ""};
 // ignore http, @ref and #anchor
-char * ignoreTargetStart [] = { "#", "@" , "http" , "\0"};
-// both need to be null terminated
+const char * const ignoreTargetStart [] = { "#", "@" , "http" , ""};
+// both need to be terminated with an empty string

 // helpers
 void printTarget(FILE * output, char * target, char * filenameInElektra);
-void printConvertedPath (FILE * output ,char * path);
+void printConvertedPath (FILE * output, char * path);
 char * getPathInElektraRoot (char * executablename, char * filename);
-void exitError (FILE * f1, FILE * f2, char * mes);
+void exitError (FILE * f1, FILE * f2, const char * mes);

 /* These structs represent the transitions from the state machines.
  * Means if char c is read and the state machine is in state s
@@ -57,14 +59,32 @@
  * fact that links can not be nested.
  */

-#define LINK_START 0
-#define LINK_POSSIBLE(old, new) ((old == 0 || old == 5) && new == 2)
-#define LINK_FOUND(old, new) (state == 4 && newstate == 5)
-#define LINK_NAME(old, new) (((old == 2 || old == 3) && (new == 2  || new == 3)) \
-								|| (old == 3 && new == 4))
-#define LINK_TARGET(old, new) (state == 4 && newstate == 4)
-#define LINK_TRAP(old, new) (new == 6)
-#define LINK_NOLINK(old, new) (newstate == 0 || newstate == 1)
+const int linkStart = 0;
+static inline int linkPossible (int old, int new)
+{
+	return (old == 0 || old == 5) && new == 2;
+}
+static inline int linkFound (int old, int new)
+{
+	return old == 4 && new == 5;
+}
+static inline int linkName (int old, int new)
+{
+	return ((old == 2 || old == 3) && (new == 2  || new == 3))
+								|| (old == 3 && new == 4);
+}
+static inline int linkTarget (int old, int new)
+{
+	return old == 4 && new == 4;
+}
+static inline int linkTrap (int old UNUSED, int new)
+{
+	return new == 6;
+}
+static inline int linkNolink (int old UNUSED, int new)
+{
+	return new == 0 || new == 1;
+}

 struct transitionLink genLinkTransitionTable() {
     struct transitionLink out = {
@@ -92,8 +112,11 @@
  * checks whether a title has matched.
  */

-#define TITLE_START 0
-#define TITLE_ISGOAL(old, new) (old == 3 && new == 0)
+const int titleStart = 0;
+static inline int titleIsGoal (int old, int new)
+{
+	return old == 3 && new == 0;
+}

 struct transitionTitle genTitleTransitionTable() {
     struct transitionTitle out = {
@@ -136,7 +159,7 @@
  */
 bool convertTitle (FILE * input, FILE *  output, char * filenameInElektra)
 {
-	int state = TITLE_START;
+	int state = titleStart;
 	int newstate;
 	char c;
 	bool titleFound = false;
@@ -145,7 +168,7 @@
 	{
 		newstate = transitions.t[resolveChar (c)][state];

-		if (!titleFound && TITLE_ISGOAL (state, newstate))
+		if (!titleFound && titleIsGoal (state, newstate))
 		{
 			titleFound = true;
 			// print Header
@@ -168,7 +191,7 @@
 {
 	char c;
 	fpos_t pos;
-	int state = LINK_START;
+	int state = linkStart;
 	int newstate;
 	int index = 0;
 	unsigned int len = 0;
@@ -181,7 +204,7 @@
 	while ((c = fgetc (input)) != EOF)
 	{
 		newstate = transitions.t[resolveChar (c)][state];
-		if (LINK_POSSIBLE (state, newstate))
+		if (linkPossible (state, newstate))
 		{
 			// first [, possible link
 			// position is saved for setting back
@@ -191,7 +214,7 @@
 			index = 0;
 			len = 0;
 		}
-		if (LINK_FOUND (state, newstate))
+		else if (linkFound (state, newstate))
 		{
 			//set back and convert link if not blacklisted
 			if (fsetpos (input, &pos))
@@ -214,7 +237,7 @@
 			//check target
 			bool targetOK = true;
 			//start
-			for (int i = 0;strcmp (ignoreTargetStart[i], "\0") != 0;++i)
+			for (int i = 0;strcmp (ignoreTargetStart[i], "") != 0;++i)
 			{
 				if (strncmp (ignoreTargetStart[i], target,
 					strlen (ignoreTargetStart[i])) == 0)
@@ -224,7 +247,7 @@
 				}
 			}
 			//end
-			for (int i = 0;strcmp (ignoreTargetEnd[i], "\0") != 0;++i)
+			for (int i = 0;strcmp (ignoreTargetEnd[i], "") != 0;++i)
 			{
 				if(len < strlen (ignoreTargetEnd[i]))
 					continue;
@@ -245,22 +268,22 @@
 			else fprintf (output, "%s", target);
 			fprintf (output, "%c", fgetc (input)); // print ")"
 		}
-		if (LINK_NAME (state, newstate))
+		else if (linkName (state, newstate))
 		{
 			++index;
 		}
-		if (LINK_TARGET (state, newstate)) ++len;
-		if (LINK_TRAP (state, newstate))
+		else if (linkTarget (state, newstate)) ++len;
+		else if (linkTrap (state, newstate))
 		{
 			//trap, reset
 			if (fsetpos (input, &pos))
 				exitError (input, NULL, "fsetpos");

 			fprintf (output, "["); //first char got lost
-			state = LINK_START;
+			state = linkStart;
 			continue;
 		}
-		if(LINK_NOLINK (state, newstate))
+		else if(linkNolink (state, newstate))
 		{
 			// print all other content
 			fprintf (output, "%c", c);
@@ -273,7 +296,7 @@
 {
 	if (argc < 2)
 	{
-		fprintf (stderr, "args error\n");
+		fprintf (stderr, "Argument Error: expected format <filter> <input-file>\n");
 		return EXIT_FAILURE;
 	}

@@ -291,14 +314,14 @@
 	FILE * input = fopen (filename, "r");
 	if (!input)
 	{
-		fprintf (stderr ,"fopen Error\n");
+		fprintf (stderr ,"fopen Error: file %s not found\n", filename);
 		return EXIT_FAILURE;
 	}
 	FILE * output = fopen (TEMP_FILENAME, "w+");
 	if (!output)
 	{
 		fclose (input);
-		fprintf (stderr ,"fopen Error\n");
+		fprintf (stderr ,"fopen Error: tempfile %s not found\n", TEMP_FILENAME);
 		return EXIT_FAILURE;
 	}

@@ -330,17 +353,16 @@
 		fprintf (output, "# %s # {#", &title[1]);
 		printConvertedPath (output, filenameInElektra);
 		fprintf (output, "}\n");
-		//2nd pass
+		//2nd pass (see README.md)
 		convertLinks (input, output, filenameInElektra);
 		fclose (input);
-	} else
-	{
+	} else {
 		fclose (input);
 		//reset temp file
 		if (fsetpos (output, &startTempFile))
 			exitError (output, NULL, "fsetpos");

-		//2nd pass
+		//2nd pass (see README.md)
 		convertLinks (output, stdout, filenameInElektra);
 		fclose (output);
 	}
@@ -391,8 +413,7 @@
 				fprintf (output, "_");
 			}
 		}
-	}else
-	{
+	} else {
 		++target; // remove starting /
 	}
 	printConvertedPath (output, target);
@@ -460,6 +481,7 @@
 			break;
 		}
 	}
+	fclose (input);
 	if (!foundCmakecacheVar)
 	{
 		fprintf (stderr, "%s parse Error: Variable %s not found\n", CMAKE_CACHE_FILENAME, CMAKE_CACHE_VARNAME);
@@ -472,7 +494,7 @@
 	return out;
 }

-void exitError (FILE * f1, FILE * f2, char * mes)
+void exitError (FILE * f1, FILE * f2, const char * mes)
 {
 	if (f1)
 		fclose (f1);


fixed some thread dead-lock bugs

fixed some thread dead-lock bugs

git-svn-id: 444ed946b9c2220da791e84c3dd156a05f92db99@930 c6295689-39f2-0310-b995-f0e70906c6a9

--- src/pkcs11/pkcs11-global.c
+++ src/pkcs11/pkcs11-global.c
@@ -72,8 +72,10 @@
 	if (rv != CKR_OK)
 		return rv;

-	if (pReserved != NULL)
-		return CKR_ARGUMENTS_BAD;
+	if (pReserved != NULL) {
+		rv = CKR_ARGUMENTS_BAD;
+		goto out;
+	}

 	debug(context, "Shutting down Cryptoki\n");
 	for (i=0; i<context->reader_count; i++)
@@ -81,7 +83,7 @@

 	sc_release_context(context);
 	context = NULL;
-	sc_pkcs11_unlock();
+out:	sc_pkcs11_unlock();
 	sc_pkcs11_free_lock();

         return CKR_OK;
@@ -199,8 +201,10 @@
 	rv = slot_get_slot(slotID, &slot);
 	if (rv == CKR_OK)
 		rv = card_detect(slot->reader);
-	if (rv == CKR_TOKEN_NOT_PRESENT)
-		return CKR_OK;
+	if (rv == CKR_TOKEN_NOT_PRESENT) {
+		rv = CKR_OK;
+		goto out;
+	}

 	if (rv == CKR_OK)
 		memcpy(pInfo, &slot->slot_info, sizeof(CK_SLOT_INFO));
@@ -302,8 +306,10 @@
 		}
 	}

-	if (slot->card->framework->init_token == NULL)
-		return CKR_FUNCTION_NOT_SUPPORTED;
+	if (slot->card->framework->init_token == NULL) {
+		rv = CKR_FUNCTION_NOT_SUPPORTED;
+		goto out;
+	}
 	rv = slot->card->framework->init_token(slot->card,
 				 slot->fw_data, pPin, ulPinLen, pLabel);


Replace pointers to aural/page properties with pointers to void as placeholders

svn path=/trunk/libcss/; revision=6516

--- include/libcss/computed.h
+++ include/libcss/computed.h
@@ -12,16 +12,6 @@
 #include <libcss/functypes.h>
 #include <libcss/properties.h>
 #include <libcss/types.h>
-
-typedef struct css_computed_aural {
-	/** \todo */
-	uint8_t dummy;
-} css_computed_aural;
-
-typedef struct css_computed_page {
-	/** \todo */
-	uint8_t dummy;
-} css_computed_page;

 enum css_computed_content_type {
 	CSS_COMPUTED_CONTENT_NONE		= 0,
@@ -330,8 +320,8 @@
 	css_string *font_family;

 	css_computed_uncommon *uncommon;/**< Uncommon properties */
-	css_computed_aural *aural;	/**< Aural properties */
-	css_computed_page *page;	/**< Page properties */
+	void *aural;			/**< Aural properties */
+	void *page;			/**< Page properties */

 	css_allocator_fn alloc;
 	void *pw;


fixed call memory

fixed call memory

--- ir/be/ia32/ia32_intrinsics.c
+++ ir/be/ia32/ia32_intrinsics.c
@@ -55,7 +55,7 @@
 	set_Tuple_pred(call, pn_Call_M_regular,        get_irg_no_mem(irg));
 	set_Tuple_pred(call, pn_Call_X_except,         get_irg_bad(irg));
 	set_Tuple_pred(call, pn_Call_T_result,         res);
-	set_Tuple_pred(call, pn_Call_M_except,         get_irg_bad(irg));
+	set_Tuple_pred(call, pn_Call_M_except,         get_irg_no_mem(irg));
 	set_Tuple_pred(call, pn_Call_P_value_res_base, get_irg_bad(irg));
 }


mask values

mask values

--- HFSProcessor.c
+++ HFSProcessor.c
@@ -25,9 +25,7 @@
   char name[512];
   char atrname[512];

-  int32 fillValue;
-  int32 xSize;
-  int32 ySize;
+  int32 fillValue = -1;

   //TODO: this should be passed in  some how.
   char * filename = "/home/wselwood/data/real/MYD11A2.A2015009.h22v10.005.2015020130228.hdf";
@@ -54,22 +52,6 @@

     if (strcmp(name, requiredPart) == 0) {

-
-      // Hack: find the number of elements in the dim sizes array that are actually populated.
-      int n = 0;
-      while(dimsizes[n] != 0) {
-        n++;
-      }
-
-      if(n == 2) {
-        xSize = dimsizes[0];
-        ySize = dimsizes[1];
-      }
-      else {
-        printf("Error incorrect number of dimentions %d\n", n);
-        return 1;
-      }
-
       for (int j = 0; j < nattrs; j++) {
         status = SDattrinfo(sds_id, j, atrname, &nt, &count);
         check(status, "Error getting attribute info for %s", name);
@@ -92,36 +74,34 @@
         }
       }

-      printf("%s x:%d y:%d fillValue:%d\n", name, xSize, ySize, fillValue);
-
-      char* data = (char*) malloc(sizeof(char) * xSize * ySize);
-      if(data == NULL) {
-        printf("ERROR could not allocate data");
+      printf("%s x:%d y:%d fillValue:%d\n", name, dimsizes[0], dimsizes[1], fillValue);
+      if(fillValue == -1) {
+        printf("ERROR fill value not found\n");
         return 1;
       }
-      printf("allocated memory\n");
+      char* data = (char*) malloc(sizeof(char) * dimsizes[0] * dimsizes[1]);
+      if(data == NULL) {
+        printf("ERROR could not allocate data\n");
+        return 1;
+      }

-      int32 start[2], edges[2];
+      int32 start[2] = {0, 0};

-      start[0] = 0;
-      start[1] = 0;
-      edges[0] = xSize;
-      edges[1] = ySize;
-      status = SDreaddata(sds_id, start, NULL, edges, data);
+      status = SDreaddata(sds_id, start, NULL, dimsizes, data);
       check(status, "Error reading chunk from %s\n", name);
-      printf("read chunk\n");
-      for (int x = 0; x < xSize; x++) {
-        for (int y = 0; y < ySize; y++) {
-          char value = data[(x*xSize)+y];
+
+      for (int x = 0; x < dimsizes[0]; x++) {
+        for (int y = 0; y < dimsizes[1]; y++) {
+          char value = data[(x*dimsizes[0])+y];
           if (value != fillValue) {
-            printf("%d", value);
+            printf("#");
           } else {
             printf(" ");
           }
-
         }
         printf("\n");
       }
+
       free(data);
     }


Add basic avtest OPEN support

Add basic avtest OPEN support

--- test/avtest.c
+++ test/avtest.c
@@ -48,6 +48,8 @@
 #define AVDTP_GET_CAPABILITIES		0x02
 #define AVDTP_SET_CONFIGURATION		0x03
 #define AVDTP_GET_CONFIGURATION		0x04
+#define AVDTP_RECONFIGURE		0x05
+#define AVDTP_OPEN			0x06

 #define AVDTP_SEP_TYPE_SOURCE		0x00
 #define AVDTP_SEP_TYPE_SINK		0x01
@@ -110,6 +112,8 @@
 		0x02,
 		0x33,
 };
+
+static int media_sock = -1;

 static void dump_header(struct avdtp_header *hdr)
 {
@@ -282,7 +286,8 @@
 	return -1;
 }

-static void do_send(int sk, unsigned char cmd, int invalid, int preconf)
+static void do_send(int sk, const bdaddr_t *src, const bdaddr_t *dst,
+				unsigned char cmd, int invalid, int preconf)
 {
 	unsigned char buf[672];
 	struct avdtp_header *hdr = (void *) buf;
@@ -311,7 +316,7 @@

 	case AVDTP_SET_CONFIGURATION:
 		if (invalid)
-			do_send(sk, cmd, 0, 0);
+			do_send(sk, src, dst, cmd, 0, 0);
 		hdr->message_type = AVDTP_MSG_TYPE_COMMAND;
 		hdr->packet_type = AVDTP_PKT_TYPE_SINGLE;
 		hdr->signal_id = AVDTP_SET_CONFIGURATION;
@@ -323,7 +328,7 @@

 	case AVDTP_GET_CONFIGURATION:
 		if (preconf)
-			do_send(sk, AVDTP_SET_CONFIGURATION, 0, 0);
+			do_send(sk, src, dst, AVDTP_SET_CONFIGURATION, 0, 0);
 		hdr->message_type = AVDTP_MSG_TYPE_COMMAND;
 		hdr->packet_type = AVDTP_PKT_TYPE_SINGLE;
 		hdr->signal_id = AVDTP_GET_CONFIGURATION;
@@ -333,12 +338,25 @@
 			buf[2] = 1 << 2; /* Valid ACP SEID */
 		len = write(sk, buf, 3);
 		break;
+
+	case AVDTP_OPEN:
+		if (preconf)
+			do_send(sk, src, dst, AVDTP_SET_CONFIGURATION, 0, 0);
+		hdr->message_type = AVDTP_MSG_TYPE_COMMAND;
+		hdr->packet_type = AVDTP_PKT_TYPE_SINGLE;
+		hdr->signal_id = AVDTP_OPEN;
+		buf[2] = 1 << 2; /* ACP SEID */
+		len = write(sk, buf, 3);
+		break;
 	}

 	len = read(sk, buf, sizeof(buf));

 	dump_buffer(buf, len);
 	dump_header(hdr);
+
+	if (cmd == AVDTP_OPEN)
+		media_sock = do_connect(src, dst);
 }

 static void usage()
@@ -374,6 +392,8 @@
 		return AVDTP_SET_CONFIGURATION;
 	else if (!strncmp(arg, "getconf", 7))
 		return AVDTP_GET_CONFIGURATION;
+	else if (!strncmp(arg, "open", 4))
+		return AVDTP_OPEN;
 	else
 		return atoi(arg);
 }
@@ -437,7 +457,9 @@
 		sk = do_connect(&src, &dst);
 		if (sk < 0)
 			exit(1);
-		do_send(sk, cmd, invalid, preconf);
+		do_send(sk, &src, &dst, cmd, invalid, preconf);
+		if (media_sock >= 0)
+			close(media_sock);
 		close(sk);
 		break;
 	default:


ath9k: Fix tx stuck when connected to aggr disabled HT AP

This patch along with my previous patch in mac80211 "Fix the
way ADDBA count..", fixes hang in tx when connected to an HT
AP which rejects/times out on addba req.

AGGR_ADDBA_PROGRESS should be cleared in aggr state when addba
negotiation is terminated due to either addba response is timed out
or addba is denied by the AP. With out clearing this bit,
all frames are queued onto s/w queue for getting tx'd as aggr and
will never be scheduled onto hw queue.

Signed-off-by: Vasanthakumar Thiagarajan <1f9b907e684cdf06e2f9d7218724ac8143aa73aa@atheros.com>
Signed-off-by: John W. Linville <2a53bac7a5d324865ef46ec4c38b2c0fba1456b4@tuxdriver.com>

--- drivers/net/wireless/ath/ath9k/xmit.c
+++ drivers/net/wireless/ath/ath9k/xmit.c
@@ -711,6 +711,7 @@
 		return 0;

 	if (!(txtid->state & AGGR_ADDBA_COMPLETE)) {
+		txtid->state &= ~AGGR_ADDBA_PROGRESS;
 		txtid->addba_exchangeattempts = 0;
 		return 0;
 	}


clk: nomadik: Remove clk.h and clkdev.h includes

Clock provider drivers generally shouldn't include clk.h because
it's the consumer API. Remove the include here because this is a
provider driver. This driver also includes clkdev.h even though
it isn't used, so drop it too and add slab.h to make sure
everything still compiles.

Reviewed-by: Linus Walleij <9cd9d802d23c0ed5e224beabf4ae4a5c478746ef@linaro.org>
Signed-off-by: Stephen Boyd <010521127f513270fe503d86ab8316ac5147f4b7@codeaurora.org>


MEMORY BUG: XmString not freed before re-allocated by macros

--- MOTIF/BMotif_displaystate.c
+++ MOTIF/BMotif_displaystate.c
@@ -2009,6 +2009,7 @@
   XtVaSetValues ( ( Widget ) Main_1->anm, XmNlabelString, xstr, NULL );
   XtVaSetValues ( ( Widget ) Main_1->sts, XmNlabelString, xstr, NULL );
   XtVaSetValues ( ( Widget ) Main_1->rst, XmNlabelString, xstr, NULL );
+  XmStringFree ( xstr );
   XmUpdateDisplay ( ( Widget ) Main_1->row );
 /*  if ( Display_1->ps ) { */
     if ( str [ 0 ] == applicable_edited_chr ) {
@@ -2016,7 +2017,7 @@
       fg = lab_col_b [ Display_1->type ];
       bg = lab_col_f [ Display_1->type ];
       */
-      set_cmt_col_applicable ( Main_offset, Main_1, Main_0 );
+      set_cmt_col_applicable (Main_offset, Main_1, Main_0 );
     }
     else {
       fg = inapplicable_lab_col;
@@ -2025,7 +2026,6 @@
     }
     /* set_cmt_col ( Main_offset, Main_1, Main_0 );*/
 /*  } */
-  XmStringFree ( xstr );
 }

 void
@@ -2039,6 +2039,7 @@
   XtVaSetValues ( ( Widget ) Provers_1->pmd, XmNlabelString, xstr, NULL );
   XtVaSetValues ( ( Widget ) Provers_1->ppf, XmNlabelString, xstr, NULL );
   XtVaSetValues ( ( Widget ) Provers_1->rsl, XmNlabelString, xstr, NULL );
+  XmStringFree ( xstr );
   XmUpdateDisplay ( ( Widget ) Provers_1->row );
 /*  if ( Display_1->ps ) { */
     if ( str [ 0 ] == applicable_edited_chr ) {
@@ -2059,7 +2060,6 @@
 /*  } */

   /**  gdb records a double free here? why? **/
-  XmStringFree ( xstr );
 }

 void
@@ -2074,6 +2074,7 @@
   XtVaSetValues ( ( Widget ) Generators_1->Enm, XmNlabelString, xstr, NULL );
   XtVaSetValues ( ( Widget ) Generators_1->Itf, XmNlabelString, xstr, NULL );
   XtVaSetValues ( ( Widget ) Generators_1->rst, XmNlabelString, xstr, NULL );
+  XmStringFree ( xstr );
   XmUpdateDisplay ( ( Widget ) Generators_1->row );
 /*  if ( Display_1->ps ) { */
     if ( str [ 0 ] == applicable_edited_chr ) {
@@ -2094,7 +2095,6 @@
     set_cmt_col ( Generators_offset, Generators_1, Generators_0 );
     */
 /*  } */
-  XmStringFree ( xstr );
 }

 void
@@ -2108,6 +2108,7 @@
   XtVaSetValues ( ( Widget ) Translators_1->lnk, XmNlabelString, xstr, NULL );
   XtVaSetValues ( ( Widget ) Translators_1->exe, XmNlabelString, xstr, NULL );
   XtVaSetValues ( ( Widget ) Translators_1->rst, XmNlabelString, xstr, NULL );
+  XmStringFree ( xstr );
   XmUpdateDisplay ( ( Widget ) Translators_1->row );
 /*  if ( Display_1->ps ) { */
     if ( str [ 0 ] == applicable_edited_chr ) {
@@ -2128,7 +2129,6 @@
     set_cmt_col ( Translators_offset, Translators_1, Translators_0 );
     */
 /*  } */
-  XmStringFree ( xstr );
 }

 void
@@ -2142,6 +2142,7 @@
   XtVaSetValues ( ( Widget ) Documents_1->shw, XmNlabelString, xstr, NULL );
   XtVaSetValues ( ( Widget ) Documents_1->prt, XmNlabelString, xstr, NULL );
   XtVaSetValues ( ( Widget ) Documents_1->rst, XmNlabelString, xstr, NULL );
+  XmStringFree ( xstr );
   XmUpdateDisplay ( ( Widget ) Documents_1->row );
 /*  if ( Display_1->ps ) { */
     if ( str [ 0 ] == applicable_edited_chr ) {
@@ -2160,7 +2161,6 @@
     }
     /*set_cmt_col ( Documents_offset, Documents_1, Documents_0 );*/
 /*  } */
-  XmStringFree ( xstr );
 }

 /***************** ChangeAllButDecorationAndCmtApplicablity ******************/


Bugfix chomp() and set_hostname()

Bugfix chomp() and set_hostname()

chomp():
        Removed first \n instead of last \n

set_hostname():
        If /etc/hostname exists we need to realloc the size of
        the current hostname variable. Also, only try to set
        the hostname if !NULL

Signed-off-by: Joachim Nilsson <583c295fd7602c168ad814279bbc3894ba65f5d6@gmail.com>

--- helpers.c
+++ helpers.c
@@ -640,9 +640,9 @@

 void chomp(char *str)
 {
-	char *x;
-
-	if ((x = strchr((str), 0x0a)) != NULL)
+	char *x = strrchr(str, 0x0a);
+
+	if (x)
 		*x = 0;
 }

@@ -652,12 +652,20 @@

 	_d("Set hostname: %s", hostname);
 	if ((fp = fopen("/etc/hostname", "r")) != NULL) {
-		fgets(hostname, HOSTNAME_SIZE, fp);
+		struct stat st;
+
+		fstat(fileno(fp), &st);
+		hostname = realloc(hostname, st.st_size);
+		if (!hostname)
+			return;
+
+		fgets(hostname, st.st_size, fp);
 		chomp(hostname);
 		fclose(fp);
 	}

-	sethostname(hostname, strlen(hostname));
+	if (hostname)
+		sethostname(hostname, strlen(hostname));
 }

 /**


VFS: Remove writeback_control->fs_private

The only user of this field was NFS.

Signed-off-by: Trond Myklebust <6a1f9db795c9fc44be97d66ab114c53193bd3d13@netapp.com>

--- include/linux/writeback.h
+++ include/linux/writeback.h
@@ -61,8 +61,6 @@
 	unsigned for_reclaim:1;		/* Invoked from the page allocator */
 	unsigned for_writepages:1;	/* This is a writepages() call */
 	unsigned range_cyclic:1;	/* range_start is cyclic */
-
-	void *fs_private;		/* For use by ->writepages() */
 };

 /*


- use edges to reroute the result in resolve_call:
  this prevents some nasty warnings about unreachable Tuples
  in the back end

[r24016]

--- ir/be/ia32/ia32_intrinsics.c
+++ ir/be/ia32/ia32_intrinsics.c
@@ -26,6 +26,7 @@
  */
 #include "config.h"

+#include "iredges.h"
 #include "irgmod.h"
 #include "irop.h"
 #include "irnode_t.h"
@@ -62,7 +63,38 @@
 #define BINOP_Right_High 3

 /**
+ * Reroute edges from the pn_Call_T_result proj of a call.
+ *
+ * @param proj   the pn_Call_T_result Proj
+ * @param l_res  the lower 32 bit result
+ * @param h_res  the upper 32 bit result or NULL
+ * @param irg    the graph to replace on
+ */
+static void reroute_result(ir_node *proj, ir_node *l_res, ir_node *h_res, ir_graph *irg) {
+	const ir_edge_t *edge, *next;
+
+	foreach_out_edge_safe(proj, edge, next) {
+		ir_node *proj = get_edge_src_irn(edge);
+		long    pn    = get_Proj_proj(proj);
+
+		if (pn == 0) {
+			edges_reroute(proj, l_res, irg);
+		} else if (pn == 1 && h_res != NULL) {
+			edges_reroute(proj, h_res, irg);
+		} else {
+			panic("Unsupported Result-Proj from Call found");
+		}
+	}
+}
+
+/**
  * Replace a call be a tuple of l_res, h_res.
+ *
+ * @param call   the call node to replace
+ * @param l_res  the lower 32 bit result
+ * @param h_res  the upper 32 bit result or NULL
+ * @param irg    the graph to replace on
+ * @param block  the block to replace on (always the call block)
  */
 static void resolve_call(ir_node *call, ir_node *l_res, ir_node *h_res, ir_graph *irg, ir_node *block) {
 	ir_node *jmp, *res, *in[2];
@@ -70,29 +102,77 @@
 	ir_node *nomem = get_irg_no_mem(irg);
 	int     old_cse;

-	in[0] = l_res;
-	in[1] = h_res;
-	res = new_r_Tuple(irg, block, h_res == NULL ? 1 : 2, in);
-
-	turn_into_tuple(call, pn_Call_max);
-	set_Tuple_pred(call, pn_Call_M_regular,        nomem);
-	/*
-	 * Beware:
-	 * We do not check here if this call really has exception and regular Proj's.
-	 * new_r_Jmp might than be CSEd with the real exit jmp and then bad things happen
-	 * (in movgen.c from 186.crafty for example).
-	 * So be sure the newly created Jmp cannot CSE.
-	 */
-	old_cse = get_opt_cse();
-	set_opt_cse(0);
-	jmp = new_r_Jmp(irg, block);
-	set_opt_cse(old_cse);
-
-	set_Tuple_pred(call, pn_Call_X_regular,        jmp);
-	set_Tuple_pred(call, pn_Call_X_except,         bad);
-	set_Tuple_pred(call, pn_Call_T_result,         res);
-	set_Tuple_pred(call, pn_Call_M_except,         nomem);
-	set_Tuple_pred(call, pn_Call_P_value_res_base, bad);
+	if (edges_activated(irg)) {
+		/* use rerouting to prevent some warning in the backend */
+		const ir_edge_t *edge, *next;
+
+		foreach_out_edge_safe(call, edge, next) {
+			ir_node *proj = get_edge_src_irn(edge);
+			pn_Call pn    = get_Proj_proj(proj);
+
+			switch (pn) {
+			case pn_Call_X_regular:
+				/* Beware:
+				 * We do not check here if this call really has exception and regular Proj's.
+				 * new_r_Jmp might than be CSEd with the real exit jmp and then bad things happen
+				 * (in movgen.c from 186.crafty for example).
+				 * So be sure the newly created Jmp cannot CSE.
+				 */
+				old_cse = get_opt_cse();
+				set_opt_cse(0);
+				jmp = new_r_Jmp(irg, block);
+				set_opt_cse(old_cse);
+				edges_reroute(proj, jmp, irg);
+				break;
+
+			case pn_Call_X_except:
+			case pn_Call_P_value_res_base:
+				/* should not happen here */
+				edges_reroute(proj, bad, irg);
+				break;
+			case pn_Call_M_except:
+				/* should not happen here */
+				edges_reroute(proj, nomem, irg);
+				break;
+			case pn_Call_T_result:
+				reroute_result(proj, l_res, h_res, irg);
+				break;
+			default:
+				panic("Wrong Proj from Call");
+			}
+			kill_node(proj);
+		}
+		kill_node(call);
+	} else {
+		/* no edges, build Tuple */
+		if (h_res == NULL)
+			res = l_res;
+		else {
+			in[0] = l_res;
+			in[1] = h_res;
+			res = new_r_Tuple(irg, block, 2, in);
+		}
+
+		turn_into_tuple(call, pn_Call_max);
+		set_Tuple_pred(call, pn_Call_M_regular,        nomem);
+		/*
+		 * Beware:
+		 * We do not check here if this call really has exception and regular Proj's.
+		 * new_r_Jmp might than be CSEd with the real exit jmp and then bad things happen
+		 * (in movgen.c from 186.crafty for example).
+		 * So be sure the newly created Jmp cannot CSE.
+		 */
+		old_cse = get_opt_cse();
+		set_opt_cse(0);
+		jmp = new_r_Jmp(irg, block);
+		set_opt_cse(old_cse);
+
+		set_Tuple_pred(call, pn_Call_X_regular,        jmp);
+		set_Tuple_pred(call, pn_Call_X_except,         bad);
+		set_Tuple_pred(call, pn_Call_T_result,         res);
+		set_Tuple_pred(call, pn_Call_M_except,         nomem);
+		set_Tuple_pred(call, pn_Call_P_value_res_base, bad);
+	}
 }

 /**


Fixed LookAt

Fixed LookAt

--- HandmadeMath.h
+++ HandmadeMath.h
@@ -7,16 +7,16 @@
   You MUST

      #define HANDMADE_MATH_IMPLEMENTATION
-
+
   in EXACTLY one C or C++ file that includes this header, BEFORE the
   include, like this:
-
+
      #define HANDMADE_MATH_IMPLEMENTATION
      #include "HandmadeMade.h"

   All other files should just #include "HandmadeMath.h" without the #define.
   ==========================================================================
-
+
   For overloaded, and operator overloaded versions of the base C functions.
   You MUST

@@ -24,14 +24,14 @@

   in EXACTLY one C or C++ file that includes this header, BEFORE the
   include, like this:
-
+
      #define HANDMADE_MATH_IMPLEMENTATION
      #define HANDMADE_MATH_CPP_MODE
      #include "HandmadeMath.h"

   All other files should just #include "HandmadeMath.h" without the #define.
   ==========================================================================
-
+
   LICENSE

   This software is in the public domain. Where that dedication is not
@@ -73,19 +73,19 @@
 #endif

 #define Pi32 3.14159265359f
-
+
 typedef union vec2
 {
     struct
     {
         float X, Y;
     };
-
+
     struct
     {
         float U, V;
     };
-
+
     struct
     {
         float Left, Right;
@@ -100,35 +100,35 @@
     {
         float X, Y, Z;
     };
-
+
     struct
     {
         float U, V, W;
     };
-
+
     struct
     {
         float R, G, B;
     };
-
+
     struct
     {
         vec2 XY;
         float Ignored0_;
     };
-
+
     struct
     {
         float Ignored1_;
         vec2 YZ;
     };
-
+
     struct
     {
         vec2 UV;
         float Ignored2_;
     };
-
+
     struct
     {
         float Ignored3_;
@@ -150,7 +150,7 @@
                 float X, Y, Z;
             };
         };
-
+
         float W;
     };
     struct
@@ -163,31 +163,31 @@
                 float R, G, B;
             };
         };
-
+
         float A;
     };
-
+
     struct
     {
         vec2 XY;
         float Ignored0_;
         float Ignored1_;
     };
-
+
     struct
     {
         float Ignored2_;
         vec2 YZ;
         float Ignored3_;
     };
-
+
     struct
     {
         float Ignored4_;
         float Ignored5_;
         vec2 ZW;
     };
-
+
     float Elements[4];
 } vec4;

@@ -201,7 +201,7 @@
 HMMDEF HINLINE vec3 Normalize(vec3 A);
 HMMDEF HINLINE vec3 Cross(vec3 VecOne, vec3 VecTwo);
 HMMDEF HINLINE float Dot(vec3 VecOne, vec3 VecTwo);
-
+
 HMMDEF HINLINE vec2 Vec2i(int X, int Y);
 HMMDEF HINLINE vec2 Vec2(float X, float Y);
 HMMDEF HINLINE vec3 Vec3(float X, float Y, float Z);
@@ -236,7 +236,7 @@
 HMMDEF mat4 Scale(vec3 Scale);

 HMMDEF mat4 LookAt(vec3 Eye, vec3 Center, vec3 Up);
-
+
 #ifdef __cplusplus
 }
 #endif
@@ -255,7 +255,7 @@
 HMMDEF HINLINE vec3 Multiply(int X, int Y, int Z);
 HMMDEF HINLINE vec4 Multiply(int X, int Y, int Z, int W);
 HMMDEF HINLINE mat4 Multiply(mat4 Left, mat4 Right);
-
+
 HMMDEF HINLINE vec2 Divide(int X, int Y);
 HMMDEF HINLINE vec3 Divide(int X, int Y, int Z);
 HMMDEF HINLINE vec4 Divide(int X, int Y, int Z, int W);
@@ -423,7 +423,7 @@

     return(Result);
 }
-
+
 HMMDEF HINLINE vec3
 Vec3(float X, float Y, float Z)
 {
@@ -444,10 +444,10 @@
     Result.X = (float)X;
     Result.Y = (float)Y;
     Result.Z = (float)Z;
-
-    return(Result);
-}
-
+
+    return(Result);
+}
+
 HMMDEF HINLINE vec4
 Vec4(float X, float Y, float Z, float W)
 {
@@ -470,7 +470,7 @@
     Result.Y = (float)Y;
     Result.Z = (float)Z;
     Result.W = (float)W;
-
+
     return(Result);
 }

@@ -621,7 +621,7 @@
 HMMDEF mat4 Mat4()
 {
     mat4 Result;
-
+
     for(int Rows = 0;
         Rows < 4;
         ++Rows)
@@ -641,7 +641,7 @@
 Mat4d(float Diagonal)
 {
     mat4 Result;
-
+
     for(int Rows = 0;
         Rows < 4;
         ++Rows)
@@ -666,7 +666,7 @@
 MultiplyMat4(mat4 Left, mat4 Right)
 {
     mat4 Result = Mat4();
-
+
     for(int Rows = 0;
         Rows < 4;
         ++Rows)
@@ -686,7 +686,7 @@
             Result.Elements[Rows][Columns] = Sum;
         }
     }
-
+
     return(Result);
 }

@@ -716,7 +716,7 @@
     Result.Elements[2][3] = -1.0f;
     Result.Elements[2][2] = -(Far + Near) / (Far - Near);
     Result.Elements[3][2] = -(2.0f * Far * Near) / (Far - Near);
-
+
     return(Result);
 }

@@ -728,7 +728,7 @@
     Result.Elements[0][3] = Translation.X;
     Result.Elements[1][3] = Translation.Y;
     Result.Elements[2][3] = Translation.Z;
-
+
     return(Result);
 }

@@ -756,13 +756,13 @@
 LookAt(vec3 Eye, vec3 Center, vec3 Up)
 {
     mat4 Result = {};
-
+
     vec3 F = Normalize(Center - Eye);
-    vec3 S = Normalize(Cross(F, Up));
-    vec3 U = Cross(S, F);
-
+    vec3 S = Cross(F, Normalize(Up));
+    vec3 U = Cross(Normalize(S), F);
+
     Result.Elements[0][0] = S.X;
-    Result.Elements[0][1] = U.X;
+    Result.Elements[0][1] = U.X;m
     Result.Elements[0][2] = -F.X;

     Result.Elements[1][0] = S.Y;
@@ -777,7 +777,7 @@
     Result.Elements[3][1] = -Dot(U, Eye);
     Result.Elements[3][2] = Dot(F, Eye);
     Result.Elements[3][3] = 1.0f;
-
+
     return(Result);
 }

@@ -789,7 +789,7 @@
     Result.Elements[0][0] = Scale.X;
     Result.Elements[1][1] = Scale.Y;
     Result.Elements[2][2] = Scale.Z;
-
+
     return(Result);
 }

@@ -858,7 +858,7 @@

     return(Result);
 }
-
+
 HMMDEF HINLINE vec4
 Multiply(vec4 Left, vec4 Right)
 {
@@ -879,7 +879,7 @@
 Divide(vec2 Left, vec2 Right)
 {
     vec2 Result = DivideVec2(Left, Right);
-
+
     return(Result);
 }


ath9k: fix regression in sending aggregated packets

The recent commit "ath9k: Send legacy rated frames as unaggregated"
introduced a check to ensure that packets with non-MCS rates set in
the rate series will not be aggregated. However, it failed to check
if the rate series is valid before testing the flags, thus breaking
aggregation for normal MCS-only packets if the last series is unset.

Signed-off-by: Felix Fietkau <118ed6118e893d16e8c6e0776e0ebc290952c897@openwrt.org>
Signed-off-by: John W. Linville <2a53bac7a5d324865ef46ec4c38b2c0fba1456b4@tuxdriver.com>

--- drivers/net/wireless/ath/ath9k/xmit.c
+++ drivers/net/wireless/ath/ath9k/xmit.c
@@ -582,7 +582,10 @@
 	tx_info = IEEE80211_SKB_CB(skb);
 	rates = tx_info->control.rates;

-	for (i = 3; i >= 0; i--) {
+	for (i = 0; i < 4; i++) {
+		if (!rates[i].count || rates[i].idx < 0)
+			break;
+
 		if (!(rates[i].flags & IEEE80211_TX_RC_MCS))
 			return true;
 	}


cpufreq: remove __cpufreq_remove_dev()

cpufreq: remove __cpufreq_remove_dev()

Nobody except cpufreq_remove_dev() calls __cpufreq_remove_dev() and
so we don't need two separate routines here. Merge code from
__cpufreq_remove_dev() into cpufreq_remove_dev() and get rid of
__cpufreq_remove_dev().

Signed-off-by: Viresh Kumar <5ff32272b3d9f86512eddc8e0af523fc6f7924e5@linaro.org>
Reviewed-by: Srivatsa S. Bhat <5b23f8226e886b22344fc642373ea657dd596b63@linux.vnet.ibm.com>
Signed-off-by: Rafael J. Wysocki <27ffc44a8ec6a212fba98cfc3246c6ce8ab131e0@intel.com>


importing files

importing files

--- decommenter.c
+++ decommenter.c
@@ -0,0 +1,49 @@
+//Author: Michael Harrison
+//Decommenter
+//Remove /* */ style comments from a file
+
+#include <stdio.h>
+
+int comment(int last, int current);
+
+int main (int argc, char **argv) {
+    int last, current, next;
+	FILE *read = fopen("in.c","r");
+	FILE *write = fopen("out.txt","w");
+    while(current!=EOF){
+        while((!comment(last,(current=getc(read))))&& (current!=EOF)){
+			if (current!='/'){
+                putc(current,write);
+                last=current;
+			}
+			else {
+				if ((next=getc(read))=='*'){
+					last=current;
+					ungetc(next,read);
+					fflush(read);
+				}
+				else{
+					ungetc(next,read);
+					fflush(read);
+					putc(current,write);
+					last=current;
+				}
+			}
+        }
+        while(((current=getc(read))!=EOF)&&(!comment(last,current))){
+            last=current;
+		}
+    }
+    fclose(read);
+	fclose(write);
+	return 0;
+}
+
+int comment(int last, int current){
+	if (last == '/' && current == '*')
+		return 1;
+	else if (last == '*' && current == '/')
+		return 1;
+	else
+		return 0;
+}


Minor rearrangement and documentation

Minor rearrangement and documentation

--- H/csound.h
+++ H/csound.h
@@ -941,15 +941,57 @@
     PUBLIC void csoundInputMessage(CSOUND *, const char *message);

     /**
+     * Creates a buffer for storing messages printed by Csound.
+     * Should be called after creating a Csound instance; note that
+     * the message buffer uses the host data pointer, and the buffer
+     * should be freed by calling csoundDestroyMessageBuffer() before
+     * deleting the Csound instance.
+     * If 'toStdOut' is non-zero, the messages are also printed to
+     * stdout and stderr (depending on the type of the message),
+     * in addition to being stored in the buffer.
+     * Using the message buffer ties up the internal message callback, so
+     * csoundSetMessageCallback should not be called after creating the
+     * message buffer.
+     */
+    void PUBLIC csoundEnableMessageBuffer(CSOUND *csound, int toStdOut);
+
+    /**
+     * Returns the first message from the buffer.
+     */
+    PUBLIC const char*  csoundGetFirstMessage(CSOUND *csound);
+
+    /**
+     * Returns the attribute parameter (see msg_attr.h) of the first message
+     * in the buffer.
+     */
+    int PUBLIC csoundGetFirstMessageAttr(CSOUND *csound);
+
+    /**
+     * Removes the first message from the buffer.
+     */
+    void PUBLIC csoundPopFirstMessage(CSOUND *csound);
+
+    /**
+     * Returns the number of pending messages in the buffer.
+     */
+    int PUBLIC csoundGetMessageCnt(CSOUND *csound);
+
+    /**
+     * Releases all memory used by the message buffer.
+     */
+    void PUBLIC csoundDestroyMessageBuffer(CSOUND *csound);
+
+    /*
+     * CONTROL AND EVENTS
+     */
+
+
+    /**
      * Set the ASCII code of the most recent key pressed.
      * This value is used by the 'sensekey' opcode if a callback
      * for returning keyboard events is not set (see csoundSetCallback()).
      */
     PUBLIC void csoundKeyPress(CSOUND *, char c);
-
-    /*
-     * CONTROL AND EVENTS
-     */

     /**
      * Control values are specified by a 'channelName' string.
@@ -1937,46 +1979,6 @@
     PUBLIC void csoundRemoveCallback(CSOUND *,
             int (*func)(void *, void *, unsigned int));

-
-
-    /**
-     * Creates a buffer for storing messages printed by Csound.
-     * Should be called after creating a Csound instance; note that
-     * the message buffer uses the host data pointer, and the buffer
-     * should be freed by calling csoundDestroyMessageBuffer() before
-     * deleting the Csound instance.
-     * If 'toStdOut' is non-zero, the messages are also printed to
-     * stdout and stderr (depending on the type of the message),
-     * in addition to being stored in the buffer.
-     */
-    void PUBLIC csoundEnableMessageBuffer(CSOUND *csound, int toStdOut);
-
-    /**
-     * Returns the first message from the buffer.
-     */
-    PUBLIC const char*  csoundGetFirstMessage(CSOUND *csound);
-
-    /**
-     * Returns the attribute parameter (see msg_attr.h) of the first message
-     * in the buffer.
-     */
-    int PUBLIC csoundGetFirstMessageAttr(CSOUND *csound);
-
-    /**
-     * Removes the first message from the buffer.
-     */
-    void PUBLIC csoundPopFirstMessage(CSOUND *csound);
-
-    /**
-     * Returns the number of pending messages in the buffer.
-     */
-    int PUBLIC csoundGetMessageCnt(CSOUND *csound);
-
-    /**
-     * Releases all memory used by the message buffer.
-     */
-    void PUBLIC csoundDestroyMessageBuffer(CSOUND *csound);
-
 #if !defined(SWIG)
     /**
      * Sets an external callback for receiving notices whenever Csound opens


Replaced assert( IsValid() ) with checker's call to IsValid.

git-svn-id: 2bceadd671bcc8d4f7a34159d1bc3b98592acb3b@1024 7ec92016-0320-0410-acc4-a06ded1c099a

--- include/loki/LevelMutex.h
+++ include/loki/LevelMutex.h
@@ -280,8 +280,9 @@
     {
     public:
         inline explicit Checker( const volatile LevelMutexInfo * mutex ) :
-            m_mutex( mutex ) {}
-        inline ~Checker( void ) { m_mutex->IsValid(); }
+            m_mutex( mutex ) { Check(); }
+        inline ~Checker( void ) { Check(); }
+        inline bool Check( void ) const { return m_mutex->IsValid(); }
     private:
         Checker( void );
         Checker( const Checker & );
@@ -782,7 +783,6 @@

     virtual MutexErrors::Type TryLock( void ) volatile
     {
-        assert( IsValid() );
         LOKI_MUTEX_DEBUG_CODE( Checker checker( this ); (void)checker; )

         MutexErrors::Type result = LevelMutexInfo::PreLockCheck( true );
@@ -804,7 +804,6 @@

     virtual MutexErrors::Type Lock( void ) volatile
     {
-        assert( IsValid() );
         LOKI_MUTEX_DEBUG_CODE( Checker checker( this ); (void)checker; )

         MutexErrors::Type result = LevelMutexInfo::PreLockCheck( false );
@@ -824,7 +823,6 @@

     virtual MutexErrors::Type Lock( unsigned int milliSeconds ) volatile
     {
-        assert( IsValid() );
         LOKI_MUTEX_DEBUG_CODE( Checker checker( this ); (void)checker; )

         MutexErrors::Type result = LevelMutexInfo::PreLockCheck( false );
@@ -860,7 +858,6 @@

     virtual MutexErrors::Type Unlock( void ) volatile
     {
-        assert( IsValid() );
         LOKI_MUTEX_DEBUG_CODE( Checker checker( this ); (void)checker; )

         MutexErrors::Type result = LevelMutexInfo::PreUnlockCheck();
@@ -906,7 +903,6 @@
      */
     virtual MutexErrors::Type LockThis( void ) volatile
     {
-        assert( IsValid() );
         LOKI_MUTEX_DEBUG_CODE( Checker checker( this ); (void)checker; )
         assert( this != LevelMutexInfo::GetCurrentMutex() );

@@ -927,7 +923,6 @@
      */
     virtual MutexErrors::Type LockThis( unsigned int milliSeconds ) volatile
     {
-        assert( IsValid() );
         LOKI_MUTEX_DEBUG_CODE( Checker checker( this ); (void)checker; )

         clock_t timeOut = clock() + milliSeconds;
@@ -953,9 +948,8 @@
      */
     virtual MutexErrors::Type UnlockThis( void ) volatile
     {
-        assert( IsValid() );
+        LOKI_MUTEX_DEBUG_CODE( Checker checker( this ); (void)checker; )
         assert( NULL != LevelMutexInfo::GetCurrentMutex() );
-        LOKI_MUTEX_DEBUG_CODE( Checker checker( this ); (void)checker; )

         if ( 1 < LevelMutexInfo::GetLockCount() )
         {


git-svn-id: https://www.imagemagick.org/subversion/ImageMagick/trunk@8860 aa41f4f7-0bf4-0310-aa73-e5a19afd5a74

--- MagickCore/pixel-accessor.h
+++ MagickCore/pixel-accessor.h
@@ -35,7 +35,7 @@
 {
   if (pixel <= (0.0031308*QuantumRange))
     return(12.92*pixel);
-  return(1.055*QuantumRange*pow(QuantumScale*pixel,1.0/2.4)-0.055);
+  return(QuantumRange*(1.055*pow(QuantumScale*pixel,1.0/2.4)-0.055));
 }

 static inline double DecompandsRGB(const double pixel)


Update SceneGraph documentation

Update SceneGraph documentation

--- engine/world/SceneGraph.h
+++ engine/world/SceneGraph.h
@@ -37,6 +37,7 @@

 class Allocator;

+/// Represents a collection of nodes, possibly linked together to form a tree.
 ///
 /// @ingroup World
 struct SceneGraph


fixed bug when update batch info

fixed bug when update batch info

--- drivers/nvme-ssd/nvme_batch_manager.h
+++ drivers/nvme-ssd/nvme_batch_manager.h
@@ -163,6 +163,10 @@

   private:
+    bool _is_complete(size_t idx) {
+      return (array[idx].counter == array[idx].total && array[idx].fixed);
+    }
+
     bool _update_single_loop(uint16_t cmdid) {
       size_t head = buffer.get_head();
       size_t tail = buffer.get_tail(); //may get a stale value, this is fine
@@ -175,17 +179,26 @@
         if(cmdid >= array[idx2].start_cmdid && cmdid <= array[idx2].end_cmdid){
           array[idx2].counter++;
           assert(array[idx2].counter <= array[idx2].total);
-          if(array[idx2].counter == array[idx2].total) {
+          if(_is_complete(idx2)) {
             //TODO: callback
-            batch_info_t bi;
-            buffer.pop(bi);
+
+            //if idx2 is the head, then pop all finished batch info
+            if(idx2++ == head) {
+              batch_info_t bi;
+              while(1) {
+                if(_is_complete(idx2))
+                  buffer.pop(bi);
+                else
+                  break;
+              }
+            }
           }
           return true; //updated sucessfully
         }
-        //we may reach here, because the tail we got can be a stale value
-        PLOG("Did NOT find the right range!!");
-        return false;
       }
+      //we may reach here, because the tail we got can be a stale value
+      PLOG("Did NOT find the right range!!");
+      return false;
     }
 };


driver/eth_dw: Limit name space, add static.

Change-Id: If9de0bec8bafb66119e158782cf9618143dc2a52
Signed-off-by: Marcus Shawcroft <cf6354583ee83038f2010cbcbe1b1f2adb85107d@arm.com>

--- drivers/ethernet/eth_dw.c
+++ drivers/ethernet/eth_dw.c
@@ -142,7 +142,7 @@
 	return 1;
 }

-void eth_dw_isr(struct device *port)
+static void eth_dw_isr(struct device *port)
 {
 	struct eth_runtime *context = port->driver_data;
 	uint32_t base_addr = context->base_addr;


removed dependency

removed dependency

git-svn-id: e171abefef93db0a74257c7d87d5b6400fe00c1f@3149 f22100f3-aa73-48fe-a4fb-fd497bb32605

--- trunk/extension/include/wx/extension/lexers.h
+++ trunk/extension/include/wx/extension/lexers.h
@@ -15,11 +15,10 @@
 #include <map>
 #include <set>
 #include <vector>
-#include <wx/colour.h>
 #include <wx/filename.h>
 #include <wx/xml/xml.h>
+#include <wx/extension/indicator.h>
 #include <wx/extension/lexer.h>
-#include <wx/extension/indicator.h>
 #include <wx/extension/marker.h>
 #include <wx/extension/property.h>
 #include <wx/extension/style.h>


add export specifier

add export specifier

git-svn-id: e2e1a767b54e5f731ad8ac18fa5089ee37d5625a@572 7ec92016-0320-0410-acc4-a06ded1c099a

--- include/loki/SafeFormat.h
+++ include/loki/SafeFormat.h
@@ -28,6 +28,8 @@
 #include <cassert>
 #include <locale>

+#include <loki/LokiExport.h>
+

 // long is 32 bit on 64-bit Windows!
 #if defined(_WIN32) || defined(_WIN64)
@@ -47,10 +49,12 @@

     // Crude writing method: writes straight to the file, unbuffered
     // Must be combined with a buffer to work properly (and efficiently)
-    void write(std::FILE* f, const char* from, const char* to);
+    LOKI_EXPORT
+	void write(std::FILE* f, const char* from, const char* to);

     // Write to a string
+	LOKI_EXPORT
     void write(std::string& s, const char* from, const char* to);

     // Write to a fixed-size buffer
@@ -528,16 +532,22 @@
         LOKI_SAFEFORMAT_SIGNED_LONG result_;
     };

+	LOKI_EXPORT
     PrintfState<std::FILE*, char> Printf(const char* format);

+	LOKI_EXPORT
     PrintfState<std::FILE*, char> Printf(const std::string format);

+	LOKI_EXPORT
     PrintfState<std::FILE*, char> FPrintf(FILE* f, const char* format);

+	LOKI_EXPORT
     PrintfState<std::FILE*, char> FPrintf(FILE* f, const std::string& format);

+	LOKI_EXPORT
     PrintfState<std::string&, char> SPrintf(std::string& s, const char* format);

+	LOKI_EXPORT
     PrintfState<std::string&, char> SPrintf(std::string& s, const std::string& format);

     template <class T, class Char>
@@ -563,6 +573,9 @@
 #endif //SAFEFORMAT_H_

 // $Log$
+// Revision 1.24  2006/02/28 11:13:20  syntheticpp
+// add export specifier
+//
 // Revision 1.23  2006/01/18 17:21:31  lfittl
 // - Compile library with -Weffc++ and -pedantic (gcc)
 // - Fix most issues raised by using -Weffc++ (initialization lists)


ideapad-laptop: Disable touchpad interface on Yoga models

Yoga models don't offer touchpad ctrl through the ideapad interface, causing
ideapad_sync_touchpad_state to send wrong touchpad enable/disable events.

Signed-off-by: Hans de Goede <9fa1be1a5b5729e4c6b404f34c9ce49ff4882fd8@redhat.com>
Signed-off-by: Matthew Garrett <d1dada306f6f6bc535ec5238317ee8d221588a1a@nebula.com>

--- drivers/platform/x86/ideapad-laptop.c
+++ drivers/platform/x86/ideapad-laptop.c
@@ -88,6 +88,7 @@
 	struct dentry *debug;
 	unsigned long cfg;
 	bool has_hw_rfkill_switch;
+	bool has_touchpad_control;
 };

 static bool no_bt_rfkill;
@@ -766,6 +767,9 @@
 {
 	unsigned long value;

+	if (!priv->has_touchpad_control)
+		return;
+
 	/* Without reading from EC touchpad LED doesn't switch state */
 	if (!read_ec_data(priv->adev->handle, VPCCMD_R_TOUCHPAD, &value)) {
 		/* Some IdeaPads don't really turn off touchpad - they only
@@ -840,6 +844,28 @@
 	{}
 };

+/*
+ * Some models don't offer touchpad ctrl through the ideapad interface, causing
+ * ideapad_sync_touchpad_state to send wrong touchpad enable/disable events.
+ */
+static struct dmi_system_id no_touchpad_ctrl_list[] = {
+	{
+		.ident = "Lenovo Yoga 1 series",
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
+			DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo IdeaPad Yoga"),
+		},
+	},
+	{
+		.ident = "Lenovo Yoga 2 11 / 13 / Pro",
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
+			DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo Yoga 2"),
+		},
+	},
+	{}
+};
+
 static int ideapad_acpi_add(struct platform_device *pdev)
 {
 	int ret, i;
@@ -863,6 +889,7 @@
 	priv->adev = adev;
 	priv->platform_device = pdev;
 	priv->has_hw_rfkill_switch = !dmi_check_system(no_hw_rfkill_list);
+	priv->has_touchpad_control = !dmi_check_system(no_touchpad_ctrl_list);

 	ret = ideapad_sysfs_init(priv);
 	if (ret)


[PATCH] dcdbas: convert to the new platform device interface

Do not use platform_device_register_simple() as it is going away, define
dcdbas_driver and implement ->probe() and ->remove() functions so manual
binding and unbinding will work with this driver.

Also switch to using attribute_group when creating sysfs attributes and
make sure to check and handle errors; explicitely remove attributes when
detaching driver.

Signed-off-by: Dmitry Torokhov <10a8c465cefc9bdd6c925e26964d23c90f1141cc@mail.ru>
Signed-off-by: Andrew Morton <5c1e68b099950c134891f0b6e179498a8ebe9cf9@osdl.org>
Signed-off-by: Linus Torvalds <69652caca27c8b940640ad396ab71f93cacec34f@osdl.org>

--- drivers/firmware/dcdbas.c
+++ drivers/firmware/dcdbas.c
@@ -530,29 +530,26 @@
 static DCDBAS_DEV_ATTR_RW(host_control_smi_type);
 static DCDBAS_DEV_ATTR_RW(host_control_on_shutdown);

-static struct device_attribute *dcdbas_dev_attrs[] = {
-	&dev_attr_smi_data_buf_size,
-	&dev_attr_smi_data_buf_phys_addr,
-	&dev_attr_smi_request,
-	&dev_attr_host_control_action,
-	&dev_attr_host_control_smi_type,
-	&dev_attr_host_control_on_shutdown,
+static struct attribute *dcdbas_dev_attrs[] = {
+	&dev_attr_smi_data_buf_size.attr,
+	&dev_attr_smi_data_buf_phys_addr.attr,
+	&dev_attr_smi_request.attr,
+	&dev_attr_host_control_action.attr,
+	&dev_attr_host_control_smi_type.attr,
+	&dev_attr_host_control_on_shutdown.attr,
 	NULL
 };

-/**
- * dcdbas_init: initialize driver
- */
-static int __init dcdbas_init(void)
-{
-	int i;
+static struct attribute_group dcdbas_attr_group = {
+	.attrs = dcdbas_dev_attrs,
+};
+
+static int __devinit dcdbas_probe(struct platform_device *dev)
+{
+	int i, error;

 	host_control_action = HC_ACTION_NONE;
 	host_control_smi_type = HC_SMITYPE_NONE;
-
-	dcdbas_pdev = platform_device_register_simple(DRIVER_NAME, -1, NULL, 0);
-	if (IS_ERR(dcdbas_pdev))
-		return PTR_ERR(dcdbas_pdev);

 	/*
 	 * BIOS SMI calls require buffer addresses be in 32-bit address space.
@@ -561,19 +558,79 @@
 	dcdbas_pdev->dev.coherent_dma_mask = DMA_32BIT_MASK;
 	dcdbas_pdev->dev.dma_mask = &dcdbas_pdev->dev.coherent_dma_mask;

+	error = sysfs_create_group(&dev->dev.kobj, &dcdbas_attr_group);
+	if (error)
+		return error;
+
+	for (i = 0; dcdbas_bin_attrs[i]; i++) {
+		error = sysfs_create_bin_file(&dev->dev.kobj,
+					      dcdbas_bin_attrs[i]);
+		if (error) {
+			while (--i >= 0)
+				sysfs_remove_bin_file(&dev->dev.kobj,
+						      dcdbas_bin_attrs[i]);
+			sysfs_create_group(&dev->dev.kobj, &dcdbas_attr_group);
+			return error;
+		}
+	}
+
 	register_reboot_notifier(&dcdbas_reboot_nb);

+	dev_info(&dev->dev, "%s (version %s)\n",
+		 DRIVER_DESCRIPTION, DRIVER_VERSION);
+
+	return 0;
+}
+
+static int __devexit dcdbas_remove(struct platform_device *dev)
+{
+	int i;
+
+	unregister_reboot_notifier(&dcdbas_reboot_nb);
 	for (i = 0; dcdbas_bin_attrs[i]; i++)
-		sysfs_create_bin_file(&dcdbas_pdev->dev.kobj,
-				      dcdbas_bin_attrs[i]);
-
-	for (i = 0; dcdbas_dev_attrs[i]; i++)
-		device_create_file(&dcdbas_pdev->dev, dcdbas_dev_attrs[i]);
-
-	dev_info(&dcdbas_pdev->dev, "%s (version %s)\n",
-		 DRIVER_DESCRIPTION, DRIVER_VERSION);
+		sysfs_remove_bin_file(&dev->dev.kobj, dcdbas_bin_attrs[i]);
+	sysfs_remove_group(&dev->dev.kobj, &dcdbas_attr_group);

 	return 0;
+}
+
+static struct platform_driver dcdbas_driver = {
+	.driver		= {
+		.name	= DRIVER_NAME,
+		.owner	= THIS_MODULE,
+	},
+	.probe		= dcdbas_probe,
+	.remove		= __devexit_p(dcdbas_remove),
+};
+
+/**
+ * dcdbas_init: initialize driver
+ */
+static int __init dcdbas_init(void)
+{
+	int error;
+
+	error = platform_driver_register(&dcdbas_driver);
+	if (error)
+		return error;
+
+	dcdbas_pdev = platform_device_alloc(DRIVER_NAME, -1);
+	if (!dcdbas_pdev) {
+		error = -ENOMEM;
+		goto err_unregister_driver;
+	}
+
+	error = platform_device_add(dcdbas_pdev);
+	if (error)
+		goto err_free_device;
+
+	return 0;
+
+ err_free_device:
+	platform_device_put(dcdbas_pdev);
+ err_unregister_driver:
+	platform_driver_unregister(&dcdbas_driver);
+	return error;
 }

 /**
@@ -588,6 +645,15 @@
 	unregister_reboot_notifier(&dcdbas_reboot_nb);
 	smi_data_buf_free();
 	platform_device_unregister(dcdbas_pdev);
+	platform_driver_unregister(&dcdbas_driver);
+
+	/*
+	 * We have to free the buffer here instead of dcdbas_remove
+	 * because only in module exit function we can be sure that
+	 * all sysfs attributes belonging to this module have been
+	 * released.
+	 */
+	smi_data_buf_free();
 }

 module_init(dcdbas_init);


regulator: max8973: Fix callback setting for max8973_dcdc_ops.enable

Signed-off-by: Axel Lin <b6ffd6973e972cb999e8e535ab74da7fee0c035f@ingics.com>
Signed-off-by: Mark Brown <b51b9a92386687a9ac927cebfa0f978adeb8cea5@opensource.wolfsonmicro.com>

--- drivers/regulator/max8973-regulator.c
+++ drivers/regulator/max8973-regulator.c
@@ -401,7 +401,7 @@
 	if (pdata->enable_ext_control) {
 		max->desc.enable_reg = MAX8973_VOUT;
 		max->desc.enable_mask = MAX8973_VOUT_ENABLE;
-		max8973_dcdc_ops.enable = regulator_is_enabled_regmap;
+		max8973_dcdc_ops.enable = regulator_enable_regmap;
 		max8973_dcdc_ops.disable = regulator_disable_regmap;
 		max8973_dcdc_ops.is_enabled = regulator_is_enabled_regmap;
 	}


HTTP requests probably shouldn't work on const objects

--- include/neapolis/Client.h
+++ include/neapolis/Client.h
@@ -23,7 +23,7 @@
   // I should look into using something like boost::variant,
   // since I only really care about using Multipart or Parameters.
   template<typename T>
-  Response send(const std::string& path, const T& uriParams) const {
+  Response send(const std::string& path, const T& uriParams) {
     const auto response = cpr::Post(
       Url{std::string(rootPath) + path},
       Authentication{user, pass},


drivers/firmware/memmap.c: pass the correct argument to firmware_map_find_entry_bootmem()

firmware_map_add_hotplug() calls firmware_map_find_entry_bootmem() to
get free firmware_map_entry.  But end arguments is not correct.  So
firmware_map_find_entry_bootmem() cannot not find firmware_map_entry.

The patch passes the correct end argument to firmware_map_find_entry_bootmem().

Signed-off-by: Yasuaki Ishimatsu <9b26f769475fafc2d25107053b1bdd774d49438a@jp.fujitsu.com>
Cc: Santosh Shilimkar <5b4d8dc9ea337fff5fd1729321eda9873ade0b09@ti.com>
Cc: Toshi Kani <322b9f75d3806917607539efc168804d71b9503d@hp.com>
Cc: Greg Kroah-Hartman <4645f7897fd33786a2ee1264d590b3c400559d85@linuxfoundation.org>
Signed-off-by: Andrew Morton <5c1e68b099950c134891f0b6e179498a8ebe9cf9@linux-foundation.org>
Signed-off-by: Linus Torvalds <69652caca27c8b940640ad396ab71f93cacec34f@linux-foundation.org>


(printChildren) : Save the original currentNode.

--- esidl/include/cplusplus.h
+++ esidl/include/cplusplus.h
@@ -101,6 +101,7 @@
             return;
         }

+        const Node* saved = currentNode;
         std::string separator;
         bool br;
         int count = 0;
@@ -136,7 +137,7 @@
         {
             write("%s", separator.c_str());
         }
-        currentNode = node;
+        currentNode = saved;
     }

 public:


[SCSI] scsi_dh: Fixup kernel-doc comments

Fixup some kernel-doc comments to reference to the
correct function name.

Signed-off-by: Hannes Reinecke <b0d1e9e4a4e27620745ff49be9000da3174a4cc6@suse.de>
Signed-off-by: James Bottomley <1acebbdca565c7b6b638bdc23b58b5610d1a56b8@Parallels.com>

--- drivers/scsi/device_handler/scsi_dh.c
+++ drivers/scsi/device_handler/scsi_dh.c
@@ -468,7 +468,7 @@
 EXPORT_SYMBOL_GPL(scsi_dh_handler_exist);

 /*
- * scsi_dh_handler_attach - Attach device handler
+ * scsi_dh_attach - Attach device handler
  * @sdev - sdev the handler should be attached to
  * @name - name of the handler to attach
  */
@@ -498,7 +498,7 @@
 EXPORT_SYMBOL_GPL(scsi_dh_attach);

 /*
- * scsi_dh_handler_detach - Detach device handler
+ * scsi_dh_detach - Detach device handler
  * @sdev - sdev the handler should be detached from
  *
  * This function will detach the device handler only


gpio: tegra: remove useless includes of <mach/*.h>

Nothing from these files is needed, so remove the includes. This helps
single zImage work by reducing use of the mach-tegra/include/mach/
directory.

Signed-off-by: Stephen Warren <5ef2a23ba3aff51d1cfc8c113c1ec34b608b3b13@nvidia.com>
Acked-by: Linus Walleij <9cd9d802d23c0ed5e224beabf4ae4a5c478746ef@linaro.org>

--- drivers/gpio/gpio-tegra.c
+++ drivers/gpio/gpio-tegra.c
@@ -30,9 +30,6 @@

 #include <asm/mach/irq.h>

-#include <mach/iomap.h>
-#include <mach/suspend.h>
-
 #define GPIO_BANK(x)		((x) >> 5)
 #define GPIO_PORT(x)		(((x) >> 3) & 0x3)
 #define GPIO_BIT(x)		((x) & 0x7)