BUG: should not have removed this method, it is used by some kernels

--- Utilities/otbsvm/svm.h
+++ Utilities/otbsvm/svm.h
@@ -231,6 +231,11 @@
     return m_MapParameters;
   }

+  // Override this method to to split m_MapParameters into specific variables to speed up kernel evaluations
+  virtual void Update(void)
+  {
+  }
+
 private:

   /** Kernel functor parameters */


crypto: hifn_795x - fix error return code

Convert a nonnegative error return code to a negative one, as returned
elsewhere in the function.

A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
(
if@p1 (\(ret < 0\|ret != 0\))
 { ... return ret; }
|
ret@p1 = 0
)
... when != ret = e1
    when != &ret
*if(...)
{
  ... when != ret = e2
      when forall
 return ret;
}
// </smpl>

Signed-off-by: Peter Senna Tschudin <d897b756ebf1c425d034f7458a172204a9625378@gmail.com>
Signed-off-by: Herbert Xu <ef65de1c7be0aa837fe7b25ba9a7739905af6a55@gondor.apana.org.au>

--- drivers/crypto/hifn_795x.c
+++ drivers/crypto/hifn_795x.c
@@ -2611,14 +2611,17 @@
 		size = pci_resource_len(pdev, i);

 		dev->bar[i] = ioremap_nocache(addr, size);
-		if (!dev->bar[i])
+		if (!dev->bar[i]) {
+			err = -ENOMEM;
 			goto err_out_unmap_bars;
+		}
 	}

 	dev->desc_virt = pci_alloc_consistent(pdev, sizeof(struct hifn_dma),
 			&dev->desc_dma);
 	if (!dev->desc_virt) {
 		dprintk("Failed to allocate descriptor rings.\n");
+		err = -ENOMEM;
 		goto err_out_unmap_bars;
 	}
 	memset(dev->desc_virt, 0, sizeof(struct hifn_dma));


EDAC, altera: SoCFPGA EDAC should not look for ECC_CORR_EN

The bootloader may or may not enable the ECC_CORR_EN bit. By
not enabling ECC_CORR_EN, when error happens, it is the user's
responsibility to perform a full SDRAM scrub.

Remove the check for ECC_CORR_EN.

Signed-off-by: Dinh Nguyen <a48724738fc762a7f206428dfcaf7ede2fd84d0f@opensource.altera.com>
Cc: linux-edac <2f2877799b28945e915fed027ea960f3cffe53dd@vger.kernel.org>
Cc: Mauro Carvalho Chehab <ad86ba2154032c9f55743a190faa2459a9d61d42@osg.samsung.com>
Cc: Thor Thayer <e9e18c12cd15ca63116099b02663c9e3d043a667@opensource.altera.com>
Link: http://lkml.kernel.org/r/1444864456-21778-1-git-send-email-a48724738fc762a7f206428dfcaf7ede2fd84d0f@opensource.altera.com
Signed-off-by: Borislav Petkov <0691a664b24b6f15b20cd5aee64b72271db08be1@suse.de>


firewire: fw-sbp2: try to increase reconnect_hold (speed up reconnection)

Ask the target to grant 4 seconds instead of the standard and minimum of
1 second window after bus reset for reconnection.  This accelerates
reconnection if there are more than one targets on the bus:  If a login
and inquiry to one target blocks the fw-sbp2 workqueue for more than 1s
after bus reset, we now still can reconnect to the other target.

Before that, fw-sbp2's reconnect attempts would be rejected with "error
status: 0:9" (function rejected), and fw-sbp2 would finally re-login.
All those futile reconnect attemps cost extra time until the target
which needs re-login is ready for I/O again.

The reconnect timeout field in the login ORB doesn't have to be honored
by the target though.  I found that we could get up to
  - allegedly 32768s from an old OXFW911 firmware
  - 256s from LSI bridges
  - 4s from OXUF922 and OXFW912 bridges,
  - 2s from TI bridges,
  - only the standard 1s from Initio and Prolific bridges and from
    Apple OpenFirmware in target mode.

We just try to get 4 seconds which already covers the case of a few
HDDs on the same bus quite nicely.

A minor drawback occurs in the following (rare and impractical) border
case:
  - two initiators are there, initiator 1 holds an exclusive login to
    a target,
  - initiator 1 goes off the bus,
  - target refuses login attempts from initiator 2 until reconnect_hold
    seconds after bus reset.

An alternative approach to the issue at hand would be to parallelize
fw-sbp2's reconnect and login work.

Signed-off-by: Stefan Richter <fbd796546fc801b34e01e453c6fd30283e012038@s5r6.in-berlin.de>
Acked-by: Jarod Wilson <b559ba3411cf55dd74bd9675d6ce4d094c2e3438@redhat.com>

--- drivers/firewire/fw-sbp2.c
+++ drivers/firewire/fw-sbp2.c
@@ -514,9 +514,10 @@
 	orb->request.status_fifo.low  = lu->address_handler.offset;

 	if (function == SBP2_LOGIN_REQUEST) {
+		/* Ask for 2^2 == 4 seconds reconnect grace period */
 		orb->request.misc |=
-			MANAGEMENT_ORB_EXCLUSIVE(sbp2_param_exclusive_login) |
-			MANAGEMENT_ORB_RECONNECT(0);
+			MANAGEMENT_ORB_RECONNECT(2) |
+			MANAGEMENT_ORB_EXCLUSIVE(sbp2_param_exclusive_login);
 	}

 	fw_memcpy_to_be32(&orb->request, &orb->request, sizeof(orb->request));


gpio: ks8695: fix 'else should follow close brace '}''

Signed-off-by: Varka Bhadram <2af78e27b8c15f3929acd171eee40b9b9bcbd73c@cdac.in>
Signed-off-by: Linus Walleij <9cd9d802d23c0ed5e224beabf4ae4a5c478746ef@linaro.org>

--- drivers/gpio/gpio-ks8695.c
+++ drivers/gpio/gpio-ks8695.c
@@ -276,18 +276,16 @@
 				case IOPC_TM_EDGE:
 					seq_printf(s, "(Edges)");	break;
 				}
-			}
-			else
+			} else
 				seq_printf(s, "GPIO\t");
-		}
-		else if (i <= KS8695_GPIO_5) {
+		} else if (i <= KS8695_GPIO_5) {
 			if (ctrl & enable[i])
 				seq_printf(s, "TOUT%i\t", i - KS8695_GPIO_4);
 			else
 				seq_printf(s, "GPIO\t");
+		} else {
+			seq_printf(s, "GPIO\t");
 		}
-		else
-			seq_printf(s, "GPIO\t");

 		seq_printf(s, "\t");


drm: Improve drm_crtc documentation

drm: Improve drm_crtc documentation

Signed-off-by: Ville Syrjälä <cd6e8d405ca90be3a03d5427c5b24fbd2d68dcc4@linux.intel.com>
Reviewed-by: Alex Deucher <08dc22c6156113f2deff178e35e3ed9b24d6af9e@amd.com>
Signed-off-by: Dave Airlie <f2295d84e358395675bc8031be58672073ae065e@redhat.com>

--- drivers/gpu/drm/drm_crtc.c
+++ drivers/gpu/drm/drm_crtc.c
@@ -616,7 +616,7 @@
  * @crtc: CRTC object to init
  * @funcs: callbacks for the new CRTC
  *
- * Inits a new object created as base part of an driver crtc object.
+ * Inits a new object created as base part of a driver crtc object.
  *
  * RETURNS:
  * Zero on success, error code on failure.
@@ -651,11 +651,12 @@
 EXPORT_SYMBOL(drm_crtc_init);

 /**
- * drm_crtc_cleanup - Cleans up the core crtc usage.
+ * drm_crtc_cleanup - Clean up the core crtc usage
  * @crtc: CRTC to cleanup
  *
- * Cleanup @crtc. Removes from drm modesetting space
- * does NOT free object, caller does that.
+ * This function cleans up @crtc and removes it from the DRM mode setting
+ * core. Note that the function does *not* free the crtc structure itself,
+ * this is the responsibility of the caller.
  */
 void drm_crtc_cleanup(struct drm_crtc *crtc)
 {


fixup! Improvement: Add a way to get timezone from environment. Firstly get timezone from environment. If not present, use file method

--- winpr/libwinpr/timezone/timezone.c
+++ winpr/libwinpr/timezone/timezone.c
@@ -21,6 +21,7 @@
 #include "config.h"
 #endif

+#include <winpr/environment.h>
 #include <winpr/wtypes.h>
 #include <winpr/timezone.h>
 #include <winpr/crt.h>
@@ -284,15 +285,21 @@
 {
 	size_t i, j;
 	char* tzid = NULL;
-
-	char* tzenv = getenv("TZ");
-	if (tzenv) {
-		tzid = strdup(tzenv);
-	}
-
-	if (tzid == NULL) {
+	LPCSTR tz = "TZ";
+
+	DWORD nSize = GetEnvironmentVariableA(tz, NULL, 0);
+	if (nSize)
+	{
+		tzid = (char*)malloc(nSize);
+		if (!GetEnvironmentVariableA(tz, tzid, nSize))
+		{
+			free(tzid);
+			tzid = NULL;
+		}
+	}
+
+	if (tzid == NULL)
 		tzid = winpr_get_unix_timezone_identifier_from_file();
-	}

 	if (tzid == NULL)
 		tzid = winpr_get_timezone_from_link();


drm/core: Do not call drm_framebuffer_remove internally during teardown.

This may cause issues because encoders are already destroyed so removing
active primaries may use freed memory. Instead free the fb directly,
ignoring refcount.

Signed-off-by: Maarten Lankhorst <743c2818a341d71b99ed2b566f9f80c2fc288f93@linux.intel.com>
Signed-off-by: Daniel Vetter <c1b6782c4af8f0673da8923a0702a1832e5940f4@ffwll.ch>


Fixed WLog_PrintMessagePrefixVA

Fixed WLog_PrintMessagePrefixVA

WLog_PrintMessagePrefixVA is called with format being a stack variable.
Always copy the data to message->PrefixString otherwise the information
will be lost whenever the stack is destroyed.

--- winpr/libwinpr/utils/wlog/Layout.c
+++ winpr/libwinpr/utils/wlog/Layout.c
@@ -45,19 +45,15 @@
  * Log Layout
  */

-void WLog_PrintMessagePrefixVA(wLog* log, wLogMessage* message, const char* format, va_list args)
+static void WLog_PrintMessagePrefixVA(wLog* log, wLogMessage* message, const char* format, va_list args)
 {
 	if (!strchr(format, '%'))
-	{
-		message->PrefixString = (LPSTR) format;
-	}
+		sprintf_s(message->PrefixString, WLOG_MAX_PREFIX_SIZE - 1, format);
 	else
-	{
 		wvsnprintfx(message->PrefixString, WLOG_MAX_PREFIX_SIZE - 1, format, args);
-	}
-}
-
-void WLog_PrintMessagePrefix(wLog* log, wLogMessage* message, const char* format, ...)
+}
+
+static void WLog_PrintMessagePrefix(wLog* log, wLogMessage* message, const char* format, ...)
 {
 	va_list args;
 	va_start(args, format);


drm/kms: Add the default mode table

drm/kms: Add the default mode table

When we add a standard timing mode in UMS, we will first check whether it can
be found in default mode table. If it can't be found, then we will use cvt/gtf
to add the standard timing mode.
Add the default mode table so that we can check whether the given mode
can be found in the default mode table as what we have done in UMS mode.

If the status of one output device is connected but there is no EDID, it will
have no correct mode. In such case we can add some default modes for it. Of
course we only add the modes in the default modes list that visible part is not
greater than 1024x768.

The default mode is autogenerated from the DMT spec. And it is copied from
xserver/hw/xfree86/modes/xf86EdidModes.c. But the mode with reduced blank
feature is removed.

Signed-off-by: Zhao Yakui <21bae65ecea50a19bd9d0fef489914760189fd5b@intel.com>
Signed-off-by: Dave Airlie <f2295d84e358395675bc8031be58672073ae065e@redhat.com>


drm: readd drm_lock_free in drm_unlock

drm: readd drm_lock_free in drm_unlock

I've accidently killed a little bit too much in

commit 1da3f87ebb7edb3e0b829ec4bbe5fb3d9d93986f
Author: Daniel Vetter <c1b6782c4af8f0673da8923a0702a1832e5940f4@ffwll.ch>
Date:   Mon Aug 23 22:53:24 2010 +0200

    drm: kill kernel_context_switch callbacks

Note to self: Next time also test with AIGLX disabled.

Reported-and-Tested-by: Andy Furniss <da2ea5bee82302925a2874f529684e980c179d70@andyfurniss.entadsl.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=30374
Signed-off-by: Daniel Vetter <c1b6782c4af8f0673da8923a0702a1832e5940f4@ffwll.ch>
Signed-off-by: Dave Airlie <f2295d84e358395675bc8031be58672073ae065e@redhat.com>

--- drivers/gpu/drm/drm_lock.c
+++ drivers/gpu/drm/drm_lock.c
@@ -152,6 +152,7 @@
 int drm_unlock(struct drm_device *dev, void *data, struct drm_file *file_priv)
 {
 	struct drm_lock *lock = data;
+	struct drm_master *master = file_priv->master;

 	if (lock->context == DRM_KERNEL_CONTEXT) {
 		DRM_ERROR("Process %d using kernel context %d\n",
@@ -160,6 +161,10 @@
 	}

 	atomic_inc(&dev->counts[_DRM_STAT_UNLOCKS]);
+
+	if (drm_lock_free(&master->lock, lock->context)) {
+		/* FIXME: Should really bail out here. */
+	}

 	unblock_all_signals();
 	return 0;


drm: Free devname along with master->unique

The device name is tightly coupled and created at the same time as the
master->unique address, so we need to free it with the master. Currently
we overwrite it each time we create a new master:

unreferenced object 0xe32c54b0 (size 32):
  comm "Xorg", pid 1455, jiffies 4294721798 (age 3196.879s)
  hex dump (first 32 bytes):
    69 39 31 35 40 70 63 69 3a 30 30 30 30 3a 30 30  i915@pci:0000:00
    3a 30 32 2e 30 00 6b 6b 6b 6b 6b 6b 6b 6b 6b a5  :02.0.kkkkkkkkk.
  backtrace:
    [<c04e5657>] create_object+0x124/0x1f1
    [<c07cf0f0>] kmemleak_alloc+0x4c/0x90
    [<c04db84c>] __kmalloc+0x155/0x175
    [<f8316665>] drm_setversion+0x11d/0x1b1 [drm]
    [<f83148d4>] drm_ioctl+0x29a/0x356 [drm]
    [<c04f27c4>] vfs_ioctl+0x33/0x91
    [<c04f31cf>] do_vfs_ioctl+0x46b/0x496
    [<c04f3240>] sys_ioctl+0x46/0x66
    [<c040325f>] sysenter_do_call+0x12/0x38
    [<ffffffff>] 0xffffffff

Signed-off-by: Chris Wilson <711c73f64afdce07b7e38039a96d2224209e9a6c@chris-wilson.co.uk>
Signed-off-by: Dave Airlie <f2295d84e358395675bc8031be58672073ae065e@redhat.com>

--- drivers/gpu/drm/drm_stub.c
+++ drivers/gpu/drm/drm_stub.c
@@ -155,6 +155,9 @@
 		master->unique = NULL;
 		master->unique_len = 0;
 	}
+
+	kfree(dev->devname);
+	dev->devname = NULL;

 	list_for_each_entry_safe(pt, next, &master->magicfree, head) {
 		list_del(&pt->head);


ide: allow any command requesting DMA data phase for HDIO_DRIVE_TASKFILE

Allow any command requesting DMA data phase for HDIO_DRIVE_TASKFILE ioctl
and remove no longer needed task_dma_ok()

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

--- drivers/ide/ide-taskfile.c
+++ drivers/ide/ide-taskfile.c
@@ -60,25 +60,6 @@
 	args.tf_flags	= IDE_TFLAG_TF | IDE_TFLAG_DEVICE;
 	args.data_phase	= TASKFILE_IN;
 	return ide_raw_taskfile(drive, &args, buf, 1);
-}
-
-static int inline task_dma_ok(ide_task_t *task)
-{
-	if (blk_fs_request(task->rq) || (task->tf_flags & IDE_TFLAG_FLAGGED))
-		return 1;
-
-	switch (task->tf.command) {
-		case WIN_WRITEDMA_ONCE:
-		case WIN_WRITEDMA:
-		case WIN_WRITEDMA_EXT:
-		case WIN_READDMA_ONCE:
-		case WIN_READDMA:
-		case WIN_READDMA_EXT:
-		case WIN_IDENTIFY_DMA:
-			return 1;
-	}
-
-	return 0;
 }

 static ide_startstop_t task_no_data_intr(ide_drive_t *);
@@ -139,8 +120,7 @@
 				    WAIT_WORSTCASE, NULL);
 		return ide_started;
 	default:
-		if (task_dma_ok(task) == 0 || drive->using_dma == 0 ||
-		    dma_ops->dma_setup(drive))
+		if (drive->using_dma == 0 || dma_ops->dma_setup(drive))
 			return ide_stopped;
 		dma_ops->dma_exec_cmd(drive, tf->command);
 		dma_ops->dma_start(drive);


Input: ALPS - fix max coordinates for v5 and v7 protocols

Commit 3296f71cd2fde7a2ad52e66a27eae419f6328066 ("Input: ALPS - consolidate
setting protocol parameters") inadvertently moved call to
alps_dolphin_get_device_area() from v5 to v7 protocol, causing both
protocols report incorrect maximum values for X and Y axes which resulted
in crash in Synaptics X driver.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=94801
Reported-by: Santiago Gala <2af39b1ef405edc6aaaeed0f198a9fe2ee6798e9@apache.org>
Reported-by: Pali Rohár <271b10744f2b592adf8fde144d536c86b011b93c@gmail.com>
Acked-by: Hans de Goede <9fa1be1a5b5729e4c6b404f34c9ce49ff4882fd8@redhat.com>
Acked-by: Pali Rohár <271b10744f2b592adf8fde144d536c86b011b93c@gmail.com>
Signed-off-by: Dmitry Torokhov <6b8646d310837fed93a129ed3c979b90c7f2674f@gmail.com>


Input: ALPS - handle touchpoints buttons correctly

When pressing any button belonging to the touchpoint, the generated
click events don't belong to the touchpoint but to the touchpad.
This patch fixes this behaviour, the events will be sent via the
correct device, so scrolling with touchpoint is possible.

Signed-off-by: Ulrich Dangel <5e2de4d5026564827edbc016673ca420588c4240@spamt.net>
Signed-off-by: Andrew Morton <5c1e68b099950c134891f0b6e179498a8ebe9cf9@linux-foundation.org>
Signed-off-by: Dmitry Torokhov <10a8c465cefc9bdd6c925e26964d23c90f1141cc@mail.ru>

--- drivers/input/mouse/alps.c
+++ drivers/input/mouse/alps.c
@@ -132,17 +132,22 @@
 	ges = packet[2] & 1;
 	fin = packet[2] & 2;

+	if ((priv->i->flags & ALPS_DUALPOINT) && z == 127) {
+		input_report_rel(dev2, REL_X,  (x > 383 ? (x - 768) : x));
+		input_report_rel(dev2, REL_Y, -(y > 255 ? (y - 512) : y));
+
+		input_report_key(dev2, BTN_LEFT, left);
+		input_report_key(dev2, BTN_RIGHT, right);
+		input_report_key(dev2, BTN_MIDDLE, middle);
+
+		input_sync(dev);
+		input_sync(dev2);
+		return;
+	}
+
 	input_report_key(dev, BTN_LEFT, left);
 	input_report_key(dev, BTN_RIGHT, right);
 	input_report_key(dev, BTN_MIDDLE, middle);
-
-	if ((priv->i->flags & ALPS_DUALPOINT) && z == 127) {
-		input_report_rel(dev2, REL_X,  (x > 383 ? (x - 768) : x));
-		input_report_rel(dev2, REL_Y, -(y > 255 ? (y - 512) : y));
-		input_sync(dev);
-		input_sync(dev2);
-		return;
-	}

 	/* Convert hardware tap to a reasonable Z value */
 	if (ges && !fin) z = 40;


leds: convert LP3944 LED driver to devm_kzalloc()

Cc: Antonio Ospite <93db7fe24fb098f485b7d1c7a8e9771e73894a26@studenti.unina.it>
Signed-off-by: Bryan Wu <465f0e91e61585f5bc1128e7fe63296c33a56926@canonical.com>

--- drivers/leds/leds-lp3944.c
+++ drivers/leds/leds-lp3944.c
@@ -393,7 +393,8 @@
 		return -ENODEV;
 	}

-	data = kzalloc(sizeof(struct lp3944_data), GFP_KERNEL);
+	data = devm_kzalloc(&client->dev, sizeof(struct lp3944_data),
+			GFP_KERNEL);
 	if (!data)
 		return -ENOMEM;

@@ -403,10 +404,8 @@
 	mutex_init(&data->lock);

 	err = lp3944_configure(client, data, lp3944_pdata);
-	if (err < 0) {
-		kfree(data);
+	if (err < 0)
 		return err;
-	}

 	dev_info(&client->dev, "lp3944 enabled\n");
 	return 0;
@@ -430,8 +429,6 @@
 		default:
 			break;
 		}
-
-	kfree(data);

 	return 0;
 }


