* [PATCH 2/2] 8139too: different style cleanups
@ 2008-06-14 12:37 Németh Márton
2008-06-14 18:44 ` Németh Márton
0 siblings, 1 reply; 5+ messages in thread
From: Németh Márton @ 2008-06-14 12:37 UTC (permalink / raw)
To: Jeff Garzik; +Cc: netdev, Trivial Patch Monkey, LKML
From: Márton Németh <nm127@freemail.hu>
Clean up the following errors and warnings reported by checkpatch.pl:
- Use #include <linux/io.h> instead of <asm/io.h>
- Use #include <linux/uaccess.h> instead of <asm/uaccess.h>
- __func__ should be used instead of gcc specific __FUNCTION__
- Macros with complex values should be enclosed in parenthesis
- do not add new typedefs
- trailing statements should be on next line
- braces {} are not necessary for single statement blocks
- plain inline is preferred over __inline__
Signed-off-by: Márton Németh <nm127@freemail.hu>
---
--- b/drivers/net/8139too.c 2008-06-14 14:08:18.000000000 +0200
+++ c/drivers/net/8139too.c 2008-06-14 14:16:49.000000000 +0200
@@ -107,8 +107,8 @@
#include <linux/mii.h>
#include <linux/completion.h>
#include <linux/crc32.h>
-#include <asm/io.h>
-#include <asm/uaccess.h>
+#include <linux/io.h>
+#include <linux/uaccess.h>
#include <asm/irq.h>
#define RTL8139_DRIVER_NAME DRV_NAME " Fast Ethernet driver " DRV_VERSION
@@ -135,7 +135,7 @@
#if RTL8139_DEBUG
/* note: prints function name for you */
# define DPRINTK(fmt, args...) \
- printk(KERN_DEBUG "%s: " fmt, __FUNCTION__ , ## args)
+ printk(KERN_DEBUG "%s: " fmt, __func__ , ## args)
#else
# define DPRINTK(fmt, args...)
#endif
@@ -146,7 +146,7 @@
# define assert(expr) \
if (unlikely(!(expr))) { \
printk(KERN_ERR "Assertion failed! %s,%s,%s,line=%d\n", \
- #expr, __FILE__, __FUNCTION__, __LINE__); \
+ #expr, __FILE__, __func__, __LINE__); \
}
#endif
@@ -221,9 +221,9 @@ enum {
#define RTL8139B_IO_SIZE 256
#define RTL8129_CAPS HAS_MII_XCVR
-#define RTL8139_CAPS HAS_CHIP_XCVR|HAS_LNK_CHNG
+#define RTL8139_CAPS (HAS_CHIP_XCVR|HAS_LNK_CHNG)
-typedef enum {
+enum {
RTL8139 = 0,
RTL8129,
} board_t;
@@ -1033,7 +1033,8 @@ static int __devinit rtl8139_init_one(st
/* dev is fully set up and ready to use now */
DPRINTK("about to register device named %s (%p)...\n", dev->name, dev);
i = register_netdev(dev);
- if (i) goto err_out;
+ if (i)
+ goto err_out;
pci_set_drvdata(pdev, dev);
@@ -1378,9 +1379,9 @@ static void rtl_check_media(struct net_d
{
struct rtl8139_private *tp = netdev_priv(dev);
- if (tp->phys[0] >= 0) {
+ if (tp->phys[0] >= 0)
mii_check_media(&tp->mii, netif_msg_link(tp), init_media);
- }
+
}
/* Start the hardware at open or resume. */
@@ -1921,7 +1922,7 @@ static void rtl8139_rx_err(u32 rx_status
}
#if RX_BUF_IDX == 3
-static __inline__ void wrap_copy(struct sk_buff *skb, const unsigned char *ring,
+static inline void wrap_copy(struct sk_buff *skb, const unsigned char *ring,
u32 offset, unsigned int size)
{
u32 left = RX_BUF_LEN - offset;
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] 8139too: different style cleanups
2008-06-14 12:37 [PATCH 2/2] 8139too: different style cleanups Németh Márton
@ 2008-06-14 18:44 ` Németh Márton
2008-06-15 6:26 ` David Newall
0 siblings, 1 reply; 5+ messages in thread
From: Németh Márton @ 2008-06-14 18:44 UTC (permalink / raw)
To: Jeff Garzik; +Cc: netdev, Trivial Patch Monkey, LKML
From: Márton Németh <nm127@freemail.hu>
Clean up the following errors and warnings reported by checkpatch.pl:
- Use #include <linux/io.h> instead of <asm/io.h>
- Use #include <linux/uaccess.h> instead of <asm/uaccess.h>
- __func__ should be used instead of gcc specific __FUNCTION__
- Macros with complex values should be enclosed in parenthesis
- do not add new typedefs
- trailing statements should be on next line
- braces {} are not necessary for single statement blocks
- plain inline is preferred over __inline__
Signed-off-by: Márton Németh <nm127@freemail.hu>
---
--- b/drivers/net/8139too.c 2008-06-14 20:32:45.000000000 +0200
+++ c/drivers/net/8139too.c 2008-06-14 20:38:24.000000000 +0200
@@ -107,8 +107,8 @@
#include <linux/mii.h>
#include <linux/completion.h>
#include <linux/crc32.h>
-#include <asm/io.h>
-#include <asm/uaccess.h>
+#include <linux/io.h>
+#include <linux/uaccess.h>
#include <asm/irq.h>
#define RTL8139_DRIVER_NAME DRV_NAME " Fast Ethernet driver " DRV_VERSION
@@ -135,7 +135,7 @@
#if RTL8139_DEBUG
/* note: prints function name for you */
# define DPRINTK(fmt, args...) \
- printk(KERN_DEBUG "%s: " fmt, __FUNCTION__ , ## args)
+ printk(KERN_DEBUG "%s: " fmt, __func__ , ## args)
#else
# define DPRINTK(fmt, args...)
#endif
@@ -146,7 +146,7 @@
# define assert(expr) \
if (unlikely(!(expr))) { \
printk(KERN_ERR "Assertion failed! %s,%s,%s,line=%d\n", \
- #expr, __FILE__, __FUNCTION__, __LINE__); \
+ #expr, __FILE__, __func__, __LINE__); \
}
#endif
@@ -222,9 +222,9 @@ enum {
#define RTL8139B_IO_SIZE 256
#define RTL8129_CAPS HAS_MII_XCVR
-#define RTL8139_CAPS HAS_CHIP_XCVR|HAS_LNK_CHNG
+#define RTL8139_CAPS (HAS_CHIP_XCVR|HAS_LNK_CHNG)
-typedef enum {
+enum {
RTL8139 = 0,
RTL8129,
} board_t;
@@ -1035,7 +1035,8 @@ static int __devinit rtl8139_init_one(st
/* dev is fully set up and ready to use now */
DPRINTK("about to register device named %s (%p)...\n", dev->name, dev);
i = register_netdev(dev);
- if (i) goto err_out;
+ if (i)
+ goto err_out;
pci_set_drvdata(pdev, dev);
@@ -1380,9 +1381,9 @@ static void rtl_check_media(struct net_d
{
struct rtl8139_private *tp = netdev_priv(dev);
- if (tp->phys[0] >= 0) {
+ if (tp->phys[0] >= 0)
mii_check_media(&tp->mii, netif_msg_link(tp), init_media);
- }
+
}
/* Start the hardware at open or resume. */
@@ -1923,7 +1924,7 @@ static void rtl8139_rx_err(u32 rx_status
}
#if RX_BUF_IDX == 3
-static __inline__ void wrap_copy(struct sk_buff *skb, const unsigned char *ring,
+static inline void wrap_copy(struct sk_buff *skb, const unsigned char *ring,
u32 offset, unsigned int size)
{
u32 left = RX_BUF_LEN - offset;
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] 8139too: different style cleanups
2008-06-14 18:44 ` Németh Márton
@ 2008-06-15 6:26 ` David Newall
2008-06-15 6:50 ` Harvey Harrison
2008-06-16 5:09 ` [PATCH] 8139too: add missing brackets Németh Márton
0 siblings, 2 replies; 5+ messages in thread
From: David Newall @ 2008-06-15 6:26 UTC (permalink / raw)
To: Németh Márton; +Cc: Jeff Garzik, netdev, Trivial Patch Monkey, LKML
Németh Márton wrote:
> # define DPRINTK(fmt, args...) \
> - printk(KERN_DEBUG "%s: " fmt, __FUNCTION__ , ## args)
> + printk(KERN_DEBUG "%s: " fmt, __func__ , ## args)
>
Why change __FUNCTION__ to __func__? I don't even know where __func__
come from? Assuming that it isn't totally broken, and I'll believe that
it isn't, then would it be compiler-specific? __FUNCTION__ is standard
and that's more than enough reason to prefer that form to any
non-standard variation.
Yes to the following; no to all the rest:
> -#define RTL8139_CAPS HAS_CHIP_XCVR|HAS_LNK_CHNG
> +#define RTL8139_CAPS (HAS_CHIP_XCVR|HAS_LNK_CHNG)
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] 8139too: different style cleanups
2008-06-15 6:26 ` David Newall
@ 2008-06-15 6:50 ` Harvey Harrison
2008-06-16 5:09 ` [PATCH] 8139too: add missing brackets Németh Márton
1 sibling, 0 replies; 5+ messages in thread
From: Harvey Harrison @ 2008-06-15 6:50 UTC (permalink / raw)
To: David Newall
Cc: Németh Márton, Jeff Garzik, netdev,
Trivial Patch Monkey, LKML
On Sun, 2008-06-15 at 15:56 +0930, David Newall wrote:
> Németh Márton wrote:
> > # define DPRINTK(fmt, args...) \
> > - printk(KERN_DEBUG "%s: " fmt, __FUNCTION__ , ## args)
> > + printk(KERN_DEBUG "%s: " fmt, __func__ , ## args)
> >
>
> Why change __FUNCTION__ to __func__? I don't even know where __func__
> come from? Assuming that it isn't totally broken, and I'll believe that
> it isn't, then would it be compiler-specific? __FUNCTION__ is standard
> and that's more than enough reason to prefer that form to any
> non-standard variation.
__FUNCTION__ is gcc-specific, __func__ is C99.
Harvey
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH] 8139too: add missing brackets
2008-06-15 6:26 ` David Newall
2008-06-15 6:50 ` Harvey Harrison
@ 2008-06-16 5:09 ` Németh Márton
1 sibling, 0 replies; 5+ messages in thread
From: Németh Márton @ 2008-06-16 5:09 UTC (permalink / raw)
To: David Newall; +Cc: Jeff Garzik, netdev, Trivial Patch Monkey, LKML
From: Márton Németh <nm127@freemail.hu>
Clean up the following error reported by checkpatch.pl:
- Macros with complex values should be enclosed in parenthesis
The macro RTL8139_CAPS currently only used as a whole expression
to initialize board_info[] so this change won't change the resulting code.
Signed-off-by: Márton Németh <nm127@freemail.hu>
---
--- a/drivers/net/8139too.c 2008-06-14 00:20:47.000000000 +0200
+++ b/drivers/net/8139too.c 2008-06-16 07:03:20.000000000 +0200
@@ -219,7 +219,7 @@ enum {
#define RTL8139B_IO_SIZE 256
#define RTL8129_CAPS HAS_MII_XCVR
-#define RTL8139_CAPS HAS_CHIP_XCVR|HAS_LNK_CHNG
+#define RTL8139_CAPS (HAS_CHIP_XCVR|HAS_LNK_CHNG)
typedef enum {
RTL8139 = 0,
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2008-06-16 5:10 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-14 12:37 [PATCH 2/2] 8139too: different style cleanups Németh Márton
2008-06-14 18:44 ` Németh Márton
2008-06-15 6:26 ` David Newall
2008-06-15 6:50 ` Harvey Harrison
2008-06-16 5:09 ` [PATCH] 8139too: add missing brackets Németh Márton
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.