cleanup for Realtek 8139CP
Subsystems (2)
v3 cover cleanup for Realtek 8139CP
From: Varka Bhadram <[email protected]>
changes since v2:
- making version info print once.
changes sice v1:
- remove unused varible warning
Varka Bhadram (2):
ethernet: realtek: use module_pci_driver
ethernet: realtek: use pci_device_id
drivers/net/ethernet/realtek/8139cp.c | 36 +++++++++------------------------ 1 file changed, 9 insertions(+), 27 deletions(-)
Signature · 1 line
1.7.9.5
PATCH v3 1/2 ethernet: realtek: use module_pci_driver
From: Varka Bhadram <[email protected]>
This patch converts to use the macro module_pci_driver, which makes the code smaller and simpler.
Previously in this driver we are having driver version info will be printed log buffer based on whether the driver selected as module or statically into image itself. By using the module_pci_driver that part of the code removed. For the first time of the device init, we are making the version info to be printed once.
--- drivers/net/ethernet/realtek/8139cp.c | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-)
drivers/net/ethernet/realtek/8139cp.c +2 -20
@@ -1887,11 +1887,7 @@ static int cp_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)resource_size_t pciaddr;unsigned int addr_len, i, pci_using_dac; -#ifndef MODULE -static int version_printed; -if (version_printed++ ==0 ) -pr_info ("%s" , version); -#endif +pr_info_once ("%s" , version);if (pdev->vendor ==PCI_VENDOR_ID_REALTEK && pdev->device ==PCI_DEVICE_ID_REALTEK_8139 && pdev->revision <0x20 ) {
@@ -2121,18 +2117,4 @@ static struct pci_driver cp_driver = {#endif }; -static int __init cp_init (void ) -{ -#ifdef MODULE -pr_info ("%s" , version); -#endif -return pci_register_driver (&cp_driver); -} - -static void __exit cp_exit (void) -{ -pci_unregister_driver (&cp_driver); -} - -module_init (cp_init); -module_exit (cp_exit); +module_pci_driver (cp_driver);
Signature · 1 line
1.7.9.5
PATCH v3 2/2 ethernet: realtek: use pci_device_id
In reply to [email protected]From: Varka Bhadram <[email protected]>
This patch use the struct pci_device_id instead of using macro DEFINE_PCI_DEVICE_TABLE which is deprecated and should not be used. And also moves these ids after probe and remove functionalities.
--- drivers/net/ethernet/realtek/8139cp.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/net/ethernet/realtek/8139cp.c +7 -7
@@ -382,13 +382,6 @@ static int cp_get_eeprom(struct net_device *dev,static int cp_set_eeprom (struct net_device *dev,struct ethtool_eeprom *eeprom,u8 *data); -static DEFINE_PCI_DEVICE_TABLE (cp_pci_tbl) = { - {PCI_DEVICE (PCI_VENDOR_ID_REALTEK ,PCI_DEVICE_ID_REALTEK_8139 ), }, - {PCI_DEVICE (PCI_VENDOR_ID_TTTECH ,PCI_DEVICE_ID_TTTECH_MC322 ), }, - { }, -}; -MODULE_DEVICE_TABLE (pci, cp_pci_tbl); -static struct {const char str[ETH_GSTRING_LEN ]; } ethtool_stats_keys[] = {
@@ -2106,6 +2099,13 @@ static int cp_resume (struct pci_dev *pdev) }#endif /* CONFIG_PM */ +static const struct pci_device_id cp_pci_tbl[] = { + {PCI_DEVICE (PCI_VENDOR_ID_REALTEK ,PCI_DEVICE_ID_REALTEK_8139 ), }, + {PCI_DEVICE (PCI_VENDOR_ID_TTTECH ,PCI_DEVICE_ID_TTTECH_MC322 ), }, + { }, +}; +MODULE_DEVICE_TABLE (pci, cp_pci_tbl); +static struct pci_driver cp_driver = { .name =DRV_NAME , .id_table = cp_pci_tbl,
Signature · 1 line
1.7.9.5
David Miller
maintainerFrom: [email protected]
Date: Wed, 23 Jul 2014 09:19:47 +0530
Quoted 6 lines
From: Varka Bhadram <[email protected]>
changes since v2:
- making version info print once.
changes sice v1:
- remove unused varible warning
Series applied, thanks.