From patchwork Wed Jul 23 03:49:48 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Varka Bhadram X-Patchwork-Id: 372800 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id A98C6140187 for ; Wed, 23 Jul 2014 13:52:11 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756698AbaGWDvW (ORCPT ); Tue, 22 Jul 2014 23:51:22 -0400 Received: from mail-pa0-f50.google.com ([209.85.220.50]:45566 "EHLO mail-pa0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753791AbaGWDvV (ORCPT ); Tue, 22 Jul 2014 23:51:21 -0400 Received: by mail-pa0-f50.google.com with SMTP id et14so844893pad.37 for ; Tue, 22 Jul 2014 20:51:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=svn65EqK4nj9YCfd/KIzvUXvMtR5IMPCBP2dO4XMR/Q=; b=wv6wS6ak2zfnBR3Ns67CNmedXcyvzqtJOYxbWK3vRxo2+IAsQDjYr552tRVWL3wOtQ zQ28winUhuYrDPpUc/bkJ8asmhY3CXmwJTyf2lrjftQDSq31Hsp2PM84Im0bnA+N2XoO 1iI1HwWdp0CvKSWKf3r/hCbZgoWk0nuqg+YSI77Un2I0cmHumPCUZBINySHtw0mJHeQO RCKmBtpXoy7ghYntfa5qZPufhlzg/cQQ6rcU28GM/biRp9p6/7Lm7D6sv2RtQyLfu9PT H9gpAoHKcoQsnByy3jt3TEVqzk2AmJQl1E+tuarawdO0t1PE4xwqJ2dZKCxTSOpsnTa3 zxxQ== X-Received: by 10.69.26.68 with SMTP id iw4mr17109643pbd.137.1406087480749; Tue, 22 Jul 2014 20:51:20 -0700 (PDT) Received: from cdac.hyderabad.cdac.in ([196.12.45.164]) by mx.google.com with ESMTPSA id q6sm1149090pdp.5.2014.07.22.20.51.17 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 22 Jul 2014 20:51:20 -0700 (PDT) From: varkabhadram@gmail.com To: netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org, davem@davemloft.net, Varka Bhadram Subject: [PATCH net-next v3 1/2] ethernet: realtek: use module_pci_driver Date: Wed, 23 Jul 2014 09:19:48 +0530 Message-Id: <1406087389-4436-2-git-send-email-varkabhadram@gmail.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1406087389-4436-1-git-send-email-varkabhadram@gmail.com> References: <1406087389-4436-1-git-send-email-varkabhadram@gmail.com> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Varka Bhadram 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 --- drivers/net/ethernet/realtek/8139cp.c | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/drivers/net/ethernet/realtek/8139cp.c b/drivers/net/ethernet/realtek/8139cp.c index 2bc728e..be101ca 100644 --- a/drivers/net/ethernet/realtek/8139cp.c +++ b/drivers/net/ethernet/realtek/8139cp.c @@ -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);