[linux-next] LinuxNextTracking branch, master, updated. next-20111208

batman at open-mesh.org batman at open-mesh.org
Fri Dec 9 00:17:27 CET 2011


The following commit has been merged in the master branch:
commit 74d61492776c73bc61f1694222bfc0224938ac5b
Merge: fa412c8c0ad919a4f584ab2a018f8a4faed3c873 f33f1fccbf67b3d9b310a4b09114b7c670320ad4
Author: Stephen Rothwell <sfr at canb.auug.org.au>
Date:   Thu Dec 8 12:46:50 2011 +1100

    Merge remote-tracking branch 'net-next/master'
    
    Conflicts:
    	drivers/net/ethernet/freescale/fsl_pq_mdio.c

diff --combined MAINTAINERS
index 3cae547,209ad06..de60110
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@@ -749,7 -749,6 +749,7 @@@ M:	Barry Song <baohua.song at csr.com
  L:	linux-arm-kernel at lists.infradead.org (moderated for non-subscribers)
  S:	Maintained
  F:	arch/arm/mach-prima2/
 +F:	drivers/dma/sirf-dma*
  
  ARM/EBSA110 MACHINE SUPPORT
  M:	Russell King <linux at arm.linux.org.uk>
@@@ -1055,18 -1054,35 +1055,18 @@@ ARM/SAMSUNG ARM ARCHITECTURE
  M:	Ben Dooks <ben-linux at fluff.org>
  M:	Kukjin Kim <kgene.kim at samsung.com>
  L:	linux-arm-kernel at lists.infradead.org (moderated for non-subscribers)
 +L:	linux-samsung-soc at vger.kernel.org (moderated for non-subscribers)
  W:	http://www.fluff.org/ben/linux/
  S:	Maintained
  F:	arch/arm/plat-samsung/
  F:	arch/arm/plat-s3c24xx/
  F:	arch/arm/plat-s5p/
 +F:	arch/arm/mach-s3c24*/
 +F:	arch/arm/mach-s3c64xx/
  F:	drivers/*/*s3c2410*
  F:	drivers/*/*/*s3c2410*
 -
 -ARM/S3C2410 ARM ARCHITECTURE
 -M:	Ben Dooks <ben-linux at fluff.org>
 -L:	linux-arm-kernel at lists.infradead.org (moderated for non-subscribers)
 -W:	http://www.fluff.org/ben/linux/
 -S:	Maintained
 -F:	arch/arm/mach-s3c2410/
 -
 -ARM/S3C244x ARM ARCHITECTURE
 -M:	Ben Dooks <ben-linux at fluff.org>
 -L:	linux-arm-kernel at lists.infradead.org (moderated for non-subscribers)
 -W:	http://www.fluff.org/ben/linux/
 -S:	Maintained
 -F:	arch/arm/mach-s3c2440/
 -F:	arch/arm/mach-s3c2443/
 -
 -ARM/S3C64xx ARM ARCHITECTURE
 -M:	Ben Dooks <ben-linux at fluff.org>
 -L:	linux-arm-kernel at lists.infradead.org (moderated for non-subscribers)
 -W:	http://www.fluff.org/ben/linux/
 -S:	Maintained
 -F:	arch/arm/mach-s3c64xx/
 +F:	drivers/spi/spi-s3c*
 +F:	sound/soc/samsung/*
  
  ARM/S5P EXYNOS ARM ARCHITECTURES
  M:	Kukjin Kim <kgene.kim at samsung.com>
@@@ -1662,14 -1678,6 +1662,14 @@@ T:	git git://git.alsa-project.org/alsa-
  S:	Maintained
  F:	sound/pci/oxygen/
  
 +C6X ARCHITECTURE
 +M:	Mark Salter <msalter at redhat.com>
 +M:	Aurelien Jacquiot <a-jacquiot at ti.com>
 +L:	linux-c6x-dev at linux-c6x.org
 +W:	http://www.linux-c6x.org/wiki/index.php/Main_Page
 +S:	Maintained
 +F:	arch/c6x/
 +
  CACHEFILES: FS-CACHE BACKEND FOR CACHING ON MOUNTED FILESYSTEMS
  M:	David Howells <dhowells at redhat.com>
  L:	linux-cachefs at redhat.com
@@@ -2846,14 -2854,6 +2846,14 @@@ L:	platform-driver-x86 at vger.kernel.or
  S:	Maintained
  F:	drivers/platform/x86/fujitsu-laptop.c
  
 +FUJITSU M-5MO LS CAMERA ISP DRIVER
 +M:	Kyungmin Park <kyungmin.park at samsung.com>
 +M:	Heungjun Kim <riverful.kim at samsung.com>
 +L:	linux-media at vger.kernel.org
 +S:	Maintained
 +F:	drivers/media/video/m5mols/
 +F:	include/media/m5mols.h
 +
  FUSE: FILESYSTEM IN USERSPACE
  M:	Miklos Szeredi <miklos at szeredi.hu>
  L:	fuse-devel at lists.sourceforge.net
@@@ -3796,6 -3796,7 +3796,6 @@@ S:	Odd Fixe
  
  KERNEL NFSD, SUNRPC, AND LOCKD SERVERS
  M:	"J. Bruce Fields" <bfields at fieldses.org>
 -M:	Neil Brown <neilb at suse.de>
  L:	linux-nfs at vger.kernel.org
  W:	http://nfs.sourceforge.net/
  S:	Supported
@@@ -4027,7 -4028,7 +4027,7 @@@ M:	Josh Boyer <jwboyer at gmail.com
  M:	Matt Porter <mporter at kernel.crashing.org>
  W:	http://www.penguinppc.org/
  L:	linuxppc-dev at lists.ozlabs.org
 -T:	git git://git.kernel.org/pub/scm/linux/kernel/git/jwboyer/powerpc-4xx.git
 +T:	git git://git.infradead.org/users/jwboyer/powerpc-4xx.git
  S:	Maintained
  F:	arch/powerpc/platforms/40x/
  F:	arch/powerpc/platforms/44x/
@@@ -4131,7 -4132,6 +4131,7 @@@ F:	fs/partitions/ldm.
  
  LogFS
  M:	Joern Engel <joern at logfs.org>
 +M:	Prasad Joshi <prasadjoshi.linux at gmail.com>
  L:	logfs at logfs.org
  W:	logfs.org
  S:	Maintained
@@@ -4297,9 -4297,7 +4297,9 @@@ T:	git git://git.kernel.org/pub/scm/lin
  S:	Maintained
  F:	Documentation/dvb/
  F:	Documentation/video4linux/
 +F:	Documentation/DocBook/media/
  F:	drivers/media/
 +F:	drivers/staging/media/
  F:	include/media/
  F:	include/linux/dvb/
  F:	include/linux/videodev*.h
@@@ -4870,6 -4868,14 +4870,14 @@@ S:	Maintaine
  T:	git git://openrisc.net/~jonas/linux
  F:	arch/openrisc
  
+ OPENVSWITCH
+ M:	Jesse Gross <jesse at nicira.com>
+ L:	dev at openvswitch.org
+ W:	http://openvswitch.org
+ T:	git git://git.kernel.org/pub/scm/linux/kernel/git/jesse/openvswitch.git
+ S:	Maintained
+ F:	net/openvswitch/
+ 
  OPL4 DRIVER
  M:	Clemens Ladisch <clemens at ladisch.de>
  L:	alsa-devel at alsa-project.org (moderated for non-subscribers)
@@@ -6512,6 -6518,13 +6520,13 @@@ W:	http://tcp-lp-mod.sourceforge.net
  S:	Maintained
  F:	net/ipv4/tcp_lp.c
  
+ TEAM DRIVER
+ M:	Jiri Pirko <jpirko at redhat.com>
+ L:	netdev at vger.kernel.org
+ S:	Supported
+ F:	drivers/net/team/
+ F:	include/linux/if_team.h
+ 
  TEGRA SUPPORT
  M:	Colin Cross <ccross at android.com>
  M:	Olof Johansson <olof at lixom.net>
diff --combined drivers/bluetooth/btusb.c
index eabc437,2bd87d4..ea5ad1c
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@@ -315,7 -315,8 +315,8 @@@ static int btusb_submit_intr_urb(struc
  
  	err = usb_submit_urb(urb, mem_flags);
  	if (err < 0) {
- 		BT_ERR("%s urb %p submission failed (%d)",
+ 		if (err != -EPERM && err != -ENODEV)
+ 			BT_ERR("%s urb %p submission failed (%d)",
  						hdev->name, urb, -err);
  		usb_unanchor_urb(urb);
  	}
@@@ -400,7 -401,8 +401,8 @@@ static int btusb_submit_bulk_urb(struc
  
  	err = usb_submit_urb(urb, mem_flags);
  	if (err < 0) {
- 		BT_ERR("%s urb %p submission failed (%d)",
+ 		if (err != -EPERM && err != -ENODEV)
+ 			BT_ERR("%s urb %p submission failed (%d)",
  						hdev->name, urb, -err);
  		usb_unanchor_urb(urb);
  	}
@@@ -523,7 -525,8 +525,8 @@@ static int btusb_submit_isoc_urb(struc
  
  	err = usb_submit_urb(urb, mem_flags);
  	if (err < 0) {
- 		BT_ERR("%s urb %p submission failed (%d)",
+ 		if (err != -EPERM && err != -ENODEV)
+ 			BT_ERR("%s urb %p submission failed (%d)",
  						hdev->name, urb, -err);
  		usb_unanchor_urb(urb);
  	}
@@@ -727,6 -730,9 +730,9 @@@ static int btusb_send_frame(struct sk_b
  		usb_fill_bulk_urb(urb, data->udev, pipe,
  				skb->data, skb->len, btusb_tx_complete, skb);
  
+ 		if (skb->priority >= HCI_PRIO_MAX - 1)
+ 			urb->transfer_flags  = URB_ISO_ASAP;
+ 
  		hdev->stat.acl_tx++;
  		break;
  
@@@ -770,15 -776,18 +776,17 @@@ skip_waking
  
  	err = usb_submit_urb(urb, GFP_ATOMIC);
  	if (err < 0) {
- 		BT_ERR("%s urb %p submission failed", hdev->name, urb);
+ 		if (err != -EPERM && err != -ENODEV)
+ 			BT_ERR("%s urb %p submission failed (%d)",
+ 						hdev->name, urb, -err);
  		kfree(urb->setup_packet);
  		usb_unanchor_urb(urb);
  	} else {
  		usb_mark_last_busy(data->udev);
  	}
  
 -	usb_free_urb(urb);
 -
  done:
 +	usb_free_urb(urb);
  	return err;
  }
  
diff --combined drivers/net/ethernet/Makefile
index 94b7f28,cd6d69a..08d5f03
--- a/drivers/net/ethernet/Makefile
+++ b/drivers/net/ethernet/Makefile
@@@ -10,10 -10,11 +10,11 @@@ obj-$(CONFIG_NET_VENDOR_ALTEON) += alte
  obj-$(CONFIG_NET_VENDOR_AMD) += amd/
  obj-$(CONFIG_NET_VENDOR_APPLE) += apple/
  obj-$(CONFIG_NET_VENDOR_ATHEROS) += atheros/
 -obj-$(CONFIG_NET_ATMEL) += cadence/
 +obj-$(CONFIG_NET_CADENCE) += cadence/
  obj-$(CONFIG_NET_BFIN) += adi/
  obj-$(CONFIG_NET_VENDOR_BROADCOM) += broadcom/
  obj-$(CONFIG_NET_VENDOR_BROCADE) += brocade/
+ obj-$(CONFIG_NET_CALXEDA_XGMAC) += calxeda/
  obj-$(CONFIG_NET_VENDOR_CHELSIO) += chelsio/
  obj-$(CONFIG_NET_VENDOR_CIRRUS) += cirrus/
  obj-$(CONFIG_NET_VENDOR_CISCO) += cisco/
diff --combined drivers/net/ethernet/micrel/ks8842.c
index de9f2e2,75ec87a..0a85690
--- a/drivers/net/ethernet/micrel/ks8842.c
+++ b/drivers/net/ethernet/micrel/ks8842.c
@@@ -459,7 -459,7 +459,7 @@@ static int ks8842_tx_frame_dma(struct s
  		sg_dma_len(&ctl->sg) += 4 - sg_dma_len(&ctl->sg) % 4;
  
  	ctl->adesc = ctl->chan->device->device_prep_slave_sg(ctl->chan,
 -		&ctl->sg, 1, DMA_TO_DEVICE,
 +		&ctl->sg, 1, DMA_MEM_TO_DEV,
  		DMA_PREP_INTERRUPT | DMA_COMPL_SKIP_SRC_UNMAP);
  	if (!ctl->adesc)
  		return NETDEV_TX_BUSY;
@@@ -571,7 -571,7 +571,7 @@@ static int __ks8842_start_new_rx_dma(st
  		sg_dma_len(sg) = DMA_BUFFER_SIZE;
  
  		ctl->adesc = ctl->chan->device->device_prep_slave_sg(ctl->chan,
 -			sg, 1, DMA_FROM_DEVICE,
 +			sg, 1, DMA_DEV_TO_MEM,
  			DMA_PREP_INTERRUPT | DMA_COMPL_SKIP_SRC_UNMAP);
  
  		if (!ctl->adesc)
@@@ -1264,18 -1264,7 +1264,7 @@@ static struct platform_driver ks8842_pl
  	.remove		= ks8842_remove,
  };
  
- static int __init ks8842_init(void)
- {
- 	return platform_driver_register(&ks8842_platform_driver);
- }
- 
- static void __exit ks8842_exit(void)
- {
- 	platform_driver_unregister(&ks8842_platform_driver);
- }
- 
- module_init(ks8842_init);
- module_exit(ks8842_exit);
+ module_platform_driver(ks8842_platform_driver);
  
  MODULE_DESCRIPTION("Timberdale KS8842 ethernet driver");
  MODULE_AUTHOR("Mocean Laboratories <info at mocean-labs.com>");
diff --combined drivers/net/ppp/pptp.c
index f8a6853,ede899c..c1c9293
--- a/drivers/net/ppp/pptp.c
+++ b/drivers/net/ppp/pptp.c
@@@ -162,7 -162,7 +162,7 @@@ static void del_chan(struct pppox_sock 
  {
  	spin_lock(&chan_lock);
  	clear_bit(sock->proto.pptp.src_addr.call_id, callid_bitmap);
- 	rcu_assign_pointer(callid_sock[sock->proto.pptp.src_addr.call_id], NULL);
+ 	RCU_INIT_POINTER(callid_sock[sock->proto.pptp.src_addr.call_id], NULL);
  	spin_unlock(&chan_lock);
  	synchronize_rcu();
  }
@@@ -423,8 -423,10 +423,8 @@@ static int pptp_bind(struct socket *soc
  	lock_sock(sk);
  
  	opt->src_addr = sp->sa_addr.pptp;
 -	if (add_chan(po)) {
 -		release_sock(sk);
 +	if (add_chan(po))
  		error = -EBUSY;
 -	}
  
  	release_sock(sk);
  	return error;
diff --combined drivers/net/wireless/ath/ath9k/main.c
index d2348a5,fd59c1f..424289f
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@@ -286,7 -286,7 +286,7 @@@ static bool ath_complete_reset(struct a
  			ath_start_ani(common);
  	}
  
 -	if (ath9k_hw_ops(ah)->antdiv_comb_conf_get && sc->ant_rx != 3) {
 +	if ((ah->caps.hw_caps & ATH9K_HW_CAP_ANT_DIV_COMB) && sc->ant_rx != 3) {
  		struct ath_hw_antcomb_conf div_ant_conf;
  		u8 lna_conf;
  
@@@ -630,7 -630,8 +630,8 @@@ set_timer
  	}
  }
  
- static void ath_node_attach(struct ath_softc *sc, struct ieee80211_sta *sta)
+ static void ath_node_attach(struct ath_softc *sc, struct ieee80211_sta *sta,
+ 			    struct ieee80211_vif *vif)
  {
  	struct ath_node *an;
  	an = (struct ath_node *)sta->drv_priv;
@@@ -640,6 -641,7 +641,7 @@@
  	list_add(&an->list, &sc->nodes);
  	spin_unlock(&sc->nodes_lock);
  	an->sta = sta;
+ 	an->vif = vif;
  #endif
  	if (sc->sc_flags & SC_OP_TXAGGR) {
  		ath_tx_node_init(sc, an);
@@@ -740,6 -742,9 +742,9 @@@ void ath9k_tasklet(unsigned long data
  		if (status & ATH9K_INT_GENTIMER)
  			ath_gen_timer_isr(sc->sc_ah);
  
+ 	if (status & ATH9K_INT_MCI)
+ 		ath_mci_intr(sc);
+ 
  out:
  	/* re-enable hardware interrupt */
  	ath9k_hw_enable_interrupts(ah);
