Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp728433pxj; Wed, 16 Jun 2021 12:09:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyFQrilCrjVO0UWt41+FAO/3JPL2Ng0IB5L1gUInS6j21oIRKo6DvdZu8pWRQVw+wO+ef1l X-Received: by 2002:a17:907:3f08:: with SMTP id hq8mr1084013ejc.150.1623870591212; Wed, 16 Jun 2021 12:09:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623870591; cv=none; d=google.com; s=arc-20160816; b=zFXpK5yNjV/YRyH4R4Uvo71NKh1X1CZePGwHeQoU6PnC4k/R3vksOVxtVUpkQu1ubL NKZJTOXhFE5ocVZoF1SKFB0ZhX1KZwLYh/xfWxRxe59WakGdYyQ/Ellkyfc/GqR1WGqm mPHZr5rqD+/+BBmmBp8wt+Xe01VyUqMKfEm0o2SiHpQJ20/UOy1BbUaqVZ723o8+7KlT eiJNuUhrQK9GQI0ra4JIqvYWNcSaoR5FNOzqAOLQCo+QPl10Yz1NKZipqQbDUoyT3mWt 4f/69qkFtB5CYYNDR5JtxWoxpohlul2/vQX/CDLVAw0iyu1zf85H8rW7DckwLc1sN4iG 6FWQ== 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=W9iIV3fRWcuhnDQHavTChUG8tN9zEP8tigghvmdojt0=; b=PjbduBHRavadfu7JNE7YbkzLqqINP8g4qkhZbOeMtfeZcoAL67ff2zPrTYTgLqZJo5 wr0xbq/M+zzM92T1a+bzGop46jPSwzatpbyfC1AEHUM46t5SbyMF78uQRo19fcyyIqNd PD0aYf9UNFaxugPk2CLAClMfgbRP4q4BntNZX3dEwBKJ9KBc3m2MHm9VGgOT0GYKo8rq HI2mK5OkD6/dwh78r0izWfTfuwmCEZvZO8TS+6CLs/hobjB8d/8doIvWWGwr911QF/qk s11GPJwf7t3uR33r+q4G+Xo1wCu7/3Poius+2CW1MoDu6fQEOj+0Vo1XtVmTdHY+sUWE vzpw== 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 h7si2666104edt.10.2021.06.16.12.09.28; Wed, 16 Jun 2021 12:09:51 -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 S233720AbhFPOdI (ORCPT + 99 others); Wed, 16 Jun 2021 10:33:08 -0400 Received: from mga04.intel.com ([192.55.52.120]:9731 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233208AbhFPOdH (ORCPT ); Wed, 16 Jun 2021 10:33:07 -0400 IronPort-SDR: ERHjl+zN6PoI5/q3zIl16UX2GwmHmzVUTk3RcFOw5cMJTFIsrvfiCWhWvr54sbWyQP41uNZ+8B MhJ0FjZ2MJng== X-IronPort-AV: E=McAfee;i="6200,9189,10016"; a="204356436" X-IronPort-AV: E=Sophos;i="5.83,278,1616482800"; d="scan'208";a="204356436" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jun 2021 07:31:01 -0700 IronPort-SDR: 7ZyKCQaT1jdkElj93gSvPXBJ9/SpjQUlX35ATgnKLrRiyhMdNvuoCfP9/4Slv+D0nL/7Im2xRz BRwiWdpF3/VA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,278,1616482800"; d="scan'208";a="442896117" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga007.jf.intel.com with ESMTP; 16 Jun 2021 07:31:00 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 733122AA; Wed, 16 Jun 2021 17:31:24 +0300 (EEST) From: Andy Shevchenko To: Andy Shevchenko , linux-kernel@vger.kernel.org Cc: Rodolfo Giometti , Greg Kroah-Hartman Subject: [PATCH v1 1/1] pps: generators: pps_gen_parport: Switch to use module_parport_driver() Date: Wed, 16 Jun 2021 17:31:21 +0300 Message-Id: <20210616143121.46059-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/pps/generators/pps_gen_parport.c | 44 +++++------------------- 1 file changed, 9 insertions(+), 35 deletions(-) diff --git a/drivers/pps/generators/pps_gen_parport.c b/drivers/pps/generators/pps_gen_parport.c index 6a1af7664f3b..565f99782402 100644 --- a/drivers/pps/generators/pps_gen_parport.c +++ b/drivers/pps/generators/pps_gen_parport.c @@ -20,8 +20,6 @@ #include #include -#define DRVDESC "parallel port PPS signal generator" - #define SIGNAL 0 #define NO_SIGNAL PARPORT_CONTROL_STROBE @@ -180,6 +178,11 @@ static void parport_attach(struct parport *port) { struct pardev_cb pps_cb; + if (send_delay > SEND_DELAY_MAX) { + pr_err("delay value should be not greater then %d\n", SEND_DELAY_MAX); + return -EINVAL; + } + if (attached) { /* we already have a port */ return; @@ -223,6 +226,8 @@ static void parport_detach(struct parport *port) hrtimer_cancel(&device.timer); parport_release(device.pardev); parport_unregister_device(device.pardev); + + pr_info("hrtimer avg error is %ldns\n", hrtimer_error); } static struct parport_driver pps_gen_parport_driver = { @@ -231,39 +236,8 @@ static struct parport_driver pps_gen_parport_driver = { .detach = parport_detach, .devmodel = true, }; - -/* module staff */ - -static int __init pps_gen_parport_init(void) -{ - int ret; - - pr_info(DRVDESC "\n"); - - if (send_delay > SEND_DELAY_MAX) { - pr_err("delay value should be not greater" - " then %d\n", SEND_DELAY_MAX); - return -EINVAL; - } - - ret = parport_register_driver(&pps_gen_parport_driver); - if (ret) { - pr_err("unable to register with parport\n"); - return ret; - } - - return 0; -} - -static void __exit pps_gen_parport_exit(void) -{ - parport_unregister_driver(&pps_gen_parport_driver); - pr_info("hrtimer avg error is %ldns\n", hrtimer_error); -} - -module_init(pps_gen_parport_init); -module_exit(pps_gen_parport_exit); +module_parport_driver(pps_gen_parport_driver); MODULE_AUTHOR("Alexander Gordeev "); -MODULE_DESCRIPTION(DRVDESC); +MODULE_DESCRIPTION("parallel port PPS signal generator"); MODULE_LICENSE("GPL"); -- 2.30.2