Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp757669pxj; Wed, 16 Jun 2021 12:54:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxDwNrn9pQOvTlEK5Li6Up+Nsn1vI2XsxxCUmRPYv5m+/gm0Ooi/9X8sHCqCHf4grISeWIW X-Received: by 2002:a5e:930e:: with SMTP id k14mr837281iom.136.1623873275164; Wed, 16 Jun 2021 12:54:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623873275; cv=none; d=google.com; s=arc-20160816; b=zSLxdLj27r2iupop3f6S3NBLbkMCkW1sXknw8qxI1pnpYTb4b7MAXDbADIAj8LBLg/ eSSVhLrEVUQBIrzi6TIXDXMHfvZDuK0FX5lXqnZYfJEd2amJEQs22HZOh+/qyU/DhECC cQG0khfTDyM20gJ6uln4swtsrpKs0mWeumllcLX5/2r8aBy84O2AWZhcD4us7045p4ir Hwy1mmEB2jaSp2tB0+3FPHS4uftJhl/5fgv2ffIWTGRz75/ydph4EzLbC689k4UuYMnr AzTjXoS6DOx97e1Ee0MTOyb/31QiubTzeCdtF/KdDHia3ybTTtrXaKaWfsG6iD2zhkY8 Df6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:ironport-sdr:ironport-sdr; bh=Sn5CyOqR/XmRIeE0U9kmCP5kfZIS1FWhtP4SnQo/2SE=; b=Q9Zto6rYXgW3TdEbezMbnm3Zz8BwFirCMJ9XMclQHCUDwNZva0UaHJOcnsv+emZZ9L tlDrbDKPN+2dQT9WB9Cd2K/OmznbcfYLAdJg8RLFmRxOz/91pMS9WSvGKVgVW8wUSr6i aBkWdSIbAxq7s1H/Lbjlxs6Szk74IfJBZYowRmQPL79Wt34tcAs6YBRYJrpjmnUkTxpN vSFtvYBxutN5a6FOMn8AcMUJ3P+VFFTyceMM35wtEnOHnccQQVfGG37s/OFeBYoxgqtm fYqTT9er6FjAWF4QLqtCY2jnqdYlKBWDymWJfgbXKet4UzZ7ZkWFDOIGS9BgzH/FViin 7ogQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g12si3357298ilf.112.2021.06.16.12.54.22; Wed, 16 Jun 2021 12:54:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233782AbhFPOI3 (ORCPT + 99 others); Wed, 16 Jun 2021 10:08:29 -0400 Received: from mga02.intel.com ([134.134.136.20]:63903 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233420AbhFPOI1 (ORCPT ); Wed, 16 Jun 2021 10:08:27 -0400 IronPort-SDR: GczPlc79uu6ssbfv71Kai5W36lxtYtOQ9LBD11Jxm9qftNo5EsXE5jNpTVmeG9z3tFrZcI+wiu 0r2Cvo7ljqQQ== X-IronPort-AV: E=McAfee;i="6200,9189,10016"; a="193302315" X-IronPort-AV: E=Sophos;i="5.83,278,1616482800"; d="scan'208";a="193302315" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jun 2021 07:06:20 -0700 IronPort-SDR: rhkRQCYvGclBnd+hF191KeKexMCIvZIEqGUBRbNM0royz7cMw/B0MzC6w7/QVj39W8s7NCq2tx 8OKg216xfSVg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,278,1616482800"; d="scan'208";a="554816631" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 16 Jun 2021 07:06:19 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id E9E2E2AA; Wed, 16 Jun 2021 17:06:43 +0300 (EEST) From: Andy Shevchenko To: Andy Shevchenko , linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Jean Delvare Subject: [PATCH v1 1/1] i2c: parport: Switch to use module_parport_driver() Date: Wed, 16 Jun 2021 17:04:41 +0300 Message-Id: <20210616140441.39479-1-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Switch to use module_parport_driver() to reduce boilerplate code. Signed-off-by: Andy Shevchenko --- drivers/i2c/busses/i2c-parport.c | 36 ++++++++++---------------------- 1 file changed, 11 insertions(+), 25 deletions(-) diff --git a/drivers/i2c/busses/i2c-parport.c b/drivers/i2c/busses/i2c-parport.c index a535889acca6..ccbbc9306e88 100644 --- a/drivers/i2c/busses/i2c-parport.c +++ b/drivers/i2c/busses/i2c-parport.c @@ -267,6 +267,16 @@ static void i2c_parport_attach(struct parport *port) int i; struct pardev_cb i2c_parport_cb; + if (type < 0) { + pr_warn("adapter type unspecified\n"); + return -ENODEV; + } + + if (type >= ARRAY_SIZE(adapter_parm)) { + pr_warn("invalid type (%d)\n", type); + return -ENODEV; + } + for (i = 0; i < MAX_DEVICE; i++) { if (parport[i] == -1) continue; @@ -392,32 +402,8 @@ static struct parport_driver i2c_parport_driver = { .detach = i2c_parport_detach, .devmodel = true, }; - -/* ----- Module loading, unloading and information ------------------------ */ - -static int __init i2c_parport_init(void) -{ - if (type < 0) { - pr_warn("adapter type unspecified\n"); - return -ENODEV; - } - - if (type >= ARRAY_SIZE(adapter_parm)) { - pr_warn("invalid type (%d)\n", type); - return -ENODEV; - } - - return parport_register_driver(&i2c_parport_driver); -} - -static void __exit i2c_parport_exit(void) -{ - parport_unregister_driver(&i2c_parport_driver); -} +module_parport_driver(i2c_parport_driver); MODULE_AUTHOR("Jean Delvare "); MODULE_DESCRIPTION("I2C bus over parallel port"); MODULE_LICENSE("GPL"); - -module_init(i2c_parport_init); -module_exit(i2c_parport_exit); -- 2.30.2