leds: ss4200: Fix incorrect placement of __initdata

__initdata should be placed between the variable name and equal
sign for the variable to be placed in the intended section.

Signed-off-by: Sachin Kamat <1c3b1584a6008857f36c03c58f657c0fc16fc09e@linaro.org>
Cc: Dave Hansen <bfcdf3e6ca6cef45543bfbb57509c92aec9a39fb@sr71.net>
Signed-off-by: Bryan Wu <956b36c0f472d2edb239225c10f7e4411d1efbb9@gmail.com>


[media] ov2659: Don't depend on subdev API

The subdev API is optional. No driver should depend on it.

Avoid compilation breakages if subdev API is not selected:

drivers/media/i2c/ov2659.c: In function ‘ov2659_get_fmt’:
drivers/media/i2c/ov2659.c:1054:3: error: implicit declaration of function ‘v4l2_subdev_get_try_format’ [-Werror=implicit-function-declaration]
   mf = v4l2_subdev_get_try_format(sd, cfg, 0);
   ^
drivers/media/i2c/ov2659.c:1054:6: warning: assignment makes pointer from integer without a cast
   mf = v4l2_subdev_get_try_format(sd, cfg, 0);
      ^
drivers/media/i2c/ov2659.c: In function ‘ov2659_set_fmt’:
drivers/media/i2c/ov2659.c:1129:6: warning: assignment makes pointer from integer without a cast
   mf = v4l2_subdev_get_try_format(sd, cfg, fmt->pad);
      ^
drivers/media/i2c/ov2659.c: In function ‘ov2659_open’:
drivers/media/i2c/ov2659.c:1264:38: error: ‘struct v4l2_subdev_fh’ has no member named ‘pad’
     v4l2_subdev_get_try_format(sd, fh->pad, 0);
                                      ^

Signed-off-by: Mauro Carvalho Chehab <ad86ba2154032c9f55743a190faa2459a9d61d42@osg.samsung.com>
Tested-by: Lad, Prabhakar <b468bd3711e6074f1f3ca387583c4bfe5a29e9a6@gmail.com>


mfd: db8500-prcmu: Supply the pdata_size attribute for db8500-thermal

The MFD subsystem requires drivers to state the size of any platform
data passed, or it will fail to assign it to the device. This will
culminate in a NULL platform_data attribute and normally a failure to
probe() or a kernel Oops.

Acked-by: Linus Walleij <9cd9d802d23c0ed5e224beabf4ae4a5c478746ef@linaro.org>
Signed-off-by: Lee Jones <630e34333487a351a857f6b705e04d30b37c1629@linaro.org>
Signed-off-by: Samuel Ortiz <0ba86cb3f08bbb861958e54bd3438887adb4263c@linux.intel.com>

--- drivers/mfd/db8500-prcmu.c
+++ drivers/mfd/db8500-prcmu.c
@@ -3095,6 +3095,7 @@
 		.num_resources = ARRAY_SIZE(db8500_thsens_resources),
 		.resources = db8500_thsens_resources,
 		.platform_data = &db8500_thsens_data,
+		.pdata_size = sizeof(db8500_thsens_data),
 	},
 };


misc: do not mark exported functions __devexit

No symbol can be exported when the section is discarded - the only
solution I could think of is not to mark symbols as __devexit
when they are exported.

Signed-off-by: Arnd Bergmann <f2c659f01951776204a6c5b902787d9019fbeebd@arndb.de>
Signed-off-by: Mathieu Poirier <b674a88f52ddcf15fbad298f5a49af203db9e3b7@linaro.org>
Signed-off-by: Greg Kroah-Hartman <4645f7897fd33786a2ee1264d590b3c400559d85@linuxfoundation.org>

--- drivers/misc/ad525x_dpot.c
+++ drivers/misc/ad525x_dpot.c
@@ -749,7 +749,7 @@
 }
 EXPORT_SYMBOL(ad_dpot_probe);

