From patchwork Mon Oct 12 11:19:47 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 7374181 Return-Path: X-Original-To: patchwork-platform-driver-x86@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 4DB399F1D5 for ; Mon, 12 Oct 2015 11:22:19 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8808E2072B for ; Mon, 12 Oct 2015 11:22:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id ACB9C207C0 for ; Mon, 12 Oct 2015 11:22:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752001AbbJLLVZ (ORCPT ); Mon, 12 Oct 2015 07:21:25 -0400 Received: from mga01.intel.com ([192.55.52.88]:20012 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751308AbbJLLTw (ORCPT ); Mon, 12 Oct 2015 07:19:52 -0400 Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga101.fm.intel.com with ESMTP; 12 Oct 2015 04:19:51 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.17,672,1437462000"; d="scan'208";a="824657681" Received: from black.fi.intel.com ([10.237.72.93]) by orsmga002.jf.intel.com with ESMTP; 12 Oct 2015 04:19:50 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 4327532F; Mon, 12 Oct 2015 14:19:49 +0300 (EEST) From: Andy Shevchenko To: platform-driver-x86@vger.kernel.org, Darren Hart , linux-kernel@vger.kernel.org Cc: Andy Shevchenko Subject: [PATCH v2 4/5] intel_scu_ipc: switch to use module_pci_driver() macro Date: Mon, 12 Oct 2015 14:19:47 +0300 Message-Id: <1444648788-74265-5-git-send-email-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.5.3 In-Reply-To: <1444648788-74265-1-git-send-email-andriy.shevchenko@linux.intel.com> References: <1444648788-74265-1-git-send-email-andriy.shevchenko@linux.intel.com> Sender: platform-driver-x86-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: platform-driver-x86@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Eliminate some boilerplate code by using module_pci_driver() instead of init/exit, moving the salient bits from init into probe. Signed-off-by: Andy Shevchenko --- drivers/platform/x86/intel_scu_ipc.c | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/drivers/platform/x86/intel_scu_ipc.c b/drivers/platform/x86/intel_scu_ipc.c index 5087485..9de2029 100644 --- a/drivers/platform/x86/intel_scu_ipc.c +++ b/drivers/platform/x86/intel_scu_ipc.c @@ -567,10 +567,15 @@ static irqreturn_t ioc(int irq, void *dev_id) */ static int ipc_probe(struct pci_dev *pdev, const struct pci_device_id *id) { + int platform; /* Platform type */ int err; struct intel_scu_ipc_dev *scu = &ipcdev; struct intel_scu_ipc_pdata_t *pdata; + platform = intel_mid_identify_cpu(); + if (platform == 0) + return -ENODEV; + if (scu->dev) /* We support only one SCU */ return -EBUSY; @@ -651,24 +656,8 @@ static struct pci_driver ipc_driver = { .remove = ipc_remove, }; -static int __init intel_scu_ipc_init(void) -{ - int platform; /* Platform type */ - - platform = intel_mid_identify_cpu(); - if (platform == 0) - return -ENODEV; - return pci_register_driver(&ipc_driver); -} - -static void __exit intel_scu_ipc_exit(void) -{ - pci_unregister_driver(&ipc_driver); -} +module_pci_driver(ipc_driver); MODULE_AUTHOR("Sreedhara DS "); MODULE_DESCRIPTION("Intel SCU IPC driver"); MODULE_LICENSE("GPL"); - -module_init(intel_scu_ipc_init); -module_exit(intel_scu_ipc_exit);