Skip to content

Commit 5490c27

Browse files
bhadramdavem330
authored andcommitted
ethernet: realtek: use module_pci_driver
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. Signed-off-by: Varka Bhadram <varkab@cdac.in> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 274f482 commit 5490c27

1 file changed

Lines changed: 2 additions & 20 deletions

File tree

‎drivers/net/ethernet/realtek/8139cp.c‎

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1887,11 +1887,7 @@ static int cp_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
18871887
resource_size_t pciaddr;
18881888
unsigned int addr_len, i, pci_using_dac;
18891889

1890-
#ifndef MODULE
1891-
static int version_printed;
1892-
if (version_printed++ == 0)
1893-
pr_info("%s", version);
1894-
#endif
1890+
pr_info_once("%s", version);
18951891

18961892
if (pdev->vendor == PCI_VENDOR_ID_REALTEK &&
18971893
pdev->device == PCI_DEVICE_ID_REALTEK_8139 && pdev->revision < 0x20) {
@@ -2121,18 +2117,4 @@ static struct pci_driver cp_driver = {
21212117
#endif
21222118
};
21232119

2124-
static int __init cp_init (void)
2125-
{
2126-
#ifdef MODULE
2127-
pr_info("%s", version);
2128-
#endif
2129-
return pci_register_driver(&cp_driver);
2130-
}
2131-
2132-
static void __exit cp_exit (void)
2133-
{
2134-
pci_unregister_driver (&cp_driver);
2135-
}
2136-
2137-
module_init(cp_init);
2138-
module_exit(cp_exit);
2120+
module_pci_driver(cp_driver);

0 commit comments

Comments
 (0)