sh-pfc: sh73a0: Remove BSC function GPIOS

All sh73a0 platforms now use the pinctrl API to control the BSC pins,
the corresponding function GPIOS are unused. Remove them.

Signed-off-by: Laurent Pinchart <ae960578cc5eca7b9b1dbc37d9caa6cb634f35e0@ideasonboard.com>
Acked-by: Linus Walleij <9cd9d802d23c0ed5e224beabf4ae4a5c478746ef@linaro.org>

--- drivers/pinctrl/sh-pfc/pfc-sh73a0.c
+++ drivers/pinctrl/sh-pfc/pfc-sh73a0.c
@@ -3022,37 +3022,11 @@
 	GPIO_FN(A25), \
 	GPIO_FN(MSIOF0_SS2),
 	GPIO_FN(A26), \
-	GPIO_FN(D0_NAF0),
-	GPIO_FN(D1_NAF1),
-	GPIO_FN(D2_NAF2),
-	GPIO_FN(D3_NAF3),
-	GPIO_FN(D4_NAF4),
-	GPIO_FN(D5_NAF5),
-	GPIO_FN(D6_NAF6),
-	GPIO_FN(D7_NAF7),
-	GPIO_FN(D8_NAF8),
-	GPIO_FN(D9_NAF9),
-	GPIO_FN(D10_NAF10),
-	GPIO_FN(D11_NAF11),
-	GPIO_FN(D12_NAF12),
-	GPIO_FN(D13_NAF13),
-	GPIO_FN(D14_NAF14),
-	GPIO_FN(D15_NAF15),
-	GPIO_FN(CS4_),
-	GPIO_FN(CS5A_), \
-	GPIO_FN(PORT91_RDWR),
-	GPIO_FN(CS5B_), \
 	GPIO_FN(FCE1_),
-	GPIO_FN(CS6B_), \
 	GPIO_FN(DACK0),
 	GPIO_FN(FCE0_), \
-	GPIO_FN(CS6A_),
 	GPIO_FN(WAIT_), \
 	GPIO_FN(DREQ0),
-	GPIO_FN(RD__FSC),
-	GPIO_FN(WE0__FWE), \
-	GPIO_FN(RDWR_FWE),
-	GPIO_FN(WE1_),
 	GPIO_FN(FRB),
 	GPIO_FN(CKO),
 	GPIO_FN(NBRSTOUT_),
@@ -3125,7 +3099,6 @@
 	GPIO_FN(VIO2_FIELD), \
 	GPIO_FN(VIO_CKO),
 	GPIO_FN(A27), \
-	GPIO_FN(PORT149_RDWR), \
 	GPIO_FN(MFG0_IN1), \
 	GPIO_FN(MFG0_IN2),
 	GPIO_FN(TS_SPSYNC3), \


Add secure comparator to themis.h

Add secure comparator to themis.h

--- src/themis/themis.h
+++ src/themis/themis.h
@@ -37,6 +37,10 @@
 #include <themis/secure_cell.h>
 #include <themis/secure_session.h>

+#ifdef SECURE_COMPARATOR_ENABLED
+#include <themis/secure_comparator.h>
+#endif
+
 const char* themis_version();

 /** @} */


Fix statvfs.h for toolchains based on GCC 5

--- include/sys/statvfs.h
+++ include/sys/statvfs.h
@@ -33,6 +33,24 @@
 /*---------------------------------------------------------------------------------------------------------------------+
 | global types
 +---------------------------------------------------------------------------------------------------------------------*/
+
+// toolchains with GCC 5 don't have fsblkcnt_t and fsfilcnt_t types, these were introduced in newlib in
+// https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;a=commit;h=f3e587d30a9f65d0c6551ad14095300f6e81672e
+#ifndef _FSBLKCNT_T_DECLARED
+
+#ifndef __machine_fsblkcnt_t_defined
+typedef __uint64_t __fsblkcnt_t;
+#endif
+#ifndef __machine_fsfilcnt_t_defined
+typedef __uint32_t __fsfilcnt_t;
+#endif
+
+typedef __fsblkcnt_t fsblkcnt_t;
+typedef __fsfilcnt_t fsfilcnt_t;
+
+#define _FSBLKCNT_T_DECLARED
+
+#endif	/* !def _FSBLKCNT_T_DECLARED */

 /** file System information structure */
 struct statvfs


eeepc-laptop: Remove uneccesary acpi_disabled check

acpi_bus_register_driver() already checks acpi_disabled, so acpi bus
drivers don't need to.

Signed-off-by: Alan Jenkins <162afe620bd365a9fa23fc00a34825fb9030a484@tuffmail.co.uk>
Signed-off-by: Len Brown <b060cfa1096cc6e8be83699ddb4ed8a77dd63af5@intel.com>


toshiba_acpi: Remove TOS_FAILURE check from some functions

This patch removes the check for TOS_FAILURE whenever we are using
the tci_raw function call, as that code is only returned by the
{hci, sci}_{read, write} functions and never by the tci_raw, and
thus making that check irrelevant.

Signed-off-by: Azael Avalos <38200bb1bfd6b0890d2ad683bb8ab02214b08408@gmail.com>
Signed-off-by: Darren Hart <38f9eaa30910c40b06f5a60020b1222f2a953801@linux.intel.com>


[SCSI] correct the sym2 period setting routines

There's a slight bug in the routines in that if the period requires dt,
then the routine will unconditionally set it.  DT may only be set if
Wide is also set, so this turns back on the wide bit.

For domain validation to work correctly, we need to observe the wide bit
absolutely.

Acked by: Matthew Wilcox <willy@debian.org>
Signed-off-by: James Bottomley <407b36959ca09543ccda8f8e06721c791bc53435@SteelEye.com>

--- drivers/scsi/sym53c8xx_2/sym_glue.c
+++ drivers/scsi/sym53c8xx_2/sym_glue.c
@@ -2038,8 +2038,9 @@
 	struct sym_hcb *np = sym_get_hcb(shost);
 	struct sym_tcb *tp = &np->target[starget->id];

-	/* have to have DT for these transfers */
-	if (period <= np->minsync)
+	/* have to have DT for these transfers, but DT will also
+	 * set width, so check that this is allowed */
+	if (period <= np->minsync && spi_width(starget))
 		tp->tgoal.dt = 1;

 	tp->tgoal.period = period;


staging: android: alarm: remove unnecessary goto statement

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

--- drivers/staging/android/alarm-dev.c
+++ drivers/staging/android/alarm-dev.c
@@ -237,7 +237,6 @@

 	default:
 		rv = -EINVAL;
-		goto err1;
 	}
 err1:
 	return rv;


Staging: at76_usb: fix !CONFIG_WIRELESS_EXT build

Fix this build error when CONFIG_WIRELESS_EXT is not set
at76_usb.c:5322: error: 'struct net_device' has no member named 'wireless_data'
at76_usb.c:5325: error: 'struct net_device' has no member named 'wireless_handlers'

Signed-off-by: Alexander Beregalov <435b083b31024cbc6ffdb70c015fef51b502cce2@gmail.com>
Signed-off-by: Greg Kroah-Hartman <4645f7897fd33786a2ee1264d590b3c400559d85@suse.de>

--- drivers/staging/at76_usb/at76_usb.c
+++ drivers/staging/at76_usb/at76_usb.c
@@ -5319,10 +5319,12 @@

 	/* Add pointers to enable iwspy support. */
 	priv->wireless_data.spy_data = &priv->spy_data;
+#ifdef CONFIG_WIRELESS_EXT
 	netdev->wireless_data = &priv->wireless_data;
+	netdev->wireless_handlers = &at76_handler_def;
+#endif

 	netdev->watchdog_timeo = 2 * HZ;
-	netdev->wireless_handlers = &at76_handler_def;
 	dev_alloc_name(netdev, "wlan%d");

 	ret = register_netdev(priv->netdev);


Staging: bcm: Fix coding style issues in InterfaceMisc.c

This patch cleans up several code style issues found
in InterfaceMisc.c reported by checkpatch.pl.

Signed-off-by: Kevin McKinney <276c5fcfd53a88c2e5d996063a97c91e0154f2a8@gmail.com>
Signed-off-by: Greg Kroah-Hartman <4645f7897fd33786a2ee1264d590b3c400559d85@suse.de>


Whitespace OCD

Whitespace OCD

--- include/vut_options.h
+++ include/vut_options.h
@@ -29,7 +29,7 @@

 /* VUT options */

-#define VUT_OPT_d \
+#define VUT_OPT_d							\
 	VOPT("d", "[-d]", "Process old log entries and exit",		\
 	    "Process log records at the head of the log and exit."	\
 	)


staging: et131x: Remove duplicated register defines from et1310_phy.h

The VMI_* set of register defines are not used, and duplicate the set of PHY_* registers from the same file, which are used - hence removing.

Signed-off-by: Mark Einon <78d8af80769b0cbc00e314928418dc93597f13ae@gmail.com>
Signed-off-by: Greg Kroah-Hartman <4645f7897fd33786a2ee1264d590b3c400559d85@suse.de>

--- drivers/staging/et131x/et1310_phy.h
+++ drivers/staging/et131x/et1310_phy.h
@@ -60,24 +60,6 @@
 #define _ET1310_PHY_H_

 #include "et1310_address_map.h"
