[PATCH] USB: fix coding style issue

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



try to fix some codeing style issue, such as "space prohibited" and "not
initialise statics".

Signed-off-by: pierre Kuo <vichy.kuo@xxxxxxxxx>
---
 drivers/usb/host/ehci-hcd.c   |  6 ++---
 drivers/usb/host/ehci-hub.c   | 22 ++++++++---------
 drivers/usb/host/ehci-mem.c   | 55 ++++++++++++++++++++++---------------------
 drivers/usb/host/ehci-pci.c   |  4 ++--
 drivers/usb/host/ehci-sysfs.c |  2 +-
 5 files changed, 45 insertions(+), 44 deletions(-)

diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index 6e834b83..cbcac78 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -68,7 +68,7 @@
 #define DRIVER_AUTHOR "David Brownell"
 #define DRIVER_DESC "USB 2.0 'Enhanced' Host Controller (EHCI) Driver"
 
-static const char	hcd_name [] = "ehci_hcd";
+static const char	hcd_name[] = "ehci_hcd";
 
 
 #undef EHCI_URB_TRACE
@@ -88,12 +88,12 @@
 #define	EHCI_TUNE_FLS		1	/* (medium) 512-frame schedule */
 
 /* Initial IRQ latency:  faster than hw default */
-static int log2_irq_thresh = 0;		// 0 to 6
+static int log2_irq_thresh;		// 0 to 6
 module_param (log2_irq_thresh, int, S_IRUGO);
 MODULE_PARM_DESC (log2_irq_thresh, "log2 IRQ latency, 1-64 microframes");
 
 /* initial park setting:  slower than hw default */
-static unsigned park = 0;
+static unsigned int park;
 module_param (park, uint, S_IRUGO);
 MODULE_PARM_DESC (park, "park setting; 1-3 back-to-back async packets");
 