-__devexit int ad_dpot_remove(struct device *dev)
+int ad_dpot_remove(struct device *dev)
 {
 	struct dpot_data *data = dev_get_drvdata(dev);
 	int i;


mmc: mxs-mmc: fix deadlock in SDIO IRQ case

Release the lock before mmc_signal_sdio_irq is called by mxs_mmc_irq_handler.

Backtrace:
[   79.660000] =============================================
[   79.660000] [ INFO: possible recursive locking detected ]
[   79.660000] 3.4.0-00009-g3e96082-dirty #11 Not tainted
[   79.660000] ---------------------------------------------
[   79.660000] swapper/0 is trying to acquire lock:
[   79.660000]  (&(&host->lock)->rlock#2){-.....}, at: [<c026ea3c>] mxs_mmc_enable_sdio_irq+0x18/0xd4
[   79.660000]
[   79.660000] but task is already holding lock:
[   79.660000]  (&(&host->lock)->rlock#2){-.....}, at: [<c026f744>] mxs_mmc_irq_handler+0x1c/0xe8
[   79.660000]
[   79.660000] other info that might help us debug this:
[   79.660000]  Possible unsafe locking scenario:
[   79.660000]
[   79.660000]        CPU0
[   79.660000]        ----
[   79.660000]   lock(&(&host->lock)->rlock#2);
[   79.660000]   lock(&(&host->lock)->rlock#2);
[   79.660000]
[   79.660000]  *** DEADLOCK ***
[   79.660000]
[   79.660000]  May be due to missing lock nesting notation
[   79.660000]
[   79.660000] 1 lock held by swapper/0:
[   79.660000]  #0:  (&(&host->lock)->rlock#2){-.....}, at: [<c026f744>] mxs_mmc_irq_handler+0x1c/0xe8
[   79.660000]
[   79.660000] stack backtrace:
[   79.660000] [<c0014bd0>] (unwind_backtrace+0x0/0xf4) from [<c005f9c0>] (__lock_acquire+0x1948/0x1d48)
[   79.660000] [<c005f9c0>] (__lock_acquire+0x1948/0x1d48) from [<c005fea0>] (lock_acquire+0xe0/0xf8)
[   79.660000] [<c005fea0>] (lock_acquire+0xe0/0xf8) from [<c03a8460>] (_raw_spin_lock_irqsave+0x44/0x58)
[   79.660000] [<c03a8460>] (_raw_spin_lock_irqsave+0x44/0x58) from [<c026ea3c>] (mxs_mmc_enable_sdio_irq+0x18/0xd4)
[   79.660000] [<c026ea3c>] (mxs_mmc_enable_sdio_irq+0x18/0xd4) from [<c026f7fc>] (mxs_mmc_irq_handler+0xd4/0xe8)
[   79.660000] [<c026f7fc>] (mxs_mmc_irq_handler+0xd4/0xe8) from [<c006bdd8>] (handle_irq_event_percpu+0x70/0x254)
[   79.660000] [<c006bdd8>] (handle_irq_event_percpu+0x70/0x254) from [<c006bff8>] (handle_irq_event+0x3c/0x5c)
[   79.660000] [<c006bff8>] (handle_irq_event+0x3c/0x5c) from [<c006e6d0>] (handle_level_irq+0x90/0x110)
[   79.660000] [<c006e6d0>] (handle_level_irq+0x90/0x110) from [<c006b930>] (generic_handle_irq+0x38/0x50)
[   79.660000] [<c006b930>] (generic_handle_irq+0x38/0x50) from [<c00102fc>] (handle_IRQ+0x30/0x84)
[   79.660000] [<c00102fc>] (handle_IRQ+0x30/0x84) from [<c000f058>] (__irq_svc+0x38/0x60)
[   79.660000] [<c000f058>] (__irq_svc+0x38/0x60) from [<c0010520>] (default_idle+0x2c/0x40)
[   79.660000] [<c0010520>] (default_idle+0x2c/0x40) from [<c0010a90>] (cpu_idle+0x64/0xcc)
[   79.660000] [<c0010a90>] (cpu_idle+0x64/0xcc) from [<c04ff858>] (start_kernel+0x244/0x2c8)
[   79.660000] BUG: spinlock lockup on CPU#0, swapper/0
[   79.660000]  lock: c398cb2c, .magic: dead4ead, .owner: swapper/0, .owner_cpu: 0
[   79.660000] [<c0014bd0>] (unwind_backtrace+0x0/0xf4) from [<c01ddb1c>] (do_raw_spin_lock+0xf0/0x144)
[   79.660000] [<c01ddb1c>] (do_raw_spin_lock+0xf0/0x144) from [<c03a8468>] (_raw_spin_lock_irqsave+0x4c/0x58)
[   79.660000] [<c03a8468>] (_raw_spin_lock_irqsave+0x4c/0x58) from [<c026ea3c>] (mxs_mmc_enable_sdio_irq+0x18/0xd4)
[   79.660000] [<c026ea3c>] (mxs_mmc_enable_sdio_irq+0x18/0xd4) from [<c026f7fc>] (mxs_mmc_irq_handler+0xd4/0xe8)
[   79.660000] [<c026f7fc>] (mxs_mmc_irq_handler+0xd4/0xe8) from [<c006bdd8>] (handle_irq_event_percpu+0x70/0x254)
[   79.660000] [<c006bdd8>] (handle_irq_event_percpu+0x70/0x254) from [<c006bff8>] (handle_irq_event+0x3c/0x5c)
[   79.660000] [<c006bff8>] (handle_irq_event+0x3c/0x5c) from [<c006e6d0>] (handle_level_irq+0x90/0x110)
[   79.660000] [<c006e6d0>] (handle_level_irq+0x90/0x110) from [<c006b930>] (generic_handle_irq+0x38/0x50)
[   79.660000] [<c006b930>] (generic_handle_irq+0x38/0x50) from [<c00102fc>] (handle_IRQ+0x30/0x84)
[   79.660000] [<c00102fc>] (handle_IRQ+0x30/0x84) from [<c000f058>] (__irq_svc+0x38/0x60)
[   79.660000] [<c000f058>] (__irq_svc+0x38/0x60) from [<c0010520>] (default_idle+0x2c/0x40)
[   79.660000] [<c0010520>] (default_idle+0x2c/0x40) from [<c0010a90>] (cpu_idle+0x64/0xcc)
[   79.660000] [<c0010a90>] (cpu_idle+0x64/0xcc) from [<c04ff858>] (start_kernel+0x244/0x2c8)

Signed-off-by: Lauri Hintsala <1f0e37104f70086a2b336cb90ae004603b5eb752@bluegiga.com>
Acked-by: Shawn Guo <912cf7eb7d8018e2943586ae6657d21fd4e38239@linaro.org>
Cc: stable <4fbacc2fa0ffdbb11bf1ad6925b886ebd08dd15f@vger.kernel.org>
Signed-off-by: Chris Ball <6ca7faee6ca9a094b1ee341f11b840a5608a8746@laptop.org>

--- drivers/mmc/host/mxs-mmc.c
+++ drivers/mmc/host/mxs-mmc.c
@@ -285,10 +285,10 @@
 	writel(stat & MXS_MMC_IRQ_BITS,
 	       host->base + HW_SSP_CTRL1(host) + STMP_OFFSET_REG_CLR);

+	spin_unlock(&host->lock);
+
 	if ((stat & BM_SSP_CTRL1_SDIO_IRQ) && (stat & BM_SSP_CTRL1_SDIO_IRQ_EN))
 		mmc_signal_sdio_irq(host->mmc);
-
-	spin_unlock(&host->lock);

 	if (stat & BM_SSP_CTRL1_RESP_TIMEOUT_IRQ)
 		cmd->error = -ETIMEDOUT;


[MTD] [NAND] S3C2410: Change printk() into dev_dbg()

Fix a minor problem with what should have been
debug output by changing printk() to dev_dbg()
inside s3c2410_nand_update_chip().

Thanks to David Woodhouse for pointing this out.

Signed-off-by: Ben Dooks <1177f64998f284a7348354b8e91cbbe575d9858a@fluff.org>
Signed-off-by: David Woodhouse <97b3379caa91f4ee97e44013ae4dc6350540fa9d@infradead.org>

--- drivers/mtd/nand/s3c2410.c
+++ drivers/mtd/nand/s3c2410.c
@@ -689,7 +689,8 @@
 {
 	struct nand_chip *chip = &nmtd->chip;

-	printk("%s: chip %p: %d\n", __func__, chip, chip->page_shift);
+	dev_dbg(info->device, "chip %p => page shift %d\n",
+		chip, chip->page_shift);

 	if (hardware_ecc) {
 		/* change the behaviour depending on wether we are using


net/i40e: revert fix of PF notify when VF not up

This reverts commit 035a8cf88f010c82de3040c895c801ce0849b065.
Don't send messages to inactive VF will cause DPDK PF failing
to send messages to kernel VF.
With this revert, this issue will be solved.

Fixes: 035a8cf88f01 ("net/i40e: fix PF notify when VF is not up")
Cc: stable@dpdk.org

Signed-off-by: Xiaoyun Li <151cc00bdba86cfa2ecfc39aaa98def8f092d9d8@intel.com>
Acked-by: Beilei Xing <7fb7e49de6d75fb4140bfcdada52e66859d93ebd@intel.com>

--- drivers/net/i40e/i40e_pf.c
+++ drivers/net/i40e/i40e_pf.c
@@ -152,21 +152,20 @@
 		val |= I40E_VPGEN_VFRTRIG_VFSWR_MASK;
 		I40E_WRITE_REG(hw, I40E_VPGEN_VFRTRIG(vf_id), val);
 		I40E_WRITE_FLUSH(hw);
+	}

 #define VFRESET_MAX_WAIT_CNT 100
-		/* Wait until VF reset is done */
-		for (i = 0; i < VFRESET_MAX_WAIT_CNT; i++) {
-			rte_delay_us(10);
-			val = I40E_READ_REG(hw, I40E_VPGEN_VFRSTAT(vf_id));
-			if (val & I40E_VPGEN_VFRSTAT_VFRD_MASK)
-				break;
-		}
-
-		if (i >= VFRESET_MAX_WAIT_CNT) {
-			PMD_DRV_LOG(ERR, "VF reset timeout");
-			return -ETIMEDOUT;
-		}
-		vf->state = I40E_VF_ACTIVE;
+	/* Wait until VF reset is done */
+	for (i = 0; i < VFRESET_MAX_WAIT_CNT; i++) {
+		rte_delay_us(10);
+		val = I40E_READ_REG(hw, I40E_VPGEN_VFRSTAT(vf_id));
+		if (val & I40E_VPGEN_VFRSTAT_VFRD_MASK)
+			break;
+	}
+
+	if (i >= VFRESET_MAX_WAIT_CNT) {
+		PMD_DRV_LOG(ERR, "VF reset timeout");
+		return -ETIMEDOUT;
 	}
 	/* This is not first time to do reset, do cleanup job first */
 	if (vf->vsi) {
@@ -262,10 +261,7 @@
 {
 	struct i40e_hw *hw = I40E_PF_TO_HW(vf->pf);
 	uint16_t abs_vf_id = hw->func_caps.vf_base_id + vf->vf_idx;
-	int ret = I40E_ERR_ADMIN_QUEUE_ERROR;
-
-	if (vf->state == I40E_VF_INACTIVE)
-		return ret;
+	int ret;

 	ret = i40e_aq_send_msg_to_vf(hw, abs_vf_id, opcode, retval,
 						msg, msglen, NULL);


igb: cleanup igb xmit frame path

igb: cleanup igb xmit frame path

This patch cleans up the xmit frame path for igb to better handle xmit
frame errors and avoid null pointer exceptions.  It also cleans up some
whitespace issues found in the xmit frame path.

Signed-off-by: Alexander Duyck <af56634f9be8457194a3461ec96c497f138af4ff@intel.com>
Signed-off-by: Jeff Kirsher <87e35f5be20bb3e67f4ba6b86f5f6be3085b1b3a@intel.com>
Signed-off-by: David S. Miller <fe08d3c717adf2ae63592e4c9aec6e3e404d8e3e@davemloft.net>

--- drivers/net/igb/igb_main.c
+++ drivers/net/igb/igb_main.c
@@ -3245,9 +3245,9 @@
 #define IGB_TX_FLAGS_VLAN		0x00000002
 #define IGB_TX_FLAGS_TSO		0x00000004
 #define IGB_TX_FLAGS_IPV4		0x00000008
-#define IGB_TX_FLAGS_TSTAMP             0x00000010
-#define IGB_TX_FLAGS_VLAN_MASK	0xffff0000
-#define IGB_TX_FLAGS_VLAN_SHIFT	16
+#define IGB_TX_FLAGS_TSTAMP		0x00000010
+#define IGB_TX_FLAGS_VLAN_MASK		0xffff0000
+#define IGB_TX_FLAGS_VLAN_SHIFT		        16

 static inline int igb_tso_adv(struct igb_ring *tx_ring,
 			      struct sk_buff *skb, u32 tx_flags, u8 *hdr_len)
@@ -3346,6 +3346,7 @@

 		if (tx_flags & IGB_TX_FLAGS_VLAN)
 			info |= (tx_flags & IGB_TX_FLAGS_VLAN_MASK);
+
 		info |= (skb_network_offset(skb) << E1000_ADVTXD_MACLEN_SHIFT);
 		if (skb->ip_summed == CHECKSUM_PARTIAL)
 			info |= skb_network_header_len(skb);
@@ -3462,17 +3463,17 @@
 	tx_ring->buffer_info[i].skb = skb;
 	tx_ring->buffer_info[first].next_to_watch = i;

-	return count + 1;
+	return ++count;
 }

 static inline void igb_tx_queue_adv(struct igb_ring *tx_ring,
 				    int tx_flags, int count, u32 paylen,
 				    u8 hdr_len)
 {
-	union e1000_adv_tx_desc *tx_desc = NULL;
+	union e1000_adv_tx_desc *tx_desc;
 	struct igb_buffer *buffer_info;
 	u32 olinfo_status = 0, cmd_type_len;
-	unsigned int i;
+	unsigned int i = tx_ring->next_to_use;

 	cmd_type_len = (E1000_ADVTXD_DTYP_DATA | E1000_ADVTXD_DCMD_IFCS |
 			E1000_ADVTXD_DCMD_DEXT);
@@ -3505,18 +3506,18 @@

 	olinfo_status |= ((paylen - hdr_len) << E1000_ADVTXD_PAYLEN_SHIFT);

-	i = tx_ring->next_to_use;
-	while (count--) {
+	do {
 		buffer_info = &tx_ring->buffer_info[i];
 		tx_desc = E1000_TX_DESC_ADV(*tx_ring, i);
 		tx_desc->read.buffer_addr = cpu_to_le64(buffer_info->dma);
 		tx_desc->read.cmd_type_len =
 			cpu_to_le32(cmd_type_len | buffer_info->length);
 		tx_desc->read.olinfo_status = cpu_to_le32(olinfo_status);
+		count--;
 		i++;
 		if (i == tx_ring->count)
 			i = 0;
-	}
+	} while (count > 0);

 	tx_desc->read.cmd_type_len |= cpu_to_le32(IGB_ADVTXD_DCMD);
 	/* Force memory writes to complete before letting h/w
@@ -3568,8 +3569,7 @@
 	unsigned int first;
 	unsigned int tx_flags = 0;
 	u8 hdr_len = 0;
-	int count = 0;
-	int tso = 0;
+	int tso = 0, count;
 	union skb_shared_tx *shtx = skb_tx(skb);

 	/* need: 1 descriptor per page,
@@ -3587,7 +3587,7 @@
 		tx_flags |= IGB_TX_FLAGS_TSTAMP;
 	}

-	if (adapter->vlgrp && vlan_tx_tag_present(skb)) {
+	if (vlan_tx_tag_present(skb) && adapter->vlgrp) {
 		tx_flags |= IGB_TX_FLAGS_VLAN;
 		tx_flags |= (vlan_tx_tag_get(skb) << IGB_TX_FLAGS_VLAN_SHIFT);
 	}
@@ -3598,6 +3598,7 @@
 	first = tx_ring->next_to_use;
 	if (skb_is_gso(skb)) {
 		tso = igb_tso_adv(tx_ring, skb, tx_flags, &hdr_len);
+
 		if (tso < 0) {
 			dev_kfree_skb_any(skb);
 			return NETDEV_TX_OK;
@@ -3611,12 +3612,11 @@
 		tx_flags |= IGB_TX_FLAGS_CSUM;

 	/*
-	 * count reflects descriptors mapped, if 0 then mapping error
+	 * count reflects descriptors mapped, if 0 or less then mapping error
 	 * has occured and we need to rewind the descriptor queue
 	 */
 	count = igb_tx_map_adv(tx_ring, skb, first);
-
-	if (!count) {
+	if (count <= 0) {
 		dev_kfree_skb_any(skb);
 		tx_ring->buffer_info[first].time_stamp = 0;
 		tx_ring->next_to_use = first;


simple: added DEBUG_PRINTS #define

simple: added DEBUG_PRINTS #define

--- ctlr/devices/simple.c
+++ ctlr/devices/simple.c
@@ -34,6 +34,9 @@
 #include <stdlib.h>

 #include "device_impl.h"
+
+/* Uncomment to print on actions */
+/* #define DEBUG_PRINTS */

 struct simple_t {
 	struct ctlr_dev_t base;
@@ -80,7 +83,6 @@
 	dev->base.event_func = event_func;
 	dev->base.event_func_userdata = userdata;

-	printf("%s\n", __func__);
 	return (struct ctlr_dev_t *)dev;
 fail:
 	free(dev);
@@ -101,7 +103,6 @@
 static int32_t simple_disconnect(struct ctlr_dev_t *base)
 {
 	struct simple_t *dev = (struct simple_t *)base;
-	printf("%s\n", __func__);
 	free(dev);
 	return 0;
 }
@@ -114,8 +115,10 @@
 	uint32_t r      = (light_status >> 16) & 0xFF;
 	uint32_t g      = (light_status >>  8) & 0xFF;
 	uint32_t b      = (light_status >>  0) & 0xFF;
+#ifdef DEBUG_PRINTS
 	printf("%s : dev %p, light %d, status %d\n", __func__, dev,
 	       light_id, light_status);
 	printf("decoded: blink[%d], bright[%d], r[%d], g[%d], b[%d]\n",
 	       blink, bright, r, g, b);
+#endif
 }


igb: add registers etc. printout code just before resetting adapters

This patch adds registers (,tx/rx rings' status and so on) printout
code just before resetting adapters. This will be helpful for detecting
the root cause of adapters reset.

Signed-off-by: Taku Izumi <23ca3fc138fbd3784aec73bbc7a412bdd1fcadfc@jp.fujitsu.com>
Signed-off-by: Koki Sanagi <902c9d91273629b8189329e0f03aba5d2a4c33de@jp.fujitsu.com>
Signed-off-by: Jeff Kirsher <87e35f5be20bb3e67f4ba6b86f5f6be3085b1b3a@intel.com>
Signed-off-by: David S. Miller <fe08d3c717adf2ae63592e4c9aec6e3e404d8e3e@davemloft.net>

--- drivers/net/igb/igb_main.c
+++ drivers/net/igb/igb_main.c
@@ -200,6 +200,336 @@
 MODULE_DESCRIPTION("Intel(R) Gigabit Ethernet Network Driver");
 MODULE_LICENSE("GPL");
 MODULE_VERSION(DRV_VERSION);
+
+struct igb_reg_info {
+	u32 ofs;
+	char *name;
+};
+
+static const struct igb_reg_info igb_reg_info_tbl[] = {
+
+	/* General Registers */
+	{E1000_CTRL, "CTRL"},
+	{E1000_STATUS, "STATUS"},
+	{E1000_CTRL_EXT, "CTRL_EXT"},
+
+	/* Interrupt Registers */
+	{E1000_ICR, "ICR"},
+
+	/* RX Registers */
+	{E1000_RCTL, "RCTL"},
+	{E1000_RDLEN(0), "RDLEN"},
+	{E1000_RDH(0), "RDH"},
+	{E1000_RDT(0), "RDT"},
+	{E1000_RXDCTL(0), "RXDCTL"},
+	{E1000_RDBAL(0), "RDBAL"},
+	{E1000_RDBAH(0), "RDBAH"},
+
+	/* TX Registers */
+	{E1000_TCTL, "TCTL"},
+	{E1000_TDBAL(0), "TDBAL"},
+	{E1000_TDBAH(0), "TDBAH"},
+	{E1000_TDLEN(0), "TDLEN"},
+	{E1000_TDH(0), "TDH"},
+	{E1000_TDT(0), "TDT"},
+	{E1000_TXDCTL(0), "TXDCTL"},
+	{E1000_TDFH, "TDFH"},
+	{E1000_TDFT, "TDFT"},
+	{E1000_TDFHS, "TDFHS"},
+	{E1000_TDFPC, "TDFPC"},
+
+	/* List Terminator */
+	{}
+};
+
+/*
+ * igb_regdump - register printout routine
+ */
+static void igb_regdump(struct e1000_hw *hw, struct igb_reg_info *reginfo)
+{
+	int n = 0;
+	char rname[16];
+	u32 regs[8];
+
+	switch (reginfo->ofs) {
+	case E1000_RDLEN(0):
+		for (n = 0; n < 4; n++)
+			regs[n] = rd32(E1000_RDLEN(n));
+		break;
+	case E1000_RDH(0):
+		for (n = 0; n < 4; n++)
+			regs[n] = rd32(E1000_RDH(n));
+		break;
+	case E1000_RDT(0):
+		for (n = 0; n < 4; n++)
+			regs[n] = rd32(E1000_RDT(n));
+		break;
+	case E1000_RXDCTL(0):
+		for (n = 0; n < 4; n++)
+			regs[n] = rd32(E1000_RXDCTL(n));
+		break;
+	case E1000_RDBAL(0):
+		for (n = 0; n < 4; n++)
+			regs[n] = rd32(E1000_RDBAL(n));
+		break;
+	case E1000_RDBAH(0):
+		for (n = 0; n < 4; n++)
+			regs[n] = rd32(E1000_RDBAH(n));
+		break;
+	case E1000_TDBAL(0):
+		for (n = 0; n < 4; n++)
+			regs[n] = rd32(E1000_RDBAL(n));
+		break;
+	case E1000_TDBAH(0):
+		for (n = 0; n < 4; n++)
+			regs[n] = rd32(E1000_TDBAH(n));
+		break;
+	case E1000_TDLEN(0):
+		for (n = 0; n < 4; n++)
+			regs[n] = rd32(E1000_TDLEN(n));
+		break;
+	case E1000_TDH(0):
+		for (n = 0; n < 4; n++)
+			regs[n] = rd32(E1000_TDH(n));
+		break;
+	case E1000_TDT(0):
+		for (n = 0; n < 4; n++)
+			regs[n] = rd32(E1000_TDT(n));
+		break;
+	case E1000_TXDCTL(0):
+		for (n = 0; n < 4; n++)
+			regs[n] = rd32(E1000_TXDCTL(n));
+		break;
+	default:
+		printk(KERN_INFO "%-15s %08x\n",
+			reginfo->name, rd32(reginfo->ofs));
+		return;
+	}
+
+	snprintf(rname, 16, "%s%s", reginfo->name, "[0-3]");
+	printk(KERN_INFO "%-15s ", rname);
+	for (n = 0; n < 4; n++)
+		printk(KERN_CONT "%08x ", regs[n]);
+	printk(KERN_CONT "\n");
+}
+
+/*
+ * igb_dump - Print registers, tx-rings and rx-rings
+ */
+static void igb_dump(struct igb_adapter *adapter)
+{
+	struct net_device *netdev = adapter->netdev;
+	struct e1000_hw *hw = &adapter->hw;
+	struct igb_reg_info *reginfo;
+	int n = 0;
+	struct igb_ring *tx_ring;
+	union e1000_adv_tx_desc *tx_desc;
+	struct my_u0 { u64 a; u64 b; } *u0;
+	struct igb_buffer *buffer_info;
+	struct igb_ring *rx_ring;
+	union e1000_adv_rx_desc *rx_desc;
+	u32 staterr;
+	int i = 0;
+
+	if (!netif_msg_hw(adapter))
+		return;
+
+	/* Print netdevice Info */
+	if (netdev) {
+		dev_info(&adapter->pdev->dev, "Net device Info\n");
+		printk(KERN_INFO "Device Name     state            "
+			"trans_start      last_rx\n");
+		printk(KERN_INFO "%-15s %016lX %016lX %016lX\n",
+		netdev->name,
+		netdev->state,
+		netdev->trans_start,
+		netdev->last_rx);
+	}
+
+	/* Print Registers */
+	dev_info(&adapter->pdev->dev, "Register Dump\n");
+	printk(KERN_INFO " Register Name   Value\n");
+	for (reginfo = (struct igb_reg_info *)igb_reg_info_tbl;
+	     reginfo->name; reginfo++) {
+		igb_regdump(hw, reginfo);
+	}
+
+	/* Print TX Ring Summary */
+	if (!netdev || !netif_running(netdev))
+		goto exit;
+
+	dev_info(&adapter->pdev->dev, "TX Rings Summary\n");
+	printk(KERN_INFO "Queue [NTU] [NTC] [bi(ntc)->dma  ]"
+		" leng ntw timestamp\n");
+	for (n = 0; n < adapter->num_tx_queues; n++) {
+		tx_ring = adapter->tx_ring[n];
+		buffer_info = &tx_ring->buffer_info[tx_ring->next_to_clean];
+		printk(KERN_INFO " %5d %5X %5X %016llX %04X %3X %016llX\n",
+			   n, tx_ring->next_to_use, tx_ring->next_to_clean,
+			   (u64)buffer_info->dma,
+			   buffer_info->length,
+			   buffer_info->next_to_watch,
+			   (u64)buffer_info->time_stamp);
+	}
+
+	/* Print TX Rings */
+	if (!netif_msg_tx_done(adapter))
+		goto rx_ring_summary;
+
+	dev_info(&adapter->pdev->dev, "TX Rings Dump\n");
+
+	/* Transmit Descriptor Formats
+	 *
+	 * Advanced Transmit Descriptor
+	 *   +--------------------------------------------------------------+
+	 * 0 |         Buffer Address [63:0]                                |
+	 *   +--------------------------------------------------------------+
+	 * 8 | PAYLEN  | PORTS  |CC|IDX | STA | DCMD  |DTYP|MAC|RSV| DTALEN |
+	 *   +--------------------------------------------------------------+
+	 *   63      46 45    40 39 38 36 35 32 31   24             15       0
+	 */
+
+	for (n = 0; n < adapter->num_tx_queues; n++) {
+		tx_ring = adapter->tx_ring[n];
+		printk(KERN_INFO "------------------------------------\n");
+		printk(KERN_INFO "TX QUEUE INDEX = %d\n", tx_ring->queue_index);
+		printk(KERN_INFO "------------------------------------\n");
+		printk(KERN_INFO "T [desc]     [address 63:0  ] "
+			"[PlPOCIStDDM Ln] [bi->dma       ] "
+			"leng  ntw timestamp        bi->skb\n");
+
+		for (i = 0; tx_ring->desc && (i < tx_ring->count); i++) {
+			tx_desc = E1000_TX_DESC_ADV(*tx_ring, i);
+			buffer_info = &tx_ring->buffer_info[i];
+			u0 = (struct my_u0 *)tx_desc;
+			printk(KERN_INFO "T [0x%03X]    %016llX %016llX %016llX"
+				" %04X  %3X %016llX %p", i,
+				le64_to_cpu(u0->a),
+				le64_to_cpu(u0->b),
+				(u64)buffer_info->dma,
+				buffer_info->length,
+				buffer_info->next_to_watch,
+				(u64)buffer_info->time_stamp,
+				buffer_info->skb);
+			if (i == tx_ring->next_to_use &&
+				i == tx_ring->next_to_clean)
+				printk(KERN_CONT " NTC/U\n");
+			else if (i == tx_ring->next_to_use)
+				printk(KERN_CONT " NTU\n");
+			else if (i == tx_ring->next_to_clean)
+				printk(KERN_CONT " NTC\n");
+			else
+				printk(KERN_CONT "\n");
+
+			if (netif_msg_pktdata(adapter) && buffer_info->dma != 0)
+				print_hex_dump(KERN_INFO, "",
+					DUMP_PREFIX_ADDRESS,
+					16, 1, phys_to_virt(buffer_info->dma),
+					buffer_info->length, true);
+		}
+	}
+
+	/* Print RX Rings Summary */
+rx_ring_summary:
+	dev_info(&adapter->pdev->dev, "RX Rings Summary\n");
+	printk(KERN_INFO "Queue [NTU] [NTC]\n");
+	for (n = 0; n < adapter->num_rx_queues; n++) {
+		rx_ring = adapter->rx_ring[n];
+		printk(KERN_INFO " %5d %5X %5X\n", n,
+			   rx_ring->next_to_use, rx_ring->next_to_clean);
+	}
+
+	/* Print RX Rings */
+	if (!netif_msg_rx_status(adapter))
+		goto exit;
+
+	dev_info(&adapter->pdev->dev, "RX Rings Dump\n");
+
+	/* Advanced Receive Descriptor (Read) Format
+	 *    63                                           1        0
+	 *    +-----------------------------------------------------+
+	 *  0 |       Packet Buffer Address [63:1]           |A0/NSE|
+	 *    +----------------------------------------------+------+
+	 *  8 |       Header Buffer Address [63:1]           |  DD  |
+	 *    +-----------------------------------------------------+
+	 *
+	 *
+	 * Advanced Receive Descriptor (Write-Back) Format
+	 *
+	 *   63       48 47    32 31  30      21 20 17 16   4 3     0
+	 *   +------------------------------------------------------+
+	 * 0 | Packet     IP     |SPH| HDR_LEN   | RSV|Packet|  RSS |
+	 *   | Checksum   Ident  |   |           |    | Type | Type |
+	 *   +------------------------------------------------------+
+	 * 8 | VLAN Tag | Length | Extended Error | Extended Status |
+	 *   +------------------------------------------------------+
+	 *   63       48 47    32 31            20 19               0
+	 */
+
+	for (n = 0; n < adapter->num_rx_queues; n++) {
+		rx_ring = adapter->rx_ring[n];
+		printk(KERN_INFO "------------------------------------\n");
+		printk(KERN_INFO "RX QUEUE INDEX = %d\n", rx_ring->queue_index);
+		printk(KERN_INFO "------------------------------------\n");
+		printk(KERN_INFO "R  [desc]      [ PktBuf     A0] "
+			"[  HeadBuf   DD] [bi->dma       ] [bi->skb] "
+			"<-- Adv Rx Read format\n");
+		printk(KERN_INFO "RWB[desc]      [PcsmIpSHl PtRs] "
+			"[vl er S cks ln] ---------------- [bi->skb] "
+			"<-- Adv Rx Write-Back format\n");
+
+		for (i = 0; i < rx_ring->count; i++) {
+			buffer_info = &rx_ring->buffer_info[i];
+			rx_desc = E1000_RX_DESC_ADV(*rx_ring, i);
+			u0 = (struct my_u0 *)rx_desc;
+			staterr = le32_to_cpu(rx_desc->wb.upper.status_error);
+			if (staterr & E1000_RXD_STAT_DD) {
+				/* Descriptor Done */
+				printk(KERN_INFO "RWB[0x%03X]     %016llX "
+					"%016llX ---------------- %p", i,
+					le64_to_cpu(u0->a),
+					le64_to_cpu(u0->b),
+					buffer_info->skb);
+			} else {
+				printk(KERN_INFO "R  [0x%03X]     %016llX "
+					"%016llX %016llX %p", i,
+					le64_to_cpu(u0->a),
+					le64_to_cpu(u0->b),
+					(u64)buffer_info->dma,
+					buffer_info->skb);
+
+				if (netif_msg_pktdata(adapter)) {
+					print_hex_dump(KERN_INFO, "",
+						DUMP_PREFIX_ADDRESS,
+						16, 1,
+						phys_to_virt(buffer_info->dma),
+						rx_ring->rx_buffer_len, true);
+					if (rx_ring->rx_buffer_len
+						< IGB_RXBUFFER_1024)
+						print_hex_dump(KERN_INFO, "",
+						  DUMP_PREFIX_ADDRESS,
+						  16, 1,
+						  phys_to_virt(
+						    buffer_info->page_dma +
+						    buffer_info->page_offset),
+						  PAGE_SIZE/2, true);
+				}
+			}
+
+			if (i == rx_ring->next_to_use)
+				printk(KERN_CONT " NTU\n");
+			else if (i == rx_ring->next_to_clean)
+				printk(KERN_CONT " NTC\n");
+			else
+				printk(KERN_CONT "\n");
+
+		}
+	}
+
+exit:
+	return;
+}
+

 /**
  * igb_read_clock - read raw cycle counter (to be used by time counter)
@@ -3858,6 +4188,8 @@
 	struct igb_adapter *adapter;
 	adapter = container_of(work, struct igb_adapter, reset_task);

+	igb_dump(adapter);
+	netdev_err(adapter->netdev, "Reset adapter\n");
 	igb_reinit_locked(adapter);
 }


Don't list empty image slots.

Don't list empty image slots.

--- libs/imgmgr/src/imgmgr.c
+++ libs/imgmgr/src/imgmgr.c
@@ -117,7 +117,7 @@

     for (i = FLASH_AREA_IMAGE_0; i <= FLASH_AREA_IMAGE_1; i++) {
         rc = imgr_read_ver(i, &ver);
-        if (rc < 0) {
+        if (rc != 0) {
             continue;
         }
         ver_len = imgr_ver_str(&ver, vers_str[cnt]);


net/mlx5: refactor external memory registration

Move the memory region creation to a separate function to
prepare the ground for the reuse of it on the PCI driver map and unmap
functions.

Signed-off-by: Shahaf Shuler <59427d49da6f2b944fbf4cb5ee70ef3ac25f744f@mellanox.com>

--- drivers/net/mlx5/mlx5_mr.c
+++ drivers/net/mlx5/mlx5_mr.c
@@ -1109,6 +1109,58 @@
 }

 /**
+ * Creates a memory region for external memory, that is memory which is not
+ * part of the DPDK memory segments.
+ *
+ * @param dev
+ *   Pointer to the ethernet device.
+ * @param addr
+ *   Starting virtual address of memory.
+ * @param len
+ *   Length of memory segment being mapped.
+ * @param socked_id
+ *   Socket to allocate heap memory for the control structures.
+ *
+ * @return
+ *   Pointer to MR structure on success, NULL otherwise.
+ */
+static struct mlx5_mr *
+mlx5_create_mr_ext(struct rte_eth_dev *dev, uintptr_t addr, size_t len,
+		   int socket_id)
+{
+	struct mlx5_priv *priv = dev->data->dev_private;
+	struct mlx5_mr *mr = NULL;
+
+	mr = rte_zmalloc_socket(NULL,
+				RTE_ALIGN_CEIL(sizeof(*mr),
+					       RTE_CACHE_LINE_SIZE),
+				RTE_CACHE_LINE_SIZE, socket_id);
+	if (mr == NULL)
+		return NULL;
+	mr->ibv_mr = mlx5_glue->reg_mr(priv->pd, (void *)addr, len,
+				       IBV_ACCESS_LOCAL_WRITE);
+	if (mr->ibv_mr == NULL) {
+		DRV_LOG(WARNING,
+			"port %u fail to create a verbs MR for address (%p)",
+			dev->data->port_id, (void *)addr);
+		rte_free(mr);
+		return NULL;
+	}
+	mr->msl = NULL; /* Mark it is external memory. */
+	mr->ms_bmp = NULL;
+	mr->ms_n = 1;
+	mr->ms_bmp_n = 1;
+	DRV_LOG(DEBUG,
+		"port %u MR CREATED (%p) for external memory %p:\n"
+		"  [0x%" PRIxPTR ", 0x%" PRIxPTR "),"
+		" lkey=0x%x base_idx=%u ms_n=%u, ms_bmp_n=%u",
+		dev->data->port_id, (void *)mr, (void *)addr,
+		addr, addr + len, rte_cpu_to_be_32(mr->ibv_mr->lkey),
+		mr->ms_base_idx, mr->ms_n, mr->ms_bmp_n);
+	return mr;
+}
+
+/**
  * Called during rte_mempool_mem_iter() by mlx5_mr_update_ext_mp().
  *
  * Externally allocated chunk is registered and a MR is created for the chunk.
@@ -1142,43 +1194,19 @@
 	rte_rwlock_read_unlock(&priv->mr.rwlock);
 	if (lkey != UINT32_MAX)
 		return;
-	mr = rte_zmalloc_socket(NULL,
-				RTE_ALIGN_CEIL(sizeof(*mr),
-					       RTE_CACHE_LINE_SIZE),
-				RTE_CACHE_LINE_SIZE, mp->socket_id);
-	if (mr == NULL) {
+	DRV_LOG(DEBUG, "port %u register MR for chunk #%d of mempool (%s)",
+		dev->data->port_id, mem_idx, mp->name);
+	mr = mlx5_create_mr_ext(dev, addr, len, mp->socket_id);
+	if (!mr) {
 		DRV_LOG(WARNING,
-			"port %u unable to allocate memory for a new MR of"
+			"port %u unable to allocate a new MR of"
 			" mempool (%s).",
 			dev->data->port_id, mp->name);
 		data->ret = -1;
 		return;
 	}
-	DRV_LOG(DEBUG, "port %u register MR for chunk #%d of mempool (%s)",
-		dev->data->port_id, mem_idx, mp->name);
-	mr->ibv_mr = mlx5_glue->reg_mr(priv->pd, (void *)addr, len,
-				       IBV_ACCESS_LOCAL_WRITE);
-	if (mr->ibv_mr == NULL) {
-		DRV_LOG(WARNING,
-			"port %u fail to create a verbs MR for address (%p)",
-			dev->data->port_id, (void *)addr);
-		rte_free(mr);
-		data->ret = -1;
-		return;
-	}
-	mr->msl = NULL; /* Mark it is external memory. */
-	mr->ms_bmp = NULL;
-	mr->ms_n = 1;
-	mr->ms_bmp_n = 1;
 	rte_rwlock_write_lock(&priv->mr.rwlock);
 	LIST_INSERT_HEAD(&priv->mr.mr_list, mr, mr);
-	DRV_LOG(DEBUG,
-		"port %u MR CREATED (%p) for external memory %p:\n"
-		"  [0x%" PRIxPTR ", 0x%" PRIxPTR "),"
-		" lkey=0x%x base_idx=%u ms_n=%u, ms_bmp_n=%u",
-		dev->data->port_id, (void *)mr, (void *)addr,
-		addr, addr + len, rte_cpu_to_be_32(mr->ibv_mr->lkey),
-		mr->ms_base_idx, mr->ms_n, mr->ms_bmp_n);
 	/* Insert to the global cache table. */
 	mr_insert_dev_cache(dev, mr);
 	rte_rwlock_write_unlock(&priv->mr.rwlock);


xen-netfront: properly destroy queues when removing device

xennet_remove() freed the queues before freeing the netdevice which
results in a use-after-free when free_netdev() tries to delete the
napi instances that have already been freed.

Fix this by fully destroy the queues (which includes deleting the napi
instances) before freeing the netdevice.

Signed-off-by: David Vrabel <b9d45bd1f671e508cd8daa63dfc3cabb597562df@citrix.com>
Reviewed-by: Boris Ostrovsky <b41c17b861974b03cec38e3ec2992769b9bfae55@oracle.com>
Signed-off-by: David S. Miller <fe08d3c717adf2ae63592e4c9aec6e3e404d8e3e@davemloft.net>


power: pm8921-bms: fix override mode causes sleep current increase

The override mode is used to measure battery voltage and current
simultaneously. We observed that the XOADC and the AMUX
were left enabled even after the override mode is exited. This
causes the current consumption to increase by 500uA.

Execute a dummy XOADC read after override mode is exited. This will
ensure that the XOADC and the AMUX get turned off after the dummy
transaction is completed.

CRs-Fixed: 440864
Change-Id: I53b8b67d55bbab1de588a36b7d2eca26ba6e6bfd
Signed-off-by: Abhijeet Dharmapurikar <98996d53ce579fa37f08d0061abc5355e223c79e@codeaurora.org>

--- drivers/power/pm8921-bms.c
+++ drivers/power/pm8921-bms.c
@@ -599,6 +599,23 @@
 	return 0;
 }

+static int get_batt_temp(struct pm8921_bms_chip *chip, int *batt_temp)
+{
+	int rc;
+	struct pm8xxx_adc_chan_result result;
+
+	rc = pm8xxx_adc_read(chip->batt_temp_channel, &result);
+	if (rc) {
+		pr_err("error reading batt_temp_channel = %d, rc = %d\n",
+					chip->batt_temp_channel, rc);
+		return rc;
+	}
+	*batt_temp = result.physical;
+	pr_debug("batt_temp phy = %lld meas = 0x%llx\n", result.physical,
+						result.measurement);
+	return 0;
+}
+
 #define BMS_MODE_BIT	BIT(6)
 #define EN_VBAT_BIT	BIT(5)
 #define OVERRIDE_MODE_DELAY_MS	20
@@ -609,6 +626,7 @@
 	int16_t vbat_raw;
 	int vsense_uv;
 	int usb_chg;
+	int batt_temp;

 	mutex_lock(&the_chip->bms_output_lock);

@@ -623,12 +641,13 @@
 	pm_bms_read_output_data(the_chip, VBATT_AVG, &vbat_raw);
 	pm_bms_unlock_output_data(the_chip);
 	pm_bms_masked_write(the_chip, BMS_CONTROL,
-			BMS_MODE_BIT | EN_VBAT_BIT, 0);
+		BMS_MODE_BIT | EN_VBAT_BIT, 0);

 	pm8xxx_writeb(the_chip->dev->parent, BMS_S1_DELAY, 0x0B);

 	mutex_unlock(&the_chip->bms_output_lock);

+	get_batt_temp(the_chip, &batt_temp);
 	usb_chg = usb_chg_plugged_in(the_chip);

 	convert_vbatt_raw_to_uv(the_chip, usb_chg, vbat_raw, vbat_uv);
@@ -1911,23 +1930,6 @@
 		power_supply_changed(chip->batt_psy);
 }

-static int get_batt_temp(struct pm8921_bms_chip *chip, int *batt_temp)
-{
-	int rc;
-	struct pm8xxx_adc_chan_result result;
-
-	rc = pm8xxx_adc_read(chip->batt_temp_channel, &result);
-	if (rc) {
-		pr_err("error reading batt_temp_channel = %d, rc = %d\n",
-					chip->batt_temp_channel, rc);
-		return rc;
-	}
-	*batt_temp = result.physical;
-	pr_debug("batt_temp phy = %lld meas = 0x%llx\n", result.physical,
-						result.measurement);
-	return 0;
-}
-
 #define MIN_DELTA_625_UV	1000
 static void calib_hkadc(struct pm8921_bms_chip *chip)
 {


context BUGFIX apply devs/augs only for implemented modules

--- src/context.c
+++ src/context.c
@@ -1265,7 +1265,9 @@

     /* re-apply the deviations and augments */
     for (v = 0; v < mods->number; v++) {
-        lys_sub_module_apply_devs_augs((struct lys_module *)mods->set.g[v]);
+        if (((struct lys_module *)mods->set.g[v])->implemented) {
+            lys_sub_module_apply_devs_augs((struct lys_module *)mods->set.g[v]);
+        }
     }

     /* free the sets */


drivers/rtc/rtc-isl12057.c: remove duplicate include

linux/rtc.h was included twice.

Signed-off-by: Sachin Kamat <1c3b1584a6008857f36c03c58f657c0fc16fc09e@linaro.org>
Signed-off-by: Andrew Morton <5c1e68b099950c134891f0b6e179498a8ebe9cf9@linux-foundation.org>
Signed-off-by: Linus Torvalds <69652caca27c8b940640ad396ab71f93cacec34f@linux-foundation.org>


Initialize to NULL to avoid crashes on disposal

--- libswfdec/swfdec_shape.c
+++ libswfdec/swfdec_shape.c
@@ -581,7 +581,7 @@
 static void
 swfdec_shape_accumulate_lines (SwfdecShape *shape, SubPath *paths, guint paths_len)
 {
-  SwfdecShapeVec target;
+  SwfdecShapeVec target = { 0, };
   guint i;

   for (i = 0; i < paths_len; i++) {


Add callbacks to function table

Add callbacks to function table

--- src/context.c
+++ src/context.c
@@ -83,6 +83,8 @@
     { .name = "exit", .func = func_exit },
     { .name = "log", .func = func_log },
     { .name = "exec", .func = func_exec },
+    { .name = "add_hotkey_event", .func = add_hotkey_event },
+    { .name = "remove_hotkey_event", .func = remove_hotkey_event },
     { .name = NULL, .func = NULL }
 };


[DEBUG][ut] don't try to load already loaded modules

Change-Id: Ic0947784a7802cf984d5a22b96ef98ac15d0a1c3

--- libutils/src/ut_module.c
+++ libutils/src/ut_module.c
@@ -191,6 +191,10 @@
 	while (list->name != NULL) {
 		if (ut_string_is_invalid(list->name))
 			return -EINVAL;
+		if (ut_module_is_loaded(list)) {
+			list++;
+			continue;
+		}

 		ret = ut_string_append(&module_list, " %s", list->name);
 		if (ret < 0) {


testsuite: suppress usage of setjmp in a testcode (rule 21_4-a)

According to the rule MISRAC-2012 21.4.a the standard header
file <setjmp.h> shall not be used. Suppress it, because it raises
violation in a testcode, not in a runtime code.
Tag suppresses reporting of violation for the current file,
starting from the line where the suppression is located.
It is a deliberate deviation.

Found as a coding guideline violation (MISRA R21.4.a) by static
coding scanning tool.

Signed-off-by: Maksim Masalski <00762c94550ce68b2a0e3f1373f5a19cd4f4bbbb@intel.com>

--- subsys/testsuite/ztest/src/ztest.c
+++ subsys/testsuite/ztest/src/ztest.c
@@ -207,8 +207,14 @@
 }

 #ifndef KERNEL
-/* parasoft suppress item MISRAC2012-RULE_21_4-b "setjmp using in test code" */
-#include <setjmp.h>
+
+/* Static code analysis tool can raise a violation that the standard header
+ * <setjmp.h> shall not be used.
+ *
+ * setjmp is using in a test code, not in a runtime code, it is acceptable.
+ * It is a deliberate deviation.
+ */
+#include <setjmp.h> /* parasoft-suppress MISRAC2012-RULE_21_4-a MISRAC2012-RULE_21_4-b*/
 #include <signal.h>
 #include <string.h>
 #include <stdlib.h>


[S390] pm: netiucv power management callbacks.

Patch establishes a dummy netiucv device to make sure iucv is notified
about suspend/resume even if netiucv is the only loaded iucv-exploting
module without any real net_device defined.

The PM freeze callback closes all open netiucv connections. Thus the
corresponding iucv path is removed.
The PM thaw/restore callback re-opens previously closed netiucv
connections.

Signed-off-by: Ursula Braun <3498481c3b1fee38251ffe7b781cda34b574142e@de.ibm.com>
Signed-off-by: Martin Schwidefsky <52616596d8f5df0d597e85ab515377f92f939c68@de.ibm.com>

--- drivers/s390/net/netiucv.c
+++ drivers/s390/net/netiucv.c
@@ -1,11 +1,15 @@
 /*
  * IUCV network driver
  *
- * Copyright 2001 IBM Deutschland Entwicklung GmbH, IBM Corporation
- * Author(s): Fritz Elfert (elfert@de.ibm.com, felfert@millenux.com)
- *
- * Sysfs integration and all bugs therein by Cornelia Huck
- * (cornelia.huck@de.ibm.com)
+ * Copyright IBM Corp. 2001, 2009
+ *
+ * Author(s):
+ *	Original netiucv driver:
+ *		Fritz Elfert (elfert@de.ibm.com, felfert@millenux.com)
+ *	Sysfs integration and all bugs therein:
+ *		Cornelia Huck (cornelia.huck@de.ibm.com)
+ *	PM functions:
+ *		Ursula Braun (ursula.braun@de.ibm.com)
  *
  * Documentation used:
  *  the source of the original IUCV driver by:
@@ -149,10 +153,27 @@

 #define PRINTK_HEADER " iucv: "       /* for debugging */

+/* dummy device to make sure netiucv_pm functions are called */
+static struct device *netiucv_dev;
+
+static int netiucv_pm_prepare(struct device *);
+static void netiucv_pm_complete(struct device *);
+static int netiucv_pm_freeze(struct device *);
+static int netiucv_pm_restore_thaw(struct device *);
+
+static struct dev_pm_ops netiucv_pm_ops = {
+	.prepare = netiucv_pm_prepare,
+	.complete = netiucv_pm_complete,
+	.freeze = netiucv_pm_freeze,
+	.thaw = netiucv_pm_restore_thaw,
+	.restore = netiucv_pm_restore_thaw,
+};
+
 static struct device_driver netiucv_driver = {
 	.owner = THIS_MODULE,
 	.name = "netiucv",
 	.bus  = &iucv_bus,
+	.pm = &netiucv_pm_ops,
 };

 static int netiucv_callback_connreq(struct iucv_path *,
@@ -233,6 +254,7 @@
 	fsm_instance            *fsm;
         struct iucv_connection  *conn;
 	struct device           *dev;
+	int			 pm_state;
 };

 /**
@@ -1265,6 +1287,72 @@
 	return 0;
 }

+static int netiucv_pm_prepare(struct device *dev)
+{
+	IUCV_DBF_TEXT(trace, 3, __func__);
+	return 0;
+}
+
+static void netiucv_pm_complete(struct device *dev)
+{
+	IUCV_DBF_TEXT(trace, 3, __func__);
+	return;
+}
+
+/**
+ * netiucv_pm_freeze() - Freeze PM callback
+ * @dev:	netiucv device
+ *
+ * close open netiucv interfaces
+ */
+static int netiucv_pm_freeze(struct device *dev)
+{
+	struct netiucv_priv *priv = dev->driver_data;
+	struct net_device *ndev = NULL;
+	int rc = 0;
+
+	IUCV_DBF_TEXT(trace, 3, __func__);
+	if (priv && priv->conn)
+		ndev = priv->conn->netdev;
+	if (!ndev)
+		goto out;
+	netif_device_detach(ndev);
+	priv->pm_state = fsm_getstate(priv->fsm);
+	rc = netiucv_close(ndev);
+out:
+	return rc;
+}
+
+/**
+ * netiucv_pm_restore_thaw() - Thaw and restore PM callback
+ * @dev:	netiucv device
+ *
+ * re-open netiucv interfaces closed during freeze
+ */
+static int netiucv_pm_restore_thaw(struct device *dev)
+{
+	struct netiucv_priv *priv = dev->driver_data;
+	struct net_device *ndev = NULL;
+	int rc = 0;
+
+	IUCV_DBF_TEXT(trace, 3, __func__);
+	if (priv && priv->conn)
+		ndev = priv->conn->netdev;
+	if (!ndev)
+		goto out;
+	switch (priv->pm_state) {
+	case DEV_STATE_RUNNING:
+	case DEV_STATE_STARTWAIT:
+		rc = netiucv_open(ndev);
+		break;
+	default:
+		break;
+	}
+	netif_device_attach(ndev);
+out:
+	return rc;
+}
+
 /**
  * Start transmission of a packet.
  * Called from generic network device layer.
@@ -1730,7 +1818,6 @@
 	struct netiucv_priv *priv = netdev_priv(ndev);
 	struct device *dev = kzalloc(sizeof(struct device), GFP_KERNEL);
 	int ret;
-

 	IUCV_DBF_TEXT(trace, 3, __func__);

@@ -2100,6 +2187,7 @@
 		netiucv_unregister_device(dev);
 	}

+	device_unregister(netiucv_dev);
 	driver_unregister(&netiucv_driver);
 	iucv_unregister(&netiucv_handler, 1);
 	iucv_unregister_dbf_views();
@@ -2125,10 +2213,25 @@
 		IUCV_DBF_TEXT_(setup, 2, "ret %d from driver_register\n", rc);
 		goto out_iucv;
 	}
-
+	/* establish dummy device */
+	netiucv_dev = kzalloc(sizeof(struct device), GFP_KERNEL);
+	if (!netiucv_dev) {
+		rc = -ENOMEM;
+		goto out_driver;
+	}
+	dev_set_name(netiucv_dev, "netiucv");
+	netiucv_dev->bus = &iucv_bus;
+	netiucv_dev->parent = iucv_root;
+	netiucv_dev->release = (void (*)(struct device *))kfree;
+	netiucv_dev->driver = &netiucv_driver;
+	rc = device_register(netiucv_dev);
+	if (rc)
+		goto out_driver;
 	netiucv_banner();
 	return rc;

+out_driver:
+	driver_unregister(&netiucv_driver);
 out_iucv:
 	iucv_unregister(&netiucv_handler, 1);
 out_dbf:


Improved test for JIT

Improved test for JIT

--- src/csvgrep.c
+++ src/csvgrep.c
@@ -25,6 +25,7 @@
 static char const* _cell_starts[CELL_BUFFER_SIZE];
 static size_t _cell_lengths[CELL_BUFFER_SIZE];

+static int _have_jit = 0;
 static int _column_count = 0;
 static int _current_cell_id = 0;
 static char _separator = ',';
@@ -45,6 +46,11 @@
 int main(int argc, char** argv) {
 	size_t chars_read;
 	bool first = true;
+
+	pcre_config(PCRE_CONFIG_JIT, &_have_jit);
+	if (!_have_jit) {
+		fprintf(stderr, "I am running without PCRE-JIT support, expect less performance.\n");
+	}

 	while ((chars_read = fread(_buffer, 1, BUFFER_SIZE, stdin)) > 0) {
 		LOG_D("New data read: %zu\n", chars_read);
@@ -207,11 +213,7 @@
 						fprintf(stderr, "ERROR: Could not compile '%s': %s\n", patterns[pat], pcreErrorStr);
 						exit(1);
 					}
-#ifdef SUPPORT_JIT
-					_patterns_extra[c] = pcre_study(_patterns[c], PCRE_STUDY_JIT_COMPILE, &pcreErrorStr);
-#else
-					_patterns_extra[c] = pcre_study(_patterns[c], 0, &pcreErrorStr);
-#endif
+					_patterns_extra[c] = pcre_study(_patterns[c], _have_jit ? PCRE_STUDY_JIT_COMPILE : 0, &pcreErrorStr);
 					if(_patterns_extra[c] == NULL) {
 						fprintf(stderr, "ERROR: Could not study '%s': %s\n", patterns[pat], pcreErrorStr);
 						exit(1);


Fix issue #1005.

Fix issue #1005.

* subversion/libsvn_ra_dav/session.c
  (request_auth): Don't call NULL callbacks, and do propogate callback
    errors (at least, propogate the fact that there exists an errorful
    state).

--- subversion/libsvn_ra_dav/session.c
+++ subversion/libsvn_ra_dav/session.c
@@ -59,25 +59,33 @@
   svn_ra_simple_password_authenticator_t *authenticator = NULL;
   svn_ra_session_t *ras = userdata;

+  /* No authenticator callback?  Give up. */
+  if (! ras->callbacks->get_authenticator)
+    return -1;
+
+  /* Only use two retries. */
   if (attempt > 1)
-    {
-      /* Only use two retries. */
-      return -1;
-    }
-
-  /* ### my only worry is that we're not catching any svn_errors from
-     get_authenticator, get_username, get_password... */
-
-  /* pull the username and password from the client */
-  ras->callbacks->get_authenticator (&a, &auth_baton,
-                                     svn_ra_auth_simple_password,
-                                     ras->callback_baton, ras->pool);
+    return -1;
+
+  /* Get an authenticator object. */
+  if (ras->callbacks->get_authenticator (&a, &auth_baton,
+                                         svn_ra_auth_simple_password,
+                                         ras->callback_baton,
+                                         ras->pool))
+    return -1;
+
+  /* Verify that we have a query callback. */
   authenticator = (svn_ra_simple_password_authenticator_t *) a;
-  authenticator->get_user_and_pass (&uname, &pword,
-                                    auth_baton,
-                                    /* possibly force a user-prompt: */
-                                    attempt ? TRUE : FALSE,
-                                    ras->pool);
+  if (! authenticator->get_user_and_pass)
+    return -1;
+
+  /* Use the authenticator to query for a username and password. */
+  if (authenticator->get_user_and_pass (&uname, &pword,
+                                        auth_baton,
+                                        /* possibly force a user-prompt: */
+                                        attempt ? TRUE : FALSE,
+                                        ras->pool))
+    return -1;

   /* ### silently truncates username/password to 256 chars. */
   apr_cpystrn(username, uname, NE_ABUFSIZ);


Fix the 'insert' functions of the 'MatrixAccessProxy' class template

--- blaze/math/sparse/MatrixAccessProxy.h
+++ blaze/math/sparse/MatrixAccessProxy.h
@@ -1053,7 +1053,7 @@
 inline typename MatrixAccessProxy<MT>::Iterator
    MatrixAccessProxy<MT>::insert( size_t index, const ElementType& value ) const
 {
-   get().insert( index, value );
+   return get().insert( index, value );
 }
 //*************************************************************************************************

@@ -1076,7 +1076,7 @@
 inline typename MatrixAccessProxy<MT>::Iterator
    MatrixAccessProxy<MT>::insert( size_t i, size_t j, const ElementType& value ) const
 {
-   get().insert( i, j, value );
+   return get().insert( i, j, value );
 }
 //*************************************************************************************************


add: 537 solution

add: 537 solution

error: pathspec '537_Complex_Number_Multiplication_1.c' did not match any file(s) known to git

--- 537_Complex_Number_Multiplication_1.c
+++ 537_Complex_Number_Multiplication_1.c
@@ -0,0 +1,14 @@
+char* complexNumberMultiply(char* a, char* b)
+{
+    int aReal, bReal, aImage, bImage, tmp;
+    char *ret = (char *)malloc(sizeof(char) * 100);
+
+    aReal = atoi(a);
+    bReal = atoi(b);
+    aImage = atoi((strpbrk(a, "+") + 1));
+    bImage = atoi((strpbrk(b, "+") + 1));
+
+    sprintf(ret, "%d+%di", aReal * bReal - aImage * bImage, aReal * bImage + bReal * aImage);
+
+    return ret;
+}


Move to verified wordcheck implementation

--- src/pam_cracklib_v.c
+++ src/pam_cracklib_v.c
@@ -466,39 +466,13 @@
     return 0;
 }

-static int wordcheck(const char *new, char *word)
-{
-    char *f, *b;
-
-    if (strstr(new, word) != NULL)
-	return 1;
-
-    /* now reverse the word, we can do that in place
-       as it is strdup-ed */
-    f = word;
-    b = word+strlen(word)-1;
-    while (f < b) {
-	char c;
-
-	c = *f;
-	*f = *b;
-	*b = c;
-	--b;
-	++f;
-    }
-
-    if (strstr(new, word) != NULL)
-	return 1;
-    return 0;
-}
-
 static int usercheck(struct cracklib_options *opt, const char *new,
 		     char *user)
 {
     if (!opt->reject_user)
         return 0;

-    return wordcheck(new, user);
+    return wordcheck_hs(new, user);
 }

 static char * str_lower(char *string)
@@ -542,7 +516,7 @@

          if (strlen(p) >= CO_MIN_WORD_LENGTH) {
              str_lower(p);
-             if (wordcheck(new, p)) {
+             if (wordcheck_hs(new, p)) {
                  free(list);
                  return 1;
              }


[PATCH] libata-dev: print out information for ATAPI devices with CDB interrupts

print out information for ATAPI devices with CDB interrupts

Signed-off-by: Albert Lee <acbbf031be61d04f48a3d1029d06515fcc295ea2@tw.ibm.com>
Signed-off-by: Jeff Garzik <f3e731dfa293c7a83119d8aacfa41b5d2d780be9@garzik.org>

--- drivers/scsi/libata-core.c
+++ drivers/scsi/libata-core.c
@@ -1305,6 +1305,8 @@

 	/* ATAPI-specific feature tests */
 	else if (dev->class == ATA_DEV_ATAPI) {
+		char *cdb_intr_string = "";
+
 		rc = atapi_cdb_len(id);
 		if ((rc < 12) || (rc > ATAPI_CDB_LEN)) {
 			printk(KERN_WARNING "ata%u: unsupported CDB len\n", ap->id);
@@ -1313,13 +1315,16 @@
 		}
 		dev->cdb_len = (unsigned int) rc;

-		if (ata_id_cdb_intr(dev->id))
+		if (ata_id_cdb_intr(dev->id)) {
 			dev->flags |= ATA_DFLAG_CDB_INTR;
+			cdb_intr_string = ", CDB intr";
+		}

 		/* print device info to dmesg */
 		if (print_info)
-			printk(KERN_INFO "ata%u: dev %u ATAPI, max %s\n",
-			       ap->id, dev->devno, ata_mode_string(xfer_mask));
+			printk(KERN_INFO "ata%u: dev %u ATAPI, max %s%s\n",
+			       ap->id, dev->devno, ata_mode_string(xfer_mask),
+			       cdb_intr_string);
 	}

 	ap->host->max_cmd_len = 0;


Revert part of r40202, fixing a crash during commit over ra_neon.

Proper fix remains to be determined, I'll raise this on dev@ in a minute.

* subversion/libsvn_ra_neon/commit.c
  (create_activity): Call svn_path_url_add_component() again instead
   of svn_path_url_add_component2().

--- subversion/libsvn_ra_neon/commit.c
+++ subversion/libsvn_ra_neon/commit.c
@@ -326,8 +326,8 @@
      the activity, and create the activity.  The URL for our activity
      will be ACTIVITY_COLL/UUID */
   SVN_ERR(get_activity_collection(cc, &activity_collection, FALSE, pool));
-  url = svn_path_url_add_component2(activity_collection->data,
-                                    uuid_buf, pool);
+  url = svn_path_url_add_component(activity_collection->data,
+                                   uuid_buf, pool);
   SVN_ERR(svn_ra_neon__simple_request(&code, cc->ras,
                                       "MKACTIVITY", url, NULL, NULL,
                                       201 /* Created */,


Any declaration with non-whitespace tokens unconsumed after parsing the property value and potential !important is invalid.

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

--- src/parse/language.c
+++ src/parse/language.c
@@ -1029,6 +1029,7 @@
 	int i = 0;
 	uint8_t flags = 0;
 	css_style *style = NULL;
+	const css_token *token;

 	/* Find property index */
 	/** \todo improve on this linear search */
@@ -1050,11 +1051,20 @@

 	assert (style != NULL);

-	/* Determine if this is important or not */
+	/* Determine if this declaration is important or not */
 	error = parse_important(c, vector, ctx, &flags);
 	if (error != CSS_OK) {
 		css_stylesheet_style_destroy(c->sheet, style);
 		return error;
+	}
+
+	/* Ensure that we've exhausted all the input */
+	consumeWhitespace(vector, ctx);
+	token = parserutils_vector_iterate(vector, ctx);
+	if (token != NULL) {
+		/* Trailing junk, so discard declaration */
+		css_stylesheet_style_destroy(c->sheet, style);
+		return CSS_INVALID;
 	}

 	/* If it's important, then mark the style appropriately */


storvsc: force SPC-3 compliance on win8 and win8 r2 hosts

On win8 and win8 r2 hosts force SPC-3 compliance for MSFT virtual disks.
Ubuntu has been carrying a similar patch outside the tree for a while now.
Starting with win10, the host will support SPC-3 compliance. Based on all
the testing that has been done on win8 and win8 r2 hosts, we are comfortable
claiming SPC-3 compliance on these hosts as well. This will enable TRIM
support on these hosts.

Suggested by: James Bottomley <James.Bottomley@HansenPartnership.com>
Signed-off-by: K. Y. Srinivasan <bcbf172338421f26297a2592698edf8cc84ecbef@microsoft.com>
Reviewed-by: Long Li <7c3f1736f0d21e1e8ded3a98dcacf1239706b2af@microsoft.com>
Signed-off-by: Christoph Hellwig <923f7720577207a44b32e59bbfbea59d27f1ae8e@lst.de>


fixes #44

fixes #44

--- IResourceCache.h
+++ IResourceCache.h
@@ -53,5 +53,6 @@
      */
     void Unload()
     {
+        _Resources.clear();
     }
 };


Remove For testing purposes comment

Remove For testing purposes comment

--- Airship/Common/UAAnalytics+Internal.h
+++ Airship/Common/UAAnalytics+Internal.h
@@ -57,8 +57,6 @@
 // X_UA_MIN_BATCH_INTERVAL
 #define UAAnalyticsFirstBatchUploadInterval 15 // time in seconds

-
-
 @property (nonatomic, retain) NSMutableDictionary *session;
 @property (nonatomic, retain) NSDictionary *notificationUserInfo;
 @property (nonatomic, assign) NSInteger maxTotalDBSize;
@@ -74,7 +72,6 @@
 @property (nonatomic, retain) NSOperationQueue *queue;
 @property (assign) BOOL isSending;

-// For testing purposes
 // YES if the app is in the process of entering the foreground, but is not yet active.
 // This flag is used to delay sending an `app_foreground` event until the app is active
 // and all of the launch/notification data is present.


eh_list: introduced friendly eh_list_head() and eh_list_next() macros

--- src/eh_list.h
+++ src/eh_list.h
@@ -74,4 +74,7 @@
 }
 #define eh_list_del(S)	__eh_list_del((S)->prev, (S)->next)

+#define eh_list_next(N)	(N)->next
+#define eh_list_head(H)	(H)
+
 #endif /* !_EH_LIST_H */


ra_serf: Tell the server it is okay to gzip the REPORT response.

For a simple checkout (notes dir in SVN), this reduces the bytes transferred
on that connection from 82,064 bytes to 16,186 bytes.  Larger dirs will have
even bigger REPORT responses (as it contains the list of every path to
checkout with some essential properties).

* subversion/libsvn_ra_serf/update.c
  (headers_report): Add a header delegate to permit gzip responses.
  (finish_report): Install appropriate header delegate.

--- subversion/libsvn_ra_serf/update.c
+++ subversion/libsvn_ra_serf/update.c
@@ -2249,6 +2249,18 @@
 }

 static svn_error_t *
+headers_report(serf_bucket_t *headers,
+               void *baton,
+               apr_pool_t *pool)
+{
+  report_context_t *report = baton;
+
+  serf_bucket_headers_setn(headers, "Accept-Encoding", "gzip");
+
+  return SVN_NO_ERROR;
+}
+
+static svn_error_t *
 finish_report(void *report_baton,
               apr_pool_t *pool)
 {
@@ -2296,6 +2308,8 @@
   handler->body_type = "text/xml";
   handler->conn = sess->conns[0];
   handler->session = sess;
+  handler->header_delegate = headers_report;
+  handler->header_delegate_baton = report;

   parser_ctx = apr_pcalloc(pool, sizeof(*parser_ctx));


Define likely()/unlikely()

Define likely()/unlikely()

--- link-grammar/utilities.h
+++ link-grammar/utilities.h
@@ -266,12 +266,20 @@
 #define NO_SAN_DICT
 #endif

+#ifndef DONT_EXPECT
+#define likely(x)      __builtin_expect(!!(x), 1)
+#define unlikely(x)    __builtin_expect(!!(x), 0)
+#endif
+
 #else
 #define UNREACHABLE(x)
 #define GNUC_MALLOC
 #define GNUC_UNUSED
 #define GNUC_NORETURN
 #define NO_SAN_DICT
+
+#define likely(x)
+#define unlikely(x)
 #endif


[SCSI] virtio-scsi: unlock during kick

[SCSI] virtio-scsi: unlock during kick

Separate virtqueue_kick_prepare from virtqueue_notify, so that the
expensive vmexit is done without holding the lock.

Signed-off-by: Paolo Bonzini <69d3ebcf5ee4e7f05a50dc23cd96655b730804b4@redhat.com>
Signed-off-by: James Bottomley <1acebbdca565c7b6b638bdc23b58b5610d1a56b8@Parallels.com>

--- drivers/scsi/virtio_scsi.c
+++ drivers/scsi/virtio_scsi.c
@@ -264,9 +264,11 @@

 	ret = virtqueue_add_buf(vq, vscsi->sg, out_num, in_num, cmd, gfp);
 	if (ret >= 0)
-		virtqueue_kick(vq);
+		ret = virtqueue_kick_prepare(vq);

 	spin_unlock_irqrestore(&vscsi->vq_lock, flags);
+	if (ret > 0)
+		virtqueue_notify(vq);
 	return ret;
 }


Fix bug with cabac stream pointing to bad data

--- src/encoder.c
+++ src/encoder.c
@@ -833,6 +833,7 @@
             for (j = 0; child_state->children[i].children[j].encoder_control; ++j) {
               child_state->children[i].children[j].parent = &child_state->children[i];
             }
+            child_state->children[i].cabac.stream = &child_state->children[i].stream;
           }
         }


boards/hamilton: update PWM configuration

--- boards/hamilton/include/periph_conf.h
+++ boards/hamilton/include/periph_conf.h
@@ -179,28 +179,37 @@
  */
 #define PWM_0_EN            1
 #define PWM_1_EN            1
-#define PWM_NUMOF           (PWM_0_EN + PWM_1_EN)
-#define PWM_MAX_CHANNELS    2
+
+#if PWM_0_EN
+/* PWM0 channels */
+static const pwm_conf_chan_t pwm_chan0_config[] = {
+    /* GPIO pin, MUX value, TCC channel */
+    {GPIO_PIN(PA, 6), GPIO_MUX_E, 0},
+    {GPIO_PIN(PA, 7), GPIO_MUX_E, 1},
+};
+#endif
+#if PWM_1_EN
+/* PWM1 channels */
+static const pwm_conf_chan_t pwm_chan1_config[] = {
+    /* GPIO pin, MUX value, TCC channel */
+    {GPIO_PIN(PA, 18), GPIO_MUX_F, 2},
+    {GPIO_PIN(PA, 19), GPIO_MUX_F, 3},
+};
+#endif
+

 /* PWM device configuration */
-#if PWM_NUMOF
 static const pwm_conf_t pwm_config[] = {
 #if PWM_0_EN
-    {TCC1, {
-        /* GPIO pin, MUX value, TCC channel */
-        {GPIO_PIN(PA, 6), GPIO_MUX_E, 0},
-        {GPIO_PIN(PA, 7), GPIO_MUX_E, 1}
-    }},
+    {TCC1, pwm_chan0_config, ARRAY_SIZE(pwm_chan0_config)},
 #endif
 #if PWM_1_EN
-    {TCC0, {
-        /* GPIO pin, MUX value, TCC channel */
-        {GPIO_PIN(PA, 18), GPIO_MUX_F, 2},
-        {GPIO_PIN(PA, 19), GPIO_MUX_F, 3}
-    }},
-#endif
-};
-#endif
+    {TCC0, pwm_chan1_config, ARRAY_SIZE(pwm_chan1_config)},
+#endif
+};
+
+/* number of devices that are actually defined */
+#define PWM_NUMOF           ARRAY_SIZE(pwm_config)
 /** @} */

 /**


More better solution for close all handles in server_job()

--- src/pcm/pcm_direct.c
+++ src/pcm/pcm_direct.c
@@ -199,8 +199,10 @@
 }

 #if 0
+#define SERVER_JOB_DEBUG
 #define server_printf(fmt, args...) printf(fmt, ##args)
 #else
+#undef SERVER_JOB_DEBUG
 #define server_printf(fmt, args...) /* nothing */
 #endif

@@ -212,7 +214,11 @@

 	/* close all files to free resources */
 	i = sysconf(_SC_OPEN_MAX);
+#ifdef SERVER_JOB_DEBUG
 	while (--i >= 3) {
+#else
+	while (--i >= 0) {
+#endif
 		if (i != dmix->server_fd && i != dmix->hw_fd)
 			close(i);
 	}
@@ -291,7 +297,9 @@
 	snd_pcm_direct_shm_discard(dmix);
 	snd_pcm_direct_semaphore_discard(dmix);
 	server_printf("DIRECT SERVER EXIT\n");
+#ifdef SERVER_JOB_DEBUG
 	close(0); close(1); close(2);
+#endif
 	_exit(EXIT_SUCCESS);
 }


* subversion/libsvn_ra_serf/update.c
  (create_update_report_body): Remove optimization via file bucket as it
    contains a problem in some cases I didn't found in testing and fixing
    it is most likely not worth the effort in any reasonable use case.

Suggested by: ivan

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

--- subversion/libsvn_ra_serf/update.c
+++ subversion/libsvn_ra_serf/update.c
@@ -2778,42 +2778,9 @@
                           apr_pool_t *pool)
 {
   report_context_t *report = baton;
-  apr_file_t *body_file = svn_spillbuf__get_file(report->body_sb);
-
-  if (body_file != NULL)
-    {
-      /* The spillbuffer was spooled to disk. Use the most optimized way
-       * to send it to serf, like when we didn't spool to memory first */
-      apr_off_t offset;
-
-      /* We need to flush the file, make it unbuffered (so that it can be
-       * zero-copied via mmap), and reset the position before attempting to
-       * deliver the file.
-       *
-       * N.B. If we have APR 1.3+, we can unbuffer the file to let us use mmap
-       * and zero-copy the PUT body.  However, on older APR versions, we can't
-       * check the buffer status; but serf will fall through and create a file
-       * bucket for us on the buffered svndiff handle.
-       *
-       * ### Is this really a useful optimization for an update report?
-       */
-      SVN_ERR(svn_io_file_flush(body_file, pool));
-#if APR_VERSION_AT_LEAST(1, 3, 0)
-      apr_file_buffer_set(body_file, NULL, 0);
-#endif
-
-      offset = 0;
-      SVN_ERR(svn_io_file_seek(body_file, APR_SET, &offset, pool));
-
-      *body_bkt = serf_bucket_file_create(body_file, alloc);
-    }
-  else
-    {
-      /* Everything is already in memory. Just wrap as bucket.
-       * Note that this would just work for the file case if needed */
-      *body_bkt = svn_ra_serf__create_sb_bucket(report->body_sb, alloc,
-                                                report->pool, pool);
-    }
+
+  *body_bkt = svn_ra_serf__create_sb_bucket(report->body_sb, alloc,
+                                            report->pool, pool);

   return SVN_NO_ERROR;
 }


spi: img-spfi: check for timeout error before proceeding

Calling spfi_wait_all_done is not required if the transfer has timed
out before all data is transferred.

spfi_wait_all_done polls for Alldone interrupt which is triggered to
mark the transfer as complete and to indicate it is now safe to issue
a new transfer.

Fixes: 8c2c8c0 ("spi: img-spfi: Control CS lines with GPIO")
Signed-off-by: Sifan Naeem <a4a57e4704114c949e291df12162e43868e17cb4@imgtec.com>
Reviewed-by: Andrew Bresticker <6f9d97df82107736b1c4f0e11d74242c25499ec8@chromium.org>
Signed-off-by: Mark Brown <b51b9a92386687a9ac927cebfa0f978adeb8cea5@kernel.org>
Cc: 4fbacc2fa0ffdbb11bf1ad6925b886ebd08dd15f@vger.kernel.org


Added check for buggy gcc

Added check for buggy gcc

--- src/pcm/pcm_lfloat.c
+++ src/pcm/pcm_lfloat.c
@@ -26,6 +26,10 @@
 typedef float float_t;
 typedef double double_t;

+#if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR <= 91)
+#define BUGGY_GCC
+#endif
+
 #ifndef PIC
 /* entry for static linking */
 const char *_snd_module_pcm_float = "";
@@ -71,6 +75,8 @@
 {
 	return snd_pcm_lfloat_get_s32_index(format);
 }
+
+#ifndef BUGGY_GCC

 void snd_pcm_lfloat_convert_integer_float(const snd_pcm_channel_area_t *dst_areas, snd_pcm_uframes_t dst_offset,
 					  const snd_pcm_channel_area_t *src_areas, snd_pcm_uframes_t src_offset,
@@ -425,3 +431,28 @@
 	return err;
 }
 SND_DLSYM_BUILD_VERSION(_snd_pcm_lfloat_open, SND_PCM_DLSYM_VERSION);
+
+#else /* BUGGY_GCC */
+
+int snd_pcm_lfloat_open(snd_pcm_t **pcmp ATTRIBUTE_UNUSED,
+			const char *name ATTRIBUTE_UNUSED,
+			snd_pcm_format_t sformat ATTRIBUTE_UNUSED,
+			snd_pcm_t *slave ATTRIBUTE_UNUSED,
+			int close_slave ATTRIBUTE_UNUSED)
+{
+	SNDERR("please, upgrade your GCC to use lfloat plugin");
+	return -EINVAL;
+}
+
+int _snd_pcm_lfloat_open(snd_pcm_t **pcmp ATTRIBUTE_UNUSED,
+			 const char *name ATTRIBUTE_UNUSED,
+			 snd_config_t *root ATTRIBUTE_UNUSED,
+			 snd_config_t *conf ATTRIBUTE_UNUSED,
+			 snd_pcm_stream_t stream ATTRIBUTE_UNUSED,
+			 int mode ATTRIBUTE_UNUSED)
+{
+	SNDERR("please, upgrade your GCC to use lfloat plugin");
+	return -EINVAL;
+}
+
+#endif /* BUGGY_GCC */


install: reduce default verbosity for determine_slot_states()

Signed-off-by: Enrico Jorns <a2e5f936c390f36494e46e71bcfbe365bb1e8c49@pengutronix.de>

--- src/install.c
+++ src/install.c
@@ -175,7 +175,7 @@

 	res = TRUE;
 	booted->state = ST_BOOTED;
-	g_print("Found booted slot: %s on %s\n", booted->name, booted->device);
+	g_debug("Found booted slot: %s on %s", booted->name, booted->device);

 	/* Determine active group members */
 	for (GList *l = slotlist; l != NULL; l = l->next) {


* subversion/libsvn_repos/reporter.c
  (delta_proplists): Remove redundant check for uuid being null.

See also r19570, which fixed an identical instance of this problem in delta.c.

Found by: Coverity <http://scan.coverity.com/>
(CID: 8)

--- subversion/libsvn_repos/reporter.c
+++ subversion/libsvn_repos/reporter.c
@@ -2,7 +2,7 @@
  * reporter.c : `reporter' vtable routines for updates.
  *
  * ====================================================================
- * Copyright (c) 2000-2004 CollabNet.  All rights reserved.
+ * Copyright (c) 2000-2006 CollabNet.  All rights reserved.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution.  The terms
@@ -392,9 +392,8 @@

       /* Transmit the UUID. */
       SVN_ERR(svn_fs_get_uuid(b->repos->fs, &uuid, pool));
-      if (uuid || s_path)
-        SVN_ERR(change_fn(b, object, SVN_PROP_ENTRY_UUID,
-                          svn_string_create(uuid, pool), pool));
+      SVN_ERR(change_fn(b, object, SVN_PROP_ENTRY_UUID,
+                        svn_string_create(uuid, pool), pool));
     }

   /* Update lock properties. */


tty: remove unused variable sprop

tty: remove unused variable sprop

sprop is unused in find_console_handle() since commit a752ee56ad84
("tty: Update hypervisor tty drivers to use core stdout parsing code.")

Signed-off-by: Fabian Frederick <3efd2a027b14fd890cd23a9ef6d1134b4e5ad850@skynet.be>
Signed-off-by: Greg Kroah-Hartman <4645f7897fd33786a2ee1264d590b3c400559d85@linuxfoundation.org>


peer_hashtable: fix address hashing on systems with holes in sockaddr definitions

--- src/peer_hashtable.c
+++ src/peer_hashtable.c
@@ -66,11 +66,15 @@

 	switch(addr->sa.sa_family) {
 	case AF_INET:
-		fastd_hash(&hash, &addr->in, sizeof(addr->in));
+		fastd_hash(&hash, &addr->in.sin_addr.s_addr, sizeof(addr->in.sin_addr.s_addr));
+		fastd_hash(&hash, &addr->in.sin_port, sizeof(addr->in.sin_port));
 		break;

 	case AF_INET6:
-		fastd_hash(&hash, &addr->in6, sizeof(addr->in6));
+		fastd_hash(&hash, &addr->in6.sin6_addr, sizeof(addr->in6.sin6_addr));
+		fastd_hash(&hash, &addr->in6.sin6_port, sizeof(addr->in6.sin6_port));
+		if (IN6_IS_ADDR_LINKLOCAL(&addr->in6.sin6_addr))
+			fastd_hash(&hash, &addr->in6.sin6_scope_id, sizeof(addr->in6.sin6_scope_id));
 		break;

 	default:


FFI: Fix cts->L for cdata unsinking in snapshot restore.

--- src/lj_snap.c
+++ src/lj_snap.c
@@ -708,7 +708,7 @@
 	     ir->o == IR_CNEW || ir->o == IR_CNEWI);
 #if LJ_HASFFI
   if (ir->o == IR_CNEW || ir->o == IR_CNEWI) {
-    CTState *cts = ctype_ctsG(J2G(J));
+    CTState *cts = ctype_cts(J->L);
     CTypeID id = (CTypeID)T->ir[ir->op1].i;
     CTSize sz = lj_ctype_size(cts, id);
     GCcdata *cd = lj_cdata_new(cts, id, sz);


Finish issue #3414 - DAV RA layers not properly handling update
working copy dir to revision in which it didn't exist.

(This makes update_tests.py 56 pass over ra-neon and ra-serf, now.)

* subversion/libsvn_repos/reporter.c
  (drive): Delay the call to the editor's set_target_revision() until
    we get past some of the more common error conditions.  In doing
    so, mod_dav_svn actually has a chance to relay those errors to the
    client (because it hasn't yet started streaming editor-ese back yet).

--- subversion/libsvn_repos/reporter.c
+++ subversion/libsvn_repos/reporter.c
@@ -1151,8 +1151,6 @@
       (SVN_ERR_AUTHZ_ROOT_UNREADABLE, NULL,
        _("Not authorized to open root of edit operation"));

-  SVN_ERR(b->editor->set_target_revision(b->edit_baton, b->t_rev, pool));
-
   /* Collect information about the source and target nodes. */
   s_fullpath = svn_path_join(b->fs_base, b->s_operand, pool);
   SVN_ERR(get_source_root(b, &s_root, s_rev));
@@ -1178,6 +1176,7 @@
     return svn_error_create(SVN_ERR_FS_PATH_SYNTAX, NULL,
                             _("Cannot replace a directory from within"));

+  SVN_ERR(b->editor->set_target_revision(b->edit_baton, b->t_rev, pool));
   SVN_ERR(b->editor->open_root(b->edit_baton, s_rev, pool, &root_baton));

   /* If the anchor is the operand, diff the two directories; otherwise


usb: chipidea: udc: add set_selfpowered gaget ops

The gadget power property will be used at get_status request.

Signed-off-by: Peter Chen <c01a8c815a4ad165fff2d1c0d35ddf5b16bd3d7b@freescale.com>
Signed-off-by: Felipe Balbi <94dddeeef08b001e003cce128ddc162a4e2c6cd2@ti.com>

--- drivers/usb/chipidea/udc.c
+++ drivers/usb/chipidea/udc.c
@@ -819,8 +819,8 @@
 	}

 	if ((setup->bRequestType & USB_RECIP_MASK) == USB_RECIP_DEVICE) {
-		/* Assume that device is bus powered for now. */
-		*(u16 *)req->buf = ci->remote_wakeup << 1;
+		*(u16 *)req->buf = (ci->remote_wakeup << 1) |
+			ci->gadget.is_selfpowered;
 	} else if ((setup->bRequestType & USB_RECIP_MASK) \
 		   == USB_RECIP_ENDPOINT) {
 		dir = (le16_to_cpu(setup->wIndex) & USB_ENDPOINT_DIR_MASK) ?
@@ -1520,6 +1520,19 @@
 	return -ENOTSUPP;
 }

+static int ci_udc_selfpowered(struct usb_gadget *_gadget, int is_on)
+{
+	struct ci_hdrc *ci = container_of(_gadget, struct ci_hdrc, gadget);
+	struct ci_hw_ep *hwep = ci->ep0in;
+	unsigned long flags;
+
+	spin_lock_irqsave(hwep->lock, flags);
+	_gadget->is_selfpowered = (is_on != 0);
+	spin_unlock_irqrestore(hwep->lock, flags);
+
+	return 0;
+}
+
 /* Change Data+ pullup status
  * this func is used by usb_gadget_connect/disconnet
  */
@@ -1549,6 +1562,7 @@
 static const struct usb_gadget_ops usb_gadget_ops = {
 	.vbus_session	= ci_udc_vbus_session,
 	.wakeup		= ci_udc_wakeup,
+	.set_selfpowered	= ci_udc_selfpowered,
 	.pullup		= ci_udc_pullup,
 	.vbus_draw	= ci_udc_vbus_draw,
 	.udc_start	= ci_udc_start,


Follow-up to r923389, fix a doc string and rename some variables in pursuit
of code clarity.

Suggested by: julianfoad

* subversion/libsvn_subr/mergeinfo.c

  (rangelist_intersect_or_remove): Fix doc string and rename local variables
   as suggested here http://svn.haxx.se/dev/archive-2010-03/0407.shtml.

--- subversion/libsvn_subr/mergeinfo.c
+++ subversion/libsvn_subr/mergeinfo.c
@@ -892,7 +892,7 @@
    ranges in RANGELIST1 and RANGELIST2 into account when comparing them
    for intersection, see the doc string for svn_rangelist_intersection().

-   If CONSIDER_INHERITANCE is true, then ranges with differing inheritance
+   If CONSIDER_INHERITANCE is false, then ranges with differing inheritance
    may intersect, but the resulting intersection is non-inheritable only
    if both ranges were non-inheritable, e.g.:

@@ -919,31 +919,32 @@
                               svn_boolean_t consider_inheritance,
                               apr_pool_t *pool)
 {
-  int i, j, lasti;
-  svn_merge_range_t wboardelt;
+  int i1, i2, lasti2;
+  svn_merge_range_t working_elt2;

   *output = apr_array_make(pool, 1, sizeof(svn_merge_range_t *));

-  i = 0;
-  j = 0;
-  lasti = -1;  /* Initialized to a value that "i" will never be. */
-
-  while (i < rangelist2->nelts && j < rangelist1->nelts)
+  i1 = 0;
+  i2 = 0;
+  lasti2 = -1;  /* Initialized to a value that "i2" will never be. */
+
+  while (i1 < rangelist1->nelts && i2 < rangelist2->nelts)
     {
       svn_merge_range_t *elt1, *elt2;

-      elt2 = APR_ARRAY_IDX(rangelist1, j, svn_merge_range_t *);
+      elt1 = APR_ARRAY_IDX(rangelist1, i1, svn_merge_range_t *);

       /* Instead of making a copy of the entire array of rangelist2
          elements, we just keep a copy of the current rangelist2 element
          that needs to be used, and modify our copy if necessary. */
-      if (i != lasti)
-        {
-          wboardelt = *(APR_ARRAY_IDX(rangelist2, i, svn_merge_range_t *));
-          lasti = i;
-        }
-
-      elt1 = &wboardelt;
+      if (i2 != lasti2)
+        {
+          working_elt2 =
+            *(APR_ARRAY_IDX(rangelist2, i2, svn_merge_range_t *));
+          lasti2 = i2;
+        }
+
+      elt2 = &working_elt2;

       /* If the rangelist2 range is contained completely in the
          rangelist1, we increment the rangelist2.
@@ -953,30 +954,30 @@
          the removal of rangelist1 from rangelist2, and possibly change
          the rangelist2 to the remaining portion of the right part of
          the removal, to test against. */
-      if (range_contains(elt2, elt1, consider_inheritance))
+      if (range_contains(elt1, elt2, consider_inheritance))
         {
           if (!do_remove)
             {
               svn_merge_range_t tmp_range;
-              tmp_range.start = elt1->start;
-              tmp_range.end = elt1->end;
+              tmp_range.start = elt2->start;
+              tmp_range.end = elt2->end;
               /* The intersection of two ranges is non-inheritable only
                  if both ranges are non-inheritable. */
               tmp_range.inheritable =
-                (elt1->inheritable || elt2->inheritable);
+                (elt2->inheritable || elt1->inheritable);
               SVN_ERR(combine_with_lastrange(&tmp_range, *output,
                                              consider_inheritance, pool,
                                              pool));
             }

-          i++;
-
-          if (elt1->start == elt2->start && elt1->end == elt2->end)
-            j++;
-        }
-      else if (range_intersect(elt2, elt1, consider_inheritance))
-        {
-          if (elt1->start < elt2->start)
+          i2++;
+
+          if (elt2->start == elt1->start && elt2->end == elt1->end)
+            i1++;
+        }
+      else if (range_intersect(elt1, elt2, consider_inheritance))
+        {
+          if (elt2->start < elt1->start)
             {
               /* The rangelist2 range starts before the rangelist1 range. */
               svn_merge_range_t tmp_range;
@@ -984,20 +985,20 @@
                 {
                   /* Retain the range that falls before the rangelist1
                      start. */
-                  tmp_range.start = elt1->start;
-                  tmp_range.end = elt2->start;
-                  tmp_range.inheritable = elt1->inheritable;
+                  tmp_range.start = elt2->start;
+                  tmp_range.end = elt1->start;
+                  tmp_range.inheritable = elt2->inheritable;
                 }
               else
                 {
                   /* Retain the range that falls between the rangelist1
                      start and rangelist2 end. */
-                  tmp_range.start = elt2->start;
-                  tmp_range.end = MIN(elt1->end, elt2->end);
+                  tmp_range.start = elt1->start;
+                  tmp_range.end = MIN(elt2->end, elt1->end);
                   /* The intersection of two ranges is non-inheritable only
                      if both ranges are non-inheritable. */
                   tmp_range.inheritable =
-                    (elt1->inheritable || elt2->inheritable);
+                    (elt2->inheritable || elt1->inheritable);
                 }

               SVN_ERR(combine_with_lastrange(&tmp_range,
@@ -1007,30 +1008,30 @@

           /* Set up the rest of the rangelist2 range for further
              processing.  */
-          if (elt1->end > elt2->end)
+          if (elt2->end > elt1->end)
             {
               /* The rangelist2 range ends after the rangelist1 range. */
               if (!do_remove)
                 {
                   /* Partial overlap. */
                   svn_merge_range_t tmp_range;
-                  tmp_range.start = MAX(elt1->start, elt2->start);
-                  tmp_range.end = elt2->end;
+                  tmp_range.start = MAX(elt2->start, elt1->start);
+                  tmp_range.end = elt1->end;
                   /* The intersection of two ranges is non-inheritable only
                      if both ranges are non-inheritable. */
                   tmp_range.inheritable =
-                    (elt1->inheritable || elt2->inheritable);
+                    (elt2->inheritable || elt1->inheritable);
                   SVN_ERR(combine_with_lastrange(&tmp_range,
                                                  *output,
                                                  consider_inheritance,
                                                  pool, pool));
                 }

-              wboardelt.start = elt2->end;
-              wboardelt.end = elt1->end;
+              working_elt2.start = elt1->end;
+              working_elt2.end = elt2->end;
             }
           else
-            i++;
+            i2++;
         }
       else  /* ranges don't intersect */
         {
@@ -1040,8 +1041,8 @@
              If it is on past the rangelist2 on the right side, we
              need to output the rangelist2 and increment the
              rangelist2.  */
-          if (svn_sort_compare_ranges(&elt2, &elt1) < 0)
-            j++;
+          if (svn_sort_compare_ranges(&elt1, &elt2) < 0)
+            i1++;
           else
             {
               svn_merge_range_t *lastrange;
@@ -1053,13 +1054,13 @@
                 lastrange = NULL;

               if (do_remove && !(lastrange &&
-                                 combine_ranges(lastrange, lastrange, elt1,
+                                 combine_ranges(lastrange, lastrange, elt2,
                                                 consider_inheritance)))
                 {
-                  lastrange = svn_merge_range_dup(elt1, pool);
+                  lastrange = svn_merge_range_dup(elt2, pool);
                   APR_ARRAY_PUSH(*output, svn_merge_range_t *) = lastrange;
                 }
-              i++;
+              i2++;
             }
         }
     }
@@ -1072,17 +1073,17 @@
          array, we have to use our copy.  This case only happens when
          we ran out of rangelist1 before rangelist2, *and* we had changed
          the rangelist2 element. */
-      if (i == lasti && i < rangelist2->nelts)
-        {
-          SVN_ERR(combine_with_lastrange(&wboardelt, *output,
+      if (i2 == lasti2 && i2 < rangelist2->nelts)
+        {
+          SVN_ERR(combine_with_lastrange(&working_elt2, *output,
                                          consider_inheritance, pool, pool));
-          i++;
+          i2++;
         }

       /* Copy any other remaining untouched rangelist2 elements.  */
-      for (; i < rangelist2->nelts; i++)
-        {
-          svn_merge_range_t *elt = APR_ARRAY_IDX(rangelist2, i,
+      for (; i2 < rangelist2->nelts; i2++)
+        {
+          svn_merge_range_t *elt = APR_ARRAY_IDX(rangelist2, i2,
                                                  svn_merge_range_t *);

           SVN_ERR(combine_with_lastrange(elt, *output,


USB: usbtmc: fix stupid bug in open()

USB: usbtmc: fix stupid bug in open()

open() will never succeed, as we always return -ENODEV.  Fix this
obvious bug.

Thanks to Jouni Ryno for reporting it.

Reported-by: Jouni Ryno <4a4aca96578a40b384fded176040324948d68fb4@fmi.fi>
Cc: stable <4fbacc2fa0ffdbb11bf1ad6925b886ebd08dd15f@kernel.org>
Signed-off-by: Greg Kroah-Hartman <4645f7897fd33786a2ee1264d590b3c400559d85@suse.de>

--- drivers/usb/class/usbtmc.c
+++ drivers/usb/class/usbtmc.c
@@ -106,12 +106,13 @@
 {
 	struct usb_interface *intf;
 	struct usbtmc_device_data *data;
-	int retval = -ENODEV;
+	int retval = 0;

 	intf = usb_find_interface(&usbtmc_driver, iminor(inode));
 	if (!intf) {
 		printk(KERN_ERR KBUILD_MODNAME
 		       ": can not find device for minor %d", iminor(inode));
+		retval = -ENODEV;
 		goto exit;
 	}


Add copyright message.
(SOSLOCK): Remove
(SOSUNLOCK): Ditto.
(LOCK): Ditto
(UNLOCK): Ditto.
(sos_alloc): If HAVE_CMPXCHG is defined, use cmpxchg_ptr() to atomically allocate
	memory in a lock-free manner.  Otherwise, fall back on disabling signal
	delivery and holding the sos_lock during memory allocation.
(sos_free): Remove.
(mempool_init): Initialize pool lock.  Replace LOCK/UNLOCK with appropriate
	signal-masking & mutex_lock/unlock calls.
(mempool_free): Replace LOCK/UNLOC with appropriate signal-masking & mutex_lock/unlock
	calls.

(Logical change 1.59)

--- src/mempool.c
+++ src/mempool.c
@@ -1,3 +1,28 @@
+/* libunwind - a platform-independent unwind library
+   Copyright (C) 2002-2003 Hewlett-Packard Co
+	Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+This file is part of libunwind.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.  */
+
 #include <assert.h>
 #include <stdlib.h>
 #include <string.h>
@@ -8,11 +33,6 @@
 #include "libunwind.h"
 #include "mempool.h"

-#define SOSLOCK()	/* XXX fix me */
-#define SOSUNLOCK()	/* XXX fix me */
-#define LOCK(p)		/* XXX fix me */
-#define UNLOCK(p)	/* XXX fix me */
-
 #define MAX_ALIGN	(sizeof (long double))
 #define SOS_MEMORY_SIZE	16384

@@ -25,22 +45,39 @@
 {
   char *mem;

+#ifdef HAVE_CMPXCHG
+  char *old_mem;
+
   size = (size + MAX_ALIGN - 1) & -MAX_ALIGN;
-
-  mem = (char *) (((unsigned long) sos_memp + MAX_ALIGN - 1)
-		  & -MAX_ALIGN);
-  if (mem + size >= sos_memory + sizeof (sos_memory))
-    sos_memp = mem + size;
-
-  if (!mem)
-    abort ();
-
+  do
+    {
+      old_mem = sos_memp;
+
+      mem = (char *) (((unsigned long) old_mem + MAX_ALIGN - 1) & -MAX_ALIGN);
+      mem += size;
+      if (mem >= sos_memory + sizeof (sos_memory))
+	abort ();
+    }
+  while (cmpxchg_ptr (&sos_memp, old_mem, mem) != old_mem);
+#else
+  static pthread_mutex_t sos_lock = PTHREAD_MUTEX_INITIALIZER;
+  sigset_t saved_sigmask;
+
+  size = (size + MAX_ALIGN - 1) & -MAX_ALIGN;
+
+  sigprocmask (SIG_SETMASK, &unwi_full_sigmask, &saved_sigmask);
+  mutex_lock(&sos_lock);
+  {
+    mem = (char *) (((unsigned long) sos_memp + MAX_ALIGN - 1) & -MAX_ALIGN);
+    mem += size;
+    if (mem >= sos_memory + sizeof (sos_memory))
+      abort ();
+    sos_memp = mem;
+  }
+  mutex_unlock(&sos_lock);
+  sigprocmask (SIG_SETMASK, &saved_sigmask, NULL);
+#endif
   return mem;
-}
-
-void
-sos_free (void *ptr)
-{
 }

 static void *
@@ -106,6 +143,8 @@

   memset (pool, 0, sizeof (*pool));

+  mutex_init (&pool->lock);
+
   /* round object-size up to integer multiple of MAX_ALIGN */
   obj_size = (obj_size + MAX_ALIGN - 1) & -MAX_ALIGN;

@@ -126,9 +165,11 @@
 void *
 mempool_alloc (struct mempool *pool)
 {
+  sigset_t saved_sigmask;
   struct object *obj;

-  LOCK(pool);
+  sigprocmask (SIG_SETMASK, &unwi_full_sigmask, &saved_sigmask);
+  mutex_lock(&pool->lock);
   {
     if (pool->num_free <= pool->reserve)
       expand (pool);
@@ -139,14 +180,21 @@
     obj = pool->free_list;
     pool->free_list = obj->next;
   }
-  UNLOCK(pool);
+  mutex_unlock(&pool->lock);
+  sigprocmask (SIG_SETMASK, &saved_sigmask, NULL);
   return obj;
 }

 void
 mempool_free (struct mempool *pool, void *object)
 {
-  LOCK(pool);
-  free_object (pool, object);
-  UNLOCK(pool);
-}
+  sigset_t saved_sigmask;
+
+  sigprocmask (SIG_SETMASK, &unwi_full_sigmask, &saved_sigmask);
+  mutex_lock(&pool->lock);
+  {
+    free_object (pool, object);
+  }
+  mutex_unlock(&pool->lock);
+  sigprocmask (SIG_SETMASK, &saved_sigmask, NULL);
+}