-
-/* VMI Register Addresses */
-#define VMI_RESERVED16_REG                  16
-#define VMI_RESERVED17_REG                  17
-#define VMI_RESERVED18_REG                  18
-#define VMI_LOOPBACK_CONTROL_REG            19
-#define VMI_RESERVED20_REG                  20
-#define VMI_MI_CONTROL_REG                  21
-#define VMI_PHY_CONFIGURATION_REG           22
-#define VMI_PHY_CONTROL_REG                 23
-#define VMI_INTERRUPT_MASK_REG              24
-#define VMI_INTERRUPT_STATUS_REG            25
-#define VMI_PHY_STATUS_REG                  26
-#define VMI_LED_CONTROL_1_REG               27
-#define VMI_LED_CONTROL_2_REG               28
-#define VMI_RESERVED29_REG                  29
-#define VMI_RESERVED30_REG                  30
-#define VMI_RESERVED31_REG                  31

 /* PHY Register Mapping(MI) Management Interface Regs */
 struct mi_regs {


fwserial: (coding style) if/else bracket matching

Style-only modifications to make checkpatch.pl --file --strict a bit happier.
if/else bracket matching (either none or both options should be bracketed).

Signed-off-by: Dominique van den Broeck <faa323c7720f78ab585d55c266a6efab2944fc08@free.fr>
Signed-off-by: Greg Kroah-Hartman <4645f7897fd33786a2ee1264d590b3c400559d85@linuxfoundation.org>


Staging: go7007: small cleanup

Staging: go7007: small cleanup

small cleanup of go7007:

- prepare for urb->status conversion
- micro optimization
- use kzalloc
- fix free of memory in use in go7007_usb_disconnect

Signed-off-by: Oliver Neukum <bfee72d94d376f4e00f72b756466867d7f9eb24e@suse.de>
Cc: Cohen <ded0511dfe5b9597dcaa585c1ec76ade317c85c3@snurgle.org>
Signed-off-by: Greg Kroah-Hartman <4645f7897fd33786a2ee1264d590b3c400559d85@suse.de>

--- drivers/staging/go7007/go7007-usb.c
+++ drivers/staging/go7007/go7007-usb.c
@@ -680,9 +680,10 @@
 {
 	struct go7007 *go = (struct go7007 *)urb->context;
 	u16 *regs = (u16 *)urb->transfer_buffer;
-
-	if (urb->status != 0) {
-		if (urb->status != -ESHUTDOWN &&
+	int status = urb->status;
+
+	if (status) {
+		if (status != -ESHUTDOWN &&
 				go->status != STATUS_SHUTDOWN) {
 			printk(KERN_ERR
 				"go7007-usb: error in read interrupt: %d\n",
@@ -723,15 +724,14 @@
 static void go7007_usb_read_video_pipe_complete(struct urb *urb)
 {
 	struct go7007 *go = (struct go7007 *)urb->context;
-	int r;
+	int r, status = urb-> status;

 	if (!go->streaming) {
 		wake_up_interruptible(&go->frame_waitq);
 		return;
 	}
-	if (urb->status != 0) {
-		printk(KERN_ERR "go7007-usb: error in video pipe: %d\n",
-				urb->status);
+	if (status) {
+		printk(KERN_ERR "go7007-usb: error in video pipe: %d\n", status);
 		return;
 	}
 	if (urb->actual_length != urb->transfer_buffer_length) {
@@ -747,13 +747,12 @@
 static void go7007_usb_read_audio_pipe_complete(struct urb *urb)
 {
 	struct go7007 *go = (struct go7007 *)urb->context;
-	int r;
+	int r, status = urb->status;

 	if (!go->streaming)
 		return;
-	if (urb->status != 0) {
-		printk(KERN_ERR "go7007-usb: error in audio pipe: %d\n",
-				urb->status);
+	if (status) {
+		printk(KERN_ERR "go7007-usb: error in audio pipe: %d\n", status);
 		return;
 	}
 	if (urb->actual_length != urb->transfer_buffer_length) {
@@ -794,7 +793,7 @@
 	return 0;

 audio_submit_failed:
-	for (i = 0; i < 8; ++i)
+	for (i = 0; i < 7; ++i)
 		usb_kill_urb(usb->audio_urbs[i]);
 video_submit_failed:
 	for (i = 0; i < 8; ++i)
@@ -1019,10 +1018,9 @@
 		return 0;
 	}

-	usb = kmalloc(sizeof(struct go7007_usb), GFP_KERNEL);
+	usb = kzalloc(sizeof(struct go7007_usb), GFP_KERNEL);
 	if (usb == NULL)
 		return -ENOMEM;
-	memset(usb, 0, sizeof(struct go7007_usb));

 	/* Allocate the URB and buffer for receiving incoming interrupts */
 	usb->intr_urb = usb_alloc_urb(0, GFP_KERNEL);
@@ -1227,6 +1225,7 @@
 {
 	struct go7007 *go = usb_get_intfdata(intf);
 	struct go7007_usb *usb = go->hpi_context;
+	struct urb *vurb, *aurb;
 	int i;

 	go->status = STATUS_SHUTDOWN;
@@ -1234,15 +1233,19 @@

 	/* Free USB-related structs */
 	for (i = 0; i < 8; ++i) {
-		if (usb->video_urbs[i] != NULL) {
-			if (usb->video_urbs[i]->transfer_buffer != NULL)
-				kfree(usb->video_urbs[i]->transfer_buffer);
-			usb_free_urb(usb->video_urbs[i]);
+		vurb = usb->video_urbs[i];
+		if (vurb) {
+			usb_kill_urb(vurb);
+			if (vurb->transfer_buffer)
+				kfree(vurb->transfer_buffer);
+			usb_free_urb(vurb);
 		}
-		if (usb->audio_urbs[i] != NULL) {
-			if (usb->audio_urbs[i]->transfer_buffer != NULL)
-				kfree(usb->audio_urbs[i]->transfer_buffer);
-			usb_free_urb(usb->audio_urbs[i]);
+		aurb = usb->audio_urbs[i];
+		if (aurb) {
+			usb_kill_urb(aurb);
+			if (aurb->transfer_buffer)
+				kfree(aurb->transfer_buffer);
+			usb_free_urb(aurb);
 		}
 	}
 	kfree(usb->intr_urb->transfer_buffer);


that was not meant to go there yet

that was not meant to go there yet

--- includes/linux/list.h
+++ includes/linux/list.h
@@ -1,710 +0,0 @@
-#ifndef _LINUX_LIST_H
-#define _LINUX_LIST_H
-
-#include <linux/stddef.h>
-#include <linux/poison.h>
-#include <linux/prefetch.h>
-#include <asm/system.h>
-
-#define CONFIG_DEBUG_LIST 1
-
-/*
- * Simple doubly linked list implementation.
- *
- * Some of the internal functions ("__xxx") are useful when
- * manipulating whole lists rather than single entries, as
- * sometimes we already know the next/prev entries and we can
- * generate better code by using them directly rather than
- * using the generic single-entry routines.
- */
-
-struct list_head {
-	struct list_head *next, *prev;
-};
-
-#define LIST_HEAD_INIT(name) { &(name), &(name) }
-
-#define LIST_HEAD(name) \
-	struct list_head name = LIST_HEAD_INIT(name)
-
-#ifndef CONFIG_DEBUG_LIST
-static inline void INIT_LIST_HEAD(struct list_head *list)
-{
-	list->next = list;
-	list->prev = list;
-}
-#else
-extern void INIT_LIST_HEAD(struct list_head *list);
-#endif
-/*
- * Insert a new entry between two known consecutive entries.
- *
- * This is only for internal list manipulation where we know
- * the prev/next entries already!
- */
-#ifdef CONFIG_DEBUG_LIST
-static inline void __list_add(struct list_head *new,
-			      struct list_head *prev,
-			      struct list_head *next)
-{
-//	next->prev = new;
-//	new->next = next;
-//	new->prev = prev;
-	INIT_LIST_HEAD(new);
-	prev->next = new;
-}
-#else
-extern void __list_add(struct list_head *new,
-			      struct list_head *prev,
-			      struct list_head *next);
-#endif
-
-/**
- * list_add - add a new entry
- * @new: new entry to be added
- * @head: list head to add it after
- *
- * Insert a new entry after the specified head.
- * This is good for implementing stacks.
- */
-static inline void list_add(struct list_head *new, struct list_head *head)
-{
-	__list_add(new, head, head->next);
-}
-
-
-/**
- * list_add_tail - add a new entry
- * @new: new entry to be added
- * @head: list head to add it before
- *
- * Insert a new entry before the specified head.
- * This is useful for implementing queues.
- */
-static inline void list_add_tail(struct list_head *new, struct list_head *head)
-{
-	__list_add(new, head->prev, head);
-}
-
-/*
- * Delete a list entry by making the prev/next entries
- * point to each other.
- *
- * This is only for internal list manipulation where we know
- * the prev/next entries already!
- */
-#ifndef CONFIG_DEBUG_LIST
-static inline void __list_del(struct list_head * prev, struct list_head * next)
-{
-	next->prev = prev;
-	prev->next = next;
-}
-#else
-extern void __list_del(struct list_head * prev, struct list_head * next);
-#endif
-
-/**
- * list_del - deletes entry from list.
- * @entry: the element to delete from the list.
- * Note: list_empty() on entry does not return true after this, the entry is
- * in an undefined state.
- */
-#ifndef CONFIG_DEBUG_LIST
-static inline void list_del(struct list_head *entry)
-{
-	__list_del(entry->prev, entry->next);
-	entry->next = LIST_POISON1;
-	entry->prev = LIST_POISON2;
-}
-#else
-extern void list_del(struct list_head *entry);
-#endif
-
-/**
- * list_replace - replace old entry by new one
- * @old : the element to be replaced
- * @new : the new element to insert
- *
- * If @old was empty, it will be overwritten.
- */
-#ifndef CONFIG_DEBUG_LIST
-static inline void list_replace(struct list_head *old,
-				struct list_head *new)
-{
-	new->next = old->next;
-	new->next->prev = new;
-	new->prev = old->prev;
-	new->prev->next = new;
-}
-#else
-extern void list_replace(struct list_head *old,
-  struct list_head *new);
-#endif
-
-static inline void list_replace_init(struct list_head *old,
-					struct list_head *new)
-{
-	list_replace(old, new);
-	INIT_LIST_HEAD(old);
-}
-
-/**
- * list_del_init - deletes entry from list and reinitialize it.
- * @entry: the element to delete from the list.
- */
-static inline void list_del_init(struct list_head *entry)
-{
-	__list_del(entry->prev, entry->next);
-	INIT_LIST_HEAD(entry);
-}
-
-/**
- * list_move - delete from one list and add as another's head
- * @list: the entry to move
- * @head: the head that will precede our entry
- */
-static inline void list_move(struct list_head *list, struct list_head *head)
-{
-	__list_del(list->prev, list->next);
-	list_add(list, head);
-}
-
-/**
- * list_move_tail - delete from one list and add as another's tail
- * @list: the entry to move
- * @head: the head that will follow our entry
- */
-static inline void list_move_tail(struct list_head *list,
-				  struct list_head *head)
-{
-	__list_del(list->prev, list->next);
-	list_add_tail(list, head);
-}
-
-/**
- * list_is_last - tests whether @list is the last entry in list @head
- * @list: the entry to test
- * @head: the head of the list
- */
-static inline int list_is_last(const struct list_head *list,
-				const struct list_head *head)
-{
-	return list->next == head;
-}
-
-/**
- * list_empty - tests whether a list is empty
- * @head: the list to test.
- */
-static inline int list_empty(const struct list_head *head)
-{
-	return head->next == head;
-}
-
-/**
- * list_empty_careful - tests whether a list is empty and not being modified
- * @head: the list to test
- *
- * Description:
- * tests whether a list is empty _and_ checks that no other CPU might be
- * in the process of modifying either member (next or prev)
- *
- * NOTE: using list_empty_careful() without synchronization
- * can only be safe if the only activity that can happen
- * to the list entry is list_del_init(). Eg. it cannot be used
- * if another CPU could re-list_add() it.
- */
-static inline int list_empty_careful(const struct list_head *head)
-{
-	struct list_head *next = head->next;
-	return (next == head) && (next == head->prev);
-}
-
-/**
- * list_is_singular - tests whether a list has just one entry.
- * @head: the list to test.
- */
-static inline int list_is_singular(const struct list_head *head)
-{
-	return !list_empty(head) && (head->next == head->prev);
-}
-
-static inline void __list_cut_position(struct list_head *list,
-		struct list_head *head, struct list_head *entry)
-{
-	struct list_head *new_first = entry->next;
-	list->next = head->next;
-	list->next->prev = list;
-	list->prev = entry;
-	entry->next = list;
-	head->next = new_first;
-	new_first->prev = head;
-}
-
-/**
- * list_cut_position - cut a list into two
- * @list: a new list to add all removed entries
- * @head: a list with entries
- * @entry: an entry within head, could be the head itself
- *	and if so we won't cut the list
- *
- * This helper moves the initial part of @head, up to and
- * including @entry, from @head to @list. You should
- * pass on @entry an element you know is on @head. @list
- * should be an empty list or a list you do not care about
- * losing its data.
- *
- */
-static inline void list_cut_position(struct list_head *list,
-		struct list_head *head, struct list_head *entry)
-{
-	if (list_empty(head))
-		return;
-	if (list_is_singular(head) &&
-		(head->next != entry && head != entry))
-		return;
-	if (entry == head)
-		INIT_LIST_HEAD(list);
-	else
-		__list_cut_position(list, head, entry);
-}
-
-static inline void __list_splice(const struct list_head *list,
-				 struct list_head *prev,
-				 struct list_head *next)
-{
-	struct list_head *first = list->next;
-	struct list_head *last = list->prev;
-
-	first->prev = prev;
-	prev->next = first;
-
-	last->next = next;
-	next->prev = last;
-}
-
-/**
- * list_splice - join two lists, this is designed for stacks
- * @list: the new list to add.
- * @head: the place to add it in the first list.
- */
-static inline void list_splice(const struct list_head *list,
-				struct list_head *head)
-{
-	if (!list_empty(list))
-		__list_splice(list, head, head->next);
-}
-
-/**
- * list_splice_tail - join two lists, each list being a queue
- * @list: the new list to add.
- * @head: the place to add it in the first list.
- */
-static inline void list_splice_tail(struct list_head *list,
-				struct list_head *head)
-{
-	if (!list_empty(list))
-		__list_splice(list, head->prev, head);
-}
-
-/**
- * list_splice_init - join two lists and reinitialise the emptied list.
- * @list: the new list to add.
- * @head: the place to add it in the first list.
- *
- * The list at @list is reinitialised
- */
-static inline void list_splice_init(struct list_head *list,
-				    struct list_head *head)
-{
-	if (!list_empty(list)) {
-		__list_splice(list, head, head->next);
-		INIT_LIST_HEAD(list);
-	}
-}
-
-/**
- * list_splice_tail_init - join two lists and reinitialise the emptied list
- * @list: the new list to add.
- * @head: the place to add it in the first list.
- *
- * Each of the lists is a queue.
- * The list at @list is reinitialised
- */
-static inline void list_splice_tail_init(struct list_head *list,
-					 struct list_head *head)
-{
-	if (!list_empty(list)) {
-		__list_splice(list, head->prev, head);
-		INIT_LIST_HEAD(list);
-	}
-}
-
-/**
- * list_entry - get the struct for this entry
- * @ptr:	the &struct list_head pointer.
- * @type:	the type of the struct this is embedded in.
- * @member:	the name of the list_struct within the struct.
- */
-#define list_entry(ptr, type, member) \
-	container_of(ptr, type, member)
-
-/**
- * list_first_entry - get the first element from a list
- * @ptr:	the list head to take the element from.
- * @type:	the type of the struct this is embedded in.
- * @member:	the name of the list_struct within the struct.
- *
- * Note, that list is expected to be not empty.
- */
-#define list_first_entry(ptr, type, member) \
-	list_entry((ptr)->next, type, member)
-
-/**
- * list_for_each	-	iterate over a list
- * @pos:	the &struct list_head to use as a loop cursor.
- * @head:	the head for your list.
- */
-#define list_for_each(pos, head) \
-	for (pos = (head)->next; prefetch(pos->next), pos != (head); \
-        	pos = pos->next)
-
-/**
- * __list_for_each	-	iterate over a list
- * @pos:	the &struct list_head to use as a loop cursor.
- * @head:	the head for your list.
- *
- * This variant differs from list_for_each() in that it's the
- * simplest possible list iteration code, no prefetching is done.
- * Use this for code that knows the list to be very short (empty
- * or 1 entry) most of the time.
- */
-#define __list_for_each(pos, head) \
-	for (pos = (head)->next; pos != (head); pos = pos->next)
-
-/**
- * list_for_each_prev	-	iterate over a list backwards
- * @pos:	the &struct list_head to use as a loop cursor.
- * @head:	the head for your list.
- */
-#define list_for_each_prev(pos, head) \
-	for (pos = (head)->prev; prefetch(pos->prev), pos != (head); \
-        	pos = pos->prev)
-
-/**
- * list_for_each_safe - iterate over a list safe against removal of list entry
- * @pos:	the &struct list_head to use as a loop cursor.
- * @n:		another &struct list_head to use as temporary storage
- * @head:	the head for your list.
- */
-#define list_for_each_safe(pos, n, head) \
-	for (pos = (head)->next, n = pos->next; pos != (head); \
-		pos = n, n = pos->next)
-
-/**
- * list_for_each_prev_safe - iterate over a list backwards safe against removal of list entry
- * @pos:	the &struct list_head to use as a loop cursor.
- * @n:		another &struct list_head to use as temporary storage
- * @head:	the head for your list.
- */
-#define list_for_each_prev_safe(pos, n, head) \
-	for (pos = (head)->prev, n = pos->prev; \
-	     prefetch(pos->prev), pos != (head); \
-	     pos = n, n = pos->prev)
-
-/**
- * list_for_each_entry	-	iterate over list of given type
- * @pos:	the type * to use as a loop cursor.
- * @head:	the head for your list.
- * @member:	the name of the list_struct within the struct.
- */
-#define list_for_each_entry(pos, head, member)				\
-	for (pos = list_entry((head)->next, typeof(*pos), member);	\
-	     prefetch(pos->member.next), &pos->member != (head); 	\
-	     pos = list_entry(pos->member.next, typeof(*pos), member))
-
-/**
- * list_for_each_entry_reverse - iterate backwards over list of given type.
- * @pos:	the type * to use as a loop cursor.
- * @head:	the head for your list.
- * @member:	the name of the list_struct within the struct.
- */
-#define list_for_each_entry_reverse(pos, head, member)			\
-	for (pos = list_entry((head)->prev, typeof(*pos), member);	\
-	     prefetch(pos->member.prev), &pos->member != (head); 	\
-	     pos = list_entry(pos->member.prev, typeof(*pos), member))
-
-/**
- * list_prepare_entry - prepare a pos entry for use in list_for_each_entry_continue()
- * @pos:	the type * to use as a start point
- * @head:	the head of the list
- * @member:	the name of the list_struct within the struct.
- *
- * Prepares a pos entry for use as a start point in list_for_each_entry_continue().
- */
-#define list_prepare_entry(pos, head, member) \
-	((pos) ? : list_entry(head, typeof(*pos), member))
-
-/**
- * list_for_each_entry_continue - continue iteration over list of given type
- * @pos:	the type * to use as a loop cursor.
- * @head:	the head for your list.
- * @member:	the name of the list_struct within the struct.
- *
- * Continue to iterate over list of given type, continuing after
- * the current position.
- */
-#define list_for_each_entry_continue(pos, head, member) 		\
-	for (pos = list_entry(pos->member.next, typeof(*pos), member);	\
-	     prefetch(pos->member.next), &pos->member != (head);	\
-	     pos = list_entry(pos->member.next, typeof(*pos), member))
-
-/**
- * list_for_each_entry_continue_reverse - iterate backwards from the given point
- * @pos:	the type * to use as a loop cursor.
- * @head:	the head for your list.
- * @member:	the name of the list_struct within the struct.
- *
- * Start to iterate over list of given type backwards, continuing after
- * the current position.
- */
-#define list_for_each_entry_continue_reverse(pos, head, member)		\
-	for (pos = list_entry(pos->member.prev, typeof(*pos), member);	\
-	     prefetch(pos->member.prev), &pos->member != (head);	\
-	     pos = list_entry(pos->member.prev, typeof(*pos), member))
-
-/**
- * list_for_each_entry_from - iterate over list of given type from the current point
- * @pos:	the type * to use as a loop cursor.
- * @head:	the head for your list.
- * @member:	the name of the list_struct within the struct.
- *
- * Iterate over list of given type, continuing from current position.
- */
-#define list_for_each_entry_from(pos, head, member) 			\
-	for (; prefetch(pos->member.next), &pos->member != (head);	\
-	     pos = list_entry(pos->member.next, typeof(*pos), member))
-
-/**
- * list_for_each_entry_safe - iterate over list of given type safe against removal of list entry
- * @pos:	the type * to use as a loop cursor.
- * @n:		another type * to use as temporary storage
- * @head:	the head for your list.
- * @member:	the name of the list_struct within the struct.
- */
-#define list_for_each_entry_safe(pos, n, head, member)			\
-	for (pos = list_entry((head)->next, typeof(*pos), member),	\
-		n = list_entry(pos->member.next, typeof(*pos), member);	\
-	     &pos->member != (head); 					\
-	     pos = n, n = list_entry(n->member.next, typeof(*n), member))
-
-/**
- * list_for_each_entry_safe_continue
- * @pos:	the type * to use as a loop cursor.
- * @n:		another type * to use as temporary storage
- * @head:	the head for your list.
- * @member:	the name of the list_struct within the struct.
- *
- * Iterate over list of given type, continuing after current point,
- * safe against removal of list entry.
- */
-#define list_for_each_entry_safe_continue(pos, n, head, member) 		\
-	for (pos = list_entry(pos->member.next, typeof(*pos), member), 		\
-		n = list_entry(pos->member.next, typeof(*pos), member);		\
-	     &pos->member != (head);						\
-	     pos = n, n = list_entry(n->member.next, typeof(*n), member))
-
-/**
- * list_for_each_entry_safe_from
- * @pos:	the type * to use as a loop cursor.
- * @n:		another type * to use as temporary storage
- * @head:	the head for your list.
- * @member:	the name of the list_struct within the struct.
- *
- * Iterate over list of given type from current point, safe against
- * removal of list entry.
- */
-#define list_for_each_entry_safe_from(pos, n, head, member) 			\
-	for (n = list_entry(pos->member.next, typeof(*pos), member);		\
-	     &pos->member != (head);						\
-	     pos = n, n = list_entry(n->member.next, typeof(*n), member))
-
-/**
- * list_for_each_entry_safe_reverse
- * @pos:	the type * to use as a loop cursor.
- * @n:		another type * to use as temporary storage
- * @head:	the head for your list.
- * @member:	the name of the list_struct within the struct.
- *
- * Iterate backwards over list of given type, safe against removal
- * of list entry.
- */
-#define list_for_each_entry_safe_reverse(pos, n, head, member)		\
-	for (pos = list_entry((head)->prev, typeof(*pos), member),	\
-		n = list_entry(pos->member.prev, typeof(*pos), member);	\
-	     &pos->member != (head); 					\
-	     pos = n, n = list_entry(n->member.prev, typeof(*n), member))
-
-/*
- * Double linked lists with a single pointer list head.
- * Mostly useful for hash tables where the two pointer list head is
- * too wasteful.
- * You lose the ability to access the tail in O(1).
- */
-
-struct hlist_head {
-	struct hlist_node *first;
-};
-
-struct hlist_node {
-	struct hlist_node *next, **pprev;
-};
-
-#define HLIST_HEAD_INIT { .first = NULL }
-#define HLIST_HEAD(name) struct hlist_head name = {  .first = NULL }
-#define INIT_HLIST_HEAD(ptr) ((ptr)->first = NULL)
-static inline void INIT_HLIST_NODE(struct hlist_node *h)
-{
-	h->next = NULL;
-	h->pprev = NULL;
-}
-
-static inline int hlist_unhashed(const struct hlist_node *h)
-{
-	return !h->pprev;
-}
-
-static inline int hlist_empty(const struct hlist_head *h)
-{
-	return !h->first;
-}
-
-static inline void __hlist_del(struct hlist_node *n)
-{
-	struct hlist_node *next = n->next;
-	struct hlist_node **pprev = n->pprev;
-	*pprev = next;
-	if (next)
-		next->pprev = pprev;
-}
-
-static inline void hlist_del(struct hlist_node *n)
-{
-	__hlist_del(n);
-	n->next = LIST_POISON1;
-	n->pprev = LIST_POISON2;
-}
-
-static inline void hlist_del_init(struct hlist_node *n)
-{
-	if (!hlist_unhashed(n)) {
-		__hlist_del(n);
-		INIT_HLIST_NODE(n);
-	}
-}
-
-static inline void hlist_add_head(struct hlist_node *n, struct hlist_head *h)
-{
-	struct hlist_node *first = h->first;
-	n->next = first;
-	if (first)
-		first->pprev = &n->next;
-	h->first = n;
-	n->pprev = &h->first;
-}
-
-/* next must be != NULL */
-static inline void hlist_add_before(struct hlist_node *n,
-					struct hlist_node *next)
-{
-	n->pprev = next->pprev;
-	n->next = next;
-	next->pprev = &n->next;
-	*(n->pprev) = n;
-}
-
-static inline void hlist_add_after(struct hlist_node *n,
-					struct hlist_node *next)
-{
-	next->next = n->next;
-	n->next = next;
-	next->pprev = &n->next;
-
-	if(next->next)
-		next->next->pprev  = &next->next;
-}
-
-/*
- * Move a list from one list head to another. Fixup the pprev
- * reference of the first entry if it exists.
- */
-static inline void hlist_move_list(struct hlist_head *old,
-				   struct hlist_head *new)
-{
-	new->first = old->first;
-	if (new->first)
-		new->first->pprev = &new->first;
-	old->first = NULL;
-}
-
-#define hlist_entry(ptr, type, member) container_of(ptr,type,member)
-
-#define hlist_for_each(pos, head) \
-	for (pos = (head)->first; pos && ({ prefetch(pos->next); 1; }); \
-	     pos = pos->next)
-
-#define hlist_for_each_safe(pos, n, head) \
-	for (pos = (head)->first; pos && ({ n = pos->next; 1; }); \
-	     pos = n)
-
-/**
- * hlist_for_each_entry	- iterate over list of given type
- * @tpos:	the type * to use as a loop cursor.
- * @pos:	the &struct hlist_node to use as a loop cursor.
- * @head:	the head for your list.
- * @member:	the name of the hlist_node within the struct.
- */
-#define hlist_for_each_entry(tpos, pos, head, member)			 \
-	for (pos = (head)->first;					 \
-	     pos && ({ prefetch(pos->next); 1;}) &&			 \
-		({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \
-	     pos = pos->next)
-
-/**
- * hlist_for_each_entry_continue - iterate over a hlist continuing after current point
- * @tpos:	the type * to use as a loop cursor.
- * @pos:	the &struct hlist_node to use as a loop cursor.
- * @member:	the name of the hlist_node within the struct.
- */
-#define hlist_for_each_entry_continue(tpos, pos, member)		 \
-	for (pos = (pos)->next;						 \
-	     pos && ({ prefetch(pos->next); 1;}) &&			 \
-		({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \
-	     pos = pos->next)
-
-/**
- * hlist_for_each_entry_from - iterate over a hlist continuing from current point
- * @tpos:	the type * to use as a loop cursor.
- * @pos:	the &struct hlist_node to use as a loop cursor.
- * @member:	the name of the hlist_node within the struct.
- */
-#define hlist_for_each_entry_from(tpos, pos, member)			 \
-	for (; pos && ({ prefetch(pos->next); 1;}) &&			 \
-		({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \
-	     pos = pos->next)
-
-/**
- * hlist_for_each_entry_safe - iterate over list of given type safe against removal of list entry
- * @tpos:	the type * to use as a loop cursor.
- * @pos:	the &struct hlist_node to use as a loop cursor.
- * @n:		another &struct hlist_node to use as temporary storage
- * @head:	the head for your list.
- * @member:	the name of the hlist_node within the struct.
- */
-#define hlist_for_each_entry_safe(tpos, pos, n, head, member) 		 \
-	for (pos = (head)->first;					 \
-	     pos && ({ n = pos->next; 1; }) && 				 \
-		({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \
-	     pos = n)
-
-#endif


rtl8192e: reject rtl8192se cards with same PCI ID

Signed-off-by: Larry Finger <ed0f1d78b8c21b2970494a178da4bdfa8beba2a7@lwfinger.net>
Signed-off-by: Mike McCormack <fa77123c115913ca9e97c82fc48a0b47e477b7b4@ring3k.org>

--- drivers/staging/rtl8192e/rtl_core.c
+++ drivers/staging/rtl8192e/rtl_core.c
@@ -3558,6 +3558,7 @@
 #endif
 	int err = 0;
 	bool bdma64 = false;
+	u8 revision_id;

 	RT_TRACE(COMP_INIT,"Configuring chip resources");

@@ -3680,6 +3681,11 @@
         pci_write_config_byte(pdev,0x04,0x06);
         pci_write_config_byte(pdev,0x04,0x07);
 #endif
+
+	pci_read_config_byte(pdev, 0x08, &revision_id);
+	/* If the revisionid is 0x10, the device uses rtl8192se. */
+	if (pdev->device == 0x8192 && revision_id == 0x10)
+		goto fail1;

 #if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
 	priv->ops = ops;


Staging: xgifb: change obsolete pci_find_device() with pci_get_device()

Replaced obsolete pci_find_device() calls with pci_get_device() calls.
This is recommended in pci.txt filei in PCI Documentation.

Signed-off-by: Atul Sowani <e98a19b24a10093fc374d09e4efa12f94ea3d3d1@gmail.com>
Acked-by: Arnaud Patard <792745173c1ee81f4d7d786155d4c148b6e57204@rtp-net.org>
Signed-off-by: Greg Kroah-Hartman <4645f7897fd33786a2ee1264d590b3c400559d85@suse.de>

--- drivers/staging/xgifb/XGI_main_26.c
+++ drivers/staging/xgifb/XGI_main_26.c
@@ -472,9 +472,11 @@
 			break;
 		}

-		pdev = pci_find_device(PCI_VENDOR_ID_SI, nbridge_id, pdev);
-		if (pdev)
+		pdev = pci_get_device(PCI_VENDOR_ID_SI, nbridge_id, pdev);
+		if (pdev) {
 			valid_pdev = 1;
+			pci_dev_put(pdev);
+		}
 	}

 	if (!valid_pdev) {


staging : xgifb: Removes compilation conditionals

This patch fixes a compilation warning in today linux-next
removing some compilation conditionals.

Signed-off-by: Javier Martinez Canillas <07d7d8b97f07df629b11b70f3903e2991d35e296@gmail.com>
Signed-off-by: Greg Kroah-Hartman <4645f7897fd33786a2ee1264d590b3c400559d85@suse.de>

--- drivers/staging/xgifb/XGI_main_26.c
+++ drivers/staging/xgifb/XGI_main_26.c
@@ -2797,7 +2797,6 @@

 }

-#ifndef MODULE
 XGIINITSTATIC int __init XGIfb_setup(char *options)
 {
 	char *this_opt;
@@ -2880,7 +2879,6 @@
 	printk("\nxgifb: outa xgifb_setup 3450");
 	return 0;
 }
-#endif

 static unsigned char VBIOS_BUF[65535];

@@ -3461,13 +3459,12 @@

 XGIINITSTATIC int __init xgifb_init(void)
 {
-#ifndef MODULE
 	char *option = NULL;

 	if (fb_get_options("xgifb", &option))
 		return -ENODEV;
 	XGIfb_setup(option);
-#endif
+
 	return pci_register_driver(&xgifb_driver);
 }


[SCSI] target: Fix demo-mode MappedLUN shutdown UA/PR breakage

This patch fixes a bug in core_update_device_list_for_node() where
individual demo-mode generated MappedLUN's UA + Persistent
Reservations metadata where being leaked, instead of falling through
and calling existing core_scsi3_ua_release_all() and
core_scsi3_free_pr_reg_from_nacl() at the end of
core_update_device_list_for_node().

This bug would manifest itself with the following OOPs w/ TPG
demo-mode endpoints (tfo->tpg_check_demo_mode()=1), and PROUT
REGISTER+RESERVE -> explict struct se_session logout -> struct
se_device shutdown:

[  697.021139] LIO_iblock used greatest stack depth: 2704 bytes left
[  702.235017] general protection fault: 0000 [#1] SMP
[  702.235074] last sysfs file: /sys/devices/virtual/net/lo/operstate
[  704.372695] CPU 0
[  704.372725] Modules linked in: crc32c target_core_stgt scsi_tgt target_core_pscsi target_core_file target_core_iblock target_core_mod configfs sr_mod cdrom sd_mod ata_piix mptspi mptscsih libata mptbase [last unloaded: iscsi_target_mod]
[  704.375442]
[  704.375563] Pid: 4964, comm: tcm_node Not tainted 2.6.37+ #1 440BX Desktop Reference Platform/VMware Virtual Platform
[  704.375912] RIP: 0010:[<ffffffffa00aaa16>]  [<ffffffffa00aaa16>] __core_scsi3_complete_pro_release+0x31/0x133 [target_core_mod]
[  704.376017] RSP: 0018:ffff88001e5ffcb8  EFLAGS: 00010296
[  704.376017] RAX: 6d32335b1b0a0d0a RBX: ffff88001d952cb0 RCX: 0000000000000015
[  704.376017] RDX: ffff88001b428000 RSI: ffff88001da5a4c0 RDI: ffff88001e5ffcd8
[  704.376017] RBP: ffff88001e5ffd28 R08: ffff88001e5ffcd8 R09: ffff88001d952080
[  704.377116] R10: ffff88001dfc5480 R11: ffff88001df8abb0 R12: ffff88001d952cb0
[  704.377319] R13: 0000000000000000 R14: ffff88001df8abb0 R15: ffff88001b428000
[  704.377521] FS:  00007f033d15c6e0(0000) GS:ffff88001fa00000(0000) knlGS:0000000000000000
[  704.377861] CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
[  704.378043] CR2: 00007fff09281510 CR3: 000000001e5db000 CR4: 00000000000006f0
[  704.378110] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[  704.378110] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
[  704.378110] Process tcm_node (pid: 4964, threadinfo ffff88001e5fe000, task ffff88001d99c260)
[  704.378110] Stack:
[  704.378110]  ffffea0000678980 ffff88001da5a4c0 ffffea0000678980 ffff88001f402b00
[  704.378110]  ffff88001e5ffd08 ffffffff810ea236 ffff88001e5ffd18 0000000000000282
[  704.379772]  ffff88001d952080 ffff88001d952cb0 ffff88001d952cb0 ffff88001dc79010
[  704.380082] Call Trace:
[  704.380220]  [<ffffffff810ea236>] ? __slab_free+0x89/0x11c
[  704.380403]  [<ffffffffa00ab781>] core_scsi3_free_all_registrations+0x3e/0x157 [target_core_mod]
[  704.380479]  [<ffffffffa00a752b>] se_release_device_for_hba+0xa6/0xd8 [target_core_mod]
[  704.380479]  [<ffffffffa00a7598>] se_free_virtual_device+0x3b/0x45 [target_core_mod]
[  704.383750]  [<ffffffffa00a3177>] target_core_drop_subdev+0x13a/0x18d [target_core_mod]
[  704.384068]  [<ffffffffa00960db>] client_drop_item+0x25/0x31 [configfs]
[  704.384263]  [<ffffffffa00967b5>] configfs_rmdir+0x1a1/0x223 [configfs]
[  704.384459]  [<ffffffff810fa8cd>] vfs_rmdir+0x7e/0xd3
[  704.384631]  [<ffffffff810fc3be>] do_rmdir+0xa3/0xf4
[  704.384895]  [<ffffffff810eed15>] ? filp_close+0x67/0x72
[  704.386485]  [<ffffffff810fc446>] sys_rmdir+0x11/0x13
[  704.387893]  [<ffffffff81002a92>] system_call_fastpath+0x16/0x1b
[  704.388083] Code: 4c 8d 45 b0 41 56 49 89 d7 41 55 41 89 cd 41 54 b9 15 00 00 00 53 48 89 fb 48 83 ec 48 4c 89 c7 48 89 75 98 48 8b 86 28 01 00 00 <48> 8b 80 90 01 00 00 48 89 45 a0 31 c0 f3 aa c7 45 ac 00 00 00
[  704.388763] RIP  [<ffffffffa00aaa16>] __core_scsi3_complete_pro_release+0x31/0x133 [target_core_mod]
[  704.389142]  RSP <ffff88001e5ffcb8>
[  704.389572] ---[ end trace 2a3614f3cd6261a5 ]---

Signed-off-by: Nicholas A. Bellinger <978acd1567d5598152161fdf8bf3ca568f950c9b@linux-iscsi.org>
Signed-off-by: James Bottomley <407b36959ca09543ccda8f8e06721c791bc53435@suse.de>

--- drivers/target/target_core_device.c
+++ drivers/target/target_core_device.c
@@ -373,11 +373,11 @@
 		/*
 		 * deve->se_lun_acl will be NULL for demo-mode created LUNs
 		 * that have not been explictly concerted to MappedLUNs ->
-		 * struct se_lun_acl.
+		 * struct se_lun_acl, but we remove deve->alua_port_list from
+		 * port->sep_alua_list. This also means that active UAs and
+		 * NodeACL context specific PR metadata for demo-mode
+		 * MappedLUN *deve will be released below..
 		 */
-		if (!(deve->se_lun_acl))
-			return 0;
-
 		spin_lock_bh(&port->sep_alua_lock);
 		list_del(&deve->alua_port_list);
 		spin_unlock_bh(&port->sep_alua_lock);


USB: atmel_usba_udc: fix freeing irq in usba_udc_remove()

Add a free_irq() call on vbus gpio when we remove udc so that the
vbus irq is properly released.

Signed-off-by: Rob Emanuele <e103e936f01582b125fc52b9c86b56f488b28fc7@crystalfontz.com>
Signed-off-by: Nicolas Ferre <45b517be0e5ec6dc3a39715767c1d18e090d39b4@atmel.com>
Acked-by: Jean-Christophe PLAGNIOL-VILLARD <9fc55922e47e21cb004bb878f69efa10ab51cf02@jcrosoft.com>
Signed-off-by: Greg Kroah-Hartman <4645f7897fd33786a2ee1264d590b3c400559d85@suse.de>

--- drivers/usb/gadget/atmel_usba_udc.c
+++ drivers/usb/gadget/atmel_usba_udc.c
@@ -2057,8 +2057,10 @@
 		usba_ep_cleanup_debugfs(&usba_ep[i]);
 	usba_cleanup_debugfs(udc);

-	if (gpio_is_valid(udc->vbus_pin))
+	if (gpio_is_valid(udc->vbus_pin)) {
+		free_irq(gpio_to_irq(udc->vbus_pin), udc);
 		gpio_free(udc->vbus_pin);
+	}

 	free_irq(udc->irq, udc);
 	kfree(usba_ep);


USB: gadget: f_mass_storage: Fix USB WHQL Certification Issues

As part of the USB MSCV testing, the host issues random commands and
expects the device to respond, but the device is not able to respond to
these commands, since the endpoints are not enabled due to the thread
latency and hence the compliance testing is failing.

Hence enabling/disabling the endpoints in interrupt context.

Change-Id: I27ad5875a3bde9a480866173d18cc3292c4af969
Signed-off-by: Chiranjeevi Velempati <692a45b26f75473403cc09fb298f4dc2e885a389@codeaurora.org>

--- drivers/usb/gadget/f_mass_storage.c
+++ drivers/usb/gadget/f_mass_storage.c
@@ -2377,15 +2377,6 @@
 			}
 		}

-		/* Disable the endpoints */
-		if (fsg->bulk_in_enabled) {
-			usb_ep_disable(fsg->bulk_in);
-			fsg->bulk_in_enabled = 0;
-		}
-		if (fsg->bulk_out_enabled) {
-			usb_ep_disable(fsg->bulk_out);
-			fsg->bulk_out_enabled = 0;
-		}

 		common->fsg = NULL;
 		wake_up(&common->fsg_wait);
@@ -2397,28 +2388,6 @@

 	common->fsg = new_fsg;
 	fsg = common->fsg;
-
-	/* Enable the endpoints */
-	rc = config_ep_by_speed(common->gadget, &(fsg->function), fsg->bulk_in);
-	if (rc)
-		goto reset;
-	rc = usb_ep_enable(fsg->bulk_in);
-	if (rc)
-		goto reset;
-	fsg->bulk_in->driver_data = common;
-	fsg->bulk_in_enabled = 1;
-
-	rc = config_ep_by_speed(common->gadget, &(fsg->function),
-				fsg->bulk_out);
-	if (rc)
-		goto reset;
-	rc = usb_ep_enable(fsg->bulk_out);
-	if (rc)
-		goto reset;
-	fsg->bulk_out->driver_data = common;
-	fsg->bulk_out_enabled = 1;
-	common->bulk_out_maxpacket = usb_endpoint_maxp(fsg->bulk_out->desc);
-	clear_bit(IGNORE_BULK_OUT, &fsg->atomic_bitflags);

 	/* Allocate the requests */
 	for (i = 0; i < fsg_num_buffers; ++i) {
@@ -2448,14 +2417,55 @@
 static int fsg_set_alt(struct usb_function *f, unsigned intf, unsigned alt)
 {
 	struct fsg_dev *fsg = fsg_from_func(f);
+	struct fsg_common *common = fsg->common;
+	int rc;
+
+	/* Enable the endpoints */
+	rc = config_ep_by_speed(common->gadget, &(fsg->function), fsg->bulk_in);
+	if (rc)
+		return rc;
+	rc = usb_ep_enable(fsg->bulk_in);
+	if (rc)
+		return rc;
+	fsg->bulk_in->driver_data = common;
+	fsg->bulk_in_enabled = 1;
+
+	rc = config_ep_by_speed(common->gadget, &(fsg->function),
+				fsg->bulk_out);
+	if (rc)
+		goto reset_bulk_int;
+	rc = usb_ep_enable(fsg->bulk_out);
+	if (rc)
+		goto reset_bulk_int;
+	fsg->bulk_out->driver_data = common;
+	fsg->bulk_out_enabled = 1;
+	common->bulk_out_maxpacket = le16_to_cpu(fsg->bulk_in->desc->wMaxPacketSize);
+	clear_bit(IGNORE_BULK_OUT, &fsg->atomic_bitflags);
 	fsg->common->new_fsg = fsg;
 	raise_exception(fsg->common, FSG_STATE_CONFIG_CHANGE);
 	return USB_GADGET_DELAYED_STATUS;
+
+reset_bulk_int:
+	usb_ep_disable(fsg->bulk_in);
+	fsg->bulk_in_enabled = 0;
+	return rc;
 }

 static void fsg_disable(struct usb_function *f)
 {
 	struct fsg_dev *fsg = fsg_from_func(f);
+
+	/* Disable the endpoints */
+	if (fsg->bulk_in_enabled) {
+		usb_ep_disable(fsg->bulk_in);
+		fsg->bulk_in_enabled = 0;
+		fsg->bulk_in->driver_data = NULL;
+	}
+	if (fsg->bulk_out_enabled) {
+		usb_ep_disable(fsg->bulk_out);
+		fsg->bulk_out_enabled = 0;
+		fsg->bulk_out->driver_data = NULL;
+	}
 	fsg->common->new_fsg = NULL;
 	raise_exception(fsg->common, FSG_STATE_CONFIG_CHANGE);
 }


Use unicode constants for WCHAR

Use unicode constants for WCHAR

--- channels/drive/client/drive_file.c
+++ channels/drive/client/drive_file.c
@@ -59,24 +59,24 @@

 	for (i = 0; i < length; i++)
 	{
-		if (path[i] == '\\')
-			path[i] = '/';
+		if (path[i] == L'\\')
+			path[i] = L'/';
 	}

 #ifdef WIN32

-	if ((length == 3) && (path[1] == ':') && (path[2] == '/'))
+	if ((length == 3) && (path[1] == L':') && (path[2] == L'/'))
 		return;

 #else

-	if ((length == 1) && (path[0] == '/'))
+	if ((length == 1) && (path[0] == L'/'))
 		return;

 #endif

-	if ((length > 0) && (path[length - 1] == '/'))
-		path[length - 1] = '\0';
+	if ((length > 0) && (path[length - 1] == L'/'))
+		path[length - 1] = L'\0';
 }

 static WCHAR* drive_file_combine_fullpath(const WCHAR* base_path, const WCHAR* path,
@@ -126,8 +126,8 @@
 	}

 	CopyMemory(path_slash, path, base_path_length);
-	path_slash[base_path_length / 2] = '/';
-	path_slash[base_path_length / 2 + 1] = '*';
+	path_slash[base_path_length / 2] = L'/';
+	path_slash[base_path_length / 2 + 1] = L'*';
 	DEBUG_WSTR("Search in %s", path_slash);
 	dir = FindFirstFileW(path_slash, &findFileData);
 	path_slash[base_path_length / 2 + 1] = 0;
@@ -142,8 +142,8 @@
 	{
 		len = _wcslen(findFileData.cFileName);

-		if ((len == 1 && findFileData.cFileName[0] == '.') || (len == 2 &&
-		        findFileData.cFileName[0] == '.' && findFileData.cFileName[1] == '.'))
+		if ((len == 1 && findFileData.cFileName[0] == L'.') || (len == 2 &&
+		        findFileData.cFileName[0] == L'.' && findFileData.cFileName[1] == L'.'))
 		{
 			continue;
 		}
@@ -852,7 +852,3 @@
 	Stream_Write_UINT8(output, 0); /* Padding */
 	return FALSE;
 }
-
-#ifdef _WIN32
-#pragma warning(pop)
-#endif


[PATCH] USB: drivers/usb/misc/sisusbvga/sisusb.c: remove dead code

The Coverity checker found this dead code.

Signed-off-by: Adrian Bunk <0b86548ef377da0031a3ff3f0c4e06f016e20105@stusta.de>
Signed-off-by: Greg Kroah-Hartman <4645f7897fd33786a2ee1264d590b3c400559d85@suse.de>

--- drivers/usb/misc/sisusbvga/sisusb.c
+++ drivers/usb/misc/sisusbvga/sisusb.c
@@ -862,9 +862,6 @@
 	while (length) {

 	    switch (length) {
-
-		case 0:
-			return ret;

 		case 1:
 			if (userbuffer) {
@@ -1221,9 +1218,6 @@

 	    switch (length) {

-		case 0:
-			return ret;
-
 		case 1:

 			ret |= sisusb_read_memio_byte(sisusb, SISUSB_TYPE_MEM,


Refactored printf(msg) to fprintf(stderr, msg)

--- channels/rdpei/client/rdpei_main.c
+++ channels/rdpei/client/rdpei_main.c
@@ -82,7 +82,7 @@
 	Stream_Write_UINT32(s, pduLength); /* pduLength (4 bytes) */
 	Stream_SetPosition(s, Stream_Length(s));

-	printf("rdpei_send_pdu: eventId: %d (%s) length: %d\n",
+	fprintf(stderr, "rdpei_send_pdu: eventId: %d (%s) length: %d\n",
 			eventId, RDPEI_EVENTID_STRINGS[eventId], pduLength);

 	status = callback->channel->Write(callback->channel,
@@ -204,7 +204,7 @@

 	if (protocolVersion != RDPINPUT_PROTOCOL_V1)
 	{
-		printf("Unknown [MS-RDPEI] protocolVersion: 0x%08X\n", protocolVersion);
+		fprintf(stderr, "Unknown [MS-RDPEI] protocolVersion: 0x%08X\n", protocolVersion);
 		return -1;
 	}

@@ -229,7 +229,7 @@
 	Stream_Read_UINT16(s, eventId); /* eventId (2 bytes) */
 	Stream_Read_UINT32(s, pduLength); /* pduLength (4 bytes) */

-	printf("rdpei_recv_pdu: eventId: %d (%s) length: %d\n",
+	fprintf(stderr, "rdpei_recv_pdu: eventId: %d (%s) length: %d\n",
 			eventId, RDPEI_EVENTID_STRINGS[eventId], pduLength);

 	switch (eventId)


vdpa/mlx5: fix steering update in virtq unset

When a virtq is destroyed by the driver, it must be removed from the
steering RQT which holds its reference.

The driver didn't remove the virtq from RQT before destroying it what
caused HW syndrome in virtq unset.

Remove the virtq from RQT before destroying it.

Fixes: 9f09b1ca15c5 ("vdpa/mlx5: recreate a virtq becoming enabled")
Cc: stable@dpdk.org

Signed-off-by: Xueming Li <a578f76ca98b1dec92e0d1baef814b93f3f2f3b4@mellanox.com>
Signed-off-by: Matan Azrad <6969f5f553ad7652679a585a85d7321babc90464@mellanox.com>
Reviewed-by: Maxime Coquelin <9a2667dee3b90866bbc9c2696cff2b7d5616c95a@redhat.com>

--- drivers/vdpa/mlx5/mlx5_vdpa_virtq.c
+++ drivers/vdpa/mlx5/mlx5_vdpa_virtq.c
@@ -482,6 +482,13 @@
 		DRV_LOG(INFO, "Virtq %d was modified, recreate it.", index);
 	}
 	if (virtq->virtq) {
+		virtq->enable = 0;
+		if (is_virtq_recvq(virtq->index, priv->nr_virtqs)) {
+			ret = mlx5_vdpa_steer_update(priv);
+			if (ret)
+				DRV_LOG(WARNING, "Failed to disable steering "
+					"for virtq %d.", index);
+		}
 		ret = mlx5_vdpa_virtq_stop(priv, index);
 		if (ret)
 			DRV_LOG(WARNING, "Failed to stop virtq %d.", index);
@@ -493,14 +500,12 @@
 			DRV_LOG(ERR, "Failed to setup virtq %d.", index);
 			return ret;
 		}
-	}
-	virtq->enable = !!enable;
-	if (is_virtq_recvq(virtq->index, priv->nr_virtqs)) {
-		/* Need to add received virtq to the RQT table of the TIRs. */
-		ret = mlx5_vdpa_steer_update(priv);
-		if (ret) {
-			virtq->enable = !enable;
-			return ret;
+		virtq->enable = 1;
+		if (is_virtq_recvq(virtq->index, priv->nr_virtqs)) {
+			ret = mlx5_vdpa_steer_update(priv);
+			if (ret)
+				DRV_LOG(WARNING, "Failed to enable steering "
+					"for virtq %d.", index);
 		}
 	}
 	return 0;


OMAPDSS: DSI: Add OMAP5 DSI module IDs

OMAPDSS: DSI: Add OMAP5 DSI module IDs

Add OMAP5 DSI module ID support to the OMAP DSI driver.

Signed-off-by: Tomi Valkeinen <e1ca4dbb8be1acaf20734fecd2da10ed1d46a9bb@ti.com>


update the fetch_email_body test to pass in a progress callback

--- check_tests/eas_libeasmail_tests.c
+++ check_tests/eas_libeasmail_tests.c
@@ -688,6 +688,13 @@
 }
 END_TEST

+static void
+test_fetch_email_body_progress_cb (gpointer progress_data, guint percent)
+{
+	g_main_loop_quit (loop);
+    g_main_loop_unref (loop);
+    loop = NULL;
+}

 START_TEST (test_eas_mail_handler_fetch_email_body)
 {
@@ -774,14 +781,27 @@
         }

         mark_point();
+
+		EasProgressFn progress_cb = NULL;
+
+		// comment out if progress reports not desired:
+		progress_cb = test_fetch_email_body_progress_cb;
+
+		loop = g_main_loop_new (NULL, FALSE);	// lrm required only if we're passing in a progress function
+
         // call method to get body
         rtn = eas_mail_handler_fetch_email_body (email_handler,
                                                  g_inbox_id, // Inbox
                                                  email->server_id,
                                                  mime_directory,
-                                                 NULL,
-                                                 NULL,
+                                                 progress_cb,
+                                                 NULL,		//data passed to cb
                                                  &error);
+		if(progress_cb)
+		{
+			if (loop) g_main_loop_run (loop);
+		}
+
         g_free (mime_directory);

         if (rtn == TRUE)


Fix the build by including string.
Review URL: http://codereview.chromium.org/7303

git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@3347 0039d316-1c4b-4281-b951-d872f2087c98

--- chrome/browser/web_contents_view.h
+++ chrome/browser/web_contents_view.h
@@ -6,6 +6,8 @@
 #define CHROME_BROWSER_WEB_CONTENTS_VIEW_H_

 #include <windows.h>
+
+#include <string>

 #include "base/basictypes.h"
 #include "base/gfx/rect.h"


Other missing bits for path rename...

Other missing bits for path rename...

--- panel-plugin/xkb-settings-dialog.c
+++ panel-plugin/xkb-settings-dialog.c
@@ -807,8 +807,8 @@
         gtk_tree_selection_get_selected (selection, &model, &iter);
         gtk_tree_model_get (model, &iter, AVAIL_LAYOUT_TREE_COL_ID, &id, -1);

-        path = gtk_tree_model_get_path (model, &iter);
-        if (gtk_tree_path_get_depth (path) == 1)
+        tree_path = gtk_tree_model_get_path (model, &iter);
+        if (gtk_tree_path_get_depth (tree_path) == 1)
         {
             strings[0] = id;
             strings[1] = "";
@@ -816,8 +816,8 @@
         else
         {
             strings[1] = id;
-            gtk_tree_path_up(path);
-            gtk_tree_model_get_iter(model, &iter, path);
+            gtk_tree_path_up(tree_path);
+            gtk_tree_model_get_iter(model, &iter, tree_path);
             gtk_tree_model_get (model, &iter, AVAIL_LAYOUT_TREE_COL_ID, &id, -1);
             strings[0] = id;
         }


os0file.c	Fixed an extraneous error message at the start of db, changed from O_SYNC back to fdatasync because extremely slow on Sun

innobase/os/os0file.c:
  Fixed an extraneous error message at the start of db, changed from O_SYNC back to fdatasync because extremely slow on Sun

--- innobase/os/os0file.c
+++ innobase/os/os0file.c
@@ -120,9 +120,11 @@

 	err = (ulint) GetLastError();

-	fprintf(stderr,
+	if (err != ERROR_FILE_EXISTS) {
+	         fprintf(stderr,
 	 "InnoDB: operating system error number %li in a file operation.\n",
 		(long) err);
+	}

 	if (err == ERROR_FILE_NOT_FOUND) {
 		return(OS_FILE_NOT_FOUND);
@@ -134,11 +136,13 @@
 		return(100 + err);
 	}
 #else
-	fprintf(stderr,
+	err = (ulint) errno;
+
+	if (err != EEXIST) {
+	        fprintf(stderr,
 	 "InnoDB: operating system error number %i in a file operation.\n",
 		errno);
-
-	err = (ulint) errno;
+	}

 	if (err == ENOSPC ) {
 		return(OS_FILE_DISK_FULL);
@@ -310,12 +314,11 @@
 	UT_NOT_USED(purpose);

 	/* On Linux opening a file in the O_SYNC mode seems to be much
-        more efficient than calling an explicit fsync or fdatasync after
-        each write */
-
-#ifdef O_SYNC
-	create_flag = create_flag | O_SYNC;
-#endif
+        more efficient for small writes than calling an explicit fsync or
+	fdatasync after each write, but on Solaris O_SYNC and O_DSYNC is
+	extremely slow in large block writes to a big file. Therefore we
+	do not use these options, but use explicit fdatasync. */
+
 	if (create_mode == OS_FILE_CREATE) {
 	        file = open(name, create_flag, S_IRUSR | S_IWUSR | S_IRGRP
 			                     | S_IWGRP | S_IROTH | S_IWOTH);
@@ -435,10 +438,13 @@
 	byte*   buf;

 try_again:
-	buf = ut_malloc(UNIV_PAGE_SIZE * 64);
+	/* We use a very big 16 MB buffer in writing because Linux is
+	extremely slow in fdatasync on 1 MB writes */
+
+	buf = ut_malloc(UNIV_PAGE_SIZE * 1024);

 	/* Write buffer full of zeros */
-	for (i = 0; i < UNIV_PAGE_SIZE * 64; i++) {
+	for (i = 0; i < UNIV_PAGE_SIZE * 1024; i++) {
 	        buf[i] = '\0';
 	}

@@ -450,10 +456,10 @@
 	UT_NOT_USED(size_high);
 #endif
 	while (offset < low) {
-	        if (low - offset < UNIV_PAGE_SIZE * 64) {
+	        if (low - offset < UNIV_PAGE_SIZE * 1024) {
 	                 n_bytes = low - offset;
 	        } else {
-	                 n_bytes = UNIV_PAGE_SIZE * 64;
+	                 n_bytes = UNIV_PAGE_SIZE * 1024;
 	        }

 	        ret = os_file_write(name, file, buf, offset, 0, n_bytes);
@@ -469,6 +475,8 @@

 	ret = os_file_flush(file);

+	fsync(file);
+
 	if (ret) {
 	        return(TRUE);
 	}
@@ -509,14 +517,7 @@
 #else
 	int	ret;

-#ifdef O_SYNC
-	/* We open all files with the O_SYNC option, which means there
-        should be no need for fsync or fdatasync. In practice such a need
-	may be because on a Linux Xeon computer "donna" the OS seemed to be
-	fooled to believe that 500 disk writes/second are possible. */
-
-	ret = 0;
-#elif defined(HAVE_FDATASYNC)
+#ifdef HAVE_FDATASYNC
 	ret = fdatasync(file);
 #else
 	ret = fsync(file);


clockevents: Enforce oneshot broadcast when broadcast mask is set on resume

The jinxed VAIO refuses to resume without hitting keys on the keyboard
when this is not enforced. It is unclear why the cpu ends up in a lower
C State without notifying the clock events layer, but enforcing the
oneshot broadcast here is safe.

Signed-off-by: Thomas Gleixner <00e4cf8f46a57000a44449bf9dd8cbbcc209fd2a@linutronix.de>

--- kernel/time/tick-broadcast.c
+++ kernel/time/tick-broadcast.c
@@ -382,12 +382,23 @@

 int tick_resume_broadcast_oneshot(struct clock_event_device *bc)
 {
+	int cpu = smp_processor_id();
+
+	/*
+	 * If the CPU is marked for broadcast, enforce oneshot
+	 * broadcast mode. The jinxed VAIO does not resume otherwise.
+	 * No idea why it ends up in a lower C State during resume
+	 * without notifying the clock events layer.
+	 */
+	if (cpu_isset(cpu, tick_broadcast_mask))
+		cpu_set(cpu, tick_broadcast_oneshot_mask);
+
 	clockevents_set_mode(bc, CLOCK_EVT_MODE_ONESHOT);

 	if(!cpus_empty(tick_broadcast_oneshot_mask))
 		tick_broadcast_set_event(ktime_get(), 1);

-	return cpu_isset(smp_processor_id(), tick_broadcast_oneshot_mask);
+	return cpu_isset(cpu, tick_broadcast_oneshot_mask);
 }

 /*


Update GeometricRand.h

Update GeometricRand.h

--- variables/discrete/GeometricRand.h
+++ variables/discrete/GeometricRand.h
@@ -48,6 +48,9 @@
     double ExcessKurtosis() const override;

     inline double Entropy() const;
+
+    bool fit_MLE(const QVector<int> &sample);
+    bool fit_MM(const QVector<int> &sample);
 };

 #endif // GEOMETRICRAND_H


vp9-svc: Fix to initialize downsampling filters.

For 3 spatial layers with 1/2 downsampling, the
downsampling filter for the middle layer was not
set for the very first frame, so it was defaulting
to the subsample filter (no averaging/phase = 0).

Its not set due to the two stage scaling that is
done for 1/4 on base layer, during which the intermediate
1/2 result is saved for the middle layer.

Fix for now is to set the default downsampling filter
to Bilinear (averaging/non-zero phase) for all layers on
init (vp9_init_layer_context):.

Change-Id: Ic7407810b34c621e7e7420682508d45478bdffcf

--- vp9/encoder/vp9_svc_layercontext.c
+++ vp9/encoder/vp9_svc_layercontext.c
@@ -45,8 +45,8 @@
     svc->ext_lst_fb_idx[sl] = 0;
     svc->ext_gld_fb_idx[sl] = 1;
     svc->ext_alt_fb_idx[sl] = 2;
-    svc->downsample_filter_type[sl] = EIGHTTAP;
-    svc->downsample_filter_phase[sl] = 0;  // Set to 8 for averaging filter.
+    svc->downsample_filter_type[sl] = BILINEAR;
+    svc->downsample_filter_phase[sl] = 8;  // Set to 8 for averaging filter.
   }

   if (cpi->oxcf.error_resilient_mode == 0 && cpi->oxcf.pass == 2) {


Make API neater

Make API neater


MFC r258167:   ANSIfy function defintions.

--- sys/net/if_gif.c
+++ sys/net/if_gif.c
@@ -152,10 +152,7 @@
 #endif

 static int
-gif_clone_create(ifc, unit, params)
-	struct if_clone *ifc;
-	int unit;
-	caddr_t params;
+gif_clone_create(struct if_clone *ifc, int unit, caddr_t params)
 {
 	struct gif_softc *sc;

@@ -199,8 +196,7 @@
 }

 static void
-gif_clone_destroy(ifp)
-	struct ifnet *ifp;
+gif_clone_destroy(struct ifnet *ifp)
 {
 #if defined(INET) || defined(INET6)
 	int err;
@@ -246,10 +242,7 @@
     NULL);

 static int
-gifmodevent(mod, type, data)
-	module_t mod;
-	int type;
-	void *data;
+gifmodevent(module_t mod, int type, void *data)
 {

 	switch (type) {
@@ -279,11 +272,7 @@
 MODULE_VERSION(if_gif, 1);

 int
-gif_encapcheck(m, off, proto, arg)
-	const struct mbuf *m;
-	int off;
-	int proto;
-	void *arg;
+gif_encapcheck(const struct mbuf *m, int off, int proto, void *arg)
 {
 	struct ip ip;
 	struct gif_softc *sc;
@@ -528,10 +517,7 @@
 }

 void
-gif_input(m, af, ifp)
-	struct mbuf *m;
-	int af;
-	struct ifnet *ifp;
+gif_input(struct mbuf *m, int af, struct ifnet *ifp)
 {
 	int isr, n;
 	struct gif_softc *sc;
@@ -669,10 +655,7 @@

 /* XXX how should we handle IPv6 scope on SIOC[GS]IFPHYADDR? */
 int
-gif_ioctl(ifp, cmd, data)
-	struct ifnet *ifp;
-	u_long cmd;
-	caddr_t data;
+gif_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
 {
 	struct gif_softc *sc  = ifp->if_softc;
 	struct ifreq     *ifr = (struct ifreq*)data;
@@ -949,10 +932,7 @@
  * a mutex.
  */
 int
-gif_set_tunnel(ifp, src, dst)
-	struct ifnet *ifp;
-	struct sockaddr *src;
-	struct sockaddr *dst;
+gif_set_tunnel(struct ifnet *ifp, struct sockaddr *src, struct sockaddr *dst)
 {
 	struct gif_softc *sc = ifp->if_softc;
 	struct gif_softc *sc2;
@@ -1058,8 +1038,7 @@
 }

 void
-gif_delete_tunnel(ifp)
-	struct ifnet *ifp;
+gif_delete_tunnel(struct ifnet *ifp)
 {
 	struct gif_softc *sc = ifp->if_softc;


In in_addprefix() compare not only route addresses, but their masks,
too. This fixes problem when connected prefixes overlap.

Obtained from:	OpenBSD (rev. 1.40 by claudio);
		[ I came to this fix myself, and then found out that
		  OpenBSD had already fixed it the same way.]

--- sys/netinet/in.c
+++ sys/netinet/in.c
@@ -794,7 +794,7 @@
 	int flags;
 {
 	struct in_ifaddr *ia;
-	struct in_addr prefix, mask, p;
+	struct in_addr prefix, mask, p, m;
 	int error;

 	if ((flags & RTF_HOST) != 0)
@@ -806,15 +806,20 @@
 	}

 	TAILQ_FOREACH(ia, &in_ifaddrhead, ia_link) {
-		if (rtinitflags(ia))
-			p = ia->ia_dstaddr.sin_addr;
-		else {
+		if (rtinitflags(ia)) {
 			p = ia->ia_addr.sin_addr;
-			p.s_addr &= ia->ia_sockmask.sin_addr.s_addr;
-		}
-
-		if (prefix.s_addr != p.s_addr)
-			continue;
+
+			if (prefix.s_addr != p.s_addr)
+				continue;
+		} else {
+			p = ia->ia_addr.sin_addr;
+			m = ia->ia_sockmask.sin_addr;
+			p.s_addr &= m.s_addr;
+
+			if (prefix.s_addr != p.s_addr ||
+			    mask.s_addr != m.s_addr)
+				continue;
+		}

 		/*
 		 * If we got a matching prefix route inserted by other


Add protocol number for SCTP.

Add protocol number for SCTP.

Submitted by:	Randall Stewart rrs at cisco.com
MFC after:	1 week

--- sys/netinet/in.h
+++ sys/netinet/in.h
@@ -228,6 +228,7 @@
 #define	IPPROTO_APES		99		/* any private encr. scheme */
 #define	IPPROTO_GMTP		100		/* GMTP*/
 #define	IPPROTO_IPCOMP		108		/* payload compression (IPComp) */
+#define IPPROTO_SCTP 		132		/* SCTP */
 /* 101-254: Partly Unassigned */
 #define	IPPROTO_PIM		103		/* Protocol Independent Mcast */
 #define	IPPROTO_CARP		112		/* CARP */


- Check the result of malloc(M_NOWAIT) in replay_alloc(). The caller
  (replay_alloc()) knows how to handle replay_alloc() failure.
- Eliminate 'freed_one' variable, it is not needed - when no entry is found
  rce will be NULL.
- Add locking assertions where we expect a rc_lock to be held.

Reviewed by:	rmacklem
MFC after:	2 weeks

--- sys/rpc/replay.c
+++ sys/rpc/replay.c
@@ -113,8 +113,12 @@
 {
 	struct replay_cache_entry *rce;

+	mtx_assert(&rc->rc_lock, MA_OWNED);
+
 	rc->rc_count++;
 	rce = malloc(sizeof(*rce), M_RPC, M_NOWAIT|M_ZERO);
+	if (!rce)
+		return (NULL);
 	rce->rce_hash = h;
 	rce->rce_msg = *msg;
 	bcopy(addr, &rce->rce_addr, addr->sa_len);
@@ -128,6 +132,8 @@
 static void
 replay_free(struct replay_cache *rc, struct replay_cache_entry *rce)
 {
+
+	mtx_assert(&rc->rc_lock, MA_OWNED);

 	rc->rc_count--;
 	TAILQ_REMOVE(&rc->rc_cache[rce->rce_hash], rce, rce_link);
@@ -143,26 +149,25 @@
 replay_prune(struct replay_cache *rc)
 {
 	struct replay_cache_entry *rce;
-	bool_t freed_one;
-
-	if (rc->rc_count >= REPLAY_MAX || rc->rc_size > rc->rc_maxsize) {
-		do {
-			freed_one = FALSE;
-			/*
-			 * Try to free an entry. Don't free in-progress entries
-			 */
-			TAILQ_FOREACH_REVERSE(rce, &rc->rc_all,
-			    replay_cache_list, rce_alllink) {
-				if (rce->rce_repmsg.rm_xid) {
-					replay_free(rc, rce);
-					freed_one = TRUE;
-					break;
-				}
-			}
-		} while (freed_one
-		    && (rc->rc_count >= REPLAY_MAX
-			|| rc->rc_size > rc->rc_maxsize));
-	}
+
+	mtx_assert(&rc->rc_lock, MA_OWNED);
+
+	if (rc->rc_count < REPLAY_MAX && rc->rc_size <= rc->rc_maxsize)
+		return;
+
+	do {
+		/*
+		 * Try to free an entry. Don't free in-progress entries.
+		 */
+		TAILQ_FOREACH_REVERSE(rce, &rc->rc_all, replay_cache_list,
+		    rce_alllink) {
+			if (rce->rce_repmsg.rm_xid)
+				break;
+		}
+		if (rce)
+			replay_free(rc, rce);
+	} while (rce && (rc->rc_count >= REPLAY_MAX
+	    || rc->rc_size > rc->rc_maxsize));
 }

 enum replay_state


shuffle structs for better cacheline behavior.

--- sys/sys/malloc.h
+++ sys/sys/malloc.h
@@ -31,7 +31,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)malloc.h	8.5 (Berkeley) 5/3/95
- * $Id: malloc.h,v 1.30 1997/10/12 20:25:59 phk Exp $
+ * $Id: malloc.h,v 1.31 1997/10/28 19:01:02 phk Exp $
  */

 #ifndef _SYS_MALLOC_H_
@@ -49,17 +49,17 @@
 #define M_MAGIC		877983977	/* time when first defined :-) */

 struct malloc_type {
-	const char * const ks_shortdesc;	/* Short description */
-	u_long	ks_magic;	/* If if's not magic, don't touch it */
 	struct malloc_type *ks_next; /* Next pointer */
+	long 	ks_memuse;	/* total memory held in bytes */
+	long	ks_limit;	/* most that are allowed to exist */
+	long	ks_size;	/* sizes of this thing that are allocated */
 	long	ks_inuse;	/* # of packets of this type currently in use */
 	long	ks_calls;	/* total packets of this type ever allocated */
-	long 	ks_memuse;	/* total memory held in bytes */
+	long	ks_maxused;	/* maximum number ever used */
+	u_long	ks_magic;	/* If if's not magic, don't touch it */
+	const char * const ks_shortdesc;	/* Short description */
 	u_short	ks_limblocks;	/* number of times blocked for hitting limit */
 	u_short	ks_mapblocks;	/* number of times blocked for kernel map */
-	long	ks_maxused;	/* maximum number ever used */
-	long	ks_limit;	/* most that are allowed to exist */
-	long	ks_size;	/* sizes of this thing that are allocated */
 };

 #define	MALLOC_DEFINE(type, shortdesc, longdesc) \
@@ -101,10 +101,10 @@
 struct kmembuckets {
 	caddr_t kb_next;	/* list of free blocks */
 	caddr_t kb_last;	/* last free block */
+	long	kb_total;	/* total number of blocks allocated */
+	long	kb_elmpercl;	/* # of elements in this sized allocation */
+	long	kb_totalfree;	/* # of free elements in this bucket */
 	long	kb_calls;	/* total calls to allocate this size */
-	long	kb_total;	/* total number of blocks allocated */
-	long	kb_totalfree;	/* # of free elements in this bucket */
-	long	kb_elmpercl;	/* # of elements in this sized allocation */
 	long	kb_highwat;	/* high water mark */
 	long	kb_couldfree;	/* over high water mark and could free */
 };


Add type definitions for prgregset_t and psaddr_t. Both are used by the proc services API. The prfpregset_t type already existed.

--- sys/sys/procfs.h
+++ sys/sys/procfs.h
@@ -65,6 +65,7 @@
     gregset_t	pr_reg;		/* General purpose registers (1) */
 } prstatus_t;

+typedef gregset_t prgregset_t;
 typedef fpregset_t prfpregset_t;

 #define PRFNAMESZ	16	/* Maximum command length saved */
@@ -79,4 +80,6 @@
     char	pr_psargs[PRARGSZ+1];	/* Arguments, null terminated (1) */
 } prpsinfo_t;

+typedef void *psaddr_t;		/* An address in the target process. */
+
 #endif /* _SYS_PROCFS_H_ */


sysctl_all takes no arguments for now

sysctl_all takes no arguments for now

--- sysctl/_sysctl.c
+++ sysctl/_sysctl.c
@@ -17,7 +17,7 @@

 static int Sysctl_init(Sysctl *self, PyObject *args, PyObject *kwds) {

-	PyObject *name=NULL, *value=NULL, *writable=NULL, *tmp;
+	PyObject *name=NULL, *value=NULL, *tmp;
 	static char *kwlist[] = {"name", "value", "writable", "tuneable", NULL};
 	if (! PyArg_ParseTupleAndKeywords(args, kwds, "OO|OO", kwlist, &name, &value, &self->writable, &self->tuneable))
 		return -1;
@@ -178,14 +178,11 @@

 }

-static PyObject* sysctl_all(PyObject* self, PyObject* args) {
+static PyObject* sysctl_all(PyObject* self) {

 	int name1[22], name2[22], i, j, *oid = NULL, len = 0;
 	size_t l1, l2;
 	PyObject *list;
-
-	if(!PyArg_ParseTuple(args, "I", &len))
-		return NULL;

 	list = PyList_New(0);

@@ -230,7 +227,7 @@
 }

 static PyMethodDef SysctlMethods[] = {
-	{"sysctl_all", (PyCFunction) sysctl_all, METH_VARARGS, "Sysctl all"},
+	{"sysctl_all", (PyCFunction) sysctl_all, METH_NOARGS, "Sysctl all"},
 	{NULL, NULL, 0, NULL}        /* Sentinel */
 };


systest: In memory test, round Zorro III region boundaries to nearest 1MB. Fixes #6

--- systest/memory.c
+++ systest/memory.c
@@ -10,6 +10,28 @@
  */

 #include "systest.h"
+
+static uint32_t lb(uint32_t _lb)
+{
+    /* Round down to 64kB boundary. */
+    uint32_t lb = _lb & ~0xffff;
+    if (_lb > 0x10000000) {
+        /* ZorroIII: Round to nearest 1MB (issue #6). */
+        lb = (_lb + 0x7ffff) & ~0xfffff;
+    }
+    return lb;
+}
+
+static uint32_t ub(uint32_t _ub)
+{
+    /* Round up to 64kB boundary. */
+    uint32_t ub = (_ub + 0xffff) & ~0xffff;
+    if (_ub > 0x10000000) {
+        /* ZorroIII: Round to nearest 1MB (issue #6). */
+        ub = (_ub + 0x7ffff) & ~0xfffff;
+    }
+    return ub;
+}

 static inline __attribute__((always_inline)) uint32_t lfsr(uint32_t x)
 {
@@ -552,8 +574,8 @@

     /* Calculate inclusive range [a,b] with limits expanded to 64kB alignment
      * (Kickstart sometimes steals RAM from the limits). */
-    a = mem_region[i].lower & ~0xffff;
-    b = ((mem_region[i].upper + 0xffff) & ~0xffff) - 1;
+    a = lb(mem_region[i].lower);
+    b = ub(mem_region[i].upper) - 1;

     clear_whole_screen();
     print_menu_nav_line();
@@ -665,8 +687,8 @@
         r.x = 0;
         r.y = 3;
         for (i = base; (i < nr_mem_regions) && (i < base+8); i++) {
-            a = mem_region[i].lower & ~0xffff;
-            b = (mem_region[i].upper + 0xffff) & ~0xffff;
+            a = lb(mem_region[i].lower);
+            b = ub(mem_region[i].upper);
             sprintf(s, "$%u %2u  %08x - %08x  %s  %3u.%u MB$",
                     i-base+1, i, a, b-1,
                     mem_region[i].attr & 2 ? "Chip" :
@@ -738,8 +760,8 @@
         for (i = 0; !do_exit && (i < nr_mem_regions); i++) {
             /* Calculate inclusive range [a,b] with limits expanded to 64kB
              * alignment (Kickstart sometimes steals RAM from the limits). */
-            a = max_t(uint32_t, 0x40000, mem_region[i].lower & ~0xffff);
-            b = ((mem_region[i].upper + 0xffff) & ~0xffff) - 1;
+            a = max_t(uint32_t, 0x40000, lb(mem_region[i].lower));
+            b = ub(mem_region[i].upper) - 1;
             tm_args.start = a;
             while (!do_exit && (keycode_buffer != K_ESC)
                    && tm_args.start && (tm_args.start < b)) {
@@ -782,8 +804,8 @@

         chip = fast = slow = 0;
         for (i = 0; i < nr_mem_regions; i++) {
-            a = mem_region[i].lower & ~0xffff;
-            b = (mem_region[i].upper + 0xffff) & ~ 0xffff;
+            a = lb(mem_region[i].lower);
+            b = ub(mem_region[i].upper);
             if (mem_region[i].attr & 2)
                 chip += b-a;
             else if ((a >= 0x00c00000) && (a < 0x00d00000))