[linux-yocto] [PATCH 06/57] LSI RAPIDIO: Updated as per checkpatch

Charlie Paul cpaul.windriver at gmail.com
Mon Mar 17 21:56:06 PDT 2014


---
 arch/powerpc/include/asm/rio.h      |    8 +-
 drivers/rapidio/devices/tsi721.c    |   17 +-
 drivers/rapidio/rio-access.c        |    4 +-
 drivers/rapidio/rio-driver.c        |    2 +-
 drivers/rapidio/rio-scan.c          |  162 +++---
 drivers/rapidio/rio-sysfs.c         |    2 +-
 drivers/rapidio/rio.c               |  930 +++++++++++++++++------------------
 drivers/rapidio/switches/idt_gen2.c |    7 +-
 include/linux/rio_drv.h             |    8 +-
 9 files changed, 555 insertions(+), 585 deletions(-)

diff --git a/arch/powerpc/include/asm/rio.h b/arch/powerpc/include/asm/rio.h
index 7e2937b..30eb60f 100644
--- a/arch/powerpc/include/asm/rio.h
+++ b/arch/powerpc/include/asm/rio.h
@@ -56,9 +56,11 @@ DEF_RIO_IN_BE(rio_in_be32, 32, "lwz")
 
 
 /* Bit definitions for the MCSR. */
-#define PPC47x_MCSR_L2  0x00200000 /* Error or system error reported through
-                                      the L2 cache */
-#define PPC47x_MCSR_DCR 0x00100000 /* DCR timeout */
+
+/* Error or system error reported through the L2 cache */
+#define PPC47x_MCSR_L2  0x00200000
+/* DCR timeout */
+#define PPC47x_MCSR_DCR 0x00100000
 
 
 #endif				/* ASM_PPC_RIO_H */
diff --git a/drivers/rapidio/devices/tsi721.c b/drivers/rapidio/devices/tsi721.c
index 33471e1..273d937 100644
--- a/drivers/rapidio/devices/tsi721.c
+++ b/drivers/rapidio/devices/tsi721.c
@@ -1017,8 +1017,8 @@ static int tsi721_bdma_init(struct tsi721_device *priv)
 	 */
 	priv->bdma[TSI721_DMACH_MAINT].bd_num = 2;
 	if (tsi721_bdma_ch_init(priv, TSI721_DMACH_MAINT)) {
-		dev_err(&priv->pdev->dev, "Unable to initialize maintenance DMA"
-			" channel %d, aborting\n", TSI721_DMACH_MAINT);
+		dev_err(&priv->pdev->dev, "Unable to initialize maintenance DMA channel %d, aborting\n",
+				TSI721_DMACH_MAINT);
 		return -ENOMEM;
 	}
 
@@ -2071,7 +2071,7 @@ static void tsi721_disable_ints(struct tsi721_device *priv)
  *
  * Configures Tsi721 as RapidIO master port.
  */
-static int __devinit tsi721_setup_mport(struct tsi721_device *priv)
+static int tsi721_setup_mport(struct tsi721_device *priv)
 {
 	struct pci_dev *pdev = priv->pdev;
 	int err = 0;
@@ -2137,8 +2137,8 @@ static int __devinit tsi721_setup_mport(struct tsi721_device *priv)
 		tsi721_interrupts_init(priv);
 		ops->pwenable = tsi721_pw_enable;
 	} else
-		dev_err(&pdev->dev, "Unable to get assigned PCI IRQ "
-			"vector %02X err=0x%x\n", pdev->irq, err);
+		dev_err(&pdev->dev, "Unable to get assigned PCI IRQ vector %02X err=0x%x\n"
+				pdev->irq, err);
 
 	/* Enable SRIO link */
 	iowrite32(ioread32(priv->regs + TSI721_DEVCTL) |
@@ -2158,8 +2158,8 @@ static int __devinit tsi721_setup_mport(struct tsi721_device *priv)
 	return 0;
 }
 
