Skip to contentSkip to conversation

cleanup for realtek 8139CP

PATCH Superseded [email protected] 2 participants 5 messages Jul 22, 2014

Subsystems (2)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

cover cleanup for realtek 8139CP

From: Varka Bhadram <[email protected]>

Varka Bhadram (2):
ethernet: realtek: use module_pci_driver
ethernet: realtek: use pci_device_id

 drivers/net/ethernet/realtek/8139cp.c |   30 ++++++++----------------------
 1 file changed, 8 insertions(+), 22 deletions(-)
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 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.

---
 drivers/net/ethernet/realtek/8139cp.c |   16 +---------------
 1 file changed, 1 insertion(+), 15 deletions(-)
drivers/net/ethernet/realtek/8139cp.c +1 -15
index 2bc728e..9025fba 100644
@@ -2121,18 +2121,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
#2 lore raw

PATCH 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
index 9025fba..a2a2ac6 100644
@@ -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[] = {
@@ -2110,6 +2103,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
maintainer
#4 lore raw

From: David Miller <[email protected]>
Date: Mon, 21 Jul 2014 23:56:44 -0700 (PDT)

Quoted 8 lines

From: [email protected]
Date: Tue, 22 Jul 2014 11:28:46 +0530

Quoted 3 lines

Varka Bhadram (2):
ethernet: realtek: use module_pci_driver
ethernet: realtek: use pci_device_id

Both applied, thanks.

Actually, reverted, test your changes:

drivers/net/ethernet/realtek/8139cp.c:82:13: warning: ‘version’ defined but not used [-Wunused-variable]