All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/4] usb: host: ehci.h: cleanup header file
@ 2015-12-09 19:57 Geyslan G. Bem
  2015-12-09 19:57 ` [PATCH 2/4] " Geyslan G. Bem
                   ` (3 more replies)
  0 siblings, 4 replies; 15+ messages in thread
From: Geyslan G. Bem @ 2015-12-09 19:57 UTC (permalink / raw)
  To: peter.senna
  Cc: Geyslan G. Bem, Alan Stern, Greg Kroah-Hartman, linux-usb, linux-kernel

This patch silences
 - A coccinelle warning 'scripts/coccinelle/misc/compare_const_fl.cocci'
 - All the errors and many warnings shown by checkpatch

Signed-off-by: Geyslan G. Bem <geyslan@gmail.com>
---
 drivers/usb/host/ehci.h | 89 +++++++++++++++++++++++++------------------------
 1 file changed, 45 insertions(+), 44 deletions(-)

diff --git a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h
index ec61aed..a4f5ab5 100644
--- a/drivers/usb/host/ehci.h
+++ b/drivers/usb/host/ehci.h
@@ -185,10 +185,10 @@ struct ehci_hcd {			/* one per controller */
 	struct ehci_sitd	*last_sitd_to_free;
 
 	/* per root hub port */
-	unsigned long		reset_done [EHCI_MAX_ROOT_PORTS];
+	unsigned long		reset_done[EHCI_MAX_ROOT_PORTS];
 
 	/* bit vectors (one bit per port) */
-	unsigned long		bus_suspended;		/* which ports were
+	unsigned long		bus_suspended;	/* which ports were
 			already suspended at the start of a bus suspend */
 	unsigned long		companion_ports;	/* which ports are
 			dedicated to the companion controller */
@@ -244,9 +244,9 @@ struct ehci_hcd {			/* one per controller */
 	/* irq statistics */
 #ifdef EHCI_STATS
 	struct ehci_stats	stats;
-#	define COUNT(x) do { (x)++; } while (0)
+#	define COUNT(x) ((x)++)
 #else
-#	define COUNT(x) do {} while (0)
+#	define COUNT(x) ((void) 0)
 #endif
 
 	/* debug files */
@@ -268,13 +268,13 @@ struct ehci_hcd {			/* one per controller */
 };
 
 /* convert between an HCD pointer and the corresponding EHCI_HCD */
-static inline struct ehci_hcd *hcd_to_ehci (struct usb_hcd *hcd)
+static inline struct ehci_hcd *hcd_to_ehci(struct usb_hcd *hcd)
 {
 	return (struct ehci_hcd *) (hcd->hcd_priv);
 }
-static inline struct usb_hcd *ehci_to_hcd (struct ehci_hcd *ehci)
+static inline struct usb_hcd *ehci_to_hcd(struct ehci_hcd *ehci)
 {
-	return container_of ((void *) ehci, struct usb_hcd, hcd_priv);
+	return container_of((void *) ehci, struct usb_hcd, hcd_priv);
 }
 
 /*-------------------------------------------------------------------------*/
@@ -316,25 +316,25 @@ struct ehci_qtd {
 #define HALT_BIT(ehci)		cpu_to_hc32(ehci, QTD_STS_HALT)
 #define STATUS_BIT(ehci)	cpu_to_hc32(ehci, QTD_STS_STS)
 
-	__hc32			hw_buf [5];        /* see EHCI 3.5.4 */
-	__hc32			hw_buf_hi [5];        /* Appendix B */
+	__hc32			hw_buf[5];	/* see EHCI 3.5.4 */
+	__hc32			hw_buf_hi[5];	/* Appendix B */
 
 	/* the rest is HCD-private */
-	dma_addr_t		qtd_dma;		/* qtd address */
-	struct list_head	qtd_list;		/* sw qtd list */
-	struct urb		*urb;			/* qtd's urb */
-	size_t			length;			/* length of buffer */
-} __attribute__ ((aligned (32)));
+	dma_addr_t		qtd_dma;	/* qtd address */
+	struct list_head	qtd_list;	/* sw qtd list */
+	struct urb		*urb;		/* qtd's urb */
+	size_t			length;		/* length of buffer */
+} __aligned(32);
 
 /* mask NakCnt+T in qh->hw_alt_next */
-#define QTD_MASK(ehci)	cpu_to_hc32 (ehci, ~0x1f)
+#define QTD_MASK(ehci) (cpu_to_hc32(ehci, ~0x1f))
 
-#define IS_SHORT_READ(token) (QTD_LENGTH (token) != 0 && QTD_PID (token) == 1)
+#define IS_SHORT_READ(token) (QTD_LENGTH(token) != 0 && QTD_PID(token) == 1)
 
 /*-------------------------------------------------------------------------*/
 
 /* type tag from {qh,itd,sitd,fstn}->hw_next */
-#define Q_NEXT_TYPE(ehci,dma)	((dma) & cpu_to_hc32(ehci, 3 << 1))
+#define Q_NEXT_TYPE(ehci, dma) ((dma) & cpu_to_hc32(ehci, 3 << 1))
 
 /*
  * Now the following defines are not converted using the
@@ -350,7 +350,8 @@ struct ehci_qtd {
 #define Q_TYPE_FSTN	(3 << 1)
 
 /* next async queue entry, or pointer to interrupt/periodic QH */
-#define QH_NEXT(ehci,dma)	(cpu_to_hc32(ehci, (((u32)dma)&~0x01f)|Q_TYPE_QH))
+#define QH_NEXT(ehci, dma) \
+	(cpu_to_hc32(ehci, (((u32) dma) & ~0x01f) | Q_TYPE_QH))
 
 /* for periodic/async schedules and qtd lists, mark end of list */
 #define EHCI_LIST_END(ehci)	cpu_to_hc32(ehci, 1) /* "null pointer" to hw */
@@ -405,9 +406,9 @@ struct ehci_qh_hw {
 	__hc32			hw_qtd_next;
 	__hc32			hw_alt_next;
 	__hc32			hw_token;
-	__hc32			hw_buf [5];
-	__hc32			hw_buf_hi [5];
-} __attribute__ ((aligned(32)));
+	__hc32			hw_buf[5];
+	__hc32			hw_buf_hi[5];
+} __aligned(32);
 
 struct ehci_qh {
 	struct ehci_qh_hw	*hw;		/* Must come first */
@@ -462,7 +463,7 @@ struct ehci_iso_sched {
 	struct list_head	td_list;
 	unsigned		span;
 	unsigned		first_packet;
-	struct ehci_iso_packet	packet [0];
+	struct ehci_iso_packet	packet[0];
 };
 
 /*
@@ -510,7 +511,7 @@ struct ehci_iso_stream {
 struct ehci_itd {
 	/* first part defined by EHCI spec */
 	__hc32			hw_next;           /* see EHCI 3.3.1 */
-	__hc32			hw_transaction [8]; /* see EHCI 3.3.2 */
+	__hc32			hw_transaction[8]; /* see EHCI 3.3.2 */
 #define EHCI_ISOC_ACTIVE        (1<<31)        /* activate transfer this slot */
 #define EHCI_ISOC_BUF_ERR       (1<<30)        /* Data buffer error */
 #define EHCI_ISOC_BABBLE        (1<<29)        /* babble detected */
@@ -520,8 +521,8 @@ struct ehci_itd {
 
 #define ITD_ACTIVE(ehci)	cpu_to_hc32(ehci, EHCI_ISOC_ACTIVE)
 
-	__hc32			hw_bufp [7];	/* see EHCI 3.3.3 */
-	__hc32			hw_bufp_hi [7];	/* Appendix B */
+	__hc32			hw_bufp[7];	/* see EHCI 3.3.3 */
+	__hc32			hw_bufp_hi[7];	/* Appendix B */
 
 	/* the rest is HCD-private */
 	dma_addr_t		itd_dma;	/* for this itd */
@@ -535,7 +536,7 @@ struct ehci_itd {
 	unsigned		frame;		/* where scheduled */
 	unsigned		pg;
 	unsigned		index[8];	/* in urb->iso_frame_desc */
-} __attribute__ ((aligned (32)));
+} __aligned(32);
 
 /*-------------------------------------------------------------------------*/
 
@@ -554,7 +555,7 @@ struct ehci_sitd {
 	__hc32			hw_results;		/* EHCI table 3-11 */
 #define	SITD_IOC	(1 << 31)	/* interrupt on completion */
 #define	SITD_PAGE	(1 << 30)	/* buffer 0/1 */
-#define	SITD_LENGTH(x)	(0x3ff & ((x)>>16))
+#define	SITD_LENGTH(x)	(((x) >> 16) & 0x3ff)
 #define	SITD_STS_ACTIVE	(1 << 7)	/* HC may execute this */
 #define	SITD_STS_ERR	(1 << 6)	/* error from TT */
 #define	SITD_STS_DBE	(1 << 5)	/* data buffer error (in HC) */
@@ -565,9 +566,9 @@ struct ehci_sitd {
 
 #define SITD_ACTIVE(ehci)	cpu_to_hc32(ehci, SITD_STS_ACTIVE)
 
-	__hc32			hw_buf [2];		/* EHCI table 3-12 */
+	__hc32			hw_buf[2];		/* EHCI table 3-12 */
 	__hc32			hw_backpointer;		/* EHCI table 3-13 */
-	__hc32			hw_buf_hi [2];		/* Appendix B */
+	__hc32			hw_buf_hi[2];		/* Appendix B */
 
 	/* the rest is HCD-private */
 	dma_addr_t		sitd_dma;
@@ -578,7 +579,7 @@ struct ehci_sitd {
 	struct list_head	sitd_list;	/* list of stream's sitds */
 	unsigned		frame;
 	unsigned		index;
-} __attribute__ ((aligned (32)));
+} __aligned(32);
 
 /*-------------------------------------------------------------------------*/
 
@@ -598,7 +599,7 @@ struct ehci_fstn {
 	/* the rest is HCD-private */
 	dma_addr_t		fstn_dma;
 	union ehci_shadow	fstn_next;	/* ptr to periodic q entry */
-} __attribute__ ((aligned (32)));
+} __aligned(32);
 
 /*-------------------------------------------------------------------------*/
 
@@ -634,10 +635,10 @@ struct ehci_tt {
 /* Prepare the PORTSC wakeup flags during controller suspend/resume */
 
 #define ehci_prepare_ports_for_controller_suspend(ehci, do_wakeup)	\
-		ehci_adjust_port_wakeup_flags(ehci, true, do_wakeup);
+		ehci_adjust_port_wakeup_flags(ehci, true, do_wakeup)
 
 #define ehci_prepare_ports_for_controller_resume(ehci)			\
-		ehci_adjust_port_wakeup_flags(ehci, false, false);
+		ehci_adjust_port_wakeup_flags(ehci, false, false)
 
 /*-------------------------------------------------------------------------*/
 
@@ -731,7 +732,7 @@ ehci_port_speed(struct ehci_hcd *ehci, unsigned int portsc)
 #endif
 
 static inline unsigned int ehci_readl(const struct ehci_hcd *ehci,
-		__u32 __iomem * regs)
+				      __u32 __iomem *regs)
 {
 #ifdef CONFIG_USB_EHCI_BIG_ENDIAN_MMIO
 	return ehci_big_endian_mmio(ehci) ?
@@ -806,7 +807,7 @@ static inline void set_ohci_hcfs(struct ehci_hcd *ehci, int operational)
 #define ehci_big_endian_desc(e)		((e)->big_endian_desc)
 
 /* cpu to ehci */
-static inline __hc32 cpu_to_hc32 (const struct ehci_hcd *ehci, const u32 x)
+static inline __hc32 cpu_to_hc32(const struct ehci_hcd *ehci, const u32 x)
 {
 	return ehci_big_endian_desc(ehci)
 		? (__force __hc32)cpu_to_be32(x)
@@ -814,14 +815,14 @@ static inline __hc32 cpu_to_hc32 (const struct ehci_hcd *ehci, const u32 x)
 }
 
 /* ehci to cpu */
-static inline u32 hc32_to_cpu (const struct ehci_hcd *ehci, const __hc32 x)
+static inline u32 hc32_to_cpu(const struct ehci_hcd *ehci, const __hc32 x)
 {
 	return ehci_big_endian_desc(ehci)
 		? be32_to_cpu((__force __be32)x)
 		: le32_to_cpu((__force __le32)x);
 }
 
-static inline u32 hc32_to_cpup (const struct ehci_hcd *ehci, const __hc32 *x)
+static inline u32 hc32_to_cpup(const struct ehci_hcd *ehci, const __hc32 *x)
 {
 	return ehci_big_endian_desc(ehci)
 		? be32_to_cpup((__force __be32 *)x)
@@ -831,18 +832,18 @@ static inline u32 hc32_to_cpup (const struct ehci_hcd *ehci, const __hc32 *x)
 #else
 
 /* cpu to ehci */
-static inline __hc32 cpu_to_hc32 (const struct ehci_hcd *ehci, const u32 x)
+static inline __hc32 cpu_to_hc32(const struct ehci_hcd *ehci, const u32 x)
 {
 	return cpu_to_le32(x);
 }
 
 /* ehci to cpu */
-static inline u32 hc32_to_cpu (const struct ehci_hcd *ehci, const __hc32 x)
+static inline u32 hc32_to_cpu(const struct ehci_hcd *ehci, const __hc32 x)
 {
 	return le32_to_cpu(x);
 }
 
-static inline u32 hc32_to_cpup (const struct ehci_hcd *ehci, const __hc32 *x)
+static inline u32 hc32_to_cpup(const struct ehci_hcd *ehci, const __hc32 *x)
 {
 	return le32_to_cpup(x);
 }
@@ -852,13 +853,13 @@ static inline u32 hc32_to_cpup (const struct ehci_hcd *ehci, const __hc32 *x)
 /*-------------------------------------------------------------------------*/
 
 #define ehci_dbg(ehci, fmt, args...) \
-	dev_dbg(ehci_to_hcd(ehci)->self.controller , fmt , ## args)
+	dev_dbg(ehci_to_hcd(ehci)->self.controller, fmt, ##args)
 #define ehci_err(ehci, fmt, args...) \
-	dev_err(ehci_to_hcd(ehci)->self.controller , fmt , ## args)
+	dev_err(ehci_to_hcd(ehci)->self.controller, fmt, ##args)
 #define ehci_info(ehci, fmt, args...) \
-	dev_info(ehci_to_hcd(ehci)->self.controller , fmt , ## args)
+	dev_info(ehci_to_hcd(ehci)->self.controller, fmt, ##args)
 #define ehci_warn(ehci, fmt, args...) \
-	dev_warn(ehci_to_hcd(ehci)->self.controller , fmt , ## args)
+	dev_warn(ehci_to_hcd(ehci)->self.controller, fmt, ##args)
 
 
 #ifndef CONFIG_DYNAMIC_DEBUG
-- 
2.6.3


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 2/4] usb: host: ehci.h: cleanup header file
  2015-12-09 19:57 [PATCH 1/4] usb: host: ehci.h: cleanup header file Geyslan G. Bem
@ 2015-12-09 19:57 ` Geyslan G. Bem
  2015-12-09 20:11   ` Sergei Shtylyov
  2015-12-09 19:57 ` [PATCH 3/4] usb: host: ehci.h: remove duplicated return Geyslan G. Bem
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 15+ messages in thread
From: Geyslan G. Bem @ 2015-12-09 19:57 UTC (permalink / raw)
  To: peter.senna
  Cc: Geyslan G. Bem, Alan Stern, Greg Kroah-Hartman, linux-usb, linux-kernel

This patch does align function/macro definitions.

Signed-off-by: Geyslan G. Bem <geyslan@gmail.com>
---
 drivers/usb/host/ehci.h | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h
index a4f5ab5..0daed80 100644
--- a/drivers/usb/host/ehci.h
+++ b/drivers/usb/host/ehci.h
@@ -634,11 +634,11 @@ struct ehci_tt {
 
 /* Prepare the PORTSC wakeup flags during controller suspend/resume */
 
-#define ehci_prepare_ports_for_controller_suspend(ehci, do_wakeup)	\
-		ehci_adjust_port_wakeup_flags(ehci, true, do_wakeup)
+#define ehci_prepare_ports_for_controller_suspend(ehci, do_wakeup) \
+	ehci_adjust_port_wakeup_flags(ehci, true, do_wakeup)
 
-#define ehci_prepare_ports_for_controller_resume(ehci)			\
-		ehci_adjust_port_wakeup_flags(ehci, false, false)
+#define ehci_prepare_ports_for_controller_resume(ehci) \
+	ehci_adjust_port_wakeup_flags(ehci, false, false)
 
 /*-------------------------------------------------------------------------*/
 
@@ -745,18 +745,18 @@ static inline unsigned int ehci_readl(const struct ehci_hcd *ehci,
 
 #ifdef CONFIG_SOC_IMX28
 static inline void imx28_ehci_writel(const unsigned int val,
-		volatile __u32 __iomem *addr)
+				     volatile __u32 __iomem *addr)
 {
 	__asm__ ("swp %0, %0, [%1]" : : "r"(val), "r"(addr));
 }
 #else
 static inline void imx28_ehci_writel(const unsigned int val,
-		volatile __u32 __iomem *addr)
+				     volatile __u32 __iomem *addr)
 {
 }
 #endif
 static inline void ehci_writel(const struct ehci_hcd *ehci,
-		const unsigned int val, __u32 __iomem *regs)
+			       const unsigned int val, __u32 __iomem *regs)
 {
 #ifdef CONFIG_USB_EHCI_BIG_ENDIAN_MMIO
 	ehci_big_endian_mmio(ehci) ?
@@ -874,21 +874,21 @@ struct ehci_driver_overrides {
 	size_t		extra_priv_size;
 	int		(*reset)(struct usb_hcd *hcd);
 	int		(*port_power)(struct usb_hcd *hcd,
-				int portnum, bool enable);
+				      int portnum, bool enable);
 };
 
 extern void	ehci_init_driver(struct hc_driver *drv,
-				const struct ehci_driver_overrides *over);
+				 const struct ehci_driver_overrides *over);
 extern int	ehci_setup(struct usb_hcd *hcd);
 extern int	ehci_handshake(struct ehci_hcd *ehci, void __iomem *ptr,
-				u32 mask, u32 done, int usec);
+			       u32 mask, u32 done, int usec);
 extern int	ehci_reset(struct ehci_hcd *ehci);
 
 #ifdef CONFIG_PM
 extern int	ehci_suspend(struct usb_hcd *hcd, bool do_wakeup);
 extern int	ehci_resume(struct usb_hcd *hcd, bool force_reset);
 extern void	ehci_adjust_port_wakeup_flags(struct ehci_hcd *ehci,
-			bool suspending, bool do_wakeup);
+					      bool suspending, bool do_wakeup);
 #endif	/* CONFIG_PM */
 
 extern int	ehci_hub_control(struct usb_hcd	*hcd, u16 typeReq, u16 wValue,
-- 
2.6.3


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 3/4] usb: host: ehci.h: remove duplicated return
  2015-12-09 19:57 [PATCH 1/4] usb: host: ehci.h: cleanup header file Geyslan G. Bem
  2015-12-09 19:57 ` [PATCH 2/4] " Geyslan G. Bem
@ 2015-12-09 19:57 ` Geyslan G. Bem
  2015-12-09 20:10   ` Sergei Shtylyov
                     ` (2 more replies)
  2015-12-09 19:57 ` [PATCH 4/4] usb: host: ehci.h: use flexible array instead of zero-length array Geyslan G. Bem
  2015-12-09 20:09 ` [PATCH 1/4] usb: host: ehci.h: cleanup header file Greg Kroah-Hartman
  3 siblings, 3 replies; 15+ messages in thread
From: Geyslan G. Bem @ 2015-12-09 19:57 UTC (permalink / raw)
  To: peter.senna
  Cc: Geyslan G. Bem, Alan Stern, Greg Kroah-Hartman, linux-usb, linux-kernel

This patch removes the return of the default switch case, since
'ehci_port_speed()' already has the same default return.

Signed-off-by: Geyslan G. Bem <geyslan@gmail.com>
---
 drivers/usb/host/ehci.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h
index 0daed80..49b91b6 100644
--- a/drivers/usb/host/ehci.h
+++ b/drivers/usb/host/ehci.h
@@ -664,8 +664,8 @@ ehci_port_speed(struct ehci_hcd *ehci, unsigned int portsc)
 		case 1:
 			return USB_PORT_STAT_LOW_SPEED;
 		case 2:
+		/* fall through to default function return */
 		default:
-			return USB_PORT_STAT_HIGH_SPEED;
 		}
 	}
 	return USB_PORT_STAT_HIGH_SPEED;
-- 
2.6.3


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 4/4] usb: host: ehci.h: use flexible array instead of zero-length array
  2015-12-09 19:57 [PATCH 1/4] usb: host: ehci.h: cleanup header file Geyslan G. Bem
  2015-12-09 19:57 ` [PATCH 2/4] " Geyslan G. Bem
  2015-12-09 19:57 ` [PATCH 3/4] usb: host: ehci.h: remove duplicated return Geyslan G. Bem
@ 2015-12-09 19:57 ` Geyslan G. Bem
  2015-12-09 20:09 ` [PATCH 1/4] usb: host: ehci.h: cleanup header file Greg Kroah-Hartman
  3 siblings, 0 replies; 15+ messages in thread
From: Geyslan G. Bem @ 2015-12-09 19:57 UTC (permalink / raw)
  To: peter.senna
  Cc: Geyslan G. Bem, Alan Stern, Greg Kroah-Hartman, linux-usb, linux-kernel

C99 standardized flexible arrays 'array[]'. The zero-length ones are
old gcc implementation 'array[0]'.

Signed-off-by: Geyslan G. Bem <geyslan@gmail.com>
---
 drivers/usb/host/ehci.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h
index 49b91b6..0ee1cdb 100644
--- a/drivers/usb/host/ehci.h
+++ b/drivers/usb/host/ehci.h
@@ -264,7 +264,7 @@ struct ehci_hcd {			/* one per controller */
 	struct list_head	tt_list;
 
 	/* platform-specific data -- must come last */
-	unsigned long		priv[0] __aligned(sizeof(s64));
+	unsigned long		priv[] __aligned(sizeof(s64));
 };
 
 /* convert between an HCD pointer and the corresponding EHCI_HCD */
@@ -463,7 +463,7 @@ struct ehci_iso_sched {
 	struct list_head	td_list;
 	unsigned		span;
 	unsigned		first_packet;
-	struct ehci_iso_packet	packet[0];
+	struct ehci_iso_packet	packet[];
 };
 
 /*
-- 
2.6.3


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* Re: [PATCH 1/4] usb: host: ehci.h: cleanup header file
  2015-12-09 19:57 [PATCH 1/4] usb: host: ehci.h: cleanup header file Geyslan G. Bem
                   ` (2 preceding siblings ...)
  2015-12-09 19:57 ` [PATCH 4/4] usb: host: ehci.h: use flexible array instead of zero-length array Geyslan G. Bem
@ 2015-12-09 20:09 ` Greg Kroah-Hartman
  2015-12-09 21:00   ` Geyslan G. Bem
  3 siblings, 1 reply; 15+ messages in thread
From: Greg Kroah-Hartman @ 2015-12-09 20:09 UTC (permalink / raw)
  To: Geyslan G. Bem; +Cc: peter.senna, Alan Stern, linux-usb, linux-kernel

On Wed, Dec 09, 2015 at 04:57:30PM -0300, Geyslan G. Bem wrote:
> This patch silences
>  - A coccinelle warning 'scripts/coccinelle/misc/compare_const_fl.cocci'
>  - All the errors and many warnings shown by checkpatch

"all" is a lot.  Please break down each type of change to a separate
patch.  Then do a patch with the coccinelle warning fixes as well.
That will make these patches a lot smaller and easier to review.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 3/4] usb: host: ehci.h: remove duplicated return
  2015-12-09 19:57 ` [PATCH 3/4] usb: host: ehci.h: remove duplicated return Geyslan G. Bem
@ 2015-12-09 20:10   ` Sergei Shtylyov
  2015-12-09 20:15     ` Geyslan G. Bem
  2015-12-09 21:08   ` kbuild test robot
  2015-12-09 21:24   ` kbuild test robot
  2 siblings, 1 reply; 15+ messages in thread
From: Sergei Shtylyov @ 2015-12-09 20:10 UTC (permalink / raw)
  To: Geyslan G. Bem, peter.senna
  Cc: Alan Stern, Greg Kroah-Hartman, linux-usb, linux-kernel

Hello.

On 12/09/2015 10:57 PM, Geyslan G. Bem wrote:

> This patch removes the return of the default switch case, since
> 'ehci_port_speed()' already has the same default return.
>
> Signed-off-by: Geyslan G. Bem <geyslan@gmail.com>
> ---
>   drivers/usb/host/ehci.h | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h
> index 0daed80..49b91b6 100644
> --- a/drivers/usb/host/ehci.h
> +++ b/drivers/usb/host/ehci.h
> @@ -664,8 +664,8 @@ ehci_port_speed(struct ehci_hcd *ehci, unsigned int portsc)
>   		case 1:
>   			return USB_PORT_STAT_LOW_SPEED;
>   		case 2:
> +		/* fall through to default function return */

    We just don't need the above *case*.

>   		default:
> -			return USB_PORT_STAT_HIGH_SPEED;

    And n ow we don't need *dafault* too.

>   		}
>   	}
>   	return USB_PORT_STAT_HIGH_SPEED;

MBR, Sergei


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 2/4] usb: host: ehci.h: cleanup header file
  2015-12-09 19:57 ` [PATCH 2/4] " Geyslan G. Bem
@ 2015-12-09 20:11   ` Sergei Shtylyov
  2015-12-09 20:18     ` Geyslan G. Bem
  0 siblings, 1 reply; 15+ messages in thread
From: Sergei Shtylyov @ 2015-12-09 20:11 UTC (permalink / raw)
  To: Geyslan G. Bem, peter.senna
  Cc: Alan Stern, Greg Kroah-Hartman, linux-usb, linux-kernel

Hello.

On 12/09/2015 10:57 PM, Geyslan G. Bem wrote:

> This patch does align function/macro definitions.
>
> Signed-off-by: Geyslan G. Bem <geyslan@gmail.com>

     USB code just uses different alignment style (2 tabs) than the other 
kernel parts (like networking).

MBR, Sergei


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 3/4] usb: host: ehci.h: remove duplicated return
  2015-12-09 20:10   ` Sergei Shtylyov
@ 2015-12-09 20:15     ` Geyslan G. Bem
  2015-12-09 20:22       ` Greg Kroah-Hartman
  2015-12-09 20:22       ` Sergei Shtylyov
  0 siblings, 2 replies; 15+ messages in thread
From: Geyslan G. Bem @ 2015-12-09 20:15 UTC (permalink / raw)
  To: Sergei Shtylyov
  Cc: Peter Senna Tschudin, Alan Stern, Greg Kroah-Hartman, linux-usb, LKML

2015-12-09 17:10 GMT-03:00 Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>:
> Hello.
>
> On 12/09/2015 10:57 PM, Geyslan G. Bem wrote:
>
>> This patch removes the return of the default switch case, since
>> 'ehci_port_speed()' already has the same default return.
>>
>> Signed-off-by: Geyslan G. Bem <geyslan@gmail.com>
>> ---
>>   drivers/usb/host/ehci.h | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h
>> index 0daed80..49b91b6 100644
>> --- a/drivers/usb/host/ehci.h
>> +++ b/drivers/usb/host/ehci.h
>> @@ -664,8 +664,8 @@ ehci_port_speed(struct ehci_hcd *ehci, unsigned int
>> portsc)
>>                 case 1:
>>                         return USB_PORT_STAT_LOW_SPEED;
>>                 case 2:
>> +               /* fall through to default function return */
>
>
>    We just don't need the above *case*.
>
>>                 default:
>> -                       return USB_PORT_STAT_HIGH_SPEED;
>
>
>    And n ow we don't need *dafault* too.

Case 1 only? If not low_speed, high_speed. So, I'll change it to a
simple if branch.

>
>>                 }
>>         }
>>         return USB_PORT_STAT_HIGH_SPEED;
>
>
> MBR, Sergei
>



-- 
Regards,

Geyslan G. Bem
hackingbits.com

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 2/4] usb: host: ehci.h: cleanup header file
  2015-12-09 20:11   ` Sergei Shtylyov
@ 2015-12-09 20:18     ` Geyslan G. Bem
  0 siblings, 0 replies; 15+ messages in thread
From: Geyslan G. Bem @ 2015-12-09 20:18 UTC (permalink / raw)
  To: Sergei Shtylyov
  Cc: Peter Senna Tschudin, Alan Stern, Greg Kroah-Hartman, linux-usb, LKML

2015-12-09 17:11 GMT-03:00 Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>:
> Hello.
>
> On 12/09/2015 10:57 PM, Geyslan G. Bem wrote:
>
>> This patch does align function/macro definitions.
>>
>> Signed-off-by: Geyslan G. Bem <geyslan@gmail.com>
>
>
>     USB code just uses different alignment style (2 tabs) than the other
> kernel parts (like networking).
I see. Please, ignore it.

New code has to have 2 tabs too?

>
> MBR, Sergei
>



-- 
Regards,

Geyslan G. Bem
hackingbits.com

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 3/4] usb: host: ehci.h: remove duplicated return
  2015-12-09 20:15     ` Geyslan G. Bem
@ 2015-12-09 20:22       ` Greg Kroah-Hartman
  2015-12-09 20:22       ` Sergei Shtylyov
  1 sibling, 0 replies; 15+ messages in thread
From: Greg Kroah-Hartman @ 2015-12-09 20:22 UTC (permalink / raw)
  To: Geyslan G. Bem
  Cc: Sergei Shtylyov, Peter Senna Tschudin, Alan Stern, linux-usb, LKML

On Wed, Dec 09, 2015 at 05:15:43PM -0300, Geyslan G. Bem wrote:
> 2015-12-09 17:10 GMT-03:00 Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>:
> > Hello.
> >
> > On 12/09/2015 10:57 PM, Geyslan G. Bem wrote:
> >
> >> This patch removes the return of the default switch case, since
> >> 'ehci_port_speed()' already has the same default return.
> >>
> >> Signed-off-by: Geyslan G. Bem <geyslan@gmail.com>
> >> ---
> >>   drivers/usb/host/ehci.h | 2 +-
> >>   1 file changed, 1 insertion(+), 1 deletion(-)
> >>
> >> diff --git a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h
> >> index 0daed80..49b91b6 100644
> >> --- a/drivers/usb/host/ehci.h
> >> +++ b/drivers/usb/host/ehci.h
> >> @@ -664,8 +664,8 @@ ehci_port_speed(struct ehci_hcd *ehci, unsigned int
> >> portsc)
> >>                 case 1:
> >>                         return USB_PORT_STAT_LOW_SPEED;
> >>                 case 2:
> >> +               /* fall through to default function return */
> >
> >
> >    We just don't need the above *case*.
> >
> >>                 default:
> >> -                       return USB_PORT_STAT_HIGH_SPEED;
> >
> >
> >    And n ow we don't need *dafault* too.
> 
> Case 1 only? If not low_speed, high_speed. So, I'll change it to a
> simple if branch.

No, please leave it as-is, it helps to understand what is going on here
easier.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 3/4] usb: host: ehci.h: remove duplicated return
  2015-12-09 20:15     ` Geyslan G. Bem
  2015-12-09 20:22       ` Greg Kroah-Hartman
@ 2015-12-09 20:22       ` Sergei Shtylyov
  1 sibling, 0 replies; 15+ messages in thread
From: Sergei Shtylyov @ 2015-12-09 20:22 UTC (permalink / raw)
  To: Geyslan G. Bem
  Cc: Peter Senna Tschudin, Alan Stern, Greg Kroah-Hartman, linux-usb, LKML

On 12/09/2015 11:15 PM, Geyslan G. Bem wrote:

>>> This patch removes the return of the default switch case, since
>>> 'ehci_port_speed()' already has the same default return.
>>>
>>> Signed-off-by: Geyslan G. Bem <geyslan@gmail.com>
>>> ---
>>>    drivers/usb/host/ehci.h | 2 +-
>>>    1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h
>>> index 0daed80..49b91b6 100644
>>> --- a/drivers/usb/host/ehci.h
>>> +++ b/drivers/usb/host/ehci.h
>>> @@ -664,8 +664,8 @@ ehci_port_speed(struct ehci_hcd *ehci, unsigned int
>>> portsc)
>>>                  case 1:
>>>                          return USB_PORT_STAT_LOW_SPEED;
>>>                  case 2:
>>> +               /* fall through to default function return */
>>
>>
>>     We just don't need the above *case*.
>>
>>>                  default:
>>> -                       return USB_PORT_STAT_HIGH_SPEED;
>>
>>
>>     And n ow we don't need *dafault* too.

> Case 1 only? If not low_speed, high_speed. So, I'll change it to a
> simple if branch.

    There's *case* 0 yet.


>>
>>>                  }
>>>          }
>>>          return USB_PORT_STAT_HIGH_SPEED;

MBR, Sergei


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 1/4] usb: host: ehci.h: cleanup header file
  2015-12-09 20:09 ` [PATCH 1/4] usb: host: ehci.h: cleanup header file Greg Kroah-Hartman
@ 2015-12-09 21:00   ` Geyslan G. Bem
  0 siblings, 0 replies; 15+ messages in thread
From: Geyslan G. Bem @ 2015-12-09 21:00 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: Peter Senna Tschudin, Alan Stern, linux-usb, LKML

2015-12-09 17:09 GMT-03:00 Greg Kroah-Hartman <gregkh@linuxfoundation.org>:
> On Wed, Dec 09, 2015 at 04:57:30PM -0300, Geyslan G. Bem wrote:
>> This patch silences
>>  - A coccinelle warning 'scripts/coccinelle/misc/compare_const_fl.cocci'
>>  - All the errors and many warnings shown by checkpatch
>
> "all" is a lot.  Please break down each type of change to a separate
> patch.  Then do a patch with the coccinelle warning fixes as well.
> That will make these patches a lot smaller and easier to review.

Ok. Doing.

>
> thanks,
>
> greg k-h



-- 
Regards,

Geyslan G. Bem
hackingbits.com

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 3/4] usb: host: ehci.h: remove duplicated return
  2015-12-09 19:57 ` [PATCH 3/4] usb: host: ehci.h: remove duplicated return Geyslan G. Bem
  2015-12-09 20:10   ` Sergei Shtylyov
@ 2015-12-09 21:08   ` kbuild test robot
  2015-12-09 21:24   ` kbuild test robot
  2 siblings, 0 replies; 15+ messages in thread
From: kbuild test robot @ 2015-12-09 21:08 UTC (permalink / raw)
  To: Geyslan G. Bem
  Cc: kbuild-all, peter.senna, Geyslan G. Bem, Alan Stern,
	Greg Kroah-Hartman, linux-usb, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1732 bytes --]

Hi Geyslan,

[auto build test ERROR on usb/usb-testing]
[also build test ERROR on v4.4-rc4 next-20151209]

url:    https://github.com/0day-ci/linux/commits/Geyslan-G-Bem/usb-host-ehci-h-cleanup-header-file/20151210-040115
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing
config: x86_64-randconfig-s3-12100340 (attached as .config)
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All errors (new ones prefixed by >>):

   In file included from drivers/usb/host/ehci-hcd.c:109:0:
   drivers/usb/host/ehci.h: In function 'ehci_port_speed':
>> drivers/usb/host/ehci.h:668:3: error: label at end of compound statement
      default:
      ^

vim +668 drivers/usb/host/ehci.h

^1da177e Linus Torvalds 2005-04-16  662  		case 0:
^1da177e Linus Torvalds 2005-04-16  663  			return 0;
^1da177e Linus Torvalds 2005-04-16  664  		case 1:
288ead45 Alan Stern     2010-03-04  665  			return USB_PORT_STAT_LOW_SPEED;
^1da177e Linus Torvalds 2005-04-16  666  		case 2:
50691528 Geyslan G. Bem 2015-12-09  667  		/* fall through to default function return */
^1da177e Linus Torvalds 2005-04-16 @668  		default:
^1da177e Linus Torvalds 2005-04-16  669  		}
^1da177e Linus Torvalds 2005-04-16  670  	}
288ead45 Alan Stern     2010-03-04  671  	return USB_PORT_STAT_HIGH_SPEED;

:::::: The code at line 668 was first introduced by commit
:::::: 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 Linux-2.6.12-rc2

:::::: TO: Linus Torvalds <torvalds@ppc970.osdl.org>
:::::: CC: Linus Torvalds <torvalds@ppc970.osdl.org>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/octet-stream, Size: 27024 bytes --]

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 3/4] usb: host: ehci.h: remove duplicated return
  2015-12-09 19:57 ` [PATCH 3/4] usb: host: ehci.h: remove duplicated return Geyslan G. Bem
  2015-12-09 20:10   ` Sergei Shtylyov
  2015-12-09 21:08   ` kbuild test robot
@ 2015-12-09 21:24   ` kbuild test robot
  2015-12-09 21:47     ` Geyslan G. Bem
  2 siblings, 1 reply; 15+ messages in thread
From: kbuild test robot @ 2015-12-09 21:24 UTC (permalink / raw)
  To: Geyslan G. Bem
  Cc: kbuild-all, peter.senna, Geyslan G. Bem, Alan Stern,
	Greg Kroah-Hartman, linux-usb, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1767 bytes --]

Hi Geyslan,

[auto build test ERROR on usb/usb-testing]
[also build test ERROR on v4.4-rc4 next-20151209]

url:    https://github.com/0day-ci/linux/commits/Geyslan-G-Bem/usb-host-ehci-h-cleanup-header-file/20151210-040115
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing
config: x86_64-randconfig-s0-12100345 (attached as .config)
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All errors (new ones prefixed by >>):

   In file included from drivers/usb/chipidea/host.c:29:0:
   drivers/usb/chipidea/../host/ehci.h: In function 'ehci_port_speed':
>> drivers/usb/chipidea/../host/ehci.h:668:3: error: label at end of compound statement
      default:
      ^

vim +668 drivers/usb/chipidea/../host/ehci.h

^1da177e Linus Torvalds 2005-04-16  662  		case 0:
^1da177e Linus Torvalds 2005-04-16  663  			return 0;
^1da177e Linus Torvalds 2005-04-16  664  		case 1:
288ead45 Alan Stern     2010-03-04  665  			return USB_PORT_STAT_LOW_SPEED;
^1da177e Linus Torvalds 2005-04-16  666  		case 2:
50691528 Geyslan G. Bem 2015-12-09  667  		/* fall through to default function return */
^1da177e Linus Torvalds 2005-04-16 @668  		default:
^1da177e Linus Torvalds 2005-04-16  669  		}
^1da177e Linus Torvalds 2005-04-16  670  	}
288ead45 Alan Stern     2010-03-04  671  	return USB_PORT_STAT_HIGH_SPEED;

:::::: The code at line 668 was first introduced by commit
:::::: 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 Linux-2.6.12-rc2

:::::: TO: Linus Torvalds <torvalds@ppc970.osdl.org>
:::::: CC: Linus Torvalds <torvalds@ppc970.osdl.org>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/octet-stream, Size: 22924 bytes --]

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 3/4] usb: host: ehci.h: remove duplicated return
  2015-12-09 21:24   ` kbuild test robot
@ 2015-12-09 21:47     ` Geyslan G. Bem
  0 siblings, 0 replies; 15+ messages in thread
From: Geyslan G. Bem @ 2015-12-09 21:47 UTC (permalink / raw)
  To: kbuild test robot
  Cc: kbuild-all, Peter Senna Tschudin, Alan Stern, Greg Kroah-Hartman,
	linux-usb, LKML

2015-12-09 18:24 GMT-03:00 kbuild test robot <lkp@intel.com>:
> Hi Geyslan,
>
> [auto build test ERROR on usb/usb-testing]
> [also build test ERROR on v4.4-rc4 next-20151209]
>
> url:    https://github.com/0day-ci/linux/commits/Geyslan-G-Bem/usb-host-ehci-h-cleanup-header-file/20151210-040115
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing
> config: x86_64-randconfig-s0-12100345 (attached as .config)
> reproduce:
>         # save the attached .config to linux build tree
>         make ARCH=x86_64
>
> All errors (new ones prefixed by >>):
>
>    In file included from drivers/usb/chipidea/host.c:29:0:
>    drivers/usb/chipidea/../host/ehci.h: In function 'ehci_port_speed':
>>> drivers/usb/chipidea/../host/ehci.h:668:3: error: label at end of compound statement
>       default:
Missed the break. Coul be removed too.

>       ^
>
> vim +668 drivers/usb/chipidea/../host/ehci.h
>
> ^1da177e Linus Torvalds 2005-04-16  662                 case 0:
> ^1da177e Linus Torvalds 2005-04-16  663                         return 0;
> ^1da177e Linus Torvalds 2005-04-16  664                 case 1:
> 288ead45 Alan Stern     2010-03-04  665                         return USB_PORT_STAT_LOW_SPEED;
> ^1da177e Linus Torvalds 2005-04-16  666                 case 2:
> 50691528 Geyslan G. Bem 2015-12-09  667                 /* fall through to default function return */
> ^1da177e Linus Torvalds 2005-04-16 @668                 default:
> ^1da177e Linus Torvalds 2005-04-16  669                 }
> ^1da177e Linus Torvalds 2005-04-16  670         }
> 288ead45 Alan Stern     2010-03-04  671         return USB_PORT_STAT_HIGH_SPEED;
>
> :::::: The code at line 668 was first introduced by commit
> :::::: 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 Linux-2.6.12-rc2
>
> :::::: TO: Linus Torvalds <torvalds@ppc970.osdl.org>
> :::::: CC: Linus Torvalds <torvalds@ppc970.osdl.org>
>
> ---
> 0-DAY kernel test infrastructure                Open Source Technology Center
> https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

