ixgb: Use pr_<level> and netdev_<level>
Subsystems (2)
PATCH 1/1 ixgb: Use pr_<level> and netdev_<level>
From: Joe Perches <[email protected]>
Convert DEBUGOUTx to pr_debug
Convert DEBUGFUNC to more commonly used ENTER
Convert mac address output to %pM
Use #define pr_fmt
Convert a few printks to pr_<level>
Improve ixgb_mc_addr_list_update: use a temporary for current mc address Use etherdevice.h functions for mac address testing
---
drivers/net/ixgb/ixgb.h | 8 ++ drivers/net/ixgb/ixgb_ee.c | 14 ++-- drivers/net/ixgb/ixgb_hw.c | 147 +++++++++++++++++------------------------ drivers/net/ixgb/ixgb_hw.h | 12 --- drivers/net/ixgb/ixgb_main.c | 33 ++++----- drivers/net/ixgb/ixgb_osdep.h | 16 +--- drivers/net/ixgb/ixgb_param.c | 31 ++++----- 7 files changed, 105 insertions(+), 156 deletions(-)
drivers/net/ixgb/ixgb.h +6 -2
@@ -78,9 +78,13 @@ struct ixgb_adapter;#define PFX "ixgb: "#ifdef _DEBUG_DRIVER_ -#define IXGB_DBG(args...) printk(KERN_DEBUG PFX args) +#define IXGB_DBG(fmt, args...) printk(KERN_DEBUG PFX fmt, ##args)#else -#define IXGB_DBG(args...) +#define IXGB_DBG(fmt, args...) \ +do { \ + if (0) \ + printk(KERN_DEBUG PFX fmt, ##args); \ +} while (0)#endif /* TX/RX descriptor defines */
drivers/net/ixgb/ixgb_ee.c +8 -6
@@ -26,6 +26,8 @@*******************************************************************************/ +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include "ixgb_hw.h" #include "ixgb_ee.h" /* Local prototypes */
@@ -467,11 +469,11 @@ ixgb_get_eeprom_data(struct ixgb_hw *hw)u16 checksum =0 ;struct ixgb_ee_map_type *ee_map; -DEBUGFUNC ("ixgb_get_eeprom_data" ); +ENTER (); ee_map = (struct ixgb_ee_map_type *)hw->eeprom; -DEBUGOUT ("ixgb_ee: Reading eeprom data\n" ); +pr_debug ("Reading eeprom data\n" );for (i =0 ; i <IXGB_EEPROM_SIZE ; i++) {u16 ee_data; ee_data =ixgb_read_eeprom (hw, i);
@@ -480,7 +482,7 @@ ixgb_get_eeprom_data(struct ixgb_hw *hw) }if (checksum != (u16 )EEPROM_SUM ) { -DEBUGOUT ("ixgb_ee: Checksum invalid.\n" ); +pr_debug ("Checksum invalid\n" );/* clear the init_ctrl_reg_1 to signify that the cache is * invalidated */ ee_map->init_ctrl_reg_1 =cpu_to_le16 (EEPROM_ICW1_SIGNATURE_CLEAR );
@@ -489,7 +491,7 @@ ixgb_get_eeprom_data(struct ixgb_hw *hw)if ((ee_map->init_ctrl_reg_1 &cpu_to_le16 (EEPROM_ICW1_SIGNATURE_MASK )) !=cpu_to_le16 (EEPROM_ICW1_SIGNATURE_VALID )) { -DEBUGOUT ("ixgb_ee: Signature invalid.\n" ); +pr_debug ("Signature invalid\n" );return (false); }
@@ -555,13 +557,13 @@ ixgb_get_ee_mac_addr(struct ixgb_hw *hw,int i;struct ixgb_ee_map_type *ee_map = (struct ixgb_ee_map_type *)hw->eeprom; -DEBUGFUNC ("ixgb_get_ee_mac_addr" ); +ENTER ();if (ixgb_check_and_get_eeprom_data (hw) == true) {for (i =0 ; i <IXGB_ETH_LENGTH_OF_ADDRESS ; i++) { mac_addr[i] = ee_map->mac_addr[i]; -DEBUGOUT2 ("mac(%d) = %.2X\n" , i, mac_addr[i]); } +pr_debug ("eeprom mac address = %pM\n" , mac_addr); } }
drivers/net/ixgb/ixgb_hw.c +61 -86
376 lines not on this page · raw message
drivers/net/ixgb/ixgb_hw.h +0 -12
@@ -636,18 +636,6 @@ struct ixgb_flash_buffer {u8 filler3[0xAAAA ]; }; -/* -* This is a little-endian specific check. -*/ -#define IS_MULTICAST (Address) \ - (bool)(((u8 *)(Address))[0] & ((u8)0x01)) - -/* -* Check whether an address is broadcast. -*/ -#define IS_BROADCAST (Address) \ - ((((u8 *)(Address))[0] == ((u8)0xff)) && (((u8 *)(Address))[1] == ((u8)0xff))) -/* Flow control parameters */ struct ixgb_fc {u32 high_water;/* Flow Control High-water */
drivers/net/ixgb/ixgb_main.c +15 -18
@@ -26,6 +26,8 @@*******************************************************************************/ +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include "ixgb.h" char ixgb_driver_name[] ="ixgb" ;
@@ -146,10 +148,8 @@ MODULE_PARM_DESC(debug, "Debug level (0=none,...,16=all)");static int __init ixgb_init_module (void ) { -printk (KERN_INFO "%s - version %s\n" , - ixgb_driver_string, ixgb_driver_version); - -printk (KERN_INFO "%s\n" , ixgb_copyright); +pr_info ("%s - version %s\n" , ixgb_driver_string, ixgb_driver_version); +pr_info ("%s\n" , ixgb_copyright);return pci_register_driver (&ixgb_driver); }
@@ -374,8 +374,7 @@ ixgb_probe(struct pci_dev *pdev, const struct pci_device_id *ent) }else {if ((err =pci_set_dma_mask (pdev,DMA_BIT_MASK (32 ))) || (err =pci_set_consistent_dma_mask (pdev,DMA_BIT_MASK (32 )))) { -printk (KERN_ERR -"ixgb: No usable DMA configuration, aborting\n" ); +pr_err ("No usable DMA configuration, aborting\n" ); goto err_dma_mask; } pci_using_dac =0 ;
@@ -1118,15 +1117,14 @@ ixgb_watchdog(unsigned long data)if (adapter->hw.link_up) {if (!netif_carrier_ok (netdev)) { -printk (KERN_INFO "ixgb: %s NIC Link is Up 10 Gbps " -"Full Duplex, Flow Control: %s\n" , - netdev->name, - (adapter->hw.fc.type == ixgb_fc_full) ? -"RX/TX" : - ((adapter->hw.fc.type == ixgb_fc_rx_pause) ? -"RX" : - ((adapter->hw.fc.type == ixgb_fc_tx_pause) ? -"TX" :"None" ))); +netdev_info (netdev, +"NIC Link is Up 10 Gbps Full Duplex, Flow Control: %s\n" , + (adapter->hw.fc.type == ixgb_fc_full) ? +"RX/TX" : + (adapter->hw.fc.type == ixgb_fc_rx_pause) ? +"RX" : + (adapter->hw.fc.type == ixgb_fc_tx_pause) ? +"TX" :"None" ); adapter->link_speed =10000 ; adapter->link_duplex =FULL_DUPLEX ;netif_carrier_on (netdev);
@@ -1135,8 +1133,7 @@ ixgb_watchdog(unsigned long data)if (netif_carrier_ok (netdev)) { adapter->link_speed =0 ; adapter->link_duplex =0 ; -printk (KERN_INFO "ixgb: %s NIC Link is Down\n" , - netdev->name); +netdev_info (netdev,"NIC Link is Down\n" );netif_carrier_off (netdev); } }
@@ -2322,7 +2319,7 @@ static void ixgb_io_resume(struct pci_dev *pdev)if (netif_running (netdev)) {if (ixgb_up (adapter)) { -printk ("ixgb: can't bring device back up after reset\n" ); +pr_err ("can't bring device back up after reset\n" );return ; } }
drivers/net/ixgb/ixgb_osdep.h +2 -14
@@ -41,20 +41,8 @@#undef ASSERT#define ASSERT (x) BUG_ON(!(x)) -#define MSGOUT (S ,A ,B ) printk(KERN_DEBUG S "\n", A, B) - -#ifdef DBG -#define DEBUGOUT (S ) printk(KERN_DEBUG S "\n") -#define DEBUGOUT1(S, A...) printk(KERN_DEBUG S "\n", A) -#else -#define DEBUGOUT (S ) -#define DEBUGOUT1(S, A...) -#endif - -#define DEBUGFUNC (F ) DEBUGOUT(F) -#define DEBUGOUT2 DEBUGOUT1 -#define DEBUGOUT3 DEBUGOUT2 -#define DEBUGOUT7 DEBUGOUT3 + +#define ENTER () pr_debug("%s\n", __func__);#define IXGB_WRITE_REG (a, reg, value) ( \ writel((value), ((a)->hw_addr + IXGB_##reg)))
drivers/net/ixgb/ixgb_param.c +13 -18
@@ -26,6 +26,8 @@*******************************************************************************/ +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include "ixgb.h" /* This is the only thing that needs to be changed to adjust the
@@ -209,16 +211,16 @@ ixgb_validate_option(unsigned int *value, const struct ixgb_option *opt)case enable_option:switch (*value) {case OPTION_ENABLED : -printk (KERN_INFO "%s Enabled\n" , opt->name); +pr_info ("%s Enabled\n" , opt->name);return 0 ;case OPTION_DISABLED : -printk (KERN_INFO "%s Disabled\n" , opt->name); +pr_info ("%s Disabled\n" , opt->name);return 0 ; }break ;case range_option:if (*value >= opt->arg.r.min && *value <= opt->arg.r.max) { -printk (KERN_INFO "%s set to %i\n" , opt->name, *value); +pr_info ("%s set to %i\n" , opt->name, *value);return 0 ; }break ;
@@ -230,7 +232,7 @@ ixgb_validate_option(unsigned int *value, const struct ixgb_option *opt) ent = &opt->arg.l.p[i];if (*value == ent->i) {if (ent->str[0 ] !='\0' ) -printk (KERN_INFO "%s\n" , ent->str); +pr_info ("%s\n" , ent->str);return 0 ; } }
@@ -240,8 +242,7 @@ ixgb_validate_option(unsigned int *value, const struct ixgb_option *opt)BUG (); } -printk (KERN_INFO "Invalid %s specified (%i) %s\n" , - opt->name, *value, opt->err); +pr_info ("Invalid %s specified (%i) %s\n" , opt->name, *value, opt->err); *value = opt->def;return -1 ; }
@@ -261,9 +262,8 @@ ixgb_check_options(struct ixgb_adapter *adapter) {int bd = adapter->bd_number;if (bd >=IXGB_MAX_NIC ) { -printk (KERN_NOTICE -"Warning: no configuration for board #%i\n" , bd); -printk (KERN_NOTICE "Using defaults for all values\n" ); +pr_notice ("Warning: no configuration for board #%i\n" , bd); +pr_notice ("Using defaults for all values\n" ); } {/* Transmit Descriptor Count */
@@ -363,8 +363,7 @@ ixgb_check_options(struct ixgb_adapter *adapter) adapter->hw.fc.high_water = opt.def; }if (!(adapter->hw.fc.type & ixgb_fc_tx_pause) ) -printk (KERN_INFO -"Ignoring RxFCHighThresh when no RxFC\n" ); +pr_info ("Ignoring RxFCHighThresh when no RxFC\n" ); } {/* Receive Flow Control Low Threshold */ const struct ixgb_option opt = {
@@ -383,8 +382,7 @@ ixgb_check_options(struct ixgb_adapter *adapter) adapter->hw.fc.low_water = opt.def; }if (!(adapter->hw.fc.type & ixgb_fc_tx_pause) ) -printk (KERN_INFO -"Ignoring RxFCLowThresh when no RxFC\n" ); +pr_info ("Ignoring RxFCLowThresh when no RxFC\n" ); } {/* Flow Control Pause Time Request*/ const struct ixgb_option opt = {
@@ -404,17 +402,14 @@ ixgb_check_options(struct ixgb_adapter *adapter) adapter->hw.fc.pause_time = opt.def; }if (!(adapter->hw.fc.type & ixgb_fc_tx_pause) ) -printk (KERN_INFO -"Ignoring FCReqTimeout when no RxFC\n" ); +pr_info ("Ignoring FCReqTimeout when no RxFC\n" ); }/* high low and spacing check for rx flow control thresholds */ if (adapter->hw.fc.type & ixgb_fc_tx_pause) {/* high must be greater than low */ if (adapter->hw.fc.high_water < (adapter->hw.fc.low_water +8 )) {/* set defaults */ -printk (KERN_INFO -"RxFCHighThresh must be >= (RxFCLowThresh + 8), " -"Using Defaults\n" ); +pr_info ("RxFCHighThresh must be >= (RxFCLowThresh + 8), Using Defaults\n" ); adapter->hw.fc.high_water =DEFAULT_FCRTH ; adapter->hw.fc.low_water =DEFAULT_FCRTL ; }
From: Jeff Kirsher <[email protected]>
Date: Tue, 27 Apr 2010 03:50:58 -0700
Quoted 10 lines
From: Joe Perches <[email protected]>
Convert DEBUGOUTx to
pr_debug
Convert DEBUGFUNC to more commonly used ENTER
Convert mac address output to %pM
Use #definepr_fmt
Convert a few printks to pr_<level>
Improveixgb_mc_addr_list_update: use a temporary for current mc address Useetherdevice.hfunctions for mac address testing
Quoted 2 lines
Signed-off-by Joe Perches <[email protected]>Signed-off-by Jeff Kirsher <[email protected]>
Applied.