@@@ -762,7 -767,8 +767,8 @@@ irqreturn_t ath_isr(int irq, void *dev
  		ATH9K_INT_BMISS |		\
  		ATH9K_INT_CST |			\
  		ATH9K_INT_TSFOOR |		\
- 		ATH9K_INT_GENTIMER)
+ 		ATH9K_INT_GENTIMER |		\
+ 		ATH9K_INT_MCI)
  
  	struct ath_softc *sc = dev;
  	struct ath_hw *ah = sc->sc_ah;
@@@ -1117,6 -1123,9 +1123,9 @@@ static int ath9k_start(struct ieee80211
  	if (ah->caps.hw_caps & ATH9K_HW_CAP_HT)
  		ah->imask |= ATH9K_INT_CST;
  
+ 	if (ah->caps.hw_caps & ATH9K_HW_CAP_MCI)
+ 		ah->imask |= ATH9K_INT_MCI;
+ 
  	sc->sc_flags &= ~SC_OP_INVALID;
  	sc->sc_ah->is_monitoring = false;
  
@@@ -1133,8 -1142,9 +1142,9 @@@
  
  	if ((ah->btcoex_hw.scheme != ATH_BTCOEX_CFG_NONE) &&
  	    !ah->btcoex_hw.enabled) {
- 		ath9k_hw_btcoex_set_weight(ah, AR_BT_COEX_WGHT,
- 					   AR_STOMP_LOW_WLAN_WGHT);
+ 		if (!(sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_MCI))
+ 			ath9k_hw_btcoex_set_weight(ah, AR_BT_COEX_WGHT,
+ 						   AR_STOMP_LOW_WLAN_WGHT);
  		ath9k_hw_btcoex_enable(ah);
  
  		if (ah->btcoex_hw.scheme == ATH_BTCOEX_CFG_3WIRE)
@@@ -1237,6 -1247,7 +1247,7 @@@ static void ath9k_stop(struct ieee80211
  		ath9k_hw_btcoex_disable(ah);
  		if (ah->btcoex_hw.scheme == ATH_BTCOEX_CFG_3WIRE)
  			ath9k_btcoex_timer_pause(sc);
+ 		ath_mci_flush_profile(&sc->btcoex.mci);
  	}
  
  	spin_lock_bh(&sc->sc_pcu_lock);
@@@ -1798,7 -1809,7 +1809,7 @@@ static int ath9k_sta_add(struct ieee802
  	struct ath_node *an = (struct ath_node *) sta->drv_priv;
  	struct ieee80211_key_conf ps_key = { };
  
- 	ath_node_attach(sc, sta);
+ 	ath_node_attach(sc, sta, vif);
  
  	if (vif->type != NL80211_IFTYPE_AP &&
  	    vif->type != NL80211_IFTYPE_AP_VLAN)
diff --combined net/batman-adv/translation-table.c
index 5f09a57,78b9528..1f7834d
--- a/net/batman-adv/translation-table.c
+++ b/net/batman-adv/translation-table.c
@@@ -67,7 -67,7 +67,7 @@@ static struct tt_local_entry *tt_local_
  	struct hlist_head *head;
  	struct hlist_node *node;
  	struct tt_local_entry *tt_local_entry, *tt_local_entry_tmp = NULL;
- 	int index;
+ 	uint32_t index;
  
  	if (!hash)
  		return NULL;
@@@ -99,7 -99,7 +99,7 @@@ static struct tt_global_entry *tt_globa
  	struct hlist_node *node;
  	struct tt_global_entry *tt_global_entry;
  	struct tt_global_entry *tt_global_entry_tmp = NULL;
- 	int index;
+ 	uint32_t index;
  
  	if (!hash)
  		return NULL;
@@@ -245,11 -245,9 +245,11 @@@ void tt_local_add(struct net_device *so
  	if (tt_global_entry) {
  		/* This node is probably going to update its tt table */
  		tt_global_entry->orig_node->tt_poss_change = true;
 -		/* The global entry has to be marked as PENDING and has to be
 +		/* The global entry has to be marked as ROAMING and has to be
  		 * kept for consistency purpose */
 -		tt_global_entry->flags |= TT_CLIENT_PENDING;
 +		tt_global_entry->flags |= TT_CLIENT_ROAM;
 +		tt_global_entry->roam_at = jiffies;
 +
  		send_roam_adv(bat_priv, tt_global_entry->addr,
  			      tt_global_entry->orig_node);
  	}
@@@ -316,9 -314,8 +316,8 @@@ int tt_local_seq_print_text(struct seq_
  	struct hard_iface *primary_if;
  	struct hlist_node *node;
  	struct hlist_head *head;
- 	size_t buf_size, pos;
- 	char *buff;
- 	int i, ret = 0;
+ 	uint32_t i;
+ 	int ret = 0;
  
  	primary_if = primary_if_get_selected(bat_priv);
  	if (!primary_if) {
@@@ -339,34 -336,13 +338,13 @@@
  		   "announced via TT (TTVN: %u):\n",
  		   net_dev->name, (uint8_t)atomic_read(&bat_priv->ttvn));
  
- 	buf_size = 1;
- 	/* Estimate length for: " * xx:xx:xx:xx:xx:xx\n" */
- 	for (i = 0; i < hash->size; i++) {
- 		head = &hash->table[i];
- 
- 		rcu_read_lock();
- 		__hlist_for_each_rcu(node, head)
- 			buf_size += 29;
- 		rcu_read_unlock();
- 	}
- 
- 	buff = kmalloc(buf_size, GFP_ATOMIC);
- 	if (!buff) {
- 		ret = -ENOMEM;
- 		goto out;
- 	}
- 
- 	buff[0] = '\0';
- 	pos = 0;
- 
  	for (i = 0; i < hash->size; i++) {
  		head = &hash->table[i];
  
  		rcu_read_lock();
  		hlist_for_each_entry_rcu(tt_local_entry, node,
  					 head, hash_entry) {
- 			pos += snprintf(buff + pos, 30, " * %pM "
- 					"[%c%c%c%c%c]\n",
+ 			seq_printf(seq, " * %pM [%c%c%c%c%c]\n",
  					tt_local_entry->addr,
  					(tt_local_entry->flags &
  					 TT_CLIENT_ROAM ? 'R' : '.'),
@@@ -381,9 -357,6 +359,6 @@@
  		}
  		rcu_read_unlock();
  	}
- 
- 	seq_printf(seq, "%s", buff);
- 	kfree(buff);
  out:
  	if (primary_if)
  		hardif_free_ref(primary_if);
@@@ -429,7 -402,7 +404,7 @@@ static void tt_local_purge(struct bat_p
  	struct hlist_node *node, *node_tmp;
  	struct hlist_head *head;
  	spinlock_t *list_lock; /* protects write access to the hash lists */
- 	int i;
+ 	uint32_t i;
  
  	for (i = 0; i < hash->size; i++) {
  		head = &hash->table[i];
@@@ -467,7 -440,7 +442,7 @@@ static void tt_local_table_free(struct 
  	struct tt_local_entry *tt_local_entry;
  	struct hlist_node *node, *node_tmp;
  	struct hlist_head *head;
- 	int i;
+ 	uint32_t i;
  
  	if (!bat_priv->tt_local_hash)
  		return;
@@@ -592,9 -565,8 +567,8 @@@ int tt_global_seq_print_text(struct seq
  	struct hard_iface *primary_if;
  	struct hlist_node *node;
  	struct hlist_head *head;
- 	size_t buf_size, pos;
- 	char *buff;
- 	int i, ret = 0;
+ 	uint32_t i;
+ 	int ret = 0;
  
  	primary_if = primary_if_get_selected(bat_priv);
  	if (!primary_if) {
@@@ -617,35 -589,13 +591,13 @@@
  	seq_printf(seq, "       %-13s %s       %-15s %s %s\n",
  		   "Client", "(TTVN)", "Originator", "(Curr TTVN)", "Flags");
  
- 	buf_size = 1;
- 	/* Estimate length for: " * xx:xx:xx:xx:xx:xx (ttvn) via
- 	 * xx:xx:xx:xx:xx:xx (cur_ttvn)\n"*/
- 	for (i = 0; i < hash->size; i++) {
- 		head = &hash->table[i];
- 
- 		rcu_read_lock();
- 		__hlist_for_each_rcu(node, head)
- 			buf_size += 67;
- 		rcu_read_unlock();
- 	}
- 
- 	buff = kmalloc(buf_size, GFP_ATOMIC);
- 	if (!buff) {
- 		ret = -ENOMEM;
- 		goto out;
- 	}
- 
- 	buff[0] = '\0';
- 	pos = 0;
- 
  	for (i = 0; i < hash->size; i++) {
  		head = &hash->table[i];
  
  		rcu_read_lock();
  		hlist_for_each_entry_rcu(tt_global_entry, node,
  					 head, hash_entry) {
- 			pos += snprintf(buff + pos, 69,
- 					" * %pM  (%3u) via %pM     (%3u)   "
+ 			seq_printf(seq, " * %pM  (%3u) via %pM     (%3u)   "
  					"[%c%c%c]\n", tt_global_entry->addr,
  					tt_global_entry->ttvn,
  					tt_global_entry->orig_node->orig,
@@@ -661,9 -611,6 +613,6 @@@
  		}
  		rcu_read_unlock();
  	}
- 
- 	seq_printf(seq, "%s", buff);
- 	kfree(buff);
  out:
  	if (primary_if)
  		hardif_free_ref(primary_if);
@@@ -696,7 -643,6 +645,7 @@@ void tt_global_del(struct bat_priv *bat
  		   const char *message, bool roaming)
  {
  	struct tt_global_entry *tt_global_entry = NULL;
 +	struct tt_local_entry *tt_local_entry = NULL;
  
  	tt_global_entry = tt_global_hash_find(bat_priv, addr);
  	if (!tt_global_entry)
@@@ -704,36 -650,22 +653,36 @@@
  
  	if (tt_global_entry->orig_node == orig_node) {
  		if (roaming) {
 -			tt_global_entry->flags |= TT_CLIENT_ROAM;
 -			tt_global_entry->roam_at = jiffies;
 -			goto out;
 +			/* if we are deleting a global entry due to a roam
 +			 * event, there are two possibilities:
 +			 * 1) the client roamed from node A to node B => we mark
 +			 *    it with TT_CLIENT_ROAM, we start a timer and we
 +			 *    wait for node B to claim it. In case of timeout
 +			 *    the entry is purged.
 +			 * 2) the client roamed to us => we can directly delete
 +			 *    the global entry, since it is useless now. */
 +			tt_local_entry = tt_local_hash_find(bat_priv,
 +							tt_global_entry->addr);
 +			if (!tt_local_entry) {
 +				tt_global_entry->flags |= TT_CLIENT_ROAM;
 +				tt_global_entry->roam_at = jiffies;
 +				goto out;
 +			}
  		}
  		_tt_global_del(bat_priv, tt_global_entry, message);
  	}
  out:
  	if (tt_global_entry)
  		tt_global_entry_free_ref(tt_global_entry);
 +	if (tt_local_entry)
 +		tt_local_entry_free_ref(tt_local_entry);
  }
  
  void tt_global_del_orig(struct bat_priv *bat_priv,
  			struct orig_node *orig_node, const char *message)
  {
  	struct tt_global_entry *tt_global_entry;
- 	int i;
+ 	uint32_t i;
  	struct hashtable_t *hash = bat_priv->tt_global_hash;
  	struct hlist_node *node, *safe;
  	struct hlist_head *head;
@@@ -752,9 -684,10 +701,10 @@@
  			if (tt_global_entry->orig_node == orig_node) {
  				bat_dbg(DBG_TT, bat_priv,
  					"Deleting global tt entry %pM "
- 					"(via %pM): originator time out\n",
+ 					"(via %pM): %s\n",
  					tt_global_entry->addr,
- 					tt_global_entry->orig_node->orig);
+ 					tt_global_entry->orig_node->orig,
+ 					message);
  				hlist_del_rcu(node);
  				tt_global_entry_free_ref(tt_global_entry);
  			}
@@@ -771,7 -704,7 +721,7 @@@ static void tt_global_roam_purge(struc
  	struct hlist_node *node, *node_tmp;
  	struct hlist_head *head;
  	spinlock_t *list_lock; /* protects write access to the hash lists */
- 	int i;
+ 	uint32_t i;
  
  	for (i = 0; i < hash->size; i++) {
  		head = &hash->table[i];
@@@ -805,7 -738,7 +755,7 @@@ static void tt_global_table_free(struc
  	struct tt_global_entry *tt_global_entry;
  	struct hlist_node *node, *node_tmp;
  	struct hlist_head *head;
- 	int i;
+ 	uint32_t i;
  
  	if (!bat_priv->tt_global_hash)
  		return;
@@@ -891,7 -824,8 +841,8 @@@ uint16_t tt_global_crc(struct bat_priv 
  	struct tt_global_entry *tt_global_entry;
  	struct hlist_node *node;
  	struct hlist_head *head;
- 	int i, j;
+ 	uint32_t i;
+ 	int j;
  
  	for (i = 0; i < hash->size; i++) {
  		head = &hash->table[i];
@@@ -928,7 -862,8 +879,8 @@@ uint16_t tt_local_crc(struct bat_priv *
  	struct tt_local_entry *tt_local_entry;
  	struct hlist_node *node;
  	struct hlist_head *head;
- 	int i, j;
+ 	uint32_t i;
+ 	int j;
  
  	for (i = 0; i < hash->size; i++) {
  		head = &hash->table[i];
@@@ -1065,7 -1000,7 +1017,7 @@@ static struct sk_buff *tt_response_fill
  	struct sk_buff *skb = NULL;
  	uint16_t tt_tot, tt_count;
  	ssize_t tt_query_size = sizeof(struct tt_query_packet);
- 	int i;
+ 	uint32_t i;
  
  	if (tt_query_size + tt_len > primary_if->soft_iface->mtu) {
  		tt_len = primary_if->soft_iface->mtu - tt_query_size;
@@@ -1204,11 -1139,11 +1156,11 @@@ static bool send_other_tt_response(stru
  		(tt_request->flags & TT_FULL_TABLE ? 'F' : '.'));
  
  	/* Let's get the orig node of the REAL destination */
- 	req_dst_orig_node = get_orig_node(bat_priv, tt_request->dst);
+ 	req_dst_orig_node = orig_hash_find(bat_priv, tt_request->dst);
  	if (!req_dst_orig_node)
  		goto out;
  
- 	res_dst_orig_node = get_orig_node(bat_priv, tt_request->src);
+ 	res_dst_orig_node = orig_hash_find(bat_priv, tt_request->src);
  	if (!res_dst_orig_node)
  		goto out;
  
@@@ -1334,7 -1269,7 +1286,7 @@@ static bool send_my_tt_response(struct 
  	my_ttvn = (uint8_t)atomic_read(&bat_priv->ttvn);
  	req_ttvn = tt_request->ttvn;
  
- 	orig_node = get_orig_node(bat_priv, tt_request->src);
+ 	orig_node = orig_hash_find(bat_priv, tt_request->src);
  	if (!orig_node)
  		goto out;
  
@@@ -1742,7 -1677,7 +1694,7 @@@ void tt_free(struct bat_priv *bat_priv
   * entry */
  static void tt_local_reset_flags(struct bat_priv *bat_priv, uint16_t flags)
  {
- 	int i;
+ 	uint32_t i;
  	struct hashtable_t *hash = bat_priv->tt_local_hash;
  	struct hlist_head *head;
  	struct hlist_node *node;
@@@ -1775,7 -1710,7 +1727,7 @@@ static void tt_local_purge_pending_clie
  	struct hlist_node *node, *node_tmp;
  	struct hlist_head *head;
  	spinlock_t *list_lock; /* protects write access to the hash lists */
- 	int i;
+ 	uint32_t i;
  
  	if (!hash)
  		return;
diff --combined net/bluetooth/bnep/core.c
index 1eea820,a6cd856..42d53b8
--- a/net/bluetooth/bnep/core.c
+++ b/net/bluetooth/bnep/core.c
@@@ -65,26 -65,29 +65,24 @@@ static DECLARE_RWSEM(bnep_session_sem)
  static struct bnep_session *__bnep_get_session(u8 *dst)
  {
  	struct bnep_session *s;
  
  	BT_DBG("");
  
- 	list_for_each(p, &bnep_session_list) {
- 		s = list_entry(p, struct bnep_session, list);
+ 	list_for_each_entry(s, &bnep_session_list, list)
  		if (!compare_ether_addr(dst, s->eh.h_source))
  			return s;
- 	}
+ 
  	return NULL;
  }
  
  static void __bnep_link_session(struct bnep_session *s)
  {
 -	/* It's safe to call __module_get() here because sessions are added
 -	   by the socket layer which has to hold the reference to this module.
 -	 */
 -	__module_get(THIS_MODULE);
  	list_add(&s->list, &bnep_session_list);
  }
  
  static void __bnep_unlink_session(struct bnep_session *s)
  {
  	list_del(&s->list);
 -	module_put(THIS_MODULE);
  }
  
  static int bnep_send(struct bnep_session *s, void *data, size_t len)
@@@ -525,7 -528,6 +523,7 @@@ static int bnep_session(void *arg
  
  	up_write(&bnep_session_sem);
  	free_netdev(dev);
 +	module_put_and_exit(0);
  	return 0;
  }
  
@@@ -612,11 -614,9 +610,11 @@@ int bnep_add_connection(struct bnep_con
  
  	__bnep_link_session(s);
  
 +	__module_get(THIS_MODULE);
  	s->task = kthread_run(bnep_session, s, "kbnepd %s", dev->name);
  	if (IS_ERR(s->task)) {
  		/* Session thread start failed, gotta cleanup. */
 +		module_put(THIS_MODULE);
  		unregister_netdev(dev);
  		__bnep_unlink_session(s);
  		err = PTR_ERR(s->task);
@@@ -665,17 -665,14 +663,14 @@@ static void __bnep_copy_ci(struct bnep_
  
  int bnep_get_connlist(struct bnep_connlist_req *req)
  {
- 	struct list_head *p;
+ 	struct bnep_session *s;
  	int err = 0, n = 0;
  
  	down_read(&bnep_session_sem);
  
- 	list_for_each(p, &bnep_session_list) {
- 		struct bnep_session *s;
+ 	list_for_each_entry(s, &bnep_session_list, list) {
  		struct bnep_conninfo ci;
  
- 		s = list_entry(p, struct bnep_session, list);
- 
  		__bnep_copy_ci(&ci, s);
  
  		if (copy_to_user(req->ci, &ci, sizeof(ci))) {
diff --combined net/bluetooth/cmtp/core.c
index 5a6e634,9e8940b..6c9c1fd
--- a/net/bluetooth/cmtp/core.c
+++ b/net/bluetooth/cmtp/core.c
@@@ -53,26 -53,26 +53,24 @@@ static LIST_HEAD(cmtp_session_list)
  static struct cmtp_session *__cmtp_get_session(bdaddr_t *bdaddr)
  {
  	struct cmtp_session *session;
  
  	BT_DBG("");
  
- 	list_for_each(p, &cmtp_session_list) {
- 		session = list_entry(p, struct cmtp_session, list);
+ 	list_for_each_entry(session, &cmtp_session_list, list)
  		if (!bacmp(bdaddr, &session->bdaddr))
  			return session;
- 	}
+ 
  	return NULL;
  }
  
  static void __cmtp_link_session(struct cmtp_session *session)
  {
 -	__module_get(THIS_MODULE);
  	list_add(&session->list, &cmtp_session_list);
  }
  
  static void __cmtp_unlink_session(struct cmtp_session *session)
  {
  	list_del(&session->list);
 -	module_put(THIS_MODULE);
  }
  
  static void __cmtp_copy_session(struct cmtp_session *session, struct cmtp_conninfo *ci)
@@@ -325,7 -325,6 +323,7 @@@ static int cmtp_session(void *arg
  	up_write(&cmtp_session_sem);
  
  	kfree(session);
 +	module_put_and_exit(0);
  	return 0;
  }
  
@@@ -375,11 -374,9 +373,11 @@@ int cmtp_add_connection(struct cmtp_con
  
  	__cmtp_link_session(session);
  
 +	__module_get(THIS_MODULE);
  	session->task = kthread_run(cmtp_session, session, "kcmtpd_ctr_%d",
  								session->num);
  	if (IS_ERR(session->task)) {
 +		module_put(THIS_MODULE);
  		err = PTR_ERR(session->task);
  		goto unlink;
  	}
@@@ -432,19 -429,16 +430,16 @@@ int cmtp_del_connection(struct cmtp_con
  
  int cmtp_get_connlist(struct cmtp_connlist_req *req)
  {
- 	struct list_head *p;
+ 	struct cmtp_session *session;
  	int err = 0, n = 0;
  
  	BT_DBG("");
  
  	down_read(&cmtp_session_sem);
  
- 	list_for_each(p, &cmtp_session_list) {
- 		struct cmtp_session *session;
+ 	list_for_each_entry(session, &cmtp_session_list, list) {
  		struct cmtp_conninfo ci;
  
- 		session = list_entry(p, struct cmtp_session, list);
- 
  		__cmtp_copy_session(session, &ci);
  
  		if (copy_to_user(req->ci, &ci, sizeof(ci))) {
diff --combined net/bluetooth/hci_event.c
index 643a41b,a89cf1f..8fd4322
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@@ -58,9 -58,11 +58,11 @@@ static void hci_cc_inquiry_cancel(struc
  	if (status)
  		return;
  
- 	if (test_and_clear_bit(HCI_INQUIRY, &hdev->flags) &&
- 			test_bit(HCI_MGMT, &hdev->flags))
- 		mgmt_discovering(hdev->id, 0);
+ 	clear_bit(HCI_INQUIRY, &hdev->flags);
+ 
+ 	hci_dev_lock(hdev);
+ 	mgmt_discovering(hdev, 0);
+ 	hci_dev_unlock(hdev);
  
  	hci_req_complete(hdev, HCI_OP_INQUIRY_CANCEL, status);
  
@@@ -76,10 -78,6 +78,6 @@@ static void hci_cc_exit_periodic_inq(st
  	if (status)
  		return;
  
- 	if (test_and_clear_bit(HCI_INQUIRY, &hdev->flags) &&
- 				test_bit(HCI_MGMT, &hdev->flags))
- 		mgmt_discovering(hdev->id, 0);
- 
  	hci_conn_check_pending(hdev);
  }
  
@@@ -205,13 -203,15 +203,15 @@@ static void hci_cc_write_local_name(str
  	if (!sent)
  		return;
  
+ 	hci_dev_lock(hdev);
+ 
  	if (test_bit(HCI_MGMT, &hdev->flags))
- 		mgmt_set_local_name_complete(hdev->id, sent, status);
+ 		mgmt_set_local_name_complete(hdev, sent, status);
  
- 	if (status)
- 		return;
+ 	if (status == 0)
+ 		memcpy(hdev->dev_name, sent, HCI_MAX_NAME_LENGTH);
  
- 	memcpy(hdev->dev_name, sent, HCI_MAX_NAME_LENGTH);
+ 	hci_dev_unlock(hdev);
  }
  
  static void hci_cc_read_local_name(struct hci_dev *hdev, struct sk_buff *skb)
@@@ -274,7 -274,8 +274,8 @@@ static void hci_cc_write_encrypt_mode(s
  
  static void hci_cc_write_scan_enable(struct hci_dev *hdev, struct sk_buff *skb)
  {
- 	__u8 status = *((__u8 *) skb->data);
+ 	__u8 param, status = *((__u8 *) skb->data);
+ 	int old_pscan, old_iscan;
  	void *sent;
  
  	BT_DBG("%s status 0x%x", hdev->name, status);
@@@ -283,28 -284,40 +284,40 @@@
  	if (!sent)
  		return;
  
- 	if (!status) {
- 		__u8 param = *((__u8 *) sent);
- 		int old_pscan, old_iscan;
- 
- 		old_pscan = test_and_clear_bit(HCI_PSCAN, &hdev->flags);
- 		old_iscan = test_and_clear_bit(HCI_ISCAN, &hdev->flags);
+ 	param = *((__u8 *) sent);
  
- 		if (param & SCAN_INQUIRY) {
- 			set_bit(HCI_ISCAN, &hdev->flags);
- 			if (!old_iscan)
- 				mgmt_discoverable(hdev->id, 1);
- 		} else if (old_iscan)
- 			mgmt_discoverable(hdev->id, 0);
+ 	hci_dev_lock(hdev);
  
- 		if (param & SCAN_PAGE) {
- 			set_bit(HCI_PSCAN, &hdev->flags);
- 			if (!old_pscan)
- 				mgmt_connectable(hdev->id, 1);
- 		} else if (old_pscan)
- 			mgmt_connectable(hdev->id, 0);
+ 	if (status != 0) {
+ 		mgmt_write_scan_failed(hdev, param, status);
+ 		hdev->discov_timeout = 0;
+ 		goto done;
  	}
  
+ 	old_pscan = test_and_clear_bit(HCI_PSCAN, &hdev->flags);
+ 	old_iscan = test_and_clear_bit(HCI_ISCAN, &hdev->flags);
+ 
+ 	if (param & SCAN_INQUIRY) {
+ 		set_bit(HCI_ISCAN, &hdev->flags);
+ 		if (!old_iscan)
+ 			mgmt_discoverable(hdev, 1);
+ 		if (hdev->discov_timeout > 0) {
+ 			int to = msecs_to_jiffies(hdev->discov_timeout * 1000);
+ 			queue_delayed_work(hdev->workqueue, &hdev->discov_off,
+ 									to);
+ 		}
+ 	} else if (old_iscan)
+ 		mgmt_discoverable(hdev, 0);
+ 
+ 	if (param & SCAN_PAGE) {
+ 		set_bit(HCI_PSCAN, &hdev->flags);
+ 		if (!old_pscan)
+ 			mgmt_connectable(hdev, 1);
+ 	} else if (old_pscan)
+ 		mgmt_connectable(hdev, 0);
+ 
+ done:
+ 	hci_dev_unlock(hdev);
  	hci_req_complete(hdev, HCI_OP_WRITE_SCAN_ENABLE, status);
  }
  
@@@ -545,7 -558,7 +558,7 @@@ static void hci_setup(struct hci_dev *h
  {
  	hci_setup_event_mask(hdev);
  
 -	if (hdev->lmp_ver > 1)
 +	if (hdev->hci_ver > 1)
  		hci_send_cmd(hdev, HCI_OP_READ_LOCAL_COMMANDS, 0, NULL);
  
  	if (hdev->features[6] & LMP_SIMPLE_PAIR) {
@@@ -748,6 -761,30 +761,30 @@@ static void hci_cc_write_ca_timeout(str
  	hci_req_complete(hdev, HCI_OP_WRITE_CA_TIMEOUT, status);
  }
  
+ static void hci_cc_read_local_amp_info(struct hci_dev *hdev,
+ 		struct sk_buff *skb)
+ {
+ 	struct hci_rp_read_local_amp_info *rp = (void *) skb->data;
+ 
+ 	BT_DBG("%s status 0x%x", hdev->name, rp->status);
+ 
+ 	if (rp->status)
+ 		return;
+ 
+ 	hdev->amp_status = rp->amp_status;
+ 	hdev->amp_total_bw = __le32_to_cpu(rp->total_bw);
+ 	hdev->amp_max_bw = __le32_to_cpu(rp->max_bw);
+ 	hdev->amp_min_latency = __le32_to_cpu(rp->min_latency);
+ 	hdev->amp_max_pdu = __le32_to_cpu(rp->max_pdu);
+ 	hdev->amp_type = rp->amp_type;
+ 	hdev->amp_pal_cap = __le16_to_cpu(rp->pal_cap);
+ 	hdev->amp_assoc_size = __le16_to_cpu(rp->max_assoc_size);
+ 	hdev->amp_be_flush_to = __le32_to_cpu(rp->be_flush_to);
+ 	hdev->amp_max_flush_to = __le32_to_cpu(rp->max_flush_to);
+ 
+ 	hci_req_complete(hdev, HCI_OP_READ_LOCAL_AMP_INFO, rp->status);
+ }
+ 
  static void hci_cc_delete_stored_link_key(struct hci_dev *hdev,
  							struct sk_buff *skb)
  {
@@@ -804,19 -841,24 +841,24 @@@ static void hci_cc_pin_code_reply(struc
  
  	BT_DBG("%s status 0x%x", hdev->name, rp->status);
  
+ 	hci_dev_lock(hdev);
+ 
  	if (test_bit(HCI_MGMT, &hdev->flags))
- 		mgmt_pin_code_reply_complete(hdev->id, &rp->bdaddr, rp->status);
+ 		mgmt_pin_code_reply_complete(hdev, &rp->bdaddr, rp->status);
  
  	if (rp->status != 0)
- 		return;
+ 		goto unlock;
  
  	cp = hci_sent_cmd_data(hdev, HCI_OP_PIN_CODE_REPLY);
  	if (!cp)
- 		return;
+ 		goto unlock;
  
  	conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &cp->bdaddr);
  	if (conn)
  		conn->pin_length = cp->pin_len;
+ 
+ unlock:
+ 	hci_dev_unlock(hdev);
  }
  
  static void hci_cc_pin_code_neg_reply(struct hci_dev *hdev, struct sk_buff *skb)
@@@ -825,10 -867,15 +867,15 @@@
  
  	BT_DBG("%s status 0x%x", hdev->name, rp->status);
  
+ 	hci_dev_lock(hdev);
+ 
  	if (test_bit(HCI_MGMT, &hdev->flags))
- 		mgmt_pin_code_neg_reply_complete(hdev->id, &rp->bdaddr,
+ 		mgmt_pin_code_neg_reply_complete(hdev, &rp->bdaddr,
  								rp->status);
+ 
+ 	hci_dev_unlock(hdev);
  }
+ 
  static void hci_cc_le_read_buffer_size(struct hci_dev *hdev,
  				       struct sk_buff *skb)
  {
@@@ -855,9 -902,13 +902,13 @@@ static void hci_cc_user_confirm_reply(s
  
  	BT_DBG("%s status 0x%x", hdev->name, rp->status);
  
+ 	hci_dev_lock(hdev);
+ 
  	if (test_bit(HCI_MGMT, &hdev->flags))
- 		mgmt_user_confirm_reply_complete(hdev->id, &rp->bdaddr,
+ 		mgmt_user_confirm_reply_complete(hdev, &rp->bdaddr,
  								rp->status);
+ 
+ 	hci_dev_unlock(hdev);
  }
  
  static void hci_cc_user_confirm_neg_reply(struct hci_dev *hdev,
@@@ -867,9 -918,13 +918,13 @@@
  
  	BT_DBG("%s status 0x%x", hdev->name, rp->status);
  
+ 	hci_dev_lock(hdev);
+ 
  	if (test_bit(HCI_MGMT, &hdev->flags))
- 		mgmt_user_confirm_neg_reply_complete(hdev->id, &rp->bdaddr,
+ 		mgmt_user_confirm_neg_reply_complete(hdev, &rp->bdaddr,
  								rp->status);
+ 
+ 	hci_dev_unlock(hdev);
  }
  
  static void hci_cc_read_local_oob_data_reply(struct hci_dev *hdev,
@@@ -879,8 -934,10 +934,10 @@@
  
  	BT_DBG("%s status 0x%x", hdev->name, rp->status);
  
- 	mgmt_read_local_oob_data_reply_complete(hdev->id, rp->hash,
+ 	hci_dev_lock(hdev);
+ 	mgmt_read_local_oob_data_reply_complete(hdev, rp->hash,
  						rp->randomizer, rp->status);
+ 	hci_dev_unlock(hdev);
  }
  
  static void hci_cc_le_set_scan_enable(struct hci_dev *hdev,
@@@ -955,12 -1012,18 +1012,18 @@@ static inline void hci_cs_inquiry(struc
  	if (status) {
  		hci_req_complete(hdev, HCI_OP_INQUIRY, status);
  		hci_conn_check_pending(hdev);
+ 		hci_dev_lock(hdev);
+ 		if (test_bit(HCI_MGMT, &hdev->flags))
+ 			mgmt_inquiry_failed(hdev, status);
+ 		hci_dev_unlock(hdev);
  		return;
  	}
  
- 	if (!test_and_set_bit(HCI_INQUIRY, &hdev->flags) &&
- 				test_bit(HCI_MGMT, &hdev->flags))
- 		mgmt_discovering(hdev->id, 1);
+ 	set_bit(HCI_INQUIRY, &hdev->flags);
+ 
+ 	hci_dev_lock(hdev);
+ 	mgmt_discovering(hdev, 1);
+ 	hci_dev_unlock(hdev);
  }
  
  static inline void hci_cs_create_conn(struct hci_dev *hdev, __u8 status)
@@@ -1339,13 -1402,16 +1402,16 @@@ static inline void hci_inquiry_complete
  
  	BT_DBG("%s status %d", hdev->name, status);
  
  	hci_req_complete(hdev, HCI_OP_INQUIRY, status);
  
  	hci_conn_check_pending(hdev);
+ 
+ 	if (!test_and_clear_bit(HCI_INQUIRY, &hdev->flags))
+ 		return;
+ 
+ 	hci_dev_lock(hdev);
+ 	mgmt_discovering(hdev, 0);
+ 	hci_dev_unlock(hdev);
  }
  
  static inline void hci_inquiry_result_evt(struct hci_dev *hdev, struct sk_buff *skb)
@@@ -1361,12 -1427,6 +1427,6 @@@
  
  	hci_dev_lock(hdev);
  
- 	if (!test_and_set_bit(HCI_INQUIRY, &hdev->flags)) {
- 
- 		if (test_bit(HCI_MGMT, &hdev->flags))
- 			mgmt_discovering(hdev->id, 1);
- 	}
- 
  	for (; num_rsp; num_rsp--, info++) {
  		bacpy(&data.bdaddr, &info->bdaddr);
  		data.pscan_rep_mode	= info->pscan_rep_mode;
@@@ -1377,8 -1437,8 +1437,8 @@@
  		data.rssi		= 0x00;
  		data.ssp_mode		= 0x00;
  		hci_inquiry_cache_update(hdev, &data);
- 		mgmt_device_found(hdev->id, &info->bdaddr, info->dev_class, 0,
- 									NULL);
+ 		mgmt_device_found(hdev, &info->bdaddr, ACL_LINK,
+ 						info->dev_class, 0, NULL);
  	}
  
  	hci_dev_unlock(hdev);
@@@ -1412,7 -1472,7 +1472,7 @@@ static inline void hci_conn_complete_ev
  			conn->state = BT_CONFIG;
  			hci_conn_hold(conn);
  			conn->disc_timeout = HCI_DISCONN_TIMEOUT;
- 			mgmt_connected(hdev->id, &ev->bdaddr, conn->type);
+ 			mgmt_connected(hdev, &ev->bdaddr, conn->type);
  		} else
  			conn->state = BT_CONNECTED;
  
@@@ -1444,7 -1504,8 +1504,8 @@@
  	} else {
  		conn->state = BT_CLOSED;
  		if (conn->type == ACL_LINK)
- 			mgmt_connect_failed(hdev->id, &ev->bdaddr, ev->status);
+ 			mgmt_connect_failed(hdev, &ev->bdaddr, conn->type,
+ 								ev->status);
  	}
  
  	if (conn->type == ACL_LINK)
@@@ -1531,7 -1592,7 +1592,7 @@@ static inline void hci_conn_request_evt
  		struct hci_cp_reject_conn_req cp;
  
  		bacpy(&cp.bdaddr, &ev->bdaddr);
- 		cp.reason = 0x0f;
+ 		cp.reason = HCI_ERROR_REJ_BAD_ADDR;
  		hci_send_cmd(hdev, HCI_OP_REJECT_CONN_REQ, sizeof(cp), &cp);
  	}
  }
@@@ -1544,7 -1605,9 +1605,9 @@@ static inline void hci_disconn_complete
  	BT_DBG("%s status %d", hdev->name, ev->status);
  
  	if (ev->status) {
- 		mgmt_disconnect_failed(hdev->id);
+ 		hci_dev_lock(hdev);
+ 		mgmt_disconnect_failed(hdev);
+ 		hci_dev_unlock(hdev);
  		return;
  	}
  
@@@ -1557,7 -1620,7 +1620,7 @@@
  	conn->state = BT_CLOSED;
  
  	if (conn->type == ACL_LINK || conn->type == LE_LINK)
- 		mgmt_disconnected(hdev->id, &conn->dst);
+ 		mgmt_disconnected(hdev, &conn->dst, conn->type);
  
  	hci_proto_disconn_cfm(conn, ev->reason);
  	hci_conn_del(conn);
@@@ -1588,7 -1651,7 +1651,7 @@@ static inline void hci_auth_complete_ev
  			conn->sec_level = conn->pending_sec_level;
  		}
  	} else {
- 		mgmt_auth_failed(hdev->id, &conn->dst, ev->status);
+ 		mgmt_auth_failed(hdev, &conn->dst, ev->status);
  	}
  
  	clear_bit(HCI_CONN_AUTH_PEND, &conn->pend);
@@@ -1643,7 -1706,7 +1706,7 @@@ static inline void hci_remote_name_evt(
  	hci_dev_lock(hdev);
  
  	if (ev->status == 0 && test_bit(HCI_MGMT, &hdev->flags))
- 		mgmt_remote_name(hdev->id, &ev->bdaddr, ev->name);
+ 		mgmt_remote_name(hdev, &ev->bdaddr, ev->name);
  
  	conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &ev->bdaddr);
  	if (!conn)
@@@ -1898,6 -1961,10 +1961,10 @@@ static inline void hci_cmd_complete_evt
  		hci_cc_write_ca_timeout(hdev, skb);
  		break;
  
+ 	case HCI_OP_READ_LOCAL_AMP_INFO:
+ 		hci_cc_read_local_amp_info(hdev, skb);
+ 		break;
+ 
  	case HCI_OP_DELETE_STORED_LINK_KEY:
  		hci_cc_delete_stored_link_key(hdev, skb);
  		break;
@@@ -2029,7 -2096,7 +2096,7 @@@ static inline void hci_cmd_status_evt(s
  
  	case HCI_OP_DISCONNECT:
  		if (ev->status != 0)
- 			mgmt_disconnect_failed(hdev->id);
+ 			mgmt_disconnect_failed(hdev);
  		break;
  
  	case HCI_OP_LE_CREATE_CONN:
@@@ -2194,7 -2261,7 +2261,7 @@@ static inline void hci_pin_code_request
  		else
  			secure = 0;
  
- 		mgmt_pin_code_request(hdev->id, &ev->bdaddr, secure);
+ 		mgmt_pin_code_request(hdev, &ev->bdaddr, secure);
  	}
  
  unlock:
@@@ -2363,12 -2430,6 +2430,6 @@@ static inline void hci_inquiry_result_w
  
  	hci_dev_lock(hdev);
  
- 	if (!test_and_set_bit(HCI_INQUIRY, &hdev->flags)) {
- 
- 		if (test_bit(HCI_MGMT, &hdev->flags))
- 			mgmt_discovering(hdev->id, 1);
- 	}
- 
  	if ((skb->len - 1) / num_rsp != sizeof(struct inquiry_info_with_rssi)) {
  		struct inquiry_info_with_rssi_and_pscan_mode *info;
  		info = (void *) (skb->data + 1);
@@@ -2383,7 -2444,7 +2444,7 @@@
  			data.rssi		= info->rssi;
  			data.ssp_mode		= 0x00;
  			hci_inquiry_cache_update(hdev, &data);
- 			mgmt_device_found(hdev->id, &info->bdaddr,
+ 			mgmt_device_found(hdev, &info->bdaddr, ACL_LINK,
  						info->dev_class, info->rssi,
  						NULL);
  		}
@@@ -2400,7 -2461,7 +2461,7 @@@
  			data.rssi		= info->rssi;
  			data.ssp_mode		= 0x00;
  			hci_inquiry_cache_update(hdev, &data);
- 			mgmt_device_found(hdev->id, &info->bdaddr,
+ 			mgmt_device_found(hdev, &info->bdaddr, ACL_LINK,
  						info->dev_class, info->rssi,
  						NULL);
  		}
@@@ -2531,12 -2592,6 +2592,6 @@@ static inline void hci_extended_inquiry
  	if (!num_rsp)
  		return;
  
- 	if (!test_and_set_bit(HCI_INQUIRY, &hdev->flags)) {
- 
- 		if (test_bit(HCI_MGMT, &hdev->flags))
- 			mgmt_discovering(hdev->id, 1);
- 	}
- 
  	hci_dev_lock(hdev);
  
  	for (; num_rsp; num_rsp--, info++) {
@@@ -2549,8 -2604,8 +2604,8 @@@
  		data.rssi		= info->rssi;
  		data.ssp_mode		= 0x01;
  		hci_inquiry_cache_update(hdev, &data);
- 		mgmt_device_found(hdev->id, &info->bdaddr, info->dev_class,
- 						info->rssi, info->data);
+ 		mgmt_device_found(hdev, &info->bdaddr, ACL_LINK,
+ 				info->dev_class, info->rssi, info->data);
  	}
  
  	hci_dev_unlock(hdev);
@@@ -2614,7 -2669,7 +2669,7 @@@ static inline void hci_io_capa_request_
  		struct hci_cp_io_capability_neg_reply cp;
  
  		bacpy(&cp.bdaddr, &ev->bdaddr);
- 		cp.reason = 0x18; /* Pairing not allowed */
+ 		cp.reason = HCI_ERROR_PAIRING_NOT_ALLOWED;
  
  		hci_send_cmd(hdev, HCI_OP_IO_CAPABILITY_NEG_REPLY,
  							sizeof(cp), &cp);
@@@ -2706,7 -2761,7 +2761,7 @@@ static inline void hci_user_confirm_req
  	}
  
  confirm:
- 	mgmt_user_confirm_request(hdev->id, &ev->bdaddr, ev->passkey,
+ 	mgmt_user_confirm_request(hdev, &ev->bdaddr, ev->passkey,
  								confirm_hint);
  
  unlock:
@@@ -2732,7 -2787,7 +2787,7 @@@ static inline void hci_simple_pair_comp
  	 * event gets always produced as initiator and is also mapped to
  	 * the mgmt_auth_failed event */
  	if (!test_bit(HCI_CONN_AUTH_PEND, &conn->pend) && ev->status != 0)
- 		mgmt_auth_failed(hdev->id, &conn->dst, ev->status);
+ 		mgmt_auth_failed(hdev, &conn->dst, ev->status);
  
  	hci_conn_put(conn);
  
@@@ -2813,14 -2868,14 +2868,14 @@@ static inline void hci_le_conn_complete
  	}
  
  	if (ev->status) {
- 		mgmt_connect_failed(hdev->id, &ev->bdaddr, ev->status);
+ 		mgmt_connect_failed(hdev, &ev->bdaddr, conn->type, ev->status);
  		hci_proto_connect_cfm(conn, ev->status);
  		conn->state = BT_CLOSED;
  		hci_conn_del(conn);
  		goto unlock;
  	}
  
- 	mgmt_connected(hdev->id, &ev->bdaddr, conn->type);
+ 	mgmt_connected(hdev, &ev->bdaddr, conn->type);
  
  	conn->sec_level = BT_SECURITY_LOW;
  	conn->handle = __le16_to_cpu(ev->handle);
@@@ -3104,5 -3159,5 +3159,5 @@@ void hci_si_event(struct hci_dev *hdev
  	kfree_skb(skb);
  }
  
- module_param(enable_le, bool, 0444);
+ module_param(enable_le, bool, 0644);
  MODULE_PARM_DESC(enable_le, "Enable LE support");
diff --combined net/mac80211/agg-tx.c
index 2e4b961,2c2e951..399b5c4
--- a/net/mac80211/agg-tx.c
+++ b/net/mac80211/agg-tx.c
@@@ -78,7 -78,8 +78,8 @@@ static void ieee80211_send_addba_reques
  	memcpy(mgmt->da, da, ETH_ALEN);
  	memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN);
  	if (sdata->vif.type == NL80211_IFTYPE_AP ||
- 	    sdata->vif.type == NL80211_IFTYPE_AP_VLAN)
+ 	    sdata->vif.type == NL80211_IFTYPE_AP_VLAN ||
+ 	    sdata->vif.type == NL80211_IFTYPE_MESH_POINT)
  		memcpy(mgmt->bssid, sdata->vif.addr, ETH_ALEN);
  	else if (sdata->vif.type == NL80211_IFTYPE_STATION)
  		memcpy(mgmt->bssid, sdata->u.mgd.bssid, ETH_ALEN);
@@@ -185,6 -186,7 +186,7 @@@ int ___ieee80211_stop_tx_ba_session(str
  #endif /* CONFIG_MAC80211_HT_DEBUG */
  
  	del_timer_sync(&tid_tx->addba_resp_timer);
+ 	del_timer_sync(&tid_tx->session_timer);
  
  	/*
  	 * After this packets are no longer handed right through
@@@ -303,38 -305,6 +305,38 @@@ ieee80211_wake_queue_agg(struct ieee802
  	__release(agg_queue);
  }
  
 +/*
 + * splice packets from the STA's pending to the local pending,
 + * requires a call to ieee80211_agg_splice_finish later
 + */
 +static void __acquires(agg_queue)
 +ieee80211_agg_splice_packets(struct ieee80211_local *local,
 +			     struct tid_ampdu_tx *tid_tx, u16 tid)
 +{
 +	int queue = ieee80211_ac_from_tid(tid);
 +	unsigned long flags;
 +
 +	ieee80211_stop_queue_agg(local, tid);
 +
 +	if (WARN(!tid_tx, "TID %d gone but expected when splicing aggregates"
 +			  " from the pending queue\n", tid))
 +		return;
 +
 +	if (!skb_queue_empty(&tid_tx->pending)) {
 +		spin_lock_irqsave(&local->queue_stop_reason_lock, flags);
 +		/* copy over remaining packets */
 +		skb_queue_splice_tail_init(&tid_tx->pending,
 +					   &local->pending[queue]);
 +		spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags);
 +	}
 +}
 +
 +static void __releases(agg_queue)
 +ieee80211_agg_splice_finish(struct ieee80211_local *local, u16 tid)
 +{
 +	ieee80211_wake_queue_agg(local, tid);
 +}
 +
  void ieee80211_tx_ba_session_handle_start(struct sta_info *sta, int tid)
  {
  	struct tid_ampdu_tx *tid_tx;
@@@ -346,17 -316,19 +348,17 @@@
  	tid_tx = rcu_dereference_protected_tid_tx(sta, tid);
  
  	/*
 -	 * While we're asking the driver about the aggregation,
 -	 * stop the AC queue so that we don't have to worry
 -	 * about frames that came in while we were doing that,
 -	 * which would require us to put them to the AC pending
 -	 * afterwards which just makes the code more complex.
 +	 * Start queuing up packets for this aggregation session.
 +	 * We're going to release them once the driver is OK with
 +	 * that.
  	 */
  	clear_bit(HT_AGG_STATE_WANT_START, &tid_tx->state);
  
  	/*
 -	 * make sure no packets are being processed to get
 -	 * valid starting sequence number
 +	 * Make sure no packets are being processed. This ensures that
 +	 * we have a valid starting sequence number and that in-flight
 +	 * packets have been flushed out and no packets for this TID
 +	 * will go into the driver during the ampdu_action call.
  	 */
  	synchronize_net();
  
@@@ -370,15 -342,17 +372,15 @@@
  					" tid %d\n", tid);
  #endif
  		spin_lock_bh(&sta->lock);
 +		ieee80211_agg_splice_packets(local, tid_tx, tid);
  		ieee80211_assign_tid_tx(sta, tid, NULL);
 +		ieee80211_agg_splice_finish(local, tid);
  		spin_unlock_bh(&sta->lock);
  
 -		ieee80211_wake_queue_agg(local, tid);
  		kfree_rcu(tid_tx, rcu_head);
  		return;
  	}
  
 -	/* we can take packets again now */
 -	ieee80211_wake_queue_agg(local, tid);
 -
  	/* activate the timer for the recipient's addBA response */
  	mod_timer(&tid_tx->addba_resp_timer, jiffies + ADDBA_RESP_INTERVAL);
  #ifdef CONFIG_MAC80211_HT_DEBUG
@@@ -396,6 -370,28 +398,28 @@@
  				     tid_tx->timeout);
  }
  
+ /*
+  * After accepting the AddBA Response we activated a timer,
+  * resetting it after each frame that we send.
+  */
+ static void sta_tx_agg_session_timer_expired(unsigned long data)
+ {
+ 	/* not an elegant detour, but there is no choice as the timer passes
+ 	 * only one argument, and various sta_info are needed here, so init
+ 	 * flow in sta_info_create gives the TID as data, while the timer_to_id
+ 	 * array gives the sta through container_of */
+ 	u8 *ptid = (u8 *)data;
+ 	u8 *timer_to_id = ptid - *ptid;
+ 	struct sta_info *sta = container_of(timer_to_id, struct sta_info,
+ 					 timer_to_tid[0]);
+ 
+ #ifdef CONFIG_MAC80211_HT_DEBUG
+ 	printk(KERN_DEBUG "tx session timer expired on tid %d\n", (u16)*ptid);
+ #endif
+ 
+ 	ieee80211_stop_tx_ba_session(&sta->sta, *ptid);
+ }
+ 
  int ieee80211_start_tx_ba_session(struct ieee80211_sta *pubsta, u16 tid,
  				  u16 timeout)
  {
@@@ -420,13 -416,8 +444,8 @@@
  	       pubsta->addr, tid);
  #endif /* CONFIG_MAC80211_HT_DEBUG */
  
- 	/*
- 	 * The aggregation code is not prepared to handle
- 	 * anything but STA/AP due to the BSSID handling.
- 	 * IBSS could work in the code but isn't supported
- 	 * by drivers or the standard.
- 	 */
  	if (sdata->vif.type != NL80211_IFTYPE_STATION &&
+ 	    sdata->vif.type != NL80211_IFTYPE_MESH_POINT &&
  	    sdata->vif.type != NL80211_IFTYPE_AP_VLAN &&
  	    sdata->vif.type != NL80211_IFTYPE_AP)
  		return -EINVAL;
@@@ -470,11 -461,16 +489,16 @@@
  
  	tid_tx->timeout = timeout;
  
- 	/* Tx timer */
+ 	/* response timer */
  	tid_tx->addba_resp_timer.function = sta_addba_resp_timer_expired;
  	tid_tx->addba_resp_timer.data = (unsigned long)&sta->timer_to_tid[tid];
  	init_timer(&tid_tx->addba_resp_timer);
  
+ 	/* tx timer */
+ 	tid_tx->session_timer.function = sta_tx_agg_session_timer_expired;
+ 	tid_tx->session_timer.data = (unsigned long)&sta->timer_to_tid[tid];
+ 	init_timer(&tid_tx->session_timer);
+ 
  	/* assign a dialog token */
  	sta->ampdu_mlme.dialog_token_allocator++;
  	tid_tx->dialog_token = sta->ampdu_mlme.dialog_token_allocator;
@@@ -494,6 -490,38 +518,6 @@@
  }
  EXPORT_SYMBOL(ieee80211_start_tx_ba_session);
  
 -/*
 - * splice packets from the STA's pending to the local pending,
 - * requires a call to ieee80211_agg_splice_finish later
 - */
 -static void __acquires(agg_queue)
 -ieee80211_agg_splice_packets(struct ieee80211_local *local,
 -			     struct tid_ampdu_tx *tid_tx, u16 tid)
 -{
 -	int queue = ieee80211_ac_from_tid(tid);
 -	unsigned long flags;
 -
 -	ieee80211_stop_queue_agg(local, tid);
 -
 -	if (WARN(!tid_tx, "TID %d gone but expected when splicing aggregates"
 -			  " from the pending queue\n", tid))
 -		return;
 -
 -	if (!skb_queue_empty(&tid_tx->pending)) {
 -		spin_lock_irqsave(&local->queue_stop_reason_lock, flags);
 -		/* copy over remaining packets */
 -		skb_queue_splice_tail_init(&tid_tx->pending,
 -					   &local->pending[queue]);
 -		spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags);
 -	}
 -}
 -
 -static void __releases(agg_queue)
 -ieee80211_agg_splice_finish(struct ieee80211_local *local, u16 tid)
 -{
 -	ieee80211_wake_queue_agg(local, tid);
 -}
 -
  static void ieee80211_agg_tx_operational(struct ieee80211_local *local,
  					 struct sta_info *sta, u16 tid)
  {
@@@ -547,7 -575,7 +571,7 @@@ void ieee80211_start_tx_ba_cb(struct ie
  	}
  
  	mutex_lock(&local->sta_mtx);
- 	sta = sta_info_get(sdata, ra);
+ 	sta = sta_info_get_bss(sdata, ra);
  	if (!sta) {
  		mutex_unlock(&local->sta_mtx);
  #ifdef CONFIG_MAC80211_HT_DEBUG
@@@ -676,7 -704,7 +700,7 @@@ void ieee80211_stop_tx_ba_cb(struct iee
  
  	mutex_lock(&local->sta_mtx);
  
- 	sta = sta_info_get(sdata, ra);
+ 	sta = sta_info_get_bss(sdata, ra);
  	if (!sta) {
  #ifdef CONFIG_MAC80211_HT_DEBUG
  		printk(KERN_DEBUG "Could not find station: %pM\n", ra);
@@@ -814,6 -842,11 +838,11 @@@ void ieee80211_process_addba_resp(struc
  			ieee80211_agg_tx_operational(local, sta, tid);
  
  		sta->ampdu_mlme.addba_req_num[tid] = 0;
+ 
+ 		if (tid_tx->timeout)
+ 			mod_timer(&tid_tx->session_timer,
+ 				  TU_TO_EXP_TIME(tid_tx->timeout));
+ 
  	} else {
  		___ieee80211_stop_tx_ba_session(sta, tid, WLAN_BACK_INITIATOR,
  						true);
diff --combined net/sunrpc/svcsock.c
index 277909e,4653286..4645709
--- a/net/sunrpc/svcsock.c
+++ b/net/sunrpc/svcsock.c
@@@ -157,7 -157,7 +157,7 @@@ static void svc_set_cmsg_data(struct sv
  			cmh->cmsg_level = SOL_IPV6;
  			cmh->cmsg_type = IPV6_PKTINFO;
  			pki->ipi6_ifindex = daddr->sin6_scope_id;
- 			ipv6_addr_copy(&pki->ipi6_addr,	&daddr->sin6_addr);
+ 			pki->ipi6_addr = daddr->sin6_addr;
  			cmh->cmsg_len = CMSG_LEN(sizeof(*pki));
  		}
  		break;
@@@ -523,7 -523,7 +523,7 @@@ static int svc_udp_get_dest_address6(st
  		return 0;
  
  	daddr->sin6_family = AF_INET6;
- 	ipv6_addr_copy(&daddr->sin6_addr, &pki->ipi6_addr);
+ 	daddr->sin6_addr = pki->ipi6_addr;
  	daddr->sin6_scope_id = pki->ipi6_ifindex;
  	return 1;
  }
@@@ -739,8 -739,7 +739,8 @@@ static void svc_udp_init(struct svc_soc
  {
  	int err, level, optname, one = 1;
  
 -	svc_xprt_init(&svc_udp_class, &svsk->sk_xprt, serv);
 +	svc_xprt_init(sock_net(svsk->sk_sock->sk), &svc_udp_class,
 +		      &svsk->sk_xprt, serv);
  	clear_bit(XPT_CACHE_AUTH, &svsk->sk_xprt.xpt_flags);
  	svsk->sk_sk->sk_data_ready = svc_udp_data_ready;
  	svsk->sk_sk->sk_write_space = svc_write_space;
@@@ -1344,8 -1343,7 +1344,8 @@@ static void svc_tcp_init(struct svc_soc
  {
  	struct sock	*sk = svsk->sk_sk;
  
 -	svc_xprt_init(&svc_tcp_class, &svsk->sk_xprt, serv);
 +	svc_xprt_init(sock_net(svsk->sk_sock->sk), &svc_tcp_class,
 +		      &svsk->sk_xprt, serv);
  	set_bit(XPT_CACHE_AUTH, &svsk->sk_xprt.xpt_flags);
  	if (sk->sk_state == TCP_LISTEN) {
  		dprintk("setting up TCP socket for listening\n");
@@@ -1661,7 -1659,7 +1661,7 @@@ static struct svc_xprt *svc_bc_create_s
  		return ERR_PTR(-ENOMEM);
  
  	xprt = &svsk->sk_xprt;
 -	svc_xprt_init(&svc_tcp_bc_class, xprt, serv);
 +	svc_xprt_init(net, &svc_tcp_bc_class, xprt, serv);
  
  	serv->sv_bc_xprt = xprt;
  

-- 
LinuxNextTracking


More information about the linux-merge mailing list