Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp3008160pxv; Mon, 12 Jul 2021 07:13:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz3ZVcghP6IiroY/hqnFWiyyVI1+w4f4mECGz0TGkdgQQ3vuK+bFmE5AYbCkK7DzPYvwVhJ X-Received: by 2002:a05:6638:1494:: with SMTP id j20mr598020jak.144.1626099181316; Mon, 12 Jul 2021 07:13:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626099181; cv=none; d=google.com; s=arc-20160816; b=sFBqidiwMI72sq0RsFdN1ixzgDFGnHb0rIUDVUQiARKK2GEHBI3cB9Cv363Dgxc9JC AGTJj6IvovdSevb34sJju/EY1qZbr6ePFtIRCIoSvr/fF8fECasQJsZiJ8m3sDI+fcjs vh1Bpuk9INcSEhDHslgCWh3RRe9PygKO58FesZhvNnHRgrfdfehKfRJgf4Hn+K1nVPkQ N9uQDR3w3+KAY93FkZ50BF77pHFvIjmAi4RrcbPQUKI8rJz0SS+RF7HUzJr9xI7WOB24 utHU8o8VPWJDhL3Q+AoK0nGFO0Tk427UiuVQVChjHRixnZBFKhNfUFhL6PJ4Nsef+nCc mlxw== 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; bh=LIYpFVPsyJwWKseay94ne523V7Ib3jGULQOHrNd71JY=; b=kGd4IQuOM5V+h1Ixl+QTAH3VYPokSDgMUMB5P/1AyR07tEW2f6S6Vg5ccBjQ3kxuS7 7ttdO8yyPtGoU+1yURDdM2hfJ14/oFL/XwRS3LfRl+5q0zl3OWtQvNx2tsvZXGDaZO+A i4vRbSm3r7sOY+8NUdEGMaRayrFv7/Vlh92MDSEmv31n9z5HFxZQTU4F0JEYZpbkZyy7 3LS330WuVgDsl+Z8rjhyyeDxyhEH5g4gIkX1jQU8QuZRLXHSfAC03Nfm87l3J6msosHG ddYPBJxCRvijOnsgy37exe7E5+g0fURdnox2/kXTUcCbKD97LMkymwsIu0Osv+5Gx+5D 83eA== 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 o11si11352656ilg.108.2021.07.12.07.12.48; Mon, 12 Jul 2021 07:13:01 -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 S233683AbhGLONr (ORCPT + 99 others); Mon, 12 Jul 2021 10:13:47 -0400 Received: from mga09.intel.com ([134.134.136.24]:19690 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231510AbhGLONn (ORCPT ); Mon, 12 Jul 2021 10:13:43 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10042"; a="209961572" X-IronPort-AV: E=Sophos;i="5.84,234,1620716400"; d="scan'208";a="209961572" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jul 2021 07:10:55 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.84,234,1620716400"; d="scan'208";a="459191111" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga008.jf.intel.com with ESMTP; 12 Jul 2021 07:10:53 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id CA9BFFF; Mon, 12 Jul 2021 17:11:20 +0300 (EEST) From: Andy Shevchenko To: Andy Shevchenko , linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Jean Delvare Subject: [PATCH v2 1/1] i2c: parport: Switch to use module_parport_driver() Date: Mon, 12 Jul 2021 17:11:19 +0300 Message-Id: <20210712141119.22426-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 --- v2: fixed compilation error (Jean, LKP) 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..231145c48728 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; + } + + if (type >= ARRAY_SIZE(adapter_parm)) { + pr_warn("invalid type (%d)\n", type); + return; + } + 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