From patchwork Wed Sep 13 11:20:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Abbott X-Patchwork-Id: 138782 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9ecd:0:b0:3f2:4152:657d with SMTP id t13csp1054931vqx; Wed, 13 Sep 2023 05:40:15 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGDu70kbJbENZWm02CVpjlCjx3+vexx+3OVcfsXXI+np8I8hKMCaNLW/0SpMZbkWj5yyYbA X-Received: by 2002:a17:902:9302:b0:1c3:4b24:d89d with SMTP id bc2-20020a170902930200b001c34b24d89dmr2362281plb.40.1694608815003; Wed, 13 Sep 2023 05:40:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694608814; cv=none; d=google.com; s=arc-20160816; b=xE/3qtBm57yFYfQCUKUCVD4/lLbFBnvd1Df1Rj6mpMLwf7lZxnpMUxr6TsaQ4+dtwc OE8toX2u3bQ6JpvAPRwtAAKozKT9hGy7tUHygv+oMpORkaKK7PBDUrh4fwW1B082iAuz mkJG/dWjqMfDmCEHMji/9GTZcfKsyubKIkEA0XIHWxGeaCIAJxuWBlqtki5X7cKE47J6 Mjwt48Qesqes/jKH+rHITdPMDuah0OSXfzwTh2ZM4aFNvPSDfWrXdCllsnQAOgD7cO8x lKSxVhbEJduuFASblfjFiLmjO206ifkG7dGO6z2ga2qwkE2JSSsxbKMzVPOAJy/z9yct KMXA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=CTPhZHDS+6t/WSPXMF+Rs8nHVLk8/TiyKH2sCKxTYcs=; fh=kwtD2hwqQlovK7ZFEo+a1+lZVyuMpHjK7AWAyN3Ssmk=; b=ETOjaov45AQv5Z3Q9YT/rAVzSRDDaiIY0AZLI1Ii+SqKzhHBRBv4mQK7OpjvBV3i6W /N8FT2duMqnDAyDxFr3aH09jtAYzsB5OkyPfVv+zk5bSWW+toWxRcyPeyQST08ULvKHp aMC2bc7ov9WWDYko5JRs2ZTZiNZ2pVJ4Xvhlh3rIBGKhzKl0V06WW6Czvm7wB01Xxgh3 icuWx6lvpyxm3HrKt9DpdOrIp8871ohDCU49ui3ZPs0qpt1KDtUw07B1iuduSr1Hr7o4 1w97lQMOU5tF8V5pCIHeC03K6HS5i3OhaVEUtg0bRTSKs4ZasQez9/P387QFSNBDKje7 HGug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mev.co.uk header.s=20221208-6x11dpa4 header.b=on1dWPv7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=mev.co.uk Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id e6-20020a170902744600b001b7ecbbaa13si9713206plt.152.2023.09.13.05.40.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Sep 2023 05:40:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@mev.co.uk header.s=20221208-6x11dpa4 header.b=on1dWPv7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=mev.co.uk Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 570948090EA7; Wed, 13 Sep 2023 04:22:11 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240199AbjIMLVQ (ORCPT + 36 others); Wed, 13 Sep 2023 07:21:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57098 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240054AbjIMLVC (ORCPT ); Wed, 13 Sep 2023 07:21:02 -0400 Received: from smtp111.iad3b.emailsrvr.com (smtp111.iad3b.emailsrvr.com [146.20.161.111]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E8C872118 for ; Wed, 13 Sep 2023 04:20:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=mev.co.uk; s=20221208-6x11dpa4; t=1694604058; bh=x5etE6hQat85RKwGFWa9VifsFJ9wpy5aUmUk22feDXQ=; h=From:To:Subject:Date:From; b=on1dWPv79ZrarYZeofxCeBD2R05UZDrxylRLuA+zVLUn1pm8cx7R+Ht2YLE3S5sWO 0gxp/DH/aDB8/wcQa0R7vwFvGTe9EWVttg91eatXvj4Vh71YgROOm4a4zuW7MhpLR6 M6Q4X3nqzTSmf6ZV3d8ByMln0Sjdv5pBO1YPu4W8= X-Auth-ID: abbotti@mev.co.uk Received: by smtp6.relay.iad3b.emailsrvr.com (Authenticated sender: abbotti-AT-mev.co.uk) with ESMTPSA id 84871200C1; Wed, 13 Sep 2023 07:20:57 -0400 (EDT) From: Ian Abbott To: linux-kernel@vger.kernel.org Cc: Arnd Bergmann , Niklas Schnelle , Ian Abbott Subject: [PATCH 08/13] comedi: ni_labpc_common: Conditionally remove I/O port support Date: Wed, 13 Sep 2023 12:20:27 +0100 Message-Id: <20230913112032.90618-9-abbotti@mev.co.uk> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230913112032.90618-1-abbotti@mev.co.uk> References: <20230913112032.90618-1-abbotti@mev.co.uk> MIME-Version: 1.0 X-Classification-ID: e346d63c-f057-4595-b974-8be9cf32e1c1-9-1 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Wed, 13 Sep 2023 04:22:11 -0700 (PDT) X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1776926132721562160 X-GMAIL-MSGID: 1776926132721562160 In a future patch, the port I/O functions (`inb()`, `outb()`, and friends will only be declared in the `HAS_IOPORT` configuration option is enabled. The ni_labpc_common module is used by the ni_labpc module (for ISA cards), the ni_labpc_cs module (for PCMCIA cards), and the ni_labpc_pci module (for PCI cards). The ISA and PCMCIA cards use port I/O and the PCI cards use memory-mapped I/O. Conditionally compile the parts of the module that use the port I/O functions so they are compiled if and only if the `CONFIG_HAS_PORTIO` macro is defined, so that the module can be built if the port I/O functions have not been declared. Cc: Arnd Bergmann Cc: Niklas Schnelle Signed-off-by: Ian Abbott --- drivers/comedi/drivers/ni_labpc_common.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/comedi/drivers/ni_labpc_common.c b/drivers/comedi/drivers/ni_labpc_common.c index 5d5c1d0e9cb6..7170b4e98b5e 100644 --- a/drivers/comedi/drivers/ni_labpc_common.c +++ b/drivers/comedi/drivers/ni_labpc_common.c @@ -78,6 +78,9 @@ static const struct comedi_lrange range_labpc_ao = { * functions that do inb/outb and readb/writeb so we can use * function pointers to decide which to use */ + +#ifdef CONFIG_HAS_PORTIO + static unsigned int labpc_inb(struct comedi_device *dev, unsigned long reg) { return inb(dev->iobase + reg); @@ -89,6 +92,8 @@ static void labpc_outb(struct comedi_device *dev, outb(byte, dev->iobase + reg); } +#endif /* CONFIG_HAS_PORTIO */ + static unsigned int labpc_readb(struct comedi_device *dev, unsigned long reg) { return readb(dev->mmio + reg); @@ -1200,8 +1205,12 @@ int labpc_common_attach(struct comedi_device *dev, devpriv->read_byte = labpc_readb; devpriv->write_byte = labpc_writeb; } else { +#ifdef CONFIG_HAS_PORTIO devpriv->read_byte = labpc_inb; devpriv->write_byte = labpc_outb; +#else + return -ENXIO; +#endif } /* initialize board's command registers */