From patchwork Sun May 1 22:44:11 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: William Breathitt Gray X-Patchwork-Id: 617296 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3qyjD51KGSz9t5C for ; Mon, 2 May 2016 08:44:21 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=BgF0W/d6; dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752446AbcEAWoU (ORCPT ); Sun, 1 May 2016 18:44:20 -0400 Received: from mail-yw0-f171.google.com ([209.85.161.171]:34646 "EHLO mail-yw0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752323AbcEAWoT (ORCPT ); Sun, 1 May 2016 18:44:19 -0400 Received: by mail-yw0-f171.google.com with SMTP id j74so221917593ywg.1; Sun, 01 May 2016 15:44:19 -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=uGrX2t8GPcpA0k7UPR0ipnrTpvZyBoce9Vr3h3w7D+g=; b=BgF0W/d6sBeGxGOxk3C2+hoVqR37RwYBEK0oBy+R41+u0eUqnsdJVA+Q/6klPT6tWl wix30WNeDuZCsOt8OsQX56qmUaD2oznha6ZxM8jkFfpdL93UVFJdz0L08Cv9IeP57gyk bSrOt/ASxUJSMPp1Xk8KRUgMhFC9egXD1tFwUnJCbwJLO6qQRCJPxXuuRVjz62avsIhL q2KTpJLGUnRX5i27+sJGBE9zJ4pamMQfbO3uQQ4T1R7Gru2Tzmsj9bo/3zfTYeYcMCtB nRWeLGp57FpgGoNWxVacKSv5enwJuPUmJwMzSut+zEHf6Z3p9vFZ6TM22zhgoHIdWj/5 Fwug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=uGrX2t8GPcpA0k7UPR0ipnrTpvZyBoce9Vr3h3w7D+g=; b=TNNQofpgZ2+CVAq5P28DjmjptP0KyFXJ2NoDpR1T9bOhbLuvrfVbQKUGuQRYdRd0v5 A3bYVfcyRxC7oAxGqpJS9YlrnbZQCz03RwXIZgl8XhpRivtIak+fWG5CabTEBl4WSbnh Hdbwh4o6pf3jqGcYa+SlSp+rN8HD/fqlxp/Niy7PRuU3DdXUnDjEpmgZj/fZhjNeK6Bj cW5VSWBlfyWCYTAl5gHN95VU0HMks2y4Xq79iLAuGVGC0KMplYA45qVHcH2ew+PsD5Lp kuMFEHlz5gAzdDX0YmZKSykLz4rWjKc2LLSMgJoGykruwXcVdI3EQQQEC/wIiyC/rrFx Ggrw== X-Gm-Message-State: AOPr4FVp8R9akpuFoBvq5ZA69ellLYM5OfOX9Fja9v9x3Zo9/0ZqClacMSk48omtkfQ5nw== X-Received: by 10.13.232.134 with SMTP id r128mr17605171ywe.163.1462142658563; Sun, 01 May 2016 15:44:18 -0700 (PDT) Received: from localhost (71-47-58-73.res.bhn.net. [71.47.58.73]) by smtp.gmail.com with ESMTPSA id k80sm13783865ywe.31.2016.05.01.15.44.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 01 May 2016 15:44:18 -0700 (PDT) From: William Breathitt Gray To: gregkh@linuxfoundation.org Cc: linux-iio@vger.kernel.org, linux-watchdog@vger.kernel.org, linux-gpio@vger.kernel.org, William Breathitt Gray , Jonathan Cameron , Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald Subject: [PATCH v2 05/10] iio: stx104: Utilize the module_isa_driver and max_num_isa_dev macros Date: Sun, 1 May 2016 18:44:11 -0400 Message-Id: X-Mailer: git-send-email 2.7.3 In-Reply-To: References: Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org The Apex Embedded Systems STX104 DAC drivers does not do anything special in module init/exit. This patch eliminates the module init/exit boilerplate code by utilizing the module_isa_driver macro. Additionally, the max_num_isa_dev macro is utilized to simplify the determination of maximum possible STX104 devices in the system. Cc: Jonathan Cameron Cc: Hartmut Knaack Cc: Lars-Peter Clausen Cc: Peter Meerwald Signed-off-by: William Breathitt Gray --- drivers/iio/dac/stx104.c | 24 +++--------------------- 1 file changed, 3 insertions(+), 21 deletions(-) diff --git a/drivers/iio/dac/stx104.c b/drivers/iio/dac/stx104.c index 174f4b7..2794122 100644 --- a/drivers/iio/dac/stx104.c +++ b/drivers/iio/dac/stx104.c @@ -33,16 +33,9 @@ } #define STX104_EXTENT 16 -/** - * The highest base address possible for an ISA device is 0x3FF; this results in - * 1024 possible base addresses. Dividing the number of possible base addresses - * by the address extent taken by each device results in the maximum number of - * devices on a system. - */ -#define MAX_NUM_STX104 (1024 / STX104_EXTENT) -static unsigned base[MAX_NUM_STX104]; -static unsigned num_stx104; +static unsigned int base[max_num_isa_dev(STX104_EXTENT)]; +static unsigned int num_stx104; module_param_array(base, uint, &num_stx104, 0); MODULE_PARM_DESC(base, "Apex Embedded Systems STX104 base addresses"); @@ -134,18 +127,7 @@ static struct isa_driver stx104_driver = { } }; -static void __exit stx104_exit(void) -{ - isa_unregister_driver(&stx104_driver); -} - -static int __init stx104_init(void) -{ - return isa_register_driver(&stx104_driver, num_stx104); -} - -module_init(stx104_init); -module_exit(stx104_exit); +module_isa_driver(stx104_driver, num_stx104); MODULE_AUTHOR("William Breathitt Gray "); MODULE_DESCRIPTION("Apex Embedded Systems STX104 DAC driver");