diff --git a/drivers/usb/host/ehci-hub.c b/drivers/usb/host/ehci-hub.c
index df169c8..e880861 100644
--- a/drivers/usb/host/ehci-hub.c
+++ b/drivers/usb/host/ehci-hub.c
@@ -268,7 +268,7 @@ static int ehci_bus_suspend (struct usb_hcd *hcd)
 	fs_idle_delay = false;
 	port = HCS_N_PORTS(ehci->hcs_params);
 	while (port--) {
-		u32 __iomem	*reg = &ehci->regs->port_status [port];
+		u32 __iomem	*reg = &ehci->regs->port_status[port];
 		u32		t1 = ehci_readl(ehci, reg) & ~PORT_RWC_BITS;
 		u32		t2 = t1 & ~PORT_WAKE_BITS;
 
@@ -474,14 +474,14 @@ static int ehci_bus_resume (struct usb_hcd *hcd)
 	/* manually resume the ports we suspended during bus_suspend() */
 	i = HCS_N_PORTS (ehci->hcs_params);
 	while (i--) {
-		temp = ehci_readl(ehci, &ehci->regs->port_status [i]);
+		temp = ehci_readl(ehci, &ehci->regs->port_status[i]);
 		temp &= ~(PORT_RWC_BITS | PORT_WAKE_BITS);
 		if (test_bit(i, &ehci->bus_suspended) &&
 				(temp & PORT_SUSPEND)) {
 			temp |= PORT_RESUME;
 			set_bit(i, &resume_needed);
 		}
-		ehci_writel(ehci, temp, &ehci->regs->port_status [i]);
+		ehci_writel(ehci, temp, &ehci->regs->port_status[i]);
 	}
 
 	/*
@@ -498,10 +498,10 @@ static int ehci_bus_resume (struct usb_hcd *hcd)
 
 	i = HCS_N_PORTS (ehci->hcs_params);
 	while (i--) {
-		temp = ehci_readl(ehci, &ehci->regs->port_status [i]);
+		temp = ehci_readl(ehci, &ehci->regs->port_status[i]);
 		if (test_bit(i, &resume_needed)) {
 			temp &= ~(PORT_RWC_BITS | PORT_SUSPEND | PORT_RESUME);
-			ehci_writel(ehci, temp, &ehci->regs->port_status [i]);
+			ehci_writel(ehci, temp, &ehci->regs->port_status[i]);
 		}
 	}
 
@@ -628,7 +628,7 @@ static int check_reset_complete (
 	u32		ppcd = ~0;
 
 	/* init status to no-changes */
-	buf [0] = 0;
+	buf[0] = 0;
 	ports = HCS_N_PORTS (ehci->hcs_params);
 	if (ports > 7) {
 		buf [1] = 0;
@@ -679,9 +679,9 @@ static int check_reset_complete (
 				|| (ehci->reset_done[i] && time_after_eq(
 					jiffies, ehci->reset_done[i]))) {
 			if (i < 7)
-			    buf [0] |= 1 << (i + 1);
+				buf[0] |= 1 << (i + 1);
 			else
-			    buf [1] |= 1 << (i - 7);
+				buf[1] |= 1 << (i - 7);
 			status = STS_PCD;
 		}
 	}
@@ -1016,7 +1016,7 @@ int ehci_hub_control(
 		if (temp & PORT_PEC)
 			status |= USB_PORT_STAT_C_ENABLE << 16;
 
-		if ((temp & PORT_OCC) && !ignore_oc){
+		if ((temp & PORT_OCC) && !ignore_oc) {
 			status |= USB_PORT_STAT_C_OVERCURRENT << 16;
 
 			/*
@@ -1077,7 +1077,7 @@ int ehci_hub_control(
 		/* whoever resets must GetPortStatus to complete it!! */
 		} else {
 			status |= USB_PORT_STAT_C_RESET << 16;
-			ehci->reset_done [wIndex] = 0;
+			ehci->reset_done[wIndex] = 0;
 
 			/* force reset to complete */
 			ehci_writel(ehci, temp & ~(PORT_RWC_BITS | PORT_RESET),
@@ -1245,7 +1245,7 @@ int ehci_hub_control(
 				 * caller must wait, then call GetPortStatus
 				 * usb 2.0 spec says 50 ms resets on root
 				 */
-				ehci->reset_done [wIndex] = jiffies
+				ehci->reset_done[wIndex] = jiffies
 						+ msecs_to_jiffies (50);
 
 				/*
diff --git a/drivers/usb/host/ehci-mem.c b/drivers/usb/host/ehci-mem.c
index 9b7e639..e22dd2a 100644
--- a/drivers/usb/host/ehci-mem.c
+++ b/drivers/usb/host/ehci-mem.c
@@ -38,15 +38,15 @@
 static inline void ehci_qtd_init(struct ehci_hcd *ehci, struct ehci_qtd *qtd,
 				  dma_addr_t dma)
 {
-	memset (qtd, 0, sizeof *qtd);
+	memset(qtd, 0, sizeof(*qtd));
 	qtd->qtd_dma = dma;
 	qtd->hw_token = cpu_to_hc32(ehci, QTD_STS_HALT);
 	qtd->hw_next = EHCI_LIST_END(ehci);
 	qtd->hw_alt_next = EHCI_LIST_END(ehci);
-	INIT_LIST_HEAD (&qtd->qtd_list);
+	INIT_LIST_HEAD(&qtd->qtd_list);
 }
 
-static struct ehci_qtd *ehci_qtd_alloc (struct ehci_hcd *ehci, gfp_t flags)
+static struct ehci_qtd *ehci_qtd_alloc(struct ehci_hcd *ehci, gfp_t flags)
 {
 	struct ehci_qtd		*qtd;
 	dma_addr_t		dma;
@@ -58,45 +58,45 @@ static struct ehci_qtd *ehci_qtd_alloc (struct ehci_hcd *ehci, gfp_t flags)
 	return qtd;
 }
 
-static inline void ehci_qtd_free (struct ehci_hcd *ehci, struct ehci_qtd *qtd)
+static inline void ehci_qtd_free(struct ehci_hcd *ehci, struct ehci_qtd *qtd)
 {
-	dma_pool_free (ehci->qtd_pool, qtd, qtd->qtd_dma);
+	dma_pool_free(ehci->qtd_pool, qtd, qtd->qtd_dma);
 }
 
 
 static void qh_destroy(struct ehci_hcd *ehci, struct ehci_qh *qh)
 {
 	/* clean qtds first, and know this is not linked */
-	if (!list_empty (&qh->qtd_list) || qh->qh_next.ptr) {
-		ehci_dbg (ehci, "unused qh not empty!\n");
+	if (!list_empty(&qh->qtd_list) || qh->qh_next.ptr) {
+		ehci_dbg(ehci, "unused qh not empty!\n");
 		BUG ();
 	}
 	if (qh->dummy)
-		ehci_qtd_free (ehci, qh->dummy);
+		ehci_qtd_free(ehci, qh->dummy);
 	dma_pool_free(ehci->qh_pool, qh->hw, qh->qh_dma);
 	kfree(qh);
 }
 
-static struct ehci_qh *ehci_qh_alloc (struct ehci_hcd *ehci, gfp_t flags)
+static struct ehci_qh *ehci_qh_alloc(struct ehci_hcd *ehci, gfp_t flags)
 {
 	struct ehci_qh		*qh;
 	dma_addr_t		dma;
 
-	qh = kzalloc(sizeof *qh, GFP_ATOMIC);
+	qh = kzalloc(sizeof(*qh), GFP_ATOMIC);
 	if (!qh)
 		goto done;
 	qh->hw = (struct ehci_qh_hw *)
 		dma_pool_alloc(ehci->qh_pool, flags, &dma);
 	if (!qh->hw)
 		goto fail;
-	memset(qh->hw, 0, sizeof *qh->hw);
+	memset(qh->hw, 0, sizeof(*qh->hw));
 	qh->qh_dma = dma;
-	// INIT_LIST_HEAD (&qh->qh_list);
-	INIT_LIST_HEAD (&qh->qtd_list);
+	// INIT_LIST_HEAD(&qh->qh_list);
+	INIT_LIST_HEAD(&qh->qtd_list);
 	INIT_LIST_HEAD(&qh->unlink_node);
 
 	/* dummy td enables safe urb queuing */
-	qh->dummy = ehci_qtd_alloc (ehci, flags);
+	qh->dummy = ehci_qtd_alloc(ehci, flags);
 	if (qh->dummy == NULL) {
 		ehci_dbg (ehci, "no dummy td\n");
 		goto fail1;
@@ -117,7 +117,7 @@ static struct ehci_qh *ehci_qh_alloc (struct ehci_hcd *ehci, gfp_t flags)
  * This is the initialisation and cleanup code.
  */
 
-static void ehci_mem_cleanup (struct ehci_hcd *ehci)
+static void ehci_mem_cleanup(struct ehci_hcd *ehci)
 {
 	if (ehci->async)
 		qh_destroy(ehci, ehci->async);
@@ -139,7 +139,7 @@ static void ehci_mem_cleanup (struct ehci_hcd *ehci)
 
 	if (ehci->periodic)
 		dma_free_coherent(ehci_to_hcd(ehci)->self.sysdev,
-			ehci->periodic_size * sizeof (u32),
+			ehci->periodic_size * sizeof(u32),
 			ehci->periodic, ehci->periodic_dma);
 	ehci->periodic = NULL;
 
@@ -149,14 +149,14 @@ static void ehci_mem_cleanup (struct ehci_hcd *ehci)
 }
 
 /* remember to add cleanup code (above) if you add anything here */
-static int ehci_mem_init (struct ehci_hcd *ehci, gfp_t flags)
+static int ehci_mem_init(struct ehci_hcd *ehci, gfp_t flags)
 {
 	int i;
 
 	/* QTDs for control/bulk/intr transfers */
-	ehci->qtd_pool = dma_pool_create ("ehci_qtd",
+	ehci->qtd_pool = dma_pool_create("ehci_qtd",
 			ehci_to_hcd(ehci)->self.sysdev,
-			sizeof (struct ehci_qtd),
+			sizeof(struct ehci_qtd),
 			32 /* byte alignment (for hw parts) */,
 			4096 /* can't cross 4K */);
 	if (!ehci->qtd_pool) {
@@ -164,7 +164,7 @@ static int ehci_mem_init (struct ehci_hcd *ehci, gfp_t flags)
 	}
 
 	/* QHs for control/bulk/intr transfers */
-	ehci->qh_pool = dma_pool_create ("ehci_qh",
+	ehci->qh_pool = dma_pool_create("ehci_qh",
 			ehci_to_hcd(ehci)->self.sysdev,
 			sizeof(struct ehci_qh_hw),
 			32 /* byte alignment (for hw parts) */,
@@ -172,15 +172,15 @@ static int ehci_mem_init (struct ehci_hcd *ehci, gfp_t flags)
 	if (!ehci->qh_pool) {
 		goto fail;
 	}
-	ehci->async = ehci_qh_alloc (ehci, flags);
+	ehci->async = ehci_qh_alloc(ehci, flags);
 	if (!ehci->async) {
 		goto fail;
 	}
 
 	/* ITD for high speed ISO transfers */
-	ehci->itd_pool = dma_pool_create ("ehci_itd",
+	ehci->itd_pool = dma_pool_create("ehci_itd",
 			ehci_to_hcd(ehci)->self.sysdev,
-			sizeof (struct ehci_itd),
+			sizeof(struct ehci_itd),
 			32 /* byte alignment (for hw parts) */,
 			4096 /* can't cross 4K */);
 	if (!ehci->itd_pool) {
@@ -188,9 +188,9 @@ static int ehci_mem_init (struct ehci_hcd *ehci, gfp_t flags)
 	}
 
 	/* SITD for full/low speed split ISO transfers */
-	ehci->sitd_pool = dma_pool_create ("ehci_sitd",
+	ehci->sitd_pool = dma_pool_create("ehci_sitd",
 			ehci_to_hcd(ehci)->self.sysdev,
-			sizeof (struct ehci_sitd),
+			sizeof(struct ehci_sitd),
 			32 /* byte alignment (for hw parts) */,
 			4096 /* can't cross 4K */);
 	if (!ehci->sitd_pool) {
@@ -208,6 +208,7 @@ static int ehci_mem_init (struct ehci_hcd *ehci, gfp_t flags)
 
 	if (ehci->use_dummy_qh) {
 		struct ehci_qh_hw	*hw;
+
 		ehci->dummy = ehci_qh_alloc(ehci, flags);
 		if (!ehci->dummy)
 			goto fail;
@@ -232,7 +233,7 @@ static int ehci_mem_init (struct ehci_hcd *ehci, gfp_t flags)
 		return 0;
 
 fail:
-	ehci_dbg (ehci, "couldn't init memory\n");
-	ehci_mem_cleanup (ehci);
+	ehci_dbg(ehci, "couldn't init memory\n");
+	ehci_mem_cleanup(ehci);
 	return -ENOMEM;
 }
diff --git a/drivers/usb/host/ehci-pci.c b/drivers/usb/host/ehci-pci.c
index 9332697..766eda6 100644
--- a/drivers/usb/host/ehci-pci.c
+++ b/drivers/usb/host/ehci-pci.c
@@ -379,11 +379,11 @@ static int ehci_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 static void ehci_pci_remove(struct pci_dev *pdev)
 {
 	pci_clear_mwi(pdev);
-	usb_hcd_pci_remove(pdev);	
+	usb_hcd_pci_remove(pdev);
 }
 
 /* PCI driver selection metadata; PCI hotplugging uses this */
-static const struct pci_device_id pci_ids [] = { {
+static const struct pci_device_id pci_ids[] = { {
 	/* handle any USB 2.0 EHCI controller */
 	PCI_DEVICE_CLASS(PCI_CLASS_SERIAL_USB_EHCI, ~0),
 	.driver_data =	(unsigned long) &ehci_pci_hc_driver,
diff --git a/drivers/usb/host/ehci-sysfs.c b/drivers/usb/host/ehci-sysfs.c
index 5216f2b..8211c13 100644
--- a/drivers/usb/host/ehci-sysfs.c
+++ b/drivers/usb/host/ehci-sysfs.c
@@ -59,7 +59,7 @@ static ssize_t store_companion(struct device *dev,
 	if (sscanf(buf, "%d", &portnum) != 1)
 		return -EINVAL;
 	if (portnum < 0) {
-		portnum = - portnum;
+		portnum = -portnum;
 		new_owner = 0;		/* Owned by EHCI */
 	}
 	if (portnum <= 0 || portnum > HCS_N_PORTS(ehci->hcs_params))
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux