enc28j60: Switch to use module_spi_driver() macro
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Tue, 19 Mar 2019 18:49:22 +0000 (20:49 +0200)
committerDavid S. Miller <davem@davemloft.net>
Tue, 19 Mar 2019 21:59:31 +0000 (14:59 -0700)
Eliminate some boilerplate code by using module_spi_driver() instead of
->init() / ->exit(), moving the salient bits from ->init() into ->probe().

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/microchip/enc28j60.c

index 2e323f330ecbbf9b204d83a1064eb8bbaedf7a46..4cf4525260b710d2f05cf2022b4cd2714e96b433 100644 (file)
@@ -417,11 +417,9 @@ enc28j60_packet_write(struct enc28j60_net *priv, int len, const u8 *data)
        mutex_unlock(&priv->lock);
 }
 
-static unsigned long msec20_to_jiffies;
-
 static int poll_ready(struct enc28j60_net *priv, u8 reg, u8 mask, u8 val)
 {
-       unsigned long timeout = jiffies + msec20_to_jiffies;
+       unsigned long timeout = jiffies + msecs_to_jiffies(20);
 
        /* 20 msec timeout read */
        while ((nolock_regb_read(priv, reg) & mask) != val) {
@@ -1632,22 +1630,7 @@ static struct spi_driver enc28j60_driver = {
        .probe = enc28j60_probe,
        .remove = enc28j60_remove,
 };
-
-static int __init enc28j60_init(void)
-{
-       msec20_to_jiffies = msecs_to_jiffies(20);
-
-       return spi_register_driver(&enc28j60_driver);
-}
-
-module_init(enc28j60_init);
-
-static void __exit enc28j60_exit(void)
-{
-       spi_unregister_driver(&enc28j60_driver);
-}
-
-module_exit(enc28j60_exit);
+module_spi_driver(enc28j60_driver);
 
 MODULE_DESCRIPTION(DRV_NAME " ethernet driver");
 MODULE_AUTHOR("Claudio Lanconelli <lanconelli.claudio@eptar.com>");