-static int __devinit tsi721_probe(struct pci_dev *pdev,
-				  const struct pci_device_id *id)
+static int tsi721_probe(struct pci_dev *pdev,
+		const struct pci_device_id *id)
 {
 	struct tsi721_device *priv;
 	int cap;
@@ -2235,8 +2235,7 @@ static int __devinit tsi721_probe(struct pci_dev *pdev,
 
 	err = pci_request_regions(pdev, DRV_NAME);
 	if (err) {
-		dev_err(&pdev->dev, "Cannot obtain PCI resources, "
-			"aborting.\n");
+		dev_err(&pdev->dev, "Cannot obtain PCI resources, aborting.\n");
 		goto err_disable_pdev;
 	}
 
diff --git a/drivers/rapidio/rio-access.c b/drivers/rapidio/rio-access.c
index 1e05d2a..6e377d7 100644
--- a/drivers/rapidio/rio-access.c
+++ b/drivers/rapidio/rio-access.c
@@ -43,7 +43,7 @@ static DEFINE_RAW_SPINLOCK(rio_doorbell_lock);
  */
 #define RIO_LOP_READ(size, type, len)					\
 int __rio_local_read_config_##size					\
-	(struct rio_mport *mport, u32 offset, type *value)		\
+	(struct rio_mport *mport, u32 offset, type * value)		\
 {									\
 	int res;							\
 	unsigned long flags;						\
@@ -105,7 +105,7 @@ EXPORT_SYMBOL_GPL(__rio_local_write_config_32);
 #define RIO_OP_READ(size, type, len)					\
 int rio_mport_read_config_##size					\
 	(struct rio_mport *mport, u16 destid, u8 hopcount,		\
-		u32 offset, type *value)				\
+		u32 offset, type * value)				\
 {									\
 	int res;							\
 	unsigned long flags;						\
diff --git a/drivers/rapidio/rio-driver.c b/drivers/rapidio/rio-driver.c
index 143b2ae..fe19ab1 100644
--- a/drivers/rapidio/rio-driver.c
+++ b/drivers/rapidio/rio-driver.c
@@ -261,7 +261,7 @@ EXPORT_SYMBOL_GPL(rio_bus_type);
 static int __init rio_bus_init(void)
 {
 	if (device_register(&rio_bus) < 0)
-		printk(KERN_ERR "RIO: failed to register RIO bus device\n");
+		pr_err("RIO: failed to register RIO bus device\n");
 	return bus_register(&rio_bus_type);
 }
 
diff --git a/drivers/rapidio/rio-scan.c b/drivers/rapidio/rio-scan.c
index d3a2dce..851f041 100644
--- a/drivers/rapidio/rio-scan.c
+++ b/drivers/rapidio/rio-scan.c
@@ -45,8 +45,8 @@ static void rio_init_em(struct rio_dev *rdev);
 
 DEFINE_SPINLOCK(rio_global_list_lock);
 
-static int next_destid = 0;
-static int next_net = 0;
+static int next_destid;
+static int next_net;
 static int next_comptag = 1;
 
 static struct timer_list rio_enum_timer =
@@ -87,7 +87,8 @@ static u16 rio_get_device_id(struct rio_mport *port, u16 destid, u8 hopcount)
  *
  * Writes the base/extended device id from a device.
  */
-static void rio_set_device_id(struct rio_mport *port, u16 destid, u8 hopcount, u16 did)
+static void rio_set_device_id(struct rio_mport *port, u16 destid,
+		u8 hopcount, u16 did)
 {
 	rio_mport_write_config_32(port, destid, hopcount, RIO_DID_CSR,
 				  RIO_SET_DID(port->sys_size, did));
@@ -125,7 +126,7 @@ static int rio_clear_locks(struct rio_mport *port)
 				  port->host_deviceid);
 	rio_local_read_config_32(port, RIO_HOST_DID_LOCK_CSR, &result);
 	if ((result & 0xffff) != 0xffff) {
-		printk(KERN_INFO
+		pr_info(
 		       "RIO: badness when releasing host lock on master port, result %8.8x\n",
 		       result);
 		ret = -EINVAL;
@@ -135,7 +136,7 @@ static int rio_clear_locks(struct rio_mport *port)
 				    port->host_deviceid);
 		rio_read_config_32(rdev, RIO_HOST_DID_LOCK_CSR, &result);
 		if ((result & 0xffff) != 0xffff) {
-			printk(KERN_INFO
+			pr_info(
 			       "RIO: badness when releasing host lock on vid %4.4x did %4.4x\n",
 			       rdev->vid, rdev->did);
 			ret = -EINVAL;
@@ -196,7 +197,9 @@ static int rio_enum_host(struct rio_mport *port)
 static int rio_device_has_destid(struct rio_mport *port, int src_ops,
 				 int dst_ops)
 {
-	u32 mask = RIO_OPS_READ | RIO_OPS_WRITE | RIO_OPS_ATOMIC_TST_SWP | RIO_OPS_ATOMIC_INC | RIO_OPS_ATOMIC_DEC | RIO_OPS_ATOMIC_SET | RIO_OPS_ATOMIC_CLR;
+	u32 mask = RIO_OPS_READ | RIO_OPS_WRITE | RIO_OPS_ATOMIC_TST_SWP |
+			RIO_OPS_ATOMIC_INC | RIO_OPS_ATOMIC_DEC |
+			RIO_OPS_ATOMIC_SET | RIO_OPS_ATOMIC_CLR;
 
 	return !!((src_ops | dst_ops) & mask);
 }
@@ -265,7 +268,7 @@ static void rio_switch_init(struct rio_dev *rdev, int do_enum)
 	}
 
 	if (!rdev->rswitch->add_entry || !rdev->rswitch->get_entry)
-		printk(KERN_ERR "RIO: missing routing ops for %s\n",
+		pr_err("RIO: missing routing ops for %s\n",
 		       rio_name(rdev));
 }
 
@@ -316,8 +319,8 @@ inline int rio_enable_rx_tx_port(struct rio_mport *port,
 	/*
 	* enable rx input tx output port
 	*/
-	pr_debug("rio_enable_rx_tx_port(local = %d, destid = %d, hopcount = "
-		 "%d, port_num = %d)\n", local, destid, hopcount, port_num);
+	pr_debug("rio_enable_rx_tx_port(local = %d, destid = %d, hopcount = %d, port_num = %d)\n",
+			local, destid, hopcount, port_num);
 
 	ext_ftr_ptr = rio_mport_get_physefb(port, local, destid, hopcount);
 
@@ -450,7 +453,8 @@ static struct rio_dev *rio_setup_device(struct rio_net *net,
 			if (next_destid == port->host_deviceid)
 				next_destid++;
 		} else
-			rdev->destid = rio_get_device_id(port, destid, hopcount);
+			rdev->destid = rio_get_device_id(port,
+					destid, hopcount);
 
 		rdev->hopcount = 0xff;
 	} else {
@@ -756,8 +760,8 @@ static int rio_enum_peer(struct rio_net *net, struct rio_mport *port,
 	u32 regval;
 	int tmp;
 
-	if (rio_mport_chk_dev_access(port,
-			RIO_ANY_DESTID(port->sys_size), hopcount)) {
+	if (rio_mport_chk_dev_access(port, RIO_ANY_DESTID(port->sys_size),
+			hopcount)) {
 		pr_debug("RIO: device access check failed\n");
 		return -1;
 	}
@@ -768,15 +772,14 @@ static int rio_enum_peer(struct rio_net *net, struct rio_mport *port,
 		 * Already discovered by this host. Add it as another
 		 * link to the existing device.
 		 */
-		rio_mport_read_config_32(port, RIO_ANY_DESTID(port->sys_size),
-				hopcount, RIO_COMPONENT_TAG_CSR, &regval);
+		rio_mport_read_config_32(port, RIO_ANY_DESTID(port->sys_size), hopcount,
+				RIO_COMPONENT_TAG_CSR, &regval);
 
 		if (regval) {
 			rdev = rio_get_comptag((regval & 0xffff), NULL);
 
 			if (rdev && prev && rio_is_switch(prev)) {
-				pr_debug("RIO: redundant path to %s\n",
-					 rio_name(rdev));
+				pr_debug("RIO: redundant path to %s\n", rio_name(rdev));
 				prev->rswitch->nextdev[prev_port] = rdev;
 			}
 		}
@@ -785,29 +788,26 @@ static int rio_enum_peer(struct rio_net *net, struct rio_mport *port,
 	}
 
 	/* Attempt to acquire device lock */
-	rio_mport_write_config_32(port, RIO_ANY_DESTID(port->sys_size),
-				  hopcount,
-				  RIO_HOST_DID_LOCK_CSR, port->host_deviceid);
+	rio_mport_write_config_32(port, RIO_ANY_DESTID(port->sys_size), hopcount,
+	RIO_HOST_DID_LOCK_CSR, port->host_deviceid);
 	while ((tmp = rio_get_host_deviceid_lock(port, hopcount))
-	       < port->host_deviceid) {
+			< port->host_deviceid) {
 		/* Delay a bit */
 		mdelay(1);
 		/* Attempt to acquire device lock again */
 		rio_mport_write_config_32(port, RIO_ANY_DESTID(port->sys_size),
-					  hopcount,
-					  RIO_HOST_DID_LOCK_CSR,
-					  port->host_deviceid);
+				hopcount,
+				RIO_HOST_DID_LOCK_CSR, port->host_deviceid);
 	}
 
 	if (rio_get_host_deviceid_lock(port, hopcount) > port->host_deviceid) {
-		pr_debug(
-		    "RIO: PE locked by a higher priority host...retreating\n");
+		pr_debug("RIO: PE locked by a higher priority host...retreating\n");
 		return -1;
 	}
 
 	/* Setup new RIO device */
-	rdev = rio_setup_device(net, port, RIO_ANY_DESTID(port->sys_size),
-					hopcount, 1);
+	rdev = rio_setup_device(net, port, RIO_ANY_DESTID(port->sys_size), hopcount,
+			1);
 	if (rdev) {
 		/* Add device to the global and bus/net specific list. */
 		list_add_tail(&rdev->net_list, &net->devices);
@@ -819,30 +819,26 @@ static int rio_enum_peer(struct rio_net *net, struct rio_mport *port,
 
 	if (rio_is_switch(rdev)) {
 		sw_inport = RIO_GET_PORT_NUM(rdev->swpinfo);
-		rio_route_add_entry(rdev, RIO_GLOBAL_TABLE,
-				    port->host_deviceid, sw_inport, 0);
+		rio_route_add_entry(rdev, RIO_GLOBAL_TABLE, port->host_deviceid,
+				sw_inport, 0);
 		rdev->rswitch->route_table[port->host_deviceid] = sw_inport;
 
 		for (destid = 0; destid < next_destid; destid++) {
 			if (destid == port->host_deviceid)
 				continue;
-			rio_route_add_entry(rdev, RIO_GLOBAL_TABLE,
-					    destid, sw_inport, 0);
+			rio_route_add_entry(rdev, RIO_GLOBAL_TABLE, destid, sw_inport, 0);
 			rdev->rswitch->route_table[destid] = sw_inport;
 		}
 
-		pr_debug(
-		    "RIO: found %s (vid %4.4x did %4.4x) with %d ports\n",
-		    rio_name(rdev), rdev->vid, rdev->did,
-		    RIO_GET_TOTAL_PORTS(rdev->swpinfo));
+		pr_debug("RIO: found %s (vid %4.4x did %4.4x) with %d ports\n",
+				rio_name(rdev), rdev->vid, rdev->did,
+				RIO_GET_TOTAL_PORTS(rdev->swpinfo));
 		sw_destid = next_destid;
-		for (port_num = 0;
-		     port_num < RIO_GET_TOTAL_PORTS(rdev->swpinfo);
-		     port_num++) {
+		for (port_num = 0; port_num < RIO_GET_TOTAL_PORTS(rdev->swpinfo);
+				port_num++) {
 			/*Enable Input Output Port (transmitter reviever)*/
-			rio_enable_rx_tx_port(port, 0,
-					      RIO_ANY_DESTID(port->sys_size),
-					      hopcount, port_num);
+			rio_enable_rx_tx_port(port, 0, RIO_ANY_DESTID(port->sys_size),
+					hopcount, port_num);
 
 			if (sw_inport == port_num) {
 				rdev->rswitch->port_ok |= (1 << port_num);
@@ -851,35 +847,24 @@ static int rio_enum_peer(struct rio_net *net, struct rio_mport *port,
 
 			cur_destid = next_destid;
 
-			if (rio_sport_is_active
-			    (port, RIO_ANY_DESTID(port->sys_size), hopcount,
-			     port_num)) {
-				pr_debug(
-				    "RIO: scanning device on port %d\n",
-				    port_num);
+			if (rio_sport_is_active(port, RIO_ANY_DESTID(port->sys_size),
+					hopcount, port_num)) {
+				pr_debug("RIO: scanning device on port %d\n", port_num);
 				rdev->rswitch->port_ok |= (1 << port_num);
 				rio_route_add_entry(rdev, RIO_GLOBAL_TABLE,
-						RIO_ANY_DESTID(port->sys_size),
-						port_num, 0);
+						RIO_ANY_DESTID(port->sys_size), port_num, 0);
 
-				if (rio_enum_peer(net, port, hopcount + 1,
-						  rdev, port_num) < 0)
+				if (rio_enum_peer(net, port, hopcount + 1, rdev, port_num) < 0)
 					return -1;
 
 				/* Update routing tables */
 				if (next_destid > cur_destid) {
-					for (destid = cur_destid;
-					     destid < next_destid; destid++) {
+					for (destid = cur_destid; destid < next_destid; destid++) {
 						if (destid == port->host_deviceid)
 							continue;
 						rio_route_add_entry(rdev,
-								    RIO_GLOBAL_TABLE,
-								    destid,
-								    port_num,
-								    0);
-						rdev->rswitch->
-						    route_table[destid] =
-						    port_num;
+						RIO_GLOBAL_TABLE, destid, port_num, 0);
+						rdev->rswitch->route_table[destid] = port_num;
 					}
 				}
 			} else {
@@ -894,12 +879,10 @@ static int rio_enum_peer(struct rio_net *net, struct rio_mport *port,
 		}
 
 		/* Direct Port-write messages to the enumeratiing host */
-		if ((rdev->src_ops & RIO_SRC_OPS_PORT_WRITE) &&
-		    (rdev->em_efptr)) {
-			rio_write_config_32(rdev,
-					rdev->em_efptr + RIO_EM_PW_TGT_DEVID,
-					(port->host_deviceid << 16) |
-					(port->sys_size << 15));
+		if ((rdev->src_ops & RIO_SRC_OPS_PORT_WRITE) && (rdev->em_efptr)) {
+			rio_write_config_32(rdev, rdev->em_efptr + RIO_EM_PW_TGT_DEVID,
+				(port->host_deviceid << 16) |
+				(port->sys_size << 15));
 		}
 
 		rio_init_em(rdev);
@@ -914,7 +897,8 @@ static int rio_enum_peer(struct rio_net *net, struct rio_mport *port,
 		rdev->destid = sw_destid;
 	} else
 		pr_debug("RIO: found %s (vid %4.4x did %4.4x)\n",
-		    rio_name(rdev), rdev->vid, rdev->did);
+				rio_name(rdev),
+				rdev->vid, rdev->did);
 
 	return 0;
 }
@@ -957,7 +941,8 @@ rio_disc_peer(struct rio_net *net, struct rio_mport *port, u16 destid,
 	u16 ndestid;
 
 	/* Setup new RIO device */
-	if ((rdev = rio_setup_device(net, port, destid, hopcount, 0))) {
+	rdev = rio_setup_device(net, port, destid, hopcount, 0);
+	if (rdev) {
 		/* Add device to the global and bus/net specific list. */
 		list_add_tail(&rdev->net_list, &net->devices);
 		rdev->prev = prev;
@@ -1030,8 +1015,8 @@ static int rio_mport_is_active(struct rio_mport *port)
 	int *entry = rio_mport_phys_table;
 
 	do {
-		if ((ext_ftr_ptr =
-		     rio_mport_get_feature(port, 1, 0, 0, *entry)))
+		ext_ftr_ptr = rio_mport_get_feature(port, 1, 0, 0, *entry);
+		if (()
 			break;
 	} while (*++entry >= 0);
 
@@ -1153,21 +1138,21 @@ int rio_enum_mport(struct rio_mport *mport)
 	struct rio_net *net = NULL;
 	int rc = 0;
 
-	printk(KERN_INFO "RIO: enumerate master port %d, %s\n", mport->id,
-	       mport->name);
+	pr_info("RIO: enumerate master port %d, %s\n", mport->id,
+			mport->name);
 	/* If somebody else enumerated our master port device, bail. */
 	if (rio_enum_host(mport) < 0) {
-		printk(KERN_INFO
-		       "RIO: master port %d device has been enumerated by a remote host\n",
-		       mport->id);
+		pr_info("RIO: master port %d device has been enumerated by a remote host\n",
+				mport->id);
 		rc = -EBUSY;
 		goto out;
 	}
 
 	/* If master port has an active link, allocate net and enum peers */
 	if (rio_mport_is_active(mport)) {
-		if (!(net = rio_alloc_net(mport))) {
-			printk(KERN_ERR "RIO: failed to allocate new net\n");
+		net = rio_alloc_net(mport);
+		if (!net) {
+			pr_err("RIO: failed to allocate new net\n");
 			rc = -ENOMEM;
 			goto out;
 		}
@@ -1181,7 +1166,7 @@ int rio_enum_mport(struct rio_mport *mport)
 
 		if (rio_enum_peer(net, mport, 0, NULL, 0) < 0) {
 			/* A higher priority host won enumeration, bail. */
-			printk(KERN_INFO
+			pr_info(
 			       "RIO: master port %d device has lost enumeration to a remote host\n",
 			       mport->id);
 			rio_clear_locks(mport);
@@ -1192,12 +1177,12 @@ int rio_enum_mport(struct rio_mport *mport)
 		rio_clear_locks(mport);
 		rio_pw_enable(mport, 1);
 	} else {
-		printk(KERN_INFO "RIO: master port %d link inactive\n",
+		pr_info("RIO: master port %d link inactive\n",
 		       mport->id);
 		rc = -EINVAL;
 	}
 
-      out:
+out:
 	return rc;
 }
 
@@ -1217,9 +1202,7 @@ static void rio_build_route_tables(void)
 		if (rio_is_switch(rdev)) {
 			rio_lock_device(rdev->net->hport, rdev->destid,
 					rdev->hopcount, 1000);
-			for (i = 0;
-			     i < RIO_MAX_ROUTE_ENTRIES(rdev->net->hport->sys_size);
-			     i++) {
+			for (i = 0; i < RIO_MAX_ROUTE_ENTRIES(rdev->net->hport->sys_size); i++) {
 				if (rio_route_get_entry(rdev,
 					RIO_GLOBAL_TABLE, i, &sport, 0) < 0)
 					continue;
@@ -1261,13 +1244,14 @@ int rio_disc_mport(struct rio_mport *mport)
 	struct rio_net *net = NULL;
 	int enum_timeout_flag = 0;
 
-	printk(KERN_INFO "RIO: discover master port %d, %s\n", mport->id,
+	pr_info("RIO: discover master port %d, %s\n", mport->id,
 	       mport->name);
 
 	/* If master port has an active link, allocate net and discover peers */
 	if (rio_mport_is_active(mport)) {
-		if (!(net = rio_alloc_net(mport))) {
-			printk(KERN_ERR "RIO: Failed to allocate new net\n");
+		net = rio_alloc_net(mport);
+		if (!net) {
+			pr_err("RIO: Failed to allocate new net\n");
 			goto bail;
 		}
 
@@ -1296,7 +1280,7 @@ int rio_disc_mport(struct rio_mport *mport)
 
 		if (rio_disc_peer(net, mport, RIO_ANY_DESTID(mport->sys_size),
 					0, NULL, 0) < 0) {
-			printk(KERN_INFO
+			pr_info(
 			       "RIO: master port %d device has failed discovery\n",
 			       mport->id);
 			goto bail;
@@ -1307,8 +1291,8 @@ int rio_disc_mport(struct rio_mport *mport)
 
 	return 0;
 
-      timeout:
+timeout:
 	pr_debug("timeout\n");
-      bail:
+bail:
 	return -EBUSY;
 }
diff --git a/drivers/rapidio/rio-sysfs.c b/drivers/rapidio/rio-sysfs.c
index 288b014..77a3826 100644
--- a/drivers/rapidio/rio-sysfs.c
+++ b/drivers/rapidio/rio-sysfs.c
@@ -403,7 +403,7 @@ int rio_create_sysfs_dev_files(struct rio_dev *rdev)
 	}
 
 	if (err)
-		pr_warning("RIO: Failed to create attribute file(s) for %s\n",
+		pr_warn("RIO: Failed to create attribute file(s) for %s\n",
 			   rio_name(rdev));
 
 	return err;
diff --git a/drivers/rapidio/rio.c b/drivers/rapidio/rio.c
index 93c7464..8591024 100644
--- a/drivers/rapidio/rio.c
+++ b/drivers/rapidio/rio.c
@@ -74,12 +74,12 @@ retry:
 	}
 	rcu_read_unlock();
 done:
-	if (nptr)
+	if (nptr != NULL)
 		kfree(nptr);
 	*n = num;
 	return dptr;
 err:
-	if (dptr)
+	if (dptr != NULL)
 		kfree(dptr);
 	dptr = ERR_PTR(-ENOMEM);
 	goto done;
@@ -122,12 +122,12 @@ retry:
 	}
 	rcu_read_unlock();
 done:
-	if (nptr)
+	if (nptr != NULL)
 		kfree(nptr);
 	*n = num;
 	return dptr;
 err:
-	if (dptr)
+	if (dptr != NULL)
 		kfree(dptr);
 	dptr = ERR_PTR(-ENOMEM);
 	goto done;
@@ -136,13 +136,12 @@ EXPORT_SYMBOL_GPL(rio_get_all_devices);
 
 int rio_get_err_and_status(struct rio_dev *rdev, int portnum, u32 *err_status)
 {
-        int rc;
-	if ((rc = rio_read_config_32(rdev,
-                                     rdev->phys_efptr + RIO_PORT_N_ERR_STS_CSR(portnum),
-                                     err_status))) {
-                pr_debug("RIO: Failed to read RIO_PORT_N_ERR_STS_CSR from device\n");
-        }
-        return rc;
+	int rc;
+	rc = rio_read_config_32(rdev,
+				rdev->phys_efptr + RIO_PORT_N_ERR_STS_CSR(portnum), err_status);
+	if (rc)
+		pr_debug("RIO: Failed to read RIO_PORT_N_ERR_STS_CSR from device\n");
+	return rc;
 }
 
 /**
@@ -156,9 +155,8 @@ int rio_get_err_and_status(struct rio_dev *rdev, int portnum, u32 *err_status)
  */
 int rio_is_switch(struct rio_dev *rdev)
 {
-	if (rdev->pef & RIO_PEF_SWITCH) {
+	if (rdev->pef & RIO_PEF_SWITCH)
 		return 1;
-	}
 	return 0;
 }
 #ifdef NEW_STYLE
@@ -277,8 +275,9 @@ u16 rio_local_get_device_id(struct rio_mport *port)
 	if (rio_local_read_config_32(port, RIO_DID_CSR, &result))
 		pr_debug("RIO: Failed to read RIO_DID_CSR\n");
 
-	return (RIO_GET_DID(port->sys_size, result));
+	return RIO_GET_DID(port->sys_size, result);
 }
+EXPORT_SYMBOL_GPL(rio_local_get_device_id);
 
 /**
  * rio_request_inb_mbox - request inbound mailbox service
@@ -295,7 +294,7 @@ int rio_request_inb_mbox(struct rio_mport *mport,
 			 void *dev_id,
 			 int mbox,
 			 int entries,
-			 void (*minb) (struct rio_mport * mport, void *dev_id, int mbox,
+			 void (*minb) (struct rio_mport *mport, void *dev_id, int mbox,
 				       int slot))
 {
 	int rc = -ENOSYS;
@@ -310,9 +309,8 @@ int rio_request_inb_mbox(struct rio_mport *mport,
 		rio_init_mbox_res(res, mbox, mbox);
 
 		/* Make sure this mailbox isn't in use */
-		if ((rc =
-		     request_resource(&mport->riores[RIO_INB_MBOX_RESOURCE],
-				      res)) < 0) {
+		rc = request_resource(&mport->riores[RIO_INB_MBOX_RESOURCE], res);
+		if (rc < 0) {
 			kfree(res);
 			goto out;
 		}
@@ -329,6 +327,7 @@ int rio_request_inb_mbox(struct rio_mport *mport,
 out:
 	return rc;
 }
+EXPORT_SYMBOL_GPL(rio_request_inb_mbox);
 
 /**
  * rio_release_inb_mbox - release inbound mailbox message service
@@ -348,6 +347,7 @@ int rio_release_inb_mbox(struct rio_mport *mport, int mbox)
 	} else
 		return -ENOSYS;
 }
+EXPORT_SYMBOL_GPL(rio_release_inb_mbox);
 
 /**
  * rio_request_outb_mbox - request outbound mailbox service
@@ -360,14 +360,10 @@ int rio_release_inb_mbox(struct rio_mport *mport, int mbox)
  * Requests ownership of an outbound mailbox resource and binds
  * a callback function to the resource. Returns 0 on success.
  */
-int rio_request_outb_mbox(struct rio_mport *mport,
-			  void *dev_id,
-			  int mbox,
-			  int entries,
-			  int prio,
-			  void (*moutb) (struct rio_mport * mport, void *dev_id,
-					 int mbox, int slot, void *cookie))
-{
+int rio_request_outb_mbox(struct rio_mport *mport, void *dev_id, int mbox,
+		int entries, int prio,
+		void (*moutb)(struct rio_mport *mport, void *dev_id, int mbox,
+				int slot, void *cookie)) {
 	int rc = -ENOSYS;
 	struct resource *res;
 
@@ -380,9 +376,9 @@ int rio_request_outb_mbox(struct rio_mport *mport,
 		rio_init_mbox_res(res, mbox, mbox);
 
 		/* Make sure this outbound mailbox isn't in use */
-		if ((rc =
-		     request_resource(&mport->riores[RIO_OUTB_MBOX_RESOURCE],
-				      res)) < 0) {
+		rc = request_resource(&mport->riores[RIO_OUTB_MBOX_RESOURCE],
+				res);
+		if (rc < 0) {
 			kfree(res);
 			goto out;
 		}
@@ -399,6 +395,7 @@ int rio_request_outb_mbox(struct rio_mport *mport,
 out:
 	return rc;
 }
+EXPORT_SYMBOL_GPL(rio_request_outb_mbox);
 
 /**
  * rio_release_outb_mbox - release outbound mailbox message service
@@ -418,6 +415,7 @@ int rio_release_outb_mbox(struct rio_mport *mport, int mbox)
 	} else
 		return -ENOSYS;
 }
+EXPORT_SYMBOL_GPL(rio_release_outb_mbox);
 
 /**
  * rio_setup_inb_dbell - bind inbound doorbell callback
@@ -432,13 +430,13 @@ int rio_release_outb_mbox(struct rio_mport *mport, int mbox)
  */
 static int
 rio_setup_inb_dbell(struct rio_mport *mport, void *dev_id, struct resource *res,
-		    void (*dinb) (struct rio_mport * mport, void *dev_id, u16 src, u16 dst,
+		    void (*dinb) (struct rio_mport *mport, void *dev_id, u16 src, u16 dst,
 				  u16 info))
 {
 	int rc = 0;
 	struct rio_dbell *dbell;
-
-	if (!(dbell = kmalloc(sizeof(struct rio_dbell), GFP_KERNEL))) {
+	dbell = kmalloc(sizeof(struct rio_dbell), GFP_KERNEL);
+	if (!dbell) {
 		rc = -ENOMEM;
 		goto out;
 	}
@@ -469,7 +467,7 @@ int rio_request_inb_dbell(struct rio_mport *mport,
 			  void *dev_id,
 			  u16 start,
 			  u16 end,
-			  void (*dinb) (struct rio_mport * mport, void *dev_id, u16 src,
+			  void (*dinb) (struct rio_mport *mport, void *dev_id, u16 src,
 					u16 dst, u16 info))
 {
 	int rc = 0;
@@ -480,9 +478,9 @@ int rio_request_inb_dbell(struct rio_mport *mport,
 		rio_init_dbell_res(res, start, end);
 
 		/* Make sure these doorbells aren't in use */
-		if ((rc =
-		     request_resource(&mport->riores[RIO_DOORBELL_RESOURCE],
-				      res)) < 0) {
+		rc = request_resource(&mport->riores[RIO_DOORBELL_RESOURCE],
+				res);
+		if (rc < 0) {
 			kfree(res);
 			goto out;
 		}
@@ -495,6 +493,7 @@ int rio_request_inb_dbell(struct rio_mport *mport,
 out:
 	return rc;
 }
+EXPORT_SYMBOL_GPL(rio_request_inb_dbell);
 
 /**
  * rio_release_inb_dbell - release inbound doorbell message service
@@ -536,6 +535,7 @@ int rio_release_inb_dbell(struct rio_mport *mport, u16 start, u16 end)
 out:
 	return rc;
 }
+EXPORT_SYMBOL_GPL(rio_release_inb_dbell);
 
 /**
  * rio_request_outb_dbell - request outbound doorbell message range
@@ -564,6 +564,7 @@ struct resource *rio_request_outb_dbell(struct rio_dev *rdev, u16 start,
 
 	return res;
 }
+EXPORT_SYMBOL_GPL(rio_request_outb_dbell);
 
 /**
  * rio_release_outb_dbell - release outbound doorbell message range
@@ -581,6 +582,7 @@ int rio_release_outb_dbell(struct rio_dev *rdev, struct resource *res)
 
 	return rc;
 }
+EXPORT_SYMBOL_GPL(rio_release_outb_dbell);
 
 /**
  * rio_request_inb_pwrite - request inbound port-write message service
@@ -591,7 +593,7 @@ int rio_release_outb_dbell(struct rio_dev *rdev, struct resource *res)
  * Returns 0 if the request has been satisfied.
  */
 int rio_request_inb_pwrite(struct rio_dev *rdev,
-                           int (*pwcback)(struct rio_dev *rdev, union rio_pw_msg *msg, int step))
+		int (*pwcback)(struct rio_dev *rdev, union rio_pw_msg *msg, int step))
 {
 	int rc = 0;
 
@@ -636,27 +638,26 @@ EXPORT_SYMBOL_GPL(rio_release_inb_pwrite);
  * @destid: Destination ID of the device
  * @hopcount: Number of switch hops to the device
  */
-int
-rio_mport_get_physefb(struct rio_mport *port, int local,
-		      u16 destid, u8 hopcount, u32 *physefb)
-{
+int rio_mport_get_physefb(struct rio_mport *port, int local, u16 destid,
+		u8 hopcount, u32 *physefb) {
 	u32 ext_ftr_ptr;
 	u32 ftr_header;
-        int rc = 0;
-
-	if ((rc = rio_mport_get_efb(port, local, destid, hopcount, 0, &ext_ftr_ptr)))
-                goto done;
+	int rc = 0;
+	rc = rio_mport_get_efb(port, local, destid, hopcount, 0, &ext_ftr_ptr);
+	if (rc)
+		goto done;
 
-	while (ext_ftr_ptr)  {
+	while (ext_ftr_ptr) {
 		if (local) {
-			if ((rc = rio_local_read_config_32(port, ext_ftr_ptr,
-                                                           &ftr_header)))
-                                goto done;
-                } else {
-			if ((rc = rio_mport_read_config_32(port, destid, hopcount,
-                                                           ext_ftr_ptr, &ftr_header)))
-                                goto done;
-                }
+			rc = rio_local_read_config_32(port, ext_ftr_ptr, &ftr_header);
+			if (rc)
+				goto done;
+		} else {
+			rc = rio_mport_read_config_32(port, destid, hopcount,
+								ext_ftr_ptr, &ftr_header);
+			if (rc)
+				goto done;
+		}
 
 		ftr_header = RIO_GET_BLOCK_ID(ftr_header);
 		switch (ftr_header) {
@@ -669,19 +670,19 @@ rio_mport_get_physefb(struct rio_mport *port, int local,
 		case RIO_EFB_SER_EP_FREE_ID:
 		case RIO_EFB_SER_EP_FREC_ID:
 
-                        goto done;
+			goto done;
 
 		default:
 			break;
 		}
-
-		if ((rc = rio_mport_get_efb(port, local, destid,
-                                            hopcount, ext_ftr_ptr, &ext_ftr_ptr)))
-                        goto done;
+		rc = rio_mport_get_efb(port, local, destid, hopcount, ext_ftr_ptr,
+						&ext_ftr_ptr);
+		if (rc)
+			goto done;
 	}
 
 done:
-        *physefb = ext_ftr_ptr;
+	*physefb = ext_ftr_ptr;
 	return rc;
 }
 EXPORT_SYMBOL_GPL(rio_mport_get_physefb);
@@ -740,40 +741,40 @@ done:
  * @pnum: Switch port number to set LOCKOUT bit
  * @lock: Operation : set (=1) or clear (=0)
  */
-static int
-rio_set_port_lockout(struct rio_dev *rdev, u32 pnum, int lock, int do_lock)
-{
-        int rc = 0;
+static int rio_set_port_lockout(struct rio_dev *rdev, u32 pnum, int lock,
+		int do_lock) {
+	int rc = 0;
 	u32 regval;
 
-        if (do_lock)
-                if ((rc = rio_hw_lock_wait(rdev->hport, rdev->destid, rdev->hopcount, 10)))
-                        goto done;
-
-	if ((rc = rio_read_config_32(rdev,
-                                     rdev->phys_efptr + RIO_PORT_N_CTL_CSR(pnum),
-                                     &regval)))
-                goto rel_lock;
+	if (do_lock)
+		rc = rio_hw_lock_wait(rdev->hport, rdev->destid, rdev->hopcount,
+						10);
+		if (rc)
+			goto done;
+	rc = rio_read_config_32(rdev,
+		rdev->phys_efptr + RIO_PORT_N_CTL_CSR(pnum), &regval);
+	if (rc)
+		goto rel_lock;
 
 	if (lock)
 		regval |= RIO_PORT_N_CTL_LOCKOUT;
 	else
 		regval &= ~RIO_PORT_N_CTL_LOCKOUT;
 
-	rc = rio_write_config_32(rdev,
-                                 rdev->phys_efptr + RIO_PORT_N_CTL_CSR(pnum),
-                                 regval);
+	rc = rio_write_config_32(rdev, rdev->phys_efptr + RIO_PORT_N_CTL_CSR(pnum),
+			regval);
 
 	pr_debug("RIO_EM: %s_port_lockout %s port %d addr %8.8x == %8.8x\n",
-		 (lock ? "set":"clear"), rio_name(rdev), pnum, rdev->phys_efptr + RIO_PORT_N_CTL_CSR(pnum), regval);
+			(lock ? "set" : "clear"), rio_name(rdev), pnum,
+			rdev->phys_efptr + RIO_PORT_N_CTL_CSR(pnum), regval);
 
 rel_lock:
-        if (do_lock) {
-                if (rc)
-                        rio_hw_unlock(rdev->hport, rdev->destid, rdev->hopcount);
-                else
-                        rc = rio_hw_unlock(rdev->hport, rdev->destid, rdev->hopcount);
-        }
+	if (do_lock) {
+		if (rc)
+			rio_hw_unlock(rdev->hport, rdev->destid, rdev->hopcount);
+		else
+			rc = rio_hw_unlock(rdev->hport, rdev->destid, rdev->hopcount);
+	}
 done:
 	return rc;
 }
@@ -811,49 +812,49 @@ static int rio_chk_dev_access(struct rio_dev *rdev)
  * @pnum: Device port number to issue the command
  * @lnkresp: Response from a link partner
  */
-static int
-rio_get_input_status(struct rio_dev *rdev, int pnum, u32 request, u32 *lnkresp)
+static int rio_get_input_status(struct rio_dev *rdev, int pnum, u32 request,
+		u32 *lnkresp)
 {
 	u32 regval;
 	int checkcount;
-        int rc = 0;
+	int rc = 0;
 
 	if (lnkresp) {
 		/* Read from link maintenance response register
 		 * to clear valid bit */
-		if ((rc = rio_read_config_32(rdev,
-                                             rdev->phys_efptr + RIO_PORT_N_MNT_RSP_CSR(pnum),
-                                             &regval)))
-                        goto done;
+		rc = rio_read_config_32(rdev,
+				rdev->phys_efptr + RIO_PORT_N_MNT_RSP_CSR(pnum), &regval);
+		if (rc)
+			goto done;
 		udelay(50);
 	}
 
 	/* Issue Input-status command */
-	if ((rc = rio_write_config_32(rdev,
-                                      rdev->phys_efptr + RIO_PORT_N_MNT_REQ_CSR(pnum),
-                                      request)))
-                goto done;
+	rc = rio_write_config_32(rdev,
+			rdev->phys_efptr + RIO_PORT_N_MNT_REQ_CSR(pnum), request);
+	if (rc)
+		goto done;
 
 	/* Exit if the response is not expected */
 	if (lnkresp == NULL)
-                goto done;
+		goto done;
 
 	checkcount = 3;
 	while (checkcount--) {
 		udelay(50);
-		if ((rc = rio_read_config_32(rdev,
-                                             rdev->phys_efptr + RIO_PORT_N_MNT_RSP_CSR(pnum),
-                                             &regval)))
-                        goto done;
+		rc = rio_read_config_32(rdev,
+				rdev->phys_efptr + RIO_PORT_N_MNT_RSP_CSR(pnum), &regval);
+		if (rc)
+			goto done;
 		if (regval & RIO_PORT_N_MNT_RSP_RVAL) {
 			*lnkresp = regval;
-                        goto done;
+			goto done;
 		}
 	}
 
 	rc = -EIO;
 done:
-        return rc;
+	return rc;
 }
 
 /**
@@ -862,118 +863,119 @@ done:
  * @pnum: Switch port number to clear errors
  * @err_status: port error status (if 0 reads register from device)
  */
-int
-rio_clr_err_stopped(struct rio_dev *rdev, u32 pnum, u32 err_status, int *success)
-{
+int rio_clr_err_stopped(struct rio_dev *rdev, u32 pnum, u32 err_status,
+		int *success) {
 	struct rio_dev *nextdev;
 	u32 regval;
 	u32 far_ackid, far_linkstat, near_ackid;
-        int rc = 0;
+	int rc = 0;
 
 	nextdev = lookup_rdev_next(rdev, pnum);
 	if (IS_ERR(nextdev))
 		nextdev = NULL;
 
-        if (rdev->use_hw_lock &&
-            ((rc = rio_hw_lock_wait(rdev->hport, rdev->destid, rdev->hopcount, 10))))
-                goto done;
+	rc = rio_hw_lock_wait(rdev->hport, rdev->destid,
+						rdev->hopcount, 10);
+	if (rdev->use_hw_lock && rc)
+		goto done;
 
-        if (err_status == 0) {
-		if ((rc = rio_get_err_and_status(rdev, pnum, &err_status)))
-                        goto err;
-        }
+	if (err_status == 0) {
+		rc = rio_get_err_and_status(rdev, pnum, &err_status);
+		if (rc)
+			goto err;
+	}
 
 	if (err_status & RIO_PORT_N_ERR_STS_PW_OUT_ES) {
 		pr_debug("RIO_EM: servicing Output Error-Stopped state\n");
 		/*
 		 * Send a Link-Request/Input-Status control symbol
 		 */
-                rc = rio_get_input_status(rdev, pnum, RIO_MNT_REQ_CMD_IS, &regval);
-                if (rc == -EIO) {
+		rc = rio_get_input_status(rdev, pnum, RIO_MNT_REQ_CMD_IS, &regval);
+		if (rc == -EIO) {
 			pr_debug("RIO_EM: Input-status response timeout\n");
 			goto rd_err;
-                } else if (rc) {
+		} else if (rc) {
 			goto err;
-                }
+		}
 
-		pr_debug("RIO_EM: SP%d Input-status response=0x%08x\n",
-			 pnum, regval);
+		pr_debug("RIO_EM: SP%d Input-status response=0x%08x\n", pnum, regval);
 		far_ackid = (regval & RIO_PORT_N_MNT_RSP_ASTAT) >> 5;
 		far_linkstat = regval & RIO_PORT_N_MNT_RSP_LSTAT;
-		if ((rc = rio_read_config_32(rdev,
-                                             rdev->phys_efptr + RIO_PORT_N_ACK_STS_CSR(pnum),
-                                             &regval)))
-                        goto err;
+		rc = rio_read_config_32(rdev,
+				rdev->phys_efptr + RIO_PORT_N_ACK_STS_CSR(pnum), &regval);
+		if (rc)
+			goto err;
 		pr_debug("RIO_EM: SP%d_ACK_STS_CSR=0x%08x\n", pnum, regval);
 		near_ackid = (regval & RIO_PORT_N_ACK_INBOUND) >> 24;
-		pr_debug("RIO_EM: SP%d far_ackID=0x%02x far_linkstat=0x%02x" \
-			 " near_ackID=0x%02x\n",
-                         pnum, far_ackid, far_linkstat, near_ackid);
+		pr_debug(
+				"RIO_EM: SP%d far_ackID=0x%02x far_linkstat=0x%02x" " near_ackID=0x%02x\n",
+				pnum, far_ackid, far_linkstat, near_ackid);
 
 		/*
 		 * If required, synchronize ackIDs of near and
 		 * far sides.
 		 */
-		if ((far_ackid != ((regval & RIO_PORT_N_ACK_OUTSTAND) >> 8)) ||
-		    (far_ackid != (regval & RIO_PORT_N_ACK_OUTBOUND))) {
+		if ((far_ackid != ((regval & RIO_PORT_N_ACK_OUTSTAND) >> 8))
+				|| (far_ackid != (regval & RIO_PORT_N_ACK_OUTBOUND))) {
 			/* Align near outstanding/outbound ackIDs with
 			 * far inbound.
 			 */
-			if ((rc = rio_write_config_32(rdev,
-                                                      rdev->phys_efptr + RIO_PORT_N_ACK_STS_CSR(pnum),
-                                                      (near_ackid << 24) |
-                                                      (far_ackid << 8) | far_ackid)))
-                                goto err;
+			rc = rio_write_config_32(rdev,
+					rdev->phys_efptr + RIO_PORT_N_ACK_STS_CSR(pnum),
+					(near_ackid << 24) | (far_ackid << 8) | far_ackid);
+			if (rc)
+				goto err;
 			/* Align far outstanding/outbound ackIDs with
 			 * near inbound.
 			 */
 			far_ackid++;
 			if (nextdev) {
-				if ((rc = rio_write_config_32(nextdev,
-                                                              nextdev->phys_efptr +
-                                                              RIO_PORT_N_ACK_STS_CSR(
-                                                                      RIO_GET_PORT_NUM(nextdev->swpinfo)),
-                                                              (far_ackid << 24) |
-                                                              (near_ackid << 8) | near_ackid)))
-                                        goto err;
-                        } else {
+				rc = rio_write_config_32(nextdev,
+						nextdev->phys_efptr
+						+ RIO_PORT_N_ACK_STS_CSR(
+						RIO_GET_PORT_NUM(nextdev->swpinfo)),
+						(far_ackid << 24) | (near_ackid << 8) | near_ackid);
+				if (rc)
+					goto err;
+			} else {
 				pr_debug("RIO_EM: Invalid nextdev pointer (NULL)\n");
-                        }
+			}
 		}
-        rd_err:
-		if ((rc = rio_get_err_and_status(rdev, pnum, &err_status)))
-                        goto err;
+rd_err:
+	rc = rio_get_err_and_status(rdev, pnum, &err_status);
+	if (rc)
+			goto err;
 		pr_debug("RIO_EM: SP%d_ERR_STS_CSR=0x%08x\n", pnum, err_status);
 	}
 
 	if ((err_status & RIO_PORT_N_ERR_STS_PW_INP_ES) && nextdev) {
 		pr_debug("RIO_EM: servicing Input Error-Stopped state\n");
-		rio_get_input_status(nextdev,
-				     RIO_GET_PORT_NUM(nextdev->swpinfo), RIO_MNT_REQ_CMD_IS, NULL);
+		rio_get_input_status(nextdev, RIO_GET_PORT_NUM(nextdev->swpinfo),
+				RIO_MNT_REQ_CMD_IS, NULL);
 		udelay(50);
-
-		if ((rc = rio_get_err_and_status(rdev, pnum, &err_status)))
-                        goto err;
+		rc = rio_get_err_and_status(rdev, pnum, &err_status);
+		if (rc)
+			goto err;
 		pr_debug("RIO_EM: SP%d_ERR_STS_CSR=0x%08x\n", pnum, err_status);
 	}
 
-        *success = (err_status & (RIO_PORT_N_ERR_STS_PW_OUT_ES |
-                                  RIO_PORT_N_ERR_STS_PW_INP_ES)) ? 0 : 1;
-        goto rel_lock;
+	*success = (err_status & (RIO_PORT_N_ERR_STS_PW_OUT_ES |
+	RIO_PORT_N_ERR_STS_PW_INP_ES)) ? 0 : 1;
+	goto rel_lock;
 err:
-        pr_debug("RIO_EM: Read/Write Error\n");
-        *success = 0;
+	pr_debug("RIO_EM: Read/Write Error\n");
+	*success = 0;
 rel_lock:
-        if (rdev->use_hw_lock) {
-                if (rc)
-                        rio_hw_unlock(rdev->hport, rdev->destid, rdev->hopcount);
-                else
-                        rc = rio_hw_unlock(rdev->hport, rdev->destid, rdev->hopcount);
-        }
+	if (rdev->use_hw_lock) {
+		if (rc)
+			rio_hw_unlock(rdev->hport, rdev->destid, rdev->hopcount);
+		else
+			rc = rio_hw_unlock(rdev->hport, rdev->destid, rdev->hopcount);
+	}
 done:
 	if (nextdev)
 		rio_dev_put(nextdev);
-        return rc;
+	return rc;
 }
 /**
  * @brief Brute force sync ackid method
@@ -999,15 +1001,16 @@ static int rio_ackid_sync(struct rio_dev *rdev, u32 pnum)
 	struct rio_dev *nextdev;
 	u32 regval;
 	u32 far_ackid, far_linkstat, near_ackid;
-        int rc = 0;
+	int rc = 0;
 
 	nextdev = lookup_rdev_next(rdev, pnum);
 	if (IS_ERR(nextdev))
 		nextdev = NULL;
 
-        if (rdev->use_hw_lock &&
-            ((rc = rio_hw_lock_wait(rdev->hport, rdev->destid, rdev->hopcount, 10))))
-                goto done;
+	rc = rio_hw_lock_wait(rdev->hport, rdev->destid,
+						rdev->hopcount, 10);
+	if (rdev->use_hw_lock && rc)
+		goto done;
 
 	pr_debug("RIO_EM: Send link request\n");
 	/*
@@ -1022,20 +1025,19 @@ static int rio_ackid_sync(struct rio_dev *rdev, u32 pnum)
 		goto err;
 	}
 
-	pr_debug("RIO_EM: SP%d Input-status response=0x%08x\n",
-		 pnum, regval);
+	pr_debug("RIO_EM: SP%d Input-status response=0x%08x\n", pnum, regval);
 	far_ackid = (regval & RIO_PORT_N_MNT_RSP_ASTAT) >> 5;
 	far_linkstat = regval & RIO_PORT_N_MNT_RSP_LSTAT;
-	if ((rc = rio_read_config_32(rdev,
-				     rdev->phys_efptr + RIO_PORT_N_ACK_STS_CSR(pnum),
-				     &regval)))
+	rc = rio_read_config_32(rdev,
+				rdev->phys_efptr + RIO_PORT_N_ACK_STS_CSR(pnum), &regval);
+	if (rc)
 		goto err;
 
 	pr_debug("RIO_EM: SP%d_ACK_STS_CSR=0x%08x\n", pnum, regval);
 	near_ackid = (regval & RIO_PORT_N_ACK_INBOUND) >> 24;
-	pr_debug("RIO_EM: SP%d far_ackID=0x%02x far_linkstat=0x%02x"	\
-		 " near_ackID=0x%02x\n",
-		 pnum, far_ackid, far_linkstat, near_ackid);
+	pr_debug(
+			"RIO_EM: SP%d far_ackID=0x%02x far_linkstat=0x%02x" " near_ackID=0x%02x\n",
+			pnum, far_ackid, far_linkstat, near_ackid);
 
 	if (far_linkstat != 0x10) {
 		pr_warn("RIO_EM: LP link state 0x%08x\n", far_linkstat);
@@ -1046,137 +1048,142 @@ static int rio_ackid_sync(struct rio_dev *rdev, u32 pnum)
 	 * If required, synchronize ackIDs of near and
 	 * far sides.
 	 */
-	if ((far_ackid != ((regval & RIO_PORT_N_ACK_OUTSTAND) >> 8)) ||
-	    (far_ackid != (regval & RIO_PORT_N_ACK_OUTBOUND))) {
+	if ((far_ackid != ((regval & RIO_PORT_N_ACK_OUTSTAND) >> 8))
+			|| (far_ackid != (regval & RIO_PORT_N_ACK_OUTBOUND))) {
 		/* Align near outstanding/outbound ackIDs with
 		 * far inbound.
 		 */
-		if ((rc = rio_write_config_32(rdev,
-					      rdev->phys_efptr + RIO_PORT_N_ACK_STS_CSR(pnum),
-					      (far_ackid << 24) |
-					      (far_ackid << 8) | far_ackid)))
+		rc = rio_write_config_32(rdev,
+						rdev->phys_efptr + RIO_PORT_N_ACK_STS_CSR(pnum),
+						(far_ackid << 24) | (far_ackid << 8) | far_ackid);
+		if (rc)
 			goto err;
 	}
 	goto rel_lock;
 rd_err:
-	if ((rc = rio_get_err_and_status(rdev, pnum, &regval)))
+	rc = rio_get_err_and_status(rdev, pnum, &regval);
+	if (rc)
 		goto err;
 	pr_warn("RIO_EM: SP%d_ERR_STS_CSR=0x%08x\n", pnum, regval);
-        goto rel_lock;
+	goto rel_lock;
 err:
-        pr_warn("RIO_EM: Read/Write Error\n");
+	pr_warn("RIO_EM: Read/Write Error\n");
 rel_lock:
-        if (rdev->use_hw_lock) {
-                if (rc)
-                        rio_hw_unlock(rdev->hport, rdev->destid, rdev->hopcount);
-                else
-                        rc = rio_hw_unlock(rdev->hport, rdev->destid, rdev->hopcount);
-        }
+	if (rdev->use_hw_lock) {
+		if (rc)
+			rio_hw_unlock(rdev->hport, rdev->destid, rdev->hopcount);
+		else
+			rc = rio_hw_unlock(rdev->hport, rdev->destid, rdev->hopcount);
+	}
 done:
 	if (nextdev)
 		rio_dev_put(nextdev);
-        return rc;
+	return rc;
 }
 
-static int
-rio_pw_dump_msg(union rio_pw_msg *pw_msg)
+static int rio_pw_dump_msg(union rio_pw_msg *pw_msg)
 {
 #ifdef DEBUG_PW
-        u32 i;
-        for (i = 0; i < RIO_PW_MSG_SIZE/sizeof(u32);) {
-                pr_debug("0x%02x: %08x %08x %08x %08x\n",
-                         i * 4, pw_msg->raw[i], pw_msg->raw[i + 1],
-                         pw_msg->raw[i + 2], pw_msg->raw[i + 3]);
-                i += 4;
-        }
+	u32 i;
+	for (i = 0; i < RIO_PW_MSG_SIZE/sizeof(u32);) {
+		pr_debug("0x%02x: %08x %08x %08x %08x\n",
+				i * 4, pw_msg->raw[i], pw_msg->raw[i + 1],
+				pw_msg->raw[i + 2], pw_msg->raw[i + 3]);
+		i += 4;
+	}
 #endif
-        return 0;
+	return 0;
 }
 
-static int
-rio_handle_local_domain(struct rio_dev *rdev, int portnum, u32 err_status)
-{
-        int rc = 0;
+static int rio_handle_local_domain(struct rio_dev *rdev, int portnum,
+		u32 err_status) {
+	int rc = 0;
 	u32 em_perrdet, em_ltlerrdet;
 
 	if (rdev->local_domain) {
-                if (rdev->use_hw_lock &&
-                    ((rc = rio_hw_lock_wait(rdev->hport, rdev->destid, rdev->hopcount, 10))))
-                        goto done;
-
-		if ((rc = rio_read_config_32(rdev,
-                                             rdev->em_efptr + RIO_EM_PN_ERR_DETECT(portnum),
-                                             &em_perrdet))) {
-                        pr_debug("RIO_PW: Failed to read RIO_EM_PN_ERR_DETECT from device\n");
-                        goto rel_lock;
-                }
+		rc = rio_hw_lock_wait(rdev->hport, rdev->destid,
+								rdev->hopcount, 10);
+		if (rdev->use_hw_lock && rc)
+			goto done;
+		rc = rio_read_config_32(rdev,
+						rdev->em_efptr + RIO_EM_PN_ERR_DETECT(portnum), &em_perrdet);
+		if (rc) {
+			pr_debug(
+					"RIO_PW: Failed to read RIO_EM_PN_ERR_DETECT from device\n");
+			goto rel_lock;
+		}
 		if (em_perrdet) {
 			/* Clear EM Port N Error Detect CSR */
-			if ((rc = rio_write_config_32(rdev,
-                                                      rdev->em_efptr + RIO_EM_PN_ERR_DETECT(portnum),
-                                                      0))) {
-                                pr_debug("RIO_PW: Failed to write RIO_EM_PN_ERR_DETECT to device\n");
-                                goto rel_lock;
-                        }
+			rc = rio_write_config_32(rdev,
+								rdev->em_efptr + RIO_EM_PN_ERR_DETECT(portnum), 0);
+			if (rc) {
+				pr_debug(
+						"RIO_PW: Failed to write RIO_EM_PN_ERR_DETECT to device\n");
+				goto rel_lock;
+			}
+		}
+		rc = rio_read_config_32(rdev,
+						rdev->em_efptr + RIO_EM_LTL_ERR_DETECT, &em_ltlerrdet);
+		if (rc) {
+			pr_debug(
+					"RIO_PW: Failed to read RIO_EM_LTL_ERR_DETECT from device\n");
+			goto rel_lock;
 		}
-		if ((rc = rio_read_config_32(rdev,
-                                             rdev->em_efptr + RIO_EM_LTL_ERR_DETECT,
-                                             &em_ltlerrdet))) {
-                        pr_debug("RIO_PW: Failed to read RIO_EM_LTL_ERR_DETECT from device\n");
-                        goto rel_lock;
-                }
 		if (em_ltlerrdet) {
 			/* Clear EM L/T Layer Error Detect CSR */
-			if ((rc = rio_write_config_32(rdev,
-                                                      rdev->em_efptr + RIO_EM_LTL_ERR_DETECT, 0))) {
-                                pr_debug("RIO_PW: Failed to write RIO_EM_LTL_ERR_DETECT to device\n");
-                                goto rel_lock;
-                        }
+			rc = rio_write_config_32(rdev,
+								rdev->em_efptr + RIO_EM_LTL_ERR_DETECT, 0);
+			if (rc) {
+				pr_debug(
+						"RIO_PW: Failed to write RIO_EM_LTL_ERR_DETECT to device\n");
+				goto rel_lock;
+			}
 		}
 		/* Clear remaining error bits and Port-Write Pending bit */
-		if ((rc = rio_write_config_32(rdev,
-                                              rdev->phys_efptr + RIO_PORT_N_ERR_STS_CSR(portnum),
-                                              err_status))) {
-                        pr_debug("RIO_PW: Failed to write RIO_PORT_N_ERR_STS_CSR to device\n");
-                        goto rel_lock;
-                }
-        rel_lock:
-                if (rdev->use_hw_lock) {
-                        if (rc)
-                                rio_hw_unlock(rdev->hport, rdev->destid, rdev->hopcount);
-                        else
-                                rc = rio_hw_unlock(rdev->hport, rdev->destid, rdev->hopcount);
-                }
+		rc = rio_write_config_32(rdev,
+						rdev->phys_efptr + RIO_PORT_N_ERR_STS_CSR(portnum), err_status);
+		if (rc) {
+			pr_debug(
+					"RIO_PW: Failed to write RIO_PORT_N_ERR_STS_CSR to device\n");
+			goto rel_lock;
+		}
+rel_lock:
+		if (rdev->use_hw_lock) {
+			if (rc)
+				rio_hw_unlock(rdev->hport, rdev->destid, rdev->hopcount);
+			else
+				rc = rio_hw_unlock(rdev->hport, rdev->destid, rdev->hopcount);
+		}
 	}
 done:
-        return rc;
+	return rc;
 }
 
-static int
-rio_handle_events(struct rio_dev *rdev, int portnum, u32 err_status, int *event)
-{
-        int rc = 0;
-        int success;
+static int rio_handle_events(struct rio_dev *rdev, int portnum, u32 err_status,
+		int *event) {
+	int rc = 0;
+	int success;
 
 	rio_tree_write_lock();
 
 	if (err_status & RIO_PORT_N_ERR_STS_PORT_OK) {
 		pr_debug("RIO: port OK\n");
-                if ((!(rdev->rswitch->port_init & (1 << portnum))) ||
-                    (!(rdev->rswitch->port_ok & (1 << portnum)))) {
+		if ((!(rdev->rswitch->port_init & (1 << portnum)))
+				|| (!(rdev->rswitch->port_ok & (1 << portnum)))) {
 			rdev->rswitch->port_init |= (1 << portnum);
 			rdev->rswitch->port_ok |= (1 << portnum);
 			if (rdev->local_domain) {
-				if ((rc = rio_set_port_lockout(rdev, portnum, 0, 1))) {
-                                        pr_warn("RIO: Failed to set port lockout bit.\n");
-                                        goto done;
-                                }
-                        }
+				rc = rio_set_port_lockout(rdev, portnum, 0, 1);
+				if (rc) {
+					pr_warn("RIO: Failed to set port lockout bit.\n");
+					goto done;
+				}
+			}
 		}
-                /* Schedule Insertion Service */
-                pr_debug("RIO: Device Insertion on [%s]-P%d\n",
-                         rio_name(rdev), portnum);
-                *event = RIO_DEVICE_INSERTION;
+		/* Schedule Insertion Service */
+		pr_debug("RIO: Device Insertion on [%s]-P%d\n", rio_name(rdev),
+				portnum);
+		*event = RIO_DEVICE_INSERTION;
 
 		if (rdev->local_domain) {
 			/* Clear error-stopped states (if reported).
@@ -1184,108 +1191,110 @@ rio_handle_events(struct rio_dev *rdev, int portnum, u32 err_status, int *event)
 			 * may be needed for successful recovery.
 			 */
 			if (err_status & (RIO_PORT_N_ERR_STS_PW_OUT_ES |
-					  RIO_PORT_N_ERR_STS_PW_INP_ES)) {
-                                if ((rc = rio_clr_err_stopped(rdev, portnum, err_status, &success))) {
-                                        goto done;
-				}
+			RIO_PORT_N_ERR_STS_PW_INP_ES)) {
+				rc = rio_clr_err_stopped(rdev, portnum, err_status,
+										&success);
+				if (rc)
+					goto done;
 				if (!success) {
 					rc = rio_clr_err_stopped(rdev, portnum, 0, &success);
-                                        if (rc) {
-                                                goto done;
-					}
-                                }
+					if (rc)
+						goto done;
+				}
 			}
 		}
-	}  else { /* if (err_status & RIO_PORT_N_ERR_STS_PORT_UNINIT) */
-                if ((!(rdev->rswitch->port_init & (1 << portnum))) ||
-                    (rdev->rswitch->port_ok & (1 << portnum))) {
+	} else { /* if (err_status & RIO_PORT_N_ERR_STS_PORT_UNINIT) */
+		if ((!(rdev->rswitch->port_init & (1 << portnum)))
+				|| (rdev->rswitch->port_ok & (1 << portnum))) {
 			rdev->rswitch->port_init |= (1 << portnum);
 			rdev->rswitch->port_ok &= ~(1 << portnum);
 			if (rdev->local_domain) {
-                                if (rdev->use_hw_lock &&
-                                    ((rc = rio_hw_lock_wait(rdev->hport,
-                                                            rdev->destid,
-                                                            rdev->hopcount, 10))))
-                                        goto done;
-				if ((rc = rio_set_port_lockout(rdev, portnum, 1, 0))) {
-                                        pr_warn("RIO: Failed to set port lockout bit.\n");
-                                        if (rdev->use_hw_lock)
-                                                rio_hw_unlock(rdev->hport,
-                                                              rdev->destid,
-                                                              rdev->hopcount);
-                                        goto done;
-                                }
-				if ((rc = rio_write_config_32(rdev,
-                                                              rdev->phys_efptr +
-                                                              RIO_PORT_N_ACK_STS_CSR(portnum),
-                                                              RIO_PORT_N_ACK_CLEAR))) {
-                                        pr_warn("RIO: Failed to write to RIO_PORT_N_ACK_STS_CSR.\n");
-                                        if (rdev->use_hw_lock)
-                                                rio_hw_unlock(rdev->hport,
-                                                              rdev->destid,
-                                                              rdev->hopcount);
-                                        goto done;
-                                }
-                                if (rdev->use_hw_lock &&
-                                    ((rc = rio_hw_unlock(rdev->hport,
-                                                         rdev->destid,
-                                                         rdev->hopcount))))
-                                        goto done;
+				rc = rio_hw_lock_wait(rdev->hport, rdev->destid,
+												rdev->hopcount, 10);
+				if (rdev->use_hw_lock && rc)
+					goto done;
+				rc = rio_set_port_lockout(rdev, portnum, 1, 0);
+				if (rc) {
+					pr_warn("RIO: Failed to set port lockout bit.\n");
+					if (rdev->use_hw_lock)
+						rio_hw_unlock(rdev->hport, rdev->destid,
+								rdev->hopcount);
+					goto done;
+				}
+				rc = rio_write_config_32(rdev,
+										rdev->phys_efptr + RIO_PORT_N_ACK_STS_CSR(portnum),
+										RIO_PORT_N_ACK_CLEAR);
+				if (rc) {
+					pr_warn("RIO: Failed to write to RIO_PORT_N_ACK_STS_CSR.\n");
+					if (rdev->use_hw_lock)
+						rio_hw_unlock(rdev->hport, rdev->destid,
+								rdev->hopcount);
+					goto done;
+				}
+				rc = rio_hw_unlock(rdev->hport, rdev->destid,
+												rdev->hopcount);
+				if (rdev->use_hw_lock && rc)
+					goto done;
 			}
 		}
-                /* Schedule Extraction Service */
-                pr_debug("RIO: Device Extraction on [%s]-P%d\n",
-                         rio_name(rdev), portnum);
-                *event = RIO_DEVICE_EXTRACTION;
+		/* Schedule Extraction Service */
+		pr_debug("RIO: Device Extraction on [%s]-P%d\n", rio_name(rdev),
+				portnum);
+		*event = RIO_DEVICE_EXTRACTION;
 	}
 done:
-        rio_tree_write_unlock();
-        return rc;
+	rio_tree_write_unlock();
+	return rc;
 }
+
 static int __rio_setup_event(struct rio_dev *rdev, int portnum, int event)
 {
-        int rc = 0;
+	int rc = 0;
 	int tmp_event = 0;
 	u32 err_status;
 
-        rdev = rio_get_by_ptr(rdev);
-        if (!rdev)
-                goto done;
+	rdev = rio_get_by_ptr(rdev);
+	if (!rdev)
+		goto done;
 
 	if (rdev->local_domain) {
 		if (rdev->rswitch->em_handle) {
-                        if ((!rdev->use_hw_lock) ||
-                            (!rio_hw_lock_wait(rdev->hport, rdev->destid, rdev->hopcount, 10))) {
-                                rdev->rswitch->em_handle(rdev, portnum);
-                                if (rdev->use_hw_lock)
-                                        rio_hw_unlock(rdev->hport, rdev->destid, rdev->hopcount);
-                        }
-                }
+			if ((!rdev->use_hw_lock)
+					|| (!rio_hw_lock_wait(rdev->hport, rdev->destid,
+							rdev->hopcount, 10))) {
+				rdev->rswitch->em_handle(rdev, portnum);
+				if (rdev->use_hw_lock)
+					rio_hw_unlock(rdev->hport, rdev->destid, rdev->hopcount);
+			}
+		}
 	}
-	if ((rc = rio_get_err_and_status(rdev, portnum, &err_status)))
-                goto rel_dev;
+	rc = rio_get_err_and_status(rdev, portnum, &err_status);
+	if (rc)
+		goto rel_dev;
 	pr_debug("port %d RIO_PORT_N_ERR_STS_CSR 0x%x\n", portnum, err_status);
-        if ((rc = rio_handle_events(rdev, portnum, err_status, &tmp_event)))
-                goto rel_dev;
-
-        if (tmp_event != event) {
-                rc = 1;
-                if (event == RIO_DEVICE_EXTRACTION) {
-                        pr_err("RIO: Removal of not reseted device is not allowed.\n");
-                } else {
-                        pr_err("RIO: Insertion of device on not ok port is not allowed.\n");
-		}
-                goto rel_dev;
-        }
+	rc = rio_handle_events(rdev, portnum, err_status, &tmp_event);
+	if (rc)
+		goto rel_dev;
+
+	if (tmp_event != event) {
+		rc = 1;
+		if (event == RIO_DEVICE_EXTRACTION)
+			pr_err("RIO: Removal of not reseted device is not allowed.\n");
+		else
+			pr_err("RIO: Insertion of device on not ok port is not allowed.\n");
+		goto rel_dev;
+	}
 
-        if ((rc = rio_handle_local_domain(rdev, portnum, err_status)))
-                goto rel_dev;
+	rc = rio_handle_local_domain(rdev, portnum, err_status);
+	if (rc)
+		goto rel_dev;
 
 rel_dev:
-        rio_dev_put(rdev);
+	rio_dev_put(rdev);
 done:
 	return rc;
 }
+
 int rio_setup_event(struct rio_dev *rdev, int portnum, int event)
 {
 	return __rio_setup_event(rdev, portnum, event);
@@ -1305,26 +1314,25 @@ int rio_setup_event_force(struct rio_dev *rdev, int portnum, int event)
  * Processes an inbound port-write message. Returns 0 if the request
  * has been satisfied.
  */
-int
-rio_inb_pwrite_handler(struct rio_mport *mport, union rio_pw_msg *pw_msg)
+int rio_inb_pwrite_handler(struct rio_mport *mport, union rio_pw_msg *pw_msg)
 {
 	struct rio_dev *rdev;
-        int rc = 0;
-        int portnum;
+	int rc = 0;
+	int portnum;
 
 	pr_debug("RIO-EM: --- %s ---\n", __func__);
 
 	rdev = rio_get_comptag(mport, (pw_msg->em.comptag & RIO_CTAG_UDEVID));
 	if (rdev == NULL) {
 		/* Device removed or enumeration error */
-		pr_debug("RIO_PW: %s No matching device for CTag 0x%08x\n",
-                         __func__, pw_msg->em.comptag);
-                rc = -EIO;
-                goto done;
+		pr_debug("RIO_PW: %s No matching device for CTag 0x%08x\n", __func__,
+				pw_msg->em.comptag);
+		rc = -EIO;
+		goto done;
 	}
 	pr_debug("RIO_PW: Port-Write message from %s\n", rio_name(rdev));
 
-        rio_pw_dump_msg(pw_msg);
+	rio_pw_dump_msg(pw_msg);
 
 	/* Call an external service function (if such is registered
 	 * for this device). This may be the service for endpoints that send
@@ -1335,7 +1343,7 @@ rio_inb_pwrite_handler(struct rio_mport *mport, union rio_pw_msg *pw_msg)
 	if (rdev->pwcback != NULL) {
 		rc = rdev->pwcback(rdev, pw_msg, 0);
 		if (rc == 0)
-                        goto rel_dev;
+			goto rel_dev;
 	}
 
 	portnum = pw_msg->em.is_port & 0xFF;
@@ -1346,43 +1354,42 @@ rio_inb_pwrite_handler(struct rio_mport *mport, union rio_pw_msg *pw_msg)
 	 */
 	if (rio_chk_dev_access(rdev)) {
 		pr_debug("RIO_PW: device access failed\n");
-                rc = -EIO;
-                goto rel_dev;
+		rc = -EIO;
+		goto rel_dev;
 	}
 
 	/* For End-point devices processing stops here */
 	if (!(rdev->pef & RIO_PEF_SWITCH))
-                goto rel_dev;
+		goto rel_dev;
 
 	if (!rdev->phys_efptr) {
-		pr_err("RIO_PW: Bad switch initialization for %s\n",
-                       rio_name(rdev));
-                goto rel_dev;
+		pr_err("RIO_PW: Bad switch initialization for %s\n", rio_name(rdev));
+		goto rel_dev;
 	}
 
 	if (rdev->local_domain) {
 		/* Process the port-write notification from switch
 		 */
-		if (rdev->rswitch->em_handle) {
+		if (rdev->rswitch->em_handle)
 			rdev->rswitch->em_handle(rdev, portnum);
-                }
 	}
 
 #if !defined(CONFIG_RAPIDIO_HOTPLUG)
-/**
- * FIXME!
- * Temporary fix to make ulma booting on DUL work
- * with the old version of the ulma driver for DUL
- * which is not adopted to hotplug
- * Maybe we should do this anyway if user don't define
- * hotplug - to keep the same level of PW handling as
- * in original RIO driver - i.e. call rio_setup_event,
- * not the rest obviously.
- */
+	/**
+	 * FIXME!
+	 * Temporary fix to make ulma booting on DUL work
+	 * with the old version of the ulma driver for DUL
+	 * which is not adopted to hotplug
+	 * Maybe we should do this anyway if user don't define
+	 * hotplug - to keep the same level of PW handling as
+	 * in original RIO driver - i.e. call rio_setup_event,
+	 * not the rest obviously.
+	 */
 	{
 		u32 err_status;
 		int event = 0;
-		if ((rc = rio_get_err_and_status(rdev, portnum, &err_status)))
+		rc = rio_get_err_and_status(rdev, portnum, &err_status);
+		if (rc)
 			goto rel_dev;
 
 		if (err_status & RIO_PORT_N_ERR_STS_PORT_OK)
@@ -1393,12 +1400,12 @@ rio_inb_pwrite_handler(struct rio_mport *mport, union rio_pw_msg *pw_msg)
 		rc = rio_setup_event(rdev, portnum, event);
 
 		if (rdev->pwcback != NULL && rc == 0)
-			(void)rdev->pwcback(rdev, pw_msg, event);
+			(void) rdev->pwcback(rdev, pw_msg, event);
 	}
 #endif
 
 rel_dev:
-        rio_dev_put(rdev);
+	rio_dev_put(rdev);
 done:
 	return rc;
 }
@@ -1413,34 +1420,31 @@ EXPORT_SYMBOL_GPL(rio_inb_pwrite_handler);
  * @from: Offset of  current Extended Feature block header (if 0 starts
  * from	ExtFeaturePtr)
  */
-int
-rio_mport_get_efb(struct rio_mport *port, int local, u16 destid,
-                  u8 hopcount, u32 from, u32 *ext_ftr_ptr)
-{
+int rio_mport_get_efb(struct rio_mport *port, int local, u16 destid,
+		u8 hopcount, u32 from, u32 *ext_ftr_ptr) {
 	u32 reg_val;
-        int rc = 0;
+	int rc = 0;
 
 	if (from == 0) {
 		if (local)
-			rc = rio_local_read_config_32(port, RIO_ASM_INFO_CAR,
-                                                      &reg_val);
+			rc = rio_local_read_config_32(port, RIO_ASM_INFO_CAR, &reg_val);
 		else
 			rc = rio_mport_read_config_32(port, destid, hopcount,
-                                                      RIO_ASM_INFO_CAR, &reg_val);
-                if (!rc)
-                        *ext_ftr_ptr = reg_val & RIO_EXT_FTR_PTR_MASK;
+			RIO_ASM_INFO_CAR, &reg_val);
+		if (!rc)
+			*ext_ftr_ptr = reg_val & RIO_EXT_FTR_PTR_MASK;
 	} else {
 		if (local)
 			rc = rio_local_read_config_32(port, from, &reg_val);
 		else
-			rc = rio_mport_read_config_32(port, destid, hopcount,
-                                                      from, &reg_val);
-                if (!rc)
-                        *ext_ftr_ptr = RIO_GET_BLOCK_ID(reg_val);
+			rc = rio_mport_read_config_32(port, destid, hopcount, from,
+					&reg_val);
+		if (!rc)
+			*ext_ftr_ptr = RIO_GET_BLOCK_ID(reg_val);
 	}
-        if (rc)
-                *ext_ftr_ptr = 0;
-        return rc;
+	if (rc)
+		*ext_ftr_ptr = 0;
+	return rc;
 }
 
 /**
@@ -1469,41 +1473,43 @@ rio_mport_get_efb(struct rio_mport *port, int local, u16 destid,
  *
  * %RIO_EFB_SER_EP_FREE_ID	LP/Serial EP Free Devices
  */
-int
-rio_mport_get_feature(struct rio_mport * port, int local, u16 destid,
-		      u8 hopcount, int ftr, u32 *feature)
-{
+int rio_mport_get_feature(struct rio_mport *port, int local, u16 destid,
+		u8 hopcount, int ftr, u32 *feature) {
 	u32 asm_info, ext_ftr_ptr = 0, ftr_header;
-        int rc = 0;
+	int rc = 0;
 
 	if (local) {
-		if ((rc = rio_local_read_config_32(port, RIO_ASM_INFO_CAR, &asm_info)))
-                        goto done;
-        } else {
-		if ((rc = rio_mport_read_config_32(port, destid, hopcount,
-                                                   RIO_ASM_INFO_CAR, &asm_info)))
-                        goto done;
-        }
+		rc = rio_local_read_config_32(port, RIO_ASM_INFO_CAR, &asm_info);
+		if (rc)
+			goto done;
+	} else {
+		rc = rio_mport_read_config_32(port, destid, hopcount,
+				RIO_ASM_INFO_CAR, &asm_info);
+		if (rc)
+			goto done;
+	}
 
 	ext_ftr_ptr = asm_info & RIO_EXT_FTR_PTR_MASK;
 
 	while (ext_ftr_ptr) {
 		if (local) {
-			if ((rc = rio_local_read_config_32(port, ext_ftr_ptr,
-                                                           &ftr_header)))
-                                goto done;
+			rc = rio_local_read_config_32(port, ext_ftr_ptr, &ftr_header);
+			if (rc)
+				goto done;
 		} else {
-			if ((rc = rio_mport_read_config_32(port, destid, hopcount,
-                                                           ext_ftr_ptr, &ftr_header)))
-                                goto done;
-                }
+			rc = rio_mport_read_config_32(port, destid, hopcount,
+								ext_ftr_ptr, &ftr_header);
+			if (rc)
+				goto done;
+		}
 		if (RIO_GET_BLOCK_ID(ftr_header) == ftr)
-                        goto done;
-		if (!(ext_ftr_ptr = RIO_GET_BLOCK_PTR(ftr_header)))
+			goto done;
+		ext_ftr_ptr = RIO_GET_BLOCK_PTR(ftr_header);
+		if (!ext_ftr_ptr)
 			break;
 	}
 done:
-        *feature = ext_ftr_ptr;
+	*feature = ext_ftr_ptr;
 	return rc;
 }
 /**
@@ -1545,7 +1551,7 @@ struct rio_dev *rio_get_asm(u16 vid, u16 did,
 			rcu_read_unlock();
 			return NULL;
 		}
-	retry:
+retry:
 		num = radix_tree_gang_lookup_slot(&mport->net.dev_tree, (void ***)nptr,
 						  NULL, key, items);
 		if (num > 0) {
@@ -1577,6 +1583,7 @@ done:
 	rcu_read_unlock();
 	return rdev;
 }
+EXPORT_SYMBOL_GPL(rio_get_asm);
 
 /**
  * rio_get_device - Begin or continue searching for a RIO device by vid/did
@@ -1596,6 +1603,7 @@ struct rio_dev *rio_get_device(u16 vid, u16 did, struct rio_dev *from)
 {
 	return rio_get_asm(vid, did, RIO_ANY_ID, RIO_ANY_ID, from);
 }
+EXPORT_SYMBOL_GPL(rio_get_device);
 
 /**
  * rio_std_route_add_entry - Add switch route table entry using standard
@@ -1607,20 +1615,18 @@ struct rio_dev *rio_get_device(u16 vid, u16 did, struct rio_dev *from)
  * @route_destid: destID entry in the RT
  * @route_port: destination port for specified destID
  */
-int
-rio_std_route_add_entry(struct rio_mport *mport, u16 destid, u8 hopcount,
-                            u16 table, u16 route_destid, u8 route_port)
-{
-        int rc = 0;
+int rio_std_route_add_entry(struct rio_mport *mport, u16 destid, u8 hopcount,
+		u16 table, u16 route_destid, u8 route_port) {
+	int rc = 0;
 	if (table == RIO_GLOBAL_TABLE) {
-		if ((rc = rio_mport_write_config_32(mport, destid, hopcount,
-                                                    RIO_STD_RTE_CONF_DESTID_SEL_CSR,
-                                                    (u32)route_destid)))
-                        goto done;
-		if ((rc = rio_mport_write_config_32(mport, destid, hopcount,
-                                                    RIO_STD_RTE_CONF_PORT_SEL_CSR,
-                                                    (u32)route_port)))
-                        goto done;
+		rc = rio_mport_write_config_32(mport, destid, hopcount,
+				RIO_STD_RTE_CONF_DESTID_SEL_CSR, (u32) route_destid);
+		if (rc)
+			goto done;
+		rc = rio_mport_write_config_32(mport, destid, hopcount,
+				RIO_STD_RTE_CONF_PORT_SEL_CSR, (u32) route_port);
+		if (rc)
+			goto done;
 	}
 
 	udelay(10);
@@ -1639,24 +1645,22 @@ done:
  * @route_destid: destID entry in the RT
  * @route_port: returned destination port for specified destID
  */
-int
-rio_std_route_get_entry(struct rio_mport *mport, u16 destid, u8 hopcount,
-                        u16 table, u16 route_destid, u8 *route_port)
-{
+int rio_std_route_get_entry(struct rio_mport *mport, u16 destid, u8 hopcount,
+		u16 table, u16 route_destid, u8 *route_port) {
 	u32 result = 0;
-        int rc = 0;
+	int rc = 0;
 
 	if (table == RIO_GLOBAL_TABLE) {
-		if ((rc = rio_mport_write_config_32(mport, destid, hopcount,
-                                                    RIO_STD_RTE_CONF_DESTID_SEL_CSR,
-                                                    route_destid)))
-                        goto done;
-		if ((rc = rio_mport_read_config_32(mport, destid, hopcount,
-                                                   RIO_STD_RTE_CONF_PORT_SEL_CSR,
-                                                   &result)))
-                        goto done;
-
-		*route_port = (u8)result;
+		rc = rio_mport_write_config_32(mport, destid, hopcount,
+				RIO_STD_RTE_CONF_DESTID_SEL_CSR, route_destid);
+		if (rc)
+			goto done;
+		rc = rio_mport_read_config_32(mport, destid, hopcount,
+				RIO_STD_RTE_CONF_PORT_SEL_CSR, &result);
+		if (rc)
+			goto done;
+
+		*route_port = (u8) result;
 	}
 done:
 	return rc;
@@ -1672,44 +1676,44 @@ done:
  */
 int
 rio_std_route_clr_table(struct rio_mport *mport, u16 destid,
-                        u8 hopcount, u16 table)
+		u8 hopcount, u16 table)
 {
 	u32 max_destid = 0xff;
 	u32 i, pef, id_inc = 1, ext_cfg = 0;
 	u32 port_sel = RIO_INVALID_ROUTE;
-        int rc = 0;
+	int rc = 0;
 
 	if (table == RIO_GLOBAL_TABLE) {
-		if ((rc = rio_mport_read_config_32(mport, destid, hopcount,
-                                                   RIO_PEF_CAR, &pef)))
-                        goto done;
+		rc = rio_mport_read_config_32(mport, destid, hopcount,
+				RIO_PEF_CAR, &pef);
+		if (rc)
+			goto done;
 
 		if (mport->sys_size) {
-			if ((rc = rio_mport_read_config_32(mport, destid, hopcount,
-                                                           RIO_SWITCH_RT_LIMIT,
-                                                           &max_destid)))
-                                goto done;
+			rc = rio_mport_read_config_32(mport, destid, hopcount,
+						RIO_SWITCH_RT_LIMIT, &max_destid);
+			if (rc)
+				goto done;
 			max_destid &= RIO_RT_MAX_DESTID;
 		}
 
 		if (pef & RIO_PEF_EXT_RT) {
 			ext_cfg = 0x80000000;
 			id_inc = 4;
-			port_sel = (RIO_INVALID_ROUTE << 24) |
-                                (RIO_INVALID_ROUTE << 16) |
-                                (RIO_INVALID_ROUTE << 8) |
-                                RIO_INVALID_ROUTE;
+			port_sel = (RIO_INVALID_ROUTE << 24) | (RIO_INVALID_ROUTE << 16)
+					| (RIO_INVALID_ROUTE << 8) |
+					RIO_INVALID_ROUTE;
 		}
 
 		for (i = 0; i <= max_destid;) {
-			if ((rc = rio_mport_write_config_32(mport, destid, hopcount,
-                                                            RIO_STD_RTE_CONF_DESTID_SEL_CSR,
-                                                            ext_cfg | i)))
-                                goto done;
-			if ((rc = rio_mport_write_config_32(mport, destid, hopcount,
-                                                            RIO_STD_RTE_CONF_PORT_SEL_CSR,
-                                                            port_sel)))
-                                goto done;
+			rc = rio_mport_write_config_32(mport, destid, hopcount,
+						RIO_STD_RTE_CONF_DESTID_SEL_CSR, ext_cfg | i);
+			if (rc)
+				goto done;
+			rc = rio_mport_write_config_32(mport, destid, hopcount,
+						RIO_STD_RTE_CONF_PORT_SEL_CSR, port_sel);
+			if (rc)
+				goto done;
 			i += id_inc;
 		}
 	}
@@ -1727,9 +1731,8 @@ static int rio_init(void)
 {
 	struct rio_dev *dev = NULL;
 
-	while ((dev = rio_get_device(RIO_ANY_ID, RIO_ANY_ID, dev)) != NULL) {
+	while ((dev = rio_get_device(RIO_ANY_ID, RIO_ANY_ID, dev)) != NULL)
 		rio_fixup_device(dev);
-	}
 	return 0;
 }
 /**
@@ -1799,17 +1802,13 @@ struct rio_mport *rio_get_mport(int hostid, struct rio_mport *from)
 	struct list_head *n;
 
 	if (list_empty(&rio_mports))
-        {
 		return NULL;
-        }
 
 	n = from ? from->node.next : rio_mports.next;
 	while (n && (n != &rio_mports)) {
 		port = list_entry(n, struct rio_mport, node);
 		if (hostid == RIO_ANY_ID || hostid == port->host_deviceid)
-                {
 			return port;
-                }
 		n = n->next;
 	}
 	return NULL;
@@ -1827,9 +1826,7 @@ int rio_register_mport(struct rio_mport *port)
 	port->host_deviceid = rio_get_hdid(port->id);
 #ifndef CONFIG_RAPIDIO_STATIC_DESTID
 	if (port->host_deviceid == 0xb)
-        {
 		port->host_deviceid = RIO_ANY_ID;
-        }
 #endif
 
 #ifdef NEW_STYLE
@@ -1846,15 +1843,4 @@ int rio_register_mport(struct rio_mport *port)
 	list_add_tail(&port->node, &rio_mports);
 	return 0;
 }
-EXPORT_SYMBOL_GPL(rio_local_get_device_id);
-EXPORT_SYMBOL_GPL(rio_get_device);
-EXPORT_SYMBOL_GPL(rio_get_asm);
-EXPORT_SYMBOL_GPL(rio_request_inb_dbell);
-EXPORT_SYMBOL_GPL(rio_release_inb_dbell);
-EXPORT_SYMBOL_GPL(rio_request_outb_dbell);
-EXPORT_SYMBOL_GPL(rio_release_outb_dbell);
-EXPORT_SYMBOL_GPL(rio_request_inb_mbox);
-EXPORT_SYMBOL_GPL(rio_release_inb_mbox);
-EXPORT_SYMBOL_GPL(rio_request_outb_mbox);
-EXPORT_SYMBOL_GPL(rio_release_outb_mbox);
 EXPORT_SYMBOL_GPL(rio_register_mport);
diff --git a/drivers/rapidio/switches/idt_gen2.c b/drivers/rapidio/switches/idt_gen2.c
index 809b7a3..ab8fc08 100644
--- a/drivers/rapidio/switches/idt_gen2.c
+++ b/drivers/rapidio/switches/idt_gen2.c
@@ -333,8 +333,7 @@ idtg2_em_handler(struct rio_dev *rdev, u8 portnum)
 			rio_read_config_32(rdev,
 					IDT_ISLTL_ADDRESS_CAP, &regval);
 
-			pr_debug("RIO: %s Implementation Specific LTL errors" \
-				 " 0x%x @(0x%x)\n",
+			pr_debug("RIO: %s Implementation Specific LTL errors 0x%x @(0x%x)\n",
 				 rio_name(rdev), em_ltlerrdet, regval);
 
 			/* Clear implementation specific address capture CSR */
@@ -354,8 +353,8 @@ idtg2_em_handler(struct rio_dev *rdev, u8 portnum)
 			rio_read_config_32(rdev,
 					IDT_PORT_ISERR_DET(portnum), &regval);
 
-			pr_debug("RIO: %s Implementation Specific Port" \
-				 " errors 0x%x\n", rio_name(rdev), regval);
+			pr_debug("RIO: %s Implementation Specific Port errors 0x%x\n",
+					rio_name(rdev), regval);
 
 			/* Clear all implementation specific events */
 			rio_write_config_32(rdev,
diff --git a/include/linux/rio_drv.h b/include/linux/rio_drv.h
index c320d77..1778100 100644
--- a/include/linux/rio_drv.h
+++ b/include/linux/rio_drv.h
@@ -370,8 +370,8 @@ static inline int rio_add_inb_buffer(struct rio_mport *mport, int mbox,
 static inline void *rio_get_inb_message(struct rio_mport *mport, int mbox,
 				int letter, int *sz, int *slot, u16 *destid)
 {
-	return mport->ops->get_inb_message(mport, mbox, letter, \
-					   sz, slot, destid);
+	return mport->ops->get_inb_message(mport, mbox, letter,
+			sz, slot, destid);
 }
 
 /* Doorbell management */
@@ -392,8 +392,8 @@ extern void rio_release_outb_region(struct rio_mport *, u32);
 extern int rio_request_inb_pwrite(struct rio_dev *,
 			int (*)(struct rio_dev *, union rio_pw_msg*, int));
 extern int rio_release_inb_pwrite(struct rio_dev *);
-extern int rio_inb_pwrite_handler(struct rio_mport *mport, \
-				  union rio_pw_msg *pw_msg);
+extern int rio_inb_pwrite_handler(struct rio_mport *mport,
+		union rio_pw_msg *pw_msg);
 
 /* LDM support */
 int rio_register_driver(struct rio_driver *);
-- 
1.7.9.5



More information about the linux-yocto mailing list