> No, please leave it as-is, it helps to understand what is going on here
> easier.

Ok. Let it go. :)

> thanks,

> greg k-h



-- 
Regards,

Geyslan G. Bem
hackingbits.com

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2015-12-09 21:49 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-09 19:57 [PATCH 1/4] usb: host: ehci.h: cleanup header file Geyslan G. Bem
2015-12-09 19:57 ` [PATCH 2/4] " Geyslan G. Bem
2015-12-09 20:11   ` Sergei Shtylyov
2015-12-09 20:18     ` Geyslan G. Bem
2015-12-09 19:57 ` [PATCH 3/4] usb: host: ehci.h: remove duplicated return Geyslan G. Bem
2015-12-09 20:10   ` Sergei Shtylyov
2015-12-09 20:15     ` Geyslan G. Bem
2015-12-09 20:22       ` Greg Kroah-Hartman
2015-12-09 20:22       ` Sergei Shtylyov
2015-12-09 21:08   ` kbuild test robot
2015-12-09 21:24   ` kbuild test robot
2015-12-09 21:47     ` Geyslan G. Bem
2015-12-09 19:57 ` [PATCH 4/4] usb: host: ehci.h: use flexible array instead of zero-length array Geyslan G. Bem
2015-12-09 20:09 ` [PATCH 1/4] usb: host: ehci.h: cleanup header file Greg Kroah-Hartman
2015-12-09 21:00   ` Geyslan G. Bem

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.