[dpdk-dev,1/2] pci: cleanup whitespace

Message ID 1428963071-4226-2-git-send-email-stephen@networkplumber.org (mailing list archive)
State Rejected, archived
Headers

Commit Message

Stephen Hemminger April 13, 2015, 10:11 p.m. UTC
  Fix whitespace errors reported by checkpatch, including
missing space around operators and places where tab should
be used instead of space.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>

---
 lib/librte_eal/linuxapp/eal/eal_pci.c | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)
  

Comments

Michael Qiu April 14, 2015, 9:29 a.m. UTC | #1
On 4/14/2015 6:11 AM, Stephen Hemminger wrote:
> Fix whitespace errors reported by checkpatch, including
> missing space around operators and places where tab should
> be used instead of space.
>
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>

Acked-by: Michael Qiu <michael.qiu@intel.com>

> ---
>  lib/librte_eal/linuxapp/eal/eal_pci.c | 17 ++++++++---------
>  1 file changed, 8 insertions(+), 9 deletions(-)
>
> diff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c b/lib/librte_eal/linuxapp/eal/eal_pci.c
> index 9cb0ffd..c98a778 100644
> --- a/lib/librte_eal/linuxapp/eal/eal_pci.c
> +++ b/lib/librte_eal/linuxapp/eal/eal_pci.c
> @@ -68,22 +68,22 @@ pci_unbind_kernel_driver(struct rte_pci_device *dev)
>  
>  	/* open /sys/bus/pci/devices/AAAA:BB:CC.D/driver */
>  	snprintf(filename, sizeof(filename),
> -	         SYSFS_PCI_DEVICES "/" PCI_PRI_FMT "/driver/unbind",
> -	         loc->domain, loc->bus, loc->devid, loc->function);
> +		 SYSFS_PCI_DEVICES "/" PCI_PRI_FMT "/driver/unbind",
> +		 loc->domain, loc->bus, loc->devid, loc->function);
>  
>  	f = fopen(filename, "w");
>  	if (f == NULL) /* device was not bound */
>  		return 0;
>  
>  	n = snprintf(buf, sizeof(buf), PCI_PRI_FMT "\n",
> -	             loc->domain, loc->bus, loc->devid, loc->function);
> +		     loc->domain, loc->bus, loc->devid, loc->function);
>  	if ((n < 0) || (n >= (int)sizeof(buf))) {
>  		RTE_LOG(ERR, EAL, "%s(): snprintf failed\n", __func__);
>  		goto error;
>  	}
>  	if (fwrite(buf, n, 1, f) == 0) {
>  		RTE_LOG(ERR, EAL, "%s(): could not write to %s\n", __func__,
> -				filename);
> +			filename);
>  		goto error;
>  	}
>  
> @@ -205,8 +205,7 @@ pci_parse_sysfs_resource(const char *filename, struct rte_pci_device *dev)
>  		return -1;
>  	}
>  
> -	for (i = 0; i<PCI_MAX_RESOURCE; i++) {
> -
> +	for (i = 0; i < PCI_MAX_RESOURCE; i++) {
>  		if (fgets(buf, sizeof(buf), f) == NULL) {
>  			RTE_LOG(ERR, EAL,
>  				"%s(): cannot read resource\n", __func__);
> @@ -402,8 +401,8 @@ parse_pci_addr_format(const char *buf, int bufsize, uint16_t *domain,
>  		};
>  		char *str[PCI_FMT_NVAL]; /* last element-separator is "." not ":" */
>  	} splitaddr;
> -
>  	char *buf_copy = strndup(buf, bufsize);
> +
>  	if (buf_copy == NULL)
>  		return -1;
>  
> @@ -411,7 +410,7 @@ parse_pci_addr_format(const char *buf, int bufsize, uint16_t *domain,
>  			!= PCI_FMT_NVAL - 1)
>  		goto error;
>  	/* final split is on '.' between devid and function */
> -	splitaddr.function = strchr(splitaddr.devid,'.');
> +	splitaddr.function = strchr(splitaddr.devid, '.');
>  	if (splitaddr.function == NULL)
>  		goto error;
>  	*splitaddr.function++ = '\0';
> @@ -671,7 +670,7 @@ rte_eal_pci_probe_one_driver(struct rte_pci_driver *dr, struct rte_pci_device *d
>  			if (ret != 0)
>  				return ret;
>  		} else if (dr->drv_flags & RTE_PCI_DRV_FORCE_UNBIND &&
> -		           rte_eal_process_type() == RTE_PROC_PRIMARY) {
> +			   rte_eal_process_type() == RTE_PROC_PRIMARY) {
>  			/* unbind current driver */
>  			if (pci_unbind_kernel_driver(dev) < 0)
>  				return -1;
  

Patch

diff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c b/lib/librte_eal/linuxapp/eal/eal_pci.c
index 9cb0ffd..c98a778 100644
--- a/lib/librte_eal/linuxapp/eal/eal_pci.c
+++ b/lib/librte_eal/linuxapp/eal/eal_pci.c
@@ -68,22 +68,22 @@  pci_unbind_kernel_driver(struct rte_pci_device *dev)
 
 	/* open /sys/bus/pci/devices/AAAA:BB:CC.D/driver */
 	snprintf(filename, sizeof(filename),
-	         SYSFS_PCI_DEVICES "/" PCI_PRI_FMT "/driver/unbind",
-	         loc->domain, loc->bus, loc->devid, loc->function);
+		 SYSFS_PCI_DEVICES "/" PCI_PRI_FMT "/driver/unbind",
+		 loc->domain, loc->bus, loc->devid, loc->function);
 
 	f = fopen(filename, "w");
 	if (f == NULL) /* device was not bound */
 		return 0;
 
 	n = snprintf(buf, sizeof(buf), PCI_PRI_FMT "\n",
-	             loc->domain, loc->bus, loc->devid, loc->function);
+		     loc->domain, loc->bus, loc->devid, loc->function);
 	if ((n < 0) || (n >= (int)sizeof(buf))) {
 		RTE_LOG(ERR, EAL, "%s(): snprintf failed\n", __func__);
 		goto error;
 	}
 	if (fwrite(buf, n, 1, f) == 0) {
 		RTE_LOG(ERR, EAL, "%s(): could not write to %s\n", __func__,
-				filename);
+			filename);
 		goto error;
 	}
 
@@ -205,8 +205,7 @@  pci_parse_sysfs_resource(const char *filename, struct rte_pci_device *dev)
 		return -1;
 	}
 
-	for (i = 0; i<PCI_MAX_RESOURCE; i++) {
-
+	for (i = 0; i < PCI_MAX_RESOURCE; i++) {
 		if (fgets(buf, sizeof(buf), f) == NULL) {
 			RTE_LOG(ERR, EAL,
 				"%s(): cannot read resource\n", __func__);
@@ -402,8 +401,8 @@  parse_pci_addr_format(const char *buf, int bufsize, uint16_t *domain,
 		};
 		char *str[PCI_FMT_NVAL]; /* last element-separator is "." not ":" */
 	} splitaddr;
-
 	char *buf_copy = strndup(buf, bufsize);
+
 	if (buf_copy == NULL)
 		return -1;
 
@@ -411,7 +410,7 @@  parse_pci_addr_format(const char *buf, int bufsize, uint16_t *domain,
 			!= PCI_FMT_NVAL - 1)
 		goto error;
 	/* final split is on '.' between devid and function */
-	splitaddr.function = strchr(splitaddr.devid,'.');
+	splitaddr.function = strchr(splitaddr.devid, '.');
 	if (splitaddr.function == NULL)
 		goto error;
 	*splitaddr.function++ = '\0';
@@ -671,7 +670,7 @@  rte_eal_pci_probe_one_driver(struct rte_pci_driver *dr, struct rte_pci_device *d
 			if (ret != 0)
 				return ret;
 		} else if (dr->drv_flags & RTE_PCI_DRV_FORCE_UNBIND &&
-		           rte_eal_process_type() == RTE_PROC_PRIMARY) {
+			   rte_eal_process_type() == RTE_PROC_PRIMARY) {
 			/* unbind current driver */
 			if (pci_unbind_kernel_driver(dev) < 0)
 				return -1;